@remotion/cli 3.1.11 → 3.2.0

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 (77) hide show
  1. package/dist/editor/components/Editor.js +3 -1
  2. package/dist/editor/components/InitialCompositionLoader.js +13 -0
  3. package/dist/editor/components/PlayPause.js +41 -23
  4. package/dist/editor/components/PreviewToolbar.js +2 -2
  5. package/dist/editor/components/Splitter/SplitterElement.js +1 -0
  6. package/dist/editor/components/TimeValue.js +9 -5
  7. package/dist/editor/components/Timeline/MaxTimelineTracks.d.ts +1 -0
  8. package/dist/editor/components/Timeline/MaxTimelineTracks.js +5 -3
  9. package/dist/editor/components/Timeline/Timeline.js +11 -4
  10. package/dist/editor/components/Timeline/TimelineDragHandler.js +120 -23
  11. package/dist/editor/components/Timeline/TimelineList.js +5 -4
  12. package/dist/editor/components/Timeline/TimelineListItem.d.ts +1 -0
  13. package/dist/editor/components/Timeline/TimelineListItem.js +8 -4
  14. package/dist/editor/components/Timeline/TimelinePlayCursorSyncer.d.ts +2 -0
  15. package/dist/editor/components/Timeline/TimelinePlayCursorSyncer.js +76 -0
  16. package/dist/editor/components/Timeline/TimelineScrollable.js +4 -2
  17. package/dist/editor/components/Timeline/TimelineSlider.d.ts +3 -0
  18. package/dist/editor/components/Timeline/TimelineSlider.js +35 -2
  19. package/dist/editor/components/Timeline/TimelineSliderHandle.js +1 -3
  20. package/dist/editor/components/Timeline/TimelineTimeIndicators.d.ts +5 -0
  21. package/dist/editor/components/Timeline/TimelineTimeIndicators.js +168 -0
  22. package/dist/editor/components/Timeline/TimelineTracks.js +14 -9
  23. package/dist/editor/components/Timeline/TimelineZoomControls.js +18 -2
  24. package/dist/editor/components/Timeline/imperative-state.d.ts +12 -0
  25. package/dist/editor/components/Timeline/imperative-state.js +39 -0
  26. package/dist/editor/components/Timeline/timeline-refs.d.ts +2 -0
  27. package/dist/editor/components/Timeline/timeline-refs.js +3 -1
  28. package/dist/editor/components/Timeline/timeline-scroll-logic.d.ts +40 -0
  29. package/dist/editor/components/Timeline/timeline-scroll-logic.js +206 -1
  30. package/dist/editor/components/ZoomPersistor.d.ts +4 -0
  31. package/dist/editor/components/ZoomPersistor.js +37 -0
  32. package/dist/editor/helpers/colors.d.ts +1 -0
  33. package/dist/editor/helpers/colors.js +2 -1
  34. package/dist/editor/helpers/get-left-of-timeline-slider.d.ts +1 -0
  35. package/dist/editor/helpers/get-left-of-timeline-slider.js +7 -4
  36. package/dist/editor/helpers/get-timeline-sequence-layout.js +29 -9
  37. package/dist/editor/icons/minus.d.ts +3 -0
  38. package/dist/editor/icons/minus.js +8 -0
  39. package/dist/editor/icons/plus.d.ts +3 -0
  40. package/dist/editor/icons/plus.js +8 -0
  41. package/dist/editor/state/timeline-zoom.d.ts +1 -1
  42. package/dist/editor/state/timeline-zoom.js +15 -1
  43. package/dist/handle-common-errors.js +5 -0
  44. package/dist/preview-server/live-events.js +4 -0
  45. package/dist/preview-server/routes.js +16 -2
  46. package/dist/preview-server/start-server.js +1 -1
  47. package/dist/upgrade.js +1 -0
  48. package/dist/versions.js +1 -0
  49. package/package.json +7 -7
  50. package/dist/bundle-on-cli.d.ts +0 -2
  51. package/dist/bundle-on-cli.js +0 -41
  52. package/dist/bundle.d.ts +0 -1
  53. package/dist/bundle.js +0 -31
  54. package/dist/chalk/symbols.d.ts +0 -111
  55. package/dist/chalk/symbols.js +0 -75
  56. package/dist/chalk/utilities.d.ts +0 -2
  57. package/dist/chalk/utilities.js +0 -37
  58. package/dist/editor/components/CompositionManager.d.ts +0 -4
  59. package/dist/editor/components/CompositionManager.js +0 -60
  60. package/dist/editor/components/LoadingIndicator.d.ts +0 -2
  61. package/dist/editor/components/LoadingIndicator.js +0 -35
  62. package/dist/prepare-entry-point.d.ts +0 -11
  63. package/dist/prepare-entry-point.js +0 -36
  64. package/dist/preview-server/fast-refresh/helpers.d.ts +0 -39
  65. package/dist/preview-server/fast-refresh/helpers.js +0 -145
  66. package/dist/preview-server/fast-refresh/index.d.ts +0 -30
  67. package/dist/preview-server/fast-refresh/index.js +0 -86
  68. package/dist/preview-server/fast-refresh/loader.d.ts +0 -35
  69. package/dist/preview-server/fast-refresh/loader.js +0 -81
  70. package/dist/preview-server/fast-refresh/runtime.d.ts +0 -35
  71. package/dist/preview-server/fast-refresh/runtime.js +0 -32
  72. package/dist/preview-server/static-preview.d.ts +0 -1
  73. package/dist/preview-server/static-preview.js +0 -40
  74. package/dist/preview-server/webpack-cache.d.ts +0 -12
  75. package/dist/preview-server/webpack-cache.js +0 -66
  76. package/dist/webpack-cache.d.ts +0 -12
  77. package/dist/webpack-cache.js +0 -66
@@ -1,86 +0,0 @@
1
- "use strict";
2
- /**
3
- * Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ReactFreshWebpackPlugin = void 0;
7
- /**
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2020 Vercel, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
- // This file is copied from the @vercel/next.js, with removed TS annotations
31
- // minor tweaks, and removed all webpack v4-related functionality
32
- //
33
- // https://github.com/vercel/next.js/blob/canary/packages/react-refresh-utils/ReactRefreshWebpackPlugin.ts
34
- const webpack_1 = require("webpack");
35
- class ReactRefreshRuntimeModule extends webpack_1.RuntimeModule {
36
- constructor() {
37
- super('react refresh', 5);
38
- }
39
- generate() {
40
- const { runtimeTemplate } = this.compilation;
41
- return webpack_1.Template.asString([
42
- `${webpack_1.RuntimeGlobals.interceptModuleExecution}.push(${runtimeTemplate.basicFunction('options', [
43
- `const originalFactory = options.factory;`,
44
- `options.factory = ${runtimeTemplate.basicFunction('moduleObject, moduleExports, webpackRequire', [
45
- // Legacy CSS implementations will `eval` browser code in a Node.js
46
- // context to extract CSS. For backwards compatibility, we need to check
47
- // we're in a browser context before continuing.
48
- `const hasRefresh = typeof self !== "undefined" && !!self.$RefreshInterceptModuleExecution$;`,
49
- `const cleanup = hasRefresh ? self.$RefreshInterceptModuleExecution$(moduleObject.id) : () => {};`,
50
- 'try {',
51
- webpack_1.Template.indent('originalFactory.call(this, moduleObject, moduleExports, webpackRequire);'),
52
- '} finally {',
53
- webpack_1.Template.indent(`cleanup();`),
54
- '}',
55
- ])}`,
56
- ])})`,
57
- ]);
58
- }
59
- }
60
- class ReactFreshWebpackPlugin {
61
- apply(compiler) {
62
- const webpackMajorVersion = parseInt(webpack_1.version !== null && webpack_1.version !== void 0 ? webpack_1.version : '', 10);
63
- if (webpackMajorVersion < 5) {
64
- throw new Error(`ReactFreshWebpackPlugin does not support webpack v${webpackMajorVersion}.`);
65
- }
66
- compiler.hooks.compilation.tap(this.constructor.name, (compilation) => {
67
- compilation.mainTemplate.hooks.localVars.tap(this.constructor.name, (source) => webpack_1.Template.asString([
68
- source,
69
- '',
70
- '// noop fns to prevent runtime errors during initialization',
71
- 'if (typeof self !== "undefined") {',
72
- webpack_1.Template.indent('self.$RefreshReg$ = function () {};'),
73
- webpack_1.Template.indent('self.$RefreshSig$ = function () {'),
74
- webpack_1.Template.indent(webpack_1.Template.indent('return function (type) {')),
75
- webpack_1.Template.indent(webpack_1.Template.indent(webpack_1.Template.indent('return type;'))),
76
- webpack_1.Template.indent(webpack_1.Template.indent('};')),
77
- webpack_1.Template.indent('};'),
78
- '}',
79
- ]));
80
- compilation.hooks.additionalTreeRuntimeRequirements.tap(this.constructor.name, (chunk) => {
81
- compilation.addRuntimeModule(chunk, new ReactRefreshRuntimeModule());
82
- });
83
- });
84
- }
85
- }
86
- exports.ReactFreshWebpackPlugin = ReactFreshWebpackPlugin;
@@ -1,35 +0,0 @@
1
- /**
2
- * ⚠️ Be careful when refactoring this file!
3
- * This gets injected into every file of the browser.
4
- * You cannot have returns, optional chains, inverse the if statement etc.
5
- * Check the Typescript output in dist/ to see that no extra `var` statements were produced
6
- */
7
- /**
8
- * Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
9
- */
10
- /**
11
- * The MIT License (MIT)
12
- *
13
- * Copyright (c) 2020 Vercel, Inc.
14
- *
15
- * Permission is hereby granted, free of charge, to any person obtaining a copy
16
- * of this software and associated documentation files (the "Software"), to deal
17
- * in the Software without restriction, including without limitation the rights
18
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
- * copies of the Software, and to permit persons to whom the Software is
20
- * furnished to do so, subject to the following conditions:
21
- *
22
- * The above copyright notice and this permission notice shall be included in all
23
- * copies or substantial portions of the Software.
24
- *
25
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- * SOFTWARE.
32
- */
33
- import { LoaderDefinition } from 'webpack';
34
- declare const ReactRefreshLoader: LoaderDefinition;
35
- export default ReactRefreshLoader;
@@ -1,81 +0,0 @@
1
- "use strict";
2
- /**
3
- * ⚠️ Be careful when refactoring this file!
4
- * This gets injected into every file of the browser.
5
- * You cannot have returns, optional chains, inverse the if statement etc.
6
- * Check the Typescript output in dist/ to see that no extra `var` statements were produced
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- // This file is copied from the @vercel/next.js, with removed TS annotations
10
- //
11
- // https://github.com/vercel/next.js/blob/canary/packages/react-refresh-utils/loader.ts
12
- // This function gets unwrapped into global scope, which is why we don't invert
13
- // if-blocks. Also, you cannot use `return`.
14
- function RefreshModuleRuntime() {
15
- // Legacy CSS implementations will `eval` browser code in a Node.js context
16
- // to extract CSS. For backwards compatibility, we need to check we're in a
17
- // browser context before continuing.
18
- if (typeof self !== 'undefined' &&
19
- // AMP / No-JS mode does not inject these helpers:
20
- '$RefreshHelpers$' in self) {
21
- // @ts-expect-error
22
- // eslint-disable-next-line no-proto
23
- const currentExports = module.__proto__.exports;
24
- let prevExports = null;
25
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
26
- if (module.hot && module.hot.data && module.hot.data.prevExports) {
27
- prevExports = module.hot.data.prevExports;
28
- }
29
- // This cannot happen in MainTemplate because the exports mismatch between
30
- // templating and execution.
31
- self.$RefreshHelpers$.registerExportsForReactRefresh(currentExports, module.id);
32
- // A module can be accepted automatically based on its exports, e.g. when
33
- // it is a Refresh Boundary.
34
- if (self.$RefreshHelpers$.isReactRefreshBoundary(currentExports)) {
35
- // Save the previous exports on update so we can compare the boundary
36
- // signatures.
37
- module.hot.dispose((data) => {
38
- data.prevExports = currentExports;
39
- });
40
- // Unconditionally accept an update to this module, we'll check if it's
41
- // still a Refresh Boundary later.
42
- module.hot.accept();
43
- // This field is set when the previous version of this module was a
44
- // Refresh Boundary, letting us know we need to check for invalidation or
45
- // enqueue an update.
46
- if (prevExports !== null) {
47
- // A boundary can become ineligible if its exports are incompatible
48
- // with the previous exports.
49
- //
50
- // For example, if you add/remove/change exports, we'll want to
51
- // re-execute the importing modules, and force those components to
52
- // re-render. Similarly, if you convert a class component to a
53
- // function, we want to invalidate the boundary.
54
- if (self.$RefreshHelpers$.shouldInvalidateReactRefreshBoundary(prevExports, currentExports)) {
55
- // @ts-expect-error
56
- module.hot.invalidate();
57
- }
58
- else {
59
- self.$RefreshHelpers$.scheduleUpdate();
60
- }
61
- }
62
- }
63
- else {
64
- // Since we just executed the code for the module, it's possible that the
65
- // new exports made it ineligible for being a boundary.
66
- // We only care about the case when we were _previously_ a boundary,
67
- // because we already accepted this update (accidental side effect).
68
- const isNoLongerABoundary = prevExports !== null;
69
- if (isNoLongerABoundary) {
70
- // @ts-expect-error
71
- module.hot.invalidate();
72
- }
73
- }
74
- }
75
- }
76
- let refreshModuleRuntime = RefreshModuleRuntime.toString();
77
- refreshModuleRuntime = refreshModuleRuntime.slice(refreshModuleRuntime.indexOf('{') + 1, refreshModuleRuntime.lastIndexOf('}'));
78
- const ReactRefreshLoader = function (source, inputSourceMap) {
79
- this.callback(null, `${source}\n\n;${refreshModuleRuntime}`, inputSourceMap);
80
- };
81
- exports.default = ReactRefreshLoader;
@@ -1,35 +0,0 @@
1
- /**
2
- * Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
3
- */
4
- /**
5
- * The MIT License (MIT)
6
- *
7
- * Copyright (c) 2020 Vercel, Inc.
8
- *
9
- * Permission is hereby granted, free of charge, to any person obtaining a copy
10
- * of this software and associated documentation files (the "Software"), to deal
11
- * in the Software without restriction, including without limitation the rights
12
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- * copies of the Software, and to permit persons to whom the Software is
14
- * furnished to do so, subject to the following conditions:
15
- *
16
- * The above copyright notice and this permission notice shall be included in all
17
- * copies or substantial portions of the Software.
18
- *
19
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
- * SOFTWARE.
26
- */
27
- declare global {
28
- interface Window {
29
- $RefreshReg$: (type: string, id?: string) => void;
30
- $RefreshSig$: () => (type: string) => unknown;
31
- $RefreshHelpers$: typeof RefreshHelpers;
32
- $RefreshInterceptModuleExecution$: (webpackId: unknown) => () => void;
33
- }
34
- }
35
- import RefreshHelpers from './helpers';
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /**
3
- * Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
4
- */
5
- var __importDefault = (this && this.__importDefault) || function (mod) {
6
- return (mod && mod.__esModule) ? mod : { "default": mod };
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const RefreshRuntime = require('react-refresh/runtime');
10
- const helpers_1 = __importDefault(require("./helpers"));
11
- // Hook into ReactDOM initialization
12
- RefreshRuntime.injectIntoGlobalHook(self);
13
- // noop fns to prevent runtime errors during initialization
14
- self.$RefreshReg$ = () => undefined;
15
- self.$RefreshSig$ = () => (type) => type;
16
- // Register global helpers
17
- self.$RefreshHelpers$ = helpers_1.default;
18
- // Register a helper for module execution interception
19
- self.$RefreshInterceptModuleExecution$ = function (webpackModuleId) {
20
- const prevRefreshReg = self.$RefreshReg$;
21
- const prevRefreshSig = self.$RefreshSig$;
22
- self.$RefreshReg$ = (type, id) => {
23
- RefreshRuntime.register(type, webpackModuleId + ' ' + id);
24
- };
25
- self.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
26
- // Modeled after `useEffect` cleanup pattern:
27
- // https://reactjs.org/docs/hooks-effect.html#effects-with-cleanup
28
- return () => {
29
- self.$RefreshReg$ = prevRefreshReg;
30
- self.$RefreshSig$ = prevRefreshSig;
31
- };
32
- };
@@ -1 +0,0 @@
1
- export declare const indexHtml: (staticHash: string, baseDir: string, editorName: string | null) => string;
@@ -1,40 +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.indexHtml = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const indexHtml = (staticHash, baseDir, editorName) => `
9
- <!DOCTYPE html>
10
- <html lang="en">
11
- <head>
12
- <meta charset="UTF-8" />
13
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
14
- <link rel="preconnect" href="https://fonts.gstatic.com" />
15
- <link rel="icon" type="image/png" href="/remotion.png" />
16
- <title>Remotion Preview</title>
17
- </head>
18
- <body>
19
- <script>window.remotion_staticBase = "${staticHash}";</script>
20
- <div id="video-container"></div>
21
- <div id="explainer-container"></div>
22
- ${editorName
23
- ? `<script>window.remotion_editorName = "${editorName}";</script>`
24
- : '<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>
27
-
28
- <div id="container"></div>
29
- <div id="menuportal-0"></div>
30
- <div id="menuportal-1"></div>
31
- <div id="menuportal-2"></div>
32
- <div id="menuportal-3"></div>
33
- <div id="menuportal-4"></div>
34
- <div id="menuportal-5"></div>
35
- <div id="remotion-error-overlay"></div>
36
- <script src="${baseDir}bundle.js"></script>
37
- </body>
38
- </html>
39
- `.trim();
40
- exports.indexHtml = indexHtml;
@@ -1,12 +0,0 @@
1
- declare type Environment = 'development' | 'production';
2
- declare global {
3
- namespace NodeJS {
4
- interface ProcessVersions {
5
- pnp?: string;
6
- }
7
- }
8
- }
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;
12
- export {};
@@ -1,66 +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.cacheExists = exports.getWebpackCacheName = exports.clearCache = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- const remotion_1 = require("remotion");
10
- // Inlined from https://github.com/webpack/webpack/blob/4c2ee7a4ddb8db2362ca83b6c4190523387ba7ee/lib/config/defaults.js#L265
11
- // An algorithm to determine where Webpack will cache the depencies
12
- const getWebpackCacheDir = () => {
13
- const cwd = process.cwd();
14
- let dir = cwd;
15
- for (;;) {
16
- try {
17
- if (fs_1.default.statSync(path_1.default.join(dir, 'package.json')).isFile()) {
18
- break;
19
- }
20
- // eslint-disable-next-line no-empty
21
- }
22
- catch (e) { }
23
- const parent = path_1.default.dirname(dir);
24
- if (dir === parent) {
25
- dir = undefined;
26
- break;
27
- }
28
- dir = parent;
29
- }
30
- if (!dir) {
31
- return path_1.default.resolve(cwd, '.cache/webpack');
32
- }
33
- if (process.versions.pnp === '1') {
34
- return path_1.default.resolve(dir, '.pnp/.cache/webpack');
35
- }
36
- if (process.versions.pnp === '3') {
37
- return path_1.default.resolve(dir, '.yarn/.cache/webpack');
38
- }
39
- return path_1.default.resolve(dir, 'node_modules/.cache/webpack');
40
- };
41
- const remotionCacheLocation = (environment, inputProps) => {
42
- return path_1.default.join(getWebpackCacheDir(), (0, exports.getWebpackCacheName)(environment, inputProps));
43
- };
44
- const clearCache = (environment, inputProps) => {
45
- var _a;
46
- return ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(remotionCacheLocation(environment, inputProps), {
47
- recursive: true,
48
- });
49
- };
50
- exports.clearCache = clearCache;
51
- const getWebpackCacheName = (environment, inputProps) => {
52
- // In development, let's reset the cache when input props
53
- // are changing, because they are injected using Webpack and if changed,
54
- // it will get the cached version
55
- if (environment === 'development') {
56
- return `remotion-v3-${environment}-${(0, remotion_1.random)(JSON.stringify(inputProps))}`;
57
- }
58
- // In production, the cache is independent from input props because
59
- // they are passed over URL params. Speed is mostly important in production.
60
- return `remotion-v3-${environment}`;
61
- };
62
- exports.getWebpackCacheName = getWebpackCacheName;
63
- const cacheExists = (environment, inputProps) => {
64
- return fs_1.default.existsSync(remotionCacheLocation(environment, inputProps));
65
- };
66
- exports.cacheExists = cacheExists;
@@ -1,12 +0,0 @@
1
- declare type Environment = 'development' | 'production';
2
- declare global {
3
- namespace NodeJS {
4
- interface ProcessVersions {
5
- pnp?: string;
6
- }
7
- }
8
- }
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;
12
- export {};
@@ -1,66 +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.cacheExists = exports.getWebpackCacheName = exports.clearCache = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- const remotion_1 = require("remotion");
10
- // Inlined from https://github.com/webpack/webpack/blob/4c2ee7a4ddb8db2362ca83b6c4190523387ba7ee/lib/config/defaults.js#L265
11
- // An algorithm to determine where Webpack will cache the depencies
12
- const getWebpackCacheDir = () => {
13
- const cwd = process.cwd();
14
- let dir = cwd;
15
- for (;;) {
16
- try {
17
- if (fs_1.default.statSync(path_1.default.join(dir, 'package.json')).isFile()) {
18
- break;
19
- }
20
- // eslint-disable-next-line no-empty
21
- }
22
- catch (e) { }
23
- const parent = path_1.default.dirname(dir);
24
- if (dir === parent) {
25
- dir = undefined;
26
- break;
27
- }
28
- dir = parent;
29
- }
30
- if (!dir) {
31
- return path_1.default.resolve(cwd, '.cache/webpack');
32
- }
33
- if (process.versions.pnp === '1') {
34
- return path_1.default.resolve(dir, '.pnp/.cache/webpack');
35
- }
36
- if (process.versions.pnp === '3') {
37
- return path_1.default.resolve(dir, '.yarn/.cache/webpack');
38
- }
39
- return path_1.default.resolve(dir, 'node_modules/.cache/webpack');
40
- };
41
- const remotionCacheLocation = (environment, inputProps) => {
42
- return path_1.default.join(getWebpackCacheDir(), (0, exports.getWebpackCacheName)(environment, inputProps));
43
- };
44
- const clearCache = (environment, inputProps) => {
45
- var _a;
46
- return ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(remotionCacheLocation(environment, inputProps), {
47
- recursive: true,
48
- });
49
- };
50
- exports.clearCache = clearCache;
51
- const getWebpackCacheName = (environment, inputProps) => {
52
- // In development, let's reset the cache when input props
53
- // are changing, because they are injected using Webpack and if changed,
54
- // it will get the cached version
55
- if (environment === 'development') {
56
- return `remotion-v3-${environment}-${(0, remotion_1.random)(JSON.stringify(inputProps))}`;
57
- }
58
- // In production, the cache is independent from input props because
59
- // they are passed over URL params. Speed is mostly important in production.
60
- return `remotion-v3-${environment}`;
61
- };
62
- exports.getWebpackCacheName = getWebpackCacheName;
63
- const cacheExists = (environment, inputProps) => {
64
- return fs_1.default.existsSync(remotionCacheLocation(environment, inputProps));
65
- };
66
- exports.cacheExists = cacheExists;