@remotion/bundler 4.0.466 → 4.0.467

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,438 +0,0 @@
1
- /**
2
- * Forked from css-loader v5.2.7
3
- * MIT License http://www.opensource.org/licenses/mit-license.php
4
- * Author Tobias Koppers @sokra
5
- *
6
- * Removed CSS Modules plugin dependencies (postcss-modules-*).
7
- */
8
- "use strict";
9
-
10
- const {fileURLToPath} = require("url");
11
- const path = require("path");
12
- const {urlToRequest} = require("loader-utils");
13
-
14
- const WEBPACK_IGNORE_COMMENT_REGEXP = /webpackIgnore:(\s+)?(true|false)/;
15
-
16
- exports.WEBPACK_IGNORE_COMMENT_REGEXP = WEBPACK_IGNORE_COMMENT_REGEXP;
17
-
18
- // eslint-disable-next-line no-useless-escape
19
- const regexSingleEscape = /[ -,.\/:-@[\]\^`{-~]/;
20
- const regexExcessiveSpaces =
21
- /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
22
-
23
- function escape(string) {
24
- let output = "";
25
- let counter = 0;
26
-
27
- while (counter < string.length) {
28
- const character = string.charAt(counter++);
29
- let value;
30
-
31
- if (/[\t\n\f\r\x0B]/.test(character)) {
32
- const codePoint = character.charCodeAt();
33
- value = `\\${codePoint.toString(16).toUpperCase()} `;
34
- } else if (character === "\\" || regexSingleEscape.test(character)) {
35
- value = `\\${character}`;
36
- } else {
37
- value = character;
38
- }
39
-
40
- output += value;
41
- }
42
-
43
- const firstChar = string.charAt(0);
44
-
45
- if (/^-[-\d]/.test(output)) {
46
- output = `\\-${output.slice(1)}`;
47
- } else if (/\d/.test(firstChar)) {
48
- output = `\\3${firstChar} ${output.slice(1)}`;
49
- }
50
-
51
- output = output.replace(regexExcessiveSpaces, ($0, $1, $2) => {
52
- if ($1 && $1.length % 2) {
53
- return $0;
54
- }
55
-
56
- return ($1 || "") + $2;
57
- });
58
- return output;
59
- }
60
-
61
- exports.escape = escape;
62
-
63
- function gobbleHex(str) {
64
- const lower = str.toLowerCase();
65
- let hex = "";
66
- let spaceTerminated = false;
67
-
68
- for (let i = 0; i < 6 && lower[i] !== undefined; i++) {
69
- const code = lower.charCodeAt(i);
70
- const valid = (code >= 97 && code <= 102) || (code >= 48 && code <= 57);
71
- spaceTerminated = code === 32;
72
-
73
- if (!valid) {
74
- break;
75
- }
76
-
77
- hex += lower[i];
78
- }
79
-
80
- if (hex.length === 0) {
81
- return undefined;
82
- }
83
-
84
- const codePoint = parseInt(hex, 16);
85
- const isSurrogate = codePoint >= 0xd800 && codePoint <= 0xdfff;
86
-
87
- if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10ffff) {
88
- return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
89
- }
90
-
91
- return [
92
- String.fromCodePoint(codePoint),
93
- hex.length + (spaceTerminated ? 1 : 0),
94
- ];
95
- }
96
-
97
- const CONTAINS_ESCAPE = /\\/;
98
-
99
- function unescape(str) {
100
- const needToProcess = CONTAINS_ESCAPE.test(str);
101
-
102
- if (!needToProcess) {
103
- return str;
104
- }
105
-
106
- let ret = "";
107
-
108
- for (let i = 0; i < str.length; i++) {
109
- if (str[i] === "\\") {
110
- const gobbled = gobbleHex(str.slice(i + 1, i + 7));
111
-
112
- if (gobbled !== undefined) {
113
- ret += gobbled[0];
114
- i += gobbled[1];
115
- continue;
116
- }
117
-
118
- if (str[i + 1] === "\\") {
119
- ret += "\\";
120
- i += 1;
121
- continue;
122
- }
123
-
124
- if (str.length === i + 1) {
125
- ret += str[i];
126
- }
127
-
128
- continue;
129
- }
130
-
131
- ret += str[i];
132
- }
133
-
134
- return ret;
135
- }
136
-
137
- exports.unescape = unescape;
138
-
139
- function normalizePath(file) {
140
- return path.sep === "\\" ? file.replace(/\\/g, "/") : file;
141
- }
142
-
143
- const NATIVE_WIN32_PATH = /^[A-Z]:[/\\]|^\\\\/i;
144
-
145
- function normalizeUrl(url, isStringValue) {
146
- let normalizedUrl = url
147
- .replace(/^( |\t\n|\r\n|\r|\f)*/g, "")
148
- .replace(/( |\t\n|\r\n|\r|\f)*$/g, "");
149
-
150
- if (isStringValue && /\\(\n|\r\n|\r|\f)/.test(normalizedUrl)) {
151
- normalizedUrl = normalizedUrl.replace(/\\(\n|\r\n|\r|\f)/g, "");
152
- }
153
-
154
- if (NATIVE_WIN32_PATH.test(url)) {
155
- try {
156
- normalizedUrl = decodeURI(normalizedUrl);
157
- } catch (error) {
158
- // Ignore
159
- }
160
-
161
- return normalizedUrl;
162
- }
163
-
164
- normalizedUrl = unescape(normalizedUrl);
165
-
166
- try {
167
- normalizedUrl = decodeURI(normalizedUrl);
168
- } catch (error) {
169
- // Ignore
170
- }
171
-
172
- return normalizedUrl;
173
- }
174
-
175
- exports.normalizeUrl = normalizeUrl;
176
-
177
- function requestify(url, rootContext) {
178
- if (/^file:/i.test(url)) {
179
- return fileURLToPath(url);
180
- }
181
-
182
- return url.charAt(0) === "/"
183
- ? urlToRequest(url, rootContext)
184
- : urlToRequest(url);
185
- }
186
-
187
- exports.requestify = requestify;
188
-
189
- function getFilter(filter, resourcePath) {
190
- return (...args) => {
191
- if (typeof filter === "function") {
192
- return filter(...args, resourcePath);
193
- }
194
-
195
- return true;
196
- };
197
- }
198
-
199
- exports.getFilter = getFilter;
200
-
201
- const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i;
202
- const ABSOLUTE_SCHEME = /^[a-z0-9+\-.]+:/i;
203
-
204
- function getURLType(source) {
205
- if (source[0] === "/") {
206
- if (source[1] === "/") {
207
- return "scheme-relative";
208
- }
209
-
210
- return "path-absolute";
211
- }
212
-
213
- if (IS_NATIVE_WIN32_PATH.test(source)) {
214
- return "path-absolute";
215
- }
216
-
217
- return ABSOLUTE_SCHEME.test(source) ? "absolute" : "path-relative";
218
- }
219
-
220
- exports.getURLType = getURLType;
221
-
222
- function normalizeSourceMap(map, resourcePath) {
223
- let newMap = map;
224
-
225
- if (typeof newMap === "string") {
226
- newMap = JSON.parse(newMap);
227
- }
228
-
229
- delete newMap.file;
230
- const {sourceRoot} = newMap;
231
- delete newMap.sourceRoot;
232
-
233
- if (newMap.sources) {
234
- newMap.sources = newMap.sources.map((source) => {
235
- if (source.indexOf("<") === 0) {
236
- return source;
237
- }
238
-
239
- const sourceType = getURLType(source);
240
-
241
- if (sourceType === "path-relative" || sourceType === "path-absolute") {
242
- const absoluteSource =
243
- sourceType === "path-relative" && sourceRoot
244
- ? path.resolve(sourceRoot, normalizePath(source))
245
- : normalizePath(source);
246
- return path.relative(path.dirname(resourcePath), absoluteSource);
247
- }
248
-
249
- return source;
250
- });
251
- }
252
-
253
- return newMap;
254
- }
255
-
256
- exports.normalizeSourceMap = normalizeSourceMap;
257
-
258
- function getPreRequester({loaders, loaderIndex}) {
259
- const cache = Object.create(null);
260
- return (number) => {
261
- if (cache[number]) {
262
- return cache[number];
263
- }
264
-
265
- if (number === false) {
266
- cache[number] = "";
267
- } else {
268
- const loadersRequest = loaders
269
- .slice(
270
- loaderIndex,
271
- loaderIndex + 1 + (typeof number !== "number" ? 0 : number),
272
- )
273
- .map((x) => x.request)
274
- .join("!");
275
- cache[number] = `-!${loadersRequest}!`;
276
- }
277
-
278
- return cache[number];
279
- };
280
- }
281
-
282
- exports.getPreRequester = getPreRequester;
283
-
284
- function getImportCode(imports, options) {
285
- let code = "";
286
-
287
- for (const item of imports) {
288
- const {importName, url} = item;
289
-
290
- if (options.esModule) {
291
- code += `import ${importName} from ${url};\n`;
292
- } else {
293
- code += `var ${importName} = require(${url});\n`;
294
- }
295
- }
296
-
297
- return code ? `// Imports\n${code}` : "";
298
- }
299
-
300
- exports.getImportCode = getImportCode;
301
-
302
- function normalizeSourceMapForRuntime(map, loaderContext) {
303
- const resultMap = map ? map.toJSON() : null;
304
-
305
- if (resultMap) {
306
- delete resultMap.file;
307
- resultMap.sourceRoot = "";
308
- resultMap.sources = resultMap.sources.map((source) => {
309
- if (source.indexOf("<") === 0) {
310
- return source;
311
- }
312
-
313
- const sourceType = getURLType(source);
314
-
315
- if (sourceType !== "path-relative") {
316
- return source;
317
- }
318
-
319
- const resourceDirname = path.dirname(loaderContext.resourcePath);
320
- const absoluteSource = path.resolve(resourceDirname, source);
321
- const contextifyPath = normalizePath(
322
- path.relative(loaderContext.rootContext, absoluteSource),
323
- );
324
- return `webpack://./${contextifyPath}`;
325
- });
326
- }
327
-
328
- return JSON.stringify(resultMap);
329
- }
330
-
331
- function getModuleCode(result, api, replacements, options, loaderContext) {
332
- const sourceMapValue = options.sourceMap
333
- ? `,${normalizeSourceMapForRuntime(result.map, loaderContext)}`
334
- : "";
335
- let code = JSON.stringify(result.css);
336
- let beforeCode = `var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(${options.sourceMap ? "___CSS_LOADER_API_SOURCEMAP_IMPORT___" : "function(i){return i[1]}"});\n`;
337
-
338
- for (const item of api) {
339
- const {url, media, dedupe} = item;
340
- beforeCode += url
341
- ? `___CSS_LOADER_EXPORT___.push([module.id, ${JSON.stringify(`@import url(${url});`)}${media ? `, ${JSON.stringify(media)}` : ""}]);\n`
342
- : `___CSS_LOADER_EXPORT___.i(${item.importName}${media ? `, ${JSON.stringify(media)}` : dedupe ? ', ""' : ""}${dedupe ? ", true" : ""});\n`;
343
- }
344
-
345
- for (const item of replacements) {
346
- const {replacementName, importName, localName} = item;
347
-
348
- if (localName) {
349
- code = code.replace(new RegExp(replacementName, "g"), () => {
350
- return `" + ${importName}.locals[${JSON.stringify(localName)}] + "`;
351
- });
352
- } else {
353
- const {hash, needQuotes} = item;
354
- const getUrlOptions = []
355
- .concat(hash ? [`hash: ${JSON.stringify(hash)}`] : [])
356
- .concat(needQuotes ? "needQuotes: true" : []);
357
- const preparedOptions =
358
- getUrlOptions.length > 0 ? `, { ${getUrlOptions.join(", ")} }` : "";
359
- beforeCode += `var ${replacementName} = ___CSS_LOADER_GET_URL_IMPORT___(${importName}${preparedOptions});\n`;
360
- code = code.replace(
361
- new RegExp(replacementName, "g"),
362
- () => `" + ${replacementName} + "`,
363
- );
364
- }
365
- }
366
-
367
- return `${beforeCode}// Module\n___CSS_LOADER_EXPORT___.push([module.id, ${code}, ""${sourceMapValue}]);\n`;
368
- }
369
-
370
- exports.getModuleCode = getModuleCode;
371
-
372
- function getExportCode(exports, replacements, needToUseIcssPlugin, options) {
373
- let code = "// Exports\n";
374
-
375
- if (!needToUseIcssPlugin) {
376
- code += `${options.esModule ? "export default" : "module.exports ="} ___CSS_LOADER_EXPORT___;\n`;
377
- return code;
378
- }
379
-
380
- // Simplified: no ICSS/modules export handling needed
381
- code += `${options.esModule ? "export default" : "module.exports ="} ___CSS_LOADER_EXPORT___;\n`;
382
- return code;
383
- }
384
-
385
- exports.getExportCode = getExportCode;
386
-
387
- async function resolveRequests(resolve, context, possibleRequests) {
388
- return resolve(context, possibleRequests[0])
389
- .then((result) => result)
390
- .catch((error) => {
391
- const [, ...tailPossibleRequests] = possibleRequests;
392
-
393
- if (tailPossibleRequests.length === 0) {
394
- throw error;
395
- }
396
-
397
- return resolveRequests(resolve, context, tailPossibleRequests);
398
- });
399
- }
400
-
401
- exports.resolveRequests = resolveRequests;
402
-
403
- function isUrlRequestable(url) {
404
- if (/^\/\//.test(url)) {
405
- return false;
406
- }
407
-
408
- if (/^file:/i.test(url)) {
409
- return true;
410
- }
411
-
412
- if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !NATIVE_WIN32_PATH.test(url)) {
413
- return false;
414
- }
415
-
416
- if (/^#/.test(url)) {
417
- return false;
418
- }
419
-
420
- return true;
421
- }
422
-
423
- exports.isUrlRequestable = isUrlRequestable;
424
-
425
- function sort(a, b) {
426
- return a.index - b.index;
427
- }
428
-
429
- exports.sort = sort;
430
-
431
- function combineRequests(preRequest, url) {
432
- const idx = url.indexOf("!=!");
433
- return idx !== -1
434
- ? url.slice(0, idx + 3) + preRequest + url.slice(idx + 3)
435
- : preRequest + url;
436
- }
437
-
438
- exports.combineRequests = combineRequests;