@remotion/bundler 4.0.0-alpha13 → 4.0.0-alpha16

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,6 +1,6 @@
1
1
  import webpack from 'webpack';
2
2
  import type { WebpackOverrideFn } from './webpack-config';
3
- export declare type LegacyBundleOptions = {
3
+ export type LegacyBundleOptions = {
4
4
  webpackOverride?: WebpackOverrideFn;
5
5
  outDir?: string;
6
6
  enableCaching?: boolean;
@@ -17,13 +17,13 @@ export declare const getConfig: ({ entryPoint, outDir, resolvedRemotionRoot, onP
17
17
  onProgress?: ((progress: number) => void) | undefined;
18
18
  options?: LegacyBundleOptions | undefined;
19
19
  }) => [string, webpack.Configuration];
20
- export declare type BundleOptions = {
20
+ export type BundleOptions = {
21
21
  entryPoint: string;
22
22
  onProgress?: (progress: number) => void;
23
23
  ignoreRegisterRootWarning?: boolean;
24
24
  onDirectoryCreated?: (dir: string) => void;
25
25
  } & LegacyBundleOptions;
26
- declare type Arguments = [options: BundleOptions] | [
26
+ type Arguments = [options: BundleOptions] | [
27
27
  entryPoint: string,
28
28
  onProgress?: (progress: number) => void,
29
29
  options?: LegacyBundleOptions
@@ -1,11 +1,11 @@
1
1
  import type { transform, TransformOptions } from 'esbuild';
2
- declare type Implementation = {
2
+ type Implementation = {
3
3
  transform: typeof transform;
4
4
  };
5
- declare type Except<ObjectType, Properties> = {
5
+ type Except<ObjectType, Properties> = {
6
6
  [Key in keyof ObjectType as Key extends Properties ? never : Key]: ObjectType[Key];
7
7
  };
8
- export declare type LoaderOptions = Except<TransformOptions, 'sourcemap' | 'sourcefile'> & {
8
+ export type LoaderOptions = Except<TransformOptions, 'sourcemap' | 'sourcefile'> & {
9
9
  implementation: Implementation;
10
10
  };
11
11
  export {};
@@ -35,12 +35,13 @@ const AvailableCompositions = () => {
35
35
  const check = () => {
36
36
  if (window.remotion_renderReady === true) {
37
37
  setComps({ type: 'loading' });
38
- window
39
- .getStaticCompositions()
40
- .then((newComps) => {
38
+ try {
39
+ const newComps = window.remotion_getCompositionNames();
41
40
  setComps({ type: 'loaded', comps: newComps });
42
- })
43
- .catch((err) => ({ type: 'error', error: err }));
41
+ }
42
+ catch (err) {
43
+ setComps({ type: 'error', error: err });
44
+ }
44
45
  }
45
46
  else {
46
47
  timeout = setTimeout(check, 250);
@@ -72,7 +73,7 @@ const AvailableCompositions = () => {
72
73
  return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("ul", { children: state === null
73
74
  ? []
74
75
  : state.comps.map((c) => {
75
- return (0, jsx_runtime_1.jsx)("li", { children: c.id }, c.id);
76
+ return (0, jsx_runtime_1.jsx)("li", { children: c }, c);
76
77
  }) }) }));
77
78
  };
78
79
  const TestCORS = () => {
@@ -1,5 +1,5 @@
1
1
  import type { StaticFile } from 'remotion';
2
- export declare type RenderDefaults = {
2
+ export type RenderDefaults = {
3
3
  jpegQuality: number;
4
4
  scale: number;
5
5
  logLevel: string;
@@ -169,7 +169,7 @@ const setBundleModeAndUpdate = (state) => {
169
169
  };
170
170
  exports.setBundleModeAndUpdate = setBundleModeAndUpdate;
171
171
  if (typeof window !== 'undefined') {
172
- window.getStaticCompositions = () => {
172
+ const getUnevaluatedComps = () => {
173
173
  if (!remotion_1.Internals.getRoot()) {
174
174
  throw new Error('registerRoot() was never called. 1. Make sure you specified the correct entrypoint for your bundle. 2. If your registerRoot() call is deferred, use the delayRender/continueRender pattern to tell Remotion to wait.');
175
175
  }
@@ -188,31 +188,42 @@ if (typeof window !== 'undefined') {
188
188
  console.warn('Could not single out a problematic composition - The composition list as a whole is too big to serialize.');
189
189
  throw new Error('defaultProps too big - Could not serialize - an object that was passed to defaultProps was too big. Learn how to mitigate this error by visiting https://remotion.dev/docs/troubleshooting/serialize-defaultprops');
190
190
  }
191
- return Promise.all(compositions.map((c) => {
192
- return Promise.resolve(remotion_1.Internals.resolveVideoConfig({
191
+ return compositions;
192
+ };
193
+ window.getStaticCompositions = () => {
194
+ const compositions = getUnevaluatedComps();
195
+ return Promise.all(compositions.map(async (c) => {
196
+ const handle = (0, remotion_1.delayRender)(`Running calculateMetadata() for composition ${c.id}. If you didn't want to evaluate this composition, use "selectComposition()" instead of "getCompositions()"`);
197
+ const comp = remotion_1.Internals.resolveVideoConfig({
193
198
  composition: c,
194
199
  editorProps: {},
195
200
  signal: new AbortController().signal,
196
- }));
201
+ });
202
+ const resolved = await Promise.resolve(comp);
203
+ (0, remotion_1.continueRender)(handle);
204
+ return resolved;
197
205
  }));
198
206
  };
199
- window.calculateComposition = (compId) => {
200
- if (!remotion_1.Internals.compositionsRef.current) {
201
- throw new Error('Unexpectedly did not have a CompositionManager');
202
- }
203
- const compositions = remotion_1.Internals.compositionsRef.current.getCompositions();
207
+ window.remotion_getCompositionNames = () => {
208
+ return getUnevaluatedComps().map((c) => c.id);
209
+ };
210
+ window.remotion_calculateComposition = async (compId) => {
211
+ const compositions = getUnevaluatedComps();
204
212
  const selectedComp = compositions.find((c) => c.id === compId);
205
213
  if (!selectedComp) {
206
214
  throw new Error(`Could not find composition with ID ${compId}`);
207
215
  }
208
216
  const abortController = new AbortController();
209
- return Promise.resolve(remotion_1.Internals.resolveVideoConfig({
217
+ const handle = (0, remotion_1.delayRender)(`Running the calculateMetadata() function for composition ${compId}`);
218
+ const prom = await Promise.resolve(remotion_1.Internals.resolveVideoConfig({
210
219
  composition: selectedComp,
211
220
  editorProps: {},
212
221
  signal: abortController.signal,
213
222
  }));
223
+ (0, remotion_1.continueRender)(handle);
224
+ return prom;
214
225
  };
215
226
  window.siteVersion = '5';
216
227
  window.remotion_version = remotion_1.VERSION;
217
- window.setBundleMode = exports.setBundleModeAndUpdate;
228
+ window.remotion_setBundleMode = exports.setBundleModeAndUpdate;
218
229
  }
@@ -1,5 +1,5 @@
1
- declare type Environment = 'development' | 'production';
2
- declare type CacheState = 'exists' | 'other-exists' | 'does-not-exist';
1
+ type Environment = 'development' | 'production';
2
+ type CacheState = 'exists' | 'other-exists' | 'does-not-exist';
3
3
  declare global {
4
4
  namespace NodeJS {
5
5
  interface ProcessVersions {
@@ -1,6 +1,6 @@
1
1
  import type { Configuration } from 'webpack';
2
- export declare type WebpackConfiguration = Configuration;
3
- export declare type WebpackOverrideFn = (currentConfiguration: WebpackConfiguration) => WebpackConfiguration;
2
+ export type WebpackConfiguration = Configuration;
3
+ export type WebpackOverrideFn = (currentConfiguration: WebpackConfiguration) => WebpackConfiguration;
4
4
  export declare const webpackConfig: ({ entry, userDefinedComponent, outDir, environment, webpackOverride, onProgress, enableCaching, maxTimelineTracks, entryPoints, remotionRoot, keyboardShortcutsEnabled, poll, }: {
5
5
  entry: string;
6
6
  userDefinedComponent: string;
@@ -34,8 +34,9 @@ const fast_refresh_1 = require("./fast-refresh");
34
34
  const stringify_with_circular_references_1 = require("./stringify-with-circular-references");
35
35
  const webpack_cache_1 = require("./webpack-cache");
36
36
  const esbuild = require("esbuild");
37
+ const remotion_1 = require("remotion");
37
38
  const optional_dependencies_1 = require("./optional-dependencies");
38
- if (!react_dom_1.default || !react_dom_1.default.version) {
39
+ if (!(react_dom_1.default === null || react_dom_1.default === void 0 ? void 0 : react_dom_1.default.version)) {
39
40
  throw new Error('Could not find "react-dom" package. Did you install it?');
40
41
  }
41
42
  const reactDomVersion = react_dom_1.default.version.split('.')[0];
@@ -103,7 +104,7 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
103
104
  ],
104
105
  output: {
105
106
  hashFunction: 'xxhash64',
106
- filename: 'bundle.js',
107
+ filename: remotion_1.Internals.bundleName,
107
108
  devtoolModuleFilenameTemplate: '[resource-path]',
108
109
  assetModuleFilename: environment === 'development' ? '[path][name][ext]' : '[hash][ext]',
109
110
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/bundler",
3
- "version": "4.0.0-alpha13",
3
+ "version": "4.0.0-alpha16",
4
4
  "description": "Bundler for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -22,7 +22,7 @@
22
22
  "react-refresh": "0.9.0",
23
23
  "style-loader": "2.0.0",
24
24
  "webpack": "5.83.1",
25
- "remotion": "4.0.0-alpha13"
25
+ "remotion": "4.0.0-alpha16"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=16.8.0",
@@ -33,9 +33,7 @@
33
33
  "@types/node": "18.14.6",
34
34
  "@types/react": "18.0.26",
35
35
  "@types/react-dom": "18.0.10",
36
- "@typescript-eslint/eslint-plugin": "5.18.0",
37
- "@typescript-eslint/parser": "5.18.0",
38
- "eslint": "8.25.0",
36
+ "eslint": "8.42.0",
39
37
  "eslint-plugin-10x": "1.5.2",
40
38
  "eslint-plugin-react": "7.29.4",
41
39
  "eslint-plugin-react-hooks": "4.4.0",
@@ -43,7 +41,7 @@
43
41
  "prettier-plugin-organize-imports": "^2.3.4",
44
42
  "react": "^18.0.0",
45
43
  "react-dom": "^18.0.0",
46
- "typescript": "^4.7.0",
44
+ "typescript": "4.9.5",
47
45
  "vitest": "0.31.1"
48
46
  },
49
47
  "keywords": [