@remotion/bundler 3.0.9 → 3.0.10
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 +7 -0
- package/dist/bundle.js +76 -0
- package/dist/error-overlay/remotion-overlay/carets.d.ts +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +3 -3
package/dist/bundle.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WebpackOverrideFn } from 'remotion';
|
|
2
|
+
export declare const bundle: (entryPoint: string, onProgressUpdate?: ((progress: number) => void) | undefined, options?: {
|
|
3
|
+
webpackOverride?: WebpackOverrideFn | undefined;
|
|
4
|
+
outDir?: string | undefined;
|
|
5
|
+
enableCaching?: boolean | undefined;
|
|
6
|
+
publicPath?: string | undefined;
|
|
7
|
+
} | undefined) => Promise<string>;
|
package/dist/bundle.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
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.bundle = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const os_1 = __importDefault(require("os"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const remotion_1 = require("remotion");
|
|
11
|
+
const util_1 = require("util");
|
|
12
|
+
const webpack_1 = __importDefault(require("webpack"));
|
|
13
|
+
const copy_dir_1 = require("./copy-dir");
|
|
14
|
+
const static_preview_1 = require("./static-preview");
|
|
15
|
+
const webpack_config_1 = require("./webpack-config");
|
|
16
|
+
const entry = require.resolve('./renderEntry');
|
|
17
|
+
const promisified = (0, util_1.promisify)(webpack_1.default);
|
|
18
|
+
const prepareOutDir = async (specified) => {
|
|
19
|
+
if (specified) {
|
|
20
|
+
await fs_1.default.promises.mkdir(specified, { recursive: true });
|
|
21
|
+
return specified;
|
|
22
|
+
}
|
|
23
|
+
return fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'react-motion-graphics'));
|
|
24
|
+
};
|
|
25
|
+
const trimLeadingSlash = (p) => {
|
|
26
|
+
if (p.startsWith('/')) {
|
|
27
|
+
return trimLeadingSlash(p.substr(1));
|
|
28
|
+
}
|
|
29
|
+
return p;
|
|
30
|
+
};
|
|
31
|
+
const trimTrailingSlash = (p) => {
|
|
32
|
+
if (p.endsWith('/')) {
|
|
33
|
+
return trimTrailingSlash(p.substr(0, p.length - 1));
|
|
34
|
+
}
|
|
35
|
+
return p;
|
|
36
|
+
};
|
|
37
|
+
const bundle = async (entryPoint, onProgressUpdate, options) => {
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
const outDir = await prepareOutDir((_a = options === null || options === void 0 ? void 0 : options.outDir) !== null && _a !== void 0 ? _a : null);
|
|
40
|
+
const output = await promisified([
|
|
41
|
+
(0, webpack_config_1.webpackConfig)({
|
|
42
|
+
entry,
|
|
43
|
+
userDefinedComponent: entryPoint,
|
|
44
|
+
outDir,
|
|
45
|
+
environment: 'production',
|
|
46
|
+
webpackOverride: (_b = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _b !== void 0 ? _b : remotion_1.Internals.defaultOverrideFunction,
|
|
47
|
+
onProgressUpdate,
|
|
48
|
+
enableCaching: (_c = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _c !== void 0 ? _c : remotion_1.Internals.DEFAULT_WEBPACK_CACHE_ENABLED,
|
|
49
|
+
maxTimelineTracks: 15,
|
|
50
|
+
// For production, the variables are set dynamically
|
|
51
|
+
envVariables: {},
|
|
52
|
+
inputProps: {},
|
|
53
|
+
}),
|
|
54
|
+
]);
|
|
55
|
+
if (!output) {
|
|
56
|
+
throw new Error('Expected webpack output');
|
|
57
|
+
}
|
|
58
|
+
const { errors } = output.toJson();
|
|
59
|
+
if (errors !== undefined && errors.length > 0) {
|
|
60
|
+
throw new Error(errors[0].message + '\n' + errors[0].details);
|
|
61
|
+
}
|
|
62
|
+
const baseDir = (_d = options === null || options === void 0 ? void 0 : options.publicPath) !== null && _d !== void 0 ? _d : '/';
|
|
63
|
+
const publicDir = '/' +
|
|
64
|
+
[trimTrailingSlash(trimLeadingSlash(baseDir)), 'public']
|
|
65
|
+
.filter(Boolean)
|
|
66
|
+
.join('/');
|
|
67
|
+
const from = path_1.default.join(process.cwd(), 'public');
|
|
68
|
+
const to = path_1.default.join(outDir, 'public');
|
|
69
|
+
if (fs_1.default.existsSync(from)) {
|
|
70
|
+
await (0, copy_dir_1.copyDir)(from, to);
|
|
71
|
+
}
|
|
72
|
+
const html = (0, static_preview_1.indexHtml)(publicDir, baseDir, null);
|
|
73
|
+
fs_1.default.writeFileSync(path_1.default.join(outDir, 'index.html'), html);
|
|
74
|
+
return outDir;
|
|
75
|
+
};
|
|
76
|
+
exports.bundle = bundle;
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,6 @@ export declare const BundlerInternals: {
|
|
|
17
17
|
}[];
|
|
18
18
|
esbuild: typeof esbuild;
|
|
19
19
|
};
|
|
20
|
-
export { bundle } from './
|
|
20
|
+
export { bundle } from './bundle';
|
|
21
21
|
export { PackageManager } from './get-package-manager';
|
|
22
22
|
export type { ProjectInfo } from './project-info';
|
package/dist/index.js
CHANGED
|
@@ -15,5 +15,5 @@ exports.BundlerInternals = {
|
|
|
15
15
|
lockFilePaths: get_package_manager_1.lockFilePaths,
|
|
16
16
|
esbuild,
|
|
17
17
|
};
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(exports, "bundle", { enumerable: true, get: function () { return
|
|
18
|
+
var bundle_1 = require("./bundle");
|
|
19
|
+
Object.defineProperty(exports, "bundle", { enumerable: true, get: function () { return bundle_1.bundle; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/bundler",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "Bundler for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"memfs": "3.4.3",
|
|
32
32
|
"mime-types": "2.1.34",
|
|
33
33
|
"react-refresh": "0.9.0",
|
|
34
|
-
"remotion": "3.0.
|
|
34
|
+
"remotion": "3.0.10",
|
|
35
35
|
"semver": "7.3.4",
|
|
36
36
|
"source-map": "0.6.1",
|
|
37
37
|
"source-map-loader": "3.0.0",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "3ae18de4dd2dda522e37a04c0a5c225f2a94e3a1"
|
|
81
81
|
}
|