@remotion/bundler 4.0.424 → 4.0.426
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/bundle.d.ts +4 -3
- package/dist/bundle.js +42 -12
- package/dist/define-plugin-definitions.d.ts +13 -0
- package/dist/define-plugin-definitions.js +11 -0
- package/dist/index.d.ts +20 -3
- package/dist/index.js +3 -0
- package/dist/rspack-config.d.ts +20 -0
- package/dist/rspack-config.js +115 -0
- package/dist/shared-bundler-config.d.ts +54 -0
- package/dist/shared-bundler-config.js +117 -0
- package/dist/webpack-config.js +19 -105
- package/package.json +9 -7
package/dist/bundle.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export type MandatoryLegacyBundleOptions = {
|
|
|
12
12
|
onSymlinkDetected: (path: string) => void;
|
|
13
13
|
keyboardShortcutsEnabled: boolean;
|
|
14
14
|
askAIEnabled: boolean;
|
|
15
|
+
rspack: boolean;
|
|
15
16
|
};
|
|
16
17
|
export type LegacyBundleOptions = Partial<MandatoryLegacyBundleOptions>;
|
|
17
18
|
export declare const getConfig: ({ entryPoint, outDir, resolvedRemotionRoot, onProgress, options, bufferStateDelayInMilliseconds, maxTimelineTracks, experimentalClientSideRenderingEnabled, }: {
|
|
@@ -21,9 +22,9 @@ export declare const getConfig: ({ entryPoint, outDir, resolvedRemotionRoot, onP
|
|
|
21
22
|
bufferStateDelayInMilliseconds: number | null;
|
|
22
23
|
experimentalClientSideRenderingEnabled: boolean;
|
|
23
24
|
maxTimelineTracks: number | null;
|
|
24
|
-
onProgress
|
|
25
|
-
options
|
|
26
|
-
}) => Promise<[string, webpack.Configuration]>;
|
|
25
|
+
onProgress: (progress: number) => void;
|
|
26
|
+
options: MandatoryLegacyBundleOptions;
|
|
27
|
+
}) => Promise<[string, webpack.Configuration]> | Promise<[string, import("@rspack/core").RspackOptions]>;
|
|
27
28
|
type NewBundleOptions = {
|
|
28
29
|
entryPoint: string;
|
|
29
30
|
onProgress: (progress: number) => void;
|
package/dist/bundle.js
CHANGED
|
@@ -48,6 +48,7 @@ const webpack_1 = __importDefault(require("webpack"));
|
|
|
48
48
|
const copy_dir_1 = require("./copy-dir");
|
|
49
49
|
const index_html_1 = require("./index-html");
|
|
50
50
|
const read_recursively_1 = require("./read-recursively");
|
|
51
|
+
const rspack_config_1 = require("./rspack-config");
|
|
51
52
|
const webpack_config_1 = require("./webpack-config");
|
|
52
53
|
const promisified = (0, node_util_1.promisify)(webpack_1.default);
|
|
53
54
|
const prepareOutDir = async (specified) => {
|
|
@@ -71,7 +72,7 @@ const trimTrailingSlash = (p) => {
|
|
|
71
72
|
};
|
|
72
73
|
const getConfig = ({ entryPoint, outDir, resolvedRemotionRoot, onProgress, options, bufferStateDelayInMilliseconds, maxTimelineTracks, experimentalClientSideRenderingEnabled, }) => {
|
|
73
74
|
var _a, _b, _c, _d;
|
|
74
|
-
|
|
75
|
+
const configArgs = {
|
|
75
76
|
entry: node_path_1.default.join(require.resolve('@remotion/studio/renderEntry'), '..', 'esm', 'renderEntry.mjs'),
|
|
76
77
|
userDefinedComponent: entryPoint,
|
|
77
78
|
outDir,
|
|
@@ -88,7 +89,11 @@ const getConfig = ({ entryPoint, outDir, resolvedRemotionRoot, onProgress, optio
|
|
|
88
89
|
poll: null,
|
|
89
90
|
experimentalClientSideRenderingEnabled,
|
|
90
91
|
askAIEnabled: (_d = options === null || options === void 0 ? void 0 : options.askAIEnabled) !== null && _d !== void 0 ? _d : true,
|
|
91
|
-
}
|
|
92
|
+
};
|
|
93
|
+
if (options.rspack) {
|
|
94
|
+
return (0, rspack_config_1.rspackConfig)(configArgs);
|
|
95
|
+
}
|
|
96
|
+
return (0, webpack_config_1.webpackConfig)(configArgs);
|
|
92
97
|
};
|
|
93
98
|
exports.getConfig = getConfig;
|
|
94
99
|
const convertArgumentsIntoOptions = (args) => {
|
|
@@ -166,16 +171,40 @@ const internalBundle = async (actualArgs) => {
|
|
|
166
171
|
maxTimelineTracks: actualArgs.maxTimelineTracks,
|
|
167
172
|
experimentalClientSideRenderingEnabled: actualArgs.experimentalClientSideRenderingEnabled,
|
|
168
173
|
});
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
if (actualArgs.rspack) {
|
|
175
|
+
const { rspack: rspackFn } = require('@rspack/core');
|
|
176
|
+
const rspackCompiler = rspackFn(config);
|
|
177
|
+
const rspackOutput = await new Promise((resolve, reject) => {
|
|
178
|
+
rspackCompiler.run((err, stats) => {
|
|
179
|
+
if (err) {
|
|
180
|
+
reject(err);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
rspackCompiler.close(() => {
|
|
184
|
+
resolve(stats);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
if (node_worker_threads_1.isMainThread) {
|
|
189
|
+
process.chdir(currentCwd);
|
|
190
|
+
}
|
|
191
|
+
const { errors } = rspackOutput.toJson({});
|
|
192
|
+
if (errors !== undefined && errors.length > 0) {
|
|
193
|
+
throw new Error(errors[0].message + '\n' + errors[0].details);
|
|
194
|
+
}
|
|
175
195
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
196
|
+
else {
|
|
197
|
+
const output = (await promisified([config]));
|
|
198
|
+
if (node_worker_threads_1.isMainThread) {
|
|
199
|
+
process.chdir(currentCwd);
|
|
200
|
+
}
|
|
201
|
+
if (!output) {
|
|
202
|
+
throw new Error('Expected webpack output');
|
|
203
|
+
}
|
|
204
|
+
const { errors } = output.toJson();
|
|
205
|
+
if (errors !== undefined && errors.length > 0) {
|
|
206
|
+
throw new Error(errors[0].message + '\n' + errors[0].details);
|
|
207
|
+
}
|
|
179
208
|
}
|
|
180
209
|
const publicPath = (_f = actualArgs === null || actualArgs === void 0 ? void 0 : actualArgs.publicPath) !== null && _f !== void 0 ? _f : '/';
|
|
181
210
|
const staticHash = '/' +
|
|
@@ -261,7 +290,7 @@ exports.internalBundle = internalBundle;
|
|
|
261
290
|
* @see [Documentation](https://remotion.dev/docs/bundle)
|
|
262
291
|
*/
|
|
263
292
|
async function bundle(...args) {
|
|
264
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
293
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
265
294
|
const actualArgs = convertArgumentsIntoOptions(args);
|
|
266
295
|
const result = await (0, exports.internalBundle)({
|
|
267
296
|
bufferStateDelayInMilliseconds: (_a = actualArgs.bufferStateDelayInMilliseconds) !== null && _a !== void 0 ? _a : null,
|
|
@@ -284,6 +313,7 @@ async function bundle(...args) {
|
|
|
284
313
|
renderDefaults: (_s = actualArgs.renderDefaults) !== null && _s !== void 0 ? _s : null,
|
|
285
314
|
askAIEnabled: (_t = actualArgs.askAIEnabled) !== null && _t !== void 0 ? _t : true,
|
|
286
315
|
keyboardShortcutsEnabled: (_u = actualArgs.keyboardShortcutsEnabled) !== null && _u !== void 0 ? _u : true,
|
|
316
|
+
rspack: (_v = actualArgs.rspack) !== null && _v !== void 0 ? _v : false,
|
|
287
317
|
});
|
|
288
318
|
return result;
|
|
289
319
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const getDefinePluginDefinitions: ({ maxTimelineTracks, askAIEnabled, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, experimentalClientSideRenderingEnabled, }: {
|
|
2
|
+
maxTimelineTracks: number | null;
|
|
3
|
+
askAIEnabled: boolean;
|
|
4
|
+
keyboardShortcutsEnabled: boolean;
|
|
5
|
+
bufferStateDelayInMilliseconds: number | null;
|
|
6
|
+
experimentalClientSideRenderingEnabled: boolean;
|
|
7
|
+
}) => {
|
|
8
|
+
'process.env.MAX_TIMELINE_TRACKS': number | null;
|
|
9
|
+
'process.env.ASK_AI_ENABLED': boolean;
|
|
10
|
+
'process.env.KEYBOARD_SHORTCUTS_ENABLED': boolean;
|
|
11
|
+
'process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS': number | null;
|
|
12
|
+
'process.env.EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED': boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefinePluginDefinitions = void 0;
|
|
4
|
+
const getDefinePluginDefinitions = ({ maxTimelineTracks, askAIEnabled, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, experimentalClientSideRenderingEnabled, }) => ({
|
|
5
|
+
'process.env.MAX_TIMELINE_TRACKS': maxTimelineTracks,
|
|
6
|
+
'process.env.ASK_AI_ENABLED': askAIEnabled,
|
|
7
|
+
'process.env.KEYBOARD_SHORTCUTS_ENABLED': keyboardShortcutsEnabled,
|
|
8
|
+
'process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS': bufferStateDelayInMilliseconds,
|
|
9
|
+
'process.env.EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED': experimentalClientSideRenderingEnabled,
|
|
10
|
+
});
|
|
11
|
+
exports.getDefinePluginDefinitions = getDefinePluginDefinitions;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,23 @@ export declare const BundlerInternals: {
|
|
|
18
18
|
askAIEnabled: boolean;
|
|
19
19
|
experimentalClientSideRenderingEnabled: boolean;
|
|
20
20
|
}) => Promise<[string, webpack.Configuration]>;
|
|
21
|
+
rspackConfig: ({ entry, userDefinedComponent, outDir, environment, webpackOverride, onProgress, enableCaching, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, poll, experimentalClientSideRenderingEnabled, askAIEnabled, }: {
|
|
22
|
+
entry: string;
|
|
23
|
+
userDefinedComponent: string;
|
|
24
|
+
outDir: string | null;
|
|
25
|
+
environment: "development" | "production";
|
|
26
|
+
webpackOverride: import("./webpack-config").WebpackOverrideFn;
|
|
27
|
+
onProgress?: ((f: number) => void) | undefined;
|
|
28
|
+
enableCaching?: boolean | undefined;
|
|
29
|
+
maxTimelineTracks: number | null;
|
|
30
|
+
keyboardShortcutsEnabled: boolean;
|
|
31
|
+
bufferStateDelayInMilliseconds: number | null;
|
|
32
|
+
remotionRoot: string;
|
|
33
|
+
poll: number | null;
|
|
34
|
+
askAIEnabled: boolean;
|
|
35
|
+
experimentalClientSideRenderingEnabled: boolean;
|
|
36
|
+
}) => Promise<[string, import("@rspack/core").RspackOptions]>;
|
|
37
|
+
createRspackCompiler: (config: import("@rspack/core").RspackOptions) => import("@rspack/core").Compiler;
|
|
21
38
|
indexHtml: ({ publicPath, editorName, inputProps, envVariables, staticHash, remotionRoot, studioServerCommand, renderQueue, completedClientRenders, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, publicFolderExists, gitSource, projectName, installedDependencies, packageManager, audioLatencyHint, logLevel, mode, }: {
|
|
22
39
|
staticHash: string;
|
|
23
40
|
publicPath: string;
|
|
@@ -51,9 +68,9 @@ export declare const BundlerInternals: {
|
|
|
51
68
|
bufferStateDelayInMilliseconds: number | null;
|
|
52
69
|
experimentalClientSideRenderingEnabled: boolean;
|
|
53
70
|
maxTimelineTracks: number | null;
|
|
54
|
-
onProgress
|
|
55
|
-
options
|
|
56
|
-
}) => Promise<[string, webpack.Configuration]>;
|
|
71
|
+
onProgress: (progress: number) => void;
|
|
72
|
+
options: import("./bundle").MandatoryLegacyBundleOptions;
|
|
73
|
+
}) => Promise<[string, webpack.Configuration]> | Promise<[string, import("@rspack/core").RspackOptions]>;
|
|
57
74
|
readRecursively: ({ folder, output, startPath, staticHash, limit, }: {
|
|
58
75
|
folder: string;
|
|
59
76
|
startPath: string;
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.webpack = exports.bundle = exports.BundlerInternals = void 0;
|
|
|
4
4
|
const bundle_1 = require("./bundle");
|
|
5
5
|
const index_html_1 = require("./index-html");
|
|
6
6
|
const read_recursively_1 = require("./read-recursively");
|
|
7
|
+
const rspack_config_1 = require("./rspack-config");
|
|
7
8
|
const webpack_cache_1 = require("./webpack-cache");
|
|
8
9
|
const webpack_config_1 = require("./webpack-config");
|
|
9
10
|
const esbuild = require("esbuild");
|
|
@@ -12,6 +13,8 @@ exports.webpack = webpack;
|
|
|
12
13
|
exports.BundlerInternals = {
|
|
13
14
|
esbuild,
|
|
14
15
|
webpackConfig: webpack_config_1.webpackConfig,
|
|
16
|
+
rspackConfig: rspack_config_1.rspackConfig,
|
|
17
|
+
createRspackCompiler: rspack_config_1.createRspackCompiler,
|
|
15
18
|
indexHtml: index_html_1.indexHtml,
|
|
16
19
|
cacheExists: webpack_cache_1.cacheExists,
|
|
17
20
|
clearCache: webpack_cache_1.clearCache,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Configuration } from '@rspack/core';
|
|
2
|
+
import type { WebpackOverrideFn } from './webpack-config';
|
|
3
|
+
export type RspackConfiguration = Configuration;
|
|
4
|
+
export declare const rspackConfig: ({ entry, userDefinedComponent, outDir, environment, webpackOverride, onProgress, enableCaching, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, poll, experimentalClientSideRenderingEnabled, askAIEnabled, }: {
|
|
5
|
+
entry: string;
|
|
6
|
+
userDefinedComponent: string;
|
|
7
|
+
outDir: string | null;
|
|
8
|
+
environment: "development" | "production";
|
|
9
|
+
webpackOverride: WebpackOverrideFn;
|
|
10
|
+
onProgress?: ((f: number) => void) | undefined;
|
|
11
|
+
enableCaching?: boolean | undefined;
|
|
12
|
+
maxTimelineTracks: number | null;
|
|
13
|
+
keyboardShortcutsEnabled: boolean;
|
|
14
|
+
bufferStateDelayInMilliseconds: number | null;
|
|
15
|
+
remotionRoot: string;
|
|
16
|
+
poll: number | null;
|
|
17
|
+
askAIEnabled: boolean;
|
|
18
|
+
experimentalClientSideRenderingEnabled: boolean;
|
|
19
|
+
}) => Promise<[string, import("@rspack/core").RspackOptions]>;
|
|
20
|
+
export declare const createRspackCompiler: (config: import("@rspack/core").RspackOptions) => import("@rspack/core").Compiler;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createRspackCompiler = exports.rspackConfig = void 0;
|
|
7
|
+
const core_1 = require("@rspack/core");
|
|
8
|
+
const plugin_react_refresh_1 = __importDefault(require("@rspack/plugin-react-refresh"));
|
|
9
|
+
const define_plugin_definitions_1 = require("./define-plugin-definitions");
|
|
10
|
+
const shared_bundler_config_1 = require("./shared-bundler-config");
|
|
11
|
+
const rspackConfig = async ({ entry, userDefinedComponent, outDir, environment, webpackOverride = (f) => f, onProgress, enableCaching = true, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, poll, experimentalClientSideRenderingEnabled, askAIEnabled, }) => {
|
|
12
|
+
let lastProgress = 0;
|
|
13
|
+
const define = new core_1.DefinePlugin((0, define_plugin_definitions_1.getDefinePluginDefinitions)({
|
|
14
|
+
maxTimelineTracks,
|
|
15
|
+
askAIEnabled,
|
|
16
|
+
keyboardShortcutsEnabled,
|
|
17
|
+
bufferStateDelayInMilliseconds,
|
|
18
|
+
experimentalClientSideRenderingEnabled,
|
|
19
|
+
}));
|
|
20
|
+
const swcLoaderRule = {
|
|
21
|
+
loader: 'builtin:swc-loader',
|
|
22
|
+
options: {
|
|
23
|
+
jsc: {
|
|
24
|
+
parser: { syntax: 'typescript', tsx: true },
|
|
25
|
+
transform: {
|
|
26
|
+
react: {
|
|
27
|
+
runtime: 'automatic',
|
|
28
|
+
development: environment === 'development',
|
|
29
|
+
refresh: environment === 'development',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
env: { targets: 'Chrome >= 85' },
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const swcLoaderRuleJsx = {
|
|
37
|
+
loader: 'builtin:swc-loader',
|
|
38
|
+
options: {
|
|
39
|
+
jsc: {
|
|
40
|
+
parser: { syntax: 'ecmascript', jsx: true },
|
|
41
|
+
transform: {
|
|
42
|
+
react: {
|
|
43
|
+
runtime: 'automatic',
|
|
44
|
+
development: environment === 'development',
|
|
45
|
+
refresh: environment === 'development',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
env: { targets: 'Chrome >= 85' },
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
// Rspack config is structurally compatible with webpack config at runtime,
|
|
53
|
+
// but the TypeScript types differ. Cast through `any` for the override.
|
|
54
|
+
const conf = (await webpackOverride({
|
|
55
|
+
...(0, shared_bundler_config_1.getBaseConfig)(environment, poll),
|
|
56
|
+
ignoreWarnings: [
|
|
57
|
+
/Circular dependency between chunks with runtime/,
|
|
58
|
+
/Critical dependency: the request of a dependency is an expression/,
|
|
59
|
+
/"__dirname" is used and has been mocked/,
|
|
60
|
+
],
|
|
61
|
+
entry: [
|
|
62
|
+
require.resolve('./setup-environment'),
|
|
63
|
+
userDefinedComponent,
|
|
64
|
+
require.resolve('../react-shim.js'),
|
|
65
|
+
entry,
|
|
66
|
+
].filter(Boolean),
|
|
67
|
+
mode: environment,
|
|
68
|
+
plugins: environment === 'development'
|
|
69
|
+
? [
|
|
70
|
+
new plugin_react_refresh_1.default({ overlay: false }),
|
|
71
|
+
new core_1.rspack.HotModuleReplacementPlugin(),
|
|
72
|
+
define,
|
|
73
|
+
]
|
|
74
|
+
: [
|
|
75
|
+
new core_1.ProgressPlugin((p) => {
|
|
76
|
+
if (onProgress) {
|
|
77
|
+
if ((p === 1 && p > lastProgress) || p - lastProgress > 0.05) {
|
|
78
|
+
lastProgress = p;
|
|
79
|
+
onProgress(Number((p * 100).toFixed(2)));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
define,
|
|
84
|
+
],
|
|
85
|
+
output: (0, shared_bundler_config_1.getOutputConfig)(environment),
|
|
86
|
+
resolve: (0, shared_bundler_config_1.getResolveConfig)(),
|
|
87
|
+
module: {
|
|
88
|
+
rules: [
|
|
89
|
+
...(0, shared_bundler_config_1.getSharedModuleRules)(),
|
|
90
|
+
{
|
|
91
|
+
test: /\.tsx?$/,
|
|
92
|
+
use: [swcLoaderRule],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
test: /\.jsx?$/,
|
|
96
|
+
exclude: /node_modules/,
|
|
97
|
+
use: [swcLoaderRuleJsx],
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
|
+
}));
|
|
103
|
+
const [hash, finalConf] = (0, shared_bundler_config_1.computeHashAndFinalConfig)(conf, {
|
|
104
|
+
enableCaching,
|
|
105
|
+
environment,
|
|
106
|
+
outDir,
|
|
107
|
+
remotionRoot,
|
|
108
|
+
});
|
|
109
|
+
return [hash, finalConf];
|
|
110
|
+
};
|
|
111
|
+
exports.rspackConfig = rspackConfig;
|
|
112
|
+
const createRspackCompiler = (config) => {
|
|
113
|
+
return (0, core_1.rspack)(config);
|
|
114
|
+
};
|
|
115
|
+
exports.createRspackCompiler = createRspackCompiler;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare const shouldUseReactDomClient: boolean;
|
|
2
|
+
export declare const getResolveConfig: () => {
|
|
3
|
+
extensions: string[];
|
|
4
|
+
alias: {
|
|
5
|
+
'react/jsx-runtime': string;
|
|
6
|
+
'react/jsx-dev-runtime': string;
|
|
7
|
+
react: string;
|
|
8
|
+
'remotion/no-react': string;
|
|
9
|
+
'remotion/version': string;
|
|
10
|
+
remotion: string;
|
|
11
|
+
'@remotion/media-parser/worker': string;
|
|
12
|
+
'@remotion/studio': string;
|
|
13
|
+
'react-dom/client': string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const getOutputConfig: (environment: "development" | "production") => {
|
|
17
|
+
hashFunction: "xxhash64";
|
|
18
|
+
filename: string;
|
|
19
|
+
devtoolModuleFilenameTemplate: string;
|
|
20
|
+
assetModuleFilename: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const getBaseConfig: (environment: "development" | "production", poll: number | null) => {
|
|
23
|
+
optimization: {
|
|
24
|
+
minimize: boolean;
|
|
25
|
+
};
|
|
26
|
+
experiments: {
|
|
27
|
+
lazyCompilation: boolean | {
|
|
28
|
+
entries: boolean;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
watchOptions: {
|
|
32
|
+
poll: number | undefined;
|
|
33
|
+
aggregateTimeout: number;
|
|
34
|
+
ignored: string[];
|
|
35
|
+
};
|
|
36
|
+
devtool: "cheap-module-source-map" | "source-map";
|
|
37
|
+
};
|
|
38
|
+
export declare const getSharedModuleRules: () => ({
|
|
39
|
+
test: RegExp;
|
|
40
|
+
use: string[];
|
|
41
|
+
type: "javascript/auto";
|
|
42
|
+
} | {
|
|
43
|
+
use?: undefined;
|
|
44
|
+
test: RegExp;
|
|
45
|
+
type: "asset/resource";
|
|
46
|
+
})[];
|
|
47
|
+
export declare const computeHashAndFinalConfig: <T extends {
|
|
48
|
+
output?: any;
|
|
49
|
+
}>(conf: T, options: {
|
|
50
|
+
enableCaching: boolean;
|
|
51
|
+
environment: "development" | "production";
|
|
52
|
+
outDir: string | null;
|
|
53
|
+
remotionRoot: string;
|
|
54
|
+
}) => [string, T];
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.computeHashAndFinalConfig = exports.getSharedModuleRules = exports.getBaseConfig = exports.getOutputConfig = exports.getResolveConfig = exports.shouldUseReactDomClient = void 0;
|
|
7
|
+
const node_crypto_1 = require("node:crypto");
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const react_dom_1 = __importDefault(require("react-dom"));
|
|
10
|
+
const no_react_1 = require("remotion/no-react");
|
|
11
|
+
const stringify_with_circular_references_1 = require("./stringify-with-circular-references");
|
|
12
|
+
const webpack_cache_1 = require("./webpack-cache");
|
|
13
|
+
if (!(react_dom_1.default === null || react_dom_1.default === void 0 ? void 0 : react_dom_1.default.version)) {
|
|
14
|
+
throw new Error('Could not find "react-dom" package. Did you install it?');
|
|
15
|
+
}
|
|
16
|
+
const reactDomVersion = react_dom_1.default.version.split('.')[0];
|
|
17
|
+
if (reactDomVersion === '0') {
|
|
18
|
+
throw new Error(`Version ${reactDomVersion} of "react-dom" is not supported by Remotion`);
|
|
19
|
+
}
|
|
20
|
+
exports.shouldUseReactDomClient = no_react_1.NoReactInternals.ENABLE_V5_BREAKING_CHANGES
|
|
21
|
+
? true
|
|
22
|
+
: parseInt(reactDomVersion, 10) >= 18;
|
|
23
|
+
const getResolveConfig = () => ({
|
|
24
|
+
extensions: ['.ts', '.tsx', '.web.js', '.js', '.jsx', '.mjs', '.cjs'],
|
|
25
|
+
alias: {
|
|
26
|
+
// Only one version of react
|
|
27
|
+
'react/jsx-runtime': require.resolve('react/jsx-runtime'),
|
|
28
|
+
'react/jsx-dev-runtime': require.resolve('react/jsx-dev-runtime'),
|
|
29
|
+
react: require.resolve('react'),
|
|
30
|
+
// Needed to not fail on this: https://github.com/remotion-dev/remotion/issues/5045
|
|
31
|
+
'remotion/no-react': node_path_1.default.resolve(require.resolve('remotion'), '..', '..', 'esm', 'no-react.mjs'),
|
|
32
|
+
'remotion/version': node_path_1.default.resolve(require.resolve('remotion'), '..', '..', 'esm', 'version.mjs'),
|
|
33
|
+
remotion: node_path_1.default.resolve(require.resolve('remotion'), '..', '..', 'esm', 'index.mjs'),
|
|
34
|
+
'@remotion/media-parser/worker': node_path_1.default.resolve(require.resolve('@remotion/media-parser'), '..', 'esm', 'worker.mjs'),
|
|
35
|
+
// test visual controls before removing this
|
|
36
|
+
'@remotion/studio': require.resolve('@remotion/studio'),
|
|
37
|
+
'react-dom/client': exports.shouldUseReactDomClient
|
|
38
|
+
? require.resolve('react-dom/client')
|
|
39
|
+
: require.resolve('react-dom'),
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
exports.getResolveConfig = getResolveConfig;
|
|
43
|
+
const getOutputConfig = (environment) => ({
|
|
44
|
+
hashFunction: 'xxhash64',
|
|
45
|
+
filename: no_react_1.NoReactInternals.bundleName,
|
|
46
|
+
devtoolModuleFilenameTemplate: '[resource-path]',
|
|
47
|
+
assetModuleFilename: environment === 'development' ? '[path][name][ext]' : '[hash][ext]',
|
|
48
|
+
});
|
|
49
|
+
exports.getOutputConfig = getOutputConfig;
|
|
50
|
+
const getBaseConfig = (environment, poll) => {
|
|
51
|
+
const isBun = typeof Bun !== 'undefined';
|
|
52
|
+
return {
|
|
53
|
+
optimization: {
|
|
54
|
+
minimize: false,
|
|
55
|
+
},
|
|
56
|
+
experiments: {
|
|
57
|
+
lazyCompilation: isBun
|
|
58
|
+
? false
|
|
59
|
+
: environment === 'production'
|
|
60
|
+
? false
|
|
61
|
+
: {
|
|
62
|
+
entries: false,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
watchOptions: {
|
|
66
|
+
poll: poll !== null && poll !== void 0 ? poll : undefined,
|
|
67
|
+
aggregateTimeout: 0,
|
|
68
|
+
ignored: ['**/.git/**', '**/.turbo/**', '**/node_modules/**'],
|
|
69
|
+
},
|
|
70
|
+
// Higher source map quality in development to power line numbers for stack traces
|
|
71
|
+
devtool: environment === 'development'
|
|
72
|
+
? 'source-map'
|
|
73
|
+
: 'cheap-module-source-map',
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
exports.getBaseConfig = getBaseConfig;
|
|
77
|
+
const getSharedModuleRules = () => [
|
|
78
|
+
{
|
|
79
|
+
test: /\.css$/i,
|
|
80
|
+
use: [require.resolve('style-loader'), require.resolve('css-loader')],
|
|
81
|
+
type: 'javascript/auto',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
test: /\.(png|svg|jpg|jpeg|webp|gif|bmp|webm|mp4|mov|mp3|m4a|wav|aac)$/,
|
|
85
|
+
type: 'asset/resource',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
test: /\.(woff(2)?|otf|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
|
|
89
|
+
type: 'asset/resource',
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
exports.getSharedModuleRules = getSharedModuleRules;
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
|
+
const computeHashAndFinalConfig = (conf, options) => {
|
|
95
|
+
const hash = (0, node_crypto_1.createHash)('md5')
|
|
96
|
+
.update((0, stringify_with_circular_references_1.jsonStringifyWithCircularReferences)(conf))
|
|
97
|
+
.digest('hex');
|
|
98
|
+
return [
|
|
99
|
+
hash,
|
|
100
|
+
{
|
|
101
|
+
...conf,
|
|
102
|
+
cache: options.enableCaching
|
|
103
|
+
? {
|
|
104
|
+
type: 'filesystem',
|
|
105
|
+
name: (0, webpack_cache_1.getWebpackCacheName)(options.environment, hash),
|
|
106
|
+
version: hash,
|
|
107
|
+
}
|
|
108
|
+
: false,
|
|
109
|
+
output: {
|
|
110
|
+
...conf.output,
|
|
111
|
+
...(options.outDir ? { path: options.outDir } : {}),
|
|
112
|
+
},
|
|
113
|
+
context: options.remotionRoot,
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
};
|
|
117
|
+
exports.computeHashAndFinalConfig = computeHashAndFinalConfig;
|
package/dist/webpack-config.js
CHANGED
|
@@ -32,34 +32,17 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.webpackConfig = void 0;
|
|
40
|
-
const node_crypto_1 = require("node:crypto");
|
|
41
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
42
|
-
const react_dom_1 = __importDefault(require("react-dom"));
|
|
43
|
-
const no_react_1 = require("remotion/no-react");
|
|
44
37
|
const webpack_1 = __importStar(require("webpack"));
|
|
45
38
|
const case_sensitive_paths_1 = require("./case-sensitive-paths");
|
|
39
|
+
const define_plugin_definitions_1 = require("./define-plugin-definitions");
|
|
46
40
|
const fast_refresh_1 = require("./fast-refresh");
|
|
47
41
|
const hide_expression_dependency_1 = require("./hide-expression-dependency");
|
|
48
42
|
const ignore_packfilecache_warnings_1 = require("./ignore-packfilecache-warnings");
|
|
49
43
|
const optional_dependencies_1 = require("./optional-dependencies");
|
|
50
|
-
const
|
|
51
|
-
const webpack_cache_1 = require("./webpack-cache");
|
|
44
|
+
const shared_bundler_config_1 = require("./shared-bundler-config");
|
|
52
45
|
const esbuild = require("esbuild");
|
|
53
|
-
if (!(react_dom_1.default === null || react_dom_1.default === void 0 ? void 0 : react_dom_1.default.version)) {
|
|
54
|
-
throw new Error('Could not find "react-dom" package. Did you install it?');
|
|
55
|
-
}
|
|
56
|
-
const reactDomVersion = react_dom_1.default.version.split('.')[0];
|
|
57
|
-
if (reactDomVersion === '0') {
|
|
58
|
-
throw new Error(`Version ${reactDomVersion} of "react-dom" is not supported by Remotion`);
|
|
59
|
-
}
|
|
60
|
-
const shouldUseReactDomClient = no_react_1.NoReactInternals.ENABLE_V5_BREAKING_CHANGES
|
|
61
|
-
? true
|
|
62
|
-
: parseInt(reactDomVersion, 10) >= 18;
|
|
63
46
|
function truthy(value) {
|
|
64
47
|
return Boolean(value);
|
|
65
48
|
}
|
|
@@ -71,34 +54,15 @@ const webpackConfig = async ({ entry, userDefinedComponent, outDir, environment,
|
|
|
71
54
|
remotionRoot,
|
|
72
55
|
};
|
|
73
56
|
let lastProgress = 0;
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
57
|
+
const define = new webpack_1.default.DefinePlugin((0, define_plugin_definitions_1.getDefinePluginDefinitions)({
|
|
58
|
+
maxTimelineTracks,
|
|
59
|
+
askAIEnabled,
|
|
60
|
+
keyboardShortcutsEnabled,
|
|
61
|
+
bufferStateDelayInMilliseconds,
|
|
62
|
+
experimentalClientSideRenderingEnabled,
|
|
63
|
+
}));
|
|
82
64
|
const conf = await webpackOverride({
|
|
83
|
-
|
|
84
|
-
minimize: false,
|
|
85
|
-
},
|
|
86
|
-
experiments: {
|
|
87
|
-
lazyCompilation: isBun
|
|
88
|
-
? false
|
|
89
|
-
: environment === 'production'
|
|
90
|
-
? false
|
|
91
|
-
: {
|
|
92
|
-
entries: false,
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
watchOptions: {
|
|
96
|
-
poll: poll !== null && poll !== void 0 ? poll : undefined,
|
|
97
|
-
aggregateTimeout: 0,
|
|
98
|
-
ignored: ['**/.git/**', '**/.turbo/**', '**/node_modules/**'],
|
|
99
|
-
},
|
|
100
|
-
// Higher source map quality in development to power line numbers for stack traces
|
|
101
|
-
devtool: environment === 'development' ? 'source-map' : 'cheap-module-source-map',
|
|
65
|
+
...(0, shared_bundler_config_1.getBaseConfig)(environment, poll),
|
|
102
66
|
entry: [
|
|
103
67
|
// Fast Refresh must come first,
|
|
104
68
|
// because setup-environment imports ReactDOM.
|
|
@@ -136,42 +100,11 @@ const webpackConfig = async ({ entry, userDefinedComponent, outDir, environment,
|
|
|
136
100
|
new hide_expression_dependency_1.AllowDependencyExpressionPlugin(),
|
|
137
101
|
new ignore_packfilecache_warnings_1.IgnorePackFileCacheWarningsPlugin(),
|
|
138
102
|
],
|
|
139
|
-
output:
|
|
140
|
-
|
|
141
|
-
filename: no_react_1.NoReactInternals.bundleName,
|
|
142
|
-
devtoolModuleFilenameTemplate: '[resource-path]',
|
|
143
|
-
assetModuleFilename: environment === 'development' ? '[path][name][ext]' : '[hash][ext]',
|
|
144
|
-
},
|
|
145
|
-
resolve: {
|
|
146
|
-
extensions: ['.ts', '.tsx', '.web.js', '.js', '.jsx', '.mjs', '.cjs'],
|
|
147
|
-
alias: {
|
|
148
|
-
// Only one version of react
|
|
149
|
-
'react/jsx-runtime': require.resolve('react/jsx-runtime'),
|
|
150
|
-
'react/jsx-dev-runtime': require.resolve('react/jsx-dev-runtime'),
|
|
151
|
-
react: require.resolve('react'),
|
|
152
|
-
// Needed to not fail on this: https://github.com/remotion-dev/remotion/issues/5045
|
|
153
|
-
'remotion/no-react': node_path_1.default.resolve(require.resolve('remotion'), '..', '..', 'esm', 'no-react.mjs'),
|
|
154
|
-
'remotion/version': node_path_1.default.resolve(require.resolve('remotion'), '..', '..', 'esm', 'version.mjs'),
|
|
155
|
-
remotion: node_path_1.default.resolve(require.resolve('remotion'), '..', '..', 'esm', 'index.mjs'),
|
|
156
|
-
'@remotion/media-parser/worker': node_path_1.default.resolve(require.resolve('@remotion/media-parser'), '..', 'esm', 'worker.mjs'),
|
|
157
|
-
// test visual controls before removing this
|
|
158
|
-
'@remotion/studio': require.resolve('@remotion/studio'),
|
|
159
|
-
'react-dom/client': shouldUseReactDomClient
|
|
160
|
-
? require.resolve('react-dom/client')
|
|
161
|
-
: require.resolve('react-dom'),
|
|
162
|
-
},
|
|
163
|
-
},
|
|
103
|
+
output: (0, shared_bundler_config_1.getOutputConfig)(environment),
|
|
104
|
+
resolve: (0, shared_bundler_config_1.getResolveConfig)(),
|
|
164
105
|
module: {
|
|
165
106
|
rules: [
|
|
166
|
-
|
|
167
|
-
test: /\.css$/i,
|
|
168
|
-
use: [require.resolve('style-loader'), require.resolve('css-loader')],
|
|
169
|
-
type: 'javascript/auto',
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
test: /\.(png|svg|jpg|jpeg|webp|gif|bmp|webm|mp4|mov|mp3|m4a|wav|aac)$/,
|
|
173
|
-
type: 'asset/resource',
|
|
174
|
-
},
|
|
107
|
+
...(0, shared_bundler_config_1.getSharedModuleRules)(),
|
|
175
108
|
{
|
|
176
109
|
test: /\.tsx?$/,
|
|
177
110
|
use: [
|
|
@@ -187,10 +120,6 @@ const webpackConfig = async ({ entry, userDefinedComponent, outDir, environment,
|
|
|
187
120
|
: null,
|
|
188
121
|
].filter(truthy),
|
|
189
122
|
},
|
|
190
|
-
{
|
|
191
|
-
test: /\.(woff(2)?|otf|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
|
|
192
|
-
type: 'asset/resource',
|
|
193
|
-
},
|
|
194
123
|
{
|
|
195
124
|
test: /\.jsx?$/,
|
|
196
125
|
exclude: /node_modules/,
|
|
@@ -209,26 +138,11 @@ const webpackConfig = async ({ entry, userDefinedComponent, outDir, environment,
|
|
|
209
138
|
],
|
|
210
139
|
},
|
|
211
140
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
...conf,
|
|
219
|
-
cache: enableCaching
|
|
220
|
-
? {
|
|
221
|
-
type: 'filesystem',
|
|
222
|
-
name: (0, webpack_cache_1.getWebpackCacheName)(environment, hash),
|
|
223
|
-
version: hash,
|
|
224
|
-
}
|
|
225
|
-
: false,
|
|
226
|
-
output: {
|
|
227
|
-
...conf.output,
|
|
228
|
-
...(outDir ? { path: outDir } : {}),
|
|
229
|
-
},
|
|
230
|
-
context: remotionRoot,
|
|
231
|
-
},
|
|
232
|
-
];
|
|
141
|
+
return (0, shared_bundler_config_1.computeHashAndFinalConfig)(conf, {
|
|
142
|
+
enableCaching,
|
|
143
|
+
environment,
|
|
144
|
+
outDir,
|
|
145
|
+
remotionRoot,
|
|
146
|
+
});
|
|
233
147
|
};
|
|
234
148
|
exports.webpackConfig = webpackConfig;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/bundler"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/bundler",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.426",
|
|
7
7
|
"description": "Bundle Remotion compositions using Webpack",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"formatting": "prettier
|
|
14
|
+
"formatting": "prettier src --check",
|
|
15
15
|
"lint": "eslint src",
|
|
16
16
|
"test": "bun test src",
|
|
17
17
|
"make": "tsgo -d"
|
|
@@ -19,13 +19,15 @@
|
|
|
19
19
|
"author": "Jonny Burger <jonny@remotion.dev>",
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@rspack/core": "1.7.6",
|
|
23
|
+
"@rspack/plugin-react-refresh": "1.6.1",
|
|
22
24
|
"css-loader": "5.2.7",
|
|
23
25
|
"esbuild": "0.25.0",
|
|
24
26
|
"react-refresh": "0.9.0",
|
|
25
|
-
"remotion": "4.0.
|
|
26
|
-
"@remotion/studio": "4.0.
|
|
27
|
-
"@remotion/studio-shared": "4.0.
|
|
28
|
-
"@remotion/media-parser": "4.0.
|
|
27
|
+
"remotion": "4.0.426",
|
|
28
|
+
"@remotion/studio": "4.0.426",
|
|
29
|
+
"@remotion/studio-shared": "4.0.426",
|
|
30
|
+
"@remotion/media-parser": "4.0.426",
|
|
29
31
|
"style-loader": "4.0.0",
|
|
30
32
|
"source-map": "0.7.3",
|
|
31
33
|
"webpack": "5.105.0"
|
|
@@ -37,7 +39,7 @@
|
|
|
37
39
|
"devDependencies": {
|
|
38
40
|
"react": "19.2.3",
|
|
39
41
|
"react-dom": "19.2.3",
|
|
40
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
42
|
+
"@remotion/eslint-config-internal": "4.0.426",
|
|
41
43
|
"eslint": "9.19.0",
|
|
42
44
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
43
45
|
},
|