@remotion/browser-bundler 4.0.528 → 4.0.530
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.
|
@@ -1417,4 +1417,4 @@ require(${JSON.stringify(Y)});
|
|
|
1417
1417
|
module.hot.accept(${JSON.stringify(Y)}, () => {
|
|
1418
1418
|
require(${JSON.stringify(Y)});
|
|
1419
1419
|
});
|
|
1420
|
-
`}:{},onProgress:($)=>vB({type:"progress",...$}),configure:($)=>({context:NY(Q.rootDir),mode:"development",devtool:"inline-cheap-module-source-map",entry:{bundle:{asyncChunks:!1,import:J?[QG.entry,wD]:[Y]}},experiments:{buildHttp:{allowedUris:["https://esm.sh/",`${self.location.origin}/`],cacheLocation:!1,httpClient:kD({fetchImplementation:fetch})}},externals:Object.fromEntries([...Ug,...J?["react-refresh/runtime"]:[]].map((U)=>[U,`commonjs ${U}`])),module:{rules:[{parser:{worker:!1},test:/\.[cm]?[jt]sx?$/},...J?[{exclude:[/node_modules/,/__remotion_browser_bundler__/],test:/\.[jt]sx?$/,use:[{loader:"builtin:react-refresh-loader"}]}]:[],{test:/\.[jt]sx?$/,use:[{loader:"builtin:swc-loader",options:{env:{targets:"Chrome >= 111"},jsc:{parser:{syntax:"typescript",tsx:!0},transform:{react:{development:J,refresh:J,runtime:"automatic"}}}}}]}]},optimization:{emitOnErrors:!J,runtimeChunk:!1,splitChunks:!1},output:{chunkFilename:"[name].js",chunkFormat:"array-push",chunkLoading:"jsonp",filename:"bundle.js",path:"/dist",publicPath:"",hashFunction:"xxhash64",uniqueName:"remotion-browser-bundler",...J?{hotUpdateGlobal:WD}:{}},plugins:[...J?[PD({rspack:$,refreshRuntime:QG.runtime,refreshUtils:QG.utils}),new $.HotModuleReplacementPlugin,ID({rspack:$,bridgeName:mB})]:[],TD({rspack:$,development:J,external:["react","react-dom","remotion",...J?["react-refresh"]:[]],resolvedUrls:{},resolvedVersions:{...{react:"19.2.3","react-dom":"19.2.3",remotion:"4.0.
|
|
1420
|
+
`}:{},onProgress:($)=>vB({type:"progress",...$}),configure:($)=>({context:NY(Q.rootDir),mode:"development",devtool:"inline-cheap-module-source-map",entry:{bundle:{asyncChunks:!1,import:J?[QG.entry,wD]:[Y]}},experiments:{buildHttp:{allowedUris:["https://esm.sh/",`${self.location.origin}/`],cacheLocation:!1,httpClient:kD({fetchImplementation:fetch})}},externals:Object.fromEntries([...Ug,...J?["react-refresh/runtime"]:[]].map((U)=>[U,`commonjs ${U}`])),module:{rules:[{parser:{worker:!1},test:/\.[cm]?[jt]sx?$/},...J?[{exclude:[/node_modules/,/__remotion_browser_bundler__/],test:/\.[jt]sx?$/,use:[{loader:"builtin:react-refresh-loader"}]}]:[],{test:/\.[jt]sx?$/,use:[{loader:"builtin:swc-loader",options:{env:{targets:"Chrome >= 111"},jsc:{parser:{syntax:"typescript",tsx:!0},transform:{react:{development:J,refresh:J,runtime:"automatic"}}}}}]}]},optimization:{emitOnErrors:!J,runtimeChunk:!1,splitChunks:!1},output:{chunkFilename:"[name].js",chunkFormat:"array-push",chunkLoading:"jsonp",filename:"bundle.js",path:"/dist",publicPath:"",hashFunction:"xxhash64",uniqueName:"remotion-browser-bundler",...J?{hotUpdateGlobal:WD}:{}},plugins:[...J?[PD({rspack:$,refreshRuntime:QG.runtime,refreshUtils:QG.utils}),new $.HotModuleReplacementPlugin,ID({rspack:$,bridgeName:mB})]:[],TD({rspack:$,development:J,external:["react","react-dom","remotion",...J?["react-refresh"]:[]],resolvedUrls:{},resolvedVersions:{...{react:"19.2.3","react-dom":"19.2.3",remotion:"4.0.530"},...X.dependencyVersions},resolvePackage:null}),new $.optimize.LimitChunkCountPlugin({maxChunks:1})],resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}})}),hB=Q;let K=await C6.compile(Q);if(K.bundle===null)throw new ZG("Rspack compilation failed",K.errors);if(J&&(!K.hash||XG===null))throw Error("Rspack did not return a Fast Refresh build hash.");vB({type:"bundle",id:X.id,bundle:{code:K.bundle,warnings:K.warnings,fastRefresh:J&&K.hash&&XG!==null?{sessionId:XG,hash:K.hash,previousHash:_B,assets:K.assets.filter(($)=>$.name.includes(".hot-update."))}:null}}),_B=K.hash??null}catch(Q){vB({type:"error",id:X.id,error:DD(Q)})}})});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare const createBrowserModuleScope: (additionalModules
|
|
2
|
+
export declare const createBrowserModuleScope: ({ additionalModules, addSourceLocations, }: {
|
|
3
|
+
additionalModules: ReadonlyMap<string, unknown> | null;
|
|
4
|
+
addSourceLocations: boolean;
|
|
5
|
+
}) => {
|
|
3
6
|
resolveModule: (id: string) => unknown;
|
|
4
7
|
beginUpdate: () => void;
|
|
5
8
|
getRoot: () => React.FC<{}>;
|
package/dist/runtime.js
CHANGED
|
@@ -23,7 +23,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
// src/create-browser-bundle-runtime.ts
|
|
26
|
-
import { Internals } from "remotion";
|
|
26
|
+
import { Internals as Internals2 } from "remotion";
|
|
27
27
|
|
|
28
28
|
// src/browser-module-scope.ts
|
|
29
29
|
import * as React from "react";
|
|
@@ -34,7 +34,80 @@ import * as JSXRuntime from "react/jsx-runtime";
|
|
|
34
34
|
import * as Remotion from "remotion";
|
|
35
35
|
import * as RemotionNoReact from "remotion/no-react";
|
|
36
36
|
import * as RemotionVersion from "remotion/version";
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
// src/source-location-jsx.ts
|
|
39
|
+
import { Internals } from "remotion";
|
|
40
|
+
var withSourceLocation = (factory, {
|
|
41
|
+
isCreateElement,
|
|
42
|
+
sourceArgumentIndex
|
|
43
|
+
}) => {
|
|
44
|
+
const componentsToAddStacksTo = Internals.getComponentsToAddStacksTo();
|
|
45
|
+
const sequenceComponent = Internals.getSequenceComponent();
|
|
46
|
+
const internalStackProp = Internals.REMOTION_INTERNAL_STACK_PROP;
|
|
47
|
+
return new Proxy(factory, {
|
|
48
|
+
apply(target, thisArg, argArray) {
|
|
49
|
+
const [component, props, ...rest] = argArray;
|
|
50
|
+
if (!componentsToAddStacksTo.includes(component)) {
|
|
51
|
+
return Reflect.apply(target, thisArg, argArray);
|
|
52
|
+
}
|
|
53
|
+
const source = sourceArgumentIndex === null ? null : argArray[sourceArgumentIndex];
|
|
54
|
+
const stack = source && typeof source.fileName === "string" && typeof source.lineNumber === "number" && typeof source.columnNumber === "number" ? Internals.makeOriginalSourceStack({
|
|
55
|
+
fileName: source.fileName,
|
|
56
|
+
lineNumber: source.lineNumber,
|
|
57
|
+
columnNumber: source.columnNumber
|
|
58
|
+
}) : new Error().stack;
|
|
59
|
+
const newProps = props?.[internalStackProp] ? { ...props } : { ...props ?? {}, [internalStackProp]: stack };
|
|
60
|
+
if (component === sequenceComponent) {
|
|
61
|
+
const children = isCreateElement ? rest.length === 0 ? newProps.children : rest : newProps.children;
|
|
62
|
+
newProps._remotionInternalSingleChildComponent = Internals.getSingleChildComponent(children);
|
|
63
|
+
}
|
|
64
|
+
return Reflect.apply(target, thisArg, [component, newProps, ...rest]);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
var withOverrides = (module, overrides) => {
|
|
69
|
+
const wrapped = { ...module, ...overrides };
|
|
70
|
+
if (module.default !== null && typeof module.default === "object") {
|
|
71
|
+
wrapped.default = { ...module.default, ...overrides };
|
|
72
|
+
}
|
|
73
|
+
return wrapped;
|
|
74
|
+
};
|
|
75
|
+
var addSourceLocationsToJsxModules = ({
|
|
76
|
+
react,
|
|
77
|
+
jsxRuntime,
|
|
78
|
+
jsxDevRuntime
|
|
79
|
+
}) => {
|
|
80
|
+
return {
|
|
81
|
+
react: withOverrides(react, {
|
|
82
|
+
createElement: withSourceLocation(react.createElement, {
|
|
83
|
+
isCreateElement: true,
|
|
84
|
+
sourceArgumentIndex: null
|
|
85
|
+
})
|
|
86
|
+
}),
|
|
87
|
+
jsxRuntime: withOverrides(jsxRuntime, {
|
|
88
|
+
jsx: withSourceLocation(jsxRuntime.jsx, {
|
|
89
|
+
isCreateElement: false,
|
|
90
|
+
sourceArgumentIndex: null
|
|
91
|
+
}),
|
|
92
|
+
jsxs: withSourceLocation(jsxRuntime.jsxs, {
|
|
93
|
+
isCreateElement: false,
|
|
94
|
+
sourceArgumentIndex: null
|
|
95
|
+
})
|
|
96
|
+
}),
|
|
97
|
+
jsxDevRuntime: withOverrides(jsxDevRuntime, {
|
|
98
|
+
jsxDEV: withSourceLocation(jsxDevRuntime.jsxDEV, {
|
|
99
|
+
isCreateElement: false,
|
|
100
|
+
sourceArgumentIndex: 4
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/browser-module-scope.ts
|
|
107
|
+
var createBrowserModuleScope = ({
|
|
108
|
+
additionalModules,
|
|
109
|
+
addSourceLocations
|
|
110
|
+
}) => {
|
|
38
111
|
let root = null;
|
|
39
112
|
let registrations = 0;
|
|
40
113
|
const registerRoot = (component) => {
|
|
@@ -47,12 +120,17 @@ var createBrowserModuleScope = (additionalModules) => {
|
|
|
47
120
|
registrations++;
|
|
48
121
|
root = component;
|
|
49
122
|
};
|
|
123
|
+
const jsxModules = addSourceLocations ? addSourceLocationsToJsxModules({
|
|
124
|
+
react: React,
|
|
125
|
+
jsxRuntime: JSXRuntime,
|
|
126
|
+
jsxDevRuntime: JSXDevRuntime
|
|
127
|
+
}) : { react: React, jsxRuntime: JSXRuntime, jsxDevRuntime: JSXDevRuntime };
|
|
50
128
|
const sharedModules = new Map([
|
|
51
|
-
["react",
|
|
129
|
+
["react", jsxModules.react],
|
|
52
130
|
["react-dom", ReactDOM],
|
|
53
131
|
["react-dom/client", ReactDOMClient],
|
|
54
|
-
["react/jsx-runtime",
|
|
55
|
-
["react/jsx-dev-runtime",
|
|
132
|
+
["react/jsx-runtime", jsxModules.jsxRuntime],
|
|
133
|
+
["react/jsx-dev-runtime", jsxModules.jsxDevRuntime],
|
|
56
134
|
["remotion", { ...Remotion, registerRoot }],
|
|
57
135
|
["remotion/no-react", RemotionNoReact],
|
|
58
136
|
["remotion/version", RemotionVersion],
|
|
@@ -219,8 +297,11 @@ var createBrowserBundleRuntime = () => {
|
|
|
219
297
|
if (renderers.length > 0 && !renderers.some((renderer) => renderer !== null && typeof renderer === "object" && ("scheduleRefresh" in renderer) && typeof renderer.scheduleRefresh === "function" && ("setRefreshHandler" in renderer) && typeof renderer.setRefreshHandler === "function")) {
|
|
220
298
|
throw new Error("Fast Refresh requires development React DOM. Inject the React Refresh hook before importing the preview renderer.");
|
|
221
299
|
}
|
|
222
|
-
const initialScope = createBrowserModuleScope(
|
|
223
|
-
|
|
300
|
+
const initialScope = createBrowserModuleScope({
|
|
301
|
+
additionalModules: new Map([["react-refresh/runtime", refresh]]),
|
|
302
|
+
addSourceLocations: true
|
|
303
|
+
});
|
|
304
|
+
Internals2.setComponentIdentityResolver((component) => refresh.getFamilyByType(component) ?? component);
|
|
224
305
|
ownsComponentIdentityResolver = true;
|
|
225
306
|
Object.defineProperty(globalThis, "require", {
|
|
226
307
|
configurable: true,
|
|
@@ -277,7 +358,7 @@ var createBrowserBundleRuntime = () => {
|
|
|
277
358
|
}
|
|
278
359
|
disposed = true;
|
|
279
360
|
if (ownsComponentIdentityResolver) {
|
|
280
|
-
|
|
361
|
+
Internals2.setComponentIdentityResolver(null);
|
|
281
362
|
}
|
|
282
363
|
assets.dispose();
|
|
283
364
|
Reflect.deleteProperty(globalThis, browserBundleHmrBridgeName);
|
|
@@ -297,7 +378,7 @@ var createBrowserBundleRuntime = () => {
|
|
|
297
378
|
// src/create-browser-composition-observer.tsx
|
|
298
379
|
import React2, { Suspense, useEffect, useMemo, useState } from "react";
|
|
299
380
|
import { createRoot } from "react-dom/client";
|
|
300
|
-
import { Internals as
|
|
381
|
+
import { Internals as Internals3 } from "remotion";
|
|
301
382
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
302
383
|
var environment = {
|
|
303
384
|
isClientSideRendering: false,
|
|
@@ -346,7 +427,7 @@ var ObserveMetadata = ({
|
|
|
346
427
|
const controller = new AbortController;
|
|
347
428
|
const defaultProps = composition.defaultProps ?? {};
|
|
348
429
|
try {
|
|
349
|
-
const config =
|
|
430
|
+
const config = Internals3.resolveVideoConfig({
|
|
350
431
|
compositionId,
|
|
351
432
|
compositionWidth: composition.width ?? null,
|
|
352
433
|
compositionHeight: composition.height ?? null,
|
|
@@ -427,9 +508,9 @@ var ObserveComposition = ({
|
|
|
427
508
|
})
|
|
428
509
|
]
|
|
429
510
|
}), [RegisteredRoot, revision]);
|
|
430
|
-
return /* @__PURE__ */ jsx(
|
|
511
|
+
return /* @__PURE__ */ jsx(Internals3.RemotionEnvironmentContext.Provider, {
|
|
431
512
|
value: environment,
|
|
432
|
-
children: /* @__PURE__ */ jsxs(
|
|
513
|
+
children: /* @__PURE__ */ jsxs(Internals3.CompositionSetters.Provider, {
|
|
433
514
|
value: setters,
|
|
434
515
|
children: [
|
|
435
516
|
registration,
|
|
@@ -515,7 +596,7 @@ var createBrowserCompositionObserver = ({
|
|
|
515
596
|
// src/get-browser-composition.tsx
|
|
516
597
|
import React3, { Suspense as Suspense2, useEffect as useEffect2 } from "react";
|
|
517
598
|
import { createRoot as createRoot2 } from "react-dom/client";
|
|
518
|
-
import { Internals as
|
|
599
|
+
import { Internals as Internals4 } from "remotion";
|
|
519
600
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
520
601
|
|
|
521
602
|
class RegistrationErrorBoundary2 extends React3.Component {
|
|
@@ -584,7 +665,7 @@ var getBrowserComposition = async ({
|
|
|
584
665
|
throw new Error(`No composition with ID "${compositionId}" was registered. Available IDs: ${[...compositions.keys()].join(", ") || "(none)"}.`);
|
|
585
666
|
}
|
|
586
667
|
const defaultProps = composition.defaultProps ?? {};
|
|
587
|
-
const config =
|
|
668
|
+
const config = Internals4.resolveVideoConfig({
|
|
588
669
|
compositionId,
|
|
589
670
|
compositionWidth: composition.width ?? null,
|
|
590
671
|
compositionHeight: composition.height ?? null,
|
|
@@ -637,7 +718,7 @@ var getBrowserComposition = async ({
|
|
|
637
718
|
});
|
|
638
719
|
reactRoot.render(/* @__PURE__ */ jsx2(RegistrationErrorBoundary2, {
|
|
639
720
|
onError,
|
|
640
|
-
children: /* @__PURE__ */ jsx2(
|
|
721
|
+
children: /* @__PURE__ */ jsx2(Internals4.RemotionEnvironmentContext.Provider, {
|
|
641
722
|
value: {
|
|
642
723
|
isClientSideRendering: false,
|
|
643
724
|
isPlayer: false,
|
|
@@ -645,7 +726,7 @@ var getBrowserComposition = async ({
|
|
|
645
726
|
isRendering: false,
|
|
646
727
|
isStudio: false
|
|
647
728
|
},
|
|
648
|
-
children: /* @__PURE__ */ jsx2(
|
|
729
|
+
children: /* @__PURE__ */ jsx2(Internals4.CompositionSetters.Provider, {
|
|
649
730
|
value: setters,
|
|
650
731
|
children: /* @__PURE__ */ jsxs2(Suspense2, {
|
|
651
732
|
fallback: null,
|
|
@@ -677,7 +758,10 @@ var loadBrowserBundle = ({ bundle }) => {
|
|
|
677
758
|
if (bundle.fastRefresh) {
|
|
678
759
|
throw new Error("Use createBrowserBundleRuntime() to load a Fast Refresh bundle.");
|
|
679
760
|
}
|
|
680
|
-
const scope = createBrowserModuleScope(
|
|
761
|
+
const scope = createBrowserModuleScope({
|
|
762
|
+
additionalModules: null,
|
|
763
|
+
addSourceLocations: false
|
|
764
|
+
});
|
|
681
765
|
scope.evaluate(bundle.code);
|
|
682
766
|
return scope.getRoot();
|
|
683
767
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type * as JSXDevRuntime from 'react/jsx-dev-runtime';
|
|
3
|
+
import type * as JSXRuntime from 'react/jsx-runtime';
|
|
4
|
+
type ModuleRecord = Record<string, unknown> & {
|
|
5
|
+
default?: unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare const addSourceLocationsToJsxModules: ({ react, jsxRuntime, jsxDevRuntime, }: {
|
|
8
|
+
react: typeof React;
|
|
9
|
+
jsxRuntime: typeof JSXRuntime;
|
|
10
|
+
jsxDevRuntime: typeof JSXDevRuntime;
|
|
11
|
+
}) => {
|
|
12
|
+
react: ModuleRecord;
|
|
13
|
+
jsxRuntime: ModuleRecord;
|
|
14
|
+
jsxDevRuntime: ModuleRecord;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/browser-bundler",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.530",
|
|
4
4
|
"description": "Compile virtual Remotion projects in the browser",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@rspack/browser": "2.1.1",
|
|
28
28
|
"react-refresh": "0.18.0",
|
|
29
|
-
"remotion": "4.0.
|
|
29
|
+
"remotion": "4.0.530"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=18.0.0",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@rspack/plugin-react-refresh": "1.6.1",
|
|
55
55
|
"@happy-dom/global-registrator": "14.5.1",
|
|
56
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
57
|
-
"@remotion/player": "4.0.
|
|
56
|
+
"@remotion/eslint-config-internal": "4.0.530",
|
|
57
|
+
"@remotion/player": "4.0.530",
|
|
58
58
|
"@testing-library/react": "16.1.0",
|
|
59
59
|
"@types/react": "19.2.7",
|
|
60
60
|
"@types/react-dom": "19.2.3",
|