@remotion/bundler 4.0.0-webhook.27 → 4.1.0-alpha2

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.
Files changed (47) hide show
  1. package/LICENSE.md +8 -8
  2. package/dist/bundle-mode.d.ts +0 -0
  3. package/dist/bundle-mode.js +0 -0
  4. package/dist/bundle.d.ts +12 -4
  5. package/dist/bundle.js +111 -25
  6. package/dist/copy-dir.d.ts +9 -1
  7. package/dist/copy-dir.js +25 -9
  8. package/dist/esbuild-loader/index.d.ts +0 -0
  9. package/dist/esbuild-loader/index.js +2 -2
  10. package/dist/esbuild-loader/interfaces.d.ts +3 -3
  11. package/dist/esbuild-loader/interfaces.js +0 -0
  12. package/dist/fast-refresh/helpers.d.ts +0 -0
  13. package/dist/fast-refresh/helpers.js +2 -2
  14. package/dist/fast-refresh/index.d.ts +0 -0
  15. package/dist/fast-refresh/index.js +0 -0
  16. package/dist/fast-refresh/loader.d.ts +94 -0
  17. package/dist/fast-refresh/loader.js +8 -15
  18. package/dist/fast-refresh/runtime.d.ts +0 -0
  19. package/dist/fast-refresh/runtime.js +0 -1
  20. package/dist/homepage/homepage.d.ts +0 -0
  21. package/dist/homepage/homepage.js +53 -9
  22. package/dist/index-html.d.ts +39 -2
  23. package/dist/index-html.js +17 -7
  24. package/dist/index.d.ts +21 -8
  25. package/dist/index.js +2 -0
  26. package/dist/optional-dependencies.d.ts +5 -0
  27. package/dist/optional-dependencies.js +27 -0
  28. package/dist/read-recursively.d.ts +8 -0
  29. package/dist/read-recursively.js +78 -0
  30. package/dist/renderEntry.d.ts +0 -0
  31. package/dist/renderEntry.js +42 -16
  32. package/dist/setup-environment.d.ts +0 -0
  33. package/dist/setup-environment.js +81 -0
  34. package/dist/stringify-with-circular-references.d.ts +1 -0
  35. package/dist/stringify-with-circular-references.js +18 -0
  36. package/dist/test/validate-bundle.test.d.ts +0 -0
  37. package/dist/test/validate-bundle.test.js +0 -0
  38. package/dist/test/validate-public-dir.test.d.ts +0 -0
  39. package/dist/test/validate-public-dir.test.js +2 -2
  40. package/dist/validate-public-dir.d.ts +0 -0
  41. package/dist/validate-public-dir.js +6 -6
  42. package/dist/webpack-cache.d.ts +4 -3
  43. package/dist/webpack-cache.js +24 -23
  44. package/dist/webpack-config.d.ts +6 -4
  45. package/dist/webpack-config.js +16 -14
  46. package/package.json +64 -67
  47. package/react-shim.js +5 -1
@@ -24,12 +24,24 @@ const pre = {
24
24
  overflowX: 'auto',
25
25
  };
26
26
  const AvailableCompositions = () => {
27
- const [comps, setComps] = (0, react_1.useState)(null);
27
+ const [state, setComps] = (0, react_1.useState)({
28
+ type: 'not-initialized',
29
+ });
28
30
  (0, react_1.useEffect)(() => {
31
+ if ((0, bundle_mode_1.getBundleMode)().type !== 'evaluation') {
32
+ return;
33
+ }
29
34
  let timeout = null;
30
35
  const check = () => {
31
- if (window.ready === true) {
32
- setComps(window.getStaticCompositions());
36
+ if (window.remotion_renderReady === true) {
37
+ setComps({ type: 'loading' });
38
+ try {
39
+ const newComps = window.remotion_getCompositionNames();
40
+ setComps({ type: 'loaded', comps: newComps });
41
+ }
42
+ catch (err) {
43
+ setComps({ type: 'error', error: err });
44
+ }
33
45
  }
34
46
  else {
35
47
  timeout = setTimeout(check, 250);
@@ -49,14 +61,46 @@ const AvailableCompositions = () => {
49
61
  if ((0, bundle_mode_1.getBundleMode)().type !== 'evaluation') {
50
62
  return ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: showComps, children: "Click here to see a list of available compositions." }));
51
63
  }
52
- return ((0, jsx_runtime_1.jsxs)("div", { children: [comps === null ? (0, jsx_runtime_1.jsx)("p", { children: "Loading compositions..." }) : null, (0, jsx_runtime_1.jsx)("ul", { children: comps === null
53
- ? null
54
- : comps.map((c) => {
55
- return (0, jsx_runtime_1.jsx)("li", { children: c.id }, c.id);
56
- }) })] }));
64
+ if (state.type === 'loading') {
65
+ return (0, jsx_runtime_1.jsx)("div", { children: state === null ? (0, jsx_runtime_1.jsx)("p", { children: "Loading compositions..." }) : null });
66
+ }
67
+ if (state.type === 'error') {
68
+ return (0, jsx_runtime_1.jsxs)("div", { children: ["Error loading compositions: ", state.error.stack] });
69
+ }
70
+ if (state.type === 'not-initialized') {
71
+ return (0, jsx_runtime_1.jsx)("div", { children: "Not initialized" });
72
+ }
73
+ return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("ul", { children: state === null
74
+ ? []
75
+ : state.comps.map((c) => {
76
+ return (0, jsx_runtime_1.jsx)("li", { children: c }, c);
77
+ }) }) }));
78
+ };
79
+ const TestCORS = () => {
80
+ const [serveUrl, setServeUrl] = (0, react_1.useState)('');
81
+ const [result, setResult] = (0, react_1.useState)('');
82
+ const handleServeUrl = (0, react_1.useCallback)((e) => {
83
+ setServeUrl(e.target.value);
84
+ }, []);
85
+ const isCORSWorking = (0, react_1.useCallback)(async (e) => {
86
+ e.preventDefault();
87
+ try {
88
+ const response = await fetch(serveUrl, { mode: 'cors' });
89
+ if (response.ok) {
90
+ setResult(`CORS is enabled on this URL: ${serveUrl}`);
91
+ }
92
+ else {
93
+ setResult('URL does not support CORS - See DevTools console for more details');
94
+ }
95
+ }
96
+ catch (error) {
97
+ setResult('URL does not support CORS - See DevTools console for more details');
98
+ }
99
+ }, [serveUrl]);
100
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("p", { children: ["Quickly test if a URL is supported being loaded on origin", ' ', (0, jsx_runtime_1.jsx)("code", { children: window.location.origin }), ". Enter the URL of an asset below."] }), result ? (0, jsx_runtime_1.jsx)("p", { className: "result", children: result }) : null, (0, jsx_runtime_1.jsxs)("form", { onSubmit: isCORSWorking, children: [(0, jsx_runtime_1.jsx)("label", { htmlFor: "serveurl", children: (0, jsx_runtime_1.jsx)("input", { placeholder: "Enter URL", type: "text", name: "serveurl", value: serveUrl, onChange: handleServeUrl }) }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("button", { type: "submit", children: "Test CORS" })] })] }));
57
101
  };
58
102
  const Homepage = () => {
59
103
  const url = window.location.origin + window.location.pathname;
60
- return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)("h1", { children: "Remotion Bundle" }), "This is a website which contains a bundled Remotion video. You can render videos based on this URL.", (0, jsx_runtime_1.jsx)("h2", { children: "Available compositions" }), (0, jsx_runtime_1.jsx)(AvailableCompositions, {}), (0, jsx_runtime_1.jsx)("h2", { children: "How to render" }), "Locally: ", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsxs)("div", { style: pre, children: ["npx remotion render ", url, " ", '<comp-name> <output-location>'] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), "With Remotion Lambda: ", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsxs)("div", { style: pre, children: ["npx remotion lambda render ", url, " ", '<comp-name>'] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsxs)("p", { children: ["You can also render still images, and use the Node.JS APIs", ' ', (0, jsx_runtime_1.jsx)("code", { children: "getCompositions()" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "renderMedia()" }), ",", ' ', (0, jsx_runtime_1.jsx)("code", { children: "renderMediaOnLambda()" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "renderStill()" }), " and", ' ', (0, jsx_runtime_1.jsx)("code", { children: "renderStillOnLambda()" }), " with this URL."] }), (0, jsx_runtime_1.jsxs)("p", { children: ["Visit", ' ', (0, jsx_runtime_1.jsx)("a", { href: "https://remotion.dev/docs", target: "_blank", children: "remotion.dev/docs" }), ' ', "to read the documentation."] })] }));
104
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)("h1", { children: "Remotion Bundle" }), "This is a website which contains a bundled Remotion video. You can render videos based on this URL.", (0, jsx_runtime_1.jsx)("h2", { children: "Available compositions" }), (0, jsx_runtime_1.jsx)(AvailableCompositions, {}), (0, jsx_runtime_1.jsx)("h2", { children: "How to render" }), "Locally: ", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsxs)("div", { style: pre, children: ["npx remotion render ", url, " ", '<comp-name> <output-location>'] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), "With Remotion Lambda: ", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsxs)("div", { style: pre, children: ["npx remotion lambda render ", url, " ", '<comp-name>'] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsxs)("p", { children: ["You can also render still images, and use the Node.JS APIs", ' ', (0, jsx_runtime_1.jsx)("code", { children: "getCompositions()" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "renderMedia()" }), ",", ' ', (0, jsx_runtime_1.jsx)("code", { children: "renderMediaOnLambda()" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "renderStill()" }), " and", ' ', (0, jsx_runtime_1.jsx)("code", { children: "renderStillOnLambda()" }), " with this URL."] }), (0, jsx_runtime_1.jsxs)("p", { children: ["Visit", ' ', (0, jsx_runtime_1.jsx)("a", { href: "https://remotion.dev/docs", target: "_blank", children: "remotion.dev/docs" }), ' ', "to read the documentation."] }), (0, jsx_runtime_1.jsx)("h2", { children: "CORS testing tool" }), (0, jsx_runtime_1.jsx)(TestCORS, {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {})] }));
61
105
  };
62
106
  exports.Homepage = Homepage;
@@ -1,9 +1,46 @@
1
- export declare const indexHtml: ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, previewServerCommand, }: {
1
+ import type { StaticFile } from 'remotion';
2
+ export type RenderDefaults = {
3
+ jpegQuality: number;
4
+ scale: number;
5
+ logLevel: string;
6
+ codec: string;
7
+ concurrency: number;
8
+ minConcurrency: number;
9
+ muted: boolean;
10
+ maxConcurrency: number;
11
+ stillImageFormat: 'png' | 'jpeg' | 'webp' | 'pdf';
12
+ videoImageFormat: 'png' | 'jpeg' | 'none';
13
+ audioCodec: string | null;
14
+ enforceAudioTrack: boolean;
15
+ proResProfile: string;
16
+ pixelFormat: string;
17
+ audioBitrate: string | null;
18
+ videoBitrate: string | null;
19
+ everyNthFrame: number;
20
+ numberOfGifLoops: number | null;
21
+ delayRenderTimeout: number;
22
+ disableWebSecurity: boolean;
23
+ openGlRenderer: string | null;
24
+ ignoreCertificateErrors: boolean;
25
+ headless: boolean;
26
+ };
27
+ declare global {
28
+ interface Window {
29
+ remotion_renderDefaults: RenderDefaults | undefined;
30
+ }
31
+ }
32
+ export declare const indexHtml: ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, studioServerCommand, renderQueue, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, }: {
2
33
  staticHash: string;
3
34
  baseDir: string;
4
35
  editorName: string | null;
5
36
  inputProps: object | null;
6
37
  envVariables?: Record<string, string> | undefined;
7
38
  remotionRoot: string;
8
- previewServerCommand: string | null;
39
+ studioServerCommand: string | null;
40
+ renderQueue: unknown | null;
41
+ numberOfAudioTags: number;
42
+ publicFiles: StaticFile[];
43
+ includeFavicon: boolean;
44
+ title: string;
45
+ renderDefaults: RenderDefaults | undefined;
9
46
  }) => string;
@@ -4,30 +4,39 @@ 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 path_1 = __importDefault(require("path"));
8
- const indexHtml = ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, previewServerCommand, }) => `
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const remotion_1 = require("remotion");
9
+ const indexHtml = ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, studioServerCommand, renderQueue, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, }) => `
9
10
  <!DOCTYPE html>
10
11
  <html lang="en">
11
12
  <head>
12
13
  <meta charset="UTF-8" />
13
14
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
14
15
  <link rel="preconnect" href="https://fonts.gstatic.com" />
15
- <link rel="icon" type="image/png" href="/remotion.png" />
16
- <title>Remotion Preview</title>
16
+ ${includeFavicon
17
+ ? ` <link rel="icon" type="image/png" href="/remotion.png" />\n`
18
+ : ''}
19
+ <title>${title}</title>
17
20
  </head>
18
21
  <body>
22
+ <script>window.remotion_numberOfAudioTags = ${numberOfAudioTags};</script>
19
23
  <script>window.remotion_staticBase = "${staticHash}";</script>
20
24
  <div id="video-container"></div>
21
25
  <div id="explainer-container"></div>
22
26
  ${editorName
23
27
  ? `<script>window.remotion_editorName = "${editorName}";</script>`
24
28
  : '<script>window.remotion_editorName = null;</script>'}
25
- <script>window.remotion_projectName = ${JSON.stringify(path_1.default.basename(remotionRoot))};</script>
29
+ <script>window.remotion_projectName = ${JSON.stringify(node_path_1.default.basename(remotionRoot))};</script>
30
+ <script>window.remotion_renderDefaults = ${JSON.stringify(renderDefaults)};</script>
26
31
  <script>window.remotion_cwd = ${JSON.stringify(remotionRoot)};</script>
27
- <script>window.remotion_previewServerCommand = ${previewServerCommand ? JSON.stringify(previewServerCommand) : 'null'};</script>
32
+ <script>window.remotion_studioServerCommand = ${studioServerCommand ? JSON.stringify(studioServerCommand) : 'null'};</script>
28
33
  ${inputProps
29
34
  ? `<script>window.remotion_inputProps = ${JSON.stringify(JSON.stringify(inputProps))};</script>
30
35
  `
36
+ : ''}
37
+ ${renderQueue
38
+ ? `<script>window.remotion_initialRenderQueue = ${JSON.stringify(renderQueue)};</script>
39
+ `
31
40
  : ''}
32
41
  ${envVariables
33
42
  ? `<script> window.process = {
@@ -35,8 +44,9 @@ const indexHtml = ({ baseDir, editorName, inputProps, envVariables, staticHash,
35
44
  };</script>
36
45
  `
37
46
  : ''}
47
+ <script>window.remotion_staticFiles = ${JSON.stringify(publicFiles)}</script>
38
48
 
39
- <div id="container"></div>
49
+ <div id="${remotion_1.Internals.REMOTION_STUDIO_CONTAINER_ELEMENT}"></div>
40
50
  <div id="menuportal-0"></div>
41
51
  <div id="menuportal-1"></div>
42
52
  <div id="menuportal-2"></div>
package/dist/index.d.ts CHANGED
@@ -2,31 +2,37 @@ 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, onProgress, enableCaching, envVariables, maxTimelineTracks, entryPoints, remotionRoot, keyboardShortcutsEnabled, }: {
5
+ webpackConfig: ({ entry, userDefinedComponent, outDir, environment, webpackOverride, onProgress, enableCaching, maxTimelineTracks, entryPoints, remotionRoot, keyboardShortcutsEnabled, poll, }: {
6
6
  entry: string;
7
7
  userDefinedComponent: string;
8
- outDir: string;
8
+ outDir: string | null;
9
9
  environment: "development" | "production";
10
- webpackOverride: import("remotion/dist/internals").WebpackOverrideFn;
10
+ webpackOverride: import("./webpack-config").WebpackOverrideFn;
11
11
  onProgress?: ((f: number) => void) | undefined;
12
12
  enableCaching?: boolean | undefined;
13
- envVariables: Record<string, string>;
14
13
  maxTimelineTracks: number;
15
14
  keyboardShortcutsEnabled: boolean;
16
15
  entryPoints: string[];
17
16
  remotionRoot: string;
17
+ poll: number | null;
18
18
  }) => [string, webpack.Configuration];
19
- indexHtml: ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, previewServerCommand, }: {
19
+ indexHtml: ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, studioServerCommand, renderQueue, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, }: {
20
20
  staticHash: string;
21
21
  baseDir: string;
22
22
  editorName: string | null;
23
23
  inputProps: object | null;
24
24
  envVariables?: Record<string, string> | undefined;
25
25
  remotionRoot: string;
26
- previewServerCommand: string | null;
26
+ studioServerCommand: string | null;
27
+ renderQueue: unknown;
28
+ numberOfAudioTags: number;
29
+ publicFiles: import("remotion").StaticFile[];
30
+ includeFavicon: boolean;
31
+ title: string;
32
+ renderDefaults: import("./index-html").RenderDefaults | undefined;
27
33
  }) => string;
28
34
  cacheExists: (remotionRoot: string, environment: "development" | "production", hash: string) => "exists" | "other-exists" | "does-not-exist";
29
- clearCache: (remotionRoot: string) => Promise<void>;
35
+ clearCache: (remotionRoot: string, env: "development" | "production") => Promise<void>;
30
36
  getConfig: ({ entryPoint, outDir, resolvedRemotionRoot, onProgress, options, }: {
31
37
  outDir: string;
32
38
  entryPoint: string;
@@ -34,7 +40,14 @@ export declare const BundlerInternals: {
34
40
  onProgress?: ((progress: number) => void) | undefined;
35
41
  options?: import("./bundle").LegacyBundleOptions | undefined;
36
42
  }) => [string, webpack.Configuration];
43
+ readRecursively: ({ folder, output, startPath, staticHash, limit, }: {
44
+ folder: string;
45
+ startPath: string;
46
+ output?: import("remotion").StaticFile[] | undefined;
47
+ staticHash: string;
48
+ limit: number;
49
+ }) => import("remotion").StaticFile[];
37
50
  };
38
51
  export { bundle, BundleOptions, LegacyBundleOptions } from './bundle';
52
+ export { WebpackConfiguration, WebpackOverrideFn } from './webpack-config';
39
53
  export { webpack };
40
- export declare type WebpackConfiguration = webpack.Configuration;
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  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
+ const read_recursively_1 = require("./read-recursively");
6
7
  const webpack_cache_1 = require("./webpack-cache");
7
8
  const webpack_config_1 = require("./webpack-config");
8
9
  const esbuild = require("esbuild");
@@ -15,6 +16,7 @@ exports.BundlerInternals = {
15
16
  cacheExists: webpack_cache_1.cacheExists,
16
17
  clearCache: webpack_cache_1.clearCache,
17
18
  getConfig: bundle_1.getConfig,
19
+ readRecursively: read_recursively_1.readRecursively,
18
20
  };
19
21
  var bundle_2 = require("./bundle");
20
22
  Object.defineProperty(exports, "bundle", { enumerable: true, get: function () { return bundle_2.bundle; } });
@@ -0,0 +1,5 @@
1
+ import type { Compiler } from 'webpack';
2
+ export declare class AllowOptionalDependenciesPlugin {
3
+ filter(error: Error): boolean;
4
+ apply(compiler: Compiler): void;
5
+ }
@@ -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,8 @@
1
+ import type { StaticFile } from 'remotion';
2
+ export declare const readRecursively: ({ folder, output, startPath, staticHash, limit, }: {
3
+ folder: string;
4
+ startPath: string;
5
+ output?: StaticFile[] | undefined;
6
+ staticHash: string;
7
+ limit: number;
8
+ }) => StaticFile[];
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.readRecursively = void 0;
30
+ const node_fs_1 = __importStar(require("node:fs"));
31
+ const node_path_1 = __importDefault(require("node:path"));
32
+ const readRecursively = ({ folder, output = [], startPath, staticHash, limit, }) => {
33
+ const absFolder = node_path_1.default.join(startPath, folder);
34
+ if (!node_fs_1.default.existsSync(absFolder)) {
35
+ return [];
36
+ }
37
+ const files = node_fs_1.default.readdirSync(absFolder);
38
+ for (const file of files) {
39
+ if (output.length >= limit) {
40
+ break;
41
+ }
42
+ if (file.startsWith('.DS_Store')) {
43
+ continue;
44
+ }
45
+ const stat = (0, node_fs_1.statSync)(node_path_1.default.join(absFolder, file));
46
+ if (stat.isDirectory()) {
47
+ (0, exports.readRecursively)({
48
+ startPath,
49
+ folder: node_path_1.default.join(folder, file),
50
+ output,
51
+ staticHash,
52
+ limit,
53
+ });
54
+ }
55
+ else if (stat.isFile()) {
56
+ output.push({
57
+ name: node_path_1.default.join(folder, file),
58
+ lastModified: Math.floor(stat.mtimeMs),
59
+ sizeInBytes: stat.size,
60
+ src: staticHash + '/' + encodeURIComponent(node_path_1.default.join(folder, file)),
61
+ });
62
+ }
63
+ else if (stat.isSymbolicLink()) {
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
+ if (realStat.isFile()) {
67
+ output.push({
68
+ name: realpath,
69
+ lastModified: Math.floor(realStat.mtimeMs),
70
+ sizeInBytes: realStat.size,
71
+ src: staticHash + '/' + encodeURIComponent(realpath),
72
+ });
73
+ }
74
+ }
75
+ }
76
+ return output.sort((a, b) => a.name.localeCompare(b.name));
77
+ };
78
+ exports.readRecursively = readRecursively;
File without changes
@@ -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('Found no composition with the name ' + state.compositionName);
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({
@@ -95,7 +97,7 @@ let cleanupVideoContainer = () => {
95
97
  let cleanupExplainerContainer = () => {
96
98
  explainerContainer.innerHTML = '';
97
99
  };
98
- const waitForRootHandle = (0, remotion_1.delayRender)('Loading root component');
100
+ const waitForRootHandle = (0, remotion_1.delayRender)('Loading root component - See https://remotion.dev/docs/troubleshooting/loading-root-component if you experience a timeout');
99
101
  const WaitForRoot = () => {
100
102
  const [Root, setRoot] = (0, react_1.useState)(() => remotion_1.Internals.getRoot());
101
103
  (0, react_1.useEffect)(() => {
@@ -116,7 +118,7 @@ const WaitForRoot = () => {
116
118
  const renderContent = () => {
117
119
  const bundleMode = (0, bundle_mode_1.getBundleMode)();
118
120
  if (bundleMode.type === 'composition' || bundleMode.type === 'evaluation') {
119
- const markup = ((0, jsx_runtime_1.jsxs)(remotion_1.Internals.RemotionRoot, { children: [(0, jsx_runtime_1.jsx)(WaitForRoot, {}), (0, jsx_runtime_1.jsx)(GetVideo, { state: bundleMode })] }));
121
+ const markup = ((0, jsx_runtime_1.jsxs)(remotion_1.Internals.RemotionRoot, { numberOfAudioTags: 0, children: [(0, jsx_runtime_1.jsx)(WaitForRoot, {}), (0, jsx_runtime_1.jsx)(GetVideo, { state: bundleMode })] }));
120
122
  if (client_1.default.createRoot) {
121
123
  const root = client_1.default.createRoot(videoContainer);
122
124
  root.render(markup);
@@ -167,7 +169,7 @@ const setBundleModeAndUpdate = (state) => {
167
169
  };
168
170
  exports.setBundleModeAndUpdate = setBundleModeAndUpdate;
169
171
  if (typeof window !== 'undefined') {
170
- window.getStaticCompositions = () => {
172
+ const getUnevaluatedComps = () => {
171
173
  if (!remotion_1.Internals.getRoot()) {
172
174
  throw new Error('registerRoot() was never called. 1. Make sure you specified the correct entrypoint for your bundle. 2. If your registerRoot() call is deferred, use the delayRender/continueRender pattern to tell Remotion to wait.');
173
175
  }
@@ -186,18 +188,42 @@ if (typeof window !== 'undefined') {
186
188
  console.warn('Could not single out a problematic composition - The composition list as a whole is too big to serialize.');
187
189
  throw new Error('defaultProps too big - Could not serialize - an object that was passed to defaultProps was too big. Learn how to mitigate this error by visiting https://remotion.dev/docs/troubleshooting/serialize-defaultprops');
188
190
  }
189
- return compositions.map((c) => {
190
- return {
191
- defaultProps: c.defaultProps,
192
- durationInFrames: c.durationInFrames,
193
- fps: c.fps,
194
- height: c.height,
195
- id: c.id,
196
- width: c.width,
197
- };
198
- });
191
+ return compositions;
192
+ };
193
+ window.getStaticCompositions = () => {
194
+ const compositions = getUnevaluatedComps();
195
+ return Promise.all(compositions.map(async (c) => {
196
+ const handle = (0, remotion_1.delayRender)(`Running calculateMetadata() for composition ${c.id}. If you didn't want to evaluate this composition, use "selectComposition()" instead of "getCompositions()"`);
197
+ const comp = remotion_1.Internals.resolveVideoConfig({
198
+ composition: c,
199
+ editorProps: {},
200
+ signal: new AbortController().signal,
201
+ });
202
+ const resolved = await Promise.resolve(comp);
203
+ (0, remotion_1.continueRender)(handle);
204
+ return resolved;
205
+ }));
206
+ };
207
+ window.remotion_getCompositionNames = () => {
208
+ return getUnevaluatedComps().map((c) => c.id);
209
+ };
210
+ window.remotion_calculateComposition = async (compId) => {
211
+ const compositions = getUnevaluatedComps();
212
+ const selectedComp = compositions.find((c) => c.id === compId);
213
+ if (!selectedComp) {
214
+ throw new Error(`Could not find composition with ID ${compId}`);
215
+ }
216
+ const abortController = new AbortController();
217
+ const handle = (0, remotion_1.delayRender)(`Running the calculateMetadata() function for composition ${compId}`);
218
+ const prom = await Promise.resolve(remotion_1.Internals.resolveVideoConfig({
219
+ composition: selectedComp,
220
+ editorProps: {},
221
+ signal: abortController.signal,
222
+ }));
223
+ (0, remotion_1.continueRender)(handle);
224
+ return prom;
199
225
  };
200
- window.siteVersion = '4';
226
+ window.siteVersion = '5';
201
227
  window.remotion_version = remotion_1.VERSION;
202
- window.setBundleMode = exports.setBundleModeAndUpdate;
228
+ window.remotion_setBundleMode = exports.setBundleModeAndUpdate;
203
229
  }
File without changes
@@ -11,4 +11,85 @@ remotion_1.Internals.CSSUtils.injectCSS(`
11
11
  background: transparent;
12
12
  box-sizing: border-box;
13
13
  }
14
+
15
+ .algolia-docsearch-suggestion--highlight {
16
+ font-size: 15px;
17
+ line-height: 1.25;
18
+ }
19
+
20
+ .__remotion-info-button-container code {
21
+ font-family: monospace;
22
+ font-size: 14px;
23
+ color: #0584f2
24
+ }
25
+
26
+ .__remotion-vertical-scrollbar::-webkit-scrollbar {
27
+ width: 6px;
28
+ }
29
+ .__remotion-vertical-scrollbar::-webkit-scrollbar-thumb {
30
+ background-color: rgba(0, 0, 0, 0.0);
31
+ }
32
+ .__remotion-vertical-scrollbar:hover::-webkit-scrollbar-thumb {
33
+ background-color: rgba(0, 0, 0, 0.6);
34
+ }
35
+ .__remotion-vertical-scrollbar:hover::-webkit-scrollbar-thumb:hover {
36
+ background-color: rgba(0, 0, 0, 1);
37
+ }
38
+
39
+
40
+ .__remotion-horizontal-scrollbar::-webkit-scrollbar {
41
+ height: 6px;
42
+ }
43
+ .__remotion-horizontal-scrollbar::-webkit-scrollbar-thumb {
44
+ background-color: rgba(0, 0, 0, 0.0);
45
+ }
46
+ .__remotion-horizontal-scrollbar:hover::-webkit-scrollbar-thumb {
47
+ background-color: rgba(0, 0, 0, 0.6);
48
+ }
49
+ .__remotion-horizontal-scrollbar:hover::-webkit-scrollbar-thumb:hover {
50
+ background-color: rgba(0, 0, 0, 1);
51
+ }
52
+
53
+
54
+ @-moz-document url-prefix() {
55
+ .__remotion-vertical-scrollbar {
56
+ scrollbar-width: thin;
57
+ scrollbar-color: rgba(0, 0, 0, 0.6) rgba(0, 0, 0, 0);
58
+ }
59
+
60
+ .__remotion-vertical-scrollbar:hover {
61
+ scrollbar-color: rgba(0, 0, 0, 1) rgba(0, 0, 0, 0);
62
+ }
63
+
64
+ .__remotion-horizontal-scrollbar {
65
+ scrollbar-width: thin;
66
+ scrollbar-color: rgba(0, 0, 0, 0.6) rgba(0, 0, 0, 0);
67
+ }
68
+
69
+ .__remotion-horizontal-scrollbar:hover {
70
+ scrollbar-width: thin;
71
+ scrollbar-color: rgba(0, 0, 0, 1) rgba(0, 0, 0, 0);
72
+ }
73
+ }
74
+
75
+
76
+ .__remotion-timeline-slider {
77
+ appearance: none;
78
+ width: 100px;
79
+ border-radius: 3px;
80
+ height: 6px;
81
+ background-color: rgba(255, 255, 255, 0.1);
82
+ accent-color: #ffffff;
83
+ }
84
+
85
+ .__remotion-timeline-slider::-moz-range-thumb {
86
+ width: 14px;
87
+ height: 14px;
88
+ border-radius: 50%;
89
+ background-color: #ffffff;
90
+ appearance: none;
91
+ }
92
+
93
+
94
+
14
95
  `);
@@ -0,0 +1 @@
1
+ export declare const jsonStringifyWithCircularReferences: (circ: unknown) => string;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jsonStringifyWithCircularReferences = void 0;
4
+ const jsonStringifyWithCircularReferences = (circ) => {
5
+ let seen = [];
6
+ const val = JSON.stringify(circ, (_, value) => {
7
+ if (typeof value === 'object' && value !== null && seen) {
8
+ if (seen.includes(value)) {
9
+ return '[Circular]';
10
+ }
11
+ seen.push(value);
12
+ }
13
+ return value;
14
+ });
15
+ seen = null;
16
+ return val;
17
+ };
18
+ exports.jsonStringifyWithCircularReferences = jsonStringifyWithCircularReferences;
File without changes
File without changes
File without changes
@@ -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 path_1 = __importDefault(require("path"));
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)(path_1.default.parse(process.cwd()).root)).toThrow(/which is the root directory. This is not allowed./);
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';
File without changes