@remotion/renderer 4.0.4 → 4.0.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.
- package/dist/assets/download-and-map-assets-to-file.d.ts +2 -4
- package/dist/assets/download-and-map-assets-to-file.js +14 -10
- package/dist/assets/download-map.d.ts +4 -0
- package/dist/assets/download-map.js +3 -0
- package/dist/audio-codec.d.ts +1 -1
- package/dist/browser/Browser.d.ts +3 -3
- package/dist/browser/Browser.js +1 -1
- package/dist/browser/BrowserPage.d.ts +4 -4
- package/dist/browser/BrowserPage.js +26 -8
- package/dist/browser/Target.d.ts +1 -1
- package/dist/browser/create-browser-fetcher.js +19 -24
- package/dist/client.d.ts +4 -9
- package/dist/compositor/compositor.d.ts +1 -1
- package/dist/compositor/compositor.js +1 -1
- package/dist/compositor/payloads.d.ts +10 -0
- package/dist/get-browser-instance.js +2 -2
- package/dist/get-bundle-url-from-serve-url.d.ts +2 -0
- package/dist/get-bundle-url-from-serve-url.js +30 -0
- package/dist/get-compositions.d.ts +1 -1
- package/dist/get-compositions.js +1 -1
- package/dist/get-local-browser-executable.js +15 -0
- package/dist/get-video-metadata.d.ts +2 -0
- package/dist/get-video-metadata.js +14 -0
- package/dist/index.d.ts +9 -8
- package/dist/index.js +3 -1
- package/dist/logger.d.ts +1 -0
- package/dist/logger.js +10 -0
- package/dist/offthread-video-server.d.ts +0 -1
- package/dist/offthread-video-server.js +2 -4
- package/dist/prepare-server.d.ts +2 -4
- package/dist/prepare-server.js +9 -10
- package/dist/prespawn-ffmpeg.d.ts +1 -1
- package/dist/render-frames.d.ts +1 -1
- package/dist/render-frames.js +5 -3
- package/dist/render-media.d.ts +1 -1
- package/dist/render-media.js +2 -2
- package/dist/render-still.d.ts +1 -1
- package/dist/render-still.js +2 -2
- package/dist/select-composition.d.ts +2 -2
- package/dist/serve-handler/index.js +1 -1
- package/dist/serve-static.d.ts +0 -2
- package/dist/serve-static.js +2 -2
- package/dist/set-props-and-env.js +1 -1
- package/dist/stitch-frames-to-video.d.ts +1 -1
- package/dist/symbolicate-stacktrace.d.ts +3 -2
- package/dist/symbolicate-stacktrace.js +14 -7
- package/package.json +10 -10
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { TAsset } from 'remotion';
|
|
2
|
-
import { OffthreadVideoServerEmitter } from '../offthread-video-server';
|
|
3
2
|
import type { DownloadMap } from './download-map';
|
|
4
3
|
export type RenderMediaOnDownload = (src: string) => ((progress: {
|
|
5
4
|
percent: number | null;
|
|
6
5
|
downloaded: number;
|
|
7
6
|
totalSize: number | null;
|
|
8
7
|
}) => void) | undefined | void;
|
|
9
|
-
export declare const downloadAsset: ({ src, downloadMap,
|
|
8
|
+
export declare const downloadAsset: ({ src, downloadMap, }: {
|
|
10
9
|
src: string;
|
|
11
|
-
emitter: OffthreadVideoServerEmitter;
|
|
12
10
|
downloadMap: DownloadMap;
|
|
13
11
|
}) => Promise<string>;
|
|
14
12
|
export declare const markAllAssetsAsDownloaded: (downloadMap: DownloadMap) => void;
|
|
@@ -23,4 +21,4 @@ export declare const downloadAndMapAssetsToFileUrl: ({ asset, onDownload, downlo
|
|
|
23
21
|
onDownload: RenderMediaOnDownload | null;
|
|
24
22
|
downloadMap: DownloadMap;
|
|
25
23
|
}) => Promise<TAsset>;
|
|
26
|
-
export declare const attachDownloadListenerToEmitter: (
|
|
24
|
+
export declare const attachDownloadListenerToEmitter: (downloadMap: DownloadMap, onDownload: RenderMediaOnDownload | null) => () => void;
|
|
@@ -33,7 +33,6 @@ const remotion_1 = require("remotion");
|
|
|
33
33
|
const compress_assets_1 = require("../compress-assets");
|
|
34
34
|
const ensure_output_directory_1 = require("../ensure-output-directory");
|
|
35
35
|
const mime_types_1 = require("../mime-types");
|
|
36
|
-
const offthread_video_server_1 = require("../offthread-video-server");
|
|
37
36
|
const download_file_1 = require("./download-file");
|
|
38
37
|
const sanitize_filepath_1 = require("./sanitize-filepath");
|
|
39
38
|
const waitForAssetToBeDownloaded = ({ src, downloadDir, downloadMap, }) => {
|
|
@@ -116,7 +115,7 @@ function validateBufferEncoding(potentialEncoding, dataUrl) {
|
|
|
116
115
|
throw new TypeError(errMessage);
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
const downloadAsset = async ({ src, downloadMap,
|
|
118
|
+
const downloadAsset = async ({ src, downloadMap, }) => {
|
|
120
119
|
var _a, _b, _c;
|
|
121
120
|
if ((0, compress_assets_1.isAssetCompressed)(src)) {
|
|
122
121
|
return src;
|
|
@@ -146,7 +145,7 @@ const downloadAsset = async ({ src, downloadMap, emitter, }) => {
|
|
|
146
145
|
if (process.env.NODE_ENV === 'test') {
|
|
147
146
|
console.log('Actually downloading asset', src);
|
|
148
147
|
}
|
|
149
|
-
emitter.dispatchDownload(src);
|
|
148
|
+
downloadMap.emitter.dispatchDownload(src);
|
|
150
149
|
if (src.startsWith('data:')) {
|
|
151
150
|
const [assetDetails, assetData] = src.substring('data:'.length).split(',');
|
|
152
151
|
if (!assetDetails.includes(';')) {
|
|
@@ -176,7 +175,7 @@ const downloadAsset = async ({ src, downloadMap, emitter, }) => {
|
|
|
176
175
|
const { to } = await (0, download_file_1.downloadFile)({
|
|
177
176
|
url: src,
|
|
178
177
|
onProgress: (progress) => {
|
|
179
|
-
emitter.dispatchDownloadProgress(src, progress.percent, progress.downloaded, progress.totalSize);
|
|
178
|
+
downloadMap.emitter.dispatchDownloadProgress(src, progress.percent, progress.downloaded, progress.totalSize);
|
|
180
179
|
},
|
|
181
180
|
to: (contentDisposition, contentType) => (0, exports.getSanitizedFilenameForAssetUrl)({
|
|
182
181
|
contentDisposition,
|
|
@@ -243,11 +242,9 @@ const getSanitizedFilenameForAssetUrl = ({ src, downloadDir, contentDisposition,
|
|
|
243
242
|
};
|
|
244
243
|
exports.getSanitizedFilenameForAssetUrl = getSanitizedFilenameForAssetUrl;
|
|
245
244
|
const downloadAndMapAssetsToFileUrl = async ({ asset, onDownload, downloadMap, }) => {
|
|
246
|
-
const
|
|
247
|
-
const cleanup = (0, exports.attachDownloadListenerToEmitter)(emitter, onDownload);
|
|
245
|
+
const cleanup = (0, exports.attachDownloadListenerToEmitter)(downloadMap, onDownload);
|
|
248
246
|
const newSrc = await (0, exports.downloadAsset)({
|
|
249
247
|
src: asset.src,
|
|
250
|
-
emitter,
|
|
251
248
|
downloadMap,
|
|
252
249
|
});
|
|
253
250
|
cleanup();
|
|
@@ -257,14 +254,21 @@ const downloadAndMapAssetsToFileUrl = async ({ asset, onDownload, downloadMap, }
|
|
|
257
254
|
};
|
|
258
255
|
};
|
|
259
256
|
exports.downloadAndMapAssetsToFileUrl = downloadAndMapAssetsToFileUrl;
|
|
260
|
-
const attachDownloadListenerToEmitter = (
|
|
257
|
+
const attachDownloadListenerToEmitter = (downloadMap, onDownload) => {
|
|
261
258
|
const cleanup = [];
|
|
262
259
|
if (!onDownload) {
|
|
263
260
|
return () => undefined;
|
|
264
261
|
}
|
|
265
|
-
|
|
262
|
+
if (downloadMap.downloadListeners.includes(onDownload)) {
|
|
263
|
+
return () => undefined;
|
|
264
|
+
}
|
|
265
|
+
downloadMap.downloadListeners.push(onDownload);
|
|
266
|
+
cleanup.push(() => {
|
|
267
|
+
downloadMap.downloadListeners = downloadMap.downloadListeners.filter((l) => l !== onDownload);
|
|
268
|
+
});
|
|
269
|
+
const a = downloadMap.emitter.addEventListener('download', ({ detail: { src: initialSrc } }) => {
|
|
266
270
|
const progress = onDownload(initialSrc);
|
|
267
|
-
const b = emitter.addEventListener('progress', ({ detail: { downloaded, percent, src: progressSrc, totalSize } }) => {
|
|
271
|
+
const b = downloadMap.emitter.addEventListener('progress', ({ detail: { downloaded, percent, src: progressSrc, totalSize } }) => {
|
|
268
272
|
if (initialSrc === progressSrc) {
|
|
269
273
|
progress === null || progress === void 0 ? void 0 : progress({ downloaded, percent, totalSize });
|
|
270
274
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { TAsset } from 'remotion';
|
|
2
|
+
import { OffthreadVideoServerEmitter } from '../offthread-video-server';
|
|
3
|
+
import type { RenderMediaOnDownload } from './download-and-map-assets-to-file';
|
|
2
4
|
export type AudioChannelsAndDurationResultCache = {
|
|
3
5
|
channels: number;
|
|
4
6
|
duration: number | null;
|
|
5
7
|
};
|
|
6
8
|
export type DownloadMap = {
|
|
7
9
|
id: string;
|
|
10
|
+
emitter: OffthreadVideoServerEmitter;
|
|
11
|
+
downloadListeners: RenderMediaOnDownload[];
|
|
8
12
|
isDownloadingMap: {
|
|
9
13
|
[src: string]: {
|
|
10
14
|
[downloadDir: string]: boolean;
|
|
@@ -30,6 +30,7 @@ exports.cleanDownloadMap = exports.makeDownloadMap = void 0;
|
|
|
30
30
|
const node_fs_1 = __importStar(require("node:fs"));
|
|
31
31
|
const node_path_1 = __importDefault(require("node:path"));
|
|
32
32
|
const delete_directory_1 = require("../delete-directory");
|
|
33
|
+
const offthread_video_server_1 = require("../offthread-video-server");
|
|
33
34
|
const tmp_dir_1 = require("../tmp-dir");
|
|
34
35
|
const makeAndReturn = (dir, name) => {
|
|
35
36
|
const p = node_path_1.default.join(dir, name);
|
|
@@ -51,6 +52,7 @@ const makeDownloadMap = () => {
|
|
|
51
52
|
durationOfAssetCache: {},
|
|
52
53
|
id: String(Math.random()),
|
|
53
54
|
assetDir: dir,
|
|
55
|
+
downloadListeners: [],
|
|
54
56
|
downloadDir: makeAndReturn(dir, 'remotion-assets-dir'),
|
|
55
57
|
complexFilter: makeAndReturn(dir, 'remotion-complex-filter'),
|
|
56
58
|
preEncode: makeAndReturn(dir, 'pre-encode'),
|
|
@@ -59,6 +61,7 @@ const makeDownloadMap = () => {
|
|
|
59
61
|
stitchFrames: makeAndReturn(dir, 'remotion-stitch-temp-dir'),
|
|
60
62
|
compositingDir: makeAndReturn(dir, 'remotion-compositing-temp-dir'),
|
|
61
63
|
compositorCache: {},
|
|
64
|
+
emitter: new offthread_video_server_1.OffthreadVideoServerEmitter(),
|
|
62
65
|
};
|
|
63
66
|
};
|
|
64
67
|
exports.makeDownloadMap = makeDownloadMap;
|
package/dist/audio-codec.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const supportedAudioCodecs: {
|
|
|
5
5
|
readonly h264: readonly ["aac", "pcm-16"];
|
|
6
6
|
readonly 'h264-mkv': readonly ["pcm-16"];
|
|
7
7
|
readonly aac: readonly ["aac", "pcm-16"];
|
|
8
|
-
readonly gif:
|
|
8
|
+
readonly gif: readonly [];
|
|
9
9
|
readonly h265: readonly ["aac", "pcm-16"];
|
|
10
10
|
readonly mp3: readonly ["mp3", "pcm-16"];
|
|
11
11
|
readonly prores: readonly ["aac", "pcm-16"];
|
|
@@ -41,8 +41,8 @@ export declare class HeadlessBrowser extends EventEmitter {
|
|
|
41
41
|
get _targets(): Map<string, Target>;
|
|
42
42
|
constructor(connection: Connection, defaultViewport: Viewport, closeCallback?: BrowserCloseCallback);
|
|
43
43
|
browserContexts(): BrowserContext[];
|
|
44
|
-
newPage(context: AnySourceMapConsumer | null
|
|
45
|
-
_createPageInContext(context: AnySourceMapConsumer | null
|
|
44
|
+
newPage(context: Promise<AnySourceMapConsumer | null>, logLevel: LogLevel, indent: boolean): Promise<Page>;
|
|
45
|
+
_createPageInContext(context: Promise<AnySourceMapConsumer | null>, logLevel: LogLevel, indent: boolean): Promise<Page>;
|
|
46
46
|
targets(): Target[];
|
|
47
47
|
waitForTarget(predicate: (x: Target) => boolean | Promise<boolean>, options?: WaitForTargetOptions): Promise<Target>;
|
|
48
48
|
pages(logLevel: LogLevel, indent: boolean): Promise<Page[]>;
|
|
@@ -57,7 +57,7 @@ export declare class BrowserContext extends EventEmitter {
|
|
|
57
57
|
timeout?: number;
|
|
58
58
|
}): Promise<Target>;
|
|
59
59
|
pages(logLevel: LogLevel, indent: boolean): Promise<Page[]>;
|
|
60
|
-
newPage(context: AnySourceMapConsumer | null
|
|
60
|
+
newPage(context: Promise<AnySourceMapConsumer | null>, logLevel: LogLevel, indent: boolean): Promise<Page>;
|
|
61
61
|
browser(): HeadlessBrowser;
|
|
62
62
|
}
|
|
63
63
|
export {};
|
package/dist/browser/Browser.js
CHANGED
|
@@ -199,7 +199,7 @@ class BrowserContext extends EventEmitter_1.EventEmitter {
|
|
|
199
199
|
async pages(logLevel, indent) {
|
|
200
200
|
const pages = await Promise.all(this.targets()
|
|
201
201
|
.filter((target) => target.type() === 'page')
|
|
202
|
-
.map((target) => target.page(null, logLevel, indent)));
|
|
202
|
+
.map((target) => target.page(Promise.resolve(null), logLevel, indent)));
|
|
203
203
|
return pages.filter((page) => {
|
|
204
204
|
return Boolean(page);
|
|
205
205
|
});
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import type { LogLevel } from '../log-level';
|
|
16
17
|
import type { AnySourceMapConsumer } from '../symbolicate-stacktrace';
|
|
17
18
|
import type { HeadlessBrowser } from './Browser';
|
|
18
19
|
import type { CDPSession } from './Connection';
|
|
@@ -25,7 +26,6 @@ import type { JSHandle } from './JSHandle';
|
|
|
25
26
|
import type { Viewport } from './PuppeteerViewport';
|
|
26
27
|
import type { Target } from './Target';
|
|
27
28
|
import { TaskQueue } from './TaskQueue';
|
|
28
|
-
import type { LogLevel } from '../log-level';
|
|
29
29
|
interface WaitForOptions {
|
|
30
30
|
timeout?: number;
|
|
31
31
|
}
|
|
@@ -47,7 +47,7 @@ export declare class Page extends EventEmitter {
|
|
|
47
47
|
target: Target;
|
|
48
48
|
defaultViewport: Viewport;
|
|
49
49
|
browser: HeadlessBrowser;
|
|
50
|
-
sourcemapContext: AnySourceMapConsumer | null
|
|
50
|
+
sourcemapContext: Promise<AnySourceMapConsumer | null>;
|
|
51
51
|
logLevel: LogLevel;
|
|
52
52
|
indent: boolean;
|
|
53
53
|
}): Promise<Page>;
|
|
@@ -60,7 +60,7 @@ export declare class Page extends EventEmitter {
|
|
|
60
60
|
client: CDPSession;
|
|
61
61
|
target: Target;
|
|
62
62
|
browser: HeadlessBrowser;
|
|
63
|
-
sourcemapContext: AnySourceMapConsumer | null
|
|
63
|
+
sourcemapContext: Promise<AnySourceMapConsumer | null>;
|
|
64
64
|
logLevel: LogLevel;
|
|
65
65
|
indent: boolean;
|
|
66
66
|
});
|
|
@@ -95,6 +95,6 @@ export declare class Page extends EventEmitter {
|
|
|
95
95
|
close(options?: {
|
|
96
96
|
runBeforeUnload?: boolean;
|
|
97
97
|
}): Promise<void>;
|
|
98
|
-
setBrowserSourceMapContext(context: AnySourceMapConsumer | null): void;
|
|
98
|
+
setBrowserSourceMapContext(context: Promise<AnySourceMapConsumer | null>): void;
|
|
99
99
|
}
|
|
100
100
|
export {};
|
|
@@ -29,6 +29,7 @@ var _Page_instances, _Page_client, _Page_target, _Page_timeoutSettings, _Page_fr
|
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.Page = void 0;
|
|
31
31
|
const remotion_1 = require("remotion");
|
|
32
|
+
const format_logs_1 = require("../format-logs");
|
|
32
33
|
const logger_1 = require("../logger");
|
|
33
34
|
const truthy_1 = require("../truthy");
|
|
34
35
|
const assert_1 = require("./assert");
|
|
@@ -39,7 +40,6 @@ const JSHandle_1 = require("./JSHandle");
|
|
|
39
40
|
const TaskQueue_1 = require("./TaskQueue");
|
|
40
41
|
const TimeoutSettings_1 = require("./TimeoutSettings");
|
|
41
42
|
const util_1 = require("./util");
|
|
42
|
-
const format_logs_1 = require("../format-logs");
|
|
43
43
|
const shouldHideWarning = (log) => {
|
|
44
44
|
// Mixed Content warnings caused by localhost should not be displayed
|
|
45
45
|
if (log.text.includes('Mixed Content:') &&
|
|
@@ -71,13 +71,16 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
71
71
|
_Page_timeoutSettings.set(this, new TimeoutSettings_1.TimeoutSettings());
|
|
72
72
|
_Page_frameManager.set(this, void 0);
|
|
73
73
|
_Page_pageBindings.set(this, new Map());
|
|
74
|
+
this.sourcemapContext = null;
|
|
74
75
|
__classPrivateFieldSet(this, _Page_client, client, "f");
|
|
75
76
|
__classPrivateFieldSet(this, _Page_target, target, "f");
|
|
76
77
|
__classPrivateFieldSet(this, _Page_frameManager, new FrameManager_1.FrameManager(client, this, __classPrivateFieldGet(this, _Page_timeoutSettings, "f")), "f");
|
|
77
78
|
this.screenshotTaskQueue = new TaskQueue_1.TaskQueue();
|
|
78
79
|
this.browser = browser;
|
|
79
80
|
this.id = String(Math.random());
|
|
80
|
-
|
|
81
|
+
sourcemapContext.then((context) => {
|
|
82
|
+
this.sourcemapContext = context;
|
|
83
|
+
});
|
|
81
84
|
this.logLevel = logLevel;
|
|
82
85
|
client.on('Target.attachedToTarget', (event) => {
|
|
83
86
|
switch (event.targetInfo.type) {
|
|
@@ -131,11 +134,24 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
131
134
|
]
|
|
132
135
|
.filter(truthy_1.truthy)
|
|
133
136
|
.join(':');
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
const tag = [origPosition === null || origPosition === void 0 ? void 0 : origPosition.name, file].filter(truthy_1.truthy).join('@');
|
|
138
|
+
if (log.type === 'error') {
|
|
139
|
+
logger_1.Log.errorAdvanced({
|
|
140
|
+
logLevel,
|
|
141
|
+
tag,
|
|
142
|
+
indent,
|
|
143
|
+
}, log.previewString);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
logger_1.Log.verboseAdvanced({
|
|
147
|
+
logLevel,
|
|
148
|
+
tag,
|
|
149
|
+
indent,
|
|
150
|
+
}, log.previewString);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else if (log.type === 'error') {
|
|
154
|
+
logger_1.Log.errorAdvanced({ logLevel, tag: `console.${log.type}`, indent }, log.text);
|
|
139
155
|
}
|
|
140
156
|
else {
|
|
141
157
|
logger_1.Log.verboseAdvanced({ logLevel, tag: `console.${log.type}`, indent }, log.text);
|
|
@@ -234,7 +250,9 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
234
250
|
}
|
|
235
251
|
}
|
|
236
252
|
setBrowserSourceMapContext(context) {
|
|
237
|
-
|
|
253
|
+
context.then((ctx) => {
|
|
254
|
+
this.sourcemapContext = ctx;
|
|
255
|
+
});
|
|
238
256
|
}
|
|
239
257
|
}
|
|
240
258
|
exports.Page = Page;
|
package/dist/browser/Target.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare class Target {
|
|
|
37
37
|
/**
|
|
38
38
|
* If the target is not of type `"page"` or `"background_page"`, returns `null`.
|
|
39
39
|
*/
|
|
40
|
-
page(sourcemapContext: AnySourceMapConsumer | null
|
|
40
|
+
page(sourcemapContext: Promise<AnySourceMapConsumer | null>, logLevel: LogLevel, indent: boolean): Promise<Page | null>;
|
|
41
41
|
url(): string;
|
|
42
42
|
/**
|
|
43
43
|
* Identifies what kind of target this is.
|
|
@@ -31,30 +31,25 @@ function getRevision(product) {
|
|
|
31
31
|
async function downloadBrowser(product) {
|
|
32
32
|
const revision = getRevision(product);
|
|
33
33
|
const revisionInfo = (0, BrowserFetcher_1.getRevisionInfo)(revision, product);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
throw new Error(`Failed to set up ${supportedProducts[product]} r${revision}! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.`);
|
|
57
|
-
}
|
|
34
|
+
await (0, BrowserFetcher_1.download)({
|
|
35
|
+
revision: revisionInfo.revision,
|
|
36
|
+
progressCallback: (downloadedBytes, totalBytes) => {
|
|
37
|
+
console.log('Downloading', supportedProducts[product], toMegabytes(downloadedBytes) + '/' + toMegabytes(totalBytes));
|
|
38
|
+
},
|
|
39
|
+
product,
|
|
40
|
+
platform: (0, BrowserFetcher_1.getPlatform)(product),
|
|
41
|
+
downloadHost: (0, BrowserFetcher_1.getDownloadHost)(product),
|
|
42
|
+
downloadsFolder: (0, BrowserFetcher_1.getDownloadsFolder)(product),
|
|
43
|
+
});
|
|
44
|
+
const _localRevisions = await (0, BrowserFetcher_1.localRevisions)((0, BrowserFetcher_1.getDownloadsFolder)(product), product, (0, BrowserFetcher_1.getPlatform)(product));
|
|
45
|
+
console.log(`${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}`);
|
|
46
|
+
await Promise.all(_localRevisions
|
|
47
|
+
.filter((__revision) => {
|
|
48
|
+
return __revision !== revisionInfo.revision;
|
|
49
|
+
})
|
|
50
|
+
.map((__revision) => {
|
|
51
|
+
return (0, BrowserFetcher_1.removeBrowser)(__revision, (0, BrowserFetcher_1.getFolderPath)(revision, (0, BrowserFetcher_1.getDownloadsFolder)(product), (0, BrowserFetcher_1.getPlatform)(product)));
|
|
52
|
+
}));
|
|
58
53
|
}
|
|
59
54
|
exports.downloadBrowser = downloadBrowser;
|
|
60
55
|
function toMegabytes(bytes) {
|
package/dist/client.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const BrowserSafeApis: {
|
|
|
12
12
|
readonly h264: readonly ["aac", "pcm-16"];
|
|
13
13
|
readonly 'h264-mkv': readonly ["pcm-16"];
|
|
14
14
|
readonly aac: readonly ["aac", "pcm-16"];
|
|
15
|
-
readonly gif:
|
|
15
|
+
readonly gif: readonly [];
|
|
16
16
|
readonly h265: readonly ["aac", "pcm-16"];
|
|
17
17
|
readonly mp3: readonly ["mp3", "pcm-16"];
|
|
18
18
|
readonly prores: readonly ["aac", "pcm-16"];
|
|
@@ -132,12 +132,7 @@ export declare const BrowserSafeApis: {
|
|
|
132
132
|
};
|
|
133
133
|
gif: {
|
|
134
134
|
default: import("./file-extensions").FileExtension;
|
|
135
|
-
forAudioCodec: {
|
|
136
|
-
[x: string]: {
|
|
137
|
-
possible: import("./file-extensions").FileExtension[];
|
|
138
|
-
default: import("./file-extensions").FileExtension;
|
|
139
|
-
};
|
|
140
|
-
};
|
|
135
|
+
forAudioCodec: {};
|
|
141
136
|
};
|
|
142
137
|
};
|
|
143
138
|
defaultAudioCodecs: {
|
|
@@ -178,8 +173,8 @@ export declare const BrowserSafeApis: {
|
|
|
178
173
|
lossless: "pcm-16" | null;
|
|
179
174
|
};
|
|
180
175
|
gif: {
|
|
181
|
-
compressed:
|
|
182
|
-
lossless:
|
|
176
|
+
compressed: null;
|
|
177
|
+
lossless: null;
|
|
183
178
|
};
|
|
184
179
|
};
|
|
185
180
|
defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { CompositorCommand } from './payloads';
|
|
3
2
|
import type { LogLevel } from '../log-level';
|
|
3
|
+
import type { CompositorCommand } from './payloads';
|
|
4
4
|
export type Compositor = {
|
|
5
5
|
finishCommands: () => void;
|
|
6
6
|
executeCommand: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T]) => Promise<Buffer>;
|
|
@@ -9,11 +9,11 @@ const node_fs_1 = require("node:fs");
|
|
|
9
9
|
const node_os_1 = __importDefault(require("node:os"));
|
|
10
10
|
const call_ffmpeg_1 = require("../call-ffmpeg");
|
|
11
11
|
const get_concurrency_1 = require("../get-concurrency");
|
|
12
|
+
const log_level_1 = require("../log-level");
|
|
12
13
|
const logger_1 = require("../logger");
|
|
13
14
|
const compose_1 = require("./compose");
|
|
14
15
|
const get_executable_path_1 = require("./get-executable-path");
|
|
15
16
|
const make_nonce_1 = require("./make-nonce");
|
|
16
|
-
const log_level_1 = require("../log-level");
|
|
17
17
|
const getIdealMaximumFrameCacheItems = () => {
|
|
18
18
|
const freeMemory = node_os_1.default.freemem();
|
|
19
19
|
// Assuming 1 frame is approximately 6MB
|
|
@@ -27,6 +27,12 @@ export type Layer = {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
export type CompositorImageFormat = 'Png' | 'Jpeg';
|
|
30
|
+
export type VideoMetadata = {
|
|
31
|
+
fps: number;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
durationInSeconds: number;
|
|
35
|
+
};
|
|
30
36
|
export type CompositorCommand = {
|
|
31
37
|
Compose: {
|
|
32
38
|
output: string;
|
|
@@ -54,6 +60,10 @@ export type CompositorCommand = {
|
|
|
54
60
|
FreeUpMemory: {
|
|
55
61
|
percent_of_memory: number;
|
|
56
62
|
};
|
|
63
|
+
GetVideoMetadata: {
|
|
64
|
+
src: string;
|
|
65
|
+
};
|
|
66
|
+
VideoMetadata: VideoMetadata;
|
|
57
67
|
};
|
|
58
68
|
export type CompositorCommandSerialized<T extends keyof CompositorCommand> = {
|
|
59
69
|
nonce: string;
|
|
@@ -5,7 +5,7 @@ const browser_1 = require("./browser");
|
|
|
5
5
|
const open_browser_1 = require("./open-browser");
|
|
6
6
|
const getPageAndCleanupFn = async ({ passedInInstance, browserExecutable, chromiumOptions, context, forceDeviceScaleFactor, indent, logLevel, }) => {
|
|
7
7
|
if (passedInInstance) {
|
|
8
|
-
const page = await passedInInstance.newPage(context, logLevel, indent);
|
|
8
|
+
const page = await passedInInstance.newPage(Promise.resolve(context), logLevel, indent);
|
|
9
9
|
return {
|
|
10
10
|
page,
|
|
11
11
|
cleanup: () => {
|
|
@@ -26,7 +26,7 @@ const getPageAndCleanupFn = async ({ passedInInstance, browserExecutable, chromi
|
|
|
26
26
|
viewport: null,
|
|
27
27
|
logLevel,
|
|
28
28
|
});
|
|
29
|
-
const browserPage = await browserInstance.newPage(context, logLevel, indent);
|
|
29
|
+
const browserPage = await browserInstance.newPage(Promise.resolve(context), logLevel, indent);
|
|
30
30
|
return {
|
|
31
31
|
page: browserPage,
|
|
32
32
|
cleanup: () => {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getBundleMapUrlFromServeUrl = exports.getBundleUrlFromServeUrl = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const remotion_1 = require("remotion");
|
|
9
|
+
const is_serve_url_1 = require("./is-serve-url");
|
|
10
|
+
const map = (webpackBundleOrServeUrl, suffix) => {
|
|
11
|
+
if ((0, is_serve_url_1.isServeUrl)(webpackBundleOrServeUrl)) {
|
|
12
|
+
const parsed = new URL(webpackBundleOrServeUrl);
|
|
13
|
+
const idx = parsed.pathname.lastIndexOf('/');
|
|
14
|
+
if (idx === -1) {
|
|
15
|
+
return parsed.origin + '/' + suffix;
|
|
16
|
+
}
|
|
17
|
+
return parsed.origin + parsed.pathname.substring(0, idx + 1) + suffix;
|
|
18
|
+
}
|
|
19
|
+
const index = webpackBundleOrServeUrl.lastIndexOf(path_1.default.sep);
|
|
20
|
+
const url = webpackBundleOrServeUrl.substring(0, index + 1) + suffix;
|
|
21
|
+
return url;
|
|
22
|
+
};
|
|
23
|
+
const getBundleUrlFromServeUrl = (serveUrl) => {
|
|
24
|
+
return map(serveUrl, remotion_1.Internals.bundleName);
|
|
25
|
+
};
|
|
26
|
+
exports.getBundleUrlFromServeUrl = getBundleUrlFromServeUrl;
|
|
27
|
+
const getBundleMapUrlFromServeUrl = (serveUrl) => {
|
|
28
|
+
return map(serveUrl, remotion_1.Internals.bundleMapName);
|
|
29
|
+
};
|
|
30
|
+
exports.getBundleMapUrlFromServeUrl = getBundleMapUrlFromServeUrl;
|
|
@@ -2,9 +2,9 @@ import { type VideoConfig } from 'remotion';
|
|
|
2
2
|
import type { BrowserExecutable } from './browser-executable';
|
|
3
3
|
import type { BrowserLog } from './browser-log';
|
|
4
4
|
import type { HeadlessBrowser } from './browser/Browser';
|
|
5
|
+
import { type LogLevel } from './log-level';
|
|
5
6
|
import type { ChromiumOptions } from './open-browser';
|
|
6
7
|
import type { RemotionServer } from './prepare-server';
|
|
7
|
-
import { type LogLevel } from './log-level';
|
|
8
8
|
type InternalGetCompositionsOptions = {
|
|
9
9
|
serializedInputPropsWithCustomSchema: string;
|
|
10
10
|
envVariables: Record<string, string>;
|
package/dist/get-compositions.js
CHANGED
|
@@ -6,12 +6,12 @@ const TimeoutSettings_1 = require("./browser/TimeoutSettings");
|
|
|
6
6
|
const handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
|
|
7
7
|
const find_closest_package_json_1 = require("./find-closest-package-json");
|
|
8
8
|
const get_browser_instance_1 = require("./get-browser-instance");
|
|
9
|
+
const logger_1 = require("./logger");
|
|
9
10
|
const prepare_server_1 = require("./prepare-server");
|
|
10
11
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
11
12
|
const seek_to_frame_1 = require("./seek-to-frame");
|
|
12
13
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
13
14
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
14
|
-
const logger_1 = require("./logger");
|
|
15
15
|
const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCustomSchema, onBrowserLog, page, proxyPort, serveUrl, timeoutInMilliseconds, indent, logLevel, }) => {
|
|
16
16
|
if (onBrowserLog) {
|
|
17
17
|
page.on('console', (log) => {
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getLocalBrowserExecutable = exports.ensureLocalBrowser = void 0;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
8
9
|
const BrowserFetcher_1 = require("./browser/BrowserFetcher");
|
|
9
10
|
const create_browser_fetcher_1 = require("./browser/create-browser-fetcher");
|
|
10
11
|
const revisions_1 = require("./browser/revisions");
|
|
@@ -28,6 +29,20 @@ const getSearchPathsForProduct = (product) => {
|
|
|
28
29
|
process.platform === 'win32'
|
|
29
30
|
? 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'
|
|
30
31
|
: null,
|
|
32
|
+
process.platform === 'win32'
|
|
33
|
+
? node_os_1.default.homedir() +
|
|
34
|
+
'\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe'
|
|
35
|
+
: null,
|
|
36
|
+
process.platform === 'win32'
|
|
37
|
+
? 'C:\\Program Files\\Google\\Chrome SxS\\Application\\chrome.exe'
|
|
38
|
+
: null,
|
|
39
|
+
process.platform === 'win32'
|
|
40
|
+
? 'C:\\Program Files (x86)\\Google\\Chrome SxS\\Application\\chrome.exe'
|
|
41
|
+
: null,
|
|
42
|
+
process.platform === 'win32'
|
|
43
|
+
? node_os_1.default.homedir() +
|
|
44
|
+
'\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe'
|
|
45
|
+
: null,
|
|
31
46
|
].filter(Boolean);
|
|
32
47
|
}
|
|
33
48
|
if (product === 'firefox') {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVideoMetadata = void 0;
|
|
4
|
+
const compositor_1 = require("./compositor/compositor");
|
|
5
|
+
const getVideoMetadata = async (videoSource) => {
|
|
6
|
+
const compositor = (0, compositor_1.startLongRunningCompositor)((0, compositor_1.getIdealMaximumFrameCacheItems)(), 'info', false);
|
|
7
|
+
const metadataResponse = await compositor.executeCommand('GetVideoMetadata', {
|
|
8
|
+
src: videoSource,
|
|
9
|
+
});
|
|
10
|
+
compositor.finishCommands();
|
|
11
|
+
await compositor.waitForDone();
|
|
12
|
+
return JSON.parse(metadataResponse.toString('utf-8'));
|
|
13
|
+
};
|
|
14
|
+
exports.getVideoMetadata = getVideoMetadata;
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type { FfmpegOverrideFn } from './ffmpeg-override';
|
|
|
17
17
|
export { FileExtension } from './file-extensions';
|
|
18
18
|
export { FrameRange } from './frame-range';
|
|
19
19
|
export { getCompositions, GetCompositionsOptions } from './get-compositions';
|
|
20
|
+
export { getVideoMetadata } from './get-video-metadata';
|
|
20
21
|
export { ImageFormat, StillImageFormat, validateSelectedPixelFormatAndImageFormatCombination, VideoImageFormat, } from './image-format';
|
|
21
22
|
export type { LogLevel } from './log-level';
|
|
22
23
|
export { CancelSignal, makeCancelSignal } from './make-cancel-signal';
|
|
@@ -49,7 +50,6 @@ export declare const RenderInternals: {
|
|
|
49
50
|
port: number;
|
|
50
51
|
close: () => Promise<void>;
|
|
51
52
|
compositor: import("./compositor/compositor").Compositor;
|
|
52
|
-
events: import("./offthread-video-server").OffthreadVideoServerEmitter;
|
|
53
53
|
}>;
|
|
54
54
|
validateEvenDimensionsWithCodec: ({ width, height, codec, scale, }: {
|
|
55
55
|
width: number;
|
|
@@ -262,19 +262,14 @@ export declare const RenderInternals: {
|
|
|
262
262
|
};
|
|
263
263
|
gif: {
|
|
264
264
|
default: import("./file-extensions").FileExtension;
|
|
265
|
-
forAudioCodec: {
|
|
266
|
-
[x: string]: {
|
|
267
|
-
possible: import("./file-extensions").FileExtension[];
|
|
268
|
-
default: import("./file-extensions").FileExtension;
|
|
269
|
-
};
|
|
270
|
-
};
|
|
265
|
+
forAudioCodec: {};
|
|
271
266
|
};
|
|
272
267
|
};
|
|
273
268
|
supportedAudioCodecs: {
|
|
274
269
|
readonly h264: readonly ["aac", "pcm-16"];
|
|
275
270
|
readonly 'h264-mkv': readonly ["pcm-16"];
|
|
276
271
|
readonly aac: readonly ["aac", "pcm-16"];
|
|
277
|
-
readonly gif:
|
|
272
|
+
readonly gif: readonly [];
|
|
278
273
|
readonly h265: readonly ["aac", "pcm-16"];
|
|
279
274
|
readonly mp3: readonly ["mp3", "pcm-16"];
|
|
280
275
|
readonly prores: readonly ["aac", "pcm-16"];
|
|
@@ -372,6 +367,12 @@ export declare const RenderInternals: {
|
|
|
372
367
|
logLevel: "verbose" | "info" | "warn" | "error";
|
|
373
368
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
374
369
|
error: (message?: any, ...optionalParams: any[]) => void;
|
|
370
|
+
errorAdvanced: (options: {
|
|
371
|
+
indent: boolean;
|
|
372
|
+
logLevel: "verbose" | "info" | "warn" | "error";
|
|
373
|
+
} & {
|
|
374
|
+
tag?: string | undefined;
|
|
375
|
+
}, message?: any, ...optionalParams: any[]) => void;
|
|
375
376
|
};
|
|
376
377
|
getLogLevel: () => "verbose" | "info" | "warn" | "error";
|
|
377
378
|
setLogLevel: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.RenderInternals = exports.validateOutputFilename = exports.stitchFramesToVideo = exports.selectComposition = exports.renderStill = exports.renderMedia = exports.renderFrames = exports.openBrowser = exports.makeCancelSignal = exports.validateSelectedPixelFormatAndImageFormatCombination = exports.getCompositions = exports.ErrorWithStackFrame = void 0;
|
|
29
|
+
exports.RenderInternals = exports.validateOutputFilename = exports.stitchFramesToVideo = exports.selectComposition = exports.renderStill = exports.renderMedia = exports.renderFrames = exports.openBrowser = exports.makeCancelSignal = exports.validateSelectedPixelFormatAndImageFormatCombination = exports.getVideoMetadata = exports.getCompositions = exports.ErrorWithStackFrame = void 0;
|
|
30
30
|
const execa_1 = __importDefault(require("execa"));
|
|
31
31
|
const download_file_1 = require("./assets/download-file");
|
|
32
32
|
const audio_codec_1 = require("./audio-codec");
|
|
@@ -86,6 +86,8 @@ var handle_javascript_exception_1 = require("./error-handling/handle-javascript-
|
|
|
86
86
|
Object.defineProperty(exports, "ErrorWithStackFrame", { enumerable: true, get: function () { return handle_javascript_exception_1.ErrorWithStackFrame; } });
|
|
87
87
|
var get_compositions_2 = require("./get-compositions");
|
|
88
88
|
Object.defineProperty(exports, "getCompositions", { enumerable: true, get: function () { return get_compositions_2.getCompositions; } });
|
|
89
|
+
var get_video_metadata_1 = require("./get-video-metadata");
|
|
90
|
+
Object.defineProperty(exports, "getVideoMetadata", { enumerable: true, get: function () { return get_video_metadata_1.getVideoMetadata; } });
|
|
89
91
|
var image_format_2 = require("./image-format");
|
|
90
92
|
Object.defineProperty(exports, "validateSelectedPixelFormatAndImageFormatCombination", { enumerable: true, get: function () { return image_format_2.validateSelectedPixelFormatAndImageFormatCombination; } });
|
|
91
93
|
var make_cancel_signal_1 = require("./make-cancel-signal");
|
package/dist/logger.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const Log: {
|
|
|
17
17
|
warn: (message?: any, ...optionalParams: any[]) => void;
|
|
18
18
|
warnAdvanced: (options: LogOptions, message?: any, ...optionalParams: any[]) => void;
|
|
19
19
|
error: (message?: any, ...optionalParams: any[]) => void;
|
|
20
|
+
errorAdvanced: (options: VerboseLogOptions, message?: any, ...optionalParams: any[]) => void;
|
|
20
21
|
};
|
|
21
22
|
export declare const getLogLevel: () => "verbose" | "info" | "warn" | "error";
|
|
22
23
|
export declare const setLogLevel: (newLogLevel: LogLevel) => void;
|
package/dist/logger.js
CHANGED
|
@@ -51,6 +51,16 @@ exports.Log = {
|
|
|
51
51
|
return console.error(...args.map((a) => chalk_1.chalk.red(a)));
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
+
errorAdvanced: (options, ...args) => {
|
|
55
|
+
if ((0, log_level_1.isEqualOrBelowLogLevel)((0, exports.getLogLevel)(), 'error')) {
|
|
56
|
+
return console.log(...[
|
|
57
|
+
options.indent ? exports.INDENT_TOKEN : null,
|
|
58
|
+
options.tag ? (0, exports.verboseTag)(options.tag) : null,
|
|
59
|
+
]
|
|
60
|
+
.filter(truthy_1.truthy)
|
|
61
|
+
.concat(args.map((a) => chalk_1.chalk.red(a))));
|
|
62
|
+
}
|
|
63
|
+
},
|
|
54
64
|
};
|
|
55
65
|
let logLevel = 'info';
|
|
56
66
|
const getLogLevel = () => {
|
|
@@ -16,7 +16,6 @@ export declare const startOffthreadVideoServer: ({ downloadMap, concurrency, log
|
|
|
16
16
|
listener: RequestListener;
|
|
17
17
|
close: () => Promise<void>;
|
|
18
18
|
compositor: Compositor;
|
|
19
|
-
events: OffthreadVideoServerEmitter;
|
|
20
19
|
};
|
|
21
20
|
type DownloadEventPayload = {
|
|
22
21
|
src: string;
|
|
@@ -30,7 +30,6 @@ const extractUrlAndSourceFromUrl = (url) => {
|
|
|
30
30
|
};
|
|
31
31
|
exports.extractUrlAndSourceFromUrl = extractUrlAndSourceFromUrl;
|
|
32
32
|
const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent, }) => {
|
|
33
|
-
const events = new OffthreadVideoServerEmitter();
|
|
34
33
|
const compositor = (0, compositor_1.startCompositor)('StartLongRunningProcess', {
|
|
35
34
|
concurrency,
|
|
36
35
|
maximum_frame_cache_items: (0, compositor_1.getIdealMaximumFrameCacheItems)(),
|
|
@@ -70,7 +69,7 @@ const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent,
|
|
|
70
69
|
return;
|
|
71
70
|
}
|
|
72
71
|
let extractStart = Date.now();
|
|
73
|
-
(0, download_and_map_assets_to_file_1.downloadAsset)({ src,
|
|
72
|
+
(0, download_and_map_assets_to_file_1.downloadAsset)({ src, downloadMap })
|
|
74
73
|
.then((to) => {
|
|
75
74
|
extractStart = Date.now();
|
|
76
75
|
return compositor.executeCommand('ExtractFrame', {
|
|
@@ -95,12 +94,11 @@ const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent,
|
|
|
95
94
|
.catch((err) => {
|
|
96
95
|
res.writeHead(500);
|
|
97
96
|
res.end();
|
|
98
|
-
|
|
97
|
+
downloadMap.emitter.dispatchError(err);
|
|
99
98
|
console.log('Error occurred', err);
|
|
100
99
|
});
|
|
101
100
|
},
|
|
102
101
|
compositor,
|
|
103
|
-
events,
|
|
104
102
|
};
|
|
105
103
|
};
|
|
106
104
|
exports.startOffthreadVideoServer = startOffthreadVideoServer;
|
package/dist/prepare-server.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
2
2
|
import type { DownloadMap } from './assets/download-map';
|
|
3
3
|
import type { Compositor } from './compositor/compositor';
|
|
4
|
-
import type { OffthreadVideoServerEmitter } from './offthread-video-server';
|
|
5
|
-
import type { AnySourceMapConsumer } from './symbolicate-stacktrace';
|
|
6
4
|
import type { LogLevel } from './log-level';
|
|
5
|
+
import type { AnySourceMapConsumer } from './symbolicate-stacktrace';
|
|
7
6
|
export type RemotionServer = {
|
|
8
7
|
serveUrl: string;
|
|
9
8
|
closeServer: (force: boolean) => Promise<unknown>;
|
|
10
9
|
offthreadPort: number;
|
|
11
10
|
compositor: Compositor;
|
|
12
|
-
sourceMap: AnySourceMapConsumer | null
|
|
13
|
-
events: OffthreadVideoServerEmitter;
|
|
11
|
+
sourceMap: Promise<AnySourceMapConsumer | null>;
|
|
14
12
|
downloadMap: DownloadMap;
|
|
15
13
|
};
|
|
16
14
|
type PrepareServerOptions = {
|
package/dist/prepare-server.js
CHANGED
|
@@ -9,6 +9,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
9
9
|
const remotion_1 = require("remotion");
|
|
10
10
|
const download_and_map_assets_to_file_1 = require("./assets/download-and-map-assets-to-file");
|
|
11
11
|
const download_map_1 = require("./assets/download-map");
|
|
12
|
+
const get_bundle_url_from_serve_url_1 = require("./get-bundle-url-from-serve-url");
|
|
12
13
|
const is_serve_url_1 = require("./is-serve-url");
|
|
13
14
|
const logger_1 = require("./logger");
|
|
14
15
|
const serve_static_1 = require("./serve-static");
|
|
@@ -18,7 +19,7 @@ const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, conc
|
|
|
18
19
|
const downloadMap = (0, download_map_1.makeDownloadMap)();
|
|
19
20
|
logger_1.Log.verboseAdvanced({ indent, logLevel }, 'Created directory for temporary files', downloadMap.assetDir);
|
|
20
21
|
if ((0, is_serve_url_1.isServeUrl)(webpackConfigOrServeUrl)) {
|
|
21
|
-
const { port: offthreadPort, close: closeProxy, compositor: comp,
|
|
22
|
+
const { port: offthreadPort, close: closeProxy, compositor: comp, } = await (0, serve_static_1.serveStatic)(null, {
|
|
22
23
|
port,
|
|
23
24
|
downloadMap,
|
|
24
25
|
remotionRoot,
|
|
@@ -34,8 +35,7 @@ const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, conc
|
|
|
34
35
|
},
|
|
35
36
|
offthreadPort,
|
|
36
37
|
compositor: comp,
|
|
37
|
-
sourceMap:
|
|
38
|
-
events,
|
|
38
|
+
sourceMap: (0, symbolicate_stacktrace_1.getSourceMapFromRemoteUrl)((0, get_bundle_url_from_serve_url_1.getBundleMapUrlFromServeUrl)(webpackConfigOrServeUrl)),
|
|
39
39
|
downloadMap,
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -46,7 +46,7 @@ const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, conc
|
|
|
46
46
|
throw new Error(`Tried to serve the Webpack bundle on a HTTP server, but the file ${indexFile} does not exist. Is this a valid path to a Webpack bundle?`);
|
|
47
47
|
}
|
|
48
48
|
const sourceMap = (0, symbolicate_stacktrace_1.getSourceMapFromLocalFile)(node_path_1.default.join(webpackConfigOrServeUrl, remotion_1.Internals.bundleName));
|
|
49
|
-
const { port: serverPort, close, compositor,
|
|
49
|
+
const { port: serverPort, close, compositor, } = await (0, serve_static_1.serveStatic)(webpackConfigOrServeUrl, {
|
|
50
50
|
port,
|
|
51
51
|
downloadMap,
|
|
52
52
|
remotionRoot,
|
|
@@ -66,16 +66,15 @@ const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, conc
|
|
|
66
66
|
serveUrl: `http://localhost:${serverPort}`,
|
|
67
67
|
offthreadPort: serverPort,
|
|
68
68
|
compositor,
|
|
69
|
-
sourceMap
|
|
70
|
-
events: newEvents,
|
|
69
|
+
sourceMap,
|
|
71
70
|
downloadMap,
|
|
72
71
|
});
|
|
73
72
|
};
|
|
74
73
|
exports.prepareServer = prepareServer;
|
|
75
74
|
const makeOrReuseServer = async (server, config, { onDownload, onError, }) => {
|
|
76
75
|
if (server) {
|
|
77
|
-
const cleanupOnDownload = (0, download_and_map_assets_to_file_1.attachDownloadListenerToEmitter)(server.
|
|
78
|
-
const cleanupError = server.
|
|
76
|
+
const cleanupOnDownload = (0, download_and_map_assets_to_file_1.attachDownloadListenerToEmitter)(server.downloadMap, onDownload);
|
|
77
|
+
const cleanupError = server.downloadMap.emitter.addEventListener('error', ({ detail: { error } }) => {
|
|
79
78
|
onError(error);
|
|
80
79
|
});
|
|
81
80
|
return {
|
|
@@ -88,8 +87,8 @@ const makeOrReuseServer = async (server, config, { onDownload, onError, }) => {
|
|
|
88
87
|
};
|
|
89
88
|
}
|
|
90
89
|
const newServer = await (0, exports.prepareServer)(config);
|
|
91
|
-
const cleanupOnDownloadNew = (0, download_and_map_assets_to_file_1.attachDownloadListenerToEmitter)(newServer.
|
|
92
|
-
const cleanupErrorNew = newServer.
|
|
90
|
+
const cleanupOnDownloadNew = (0, download_and_map_assets_to_file_1.attachDownloadListenerToEmitter)(newServer.downloadMap, onDownload);
|
|
91
|
+
const cleanupErrorNew = newServer.downloadMap.emitter.addEventListener('error', ({ detail: { error } }) => {
|
|
93
92
|
onError(error);
|
|
94
93
|
});
|
|
95
94
|
return {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Codec } from './codec';
|
|
2
2
|
import type { FfmpegOverrideFn } from './ffmpeg-override';
|
|
3
3
|
import type { VideoImageFormat } from './image-format';
|
|
4
|
+
import type { LogLevel } from './log-level';
|
|
4
5
|
import type { CancelSignal } from './make-cancel-signal';
|
|
5
6
|
import type { PixelFormat } from './pixel-format';
|
|
6
7
|
import type { ProResProfile } from './prores-profile';
|
|
7
|
-
import type { LogLevel } from './log-level';
|
|
8
8
|
type RunningStatus = {
|
|
9
9
|
type: 'running';
|
|
10
10
|
} | {
|
package/dist/render-frames.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ import type { BrowserLog } from './browser-log';
|
|
|
6
6
|
import type { HeadlessBrowser } from './browser/Browser';
|
|
7
7
|
import type { FrameRange } from './frame-range';
|
|
8
8
|
import type { VideoImageFormat } from './image-format';
|
|
9
|
+
import { type LogLevel } from './log-level';
|
|
9
10
|
import type { CancelSignal } from './make-cancel-signal';
|
|
10
11
|
import type { ChromiumOptions } from './open-browser';
|
|
11
12
|
import type { RemotionServer } from './prepare-server';
|
|
12
13
|
import type { OnStartData, RenderFramesOutput } from './types';
|
|
13
|
-
import { type LogLevel } from './log-level';
|
|
14
14
|
export type InternalRenderFramesOptions = {
|
|
15
15
|
onStart: null | ((data: OnStartData) => void);
|
|
16
16
|
onFrameUpdate: null | ((framesRendered: number, frameIndex: number, timeToRenderInMilliseconds: number) => void);
|
package/dist/render-frames.js
CHANGED
|
@@ -21,6 +21,7 @@ const get_duration_from_frame_range_1 = require("./get-duration-from-frame-range
|
|
|
21
21
|
const get_frame_padded_index_1 = require("./get-frame-padded-index");
|
|
22
22
|
const get_frame_to_render_1 = require("./get-frame-to-render");
|
|
23
23
|
const jpeg_quality_1 = require("./jpeg-quality");
|
|
24
|
+
const logger_1 = require("./logger");
|
|
24
25
|
const make_cancel_signal_1 = require("./make-cancel-signal");
|
|
25
26
|
const open_browser_1 = require("./open-browser");
|
|
26
27
|
const perf_1 = require("./perf");
|
|
@@ -33,7 +34,6 @@ const set_props_and_env_1 = require("./set-props-and-env");
|
|
|
33
34
|
const take_frame_and_compose_1 = require("./take-frame-and-compose");
|
|
34
35
|
const truthy_1 = require("./truthy");
|
|
35
36
|
const validate_scale_1 = require("./validate-scale");
|
|
36
|
-
const logger_1 = require("./logger");
|
|
37
37
|
const MAX_RETRIES_PER_FRAME = 1;
|
|
38
38
|
const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, jpegQuality, imageFormat, frameRange, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale, actualConcurrency, everyNthFrame, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, compositor, sourcemapContext, logLevel, indent, }) => {
|
|
39
39
|
if (outputDir) {
|
|
@@ -340,9 +340,11 @@ const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions
|
|
|
340
340
|
onError,
|
|
341
341
|
}),
|
|
342
342
|
browserInstance,
|
|
343
|
-
]).then(([{ server:
|
|
343
|
+
]).then(([{ server: openedServer, cleanupServer }, pInstance]) => {
|
|
344
|
+
const { serveUrl, offthreadPort, compositor, sourceMap, downloadMap } = openedServer;
|
|
344
345
|
const browserReplacer = (0, replace_browser_1.handleBrowserCrash)(pInstance, logLevel, indent);
|
|
345
|
-
cleanup.push((0, cycle_browser_tabs_1.cycleBrowserTabs)(browserReplacer, actualConcurrency, logLevel, indent)
|
|
346
|
+
cleanup.push((0, cycle_browser_tabs_1.cycleBrowserTabs)(browserReplacer, actualConcurrency, logLevel, indent)
|
|
347
|
+
.stopCycling);
|
|
346
348
|
cleanup.push(() => cleanupServer(false));
|
|
347
349
|
return innerRenderFrames({
|
|
348
350
|
onError,
|
package/dist/render-media.d.ts
CHANGED
|
@@ -9,13 +9,13 @@ import type { Codec } from './codec';
|
|
|
9
9
|
import type { FfmpegOverrideFn } from './ffmpeg-override';
|
|
10
10
|
import type { FrameRange } from './frame-range';
|
|
11
11
|
import type { VideoImageFormat } from './image-format';
|
|
12
|
+
import { type LogLevel } from './log-level';
|
|
12
13
|
import type { CancelSignal } from './make-cancel-signal';
|
|
13
14
|
import type { ChromiumOptions } from './open-browser';
|
|
14
15
|
import type { PixelFormat } from './pixel-format';
|
|
15
16
|
import type { RemotionServer } from './prepare-server';
|
|
16
17
|
import type { ProResProfile } from './prores-profile';
|
|
17
18
|
import type { OnStartData } from './types';
|
|
18
|
-
import { type LogLevel } from './log-level';
|
|
19
19
|
export type StitchingState = 'encoding' | 'muxing';
|
|
20
20
|
export type SlowFrame = {
|
|
21
21
|
frame: number;
|
package/dist/render-media.js
CHANGED
|
@@ -404,7 +404,7 @@ exports.internalRenderMedia = internalRenderMedia;
|
|
|
404
404
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/render-media)
|
|
405
405
|
*/
|
|
406
406
|
const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, audioCodec, jpegQuality, concurrency, serveUrl, disallowParallelEncoding, everyNthFrame, imageFormat, numberOfGifLoops, dumpBrowserLogs, preferLossless, verbose, quality, logLevel, }) => {
|
|
407
|
-
var _a;
|
|
407
|
+
var _a, _b;
|
|
408
408
|
if (quality !== undefined) {
|
|
409
409
|
console.warn(`The "quality" option has been renamed. Please use "jpegQuality" instead.`);
|
|
410
410
|
}
|
|
@@ -455,7 +455,7 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
455
455
|
serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
456
456
|
indent: undefined,
|
|
457
457
|
staticBase: null,
|
|
458
|
-
data: composition.props,
|
|
458
|
+
data: (_b = composition.props) !== null && _b !== void 0 ? _b : {},
|
|
459
459
|
}).serializedString,
|
|
460
460
|
});
|
|
461
461
|
};
|
package/dist/render-still.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ import type { BrowserExecutable } from './browser-executable';
|
|
|
5
5
|
import type { BrowserLog } from './browser-log';
|
|
6
6
|
import type { HeadlessBrowser } from './browser/Browser';
|
|
7
7
|
import type { StillImageFormat } from './image-format';
|
|
8
|
+
import type { LogLevel } from './log-level';
|
|
8
9
|
import type { CancelSignal } from './make-cancel-signal';
|
|
9
10
|
import type { ChromiumOptions } from './open-browser';
|
|
10
11
|
import type { RemotionServer } from './prepare-server';
|
|
11
|
-
import type { LogLevel } from './log-level';
|
|
12
12
|
type InternalRenderStillOptions = {
|
|
13
13
|
composition: VideoConfig;
|
|
14
14
|
output: string | null;
|
package/dist/render-still.js
CHANGED
|
@@ -38,6 +38,7 @@ const handle_javascript_exception_1 = require("./error-handling/handle-javascrip
|
|
|
38
38
|
const find_closest_package_json_1 = require("./find-closest-package-json");
|
|
39
39
|
const image_format_1 = require("./image-format");
|
|
40
40
|
const jpeg_quality_1 = require("./jpeg-quality");
|
|
41
|
+
const logger_1 = require("./logger");
|
|
41
42
|
const make_cancel_signal_1 = require("./make-cancel-signal");
|
|
42
43
|
const open_browser_1 = require("./open-browser");
|
|
43
44
|
const overwrite_1 = require("./overwrite");
|
|
@@ -48,7 +49,6 @@ const set_props_and_env_1 = require("./set-props-and-env");
|
|
|
48
49
|
const take_frame_and_compose_1 = require("./take-frame-and-compose");
|
|
49
50
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
50
51
|
const validate_scale_1 = require("./validate-scale");
|
|
51
|
-
const logger_1 = require("./logger");
|
|
52
52
|
const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFAULT_STILL_IMAGE_FORMAT, serveUrl, puppeteerInstance, onError, serializedInputPropsWithCustomSchema, envVariables, output, frame = 0, overwrite, browserExecutable, timeoutInMilliseconds, chromiumOptions, scale, proxyPort, cancelSignal, jpegQuality, onBrowserLog, compositor, sourceMapContext, downloadMap, logLevel, indent, serializedResolvedPropsWithCustomSchema, }) => {
|
|
53
53
|
remotion_1.Internals.validateDimension(composition.height, 'height', 'in the `config` object passed to `renderStill()`');
|
|
54
54
|
remotion_1.Internals.validateDimension(composition.width, 'width', 'in the `config` object passed to `renderStill()`');
|
|
@@ -93,7 +93,7 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
|
|
|
93
93
|
viewport: null,
|
|
94
94
|
logLevel,
|
|
95
95
|
}));
|
|
96
|
-
const page = await browserInstance.newPage(sourceMapContext, logLevel, indent);
|
|
96
|
+
const page = await browserInstance.newPage(Promise.resolve(sourceMapContext), logLevel, indent);
|
|
97
97
|
await page.setViewport({
|
|
98
98
|
width: composition.width,
|
|
99
99
|
height: composition.height,
|
|
@@ -2,9 +2,9 @@ import { type VideoConfig } from 'remotion';
|
|
|
2
2
|
import type { BrowserExecutable } from './browser-executable';
|
|
3
3
|
import type { BrowserLog } from './browser-log';
|
|
4
4
|
import type { HeadlessBrowser } from './browser/Browser';
|
|
5
|
+
import { type LogLevel } from './log-level';
|
|
5
6
|
import type { ChromiumOptions } from './open-browser';
|
|
6
7
|
import type { RemotionServer } from './prepare-server';
|
|
7
|
-
import { type LogLevel } from './log-level';
|
|
8
8
|
type InternalSelectCompositionsConfig = {
|
|
9
9
|
serializedInputPropsWithCustomSchema: string;
|
|
10
10
|
envVariables: Record<string, string>;
|
|
@@ -42,5 +42,5 @@ export declare const internalSelectComposition: (options: InternalSelectComposit
|
|
|
42
42
|
* @description Gets a composition defined in a Remotion project based on a Webpack bundle.
|
|
43
43
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/select-composition)
|
|
44
44
|
*/
|
|
45
|
-
export declare const selectComposition: (options: SelectCompositionOptions) => Promise<
|
|
45
|
+
export declare const selectComposition: (options: SelectCompositionOptions) => Promise<VideoConfig>;
|
|
46
46
|
export {};
|
|
@@ -169,7 +169,7 @@ const serveHandler = async (request, response, config) => {
|
|
|
169
169
|
return sendError(absolutePath, response, {
|
|
170
170
|
statusCode: 404,
|
|
171
171
|
code: 'not_found',
|
|
172
|
-
message: 'The requested path could not be found',
|
|
172
|
+
message: 'The requested path (' + absolutePath + ') could not be found',
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
let streamOpts = null;
|
package/dist/serve-static.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { DownloadMap } from './assets/download-map';
|
|
2
2
|
import type { Compositor } from './compositor/compositor';
|
|
3
|
-
import type { OffthreadVideoServerEmitter } from './offthread-video-server';
|
|
4
3
|
import type { LogLevel } from './log-level';
|
|
5
4
|
export declare const serveStatic: (path: string | null, options: {
|
|
6
5
|
port: number | null;
|
|
@@ -13,5 +12,4 @@ export declare const serveStatic: (path: string | null, options: {
|
|
|
13
12
|
port: number;
|
|
14
13
|
close: () => Promise<void>;
|
|
15
14
|
compositor: Compositor;
|
|
16
|
-
events: OffthreadVideoServerEmitter;
|
|
17
15
|
}>;
|
package/dist/serve-static.js
CHANGED
|
@@ -9,7 +9,7 @@ const get_port_1 = require("./get-port");
|
|
|
9
9
|
const offthread_video_server_1 = require("./offthread-video-server");
|
|
10
10
|
const serve_handler_1 = require("./serve-handler");
|
|
11
11
|
const serveStatic = async (path, options) => {
|
|
12
|
-
const { listener: offthreadRequest, close: closeCompositor, compositor,
|
|
12
|
+
const { listener: offthreadRequest, close: closeCompositor, compositor, } = (0, offthread_video_server_1.startOffthreadVideoServer)({
|
|
13
13
|
downloadMap: options.downloadMap,
|
|
14
14
|
concurrency: options.concurrency,
|
|
15
15
|
logLevel: options.logLevel,
|
|
@@ -85,7 +85,7 @@ const serveStatic = async (path, options) => {
|
|
|
85
85
|
}),
|
|
86
86
|
]);
|
|
87
87
|
};
|
|
88
|
-
return { port: selectedPort, close, compositor
|
|
88
|
+
return { port: selectedPort, close, compositor };
|
|
89
89
|
}
|
|
90
90
|
catch (err) {
|
|
91
91
|
if (!(err instanceof Error)) {
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.setPropsAndEnv = void 0;
|
|
4
4
|
const version_1 = require("remotion/version");
|
|
5
5
|
const TimeoutSettings_1 = require("./browser/TimeoutSettings");
|
|
6
|
+
const logger_1 = require("./logger");
|
|
6
7
|
const normalize_serve_url_1 = require("./normalize-serve-url");
|
|
7
8
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
8
9
|
const redirect_status_codes_1 = require("./redirect-status-codes");
|
|
9
10
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
10
|
-
const logger_1 = require("./logger");
|
|
11
11
|
const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, proxyPort, retriesRemaining, audioEnabled, videoEnabled, indent, logLevel, }) => {
|
|
12
12
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
13
13
|
const actualTimeout = timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : TimeoutSettings_1.DEFAULT_TIMEOUT;
|
|
@@ -4,10 +4,10 @@ import type { RenderAssetInfo } from './assets/download-map';
|
|
|
4
4
|
import type { AudioCodec } from './audio-codec';
|
|
5
5
|
import type { Codec } from './codec';
|
|
6
6
|
import type { FfmpegOverrideFn } from './ffmpeg-override';
|
|
7
|
+
import type { LogLevel } from './log-level';
|
|
7
8
|
import type { CancelSignal } from './make-cancel-signal';
|
|
8
9
|
import type { PixelFormat } from './pixel-format';
|
|
9
10
|
import type { ProResProfile } from './prores-profile';
|
|
10
|
-
import type { LogLevel } from './log-level';
|
|
11
11
|
type InternalStitchFramesToVideoOptions = {
|
|
12
12
|
audioBitrate: string | null;
|
|
13
13
|
videoBitrate: string | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BasicSourceMapConsumer, IndexedSourceMapConsumer } from 'source-map';
|
|
2
2
|
import { SourceMapConsumer } from 'source-map';
|
|
3
3
|
import type { UnsymbolicatedStackFrame } from './parse-browser-error-stack';
|
|
4
|
+
export declare const getSourceMapFromRemoteUrl: (url: string) => Promise<BasicSourceMapConsumer | IndexedSourceMapConsumer>;
|
|
4
5
|
type ScriptLine = {
|
|
5
6
|
lineNumber: number;
|
|
6
7
|
content: string;
|
|
@@ -22,7 +23,7 @@ export declare const symbolicateStackFrame: (frame: UnsymbolicatedStackFrame, ma
|
|
|
22
23
|
originalLineNumber: number | null;
|
|
23
24
|
originalScriptCode: ScriptLine[] | null;
|
|
24
25
|
};
|
|
25
|
-
export declare const getSourceMapFromRemoteFile: (fileName: string) => Promise<
|
|
26
|
-
export declare const getSourceMapFromLocalFile: (fileName: string) => Promise<
|
|
26
|
+
export declare const getSourceMapFromRemoteFile: (fileName: string) => Promise<AnySourceMapConsumer | null>;
|
|
27
|
+
export declare const getSourceMapFromLocalFile: (fileName: string) => Promise<AnySourceMapConsumer | null>;
|
|
27
28
|
export type AnySourceMapConsumer = BasicSourceMapConsumer | IndexedSourceMapConsumer;
|
|
28
29
|
export {};
|
|
@@ -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.getSourceMapFromLocalFile = exports.getSourceMapFromRemoteFile = exports.symbolicateStackFrame = exports.symbolicateFromSources = exports.symbolicateStackTraceFromRemoteFrames = void 0;
|
|
6
|
+
exports.getSourceMapFromLocalFile = exports.getSourceMapFromRemoteFile = exports.symbolicateStackFrame = exports.symbolicateFromSources = exports.symbolicateStackTraceFromRemoteFrames = exports.getSourceMapFromRemoteUrl = void 0;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const source_map_1 = require("source-map");
|
|
@@ -24,10 +24,18 @@ function extractSourceMapUrl(fileContents) {
|
|
|
24
24
|
}
|
|
25
25
|
return match[1].toString();
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const getSourceMapFromRemoteUrl = async (url) => {
|
|
28
|
+
if (!url.endsWith('.js.map')) {
|
|
29
|
+
throw new Error(`The URL ${url} does not seem to be a valid source map URL.`);
|
|
30
|
+
}
|
|
31
|
+
const obj = await fetchUrl(url);
|
|
32
|
+
return new source_map_1.SourceMapConsumer(obj);
|
|
33
|
+
};
|
|
34
|
+
exports.getSourceMapFromRemoteUrl = getSourceMapFromRemoteUrl;
|
|
35
|
+
const getSourceMap = (filePath, fileContents, type) => {
|
|
28
36
|
const sm = extractSourceMapUrl(fileContents);
|
|
29
37
|
if (sm === null) {
|
|
30
|
-
return null;
|
|
38
|
+
return Promise.resolve(null);
|
|
31
39
|
}
|
|
32
40
|
if (sm.indexOf('data:') === 0) {
|
|
33
41
|
const base64 = /^data:application\/json;([\w=:"-]+;)*base64,/;
|
|
@@ -36,17 +44,16 @@ const getSourceMap = async (filePath, fileContents, type) => {
|
|
|
36
44
|
throw new Error('Sorry, non-base64 inline source-map encoding is not supported.');
|
|
37
45
|
}
|
|
38
46
|
const converted = window.atob(sm.substring(match2[0].length));
|
|
39
|
-
return new source_map_1.SourceMapConsumer(JSON.parse(converted));
|
|
47
|
+
return Promise.resolve(new source_map_1.SourceMapConsumer(JSON.parse(converted)));
|
|
40
48
|
}
|
|
41
49
|
if (type === 'local') {
|
|
42
50
|
// Find adjacent file: bundle.js -> bundle.js.map
|
|
43
51
|
const newFilePath = path_1.default.join(path_1.default.dirname(filePath), sm);
|
|
44
|
-
return new source_map_1.SourceMapConsumer((0, fs_1.readFileSync)(newFilePath, 'utf8'));
|
|
52
|
+
return Promise.resolve(new source_map_1.SourceMapConsumer((0, fs_1.readFileSync)(newFilePath, 'utf8')));
|
|
45
53
|
}
|
|
46
54
|
const index = filePath.lastIndexOf('/');
|
|
47
55
|
const url = filePath.substring(0, index + 1) + sm;
|
|
48
|
-
|
|
49
|
-
return new source_map_1.SourceMapConsumer(obj);
|
|
56
|
+
return (0, exports.getSourceMapFromRemoteUrl)(url);
|
|
50
57
|
};
|
|
51
58
|
const fetchUrl = async (url) => {
|
|
52
59
|
const res = await (0, read_file_1.readFile)(url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"extract-zip": "2.0.1",
|
|
19
19
|
"source-map": "^0.8.0-beta.0",
|
|
20
20
|
"ws": "8.7.0",
|
|
21
|
-
"remotion": "4.0.
|
|
21
|
+
"remotion": "4.0.6"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": ">=16.8.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/react-dom": "18.0.10",
|
|
35
35
|
"eslint": "8.42.0",
|
|
36
36
|
"prettier": "^2.7.1",
|
|
37
|
-
"prettier-plugin-organize-imports": "^2.
|
|
37
|
+
"prettier-plugin-organize-imports": "^3.2.2",
|
|
38
38
|
"react": "18.0.0",
|
|
39
39
|
"react-dom": "18.0.0",
|
|
40
40
|
"typescript": "4.9.5",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"zod": "^3.21.4"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@remotion/compositor-
|
|
46
|
-
"@remotion/compositor-
|
|
47
|
-
"@remotion/compositor-
|
|
48
|
-
"@remotion/compositor-linux-
|
|
49
|
-
"@remotion/compositor-linux-
|
|
50
|
-
"@remotion/compositor-
|
|
51
|
-
"@remotion/compositor-win32-x64-msvc": "4.0.
|
|
45
|
+
"@remotion/compositor-darwin-arm64": "4.0.6",
|
|
46
|
+
"@remotion/compositor-darwin-x64": "4.0.6",
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.6",
|
|
48
|
+
"@remotion/compositor-linux-arm64-musl": "4.0.6",
|
|
49
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.6",
|
|
50
|
+
"@remotion/compositor-linux-x64-musl": "4.0.6",
|
|
51
|
+
"@remotion/compositor-win32-x64-msvc": "4.0.6"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
54
|
"remotion",
|