@remotion/bundler 3.1.5 → 3.1.8
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 +10 -4
- package/dist/bundle.js +36 -11
- package/dist/dev-middleware/compatible-api.d.ts +3 -3
- package/dist/dev-middleware/range-parser.d.ts +1 -1
- package/dist/esbuild-loader/index.js +1 -1
- package/dist/hot-middleware/index.d.ts +1 -0
- package/dist/index-html.d.ts +7 -1
- package/dist/index-html.js +3 -3
- package/dist/index.d.ts +21 -12
- package/dist/is-path-inside.d.ts +1 -0
- package/dist/is-path-inside.js +27 -0
- package/dist/routes.d.ts +0 -6
- package/dist/routes.js +12 -13
- package/dist/serve-static.d.ts +1 -18
- package/dist/serve-static.js +64 -55
- package/dist/setup-environment.js +0 -1
- package/dist/ts-alias-plugin.d.ts +4 -0
- package/dist/ts-alias-plugin.js +21 -0
- package/dist/webpack-cache.d.ts +2 -2
- package/dist/webpack-cache.js +13 -14
- package/dist/webpack-config.d.ts +2 -1
- package/dist/webpack-config.js +2 -1
- package/package.json +3 -3
- package/dist/bundle-mode.d.ts.map +0 -1
- package/dist/bundle-mode.js.map +0 -1
- package/dist/bundler.d.ts.map +0 -1
- package/dist/bundler.js.map +0 -1
- package/dist/copy-dir.d.ts.map +0 -1
- package/dist/copy-dir.js.map +0 -1
- package/dist/dev-middleware/compatible-api.d.ts.map +0 -1
- package/dist/dev-middleware/compatible-api.js.map +0 -1
- package/dist/dev-middleware/get-filename-from-url.d.ts.map +0 -1
- package/dist/dev-middleware/get-filename-from-url.js.map +0 -1
- package/dist/dev-middleware/get-paths.d.ts.map +0 -1
- package/dist/dev-middleware/get-paths.js.map +0 -1
- package/dist/dev-middleware/index.d.ts.map +0 -1
- package/dist/dev-middleware/index.js.map +0 -1
- package/dist/dev-middleware/is-color-supported.d.ts.map +0 -1
- package/dist/dev-middleware/is-color-supported.js.map +0 -1
- package/dist/dev-middleware/middleware.d.ts.map +0 -1
- package/dist/dev-middleware/middleware.js.map +0 -1
- package/dist/dev-middleware/range-parser.d.ts.map +0 -1
- package/dist/dev-middleware/range-parser.js.map +0 -1
- package/dist/dev-middleware/ready.d.ts.map +0 -1
- package/dist/dev-middleware/ready.js.map +0 -1
- package/dist/dev-middleware/setup-hooks.d.ts.map +0 -1
- package/dist/dev-middleware/setup-hooks.js.map +0 -1
- package/dist/dev-middleware/setup-output-filesystem.d.ts.map +0 -1
- package/dist/dev-middleware/setup-output-filesystem.js.map +0 -1
- package/dist/dev-middleware/types.d.ts.map +0 -1
- package/dist/dev-middleware/types.js.map +0 -1
- package/dist/error-overlay/entry-basic.d.ts.map +0 -1
- package/dist/error-overlay/entry-basic.js.map +0 -1
- package/dist/error-overlay/react-overlay/effects/format-warning.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/effects/format-warning.js.map +0 -1
- package/dist/error-overlay/react-overlay/effects/map-error-to-react-stack.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/effects/map-error-to-react-stack.js.map +0 -1
- package/dist/error-overlay/react-overlay/effects/proxy-console.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/effects/proxy-console.js.map +0 -1
- package/dist/error-overlay/react-overlay/effects/resolve-file-source.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/effects/resolve-file-source.js.map +0 -1
- package/dist/error-overlay/react-overlay/effects/stack-trace-limit.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/effects/stack-trace-limit.js.map +0 -1
- package/dist/error-overlay/react-overlay/effects/unhandled-error.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/effects/unhandled-error.js.map +0 -1
- package/dist/error-overlay/react-overlay/effects/unhandled-rejection.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/effects/unhandled-rejection.js.map +0 -1
- package/dist/error-overlay/react-overlay/index.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/index.js.map +0 -1
- package/dist/error-overlay/react-overlay/listen-to-runtime-errors.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js.map +0 -1
- package/dist/error-overlay/react-overlay/utils/get-file-source.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/utils/get-file-source.js.map +0 -1
- package/dist/error-overlay/react-overlay/utils/get-lines-around.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/utils/get-lines-around.js.map +0 -1
- package/dist/error-overlay/react-overlay/utils/get-source-map.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/utils/get-source-map.js.map +0 -1
- package/dist/error-overlay/react-overlay/utils/get-stack-frames.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/utils/get-stack-frames.js.map +0 -1
- package/dist/error-overlay/react-overlay/utils/open-in-editor.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/utils/open-in-editor.js.map +0 -1
- package/dist/error-overlay/react-overlay/utils/parser.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/utils/parser.js.map +0 -1
- package/dist/error-overlay/react-overlay/utils/stack-frame.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/utils/stack-frame.js.map +0 -1
- package/dist/error-overlay/react-overlay/utils/unmapper.d.ts.map +0 -1
- package/dist/error-overlay/react-overlay/utils/unmapper.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/AskOnDiscord.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/AskOnDiscord.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/Button.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/Button.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/CodeFrame.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/CodeFrame.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/DismissButton.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/DismissButton.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/ErrorDisplay.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/ErrorDisplay.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/ErrorLoader.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/ErrorTitle.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/ErrorTitle.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/OpenInEditor.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/OpenInEditor.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/Overlay.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/Overlay.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/StackFrame.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/StackFrame.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/Symbolicating.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/Symbolicating.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/carets.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/carets.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/format-location.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/format-location.js.map +0 -1
- package/dist/error-overlay/remotion-overlay/index.d.ts.map +0 -1
- package/dist/error-overlay/remotion-overlay/index.js.map +0 -1
- package/dist/esbuild-loader/index.d.ts.map +0 -1
- package/dist/esbuild-loader/index.js.map +0 -1
- package/dist/esbuild-loader/interfaces.d.ts.map +0 -1
- package/dist/esbuild-loader/interfaces.js.map +0 -1
- package/dist/fast-refresh/helpers.d.ts.map +0 -1
- package/dist/fast-refresh/helpers.js.map +0 -1
- package/dist/fast-refresh/index.d.ts.map +0 -1
- package/dist/fast-refresh/index.js.map +0 -1
- package/dist/fast-refresh/loader.d.ts.map +0 -1
- package/dist/fast-refresh/loader.js.map +0 -1
- package/dist/fast-refresh/runtime.d.ts.map +0 -1
- package/dist/fast-refresh/runtime.js.map +0 -1
- package/dist/get-latest-remotion-version.d.ts.map +0 -1
- package/dist/get-latest-remotion-version.js.map +0 -1
- package/dist/get-package-manager.d.ts.map +0 -1
- package/dist/get-package-manager.js.map +0 -1
- package/dist/get-port.d.ts.map +0 -1
- package/dist/get-port.js.map +0 -1
- package/dist/homepage/homepage.d.ts.map +0 -1
- package/dist/homepage/homepage.js.map +0 -1
- package/dist/hot-middleware/client.d.ts.map +0 -1
- package/dist/hot-middleware/client.js.map +0 -1
- package/dist/hot-middleware/index.d.ts.map +0 -1
- package/dist/hot-middleware/index.js.map +0 -1
- package/dist/hot-middleware/process-update.d.ts.map +0 -1
- package/dist/hot-middleware/process-update.js.map +0 -1
- package/dist/hot-middleware/strip-ansi.d.ts.map +0 -1
- package/dist/hot-middleware/strip-ansi.js.map +0 -1
- package/dist/hot-middleware/types.d.ts.map +0 -1
- package/dist/hot-middleware/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json-parser.d.ts +0 -7
- package/dist/json-parser.js +0 -177
- package/dist/project-info.d.ts.map +0 -1
- package/dist/project-info.js.map +0 -1
- package/dist/read.d.ts +0 -6
- package/dist/read.js +0 -183
- package/dist/renderEntry.d.ts.map +0 -1
- package/dist/renderEntry.js.map +0 -1
- package/dist/setup-environment.d.ts.map +0 -1
- package/dist/setup-environment.js.map +0 -1
- package/dist/start-server.d.ts.map +0 -1
- package/dist/start-server.js.map +0 -1
- package/dist/static-preview.d.ts.map +0 -1
- package/dist/static-preview.js.map +0 -1
- package/dist/static-server.d.ts +0 -0
- package/dist/static-server.js +0 -1
- package/dist/test/expect-to-throw.d.ts.map +0 -1
- package/dist/test/expect-to-throw.js.map +0 -1
- package/dist/test/latest-remotion-version.test.d.ts.map +0 -1
- package/dist/test/latest-remotion-version.test.js.map +0 -1
- package/dist/test/parse-error-stack.test.d.ts.map +0 -1
- package/dist/test/parse-error-stack.test.js.map +0 -1
- package/dist/test/parse-module-not-found.test.d.ts.map +0 -1
- package/dist/test/parse-module-not-found.test.js.map +0 -1
- package/dist/test/secure-source-read.test.d.ts.map +0 -1
- package/dist/test/secure-source-read.test.js.map +0 -1
- package/dist/update-available.d.ts.map +0 -1
- package/dist/update-available.js.map +0 -1
- package/dist/webpack-cache.d.ts.map +0 -1
- package/dist/webpack-cache.js.map +0 -1
- package/dist/webpack-config.d.ts.map +0 -1
- package/dist/webpack-config.js.map +0 -1
package/dist/bundle.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import type { WebpackOverrideFn } from 'remotion';
|
|
2
2
|
import webpack from 'webpack';
|
|
3
|
-
declare type
|
|
3
|
+
export declare type BundleOptions = {
|
|
4
4
|
webpackOverride?: WebpackOverrideFn;
|
|
5
5
|
outDir?: string;
|
|
6
6
|
enableCaching?: boolean;
|
|
7
7
|
publicPath?: string;
|
|
8
|
+
rootDir?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare const getConfig: (
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
export declare const getConfig: ({ entryPoint, outDir, resolvedRemotionRoot, onProgressUpdate, options, }: {
|
|
11
|
+
outDir: string;
|
|
12
|
+
entryPoint: string;
|
|
13
|
+
resolvedRemotionRoot: string;
|
|
14
|
+
onProgressUpdate?: ((progress: number) => void) | undefined;
|
|
15
|
+
options?: BundleOptions | undefined;
|
|
16
|
+
}) => [string, webpack.Configuration];
|
|
17
|
+
export declare const bundle: (entryPoint: string, onProgressUpdate?: ((progress: number) => void) | undefined, options?: BundleOptions) => Promise<string>;
|
package/dist/bundle.js
CHANGED
|
@@ -7,9 +7,9 @@ exports.bundle = exports.getConfig = void 0;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const remotion_1 = require("remotion");
|
|
11
10
|
const util_1 = require("util");
|
|
12
11
|
const webpack_1 = __importDefault(require("webpack"));
|
|
12
|
+
const worker_threads_1 = require("worker_threads");
|
|
13
13
|
const copy_dir_1 = require("./copy-dir");
|
|
14
14
|
const index_html_1 = require("./index-html");
|
|
15
15
|
const webpack_config_1 = require("./webpack-config");
|
|
@@ -34,28 +34,46 @@ const trimTrailingSlash = (p) => {
|
|
|
34
34
|
}
|
|
35
35
|
return p;
|
|
36
36
|
};
|
|
37
|
-
const getConfig = (outDir,
|
|
37
|
+
const getConfig = ({ entryPoint, outDir, resolvedRemotionRoot, onProgressUpdate, options, }) => {
|
|
38
38
|
var _a, _b;
|
|
39
39
|
return (0, webpack_config_1.webpackConfig)({
|
|
40
40
|
entry,
|
|
41
41
|
userDefinedComponent: entryPoint,
|
|
42
42
|
outDir,
|
|
43
43
|
environment: 'production',
|
|
44
|
-
webpackOverride: (_a = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _a !== void 0 ? _a :
|
|
44
|
+
webpackOverride: (_a = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _a !== void 0 ? _a : ((f) => f),
|
|
45
45
|
onProgressUpdate,
|
|
46
|
-
enableCaching: (_b = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _b !== void 0 ? _b :
|
|
46
|
+
enableCaching: (_b = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _b !== void 0 ? _b : true,
|
|
47
47
|
maxTimelineTracks: 15,
|
|
48
48
|
// For production, the variables are set dynamically
|
|
49
49
|
envVariables: {},
|
|
50
50
|
entryPoints: [],
|
|
51
|
+
remotionRoot: resolvedRemotionRoot,
|
|
51
52
|
});
|
|
52
53
|
};
|
|
53
54
|
exports.getConfig = getConfig;
|
|
54
55
|
const bundle = async (entryPoint, onProgressUpdate, options) => {
|
|
55
|
-
var _a, _b;
|
|
56
|
-
const
|
|
57
|
-
const
|
|
56
|
+
var _a, _b, _c;
|
|
57
|
+
const resolvedRemotionRoot = (_a = options === null || options === void 0 ? void 0 : options.rootDir) !== null && _a !== void 0 ? _a : process.cwd();
|
|
58
|
+
const outDir = await prepareOutDir((_b = options === null || options === void 0 ? void 0 : options.outDir) !== null && _b !== void 0 ? _b : null);
|
|
59
|
+
// The config might use an override which might use
|
|
60
|
+
// `process.cwd()`. The context should always be the Remotion root.
|
|
61
|
+
// This is not supported in worker threads (used for tests)
|
|
62
|
+
const currentCwd = process.cwd();
|
|
63
|
+
if (worker_threads_1.isMainThread) {
|
|
64
|
+
process.chdir(resolvedRemotionRoot);
|
|
65
|
+
}
|
|
66
|
+
const [, config] = (0, exports.getConfig)({
|
|
67
|
+
outDir,
|
|
68
|
+
entryPoint,
|
|
69
|
+
resolvedRemotionRoot,
|
|
70
|
+
onProgressUpdate,
|
|
71
|
+
options,
|
|
72
|
+
});
|
|
58
73
|
const output = await promisified([config]);
|
|
74
|
+
if (worker_threads_1.isMainThread) {
|
|
75
|
+
process.chdir(currentCwd);
|
|
76
|
+
}
|
|
59
77
|
if (!output) {
|
|
60
78
|
throw new Error('Expected webpack output');
|
|
61
79
|
}
|
|
@@ -63,17 +81,24 @@ const bundle = async (entryPoint, onProgressUpdate, options) => {
|
|
|
63
81
|
if (errors !== undefined && errors.length > 0) {
|
|
64
82
|
throw new Error(errors[0].message + '\n' + errors[0].details);
|
|
65
83
|
}
|
|
66
|
-
const baseDir = (
|
|
67
|
-
const
|
|
84
|
+
const baseDir = (_c = options === null || options === void 0 ? void 0 : options.publicPath) !== null && _c !== void 0 ? _c : '/';
|
|
85
|
+
const staticHash = '/' +
|
|
68
86
|
[trimTrailingSlash(trimLeadingSlash(baseDir)), 'public']
|
|
69
87
|
.filter(Boolean)
|
|
70
88
|
.join('/');
|
|
71
|
-
|
|
89
|
+
// TODO: Unhardcode public directory
|
|
90
|
+
const from = path_1.default.join(resolvedRemotionRoot, 'public');
|
|
72
91
|
const to = path_1.default.join(outDir, 'public');
|
|
73
92
|
if (fs_1.default.existsSync(from)) {
|
|
74
93
|
await (0, copy_dir_1.copyDir)(from, to);
|
|
75
94
|
}
|
|
76
|
-
const html = (0, index_html_1.indexHtml)(
|
|
95
|
+
const html = (0, index_html_1.indexHtml)({
|
|
96
|
+
staticHash,
|
|
97
|
+
baseDir,
|
|
98
|
+
editorName: null,
|
|
99
|
+
inputProps: null,
|
|
100
|
+
remotionRoot: resolvedRemotionRoot,
|
|
101
|
+
});
|
|
77
102
|
fs_1.default.writeFileSync(path_1.default.join(outDir, 'index.html'), html);
|
|
78
103
|
return outDir;
|
|
79
104
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { Request, Response } from 'express';
|
|
4
4
|
import { ReadStream } from 'fs';
|
|
5
|
-
export declare function getHeaderNames(res: Response):
|
|
6
|
-
export declare function getHeaderFromRequest(req: Request, name: string):
|
|
7
|
-
export declare function getHeaderFromResponse(res: Response, name: string):
|
|
5
|
+
export declare function getHeaderNames(res: Response): string[];
|
|
6
|
+
export declare function getHeaderFromRequest(req: Request, name: string): string | string[] | undefined;
|
|
7
|
+
export declare function getHeaderFromResponse(res: Response, name: string): string;
|
|
8
8
|
export declare function setHeaderForResponse(res: Response, name: string, value: string | number): void;
|
|
9
9
|
export declare function setStatusCode(res: Response, code: number): void;
|
|
10
10
|
export declare function send(req: Request, res: Response, bufferOtStream: ReadStream | string | Buffer, byteLength: number): void;
|
|
@@ -11,5 +11,5 @@ declare type Range = {
|
|
|
11
11
|
declare type Ranges = Range[] & {
|
|
12
12
|
type?: string;
|
|
13
13
|
};
|
|
14
|
-
export declare function parseRange(size: number, str: string | string[]):
|
|
14
|
+
export declare function parseRange(size: number, str: string | string[]): Ranges | -1 | -2;
|
|
15
15
|
export {};
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const esbuild_1 = require("esbuild");
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const tsConfigPath = path_1.default.join(process.cwd(), 'tsconfig.json');
|
|
9
8
|
const isTsExtensionPtrn = /\.ts$/i;
|
|
10
9
|
const isTypescriptInstalled = () => {
|
|
11
10
|
try {
|
|
@@ -22,6 +21,7 @@ async function ESBuildLoader(source) {
|
|
|
22
21
|
this.getOptions();
|
|
23
22
|
const options = this.getOptions();
|
|
24
23
|
const { implementation, ...esbuildTransformOptions } = options;
|
|
24
|
+
const tsConfigPath = 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;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* https://github.com/webpack-contrib/webpack-hot-middleware#readme
|
|
4
4
|
* and rewritten in TypeScript. This file is MIT licensed
|
|
5
5
|
*/
|
|
6
|
+
import { Request, Response } from 'express';
|
|
6
7
|
import webpack from 'webpack';
|
|
7
8
|
import { HotMiddlewareMessage } from './types';
|
|
8
9
|
export declare const webpackHotMiddleware: (compiler: webpack.Compiler) => {
|
package/dist/index-html.d.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export declare const indexHtml: (
|
|
1
|
+
export declare const indexHtml: ({ baseDir, editorName, inputProps, staticHash, remotionRoot, }: {
|
|
2
|
+
staticHash: string;
|
|
3
|
+
baseDir: string;
|
|
4
|
+
editorName: string | null;
|
|
5
|
+
inputProps: object | null;
|
|
6
|
+
remotionRoot: string;
|
|
7
|
+
}) => string;
|
package/dist/index-html.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.indexHtml = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const indexHtml = (
|
|
8
|
+
const indexHtml = ({ baseDir, editorName, inputProps, staticHash, remotionRoot, }) => `
|
|
9
9
|
<!DOCTYPE html>
|
|
10
10
|
<html lang="en">
|
|
11
11
|
<head>
|
|
@@ -22,8 +22,8 @@ const indexHtml = (staticHash, baseDir, editorName, inputProps) => `
|
|
|
22
22
|
${editorName
|
|
23
23
|
? `<script>window.remotion_editorName = "${editorName}";</script>`
|
|
24
24
|
: '<script>window.remotion_editorName = null;</script>'}
|
|
25
|
-
<script>window.remotion_projectName = ${JSON.stringify(path_1.default.basename(
|
|
26
|
-
<script>window.remotion_cwd = ${JSON.stringify(
|
|
25
|
+
<script>window.remotion_projectName = ${JSON.stringify(path_1.default.basename(remotionRoot))};</script>
|
|
26
|
+
<script>window.remotion_cwd = ${JSON.stringify(remotionRoot)};</script>
|
|
27
27
|
${inputProps
|
|
28
28
|
? ` <script>window.remotion_inputProps = ${JSON.stringify(JSON.stringify(inputProps))};</script>
|
|
29
29
|
`
|
package/dist/index.d.ts
CHANGED
|
@@ -2,27 +2,36 @@ import esbuild = require('esbuild');
|
|
|
2
2
|
import webpack = require('webpack');
|
|
3
3
|
export declare const BundlerInternals: {
|
|
4
4
|
esbuild: typeof esbuild;
|
|
5
|
-
webpackConfig: ({ entry, userDefinedComponent, outDir, environment, webpackOverride, onProgressUpdate, enableCaching, envVariables, maxTimelineTracks, entryPoints, }: {
|
|
5
|
+
webpackConfig: ({ entry, userDefinedComponent, outDir, environment, webpackOverride, onProgressUpdate, enableCaching, envVariables, maxTimelineTracks, entryPoints, remotionRoot, }: {
|
|
6
6
|
entry: string;
|
|
7
7
|
userDefinedComponent: string;
|
|
8
8
|
outDir: string;
|
|
9
9
|
environment: "development" | "production";
|
|
10
|
-
webpackOverride: import("remotion").WebpackOverrideFn;
|
|
10
|
+
webpackOverride: import("remotion/dist/internals").WebpackOverrideFn;
|
|
11
11
|
onProgressUpdate?: ((f: number) => void) | undefined;
|
|
12
12
|
enableCaching?: boolean | undefined;
|
|
13
13
|
envVariables: Record<string, string>;
|
|
14
14
|
maxTimelineTracks: number;
|
|
15
15
|
entryPoints: string[];
|
|
16
|
+
remotionRoot: string;
|
|
17
|
+
}) => [string, webpack.Configuration];
|
|
18
|
+
indexHtml: ({ baseDir, editorName, inputProps, staticHash, remotionRoot, }: {
|
|
19
|
+
staticHash: string;
|
|
20
|
+
baseDir: string;
|
|
21
|
+
editorName: string | null;
|
|
22
|
+
inputProps: object | null;
|
|
23
|
+
remotionRoot: string;
|
|
24
|
+
}) => string;
|
|
25
|
+
cacheExists: (remotionRoot: string, environment: "development" | "production", hash: string) => "exists" | "other-exists" | "does-not-exist";
|
|
26
|
+
clearCache: (remotionRoot: string) => Promise<void>;
|
|
27
|
+
getConfig: ({ entryPoint, outDir, resolvedRemotionRoot, onProgressUpdate, options, }: {
|
|
28
|
+
outDir: string;
|
|
29
|
+
entryPoint: string;
|
|
30
|
+
resolvedRemotionRoot: string;
|
|
31
|
+
onProgressUpdate?: ((progress: number) => void) | undefined;
|
|
32
|
+
options?: import("./bundle").BundleOptions | undefined;
|
|
16
33
|
}) => [string, webpack.Configuration];
|
|
17
|
-
indexHtml: (staticHash: string, baseDir: string, editorName: string | null, inputProps: object | null) => string;
|
|
18
|
-
cacheExists: (environment: "development" | "production", hash: string) => "exists" | "other-exists" | "does-not-exist";
|
|
19
|
-
clearCache: () => Promise<void>;
|
|
20
|
-
getConfig: (outDir: string, entryPoint: string, onProgressUpdate?: ((progress: number) => void) | undefined, options?: {
|
|
21
|
-
webpackOverride?: import("remotion").WebpackOverrideFn | undefined;
|
|
22
|
-
outDir?: string | undefined;
|
|
23
|
-
enableCaching?: boolean | undefined;
|
|
24
|
-
publicPath?: string | undefined;
|
|
25
|
-
} | undefined) => [string, webpack.Configuration];
|
|
26
34
|
};
|
|
27
|
-
export { bundle } from './bundle';
|
|
35
|
+
export { bundle, BundleOptions } from './bundle';
|
|
28
36
|
export { webpack };
|
|
37
|
+
export declare type WebpackConfiguration = webpack.Configuration;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isPathInside: (thePath: string, potentialParent: string) => boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
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.isPathInside = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const isPathInside = function (thePath, potentialParent) {
|
|
9
|
+
// For inside-directory checking, we want to allow trailing slashes, so normalize.
|
|
10
|
+
thePath = stripTrailingSep(thePath);
|
|
11
|
+
potentialParent = stripTrailingSep(potentialParent);
|
|
12
|
+
// Node treats only Windows as case-insensitive in its path module; we follow those conventions.
|
|
13
|
+
if (process.platform === 'win32') {
|
|
14
|
+
thePath = thePath.toLowerCase();
|
|
15
|
+
potentialParent = potentialParent.toLowerCase();
|
|
16
|
+
}
|
|
17
|
+
return (thePath.lastIndexOf(potentialParent, 0) === 0 &&
|
|
18
|
+
(thePath[potentialParent.length] === path_1.default.sep ||
|
|
19
|
+
thePath[potentialParent.length] === undefined));
|
|
20
|
+
};
|
|
21
|
+
exports.isPathInside = isPathInside;
|
|
22
|
+
function stripTrailingSep(thePath) {
|
|
23
|
+
if (thePath[thePath.length - 1] === path_1.default.sep) {
|
|
24
|
+
return thePath.slice(0, -1);
|
|
25
|
+
}
|
|
26
|
+
return thePath;
|
|
27
|
+
}
|
package/dist/routes.d.ts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
-
export declare const handleUpdate: (_: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
3
|
-
export declare const handleFallback: (hash: string, _: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
4
|
-
export declare const handleProjectInfo: (_: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
5
|
-
export declare const handleFileSource: (search: string, _: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
6
|
-
export declare const handleOpenInEditor: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
7
|
-
export declare const handleFavicon: (_: IncomingMessage, response: ServerResponse) => void;
|
|
8
2
|
export declare const handleRoutes: (hash: string, request: IncomingMessage, response: ServerResponse) => void | Promise<void>;
|
package/dist/routes.js
CHANGED
|
@@ -3,13 +3,14 @@ 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
|
-
exports.handleRoutes =
|
|
6
|
+
exports.handleRoutes = void 0;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const url_1 = require("url");
|
|
10
10
|
const get_file_source_1 = require("./error-overlay/react-overlay/utils/get-file-source");
|
|
11
11
|
const open_in_editor_1 = require("./error-overlay/react-overlay/utils/open-in-editor");
|
|
12
12
|
const project_info_1 = require("./project-info");
|
|
13
|
+
const serve_static_1 = require("./serve-static");
|
|
13
14
|
const static_preview_1 = require("./static-preview");
|
|
14
15
|
const update_available_1 = require("./update-available");
|
|
15
16
|
const handleUpdate = async (_, response) => {
|
|
@@ -18,7 +19,6 @@ const handleUpdate = async (_, response) => {
|
|
|
18
19
|
response.writeHead(200);
|
|
19
20
|
response.end(JSON.stringify(data));
|
|
20
21
|
};
|
|
21
|
-
exports.handleUpdate = handleUpdate;
|
|
22
22
|
const editorGuess = (0, open_in_editor_1.guessEditor)();
|
|
23
23
|
const handleFallback = async (hash, _, response) => {
|
|
24
24
|
const edit = await editorGuess;
|
|
@@ -27,14 +27,12 @@ const handleFallback = async (hash, _, response) => {
|
|
|
27
27
|
response.writeHead(200);
|
|
28
28
|
response.end((0, static_preview_1.indexHtml)(hash, '/', displayName));
|
|
29
29
|
};
|
|
30
|
-
exports.handleFallback = handleFallback;
|
|
31
30
|
const handleProjectInfo = async (_, response) => {
|
|
32
31
|
const data = await (0, project_info_1.getProjectInfo)();
|
|
33
32
|
response.setHeader('content-type', 'application/json');
|
|
34
33
|
response.writeHead(200);
|
|
35
34
|
response.end(JSON.stringify(data));
|
|
36
35
|
};
|
|
37
|
-
exports.handleProjectInfo = handleProjectInfo;
|
|
38
36
|
const handleFileSource = async (search, _, response) => {
|
|
39
37
|
if (!search.startsWith('?')) {
|
|
40
38
|
throw new Error('query must start with ?');
|
|
@@ -49,7 +47,6 @@ const handleFileSource = async (search, _, response) => {
|
|
|
49
47
|
response.write(data);
|
|
50
48
|
return response.end();
|
|
51
49
|
};
|
|
52
|
-
exports.handleFileSource = handleFileSource;
|
|
53
50
|
const handleOpenInEditor = async (req, res) => {
|
|
54
51
|
try {
|
|
55
52
|
const b = await new Promise((_resolve) => {
|
|
@@ -88,7 +85,6 @@ const handleOpenInEditor = async (req, res) => {
|
|
|
88
85
|
}));
|
|
89
86
|
}
|
|
90
87
|
};
|
|
91
|
-
exports.handleOpenInEditor = handleOpenInEditor;
|
|
92
88
|
const handleFavicon = (_, response) => {
|
|
93
89
|
const filePath = path_1.default.join(__dirname, '..', 'web', 'favicon.png');
|
|
94
90
|
const stat = (0, fs_1.statSync)(filePath);
|
|
@@ -99,24 +95,27 @@ const handleFavicon = (_, response) => {
|
|
|
99
95
|
const readStream = (0, fs_1.createReadStream)(filePath);
|
|
100
96
|
readStream.pipe(response);
|
|
101
97
|
};
|
|
102
|
-
exports.handleFavicon = handleFavicon;
|
|
103
98
|
const handleRoutes = (hash, request, response) => {
|
|
104
99
|
const url = new URL(request.url, 'http://localhost');
|
|
105
100
|
if (url.pathname === '/api/update') {
|
|
106
|
-
return
|
|
101
|
+
return handleUpdate(request, response);
|
|
107
102
|
}
|
|
108
103
|
if (url.pathname === '/api/project-info') {
|
|
109
|
-
return
|
|
104
|
+
return handleProjectInfo(request, response);
|
|
110
105
|
}
|
|
111
106
|
if (url.pathname === '/api/file-source') {
|
|
112
|
-
return
|
|
107
|
+
return handleFileSource(url.search, request, response);
|
|
113
108
|
}
|
|
114
109
|
if (url.pathname === '/api/open-in-editor') {
|
|
115
|
-
return
|
|
110
|
+
return handleOpenInEditor(request, response);
|
|
116
111
|
}
|
|
117
112
|
if (url.pathname === '/remotion.png') {
|
|
118
|
-
return
|
|
113
|
+
return handleFavicon(request, response);
|
|
119
114
|
}
|
|
120
|
-
|
|
115
|
+
if (url.pathname.startsWith(hash)) {
|
|
116
|
+
const root = path_1.default.join(process.cwd(), 'public');
|
|
117
|
+
return (0, serve_static_1.serveStatic)(root, hash, request, response);
|
|
118
|
+
}
|
|
119
|
+
return handleFallback(hash, request, response);
|
|
121
120
|
};
|
|
122
121
|
exports.handleRoutes = handleRoutes;
|
package/dist/serve-static.d.ts
CHANGED
|
@@ -6,21 +6,4 @@
|
|
|
6
6
|
* MIT Licensed
|
|
7
7
|
*/
|
|
8
8
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
9
|
-
|
|
10
|
-
* @param {string} root
|
|
11
|
-
* @param {object} [options]
|
|
12
|
-
* @return {function}
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export declare const serveStatic: (root: string, options: {
|
|
16
|
-
cacheControl: true;
|
|
17
|
-
dotfiles: 'allow';
|
|
18
|
-
etag: true;
|
|
19
|
-
extensions: false;
|
|
20
|
-
fallthrough: false;
|
|
21
|
-
immutable: false;
|
|
22
|
-
index: false;
|
|
23
|
-
lastModified: true;
|
|
24
|
-
maxAge: 0;
|
|
25
|
-
redirect: true;
|
|
26
|
-
}) => (req: IncomingMessage, res: ServerResponse) => void;
|
|
9
|
+
export declare const serveStatic: (root: string, hash: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
package/dist/serve-static.js
CHANGED
|
@@ -6,67 +6,76 @@
|
|
|
6
6
|
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
|
7
7
|
* MIT Licensed
|
|
8
8
|
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.serveStatic = void 0;
|
|
14
|
+
const fs_1 = require("fs");
|
|
15
|
+
const mime_types_1 = __importDefault(require("mime-types"));
|
|
11
16
|
const path_1 = require("path");
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const middleware_1 = require("./dev-middleware/middleware");
|
|
18
|
+
const range_parser_1 = require("./dev-middleware/range-parser");
|
|
19
|
+
const is_path_inside_1 = require("./is-path-inside");
|
|
20
|
+
const serveStatic = async function (root, hash, req, res) {
|
|
21
|
+
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
|
22
|
+
// method not allowed
|
|
23
|
+
res.statusCode = 405;
|
|
24
|
+
res.setHeader('Allow', 'GET, HEAD');
|
|
25
|
+
res.setHeader('Content-Length', '0');
|
|
26
|
+
res.end();
|
|
27
|
+
return;
|
|
22
28
|
}
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
const path = (0, path_1.join)(root, new URL(req.url, 'http://localhost').pathname.replace(new RegExp(`^${hash}`), ''));
|
|
30
|
+
if (!(0, is_path_inside_1.isPathInside)(path, root)) {
|
|
31
|
+
res.writeHead(500);
|
|
32
|
+
res.write('Not allowed to read');
|
|
33
|
+
res.end();
|
|
34
|
+
return;
|
|
25
35
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
const exists = (0, fs_1.existsSync)(path);
|
|
37
|
+
if (!exists) {
|
|
38
|
+
res.writeHead(404);
|
|
39
|
+
res.write('Not found');
|
|
40
|
+
res.end();
|
|
41
|
+
return;
|
|
32
42
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
stream.on('error', (err) => {
|
|
64
|
-
res.writeHead(500);
|
|
65
|
-
res.write(err.toString());
|
|
66
|
-
res.end();
|
|
43
|
+
const lstat = await fs_1.promises.lstat(path);
|
|
44
|
+
const isDirectory = lstat.isDirectory();
|
|
45
|
+
if (isDirectory) {
|
|
46
|
+
res.writeHead(500);
|
|
47
|
+
res.write('Is a directory');
|
|
48
|
+
res.end();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const hasRange = req.headers.range && lstat.size;
|
|
52
|
+
if (!hasRange) {
|
|
53
|
+
const readStream = (0, fs_1.createReadStream)(path);
|
|
54
|
+
res.setHeader('content-type', mime_types_1.default.lookup(path) || 'application/octet-stream');
|
|
55
|
+
res.setHeader('content-length', lstat.size);
|
|
56
|
+
res.writeHead(200);
|
|
57
|
+
readStream.pipe(res);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const range = (0, range_parser_1.parseRange)(lstat.size, req.headers.range);
|
|
61
|
+
if (typeof range === 'object' && range.type === 'bytes') {
|
|
62
|
+
const { start, end } = range[0];
|
|
63
|
+
res.setHeader('content-type', mime_types_1.default.lookup(path) || 'application/octet-stream');
|
|
64
|
+
res.setHeader('content-range', (0, middleware_1.getValueContentRangeHeader)('bytes', lstat.size, {
|
|
65
|
+
end,
|
|
66
|
+
start,
|
|
67
|
+
}));
|
|
68
|
+
res.setHeader('content-length', end - start + 1);
|
|
69
|
+
res.writeHead(206);
|
|
70
|
+
const readStream = (0, fs_1.createReadStream)(path, {
|
|
71
|
+
start,
|
|
72
|
+
end,
|
|
67
73
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
74
|
+
readStream.pipe(res);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
res.statusCode = 416;
|
|
78
|
+
res.setHeader('Content-Range', `bytes */${lstat.size}`);
|
|
79
|
+
res.end();
|
|
71
80
|
};
|
|
72
81
|
exports.serveStatic = serveStatic;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const remotion_1 = require("remotion");
|
|
4
4
|
remotion_1.Internals.setupEnvVariables();
|
|
5
|
-
remotion_1.Internals.setupPuppeteerTimeout();
|
|
6
5
|
remotion_1.Internals.CSSUtils.injectCSS(`
|
|
7
6
|
.css-reset * {
|
|
8
7
|
font-size: 16px;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.myPlugin = void 0;
|
|
4
|
+
// tsc-helpers.js
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const tsconfig = require('../../tsconfig.json');
|
|
7
|
+
const fixBaseUrl = (importPath) => importPath.startsWith('./')
|
|
8
|
+
? importPath
|
|
9
|
+
: // Assumption: this is an aliased import
|
|
10
|
+
// Read tsconfig directly to avoid any drift
|
|
11
|
+
path.join(tsconfig.compilerOptions.baseUrl, importPath);
|
|
12
|
+
// some-plugin.js
|
|
13
|
+
exports.myPlugin = {
|
|
14
|
+
name: 'my-plugin',
|
|
15
|
+
setup: (build) => {
|
|
16
|
+
build.onResolve({ filter: /(.*)/ }, async (args) => {
|
|
17
|
+
args.path = fixBaseUrl(args.path);
|
|
18
|
+
// 🍕 delicious
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
};
|
package/dist/webpack-cache.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare global {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare const clearCache: () => Promise<void>;
|
|
10
|
+
export declare const clearCache: (remotionRoot: string) => Promise<void>;
|
|
11
11
|
export declare const getWebpackCacheName: (environment: Environment, hash: string) => string;
|
|
12
|
-
export declare const cacheExists: (environment: Environment, hash: string) => CacheState;
|
|
12
|
+
export declare const cacheExists: (remotionRoot: string, environment: Environment, hash: string) => CacheState;
|
|
13
13
|
export {};
|