@remotion/bundler 3.1.3 → 3.1.6

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 (145) hide show
  1. package/dist/bundle.d.ts +6 -2
  2. package/dist/bundle.js +22 -18
  3. package/dist/index.d.ts +9 -3
  4. package/dist/index.js +4 -2
  5. package/dist/webpack-cache.d.ts +4 -3
  6. package/dist/webpack-cache.js +30 -9
  7. package/dist/webpack-config.d.ts +1 -1
  8. package/dist/webpack-config.js +20 -8
  9. package/package.json +3 -3
  10. package/dist/bundler.d.ts +0 -7
  11. package/dist/bundler.js +0 -76
  12. package/dist/dev-middleware/compatible-api.d.ts +0 -10
  13. package/dist/dev-middleware/compatible-api.js +0 -44
  14. package/dist/dev-middleware/get-filename-from-url.d.ts +0 -2
  15. package/dist/dev-middleware/get-filename-from-url.js +0 -92
  16. package/dist/dev-middleware/get-paths.d.ts +0 -7
  17. package/dist/dev-middleware/get-paths.js +0 -19
  18. package/dist/dev-middleware/index.d.ts +0 -3
  19. package/dist/dev-middleware/index.js +0 -57
  20. package/dist/dev-middleware/is-color-supported.d.ts +0 -1
  21. package/dist/dev-middleware/is-color-supported.js +0 -37
  22. package/dist/dev-middleware/middleware.d.ts +0 -4
  23. package/dist/dev-middleware/middleware.js +0 -141
  24. package/dist/dev-middleware/range-parser.d.ts +0 -15
  25. package/dist/dev-middleware/range-parser.js +0 -96
  26. package/dist/dev-middleware/ready.d.ts +0 -5
  27. package/dist/dev-middleware/ready.js +0 -13
  28. package/dist/dev-middleware/setup-hooks.d.ts +0 -2
  29. package/dist/dev-middleware/setup-hooks.js +0 -44
  30. package/dist/dev-middleware/setup-output-filesystem.d.ts +0 -2
  31. package/dist/dev-middleware/setup-output-filesystem.js +0 -13
  32. package/dist/dev-middleware/types.d.ts +0 -11
  33. package/dist/dev-middleware/types.js +0 -2
  34. package/dist/error-overlay/entry-basic.d.ts +0 -1
  35. package/dist/error-overlay/entry-basic.js +0 -21
  36. package/dist/error-overlay/react-overlay/effects/format-warning.d.ts +0 -11
  37. package/dist/error-overlay/react-overlay/effects/format-warning.js +0 -41
  38. package/dist/error-overlay/react-overlay/effects/map-error-to-react-stack.d.ts +0 -7
  39. package/dist/error-overlay/react-overlay/effects/map-error-to-react-stack.js +0 -46
  40. package/dist/error-overlay/react-overlay/effects/proxy-console.d.ts +0 -24
  41. package/dist/error-overlay/react-overlay/effects/proxy-console.js +0 -63
  42. package/dist/error-overlay/react-overlay/effects/resolve-file-source.d.ts +0 -3
  43. package/dist/error-overlay/react-overlay/effects/resolve-file-source.js +0 -31
  44. package/dist/error-overlay/react-overlay/effects/stack-trace-limit.d.ts +0 -3
  45. package/dist/error-overlay/react-overlay/effects/stack-trace-limit.js +0 -43
  46. package/dist/error-overlay/react-overlay/effects/unhandled-error.d.ts +0 -4
  47. package/dist/error-overlay/react-overlay/effects/unhandled-error.js +0 -45
  48. package/dist/error-overlay/react-overlay/effects/unhandled-rejection.d.ts +0 -4
  49. package/dist/error-overlay/react-overlay/effects/unhandled-rejection.js +0 -41
  50. package/dist/error-overlay/react-overlay/index.d.ts +0 -2
  51. package/dist/error-overlay/react-overlay/index.js +0 -21
  52. package/dist/error-overlay/react-overlay/listen-to-runtime-errors.d.ts +0 -8
  53. package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +0 -78
  54. package/dist/error-overlay/react-overlay/utils/get-file-source.d.ts +0 -1
  55. package/dist/error-overlay/react-overlay/utils/get-file-source.js +0 -21
  56. package/dist/error-overlay/react-overlay/utils/get-lines-around.d.ts +0 -14
  57. package/dist/error-overlay/react-overlay/utils/get-lines-around.js +0 -24
  58. package/dist/error-overlay/react-overlay/utils/get-source-map.d.ts +0 -13
  59. package/dist/error-overlay/react-overlay/utils/get-source-map.js +0 -58
  60. package/dist/error-overlay/react-overlay/utils/get-stack-frames.d.ts +0 -2
  61. package/dist/error-overlay/react-overlay/utils/get-stack-frames.js +0 -27
  62. package/dist/error-overlay/react-overlay/utils/open-in-editor.d.ts +0 -12
  63. package/dist/error-overlay/react-overlay/utils/open-in-editor.js +0 -459
  64. package/dist/error-overlay/react-overlay/utils/parser.d.ts +0 -2
  65. package/dist/error-overlay/react-overlay/utils/parser.js +0 -117
  66. package/dist/error-overlay/react-overlay/utils/stack-frame.d.ts +0 -40
  67. package/dist/error-overlay/react-overlay/utils/stack-frame.js +0 -31
  68. package/dist/error-overlay/react-overlay/utils/unmapper.d.ts +0 -2
  69. package/dist/error-overlay/react-overlay/utils/unmapper.js +0 -64
  70. package/dist/error-overlay/remotion-overlay/AskOnDiscord.d.ts +0 -2
  71. package/dist/error-overlay/remotion-overlay/AskOnDiscord.js +0 -14
  72. package/dist/error-overlay/remotion-overlay/Button.d.ts +0 -6
  73. package/dist/error-overlay/remotion-overlay/Button.js +0 -24
  74. package/dist/error-overlay/remotion-overlay/CodeFrame.d.ts +0 -6
  75. package/dist/error-overlay/remotion-overlay/CodeFrame.js +0 -28
  76. package/dist/error-overlay/remotion-overlay/DismissButton.d.ts +0 -2
  77. package/dist/error-overlay/remotion-overlay/DismissButton.js +0 -23
  78. package/dist/error-overlay/remotion-overlay/ErrorDisplay.d.ts +0 -5
  79. package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +0 -45
  80. package/dist/error-overlay/remotion-overlay/ErrorLoader.d.ts +0 -4
  81. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +0 -61
  82. package/dist/error-overlay/remotion-overlay/ErrorTitle.d.ts +0 -6
  83. package/dist/error-overlay/remotion-overlay/ErrorTitle.js +0 -41
  84. package/dist/error-overlay/remotion-overlay/OpenInEditor.d.ts +0 -5
  85. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +0 -90
  86. package/dist/error-overlay/remotion-overlay/Overlay.d.ts +0 -14
  87. package/dist/error-overlay/remotion-overlay/Overlay.js +0 -49
  88. package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.d.ts +0 -4
  89. package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.js +0 -13
  90. package/dist/error-overlay/remotion-overlay/StackFrame.d.ts +0 -8
  91. package/dist/error-overlay/remotion-overlay/StackFrame.js +0 -48
  92. package/dist/error-overlay/remotion-overlay/Symbolicating.d.ts +0 -2
  93. package/dist/error-overlay/remotion-overlay/Symbolicating.js +0 -8
  94. package/dist/error-overlay/remotion-overlay/carets.d.ts +0 -3
  95. package/dist/error-overlay/remotion-overlay/carets.js +0 -12
  96. package/dist/error-overlay/remotion-overlay/format-location.d.ts +0 -1
  97. package/dist/error-overlay/remotion-overlay/format-location.js +0 -10
  98. package/dist/error-overlay/remotion-overlay/index.d.ts +0 -1
  99. package/dist/error-overlay/remotion-overlay/index.js +0 -18
  100. package/dist/get-latest-remotion-version.d.ts +0 -1
  101. package/dist/get-latest-remotion-version.js +0 -31
  102. package/dist/get-package-manager.d.ts +0 -8
  103. package/dist/get-package-manager.js +0 -38
  104. package/dist/get-port.d.ts +0 -1
  105. package/dist/get-port.js +0 -80
  106. package/dist/hot-middleware/client.d.ts +0 -19
  107. package/dist/hot-middleware/client.js +0 -206
  108. package/dist/hot-middleware/index.d.ts +0 -13
  109. package/dist/hot-middleware/index.js +0 -180
  110. package/dist/hot-middleware/process-update.d.ts +0 -12
  111. package/dist/hot-middleware/process-update.js +0 -147
  112. package/dist/hot-middleware/strip-ansi.d.ts +0 -1
  113. package/dist/hot-middleware/strip-ansi.js +0 -21
  114. package/dist/hot-middleware/types.d.ts +0 -37
  115. package/dist/hot-middleware/types.js +0 -17
  116. package/dist/is-path-inside.d.ts +0 -1
  117. package/dist/is-path-inside.js +0 -27
  118. package/dist/p-limit.d.ts +0 -1
  119. package/dist/p-limit.js +0 -57
  120. package/dist/project-info.d.ts +0 -5
  121. package/dist/project-info.js +0 -22
  122. package/dist/routes.d.ts +0 -2
  123. package/dist/routes.js +0 -121
  124. package/dist/serve-static.d.ts +0 -9
  125. package/dist/serve-static.js +0 -81
  126. package/dist/start-server-pure.d.ts +0 -8
  127. package/dist/start-server-pure.js +0 -68
  128. package/dist/start-server.d.ts +0 -8
  129. package/dist/start-server.js +0 -132
  130. package/dist/static-preview.d.ts +0 -1
  131. package/dist/static-preview.js +0 -40
  132. package/dist/test/expect-to-throw.d.ts +0 -1
  133. package/dist/test/expect-to-throw.js +0 -14
  134. package/dist/test/latest-remotion-version.test.d.ts +0 -1
  135. package/dist/test/latest-remotion-version.test.js +0 -6
  136. package/dist/test/parse-error-stack.test.d.ts +0 -1
  137. package/dist/test/parse-error-stack.test.js +0 -17
  138. package/dist/test/parse-module-not-found.test.d.ts +0 -1
  139. package/dist/test/parse-module-not-found.test.js +0 -17
  140. package/dist/test/secure-source-read.test.d.ts +0 -1
  141. package/dist/test/secure-source-read.test.js +0 -8
  142. package/dist/ts-alias-plugin.d.ts +0 -4
  143. package/dist/ts-alias-plugin.js +0 -21
  144. package/dist/update-available.d.ts +0 -10
  145. package/dist/update-available.js +0 -36
package/dist/bundle.d.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import type { WebpackOverrideFn } from 'remotion';
2
- export declare const bundle: (entryPoint: string, onProgressUpdate?: ((progress: number) => void) | undefined, options?: {
2
+ import webpack from 'webpack';
3
+ declare type Options = {
3
4
  webpackOverride?: WebpackOverrideFn;
4
5
  outDir?: string;
5
6
  enableCaching?: boolean;
6
7
  publicPath?: string;
7
- }) => Promise<string>;
8
+ };
9
+ export declare const getConfig: (outDir: string, entryPoint: string, onProgressUpdate?: ((progress: number) => void) | undefined, options?: Options) => [string, webpack.Configuration];
10
+ export declare const bundle: (entryPoint: string, onProgressUpdate?: ((progress: number) => void) | undefined, options?: Options) => Promise<string>;
11
+ export {};
package/dist/bundle.js CHANGED
@@ -3,7 +3,7 @@ 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.bundle = void 0;
6
+ 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"));
@@ -34,24 +34,28 @@ const trimTrailingSlash = (p) => {
34
34
  }
35
35
  return p;
36
36
  };
37
+ const getConfig = (outDir, entryPoint, onProgressUpdate, options) => {
38
+ var _a, _b;
39
+ return (0, webpack_config_1.webpackConfig)({
40
+ entry,
41
+ userDefinedComponent: entryPoint,
42
+ outDir,
43
+ environment: 'production',
44
+ webpackOverride: (_a = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _a !== void 0 ? _a : remotion_1.Internals.defaultOverrideFunction,
45
+ onProgressUpdate,
46
+ enableCaching: (_b = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _b !== void 0 ? _b : remotion_1.Internals.DEFAULT_WEBPACK_CACHE_ENABLED,
47
+ maxTimelineTracks: 15,
48
+ // For production, the variables are set dynamically
49
+ envVariables: {},
50
+ entryPoints: [],
51
+ });
52
+ };
53
+ exports.getConfig = getConfig;
37
54
  const bundle = async (entryPoint, onProgressUpdate, options) => {
38
- var _a, _b, _c, _d;
55
+ var _a, _b;
39
56
  const outDir = await prepareOutDir((_a = options === null || options === void 0 ? void 0 : options.outDir) !== null && _a !== void 0 ? _a : null);
40
- const output = await promisified([
41
- (0, webpack_config_1.webpackConfig)({
42
- entry,
43
- userDefinedComponent: entryPoint,
44
- outDir,
45
- environment: 'production',
46
- webpackOverride: (_b = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _b !== void 0 ? _b : remotion_1.Internals.defaultOverrideFunction,
47
- onProgressUpdate,
48
- enableCaching: (_c = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _c !== void 0 ? _c : remotion_1.Internals.DEFAULT_WEBPACK_CACHE_ENABLED,
49
- maxTimelineTracks: 15,
50
- // For production, the variables are set dynamically
51
- envVariables: {},
52
- entryPoints: [],
53
- }),
54
- ]);
57
+ const [, config] = (0, exports.getConfig)(outDir, entryPoint, onProgressUpdate, options);
58
+ const output = await promisified([config]);
55
59
  if (!output) {
56
60
  throw new Error('Expected webpack output');
57
61
  }
@@ -59,7 +63,7 @@ const bundle = async (entryPoint, onProgressUpdate, options) => {
59
63
  if (errors !== undefined && errors.length > 0) {
60
64
  throw new Error(errors[0].message + '\n' + errors[0].details);
61
65
  }
62
- const baseDir = (_d = options === null || options === void 0 ? void 0 : options.publicPath) !== null && _d !== void 0 ? _d : '/';
66
+ const baseDir = (_b = options === null || options === void 0 ? void 0 : options.publicPath) !== null && _b !== void 0 ? _b : '/';
63
67
  const publicDir = '/' +
64
68
  [trimTrailingSlash(trimLeadingSlash(baseDir)), 'public']
65
69
  .filter(Boolean)
package/dist/index.d.ts CHANGED
@@ -13,10 +13,16 @@ export declare const BundlerInternals: {
13
13
  envVariables: Record<string, string>;
14
14
  maxTimelineTracks: number;
15
15
  entryPoints: string[];
16
- }) => webpack.Configuration;
16
+ }) => [string, webpack.Configuration];
17
17
  indexHtml: (staticHash: string, baseDir: string, editorName: string | null, inputProps: object | null) => string;
18
- cacheExists: (environment: "development" | "production") => boolean;
19
- clearCache: (environment: "development" | "production") => Promise<void>;
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];
20
26
  };
21
27
  export { bundle } from './bundle';
22
28
  export { webpack };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
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");
5
6
  const webpack_cache_1 = require("./webpack-cache");
6
7
  const webpack_config_1 = require("./webpack-config");
@@ -13,6 +14,7 @@ exports.BundlerInternals = {
13
14
  indexHtml: index_html_1.indexHtml,
14
15
  cacheExists: webpack_cache_1.cacheExists,
15
16
  clearCache: webpack_cache_1.clearCache,
17
+ getConfig: bundle_1.getConfig,
16
18
  };
17
- var bundle_1 = require("./bundle");
18
- Object.defineProperty(exports, "bundle", { enumerable: true, get: function () { return bundle_1.bundle; } });
19
+ var bundle_2 = require("./bundle");
20
+ Object.defineProperty(exports, "bundle", { enumerable: true, get: function () { return bundle_2.bundle; } });
@@ -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) => Promise<void>;
10
- export declare const getWebpackCacheName: (environment: Environment) => string;
11
- export declare const cacheExists: (environment: Environment) => boolean;
10
+ export declare const clearCache: () => Promise<void>;
11
+ export declare const getWebpackCacheName: (environment: Environment, hash: string) => string;
12
+ export declare const cacheExists: (environment: Environment, hash: string) => CacheState;
12
13
  export {};
@@ -37,26 +37,47 @@ const getWebpackCacheDir = () => {
37
37
  }
38
38
  return path_1.default.resolve(dir, 'node_modules/.cache/webpack');
39
39
  };
40
- const remotionCacheLocation = (environment) => {
41
- return path_1.default.join(getWebpackCacheDir(), (0, exports.getWebpackCacheName)(environment));
40
+ const remotionCacheLocation = (environment, hash) => {
41
+ return path_1.default.join(getWebpackCacheDir(), (0, exports.getWebpackCacheName)(environment, hash));
42
42
  };
43
- const clearCache = (environment) => {
43
+ const clearCache = () => {
44
44
  var _a;
45
- return ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(remotionCacheLocation(environment), {
45
+ return ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(getWebpackCacheDir(), {
46
46
  recursive: true,
47
47
  });
48
48
  };
49
49
  exports.clearCache = clearCache;
50
- const getWebpackCacheName = (environment) => {
50
+ const getPrefix = (environment) => {
51
+ return `remotion-v4-${environment}`;
52
+ };
53
+ const getWebpackCacheName = (environment, hash) => {
51
54
  if (environment === 'development') {
52
- return `remotion-v3-${environment}`;
55
+ return `${getPrefix(environment)}-${hash}`;
53
56
  }
54
57
  // In production, the cache is independent from input props because
55
58
  // they are passed over URL params. Speed is mostly important in production.
56
- return `remotion-v3-${environment}`;
59
+ return `${getPrefix(environment)}-${hash}`;
57
60
  };
58
61
  exports.getWebpackCacheName = getWebpackCacheName;
59
- const cacheExists = (environment) => {
60
- return fs_1.default.existsSync(remotionCacheLocation(environment));
62
+ const hasOtherCache = (environment) => {
63
+ const cacheDir = fs_1.default.readdirSync(getWebpackCacheDir());
64
+ if (cacheDir.find((c) => {
65
+ return c.startsWith(getPrefix(environment));
66
+ })) {
67
+ return true;
68
+ }
69
+ return false;
70
+ };
71
+ const cacheExists = (environment, hash) => {
72
+ if (fs_1.default.existsSync(remotionCacheLocation(environment, hash))) {
73
+ return 'exists';
74
+ }
75
+ if (!fs_1.default.existsSync(getWebpackCacheDir())) {
76
+ return 'does-not-exist';
77
+ }
78
+ if (hasOtherCache(environment)) {
79
+ return 'other-exists';
80
+ }
81
+ return 'does-not-exist';
61
82
  };
62
83
  exports.cacheExists = cacheExists;
@@ -10,4 +10,4 @@ export declare const webpackConfig: ({ entry, userDefinedComponent, outDir, envi
10
10
  envVariables: Record<string, string>;
11
11
  maxTimelineTracks: number;
12
12
  entryPoints: string[];
13
- }) => WebpackConfiguration;
13
+ }) => [string, WebpackConfiguration];
@@ -27,6 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.webpackConfig = void 0;
30
+ const crypto_1 = require("crypto");
30
31
  const react_dom_1 = __importDefault(require("react-dom"));
31
32
  const remotion_1 = require("remotion");
32
33
  const webpack_1 = __importStar(require("webpack"));
@@ -50,7 +51,7 @@ function truthy(value) {
50
51
  return Boolean(value);
51
52
  }
52
53
  const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpackOverride = (f) => f, onProgressUpdate, enableCaching = remotion_1.Internals.DEFAULT_WEBPACK_CACHE_ENABLED, envVariables, maxTimelineTracks, entryPoints, }) => {
53
- return webpackOverride({
54
+ const conf = webpackOverride({
54
55
  optimization: {
55
56
  minimize: false,
56
57
  },
@@ -65,12 +66,6 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
65
66
  aggregateTimeout: 0,
66
67
  ignored: ['**/.git/**', '**/node_modules/**'],
67
68
  },
68
- cache: enableCaching
69
- ? {
70
- type: 'filesystem',
71
- name: (0, webpack_cache_1.getWebpackCacheName)(environment),
72
- }
73
- : false,
74
69
  devtool: environment === 'development'
75
70
  ? 'cheap-module-source-map'
76
71
  : 'cheap-module-source-map',
@@ -108,7 +103,6 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
108
103
  hashFunction: 'xxhash64',
109
104
  globalObject: 'this',
110
105
  filename: 'bundle.js',
111
- path: outDir,
112
106
  devtoolModuleFilenameTemplate: '[resource-path]',
113
107
  assetModuleFilename: environment === 'development' ? '[path][name][ext]' : '[hash][ext]',
114
108
  },
@@ -173,5 +167,23 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
173
167
  ],
174
168
  },
175
169
  });
170
+ const hash = (0, crypto_1.createHash)('md5').update(JSON.stringify(conf)).digest('hex');
171
+ return [
172
+ hash,
173
+ {
174
+ ...conf,
175
+ cache: enableCaching
176
+ ? {
177
+ type: 'filesystem',
178
+ name: (0, webpack_cache_1.getWebpackCacheName)(environment, hash),
179
+ version: hash,
180
+ }
181
+ : false,
182
+ output: {
183
+ ...conf.output,
184
+ path: outDir,
185
+ },
186
+ },
187
+ ];
176
188
  };
177
189
  exports.webpackConfig = webpackConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/bundler",
3
- "version": "3.1.3",
3
+ "version": "3.1.6",
4
4
  "description": "Bundler for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -26,7 +26,7 @@
26
26
  "css-loader": "5.2.7",
27
27
  "esbuild": "0.14.19",
28
28
  "react-refresh": "0.9.0",
29
- "remotion": "3.1.3",
29
+ "remotion": "3.1.6",
30
30
  "style-loader": "2.0.0",
31
31
  "webpack": "5.72.0"
32
32
  },
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "d57ec16eaf33280c89b0974997946ab9ea155372"
66
+ "gitHead": "188460243a533e1511b3f83fa8c77cd4c445553d"
67
67
  }
package/dist/bundler.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { WebpackOverrideFn } from 'remotion';
2
- export declare const bundle: (entryPoint: string, onProgressUpdate?: ((progress: number) => void) | undefined, options?: {
3
- webpackOverride?: WebpackOverrideFn | undefined;
4
- outDir?: string | undefined;
5
- enableCaching?: boolean | undefined;
6
- publicPath?: string | undefined;
7
- } | undefined) => Promise<string>;
package/dist/bundler.js DELETED
@@ -1,76 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.bundle = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const os_1 = __importDefault(require("os"));
9
- const path_1 = __importDefault(require("path"));
10
- const remotion_1 = require("remotion");
11
- const util_1 = require("util");
12
- const webpack_1 = __importDefault(require("webpack"));
13
- const copy_dir_1 = require("./copy-dir");
14
- const static_preview_1 = require("./static-preview");
15
- const webpack_config_1 = require("./webpack-config");
16
- const entry = require.resolve('./renderEntry');
17
- const promisified = (0, util_1.promisify)(webpack_1.default);
18
- const prepareOutDir = async (specified) => {
19
- if (specified) {
20
- await fs_1.default.promises.mkdir(specified, { recursive: true });
21
- return specified;
22
- }
23
- return fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'react-motion-graphics'));
24
- };
25
- const trimLeadingSlash = (p) => {
26
- if (p.startsWith('/')) {
27
- return trimLeadingSlash(p.substr(1));
28
- }
29
- return p;
30
- };
31
- const trimTrailingSlash = (p) => {
32
- if (p.endsWith('/')) {
33
- return trimTrailingSlash(p.substr(0, p.length - 1));
34
- }
35
- return p;
36
- };
37
- const bundle = async (entryPoint, onProgressUpdate, options) => {
38
- var _a, _b, _c, _d;
39
- const outDir = await prepareOutDir((_a = options === null || options === void 0 ? void 0 : options.outDir) !== null && _a !== void 0 ? _a : null);
40
- const output = await promisified([
41
- (0, webpack_config_1.webpackConfig)({
42
- entry,
43
- userDefinedComponent: entryPoint,
44
- outDir,
45
- environment: 'production',
46
- webpackOverride: (_b = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _b !== void 0 ? _b : remotion_1.Internals.defaultOverrideFunction,
47
- onProgressUpdate,
48
- enableCaching: (_c = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _c !== void 0 ? _c : remotion_1.Internals.DEFAULT_WEBPACK_CACHE_ENABLED,
49
- maxTimelineTracks: 15,
50
- // For production, the variables are set dynamically
51
- envVariables: {},
52
- inputProps: {},
53
- }),
54
- ]);
55
- if (!output) {
56
- throw new Error('Expected webpack output');
57
- }
58
- const { errors } = output.toJson();
59
- if (errors !== undefined && errors.length > 0) {
60
- throw new Error(errors[0].message + '\n' + errors[0].details);
61
- }
62
- const baseDir = (_d = options === null || options === void 0 ? void 0 : options.publicPath) !== null && _d !== void 0 ? _d : '/';
63
- const publicDir = '/' +
64
- [trimTrailingSlash(trimLeadingSlash(baseDir)), 'public']
65
- .filter(Boolean)
66
- .join('/');
67
- const from = path_1.default.join(process.cwd(), 'public');
68
- const to = path_1.default.join(outDir, 'public');
69
- if (fs_1.default.existsSync(from)) {
70
- await (0, copy_dir_1.copyDir)(from, to);
71
- }
72
- const html = (0, static_preview_1.indexHtml)(publicDir, baseDir, null);
73
- fs_1.default.writeFileSync(path_1.default.join(outDir, 'index.html'), html);
74
- return outDir;
75
- };
76
- exports.bundle = bundle;
@@ -1,10 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Request, Response } from 'express';
4
- import { ReadStream } from 'fs';
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
- export declare function setHeaderForResponse(res: Response, name: string, value: string | number): void;
9
- export declare function setStatusCode(res: Response, code: number): void;
10
- export declare function send(req: Request, res: Response, bufferOtStream: ReadStream | string | Buffer, byteLength: number): void;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.send = exports.setStatusCode = exports.setHeaderForResponse = exports.getHeaderFromResponse = exports.getHeaderFromRequest = exports.getHeaderNames = void 0;
4
- function getHeaderNames(res) {
5
- if (typeof res.getHeaderNames !== 'function') {
6
- // @ts-expect-error
7
- return Object.keys(res._headers || {});
8
- }
9
- return res.getHeaderNames();
10
- }
11
- exports.getHeaderNames = getHeaderNames;
12
- function getHeaderFromRequest(req, name) {
13
- // Express API
14
- if (typeof req.get === 'function') {
15
- return req.get(name);
16
- }
17
- return req.headers[name];
18
- }
19
- exports.getHeaderFromRequest = getHeaderFromRequest;
20
- function getHeaderFromResponse(res, name) {
21
- return res.get(name);
22
- }
23
- exports.getHeaderFromResponse = getHeaderFromResponse;
24
- function setHeaderForResponse(res, name, value) {
25
- res.set(name, typeof value === 'number' ? String(value) : value);
26
- }
27
- exports.setHeaderForResponse = setHeaderForResponse;
28
- function setStatusCode(res, code) {
29
- res.status(code);
30
- }
31
- exports.setStatusCode = setStatusCode;
32
- function send(req, res, bufferOtStream, byteLength) {
33
- if (typeof bufferOtStream === 'string' || Buffer.isBuffer(bufferOtStream)) {
34
- res.send(bufferOtStream);
35
- return;
36
- }
37
- setHeaderForResponse(res, 'Content-Length', byteLength);
38
- if (req.method === 'HEAD') {
39
- res.end();
40
- return;
41
- }
42
- bufferOtStream.pipe(res);
43
- }
44
- exports.send = send;
@@ -1,2 +0,0 @@
1
- import { DevMiddlewareContext } from './types';
2
- export declare function getFilenameFromUrl(context: DevMiddlewareContext, url: string | undefined): string | undefined;
@@ -1,92 +0,0 @@
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.getFilenameFromUrl = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- // eslint-disable-next-line no-restricted-imports
9
- const querystring_1 = __importDefault(require("querystring"));
10
- const url_1 = require("url");
11
- const get_paths_1 = require("./get-paths");
12
- const cacheStore = new WeakMap();
13
- const mem = (fn, { cache = new Map() } = {}) => {
14
- const memoized = (...arguments_) => {
15
- const [key] = arguments_;
16
- const cacheItem = cache.get(key);
17
- if (cacheItem) {
18
- return cacheItem.data;
19
- }
20
- const result = fn.apply(this, arguments_);
21
- cache.set(key, {
22
- data: result,
23
- });
24
- return result;
25
- };
26
- cacheStore.set(memoized, cache);
27
- return memoized;
28
- };
29
- const memoizedParse = mem(url_1.parse);
30
- function getFilenameFromUrl(context, url) {
31
- var _a, _b;
32
- const paths = (0, get_paths_1.getPaths)(context);
33
- let foundFilename;
34
- let urlObject;
35
- try {
36
- // The `url` property of the `request` is contains only `pathname`, `search` and `hash`
37
- urlObject = memoizedParse(url, false, true);
38
- }
39
- catch (_ignoreError) {
40
- return;
41
- }
42
- for (const { publicPath, outputPath } of paths) {
43
- let filename;
44
- let publicPathObject;
45
- try {
46
- publicPathObject = memoizedParse(publicPath !== 'auto' && publicPath ? publicPath : '/', false, true);
47
- }
48
- catch (_ignoreError) {
49
- continue;
50
- }
51
- if ((_a = urlObject.pathname) === null || _a === void 0 ? void 0 : _a.startsWith(publicPathObject.pathname)) {
52
- filename = outputPath;
53
- // Strip the `pathname` property from the `publicPath` option from the start of requested url
54
- // `/complex/foo.js` => `foo.js`
55
- const pathname = urlObject.pathname.substr(publicPathObject.pathname.length);
56
- if (pathname) {
57
- filename = path_1.default.join(outputPath, querystring_1.default.unescape(pathname));
58
- }
59
- if (!context.outputFileSystem) {
60
- continue;
61
- }
62
- try {
63
- let fsStats = (_b = context.outputFileSystem) === null || _b === void 0 ? void 0 : _b.statSync(filename);
64
- if (fsStats.isFile()) {
65
- foundFilename = filename;
66
- break;
67
- }
68
- else if (fsStats.isDirectory()) {
69
- const indexValue = 'index.html';
70
- filename = path_1.default.join(filename, indexValue);
71
- // eslint-disable-next-line max-depth
72
- try {
73
- fsStats = context.outputFileSystem.statSync(filename);
74
- }
75
- catch (__ignoreError) {
76
- continue;
77
- }
78
- // eslint-disable-next-line max-depth
79
- if (fsStats.isFile()) {
80
- foundFilename = filename;
81
- break;
82
- }
83
- }
84
- }
85
- catch (_ignoreError) {
86
- continue;
87
- }
88
- }
89
- }
90
- return foundFilename;
91
- }
92
- exports.getFilenameFromUrl = getFilenameFromUrl;
@@ -1,7 +0,0 @@
1
- import { DevMiddlewareContext } from './types';
2
- declare type PublicPath = {
3
- outputPath: string;
4
- publicPath: string;
5
- };
6
- export declare function getPaths(context: DevMiddlewareContext): PublicPath[];
7
- export {};
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPaths = void 0;
4
- function getPaths(context) {
5
- const { stats } = context;
6
- const publicPaths = [];
7
- if (!stats) {
8
- return publicPaths;
9
- }
10
- const { compilation } = stats;
11
- // The `output.path` is always present and always absolute
12
- const outputPath = compilation.getPath(compilation.outputOptions.path || '');
13
- const publicPath = compilation.outputOptions.publicPath
14
- ? compilation.getPath(compilation.outputOptions.publicPath)
15
- : '';
16
- publicPaths.push({ outputPath, publicPath });
17
- return publicPaths;
18
- }
19
- exports.getPaths = getPaths;
@@ -1,3 +0,0 @@
1
- import webpack from 'webpack';
2
- import { MiddleWare } from './middleware';
3
- export declare const wdm: (compiler: webpack.Compiler) => MiddleWare;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wdm = void 0;
4
- const get_filename_from_url_1 = require("./get-filename-from-url");
5
- const middleware_1 = require("./middleware");
6
- const ready_1 = require("./ready");
7
- const setup_hooks_1 = require("./setup-hooks");
8
- const setup_output_filesystem_1 = require("./setup-output-filesystem");
9
- const noop = () => undefined;
10
- const wdm = (compiler) => {
11
- const context = {
12
- state: false,
13
- stats: undefined,
14
- callbacks: [],
15
- compiler,
16
- watching: undefined,
17
- logger: compiler.getInfrastructureLogger('webpack-dev-middleware'),
18
- outputFileSystem: undefined,
19
- };
20
- (0, setup_hooks_1.setupHooks)(context);
21
- (0, setup_output_filesystem_1.setupOutputFileSystem)(context);
22
- // Start watching
23
- if (context.compiler.watching) {
24
- context.watching = context.compiler.watching;
25
- }
26
- else {
27
- const errorHandler = (error) => {
28
- if (error) {
29
- context.logger.error(error);
30
- }
31
- };
32
- const watchOptions = context.compiler.options.watchOptions || {};
33
- context.watching = context.compiler.watch(watchOptions, errorHandler);
34
- }
35
- const instance = (0, middleware_1.middleware)(context);
36
- // @ts-expect-error
37
- instance.getFilenameFromUrl = (url) => (0, get_filename_from_url_1.getFilenameFromUrl)(context, url);
38
- // @ts-expect-error
39
- instance.waitUntilValid = (callback = noop) => {
40
- (0, ready_1.ready)(context, callback);
41
- };
42
- // @ts-expect-error
43
- instance.invalidate = (callback = noop) => {
44
- var _a;
45
- (0, ready_1.ready)(context, callback);
46
- (_a = context.watching) === null || _a === void 0 ? void 0 : _a.invalidate();
47
- };
48
- // @ts-expect-error
49
- instance.close = (callback = noop) => {
50
- var _a;
51
- (_a = context.watching) === null || _a === void 0 ? void 0 : _a.close(callback);
52
- };
53
- // @ts-expect-error
54
- instance.context = context;
55
- return instance;
56
- };
57
- exports.wdm = wdm;
@@ -1 +0,0 @@
1
- export declare const isColorSupported: boolean;
@@ -1,37 +0,0 @@
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 _a;
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.isColorSupported = void 0;
28
- const tty = __importStar(require("tty"));
29
- const argv = process.argv || [];
30
- const env = process.env || {};
31
- const isDisabled = 'NO_COLOR' in env || argv.includes('--no-color');
32
- const isForced = 'FORCE_COLOR' in env || argv.includes('--color');
33
- const isWindows = process.platform === 'win32';
34
- const isCompatibleTerminal = ((_a = tty === null || tty === void 0 ? void 0 : tty.isatty) === null || _a === void 0 ? void 0 : _a.call(tty, 1)) && env.TERM && env.TERM !== 'dumb';
35
- const isCI = 'CI' in env &&
36
- ('GITHUB_ACTIONS' in env || 'GITLAB_CI' in env || 'CIRCLECI' in env);
37
- exports.isColorSupported = !isDisabled && (isForced || isWindows || isCompatibleTerminal || isCI);
@@ -1,4 +0,0 @@
1
- import { NextFunction, Request, Response } from 'express';
2
- import { DevMiddlewareContext } from './types';
3
- export declare type MiddleWare = (req: Request, res: Response, next: NextFunction) => Promise<void>;
4
- export declare function middleware(context: DevMiddlewareContext): (req: Request, res: Response, next: NextFunction) => Promise<void>;