@remotion/bundler 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/bundle.js +22 -22
- package/dist/copy-dir.d.ts +1 -1
- package/dist/copy-dir.js +10 -10
- package/dist/esbuild-loader/index.js +2 -2
- package/dist/index-html.js +2 -2
- package/dist/optional-depdendencies.d.ts +5 -0
- package/dist/optional-depdendencies.js +27 -0
- package/dist/optional-dependencies.d.ts +5 -0
- package/dist/optional-dependencies.js +27 -0
- package/dist/read-recursively.js +12 -12
- package/dist/renderEntry.js +3 -1
- package/dist/test/validate-public-dir.test.js +2 -2
- package/dist/validate-public-dir.js +6 -6
- package/dist/webpack-cache.js +13 -13
- package/dist/webpack-config.js +5 -4
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -27,23 +27,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.bundle = exports.getConfig = void 0;
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
30
|
+
const node_fs_1 = __importStar(require("node:fs"));
|
|
31
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
32
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
33
|
+
const node_util_1 = require("node:util");
|
|
34
|
+
const node_worker_threads_1 = require("node:worker_threads");
|
|
34
35
|
const webpack_1 = __importDefault(require("webpack"));
|
|
35
|
-
const worker_threads_1 = require("worker_threads");
|
|
36
36
|
const copy_dir_1 = require("./copy-dir");
|
|
37
37
|
const index_html_1 = require("./index-html");
|
|
38
38
|
const read_recursively_1 = require("./read-recursively");
|
|
39
39
|
const webpack_config_1 = require("./webpack-config");
|
|
40
|
-
const promisified = (0,
|
|
40
|
+
const promisified = (0, node_util_1.promisify)(webpack_1.default);
|
|
41
41
|
const prepareOutDir = async (specified) => {
|
|
42
42
|
if (specified) {
|
|
43
|
-
await
|
|
43
|
+
await node_fs_1.default.promises.mkdir(specified, { recursive: true });
|
|
44
44
|
return specified;
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return node_fs_1.default.promises.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'remotion-webpack-bundle-'));
|
|
47
47
|
};
|
|
48
48
|
const trimLeadingSlash = (p) => {
|
|
49
49
|
if (p.startsWith('/')) {
|
|
@@ -100,17 +100,17 @@ const recursionLimit = 5;
|
|
|
100
100
|
const findClosestPackageJsonFolder = (currentDir) => {
|
|
101
101
|
let possiblePackageJson = '';
|
|
102
102
|
for (let i = 0; i < recursionLimit; i++) {
|
|
103
|
-
possiblePackageJson =
|
|
104
|
-
const exists =
|
|
103
|
+
possiblePackageJson = node_path_1.default.join(currentDir, 'package.json');
|
|
104
|
+
const exists = node_fs_1.default.existsSync(possiblePackageJson);
|
|
105
105
|
if (exists) {
|
|
106
|
-
return
|
|
106
|
+
return node_path_1.default.dirname(possiblePackageJson);
|
|
107
107
|
}
|
|
108
|
-
currentDir =
|
|
108
|
+
currentDir = node_path_1.default.dirname(currentDir);
|
|
109
109
|
}
|
|
110
110
|
return null;
|
|
111
111
|
};
|
|
112
112
|
const validateEntryPoint = async (entryPoint) => {
|
|
113
|
-
const contents = await
|
|
113
|
+
const contents = await node_fs_1.promises.readFile(entryPoint, 'utf8');
|
|
114
114
|
if (!contents.includes('registerRoot')) {
|
|
115
115
|
throw new Error([
|
|
116
116
|
`You passed ${entryPoint} as your entry point, but this file does not contain "registerRoot".`,
|
|
@@ -127,7 +127,7 @@ const validateEntryPoint = async (entryPoint) => {
|
|
|
127
127
|
async function bundle(...args) {
|
|
128
128
|
var _a, _b, _c, _d, _e;
|
|
129
129
|
const actualArgs = convertArgumentsIntoOptions(args);
|
|
130
|
-
const entryPoint =
|
|
130
|
+
const entryPoint = node_path_1.default.resolve(process.cwd(), actualArgs.entryPoint);
|
|
131
131
|
const resolvedRemotionRoot = (_b = (_a = actualArgs === null || actualArgs === void 0 ? void 0 : actualArgs.rootDir) !== null && _a !== void 0 ? _a : findClosestPackageJsonFolder(entryPoint)) !== null && _b !== void 0 ? _b : process.cwd();
|
|
132
132
|
if (!actualArgs.ignoreRegisterRootWarning) {
|
|
133
133
|
await validateEntryPoint(entryPoint);
|
|
@@ -138,7 +138,7 @@ async function bundle(...args) {
|
|
|
138
138
|
// `process.cwd()`. The context should always be the Remotion root.
|
|
139
139
|
// This is not supported in worker threads (used for tests)
|
|
140
140
|
const currentCwd = process.cwd();
|
|
141
|
-
if (
|
|
141
|
+
if (node_worker_threads_1.isMainThread) {
|
|
142
142
|
process.chdir(resolvedRemotionRoot);
|
|
143
143
|
}
|
|
144
144
|
const { onProgress, ...options } = actualArgs;
|
|
@@ -150,7 +150,7 @@ async function bundle(...args) {
|
|
|
150
150
|
options,
|
|
151
151
|
});
|
|
152
152
|
const output = await promisified([config]);
|
|
153
|
-
if (
|
|
153
|
+
if (node_worker_threads_1.isMainThread) {
|
|
154
154
|
process.chdir(currentCwd);
|
|
155
155
|
}
|
|
156
156
|
if (!output) {
|
|
@@ -166,15 +166,15 @@ async function bundle(...args) {
|
|
|
166
166
|
.filter(Boolean)
|
|
167
167
|
.join('/');
|
|
168
168
|
const from = (options === null || options === void 0 ? void 0 : options.publicDir)
|
|
169
|
-
?
|
|
170
|
-
:
|
|
171
|
-
const to =
|
|
169
|
+
? node_path_1.default.resolve(resolvedRemotionRoot, options.publicDir)
|
|
170
|
+
: node_path_1.default.join(resolvedRemotionRoot, 'public');
|
|
171
|
+
const to = node_path_1.default.join(outDir, 'public');
|
|
172
172
|
let symlinkWarningShown = false;
|
|
173
173
|
const showSymlinkWarning = (ent, src) => {
|
|
174
174
|
if (symlinkWarningShown) {
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
-
const absolutePath =
|
|
177
|
+
const absolutePath = node_path_1.default.join(src, ent.name);
|
|
178
178
|
if (options.onSymlinkDetected) {
|
|
179
179
|
options.onSymlinkDetected(absolutePath);
|
|
180
180
|
return;
|
|
@@ -182,7 +182,7 @@ async function bundle(...args) {
|
|
|
182
182
|
symlinkWarningShown = true;
|
|
183
183
|
console.warn(`\nFound a symbolic link in the public folder (${absolutePath}). The symlink will be forwarded into the bundle.`);
|
|
184
184
|
};
|
|
185
|
-
if (
|
|
185
|
+
if (node_fs_1.default.existsSync(from)) {
|
|
186
186
|
await (0, copy_dir_1.copyDir)({
|
|
187
187
|
src: from,
|
|
188
188
|
dest: to,
|
|
@@ -210,7 +210,7 @@ async function bundle(...args) {
|
|
|
210
210
|
title: 'Remotion Bundle',
|
|
211
211
|
renderDefaults: undefined,
|
|
212
212
|
});
|
|
213
|
-
|
|
213
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(outDir, 'index.html'), html);
|
|
214
214
|
return outDir;
|
|
215
215
|
}
|
|
216
216
|
exports.bundle = bundle;
|
package/dist/copy-dir.d.ts
CHANGED
package/dist/copy-dir.js
CHANGED
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.copyDir = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
async function copyDir({ src, dest, onSymlinkDetected, onProgress, copied = 0, }) {
|
|
10
|
-
await
|
|
11
|
-
const entries = await
|
|
10
|
+
await node_fs_1.default.promises.mkdir(dest, { recursive: true });
|
|
11
|
+
const entries = await node_fs_1.default.promises.readdir(src, { withFileTypes: true });
|
|
12
12
|
for (const entry of entries) {
|
|
13
|
-
const srcPath =
|
|
14
|
-
const destPath =
|
|
13
|
+
const srcPath = node_path_1.default.join(src, entry.name);
|
|
14
|
+
const destPath = node_path_1.default.join(dest, entry.name);
|
|
15
15
|
if (entry.isDirectory()) {
|
|
16
16
|
await copyDir({
|
|
17
17
|
src: srcPath,
|
|
@@ -22,14 +22,14 @@ async function copyDir({ src, dest, onSymlinkDetected, onProgress, copied = 0, }
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
else if (entry.isSymbolicLink()) {
|
|
25
|
-
const realpath = await
|
|
25
|
+
const realpath = await node_fs_1.default.promises.realpath(srcPath);
|
|
26
26
|
onSymlinkDetected(entry, src);
|
|
27
|
-
await
|
|
27
|
+
await node_fs_1.default.promises.symlink(realpath, destPath);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
30
|
const [, { size }] = await Promise.all([
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
node_fs_1.default.promises.copyFile(srcPath, destPath),
|
|
32
|
+
node_fs_1.default.promises.stat(srcPath),
|
|
33
33
|
]);
|
|
34
34
|
copied += size;
|
|
35
35
|
onProgress(copied);
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const esbuild_1 = require("esbuild");
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const isTsExtensionPtrn = /\.ts$/i;
|
|
9
9
|
const isTypescriptInstalled = () => {
|
|
10
10
|
try {
|
|
@@ -21,7 +21,7 @@ async function ESBuildLoader(source) {
|
|
|
21
21
|
this.getOptions();
|
|
22
22
|
const options = this.getOptions();
|
|
23
23
|
const { implementation, ...esbuildTransformOptions } = options;
|
|
24
|
-
const tsConfigPath =
|
|
24
|
+
const tsConfigPath = node_path_1.default.join(this.context, 'tsconfig.json');
|
|
25
25
|
if (implementation && typeof implementation.transform !== 'function') {
|
|
26
26
|
done(new TypeError(`esbuild-loader: options.implementation.transform must be an ESBuild transform function. Received ${typeof implementation.transform}`));
|
|
27
27
|
return;
|
package/dist/index-html.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.indexHtml = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const indexHtml = ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, previewServerCommand, renderQueue, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, }) => `
|
|
9
9
|
<!DOCTYPE html>
|
|
10
10
|
<html lang="en">
|
|
@@ -25,7 +25,7 @@ ${includeFavicon
|
|
|
25
25
|
${editorName
|
|
26
26
|
? `<script>window.remotion_editorName = "${editorName}";</script>`
|
|
27
27
|
: '<script>window.remotion_editorName = null;</script>'}
|
|
28
|
-
<script>window.remotion_projectName = ${JSON.stringify(
|
|
28
|
+
<script>window.remotion_projectName = ${JSON.stringify(node_path_1.default.basename(remotionRoot))};</script>
|
|
29
29
|
<script>window.remotion_renderDefaults = ${JSON.stringify(renderDefaults)};</script>
|
|
30
30
|
<script>window.remotion_cwd = ${JSON.stringify(remotionRoot)};</script>
|
|
31
31
|
<script>window.remotion_previewServerCommand = ${previewServerCommand ? JSON.stringify(previewServerCommand) : 'null'};</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// When Webpack cannot resolve these dependencies, it will not print an error message.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AllowOptionalDependenciesPlugin = void 0;
|
|
5
|
+
const OPTIONAL_DEPENDENCIES = [
|
|
6
|
+
'zod',
|
|
7
|
+
'@remotion/zod-types',
|
|
8
|
+
'react-native-reanimated',
|
|
9
|
+
'react-native-reanimated/package.json',
|
|
10
|
+
];
|
|
11
|
+
class AllowOptionalDependenciesPlugin {
|
|
12
|
+
filter(error) {
|
|
13
|
+
for (const dependency of OPTIONAL_DEPENDENCIES) {
|
|
14
|
+
if (error.message.includes(`Can't resolve '${dependency}'`)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
apply(compiler) {
|
|
21
|
+
compiler.hooks.afterEmit.tap('AllowOptionalDependenciesPlugin', (compilation) => {
|
|
22
|
+
compilation.errors = compilation.errors.filter(this.filter);
|
|
23
|
+
compilation.warnings = compilation.warnings.filter(this.filter);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.AllowOptionalDependenciesPlugin = AllowOptionalDependenciesPlugin;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// When Webpack cannot resolve these dependencies, it will not print an error message.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AllowOptionalDependenciesPlugin = void 0;
|
|
5
|
+
const OPTIONAL_DEPENDENCIES = [
|
|
6
|
+
'zod',
|
|
7
|
+
'@remotion/zod-types',
|
|
8
|
+
'react-native-reanimated',
|
|
9
|
+
'react-native-reanimated/package.json',
|
|
10
|
+
];
|
|
11
|
+
class AllowOptionalDependenciesPlugin {
|
|
12
|
+
filter(error) {
|
|
13
|
+
for (const dependency of OPTIONAL_DEPENDENCIES) {
|
|
14
|
+
if (error.message.includes(`Can't resolve '${dependency}'`)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
apply(compiler) {
|
|
21
|
+
compiler.hooks.afterEmit.tap('AllowOptionalDependenciesPlugin', (compilation) => {
|
|
22
|
+
compilation.errors = compilation.errors.filter(this.filter);
|
|
23
|
+
compilation.warnings = compilation.warnings.filter(this.filter);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.AllowOptionalDependenciesPlugin = AllowOptionalDependenciesPlugin;
|
package/dist/read-recursively.js
CHANGED
|
@@ -27,14 +27,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.readRecursively = void 0;
|
|
30
|
-
const
|
|
31
|
-
const
|
|
30
|
+
const node_fs_1 = __importStar(require("node:fs"));
|
|
31
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
32
32
|
const readRecursively = ({ folder, output = [], startPath, staticHash, limit, }) => {
|
|
33
|
-
const absFolder =
|
|
34
|
-
if (!
|
|
33
|
+
const absFolder = node_path_1.default.join(startPath, folder);
|
|
34
|
+
if (!node_fs_1.default.existsSync(absFolder)) {
|
|
35
35
|
return [];
|
|
36
36
|
}
|
|
37
|
-
const files =
|
|
37
|
+
const files = node_fs_1.default.readdirSync(absFolder);
|
|
38
38
|
for (const file of files) {
|
|
39
39
|
if (output.length >= limit) {
|
|
40
40
|
break;
|
|
@@ -42,11 +42,11 @@ const readRecursively = ({ folder, output = [], startPath, staticHash, limit, })
|
|
|
42
42
|
if (file.startsWith('.DS_Store')) {
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
|
-
const stat = (0,
|
|
45
|
+
const stat = (0, node_fs_1.statSync)(node_path_1.default.join(absFolder, file));
|
|
46
46
|
if (stat.isDirectory()) {
|
|
47
47
|
(0, exports.readRecursively)({
|
|
48
48
|
startPath,
|
|
49
|
-
folder:
|
|
49
|
+
folder: node_path_1.default.join(folder, file),
|
|
50
50
|
output,
|
|
51
51
|
staticHash,
|
|
52
52
|
limit,
|
|
@@ -54,21 +54,21 @@ const readRecursively = ({ folder, output = [], startPath, staticHash, limit, })
|
|
|
54
54
|
}
|
|
55
55
|
else if (stat.isFile()) {
|
|
56
56
|
output.push({
|
|
57
|
-
name:
|
|
57
|
+
name: node_path_1.default.join(folder, file),
|
|
58
58
|
lastModified: Math.floor(stat.mtimeMs),
|
|
59
59
|
sizeInBytes: stat.size,
|
|
60
|
-
src: staticHash + '/' +
|
|
60
|
+
src: staticHash + '/' + encodeURIComponent(node_path_1.default.join(folder, file)),
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
else if (stat.isSymbolicLink()) {
|
|
64
|
-
const realpath =
|
|
65
|
-
const realStat =
|
|
64
|
+
const realpath = node_fs_1.default.realpathSync(node_path_1.default.join(folder, file));
|
|
65
|
+
const realStat = node_fs_1.default.statSync(realpath);
|
|
66
66
|
if (realStat.isFile()) {
|
|
67
67
|
output.push({
|
|
68
68
|
name: realpath,
|
|
69
69
|
lastModified: Math.floor(realStat.mtimeMs),
|
|
70
70
|
sizeInBytes: realStat.size,
|
|
71
|
-
src: staticHash + '/' + realpath,
|
|
71
|
+
src: staticHash + '/' + encodeURIComponent(realpath),
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
}
|
package/dist/renderEntry.js
CHANGED
|
@@ -44,7 +44,9 @@ const GetVideo = ({ state }) => {
|
|
|
44
44
|
if (!video && compositions.compositions.length > 0) {
|
|
45
45
|
const foundComposition = compositions.compositions.find((c) => c.id === state.compositionName);
|
|
46
46
|
if (!foundComposition) {
|
|
47
|
-
throw new Error(
|
|
47
|
+
throw new Error(`Found no composition with the name ${state.compositionName}. The following compositions were found instead: ${compositions.compositions
|
|
48
|
+
.map((c) => c.id)
|
|
49
|
+
.join(', ')}. All compositions must have their ID calculated deterministically and must be mounted at the same time.`);
|
|
48
50
|
}
|
|
49
51
|
compositions.setCurrentComposition((_a = foundComposition === null || foundComposition === void 0 ? void 0 : foundComposition.id) !== null && _a !== void 0 ? _a : null);
|
|
50
52
|
compositions.setCurrentCompositionMetadata({
|
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
7
7
|
const vitest_1 = require("vitest");
|
|
8
8
|
const validate_public_dir_1 = require("../validate-public-dir");
|
|
9
9
|
(0, vitest_1.describe)('validatePublicDir()', () => {
|
|
10
10
|
(0, vitest_1.test)('Should not allow root directory as public dir.', () => {
|
|
11
|
-
(0, vitest_1.expect)(() => (0, validate_public_dir_1.validatePublicDir)(
|
|
11
|
+
(0, vitest_1.expect)(() => (0, validate_public_dir_1.validatePublicDir)(node_path_1.default.parse(process.cwd()).root)).toThrow(/which is the root directory. This is not allowed./);
|
|
12
12
|
});
|
|
13
13
|
(0, vitest_1.test)('Should not allow a path where the parent directory does not exist', () => {
|
|
14
14
|
const pathToPass = process.platform === 'win32' ? 'C:\\foo\\bar' : '/foo/bar';
|
|
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.validatePublicDir = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const validatePublicDir = (p) => {
|
|
10
|
-
const { root } =
|
|
10
|
+
const { root } = node_path_1.default.parse(process.cwd());
|
|
11
11
|
if (p === root) {
|
|
12
12
|
throw new Error(`The public directory was specified as "${p}", which is the root directory. This is not allowed.`);
|
|
13
13
|
}
|
|
14
14
|
try {
|
|
15
|
-
const stat =
|
|
15
|
+
const stat = node_fs_1.default.lstatSync(p);
|
|
16
16
|
if (!stat.isDirectory()) {
|
|
17
17
|
throw new Error(`The public directory was specified as "${p}", and while this path exists on the filesystem, it is not a directory.`);
|
|
18
18
|
}
|
|
@@ -20,8 +20,8 @@ const validatePublicDir = (p) => {
|
|
|
20
20
|
catch (e) {
|
|
21
21
|
// Path does not exist
|
|
22
22
|
// Check if the parent path exists
|
|
23
|
-
const parentPath =
|
|
24
|
-
const exists =
|
|
23
|
+
const parentPath = node_path_1.default.dirname(p);
|
|
24
|
+
const exists = node_fs_1.default.existsSync(parentPath);
|
|
25
25
|
if (!exists) {
|
|
26
26
|
throw new Error(`The public directory was specified as "${p}", but this folder does not exist and the parent directory "${parentPath}" does also not exist. Create at least the parent directory.`);
|
|
27
27
|
}
|
package/dist/webpack-cache.js
CHANGED
|
@@ -4,21 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.cacheExists = exports.getWebpackCacheName = exports.clearCache = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
// Inlined from https://github.com/webpack/webpack/blob/4c2ee7a4ddb8db2362ca83b6c4190523387ba7ee/lib/config/defaults.js#L265
|
|
10
10
|
// An algorithm to determine where Webpack will cache the depencies
|
|
11
11
|
const getWebpackCacheDir = (remotionRoot) => {
|
|
12
12
|
let dir = remotionRoot;
|
|
13
13
|
for (;;) {
|
|
14
14
|
try {
|
|
15
|
-
if (
|
|
15
|
+
if (node_fs_1.default.statSync(node_path_1.default.join(dir, 'package.json')).isFile()) {
|
|
16
16
|
break;
|
|
17
17
|
}
|
|
18
18
|
// eslint-disable-next-line no-empty
|
|
19
19
|
}
|
|
20
20
|
catch (e) { }
|
|
21
|
-
const parent =
|
|
21
|
+
const parent = node_path_1.default.dirname(dir);
|
|
22
22
|
if (dir === parent) {
|
|
23
23
|
dir = undefined;
|
|
24
24
|
break;
|
|
@@ -26,21 +26,21 @@ const getWebpackCacheDir = (remotionRoot) => {
|
|
|
26
26
|
dir = parent;
|
|
27
27
|
}
|
|
28
28
|
if (!dir) {
|
|
29
|
-
return
|
|
29
|
+
return node_path_1.default.resolve(remotionRoot, '.cache/webpack');
|
|
30
30
|
}
|
|
31
31
|
if (process.versions.pnp === '1') {
|
|
32
|
-
return
|
|
32
|
+
return node_path_1.default.resolve(dir, '.pnp/.cache/webpack');
|
|
33
33
|
}
|
|
34
34
|
if (process.versions.pnp === '3') {
|
|
35
|
-
return
|
|
35
|
+
return node_path_1.default.resolve(dir, '.yarn/.cache/webpack');
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return node_path_1.default.resolve(dir, 'node_modules/.cache/webpack');
|
|
38
38
|
};
|
|
39
39
|
const remotionCacheLocation = (remotionRoot, environment, hash) => {
|
|
40
|
-
return
|
|
40
|
+
return node_path_1.default.join(getWebpackCacheDir(remotionRoot), (0, exports.getWebpackCacheName)(environment, hash));
|
|
41
41
|
};
|
|
42
42
|
const clearCache = (remotionRoot) => {
|
|
43
|
-
return
|
|
43
|
+
return node_fs_1.default.promises.rm(getWebpackCacheDir(remotionRoot), {
|
|
44
44
|
recursive: true,
|
|
45
45
|
});
|
|
46
46
|
};
|
|
@@ -58,7 +58,7 @@ const getWebpackCacheName = (environment, hash) => {
|
|
|
58
58
|
};
|
|
59
59
|
exports.getWebpackCacheName = getWebpackCacheName;
|
|
60
60
|
const hasOtherCache = ({ remotionRoot, environment, }) => {
|
|
61
|
-
const cacheDir =
|
|
61
|
+
const cacheDir = node_fs_1.default.readdirSync(getWebpackCacheDir(remotionRoot));
|
|
62
62
|
if (cacheDir.find((c) => {
|
|
63
63
|
return c.startsWith(getPrefix(environment));
|
|
64
64
|
})) {
|
|
@@ -67,10 +67,10 @@ const hasOtherCache = ({ remotionRoot, environment, }) => {
|
|
|
67
67
|
return false;
|
|
68
68
|
};
|
|
69
69
|
const cacheExists = (remotionRoot, environment, hash) => {
|
|
70
|
-
if (
|
|
70
|
+
if (node_fs_1.default.existsSync(remotionCacheLocation(remotionRoot, environment, hash))) {
|
|
71
71
|
return 'exists';
|
|
72
72
|
}
|
|
73
|
-
if (!
|
|
73
|
+
if (!node_fs_1.default.existsSync(getWebpackCacheDir(remotionRoot))) {
|
|
74
74
|
return 'does-not-exist';
|
|
75
75
|
}
|
|
76
76
|
if (hasOtherCache({ remotionRoot, environment })) {
|
package/dist/webpack-config.js
CHANGED
|
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.webpackConfig = void 0;
|
|
30
|
-
const
|
|
30
|
+
const node_crypto_1 = require("node:crypto");
|
|
31
31
|
const react_dom_1 = __importDefault(require("react-dom"));
|
|
32
32
|
const remotion_1 = require("remotion");
|
|
33
33
|
const webpack_1 = __importStar(require("webpack"));
|
|
@@ -35,6 +35,7 @@ const fast_refresh_1 = require("./fast-refresh");
|
|
|
35
35
|
const stringify_with_circular_references_1 = require("./stringify-with-circular-references");
|
|
36
36
|
const webpack_cache_1 = require("./webpack-cache");
|
|
37
37
|
const esbuild = require("esbuild");
|
|
38
|
+
const optional_dependencies_1 = require("./optional-dependencies");
|
|
38
39
|
if (!react_dom_1.default || !react_dom_1.default.version) {
|
|
39
40
|
throw new Error('Could not find "react-dom" package. Did you install it?');
|
|
40
41
|
}
|
|
@@ -92,6 +93,7 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
|
|
|
92
93
|
'process.env.KEYBOARD_SHORTCUTS_ENABLED': keyboardShortcutsEnabled,
|
|
93
94
|
[`process.env.${remotion_1.Internals.ENV_VARIABLES_ENV_NAME}`]: JSON.stringify(envVariables),
|
|
94
95
|
}),
|
|
96
|
+
new optional_dependencies_1.AllowOptionalDependenciesPlugin(),
|
|
95
97
|
]
|
|
96
98
|
: [
|
|
97
99
|
new webpack_1.ProgressPlugin((p) => {
|
|
@@ -99,10 +101,10 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
|
|
|
99
101
|
onProgress(Number((p * 100).toFixed(2)));
|
|
100
102
|
}
|
|
101
103
|
}),
|
|
104
|
+
new optional_dependencies_1.AllowOptionalDependenciesPlugin(),
|
|
102
105
|
],
|
|
103
106
|
output: {
|
|
104
107
|
hashFunction: 'xxhash64',
|
|
105
|
-
globalObject: 'this',
|
|
106
108
|
filename: 'bundle.js',
|
|
107
109
|
devtoolModuleFilenameTemplate: '[resource-path]',
|
|
108
110
|
assetModuleFilename: environment === 'development' ? '[path][name][ext]' : '[hash][ext]',
|
|
@@ -117,7 +119,6 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
|
|
|
117
119
|
? require.resolve('react-dom/client')
|
|
118
120
|
: require.resolve('react-dom'),
|
|
119
121
|
remotion: require.resolve('remotion'),
|
|
120
|
-
'react-native$': 'react-native-web',
|
|
121
122
|
},
|
|
122
123
|
},
|
|
123
124
|
module: {
|
|
@@ -168,7 +169,7 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
|
|
|
168
169
|
],
|
|
169
170
|
},
|
|
170
171
|
});
|
|
171
|
-
const hash = (0,
|
|
172
|
+
const hash = (0, node_crypto_1.createHash)('md5')
|
|
172
173
|
.update((0, stringify_with_circular_references_1.jsonStringifyWithCircularReferences)(conf))
|
|
173
174
|
.digest('hex');
|
|
174
175
|
return [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/bundler",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-alpha7",
|
|
4
4
|
"description": "Bundler for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"css-loader": "5.2.7",
|
|
21
21
|
"esbuild": "0.16.12",
|
|
22
22
|
"react-refresh": "0.9.0",
|
|
23
|
-
"remotion": "4.0.0-
|
|
23
|
+
"remotion": "4.0.0-alpha7",
|
|
24
24
|
"style-loader": "2.0.0",
|
|
25
25
|
"webpack": "5.76.1"
|
|
26
26
|
},
|