@remotion/bundler 4.0.0-4x.2 → 4.0.0-alpha.115

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 (179) 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 +31 -3
  5. package/dist/bundle.js +167 -29
  6. package/dist/copy-dir.d.ts +9 -1
  7. package/dist/copy-dir.js +19 -3
  8. package/dist/esbuild-loader/index.d.ts +0 -0
  9. package/dist/esbuild-loader/index.js +1 -1
  10. package/dist/esbuild-loader/interfaces.d.ts +0 -0
  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 -0
  20. package/dist/homepage/homepage.d.ts +0 -0
  21. package/dist/homepage/homepage.js +30 -3
  22. package/dist/index-html.d.ts +46 -1
  23. package/dist/index-html.js +26 -5
  24. package/dist/index.d.ts +41 -10
  25. package/dist/index.js +6 -2
  26. package/dist/read-recursively.d.ts +8 -0
  27. package/dist/read-recursively.js +78 -0
  28. package/dist/renderEntry.d.ts +0 -0
  29. package/dist/renderEntry.js +37 -6
  30. package/dist/setup-environment.d.ts +0 -0
  31. package/dist/setup-environment.js +59 -3
  32. package/dist/stringify-with-circular-references.d.ts +1 -0
  33. package/dist/stringify-with-circular-references.js +18 -0
  34. package/dist/{error-overlay/entry-basic.d.ts → test/validate-bundle.test.d.ts} +0 -0
  35. package/dist/test/validate-bundle.test.js +10 -0
  36. package/dist/test/{latest-remotion-version.test.d.ts → validate-public-dir.test.d.ts} +0 -0
  37. package/dist/test/validate-public-dir.test.js +21 -0
  38. package/dist/validate-public-dir.d.ts +1 -0
  39. package/dist/validate-public-dir.js +30 -0
  40. package/dist/webpack-cache.d.ts +4 -3
  41. package/dist/webpack-cache.js +33 -17
  42. package/dist/webpack-config.d.ts +10 -6
  43. package/dist/webpack-config.js +31 -16
  44. package/package.json +15 -15
  45. package/react-shim.js +5 -1
  46. package/dist/bundler.d.ts +0 -7
  47. package/dist/bundler.js +0 -76
  48. package/dist/dev-middleware/compatible-api.d.ts +0 -10
  49. package/dist/dev-middleware/compatible-api.js +0 -44
  50. package/dist/dev-middleware/get-filename-from-url.d.ts +0 -2
  51. package/dist/dev-middleware/get-filename-from-url.js +0 -92
  52. package/dist/dev-middleware/get-paths.d.ts +0 -7
  53. package/dist/dev-middleware/get-paths.js +0 -19
  54. package/dist/dev-middleware/index.d.ts +0 -3
  55. package/dist/dev-middleware/index.js +0 -57
  56. package/dist/dev-middleware/is-color-supported.d.ts +0 -1
  57. package/dist/dev-middleware/is-color-supported.js +0 -37
  58. package/dist/dev-middleware/middleware.d.ts +0 -4
  59. package/dist/dev-middleware/middleware.js +0 -141
  60. package/dist/dev-middleware/range-parser.d.ts +0 -15
  61. package/dist/dev-middleware/range-parser.js +0 -96
  62. package/dist/dev-middleware/ready.d.ts +0 -5
  63. package/dist/dev-middleware/ready.js +0 -13
  64. package/dist/dev-middleware/setup-hooks.d.ts +0 -2
  65. package/dist/dev-middleware/setup-hooks.js +0 -44
  66. package/dist/dev-middleware/setup-output-filesystem.d.ts +0 -2
  67. package/dist/dev-middleware/setup-output-filesystem.js +0 -13
  68. package/dist/dev-middleware/types.d.ts +0 -11
  69. package/dist/dev-middleware/types.js +0 -2
  70. package/dist/error-overlay/entry-basic.js +0 -21
  71. package/dist/error-overlay/react-overlay/effects/format-warning.d.ts +0 -11
  72. package/dist/error-overlay/react-overlay/effects/format-warning.js +0 -41
  73. package/dist/error-overlay/react-overlay/effects/map-error-to-react-stack.d.ts +0 -7
  74. package/dist/error-overlay/react-overlay/effects/map-error-to-react-stack.js +0 -46
  75. package/dist/error-overlay/react-overlay/effects/proxy-console.d.ts +0 -24
  76. package/dist/error-overlay/react-overlay/effects/proxy-console.js +0 -63
  77. package/dist/error-overlay/react-overlay/effects/resolve-file-source.d.ts +0 -3
  78. package/dist/error-overlay/react-overlay/effects/resolve-file-source.js +0 -31
  79. package/dist/error-overlay/react-overlay/effects/stack-trace-limit.d.ts +0 -3
  80. package/dist/error-overlay/react-overlay/effects/stack-trace-limit.js +0 -43
  81. package/dist/error-overlay/react-overlay/effects/unhandled-error.d.ts +0 -4
  82. package/dist/error-overlay/react-overlay/effects/unhandled-error.js +0 -45
  83. package/dist/error-overlay/react-overlay/effects/unhandled-rejection.d.ts +0 -4
  84. package/dist/error-overlay/react-overlay/effects/unhandled-rejection.js +0 -41
  85. package/dist/error-overlay/react-overlay/index.d.ts +0 -2
  86. package/dist/error-overlay/react-overlay/index.js +0 -21
  87. package/dist/error-overlay/react-overlay/listen-to-runtime-errors.d.ts +0 -8
  88. package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +0 -78
  89. package/dist/error-overlay/react-overlay/utils/get-file-source.d.ts +0 -1
  90. package/dist/error-overlay/react-overlay/utils/get-file-source.js +0 -21
  91. package/dist/error-overlay/react-overlay/utils/get-lines-around.d.ts +0 -14
  92. package/dist/error-overlay/react-overlay/utils/get-lines-around.js +0 -24
  93. package/dist/error-overlay/react-overlay/utils/get-source-map.d.ts +0 -13
  94. package/dist/error-overlay/react-overlay/utils/get-source-map.js +0 -58
  95. package/dist/error-overlay/react-overlay/utils/get-stack-frames.d.ts +0 -2
  96. package/dist/error-overlay/react-overlay/utils/get-stack-frames.js +0 -27
  97. package/dist/error-overlay/react-overlay/utils/open-in-editor.d.ts +0 -12
  98. package/dist/error-overlay/react-overlay/utils/open-in-editor.js +0 -459
  99. package/dist/error-overlay/react-overlay/utils/parser.d.ts +0 -2
  100. package/dist/error-overlay/react-overlay/utils/parser.js +0 -117
  101. package/dist/error-overlay/react-overlay/utils/stack-frame.d.ts +0 -40
  102. package/dist/error-overlay/react-overlay/utils/stack-frame.js +0 -31
  103. package/dist/error-overlay/react-overlay/utils/unmapper.d.ts +0 -2
  104. package/dist/error-overlay/react-overlay/utils/unmapper.js +0 -64
  105. package/dist/error-overlay/remotion-overlay/AskOnDiscord.d.ts +0 -2
  106. package/dist/error-overlay/remotion-overlay/AskOnDiscord.js +0 -14
  107. package/dist/error-overlay/remotion-overlay/Button.d.ts +0 -6
  108. package/dist/error-overlay/remotion-overlay/Button.js +0 -24
  109. package/dist/error-overlay/remotion-overlay/CodeFrame.d.ts +0 -6
  110. package/dist/error-overlay/remotion-overlay/CodeFrame.js +0 -28
  111. package/dist/error-overlay/remotion-overlay/DismissButton.d.ts +0 -2
  112. package/dist/error-overlay/remotion-overlay/DismissButton.js +0 -23
  113. package/dist/error-overlay/remotion-overlay/ErrorDisplay.d.ts +0 -5
  114. package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +0 -45
  115. package/dist/error-overlay/remotion-overlay/ErrorLoader.d.ts +0 -4
  116. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +0 -61
  117. package/dist/error-overlay/remotion-overlay/ErrorTitle.d.ts +0 -6
  118. package/dist/error-overlay/remotion-overlay/ErrorTitle.js +0 -41
  119. package/dist/error-overlay/remotion-overlay/OpenInEditor.d.ts +0 -5
  120. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +0 -90
  121. package/dist/error-overlay/remotion-overlay/Overlay.d.ts +0 -14
  122. package/dist/error-overlay/remotion-overlay/Overlay.js +0 -49
  123. package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.d.ts +0 -4
  124. package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.js +0 -13
  125. package/dist/error-overlay/remotion-overlay/StackFrame.d.ts +0 -8
  126. package/dist/error-overlay/remotion-overlay/StackFrame.js +0 -48
  127. package/dist/error-overlay/remotion-overlay/Symbolicating.d.ts +0 -2
  128. package/dist/error-overlay/remotion-overlay/Symbolicating.js +0 -8
  129. package/dist/error-overlay/remotion-overlay/carets.d.ts +0 -3
  130. package/dist/error-overlay/remotion-overlay/carets.js +0 -12
  131. package/dist/error-overlay/remotion-overlay/format-location.d.ts +0 -1
  132. package/dist/error-overlay/remotion-overlay/format-location.js +0 -10
  133. package/dist/error-overlay/remotion-overlay/index.d.ts +0 -1
  134. package/dist/error-overlay/remotion-overlay/index.js +0 -18
  135. package/dist/get-latest-remotion-version.d.ts +0 -1
  136. package/dist/get-latest-remotion-version.js +0 -31
  137. package/dist/get-package-manager.d.ts +0 -8
  138. package/dist/get-package-manager.js +0 -38
  139. package/dist/get-port.d.ts +0 -1
  140. package/dist/get-port.js +0 -80
  141. package/dist/hot-middleware/client.d.ts +0 -19
  142. package/dist/hot-middleware/client.js +0 -206
  143. package/dist/hot-middleware/index.d.ts +0 -13
  144. package/dist/hot-middleware/index.js +0 -180
  145. package/dist/hot-middleware/process-update.d.ts +0 -12
  146. package/dist/hot-middleware/process-update.js +0 -147
  147. package/dist/hot-middleware/strip-ansi.d.ts +0 -1
  148. package/dist/hot-middleware/strip-ansi.js +0 -21
  149. package/dist/hot-middleware/types.d.ts +0 -37
  150. package/dist/hot-middleware/types.js +0 -17
  151. package/dist/is-path-inside.d.ts +0 -1
  152. package/dist/is-path-inside.js +0 -27
  153. package/dist/p-limit.d.ts +0 -1
  154. package/dist/p-limit.js +0 -57
  155. package/dist/project-info.d.ts +0 -5
  156. package/dist/project-info.js +0 -22
  157. package/dist/routes.d.ts +0 -2
  158. package/dist/routes.js +0 -121
  159. package/dist/serve-static.d.ts +0 -9
  160. package/dist/serve-static.js +0 -81
  161. package/dist/start-server-pure.d.ts +0 -8
  162. package/dist/start-server-pure.js +0 -68
  163. package/dist/start-server.d.ts +0 -8
  164. package/dist/start-server.js +0 -132
  165. package/dist/static-preview.d.ts +0 -1
  166. package/dist/static-preview.js +0 -40
  167. package/dist/test/expect-to-throw.d.ts +0 -1
  168. package/dist/test/expect-to-throw.js +0 -14
  169. package/dist/test/latest-remotion-version.test.js +0 -6
  170. package/dist/test/parse-error-stack.test.d.ts +0 -1
  171. package/dist/test/parse-error-stack.test.js +0 -17
  172. package/dist/test/parse-module-not-found.test.d.ts +0 -1
  173. package/dist/test/parse-module-not-found.test.js +0 -17
  174. package/dist/test/secure-source-read.test.d.ts +0 -1
  175. package/dist/test/secure-source-read.test.js +0 -8
  176. package/dist/ts-alias-plugin.d.ts +0 -4
  177. package/dist/ts-alias-plugin.js +0 -21
  178. package/dist/update-available.d.ts +0 -10
  179. package/dist/update-available.js +0 -36
@@ -26,10 +26,14 @@ const pre = {
26
26
  const AvailableCompositions = () => {
27
27
  const [comps, setComps] = (0, react_1.useState)(null);
28
28
  (0, react_1.useEffect)(() => {
29
+ if ((0, bundle_mode_1.getBundleMode)().type !== 'evaluation') {
30
+ return;
31
+ }
29
32
  let timeout = null;
30
33
  const check = () => {
31
34
  if (window.ready === true) {
32
- setComps(window.getStaticCompositions());
35
+ const newComps = window.getStaticCompositions();
36
+ setComps(newComps);
33
37
  }
34
38
  else {
35
39
  timeout = setTimeout(check, 250);
@@ -50,13 +54,36 @@ const AvailableCompositions = () => {
50
54
  return ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: showComps, children: "Click here to see a list of available compositions." }));
51
55
  }
52
56
  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
57
+ ? []
54
58
  : comps.map((c) => {
55
59
  return (0, jsx_runtime_1.jsx)("li", { children: c.id }, c.id);
56
60
  }) })] }));
57
61
  };
62
+ const TestCORS = () => {
63
+ const [serveUrl, setServeUrl] = (0, react_1.useState)('');
64
+ const [result, setResult] = (0, react_1.useState)('');
65
+ const handleServeUrl = (0, react_1.useCallback)((e) => {
66
+ setServeUrl(e.target.value);
67
+ }, []);
68
+ const isCORSWorking = (0, react_1.useCallback)(async (e) => {
69
+ e.preventDefault();
70
+ try {
71
+ const response = await fetch(serveUrl, { mode: 'cors' });
72
+ if (response.ok) {
73
+ setResult(`CORS is enabled on this URL: ${serveUrl}`);
74
+ }
75
+ else {
76
+ setResult('URL does not support CORS - See DevTools console for more details');
77
+ }
78
+ }
79
+ catch (error) {
80
+ setResult('URL does not support CORS - See DevTools console for more details');
81
+ }
82
+ }, [serveUrl]);
83
+ 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" })] })] }));
84
+ };
58
85
  const Homepage = () => {
59
86
  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."] })] }));
87
+ 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
88
  };
62
89
  exports.Homepage = Homepage;
@@ -1 +1,46 @@
1
- export declare const indexHtml: (staticHash: string, baseDir: string, editorName: string | null) => string;
1
+ import type { StaticFile } from 'remotion';
2
+ export declare type RenderDefaults = {
3
+ quality: 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, previewServerCommand, renderQueue, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, }: {
33
+ staticHash: string;
34
+ baseDir: string;
35
+ editorName: string | null;
36
+ inputProps: object | null;
37
+ envVariables?: Record<string, string> | undefined;
38
+ remotionRoot: string;
39
+ previewServerCommand: string | null;
40
+ renderQueue: unknown | null;
41
+ numberOfAudioTags: number;
42
+ publicFiles: StaticFile[];
43
+ includeFavicon: boolean;
44
+ title: string;
45
+ renderDefaults: RenderDefaults | undefined;
46
+ }) => string;
@@ -5,25 +5,45 @@ 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 = (staticHash, baseDir, editorName) => `
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">
11
11
  <head>
12
12
  <meta charset="UTF-8" />
13
13
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
14
14
  <link rel="preconnect" href="https://fonts.gstatic.com" />
15
- <link rel="icon" type="image/png" href="/remotion.png" />
16
- <title>Remotion Preview</title>
15
+ ${includeFavicon
16
+ ? ` <link rel="icon" type="image/png" href="/remotion.png" />\n`
17
+ : ''}
18
+ <title>${title}</title>
17
19
  </head>
18
20
  <body>
21
+ <script>window.remotion_numberOfAudioTags = ${numberOfAudioTags};</script>
19
22
  <script>window.remotion_staticBase = "${staticHash}";</script>
20
23
  <div id="video-container"></div>
21
24
  <div id="explainer-container"></div>
22
25
  ${editorName
23
26
  ? `<script>window.remotion_editorName = "${editorName}";</script>`
24
27
  : '<script>window.remotion_editorName = null;</script>'}
25
- <script>window.remotion_projectName = ${JSON.stringify(path_1.default.basename(process.cwd()))};</script>
26
- <script>window.remotion_cwd = ${JSON.stringify(process.cwd())};</script>
28
+ <script>window.remotion_projectName = ${JSON.stringify(path_1.default.basename(remotionRoot))};</script>
29
+ <script>window.remotion_renderDefaults = ${JSON.stringify(renderDefaults)};</script>
30
+ <script>window.remotion_cwd = ${JSON.stringify(remotionRoot)};</script>
31
+ <script>window.remotion_previewServerCommand = ${previewServerCommand ? JSON.stringify(previewServerCommand) : 'null'};</script>
32
+ ${inputProps
33
+ ? `<script>window.remotion_inputProps = ${JSON.stringify(JSON.stringify(inputProps))};</script>
34
+ `
35
+ : ''}
36
+ ${renderQueue
37
+ ? `<script>window.remotion_initialRenderQueue = ${JSON.stringify(renderQueue)};</script>
38
+ `
39
+ : ''}
40
+ ${envVariables
41
+ ? `<script> window.process = {
42
+ env: ${JSON.stringify(envVariables)}
43
+ };</script>
44
+ `
45
+ : ''}
46
+ <script>window.remotion_staticFiles = ${JSON.stringify(publicFiles)}</script>
27
47
 
28
48
  <div id="container"></div>
29
49
  <div id="menuportal-0"></div>
@@ -33,6 +53,7 @@ const indexHtml = (staticHash, baseDir, editorName) => `
33
53
  <div id="menuportal-4"></div>
34
54
  <div id="menuportal-5"></div>
35
55
  <div id="remotion-error-overlay"></div>
56
+ <div id="server-disconnected-overlay"></div>
36
57
  <script src="${baseDir}bundle.js"></script>
37
58
  </body>
38
59
  </html>
package/dist/index.d.ts CHANGED
@@ -2,22 +2,53 @@ 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, inputProps, envVariables, maxTimelineTracks, entryPoints, }: {
5
+ webpackConfig: ({ entry, userDefinedComponent, outDir, environment, webpackOverride, onProgress, enableCaching, envVariables, 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").WebpackOverrideFn;
11
- onProgressUpdate?: ((f: number) => void) | undefined;
10
+ webpackOverride: import("./webpack-config").WebpackOverrideFn;
11
+ onProgress?: ((f: number) => void) | undefined;
12
12
  enableCaching?: boolean | undefined;
13
- inputProps: object;
14
13
  envVariables: Record<string, string>;
15
14
  maxTimelineTracks: number;
15
+ keyboardShortcutsEnabled: boolean;
16
16
  entryPoints: string[];
17
- }) => webpack.Configuration;
18
- indexHtml: (staticHash: string, baseDir: string, editorName: string | null) => string;
19
- cacheExists: (environment: "development" | "production", inputProps: object | null) => boolean;
20
- clearCache: (environment: "development" | "production", inputProps: object | null) => Promise<void>;
17
+ remotionRoot: string;
18
+ poll: number | null;
19
+ }) => [string, webpack.Configuration];
20
+ indexHtml: ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, previewServerCommand, renderQueue, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, }: {
21
+ staticHash: string;
22
+ baseDir: string;
23
+ editorName: string | null;
24
+ inputProps: object | null;
25
+ envVariables?: Record<string, string> | undefined;
26
+ remotionRoot: string;
27
+ previewServerCommand: string | null;
28
+ renderQueue: unknown;
29
+ numberOfAudioTags: number;
30
+ publicFiles: import("remotion").StaticFile[];
31
+ includeFavicon: boolean;
32
+ title: string;
33
+ renderDefaults: import("./index-html").RenderDefaults | undefined;
34
+ }) => string;
35
+ cacheExists: (remotionRoot: string, environment: "development" | "production", hash: string) => "exists" | "other-exists" | "does-not-exist";
36
+ clearCache: (remotionRoot: string) => Promise<void>;
37
+ getConfig: ({ entryPoint, outDir, resolvedRemotionRoot, onProgress, options, }: {
38
+ outDir: string;
39
+ entryPoint: string;
40
+ resolvedRemotionRoot: string;
41
+ onProgress?: ((progress: number) => void) | undefined;
42
+ options?: import("./bundle").LegacyBundleOptions | undefined;
43
+ }) => [string, webpack.Configuration];
44
+ readRecursively: ({ folder, output, startPath, staticHash, limit, }: {
45
+ folder: string;
46
+ startPath: string;
47
+ output?: import("remotion").StaticFile[] | undefined;
48
+ staticHash: string;
49
+ limit: number;
50
+ }) => import("remotion").StaticFile[];
21
51
  };
22
- export { bundle } from './bundle';
52
+ export { bundle, BundleOptions, LegacyBundleOptions } from './bundle';
53
+ export { WebpackConfiguration, WebpackOverrideFn } from './webpack-config';
23
54
  export { webpack };
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webpack = exports.bundle = exports.BundlerInternals = void 0;
4
+ const bundle_1 = require("./bundle");
4
5
  const index_html_1 = require("./index-html");
6
+ const read_recursively_1 = require("./read-recursively");
5
7
  const webpack_cache_1 = require("./webpack-cache");
6
8
  const webpack_config_1 = require("./webpack-config");
7
9
  const esbuild = require("esbuild");
@@ -13,6 +15,8 @@ exports.BundlerInternals = {
13
15
  indexHtml: index_html_1.indexHtml,
14
16
  cacheExists: webpack_cache_1.cacheExists,
15
17
  clearCache: webpack_cache_1.clearCache,
18
+ getConfig: bundle_1.getConfig,
19
+ readRecursively: read_recursively_1.readRecursively,
16
20
  };
17
- var bundle_1 = require("./bundle");
18
- Object.defineProperty(exports, "bundle", { enumerable: true, get: function () { return bundle_1.bundle; } });
21
+ var bundle_2 = require("./bundle");
22
+ Object.defineProperty(exports, "bundle", { enumerable: true, get: function () { return bundle_2.bundle; } });
@@ -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 fs_1 = __importStar(require("fs"));
31
+ const path_1 = __importDefault(require("path"));
32
+ const readRecursively = ({ folder, output = [], startPath, staticHash, limit, }) => {
33
+ const absFolder = path_1.default.join(startPath, folder);
34
+ if (!fs_1.default.existsSync(absFolder)) {
35
+ return [];
36
+ }
37
+ const files = 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, fs_1.statSync)(path_1.default.join(absFolder, file));
46
+ if (stat.isDirectory()) {
47
+ (0, exports.readRecursively)({
48
+ startPath,
49
+ folder: path_1.default.join(folder, file),
50
+ output,
51
+ staticHash,
52
+ limit,
53
+ });
54
+ }
55
+ else if (stat.isFile()) {
56
+ output.push({
57
+ name: path_1.default.join(folder, file),
58
+ lastModified: Math.floor(stat.mtimeMs),
59
+ sizeInBytes: stat.size,
60
+ src: staticHash + '/' + path_1.default.join(folder, file),
61
+ });
62
+ }
63
+ else if (stat.isSymbolicLink()) {
64
+ const realpath = fs_1.default.realpathSync(path_1.default.join(folder, file));
65
+ const realStat = 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 + '/' + realpath,
72
+ });
73
+ }
74
+ }
75
+ }
76
+ return output.sort((a, b) => a.name.localeCompare(b.name));
77
+ };
78
+ exports.readRecursively = readRecursively;
File without changes
@@ -15,6 +15,19 @@ const remotion_1 = require("remotion");
15
15
  const bundle_mode_1 = require("./bundle-mode");
16
16
  const homepage_1 = require("./homepage/homepage");
17
17
  remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(null, '#fff'));
18
+ const getCanSerializeDefaultProps = (object) => {
19
+ try {
20
+ const str = JSON.stringify(object);
21
+ // 256MB is the theoretical limit, making it throw if over 90% of that is reached.
22
+ return str.length < 256 * 1024 * 1024 * 0.9;
23
+ }
24
+ catch (err) {
25
+ if (err.message.includes('Invalid string length')) {
26
+ return false;
27
+ }
28
+ throw err;
29
+ }
30
+ };
18
31
  const GetVideo = ({ state }) => {
19
32
  const video = remotion_1.Internals.useVideo();
20
33
  const compositions = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
@@ -34,6 +47,13 @@ const GetVideo = ({ state }) => {
34
47
  throw new Error('Found no composition with the name ' + state.compositionName);
35
48
  }
36
49
  compositions.setCurrentComposition((_a = foundComposition === null || foundComposition === void 0 ? void 0 : foundComposition.id) !== null && _a !== void 0 ? _a : null);
50
+ compositions.setCurrentCompositionMetadata({
51
+ defaultProps: state.compositionDefaultProps,
52
+ durationInFrames: state.compositionDurationInFrames,
53
+ fps: state.compositionFps,
54
+ height: state.compositionHeight,
55
+ width: state.compositionWidth,
56
+ });
37
57
  }
38
58
  }, [compositions, compositions.compositions, state, video]);
39
59
  (0, react_1.useEffect)(() => {
@@ -75,7 +95,7 @@ let cleanupVideoContainer = () => {
75
95
  let cleanupExplainerContainer = () => {
76
96
  explainerContainer.innerHTML = '';
77
97
  };
78
- const waitForRootHandle = (0, remotion_1.delayRender)('Loading root component');
98
+ const waitForRootHandle = (0, remotion_1.delayRender)('Loading root component - See https://remotion.dev/docs/troubleshooting/loading-root-component if you experience a timeout');
79
99
  const WaitForRoot = () => {
80
100
  const [Root, setRoot] = (0, react_1.useState)(() => remotion_1.Internals.getRoot());
81
101
  (0, react_1.useEffect)(() => {
@@ -96,7 +116,7 @@ const WaitForRoot = () => {
96
116
  const renderContent = () => {
97
117
  const bundleMode = (0, bundle_mode_1.getBundleMode)();
98
118
  if (bundleMode.type === 'composition' || bundleMode.type === 'evaluation') {
99
- 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 })] }));
119
+ 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 })] }));
100
120
  if (client_1.default.createRoot) {
101
121
  const root = client_1.default.createRoot(videoContainer);
102
122
  root.render(markup);
@@ -154,9 +174,19 @@ if (typeof window !== 'undefined') {
154
174
  if (!remotion_1.Internals.compositionsRef.current) {
155
175
  throw new Error('Unexpectedly did not have a CompositionManager');
156
176
  }
157
- return remotion_1.Internals.compositionsRef.current
158
- .getCompositions()
159
- .map((c) => {
177
+ const compositions = remotion_1.Internals.compositionsRef.current.getCompositions();
178
+ const canSerializeDefaultProps = getCanSerializeDefaultProps(compositions);
179
+ if (!canSerializeDefaultProps) {
180
+ console.warn('defaultProps are too big to serialize - trying to find the problematic composition...');
181
+ for (const comp of compositions) {
182
+ if (!getCanSerializeDefaultProps(comp)) {
183
+ throw new Error(`defaultProps too big - could not serialize - the defaultProps of composition with ID ${comp.id} - the object that was passed to defaultProps was too big. Learn how to mitigate this error by visiting https://remotion.dev/docs/troubleshooting/serialize-defaultprops`);
184
+ }
185
+ }
186
+ console.warn('Could not single out a problematic composition - The composition list as a whole is too big to serialize.');
187
+ 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
+ }
189
+ return compositions.map((c) => {
160
190
  return {
161
191
  defaultProps: c.defaultProps,
162
192
  durationInFrames: c.durationInFrames,
@@ -167,6 +197,7 @@ if (typeof window !== 'undefined') {
167
197
  };
168
198
  });
169
199
  };
170
- window.siteVersion = '3';
200
+ window.siteVersion = '4';
201
+ window.remotion_version = remotion_1.VERSION;
171
202
  window.setBundleMode = exports.setBundleModeAndUpdate;
172
203
  }
File without changes
@@ -2,12 +2,68 @@
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
- .css-reset * {
6
+ .css-reset, .css-reset * {
8
7
  font-size: 16px;
9
- line-height: 1;
8
+ line-height: 1.5;
10
9
  color: white;
11
10
  font-family: Arial, Helvetica, sans-serif;
11
+ background: transparent;
12
+ box-sizing: border-box;
12
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
+ .__remotion-horizontal-scrollbar::-webkit-scrollbar {
40
+ height: 6px;
41
+ }
42
+ .__remotion-horizontal-scrollbar::-webkit-scrollbar-thumb {
43
+ background-color: rgba(0, 0, 0, 0.0);
44
+ }
45
+ .__remotion-horizontal-scrollbar:hover::-webkit-scrollbar-thumb {
46
+ background-color: rgba(0, 0, 0, 0.6);
47
+ }
48
+ .__remotion-horizontal-scrollbar:hover::-webkit-scrollbar-thumb:hover {
49
+ background-color: rgba(0, 0, 0, 1);
50
+ }
51
+
52
+ .__remotion-timeline-slider {
53
+ appearance: none;
54
+ width: 100px;
55
+ border-radius: 3px;
56
+ height: 6px;
57
+ background-color: rgba(255, 255, 255, 0.1);
58
+ accent-color: #ffffff;
59
+ }
60
+
61
+ .__remotion-timeline-slider::-moz-range-thumb {
62
+ width: 14px;
63
+ height: 14px;
64
+ border-radius: 50%;
65
+ background-color: #ffffff;
66
+ appearance: none;
67
+ }
68
+
13
69
  `);
@@ -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;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const bundle_1 = require("../bundle");
5
+ (0, vitest_1.test)('Should reject bad bundle options', () => {
6
+ // @ts-expect-error
7
+ (0, vitest_1.expect)(() => (0, bundle_1.bundle)()).rejects.toThrow(/bundle\(\) was called without arguments/);
8
+ // @ts-expect-error
9
+ (0, vitest_1.expect)(() => (0, bundle_1.bundle)({})).rejects.toThrow(/bundle\(\) was called without the `entryPoint` option/);
10
+ });
@@ -0,0 +1,21 @@
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
+ const path_1 = __importDefault(require("path"));
7
+ const vitest_1 = require("vitest");
8
+ const validate_public_dir_1 = require("../validate-public-dir");
9
+ (0, vitest_1.describe)('validatePublicDir()', () => {
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./);
12
+ });
13
+ (0, vitest_1.test)('Should not allow a path where the parent directory does not exist', () => {
14
+ const pathToPass = process.platform === 'win32' ? 'C:\\foo\\bar' : '/foo/bar';
15
+ const expectedParent = process.platform === 'win32' ? 'C:\\foo' : '/foo';
16
+ (0, vitest_1.expect)(() => (0, validate_public_dir_1.validatePublicDir)(pathToPass)).toThrow(`The public directory was specified as "${pathToPass}", but this folder does not exist and the parent directory "${expectedParent}" does also not exist.`);
17
+ });
18
+ (0, vitest_1.test)('Should allow /foo as a path since that directory can be created', () => {
19
+ (0, vitest_1.expect)(() => (0, validate_public_dir_1.validatePublicDir)(process.platform === 'win32' ? 'C:\\foo' : '/foo')).not.toThrow();
20
+ });
21
+ });
@@ -0,0 +1 @@
1
+ export declare const validatePublicDir: (p: string) => void;
@@ -0,0 +1,30 @@
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.validatePublicDir = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const validatePublicDir = (p) => {
10
+ const { root } = path_1.default.parse(process.cwd());
11
+ if (p === root) {
12
+ throw new Error(`The public directory was specified as "${p}", which is the root directory. This is not allowed.`);
13
+ }
14
+ try {
15
+ const stat = fs_1.default.lstatSync(p);
16
+ if (!stat.isDirectory()) {
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
+ }
19
+ }
20
+ catch (e) {
21
+ // Path does not exist
22
+ // Check if the parent path exists
23
+ const parentPath = path_1.default.dirname(p);
24
+ const exists = fs_1.default.existsSync(parentPath);
25
+ if (!exists) {
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
+ }
28
+ }
29
+ };
30
+ exports.validatePublicDir = validatePublicDir;
@@ -1,4 +1,5 @@
1
1
  declare type Environment = 'development' | 'production';
2
+ declare type CacheState = 'exists' | 'other-exists' | 'does-not-exist';
2
3
  declare global {
3
4
  namespace NodeJS {
4
5
  interface ProcessVersions {
@@ -6,7 +7,7 @@ declare global {
6
7
  }
7
8
  }
8
9
  }
9
- export declare const clearCache: (environment: Environment, inputProps: object | null) => Promise<void>;
10
- export declare const getWebpackCacheName: (environment: Environment, inputProps: object | null) => string;
11
- export declare const cacheExists: (environment: Environment, inputProps: object | null) => boolean;
10
+ export declare const clearCache: (remotionRoot: string) => Promise<void>;
11
+ export declare const getWebpackCacheName: (environment: Environment, hash: string) => string;
12
+ export declare const cacheExists: (remotionRoot: string, environment: Environment, hash: string) => CacheState;
12
13
  export {};