| ; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.getCompositionId = void 0; | |
| const renderer_1 = require("@remotion/renderer"); | |
| const studio_server_1 = require("@remotion/studio-server"); | |
| const log_1 = require("./log"); | |
| const show_compositions_picker_1 = require("./show-compositions-picker"); | |
| const getCompName = ({ cliArgs, compositionIdFromUi, }) => { | |
| if (compositionIdFromUi) { | |
| return { | |
| compName: compositionIdFromUi, | |
| remainingArgs: [], | |
| reason: 'via UI', | |
| }; | |
| } | |
| if (cliArgs.length === 0) { | |
| return null; | |
| } | |
| const [compName, ...remainingArgs] = cliArgs; | |
| return { | |
| compName: String(compName), | |
| remainingArgs, | |
| reason: 'Passed as argument', | |
| }; | |
| }; | |
| const getCompositionId = async ({ args, compositionIdFromUi, serializedInputPropsWithCustomSchema, puppeteerInstance, envVariables, timeoutInMilliseconds, chromiumOptions, port, browserExecutable, serveUrlOrWebpackUrl, logLevel, indent, server, offthreadVideoCacheSizeInBytes, offthreadVideoThreads, binariesDirectory, onBrowserDownload, chromeMode, mediaCacheSizeInBytes, preferredEffectBackend, }) => { | |
| const compNameResult = getCompName({ | |
| cliArgs: args, | |
| compositionIdFromUi, | |
| }); | |
| if (compNameResult) { | |
| const { metadata: config, propsSize } = await renderer_1.RenderInternals.internalSelectComposition({ | |
| id: compNameResult.compName, | |
| serializedInputPropsWithCustomSchema, | |
| puppeteerInstance, | |
| envVariables, | |
| timeoutInMilliseconds, | |
| serveUrl: serveUrlOrWebpackUrl, | |
| browserExecutable, | |
| chromiumOptions, | |
| port, | |
| logLevel, | |
| server, | |
| indent, | |
| onBrowserLog: null, | |
| offthreadVideoCacheSizeInBytes, | |
| offthreadVideoThreads, | |
| binariesDirectory, | |
| onBrowserDownload, | |
| onServeUrlVisited: () => undefined, | |
| chromeMode, | |
| mediaCacheSizeInBytes, | |
| preferredEffectBackend, | |
| }); | |
| if (propsSize > 10000000) { | |
| log_1.Log.warn({ | |
| indent, | |
| logLevel, | |
| }, `The props of your composition are large (${studio_server_1.StudioServerInternals.formatBytes(propsSize)}). This may cause slowdown.`); | |
| } | |
| if (!config) { | |
| throw new Error(`Cannot find composition with ID "${compNameResult.compName}"`); | |
| } | |
| return { | |
| compositionId: compNameResult.compName, | |
| reason: compNameResult.reason, | |
| config, | |
| argsAfterComposition: compNameResult.remainingArgs, | |
| }; | |
| } | |
| const comps = await renderer_1.RenderInternals.internalGetCompositions({ | |
| puppeteerInstance, | |
| envVariables, | |
| timeoutInMilliseconds, | |
| chromiumOptions, | |
| port, | |
| browserExecutable, | |
| logLevel, | |
| indent, | |
| server, | |
| serveUrlOrWebpackUrl, | |
| onBrowserLog: null, | |
| serializedInputPropsWithCustomSchema, | |
| offthreadVideoCacheSizeInBytes, | |
| offthreadVideoThreads, | |
| binariesDirectory, | |
| onBrowserDownload, | |
| chromeMode, | |
| mediaCacheSizeInBytes, | |
| preferredEffectBackend, | |
| onLog: renderer_1.RenderInternals.defaultOnLog, | |
| }); | |
| if (comps.length === 1) { | |
| return { | |
| compositionId: comps[0].id, | |
| reason: 'Only composition', | |
| config: comps[0], | |
| argsAfterComposition: args, | |
| }; | |
| } | |
| if (!process.env.CI) { | |
| const { compositionId, reason } = await (0, show_compositions_picker_1.showSingleCompositionsPicker)(comps, logLevel); | |
| if (compositionId && typeof compositionId === 'string') { | |
| return { | |
| compositionId, | |
| reason, | |
| config: comps.find((c) => c.id === compositionId), | |
| argsAfterComposition: args, | |
| }; | |
| } | |
| } | |
| log_1.Log.error({ indent: false, logLevel }, 'Composition ID not passed.'); | |
| log_1.Log.error({ indent: false, logLevel }, 'Pass an extra argument <composition-id>.'); | |
| process.exit(1); | |
| }; | |
| exports.getCompositionId = getCompositionId; | |
Xet Storage Details
- Size:
- 4.28 kB
- Xet hash:
- a0c769239f5b2a91f386af71e7b1389cfd2881e376e0e5f651168531e0d5cf5e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.