remotion 4.0.0 → 4.0.1
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/cjs/ResolveCompositionConfig.js +12 -1
- package/dist/cjs/internals.d.ts +2 -1
- package/dist/cjs/resolve-video-config.d.ts +2 -1
- package/dist/cjs/resolve-video-config.js +10 -13
- package/dist/cjs/static-file.js +10 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.mjs +33 -14
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
|
@@ -30,12 +30,23 @@ const ResolveCompositionConfig = ({ children }) => {
|
|
|
30
30
|
: {};
|
|
31
31
|
}, [allEditorProps, renderModalComposition]);
|
|
32
32
|
const doResolution = (0, react_1.useCallback)((composition, editorProps) => {
|
|
33
|
+
var _a;
|
|
33
34
|
const controller = new AbortController();
|
|
34
35
|
if (currentCompositionMetadata) {
|
|
35
36
|
return controller;
|
|
36
37
|
}
|
|
38
|
+
const inputProps = typeof window === 'undefined' ||
|
|
39
|
+
(0, get_environment_js_1.getRemotionEnvironment)() === 'player-development' ||
|
|
40
|
+
(0, get_environment_js_1.getRemotionEnvironment)() === 'player-production'
|
|
41
|
+
? {}
|
|
42
|
+
: (_a = (0, input_props_js_1.getInputProps)()) !== null && _a !== void 0 ? _a : {};
|
|
37
43
|
const { signal } = controller;
|
|
38
|
-
const promOrNot = (0, resolve_video_config_js_1.resolveVideoConfig)({
|
|
44
|
+
const promOrNot = (0, resolve_video_config_js_1.resolveVideoConfig)({
|
|
45
|
+
composition,
|
|
46
|
+
editorProps,
|
|
47
|
+
inputProps,
|
|
48
|
+
signal,
|
|
49
|
+
});
|
|
39
50
|
if (typeof promOrNot === 'object' && 'then' in promOrNot) {
|
|
40
51
|
setResolvedConfigs((r) => ({
|
|
41
52
|
...r,
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -102,10 +102,11 @@ export declare const Internals: {
|
|
|
102
102
|
readonly usePreload: (src: string) => string;
|
|
103
103
|
readonly processColor: typeof processColor;
|
|
104
104
|
readonly NonceContext: import("react").Context<import("./nonce.js").TNonceContext>;
|
|
105
|
-
readonly resolveVideoConfig: ({ composition, editorProps: editorPropsOrUndefined, signal, }: {
|
|
105
|
+
readonly resolveVideoConfig: ({ composition, editorProps: editorPropsOrUndefined, signal, inputProps, }: {
|
|
106
106
|
composition: import("./CompositionManager.js").TCompMetadataWithCalcFunction<import("zod").AnyZodObject, Record<string, unknown>>;
|
|
107
107
|
editorProps: object;
|
|
108
108
|
signal: AbortSignal;
|
|
109
|
+
inputProps: Record<string, unknown>;
|
|
109
110
|
}) => import("./video-config.js").VideoConfig | Promise<import("./video-config.js").VideoConfig>;
|
|
110
111
|
readonly useResolvedVideoConfig: (preferredCompositionId: string | null) => ({
|
|
111
112
|
type: "loading";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { AnyZodObject } from 'zod';
|
|
2
2
|
import type { TCompMetadataWithCalcFunction } from './CompositionManager.js';
|
|
3
3
|
import type { VideoConfig } from './video-config.js';
|
|
4
|
-
export declare const resolveVideoConfig: ({ composition, editorProps: editorPropsOrUndefined, signal, }: {
|
|
4
|
+
export declare const resolveVideoConfig: ({ composition, editorProps: editorPropsOrUndefined, signal, inputProps, }: {
|
|
5
5
|
composition: TCompMetadataWithCalcFunction<AnyZodObject, Record<string, unknown>>;
|
|
6
6
|
editorProps: object;
|
|
7
7
|
signal: AbortSignal;
|
|
8
|
+
inputProps: Record<string, unknown>;
|
|
8
9
|
}) => VideoConfig | Promise<VideoConfig>;
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveVideoConfig = void 0;
|
|
4
|
-
const input_props_js_1 = require("./config/input-props.js");
|
|
5
|
-
const get_environment_js_1 = require("./get-environment.js");
|
|
6
4
|
const validate_dimensions_js_1 = require("./validation/validate-dimensions.js");
|
|
7
5
|
const validate_duration_in_frames_js_1 = require("./validation/validate-duration-in-frames.js");
|
|
8
6
|
const validate_fps_js_1 = require("./validation/validate-fps.js");
|
|
9
|
-
const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined, signal, }) => {
|
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
7
|
+
const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined, signal, inputProps, }) => {
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
11
9
|
const calculatedProm = composition.calculateMetadata
|
|
12
10
|
? composition.calculateMetadata({
|
|
13
11
|
defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
|
|
14
12
|
props: {
|
|
15
13
|
...((_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {}),
|
|
16
14
|
...(editorPropsOrUndefined !== null && editorPropsOrUndefined !== void 0 ? editorPropsOrUndefined : {}),
|
|
17
|
-
...
|
|
18
|
-
(0, get_environment_js_1.getRemotionEnvironment)() === 'player-development' ||
|
|
19
|
-
(0, get_environment_js_1.getRemotionEnvironment)() === 'player-production'
|
|
20
|
-
? {}
|
|
21
|
-
: (_c = (0, input_props_js_1.getInputProps)()) !== null && _c !== void 0 ? _c : {}),
|
|
15
|
+
...inputProps,
|
|
22
16
|
},
|
|
23
17
|
abortSignal: signal,
|
|
24
18
|
})
|
|
@@ -51,15 +45,18 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
|
|
|
51
45
|
return {
|
|
52
46
|
...data,
|
|
53
47
|
id: composition.id,
|
|
54
|
-
defaultProps: (
|
|
55
|
-
props:
|
|
48
|
+
defaultProps: (_c = composition.defaultProps) !== null && _c !== void 0 ? _c : {},
|
|
49
|
+
props: {
|
|
50
|
+
...((_d = composition.defaultProps) !== null && _d !== void 0 ? _d : {}),
|
|
51
|
+
...(inputProps !== null && inputProps !== void 0 ? inputProps : {}),
|
|
52
|
+
},
|
|
56
53
|
};
|
|
57
54
|
}
|
|
58
55
|
return {
|
|
59
56
|
...data,
|
|
60
57
|
id: composition.id,
|
|
61
|
-
defaultProps: (
|
|
62
|
-
props: (
|
|
58
|
+
defaultProps: (_e = composition.defaultProps) !== null && _e !== void 0 ? _e : {},
|
|
59
|
+
props: (_g = (_f = calculatedProm.props) !== null && _f !== void 0 ? _f : composition.defaultProps) !== null && _g !== void 0 ? _g : {},
|
|
63
60
|
};
|
|
64
61
|
};
|
|
65
62
|
exports.resolveVideoConfig = resolveVideoConfig;
|
package/dist/cjs/static-file.js
CHANGED
|
@@ -49,6 +49,14 @@ const inner = (path) => {
|
|
|
49
49
|
}
|
|
50
50
|
return `/${trimLeadingSlash(path)}`;
|
|
51
51
|
};
|
|
52
|
+
const encodeBySplitting = (path) => {
|
|
53
|
+
const splitBySlash = path.split('/');
|
|
54
|
+
const encodedArray = splitBySlash.map((element) => {
|
|
55
|
+
return encodeURIComponent(element);
|
|
56
|
+
});
|
|
57
|
+
const merged = encodedArray.join('/');
|
|
58
|
+
return merged;
|
|
59
|
+
};
|
|
52
60
|
/**
|
|
53
61
|
* @description Reference a file from the public/ folder. If the file does not appear in the autocomplete, type the path manually.
|
|
54
62
|
* @see [Documentation](https://www.remotion.dev/docs/staticfile)
|
|
@@ -78,7 +86,8 @@ const staticFile = (path) => {
|
|
|
78
86
|
if (includesHex.containsHex) {
|
|
79
87
|
warnOnce(`WARNING: You seem to pass an already encoded path (path contains ${includesHex.hexCode}). Since Remotion 4.0, the encoding is done by staticFile() itself. You may want to remove a encodeURIComponent() wrapping.`);
|
|
80
88
|
}
|
|
81
|
-
const
|
|
89
|
+
const preprocessed = encodeBySplitting(path);
|
|
90
|
+
const preparsed = inner(preprocessed);
|
|
82
91
|
if (!preparsed.startsWith('/')) {
|
|
83
92
|
return `/${preparsed}`;
|
|
84
93
|
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.1";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -58,7 +58,7 @@ function truthy(value) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// Automatically generated on publish
|
|
61
|
-
const VERSION = '4.0.
|
|
61
|
+
const VERSION = '4.0.1';
|
|
62
62
|
|
|
63
63
|
const checkMultipleRemotionVersions = () => {
|
|
64
64
|
if (typeof globalThis === 'undefined') {
|
|
@@ -399,19 +399,15 @@ function validateFps(fps, location, isGif) {
|
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined, signal, }) => {
|
|
403
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
402
|
+
const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined, signal, inputProps, }) => {
|
|
403
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
404
404
|
const calculatedProm = composition.calculateMetadata
|
|
405
405
|
? composition.calculateMetadata({
|
|
406
406
|
defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
|
|
407
407
|
props: {
|
|
408
408
|
...((_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {}),
|
|
409
409
|
...(editorPropsOrUndefined !== null && editorPropsOrUndefined !== void 0 ? editorPropsOrUndefined : {}),
|
|
410
|
-
...
|
|
411
|
-
getRemotionEnvironment() === 'player-development' ||
|
|
412
|
-
getRemotionEnvironment() === 'player-production'
|
|
413
|
-
? {}
|
|
414
|
-
: (_c = getInputProps()) !== null && _c !== void 0 ? _c : {}),
|
|
410
|
+
...inputProps,
|
|
415
411
|
},
|
|
416
412
|
abortSignal: signal,
|
|
417
413
|
})
|
|
@@ -444,15 +440,18 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
|
|
|
444
440
|
return {
|
|
445
441
|
...data,
|
|
446
442
|
id: composition.id,
|
|
447
|
-
defaultProps: (
|
|
448
|
-
props:
|
|
443
|
+
defaultProps: (_c = composition.defaultProps) !== null && _c !== void 0 ? _c : {},
|
|
444
|
+
props: {
|
|
445
|
+
...((_d = composition.defaultProps) !== null && _d !== void 0 ? _d : {}),
|
|
446
|
+
...(inputProps !== null && inputProps !== void 0 ? inputProps : {}),
|
|
447
|
+
},
|
|
449
448
|
};
|
|
450
449
|
}
|
|
451
450
|
return {
|
|
452
451
|
...data,
|
|
453
452
|
id: composition.id,
|
|
454
|
-
defaultProps: (
|
|
455
|
-
props: (
|
|
453
|
+
defaultProps: (_e = composition.defaultProps) !== null && _e !== void 0 ? _e : {},
|
|
454
|
+
props: (_g = (_f = calculatedProm.props) !== null && _f !== void 0 ? _f : composition.defaultProps) !== null && _g !== void 0 ? _g : {},
|
|
456
455
|
};
|
|
457
456
|
};
|
|
458
457
|
const validateCalculated = ({ composition, calculated, }) => {
|
|
@@ -495,12 +494,23 @@ const ResolveCompositionConfig = ({ children }) => {
|
|
|
495
494
|
: {};
|
|
496
495
|
}, [allEditorProps, renderModalComposition]);
|
|
497
496
|
const doResolution = useCallback((composition, editorProps) => {
|
|
497
|
+
var _a;
|
|
498
498
|
const controller = new AbortController();
|
|
499
499
|
if (currentCompositionMetadata) {
|
|
500
500
|
return controller;
|
|
501
501
|
}
|
|
502
|
+
const inputProps = typeof window === 'undefined' ||
|
|
503
|
+
getRemotionEnvironment() === 'player-development' ||
|
|
504
|
+
getRemotionEnvironment() === 'player-production'
|
|
505
|
+
? {}
|
|
506
|
+
: (_a = getInputProps()) !== null && _a !== void 0 ? _a : {};
|
|
502
507
|
const { signal } = controller;
|
|
503
|
-
const promOrNot = resolveVideoConfig({
|
|
508
|
+
const promOrNot = resolveVideoConfig({
|
|
509
|
+
composition,
|
|
510
|
+
editorProps,
|
|
511
|
+
inputProps,
|
|
512
|
+
signal,
|
|
513
|
+
});
|
|
504
514
|
if (typeof promOrNot === 'object' && 'then' in promOrNot) {
|
|
505
515
|
setResolvedConfigs((r) => ({
|
|
506
516
|
...r,
|
|
@@ -4048,6 +4058,14 @@ const inner = (path) => {
|
|
|
4048
4058
|
}
|
|
4049
4059
|
return `/${trimLeadingSlash(path)}`;
|
|
4050
4060
|
};
|
|
4061
|
+
const encodeBySplitting = (path) => {
|
|
4062
|
+
const splitBySlash = path.split('/');
|
|
4063
|
+
const encodedArray = splitBySlash.map((element) => {
|
|
4064
|
+
return encodeURIComponent(element);
|
|
4065
|
+
});
|
|
4066
|
+
const merged = encodedArray.join('/');
|
|
4067
|
+
return merged;
|
|
4068
|
+
};
|
|
4051
4069
|
/**
|
|
4052
4070
|
* @description Reference a file from the public/ folder. If the file does not appear in the autocomplete, type the path manually.
|
|
4053
4071
|
* @see [Documentation](https://www.remotion.dev/docs/staticfile)
|
|
@@ -4077,7 +4095,8 @@ const staticFile = (path) => {
|
|
|
4077
4095
|
if (includesHex.containsHex) {
|
|
4078
4096
|
warnOnce(`WARNING: You seem to pass an already encoded path (path contains ${includesHex.hexCode}). Since Remotion 4.0, the encoding is done by staticFile() itself. You may want to remove a encodeURIComponent() wrapping.`);
|
|
4079
4097
|
}
|
|
4080
|
-
const
|
|
4098
|
+
const preprocessed = encodeBySplitting(path);
|
|
4099
|
+
const preparsed = inner(preprocessed);
|
|
4081
4100
|
if (!preparsed.startsWith('/')) {
|
|
4082
4101
|
return `/${preparsed}`;
|
|
4083
4102
|
}
|
package/dist/esm/version.mjs
CHANGED