rollup 3.9.0 → 3.10.0
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/LICENSE.md +46 -29
- package/dist/bin/rollup +5 -5
- package/dist/es/rollup.js +3 -3
- package/dist/es/shared/rollup.js +434 -343
- package/dist/es/shared/watch.js +27 -15
- package/dist/loadConfigFile.js +3 -3
- package/dist/rollup.d.ts +4 -0
- package/dist/rollup.js +3 -3
- package/dist/shared/index.js +25 -13
- package/dist/shared/loadConfigFile.js +5 -5
- package/dist/shared/rollup.js +445 -355
- package/dist/shared/watch-cli.js +20 -12
- package/dist/shared/watch.js +3 -3
- package/package.json +36 -35
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.10.0
|
|
4
|
+
Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -14,7 +14,7 @@ const require$$0$1 = require('path');
|
|
|
14
14
|
const process$1 = require('node:process');
|
|
15
15
|
const node_perf_hooks = require('node:perf_hooks');
|
|
16
16
|
const node_crypto = require('node:crypto');
|
|
17
|
-
const
|
|
17
|
+
const promises = require('node:fs/promises');
|
|
18
18
|
const node_events = require('node:events');
|
|
19
19
|
const tty = require('tty');
|
|
20
20
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version$1 = "3.
|
|
34
|
+
var version$1 = "3.10.0";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -95,19 +95,6 @@ function locate(source, search, options) {
|
|
|
95
95
|
return getLocator$1(source, options)(search, options && options.startIndex);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
|
|
99
|
-
const RELATIVE_PATH_REGEX = /^\.?\.(\/|$)/;
|
|
100
|
-
function isAbsolute(path) {
|
|
101
|
-
return ABSOLUTE_PATH_REGEX.test(path);
|
|
102
|
-
}
|
|
103
|
-
function isRelative(path) {
|
|
104
|
-
return RELATIVE_PATH_REGEX.test(path);
|
|
105
|
-
}
|
|
106
|
-
const BACKSLASH_REGEX = /\\/g;
|
|
107
|
-
function normalize(path) {
|
|
108
|
-
return path.replace(BACKSLASH_REGEX, '/');
|
|
109
|
-
}
|
|
110
|
-
|
|
111
98
|
function spaces(index) {
|
|
112
99
|
let result = '';
|
|
113
100
|
while (index--)
|
|
@@ -142,6 +129,19 @@ function getCodeFrame(source, line, column) {
|
|
|
142
129
|
.join('\n');
|
|
143
130
|
}
|
|
144
131
|
|
|
132
|
+
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
|
|
133
|
+
const RELATIVE_PATH_REGEX = /^\.?\.(\/|$)/;
|
|
134
|
+
function isAbsolute(path) {
|
|
135
|
+
return ABSOLUTE_PATH_REGEX.test(path);
|
|
136
|
+
}
|
|
137
|
+
function isRelative(path) {
|
|
138
|
+
return RELATIVE_PATH_REGEX.test(path);
|
|
139
|
+
}
|
|
140
|
+
const BACKSLASH_REGEX = /\\/g;
|
|
141
|
+
function normalize(path) {
|
|
142
|
+
return path.replace(BACKSLASH_REGEX, '/');
|
|
143
|
+
}
|
|
144
|
+
|
|
145
145
|
function printQuotedStringList(list, verbs) {
|
|
146
146
|
const isSingleItem = list.length <= 1;
|
|
147
147
|
const quotedList = list.map(item => `"${item}"`);
|
|
@@ -202,7 +202,7 @@ function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName)
|
|
|
202
202
|
return [...relativePath.split('/'), '..', node_path.basename(targetPath)].join('/');
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
return
|
|
205
|
+
return relativePath ? (relativePath.startsWith('..') ? relativePath : './' + relativePath) : '.';
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
function error(base) {
|
|
@@ -482,7 +482,7 @@ function errorInternalIdCannotBeExternal(source, importer) {
|
|
|
482
482
|
function errorInvalidOption(option, urlHash, explanation, value) {
|
|
483
483
|
return {
|
|
484
484
|
code: INVALID_OPTION,
|
|
485
|
-
message: `Invalid value ${value
|
|
485
|
+
message: `Invalid value ${value === undefined ? '' : `${JSON.stringify(value)} `}for option "${option}" - ${explanation}.`,
|
|
486
486
|
url: `https://rollupjs.org/guide/en/#${urlHash}`
|
|
487
487
|
};
|
|
488
488
|
}
|
|
@@ -1084,8 +1084,8 @@ function getFsEvents() {
|
|
|
1084
1084
|
|
|
1085
1085
|
const fseventsImporter = /*#__PURE__*/Object.defineProperty({
|
|
1086
1086
|
__proto__: null,
|
|
1087
|
-
|
|
1088
|
-
|
|
1087
|
+
getFsEvents,
|
|
1088
|
+
loadFsEvents
|
|
1089
1089
|
}, Symbol.toStringTag, { value: 'Module' });
|
|
1090
1090
|
|
|
1091
1091
|
const {
|
|
@@ -1231,126 +1231,166 @@ function handleError(error, recover = false) {
|
|
|
1231
1231
|
process$1.exit(1);
|
|
1232
1232
|
}
|
|
1233
1233
|
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
segmentify(line, segment, j);
|
|
1254
|
-
j = 0;
|
|
1255
|
-
}
|
|
1256
|
-
else if (c === 59) { // ";"
|
|
1257
|
-
segmentify(line, segment, j);
|
|
1258
|
-
j = 0;
|
|
1259
|
-
decoded.push(line);
|
|
1260
|
-
line = [];
|
|
1261
|
-
segment[0] = 0;
|
|
1234
|
+
const comma = ','.charCodeAt(0);
|
|
1235
|
+
const semicolon = ';'.charCodeAt(0);
|
|
1236
|
+
const chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
1237
|
+
const intToChar = new Uint8Array(64); // 64 possible chars.
|
|
1238
|
+
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
|
1239
|
+
for (let i = 0; i < chars$1.length; i++) {
|
|
1240
|
+
const c = chars$1.charCodeAt(i);
|
|
1241
|
+
intToChar[i] = c;
|
|
1242
|
+
charToInt[c] = i;
|
|
1243
|
+
}
|
|
1244
|
+
// Provide a fallback for older environments.
|
|
1245
|
+
const td = typeof TextDecoder !== 'undefined'
|
|
1246
|
+
? /* #__PURE__ */ new TextDecoder()
|
|
1247
|
+
: typeof Buffer !== 'undefined'
|
|
1248
|
+
? {
|
|
1249
|
+
decode(buf) {
|
|
1250
|
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
1251
|
+
return out.toString();
|
|
1252
|
+
},
|
|
1262
1253
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1254
|
+
: {
|
|
1255
|
+
decode(buf) {
|
|
1256
|
+
let out = '';
|
|
1257
|
+
for (let i = 0; i < buf.length; i++) {
|
|
1258
|
+
out += String.fromCharCode(buf[i]);
|
|
1259
|
+
}
|
|
1260
|
+
return out;
|
|
1261
|
+
},
|
|
1262
|
+
};
|
|
1263
|
+
function decode(mappings) {
|
|
1264
|
+
const state = new Int32Array(5);
|
|
1265
|
+
const decoded = [];
|
|
1266
|
+
let index = 0;
|
|
1267
|
+
do {
|
|
1268
|
+
const semi = indexOf(mappings, index);
|
|
1269
|
+
const line = [];
|
|
1270
|
+
let sorted = true;
|
|
1271
|
+
let lastCol = 0;
|
|
1272
|
+
state[0] = 0;
|
|
1273
|
+
for (let i = index; i < semi; i++) {
|
|
1274
|
+
let seg;
|
|
1275
|
+
i = decodeInteger(mappings, i, state, 0); // genColumn
|
|
1276
|
+
const col = state[0];
|
|
1277
|
+
if (col < lastCol)
|
|
1278
|
+
sorted = false;
|
|
1279
|
+
lastCol = col;
|
|
1280
|
+
if (hasMoreVlq(mappings, i, semi)) {
|
|
1281
|
+
i = decodeInteger(mappings, i, state, 1); // sourcesIndex
|
|
1282
|
+
i = decodeInteger(mappings, i, state, 2); // sourceLine
|
|
1283
|
+
i = decodeInteger(mappings, i, state, 3); // sourceColumn
|
|
1284
|
+
if (hasMoreVlq(mappings, i, semi)) {
|
|
1285
|
+
i = decodeInteger(mappings, i, state, 4); // namesIndex
|
|
1286
|
+
seg = [col, state[1], state[2], state[3], state[4]];
|
|
1287
|
+
}
|
|
1288
|
+
else {
|
|
1289
|
+
seg = [col, state[1], state[2], state[3]];
|
|
1290
|
+
}
|
|
1273
1291
|
}
|
|
1274
1292
|
else {
|
|
1275
|
-
|
|
1276
|
-
value >>>= 1;
|
|
1277
|
-
if (shouldNegate) {
|
|
1278
|
-
value = value === 0 ? -0x80000000 : -value;
|
|
1279
|
-
}
|
|
1280
|
-
segment[j] += value;
|
|
1281
|
-
j++;
|
|
1282
|
-
value = shift = 0; // reset
|
|
1293
|
+
seg = [col];
|
|
1283
1294
|
}
|
|
1295
|
+
line.push(seg);
|
|
1284
1296
|
}
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1297
|
+
if (!sorted)
|
|
1298
|
+
sort(line);
|
|
1299
|
+
decoded.push(line);
|
|
1300
|
+
index = semi + 1;
|
|
1301
|
+
} while (index <= mappings.length);
|
|
1288
1302
|
return decoded;
|
|
1289
1303
|
}
|
|
1290
|
-
function
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
+
function indexOf(mappings, index) {
|
|
1305
|
+
const idx = mappings.indexOf(';', index);
|
|
1306
|
+
return idx === -1 ? mappings.length : idx;
|
|
1307
|
+
}
|
|
1308
|
+
function decodeInteger(mappings, pos, state, j) {
|
|
1309
|
+
let value = 0;
|
|
1310
|
+
let shift = 0;
|
|
1311
|
+
let integer = 0;
|
|
1312
|
+
do {
|
|
1313
|
+
const c = mappings.charCodeAt(pos++);
|
|
1314
|
+
integer = charToInt[c];
|
|
1315
|
+
value |= (integer & 31) << shift;
|
|
1316
|
+
shift += 5;
|
|
1317
|
+
} while (integer & 32);
|
|
1318
|
+
const shouldNegate = value & 1;
|
|
1319
|
+
value >>>= 1;
|
|
1320
|
+
if (shouldNegate) {
|
|
1321
|
+
value = -0x80000000 | -value;
|
|
1322
|
+
}
|
|
1323
|
+
state[j] += value;
|
|
1324
|
+
return pos;
|
|
1325
|
+
}
|
|
1326
|
+
function hasMoreVlq(mappings, i, length) {
|
|
1327
|
+
if (i >= length)
|
|
1328
|
+
return false;
|
|
1329
|
+
return mappings.charCodeAt(i) !== comma;
|
|
1330
|
+
}
|
|
1331
|
+
function sort(line) {
|
|
1332
|
+
line.sort(sortComparator);
|
|
1333
|
+
}
|
|
1334
|
+
function sortComparator(a, b) {
|
|
1335
|
+
return a[0] - b[0];
|
|
1304
1336
|
}
|
|
1305
1337
|
function encode(decoded) {
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1338
|
+
const state = new Int32Array(5);
|
|
1339
|
+
const bufLength = 1024 * 16;
|
|
1340
|
+
const subLength = bufLength - 36;
|
|
1341
|
+
const buf = new Uint8Array(bufLength);
|
|
1342
|
+
const sub = buf.subarray(0, subLength);
|
|
1343
|
+
let pos = 0;
|
|
1344
|
+
let out = '';
|
|
1345
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
1346
|
+
const line = decoded[i];
|
|
1347
|
+
if (i > 0) {
|
|
1348
|
+
if (pos === bufLength) {
|
|
1349
|
+
out += td.decode(buf);
|
|
1350
|
+
pos = 0;
|
|
1351
|
+
}
|
|
1352
|
+
buf[pos++] = semicolon;
|
|
1353
|
+
}
|
|
1315
1354
|
if (line.length === 0)
|
|
1316
1355
|
continue;
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
}
|
|
1340
|
-
return
|
|
1341
|
-
}
|
|
1342
|
-
function encodeInteger(
|
|
1343
|
-
|
|
1356
|
+
state[0] = 0;
|
|
1357
|
+
for (let j = 0; j < line.length; j++) {
|
|
1358
|
+
const segment = line[j];
|
|
1359
|
+
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
|
1360
|
+
// may push a comma.
|
|
1361
|
+
if (pos > subLength) {
|
|
1362
|
+
out += td.decode(sub);
|
|
1363
|
+
buf.copyWithin(0, subLength, pos);
|
|
1364
|
+
pos -= subLength;
|
|
1365
|
+
}
|
|
1366
|
+
if (j > 0)
|
|
1367
|
+
buf[pos++] = comma;
|
|
1368
|
+
pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
|
|
1369
|
+
if (segment.length === 1)
|
|
1370
|
+
continue;
|
|
1371
|
+
pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
|
|
1372
|
+
pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
|
|
1373
|
+
pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
|
|
1374
|
+
if (segment.length === 4)
|
|
1375
|
+
continue;
|
|
1376
|
+
pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
return out + td.decode(buf.subarray(0, pos));
|
|
1380
|
+
}
|
|
1381
|
+
function encodeInteger(buf, pos, state, segment, j) {
|
|
1382
|
+
const next = segment[j];
|
|
1383
|
+
let num = next - state[j];
|
|
1384
|
+
state[j] = next;
|
|
1344
1385
|
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
1345
1386
|
do {
|
|
1346
|
-
|
|
1387
|
+
let clamped = num & 0b011111;
|
|
1347
1388
|
num >>>= 5;
|
|
1348
|
-
if (num > 0)
|
|
1349
|
-
clamped |=
|
|
1350
|
-
|
|
1351
|
-
result += chars$1[clamped];
|
|
1389
|
+
if (num > 0)
|
|
1390
|
+
clamped |= 0b100000;
|
|
1391
|
+
buf[pos++] = intToChar[clamped];
|
|
1352
1392
|
} while (num > 0);
|
|
1353
|
-
return
|
|
1393
|
+
return pos;
|
|
1354
1394
|
}
|
|
1355
1395
|
|
|
1356
1396
|
class BitSet {
|
|
@@ -3218,9 +3258,16 @@ function getDefaultExportFromCjs (x) {
|
|
|
3218
3258
|
}
|
|
3219
3259
|
|
|
3220
3260
|
function getAugmentedNamespace(n) {
|
|
3261
|
+
if (n.__esModule) return n;
|
|
3221
3262
|
var f = n.default;
|
|
3222
3263
|
if (typeof f == "function") {
|
|
3223
|
-
var a = function () {
|
|
3264
|
+
var a = function a () {
|
|
3265
|
+
if (this instanceof a) {
|
|
3266
|
+
var args = [null];
|
|
3267
|
+
args.push.apply(args, arguments);
|
|
3268
|
+
var Ctor = Function.bind.apply(f, args);
|
|
3269
|
+
return new Ctor();
|
|
3270
|
+
}
|
|
3224
3271
|
return f.apply(this, arguments);
|
|
3225
3272
|
};
|
|
3226
3273
|
a.prototype = f.prototype;
|
|
@@ -3238,7 +3285,11 @@ function getAugmentedNamespace(n) {
|
|
|
3238
3285
|
return a;
|
|
3239
3286
|
}
|
|
3240
3287
|
|
|
3241
|
-
|
|
3288
|
+
exports.picomatchExports = {};
|
|
3289
|
+
var picomatch$1 = {
|
|
3290
|
+
get exports(){ return exports.picomatchExports; },
|
|
3291
|
+
set exports(v){ exports.picomatchExports = v; },
|
|
3292
|
+
};
|
|
3242
3293
|
|
|
3243
3294
|
var utils$3 = {};
|
|
3244
3295
|
|
|
@@ -5305,7 +5356,7 @@ var picomatch_1 = picomatch;
|
|
|
5305
5356
|
module.exports = picomatch_1;
|
|
5306
5357
|
} (picomatch$1));
|
|
5307
5358
|
|
|
5308
|
-
const pm = /*@__PURE__*/getDefaultExportFromCjs(
|
|
5359
|
+
const pm = /*@__PURE__*/getDefaultExportFromCjs(exports.picomatchExports);
|
|
5309
5360
|
|
|
5310
5361
|
const extractors = {
|
|
5311
5362
|
ArrayPattern(names, param) {
|
|
@@ -5408,8 +5459,8 @@ const createFilter = function createFilter(include, exclude, options) {
|
|
|
5408
5459
|
};
|
|
5409
5460
|
|
|
5410
5461
|
const reservedWords$1 = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
|
|
5411
|
-
const builtins
|
|
5412
|
-
const forbiddenIdentifiers = new Set(`${reservedWords$1} ${builtins
|
|
5462
|
+
const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
|
|
5463
|
+
const forbiddenIdentifiers = new Set(`${reservedWords$1} ${builtins}`.split(' '));
|
|
5413
5464
|
forbiddenIdentifiers.add('');
|
|
5414
5465
|
|
|
5415
5466
|
const BROKEN_FLOW_NONE = 0;
|
|
@@ -6607,21 +6658,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
6607
6658
|
for (let index = properties.length - 1; index >= 0; index--) {
|
|
6608
6659
|
const { key, kind, property } = properties[index];
|
|
6609
6660
|
allProperties.push(property);
|
|
6610
|
-
if (typeof key
|
|
6611
|
-
if (key === UnknownInteger) {
|
|
6612
|
-
unknownIntegerProps.push(property);
|
|
6613
|
-
continue;
|
|
6614
|
-
}
|
|
6615
|
-
if (kind === 'set')
|
|
6616
|
-
unmatchableSetters.push(property);
|
|
6617
|
-
if (kind === 'get')
|
|
6618
|
-
unmatchableGetters.push(property);
|
|
6619
|
-
if (kind !== 'get')
|
|
6620
|
-
unmatchablePropertiesAndSetters.push(property);
|
|
6621
|
-
if (kind !== 'set')
|
|
6622
|
-
unmatchablePropertiesAndGetters.push(property);
|
|
6623
|
-
}
|
|
6624
|
-
else {
|
|
6661
|
+
if (typeof key === 'string') {
|
|
6625
6662
|
if (kind === 'set') {
|
|
6626
6663
|
if (!propertiesAndSettersByKey[key]) {
|
|
6627
6664
|
propertiesAndSettersByKey[key] = [property, ...unmatchablePropertiesAndSetters];
|
|
@@ -6643,6 +6680,20 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
6643
6680
|
}
|
|
6644
6681
|
}
|
|
6645
6682
|
}
|
|
6683
|
+
else {
|
|
6684
|
+
if (key === UnknownInteger) {
|
|
6685
|
+
unknownIntegerProps.push(property);
|
|
6686
|
+
continue;
|
|
6687
|
+
}
|
|
6688
|
+
if (kind === 'set')
|
|
6689
|
+
unmatchableSetters.push(property);
|
|
6690
|
+
if (kind === 'get')
|
|
6691
|
+
unmatchableGetters.push(property);
|
|
6692
|
+
if (kind !== 'get')
|
|
6693
|
+
unmatchablePropertiesAndSetters.push(property);
|
|
6694
|
+
if (kind !== 'set')
|
|
6695
|
+
unmatchablePropertiesAndGetters.push(property);
|
|
6696
|
+
}
|
|
6646
6697
|
}
|
|
6647
6698
|
}
|
|
6648
6699
|
deoptimizeCachedEntities() {
|
|
@@ -6840,8 +6891,6 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
6840
6891
|
flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
6841
6892
|
flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
6842
6893
|
forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
6843
|
-
group: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
6844
|
-
groupToMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
6845
6894
|
includes: METHOD_RETURNS_BOOLEAN,
|
|
6846
6895
|
indexOf: METHOD_RETURNS_NUMBER,
|
|
6847
6896
|
join: METHOD_RETURNS_STRING,
|
|
@@ -6912,11 +6961,11 @@ class ArrayExpression extends NodeBase {
|
|
|
6912
6961
|
properties.unshift({ key: UnknownInteger, kind: 'init', property: element });
|
|
6913
6962
|
}
|
|
6914
6963
|
}
|
|
6915
|
-
else if (
|
|
6916
|
-
properties.push({ key: String(index), kind: 'init', property:
|
|
6964
|
+
else if (element) {
|
|
6965
|
+
properties.push({ key: String(index), kind: 'init', property: element });
|
|
6917
6966
|
}
|
|
6918
6967
|
else {
|
|
6919
|
-
properties.push({ key: String(index), kind: 'init', property:
|
|
6968
|
+
properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
|
|
6920
6969
|
}
|
|
6921
6970
|
}
|
|
6922
6971
|
return (this.objectEntity = new ObjectEntity(properties, ARRAY_PROTOTYPE));
|
|
@@ -7333,7 +7382,6 @@ class ReturnValueScope extends ParameterScope {
|
|
|
7333
7382
|
}
|
|
7334
7383
|
}
|
|
7335
7384
|
|
|
7336
|
-
//@ts-check
|
|
7337
7385
|
/** @typedef { import('estree').Node} Node */
|
|
7338
7386
|
/** @typedef {Node | {
|
|
7339
7387
|
* type: 'PropertyDefinition';
|
|
@@ -7345,7 +7393,7 @@ class ReturnValueScope extends ParameterScope {
|
|
|
7345
7393
|
*
|
|
7346
7394
|
* @param {NodeWithPropertyDefinition} node
|
|
7347
7395
|
* @param {NodeWithPropertyDefinition} parent
|
|
7348
|
-
* @returns boolean
|
|
7396
|
+
* @returns {boolean}
|
|
7349
7397
|
*/
|
|
7350
7398
|
function is_reference (node, parent) {
|
|
7351
7399
|
if (node.type === 'MemberExpression') {
|
|
@@ -9949,7 +9997,34 @@ class CatchClause extends NodeBase {
|
|
|
9949
9997
|
}
|
|
9950
9998
|
}
|
|
9951
9999
|
|
|
10000
|
+
const unset$1 = Symbol('unset');
|
|
9952
10001
|
class ChainExpression extends NodeBase {
|
|
10002
|
+
constructor() {
|
|
10003
|
+
super(...arguments);
|
|
10004
|
+
this.objectValue = unset$1;
|
|
10005
|
+
}
|
|
10006
|
+
deoptimizeCache() {
|
|
10007
|
+
this.objectValue = UnknownValue;
|
|
10008
|
+
}
|
|
10009
|
+
getLiteralValueAtPath() {
|
|
10010
|
+
if (this.getObjectValue() == null)
|
|
10011
|
+
return undefined;
|
|
10012
|
+
return UnknownValue;
|
|
10013
|
+
}
|
|
10014
|
+
hasEffects(context) {
|
|
10015
|
+
if (this.getObjectValue() == null)
|
|
10016
|
+
return false;
|
|
10017
|
+
return this.expression.hasEffects(context);
|
|
10018
|
+
}
|
|
10019
|
+
getObjectValue() {
|
|
10020
|
+
if (this.objectValue === unset$1) {
|
|
10021
|
+
let object = this.expression.type === 'CallExpression' ? this.expression.callee : this.expression.object;
|
|
10022
|
+
if (object.type === 'MemberExpression')
|
|
10023
|
+
object = object.object;
|
|
10024
|
+
this.objectValue = object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
10025
|
+
}
|
|
10026
|
+
return this.objectValue;
|
|
10027
|
+
}
|
|
9953
10028
|
}
|
|
9954
10029
|
|
|
9955
10030
|
class ClassBodyScope extends ChildScope {
|
|
@@ -10119,9 +10194,9 @@ class ClassNode extends NodeBase {
|
|
|
10119
10194
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
10120
10195
|
return interaction.type === INTERACTION_CALLED && path.length === 0
|
|
10121
10196
|
? !interaction.withNew ||
|
|
10122
|
-
(this.classConstructor
|
|
10123
|
-
? this.
|
|
10124
|
-
: this.
|
|
10197
|
+
(this.classConstructor === null
|
|
10198
|
+
? this.superClass?.hasEffectsOnInteractionAtPath(path, interaction, context)
|
|
10199
|
+
: this.classConstructor.hasEffectsOnInteractionAtPath(path, interaction, context)) ||
|
|
10125
10200
|
false
|
|
10126
10201
|
: this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
10127
10202
|
}
|
|
@@ -10298,12 +10373,12 @@ class ConditionalExpression extends NodeBase {
|
|
|
10298
10373
|
}
|
|
10299
10374
|
deoptimizePath(path) {
|
|
10300
10375
|
const usedBranch = this.getUsedBranch();
|
|
10301
|
-
if (
|
|
10302
|
-
|
|
10303
|
-
this.alternate.deoptimizePath(path);
|
|
10376
|
+
if (usedBranch) {
|
|
10377
|
+
usedBranch.deoptimizePath(path);
|
|
10304
10378
|
}
|
|
10305
10379
|
else {
|
|
10306
|
-
|
|
10380
|
+
this.consequent.deoptimizePath(path);
|
|
10381
|
+
this.alternate.deoptimizePath(path);
|
|
10307
10382
|
}
|
|
10308
10383
|
}
|
|
10309
10384
|
deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
@@ -10361,17 +10436,22 @@ class ConditionalExpression extends NodeBase {
|
|
|
10361
10436
|
}
|
|
10362
10437
|
includeCallArguments(context, parameters) {
|
|
10363
10438
|
const usedBranch = this.getUsedBranch();
|
|
10364
|
-
if (
|
|
10365
|
-
|
|
10366
|
-
this.alternate.includeCallArguments(context, parameters);
|
|
10439
|
+
if (usedBranch) {
|
|
10440
|
+
usedBranch.includeCallArguments(context, parameters);
|
|
10367
10441
|
}
|
|
10368
10442
|
else {
|
|
10369
|
-
|
|
10443
|
+
this.consequent.includeCallArguments(context, parameters);
|
|
10444
|
+
this.alternate.includeCallArguments(context, parameters);
|
|
10370
10445
|
}
|
|
10371
10446
|
}
|
|
10372
10447
|
render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
10373
10448
|
const usedBranch = this.getUsedBranch();
|
|
10374
|
-
if (
|
|
10449
|
+
if (this.test.included) {
|
|
10450
|
+
this.test.render(code, options, { renderedSurroundingElement });
|
|
10451
|
+
this.consequent.render(code, options);
|
|
10452
|
+
this.alternate.render(code, options);
|
|
10453
|
+
}
|
|
10454
|
+
else {
|
|
10375
10455
|
const colonPos = findFirstOccurrenceOutsideComment(code.original, ':', this.consequent.end);
|
|
10376
10456
|
const inclusionStart = findNonWhiteSpace(code.original, (this.consequent.included
|
|
10377
10457
|
? findFirstOccurrenceOutsideComment(code.original, '?', this.test.end)
|
|
@@ -10391,11 +10471,6 @@ class ConditionalExpression extends NodeBase {
|
|
|
10391
10471
|
renderedSurroundingElement: renderedSurroundingElement || this.parent.type
|
|
10392
10472
|
});
|
|
10393
10473
|
}
|
|
10394
|
-
else {
|
|
10395
|
-
this.test.render(code, options, { renderedSurroundingElement });
|
|
10396
|
-
this.consequent.render(code, options);
|
|
10397
|
-
this.alternate.render(code, options);
|
|
10398
|
-
}
|
|
10399
10474
|
}
|
|
10400
10475
|
getUsedBranch() {
|
|
10401
10476
|
if (this.isBranchResolutionAnalysed) {
|
|
@@ -11433,12 +11508,12 @@ class LogicalExpression extends NodeBase {
|
|
|
11433
11508
|
}
|
|
11434
11509
|
deoptimizePath(path) {
|
|
11435
11510
|
const usedBranch = this.getUsedBranch();
|
|
11436
|
-
if (
|
|
11437
|
-
|
|
11438
|
-
this.right.deoptimizePath(path);
|
|
11511
|
+
if (usedBranch) {
|
|
11512
|
+
usedBranch.deoptimizePath(path);
|
|
11439
11513
|
}
|
|
11440
11514
|
else {
|
|
11441
|
-
|
|
11515
|
+
this.left.deoptimizePath(path);
|
|
11516
|
+
this.right.deoptimizePath(path);
|
|
11442
11517
|
}
|
|
11443
11518
|
}
|
|
11444
11519
|
deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
@@ -12637,7 +12712,10 @@ class VariableDeclaration extends NodeBase {
|
|
|
12637
12712
|
code.remove(this.end - 1, this.end);
|
|
12638
12713
|
}
|
|
12639
12714
|
separatorString += ';';
|
|
12640
|
-
if (lastSeparatorPos
|
|
12715
|
+
if (lastSeparatorPos === null) {
|
|
12716
|
+
code.appendLeft(renderedContentEnd, separatorString);
|
|
12717
|
+
}
|
|
12718
|
+
else {
|
|
12641
12719
|
if (code.original.charCodeAt(actualContentEnd - 1) === 10 /*"\n"*/ &&
|
|
12642
12720
|
(code.original.charCodeAt(this.end) === 10 /*"\n"*/ ||
|
|
12643
12721
|
code.original.charCodeAt(this.end) === 13) /*"\r"*/) {
|
|
@@ -12654,9 +12732,6 @@ class VariableDeclaration extends NodeBase {
|
|
|
12654
12732
|
code.remove(actualContentEnd, renderedContentEnd);
|
|
12655
12733
|
}
|
|
12656
12734
|
}
|
|
12657
|
-
else {
|
|
12658
|
-
code.appendLeft(renderedContentEnd, separatorString);
|
|
12659
|
-
}
|
|
12660
12735
|
if (systemPatternExports.length > 0) {
|
|
12661
12736
|
code.appendLeft(renderedContentEnd, ` ${getSystemExportStatement(systemPatternExports, options)};`);
|
|
12662
12737
|
}
|
|
@@ -12980,7 +13055,8 @@ class NamespaceVariable extends Variable {
|
|
|
12980
13055
|
return this.memberVariables;
|
|
12981
13056
|
}
|
|
12982
13057
|
const memberVariables = Object.create(null);
|
|
12983
|
-
|
|
13058
|
+
const sortedExports = [...this.context.getExports(), ...this.context.getReexports()].sort();
|
|
13059
|
+
for (const name of sortedExports) {
|
|
12984
13060
|
if (name[0] !== '*' && name !== this.module.info.syntheticNamedExports) {
|
|
12985
13061
|
const exportedVariable = this.context.traceExport(name);
|
|
12986
13062
|
if (exportedVariable) {
|
|
@@ -13784,10 +13860,10 @@ class Module {
|
|
|
13784
13860
|
this.transformDependencies = transformDependencies;
|
|
13785
13861
|
this.customTransformCache = customTransformCache;
|
|
13786
13862
|
this.updateOptions(moduleOptions);
|
|
13787
|
-
const moduleAst = ast
|
|
13863
|
+
const moduleAst = ast ?? this.tryParse();
|
|
13788
13864
|
timeEnd('generate ast', 3);
|
|
13789
13865
|
timeStart('analyze ast', 3);
|
|
13790
|
-
this.resolvedIds = resolvedIds
|
|
13866
|
+
this.resolvedIds = resolvedIds ?? Object.create(null);
|
|
13791
13867
|
// By default, `id` is the file name. Custom resolvers and loaders
|
|
13792
13868
|
// can change that, but it makes sense to use it for the source file name
|
|
13793
13869
|
const fileName = this.id;
|
|
@@ -13888,14 +13964,6 @@ class Module {
|
|
|
13888
13964
|
}
|
|
13889
13965
|
return null;
|
|
13890
13966
|
}
|
|
13891
|
-
tryParse() {
|
|
13892
|
-
try {
|
|
13893
|
-
return this.graph.contextParse(this.info.code);
|
|
13894
|
-
}
|
|
13895
|
-
catch (error_) {
|
|
13896
|
-
return this.error(errorParseError(error_, this.id), error_.pos);
|
|
13897
|
-
}
|
|
13898
|
-
}
|
|
13899
13967
|
updateOptions({ meta, moduleSideEffects, syntheticNamedExports }) {
|
|
13900
13968
|
if (moduleSideEffects != null) {
|
|
13901
13969
|
this.info.moduleSideEffects = moduleSideEffects;
|
|
@@ -14177,6 +14245,14 @@ class Module {
|
|
|
14177
14245
|
this.options.onwarn(errorShimmedExport(this.id, name));
|
|
14178
14246
|
this.exports.set(name, MISSING_EXPORT_SHIM_DESCRIPTION);
|
|
14179
14247
|
}
|
|
14248
|
+
tryParse() {
|
|
14249
|
+
try {
|
|
14250
|
+
return this.graph.contextParse(this.info.code);
|
|
14251
|
+
}
|
|
14252
|
+
catch (error_) {
|
|
14253
|
+
return this.error(errorParseError(error_, this.id), error_.pos);
|
|
14254
|
+
}
|
|
14255
|
+
}
|
|
14180
14256
|
}
|
|
14181
14257
|
// if there is a cyclic import in the reexport chain, we should not
|
|
14182
14258
|
// import from the original module but from the cyclic module to not
|
|
@@ -14207,7 +14283,7 @@ function getCompleteAmdId(options, chunkId) {
|
|
|
14207
14283
|
if (options.autoId) {
|
|
14208
14284
|
return `${options.basePath ? options.basePath + '/' : ''}${removeJsExtension(chunkId)}`;
|
|
14209
14285
|
}
|
|
14210
|
-
return options.id
|
|
14286
|
+
return options.id ?? '';
|
|
14211
14287
|
}
|
|
14212
14288
|
|
|
14213
14289
|
function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, mechanism = 'return ') {
|
|
@@ -14414,33 +14490,82 @@ function updateExtensionForRelativeAmdId(id, forceJsExtensionForImports) {
|
|
|
14414
14490
|
return forceJsExtensionForImports ? addJsExtension(id) : removeJsExtension(id);
|
|
14415
14491
|
}
|
|
14416
14492
|
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
|
|
14427
|
-
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14493
|
+
var _staticExports = {};
|
|
14494
|
+
var _static = {
|
|
14495
|
+
get exports(){ return _staticExports; },
|
|
14496
|
+
set exports(v){ _staticExports = v; },
|
|
14497
|
+
};
|
|
14498
|
+
|
|
14499
|
+
const require$$0 = [
|
|
14500
|
+
"assert",
|
|
14501
|
+
"async_hooks",
|
|
14502
|
+
"buffer",
|
|
14503
|
+
"child_process",
|
|
14504
|
+
"cluster",
|
|
14505
|
+
"console",
|
|
14506
|
+
"constants",
|
|
14507
|
+
"crypto",
|
|
14508
|
+
"dgram",
|
|
14509
|
+
"diagnostics_channel",
|
|
14510
|
+
"dns",
|
|
14511
|
+
"domain",
|
|
14512
|
+
"events",
|
|
14513
|
+
"fs",
|
|
14514
|
+
"http",
|
|
14515
|
+
"http2",
|
|
14516
|
+
"https",
|
|
14517
|
+
"inspector",
|
|
14518
|
+
"module",
|
|
14519
|
+
"net",
|
|
14520
|
+
"os",
|
|
14521
|
+
"path",
|
|
14522
|
+
"perf_hooks",
|
|
14523
|
+
"process",
|
|
14524
|
+
"punycode",
|
|
14525
|
+
"querystring",
|
|
14526
|
+
"readline",
|
|
14527
|
+
"repl",
|
|
14528
|
+
"stream",
|
|
14529
|
+
"string_decoder",
|
|
14530
|
+
"timers",
|
|
14531
|
+
"tls",
|
|
14532
|
+
"trace_events",
|
|
14533
|
+
"tty",
|
|
14534
|
+
"url",
|
|
14535
|
+
"util",
|
|
14536
|
+
"v8",
|
|
14537
|
+
"vm",
|
|
14538
|
+
"wasi",
|
|
14539
|
+
"worker_threads",
|
|
14540
|
+
"zlib"
|
|
14541
|
+
];
|
|
14542
|
+
|
|
14543
|
+
(function (module) {
|
|
14544
|
+
module.exports = require$$0;
|
|
14545
|
+
} (_static));
|
|
14546
|
+
|
|
14547
|
+
const builtinModules = /*@__PURE__*/getDefaultExportFromCjs(_staticExports);
|
|
14548
|
+
|
|
14549
|
+
const nodeBuiltins = new Set([
|
|
14550
|
+
...builtinModules,
|
|
14551
|
+
// TODO
|
|
14552
|
+
// remove once builtin-modules includes PR: https://github.com/sindresorhus/builtin-modules/pull/17
|
|
14553
|
+
'assert/strict',
|
|
14554
|
+
'dns/promises',
|
|
14555
|
+
'fs/promises',
|
|
14556
|
+
'path/posix',
|
|
14557
|
+
'path/win32',
|
|
14558
|
+
'readline/promises',
|
|
14559
|
+
'stream/consumers',
|
|
14560
|
+
'stream/promises',
|
|
14561
|
+
'stream/web',
|
|
14562
|
+
'timers/promises',
|
|
14563
|
+
'util/types'
|
|
14564
|
+
]);
|
|
14440
14565
|
function warnOnBuiltins(warn, dependencies) {
|
|
14441
14566
|
const externalBuiltins = dependencies
|
|
14442
14567
|
.map(({ importPath }) => importPath)
|
|
14443
|
-
.filter(importPath => importPath
|
|
14568
|
+
.filter(importPath => nodeBuiltins.has(importPath) || importPath.startsWith('node:'));
|
|
14444
14569
|
if (externalBuiltins.length === 0)
|
|
14445
14570
|
return;
|
|
14446
14571
|
warn(errorMissingNodeBuiltins(externalBuiltins));
|
|
@@ -15592,10 +15717,7 @@ class Chunk {
|
|
|
15592
15717
|
if (file) {
|
|
15593
15718
|
fileName = node_path.basename(file);
|
|
15594
15719
|
}
|
|
15595
|
-
else if (this.fileName
|
|
15596
|
-
fileName = this.fileName;
|
|
15597
|
-
}
|
|
15598
|
-
else {
|
|
15720
|
+
else if (this.fileName === null) {
|
|
15599
15721
|
const [pattern, patternName] = preserveModules || this.facadeModule?.isUserDefinedEntryPoint
|
|
15600
15722
|
? [entryFileNames, 'output.entryFileNames']
|
|
15601
15723
|
: [chunkFileNames, 'output.chunkFileNames'];
|
|
@@ -15608,6 +15730,9 @@ class Chunk {
|
|
|
15608
15730
|
fileName = makeUnique(fileName, this.bundle);
|
|
15609
15731
|
}
|
|
15610
15732
|
}
|
|
15733
|
+
else {
|
|
15734
|
+
fileName = this.fileName;
|
|
15735
|
+
}
|
|
15611
15736
|
if (!hashPlaceholder) {
|
|
15612
15737
|
this.bundle[fileName] = FILE_PLACEHOLDER;
|
|
15613
15738
|
}
|
|
@@ -16854,10 +16979,7 @@ function getLinkMap(warn) {
|
|
|
16854
16979
|
}
|
|
16855
16980
|
function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, linkMap) {
|
|
16856
16981
|
let source;
|
|
16857
|
-
if (
|
|
16858
|
-
source = new Source(id, originalCode);
|
|
16859
|
-
}
|
|
16860
|
-
else {
|
|
16982
|
+
if (originalSourcemap) {
|
|
16861
16983
|
const sources = originalSourcemap.sources;
|
|
16862
16984
|
const sourcesContent = originalSourcemap.sourcesContent || [];
|
|
16863
16985
|
const directory = node_path.dirname(id) || '.';
|
|
@@ -16865,6 +16987,9 @@ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapCha
|
|
|
16865
16987
|
const baseSources = sources.map((source, index) => new Source(node_path.resolve(directory, sourceRoot, source), sourcesContent[index]));
|
|
16866
16988
|
source = new Link(originalSourcemap, baseSources);
|
|
16867
16989
|
}
|
|
16990
|
+
else {
|
|
16991
|
+
source = new Source(id, originalCode);
|
|
16992
|
+
}
|
|
16868
16993
|
return sourcemapChain.reduce(linkMap, source);
|
|
16869
16994
|
}
|
|
16870
16995
|
function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeContent, warn) {
|
|
@@ -17186,7 +17311,6 @@ class Bundle {
|
|
|
17186
17311
|
if ('code' in file) {
|
|
17187
17312
|
try {
|
|
17188
17313
|
this.graph.contextParse(file.code, {
|
|
17189
|
-
allowHashBang: true,
|
|
17190
17314
|
ecmaVersion: 'latest'
|
|
17191
17315
|
});
|
|
17192
17316
|
}
|
|
@@ -22797,7 +22921,7 @@ pp.readWord = function() {
|
|
|
22797
22921
|
|
|
22798
22922
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
22799
22923
|
|
|
22800
|
-
var version = "8.8.
|
|
22924
|
+
var version = "8.8.1";
|
|
22801
22925
|
|
|
22802
22926
|
Parser.acorn = {
|
|
22803
22927
|
Parser: Parser,
|
|
@@ -22847,7 +22971,7 @@ function tokenizer(input, options) {
|
|
|
22847
22971
|
return Parser.tokenizer(input, options)
|
|
22848
22972
|
}
|
|
22849
22973
|
|
|
22850
|
-
const
|
|
22974
|
+
const _acorn = /*#__PURE__*/Object.defineProperty({
|
|
22851
22975
|
__proto__: null,
|
|
22852
22976
|
Node,
|
|
22853
22977
|
Parser,
|
|
@@ -22932,13 +23056,27 @@ function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolve
|
|
|
22932
23056
|
resolve: (source, importer, { assertions, custom, isEntry, skipSelf } = BLANK) => moduleLoaderResolveId(source, importer, custom, isEntry, assertions || EMPTY_OBJECT, skipSelf ? [...skip, { importer, plugin, source }] : skip)
|
|
22933
23057
|
});
|
|
22934
23058
|
}
|
|
22935
|
-
return pluginDriver.
|
|
23059
|
+
return pluginDriver.hookFirstAndGetPlugin('resolveId', [source, importer, { assertions, custom: customOptions, isEntry }], replaceContext, skipped);
|
|
22936
23060
|
}
|
|
22937
23061
|
|
|
22938
23062
|
async function resolveId(source, importer, preserveSymlinks, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, assertions) {
|
|
22939
23063
|
const pluginResult = await resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, assertions);
|
|
22940
|
-
if (pluginResult != null)
|
|
22941
|
-
|
|
23064
|
+
if (pluginResult != null) {
|
|
23065
|
+
const [resolveIdResult, plugin] = pluginResult;
|
|
23066
|
+
if (typeof resolveIdResult === 'object' && !resolveIdResult.resolvedBy) {
|
|
23067
|
+
return {
|
|
23068
|
+
...resolveIdResult,
|
|
23069
|
+
resolvedBy: plugin.name
|
|
23070
|
+
};
|
|
23071
|
+
}
|
|
23072
|
+
if (typeof resolveIdResult === 'string') {
|
|
23073
|
+
return {
|
|
23074
|
+
id: resolveIdResult,
|
|
23075
|
+
resolvedBy: plugin.name
|
|
23076
|
+
};
|
|
23077
|
+
}
|
|
23078
|
+
return resolveIdResult;
|
|
23079
|
+
}
|
|
22942
23080
|
// external modules (non-entry modules that start with neither '.' or '/')
|
|
22943
23081
|
// are skipped at this stage.
|
|
22944
23082
|
if (importer !== undefined && !isAbsolute(source) && source[0] !== '.')
|
|
@@ -22956,13 +23094,13 @@ async function addJsExtensionIfNecessary(file, preserveSymlinks) {
|
|
|
22956
23094
|
}
|
|
22957
23095
|
async function findFile(file, preserveSymlinks) {
|
|
22958
23096
|
try {
|
|
22959
|
-
const stats = await
|
|
23097
|
+
const stats = await promises.lstat(file);
|
|
22960
23098
|
if (!preserveSymlinks && stats.isSymbolicLink())
|
|
22961
|
-
return await findFile(await
|
|
23099
|
+
return await findFile(await promises.realpath(file), preserveSymlinks);
|
|
22962
23100
|
if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
|
|
22963
23101
|
// check case
|
|
22964
23102
|
const name = node_path.basename(file);
|
|
22965
|
-
const files = await
|
|
23103
|
+
const files = await promises.readdir(node_path.dirname(file));
|
|
22966
23104
|
if (files.includes(name))
|
|
22967
23105
|
return file;
|
|
22968
23106
|
}
|
|
@@ -23207,15 +23345,15 @@ class ModuleLoader {
|
|
|
23207
23345
|
entryModule.isUserDefinedEntryPoint || isUserDefined;
|
|
23208
23346
|
addChunkNamesToModule(entryModule, unresolvedEntryModules[index], isUserDefined, firstChunkNamePriority + index);
|
|
23209
23347
|
const existingIndexedModule = this.indexedEntryModules.find(indexedModule => indexedModule.module === entryModule);
|
|
23210
|
-
if (
|
|
23348
|
+
if (existingIndexedModule) {
|
|
23349
|
+
existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
|
|
23350
|
+
}
|
|
23351
|
+
else {
|
|
23211
23352
|
this.indexedEntryModules.push({
|
|
23212
23353
|
index: firstEntryModuleIndex + index,
|
|
23213
23354
|
module: entryModule
|
|
23214
23355
|
});
|
|
23215
23356
|
}
|
|
23216
|
-
else {
|
|
23217
|
-
existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
|
|
23218
|
-
}
|
|
23219
23357
|
}
|
|
23220
23358
|
this.indexedEntryModules.sort(({ index: indexA }, { index: indexB }) => indexA > indexB ? 1 : -1);
|
|
23221
23359
|
return entryModules;
|
|
@@ -23266,7 +23404,7 @@ class ModuleLoader {
|
|
|
23266
23404
|
async addModuleSource(id, importer, module) {
|
|
23267
23405
|
let source;
|
|
23268
23406
|
try {
|
|
23269
|
-
source = await this.graph.fileOperationQueue.run(async () => (await this.pluginDriver.hookFirst('load', [id])) ?? (await
|
|
23407
|
+
source = await this.graph.fileOperationQueue.run(async () => (await this.pluginDriver.hookFirst('load', [id])) ?? (await promises.readFile(id, 'utf8')));
|
|
23270
23408
|
}
|
|
23271
23409
|
catch (error_) {
|
|
23272
23410
|
let message = `Could not load ${id}`;
|
|
@@ -23488,6 +23626,7 @@ class ModuleLoader {
|
|
|
23488
23626
|
id: resolvedId.id,
|
|
23489
23627
|
meta: resolvedId.meta || {},
|
|
23490
23628
|
moduleSideEffects: resolvedId.moduleSideEffects ?? this.hasModuleSideEffects(resolvedId.id, !!external),
|
|
23629
|
+
resolvedBy: resolvedId.resolvedBy ?? 'rollup',
|
|
23491
23630
|
syntheticNamedExports: resolvedId.syntheticNamedExports ?? false
|
|
23492
23631
|
};
|
|
23493
23632
|
}
|
|
@@ -23520,6 +23659,7 @@ class ModuleLoader {
|
|
|
23520
23659
|
id: source,
|
|
23521
23660
|
meta: {},
|
|
23522
23661
|
moduleSideEffects: this.hasModuleSideEffects(source, true),
|
|
23662
|
+
resolvedBy: 'rollup',
|
|
23523
23663
|
syntheticNamedExports: false
|
|
23524
23664
|
};
|
|
23525
23665
|
}
|
|
@@ -23731,8 +23871,11 @@ class FileEmitter {
|
|
|
23731
23871
|
this.facadeChunkByModule = facadeChunkByModule;
|
|
23732
23872
|
};
|
|
23733
23873
|
this.setOutputBundle = (bundle, outputOptions) => {
|
|
23734
|
-
const
|
|
23735
|
-
|
|
23874
|
+
const output = (this.output = {
|
|
23875
|
+
bundle,
|
|
23876
|
+
fileNamesBySource: new Map(),
|
|
23877
|
+
outputOptions
|
|
23878
|
+
});
|
|
23736
23879
|
for (const emittedFile of this.filesByReferenceId.values()) {
|
|
23737
23880
|
if (emittedFile.fileName) {
|
|
23738
23881
|
reserveFileNameInBundle(emittedFile.fileName, output, this.options.onwarn);
|
|
@@ -23753,12 +23896,9 @@ class FileEmitter {
|
|
|
23753
23896
|
this.outputFileEmitters.push(outputFileEmitter);
|
|
23754
23897
|
}
|
|
23755
23898
|
assignReferenceId(file, idBase) {
|
|
23756
|
-
let referenceId;
|
|
23899
|
+
let referenceId = idBase;
|
|
23757
23900
|
do {
|
|
23758
|
-
referenceId = createHash()
|
|
23759
|
-
.update(referenceId || idBase)
|
|
23760
|
-
.digest('hex')
|
|
23761
|
-
.slice(0, 8);
|
|
23901
|
+
referenceId = createHash().update(referenceId).digest('hex').slice(0, 8);
|
|
23762
23902
|
} while (this.filesByReferenceId.has(referenceId) ||
|
|
23763
23903
|
this.outputFileEmitters.some(({ filesByReferenceId }) => filesByReferenceId.has(referenceId)));
|
|
23764
23904
|
this.filesByReferenceId.set(referenceId, file);
|
|
@@ -23768,9 +23908,9 @@ class FileEmitter {
|
|
|
23768
23908
|
return referenceId;
|
|
23769
23909
|
}
|
|
23770
23910
|
emitAsset(emittedAsset) {
|
|
23771
|
-
const source =
|
|
23772
|
-
?
|
|
23773
|
-
:
|
|
23911
|
+
const source = emittedAsset.source === undefined
|
|
23912
|
+
? undefined
|
|
23913
|
+
: getValidSource(emittedAsset.source, emittedAsset, null);
|
|
23774
23914
|
const consumedAsset = {
|
|
23775
23915
|
fileName: emittedAsset.fileName,
|
|
23776
23916
|
name: emittedAsset.name,
|
|
@@ -23970,17 +24110,18 @@ class PluginDriver {
|
|
|
23970
24110
|
}
|
|
23971
24111
|
// chains, first non-null result stops and returns
|
|
23972
24112
|
hookFirst(hookName, parameters, replaceContext, skipped) {
|
|
23973
|
-
|
|
24113
|
+
return this.hookFirstAndGetPlugin(hookName, parameters, replaceContext, skipped).then(result => result && result[0]);
|
|
24114
|
+
}
|
|
24115
|
+
// chains, first non-null result stops and returns result and last plugin
|
|
24116
|
+
async hookFirstAndGetPlugin(hookName, parameters, replaceContext, skipped) {
|
|
23974
24117
|
for (const plugin of this.getSortedPlugins(hookName)) {
|
|
23975
|
-
if (skipped
|
|
24118
|
+
if (skipped?.has(plugin))
|
|
23976
24119
|
continue;
|
|
23977
|
-
|
|
23978
|
-
|
|
23979
|
-
|
|
23980
|
-
return this.runHook(hookName, parameters, plugin, replaceContext);
|
|
23981
|
-
});
|
|
24120
|
+
const result = await this.runHook(hookName, parameters, plugin, replaceContext);
|
|
24121
|
+
if (result != null)
|
|
24122
|
+
return [result, plugin];
|
|
23982
24123
|
}
|
|
23983
|
-
return
|
|
24124
|
+
return null;
|
|
23984
24125
|
}
|
|
23985
24126
|
// chains synchronously, first non-null result stops and returns
|
|
23986
24127
|
hookFirstSync(hookName, parameters, replaceContext) {
|
|
@@ -24443,26 +24584,11 @@ async function catchUnfinishedHookActions(pluginDriver, callback) {
|
|
|
24443
24584
|
return result;
|
|
24444
24585
|
}
|
|
24445
24586
|
|
|
24446
|
-
var lib = {};
|
|
24447
|
-
|
|
24448
|
-
const require$$0 = /*@__PURE__*/getAugmentedNamespace(acorn);
|
|
24449
|
-
|
|
24450
|
-
Object.defineProperty(lib, "__esModule", {
|
|
24451
|
-
value: true
|
|
24452
|
-
});
|
|
24453
|
-
var importAssertions_1 = lib.importAssertions = importAssertions;
|
|
24454
|
-
|
|
24455
|
-
var _acorn = _interopRequireWildcard(require$$0);
|
|
24456
|
-
|
|
24457
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24458
|
-
|
|
24459
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24460
|
-
|
|
24461
24587
|
const leftCurlyBrace = "{".charCodeAt(0);
|
|
24462
24588
|
const space = " ".charCodeAt(0);
|
|
24589
|
+
|
|
24463
24590
|
const keyword = "assert";
|
|
24464
|
-
const FUNC_STATEMENT = 1,
|
|
24465
|
-
FUNC_NULLABLE_ID = 4;
|
|
24591
|
+
const FUNC_STATEMENT = 1, FUNC_NULLABLE_ID = 4;
|
|
24466
24592
|
|
|
24467
24593
|
function importAssertions(Parser) {
|
|
24468
24594
|
// Use supplied version acorn version if present, to avoid
|
|
@@ -24471,10 +24597,8 @@ function importAssertions(Parser) {
|
|
|
24471
24597
|
// its own internal version of acorn and thereby sidesteps
|
|
24472
24598
|
// the package manager.
|
|
24473
24599
|
const acorn = Parser.acorn || _acorn;
|
|
24474
|
-
const {
|
|
24475
|
-
|
|
24476
|
-
TokenType
|
|
24477
|
-
} = acorn;
|
|
24600
|
+
const { tokTypes: tt, TokenType } = acorn;
|
|
24601
|
+
|
|
24478
24602
|
return class extends Parser {
|
|
24479
24603
|
constructor(...args) {
|
|
24480
24604
|
super(...args);
|
|
@@ -24489,21 +24613,19 @@ function importAssertions(Parser) {
|
|
|
24489
24613
|
if (this.type !== t) {
|
|
24490
24614
|
this.unexpected();
|
|
24491
24615
|
}
|
|
24492
|
-
|
|
24493
24616
|
this.next();
|
|
24494
24617
|
}
|
|
24495
24618
|
|
|
24496
24619
|
readToken(code) {
|
|
24497
24620
|
let i = 0;
|
|
24498
|
-
|
|
24499
24621
|
for (; i < keyword.length; i++) {
|
|
24500
24622
|
if (this._codeAt(this.pos + i) !== keyword.charCodeAt(i)) {
|
|
24501
24623
|
return super.readToken(code);
|
|
24502
24624
|
}
|
|
24503
|
-
}
|
|
24504
|
-
// ie `assert{...` or `assert {...`
|
|
24505
|
-
|
|
24625
|
+
}
|
|
24506
24626
|
|
|
24627
|
+
// ensure that the keyword is at the correct location
|
|
24628
|
+
// ie `assert{...` or `assert {...`
|
|
24507
24629
|
for (;; i++) {
|
|
24508
24630
|
if (this._codeAt(this.pos + i) === leftCurlyBrace) {
|
|
24509
24631
|
// Found '{'
|
|
@@ -24514,11 +24636,11 @@ function importAssertions(Parser) {
|
|
|
24514
24636
|
} else {
|
|
24515
24637
|
return super.readToken(code);
|
|
24516
24638
|
}
|
|
24517
|
-
}
|
|
24639
|
+
}
|
|
24640
|
+
|
|
24641
|
+
// If we're inside a dynamic import expression we'll parse
|
|
24518
24642
|
// the `assert` keyword as a standard object property name
|
|
24519
24643
|
// ie `import(""./foo.json", { assert: { type: "json" } })`
|
|
24520
|
-
|
|
24521
|
-
|
|
24522
24644
|
if (this.type.label === "{") {
|
|
24523
24645
|
return super.readToken(code);
|
|
24524
24646
|
}
|
|
@@ -24529,24 +24651,22 @@ function importAssertions(Parser) {
|
|
|
24529
24651
|
|
|
24530
24652
|
parseDynamicImport(node) {
|
|
24531
24653
|
this.next(); // skip `(`
|
|
24532
|
-
// Parse node.source.
|
|
24533
24654
|
|
|
24655
|
+
// Parse node.source.
|
|
24534
24656
|
node.source = this.parseMaybeAssign();
|
|
24535
24657
|
|
|
24536
24658
|
if (this.eat(tt.comma)) {
|
|
24537
24659
|
const obj = this.parseObj(false);
|
|
24538
24660
|
node.arguments = [obj];
|
|
24539
24661
|
}
|
|
24540
|
-
|
|
24541
24662
|
this._eat(tt.parenR);
|
|
24542
|
-
|
|
24543
24663
|
return this.finishNode(node, "ImportExpression");
|
|
24544
|
-
}
|
|
24545
|
-
|
|
24664
|
+
}
|
|
24546
24665
|
|
|
24666
|
+
// ported from acorn/src/statement.js pp.parseExport
|
|
24547
24667
|
parseExport(node, exports) {
|
|
24548
|
-
this.next();
|
|
24549
|
-
|
|
24668
|
+
this.next();
|
|
24669
|
+
// export * from '...'
|
|
24550
24670
|
if (this.eat(tt.star)) {
|
|
24551
24671
|
if (this.options.ecmaVersion >= 11) {
|
|
24552
24672
|
if (this.eatContextual("as")) {
|
|
@@ -24556,41 +24676,28 @@ function importAssertions(Parser) {
|
|
|
24556
24676
|
node.exported = null;
|
|
24557
24677
|
}
|
|
24558
24678
|
}
|
|
24559
|
-
|
|
24560
24679
|
this.expectContextual("from");
|
|
24561
|
-
|
|
24562
|
-
if (this.type !== tt.string) {
|
|
24563
|
-
this.unexpected();
|
|
24564
|
-
}
|
|
24565
|
-
|
|
24680
|
+
if (this.type !== tt.string) { this.unexpected(); }
|
|
24566
24681
|
node.source = this.parseExprAtom();
|
|
24567
24682
|
|
|
24568
24683
|
if (this.type === this.assertToken) {
|
|
24569
24684
|
this.next();
|
|
24570
24685
|
const assertions = this.parseImportAssertions();
|
|
24571
|
-
|
|
24572
24686
|
if (assertions) {
|
|
24573
24687
|
node.assertions = assertions;
|
|
24574
24688
|
}
|
|
24575
24689
|
}
|
|
24576
24690
|
|
|
24577
24691
|
this.semicolon();
|
|
24578
|
-
return this.finishNode(node, "ExportAllDeclaration")
|
|
24692
|
+
return this.finishNode(node, "ExportAllDeclaration")
|
|
24579
24693
|
}
|
|
24580
|
-
|
|
24581
|
-
if (this.eat(tt._default)) {
|
|
24582
|
-
// export default ...
|
|
24694
|
+
if (this.eat(tt._default)) { // export default ...
|
|
24583
24695
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
24584
24696
|
var isAsync;
|
|
24585
|
-
|
|
24586
24697
|
if (this.type === tt._function || (isAsync = this.isAsyncFunction())) {
|
|
24587
24698
|
var fNode = this.startNode();
|
|
24588
24699
|
this.next();
|
|
24589
|
-
|
|
24590
|
-
if (isAsync) {
|
|
24591
|
-
this.next();
|
|
24592
|
-
}
|
|
24593
|
-
|
|
24700
|
+
if (isAsync) { this.next(); }
|
|
24594
24701
|
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
|
24595
24702
|
} else if (this.type === tt._class) {
|
|
24596
24703
|
var cNode = this.startNode();
|
|
@@ -24599,38 +24706,27 @@ function importAssertions(Parser) {
|
|
|
24599
24706
|
node.declaration = this.parseMaybeAssign();
|
|
24600
24707
|
this.semicolon();
|
|
24601
24708
|
}
|
|
24602
|
-
|
|
24603
|
-
|
|
24604
|
-
|
|
24605
|
-
|
|
24606
|
-
|
|
24709
|
+
return this.finishNode(node, "ExportDefaultDeclaration")
|
|
24710
|
+
}
|
|
24711
|
+
// export var|const|let|function|class ...
|
|
24607
24712
|
if (this.shouldParseExportStatement()) {
|
|
24608
24713
|
node.declaration = this.parseStatement(null);
|
|
24609
|
-
|
|
24610
|
-
|
|
24611
|
-
|
|
24612
|
-
|
|
24613
|
-
this.checkExport(exports, node.declaration.id.name, node.declaration.id.start);
|
|
24614
|
-
}
|
|
24615
|
-
|
|
24714
|
+
if (node.declaration.type === "VariableDeclaration")
|
|
24715
|
+
{ this.checkVariableExport(exports, node.declaration.declarations); }
|
|
24716
|
+
else
|
|
24717
|
+
{ this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); }
|
|
24616
24718
|
node.specifiers = [];
|
|
24617
24719
|
node.source = null;
|
|
24618
|
-
} else {
|
|
24619
|
-
// export { x, y as z } [from '...']
|
|
24720
|
+
} else { // export { x, y as z } [from '...']
|
|
24620
24721
|
node.declaration = null;
|
|
24621
24722
|
node.specifiers = this.parseExportSpecifiers(exports);
|
|
24622
|
-
|
|
24623
24723
|
if (this.eatContextual("from")) {
|
|
24624
|
-
if (this.type !== tt.string) {
|
|
24625
|
-
this.unexpected();
|
|
24626
|
-
}
|
|
24627
|
-
|
|
24724
|
+
if (this.type !== tt.string) { this.unexpected(); }
|
|
24628
24725
|
node.source = this.parseExprAtom();
|
|
24629
24726
|
|
|
24630
24727
|
if (this.type === this.assertToken) {
|
|
24631
24728
|
this.next();
|
|
24632
24729
|
const assertions = this.parseImportAssertions();
|
|
24633
|
-
|
|
24634
24730
|
if (assertions) {
|
|
24635
24731
|
node.assertions = assertions;
|
|
24636
24732
|
}
|
|
@@ -24639,52 +24735,47 @@ function importAssertions(Parser) {
|
|
|
24639
24735
|
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
24640
24736
|
// check for keywords used as local names
|
|
24641
24737
|
var spec = list[i];
|
|
24642
|
-
this.checkUnreserved(spec.local); // check if export is defined
|
|
24643
24738
|
|
|
24739
|
+
this.checkUnreserved(spec.local);
|
|
24740
|
+
// check if export is defined
|
|
24644
24741
|
this.checkLocalExport(spec.local);
|
|
24645
24742
|
}
|
|
24646
24743
|
|
|
24647
24744
|
node.source = null;
|
|
24648
24745
|
}
|
|
24649
|
-
|
|
24650
24746
|
this.semicolon();
|
|
24651
24747
|
}
|
|
24652
|
-
|
|
24653
|
-
return this.finishNode(node, "ExportNamedDeclaration");
|
|
24748
|
+
return this.finishNode(node, "ExportNamedDeclaration")
|
|
24654
24749
|
}
|
|
24655
24750
|
|
|
24656
24751
|
parseImport(node) {
|
|
24657
|
-
this.next();
|
|
24658
|
-
|
|
24752
|
+
this.next();
|
|
24753
|
+
// import '...'
|
|
24659
24754
|
if (this.type === tt.string) {
|
|
24660
24755
|
node.specifiers = [];
|
|
24661
24756
|
node.source = this.parseExprAtom();
|
|
24662
24757
|
} else {
|
|
24663
24758
|
node.specifiers = this.parseImportSpecifiers();
|
|
24664
24759
|
this.expectContextual("from");
|
|
24665
|
-
node.source =
|
|
24760
|
+
node.source =
|
|
24761
|
+
this.type === tt.string ? this.parseExprAtom() : this.unexpected();
|
|
24666
24762
|
}
|
|
24667
24763
|
|
|
24668
24764
|
if (this.type === this.assertToken) {
|
|
24669
24765
|
this.next();
|
|
24670
24766
|
const assertions = this.parseImportAssertions();
|
|
24671
|
-
|
|
24672
24767
|
if (assertions) {
|
|
24673
24768
|
node.assertions = assertions;
|
|
24674
24769
|
}
|
|
24675
24770
|
}
|
|
24676
|
-
|
|
24677
24771
|
this.semicolon();
|
|
24678
24772
|
return this.finishNode(node, "ImportDeclaration");
|
|
24679
24773
|
}
|
|
24680
24774
|
|
|
24681
24775
|
parseImportAssertions() {
|
|
24682
24776
|
this._eat(tt.braceL);
|
|
24683
|
-
|
|
24684
24777
|
const attrs = this.parseAssertEntries();
|
|
24685
|
-
|
|
24686
24778
|
this._eat(tt.braceR);
|
|
24687
|
-
|
|
24688
24779
|
return attrs;
|
|
24689
24780
|
}
|
|
24690
24781
|
|
|
@@ -24697,38 +24788,40 @@ function importAssertions(Parser) {
|
|
|
24697
24788
|
break;
|
|
24698
24789
|
}
|
|
24699
24790
|
|
|
24700
|
-
const node = this.startNode();
|
|
24791
|
+
const node = this.startNode();
|
|
24701
24792
|
|
|
24793
|
+
// parse AssertionKey : IdentifierName, StringLiteral
|
|
24702
24794
|
let assertionKeyNode;
|
|
24703
|
-
|
|
24704
24795
|
if (this.type === tt.string) {
|
|
24705
24796
|
assertionKeyNode = this.parseLiteral(this.value);
|
|
24706
24797
|
} else {
|
|
24707
24798
|
assertionKeyNode = this.parseIdent(true);
|
|
24708
24799
|
}
|
|
24709
|
-
|
|
24710
24800
|
this.next();
|
|
24711
|
-
node.key = assertionKeyNode;
|
|
24801
|
+
node.key = assertionKeyNode;
|
|
24802
|
+
|
|
24803
|
+
// check if we already have an entry for an attribute
|
|
24712
24804
|
// if a duplicate entry is found, throw an error
|
|
24713
24805
|
// for now this logic will come into play only when someone declares `type` twice
|
|
24714
|
-
|
|
24715
24806
|
if (attrNames.has(node.key.name)) {
|
|
24716
24807
|
this.raise(this.pos, "Duplicated key in assertions");
|
|
24717
24808
|
}
|
|
24718
|
-
|
|
24719
24809
|
attrNames.add(node.key.name);
|
|
24720
24810
|
|
|
24721
24811
|
if (this.type !== tt.string) {
|
|
24722
|
-
this.raise(
|
|
24812
|
+
this.raise(
|
|
24813
|
+
this.pos,
|
|
24814
|
+
"Only string is supported as an assertion value"
|
|
24815
|
+
);
|
|
24723
24816
|
}
|
|
24724
24817
|
|
|
24725
24818
|
node.value = this.parseLiteral(this.value);
|
|
24819
|
+
|
|
24726
24820
|
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
24727
24821
|
} while (this.eat(tt.comma));
|
|
24728
24822
|
|
|
24729
24823
|
return attrs;
|
|
24730
24824
|
}
|
|
24731
|
-
|
|
24732
24825
|
};
|
|
24733
24826
|
}
|
|
24734
24827
|
|
|
@@ -24785,14 +24878,12 @@ const getOnwarn = (config) => {
|
|
|
24785
24878
|
: defaultOnWarn;
|
|
24786
24879
|
};
|
|
24787
24880
|
const getAcorn = (config) => ({
|
|
24788
|
-
allowAwaitOutsideFunction: true,
|
|
24789
24881
|
ecmaVersion: 'latest',
|
|
24790
|
-
preserveParens: false,
|
|
24791
24882
|
sourceType: 'module',
|
|
24792
24883
|
...config.acorn
|
|
24793
24884
|
});
|
|
24794
24885
|
const getAcornInjectPlugins = (config) => [
|
|
24795
|
-
|
|
24886
|
+
importAssertions,
|
|
24796
24887
|
...ensureArray$1(config.acornInjectPlugins)
|
|
24797
24888
|
];
|
|
24798
24889
|
const getCache = (config) => config.cache?.cache || config.cache;
|
|
@@ -24859,7 +24950,7 @@ const getModuleContext = (config, context) => {
|
|
|
24859
24950
|
for (const [key, moduleContext] of Object.entries(configModuleContext)) {
|
|
24860
24951
|
contextByModuleId[node_path.resolve(key)] = moduleContext;
|
|
24861
24952
|
}
|
|
24862
|
-
return id => contextByModuleId[id]
|
|
24953
|
+
return id => contextByModuleId[id] ?? context;
|
|
24863
24954
|
}
|
|
24864
24955
|
return () => context;
|
|
24865
24956
|
};
|
|
@@ -24896,7 +24987,7 @@ const getHasModuleSideEffects = (moduleSideEffectsOption) => {
|
|
|
24896
24987
|
return (_id, external) => !external;
|
|
24897
24988
|
}
|
|
24898
24989
|
if (typeof moduleSideEffectsOption === 'function') {
|
|
24899
|
-
return (id, external) =>
|
|
24990
|
+
return (id, external) => id.startsWith('\0') ? true : moduleSideEffectsOption(id, external) !== false;
|
|
24900
24991
|
}
|
|
24901
24992
|
if (Array.isArray(moduleSideEffectsOption)) {
|
|
24902
24993
|
const ids = new Set(moduleSideEffectsOption);
|
|
@@ -25360,8 +25451,8 @@ function getSortingFileType(file) {
|
|
|
25360
25451
|
async function writeOutputFile(outputFile, outputOptions) {
|
|
25361
25452
|
const fileName = node_path.resolve(outputOptions.dir || node_path.dirname(outputOptions.file), outputFile.fileName);
|
|
25362
25453
|
// 'recursive: true' does not throw if the folder structure, or parts of it, already exist
|
|
25363
|
-
await
|
|
25364
|
-
return
|
|
25454
|
+
await promises.mkdir(node_path.dirname(fileName), { recursive: true });
|
|
25455
|
+
return promises.writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
|
|
25365
25456
|
}
|
|
25366
25457
|
/**
|
|
25367
25458
|
* Auxiliary function for defining rollup configuration
|
|
@@ -25470,7 +25561,6 @@ exports.isWatchEnabled = isWatchEnabled;
|
|
|
25470
25561
|
exports.loadFsEvents = loadFsEvents;
|
|
25471
25562
|
exports.mergeOptions = mergeOptions;
|
|
25472
25563
|
exports.normalizePluginOption = normalizePluginOption;
|
|
25473
|
-
exports.picomatch = picomatch$1;
|
|
25474
25564
|
exports.printQuotedStringList = printQuotedStringList;
|
|
25475
25565
|
exports.relativeId = relativeId;
|
|
25476
25566
|
exports.rollup = rollup;
|