@remotion/bundler 4.0.0-fastlambda.8 → 4.0.0-lambda.1
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 +7 -0
- package/dist/bundle.js +77 -0
- package/dist/dev-middleware/compatible-api.d.ts +1 -0
- package/dist/dev-middleware/is-color-supported.js +5 -1
- package/dist/dev-middleware/range-parser.d.ts +1 -1
- package/dist/error-overlay/react-overlay/utils/open-in-editor.js +5 -1
- package/dist/error-overlay/remotion-overlay/AskOnDiscord.js +1 -1
- package/dist/error-overlay/remotion-overlay/Button.js +1 -1
- package/dist/error-overlay/remotion-overlay/CodeFrame.js +2 -2
- package/dist/error-overlay/remotion-overlay/DismissButton.js +1 -1
- package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +2 -2
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +4 -4
- package/dist/error-overlay/remotion-overlay/ErrorTitle.js +1 -1
- package/dist/error-overlay/remotion-overlay/OpenInEditor.js +1 -1
- package/dist/error-overlay/remotion-overlay/Overlay.js +1 -1
- package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.js +1 -1
- package/dist/error-overlay/remotion-overlay/StackFrame.js +2 -2
- package/dist/error-overlay/remotion-overlay/Symbolicating.js +1 -1
- package/dist/error-overlay/remotion-overlay/carets.d.ts +0 -1
- package/dist/error-overlay/remotion-overlay/carets.js +2 -2
- package/dist/error-overlay/remotion-overlay/index.js +2 -2
- package/dist/get-port.js +20 -23
- package/dist/homepage/homepage.d.ts +0 -1
- package/dist/homepage/homepage.js +5 -6
- package/dist/hot-middleware/process-update.js +2 -2
- package/dist/index-html.d.ts +1 -0
- package/dist/index-html.js +40 -0
- package/dist/index.d.ts +18 -19
- package/dist/index.js +10 -16
- package/dist/json-parser.d.ts +7 -0
- package/dist/json-parser.js +177 -0
- package/dist/p-limit.d.ts +1 -0
- package/dist/p-limit.js +57 -0
- package/dist/read.d.ts +6 -0
- package/dist/read.js +183 -0
- package/dist/renderEntry.js +51 -38
- package/dist/routes.d.ts +8 -0
- package/dist/routes.js +122 -0
- package/dist/serve-static.d.ts +26 -0
- package/dist/serve-static.js +72 -0
- package/dist/setup-environment.js +0 -1
- package/dist/start-server-pure.d.ts +8 -0
- package/dist/start-server-pure.js +68 -0
- package/dist/start-server.d.ts +6 -6
- package/dist/start-server.js +4 -4
- package/dist/static-server.d.ts +0 -0
- package/dist/static-server.js +1 -0
- package/dist/webpack-config.d.ts +2 -1
- package/dist/webpack-config.js +11 -21
- package/package.json +4 -18
- package/web/favicon.png +0 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* body-parser
|
|
3
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
4
|
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
/**
|
|
10
|
+
* Module dependencies.
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
const bytes = require('bytes');
|
|
14
|
+
const contentType = require('content-type');
|
|
15
|
+
const createError = require('http-errors');
|
|
16
|
+
const debug = require('debug')('body-parser:json');
|
|
17
|
+
const read = require('../read');
|
|
18
|
+
const typeis = require('type-is');
|
|
19
|
+
/**
|
|
20
|
+
* Module exports.
|
|
21
|
+
*/
|
|
22
|
+
module.exports = json;
|
|
23
|
+
/**
|
|
24
|
+
* RegExp to match the first non-space in a string.
|
|
25
|
+
*
|
|
26
|
+
* Allowed whitespace is defined in RFC 7159:
|
|
27
|
+
*
|
|
28
|
+
* ws = *(
|
|
29
|
+
* %x20 / ; Space
|
|
30
|
+
* %x09 / ; Horizontal tab
|
|
31
|
+
* %x0A / ; Line feed or New line
|
|
32
|
+
* %x0D ) ; Carriage return
|
|
33
|
+
*/
|
|
34
|
+
const FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/; // eslint-disable-line no-control-regex
|
|
35
|
+
/**
|
|
36
|
+
* Create a middleware to parse JSON bodies.
|
|
37
|
+
*
|
|
38
|
+
* @param {object} [options]
|
|
39
|
+
* @return {function}
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
function json() {
|
|
43
|
+
const limit = 100 * 1024 * 1024;
|
|
44
|
+
const inflate = true;
|
|
45
|
+
const strict = true;
|
|
46
|
+
const type = 'application/json';
|
|
47
|
+
const verify = false;
|
|
48
|
+
if (verify !== false && typeof verify !== 'function') {
|
|
49
|
+
throw new TypeError('option verify must be function');
|
|
50
|
+
}
|
|
51
|
+
// create the appropriate type checking function
|
|
52
|
+
const shouldParse = typeof type === 'function' ? type : typeChecker(type);
|
|
53
|
+
function parse(body) {
|
|
54
|
+
if (body.length === 0) {
|
|
55
|
+
// special-case empty json body, as it's a common client-side mistake
|
|
56
|
+
// TODO: maybe make this configurable or part of "strict" option
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
if (strict) {
|
|
60
|
+
const first = firstchar(body);
|
|
61
|
+
if (first !== '{' && first !== '[') {
|
|
62
|
+
debug('strict violation');
|
|
63
|
+
throw createStrictSyntaxError(body, first);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
debug('parse json');
|
|
68
|
+
return JSON.parse(body);
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
throw normalizeJsonSyntaxError(e, {
|
|
72
|
+
message: e.message,
|
|
73
|
+
stack: e.stack,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return function jsonParser(req, res) {
|
|
78
|
+
// skip requests without bodies
|
|
79
|
+
if (!typeis.hasBody(req)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// determine if request should be parsed
|
|
83
|
+
if (!shouldParse(req)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// assert charset per RFC 7159 sec 8.1
|
|
87
|
+
const charset = getCharset(req) || 'utf-8';
|
|
88
|
+
if (charset.slice(0, 4) !== 'utf-') {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
// read
|
|
92
|
+
read(req, res, parse, {
|
|
93
|
+
encoding: charset,
|
|
94
|
+
inflate,
|
|
95
|
+
limit,
|
|
96
|
+
verify,
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Create strict violation syntax error matching native error.
|
|
102
|
+
*
|
|
103
|
+
* @param {string} str
|
|
104
|
+
* @param {string} char
|
|
105
|
+
* @return {Error}
|
|
106
|
+
* @private
|
|
107
|
+
*/
|
|
108
|
+
function createStrictSyntaxError(str, char) {
|
|
109
|
+
const index = str.indexOf(char);
|
|
110
|
+
const partial = index !== -1 ? str.substring(0, index) + '#' : '';
|
|
111
|
+
try {
|
|
112
|
+
JSON.parse(partial);
|
|
113
|
+
/* istanbul ignore next */ throw new SyntaxError('strict violation');
|
|
114
|
+
}
|
|
115
|
+
catch (e) {
|
|
116
|
+
return normalizeJsonSyntaxError(e, {
|
|
117
|
+
message: e.message.replace('#', char),
|
|
118
|
+
stack: e.stack,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Get the first non-whitespace character in a string.
|
|
124
|
+
*
|
|
125
|
+
* @param {string} str
|
|
126
|
+
* @return {function}
|
|
127
|
+
* @private
|
|
128
|
+
*/
|
|
129
|
+
function firstchar(str) {
|
|
130
|
+
const match = FIRST_CHAR_REGEXP.exec(str);
|
|
131
|
+
return match ? match[1] : undefined;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Get the charset of a request.
|
|
135
|
+
*
|
|
136
|
+
* @param {object} req
|
|
137
|
+
* @api private
|
|
138
|
+
*/
|
|
139
|
+
function getCharset(req) {
|
|
140
|
+
try {
|
|
141
|
+
return (contentType.parse(req).parameters.charset || '').toLowerCase();
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Normalize a SyntaxError for JSON.parse.
|
|
149
|
+
*
|
|
150
|
+
* @param {SyntaxError} error
|
|
151
|
+
* @param {object} obj
|
|
152
|
+
* @return {SyntaxError}
|
|
153
|
+
*/
|
|
154
|
+
function normalizeJsonSyntaxError(error, obj) {
|
|
155
|
+
const keys = Object.getOwnPropertyNames(error);
|
|
156
|
+
for (let i = 0; i < keys.length; i++) {
|
|
157
|
+
const key = keys[i];
|
|
158
|
+
if (key !== 'stack' && key !== 'message') {
|
|
159
|
+
delete error[key];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// replace stack before message for Node.js 0.10 and below
|
|
163
|
+
error.stack = obj.stack.replace(error.message, obj.message);
|
|
164
|
+
error.message = obj.message;
|
|
165
|
+
return error;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get the simple type checker.
|
|
169
|
+
*
|
|
170
|
+
* @param {string} type
|
|
171
|
+
* @return {function}
|
|
172
|
+
*/
|
|
173
|
+
function typeChecker(type) {
|
|
174
|
+
return function checkType(req) {
|
|
175
|
+
return Boolean(typeis(req, type));
|
|
176
|
+
};
|
|
177
|
+
}
|
|
@@ -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>;
|
package/dist/p-limit.js
ADDED
|
@@ -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;
|
package/dist/read.d.ts
ADDED
package/dist/read.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* body-parser
|
|
3
|
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
4
|
+
* MIT Licensed
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
/**
|
|
9
|
+
* Module dependencies.
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
const createError = require('http-errors');
|
|
13
|
+
const destroy = require('destroy');
|
|
14
|
+
const getBody = require('raw-body');
|
|
15
|
+
const iconv = require('iconv-lite');
|
|
16
|
+
const onFinished = require('on-finished');
|
|
17
|
+
const unpipe = require('unpipe');
|
|
18
|
+
const zlib = require('zlib');
|
|
19
|
+
/**
|
|
20
|
+
* Module exports.
|
|
21
|
+
*/
|
|
22
|
+
module.exports = read;
|
|
23
|
+
/**
|
|
24
|
+
* Read a request into a buffer and parse.
|
|
25
|
+
*
|
|
26
|
+
* @param {object} req
|
|
27
|
+
* @param {object} res
|
|
28
|
+
* @param {function} next
|
|
29
|
+
* @param {function} parse
|
|
30
|
+
* @param {function} debug
|
|
31
|
+
* @param {object} options
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
function read(req, res, parse, debug, options) {
|
|
35
|
+
let length;
|
|
36
|
+
const opts = options;
|
|
37
|
+
let stream;
|
|
38
|
+
// flag as parsed
|
|
39
|
+
req._body = true;
|
|
40
|
+
// read options
|
|
41
|
+
const encoding = opts.encoding !== null ? opts.encoding : null;
|
|
42
|
+
const { verify } = opts;
|
|
43
|
+
try {
|
|
44
|
+
// get the content stream
|
|
45
|
+
stream = contentstream(req, debug, opts.inflate);
|
|
46
|
+
length = stream.length;
|
|
47
|
+
stream.length = undefined;
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
return next(err);
|
|
51
|
+
}
|
|
52
|
+
// set raw-body options
|
|
53
|
+
opts.length = length;
|
|
54
|
+
opts.encoding = verify ? null : encoding;
|
|
55
|
+
// assert charset is supported
|
|
56
|
+
if (opts.encoding === null &&
|
|
57
|
+
encoding !== null &&
|
|
58
|
+
!iconv.encodingExists(encoding)) {
|
|
59
|
+
return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
|
60
|
+
charset: encoding.toLowerCase(),
|
|
61
|
+
type: 'charset.unsupported',
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
// read body
|
|
65
|
+
debug('read body');
|
|
66
|
+
getBody(stream, opts, (error, body) => {
|
|
67
|
+
if (error) {
|
|
68
|
+
let _error;
|
|
69
|
+
if (error.type === 'encoding.unsupported') {
|
|
70
|
+
// echo back charset
|
|
71
|
+
_error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
|
72
|
+
charset: encoding.toLowerCase(),
|
|
73
|
+
type: 'charset.unsupported',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// set status code on error
|
|
78
|
+
_error = createError(400, error);
|
|
79
|
+
}
|
|
80
|
+
// unpipe from stream and destroy
|
|
81
|
+
if (stream !== req) {
|
|
82
|
+
unpipe(req);
|
|
83
|
+
destroy(stream, true);
|
|
84
|
+
}
|
|
85
|
+
// read off entire request
|
|
86
|
+
dump(req, function onfinished() {
|
|
87
|
+
next(createError(400, _error));
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
// verify
|
|
92
|
+
if (verify) {
|
|
93
|
+
try {
|
|
94
|
+
debug('verify body');
|
|
95
|
+
verify(req, res, body, encoding);
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
next(createError(403, err, {
|
|
99
|
+
body,
|
|
100
|
+
type: err.type || 'entity.verify.failed',
|
|
101
|
+
}));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// parse
|
|
106
|
+
let str = body;
|
|
107
|
+
try {
|
|
108
|
+
debug('parse body');
|
|
109
|
+
str =
|
|
110
|
+
typeof body !== 'string' && encoding !== null
|
|
111
|
+
? iconv.decode(body, encoding)
|
|
112
|
+
: body;
|
|
113
|
+
req.body = parse(str);
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
next(createError(400, err, {
|
|
117
|
+
body: str,
|
|
118
|
+
type: err.type || 'entity.parse.failed',
|
|
119
|
+
}));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
next();
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get the content stream of the request.
|
|
127
|
+
*
|
|
128
|
+
* @param {object} req
|
|
129
|
+
* @param {function} debug
|
|
130
|
+
* @param {boolean} [inflate=true]
|
|
131
|
+
* @return {object}
|
|
132
|
+
* @api private
|
|
133
|
+
*/
|
|
134
|
+
function contentstream(req, debug, inflate) {
|
|
135
|
+
const encoding = (req.headers['content-encoding'] || 'identity').toLowerCase();
|
|
136
|
+
const length = req.headers['content-length'];
|
|
137
|
+
let stream;
|
|
138
|
+
debug('content-encoding "%s"', encoding);
|
|
139
|
+
if (inflate === false && encoding !== 'identity') {
|
|
140
|
+
throw createError(415, 'content encoding unsupported', {
|
|
141
|
+
encoding,
|
|
142
|
+
type: 'encoding.unsupported',
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
switch (encoding) {
|
|
146
|
+
case 'deflate':
|
|
147
|
+
stream = zlib.createInflate();
|
|
148
|
+
debug('inflate body');
|
|
149
|
+
req.pipe(stream);
|
|
150
|
+
break;
|
|
151
|
+
case 'gzip':
|
|
152
|
+
stream = zlib.createGunzip();
|
|
153
|
+
debug('gunzip body');
|
|
154
|
+
req.pipe(stream);
|
|
155
|
+
break;
|
|
156
|
+
case 'identity':
|
|
157
|
+
stream = req;
|
|
158
|
+
stream.length = length;
|
|
159
|
+
break;
|
|
160
|
+
default:
|
|
161
|
+
throw createError(415, 'unsupported content encoding "' + encoding + '"', {
|
|
162
|
+
encoding,
|
|
163
|
+
type: 'encoding.unsupported',
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return stream;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Dump the contents of a request.
|
|
170
|
+
*
|
|
171
|
+
* @param {object} req
|
|
172
|
+
* @param {function} callback
|
|
173
|
+
* @api private
|
|
174
|
+
*/
|
|
175
|
+
function dump(req, callback) {
|
|
176
|
+
if (onFinished.isFinished(req)) {
|
|
177
|
+
callback(null);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
onFinished(req, callback);
|
|
181
|
+
req.resume();
|
|
182
|
+
}
|
|
183
|
+
}
|
package/dist/renderEntry.js
CHANGED
|
@@ -15,23 +15,14 @@ const remotion_1 = require("remotion");
|
|
|
15
15
|
const bundle_mode_1 = require("./bundle-mode");
|
|
16
16
|
const homepage_1 = require("./homepage/homepage");
|
|
17
17
|
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(null, '#fff'));
|
|
18
|
-
const Root = remotion_1.Internals.getRoot();
|
|
19
|
-
if (!Root) {
|
|
20
|
-
throw new Error('Root has not been registered.');
|
|
21
|
-
}
|
|
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
18
|
const GetVideo = ({ state }) => {
|
|
31
|
-
var _a;
|
|
32
19
|
const video = remotion_1.Internals.useVideo();
|
|
33
20
|
const compositions = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
34
|
-
const
|
|
21
|
+
const portalContainer = (0, react_1.useRef)(null);
|
|
22
|
+
const [handle] = (0, react_1.useState)(() => (0, remotion_1.delayRender)('Wait for Composition' + JSON.stringify(state)));
|
|
23
|
+
(0, react_1.useEffect)(() => {
|
|
24
|
+
return () => (0, remotion_1.continueRender)(handle);
|
|
25
|
+
}, [handle]);
|
|
35
26
|
(0, react_1.useEffect)(() => {
|
|
36
27
|
var _a;
|
|
37
28
|
if (state.type !== 'composition') {
|
|
@@ -45,35 +36,36 @@ const GetVideo = ({ state }) => {
|
|
|
45
36
|
compositions.setCurrentComposition((_a = foundComposition === null || foundComposition === void 0 ? void 0 : foundComposition.id) !== null && _a !== void 0 ? _a : null);
|
|
46
37
|
}
|
|
47
38
|
}, [compositions, compositions.compositions, state, video]);
|
|
48
|
-
const fetchComponent = (0, react_1.useCallback)(() => {
|
|
49
|
-
if (!video) {
|
|
50
|
-
throw new Error('Expected to have video');
|
|
51
|
-
}
|
|
52
|
-
const Comp = video.component;
|
|
53
|
-
setComponent(Comp);
|
|
54
|
-
}, [video]);
|
|
55
|
-
(0, react_1.useEffect)(() => {
|
|
56
|
-
if (video) {
|
|
57
|
-
fetchComponent();
|
|
58
|
-
}
|
|
59
|
-
}, [fetchComponent, video]);
|
|
60
39
|
(0, react_1.useEffect)(() => {
|
|
61
40
|
if (state.type === 'evaluation') {
|
|
62
41
|
(0, remotion_1.continueRender)(handle);
|
|
63
42
|
}
|
|
64
|
-
else if (
|
|
43
|
+
else if (video) {
|
|
65
44
|
(0, remotion_1.continueRender)(handle);
|
|
66
45
|
}
|
|
67
|
-
}, [
|
|
46
|
+
}, [handle, state.type, video]);
|
|
47
|
+
(0, react_1.useEffect)(() => {
|
|
48
|
+
if (!video) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const { current } = portalContainer;
|
|
52
|
+
if (!current) {
|
|
53
|
+
throw new Error('portal did not render');
|
|
54
|
+
}
|
|
55
|
+
current.appendChild(remotion_1.Internals.portalNode());
|
|
56
|
+
return () => {
|
|
57
|
+
current.removeChild(remotion_1.Internals.portalNode());
|
|
58
|
+
};
|
|
59
|
+
}, [video]);
|
|
68
60
|
if (!video) {
|
|
69
61
|
return null;
|
|
70
62
|
}
|
|
71
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: portalContainer, id: "remotion-canvas", style: {
|
|
64
|
+
width: video.width,
|
|
65
|
+
height: video.height,
|
|
66
|
+
display: 'flex',
|
|
67
|
+
backgroundColor: 'transparent',
|
|
68
|
+
} }));
|
|
77
69
|
};
|
|
78
70
|
const videoContainer = document.getElementById('video-container');
|
|
79
71
|
const explainerContainer = document.getElementById('explainer-container');
|
|
@@ -83,10 +75,28 @@ let cleanupVideoContainer = () => {
|
|
|
83
75
|
let cleanupExplainerContainer = () => {
|
|
84
76
|
explainerContainer.innerHTML = '';
|
|
85
77
|
};
|
|
78
|
+
const waitForRootHandle = (0, remotion_1.delayRender)('Loading root component');
|
|
79
|
+
const WaitForRoot = () => {
|
|
80
|
+
const [Root, setRoot] = (0, react_1.useState)(() => remotion_1.Internals.getRoot());
|
|
81
|
+
(0, react_1.useEffect)(() => {
|
|
82
|
+
if (Root) {
|
|
83
|
+
(0, remotion_1.continueRender)(waitForRootHandle);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const cleanup = remotion_1.Internals.waitForRoot((NewRoot) => {
|
|
87
|
+
setRoot(() => NewRoot);
|
|
88
|
+
});
|
|
89
|
+
return () => cleanup();
|
|
90
|
+
}, [Root]);
|
|
91
|
+
if (Root === null) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return (0, jsx_runtime_1.jsx)(Root, {});
|
|
95
|
+
};
|
|
86
96
|
const renderContent = () => {
|
|
87
97
|
const bundleMode = (0, bundle_mode_1.getBundleMode)();
|
|
88
98
|
if (bundleMode.type === 'composition' || bundleMode.type === 'evaluation') {
|
|
89
|
-
const markup = ((0, jsx_runtime_1.jsxs)(remotion_1.Internals.RemotionRoot, { children: [(0, jsx_runtime_1.jsx)(
|
|
99
|
+
const markup = ((0, jsx_runtime_1.jsxs)(remotion_1.Internals.RemotionRoot, { children: [(0, jsx_runtime_1.jsx)(WaitForRoot, {}), (0, jsx_runtime_1.jsx)(GetVideo, { state: bundleMode })] }));
|
|
90
100
|
if (client_1.default.createRoot) {
|
|
91
101
|
const root = client_1.default.createRoot(videoContainer);
|
|
92
102
|
root.render(markup);
|
|
@@ -110,14 +120,14 @@ const renderContent = () => {
|
|
|
110
120
|
if (bundleMode.type === 'index' || bundleMode.type === 'evaluation') {
|
|
111
121
|
if (client_1.default.createRoot) {
|
|
112
122
|
const root = client_1.default.createRoot(explainerContainer);
|
|
113
|
-
root.render((0, jsx_runtime_1.jsx)(homepage_1.Homepage, {}
|
|
123
|
+
root.render((0, jsx_runtime_1.jsx)(homepage_1.Homepage, {}));
|
|
114
124
|
cleanupExplainerContainer = () => {
|
|
115
125
|
root.unmount();
|
|
116
126
|
};
|
|
117
127
|
}
|
|
118
128
|
else {
|
|
119
129
|
const root = client_1.default;
|
|
120
|
-
root.render((0, jsx_runtime_1.jsx)(homepage_1.Homepage, {}
|
|
130
|
+
root.render((0, jsx_runtime_1.jsx)(homepage_1.Homepage, {}), explainerContainer);
|
|
121
131
|
cleanupExplainerContainer = () => {
|
|
122
132
|
root.unmountComponentAtNode(explainerContainer);
|
|
123
133
|
};
|
|
@@ -138,6 +148,9 @@ const setBundleModeAndUpdate = (state) => {
|
|
|
138
148
|
exports.setBundleModeAndUpdate = setBundleModeAndUpdate;
|
|
139
149
|
if (typeof window !== 'undefined') {
|
|
140
150
|
window.getStaticCompositions = () => {
|
|
151
|
+
if (!remotion_1.Internals.getRoot()) {
|
|
152
|
+
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.');
|
|
153
|
+
}
|
|
141
154
|
if (!remotion_1.Internals.compositionsRef.current) {
|
|
142
155
|
throw new Error('Unexpectedly did not have a CompositionManager');
|
|
143
156
|
}
|
|
@@ -154,6 +167,6 @@ if (typeof window !== 'undefined') {
|
|
|
154
167
|
};
|
|
155
168
|
});
|
|
156
169
|
};
|
|
157
|
-
window.siteVersion = '
|
|
170
|
+
window.siteVersion = '3';
|
|
158
171
|
window.setBundleMode = exports.setBundleModeAndUpdate;
|
|
159
172
|
}
|
package/dist/routes.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
+
export declare const handleUpdate: (_: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
3
|
+
export declare const handleFallback: (hash: string, _: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
4
|
+
export declare const handleProjectInfo: (_: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
5
|
+
export declare const handleFileSource: (search: string, _: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
6
|
+
export declare const handleOpenInEditor: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
7
|
+
export declare const handleFavicon: (_: IncomingMessage, response: ServerResponse) => void;
|
|
8
|
+
export declare const handleRoutes: (hash: string, request: IncomingMessage, response: ServerResponse) => void | Promise<void>;
|