@remotion/renderer 4.0.0-alpha5 → 4.0.0-alpha7

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 (121) hide show
  1. package/dist/assets/download-and-map-assets-to-file.js +6 -6
  2. package/dist/assets/download-file.d.ts +3 -2
  3. package/dist/assets/download-file.js +18 -3
  4. package/dist/assets/download-map.js +7 -7
  5. package/dist/assets/read-file.d.ts +1 -1
  6. package/dist/assets/read-file.js +2 -2
  7. package/dist/assets/sanitize-filepath.js +2 -2
  8. package/dist/browser/BrowserFetcher.js +13 -13
  9. package/dist/browser/BrowserRunner.d.ts +1 -1
  10. package/dist/browser/BrowserRunner.js +9 -22
  11. package/dist/browser/LaunchOptions.d.ts +1 -2
  12. package/dist/browser/Launcher.js +7 -15
  13. package/dist/browser/NodeWebSocketTransport.js +4 -4
  14. package/dist/browser/get-download-destination.js +8 -8
  15. package/dist/call-ffmpeg.js +8 -3
  16. package/dist/chalk/index.d.ts +54 -0
  17. package/dist/chalk/index.js +135 -0
  18. package/dist/chalk/is-color-supported.d.ts +1 -0
  19. package/dist/chalk/is-color-supported.js +37 -0
  20. package/dist/client.d.ts +41 -41
  21. package/dist/combine-videos.js +6 -6
  22. package/dist/compositor/compose.js +12 -7
  23. package/dist/compositor/compositor.d.ts +2 -2
  24. package/dist/compositor/compositor.js +13 -8
  25. package/dist/compositor/get-executable-path.js +1 -10
  26. package/dist/create-ffmpeg-complex-filter.d.ts +1 -4
  27. package/dist/delete-directory.js +3 -3
  28. package/dist/does-have-m2-bug.js +2 -2
  29. package/dist/ensure-output-directory.js +5 -5
  30. package/dist/ffmpeg-filter-file.js +7 -7
  31. package/dist/find-closest-package-json.js +6 -6
  32. package/dist/get-compositions.d.ts +4 -0
  33. package/dist/get-compositions.js +2 -1
  34. package/dist/get-concurrency.js +3 -3
  35. package/dist/get-extension-from-codec.d.ts +2 -2
  36. package/dist/get-extension-of-filename.js +2 -2
  37. package/dist/get-local-browser-executable.js +4 -4
  38. package/dist/get-video-threads-flag.js +3 -3
  39. package/dist/index.d.ts +111 -36
  40. package/dist/index.js +9 -0
  41. package/dist/logger.d.ts +22 -0
  42. package/dist/logger.js +61 -0
  43. package/dist/merge-audio-track.js +2 -2
  44. package/dist/mime-types.js +2 -2
  45. package/dist/offthread-video-server.d.ts +3 -2
  46. package/dist/offthread-video-server.js +4 -4
  47. package/dist/open-browser.d.ts +1 -1
  48. package/dist/open-browser.js +1 -1
  49. package/dist/options/jpeg-quality.js +1 -1
  50. package/dist/prepare-server.d.ts +2 -1
  51. package/dist/prepare-server.js +7 -5
  52. package/dist/prespawn-ffmpeg.d.ts +1 -0
  53. package/dist/prespawn-ffmpeg.js +37 -14
  54. package/dist/prestitcher-memory-usage.js +2 -2
  55. package/dist/provide-screenshot.d.ts +1 -0
  56. package/dist/puppeteer-screenshot.d.ts +1 -0
  57. package/dist/puppeteer-screenshot.js +1 -1
  58. package/dist/render-frames.d.ts +4 -0
  59. package/dist/render-frames.js +9 -7
  60. package/dist/render-media.d.ts +4 -1
  61. package/dist/render-media.js +47 -26
  62. package/dist/render-still.d.ts +6 -0
  63. package/dist/render-still.js +20 -7
  64. package/dist/resolve-asset-src.js +2 -2
  65. package/dist/screenshot-dom-element.d.ts +1 -0
  66. package/dist/screenshot-task.d.ts +1 -0
  67. package/dist/screenshot-task.js +2 -2
  68. package/dist/serve-handler/index.d.ts +1 -1
  69. package/dist/serve-handler/index.js +15 -15
  70. package/dist/serve-handler/is-path-inside.js +3 -3
  71. package/dist/serve-static.d.ts +1 -0
  72. package/dist/serve-static.js +3 -2
  73. package/dist/stitch-frames-to-video.d.ts +2 -0
  74. package/dist/stitch-frames-to-video.js +62 -39
  75. package/dist/take-frame-and-compose.d.ts +1 -0
  76. package/dist/take-frame-and-compose.js +6 -6
  77. package/dist/tmp-dir.js +7 -7
  78. package/dist/validate-output-filename.d.ts +1 -1
  79. package/install-toolchain.mjs +2 -2
  80. package/package.json +9 -9
  81. package/types/ws/index.d.ts +5 -5
  82. package/dist/assets/get-video-stream-duration.d.ts +0 -9
  83. package/dist/assets/get-video-stream-duration.js +0 -71
  84. package/dist/calculate-sar-dar-pixels.d.ts +0 -9
  85. package/dist/calculate-sar-dar-pixels.js +0 -19
  86. package/dist/determine-resize-params.d.ts +0 -1
  87. package/dist/determine-resize-params.js +0 -10
  88. package/dist/determine-vcodec-ffmpeg-flags.d.ts +0 -2
  89. package/dist/determine-vcodec-ffmpeg-flags.js +0 -13
  90. package/dist/ensure-ffmpeg.d.ts +0 -18
  91. package/dist/ensure-ffmpeg.js +0 -58
  92. package/dist/ensure-presentation-timestamp.d.ts +0 -15
  93. package/dist/ensure-presentation-timestamp.js +0 -88
  94. package/dist/extract-frame-from-video.d.ts +0 -17
  95. package/dist/extract-frame-from-video.js +0 -191
  96. package/dist/ffmpeg-executable.d.ts +0 -1
  97. package/dist/ffmpeg-executable.js +0 -2
  98. package/dist/ffmpeg-flags.d.ts +0 -31
  99. package/dist/ffmpeg-flags.js +0 -245
  100. package/dist/frame-to-ffmpeg-timestamp.d.ts +0 -1
  101. package/dist/frame-to-ffmpeg-timestamp.js +0 -8
  102. package/dist/get-can-extract-frames-fast.d.ts +0 -14
  103. package/dist/get-can-extract-frames-fast.js +0 -71
  104. package/dist/get-frame-of-video-slow.d.ts +0 -15
  105. package/dist/get-frame-of-video-slow.js +0 -72
  106. package/dist/get-video-info.d.ts +0 -8
  107. package/dist/get-video-info.js +0 -59
  108. package/dist/is-beyond-last-frame.d.ts +0 -3
  109. package/dist/is-beyond-last-frame.js +0 -12
  110. package/dist/last-frame-from-video-cache.d.ts +0 -18
  111. package/dist/last-frame-from-video-cache.js +0 -55
  112. package/dist/legacy-webpack-config.d.ts +0 -9
  113. package/dist/legacy-webpack-config.js +0 -13
  114. package/dist/quality.d.ts +0 -1
  115. package/dist/quality.js +0 -21
  116. package/dist/try-to-extract-frame-of-video-fast.d.ts +0 -13
  117. package/dist/try-to-extract-frame-of-video-fast.js +0 -55
  118. package/dist/validate-ffmpeg.d.ts +0 -7
  119. package/dist/validate-ffmpeg.js +0 -77
  120. package/dist/warn-about-ffmpeg-version.d.ts +0 -5
  121. package/dist/warn-about-ffmpeg-version.js +0 -37
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getLocalBrowserExecutable = exports.ensureLocalBrowser = void 0;
7
- const fs_1 = __importDefault(require("fs"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const BrowserFetcher_1 = require("./browser/BrowserFetcher");
9
9
  const create_browser_fetcher_1 = require("./browser/create-browser-fetcher");
10
10
  const revisions_1 = require("./browser/revisions");
@@ -38,7 +38,7 @@ const getSearchPathsForProduct = (product) => {
38
38
  const mapBrowserToProduct = (browser) => browser;
39
39
  const getLocalBrowser = (product) => {
40
40
  for (const p of getSearchPathsForProduct(product)) {
41
- if (fs_1.default.existsSync(p)) {
41
+ if (node_fs_1.default.existsSync(p)) {
42
42
  return p;
43
43
  }
44
44
  }
@@ -46,7 +46,7 @@ const getLocalBrowser = (product) => {
46
46
  };
47
47
  const getBrowserStatus = (product, browserExecutablePath) => {
48
48
  if (browserExecutablePath) {
49
- if (!fs_1.default.existsSync(browserExecutablePath)) {
49
+ if (!node_fs_1.default.existsSync(browserExecutablePath)) {
50
50
  console.warn(`Browser executable was specified as '${browserExecutablePath}' but the path doesn't exist.`);
51
51
  }
52
52
  return { path: browserExecutablePath, type: 'user-defined-path' };
@@ -56,7 +56,7 @@ const getBrowserStatus = (product, browserExecutablePath) => {
56
56
  return { path: localBrowser, type: 'local-browser' };
57
57
  }
58
58
  const revision = (0, BrowserFetcher_1.getRevisionInfo)(revisions_1.PUPPETEER_REVISIONS.chromium, product);
59
- if (revision.local && fs_1.default.existsSync(revision.executablePath)) {
59
+ if (revision.local && node_fs_1.default.existsSync(revision.executablePath)) {
60
60
  return { path: revision.executablePath, type: 'local-puppeteer-browser' };
61
61
  }
62
62
  return { type: 'no-browser' };
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getIdealVideoThreadsFlag = void 0;
7
- const os_1 = __importDefault(require("os"));
7
+ const node_os_1 = __importDefault(require("node:os"));
8
8
  const MEMORY_USAGE_PER_THREAD = 400000000; // 400MB
9
9
  const RESERVED_MEMORY = 2000000000;
10
10
  const getIdealVideoThreadsFlag = () => {
11
- const freeMemory = os_1.default.freemem();
12
- const cpus = os_1.default.cpus().length;
11
+ const freeMemory = node_os_1.default.freemem();
12
+ const cpus = node_os_1.default.cpus().length;
13
13
  const maxRecommendedBasedOnCpus = (cpus * 2) / 3;
14
14
  const maxRecommendedBasedOnMemory = (freeMemory - RESERVED_MEMORY) / MEMORY_USAGE_PER_THREAD;
15
15
  const maxRecommended = Math.min(maxRecommendedBasedOnCpus, maxRecommendedBasedOnMemory);
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import execa from 'execa';
2
3
  import { SymbolicateableError } from './error-handling/symbolicateable-error';
3
4
  import { mimeContentType, mimeLookup } from './mime-types';
@@ -42,6 +43,7 @@ export declare const RenderInternals: {
42
43
  remotionRoot: string;
43
44
  concurrency: number;
44
45
  verbose: boolean;
46
+ indent: boolean;
45
47
  }) => Promise<{
46
48
  port: number;
47
49
  close: () => Promise<void>;
@@ -50,16 +52,16 @@ export declare const RenderInternals: {
50
52
  width: number;
51
53
  height: number;
52
54
  scale: number;
53
- codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif";
55
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
54
56
  }) => void;
55
- getFileExtensionFromCodec: <T extends "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif">(codec: T, audioCodec: "pcm-16" | "aac" | "mp3" | "opus" | null) => import("./file-extensions").FileExtension;
57
+ getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">(codec: T, audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => import("./file-extensions").FileExtension;
56
58
  tmpDir: (str: string) => string;
57
59
  deleteDirectory: (directory: string) => void;
58
60
  isServeUrl: (potentialUrl: string) => boolean;
59
61
  ensureOutputDirectory: (outputLocation: string) => void;
60
62
  getRealFrameRange: (durationInFrames: number, frameRange: import("./frame-range").FrameRange | null) => [number, number];
61
63
  validatePuppeteerTimeout: (timeoutInMilliseconds: unknown) => void;
62
- downloadFile: ({ onProgress, url, to: toFn, }: {
64
+ downloadFile: (options: {
63
65
  url: string;
64
66
  to: (contentDisposition: string | null, contentType: string | null) => string;
65
67
  onProgress: ((progress: {
@@ -67,7 +69,7 @@ export declare const RenderInternals: {
67
69
  downloaded: number;
68
70
  totalSize: number | null;
69
71
  }) => void) | undefined;
70
- }) => Promise<{
72
+ }, retries?: number) => Promise<{
71
73
  sizeInBytes: number;
72
74
  to: string;
73
75
  }>;
@@ -102,23 +104,23 @@ export declare const RenderInternals: {
102
104
  };
103
105
  registerErrorSymbolicationLock: () => number;
104
106
  unlockErrorSymbolicationLock: (id: number) => void;
105
- canUseParallelEncoding: (codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif") => boolean;
107
+ canUseParallelEncoding: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => boolean;
106
108
  mimeContentType: typeof mimeContentType;
107
109
  mimeLookup: typeof mimeLookup;
108
110
  validateConcurrency: (value: unknown, setting: string) => void;
109
111
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
110
112
  DEFAULT_BROWSER: import("./browser").Browser;
111
113
  validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
112
- DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | null;
113
- validateOpenGlRenderer: (option: "swangle" | "angle" | "egl" | "swiftshader" | null) => "swangle" | "angle" | "egl" | "swiftshader" | null;
114
+ DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | null;
115
+ validateOpenGlRenderer: (option: "angle" | "swangle" | "egl" | "swiftshader" | null) => "angle" | "swangle" | "egl" | "swiftshader" | null;
114
116
  validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
115
117
  DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
116
118
  validateJpegQuality: (q: number | undefined) => void;
117
119
  DEFAULT_TIMEOUT: number;
118
- DEFAULT_CODEC: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif";
119
- isAudioCodec: (codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
120
+ DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
121
+ isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
120
122
  logLevels: readonly ["verbose", "info", "warn", "error"];
121
- isEqualOrBelowLogLevel: (currentLevel: "verbose" | "info" | "warn" | "error", level: "verbose" | "info" | "warn" | "error") => boolean;
123
+ isEqualOrBelowLogLevel: (currentLevel: "error" | "verbose" | "info" | "warn", level: "error" | "verbose" | "info" | "warn") => boolean;
122
124
  isValidLogLevel: (level: string) => boolean;
123
125
  perf: typeof perf;
124
126
  makeDownloadMap: () => import("./assets/download-map").DownloadMap;
@@ -135,92 +137,92 @@ export declare const RenderInternals: {
135
137
  output: string;
136
138
  onProgress: (p: number) => void;
137
139
  numberOfFrames: number;
138
- codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif";
140
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
139
141
  fps: number;
140
142
  numberOfGifLoops: number | null;
141
- audioCodec: "pcm-16" | "aac" | "mp3" | "opus" | null;
143
+ audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
142
144
  }) => Promise<void>;
143
145
  getMinConcurrency: () => number;
144
146
  getMaxConcurrency: () => any;
145
147
  getDefaultAudioCodec: ({ codec, preferLossless, }: {
146
- codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif";
148
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
147
149
  preferLossless: boolean;
148
- }) => "pcm-16" | "aac" | "mp3" | "opus" | null;
150
+ }) => "mp3" | "aac" | "pcm-16" | "opus" | null;
149
151
  validAudioCodecs: readonly ["pcm-16", "aac", "mp3", "opus"];
150
152
  defaultFileExtensionMap: {
151
- aac: {
153
+ h264: {
152
154
  default: import("./file-extensions").FileExtension;
153
155
  forAudioCodec: {
154
- "pcm-16": {
156
+ aac: {
155
157
  possible: import("./file-extensions").FileExtension[];
156
158
  default: import("./file-extensions").FileExtension;
157
159
  };
158
- aac: {
160
+ "pcm-16": {
159
161
  possible: import("./file-extensions").FileExtension[];
160
162
  default: import("./file-extensions").FileExtension;
161
163
  };
162
164
  };
163
165
  };
164
- mp3: {
166
+ h265: {
165
167
  default: import("./file-extensions").FileExtension;
166
168
  forAudioCodec: {
167
- "pcm-16": {
169
+ aac: {
168
170
  possible: import("./file-extensions").FileExtension[];
169
171
  default: import("./file-extensions").FileExtension;
170
172
  };
171
- mp3: {
173
+ "pcm-16": {
172
174
  possible: import("./file-extensions").FileExtension[];
173
175
  default: import("./file-extensions").FileExtension;
174
176
  };
175
177
  };
176
178
  };
177
- h264: {
179
+ vp8: {
178
180
  default: import("./file-extensions").FileExtension;
179
181
  forAudioCodec: {
180
182
  "pcm-16": {
181
183
  possible: import("./file-extensions").FileExtension[];
182
184
  default: import("./file-extensions").FileExtension;
183
185
  };
184
- aac: {
186
+ opus: {
185
187
  possible: import("./file-extensions").FileExtension[];
186
188
  default: import("./file-extensions").FileExtension;
187
189
  };
188
190
  };
189
191
  };
190
- h265: {
192
+ vp9: {
191
193
  default: import("./file-extensions").FileExtension;
192
194
  forAudioCodec: {
193
195
  "pcm-16": {
194
196
  possible: import("./file-extensions").FileExtension[];
195
197
  default: import("./file-extensions").FileExtension;
196
198
  };
197
- aac: {
199
+ opus: {
198
200
  possible: import("./file-extensions").FileExtension[];
199
201
  default: import("./file-extensions").FileExtension;
200
202
  };
201
203
  };
202
204
  };
203
- vp8: {
205
+ mp3: {
204
206
  default: import("./file-extensions").FileExtension;
205
207
  forAudioCodec: {
206
- "pcm-16": {
208
+ mp3: {
207
209
  possible: import("./file-extensions").FileExtension[];
208
210
  default: import("./file-extensions").FileExtension;
209
211
  };
210
- opus: {
212
+ "pcm-16": {
211
213
  possible: import("./file-extensions").FileExtension[];
212
214
  default: import("./file-extensions").FileExtension;
213
215
  };
214
216
  };
215
217
  };
216
- vp9: {
218
+ aac: {
217
219
  default: import("./file-extensions").FileExtension;
218
220
  forAudioCodec: {
219
- "pcm-16": {
221
+ aac: {
220
222
  possible: import("./file-extensions").FileExtension[];
221
223
  default: import("./file-extensions").FileExtension;
222
224
  };
223
- opus: {
225
+ "pcm-16": {
224
226
  possible: import("./file-extensions").FileExtension[];
225
227
  default: import("./file-extensions").FileExtension;
226
228
  };
@@ -238,11 +240,11 @@ export declare const RenderInternals: {
238
240
  prores: {
239
241
  default: import("./file-extensions").FileExtension;
240
242
  forAudioCodec: {
241
- "pcm-16": {
243
+ aac: {
242
244
  possible: import("./file-extensions").FileExtension[];
243
245
  default: import("./file-extensions").FileExtension;
244
246
  };
245
- aac: {
247
+ "pcm-16": {
246
248
  possible: import("./file-extensions").FileExtension[];
247
249
  default: import("./file-extensions").FileExtension;
248
250
  };
@@ -279,8 +281,8 @@ export declare const RenderInternals: {
279
281
  readonly vp9: readonly ["opus", "pcm-16"];
280
282
  readonly wav: readonly ["pcm-16"];
281
283
  };
282
- makeFileExtensionMap: () => Record<string, ("aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif")[]>;
283
- defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif">;
284
+ makeFileExtensionMap: () => Record<string, ("h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif")[]>;
285
+ defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">;
284
286
  getExecutablePath: (type: "compositor" | "ffmpeg" | "ffprobe" | "ffmpeg-cwd") => string;
285
287
  callFf: (bin: "ffmpeg" | "ffprobe", args: (string | null)[], options?: execa.Options<string> | undefined) => execa.ExecaChildProcess<string>;
286
288
  dynamicLibraryPathOptions: () => {
@@ -297,6 +299,79 @@ export declare const RenderInternals: {
297
299
  };
298
300
  validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
299
301
  validVideoImageFormats: readonly ["png", "jpeg", "none"];
300
- DEFAULT_STILL_IMAGE_FORMAT: "png" | "jpeg" | "pdf" | "webp";
301
- DEFAULT_VIDEO_IMAGE_FORMAT: "png" | "jpeg" | "none";
302
+ DEFAULT_STILL_IMAGE_FORMAT: "jpeg" | "png" | "webp" | "pdf";
303
+ DEFAULT_VIDEO_IMAGE_FORMAT: "jpeg" | "png" | "none";
304
+ chalk: {
305
+ enabled: boolean;
306
+ visible: boolean;
307
+ styles: Record<string, {
308
+ codes: [number, number];
309
+ name: string;
310
+ wrap?: ((input: string, newline: boolean) => string) | undefined;
311
+ }>;
312
+ keys: Record<string, string[]>;
313
+ alias?: ((name: string, col: string) => void) | undefined;
314
+ } & {
315
+ reset: (str: string) => string;
316
+ bold: (str: string) => string;
317
+ dim: (str: string) => string;
318
+ italic: (str: string) => string;
319
+ underline: (str: string) => string;
320
+ inverse: (str: string) => string;
321
+ hidden: (str: string) => string;
322
+ strikethrough: (str: string) => string;
323
+ black: (str: string) => string;
324
+ red: (str: string) => string;
325
+ green: (str: string) => string;
326
+ yellow: (str: string) => string;
327
+ blue: (str: string) => string;
328
+ magenta: (str: string) => string;
329
+ white: (str: string) => string;
330
+ gray: (str: string) => string;
331
+ bgBlack: (str: string) => string;
332
+ bgRed: (str: string) => string;
333
+ bgGreen: (str: string) => string;
334
+ bgYellow: (str: string) => string;
335
+ bgBlue: (str: string) => string;
336
+ bgMagenta: (str: string) => string;
337
+ bgWhite: (str: string) => string;
338
+ blackBright: (str: string) => string;
339
+ redBright: (str: string) => string;
340
+ greenBright: (str: string) => string;
341
+ yellowBright: (str: string) => string;
342
+ blueBright: (str: string) => string;
343
+ magentaBright: (str: string) => string;
344
+ whiteBright: (str: string) => string;
345
+ bgBlackBright: (str: string) => string;
346
+ bgRedBright: (str: string) => string;
347
+ bgGreenBright: (str: string) => string;
348
+ bgYellowBright: (str: string) => string;
349
+ bgBlueBright: (str: string) => string;
350
+ bgMagentaBright: (str: string) => string;
351
+ bgWhiteBright: (str: string) => string;
352
+ };
353
+ Log: {
354
+ verbose: (message?: any, ...optionalParams: any[]) => void;
355
+ verboseAdvanced: (options: {
356
+ indent: boolean;
357
+ logLevel: "error" | "verbose" | "info" | "warn";
358
+ } & {
359
+ tag?: string | undefined;
360
+ }, message?: any, ...optionalParams: any[]) => void;
361
+ info: (message?: any, ...optionalParams: any[]) => void;
362
+ infoAdvanced: (options: {
363
+ indent: boolean;
364
+ logLevel: "error" | "verbose" | "info" | "warn";
365
+ }, message?: any, ...optionalParams: any[]) => void;
366
+ warn: (message?: any, ...optionalParams: any[]) => void;
367
+ warnAdvanced: (options: {
368
+ indent: boolean;
369
+ logLevel: "error" | "verbose" | "info" | "warn";
370
+ }, message?: any, ...optionalParams: any[]) => void;
371
+ error: (message?: any, ...optionalParams: any[]) => void;
372
+ };
373
+ getLogLevel: () => "error" | "verbose" | "info" | "warn";
374
+ setLogLevel: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
375
+ INDENT_TOKEN: string;
376
+ isColorSupported: boolean;
302
377
  };
package/dist/index.js CHANGED
@@ -35,6 +35,8 @@ const browser_1 = require("./browser");
35
35
  const TimeoutSettings_1 = require("./browser/TimeoutSettings");
36
36
  const call_ffmpeg_1 = require("./call-ffmpeg");
37
37
  const can_use_parallel_encoding_1 = require("./can-use-parallel-encoding");
38
+ const chalk_1 = require("./chalk");
39
+ const is_color_supported_1 = require("./chalk/is-color-supported");
38
40
  const check_apple_silicon_1 = require("./check-apple-silicon");
39
41
  const codec_1 = require("./codec");
40
42
  const combine_videos_1 = require("./combine-videos");
@@ -59,6 +61,7 @@ const is_audio_codec_1 = require("./is-audio-codec");
59
61
  const is_serve_url_1 = require("./is-serve-url");
60
62
  const jpeg_quality_1 = require("./jpeg-quality");
61
63
  const log_level_1 = require("./log-level");
64
+ const logger_1 = require("./logger");
62
65
  const mime_types_1 = require("./mime-types");
63
66
  const open_browser_1 = require("./open-browser");
64
67
  const parse_browser_error_stack_1 = require("./parse-browser-error-stack");
@@ -157,6 +160,12 @@ exports.RenderInternals = {
157
160
  validVideoImageFormats: image_format_1.validVideoImageFormats,
158
161
  DEFAULT_STILL_IMAGE_FORMAT: image_format_1.DEFAULT_STILL_IMAGE_FORMAT,
159
162
  DEFAULT_VIDEO_IMAGE_FORMAT: image_format_1.DEFAULT_VIDEO_IMAGE_FORMAT,
163
+ chalk: chalk_1.chalk,
164
+ Log: logger_1.Log,
165
+ getLogLevel: logger_1.getLogLevel,
166
+ setLogLevel: logger_1.setLogLevel,
167
+ INDENT_TOKEN: logger_1.INDENT_TOKEN,
168
+ isColorSupported: is_color_supported_1.isColorSupported,
160
169
  };
161
170
  // Warn of potential performance issues with Apple Silicon (M1 chip under Rosetta)
162
171
  (0, check_apple_silicon_1.checkNodeVersionAndWarnAboutRosetta)();
@@ -0,0 +1,22 @@
1
+ import type { LogLevel } from './log-level';
2
+ export declare const INDENT_TOKEN: string;
3
+ declare type LogOptions = {
4
+ indent: boolean;
5
+ logLevel: LogLevel;
6
+ };
7
+ declare type VerboseLogOptions = LogOptions & {
8
+ tag?: string;
9
+ };
10
+ export declare const verboseTag: (str: string) => string;
11
+ export declare const Log: {
12
+ verbose: (message?: any, ...optionalParams: any[]) => void;
13
+ verboseAdvanced: (options: VerboseLogOptions, message?: any, ...optionalParams: any[]) => void;
14
+ info: (message?: any, ...optionalParams: any[]) => void;
15
+ infoAdvanced: (options: LogOptions, message?: any, ...optionalParams: any[]) => void;
16
+ warn: (message?: any, ...optionalParams: any[]) => void;
17
+ warnAdvanced: (options: LogOptions, message?: any, ...optionalParams: any[]) => void;
18
+ error: (message?: any, ...optionalParams: any[]) => void;
19
+ };
20
+ export declare const getLogLevel: () => "error" | "verbose" | "info" | "warn";
21
+ export declare const setLogLevel: (newLogLevel: LogLevel) => void;
22
+ export {};
package/dist/logger.js ADDED
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setLogLevel = exports.getLogLevel = exports.Log = exports.verboseTag = exports.INDENT_TOKEN = void 0;
4
+ const chalk_1 = require("./chalk");
5
+ const is_color_supported_1 = require("./chalk/is-color-supported");
6
+ const log_level_1 = require("./log-level");
7
+ const truthy_1 = require("./truthy");
8
+ exports.INDENT_TOKEN = chalk_1.chalk.gray('│');
9
+ const verboseTag = (str) => {
10
+ return is_color_supported_1.isColorSupported
11
+ ? chalk_1.chalk.bgBlack(` ${str.toUpperCase()} `)
12
+ : `[${str.toUpperCase()}]`;
13
+ };
14
+ exports.verboseTag = verboseTag;
15
+ exports.Log = {
16
+ verbose: (...args) => {
17
+ exports.Log.verboseAdvanced({ indent: false, logLevel: (0, exports.getLogLevel)() }, ...args);
18
+ },
19
+ verboseAdvanced: (options, ...args) => {
20
+ if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'verbose')) {
21
+ return console.log(...[
22
+ options.indent ? exports.INDENT_TOKEN : null,
23
+ options.tag ? (0, exports.verboseTag)(options.tag) : null,
24
+ ...args.map((a) => chalk_1.chalk.gray(a)),
25
+ ].filter(truthy_1.truthy));
26
+ }
27
+ },
28
+ info: (...args) => {
29
+ exports.Log.infoAdvanced({ indent: false, logLevel: (0, exports.getLogLevel)() }, ...args);
30
+ },
31
+ infoAdvanced: (options, ...args) => {
32
+ if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'info')) {
33
+ return console.log(...[options.indent ? exports.INDENT_TOKEN : null, ...args].filter(truthy_1.truthy));
34
+ }
35
+ },
36
+ warn: (...args) => {
37
+ exports.Log.warnAdvanced({ indent: false, logLevel: (0, exports.getLogLevel)() }, ...args);
38
+ },
39
+ warnAdvanced: (options, ...args) => {
40
+ if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'warn')) {
41
+ return console.warn(...[
42
+ options.indent ? chalk_1.chalk.yellow(exports.INDENT_TOKEN) : null,
43
+ ...args.map((a) => chalk_1.chalk.yellow(a)),
44
+ ].filter(truthy_1.truthy));
45
+ }
46
+ },
47
+ error: (...args) => {
48
+ if ((0, log_level_1.isEqualOrBelowLogLevel)((0, exports.getLogLevel)(), 'error')) {
49
+ return console.error(...args.map((a) => chalk_1.chalk.red(a)));
50
+ }
51
+ },
52
+ };
53
+ let logLevel = 'info';
54
+ const getLogLevel = () => {
55
+ return logLevel;
56
+ };
57
+ exports.getLogLevel = getLogLevel;
58
+ const setLogLevel = (newLogLevel) => {
59
+ logLevel = newLogLevel;
60
+ };
61
+ exports.setLogLevel = setLogLevel;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.mergeAudioTrack = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
8
  const call_ffmpeg_1 = require("./call-ffmpeg");
9
9
  const chunk_1 = require("./chunk");
10
10
  const create_ffmpeg_complex_filter_1 = require("./create-ffmpeg-complex-filter");
@@ -29,7 +29,7 @@ const mergeAudioTrackUnlimited = async ({ outName, files, numberOfSeconds, downl
29
29
  const tempPath = (0, tmp_dir_1.tmpDir)('remotion-large-audio-mixing');
30
30
  try {
31
31
  const chunkNames = await Promise.all(chunked.map(async (chunkFiles, i) => {
32
- const chunkOutname = path_1.default.join(tempPath, `chunk-${i}.wav`);
32
+ const chunkOutname = node_path_1.default.join(tempPath, `chunk-${i}.wav`);
33
33
  await (0, exports.mergeAudioTrack)({
34
34
  files: chunkFiles,
35
35
  numberOfSeconds,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mimeContentType = exports.mimeLookup = exports.getExt = void 0;
4
- const path_1 = require("path");
4
+ const node_path_1 = require("node:path");
5
5
  const mime_db_1 = require("./mime-db");
6
6
  const extensions = {};
7
7
  const types = {};
@@ -17,7 +17,7 @@ function mimeLookup(path) {
17
17
  return false;
18
18
  }
19
19
  // get the extension ("ext" or ".ext" or full path)
20
- const ext = (0, path_1.extname)('.' + path)
20
+ const ext = (0, node_path_1.extname)('.' + path)
21
21
  .toLowerCase()
22
22
  .substr(1);
23
23
  if (!ext) {
@@ -1,4 +1,4 @@
1
- import type { RequestListener } from 'http';
1
+ import type { RequestListener } from 'node:http';
2
2
  import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
3
3
  import type { DownloadMap } from './assets/download-map';
4
4
  export declare const extractUrlAndSourceFromUrl: (url: string) => {
@@ -6,12 +6,13 @@ export declare const extractUrlAndSourceFromUrl: (url: string) => {
6
6
  time: number;
7
7
  transparent: boolean;
8
8
  };
9
- export declare const startOffthreadVideoServer: ({ onDownload, onError, downloadMap, concurrency, verbose, }: {
9
+ export declare const startOffthreadVideoServer: ({ onDownload, onError, downloadMap, concurrency, verbose, indent, }: {
10
10
  onDownload: RenderMediaOnDownload;
11
11
  onError: (err: Error) => void;
12
12
  downloadMap: DownloadMap;
13
13
  concurrency: number;
14
14
  verbose: boolean;
15
+ indent: boolean;
15
16
  }) => {
16
17
  listener: RequestListener;
17
18
  close: () => Promise<void>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.startOffthreadVideoServer = exports.extractUrlAndSourceFromUrl = void 0;
4
- const url_1 = require("url");
4
+ const node_url_1 = require("node:url");
5
5
  const download_and_map_assets_to_file_1 = require("./assets/download-and-map-assets-to-file");
6
6
  const compositor_1 = require("./compositor/compositor");
7
7
  const extractUrlAndSourceFromUrl = (url) => {
@@ -10,7 +10,7 @@ const extractUrlAndSourceFromUrl = (url) => {
10
10
  if (!query.trim()) {
11
11
  throw new Error('Expected query from ' + url);
12
12
  }
13
- const params = new url_1.URLSearchParams(query);
13
+ const params = new node_url_1.URLSearchParams(query);
14
14
  const src = params.get('src');
15
15
  if (!src) {
16
16
  throw new Error('Did not pass `src` parameter');
@@ -27,12 +27,12 @@ const extractUrlAndSourceFromUrl = (url) => {
27
27
  };
28
28
  };
29
29
  exports.extractUrlAndSourceFromUrl = extractUrlAndSourceFromUrl;
30
- const startOffthreadVideoServer = ({ onDownload, onError, downloadMap, concurrency, verbose, }) => {
30
+ const startOffthreadVideoServer = ({ onDownload, onError, downloadMap, concurrency, verbose, indent, }) => {
31
31
  const compositor = (0, compositor_1.startCompositor)('StartLongRunningProcess', {
32
32
  concurrency,
33
33
  maximum_frame_cache_items: (0, compositor_1.getIdealMaximumFrameCacheItems)(),
34
34
  verbose,
35
- });
35
+ }, indent);
36
36
  return {
37
37
  close: () => {
38
38
  compositor.finishCommands();
@@ -21,6 +21,6 @@ export declare const openBrowser: (browser: Browser, options?: {
21
21
  chromiumOptions?: ChromiumOptions;
22
22
  forceDeviceScaleFactor?: number;
23
23
  viewport?: Viewport;
24
- indentationString?: string;
24
+ indent?: boolean;
25
25
  }) => Promise<PuppeteerBrowser>;
26
26
  export {};
@@ -43,7 +43,7 @@ const openBrowser = async (browser, options) => {
43
43
  executablePath,
44
44
  product: browser,
45
45
  dumpio: (_e = options === null || options === void 0 ? void 0 : options.shouldDumpIo) !== null && _e !== void 0 ? _e : false,
46
- indentationString: (_f = options === null || options === void 0 ? void 0 : options.indentationString) !== null && _f !== void 0 ? _f : '',
46
+ indent: (_f = options === null || options === void 0 ? void 0 : options.indent) !== null && _f !== void 0 ? _f : false,
47
47
  args: [
48
48
  'about:blank',
49
49
  '--allow-pre-commit-input',
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  exports.jpegQualityOption = {
6
6
  name: 'JPEG Quality',
7
7
  cliFlag: '--jpeg-quality',
8
- description: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Sets the quality of the generated JPEG images. Must be an integer between 0 and 100. Default is to leave it up to the browser, current default is 80." })),
8
+ description: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Sets the quality of the generated JPEG images. Must be an integer between 0 and 100. Default: 80." })),
9
9
  ssrName: 'jpegQuality',
10
10
  docLink: 'https://www.remotion.dev/docs/renderer/render-media#jpeg-quality',
11
11
  };
@@ -1,6 +1,6 @@
1
1
  import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
2
2
  import type { DownloadMap } from './assets/download-map';
3
- export declare const prepareServer: ({ onDownload, onError, webpackConfigOrServeUrl, port, downloadMap, remotionRoot, concurrency, verbose, }: {
3
+ export declare const prepareServer: ({ onDownload, onError, webpackConfigOrServeUrl, port, downloadMap, remotionRoot, concurrency, verbose, indent, }: {
4
4
  webpackConfigOrServeUrl: string;
5
5
  onDownload: RenderMediaOnDownload;
6
6
  onError: (err: Error) => void;
@@ -9,6 +9,7 @@ export declare const prepareServer: ({ onDownload, onError, webpackConfigOrServe
9
9
  remotionRoot: string;
10
10
  concurrency: number;
11
11
  verbose: boolean;
12
+ indent: boolean;
12
13
  }) => Promise<{
13
14
  serveUrl: string;
14
15
  closeServer: (force: boolean) => Promise<unknown>;
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.prepareServer = void 0;
7
- const fs_1 = require("fs");
8
- const path_1 = __importDefault(require("path"));
7
+ const node_fs_1 = require("node:fs");
8
+ const node_path_1 = __importDefault(require("node:path"));
9
9
  const is_serve_url_1 = require("./is-serve-url");
10
10
  const serve_static_1 = require("./serve-static");
11
11
  const wait_for_symbolication_error_to_be_done_1 = require("./wait-for-symbolication-error-to-be-done");
12
- const prepareServer = async ({ onDownload, onError, webpackConfigOrServeUrl, port, downloadMap, remotionRoot, concurrency, verbose, }) => {
12
+ const prepareServer = async ({ onDownload, onError, webpackConfigOrServeUrl, port, downloadMap, remotionRoot, concurrency, verbose, indent, }) => {
13
13
  if ((0, is_serve_url_1.isServeUrl)(webpackConfigOrServeUrl)) {
14
14
  const { port: offthreadPort, close: closeProxy } = await (0, serve_static_1.serveStatic)(null, {
15
15
  onDownload,
@@ -19,6 +19,7 @@ const prepareServer = async ({ onDownload, onError, webpackConfigOrServeUrl, por
19
19
  remotionRoot,
20
20
  concurrency,
21
21
  verbose,
22
+ indent,
22
23
  });
23
24
  return Promise.resolve({
24
25
  serveUrl: webpackConfigOrServeUrl,
@@ -29,8 +30,8 @@ const prepareServer = async ({ onDownload, onError, webpackConfigOrServeUrl, por
29
30
  });
30
31
  }
31
32
  // Check if the path has a `index.html` file
32
- const indexFile = path_1.default.join(webpackConfigOrServeUrl, 'index.html');
33
- const exists = (0, fs_1.existsSync)(indexFile);
33
+ const indexFile = node_path_1.default.join(webpackConfigOrServeUrl, 'index.html');
34
+ const exists = (0, node_fs_1.existsSync)(indexFile);
34
35
  if (!exists) {
35
36
  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?`);
36
37
  }
@@ -42,6 +43,7 @@ const prepareServer = async ({ onDownload, onError, webpackConfigOrServeUrl, por
42
43
  remotionRoot,
43
44
  concurrency,
44
45
  verbose,
46
+ indent,
45
47
  });
46
48
  return Promise.resolve({
47
49
  closeServer: async (force) => {