@remotion/bundler 3.1.4 → 3.1.7

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 (148) hide show
  1. package/dist/bundle.d.ts +10 -4
  2. package/dist/bundle.js +36 -11
  3. package/dist/esbuild-loader/index.js +1 -1
  4. package/dist/index-html.d.ts +7 -1
  5. package/dist/index-html.js +3 -3
  6. package/dist/index.d.ts +21 -12
  7. package/dist/setup-environment.js +0 -1
  8. package/dist/webpack-cache.d.ts +2 -2
  9. package/dist/webpack-cache.js +13 -14
  10. package/dist/webpack-config.d.ts +2 -1
  11. package/dist/webpack-config.js +2 -1
  12. package/package.json +3 -3
  13. package/dist/bundler.d.ts +0 -7
  14. package/dist/bundler.js +0 -76
  15. package/dist/dev-middleware/compatible-api.d.ts +0 -10
  16. package/dist/dev-middleware/compatible-api.js +0 -44
  17. package/dist/dev-middleware/get-filename-from-url.d.ts +0 -2
  18. package/dist/dev-middleware/get-filename-from-url.js +0 -92
  19. package/dist/dev-middleware/get-paths.d.ts +0 -7
  20. package/dist/dev-middleware/get-paths.js +0 -19
  21. package/dist/dev-middleware/index.d.ts +0 -3
  22. package/dist/dev-middleware/index.js +0 -57
  23. package/dist/dev-middleware/is-color-supported.d.ts +0 -1
  24. package/dist/dev-middleware/is-color-supported.js +0 -37
  25. package/dist/dev-middleware/middleware.d.ts +0 -4
  26. package/dist/dev-middleware/middleware.js +0 -141
  27. package/dist/dev-middleware/range-parser.d.ts +0 -15
  28. package/dist/dev-middleware/range-parser.js +0 -96
  29. package/dist/dev-middleware/ready.d.ts +0 -5
  30. package/dist/dev-middleware/ready.js +0 -13
  31. package/dist/dev-middleware/setup-hooks.d.ts +0 -2
  32. package/dist/dev-middleware/setup-hooks.js +0 -44
  33. package/dist/dev-middleware/setup-output-filesystem.d.ts +0 -2
  34. package/dist/dev-middleware/setup-output-filesystem.js +0 -13
  35. package/dist/dev-middleware/types.d.ts +0 -11
  36. package/dist/dev-middleware/types.js +0 -2
  37. package/dist/error-overlay/entry-basic.d.ts +0 -1
  38. package/dist/error-overlay/entry-basic.js +0 -21
  39. package/dist/error-overlay/react-overlay/effects/format-warning.d.ts +0 -11
  40. package/dist/error-overlay/react-overlay/effects/format-warning.js +0 -41
  41. package/dist/error-overlay/react-overlay/effects/map-error-to-react-stack.d.ts +0 -7
  42. package/dist/error-overlay/react-overlay/effects/map-error-to-react-stack.js +0 -46
  43. package/dist/error-overlay/react-overlay/effects/proxy-console.d.ts +0 -24
  44. package/dist/error-overlay/react-overlay/effects/proxy-console.js +0 -63
  45. package/dist/error-overlay/react-overlay/effects/resolve-file-source.d.ts +0 -3
  46. package/dist/error-overlay/react-overlay/effects/resolve-file-source.js +0 -31
  47. package/dist/error-overlay/react-overlay/effects/stack-trace-limit.d.ts +0 -3
  48. package/dist/error-overlay/react-overlay/effects/stack-trace-limit.js +0 -43
  49. package/dist/error-overlay/react-overlay/effects/unhandled-error.d.ts +0 -4
  50. package/dist/error-overlay/react-overlay/effects/unhandled-error.js +0 -45
  51. package/dist/error-overlay/react-overlay/effects/unhandled-rejection.d.ts +0 -4
  52. package/dist/error-overlay/react-overlay/effects/unhandled-rejection.js +0 -41
  53. package/dist/error-overlay/react-overlay/index.d.ts +0 -2
  54. package/dist/error-overlay/react-overlay/index.js +0 -21
  55. package/dist/error-overlay/react-overlay/listen-to-runtime-errors.d.ts +0 -8
  56. package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +0 -78
  57. package/dist/error-overlay/react-overlay/utils/get-file-source.d.ts +0 -1
  58. package/dist/error-overlay/react-overlay/utils/get-file-source.js +0 -21
  59. package/dist/error-overlay/react-overlay/utils/get-lines-around.d.ts +0 -14
  60. package/dist/error-overlay/react-overlay/utils/get-lines-around.js +0 -24
  61. package/dist/error-overlay/react-overlay/utils/get-source-map.d.ts +0 -13
  62. package/dist/error-overlay/react-overlay/utils/get-source-map.js +0 -58
  63. package/dist/error-overlay/react-overlay/utils/get-stack-frames.d.ts +0 -2
  64. package/dist/error-overlay/react-overlay/utils/get-stack-frames.js +0 -27
  65. package/dist/error-overlay/react-overlay/utils/open-in-editor.d.ts +0 -12
  66. package/dist/error-overlay/react-overlay/utils/open-in-editor.js +0 -459
  67. package/dist/error-overlay/react-overlay/utils/parser.d.ts +0 -2
  68. package/dist/error-overlay/react-overlay/utils/parser.js +0 -117
  69. package/dist/error-overlay/react-overlay/utils/stack-frame.d.ts +0 -40
  70. package/dist/error-overlay/react-overlay/utils/stack-frame.js +0 -31
  71. package/dist/error-overlay/react-overlay/utils/unmapper.d.ts +0 -2
  72. package/dist/error-overlay/react-overlay/utils/unmapper.js +0 -64
  73. package/dist/error-overlay/remotion-overlay/AskOnDiscord.d.ts +0 -2
  74. package/dist/error-overlay/remotion-overlay/AskOnDiscord.js +0 -14
  75. package/dist/error-overlay/remotion-overlay/Button.d.ts +0 -6
  76. package/dist/error-overlay/remotion-overlay/Button.js +0 -24
  77. package/dist/error-overlay/remotion-overlay/CodeFrame.d.ts +0 -6
  78. package/dist/error-overlay/remotion-overlay/CodeFrame.js +0 -28
  79. package/dist/error-overlay/remotion-overlay/DismissButton.d.ts +0 -2
  80. package/dist/error-overlay/remotion-overlay/DismissButton.js +0 -23
  81. package/dist/error-overlay/remotion-overlay/ErrorDisplay.d.ts +0 -5
  82. package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +0 -45
  83. package/dist/error-overlay/remotion-overlay/ErrorLoader.d.ts +0 -4
  84. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +0 -61
  85. package/dist/error-overlay/remotion-overlay/ErrorTitle.d.ts +0 -6
  86. package/dist/error-overlay/remotion-overlay/ErrorTitle.js +0 -41
  87. package/dist/error-overlay/remotion-overlay/OpenInEditor.d.ts +0 -5
  88. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +0 -90
  89. package/dist/error-overlay/remotion-overlay/Overlay.d.ts +0 -14
  90. package/dist/error-overlay/remotion-overlay/Overlay.js +0 -49
  91. package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.d.ts +0 -4
  92. package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.js +0 -13
  93. package/dist/error-overlay/remotion-overlay/StackFrame.d.ts +0 -8
  94. package/dist/error-overlay/remotion-overlay/StackFrame.js +0 -48
  95. package/dist/error-overlay/remotion-overlay/Symbolicating.d.ts +0 -2
  96. package/dist/error-overlay/remotion-overlay/Symbolicating.js +0 -8
  97. package/dist/error-overlay/remotion-overlay/carets.d.ts +0 -3
  98. package/dist/error-overlay/remotion-overlay/carets.js +0 -12
  99. package/dist/error-overlay/remotion-overlay/format-location.d.ts +0 -1
  100. package/dist/error-overlay/remotion-overlay/format-location.js +0 -10
  101. package/dist/error-overlay/remotion-overlay/index.d.ts +0 -1
  102. package/dist/error-overlay/remotion-overlay/index.js +0 -18
  103. package/dist/get-latest-remotion-version.d.ts +0 -1
  104. package/dist/get-latest-remotion-version.js +0 -31
  105. package/dist/get-package-manager.d.ts +0 -8
  106. package/dist/get-package-manager.js +0 -38
  107. package/dist/get-port.d.ts +0 -1
  108. package/dist/get-port.js +0 -80
  109. package/dist/hot-middleware/client.d.ts +0 -19
  110. package/dist/hot-middleware/client.js +0 -206
  111. package/dist/hot-middleware/index.d.ts +0 -13
  112. package/dist/hot-middleware/index.js +0 -180
  113. package/dist/hot-middleware/process-update.d.ts +0 -12
  114. package/dist/hot-middleware/process-update.js +0 -147
  115. package/dist/hot-middleware/strip-ansi.d.ts +0 -1
  116. package/dist/hot-middleware/strip-ansi.js +0 -21
  117. package/dist/hot-middleware/types.d.ts +0 -37
  118. package/dist/hot-middleware/types.js +0 -17
  119. package/dist/is-path-inside.d.ts +0 -1
  120. package/dist/is-path-inside.js +0 -27
  121. package/dist/p-limit.d.ts +0 -1
  122. package/dist/p-limit.js +0 -57
  123. package/dist/project-info.d.ts +0 -5
  124. package/dist/project-info.js +0 -22
  125. package/dist/routes.d.ts +0 -2
  126. package/dist/routes.js +0 -121
  127. package/dist/serve-static.d.ts +0 -9
  128. package/dist/serve-static.js +0 -81
  129. package/dist/start-server-pure.d.ts +0 -8
  130. package/dist/start-server-pure.js +0 -68
  131. package/dist/start-server.d.ts +0 -8
  132. package/dist/start-server.js +0 -132
  133. package/dist/static-preview.d.ts +0 -1
  134. package/dist/static-preview.js +0 -40
  135. package/dist/test/expect-to-throw.d.ts +0 -1
  136. package/dist/test/expect-to-throw.js +0 -14
  137. package/dist/test/latest-remotion-version.test.d.ts +0 -1
  138. package/dist/test/latest-remotion-version.test.js +0 -6
  139. package/dist/test/parse-error-stack.test.d.ts +0 -1
  140. package/dist/test/parse-error-stack.test.js +0 -17
  141. package/dist/test/parse-module-not-found.test.d.ts +0 -1
  142. package/dist/test/parse-module-not-found.test.js +0 -17
  143. package/dist/test/secure-source-read.test.d.ts +0 -1
  144. package/dist/test/secure-source-read.test.js +0 -8
  145. package/dist/ts-alias-plugin.d.ts +0 -4
  146. package/dist/ts-alias-plugin.js +0 -21
  147. package/dist/update-available.d.ts +0 -10
  148. package/dist/update-available.js +0 -36
@@ -1,147 +0,0 @@
1
- "use strict";
2
- /**
3
- * Source code is adapted from
4
- * https://github.com/webpack-contrib/webpack-hot-middleware#readme
5
- * and rewritten in TypeScript. This file is MIT licensed
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.processUpdate = void 0;
9
- /* global __webpack_hash__ */
10
- if (!module.hot) {
11
- throw new Error('[Fast refresh] Hot Module Replacement is disabled.');
12
- }
13
- const hmrDocsUrl = 'https://webpack.js.org/concepts/hot-module-replacement/'; // eslint-disable-line max-len
14
- let lastHash;
15
- const failureStatuses = { abort: 1, fail: 1 };
16
- const applyOptions = {
17
- ignoreUnaccepted: true,
18
- ignoreDeclined: true,
19
- ignoreErrored: true,
20
- onUnaccepted(data) {
21
- var _a;
22
- console.warn('Ignored an update to unaccepted module ' +
23
- ((_a = data.chain) !== null && _a !== void 0 ? _a : []).join(' -> '));
24
- },
25
- onDeclined(data) {
26
- var _a;
27
- console.warn('Ignored an update to declined module ' + ((_a = data.chain) !== null && _a !== void 0 ? _a : []).join(' -> '));
28
- },
29
- onErrored(data) {
30
- console.error(data.error);
31
- console.warn('Ignored an error while updating module ' +
32
- data.moduleId +
33
- ' (' +
34
- data.type +
35
- ')');
36
- },
37
- };
38
- function upToDate(hash) {
39
- if (hash)
40
- lastHash = hash;
41
- return lastHash === __webpack_hash__;
42
- }
43
- const processUpdate = function (hash, moduleMap, options) {
44
- var _a;
45
- const { reload } = options;
46
- if (!upToDate(hash) && ((_a = module.hot) === null || _a === void 0 ? void 0 : _a.status()) === 'idle') {
47
- console.log('[Fast refresh] Checking for updates on the server...');
48
- check();
49
- }
50
- async function check() {
51
- var _a;
52
- const cb = function (err, updatedModules) {
53
- var _a;
54
- if (err)
55
- return handleError(err);
56
- if (!updatedModules) {
57
- if (options.warn) {
58
- console.warn('[Fast refresh] Cannot find update (Full reload needed)');
59
- console.warn('[Fast refresh] (Probably because of restarting the server)');
60
- }
61
- performReload();
62
- return null;
63
- }
64
- const applyCallback = function (applyErr, renewedModules) {
65
- if (applyErr)
66
- return handleError(applyErr);
67
- if (!upToDate())
68
- check();
69
- logUpdates(updatedModules, renewedModules);
70
- };
71
- const applyResult = (_a = module.hot) === null || _a === void 0 ? void 0 : _a.apply(applyOptions, applyCallback);
72
- if (applyResult === null || applyResult === void 0 ? void 0 : applyResult.then) {
73
- // HotModuleReplacement.runtime.js refers to the result as `outdatedModules`
74
- applyResult
75
- .then((outdatedModules) => {
76
- applyCallback(null, outdatedModules);
77
- })
78
- .catch((_err) => applyCallback(_err, []));
79
- }
80
- };
81
- try {
82
- const result = await ((_a = module.hot) === null || _a === void 0 ? void 0 : _a.check(false, cb));
83
- cb(null, result);
84
- }
85
- catch (err) {
86
- cb(err, []);
87
- }
88
- }
89
- function logUpdates(updatedModules, renewedModules) {
90
- var _a;
91
- const unacceptedModules = (_a = updatedModules === null || updatedModules === void 0 ? void 0 : updatedModules.filter((moduleId) => {
92
- return renewedModules && renewedModules.indexOf(moduleId) < 0;
93
- })) !== null && _a !== void 0 ? _a : [];
94
- if (unacceptedModules.length > 0) {
95
- if (options.warn) {
96
- console.warn("[Fast refresh] The following modules couldn't be hot updated: " +
97
- '(Full reload needed)\n' +
98
- 'This is usually because the modules which have changed ' +
99
- '(and their parents) do not know how to hot reload themselves. ' +
100
- 'See ' +
101
- hmrDocsUrl +
102
- ' for more details.');
103
- unacceptedModules.forEach((moduleId) => {
104
- console.warn('[Fast refresh] - ' + (moduleMap[moduleId] || moduleId));
105
- });
106
- }
107
- performReload();
108
- return;
109
- }
110
- if (!renewedModules || renewedModules.length === 0) {
111
- console.log('[Fast refresh] Nothing hot updated.');
112
- }
113
- else {
114
- console.log('[Fast refresh] Updated modules:');
115
- renewedModules.forEach((moduleId) => {
116
- console.log('[Fast refresh] - ' + (moduleMap[moduleId] || moduleId));
117
- });
118
- }
119
- if (upToDate()) {
120
- console.log('[Fast refresh] App is up to date.');
121
- }
122
- }
123
- function handleError(err) {
124
- var _a, _b;
125
- if (((_b = (_a = module.hot) === null || _a === void 0 ? void 0 : _a.status()) !== null && _b !== void 0 ? _b : 'nope') in failureStatuses) {
126
- if (options.warn) {
127
- console.warn('[Fast refresh] Cannot check for update (Full reload needed)');
128
- console.warn('[Fast refresh] ' + (err.stack || err.message));
129
- }
130
- performReload();
131
- return;
132
- }
133
- if (options.warn) {
134
- console.warn('[Fast refresh] Update check failed: ' + (err.stack || err.message));
135
- window.location.reload();
136
- }
137
- }
138
- function performReload() {
139
- if (!reload) {
140
- return;
141
- }
142
- if (options.warn)
143
- console.warn('[Fast refresh] Reloading page');
144
- window.location.reload();
145
- }
146
- };
147
- exports.processUpdate = processUpdate;
@@ -1 +0,0 @@
1
- export declare const stripAnsi: (str: string) => string;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stripAnsi = void 0;
4
- /**
5
- * Code inlined from https://github.com/chalk/strip-ansi#readme
6
- * This file is MIT licensed.
7
- */
8
- const ansiRegex = () => {
9
- const pattern = [
10
- '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
11
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
12
- ].join('|');
13
- return new RegExp(pattern, 'g');
14
- };
15
- const stripAnsi = (str) => {
16
- if (typeof str !== 'string') {
17
- throw new TypeError(`Expected a \`string\`, got \`${typeof str}\``);
18
- }
19
- return str.replace(ansiRegex(), '');
20
- };
21
- exports.stripAnsi = stripAnsi;
@@ -1,37 +0,0 @@
1
- import webpack from 'webpack';
2
- export declare type HotMiddlewareMessage = {
3
- action: 'building';
4
- name?: string;
5
- } | {
6
- action: 'built' | 'sync';
7
- name: string;
8
- time: number | undefined;
9
- errors: unknown[];
10
- warnings: unknown[];
11
- hash: string | undefined;
12
- modules: {
13
- [key: string]: string;
14
- };
15
- };
16
- export declare const hotMiddlewareOptions: {
17
- path: string;
18
- timeout: number;
19
- overlay: boolean;
20
- reload: boolean;
21
- log: {
22
- (...data: any[]): void;
23
- (message?: any, ...optionalParams: any[]): void;
24
- };
25
- warn: boolean;
26
- name: string;
27
- autoConnect: boolean;
28
- overlayStyles: {};
29
- overlayWarnings: boolean;
30
- ansiColors: {};
31
- heartbeat: number;
32
- };
33
- export declare type HotMiddlewareOptions = typeof hotMiddlewareOptions;
34
- export declare type WebpackStats = ReturnType<webpack.Stats['toJson']>;
35
- export declare type ModuleMap = {
36
- [key: string]: string;
37
- };
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hotMiddlewareOptions = void 0;
4
- exports.hotMiddlewareOptions = {
5
- path: '/__webpack_hmr',
6
- timeout: 20 * 1000,
7
- overlay: true,
8
- reload: false,
9
- log: console.log.bind(console),
10
- warn: true,
11
- name: '',
12
- autoConnect: true,
13
- overlayStyles: {},
14
- overlayWarnings: false,
15
- ansiColors: {},
16
- heartbeat: 10 * 1000,
17
- };
@@ -1 +0,0 @@
1
- export declare const isPathInside: (thePath: string, potentialParent: string) => boolean;
@@ -1,27 +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.isPathInside = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const isPathInside = function (thePath, potentialParent) {
9
- // For inside-directory checking, we want to allow trailing slashes, so normalize.
10
- thePath = stripTrailingSep(thePath);
11
- potentialParent = stripTrailingSep(potentialParent);
12
- // Node treats only Windows as case-insensitive in its path module; we follow those conventions.
13
- if (process.platform === 'win32') {
14
- thePath = thePath.toLowerCase();
15
- potentialParent = potentialParent.toLowerCase();
16
- }
17
- return (thePath.lastIndexOf(potentialParent, 0) === 0 &&
18
- (thePath[potentialParent.length] === path_1.default.sep ||
19
- thePath[potentialParent.length] === undefined));
20
- };
21
- exports.isPathInside = isPathInside;
22
- function stripTrailingSep(thePath) {
23
- if (thePath[thePath.length - 1] === path_1.default.sep) {
24
- return thePath.slice(0, -1);
25
- }
26
- return thePath;
27
- }
package/dist/p-limit.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const pLimit: (concurrency: number) => <Arguments extends unknown[], ReturnType_1>(fn: (..._arguments: Arguments) => ReturnType_1 | PromiseLike<ReturnType_1>, ...args: Arguments) => Promise<ReturnType_1>;
package/dist/p-limit.js DELETED
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pLimit = void 0;
4
- const pLimit = (concurrency) => {
5
- const queue = [];
6
- let activeCount = 0;
7
- const next = () => {
8
- var _a;
9
- activeCount--;
10
- if (queue.length > 0) {
11
- (_a = queue.shift()) === null || _a === void 0 ? void 0 : _a();
12
- }
13
- };
14
- const run = async (fn, resolve, ...args) => {
15
- activeCount++;
16
- // eslint-disable-next-line require-await
17
- const result = (async () => fn(...args))();
18
- resolve(result);
19
- try {
20
- await result;
21
- }
22
- catch (_a) { }
23
- next();
24
- };
25
- const enqueue = (fn, resolve, ...args) => {
26
- queue.push(() => run(fn, resolve, ...args));
27
- (async () => {
28
- var _a;
29
- // This function needs to wait until the next microtask before comparing
30
- // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
31
- // when the run function is dequeued and called. The comparison in the if-statement
32
- // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
33
- await Promise.resolve();
34
- if (activeCount < concurrency && queue.length > 0) {
35
- (_a = queue.shift()) === null || _a === void 0 ? void 0 : _a();
36
- }
37
- })();
38
- };
39
- const generator = (fn, ...args) => new Promise((resolve) => {
40
- enqueue(fn, resolve, ...args);
41
- });
42
- Object.defineProperties(generator, {
43
- activeCount: {
44
- get: () => activeCount,
45
- },
46
- pendingCount: {
47
- get: () => queue.length,
48
- },
49
- clearQueue: {
50
- value: () => {
51
- queue.length = 0;
52
- },
53
- },
54
- });
55
- return generator;
56
- };
57
- exports.pLimit = pLimit;
@@ -1,5 +0,0 @@
1
- export declare type ProjectInfo = {
2
- videoFile: string | null;
3
- relativeVideoFile: string | null;
4
- };
5
- export declare const getProjectInfo: () => Promise<ProjectInfo>;
@@ -1,22 +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.getProjectInfo = void 0;
7
- const fs_1 = require("fs");
8
- const path_1 = __importDefault(require("path"));
9
- const getProjectInfo = () => {
10
- var _a;
11
- const pathsToLookFor = ['src/Video.tsx', 'src/Video.jsx'].map((p) => {
12
- return path_1.default.join(process.cwd(), p);
13
- });
14
- const videoFile = (_a = pathsToLookFor.find((p) => (0, fs_1.existsSync)(p))) !== null && _a !== void 0 ? _a : null;
15
- return Promise.resolve({
16
- videoFile,
17
- relativeVideoFile: videoFile
18
- ? path_1.default.relative(process.cwd(), videoFile)
19
- : null,
20
- });
21
- };
22
- exports.getProjectInfo = getProjectInfo;
package/dist/routes.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { IncomingMessage, ServerResponse } from 'http';
2
- export declare const handleRoutes: (hash: string, request: IncomingMessage, response: ServerResponse) => void | Promise<void>;
package/dist/routes.js DELETED
@@ -1,121 +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.handleRoutes = void 0;
7
- const fs_1 = require("fs");
8
- const path_1 = __importDefault(require("path"));
9
- const url_1 = require("url");
10
- const get_file_source_1 = require("./error-overlay/react-overlay/utils/get-file-source");
11
- const open_in_editor_1 = require("./error-overlay/react-overlay/utils/open-in-editor");
12
- const project_info_1 = require("./project-info");
13
- const serve_static_1 = require("./serve-static");
14
- const static_preview_1 = require("./static-preview");
15
- const update_available_1 = require("./update-available");
16
- const handleUpdate = async (_, response) => {
17
- const data = await (0, update_available_1.isUpdateAvailableWithTimeout)();
18
- response.setHeader('content-type', 'application/json');
19
- response.writeHead(200);
20
- response.end(JSON.stringify(data));
21
- };
22
- const editorGuess = (0, open_in_editor_1.guessEditor)();
23
- const handleFallback = async (hash, _, response) => {
24
- const edit = await editorGuess;
25
- const displayName = (0, open_in_editor_1.getDisplayNameForEditor)(edit[0]);
26
- response.setHeader('content-type', 'text/html');
27
- response.writeHead(200);
28
- response.end((0, static_preview_1.indexHtml)(hash, '/', displayName));
29
- };
30
- const handleProjectInfo = async (_, response) => {
31
- const data = await (0, project_info_1.getProjectInfo)();
32
- response.setHeader('content-type', 'application/json');
33
- response.writeHead(200);
34
- response.end(JSON.stringify(data));
35
- };
36
- const handleFileSource = async (search, _, response) => {
37
- if (!search.startsWith('?')) {
38
- throw new Error('query must start with ?');
39
- }
40
- const query = new url_1.URLSearchParams(search);
41
- const f = query.get('f');
42
- if (typeof f !== 'string') {
43
- throw new Error('must pass `f` parameter');
44
- }
45
- const data = await (0, get_file_source_1.getFileSource)(decodeURIComponent(f));
46
- response.writeHead(200);
47
- response.write(data);
48
- return response.end();
49
- };
50
- const handleOpenInEditor = async (req, res) => {
51
- try {
52
- const b = await new Promise((_resolve) => {
53
- let data = '';
54
- req.on('data', (chunk) => {
55
- data += chunk;
56
- });
57
- req.on('end', () => {
58
- _resolve(data.toString());
59
- });
60
- });
61
- const body = JSON.parse(b);
62
- if (!('stack' in body)) {
63
- throw new TypeError('Need to pass stack');
64
- }
65
- const stack = body.stack;
66
- const guess = await editorGuess;
67
- const didOpen = await (0, open_in_editor_1.launchEditor)({
68
- colNumber: stack.originalColumnNumber,
69
- editor: guess[0],
70
- fileName: path_1.default.resolve(process.cwd(), stack.originalFileName),
71
- lineNumber: stack.originalLineNumber,
72
- vsCodeNewWindow: false,
73
- });
74
- res.setHeader('content-type', 'application/json');
75
- res.writeHead(200);
76
- res.end(JSON.stringify({
77
- success: didOpen,
78
- }));
79
- }
80
- catch (err) {
81
- res.setHeader('content-type', 'application/json');
82
- res.writeHead(200);
83
- res.end(JSON.stringify({
84
- success: false,
85
- }));
86
- }
87
- };
88
- const handleFavicon = (_, response) => {
89
- const filePath = path_1.default.join(__dirname, '..', 'web', 'favicon.png');
90
- const stat = (0, fs_1.statSync)(filePath);
91
- response.writeHead(200, {
92
- 'Content-Type': 'image/png',
93
- 'Content-Length': stat.size,
94
- });
95
- const readStream = (0, fs_1.createReadStream)(filePath);
96
- readStream.pipe(response);
97
- };
98
- const handleRoutes = (hash, request, response) => {
99
- const url = new URL(request.url, 'http://localhost');
100
- if (url.pathname === '/api/update') {
101
- return handleUpdate(request, response);
102
- }
103
- if (url.pathname === '/api/project-info') {
104
- return handleProjectInfo(request, response);
105
- }
106
- if (url.pathname === '/api/file-source') {
107
- return handleFileSource(url.search, request, response);
108
- }
109
- if (url.pathname === '/api/open-in-editor') {
110
- return handleOpenInEditor(request, response);
111
- }
112
- if (url.pathname === '/remotion.png') {
113
- return handleFavicon(request, response);
114
- }
115
- if (url.pathname.startsWith(hash)) {
116
- const root = path_1.default.join(process.cwd(), 'public');
117
- return (0, serve_static_1.serveStatic)(root, hash, request, response);
118
- }
119
- return handleFallback(hash, request, response);
120
- };
121
- exports.handleRoutes = handleRoutes;
@@ -1,9 +0,0 @@
1
- /*!
2
- * serve-static
3
- * Copyright(c) 2010 Sencha Inc.
4
- * Copyright(c) 2011 TJ Holowaychuk
5
- * Copyright(c) 2014-2016 Douglas Christopher Wilson
6
- * MIT Licensed
7
- */
8
- import { IncomingMessage, ServerResponse } from 'http';
9
- export declare const serveStatic: (root: string, hash: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
@@ -1,81 +0,0 @@
1
- "use strict";
2
- /*!
3
- * serve-static
4
- * Copyright(c) 2010 Sencha Inc.
5
- * Copyright(c) 2011 TJ Holowaychuk
6
- * Copyright(c) 2014-2016 Douglas Christopher Wilson
7
- * MIT Licensed
8
- */
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.serveStatic = void 0;
14
- const fs_1 = require("fs");
15
- const mime_types_1 = __importDefault(require("mime-types"));
16
- const path_1 = require("path");
17
- const middleware_1 = require("./dev-middleware/middleware");
18
- const range_parser_1 = require("./dev-middleware/range-parser");
19
- const is_path_inside_1 = require("./is-path-inside");
20
- const serveStatic = async function (root, hash, req, res) {
21
- if (req.method !== 'GET' && req.method !== 'HEAD') {
22
- // method not allowed
23
- res.statusCode = 405;
24
- res.setHeader('Allow', 'GET, HEAD');
25
- res.setHeader('Content-Length', '0');
26
- res.end();
27
- return;
28
- }
29
- const path = (0, path_1.join)(root, new URL(req.url, 'http://localhost').pathname.replace(new RegExp(`^${hash}`), ''));
30
- if (!(0, is_path_inside_1.isPathInside)(path, root)) {
31
- res.writeHead(500);
32
- res.write('Not allowed to read');
33
- res.end();
34
- return;
35
- }
36
- const exists = (0, fs_1.existsSync)(path);
37
- if (!exists) {
38
- res.writeHead(404);
39
- res.write('Not found');
40
- res.end();
41
- return;
42
- }
43
- const lstat = await fs_1.promises.lstat(path);
44
- const isDirectory = lstat.isDirectory();
45
- if (isDirectory) {
46
- res.writeHead(500);
47
- res.write('Is a directory');
48
- res.end();
49
- return;
50
- }
51
- const hasRange = req.headers.range && lstat.size;
52
- if (!hasRange) {
53
- const readStream = (0, fs_1.createReadStream)(path);
54
- res.setHeader('content-type', mime_types_1.default.lookup(path) || 'application/octet-stream');
55
- res.setHeader('content-length', lstat.size);
56
- res.writeHead(200);
57
- readStream.pipe(res);
58
- return;
59
- }
60
- const range = (0, range_parser_1.parseRange)(lstat.size, req.headers.range);
61
- if (typeof range === 'object' && range.type === 'bytes') {
62
- const { start, end } = range[0];
63
- res.setHeader('content-type', mime_types_1.default.lookup(path) || 'application/octet-stream');
64
- res.setHeader('content-range', (0, middleware_1.getValueContentRangeHeader)('bytes', lstat.size, {
65
- end,
66
- start,
67
- }));
68
- res.setHeader('content-length', end - start + 1);
69
- res.writeHead(206);
70
- const readStream = (0, fs_1.createReadStream)(path, {
71
- start,
72
- end,
73
- });
74
- readStream.pipe(res);
75
- return;
76
- }
77
- res.statusCode = 416;
78
- res.setHeader('Content-Range', `bytes */${lstat.size}`);
79
- res.end();
80
- };
81
- exports.serveStatic = serveStatic;
@@ -1,8 +0,0 @@
1
- import { WebpackOverrideFn } from 'remotion';
2
- export declare const startServerPure: (entry: string, userDefinedComponent: string, options?: {
3
- webpackOverride?: WebpackOverrideFn;
4
- inputProps?: object;
5
- envVariables?: Record<string, string>;
6
- port: number | null;
7
- maxTimelineTracks?: number;
8
- }) => Promise<number>;
@@ -1,68 +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.startServerPure = void 0;
7
- const crypto_1 = __importDefault(require("crypto"));
8
- const fs_1 = __importDefault(require("fs"));
9
- const http_1 = __importDefault(require("http"));
10
- const os_1 = __importDefault(require("os"));
11
- const path_1 = __importDefault(require("path"));
12
- const remotion_1 = require("remotion");
13
- const webpack_1 = __importDefault(require("webpack"));
14
- const dev_middleware_1 = require("./dev-middleware");
15
- const get_port_1 = require("./get-port");
16
- const hot_middleware_1 = require("./hot-middleware");
17
- const routes_1 = require("./routes");
18
- const webpack_config_1 = require("./webpack-config");
19
- const startServerPure = async (entry, userDefinedComponent, options) => {
20
- var _a, _b, _c, _d, _e;
21
- const tmpDir = await fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'react-motion-graphics'));
22
- const config = (0, webpack_config_1.webpackConfig)({
23
- entry,
24
- userDefinedComponent,
25
- outDir: tmpDir,
26
- environment: 'development',
27
- webpackOverride: (_a = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _a !== void 0 ? _a : remotion_1.Internals.getWebpackOverrideFn(),
28
- inputProps: (_b = options === null || options === void 0 ? void 0 : options.inputProps) !== null && _b !== void 0 ? _b : {},
29
- envVariables: (_c = options === null || options === void 0 ? void 0 : options.envVariables) !== null && _c !== void 0 ? _c : {},
30
- maxTimelineTracks: (_d = options === null || options === void 0 ? void 0 : options.maxTimelineTracks) !== null && _d !== void 0 ? _d : 15,
31
- });
32
- const compiler = (0, webpack_1.default)(config);
33
- const hash = `/static-${crypto_1.default.randomBytes(6).toString('hex')}`;
34
- /**
35
- * TODO: Put static server
36
- */
37
- const wdmMiddleware = (0, dev_middleware_1.wdm)(compiler);
38
- const whm = (0, hot_middleware_1.webpackHotMiddleware)(compiler);
39
- const server = http_1.default.createServer((request, response) => {
40
- new Promise((resolve) => {
41
- wdmMiddleware(request, response, () => {
42
- resolve();
43
- });
44
- })
45
- .then(() => {
46
- return new Promise((resolve) => {
47
- whm(request, response, () => {
48
- resolve();
49
- });
50
- });
51
- })
52
- .then(() => {
53
- (0, routes_1.handleRoutes)(hash, request, response);
54
- })
55
- .catch((err) => {
56
- response.setHeader('content-type', 'application/json');
57
- response.writeHead(500);
58
- response.end(JSON.stringify({
59
- err: err.message,
60
- }));
61
- });
62
- });
63
- const desiredPort = (_e = options === null || options === void 0 ? void 0 : options.port) !== null && _e !== void 0 ? _e : undefined;
64
- const port = await (0, get_port_1.getDesiredPort)(desiredPort, 3000, 3100);
65
- server.listen(port);
66
- return port;
67
- };
68
- exports.startServerPure = startServerPure;
@@ -1,8 +0,0 @@
1
- import { WebpackOverrideFn } from 'remotion';
2
- export declare const startServer: (entry: string, userDefinedComponent: string, options?: {
3
- webpackOverride?: WebpackOverrideFn;
4
- inputProps?: object;
5
- envVariables?: Record<string, string>;
6
- port: number | null;
7
- maxTimelineTracks?: number;
8
- }) => Promise<number>;