@remotion/bundler 4.0.0-alpha4 → 4.0.0-alpha6

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/bundle.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { WebpackOverrideFn } from 'remotion';
2
1
  import webpack from 'webpack';
2
+ import type { WebpackOverrideFn } from './webpack-config';
3
3
  export declare type LegacyBundleOptions = {
4
4
  webpackOverride?: WebpackOverrideFn;
5
5
  outDir?: string;
@@ -21,6 +21,7 @@ export declare type BundleOptions = {
21
21
  entryPoint: string;
22
22
  onProgress?: (progress: number) => void;
23
23
  ignoreRegisterRootWarning?: boolean;
24
+ onDirectoryCreated?: (dir: string) => void;
24
25
  } & LegacyBundleOptions;
25
26
  declare type Arguments = [options: BundleOptions] | [
26
27
  entryPoint: string,
package/dist/bundle.js CHANGED
@@ -27,23 +27,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.bundle = exports.getConfig = void 0;
30
- const fs_1 = __importStar(require("fs"));
31
- const os_1 = __importDefault(require("os"));
32
- const path_1 = __importDefault(require("path"));
33
- const util_1 = require("util");
30
+ const node_fs_1 = __importStar(require("node:fs"));
31
+ const node_os_1 = __importDefault(require("node:os"));
32
+ const node_path_1 = __importDefault(require("node:path"));
33
+ const node_util_1 = require("node:util");
34
+ const node_worker_threads_1 = require("node:worker_threads");
34
35
  const webpack_1 = __importDefault(require("webpack"));
35
- const worker_threads_1 = require("worker_threads");
36
36
  const copy_dir_1 = require("./copy-dir");
37
37
  const index_html_1 = require("./index-html");
38
38
  const read_recursively_1 = require("./read-recursively");
39
39
  const webpack_config_1 = require("./webpack-config");
40
- const promisified = (0, util_1.promisify)(webpack_1.default);
40
+ const promisified = (0, node_util_1.promisify)(webpack_1.default);
41
41
  const prepareOutDir = async (specified) => {
42
42
  if (specified) {
43
- await fs_1.default.promises.mkdir(specified, { recursive: true });
43
+ await node_fs_1.default.promises.mkdir(specified, { recursive: true });
44
44
  return specified;
45
45
  }
46
- return fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'remotion-webpack-bundle-'));
46
+ return node_fs_1.default.promises.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'remotion-webpack-bundle-'));
47
47
  };
48
48
  const trimLeadingSlash = (p) => {
49
49
  if (p.startsWith('/')) {
@@ -68,7 +68,7 @@ const getConfig = ({ entryPoint, outDir, resolvedRemotionRoot, onProgress, optio
68
68
  webpackOverride: (_a = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _a !== void 0 ? _a : ((f) => f),
69
69
  onProgress,
70
70
  enableCaching: (_b = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _b !== void 0 ? _b : true,
71
- maxTimelineTracks: 15,
71
+ maxTimelineTracks: 90,
72
72
  // For production, the variables are set dynamically
73
73
  envVariables: {},
74
74
  entryPoints: [],
@@ -100,17 +100,17 @@ const recursionLimit = 5;
100
100
  const findClosestPackageJsonFolder = (currentDir) => {
101
101
  let possiblePackageJson = '';
102
102
  for (let i = 0; i < recursionLimit; i++) {
103
- possiblePackageJson = path_1.default.join(currentDir, 'package.json');
104
- const exists = fs_1.default.existsSync(possiblePackageJson);
103
+ possiblePackageJson = node_path_1.default.join(currentDir, 'package.json');
104
+ const exists = node_fs_1.default.existsSync(possiblePackageJson);
105
105
  if (exists) {
106
- return path_1.default.dirname(possiblePackageJson);
106
+ return node_path_1.default.dirname(possiblePackageJson);
107
107
  }
108
- currentDir = path_1.default.dirname(currentDir);
108
+ currentDir = node_path_1.default.dirname(currentDir);
109
109
  }
110
110
  return null;
111
111
  };
112
112
  const validateEntryPoint = async (entryPoint) => {
113
- const contents = await fs_1.promises.readFile(entryPoint, 'utf8');
113
+ const contents = await node_fs_1.promises.readFile(entryPoint, 'utf8');
114
114
  if (!contents.includes('registerRoot')) {
115
115
  throw new Error([
116
116
  `You passed ${entryPoint} as your entry point, but this file does not contain "registerRoot".`,
@@ -125,19 +125,20 @@ const validateEntryPoint = async (entryPoint) => {
125
125
  * @see [Documentation](https://www.remotion.dev/docs/bundle)
126
126
  */
127
127
  async function bundle(...args) {
128
- var _a, _b, _c, _d;
128
+ var _a, _b, _c, _d, _e;
129
129
  const actualArgs = convertArgumentsIntoOptions(args);
130
- const entryPoint = path_1.default.resolve(process.cwd(), actualArgs.entryPoint);
130
+ const entryPoint = node_path_1.default.resolve(process.cwd(), actualArgs.entryPoint);
131
131
  const resolvedRemotionRoot = (_b = (_a = actualArgs === null || actualArgs === void 0 ? void 0 : actualArgs.rootDir) !== null && _a !== void 0 ? _a : findClosestPackageJsonFolder(entryPoint)) !== null && _b !== void 0 ? _b : process.cwd();
132
132
  if (!actualArgs.ignoreRegisterRootWarning) {
133
133
  await validateEntryPoint(entryPoint);
134
134
  }
135
135
  const outDir = await prepareOutDir((_c = actualArgs === null || actualArgs === void 0 ? void 0 : actualArgs.outDir) !== null && _c !== void 0 ? _c : null);
136
+ (_d = actualArgs.onDirectoryCreated) === null || _d === void 0 ? void 0 : _d.call(actualArgs, outDir);
136
137
  // The config might use an override which might use
137
138
  // `process.cwd()`. The context should always be the Remotion root.
138
139
  // This is not supported in worker threads (used for tests)
139
140
  const currentCwd = process.cwd();
140
- if (worker_threads_1.isMainThread) {
141
+ if (node_worker_threads_1.isMainThread) {
141
142
  process.chdir(resolvedRemotionRoot);
142
143
  }
143
144
  const { onProgress, ...options } = actualArgs;
@@ -149,7 +150,7 @@ async function bundle(...args) {
149
150
  options,
150
151
  });
151
152
  const output = await promisified([config]);
152
- if (worker_threads_1.isMainThread) {
153
+ if (node_worker_threads_1.isMainThread) {
153
154
  process.chdir(currentCwd);
154
155
  }
155
156
  if (!output) {
@@ -159,21 +160,21 @@ async function bundle(...args) {
159
160
  if (errors !== undefined && errors.length > 0) {
160
161
  throw new Error(errors[0].message + '\n' + errors[0].details);
161
162
  }
162
- const baseDir = (_d = actualArgs === null || actualArgs === void 0 ? void 0 : actualArgs.publicPath) !== null && _d !== void 0 ? _d : '/';
163
+ const baseDir = (_e = actualArgs === null || actualArgs === void 0 ? void 0 : actualArgs.publicPath) !== null && _e !== void 0 ? _e : '/';
163
164
  const staticHash = '/' +
164
165
  [trimTrailingSlash(trimLeadingSlash(baseDir)), 'public']
165
166
  .filter(Boolean)
166
167
  .join('/');
167
168
  const from = (options === null || options === void 0 ? void 0 : options.publicDir)
168
- ? path_1.default.resolve(resolvedRemotionRoot, options.publicDir)
169
- : path_1.default.join(resolvedRemotionRoot, 'public');
170
- const to = path_1.default.join(outDir, 'public');
169
+ ? node_path_1.default.resolve(resolvedRemotionRoot, options.publicDir)
170
+ : node_path_1.default.join(resolvedRemotionRoot, 'public');
171
+ const to = node_path_1.default.join(outDir, 'public');
171
172
  let symlinkWarningShown = false;
172
173
  const showSymlinkWarning = (ent, src) => {
173
174
  if (symlinkWarningShown) {
174
175
  return;
175
176
  }
176
- const absolutePath = path_1.default.join(src, ent.name);
177
+ const absolutePath = node_path_1.default.join(src, ent.name);
177
178
  if (options.onSymlinkDetected) {
178
179
  options.onSymlinkDetected(absolutePath);
179
180
  return;
@@ -181,12 +182,13 @@ async function bundle(...args) {
181
182
  symlinkWarningShown = true;
182
183
  console.warn(`\nFound a symbolic link in the public folder (${absolutePath}). The symlink will be forwarded into the bundle.`);
183
184
  };
184
- if (fs_1.default.existsSync(from)) {
185
+ if (node_fs_1.default.existsSync(from)) {
185
186
  await (0, copy_dir_1.copyDir)({
186
187
  src: from,
187
188
  dest: to,
188
189
  onSymlinkDetected: showSymlinkWarning,
189
190
  onProgress: (prog) => { var _a; return (_a = options.onPublicDirCopyProgress) === null || _a === void 0 ? void 0 : _a.call(options, prog); },
191
+ copied: 0,
190
192
  });
191
193
  }
192
194
  const html = (0, index_html_1.indexHtml)({
@@ -196,6 +198,7 @@ async function bundle(...args) {
196
198
  inputProps: null,
197
199
  remotionRoot: resolvedRemotionRoot,
198
200
  previewServerCommand: null,
201
+ renderQueue: null,
199
202
  numberOfAudioTags: 0,
200
203
  publicFiles: (0, read_recursively_1.readRecursively)({
201
204
  folder: '.',
@@ -205,8 +208,9 @@ async function bundle(...args) {
205
208
  }),
206
209
  includeFavicon: false,
207
210
  title: 'Remotion Bundle',
211
+ renderDefaults: undefined,
208
212
  });
209
- fs_1.default.writeFileSync(path_1.default.join(outDir, 'index.html'), html);
213
+ node_fs_1.default.writeFileSync(node_path_1.default.join(outDir, 'index.html'), html);
210
214
  return outDir;
211
215
  }
212
216
  exports.bundle = bundle;
@@ -1,8 +1,9 @@
1
1
  /// <reference types="node" />
2
- import fs from 'fs';
3
- export declare function copyDir({ src, dest, onSymlinkDetected, onProgress, }: {
2
+ import fs from 'node:fs';
3
+ export declare function copyDir({ src, dest, onSymlinkDetected, onProgress, copied, }: {
4
4
  src: string;
5
5
  dest: string;
6
6
  onSymlinkDetected: (entry: fs.Dirent, dir: string) => void;
7
7
  onProgress: (bytes: number) => void;
8
+ copied: number;
8
9
  }): Promise<void>;
package/dist/copy-dir.js CHANGED
@@ -4,32 +4,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.copyDir = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- async function copyDir({ src, dest, onSymlinkDetected, onProgress, }) {
10
- await fs_1.default.promises.mkdir(dest, { recursive: true });
11
- const entries = await fs_1.default.promises.readdir(src, { withFileTypes: true });
12
- let copied = 0;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ async function copyDir({ src, dest, onSymlinkDetected, onProgress, copied = 0, }) {
10
+ await node_fs_1.default.promises.mkdir(dest, { recursive: true });
11
+ const entries = await node_fs_1.default.promises.readdir(src, { withFileTypes: true });
13
12
  for (const entry of entries) {
14
- const srcPath = path_1.default.join(src, entry.name);
15
- const destPath = path_1.default.join(dest, entry.name);
13
+ const srcPath = node_path_1.default.join(src, entry.name);
14
+ const destPath = node_path_1.default.join(dest, entry.name);
16
15
  if (entry.isDirectory()) {
17
16
  await copyDir({
18
17
  src: srcPath,
19
18
  dest: destPath,
20
19
  onSymlinkDetected,
21
20
  onProgress,
21
+ copied,
22
22
  });
23
23
  }
24
24
  else if (entry.isSymbolicLink()) {
25
- const realpath = await fs_1.default.promises.realpath(srcPath);
25
+ const realpath = await node_fs_1.default.promises.realpath(srcPath);
26
26
  onSymlinkDetected(entry, src);
27
- await fs_1.default.promises.symlink(realpath, destPath);
27
+ await node_fs_1.default.promises.symlink(realpath, destPath);
28
28
  }
29
29
  else {
30
30
  const [, { size }] = await Promise.all([
31
- fs_1.default.promises.copyFile(srcPath, destPath),
32
- fs_1.default.promises.stat(srcPath),
31
+ node_fs_1.default.promises.copyFile(srcPath, destPath),
32
+ node_fs_1.default.promises.stat(srcPath),
33
33
  ]);
34
34
  copied += size;
35
35
  onProgress(copied);
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const esbuild_1 = require("esbuild");
7
- const path_1 = __importDefault(require("path"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
8
  const isTsExtensionPtrn = /\.ts$/i;
9
9
  const isTypescriptInstalled = () => {
10
10
  try {
@@ -21,7 +21,7 @@ async function ESBuildLoader(source) {
21
21
  this.getOptions();
22
22
  const options = this.getOptions();
23
23
  const { implementation, ...esbuildTransformOptions } = options;
24
- const tsConfigPath = path_1.default.join(this.context, 'tsconfig.json');
24
+ const tsConfigPath = node_path_1.default.join(this.context, 'tsconfig.json');
25
25
  if (implementation && typeof implementation.transform !== 'function') {
26
26
  done(new TypeError(`esbuild-loader: options.implementation.transform must be an ESBuild transform function. Received ${typeof implementation.transform}`));
27
27
  return;
@@ -1,5 +1,35 @@
1
1
  import type { StaticFile } from 'remotion';
2
- export declare const indexHtml: ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, previewServerCommand, numberOfAudioTags, publicFiles, includeFavicon, title, }: {
2
+ export declare type RenderDefaults = {
3
+ jpegQuality: number;
4
+ scale: number;
5
+ logLevel: string;
6
+ codec: string;
7
+ concurrency: number;
8
+ minConcurrency: number;
9
+ muted: boolean;
10
+ maxConcurrency: number;
11
+ stillImageFormat: 'png' | 'jpeg' | 'webp' | 'pdf';
12
+ videoImageFormat: 'png' | 'jpeg' | 'none';
13
+ audioCodec: string | null;
14
+ enforceAudioTrack: boolean;
15
+ proResProfile: string;
16
+ pixelFormat: string;
17
+ audioBitrate: string | null;
18
+ videoBitrate: string | null;
19
+ everyNthFrame: number;
20
+ numberOfGifLoops: number | null;
21
+ delayRenderTimeout: number;
22
+ disableWebSecurity: boolean;
23
+ openGlRenderer: string | null;
24
+ ignoreCertificateErrors: boolean;
25
+ headless: boolean;
26
+ };
27
+ declare global {
28
+ interface Window {
29
+ remotion_renderDefaults: RenderDefaults | undefined;
30
+ }
31
+ }
32
+ export declare const indexHtml: ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, previewServerCommand, renderQueue, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, }: {
3
33
  staticHash: string;
4
34
  baseDir: string;
5
35
  editorName: string | null;
@@ -7,8 +37,10 @@ export declare const indexHtml: ({ baseDir, editorName, inputProps, envVariables
7
37
  envVariables?: Record<string, string> | undefined;
8
38
  remotionRoot: string;
9
39
  previewServerCommand: string | null;
40
+ renderQueue: unknown | null;
10
41
  numberOfAudioTags: number;
11
42
  publicFiles: StaticFile[];
12
43
  includeFavicon: boolean;
13
44
  title: string;
45
+ renderDefaults: RenderDefaults | undefined;
14
46
  }) => string;
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.indexHtml = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const indexHtml = ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, previewServerCommand, numberOfAudioTags, publicFiles, includeFavicon, title, }) => `
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const indexHtml = ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, previewServerCommand, renderQueue, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, }) => `
9
9
  <!DOCTYPE html>
10
10
  <html lang="en">
11
11
  <head>
@@ -25,12 +25,17 @@ ${includeFavicon
25
25
  ${editorName
26
26
  ? `<script>window.remotion_editorName = "${editorName}";</script>`
27
27
  : '<script>window.remotion_editorName = null;</script>'}
28
- <script>window.remotion_projectName = ${JSON.stringify(path_1.default.basename(remotionRoot))};</script>
28
+ <script>window.remotion_projectName = ${JSON.stringify(node_path_1.default.basename(remotionRoot))};</script>
29
+ <script>window.remotion_renderDefaults = ${JSON.stringify(renderDefaults)};</script>
29
30
  <script>window.remotion_cwd = ${JSON.stringify(remotionRoot)};</script>
30
31
  <script>window.remotion_previewServerCommand = ${previewServerCommand ? JSON.stringify(previewServerCommand) : 'null'};</script>
31
32
  ${inputProps
32
33
  ? `<script>window.remotion_inputProps = ${JSON.stringify(JSON.stringify(inputProps))};</script>
33
34
  `
35
+ : ''}
36
+ ${renderQueue
37
+ ? `<script>window.remotion_initialRenderQueue = ${JSON.stringify(renderQueue)};</script>
38
+ `
34
39
  : ''}
35
40
  ${envVariables
36
41
  ? `<script> window.process = {
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export declare const BundlerInternals: {
7
7
  userDefinedComponent: string;
8
8
  outDir: string | null;
9
9
  environment: "development" | "production";
10
- webpackOverride: import("remotion").WebpackOverrideFn;
10
+ webpackOverride: import("./webpack-config").WebpackOverrideFn;
11
11
  onProgress?: ((f: number) => void) | undefined;
12
12
  enableCaching?: boolean | undefined;
13
13
  envVariables: Record<string, string>;
@@ -17,7 +17,7 @@ export declare const BundlerInternals: {
17
17
  remotionRoot: string;
18
18
  poll: number | null;
19
19
  }) => [string, webpack.Configuration];
20
- indexHtml: ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, previewServerCommand, numberOfAudioTags, publicFiles, includeFavicon, title, }: {
20
+ indexHtml: ({ baseDir, editorName, inputProps, envVariables, staticHash, remotionRoot, previewServerCommand, renderQueue, numberOfAudioTags, publicFiles, includeFavicon, title, renderDefaults, }: {
21
21
  staticHash: string;
22
22
  baseDir: string;
23
23
  editorName: string | null;
@@ -25,10 +25,12 @@ export declare const BundlerInternals: {
25
25
  envVariables?: Record<string, string> | undefined;
26
26
  remotionRoot: string;
27
27
  previewServerCommand: string | null;
28
+ renderQueue: unknown;
28
29
  numberOfAudioTags: number;
29
30
  publicFiles: import("remotion").StaticFile[];
30
31
  includeFavicon: boolean;
31
32
  title: string;
33
+ renderDefaults: import("./index-html").RenderDefaults | undefined;
32
34
  }) => string;
33
35
  cacheExists: (remotionRoot: string, environment: "development" | "production", hash: string) => "exists" | "other-exists" | "does-not-exist";
34
36
  clearCache: (remotionRoot: string) => Promise<void>;
@@ -47,6 +49,6 @@ export declare const BundlerInternals: {
47
49
  limit: number;
48
50
  }) => import("remotion").StaticFile[];
49
51
  };
50
- export { WebpackConfiguration, WebpackOverrideFn } from 'remotion';
51
52
  export { bundle, BundleOptions, LegacyBundleOptions } from './bundle';
53
+ export { WebpackConfiguration, WebpackOverrideFn } from './webpack-config';
52
54
  export { webpack };
@@ -0,0 +1,6 @@
1
+ import type { Compiler } from 'webpack';
2
+ export declare const OPTIONAL_DEPENDENCIES: string[];
3
+ export declare class AllowOptionalDependenciesPlugin {
4
+ filter(error: Error): boolean;
5
+ apply(compiler: Compiler): void;
6
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // When Webpack cannot resolve these dependencies, it will not print an error message.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AllowOptionalDependenciesPlugin = exports.OPTIONAL_DEPENDENCIES = void 0;
5
+ exports.OPTIONAL_DEPENDENCIES = ['zod', '@remotion/zod-types'];
6
+ class AllowOptionalDependenciesPlugin {
7
+ filter(error) {
8
+ for (const dependency of exports.OPTIONAL_DEPENDENCIES) {
9
+ if (error.message.includes(`Can't resolve '${dependency}'`)) {
10
+ return false;
11
+ }
12
+ }
13
+ return true;
14
+ }
15
+ apply(compiler) {
16
+ compiler.hooks.afterEmit.tap('AllowOptionalDependenciesPlugin', (compilation) => {
17
+ compilation.errors = compilation.errors.filter(this.filter);
18
+ compilation.warnings = compilation.warnings.filter(this.filter);
19
+ });
20
+ }
21
+ }
22
+ exports.AllowOptionalDependenciesPlugin = AllowOptionalDependenciesPlugin;
@@ -27,14 +27,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.readRecursively = void 0;
30
- const fs_1 = __importStar(require("fs"));
31
- const path_1 = __importDefault(require("path"));
30
+ const node_fs_1 = __importStar(require("node:fs"));
31
+ const node_path_1 = __importDefault(require("node:path"));
32
32
  const readRecursively = ({ folder, output = [], startPath, staticHash, limit, }) => {
33
- const absFolder = path_1.default.join(startPath, folder);
34
- if (!fs_1.default.existsSync(absFolder)) {
33
+ const absFolder = node_path_1.default.join(startPath, folder);
34
+ if (!node_fs_1.default.existsSync(absFolder)) {
35
35
  return [];
36
36
  }
37
- const files = fs_1.default.readdirSync(absFolder);
37
+ const files = node_fs_1.default.readdirSync(absFolder);
38
38
  for (const file of files) {
39
39
  if (output.length >= limit) {
40
40
  break;
@@ -42,11 +42,11 @@ const readRecursively = ({ folder, output = [], startPath, staticHash, limit, })
42
42
  if (file.startsWith('.DS_Store')) {
43
43
  continue;
44
44
  }
45
- const stat = (0, fs_1.statSync)(path_1.default.join(absFolder, file));
45
+ const stat = (0, node_fs_1.statSync)(node_path_1.default.join(absFolder, file));
46
46
  if (stat.isDirectory()) {
47
47
  (0, exports.readRecursively)({
48
48
  startPath,
49
- folder: path_1.default.join(folder, file),
49
+ folder: node_path_1.default.join(folder, file),
50
50
  output,
51
51
  staticHash,
52
52
  limit,
@@ -54,15 +54,15 @@ const readRecursively = ({ folder, output = [], startPath, staticHash, limit, })
54
54
  }
55
55
  else if (stat.isFile()) {
56
56
  output.push({
57
- name: path_1.default.join(folder, file),
57
+ name: node_path_1.default.join(folder, file),
58
58
  lastModified: Math.floor(stat.mtimeMs),
59
59
  sizeInBytes: stat.size,
60
- src: staticHash + '/' + path_1.default.join(folder, file),
60
+ src: staticHash + '/' + node_path_1.default.join(folder, file),
61
61
  });
62
62
  }
63
63
  else if (stat.isSymbolicLink()) {
64
- const realpath = fs_1.default.realpathSync(path_1.default.join(folder, file));
65
- const realStat = fs_1.default.statSync(realpath);
64
+ const realpath = node_fs_1.default.realpathSync(node_path_1.default.join(folder, file));
65
+ const realStat = node_fs_1.default.statSync(realpath);
66
66
  if (realStat.isFile()) {
67
67
  output.push({
68
68
  name: realpath,
@@ -16,4 +16,54 @@ remotion_1.Internals.CSSUtils.injectCSS(`
16
16
  font-size: 15px;
17
17
  line-height: 1.25;
18
18
  }
19
+
20
+ .__remotion-info-button-container code {
21
+ font-family: monospace;
22
+ font-size: 14px;
23
+ color: #0584f2
24
+ }
25
+
26
+ .__remotion-vertical-scrollbar::-webkit-scrollbar {
27
+ width: 6px;
28
+ }
29
+ .__remotion-vertical-scrollbar::-webkit-scrollbar-thumb {
30
+ background-color: rgba(0, 0, 0, 0.0);
31
+ }
32
+ .__remotion-vertical-scrollbar:hover::-webkit-scrollbar-thumb {
33
+ background-color: rgba(0, 0, 0, 0.6);
34
+ }
35
+ .__remotion-vertical-scrollbar:hover::-webkit-scrollbar-thumb:hover {
36
+ background-color: rgba(0, 0, 0, 1);
37
+ }
38
+
39
+ .__remotion-horizontal-scrollbar::-webkit-scrollbar {
40
+ height: 6px;
41
+ }
42
+ .__remotion-horizontal-scrollbar::-webkit-scrollbar-thumb {
43
+ background-color: rgba(0, 0, 0, 0.0);
44
+ }
45
+ .__remotion-horizontal-scrollbar:hover::-webkit-scrollbar-thumb {
46
+ background-color: rgba(0, 0, 0, 0.6);
47
+ }
48
+ .__remotion-horizontal-scrollbar:hover::-webkit-scrollbar-thumb:hover {
49
+ background-color: rgba(0, 0, 0, 1);
50
+ }
51
+
52
+ .__remotion-timeline-slider {
53
+ appearance: none;
54
+ width: 100px;
55
+ border-radius: 3px;
56
+ height: 6px;
57
+ background-color: rgba(255, 255, 255, 0.1);
58
+ accent-color: #ffffff;
59
+ }
60
+
61
+ .__remotion-timeline-slider::-moz-range-thumb {
62
+ width: 14px;
63
+ height: 14px;
64
+ border-radius: 50%;
65
+ background-color: #ffffff;
66
+ appearance: none;
67
+ }
68
+
19
69
  `);
@@ -3,12 +3,12 @@ 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
- const path_1 = __importDefault(require("path"));
6
+ const node_path_1 = __importDefault(require("node:path"));
7
7
  const vitest_1 = require("vitest");
8
8
  const validate_public_dir_1 = require("../validate-public-dir");
9
9
  (0, vitest_1.describe)('validatePublicDir()', () => {
10
10
  (0, vitest_1.test)('Should not allow root directory as public dir.', () => {
11
- (0, vitest_1.expect)(() => (0, validate_public_dir_1.validatePublicDir)(path_1.default.parse(process.cwd()).root)).toThrow(/which is the root directory. This is not allowed./);
11
+ (0, vitest_1.expect)(() => (0, validate_public_dir_1.validatePublicDir)(node_path_1.default.parse(process.cwd()).root)).toThrow(/which is the root directory. This is not allowed./);
12
12
  });
13
13
  (0, vitest_1.test)('Should not allow a path where the parent directory does not exist', () => {
14
14
  const pathToPass = process.platform === 'win32' ? 'C:\\foo\\bar' : '/foo/bar';
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.validatePublicDir = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
9
  const validatePublicDir = (p) => {
10
- const { root } = path_1.default.parse(process.cwd());
10
+ const { root } = node_path_1.default.parse(process.cwd());
11
11
  if (p === root) {
12
12
  throw new Error(`The public directory was specified as "${p}", which is the root directory. This is not allowed.`);
13
13
  }
14
14
  try {
15
- const stat = fs_1.default.lstatSync(p);
15
+ const stat = node_fs_1.default.lstatSync(p);
16
16
  if (!stat.isDirectory()) {
17
17
  throw new Error(`The public directory was specified as "${p}", and while this path exists on the filesystem, it is not a directory.`);
18
18
  }
@@ -20,8 +20,8 @@ const validatePublicDir = (p) => {
20
20
  catch (e) {
21
21
  // Path does not exist
22
22
  // Check if the parent path exists
23
- const parentPath = path_1.default.dirname(p);
24
- const exists = fs_1.default.existsSync(parentPath);
23
+ const parentPath = node_path_1.default.dirname(p);
24
+ const exists = node_fs_1.default.existsSync(parentPath);
25
25
  if (!exists) {
26
26
  throw new Error(`The public directory was specified as "${p}", but this folder does not exist and the parent directory "${parentPath}" does also not exist. Create at least the parent directory.`);
27
27
  }
@@ -4,21 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.cacheExists = exports.getWebpackCacheName = exports.clearCache = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
9
  // Inlined from https://github.com/webpack/webpack/blob/4c2ee7a4ddb8db2362ca83b6c4190523387ba7ee/lib/config/defaults.js#L265
10
10
  // An algorithm to determine where Webpack will cache the depencies
11
11
  const getWebpackCacheDir = (remotionRoot) => {
12
12
  let dir = remotionRoot;
13
13
  for (;;) {
14
14
  try {
15
- if (fs_1.default.statSync(path_1.default.join(dir, 'package.json')).isFile()) {
15
+ if (node_fs_1.default.statSync(node_path_1.default.join(dir, 'package.json')).isFile()) {
16
16
  break;
17
17
  }
18
18
  // eslint-disable-next-line no-empty
19
19
  }
20
20
  catch (e) { }
21
- const parent = path_1.default.dirname(dir);
21
+ const parent = node_path_1.default.dirname(dir);
22
22
  if (dir === parent) {
23
23
  dir = undefined;
24
24
  break;
@@ -26,22 +26,21 @@ const getWebpackCacheDir = (remotionRoot) => {
26
26
  dir = parent;
27
27
  }
28
28
  if (!dir) {
29
- return path_1.default.resolve(remotionRoot, '.cache/webpack');
29
+ return node_path_1.default.resolve(remotionRoot, '.cache/webpack');
30
30
  }
31
31
  if (process.versions.pnp === '1') {
32
- return path_1.default.resolve(dir, '.pnp/.cache/webpack');
32
+ return node_path_1.default.resolve(dir, '.pnp/.cache/webpack');
33
33
  }
34
34
  if (process.versions.pnp === '3') {
35
- return path_1.default.resolve(dir, '.yarn/.cache/webpack');
35
+ return node_path_1.default.resolve(dir, '.yarn/.cache/webpack');
36
36
  }
37
- return path_1.default.resolve(dir, 'node_modules/.cache/webpack');
37
+ return node_path_1.default.resolve(dir, 'node_modules/.cache/webpack');
38
38
  };
39
39
  const remotionCacheLocation = (remotionRoot, environment, hash) => {
40
- return path_1.default.join(getWebpackCacheDir(remotionRoot), (0, exports.getWebpackCacheName)(environment, hash));
40
+ return node_path_1.default.join(getWebpackCacheDir(remotionRoot), (0, exports.getWebpackCacheName)(environment, hash));
41
41
  };
42
42
  const clearCache = (remotionRoot) => {
43
- var _a;
44
- return ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(getWebpackCacheDir(remotionRoot), {
43
+ return node_fs_1.default.promises.rm(getWebpackCacheDir(remotionRoot), {
45
44
  recursive: true,
46
45
  });
47
46
  };
@@ -59,7 +58,7 @@ const getWebpackCacheName = (environment, hash) => {
59
58
  };
60
59
  exports.getWebpackCacheName = getWebpackCacheName;
61
60
  const hasOtherCache = ({ remotionRoot, environment, }) => {
62
- const cacheDir = fs_1.default.readdirSync(getWebpackCacheDir(remotionRoot));
61
+ const cacheDir = node_fs_1.default.readdirSync(getWebpackCacheDir(remotionRoot));
63
62
  if (cacheDir.find((c) => {
64
63
  return c.startsWith(getPrefix(environment));
65
64
  })) {
@@ -68,10 +67,10 @@ const hasOtherCache = ({ remotionRoot, environment, }) => {
68
67
  return false;
69
68
  };
70
69
  const cacheExists = (remotionRoot, environment, hash) => {
71
- if (fs_1.default.existsSync(remotionCacheLocation(remotionRoot, environment, hash))) {
70
+ if (node_fs_1.default.existsSync(remotionCacheLocation(remotionRoot, environment, hash))) {
72
71
  return 'exists';
73
72
  }
74
- if (!fs_1.default.existsSync(getWebpackCacheDir(remotionRoot))) {
73
+ if (!node_fs_1.default.existsSync(getWebpackCacheDir(remotionRoot))) {
75
74
  return 'does-not-exist';
76
75
  }
77
76
  if (hasOtherCache({ remotionRoot, environment })) {
@@ -1,4 +1,6 @@
1
- import type { WebpackConfiguration, WebpackOverrideFn } from 'remotion';
1
+ import type { Configuration } from 'webpack';
2
+ export declare type WebpackConfiguration = Configuration;
3
+ export declare type WebpackOverrideFn = (currentConfiguration: WebpackConfiguration) => WebpackConfiguration;
2
4
  export declare const webpackConfig: ({ entry, userDefinedComponent, outDir, environment, webpackOverride, onProgress, enableCaching, envVariables, maxTimelineTracks, entryPoints, remotionRoot, keyboardShortcutsEnabled, poll, }: {
3
5
  entry: string;
4
6
  userDefinedComponent: string;
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.webpackConfig = void 0;
30
- const crypto_1 = require("crypto");
30
+ const node_crypto_1 = require("node:crypto");
31
31
  const react_dom_1 = __importDefault(require("react-dom"));
32
32
  const remotion_1 = require("remotion");
33
33
  const webpack_1 = __importStar(require("webpack"));
@@ -35,6 +35,7 @@ const fast_refresh_1 = require("./fast-refresh");
35
35
  const stringify_with_circular_references_1 = require("./stringify-with-circular-references");
36
36
  const webpack_cache_1 = require("./webpack-cache");
37
37
  const esbuild = require("esbuild");
38
+ const optional_dependencies_1 = require("./optional-dependencies");
38
39
  if (!react_dom_1.default || !react_dom_1.default.version) {
39
40
  throw new Error('Could not find "react-dom" package. Did you install it?');
40
41
  }
@@ -92,6 +93,7 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
92
93
  'process.env.KEYBOARD_SHORTCUTS_ENABLED': keyboardShortcutsEnabled,
93
94
  [`process.env.${remotion_1.Internals.ENV_VARIABLES_ENV_NAME}`]: JSON.stringify(envVariables),
94
95
  }),
96
+ new optional_dependencies_1.AllowOptionalDependenciesPlugin(),
95
97
  ]
96
98
  : [
97
99
  new webpack_1.ProgressPlugin((p) => {
@@ -99,10 +101,10 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
99
101
  onProgress(Number((p * 100).toFixed(2)));
100
102
  }
101
103
  }),
104
+ new optional_dependencies_1.AllowOptionalDependenciesPlugin(),
102
105
  ],
103
106
  output: {
104
107
  hashFunction: 'xxhash64',
105
- globalObject: 'this',
106
108
  filename: 'bundle.js',
107
109
  devtoolModuleFilenameTemplate: '[resource-path]',
108
110
  assetModuleFilename: environment === 'development' ? '[path][name][ext]' : '[hash][ext]',
@@ -168,7 +170,7 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
168
170
  ],
169
171
  },
170
172
  });
171
- const hash = (0, crypto_1.createHash)('md5')
173
+ const hash = (0, node_crypto_1.createHash)('md5')
172
174
  .update((0, stringify_with_circular_references_1.jsonStringifyWithCircularReferences)(conf))
173
175
  .digest('hex');
174
176
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/bundler",
3
- "version": "4.0.0-alpha4",
3
+ "version": "4.0.0-alpha6",
4
4
  "description": "Bundler for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -20,7 +20,7 @@
20
20
  "css-loader": "5.2.7",
21
21
  "esbuild": "0.16.12",
22
22
  "react-refresh": "0.9.0",
23
- "remotion": "4.0.0-alpha4",
23
+ "remotion": "4.0.0-alpha6",
24
24
  "style-loader": "2.0.0",
25
25
  "webpack": "5.76.1"
26
26
  },