@remotion/bundler 4.0.88 → 4.0.89
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 +1 -0
- package/dist/bundle.js +10 -6
- package/dist/homepage/homepage.d.ts +3 -1
- package/dist/homepage/homepage.js +3 -2
- package/dist/index-html.js +0 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/renderEntry.js +36 -67
- package/package.json +2 -2
package/dist/bundle.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ type Arguments = [options: BundleOptions] | [
|
|
|
28
28
|
onProgress?: (progress: number) => void,
|
|
29
29
|
options?: LegacyBundleOptions
|
|
30
30
|
];
|
|
31
|
+
export declare const findClosestFolderWithFile: (currentDir: string, file: string) => string | null;
|
|
31
32
|
/**
|
|
32
33
|
* @description The method bundles a Remotion project using Webpack and prepares it for rendering using renderMedia()
|
|
33
34
|
* @see [Documentation](https://www.remotion.dev/docs/bundle)
|
package/dist/bundle.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.bundle = exports.getConfig = void 0;
|
|
29
|
+
exports.bundle = exports.findClosestFolderWithFile = exports.getConfig = void 0;
|
|
30
30
|
const node_fs_1 = __importStar(require("node:fs"));
|
|
31
31
|
const node_os_1 = __importDefault(require("node:os"));
|
|
32
32
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -95,18 +95,22 @@ const convertArgumentsIntoOptions = (args) => {
|
|
|
95
95
|
return firstArg;
|
|
96
96
|
};
|
|
97
97
|
const recursionLimit = 5;
|
|
98
|
-
const
|
|
99
|
-
let
|
|
98
|
+
const findClosestFolderWithFile = (currentDir, file) => {
|
|
99
|
+
let possibleFile = '';
|
|
100
100
|
for (let i = 0; i < recursionLimit; i++) {
|
|
101
|
-
|
|
102
|
-
const exists = node_fs_1.default.existsSync(
|
|
101
|
+
possibleFile = node_path_1.default.join(currentDir, file);
|
|
102
|
+
const exists = node_fs_1.default.existsSync(possibleFile);
|
|
103
103
|
if (exists) {
|
|
104
|
-
return node_path_1.default.dirname(
|
|
104
|
+
return node_path_1.default.dirname(possibleFile);
|
|
105
105
|
}
|
|
106
106
|
currentDir = node_path_1.default.dirname(currentDir);
|
|
107
107
|
}
|
|
108
108
|
return null;
|
|
109
109
|
};
|
|
110
|
+
exports.findClosestFolderWithFile = findClosestFolderWithFile;
|
|
111
|
+
const findClosestPackageJsonFolder = (currentDir) => {
|
|
112
|
+
return (0, exports.findClosestFolderWithFile)(currentDir, 'package.json');
|
|
113
|
+
};
|
|
110
114
|
const validateEntryPoint = async (entryPoint) => {
|
|
111
115
|
const contents = await node_fs_1.promises.readFile(entryPoint, 'utf8');
|
|
112
116
|
if (!contents.includes('registerRoot')) {
|
|
@@ -101,8 +101,9 @@ const TestCORS = () => {
|
|
|
101
101
|
}, [serveUrl]);
|
|
102
102
|
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("p", { children: ["Quickly test if a URL is supported being loaded on origin", ' ', (0, jsx_runtime_1.jsx)("code", { children: window.location.origin }), ". Enter the URL of an asset below."] }), result ? (0, jsx_runtime_1.jsx)("p", { className: "result", children: result }) : null, (0, jsx_runtime_1.jsxs)("form", { onSubmit: isCORSWorking, children: [(0, jsx_runtime_1.jsx)("label", { htmlFor: "serveurl", children: (0, jsx_runtime_1.jsx)("input", { placeholder: "Enter URL", type: "text", name: "serveurl", value: serveUrl, onChange: handleServeUrl }) }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("button", { type: "submit", children: "Test CORS" })] })] }));
|
|
103
103
|
};
|
|
104
|
-
const Homepage = () => {
|
|
104
|
+
const Homepage = ({ rootComponent }) => {
|
|
105
105
|
const url = window.location.origin + window.location.pathname;
|
|
106
|
-
|
|
106
|
+
const Root = rootComponent;
|
|
107
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(Root, {}), (0, jsx_runtime_1.jsx)("h1", { children: "Remotion Bundle" }), "This is a website which contains a bundled Remotion video. You can render videos based on this URL.", (0, jsx_runtime_1.jsx)("h2", { children: "Available compositions" }), (0, jsx_runtime_1.jsx)(AvailableCompositions, {}), (0, jsx_runtime_1.jsx)("h2", { children: "How to render" }), "Locally: ", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsxs)("div", { style: pre, children: ["npx remotion render ", url, " ", '<comp-name> <output-location>'] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), "With Remotion Lambda: ", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsxs)("div", { style: pre, children: ["npx remotion lambda render ", url, " ", '<comp-name>'] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsxs)("p", { children: ["You can also render still images, and use the Node.JS APIs", ' ', (0, jsx_runtime_1.jsx)("code", { children: "getCompositions()" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "renderMedia()" }), ",", ' ', (0, jsx_runtime_1.jsx)("code", { children: "renderMediaOnLambda()" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "renderStill()" }), " and", ' ', (0, jsx_runtime_1.jsx)("code", { children: "renderStillOnLambda()" }), " with this URL."] }), (0, jsx_runtime_1.jsxs)("p", { children: ["Visit", ' ', (0, jsx_runtime_1.jsx)("a", { href: "https://remotion.dev/docs", target: "_blank", children: "remotion.dev/docs" }), ' ', "to read the documentation."] }), (0, jsx_runtime_1.jsx)("h2", { children: "CORS testing tool" }), (0, jsx_runtime_1.jsx)(TestCORS, {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {})] }));
|
|
107
108
|
};
|
|
108
109
|
exports.Homepage = Homepage;
|
package/dist/index-html.js
CHANGED
|
@@ -24,7 +24,6 @@ ${includeFavicon
|
|
|
24
24
|
<script>window.remotion_numberOfAudioTags = ${numberOfAudioTags};</script>
|
|
25
25
|
<script>window.remotion_staticBase = "${staticHash}";</script>
|
|
26
26
|
<div id="video-container"></div>
|
|
27
|
-
<div id="explainer-container"></div>
|
|
28
27
|
${editorName
|
|
29
28
|
? `<script>window.remotion_editorName = "${editorName}";</script>`
|
|
30
29
|
: '<script>window.remotion_editorName = null;</script>'}
|
package/dist/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export declare const BundlerInternals: {
|
|
|
48
48
|
staticHash: string;
|
|
49
49
|
limit: number;
|
|
50
50
|
}) => import("remotion").StaticFile[];
|
|
51
|
+
findClosestFolderWithFile: (currentDir: string, file: string) => string | null;
|
|
51
52
|
};
|
|
52
53
|
export { bundle, BundleOptions, LegacyBundleOptions } from './bundle';
|
|
53
54
|
export type { RenderDefaults } from './index-html';
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ exports.BundlerInternals = {
|
|
|
17
17
|
clearCache: webpack_cache_1.clearCache,
|
|
18
18
|
getConfig: bundle_1.getConfig,
|
|
19
19
|
readRecursively: read_recursively_1.readRecursively,
|
|
20
|
+
findClosestFolderWithFile: bundle_1.findClosestFolderWithFile,
|
|
20
21
|
};
|
|
21
22
|
var bundle_2 = require("./bundle");
|
|
22
23
|
Object.defineProperty(exports, "bundle", { enumerable: true, get: function () { return bundle_2.bundle; } });
|
package/dist/renderEntry.js
CHANGED
|
@@ -15,7 +15,7 @@ const remotion_1 = require("remotion");
|
|
|
15
15
|
const no_react_1 = require("remotion/no-react");
|
|
16
16
|
const bundle_mode_1 = require("./bundle-mode");
|
|
17
17
|
const homepage_1 = require("./homepage/homepage");
|
|
18
|
-
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(null, '#
|
|
18
|
+
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(null, '#1f2428'));
|
|
19
19
|
const getCanSerializeDefaultProps = (object) => {
|
|
20
20
|
try {
|
|
21
21
|
const str = JSON.stringify(object);
|
|
@@ -98,83 +98,52 @@ const GetVideo = ({ state }) => {
|
|
|
98
98
|
backgroundColor: 'transparent',
|
|
99
99
|
} }));
|
|
100
100
|
};
|
|
101
|
-
const videoContainer = document.getElementById('video-container');
|
|
102
|
-
const explainerContainer = document.getElementById('explainer-container');
|
|
103
|
-
let cleanupVideoContainer = () => {
|
|
104
|
-
videoContainer.innerHTML = '';
|
|
105
|
-
};
|
|
106
|
-
let cleanupExplainerContainer = () => {
|
|
107
|
-
explainerContainer.innerHTML = '';
|
|
108
|
-
};
|
|
109
101
|
const waitForRootHandle = (0, remotion_1.delayRender)('Loading root component - See https://remotion.dev/docs/troubleshooting/loading-root-component if you experience a timeout');
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const cleanup = remotion_1.Internals.waitForRoot((NewRoot) => {
|
|
118
|
-
setRoot(() => NewRoot);
|
|
119
|
-
});
|
|
120
|
-
return () => cleanup();
|
|
121
|
-
}, [Root]);
|
|
122
|
-
if (Root === null) {
|
|
123
|
-
return null;
|
|
102
|
+
const videoContainer = document.getElementById('video-container');
|
|
103
|
+
let root = null;
|
|
104
|
+
const getRootForElement = () => {
|
|
105
|
+
if (root) {
|
|
106
|
+
return root;
|
|
124
107
|
}
|
|
125
|
-
|
|
108
|
+
root = client_1.default.createRoot(videoContainer);
|
|
109
|
+
return root;
|
|
126
110
|
};
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
if (client_1.default.createRoot) {
|
|
132
|
-
const root = client_1.default.createRoot(videoContainer);
|
|
133
|
-
root.render(markup);
|
|
134
|
-
cleanupVideoContainer = () => {
|
|
135
|
-
root.unmount();
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
client_1.default.render(markup, videoContainer);
|
|
140
|
-
cleanupVideoContainer = () => {
|
|
141
|
-
client_1.default.unmountComponentAtNode(videoContainer);
|
|
142
|
-
};
|
|
143
|
-
}
|
|
111
|
+
const renderToDOM = (content) => {
|
|
112
|
+
// @ts-expect-error
|
|
113
|
+
if (client_1.default.createRoot) {
|
|
114
|
+
getRootForElement().render(content);
|
|
144
115
|
}
|
|
145
116
|
else {
|
|
146
|
-
|
|
147
|
-
cleanupVideoContainer = () => {
|
|
148
|
-
videoContainer.innerHTML = '';
|
|
149
|
-
};
|
|
117
|
+
client_1.default.render(content, videoContainer);
|
|
150
118
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
const root = client_1.default;
|
|
161
|
-
root.render((0, jsx_runtime_1.jsx)(homepage_1.Homepage, {}), explainerContainer);
|
|
162
|
-
cleanupExplainerContainer = () => {
|
|
163
|
-
root.unmountComponentAtNode(explainerContainer);
|
|
164
|
-
};
|
|
165
|
-
}
|
|
119
|
+
};
|
|
120
|
+
const renderContent = (Root) => {
|
|
121
|
+
const bundleMode = (0, bundle_mode_1.getBundleMode)();
|
|
122
|
+
if (bundleMode.type === 'composition') {
|
|
123
|
+
const markup = ((0, jsx_runtime_1.jsxs)(remotion_1.Internals.RemotionRoot, { numberOfAudioTags: 0, children: [(0, jsx_runtime_1.jsx)(Root, {}), (0, jsx_runtime_1.jsx)(GetVideo, { state: bundleMode })] }));
|
|
124
|
+
renderToDOM(markup);
|
|
166
125
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
126
|
+
if (bundleMode.type === 'evaluation') {
|
|
127
|
+
const markup = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(remotion_1.Internals.RemotionRoot, { numberOfAudioTags: 0, children: [(0, jsx_runtime_1.jsx)(Root, {}), (0, jsx_runtime_1.jsx)(GetVideo, { state: bundleMode })] }), (0, jsx_runtime_1.jsx)(homepage_1.Homepage, { rootComponent: Root })] }));
|
|
128
|
+
renderToDOM(markup);
|
|
129
|
+
}
|
|
130
|
+
if (bundleMode.type === 'index') {
|
|
131
|
+
renderToDOM((0, jsx_runtime_1.jsx)(homepage_1.Homepage, { rootComponent: Root }));
|
|
172
132
|
}
|
|
173
133
|
};
|
|
174
|
-
|
|
134
|
+
remotion_1.Internals.waitForRoot((Root) => {
|
|
135
|
+
renderContent(Root);
|
|
136
|
+
(0, remotion_1.continueRender)(waitForRootHandle);
|
|
137
|
+
});
|
|
175
138
|
const setBundleModeAndUpdate = (state) => {
|
|
176
139
|
(0, bundle_mode_1.setBundleMode)(state);
|
|
177
|
-
|
|
140
|
+
const delay = (0, remotion_1.delayRender)('Waiting for root component to load - See https://remotion.dev/docs/troubleshooting/loading-root-component if you experience a timeout');
|
|
141
|
+
remotion_1.Internals.waitForRoot((Root) => {
|
|
142
|
+
renderContent(Root);
|
|
143
|
+
requestAnimationFrame(() => {
|
|
144
|
+
(0, remotion_1.continueRender)(delay);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
178
147
|
};
|
|
179
148
|
exports.setBundleModeAndUpdate = setBundleModeAndUpdate;
|
|
180
149
|
if (typeof window !== 'undefined') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/bundler",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.89",
|
|
4
4
|
"description": "Bundler for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react-refresh": "0.9.0",
|
|
24
24
|
"style-loader": "2.0.0",
|
|
25
25
|
"webpack": "5.83.1",
|
|
26
|
-
"remotion": "4.0.
|
|
26
|
+
"remotion": "4.0.89"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": ">=16.8.0",
|