@remotion/bundler 3.0.17 → 3.0.18

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.
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  export declare const CaretRight: () => JSX.Element;
3
2
  export declare const CaretDown: () => JSX.Element;
package/dist/get-port.js CHANGED
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getDesiredPort = void 0;
7
7
  const net_1 = __importDefault(require("net"));
8
+ const p_limit_1 = require("./p-limit");
8
9
  const getAvailablePort = (portToTry) => new Promise((resolve) => {
9
10
  let status = 'unavailable';
10
11
  const host = '127.0.0.1';
@@ -40,7 +41,7 @@ const getPort = async (from, to) => {
40
41
  }
41
42
  throw new Error('No available ports found');
42
43
  };
43
- const getDesiredPort = async (desiredPort, from, to) => {
44
+ const getDesiredPortUnlimited = async (desiredPort, from, to) => {
44
45
  if (typeof desiredPort !== 'undefined' &&
45
46
  (await getAvailablePort(desiredPort)) === 'available') {
46
47
  return desiredPort;
@@ -52,6 +53,10 @@ const getDesiredPort = async (desiredPort, from, to) => {
52
53
  }
53
54
  return actualPort;
54
55
  };
56
+ const limit = (0, p_limit_1.pLimit)(1);
57
+ const getDesiredPort = (desiredPort, from, to) => {
58
+ return limit(getDesiredPortUnlimited, desiredPort, from, to);
59
+ };
55
60
  exports.getDesiredPort = getDesiredPort;
56
61
  const makeRange = (from, to) => {
57
62
  if (!Number.isInteger(from) || !Number.isInteger(to)) {
@@ -0,0 +1 @@
1
+ export declare const pLimit: (concurrency: number) => <Arguments extends unknown[], ReturnType_1>(fn: (..._arguments: Arguments) => ReturnType_1 | PromiseLike<ReturnType_1>, ...args: Arguments) => Promise<ReturnType_1>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pLimit = void 0;
4
+ const pLimit = (concurrency) => {
5
+ const queue = [];
6
+ let activeCount = 0;
7
+ const next = () => {
8
+ var _a;
9
+ activeCount--;
10
+ if (queue.length > 0) {
11
+ (_a = queue.shift()) === null || _a === void 0 ? void 0 : _a();
12
+ }
13
+ };
14
+ const run = async (fn, resolve, ...args) => {
15
+ activeCount++;
16
+ // eslint-disable-next-line require-await
17
+ const result = (async () => fn(...args))();
18
+ resolve(result);
19
+ try {
20
+ await result;
21
+ }
22
+ catch (_a) { }
23
+ next();
24
+ };
25
+ const enqueue = (fn, resolve, ...args) => {
26
+ queue.push(() => run(fn, resolve, ...args));
27
+ (async () => {
28
+ var _a;
29
+ // This function needs to wait until the next microtask before comparing
30
+ // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
31
+ // when the run function is dequeued and called. The comparison in the if-statement
32
+ // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
33
+ await Promise.resolve();
34
+ if (activeCount < concurrency && queue.length > 0) {
35
+ (_a = queue.shift()) === null || _a === void 0 ? void 0 : _a();
36
+ }
37
+ })();
38
+ };
39
+ const generator = (fn, ...args) => new Promise((resolve) => {
40
+ enqueue(fn, resolve, ...args);
41
+ });
42
+ Object.defineProperties(generator, {
43
+ activeCount: {
44
+ get: () => activeCount,
45
+ },
46
+ pendingCount: {
47
+ get: () => queue.length,
48
+ },
49
+ clearQueue: {
50
+ value: () => {
51
+ queue.length = 0;
52
+ },
53
+ },
54
+ });
55
+ return generator;
56
+ };
57
+ exports.pLimit = pLimit;
@@ -20,18 +20,11 @@ if (!Root) {
20
20
  throw new Error('Root has not been registered.');
21
21
  }
22
22
  const handle = (0, remotion_1.delayRender)('Loading root component');
23
- const Fallback = () => {
24
- (0, react_1.useEffect)(() => {
25
- const fallback = (0, remotion_1.delayRender)('Waiting for Root component to unsuspend');
26
- return () => (0, remotion_1.continueRender)(fallback);
27
- }, []);
28
- return null;
29
- };
30
23
  const GetVideo = ({ state }) => {
31
- var _a;
32
24
  const video = remotion_1.Internals.useVideo();
33
25
  const compositions = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
34
26
  const [Component, setComponent] = (0, react_1.useState)(null);
27
+ const portalContainer = (0, react_1.useRef)(null);
35
28
  (0, react_1.useEffect)(() => {
36
29
  var _a;
37
30
  if (state.type !== 'composition') {
@@ -65,15 +58,28 @@ const GetVideo = ({ state }) => {
65
58
  (0, remotion_1.continueRender)(handle);
66
59
  }
67
60
  }, [Component, state.type]);
61
+ (0, react_1.useEffect)(() => {
62
+ if (!video) {
63
+ return;
64
+ }
65
+ const { current } = portalContainer;
66
+ if (!current) {
67
+ throw new Error('portal did not render');
68
+ }
69
+ current.appendChild(remotion_1.Internals.portalNode());
70
+ return () => {
71
+ current.removeChild(remotion_1.Internals.portalNode());
72
+ };
73
+ }, [video]);
68
74
  if (!video) {
69
75
  return null;
70
76
  }
71
- return ((0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Fallback, {}), children: (0, jsx_runtime_1.jsx)("div", { id: "remotion-canvas", style: {
72
- width: video.width,
73
- height: video.height,
74
- display: 'flex',
75
- backgroundColor: 'transparent',
76
- }, children: Component ? ((0, jsx_runtime_1.jsx)(Component, { ...((_a = video === null || video === void 0 ? void 0 : video.defaultProps) !== null && _a !== void 0 ? _a : {}), ...(0, remotion_1.getInputProps)() })) : null }) }));
77
+ return ((0, jsx_runtime_1.jsx)("div", { ref: portalContainer, id: "remotion-canvas", style: {
78
+ width: video.width,
79
+ height: video.height,
80
+ display: 'flex',
81
+ backgroundColor: 'transparent',
82
+ } }));
77
83
  };
78
84
  const videoContainer = document.getElementById('video-container');
79
85
  const explainerContainer = document.getElementById('explainer-container');
@@ -0,0 +1,4 @@
1
+ export declare const myPlugin: {
2
+ name: string;
3
+ setup: (build: any) => void;
4
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.myPlugin = void 0;
4
+ // tsc-helpers.js
5
+ const path = require('path');
6
+ const tsconfig = require('../../tsconfig.json');
7
+ const fixBaseUrl = (importPath) => importPath.startsWith('./')
8
+ ? importPath
9
+ : // Assumption: this is an aliased import
10
+ // Read tsconfig directly to avoid any drift
11
+ path.join(tsconfig.compilerOptions.baseUrl, importPath);
12
+ // some-plugin.js
13
+ exports.myPlugin = {
14
+ name: 'my-plugin',
15
+ setup: (build) => {
16
+ build.onResolve({ filter: /(.*)/ }, async (args) => {
17
+ args.path = fixBaseUrl(args.path);
18
+ // 🍕 delicious
19
+ });
20
+ },
21
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/bundler",
3
- "version": "3.0.17",
3
+ "version": "3.0.18",
4
4
  "description": "Bundler for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -30,7 +30,7 @@
30
30
  "memfs": "3.4.3",
31
31
  "mime-types": "2.1.34",
32
32
  "react-refresh": "0.9.0",
33
- "remotion": "3.0.17",
33
+ "remotion": "3.0.18",
34
34
  "semver": "7.3.4",
35
35
  "source-map": "0.6.1",
36
36
  "style-loader": "2.0.0",
@@ -75,5 +75,5 @@
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  },
78
- "gitHead": "c973653a9ced0d8793ce0cb03ce5f837b149d865"
78
+ "gitHead": "64eadd48b303d0f627ed5883f9200345af002ee2"
79
79
  }