| ; | |
| var __importDefault = (this && this.__importDefault) || function (mod) { | |
| return (mod && mod.__esModule) ? mod : { "default": mod }; | |
| }; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.experimentalCodemodCommand = exports.printExperimentalCodemodHelp = void 0; | |
| const node_path_1 = __importDefault(require("node:path")); | |
| const client_1 = require("@remotion/renderer/client"); | |
| const minimist_1 = __importDefault(require("minimist")); | |
| const import_canvas_capture_1 = require("./import-canvas-capture"); | |
| const log_1 = require("./log"); | |
| const printExperimentalCodemodHelp = (logLevel) => { | |
| log_1.Log.info({ indent: false, logLevel }, [ | |
| 'Internal, unstable command. Arguments and behavior may change without notice.', | |
| '', | |
| 'bunx remotion experimental-codemod add-canvas-capture <file> --composition-file <Root.tsx> --id <composition-id>', | |
| '', | |
| '--width <pixels> Composition width (default: 1920)', | |
| '--height <pixels> Composition height (default: 1080)', | |
| '--fps <number> Composition and cursor keyframe FPS (default: 60)', | |
| '--public-dir <path> Public directory (default: configured directory or public/)', | |
| '--package-manager <name> Package manager used to install runtime dependencies', | |
| '--dry-run Generate changes without installing packages or writing files', | |
| ].join('\n')); | |
| }; | |
| exports.printExperimentalCodemodHelp = printExperimentalCodemodHelp; | |
| const experimentalCodemodCommand = async (remotionRoot, argv, logLevel) => { | |
| const commandLine = (0, minimist_1.default)(argv, { | |
| string: ['_', 'composition-file', 'id'], | |
| boolean: ['dry-run', 'help'], | |
| }); | |
| const [, command, captureFile] = commandLine._; | |
| if (commandLine.help || command === undefined) { | |
| (0, exports.printExperimentalCodemodHelp)(logLevel); | |
| return; | |
| } | |
| if (command !== 'add-canvas-capture') { | |
| throw new Error(`Unknown experimental codemod: ${command}. Use experimental-codemod --help.`); | |
| } | |
| const compositionFile = commandLine['composition-file']; | |
| const compositionId = commandLine.id; | |
| if (commandLine._.length !== 3 || | |
| typeof captureFile !== 'string' || | |
| !captureFile || | |
| typeof compositionFile !== 'string' || | |
| !compositionFile || | |
| typeof compositionId !== 'string' || | |
| !compositionId) { | |
| throw new Error('Usage: bunx remotion experimental-codemod add-canvas-capture <file> --composition-file <Root.tsx> --id <composition-id>'); | |
| } | |
| log_1.Log.warn({ indent: false, logLevel }, 'experimental-codemod is internal and unstable. Arguments and behavior may change without notice.'); | |
| const { overrideWidthOption, overrideHeightOption, overrideFpsOption, publicDirOption, packageManagerOption, } = client_1.BrowserSafeApis.options; | |
| const result = await (0, import_canvas_capture_1.importCanvasCapture)({ | |
| captureFile: node_path_1.default.resolve(captureFile), | |
| compositionFile, | |
| compositionId, | |
| remotionRoot, | |
| publicDir: publicDirOption.getValue({ commandLine }).value, | |
| width: overrideWidthOption.getValue({ commandLine }).value, | |
| height: overrideHeightOption.getValue({ commandLine }).value, | |
| fps: overrideFpsOption.getValue({ commandLine }).value, | |
| packageManager: packageManagerOption.getValue({ commandLine }).value, | |
| logLevel, | |
| dryRun: commandLine['dry-run'], | |
| }); | |
| log_1.Log.info({ indent: false, logLevel }, `${commandLine['dry-run'] ? 'Would import' : 'Imported'} Canvas Capture as "${result.compositionId}" (${result.metadata.width}×${result.metadata.height}, ${result.metadata.fps} fps, ${result.metadata.durationInFrames} frames)`); | |
| for (const file of [ | |
| result.compositionFile, | |
| result.componentFile, | |
| result.videoFile, | |
| ]) { | |
| log_1.Log.info({ indent: false, logLevel }, node_path_1.default.relative(remotionRoot, file)); | |
| } | |
| }; | |
| exports.experimentalCodemodCommand = experimentalCodemodCommand; | |
Xet Storage Details
- Size:
- 4.08 kB
- Xet hash:
- 27b3cc05c2e51fb7a615c0395f4f9951c108692a12b7eaa392090254503e91f2
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.