@remotion/cli 4.0.0-alpha5 → 4.0.0-alpha7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/benchmark.js +9 -4
- package/dist/better-opn/index.js +3 -3
- package/dist/chalk/index.d.ts +45 -54
- package/dist/chalk/index.js +2 -135
- package/dist/codemods/stringify-with-path.d.ts +5 -0
- package/dist/codemods/stringify-with-path.js +44 -0
- package/dist/codemods/update-default-props.d.ts +3 -1
- package/dist/codemods/update-default-props.js +3 -17
- package/dist/color-math.js +3 -1
- package/dist/compositions.js +1 -0
- package/dist/config/log.d.ts +1 -3
- package/dist/config/log.js +2 -9
- package/dist/convert-entry-point-to-serve-url.js +2 -2
- package/dist/download-progress.d.ts +1 -1
- package/dist/download-progress.js +1 -5
- package/dist/editor/components/MenuToolbar.js +15 -3
- package/dist/editor/components/NewComposition/ComboBox.js +2 -2
- package/dist/editor/components/NewComposition/MenuContent.js +1 -1
- package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
- package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
- package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
- package/dist/editor/components/RenderModal/CliCopyButton.js +42 -9
- package/dist/editor/components/RenderModal/InfoTooltip.js +2 -1
- package/dist/editor/components/RenderModal/OptionExplainer.js +13 -3
- package/dist/editor/components/RenderModal/RenderModalData.js +21 -7
- package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
- package/dist/editor/components/RenderModal/RenderModalPicture.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +3 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +8 -8
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +5 -5
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +3 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +3 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -4
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +9 -6
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +40 -7
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +16 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +73 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +5 -5
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +4 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -0
- package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +126 -0
- package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +12 -0
- package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +32 -0
- package/dist/editor/components/RenderModal/get-render-modal-warnings.d.ts +3 -2
- package/dist/editor/components/RenderModal/get-render-modal-warnings.js +9 -2
- package/dist/editor/components/RenderQueue/actions.d.ts +2 -1
- package/dist/editor/components/RenderQueue/actions.js +8 -4
- package/dist/editor/components/SidebarCollapserControls.js +12 -6
- package/dist/editor/components/Timeline/TimelineSequence.js +6 -4
- package/dist/editor/helpers/calculate-timeline.js +1 -1
- package/dist/editor/helpers/colors.d.ts +1 -1
- package/dist/editor/helpers/colors.js +1 -1
- package/dist/entry-point.js +17 -17
- package/dist/ffmpeg.js +12 -3
- package/dist/file-watcher.js +5 -5
- package/dist/get-cli-options.js +4 -4
- package/dist/get-config-file-name.js +6 -6
- package/dist/get-env.js +10 -10
- package/dist/get-input-props.js +9 -9
- package/dist/get-network-address.js +2 -2
- package/dist/handle-common-errors.d.ts +2 -1
- package/dist/handle-common-errors.js +2 -2
- package/dist/index.d.ts +9 -5
- package/dist/index.js +4 -1
- package/dist/load-config.js +8 -8
- package/dist/log.d.ts +5 -5
- package/dist/log.js +3 -42
- package/dist/parse-command-line.d.ts +1 -0
- package/dist/preview-server/api-types.d.ts +1 -1
- package/dist/preview-server/dev-middleware/compatible-api.d.ts +2 -2
- package/dist/preview-server/dev-middleware/middleware.d.ts +1 -1
- package/dist/preview-server/dev-middleware/middleware.js +7 -7
- package/dist/preview-server/dev-middleware/setup-hooks.js +2 -2
- package/dist/preview-server/error-overlay/react-overlay/utils/get-file-source.js +5 -5
- package/dist/preview-server/error-overlay/react-overlay/utils/open-in-editor.js +17 -17
- package/dist/preview-server/file-existence-watchers.js +3 -3
- package/dist/preview-server/get-absolute-public-dir.js +3 -3
- package/dist/preview-server/get-package-manager.js +3 -3
- package/dist/preview-server/handler.d.ts +1 -1
- package/dist/preview-server/hot-middleware/index.d.ts +1 -1
- package/dist/preview-server/hot-middleware/index.js +2 -2
- package/dist/preview-server/live-events.d.ts +1 -1
- package/dist/preview-server/parse-body.d.ts +1 -1
- package/dist/preview-server/project-info.js +5 -5
- package/dist/preview-server/public-folder.js +8 -8
- package/dist/preview-server/render-queue/job.d.ts +2 -0
- package/dist/preview-server/render-queue/open-directory-in-finder.js +8 -8
- package/dist/preview-server/render-queue/queue.js +4 -3
- package/dist/preview-server/routes/can-update-default-props.js +3 -2
- package/dist/preview-server/routes/update-default-props.js +7 -6
- package/dist/preview-server/routes.d.ts +1 -1
- package/dist/preview-server/routes.js +8 -8
- package/dist/preview-server/serve-static.d.ts +1 -1
- package/dist/preview-server/serve-static.js +7 -7
- package/dist/preview-server/start-server.js +2 -2
- package/dist/preview.js +4 -4
- package/dist/print-error.d.ts +2 -1
- package/dist/print-error.js +8 -5
- package/dist/progress-bar.d.ts +5 -4
- package/dist/progress-bar.js +42 -29
- package/dist/render-flows/render.js +50 -23
- package/dist/render-flows/still.js +20 -15
- package/dist/resolve-from.js +5 -5
- package/dist/setup-cache.d.ts +2 -1
- package/dist/setup-cache.js +8 -4
- package/dist/should-use-non-overlaying-logger.d.ts +4 -0
- package/dist/should-use-non-overlaying-logger.js +12 -0
- package/dist/upgrade.js +2 -2
- package/dist/user-passed-output-location.js +7 -2
- package/dist/versions.js +2 -2
- package/package.json +7 -7
- package/dist/ansi/ansi-regex.d.ts +0 -2
- package/dist/ansi/ansi-regex.js +0 -18
- package/dist/config/ffmpeg-executable.d.ts +0 -5
- package/dist/config/ffmpeg-executable.js +0 -21
- package/dist/config/quality.d.ts +0 -2
- package/dist/config/quality.js +0 -17
- package/dist/editor/components/ClipboardIcon.d.ts +0 -2
- package/dist/editor/components/ClipboardIcon.js +0 -12
- package/dist/editor/components/CollapsedCompositionSelector.d.ts +0 -4
- package/dist/editor/components/CollapsedCompositionSelector.js +0 -39
- package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.d.ts +0 -6
- package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.js +0 -24
- package/dist/editor/components/RichTimelineToggle.d.ts +0 -2
- package/dist/editor/components/RichTimelineToggle.js +0 -29
- package/dist/editor/components/Thumbnail.d.ts +0 -8
- package/dist/editor/components/Thumbnail.js +0 -76
- package/dist/editor/helpers/use-compact-ui.d.ts +0 -1
- package/dist/editor/helpers/use-compact-ui.js +0 -18
- package/dist/editor/icons/film.d.ts +0 -3
- package/dist/editor/icons/film.js +0 -8
- package/dist/editor/icons/timeline.d.ts +0 -3
- package/dist/editor/icons/timeline.js +0 -9
- package/dist/editor/state/rich-timeline.d.ts +0 -9
- package/dist/editor/state/rich-timeline.js +0 -17
- package/dist/get-render-media-options.d.ts +0 -8
- package/dist/get-render-media-options.js +0 -55
- package/dist/install.d.ts +0 -2
- package/dist/install.js +0 -36
- package/dist/is-javascript.d.ts +0 -2
- package/dist/is-javascript.js +0 -9
- package/dist/preview-server/dev-middleware/is-color-supported.d.ts +0 -1
- package/dist/preview-server/dev-middleware/is-color-supported.js +0 -37
- package/dist/preview-server/hot-middleware/strip-ansi.d.ts +0 -1
- package/dist/preview-server/hot-middleware/strip-ansi.js +0 -21
package/dist/entry-point.js
CHANGED
|
@@ -5,20 +5,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.findEntryPoint = void 0;
|
|
7
7
|
const renderer_1 = require("@remotion/renderer");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const config_1 = require("./config");
|
|
11
11
|
const log_1 = require("./log");
|
|
12
12
|
const candidates = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
node_path_1.default.join('src', 'index.ts'),
|
|
14
|
+
node_path_1.default.join('src', 'index.tsx'),
|
|
15
|
+
node_path_1.default.join('src', 'index.js'),
|
|
16
|
+
node_path_1.default.join('remotion', 'index.tsx'),
|
|
17
|
+
node_path_1.default.join('remotion', 'index.ts'),
|
|
18
|
+
node_path_1.default.join('remotion', 'index.js'),
|
|
19
19
|
];
|
|
20
20
|
const findCommonPath = (remotionRoot) => {
|
|
21
|
-
return candidates.find((candidate) => (0,
|
|
21
|
+
return candidates.find((candidate) => (0, node_fs_1.existsSync)(node_path_1.default.resolve(remotionRoot, candidate)));
|
|
22
22
|
};
|
|
23
23
|
const findEntryPoint = (args, remotionRoot) => {
|
|
24
24
|
const result = findEntryPointInner(args, remotionRoot);
|
|
@@ -28,10 +28,10 @@ const findEntryPoint = (args, remotionRoot) => {
|
|
|
28
28
|
if (renderer_1.RenderInternals.isServeUrl(result.file)) {
|
|
29
29
|
return result;
|
|
30
30
|
}
|
|
31
|
-
if (!(0,
|
|
31
|
+
if (!(0, node_fs_1.existsSync)(result.file)) {
|
|
32
32
|
throw new Error(`${result.file} was chosen as the entry point (reason = ${result.reason}) but it does not exist.`);
|
|
33
33
|
}
|
|
34
|
-
if ((0,
|
|
34
|
+
if ((0, node_fs_1.lstatSync)(result.file).isDirectory()) {
|
|
35
35
|
throw new Error(`${result.file} was chosen as the entry point (reason = ${result.reason}) but it is a directory - it needs to be a file.`);
|
|
36
36
|
}
|
|
37
37
|
return result;
|
|
@@ -42,10 +42,10 @@ const findEntryPointInner = (args, remotionRoot) => {
|
|
|
42
42
|
let file = args[0];
|
|
43
43
|
if (file) {
|
|
44
44
|
log_1.Log.verbose('Checking if', file, 'is the entry file');
|
|
45
|
-
const cwdResolution =
|
|
46
|
-
const remotionRootResolution =
|
|
45
|
+
const cwdResolution = node_path_1.default.resolve(process.cwd(), file);
|
|
46
|
+
const remotionRootResolution = node_path_1.default.resolve(remotionRoot, file);
|
|
47
47
|
// Checking if file was found in CWD
|
|
48
|
-
if ((0,
|
|
48
|
+
if ((0, node_fs_1.existsSync)(cwdResolution)) {
|
|
49
49
|
return {
|
|
50
50
|
file: cwdResolution,
|
|
51
51
|
remainingArgs: args.slice(1),
|
|
@@ -53,7 +53,7 @@ const findEntryPointInner = (args, remotionRoot) => {
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
// Checking if file was found in remotion root
|
|
56
|
-
if ((0,
|
|
56
|
+
if ((0, node_fs_1.existsSync)(remotionRootResolution)) {
|
|
57
57
|
return {
|
|
58
58
|
file: remotionRootResolution,
|
|
59
59
|
remainingArgs: args.slice(1),
|
|
@@ -69,7 +69,7 @@ const findEntryPointInner = (args, remotionRoot) => {
|
|
|
69
69
|
if (file) {
|
|
70
70
|
log_1.Log.verbose('Entry point from config file is', file);
|
|
71
71
|
return {
|
|
72
|
-
file:
|
|
72
|
+
file: node_path_1.default.resolve(remotionRoot, file),
|
|
73
73
|
remainingArgs: args,
|
|
74
74
|
reason: 'config file',
|
|
75
75
|
};
|
|
@@ -77,7 +77,7 @@ const findEntryPointInner = (args, remotionRoot) => {
|
|
|
77
77
|
// 3rd priority: Common paths
|
|
78
78
|
const found = findCommonPath(remotionRoot);
|
|
79
79
|
if (found) {
|
|
80
|
-
const absolutePath =
|
|
80
|
+
const absolutePath = node_path_1.default.resolve(remotionRoot, found);
|
|
81
81
|
log_1.Log.verbose('Selected', absolutePath, 'as the entry point because file exists and is a common entry point and no entry point was explicitly selected');
|
|
82
82
|
return {
|
|
83
83
|
file: absolutePath,
|
package/dist/ffmpeg.js
CHANGED
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ffprobeCommand = exports.ffmpegCommand = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
const
|
|
5
|
+
const node_child_process_1 = require("node:child_process");
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
6
7
|
const ffmpegCommand = (_root, args) => {
|
|
7
|
-
const
|
|
8
|
+
const binary = renderer_1.RenderInternals.getExecutablePath('ffmpeg');
|
|
9
|
+
if (!process.env.READ_ONLY_FS) {
|
|
10
|
+
(0, node_fs_1.chmodSync)(binary, 0o755);
|
|
11
|
+
}
|
|
12
|
+
const done = (0, node_child_process_1.spawnSync)(binary, args, {
|
|
8
13
|
...renderer_1.RenderInternals.dynamicLibraryPathOptions(),
|
|
9
14
|
stdio: 'inherit',
|
|
10
15
|
});
|
|
@@ -12,7 +17,11 @@ const ffmpegCommand = (_root, args) => {
|
|
|
12
17
|
};
|
|
13
18
|
exports.ffmpegCommand = ffmpegCommand;
|
|
14
19
|
const ffprobeCommand = (_root, args) => {
|
|
15
|
-
const
|
|
20
|
+
const binary = renderer_1.RenderInternals.getExecutablePath('ffprobe');
|
|
21
|
+
if (!process.env.READ_ONLY_FS) {
|
|
22
|
+
(0, node_fs_1.chmodSync)(binary, 0o755);
|
|
23
|
+
}
|
|
24
|
+
const done = (0, node_child_process_1.spawnSync)(binary, args, {
|
|
16
25
|
...renderer_1.RenderInternals.dynamicLibraryPathOptions(),
|
|
17
26
|
stdio: 'inherit',
|
|
18
27
|
});
|
package/dist/file-watcher.js
CHANGED
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.installFileWatcher = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const installFileWatcher = ({ file, onChange, }) => {
|
|
9
|
-
const existedAtBeginning =
|
|
9
|
+
const existedAtBeginning = node_fs_1.default.existsSync(file);
|
|
10
10
|
let existedBefore = existedAtBeginning;
|
|
11
11
|
const listener = () => {
|
|
12
|
-
const existsNow =
|
|
12
|
+
const existsNow = node_fs_1.default.existsSync(file);
|
|
13
13
|
if (!existedBefore && existsNow) {
|
|
14
14
|
onChange('created');
|
|
15
15
|
existedBefore = true;
|
|
@@ -24,11 +24,11 @@ const installFileWatcher = ({ file, onChange, }) => {
|
|
|
24
24
|
onChange('changed');
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
node_fs_1.default.watchFile(file, { interval: 100 }, listener);
|
|
28
28
|
return {
|
|
29
29
|
exists: existedAtBeginning,
|
|
30
30
|
unwatch: () => {
|
|
31
|
-
|
|
31
|
+
node_fs_1.default.unwatchFile(file, listener);
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
34
|
};
|
package/dist/get-cli-options.js
CHANGED
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getCliOptions = exports.getAndValidateAbsoluteOutputFile = void 0;
|
|
7
7
|
const renderer_1 = require("@remotion/renderer");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const config_1 = require("./config");
|
|
11
11
|
const get_env_1 = require("./get-env");
|
|
12
12
|
const get_input_props_1 = require("./get-input-props");
|
|
@@ -22,8 +22,8 @@ const getAndValidateFrameRange = () => {
|
|
|
22
22
|
};
|
|
23
23
|
const getBrowser = () => { var _a; return (_a = config_1.ConfigInternals.getBrowser()) !== null && _a !== void 0 ? _a : renderer_1.RenderInternals.DEFAULT_BROWSER; };
|
|
24
24
|
const getAndValidateAbsoluteOutputFile = (relativeOutputLocation, overwrite) => {
|
|
25
|
-
const absoluteOutputFile =
|
|
26
|
-
if (
|
|
25
|
+
const absoluteOutputFile = node_path_1.default.resolve(process.cwd(), relativeOutputLocation);
|
|
26
|
+
if (node_fs_1.default.existsSync(absoluteOutputFile) && !overwrite) {
|
|
27
27
|
log_1.Log.error(`File at ${absoluteOutputFile} already exists. Use --overwrite to overwrite.`);
|
|
28
28
|
process.exit(1);
|
|
29
29
|
}
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.loadConfig = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const load_config_1 = require("./load-config");
|
|
10
10
|
const log_1 = require("./log");
|
|
11
11
|
const parse_command_line_1 = require("./parse-command-line");
|
|
@@ -13,8 +13,8 @@ const defaultConfigFileJavascript = 'remotion.config.js';
|
|
|
13
13
|
const defaultConfigFileTypescript = 'remotion.config.ts';
|
|
14
14
|
const loadConfig = (remotionRoot) => {
|
|
15
15
|
if (parse_command_line_1.parsedCli.config) {
|
|
16
|
-
const fullPath =
|
|
17
|
-
if (!(0,
|
|
16
|
+
const fullPath = node_path_1.default.resolve(process.cwd(), parse_command_line_1.parsedCli.config);
|
|
17
|
+
if (!(0, node_fs_1.existsSync)(fullPath)) {
|
|
18
18
|
log_1.Log.error(`You specified a config file location of "${parse_command_line_1.parsedCli.config}" but no file under ${fullPath} was found.`);
|
|
19
19
|
process.exit(1);
|
|
20
20
|
}
|
|
@@ -23,10 +23,10 @@ const loadConfig = (remotionRoot) => {
|
|
|
23
23
|
if (remotionRoot === null) {
|
|
24
24
|
return Promise.resolve(null);
|
|
25
25
|
}
|
|
26
|
-
if ((0,
|
|
26
|
+
if ((0, node_fs_1.existsSync)(node_path_1.default.resolve(remotionRoot, defaultConfigFileTypescript))) {
|
|
27
27
|
return (0, load_config_1.loadConfigFile)(remotionRoot, defaultConfigFileTypescript, false);
|
|
28
28
|
}
|
|
29
|
-
if ((0,
|
|
29
|
+
if ((0, node_fs_1.existsSync)(node_path_1.default.resolve(remotionRoot, defaultConfigFileJavascript))) {
|
|
30
30
|
return (0, load_config_1.loadConfigFile)(remotionRoot, defaultConfigFileJavascript, true);
|
|
31
31
|
}
|
|
32
32
|
return Promise.resolve(null);
|
package/dist/get-env.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getEnvironmentVariables = void 0;
|
|
7
7
|
const renderer_1 = require("@remotion/renderer");
|
|
8
8
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
11
|
const chalk_1 = require("./chalk");
|
|
12
12
|
const config_1 = require("./config");
|
|
13
13
|
const file_watcher_1 = require("./file-watcher");
|
|
@@ -23,7 +23,7 @@ function getProcessEnv() {
|
|
|
23
23
|
}
|
|
24
24
|
const watchEnvFile = ({ processEnv, envFile, onUpdate, }) => {
|
|
25
25
|
const updateFile = async () => {
|
|
26
|
-
const file = await
|
|
26
|
+
const file = await node_fs_1.default.promises.readFile(envFile, 'utf-8');
|
|
27
27
|
onUpdate({
|
|
28
28
|
...processEnv,
|
|
29
29
|
...dotenv_1.default.parse(file),
|
|
@@ -54,7 +54,7 @@ const watchEnvFile = ({ processEnv, envFile, onUpdate, }) => {
|
|
|
54
54
|
};
|
|
55
55
|
const getEnvForEnvFile = async (processEnv, envFile, onUpdate) => {
|
|
56
56
|
try {
|
|
57
|
-
const envFileData = await
|
|
57
|
+
const envFileData = await node_fs_1.default.promises.readFile(envFile);
|
|
58
58
|
if (onUpdate) {
|
|
59
59
|
watchEnvFile({ processEnv, envFile, onUpdate });
|
|
60
60
|
}
|
|
@@ -72,8 +72,8 @@ const getEnvForEnvFile = async (processEnv, envFile, onUpdate) => {
|
|
|
72
72
|
const getEnvironmentVariables = (onUpdate) => {
|
|
73
73
|
const processEnv = getProcessEnv();
|
|
74
74
|
if (parse_command_line_1.parsedCli['env-file']) {
|
|
75
|
-
const envFile =
|
|
76
|
-
if (!
|
|
75
|
+
const envFile = node_path_1.default.resolve(process.cwd(), parse_command_line_1.parsedCli['env-file']);
|
|
76
|
+
if (!node_fs_1.default.existsSync(envFile)) {
|
|
77
77
|
log_1.Log.error('You passed a --env-file but it could not be found.');
|
|
78
78
|
log_1.Log.error('We looked for the file at:', envFile);
|
|
79
79
|
log_1.Log.error('Check that your path is correct and try again.');
|
|
@@ -84,8 +84,8 @@ const getEnvironmentVariables = (onUpdate) => {
|
|
|
84
84
|
const remotionRoot = renderer_1.RenderInternals.findRemotionRoot();
|
|
85
85
|
const configFileSetting = config_1.ConfigInternals.getDotEnvLocation();
|
|
86
86
|
if (configFileSetting) {
|
|
87
|
-
const envFile =
|
|
88
|
-
if (!
|
|
87
|
+
const envFile = node_path_1.default.resolve(remotionRoot, configFileSetting);
|
|
88
|
+
if (!node_fs_1.default.existsSync(envFile)) {
|
|
89
89
|
log_1.Log.error('You specified a custom .env file using `Config.setDotEnvLocation()` in the config file but it could not be found');
|
|
90
90
|
log_1.Log.error('We looked for the file at:', envFile);
|
|
91
91
|
log_1.Log.error('Check that your path is correct and try again.');
|
|
@@ -93,8 +93,8 @@ const getEnvironmentVariables = (onUpdate) => {
|
|
|
93
93
|
}
|
|
94
94
|
return getEnvForEnvFile(processEnv, envFile, onUpdate);
|
|
95
95
|
}
|
|
96
|
-
const defaultEnvFile =
|
|
97
|
-
if (!
|
|
96
|
+
const defaultEnvFile = node_path_1.default.resolve(remotionRoot, '.env');
|
|
97
|
+
if (!node_fs_1.default.existsSync(defaultEnvFile)) {
|
|
98
98
|
if (onUpdate) {
|
|
99
99
|
watchEnvFile({
|
|
100
100
|
processEnv,
|
package/dist/get-input-props.js
CHANGED
|
@@ -4,23 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getInputProps = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const log_1 = require("./log");
|
|
11
11
|
const parse_command_line_1 = require("./parse-command-line");
|
|
12
12
|
const getInputProps = (onUpdate) => {
|
|
13
13
|
if (!parse_command_line_1.parsedCli.props) {
|
|
14
14
|
return {};
|
|
15
15
|
}
|
|
16
|
-
const jsonFile =
|
|
16
|
+
const jsonFile = node_path_1.default.resolve(process.cwd(), parse_command_line_1.parsedCli.props);
|
|
17
17
|
try {
|
|
18
|
-
if (
|
|
19
|
-
const rawJsonData =
|
|
18
|
+
if (node_fs_1.default.existsSync(jsonFile)) {
|
|
19
|
+
const rawJsonData = node_fs_1.default.readFileSync(jsonFile, 'utf-8');
|
|
20
20
|
if (onUpdate) {
|
|
21
|
-
|
|
21
|
+
node_fs_1.default.watchFile(jsonFile, { interval: 100 }, () => {
|
|
22
22
|
try {
|
|
23
|
-
onUpdate(JSON.parse(
|
|
23
|
+
onUpdate(JSON.parse(node_fs_1.default.readFileSync(jsonFile, 'utf-8')));
|
|
24
24
|
log_1.Log.info(`Updated input props from ${jsonFile}.`);
|
|
25
25
|
}
|
|
26
26
|
catch (err) {
|
|
@@ -36,7 +36,7 @@ const getInputProps = (onUpdate) => {
|
|
|
36
36
|
log_1.Log.error('You passed --props but it was neither valid JSON nor a file path to a valid JSON file.');
|
|
37
37
|
log_1.Log.info('Got the following value:', parse_command_line_1.parsedCli.props);
|
|
38
38
|
log_1.Log.error('Check that your input is parseable using `JSON.parse` and try again.');
|
|
39
|
-
if (
|
|
39
|
+
if (node_os_1.default.platform() === 'win32') {
|
|
40
40
|
log_1.Log.warn('Note: Windows handles escaping of quotes very weirdly in the command line.');
|
|
41
41
|
log_1.Log.warn('This might have led to you having this problem.');
|
|
42
42
|
log_1.Log.warn('Consider using the alternative API for --props which is to pass');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNetworkAddress = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_os_1 = require("node:os");
|
|
5
5
|
const getNetworkAddress = () => {
|
|
6
|
-
for (const interfaceDetails of Object.values((0,
|
|
6
|
+
for (const interfaceDetails of Object.values((0, node_os_1.networkInterfaces)())) {
|
|
7
7
|
if (!interfaceDetails)
|
|
8
8
|
continue;
|
|
9
9
|
for (const details of interfaceDetails) {
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { LogLevel } from '@remotion/renderer';
|
|
2
|
+
export declare const handleCommonError: (err: Error, logLevel: LogLevel) => Promise<void>;
|
|
@@ -5,9 +5,9 @@ const chalk_1 = require("./chalk");
|
|
|
5
5
|
const log_1 = require("./log");
|
|
6
6
|
const print_error_1 = require("./print-error");
|
|
7
7
|
const truthy_1 = require("./truthy");
|
|
8
|
-
const handleCommonError = async (err) => {
|
|
8
|
+
const handleCommonError = async (err, logLevel) => {
|
|
9
9
|
var _a;
|
|
10
|
-
await (0, print_error_1.printError)(err);
|
|
10
|
+
await (0, print_error_1.printError)(err, logLevel);
|
|
11
11
|
if (err.message.includes('Could not play video with')) {
|
|
12
12
|
log_1.Log.info();
|
|
13
13
|
log_1.Log.info('💡 Get help for this issue at https://remotion.dev/docs/media-playback-error');
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export declare const CliInternals: {
|
|
|
5
5
|
createOverwriteableCliOutput: (options: {
|
|
6
6
|
quiet: boolean;
|
|
7
7
|
cancelSignal: import("@remotion/renderer").CancelSignal | null;
|
|
8
|
+
updatesDontOverwrite: boolean;
|
|
9
|
+
indent: boolean;
|
|
8
10
|
}) => import("./progress-bar").OverwriteableCliOutput;
|
|
9
11
|
chalk: {
|
|
10
12
|
enabled: boolean;
|
|
@@ -31,7 +33,6 @@ export declare const CliInternals: {
|
|
|
31
33
|
yellow: (str: string) => string;
|
|
32
34
|
blue: (str: string) => string;
|
|
33
35
|
magenta: (str: string) => string;
|
|
34
|
-
cyan: (str: string) => string;
|
|
35
36
|
white: (str: string) => string;
|
|
36
37
|
gray: (str: string) => string;
|
|
37
38
|
bgBlack: (str: string) => string;
|
|
@@ -40,7 +41,6 @@ export declare const CliInternals: {
|
|
|
40
41
|
bgYellow: (str: string) => string;
|
|
41
42
|
bgBlue: (str: string) => string;
|
|
42
43
|
bgMagenta: (str: string) => string;
|
|
43
|
-
bgCyan: (str: string) => string;
|
|
44
44
|
bgWhite: (str: string) => string;
|
|
45
45
|
blackBright: (str: string) => string;
|
|
46
46
|
redBright: (str: string) => string;
|
|
@@ -48,7 +48,6 @@ export declare const CliInternals: {
|
|
|
48
48
|
yellowBright: (str: string) => string;
|
|
49
49
|
blueBright: (str: string) => string;
|
|
50
50
|
magentaBright: (str: string) => string;
|
|
51
|
-
cyanBright: (str: string) => string;
|
|
52
51
|
whiteBright: (str: string) => string;
|
|
53
52
|
bgBlackBright: (str: string) => string;
|
|
54
53
|
bgRedBright: (str: string) => string;
|
|
@@ -56,7 +55,6 @@ export declare const CliInternals: {
|
|
|
56
55
|
bgYellowBright: (str: string) => string;
|
|
57
56
|
bgBlueBright: (str: string) => string;
|
|
58
57
|
bgMagentaBright: (str: string) => string;
|
|
59
|
-
bgCyanBright: (str: string) => string;
|
|
60
58
|
bgWhiteBright: (str: string) => string;
|
|
61
59
|
};
|
|
62
60
|
makeProgressBar: (percentage: number) => string;
|
|
@@ -65,6 +63,8 @@ export declare const CliInternals: {
|
|
|
65
63
|
verboseAdvanced: (options: {
|
|
66
64
|
indent: boolean;
|
|
67
65
|
logLevel: "verbose" | "info" | "warn" | "error";
|
|
66
|
+
} & {
|
|
67
|
+
tag?: string | undefined;
|
|
68
68
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
69
69
|
info: (message?: any, ...optionalParams: any[]) => void;
|
|
70
70
|
infoAdvanced: (options: {
|
|
@@ -139,6 +139,7 @@ export declare const CliInternals: {
|
|
|
139
139
|
"audio-codec": "mp3" | "aac" | "pcm-16" | "opus";
|
|
140
140
|
crf: number;
|
|
141
141
|
force: boolean;
|
|
142
|
+
output: string;
|
|
142
143
|
overwrite: boolean;
|
|
143
144
|
png: boolean;
|
|
144
145
|
props: string;
|
|
@@ -171,7 +172,7 @@ export declare const CliInternals: {
|
|
|
171
172
|
} & {
|
|
172
173
|
_: string[];
|
|
173
174
|
};
|
|
174
|
-
handleCommonError: (err: Error) => Promise<void>;
|
|
175
|
+
handleCommonError: (err: Error, logLevel: "verbose" | "info" | "warn" | "error") => Promise<void>;
|
|
175
176
|
formatBytes: (number: number, options?: Intl.NumberFormatOptions & {
|
|
176
177
|
locale: string;
|
|
177
178
|
bits?: boolean | undefined;
|
|
@@ -216,4 +217,7 @@ export declare const CliInternals: {
|
|
|
216
217
|
reason: string;
|
|
217
218
|
};
|
|
218
219
|
listOfRemotionPackages: string[];
|
|
220
|
+
shouldUseNonOverlayingLogger: ({ logLevel, }: {
|
|
221
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
222
|
+
}) => boolean;
|
|
219
223
|
};
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ const benchmark_1 = require("./benchmark");
|
|
|
24
24
|
const chalk_1 = require("./chalk");
|
|
25
25
|
const cleanup_before_quit_1 = require("./cleanup-before-quit");
|
|
26
26
|
const compositions_1 = require("./compositions");
|
|
27
|
+
const config_1 = require("./config");
|
|
27
28
|
const determine_image_format_1 = require("./determine-image-format");
|
|
28
29
|
const download_progress_1 = require("./download-progress");
|
|
29
30
|
const entry_point_1 = require("./entry-point");
|
|
@@ -46,6 +47,7 @@ const print_help_1 = require("./print-help");
|
|
|
46
47
|
const progress_bar_1 = require("./progress-bar");
|
|
47
48
|
const render_1 = require("./render");
|
|
48
49
|
const select_composition_1 = require("./select-composition");
|
|
50
|
+
const should_use_non_overlaying_logger_1 = require("./should-use-non-overlaying-logger");
|
|
49
51
|
const still_1 = require("./still");
|
|
50
52
|
const upgrade_1 = require("./upgrade");
|
|
51
53
|
const versions_1 = require("./versions");
|
|
@@ -107,7 +109,7 @@ const cli = async () => {
|
|
|
107
109
|
}
|
|
108
110
|
catch (err) {
|
|
109
111
|
log_1.Log.info();
|
|
110
|
-
await (0, handle_common_errors_1.handleCommonError)(err);
|
|
112
|
+
await (0, handle_common_errors_1.handleCommonError)(err, config_1.ConfigInternals.Logging.getLogLevel());
|
|
111
113
|
(0, cleanup_before_quit_1.cleanupBeforeQuit)();
|
|
112
114
|
process.exit(1);
|
|
113
115
|
}
|
|
@@ -140,4 +142,5 @@ exports.CliInternals = {
|
|
|
140
142
|
printCompositions: print_compositions_1.printCompositions,
|
|
141
143
|
getFinalOutputCodec: get_final_output_codec_1.getFinalOutputCodec,
|
|
142
144
|
listOfRemotionPackages: list_of_remotion_packages_1.listOfRemotionPackages,
|
|
145
|
+
shouldUseNonOverlayingLogger: should_use_non_overlaying_logger_1.shouldUseNonOverlayingLogger,
|
|
143
146
|
};
|
package/dist/load-config.js
CHANGED
|
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.loadConfigFile = void 0;
|
|
7
7
|
const bundler_1 = require("@remotion/bundler");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const node_worker_threads_1 = require("node:worker_threads");
|
|
11
11
|
const log_1 = require("./log");
|
|
12
12
|
const loadConfigFile = async (remotionRoot, configFileName, isJavascript) => {
|
|
13
|
-
const resolved =
|
|
14
|
-
const tsconfigJson =
|
|
15
|
-
if (!isJavascript && !
|
|
13
|
+
const resolved = node_path_1.default.resolve(remotionRoot, configFileName);
|
|
14
|
+
const tsconfigJson = node_path_1.default.join(remotionRoot, 'tsconfig.json');
|
|
15
|
+
if (!isJavascript && !node_fs_1.default.existsSync(tsconfigJson)) {
|
|
16
16
|
log_1.Log.error('Could not find a tsconfig.json file in your project. Did you delete it? Create a tsconfig.json in the root of your project. Copy the default file from https://github.com/remotion-dev/template-helloworld/blob/main/tsconfig.json.');
|
|
17
17
|
log_1.Log.error('The root directory is:', remotionRoot);
|
|
18
18
|
process.exit(1);
|
|
@@ -39,13 +39,13 @@ const loadConfigFile = async (remotionRoot, configFileName, isJavascript) => {
|
|
|
39
39
|
const str = new TextDecoder().decode(result.outputFiles[0].contents);
|
|
40
40
|
const currentCwd = process.cwd();
|
|
41
41
|
// The config file is always executed from the Remotion root, if `process.cwd()` is being used. We cannot enforce this in worker threads used for testing
|
|
42
|
-
if (
|
|
42
|
+
if (node_worker_threads_1.isMainThread) {
|
|
43
43
|
process.chdir(remotionRoot);
|
|
44
44
|
}
|
|
45
45
|
// Exectute the contents of the config file
|
|
46
46
|
// eslint-disable-next-line no-eval
|
|
47
47
|
eval(str);
|
|
48
|
-
if (
|
|
48
|
+
if (node_worker_threads_1.isMainThread) {
|
|
49
49
|
process.chdir(currentCwd);
|
|
50
50
|
}
|
|
51
51
|
return resolved;
|
package/dist/log.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { LogLevel } from '@remotion/renderer';
|
|
2
|
-
export declare const INDENT_TOKEN: string;
|
|
3
1
|
export declare const Log: {
|
|
4
2
|
verbose: (message?: any, ...optionalParams: any[]) => void;
|
|
5
3
|
verboseAdvanced: (options: {
|
|
6
4
|
indent: boolean;
|
|
7
|
-
logLevel:
|
|
5
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
6
|
+
} & {
|
|
7
|
+
tag?: string | undefined;
|
|
8
8
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
9
9
|
info: (message?: any, ...optionalParams: any[]) => void;
|
|
10
10
|
infoAdvanced: (options: {
|
|
11
11
|
indent: boolean;
|
|
12
|
-
logLevel:
|
|
12
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
13
13
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
14
14
|
warn: (message?: any, ...optionalParams: any[]) => void;
|
|
15
15
|
warnAdvanced: (options: {
|
|
16
16
|
indent: boolean;
|
|
17
|
-
logLevel:
|
|
17
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
18
18
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
19
19
|
error: (message?: any, ...optionalParams: any[]) => void;
|
|
20
20
|
};
|
package/dist/log.js
CHANGED
|
@@ -1,45 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Log =
|
|
3
|
+
exports.Log = void 0;
|
|
4
|
+
/* eslint-disable no-console */
|
|
4
5
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
|
|
6
|
-
const config_1 = require("./config");
|
|
7
|
-
const truthy_1 = require("./truthy");
|
|
8
|
-
exports.INDENT_TOKEN = chalk_1.chalk.gray('│');
|
|
9
|
-
exports.Log = {
|
|
10
|
-
verbose: (...args) => {
|
|
11
|
-
exports.Log.verboseAdvanced({ indent: false, logLevel: config_1.ConfigInternals.Logging.getLogLevel() }, ...args);
|
|
12
|
-
},
|
|
13
|
-
verboseAdvanced: (options, ...args) => {
|
|
14
|
-
if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(options.logLevel, 'verbose')) {
|
|
15
|
-
return console.log(...[
|
|
16
|
-
options.indent ? exports.INDENT_TOKEN : null,
|
|
17
|
-
...args.map((a) => chalk_1.chalk.blueBright(a)),
|
|
18
|
-
].filter(truthy_1.truthy));
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
info: (...args) => {
|
|
22
|
-
exports.Log.infoAdvanced({ indent: false, logLevel: config_1.ConfigInternals.Logging.getLogLevel() }, ...args);
|
|
23
|
-
},
|
|
24
|
-
infoAdvanced: (options, ...args) => {
|
|
25
|
-
if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(options.logLevel, 'info')) {
|
|
26
|
-
return console.log(...[options.indent ? exports.INDENT_TOKEN : null, ...args].filter(truthy_1.truthy));
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
warn: (...args) => {
|
|
30
|
-
exports.Log.warnAdvanced({ indent: false, logLevel: config_1.ConfigInternals.Logging.getLogLevel() }, ...args);
|
|
31
|
-
},
|
|
32
|
-
warnAdvanced: (options, ...args) => {
|
|
33
|
-
if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(options.logLevel, 'warn')) {
|
|
34
|
-
return console.warn(...[
|
|
35
|
-
options.indent ? chalk_1.chalk.yellow(exports.INDENT_TOKEN) : null,
|
|
36
|
-
...args.map((a) => chalk_1.chalk.yellow(a)),
|
|
37
|
-
].filter(truthy_1.truthy));
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
error: (...args) => {
|
|
41
|
-
if (renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'error')) {
|
|
42
|
-
return console.error(...args.map((a) => chalk_1.chalk.red(a)));
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
};
|
|
6
|
+
exports.Log = renderer_1.RenderInternals.Log;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
3
|
import type { AddRenderRequest, CancelRenderRequest, CancelRenderResponse, CanUpdateDefaultPropsRequest, CanUpdateDefaultPropsResponse, OpenInFileExplorerRequest, RemoveRenderRequest, SubscribeToFileExistenceRequest, SubscribeToFileExistenceResponse, UnsubscribeFromFileExistenceRequest, UpdateDefaultPropsRequest } from './render-queue/job';
|
|
4
4
|
export declare type ApiHandler<ReqData, ResData> = (params: {
|
|
5
5
|
input: ReqData;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
|
-
import type { ReadStream } from 'fs';
|
|
5
|
-
import type { IncomingMessage, ServerResponse } from 'http';
|
|
4
|
+
import type { ReadStream } from 'node:fs';
|
|
5
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
6
6
|
export declare function setHeaderForResponse(res: ServerResponse, name: string, value: string | number): void;
|
|
7
7
|
export declare function send(req: IncomingMessage, res: ServerResponse, bufferOtStream: ReadStream | string | Buffer, byteLength: number): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
3
|
import type { DevMiddlewareContext } from './types';
|
|
4
4
|
export declare function getValueContentRangeHeader(type: string, size: number, range?: {
|
|
5
5
|
start: number;
|
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.middleware = exports.getValueContentRangeHeader = void 0;
|
|
7
7
|
const renderer_1 = require("@remotion/renderer");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_querystring_1 = __importDefault(require("node:querystring"));
|
|
10
|
+
const node_url_1 = require("node:url");
|
|
11
11
|
const compatible_api_1 = require("./compatible-api");
|
|
12
12
|
const get_paths_1 = require("./get-paths");
|
|
13
13
|
const range_parser_1 = require("./range-parser");
|
|
@@ -29,7 +29,7 @@ const mem = (fn, { cache = new Map() } = {}) => {
|
|
|
29
29
|
cacheStore.set(memoized, cache);
|
|
30
30
|
return memoized;
|
|
31
31
|
};
|
|
32
|
-
const memoizedParse = mem(
|
|
32
|
+
const memoizedParse = mem(node_url_1.parse);
|
|
33
33
|
function getFilenameFromUrl(context, url) {
|
|
34
34
|
var _a, _b;
|
|
35
35
|
const paths = (0, get_paths_1.getPaths)(context);
|
|
@@ -57,7 +57,7 @@ function getFilenameFromUrl(context, url) {
|
|
|
57
57
|
// `/complex/foo.js` => `foo.js`
|
|
58
58
|
const pathname = urlObject.pathname.substr(publicPathObject.pathname.length);
|
|
59
59
|
if (pathname) {
|
|
60
|
-
filename =
|
|
60
|
+
filename = node_path_1.default.join(outputPath, node_querystring_1.default.unescape(pathname));
|
|
61
61
|
}
|
|
62
62
|
if (!context.outputFileSystem) {
|
|
63
63
|
continue;
|
|
@@ -70,7 +70,7 @@ function getFilenameFromUrl(context, url) {
|
|
|
70
70
|
}
|
|
71
71
|
else if (fsStats.isDirectory()) {
|
|
72
72
|
const indexValue = 'index.html';
|
|
73
|
-
filename =
|
|
73
|
+
filename = node_path_1.default.join(filename, indexValue);
|
|
74
74
|
// eslint-disable-next-line max-depth
|
|
75
75
|
try {
|
|
76
76
|
fsStats = context.outputFileSystem.statSync(filename);
|
|
@@ -132,7 +132,7 @@ function middleware(context) {
|
|
|
132
132
|
*/
|
|
133
133
|
if (!res.getHeader('Content-Type')) {
|
|
134
134
|
// content-type name(like application/javascript; charset=utf-8) or false
|
|
135
|
-
const contentType = renderer_1.RenderInternals.mimeContentType(
|
|
135
|
+
const contentType = renderer_1.RenderInternals.mimeContentType(node_path_1.default.extname(filename));
|
|
136
136
|
// Only set content-type header if media type is known
|
|
137
137
|
// https://tools.ietf.org/html/rfc7231#section-3.1.1.5
|
|
138
138
|
if (contentType) {
|