Commit 17d316f3 authored by suily's avatar suily
Browse files

Initial commit

parents
Pipeline #3368 failed with stages
in 0 seconds
{
"env": {
"production": {
"plugins": ["babel-plugin-strip-invariant"]
}
}
}
\ No newline at end of file
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
storybook-static
.env
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Test results
/coverage/
/test-results/
/playwright-report/
/playwright/.cache/
node_modules/
dist/
env.d.ts
\ No newline at end of file
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module.exports = {
root: true,
env: {browser: true, es2020: true},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:import/recommended',
'plugin:prettier/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
plugins: ['react-refresh'],
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {},
node: {},
},
},
rules: {
'no-console': 'warn',
curly: 'warn',
'react/jsx-no-useless-fragment': 'warn',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
},
],
'react-refresh/only-export-components': [
'warn',
{
allowConstantExport: true,
},
],
'react/react-in-jsx-scope': 'off',
},
};
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
storybook-static
.env
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Test results
/coverage/
/test-results/
/playwright-report/
/playwright/.cache/
node_modules/
dist/
\ No newline at end of file
{
"arrowParens": "avoid",
"bracketSameLine": true,
"bracketSpacing": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"endOfLine": "auto"
}
\ No newline at end of file
# Stage 1: Build Stage
FROM node:22.9.0 AS build
WORKDIR /app
# Copy package.json and yarn.lock
COPY package.json ./
COPY yarn.lock ./
# Install dependencies
RUN yarn install --frozen-lockfile
# Copy source code
COPY . .
# Build the application
RUN yarn build
# Stage 2: Production Stage
FROM nginx:latest
# Copy built files from the build stage to the production image
COPY --from=build /app/dist /usr/share/nginx/html
# Container startup command for the web server (nginx in this case)
CMD ["nginx", "-g", "daemon off;"]
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
<title>SAM 2 Demo | By Meta FAIR</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
{
"name": "frontend-vite",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"merge-schemas": "tsx schemas/merge-schemas",
"relay": "yarn merge-schemas && relay-compiler",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview --open"
},
"dependencies": {
"@carbon/icons-react": "^11.34.1",
"@heroicons/react": "^2.0.18",
"@monaco-editor/react": "^4.6.0",
"@stylexjs/stylex": "^0.6.1",
"graphql": "^16.8.1",
"immer": "^10.0.3",
"immutability-helper": "^3.1.1",
"jotai": "^2.6.1",
"jotai-immer": "^0.3.0",
"localforage": "^1.10.0",
"monaco-editor": "^0.48.0",
"mp4box": "^0.5.2",
"pts": "^0.12.8",
"react": "^18.2.0",
"react-daisyui": "^4.1.0",
"react-device-detect": "^2.2.3",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-error-boundary": "^4.0.11",
"react-photo-album": "^2.3.0",
"react-pts-canvas": "^0.5.2",
"react-relay": "^16.2.0",
"react-router-dom": "^6.15.0",
"relay-runtime": "^16.2.0",
"serialize-error": "^11.0.3",
"use-immer": "^0.9.0",
"use-resize-observer": "^9.1.0"
},
"devDependencies": {
"@graphql-tools/load-files": "^7.0.0",
"@graphql-tools/merge": "^9.0.4",
"@tailwindcss/typography": "^0.5.9",
"@types/dom-webcodecs": "^0.1.11",
"@types/invariant": "^2.2.37",
"@types/node": "^20.14.10",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.7",
"@types/react-relay": "^16.0.6",
"@types/relay-runtime": "^14.1.13",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.15",
"babel-plugin-relay": "^16.2.0",
"babel-plugin-strip-invariant": "^1.0.0",
"daisyui": "^3.6.3",
"eslint": "^8.48.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"invariant": "^2.2.4",
"postcss": "^8.4.28",
"postinstall-postinstall": "^2.1.0",
"prettier": "^3.0.3",
"relay-compiler": "^16.2.0",
"sass": "^1.66.1",
"strip-ansi": "^7.1.0",
"tailwindcss": "^3.3.3",
"tsx": "^4.16.2",
"typescript": ">=4.3.5 <5.4.0",
"vite": "^5.0.11",
"vite-plugin-babel": "^1.2.0",
"vite-plugin-relay": "^2.0.0",
"vite-plugin-stylex-dev": "^0.5.2"
},
"resolutions": {
"wrap-ansi": "7.0.0"
},
"relay": {
"src": "./src/",
"schema": "./schema.graphql",
"language": "typescript",
"eagerEsModules": true,
"exclude": [
"**/node_modules/**",
"**/__mocks__/**",
"**/__generated__/**"
]
}
}
\ No newline at end of file
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
plugins: {
'postcss-import': {},
'tailwindcss/nesting': {},
tailwindcss: {},
autoprefixer: {},
},
};
input AddPointsInput {
sessionId: String!
frameIndex: Int!
clearOldPoints: Boolean!
objectId: Int!
labels: [Int!]!
points: [[Float!]!]!
}
type CancelPropagateInVideo {
success: Boolean!
}
input CancelPropagateInVideoInput {
sessionId: String!
}
input ClearPointsInFrameInput {
sessionId: String!
frameIndex: Int!
objectId: Int!
}
type ClearPointsInVideo {
success: Boolean!
}
input ClearPointsInVideoInput {
sessionId: String!
}
type CloseSession {
success: Boolean!
}
input CloseSessionInput {
sessionId: String!
}
type Mutation {
startSession(input: StartSessionInput!): StartSession!
closeSession(input: CloseSessionInput!): CloseSession!
addPoints(input: AddPointsInput!): RLEMaskListOnFrame!
clearPointsInFrame(input: ClearPointsInFrameInput!): RLEMaskListOnFrame!
clearPointsInVideo(input: ClearPointsInVideoInput!): ClearPointsInVideo!
removeObject(input: RemoveObjectInput!): [RLEMaskListOnFrame!]!
cancelPropagateInVideo(
input: CancelPropagateInVideoInput!
): CancelPropagateInVideo!
createDeletionId: String!
acceptTos: Boolean!
acceptTermsOfService: String!
uploadVideo(
file: Upload!
startTimeSec: Float = null
durationTimeSec: Float = null
): Video!
uploadSharedVideo(file: Upload!): SharedVideo!
uploadAnnotations(file: Upload!): Boolean!
}
input PingInput {
sessionId: String!
}
type Pong {
success: Boolean!
}
type Query {
ping(input: PingInput!): Pong!
defaultVideo: Video!
videos(
"""
Returns the items in the list that come before the specified cursor.
"""
before: String = null
"""
Returns the items in the list that come after the specified cursor.
"""
after: String = null
"""
Returns the first n items from the list.
"""
first: Int = null
"""
Returns the items in the list that come after the specified cursor.
"""
last: Int = null
): VideoConnection!
sharedVideo(path: String!): SharedVideo!
}
type RLEMask {
size: [Int!]!
counts: String!
order: String!
}
type RLEMaskForObject {
objectId: Int!
rleMask: RLEMask!
}
type RLEMaskListOnFrame {
frameIndex: Int!
rleMaskList: [RLEMaskForObject!]!
}
input RemoveObjectInput {
sessionId: String!
objectId: Int!
}
type StartSession {
sessionId: String!
}
input StartSessionInput {
path: String!
}
"""
The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.
"""
scalar GlobalID
@specifiedBy(url: "https://relay.dev/graphql/objectidentification.htm")
"""
An object with a Globally Unique ID
"""
interface Node {
"""
The Globally Unique ID of this object
"""
id: GlobalID!
}
"""
Information to aid in pagination.
"""
type PageInfo {
"""
When paginating forwards, are there more items?
"""
hasNextPage: Boolean!
"""
When paginating backwards, are there more items?
"""
hasPreviousPage: Boolean!
"""
When paginating backwards, the cursor to continue.
"""
startCursor: String
"""
When paginating forwards, the cursor to continue.
"""
endCursor: String
}
type SharedVideo {
path: String!
url: String!
}
scalar Upload
type Video implements Node {
"""
The Globally Unique ID of this object
"""
id: GlobalID!
path: String!
posterPath: String
width: Int!
height: Int!
url: String!
posterUrl: String!
}
"""
A connection to a list of items.
"""
type VideoConnection {
"""
Pagination data for this connection
"""
pageInfo: PageInfo!
"""
Contains the nodes in this connection
"""
edges: [VideoEdge!]!
}
"""
An edge in a connection.
"""
type VideoEdge {
"""
A cursor for use in pagination
"""
cursor: String!
"""
The item at the end of the edge
"""
node: Video!
}
schema {
query: Query
mutation: Mutation
}
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
input AddPointsInput {
sessionId: String!
frameIndex: Int!
clearOldPoints: Boolean!
objectId: Int!
labels: [Int!]!
points: [[Float!]!]!
}
type CancelPropagateInVideo {
success: Boolean!
}
input CancelPropagateInVideoInput {
sessionId: String!
}
input ClearPointsInFrameInput {
sessionId: String!
frameIndex: Int!
objectId: Int!
}
type ClearPointsInVideo {
success: Boolean!
}
input ClearPointsInVideoInput {
sessionId: String!
}
type CloseSession {
success: Boolean!
}
input CloseSessionInput {
sessionId: String!
}
type Mutation {
startSession(input: StartSessionInput!): StartSession!
closeSession(input: CloseSessionInput!): CloseSession!
addPoints(input: AddPointsInput!): RLEMaskListOnFrame!
clearPointsInFrame(input: ClearPointsInFrameInput!): RLEMaskListOnFrame!
clearPointsInVideo(input: ClearPointsInVideoInput!): ClearPointsInVideo!
removeObject(input: RemoveObjectInput!): [RLEMaskListOnFrame!]!
cancelPropagateInVideo(
input: CancelPropagateInVideoInput!
): CancelPropagateInVideo!
}
input PingInput {
sessionId: String!
}
type Pong {
success: Boolean!
}
type Query {
ping(input: PingInput!): Pong!
}
type RLEMask {
size: [Int!]!
counts: String!
order: String!
}
type RLEMaskForObject {
objectId: Int!
rleMask: RLEMask!
}
type RLEMaskListOnFrame {
frameIndex: Int!
rleMaskList: [RLEMaskForObject!]!
}
input RemoveObjectInput {
sessionId: String!
objectId: Int!
}
type StartSession {
sessionId: String!
}
input StartSessionInput {
path: String!
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {loadFilesSync} from '@graphql-tools/load-files';
import {mergeTypeDefs} from '@graphql-tools/merge';
import fs from 'fs';
import {print} from 'graphql';
import path from 'path';
import * as prettier from 'prettier';
import {fileURLToPath} from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const loadedFiles = loadFilesSync(`${__dirname}/*.graphql`);
const typeDefs = mergeTypeDefs(loadedFiles);
const printedTypeDefs = print(typeDefs);
const prettyTypeDefs = await prettier.format(printedTypeDefs, {
parser: 'graphql',
});
fs.writeFileSync('schema.graphql', prettyTypeDefs);
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.
"""
scalar GlobalID
@specifiedBy(url: "https://relay.dev/graphql/objectidentification.htm")
type Mutation {
createDeletionId: String!
acceptTos: Boolean!
acceptTermsOfService: String!
uploadVideo(
file: Upload!
startTimeSec: Float = null
durationTimeSec: Float = null
): Video!
uploadSharedVideo(file: Upload!): SharedVideo!
uploadAnnotations(file: Upload!): Boolean!
}
"""
An object with a Globally Unique ID
"""
interface Node {
"""
The Globally Unique ID of this object
"""
id: GlobalID!
}
"""
Information to aid in pagination.
"""
type PageInfo {
"""
When paginating forwards, are there more items?
"""
hasNextPage: Boolean!
"""
When paginating backwards, are there more items?
"""
hasPreviousPage: Boolean!
"""
When paginating backwards, the cursor to continue.
"""
startCursor: String
"""
When paginating forwards, the cursor to continue.
"""
endCursor: String
}
type Query {
defaultVideo: Video!
videos(
"""
Returns the items in the list that come before the specified cursor.
"""
before: String = null
"""
Returns the items in the list that come after the specified cursor.
"""
after: String = null
"""
Returns the first n items from the list.
"""
first: Int = null
"""
Returns the items in the list that come after the specified cursor.
"""
last: Int = null
): VideoConnection!
sharedVideo(path: String!): SharedVideo!
}
type SharedVideo {
path: String!
url: String!
}
scalar Upload
type Video implements Node {
"""
The Globally Unique ID of this object
"""
id: GlobalID!
path: String!
posterPath: String
width: Int!
height: Int!
url: String!
posterUrl: String!
}
"""
A connection to a list of items.
"""
type VideoConnection {
"""
Pagination data for this connection
"""
pageInfo: PageInfo!
"""
Contains the nodes in this connection
"""
edges: [VideoEdge!]!
}
"""
An edge in a connection.
"""
type VideoEdge {
"""
A cursor for use in pagination
"""
cursor: String!
"""
The item at the end of the edge
"""
node: Video!
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment