rollup 2.70.0 → 2.71.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/CHANGELOG.md +50 -0
- package/LICENSE.md +1 -1
- package/dist/bin/rollup +17 -17
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +1213 -1154
- package/dist/es/shared/watch.js +189 -187
- package/dist/loadConfigFile.js +6 -6
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +13 -17
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +191 -189
- package/dist/shared/loadConfigFile.js +6 -4
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +1213 -1154
- package/dist/shared/watch-cli.js +79 -74
- package/dist/shared/watch.js +2 -2
- package/package.json +25 -25
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.71.0
|
|
4
|
+
Sat, 30 Apr 2022 06:02:30 GMT - commit edd971efcaf5ebdb29448b1d2daa436f6d05f04a
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -14,7 +14,7 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
14
14
|
import { promises } from 'fs';
|
|
15
15
|
import { EventEmitter } from 'events';
|
|
16
16
|
|
|
17
|
-
var version$1 = "2.
|
|
17
|
+
var version$1 = "2.71.0";
|
|
18
18
|
|
|
19
19
|
var charToInteger = {};
|
|
20
20
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -138,204 +138,208 @@ function encodeInteger(num) {
|
|
|
138
138
|
return result;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
BitSet.prototype.add = function add (n) {
|
|
146
|
-
this.bits[n >> 5] |= 1 << (n & 31);
|
|
147
|
-
};
|
|
141
|
+
class BitSet {
|
|
142
|
+
constructor(arg) {
|
|
143
|
+
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
144
|
+
}
|
|
148
145
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
146
|
+
add(n) {
|
|
147
|
+
this.bits[n >> 5] |= 1 << (n & 31);
|
|
148
|
+
}
|
|
152
149
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
has(n) {
|
|
151
|
+
return !!(this.bits[n >> 5] & (1 << (n & 31)));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
157
154
|
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
class Chunk$1 {
|
|
156
|
+
constructor(start, end, content) {
|
|
157
|
+
this.start = start;
|
|
158
|
+
this.end = end;
|
|
159
|
+
this.original = content;
|
|
160
160
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
this.edited = false;
|
|
161
|
+
this.intro = '';
|
|
162
|
+
this.outro = '';
|
|
164
163
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
next: { writable: true, value: null }
|
|
169
|
-
});
|
|
170
|
-
};
|
|
164
|
+
this.content = content;
|
|
165
|
+
this.storeName = false;
|
|
166
|
+
this.edited = false;
|
|
171
167
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
168
|
+
// we make these non-enumerable, for sanity while debugging
|
|
169
|
+
Object.defineProperties(this, {
|
|
170
|
+
previous: { writable: true, value: null },
|
|
171
|
+
next: { writable: true, value: null },
|
|
172
|
+
});
|
|
173
|
+
}
|
|
175
174
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
175
|
+
appendLeft(content) {
|
|
176
|
+
this.outro += content;
|
|
177
|
+
}
|
|
179
178
|
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
appendRight(content) {
|
|
180
|
+
this.intro = this.intro + content;
|
|
181
|
+
}
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
chunk.content = this.content;
|
|
186
|
-
chunk.storeName = this.storeName;
|
|
187
|
-
chunk.edited = this.edited;
|
|
183
|
+
clone() {
|
|
184
|
+
const chunk = new Chunk$1(this.start, this.end, this.original);
|
|
188
185
|
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
chunk.intro = this.intro;
|
|
187
|
+
chunk.outro = this.outro;
|
|
188
|
+
chunk.content = this.content;
|
|
189
|
+
chunk.storeName = this.storeName;
|
|
190
|
+
chunk.edited = this.edited;
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
};
|
|
192
|
+
return chunk;
|
|
193
|
+
}
|
|
195
194
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
while (chunk) {
|
|
199
|
-
fn(chunk);
|
|
200
|
-
chunk = chunk.next;
|
|
195
|
+
contains(index) {
|
|
196
|
+
return this.start < index && index < this.end;
|
|
201
197
|
}
|
|
202
|
-
};
|
|
203
198
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
199
|
+
eachNext(fn) {
|
|
200
|
+
let chunk = this;
|
|
201
|
+
while (chunk) {
|
|
202
|
+
fn(chunk);
|
|
203
|
+
chunk = chunk.next;
|
|
204
|
+
}
|
|
209
205
|
}
|
|
210
|
-
};
|
|
211
206
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
207
|
+
eachPrevious(fn) {
|
|
208
|
+
let chunk = this;
|
|
209
|
+
while (chunk) {
|
|
210
|
+
fn(chunk);
|
|
211
|
+
chunk = chunk.previous;
|
|
212
|
+
}
|
|
217
213
|
}
|
|
218
|
-
this.storeName = storeName;
|
|
219
214
|
|
|
220
|
-
|
|
215
|
+
edit(content, storeName, contentOnly) {
|
|
216
|
+
this.content = content;
|
|
217
|
+
if (!contentOnly) {
|
|
218
|
+
this.intro = '';
|
|
219
|
+
this.outro = '';
|
|
220
|
+
}
|
|
221
|
+
this.storeName = storeName;
|
|
221
222
|
|
|
222
|
-
|
|
223
|
-
};
|
|
223
|
+
this.edited = true;
|
|
224
224
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
};
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
228
227
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
228
|
+
prependLeft(content) {
|
|
229
|
+
this.outro = content + this.outro;
|
|
230
|
+
}
|
|
232
231
|
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
prependRight(content) {
|
|
233
|
+
this.intro = content + this.intro;
|
|
234
|
+
}
|
|
235
235
|
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
split(index) {
|
|
237
|
+
const sliceIndex = index - this.start;
|
|
238
238
|
|
|
239
|
-
|
|
239
|
+
const originalBefore = this.original.slice(0, sliceIndex);
|
|
240
|
+
const originalAfter = this.original.slice(sliceIndex);
|
|
240
241
|
|
|
241
|
-
|
|
242
|
-
newChunk.outro = this.outro;
|
|
243
|
-
this.outro = '';
|
|
242
|
+
this.original = originalBefore;
|
|
244
243
|
|
|
245
|
-
|
|
244
|
+
const newChunk = new Chunk$1(index, this.end, originalAfter);
|
|
245
|
+
newChunk.outro = this.outro;
|
|
246
|
+
this.outro = '';
|
|
246
247
|
|
|
247
|
-
|
|
248
|
-
// TODO is this block necessary?...
|
|
249
|
-
newChunk.edit('', false);
|
|
250
|
-
this.content = '';
|
|
251
|
-
} else {
|
|
252
|
-
this.content = originalBefore;
|
|
253
|
-
}
|
|
248
|
+
this.end = index;
|
|
254
249
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
250
|
+
if (this.edited) {
|
|
251
|
+
// TODO is this block necessary?...
|
|
252
|
+
newChunk.edit('', false);
|
|
253
|
+
this.content = '';
|
|
254
|
+
} else {
|
|
255
|
+
this.content = originalBefore;
|
|
256
|
+
}
|
|
259
257
|
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
newChunk.next = this.next;
|
|
259
|
+
if (newChunk.next) newChunk.next.previous = newChunk;
|
|
260
|
+
newChunk.previous = this;
|
|
261
|
+
this.next = newChunk;
|
|
262
262
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
};
|
|
263
|
+
return newChunk;
|
|
264
|
+
}
|
|
266
265
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
266
|
+
toString() {
|
|
267
|
+
return this.intro + this.content + this.outro;
|
|
268
|
+
}
|
|
270
269
|
|
|
271
|
-
|
|
270
|
+
trimEnd(rx) {
|
|
271
|
+
this.outro = this.outro.replace(rx, '');
|
|
272
|
+
if (this.outro.length) return true;
|
|
272
273
|
|
|
273
|
-
|
|
274
|
-
if (trimmed !== this.content) {
|
|
275
|
-
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
276
|
-
}
|
|
277
|
-
return true;
|
|
274
|
+
const trimmed = this.content.replace(rx, '');
|
|
278
275
|
|
|
279
|
-
|
|
280
|
-
|
|
276
|
+
if (trimmed.length) {
|
|
277
|
+
if (trimmed !== this.content) {
|
|
278
|
+
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
279
|
+
}
|
|
280
|
+
return true;
|
|
281
|
+
} else {
|
|
282
|
+
this.edit('', undefined, true);
|
|
281
283
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
+
this.intro = this.intro.replace(rx, '');
|
|
285
|
+
if (this.intro.length) return true;
|
|
286
|
+
}
|
|
284
287
|
}
|
|
285
|
-
};
|
|
286
288
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
289
|
+
trimStart(rx) {
|
|
290
|
+
this.intro = this.intro.replace(rx, '');
|
|
291
|
+
if (this.intro.length) return true;
|
|
290
292
|
|
|
291
|
-
|
|
293
|
+
const trimmed = this.content.replace(rx, '');
|
|
292
294
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
295
|
+
if (trimmed.length) {
|
|
296
|
+
if (trimmed !== this.content) {
|
|
297
|
+
this.split(this.end - trimmed.length);
|
|
298
|
+
this.edit('', undefined, true);
|
|
299
|
+
}
|
|
300
|
+
return true;
|
|
301
|
+
} else {
|
|
296
302
|
this.edit('', undefined, true);
|
|
297
|
-
}
|
|
298
|
-
return true;
|
|
299
303
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
this.outro = this.outro.replace(rx, '');
|
|
304
|
-
if (this.outro.length) { return true; }
|
|
304
|
+
this.outro = this.outro.replace(rx, '');
|
|
305
|
+
if (this.outro.length) return true;
|
|
306
|
+
}
|
|
305
307
|
}
|
|
306
|
-
}
|
|
308
|
+
}
|
|
307
309
|
|
|
308
|
-
|
|
310
|
+
let btoa = () => {
|
|
309
311
|
throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
|
|
310
312
|
};
|
|
311
313
|
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
|
|
312
|
-
btoa =
|
|
314
|
+
btoa = (str) => window.btoa(unescape(encodeURIComponent(str)));
|
|
313
315
|
} else if (typeof Buffer === 'function') {
|
|
314
|
-
btoa =
|
|
316
|
+
btoa = (str) => Buffer.from(str, 'utf-8').toString('base64');
|
|
315
317
|
}
|
|
316
318
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
319
|
+
class SourceMap {
|
|
320
|
+
constructor(properties) {
|
|
321
|
+
this.version = 3;
|
|
322
|
+
this.file = properties.file;
|
|
323
|
+
this.sources = properties.sources;
|
|
324
|
+
this.sourcesContent = properties.sourcesContent;
|
|
325
|
+
this.names = properties.names;
|
|
326
|
+
this.mappings = encode(properties.mappings);
|
|
327
|
+
}
|
|
325
328
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
+
toString() {
|
|
330
|
+
return JSON.stringify(this);
|
|
331
|
+
}
|
|
329
332
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
+
toUrl() {
|
|
334
|
+
return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());
|
|
335
|
+
}
|
|
336
|
+
}
|
|
333
337
|
|
|
334
338
|
function guessIndent(code) {
|
|
335
|
-
|
|
339
|
+
const lines = code.split('\n');
|
|
336
340
|
|
|
337
|
-
|
|
338
|
-
|
|
341
|
+
const tabbed = lines.filter((line) => /^\t+/.test(line));
|
|
342
|
+
const spaced = lines.filter((line) => /^ {2,}/.test(line));
|
|
339
343
|
|
|
340
344
|
if (tabbed.length === 0 && spaced.length === 0) {
|
|
341
345
|
return null;
|
|
@@ -349,8 +353,8 @@ function guessIndent(code) {
|
|
|
349
353
|
}
|
|
350
354
|
|
|
351
355
|
// Otherwise, we need to guess the multiple
|
|
352
|
-
|
|
353
|
-
|
|
356
|
+
const min = spaced.reduce((previous, current) => {
|
|
357
|
+
const numSpaces = /^ +/.exec(current)[0].length;
|
|
354
358
|
return Math.min(numSpaces, previous);
|
|
355
359
|
}, Infinity);
|
|
356
360
|
|
|
@@ -358,8 +362,8 @@ function guessIndent(code) {
|
|
|
358
362
|
}
|
|
359
363
|
|
|
360
364
|
function getRelativePath(from, to) {
|
|
361
|
-
|
|
362
|
-
|
|
365
|
+
const fromParts = from.split(/[/\\]/);
|
|
366
|
+
const toParts = to.split(/[/\\]/);
|
|
363
367
|
|
|
364
368
|
fromParts.pop(); // get dirname
|
|
365
369
|
|
|
@@ -369,1079 +373,1120 @@ function getRelativePath(from, to) {
|
|
|
369
373
|
}
|
|
370
374
|
|
|
371
375
|
if (fromParts.length) {
|
|
372
|
-
|
|
373
|
-
while (i--)
|
|
376
|
+
let i = fromParts.length;
|
|
377
|
+
while (i--) fromParts[i] = '..';
|
|
374
378
|
}
|
|
375
379
|
|
|
376
380
|
return fromParts.concat(toParts).join('/');
|
|
377
381
|
}
|
|
378
382
|
|
|
379
|
-
|
|
383
|
+
const toString$1 = Object.prototype.toString;
|
|
380
384
|
|
|
381
385
|
function isObject$1(thing) {
|
|
382
386
|
return toString$1.call(thing) === '[object Object]';
|
|
383
387
|
}
|
|
384
388
|
|
|
385
389
|
function getLocator$1(source) {
|
|
386
|
-
|
|
387
|
-
|
|
390
|
+
const originalLines = source.split('\n');
|
|
391
|
+
const lineOffsets = [];
|
|
388
392
|
|
|
389
|
-
for (
|
|
393
|
+
for (let i = 0, pos = 0; i < originalLines.length; i++) {
|
|
390
394
|
lineOffsets.push(pos);
|
|
391
395
|
pos += originalLines[i].length + 1;
|
|
392
396
|
}
|
|
393
397
|
|
|
394
398
|
return function locate(index) {
|
|
395
|
-
|
|
396
|
-
|
|
399
|
+
let i = 0;
|
|
400
|
+
let j = lineOffsets.length;
|
|
397
401
|
while (i < j) {
|
|
398
|
-
|
|
402
|
+
const m = (i + j) >> 1;
|
|
399
403
|
if (index < lineOffsets[m]) {
|
|
400
404
|
j = m;
|
|
401
405
|
} else {
|
|
402
406
|
i = m + 1;
|
|
403
407
|
}
|
|
404
408
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
return { line
|
|
409
|
+
const line = i - 1;
|
|
410
|
+
const column = index - lineOffsets[line];
|
|
411
|
+
return { line, column };
|
|
408
412
|
};
|
|
409
413
|
}
|
|
410
414
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
415
|
+
class Mappings {
|
|
416
|
+
constructor(hires) {
|
|
417
|
+
this.hires = hires;
|
|
418
|
+
this.generatedCodeLine = 0;
|
|
419
|
+
this.generatedCodeColumn = 0;
|
|
420
|
+
this.raw = [];
|
|
421
|
+
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
422
|
+
this.pending = null;
|
|
423
|
+
}
|
|
419
424
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
+
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
426
|
+
if (content.length) {
|
|
427
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
428
|
+
if (nameIndex >= 0) {
|
|
429
|
+
segment.push(nameIndex);
|
|
430
|
+
}
|
|
431
|
+
this.rawSegments.push(segment);
|
|
432
|
+
} else if (this.pending) {
|
|
433
|
+
this.rawSegments.push(this.pending);
|
|
425
434
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
this.
|
|
435
|
+
|
|
436
|
+
this.advance(content);
|
|
437
|
+
this.pending = null;
|
|
429
438
|
}
|
|
430
439
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
440
|
+
addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
441
|
+
let originalCharIndex = chunk.start;
|
|
442
|
+
let first = true;
|
|
434
443
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
444
|
+
while (originalCharIndex < chunk.end) {
|
|
445
|
+
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
|
|
446
|
+
this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
|
|
447
|
+
}
|
|
438
448
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
449
|
+
if (original[originalCharIndex] === '\n') {
|
|
450
|
+
loc.line += 1;
|
|
451
|
+
loc.column = 0;
|
|
452
|
+
this.generatedCodeLine += 1;
|
|
453
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
454
|
+
this.generatedCodeColumn = 0;
|
|
455
|
+
first = true;
|
|
456
|
+
} else {
|
|
457
|
+
loc.column += 1;
|
|
458
|
+
this.generatedCodeColumn += 1;
|
|
459
|
+
first = false;
|
|
460
|
+
}
|
|
443
461
|
|
|
444
|
-
|
|
445
|
-
loc.line += 1;
|
|
446
|
-
loc.column = 0;
|
|
447
|
-
this.generatedCodeLine += 1;
|
|
448
|
-
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
449
|
-
this.generatedCodeColumn = 0;
|
|
450
|
-
first = true;
|
|
451
|
-
} else {
|
|
452
|
-
loc.column += 1;
|
|
453
|
-
this.generatedCodeColumn += 1;
|
|
454
|
-
first = false;
|
|
462
|
+
originalCharIndex += 1;
|
|
455
463
|
}
|
|
456
464
|
|
|
457
|
-
|
|
465
|
+
this.pending = null;
|
|
458
466
|
}
|
|
459
467
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
Mappings.prototype.advance = function advance (str) {
|
|
464
|
-
if (!str) { return; }
|
|
468
|
+
advance(str) {
|
|
469
|
+
if (!str) return;
|
|
465
470
|
|
|
466
|
-
|
|
471
|
+
const lines = str.split('\n');
|
|
467
472
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
473
|
+
if (lines.length > 1) {
|
|
474
|
+
for (let i = 0; i < lines.length - 1; i++) {
|
|
475
|
+
this.generatedCodeLine++;
|
|
476
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
477
|
+
}
|
|
478
|
+
this.generatedCodeColumn = 0;
|
|
472
479
|
}
|
|
473
|
-
this.generatedCodeColumn = 0;
|
|
474
|
-
}
|
|
475
480
|
|
|
476
|
-
|
|
477
|
-
}
|
|
481
|
+
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
478
484
|
|
|
479
|
-
|
|
485
|
+
const n = '\n';
|
|
480
486
|
|
|
481
|
-
|
|
487
|
+
const warned = {
|
|
482
488
|
insertLeft: false,
|
|
483
489
|
insertRight: false,
|
|
484
|
-
storeName: false
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
});
|
|
507
|
-
|
|
508
|
-
this.byStart[0] = chunk;
|
|
509
|
-
this.byEnd[string.length] = chunk;
|
|
510
|
-
};
|
|
511
|
-
|
|
512
|
-
MagicString.prototype.addSourcemapLocation = function addSourcemapLocation (char) {
|
|
513
|
-
this.sourcemapLocations.add(char);
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
MagicString.prototype.append = function append (content) {
|
|
517
|
-
if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
|
|
518
|
-
|
|
519
|
-
this.outro += content;
|
|
520
|
-
return this;
|
|
521
|
-
};
|
|
490
|
+
storeName: false,
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
class MagicString {
|
|
494
|
+
constructor(string, options = {}) {
|
|
495
|
+
const chunk = new Chunk$1(0, string.length, string);
|
|
496
|
+
|
|
497
|
+
Object.defineProperties(this, {
|
|
498
|
+
original: { writable: true, value: string },
|
|
499
|
+
outro: { writable: true, value: '' },
|
|
500
|
+
intro: { writable: true, value: '' },
|
|
501
|
+
firstChunk: { writable: true, value: chunk },
|
|
502
|
+
lastChunk: { writable: true, value: chunk },
|
|
503
|
+
lastSearchedChunk: { writable: true, value: chunk },
|
|
504
|
+
byStart: { writable: true, value: {} },
|
|
505
|
+
byEnd: { writable: true, value: {} },
|
|
506
|
+
filename: { writable: true, value: options.filename },
|
|
507
|
+
indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
|
|
508
|
+
sourcemapLocations: { writable: true, value: new BitSet() },
|
|
509
|
+
storedNames: { writable: true, value: {} },
|
|
510
|
+
indentStr: { writable: true, value: guessIndent(string) },
|
|
511
|
+
});
|
|
522
512
|
|
|
523
|
-
|
|
524
|
-
|
|
513
|
+
this.byStart[0] = chunk;
|
|
514
|
+
this.byEnd[string.length] = chunk;
|
|
515
|
+
}
|
|
525
516
|
|
|
526
|
-
|
|
517
|
+
addSourcemapLocation(char) {
|
|
518
|
+
this.sourcemapLocations.add(char);
|
|
519
|
+
}
|
|
527
520
|
|
|
528
|
-
|
|
521
|
+
append(content) {
|
|
522
|
+
if (typeof content !== 'string') throw new TypeError('outro content must be a string');
|
|
529
523
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
} else {
|
|
533
|
-
this.intro += content;
|
|
524
|
+
this.outro += content;
|
|
525
|
+
return this;
|
|
534
526
|
}
|
|
535
|
-
return this;
|
|
536
|
-
};
|
|
537
527
|
|
|
538
|
-
|
|
539
|
-
|
|
528
|
+
appendLeft(index, content) {
|
|
529
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
540
530
|
|
|
541
|
-
|
|
531
|
+
this._split(index);
|
|
542
532
|
|
|
543
|
-
|
|
533
|
+
const chunk = this.byEnd[index];
|
|
544
534
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
535
|
+
if (chunk) {
|
|
536
|
+
chunk.appendLeft(content);
|
|
537
|
+
} else {
|
|
538
|
+
this.intro += content;
|
|
539
|
+
}
|
|
540
|
+
return this;
|
|
549
541
|
}
|
|
550
|
-
return this;
|
|
551
|
-
};
|
|
552
542
|
|
|
553
|
-
|
|
554
|
-
|
|
543
|
+
appendRight(index, content) {
|
|
544
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
555
545
|
|
|
556
|
-
|
|
557
|
-
var clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
|
|
546
|
+
this._split(index);
|
|
558
547
|
|
|
559
|
-
|
|
560
|
-
cloned.byStart[clonedChunk.start] = clonedChunk;
|
|
561
|
-
cloned.byEnd[clonedChunk.end] = clonedChunk;
|
|
548
|
+
const chunk = this.byStart[index];
|
|
562
549
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
clonedChunk.next = nextClonedChunk;
|
|
568
|
-
nextClonedChunk.previous = clonedChunk;
|
|
569
|
-
|
|
570
|
-
clonedChunk = nextClonedChunk;
|
|
550
|
+
if (chunk) {
|
|
551
|
+
chunk.appendRight(content);
|
|
552
|
+
} else {
|
|
553
|
+
this.outro += content;
|
|
571
554
|
}
|
|
572
|
-
|
|
573
|
-
originalChunk = nextOriginalChunk;
|
|
555
|
+
return this;
|
|
574
556
|
}
|
|
575
557
|
|
|
576
|
-
|
|
558
|
+
clone() {
|
|
559
|
+
const cloned = new MagicString(this.original, { filename: this.filename });
|
|
577
560
|
|
|
578
|
-
|
|
579
|
-
cloned.
|
|
580
|
-
}
|
|
561
|
+
let originalChunk = this.firstChunk;
|
|
562
|
+
let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
|
|
581
563
|
|
|
582
|
-
|
|
564
|
+
while (originalChunk) {
|
|
565
|
+
cloned.byStart[clonedChunk.start] = clonedChunk;
|
|
566
|
+
cloned.byEnd[clonedChunk.end] = clonedChunk;
|
|
583
567
|
|
|
584
|
-
|
|
585
|
-
|
|
568
|
+
const nextOriginalChunk = originalChunk.next;
|
|
569
|
+
const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
|
|
586
570
|
|
|
587
|
-
|
|
588
|
-
|
|
571
|
+
if (nextClonedChunk) {
|
|
572
|
+
clonedChunk.next = nextClonedChunk;
|
|
573
|
+
nextClonedChunk.previous = clonedChunk;
|
|
589
574
|
|
|
590
|
-
|
|
591
|
-
|
|
575
|
+
clonedChunk = nextClonedChunk;
|
|
576
|
+
}
|
|
592
577
|
|
|
593
|
-
|
|
578
|
+
originalChunk = nextOriginalChunk;
|
|
579
|
+
}
|
|
594
580
|
|
|
595
|
-
|
|
596
|
-
var names = Object.keys(this.storedNames);
|
|
597
|
-
var mappings = new Mappings(options.hires);
|
|
581
|
+
cloned.lastChunk = clonedChunk;
|
|
598
582
|
|
|
599
|
-
|
|
583
|
+
if (this.indentExclusionRanges) {
|
|
584
|
+
cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
|
|
600
588
|
|
|
601
|
-
|
|
602
|
-
|
|
589
|
+
cloned.intro = this.intro;
|
|
590
|
+
cloned.outro = this.outro;
|
|
591
|
+
|
|
592
|
+
return cloned;
|
|
603
593
|
}
|
|
604
594
|
|
|
605
|
-
|
|
606
|
-
|
|
595
|
+
generateDecodedMap(options) {
|
|
596
|
+
options = options || {};
|
|
607
597
|
|
|
608
|
-
|
|
598
|
+
const sourceIndex = 0;
|
|
599
|
+
const names = Object.keys(this.storedNames);
|
|
600
|
+
const mappings = new Mappings(options.hires);
|
|
609
601
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
loc,
|
|
615
|
-
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
616
|
-
);
|
|
617
|
-
} else {
|
|
618
|
-
mappings.addUneditedChunk(sourceIndex, chunk, this$1$1.original, loc, this$1$1.sourcemapLocations);
|
|
602
|
+
const locate = getLocator$1(this.original);
|
|
603
|
+
|
|
604
|
+
if (this.intro) {
|
|
605
|
+
mappings.advance(this.intro);
|
|
619
606
|
}
|
|
620
607
|
|
|
621
|
-
|
|
622
|
-
|
|
608
|
+
this.firstChunk.eachNext((chunk) => {
|
|
609
|
+
const loc = locate(chunk.start);
|
|
623
610
|
|
|
624
|
-
|
|
625
|
-
file: options.file ? options.file.split(/[/\\]/).pop() : null,
|
|
626
|
-
sources: [options.source ? getRelativePath(options.file || '', options.source) : null],
|
|
627
|
-
sourcesContent: options.includeContent ? [this.original] : [null],
|
|
628
|
-
names: names,
|
|
629
|
-
mappings: mappings.raw
|
|
630
|
-
};
|
|
631
|
-
};
|
|
611
|
+
if (chunk.intro.length) mappings.advance(chunk.intro);
|
|
632
612
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
613
|
+
if (chunk.edited) {
|
|
614
|
+
mappings.addEdit(
|
|
615
|
+
sourceIndex,
|
|
616
|
+
chunk.content,
|
|
617
|
+
loc,
|
|
618
|
+
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
619
|
+
);
|
|
620
|
+
} else {
|
|
621
|
+
mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
|
|
622
|
+
}
|
|
636
623
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
624
|
+
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
return {
|
|
628
|
+
file: options.file ? options.file.split(/[/\\]/).pop() : null,
|
|
629
|
+
sources: [options.source ? getRelativePath(options.file || '', options.source) : null],
|
|
630
|
+
sourcesContent: options.includeContent ? [this.original] : [null],
|
|
631
|
+
names,
|
|
632
|
+
mappings: mappings.raw,
|
|
633
|
+
};
|
|
634
|
+
}
|
|
640
635
|
|
|
641
|
-
|
|
642
|
-
|
|
636
|
+
generateMap(options) {
|
|
637
|
+
return new SourceMap(this.generateDecodedMap(options));
|
|
638
|
+
}
|
|
643
639
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
indentStr = undefined;
|
|
640
|
+
getIndentString() {
|
|
641
|
+
return this.indentStr === null ? '\t' : this.indentStr;
|
|
647
642
|
}
|
|
648
643
|
|
|
649
|
-
indentStr
|
|
644
|
+
indent(indentStr, options) {
|
|
645
|
+
const pattern = /^[^\r\n]/gm;
|
|
650
646
|
|
|
651
|
-
|
|
647
|
+
if (isObject$1(indentStr)) {
|
|
648
|
+
options = indentStr;
|
|
649
|
+
indentStr = undefined;
|
|
650
|
+
}
|
|
652
651
|
|
|
653
|
-
|
|
652
|
+
indentStr = indentStr !== undefined ? indentStr : this.indentStr || '\t';
|
|
654
653
|
|
|
655
|
-
|
|
656
|
-
var isExcluded = {};
|
|
654
|
+
if (indentStr === '') return this; // noop
|
|
657
655
|
|
|
658
|
-
|
|
659
|
-
var exclusions =
|
|
660
|
-
typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
|
|
661
|
-
exclusions.forEach(function (exclusion) {
|
|
662
|
-
for (var i = exclusion[0]; i < exclusion[1]; i += 1) {
|
|
663
|
-
isExcluded[i] = true;
|
|
664
|
-
}
|
|
665
|
-
});
|
|
666
|
-
}
|
|
656
|
+
options = options || {};
|
|
667
657
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
if (shouldIndentNextCharacter) { return ("" + indentStr + match); }
|
|
671
|
-
shouldIndentNextCharacter = true;
|
|
672
|
-
return match;
|
|
673
|
-
};
|
|
658
|
+
// Process exclusion ranges
|
|
659
|
+
const isExcluded = {};
|
|
674
660
|
|
|
675
|
-
|
|
661
|
+
if (options.exclude) {
|
|
662
|
+
const exclusions =
|
|
663
|
+
typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
|
|
664
|
+
exclusions.forEach((exclusion) => {
|
|
665
|
+
for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
|
|
666
|
+
isExcluded[i] = true;
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
}
|
|
676
670
|
|
|
677
|
-
|
|
678
|
-
|
|
671
|
+
let shouldIndentNextCharacter = options.indentStart !== false;
|
|
672
|
+
const replacer = (match) => {
|
|
673
|
+
if (shouldIndentNextCharacter) return `${indentStr}${match}`;
|
|
674
|
+
shouldIndentNextCharacter = true;
|
|
675
|
+
return match;
|
|
676
|
+
};
|
|
679
677
|
|
|
680
|
-
|
|
681
|
-
var end = chunk.end;
|
|
678
|
+
this.intro = this.intro.replace(pattern, replacer);
|
|
682
679
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
chunk.content = chunk.content.replace(pattern, replacer);
|
|
680
|
+
let charIndex = 0;
|
|
681
|
+
let chunk = this.firstChunk;
|
|
686
682
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
} else {
|
|
692
|
-
charIndex = chunk.start;
|
|
683
|
+
while (chunk) {
|
|
684
|
+
const end = chunk.end;
|
|
693
685
|
|
|
694
|
-
|
|
686
|
+
if (chunk.edited) {
|
|
695
687
|
if (!isExcluded[charIndex]) {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
if (
|
|
699
|
-
shouldIndentNextCharacter =
|
|
700
|
-
} else if (char !== '\r' && shouldIndentNextCharacter) {
|
|
701
|
-
shouldIndentNextCharacter = false;
|
|
702
|
-
|
|
703
|
-
if (charIndex === chunk.start) {
|
|
704
|
-
chunk.prependRight(indentStr);
|
|
705
|
-
} else {
|
|
706
|
-
this._splitChunk(chunk, charIndex);
|
|
707
|
-
chunk = chunk.next;
|
|
708
|
-
chunk.prependRight(indentStr);
|
|
709
|
-
}
|
|
688
|
+
chunk.content = chunk.content.replace(pattern, replacer);
|
|
689
|
+
|
|
690
|
+
if (chunk.content.length) {
|
|
691
|
+
shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
|
|
710
692
|
}
|
|
711
693
|
}
|
|
694
|
+
} else {
|
|
695
|
+
charIndex = chunk.start;
|
|
696
|
+
|
|
697
|
+
while (charIndex < end) {
|
|
698
|
+
if (!isExcluded[charIndex]) {
|
|
699
|
+
const char = this.original[charIndex];
|
|
700
|
+
|
|
701
|
+
if (char === '\n') {
|
|
702
|
+
shouldIndentNextCharacter = true;
|
|
703
|
+
} else if (char !== '\r' && shouldIndentNextCharacter) {
|
|
704
|
+
shouldIndentNextCharacter = false;
|
|
705
|
+
|
|
706
|
+
if (charIndex === chunk.start) {
|
|
707
|
+
chunk.prependRight(indentStr);
|
|
708
|
+
} else {
|
|
709
|
+
this._splitChunk(chunk, charIndex);
|
|
710
|
+
chunk = chunk.next;
|
|
711
|
+
chunk.prependRight(indentStr);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
712
715
|
|
|
713
|
-
|
|
716
|
+
charIndex += 1;
|
|
717
|
+
}
|
|
714
718
|
}
|
|
719
|
+
|
|
720
|
+
charIndex = chunk.end;
|
|
721
|
+
chunk = chunk.next;
|
|
715
722
|
}
|
|
716
723
|
|
|
717
|
-
|
|
718
|
-
chunk = chunk.next;
|
|
719
|
-
}
|
|
724
|
+
this.outro = this.outro.replace(pattern, replacer);
|
|
720
725
|
|
|
721
|
-
|
|
726
|
+
return this;
|
|
727
|
+
}
|
|
722
728
|
|
|
723
|
-
|
|
724
|
-
|
|
729
|
+
insert() {
|
|
730
|
+
throw new Error(
|
|
731
|
+
'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
|
|
732
|
+
);
|
|
733
|
+
}
|
|
725
734
|
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
735
|
+
insertLeft(index, content) {
|
|
736
|
+
if (!warned.insertLeft) {
|
|
737
|
+
console.warn(
|
|
738
|
+
'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
|
|
739
|
+
); // eslint-disable-line no-console
|
|
740
|
+
warned.insertLeft = true;
|
|
741
|
+
}
|
|
729
742
|
|
|
730
|
-
|
|
731
|
-
if (!warned.insertLeft) {
|
|
732
|
-
console.warn('magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'); // eslint-disable-line no-console
|
|
733
|
-
warned.insertLeft = true;
|
|
743
|
+
return this.appendLeft(index, content);
|
|
734
744
|
}
|
|
735
745
|
|
|
736
|
-
|
|
737
|
-
|
|
746
|
+
insertRight(index, content) {
|
|
747
|
+
if (!warned.insertRight) {
|
|
748
|
+
console.warn(
|
|
749
|
+
'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
|
|
750
|
+
); // eslint-disable-line no-console
|
|
751
|
+
warned.insertRight = true;
|
|
752
|
+
}
|
|
738
753
|
|
|
739
|
-
|
|
740
|
-
if (!warned.insertRight) {
|
|
741
|
-
console.warn('magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'); // eslint-disable-line no-console
|
|
742
|
-
warned.insertRight = true;
|
|
754
|
+
return this.prependRight(index, content);
|
|
743
755
|
}
|
|
744
756
|
|
|
745
|
-
|
|
746
|
-
|
|
757
|
+
move(start, end, index) {
|
|
758
|
+
if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');
|
|
759
|
+
|
|
760
|
+
this._split(start);
|
|
761
|
+
this._split(end);
|
|
762
|
+
this._split(index);
|
|
747
763
|
|
|
748
|
-
|
|
749
|
-
|
|
764
|
+
const first = this.byStart[start];
|
|
765
|
+
const last = this.byEnd[end];
|
|
750
766
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
this._split(index);
|
|
767
|
+
const oldLeft = first.previous;
|
|
768
|
+
const oldRight = last.next;
|
|
754
769
|
|
|
755
|
-
|
|
756
|
-
|
|
770
|
+
const newRight = this.byStart[index];
|
|
771
|
+
if (!newRight && last === this.lastChunk) return this;
|
|
772
|
+
const newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
757
773
|
|
|
758
|
-
|
|
759
|
-
|
|
774
|
+
if (oldLeft) oldLeft.next = oldRight;
|
|
775
|
+
if (oldRight) oldRight.previous = oldLeft;
|
|
760
776
|
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
var newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
777
|
+
if (newLeft) newLeft.next = first;
|
|
778
|
+
if (newRight) newRight.previous = last;
|
|
764
779
|
|
|
765
|
-
|
|
766
|
-
|
|
780
|
+
if (!first.previous) this.firstChunk = last.next;
|
|
781
|
+
if (!last.next) {
|
|
782
|
+
this.lastChunk = first.previous;
|
|
783
|
+
this.lastChunk.next = null;
|
|
784
|
+
}
|
|
767
785
|
|
|
768
|
-
|
|
769
|
-
|
|
786
|
+
first.previous = newLeft;
|
|
787
|
+
last.next = newRight || null;
|
|
770
788
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
this
|
|
774
|
-
this.lastChunk.next = null;
|
|
789
|
+
if (!newLeft) this.firstChunk = first;
|
|
790
|
+
if (!newRight) this.lastChunk = last;
|
|
791
|
+
return this;
|
|
775
792
|
}
|
|
776
793
|
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
if (!newLeft) { this.firstChunk = first; }
|
|
781
|
-
if (!newRight) { this.lastChunk = last; }
|
|
782
|
-
return this;
|
|
783
|
-
};
|
|
794
|
+
overwrite(start, end, content, options) {
|
|
795
|
+
if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
|
|
784
796
|
|
|
785
|
-
|
|
786
|
-
|
|
797
|
+
while (start < 0) start += this.original.length;
|
|
798
|
+
while (end < 0) end += this.original.length;
|
|
787
799
|
|
|
788
|
-
|
|
789
|
-
|
|
800
|
+
if (end > this.original.length) throw new Error('end is out of bounds');
|
|
801
|
+
if (start === end)
|
|
802
|
+
throw new Error(
|
|
803
|
+
'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
|
|
804
|
+
);
|
|
790
805
|
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
{ throw new Error('Cannot overwrite a zero-length range – use appendLeft or prependRight instead'); }
|
|
806
|
+
this._split(start);
|
|
807
|
+
this._split(end);
|
|
794
808
|
|
|
795
|
-
|
|
796
|
-
|
|
809
|
+
if (options === true) {
|
|
810
|
+
if (!warned.storeName) {
|
|
811
|
+
console.warn(
|
|
812
|
+
'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
|
|
813
|
+
); // eslint-disable-line no-console
|
|
814
|
+
warned.storeName = true;
|
|
815
|
+
}
|
|
797
816
|
|
|
798
|
-
|
|
799
|
-
if (!warned.storeName) {
|
|
800
|
-
console.warn('The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'); // eslint-disable-line no-console
|
|
801
|
-
warned.storeName = true;
|
|
817
|
+
options = { storeName: true };
|
|
802
818
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
var first = this.byStart[start];
|
|
815
|
-
var last = this.byEnd[end];
|
|
816
|
-
|
|
817
|
-
if (first) {
|
|
818
|
-
if (end > first.end && first.next !== this.byStart[first.end]) {
|
|
819
|
-
throw new Error('Cannot overwrite across a split point');
|
|
819
|
+
const storeName = options !== undefined ? options.storeName : false;
|
|
820
|
+
const contentOnly = options !== undefined ? options.contentOnly : false;
|
|
821
|
+
|
|
822
|
+
if (storeName) {
|
|
823
|
+
const original = this.original.slice(start, end);
|
|
824
|
+
Object.defineProperty(this.storedNames, original, {
|
|
825
|
+
writable: true,
|
|
826
|
+
value: true,
|
|
827
|
+
enumerable: true,
|
|
828
|
+
});
|
|
820
829
|
}
|
|
821
830
|
|
|
822
|
-
first
|
|
831
|
+
const first = this.byStart[start];
|
|
832
|
+
const last = this.byEnd[end];
|
|
823
833
|
|
|
824
|
-
if (first
|
|
825
|
-
|
|
834
|
+
if (first) {
|
|
835
|
+
let chunk = first;
|
|
826
836
|
while (chunk !== last) {
|
|
827
|
-
chunk.
|
|
837
|
+
if (chunk.next !== this.byStart[chunk.end]) {
|
|
838
|
+
throw new Error('Cannot overwrite across a split point');
|
|
839
|
+
}
|
|
828
840
|
chunk = chunk.next;
|
|
841
|
+
chunk.edit('', false);
|
|
829
842
|
}
|
|
830
843
|
|
|
831
|
-
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
var newChunk = new Chunk$1(start, end, '').edit(content, storeName);
|
|
844
|
+
first.edit(content, storeName, contentOnly);
|
|
845
|
+
} else {
|
|
846
|
+
// must be inserting at the end
|
|
847
|
+
const newChunk = new Chunk$1(start, end, '').edit(content, storeName);
|
|
836
848
|
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
849
|
+
// TODO last chunk in the array may not be the last chunk, if it's moved...
|
|
850
|
+
last.next = newChunk;
|
|
851
|
+
newChunk.previous = last;
|
|
852
|
+
}
|
|
853
|
+
return this;
|
|
840
854
|
}
|
|
841
|
-
return this;
|
|
842
|
-
};
|
|
843
|
-
|
|
844
|
-
MagicString.prototype.prepend = function prepend (content) {
|
|
845
|
-
if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
|
|
846
|
-
|
|
847
|
-
this.intro = content + this.intro;
|
|
848
|
-
return this;
|
|
849
|
-
};
|
|
850
|
-
|
|
851
|
-
MagicString.prototype.prependLeft = function prependLeft (index, content) {
|
|
852
|
-
if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
|
|
853
855
|
|
|
854
|
-
|
|
856
|
+
prepend(content) {
|
|
857
|
+
if (typeof content !== 'string') throw new TypeError('outro content must be a string');
|
|
855
858
|
|
|
856
|
-
var chunk = this.byEnd[index];
|
|
857
|
-
|
|
858
|
-
if (chunk) {
|
|
859
|
-
chunk.prependLeft(content);
|
|
860
|
-
} else {
|
|
861
859
|
this.intro = content + this.intro;
|
|
860
|
+
return this;
|
|
862
861
|
}
|
|
863
|
-
return this;
|
|
864
|
-
};
|
|
865
862
|
|
|
866
|
-
|
|
867
|
-
|
|
863
|
+
prependLeft(index, content) {
|
|
864
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
868
865
|
|
|
869
|
-
|
|
866
|
+
this._split(index);
|
|
870
867
|
|
|
871
|
-
|
|
868
|
+
const chunk = this.byEnd[index];
|
|
872
869
|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
870
|
+
if (chunk) {
|
|
871
|
+
chunk.prependLeft(content);
|
|
872
|
+
} else {
|
|
873
|
+
this.intro = content + this.intro;
|
|
874
|
+
}
|
|
875
|
+
return this;
|
|
877
876
|
}
|
|
878
|
-
return this;
|
|
879
|
-
};
|
|
880
|
-
|
|
881
|
-
MagicString.prototype.remove = function remove (start, end) {
|
|
882
|
-
while (start < 0) { start += this.original.length; }
|
|
883
|
-
while (end < 0) { end += this.original.length; }
|
|
884
|
-
|
|
885
|
-
if (start === end) { return this; }
|
|
886
877
|
|
|
887
|
-
|
|
888
|
-
|
|
878
|
+
prependRight(index, content) {
|
|
879
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
889
880
|
|
|
890
|
-
|
|
891
|
-
this._split(end);
|
|
881
|
+
this._split(index);
|
|
892
882
|
|
|
893
|
-
|
|
883
|
+
const chunk = this.byStart[index];
|
|
894
884
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
901
|
-
}
|
|
902
|
-
return this;
|
|
903
|
-
};
|
|
904
|
-
|
|
905
|
-
MagicString.prototype.lastChar = function lastChar () {
|
|
906
|
-
if (this.outro.length)
|
|
907
|
-
{ return this.outro[this.outro.length - 1]; }
|
|
908
|
-
var chunk = this.lastChunk;
|
|
909
|
-
do {
|
|
910
|
-
if (chunk.outro.length)
|
|
911
|
-
{ return chunk.outro[chunk.outro.length - 1]; }
|
|
912
|
-
if (chunk.content.length)
|
|
913
|
-
{ return chunk.content[chunk.content.length - 1]; }
|
|
914
|
-
if (chunk.intro.length)
|
|
915
|
-
{ return chunk.intro[chunk.intro.length - 1]; }
|
|
916
|
-
} while (chunk = chunk.previous);
|
|
917
|
-
if (this.intro.length)
|
|
918
|
-
{ return this.intro[this.intro.length - 1]; }
|
|
919
|
-
return '';
|
|
920
|
-
};
|
|
921
|
-
|
|
922
|
-
MagicString.prototype.lastLine = function lastLine () {
|
|
923
|
-
var lineIndex = this.outro.lastIndexOf(n);
|
|
924
|
-
if (lineIndex !== -1)
|
|
925
|
-
{ return this.outro.substr(lineIndex + 1); }
|
|
926
|
-
var lineStr = this.outro;
|
|
927
|
-
var chunk = this.lastChunk;
|
|
928
|
-
do {
|
|
929
|
-
if (chunk.outro.length > 0) {
|
|
930
|
-
lineIndex = chunk.outro.lastIndexOf(n);
|
|
931
|
-
if (lineIndex !== -1)
|
|
932
|
-
{ return chunk.outro.substr(lineIndex + 1) + lineStr; }
|
|
933
|
-
lineStr = chunk.outro + lineStr;
|
|
885
|
+
if (chunk) {
|
|
886
|
+
chunk.prependRight(content);
|
|
887
|
+
} else {
|
|
888
|
+
this.outro = content + this.outro;
|
|
934
889
|
}
|
|
890
|
+
return this;
|
|
891
|
+
}
|
|
935
892
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
{ return chunk.content.substr(lineIndex + 1) + lineStr; }
|
|
940
|
-
lineStr = chunk.content + lineStr;
|
|
941
|
-
}
|
|
893
|
+
remove(start, end) {
|
|
894
|
+
while (start < 0) start += this.original.length;
|
|
895
|
+
while (end < 0) end += this.original.length;
|
|
942
896
|
|
|
943
|
-
if (
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
lineStr = chunk.intro + lineStr;
|
|
948
|
-
}
|
|
949
|
-
} while (chunk = chunk.previous);
|
|
950
|
-
lineIndex = this.intro.lastIndexOf(n);
|
|
951
|
-
if (lineIndex !== -1)
|
|
952
|
-
{ return this.intro.substr(lineIndex + 1) + lineStr; }
|
|
953
|
-
return this.intro + lineStr;
|
|
954
|
-
};
|
|
897
|
+
if (start === end) return this;
|
|
898
|
+
|
|
899
|
+
if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');
|
|
900
|
+
if (start > end) throw new Error('end must be greater than start');
|
|
955
901
|
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
if ( end === void 0 ) end = this.original.length;
|
|
902
|
+
this._split(start);
|
|
903
|
+
this._split(end);
|
|
959
904
|
|
|
960
|
-
|
|
961
|
-
while (end < 0) { end += this.original.length; }
|
|
905
|
+
let chunk = this.byStart[start];
|
|
962
906
|
|
|
963
|
-
|
|
907
|
+
while (chunk) {
|
|
908
|
+
chunk.intro = '';
|
|
909
|
+
chunk.outro = '';
|
|
910
|
+
chunk.edit('');
|
|
964
911
|
|
|
965
|
-
|
|
966
|
-
var chunk = this.firstChunk;
|
|
967
|
-
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
968
|
-
// found end chunk before start
|
|
969
|
-
if (chunk.start < end && chunk.end >= end) {
|
|
970
|
-
return result;
|
|
912
|
+
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
971
913
|
}
|
|
914
|
+
return this;
|
|
915
|
+
}
|
|
972
916
|
|
|
973
|
-
|
|
917
|
+
lastChar() {
|
|
918
|
+
if (this.outro.length) return this.outro[this.outro.length - 1];
|
|
919
|
+
let chunk = this.lastChunk;
|
|
920
|
+
do {
|
|
921
|
+
if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
|
|
922
|
+
if (chunk.content.length) return chunk.content[chunk.content.length - 1];
|
|
923
|
+
if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
|
|
924
|
+
} while ((chunk = chunk.previous));
|
|
925
|
+
if (this.intro.length) return this.intro[this.intro.length - 1];
|
|
926
|
+
return '';
|
|
974
927
|
}
|
|
975
928
|
|
|
976
|
-
|
|
977
|
-
|
|
929
|
+
lastLine() {
|
|
930
|
+
let lineIndex = this.outro.lastIndexOf(n);
|
|
931
|
+
if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
|
|
932
|
+
let lineStr = this.outro;
|
|
933
|
+
let chunk = this.lastChunk;
|
|
934
|
+
do {
|
|
935
|
+
if (chunk.outro.length > 0) {
|
|
936
|
+
lineIndex = chunk.outro.lastIndexOf(n);
|
|
937
|
+
if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
|
|
938
|
+
lineStr = chunk.outro + lineStr;
|
|
939
|
+
}
|
|
978
940
|
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
941
|
+
if (chunk.content.length > 0) {
|
|
942
|
+
lineIndex = chunk.content.lastIndexOf(n);
|
|
943
|
+
if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
|
|
944
|
+
lineStr = chunk.content + lineStr;
|
|
945
|
+
}
|
|
984
946
|
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
947
|
+
if (chunk.intro.length > 0) {
|
|
948
|
+
lineIndex = chunk.intro.lastIndexOf(n);
|
|
949
|
+
if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
|
|
950
|
+
lineStr = chunk.intro + lineStr;
|
|
951
|
+
}
|
|
952
|
+
} while ((chunk = chunk.previous));
|
|
953
|
+
lineIndex = this.intro.lastIndexOf(n);
|
|
954
|
+
if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
|
|
955
|
+
return this.intro + lineStr;
|
|
956
|
+
}
|
|
988
957
|
|
|
989
|
-
|
|
990
|
-
|
|
958
|
+
slice(start = 0, end = this.original.length) {
|
|
959
|
+
while (start < 0) start += this.original.length;
|
|
960
|
+
while (end < 0) end += this.original.length;
|
|
991
961
|
|
|
992
|
-
result
|
|
962
|
+
let result = '';
|
|
993
963
|
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
964
|
+
// find start chunk
|
|
965
|
+
let chunk = this.firstChunk;
|
|
966
|
+
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
967
|
+
// found end chunk before start
|
|
968
|
+
if (chunk.start < end && chunk.end >= end) {
|
|
969
|
+
return result;
|
|
970
|
+
}
|
|
997
971
|
|
|
998
|
-
|
|
999
|
-
break;
|
|
972
|
+
chunk = chunk.next;
|
|
1000
973
|
}
|
|
1001
974
|
|
|
1002
|
-
chunk
|
|
1003
|
-
|
|
975
|
+
if (chunk && chunk.edited && chunk.start !== start)
|
|
976
|
+
throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
|
|
1004
977
|
|
|
1005
|
-
|
|
1006
|
-
|
|
978
|
+
const startChunk = chunk;
|
|
979
|
+
while (chunk) {
|
|
980
|
+
if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
|
|
981
|
+
result += chunk.intro;
|
|
982
|
+
}
|
|
1007
983
|
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
clone.remove(0, start);
|
|
1012
|
-
clone.remove(end, clone.original.length);
|
|
984
|
+
const containsEnd = chunk.start < end && chunk.end >= end;
|
|
985
|
+
if (containsEnd && chunk.edited && chunk.end !== end)
|
|
986
|
+
throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
|
|
1013
987
|
|
|
1014
|
-
|
|
1015
|
-
|
|
988
|
+
const sliceStart = startChunk === chunk ? start - chunk.start : 0;
|
|
989
|
+
const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
|
|
1016
990
|
|
|
1017
|
-
|
|
1018
|
-
if (this.byStart[index] || this.byEnd[index]) { return; }
|
|
991
|
+
result += chunk.content.slice(sliceStart, sliceEnd);
|
|
1019
992
|
|
|
1020
|
-
|
|
1021
|
-
|
|
993
|
+
if (chunk.outro && (!containsEnd || chunk.end === end)) {
|
|
994
|
+
result += chunk.outro;
|
|
995
|
+
}
|
|
1022
996
|
|
|
1023
|
-
|
|
1024
|
-
|
|
997
|
+
if (containsEnd) {
|
|
998
|
+
break;
|
|
999
|
+
}
|
|
1025
1000
|
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
};
|
|
1001
|
+
chunk = chunk.next;
|
|
1002
|
+
}
|
|
1029
1003
|
|
|
1030
|
-
|
|
1031
|
-
if (chunk.edited && chunk.content.length) {
|
|
1032
|
-
// zero-length edited chunks are a special case (overlapping replacements)
|
|
1033
|
-
var loc = getLocator$1(this.original)(index);
|
|
1034
|
-
throw new Error(
|
|
1035
|
-
("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")")
|
|
1036
|
-
);
|
|
1004
|
+
return result;
|
|
1037
1005
|
}
|
|
1038
1006
|
|
|
1039
|
-
|
|
1007
|
+
// TODO deprecate this? not really very useful
|
|
1008
|
+
snip(start, end) {
|
|
1009
|
+
const clone = this.clone();
|
|
1010
|
+
clone.remove(0, start);
|
|
1011
|
+
clone.remove(end, clone.original.length);
|
|
1040
1012
|
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
this.byEnd[newChunk.end] = newChunk;
|
|
1013
|
+
return clone;
|
|
1014
|
+
}
|
|
1044
1015
|
|
|
1045
|
-
|
|
1016
|
+
_split(index) {
|
|
1017
|
+
if (this.byStart[index] || this.byEnd[index]) return;
|
|
1046
1018
|
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
};
|
|
1019
|
+
let chunk = this.lastSearchedChunk;
|
|
1020
|
+
const searchForward = index > chunk.end;
|
|
1050
1021
|
|
|
1051
|
-
|
|
1052
|
-
|
|
1022
|
+
while (chunk) {
|
|
1023
|
+
if (chunk.contains(index)) return this._splitChunk(chunk, index);
|
|
1053
1024
|
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
str += chunk.toString();
|
|
1057
|
-
chunk = chunk.next;
|
|
1025
|
+
chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
|
|
1026
|
+
}
|
|
1058
1027
|
}
|
|
1059
1028
|
|
|
1060
|
-
|
|
1061
|
-
|
|
1029
|
+
_splitChunk(chunk, index) {
|
|
1030
|
+
if (chunk.edited && chunk.content.length) {
|
|
1031
|
+
// zero-length edited chunks are a special case (overlapping replacements)
|
|
1032
|
+
const loc = getLocator$1(this.original)(index);
|
|
1033
|
+
throw new Error(
|
|
1034
|
+
`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1062
1037
|
|
|
1063
|
-
|
|
1064
|
-
var chunk = this.firstChunk;
|
|
1065
|
-
do {
|
|
1066
|
-
if (chunk.intro.length && chunk.intro.trim() ||
|
|
1067
|
-
chunk.content.length && chunk.content.trim() ||
|
|
1068
|
-
chunk.outro.length && chunk.outro.trim())
|
|
1069
|
-
{ return false; }
|
|
1070
|
-
} while (chunk = chunk.next);
|
|
1071
|
-
return true;
|
|
1072
|
-
};
|
|
1038
|
+
const newChunk = chunk.split(index);
|
|
1073
1039
|
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
do {
|
|
1078
|
-
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
|
|
1079
|
-
} while (chunk = chunk.next);
|
|
1080
|
-
return length;
|
|
1081
|
-
};
|
|
1040
|
+
this.byEnd[index] = chunk;
|
|
1041
|
+
this.byStart[index] = newChunk;
|
|
1042
|
+
this.byEnd[newChunk.end] = newChunk;
|
|
1082
1043
|
|
|
1083
|
-
|
|
1084
|
-
return this.trim('[\\r\\n]');
|
|
1085
|
-
};
|
|
1044
|
+
if (chunk === this.lastChunk) this.lastChunk = newChunk;
|
|
1086
1045
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
}
|
|
1046
|
+
this.lastSearchedChunk = chunk;
|
|
1047
|
+
return true;
|
|
1048
|
+
}
|
|
1090
1049
|
|
|
1091
|
-
|
|
1092
|
-
|
|
1050
|
+
toString() {
|
|
1051
|
+
let str = this.intro;
|
|
1093
1052
|
|
|
1094
|
-
|
|
1095
|
-
|
|
1053
|
+
let chunk = this.firstChunk;
|
|
1054
|
+
while (chunk) {
|
|
1055
|
+
str += chunk.toString();
|
|
1056
|
+
chunk = chunk.next;
|
|
1057
|
+
}
|
|
1096
1058
|
|
|
1097
|
-
|
|
1059
|
+
return str + this.outro;
|
|
1060
|
+
}
|
|
1098
1061
|
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1062
|
+
isEmpty() {
|
|
1063
|
+
let chunk = this.firstChunk;
|
|
1064
|
+
do {
|
|
1065
|
+
if (
|
|
1066
|
+
(chunk.intro.length && chunk.intro.trim()) ||
|
|
1067
|
+
(chunk.content.length && chunk.content.trim()) ||
|
|
1068
|
+
(chunk.outro.length && chunk.outro.trim())
|
|
1069
|
+
)
|
|
1070
|
+
return false;
|
|
1071
|
+
} while ((chunk = chunk.next));
|
|
1072
|
+
return true;
|
|
1073
|
+
}
|
|
1102
1074
|
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1075
|
+
length() {
|
|
1076
|
+
let chunk = this.firstChunk;
|
|
1077
|
+
let length = 0;
|
|
1078
|
+
do {
|
|
1079
|
+
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
|
|
1080
|
+
} while ((chunk = chunk.next));
|
|
1081
|
+
return length;
|
|
1082
|
+
}
|
|
1108
1083
|
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
}
|
|
1084
|
+
trimLines() {
|
|
1085
|
+
return this.trim('[\\r\\n]');
|
|
1086
|
+
}
|
|
1113
1087
|
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
}
|
|
1088
|
+
trim(charType) {
|
|
1089
|
+
return this.trimStart(charType).trimEnd(charType);
|
|
1090
|
+
}
|
|
1117
1091
|
|
|
1118
|
-
|
|
1119
|
-
|
|
1092
|
+
trimEndAborted(charType) {
|
|
1093
|
+
const rx = new RegExp((charType || '\\s') + '+$');
|
|
1120
1094
|
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
return this;
|
|
1124
|
-
};
|
|
1125
|
-
MagicString.prototype.trimStartAborted = function trimStartAborted (charType) {
|
|
1126
|
-
var rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
1095
|
+
this.outro = this.outro.replace(rx, '');
|
|
1096
|
+
if (this.outro.length) return true;
|
|
1127
1097
|
|
|
1128
|
-
|
|
1129
|
-
if (this.intro.length) { return true; }
|
|
1098
|
+
let chunk = this.lastChunk;
|
|
1130
1099
|
|
|
1131
|
-
|
|
1100
|
+
do {
|
|
1101
|
+
const end = chunk.end;
|
|
1102
|
+
const aborted = chunk.trimEnd(rx);
|
|
1132
1103
|
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1104
|
+
// if chunk was trimmed, we have a new lastChunk
|
|
1105
|
+
if (chunk.end !== end) {
|
|
1106
|
+
if (this.lastChunk === chunk) {
|
|
1107
|
+
this.lastChunk = chunk.next;
|
|
1108
|
+
}
|
|
1136
1109
|
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1110
|
+
this.byEnd[chunk.end] = chunk;
|
|
1111
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
1112
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
1113
|
+
}
|
|
1140
1114
|
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}
|
|
1115
|
+
if (aborted) return true;
|
|
1116
|
+
chunk = chunk.previous;
|
|
1117
|
+
} while (chunk);
|
|
1145
1118
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
} while (chunk);
|
|
1119
|
+
return false;
|
|
1120
|
+
}
|
|
1149
1121
|
|
|
1150
|
-
|
|
1151
|
-
|
|
1122
|
+
trimEnd(charType) {
|
|
1123
|
+
this.trimEndAborted(charType);
|
|
1124
|
+
return this;
|
|
1125
|
+
}
|
|
1126
|
+
trimStartAborted(charType) {
|
|
1127
|
+
const rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
1152
1128
|
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
return this;
|
|
1156
|
-
};
|
|
1129
|
+
this.intro = this.intro.replace(rx, '');
|
|
1130
|
+
if (this.intro.length) return true;
|
|
1157
1131
|
|
|
1158
|
-
|
|
1132
|
+
let chunk = this.firstChunk;
|
|
1159
1133
|
|
|
1160
|
-
|
|
1161
|
-
|
|
1134
|
+
do {
|
|
1135
|
+
const end = chunk.end;
|
|
1136
|
+
const aborted = chunk.trimStart(rx);
|
|
1162
1137
|
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
this.uniqueSources = [];
|
|
1167
|
-
this.uniqueSourceIndexByFilename = {};
|
|
1168
|
-
};
|
|
1138
|
+
if (chunk.end !== end) {
|
|
1139
|
+
// special case...
|
|
1140
|
+
if (chunk === this.lastChunk) this.lastChunk = chunk.next;
|
|
1169
1141
|
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
filename: source.filename,
|
|
1175
|
-
separator: this.separator
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1142
|
+
this.byEnd[chunk.end] = chunk;
|
|
1143
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
1144
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
1145
|
+
}
|
|
1178
1146
|
|
|
1179
|
-
|
|
1180
|
-
|
|
1147
|
+
if (aborted) return true;
|
|
1148
|
+
chunk = chunk.next;
|
|
1149
|
+
} while (chunk);
|
|
1150
|
+
|
|
1151
|
+
return false;
|
|
1181
1152
|
}
|
|
1182
1153
|
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1154
|
+
trimStart(charType) {
|
|
1155
|
+
this.trimStartAborted(charType);
|
|
1156
|
+
return this;
|
|
1157
|
+
}
|
|
1186
1158
|
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
source.separator = this.separator;
|
|
1159
|
+
hasChanged() {
|
|
1160
|
+
return this.original !== this.toString();
|
|
1190
1161
|
}
|
|
1191
1162
|
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1163
|
+
replace(searchValue, replacement) {
|
|
1164
|
+
function getReplacement(match, str) {
|
|
1165
|
+
if (typeof replacement === 'string') {
|
|
1166
|
+
return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
|
|
1167
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter
|
|
1168
|
+
if (i === '$') return '$';
|
|
1169
|
+
if (i === '&') return match[0];
|
|
1170
|
+
const num = +i;
|
|
1171
|
+
if (num < match.length) return match[+i];
|
|
1172
|
+
return `$${i}`;
|
|
1173
|
+
});
|
|
1174
|
+
} else {
|
|
1175
|
+
return replacement(...match, match.index, str, match.groups);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
function matchAll(re, str) {
|
|
1179
|
+
let match;
|
|
1180
|
+
const matches = [];
|
|
1181
|
+
while ((match = re.exec(str))) {
|
|
1182
|
+
matches.push(match);
|
|
1200
1183
|
}
|
|
1184
|
+
return matches;
|
|
1185
|
+
}
|
|
1186
|
+
if (typeof searchValue !== 'string' && searchValue.global) {
|
|
1187
|
+
const matches = matchAll(searchValue, this.original);
|
|
1188
|
+
matches.forEach((match) => {
|
|
1189
|
+
if (match.index != null)
|
|
1190
|
+
this.overwrite(
|
|
1191
|
+
match.index,
|
|
1192
|
+
match.index + match[0].length,
|
|
1193
|
+
getReplacement(match, this.original)
|
|
1194
|
+
);
|
|
1195
|
+
});
|
|
1196
|
+
} else {
|
|
1197
|
+
const match = this.original.match(searchValue);
|
|
1198
|
+
if (match && match.index != null)
|
|
1199
|
+
this.overwrite(
|
|
1200
|
+
match.index,
|
|
1201
|
+
match.index + match[0].length,
|
|
1202
|
+
getReplacement(match, this.original)
|
|
1203
|
+
);
|
|
1201
1204
|
}
|
|
1205
|
+
return this;
|
|
1202
1206
|
}
|
|
1207
|
+
}
|
|
1203
1208
|
|
|
1204
|
-
|
|
1205
|
-
return this;
|
|
1206
|
-
};
|
|
1209
|
+
const hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1207
1210
|
|
|
1208
|
-
Bundle$1
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
separator
|
|
1212
|
-
|
|
1211
|
+
class Bundle$1 {
|
|
1212
|
+
constructor(options = {}) {
|
|
1213
|
+
this.intro = options.intro || '';
|
|
1214
|
+
this.separator = options.separator !== undefined ? options.separator : '\n';
|
|
1215
|
+
this.sources = [];
|
|
1216
|
+
this.uniqueSources = [];
|
|
1217
|
+
this.uniqueSourceIndexByFilename = {};
|
|
1218
|
+
}
|
|
1213
1219
|
|
|
1214
|
-
|
|
1215
|
-
|
|
1220
|
+
addSource(source) {
|
|
1221
|
+
if (source instanceof MagicString) {
|
|
1222
|
+
return this.addSource({
|
|
1223
|
+
content: source,
|
|
1224
|
+
filename: source.filename,
|
|
1225
|
+
separator: this.separator,
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1216
1228
|
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1229
|
+
if (!isObject$1(source) || !source.content) {
|
|
1230
|
+
throw new Error(
|
|
1231
|
+
'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`'
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1222
1234
|
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
filename: source.filename,
|
|
1226
|
-
content: source.content.clone(),
|
|
1227
|
-
separator: source.separator
|
|
1235
|
+
['filename', 'indentExclusionRanges', 'separator'].forEach((option) => {
|
|
1236
|
+
if (!hasOwnProp.call(source, option)) source[option] = source.content[option];
|
|
1228
1237
|
});
|
|
1229
|
-
});
|
|
1230
1238
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1239
|
+
if (source.separator === undefined) {
|
|
1240
|
+
// TODO there's a bunch of this sort of thing, needs cleaning up
|
|
1241
|
+
source.separator = this.separator;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
if (source.filename) {
|
|
1245
|
+
if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {
|
|
1246
|
+
this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;
|
|
1247
|
+
this.uniqueSources.push({ filename: source.filename, content: source.content.original });
|
|
1248
|
+
} else {
|
|
1249
|
+
const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];
|
|
1250
|
+
if (source.content.original !== uniqueSource.content) {
|
|
1251
|
+
throw new Error(`Illegal source: same filename (${source.filename}), different contents`);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1233
1255
|
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1256
|
+
this.sources.push(source);
|
|
1257
|
+
return this;
|
|
1258
|
+
}
|
|
1237
1259
|
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1260
|
+
append(str, options) {
|
|
1261
|
+
this.addSource({
|
|
1262
|
+
content: new MagicString(str),
|
|
1263
|
+
separator: (options && options.separator) || '',
|
|
1264
|
+
});
|
|
1265
|
+
|
|
1266
|
+
return this;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
clone() {
|
|
1270
|
+
const bundle = new Bundle$1({
|
|
1271
|
+
intro: this.intro,
|
|
1272
|
+
separator: this.separator,
|
|
1242
1273
|
});
|
|
1243
|
-
});
|
|
1244
1274
|
|
|
1245
|
-
|
|
1275
|
+
this.sources.forEach((source) => {
|
|
1276
|
+
bundle.addSource({
|
|
1277
|
+
filename: source.filename,
|
|
1278
|
+
content: source.content.clone(),
|
|
1279
|
+
separator: source.separator,
|
|
1280
|
+
});
|
|
1281
|
+
});
|
|
1246
1282
|
|
|
1247
|
-
|
|
1248
|
-
mappings.advance(this.intro);
|
|
1283
|
+
return bundle;
|
|
1249
1284
|
}
|
|
1250
1285
|
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1286
|
+
generateDecodedMap(options = {}) {
|
|
1287
|
+
const names = [];
|
|
1288
|
+
this.sources.forEach((source) => {
|
|
1289
|
+
Object.keys(source.content.storedNames).forEach((name) => {
|
|
1290
|
+
if (!~names.indexOf(name)) names.push(name);
|
|
1291
|
+
});
|
|
1292
|
+
});
|
|
1255
1293
|
|
|
1256
|
-
|
|
1257
|
-
var magicString = source.content;
|
|
1258
|
-
var locate = getLocator$1(magicString.original);
|
|
1294
|
+
const mappings = new Mappings(options.hires);
|
|
1259
1295
|
|
|
1260
|
-
if (
|
|
1261
|
-
mappings.advance(
|
|
1296
|
+
if (this.intro) {
|
|
1297
|
+
mappings.advance(this.intro);
|
|
1262
1298
|
}
|
|
1263
1299
|
|
|
1264
|
-
|
|
1265
|
-
|
|
1300
|
+
this.sources.forEach((source, i) => {
|
|
1301
|
+
if (i > 0) {
|
|
1302
|
+
mappings.advance(this.separator);
|
|
1303
|
+
}
|
|
1266
1304
|
|
|
1267
|
-
|
|
1305
|
+
const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;
|
|
1306
|
+
const magicString = source.content;
|
|
1307
|
+
const locate = getLocator$1(magicString.original);
|
|
1268
1308
|
|
|
1269
|
-
if (
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1309
|
+
if (magicString.intro) {
|
|
1310
|
+
mappings.advance(magicString.intro);
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
magicString.firstChunk.eachNext((chunk) => {
|
|
1314
|
+
const loc = locate(chunk.start);
|
|
1315
|
+
|
|
1316
|
+
if (chunk.intro.length) mappings.advance(chunk.intro);
|
|
1317
|
+
|
|
1318
|
+
if (source.filename) {
|
|
1319
|
+
if (chunk.edited) {
|
|
1320
|
+
mappings.addEdit(
|
|
1321
|
+
sourceIndex,
|
|
1322
|
+
chunk.content,
|
|
1323
|
+
loc,
|
|
1324
|
+
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
1325
|
+
);
|
|
1326
|
+
} else {
|
|
1327
|
+
mappings.addUneditedChunk(
|
|
1328
|
+
sourceIndex,
|
|
1329
|
+
chunk,
|
|
1330
|
+
magicString.original,
|
|
1331
|
+
loc,
|
|
1332
|
+
magicString.sourcemapLocations
|
|
1333
|
+
);
|
|
1334
|
+
}
|
|
1277
1335
|
} else {
|
|
1278
|
-
mappings.
|
|
1279
|
-
sourceIndex,
|
|
1280
|
-
chunk,
|
|
1281
|
-
magicString.original,
|
|
1282
|
-
loc,
|
|
1283
|
-
magicString.sourcemapLocations
|
|
1284
|
-
);
|
|
1336
|
+
mappings.advance(chunk.content);
|
|
1285
1337
|
}
|
|
1286
|
-
} else {
|
|
1287
|
-
mappings.advance(chunk.content);
|
|
1288
|
-
}
|
|
1289
1338
|
|
|
1290
|
-
|
|
1291
|
-
|
|
1339
|
+
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
1340
|
+
});
|
|
1292
1341
|
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1342
|
+
if (magicString.outro) {
|
|
1343
|
+
mappings.advance(magicString.outro);
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1297
1346
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
}
|
|
1347
|
+
return {
|
|
1348
|
+
file: options.file ? options.file.split(/[/\\]/).pop() : null,
|
|
1349
|
+
sources: this.uniqueSources.map((source) => {
|
|
1350
|
+
return options.file ? getRelativePath(options.file, source.filename) : source.filename;
|
|
1351
|
+
}),
|
|
1352
|
+
sourcesContent: this.uniqueSources.map((source) => {
|
|
1353
|
+
return options.includeContent ? source.content : null;
|
|
1354
|
+
}),
|
|
1355
|
+
names,
|
|
1356
|
+
mappings: mappings.raw,
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1310
1359
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
}
|
|
1360
|
+
generateMap(options) {
|
|
1361
|
+
return new SourceMap(this.generateDecodedMap(options));
|
|
1362
|
+
}
|
|
1314
1363
|
|
|
1315
|
-
|
|
1316
|
-
|
|
1364
|
+
getIndentString() {
|
|
1365
|
+
const indentStringCounts = {};
|
|
1317
1366
|
|
|
1318
|
-
|
|
1319
|
-
|
|
1367
|
+
this.sources.forEach((source) => {
|
|
1368
|
+
const indentStr = source.content.indentStr;
|
|
1320
1369
|
|
|
1321
|
-
|
|
1370
|
+
if (indentStr === null) return;
|
|
1322
1371
|
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1372
|
+
if (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;
|
|
1373
|
+
indentStringCounts[indentStr] += 1;
|
|
1374
|
+
});
|
|
1326
1375
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
}
|
|
1376
|
+
return (
|
|
1377
|
+
Object.keys(indentStringCounts).sort((a, b) => {
|
|
1378
|
+
return indentStringCounts[a] - indentStringCounts[b];
|
|
1379
|
+
})[0] || '\t'
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1333
1382
|
|
|
1334
|
-
|
|
1335
|
-
|
|
1383
|
+
indent(indentStr) {
|
|
1384
|
+
if (!arguments.length) {
|
|
1385
|
+
indentStr = this.getIndentString();
|
|
1386
|
+
}
|
|
1336
1387
|
|
|
1337
|
-
|
|
1338
|
-
indentStr = this.getIndentString();
|
|
1339
|
-
}
|
|
1388
|
+
if (indentStr === '') return this; // noop
|
|
1340
1389
|
|
|
1341
|
-
|
|
1390
|
+
let trailingNewline = !this.intro || this.intro.slice(-1) === '\n';
|
|
1342
1391
|
|
|
1343
|
-
|
|
1392
|
+
this.sources.forEach((source, i) => {
|
|
1393
|
+
const separator = source.separator !== undefined ? source.separator : this.separator;
|
|
1394
|
+
const indentStart = trailingNewline || (i > 0 && /\r?\n$/.test(separator));
|
|
1344
1395
|
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1396
|
+
source.content.indent(indentStr, {
|
|
1397
|
+
exclude: source.indentExclusionRanges,
|
|
1398
|
+
indentStart, //: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator )
|
|
1399
|
+
});
|
|
1348
1400
|
|
|
1349
|
-
|
|
1350
|
-
exclude: source.indentExclusionRanges,
|
|
1351
|
-
indentStart: indentStart //: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator )
|
|
1401
|
+
trailingNewline = source.content.lastChar() === '\n';
|
|
1352
1402
|
});
|
|
1353
1403
|
|
|
1354
|
-
|
|
1355
|
-
|
|
1404
|
+
if (this.intro) {
|
|
1405
|
+
this.intro =
|
|
1406
|
+
indentStr +
|
|
1407
|
+
this.intro.replace(/^[^\n]/gm, (match, index) => {
|
|
1408
|
+
return index > 0 ? indentStr + match : match;
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1356
1411
|
|
|
1357
|
-
|
|
1358
|
-
this.intro =
|
|
1359
|
-
indentStr +
|
|
1360
|
-
this.intro.replace(/^[^\n]/gm, function (match, index) {
|
|
1361
|
-
return index > 0 ? indentStr + match : match;
|
|
1362
|
-
});
|
|
1412
|
+
return this;
|
|
1363
1413
|
}
|
|
1364
1414
|
|
|
1365
|
-
|
|
1366
|
-
|
|
1415
|
+
prepend(str) {
|
|
1416
|
+
this.intro = str + this.intro;
|
|
1417
|
+
return this;
|
|
1418
|
+
}
|
|
1367
1419
|
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1420
|
+
toString() {
|
|
1421
|
+
const body = this.sources
|
|
1422
|
+
.map((source, i) => {
|
|
1423
|
+
const separator = source.separator !== undefined ? source.separator : this.separator;
|
|
1424
|
+
const str = (i > 0 ? separator : '') + source.content.toString();
|
|
1425
|
+
|
|
1426
|
+
return str;
|
|
1427
|
+
})
|
|
1428
|
+
.join('');
|
|
1429
|
+
|
|
1430
|
+
return this.intro + body;
|
|
1431
|
+
}
|
|
1372
1432
|
|
|
1373
|
-
|
|
1374
|
-
|
|
1433
|
+
isEmpty() {
|
|
1434
|
+
if (this.intro.length && this.intro.trim()) return false;
|
|
1435
|
+
if (this.sources.some((source) => !source.content.isEmpty())) return false;
|
|
1436
|
+
return true;
|
|
1437
|
+
}
|
|
1375
1438
|
|
|
1376
|
-
|
|
1377
|
-
.
|
|
1378
|
-
|
|
1379
|
-
|
|
1439
|
+
length() {
|
|
1440
|
+
return this.sources.reduce(
|
|
1441
|
+
(length, source) => length + source.content.length(),
|
|
1442
|
+
this.intro.length
|
|
1443
|
+
);
|
|
1444
|
+
}
|
|
1380
1445
|
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1446
|
+
trimLines() {
|
|
1447
|
+
return this.trim('[\\r\\n]');
|
|
1448
|
+
}
|
|
1384
1449
|
|
|
1385
|
-
|
|
1386
|
-
|
|
1450
|
+
trim(charType) {
|
|
1451
|
+
return this.trimStart(charType).trimEnd(charType);
|
|
1452
|
+
}
|
|
1387
1453
|
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
if (this.sources.some(function (source) { return !source.content.isEmpty(); }))
|
|
1392
|
-
{ return false; }
|
|
1393
|
-
return true;
|
|
1394
|
-
};
|
|
1454
|
+
trimStart(charType) {
|
|
1455
|
+
const rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
1456
|
+
this.intro = this.intro.replace(rx, '');
|
|
1395
1457
|
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1458
|
+
if (!this.intro) {
|
|
1459
|
+
let source;
|
|
1460
|
+
let i = 0;
|
|
1399
1461
|
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1462
|
+
do {
|
|
1463
|
+
source = this.sources[i++];
|
|
1464
|
+
if (!source) {
|
|
1465
|
+
break;
|
|
1466
|
+
}
|
|
1467
|
+
} while (!source.content.trimStartAborted(charType));
|
|
1468
|
+
}
|
|
1403
1469
|
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
};
|
|
1470
|
+
return this;
|
|
1471
|
+
}
|
|
1407
1472
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
this.intro = this.intro.replace(rx, '');
|
|
1473
|
+
trimEnd(charType) {
|
|
1474
|
+
const rx = new RegExp((charType || '\\s') + '+$');
|
|
1411
1475
|
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
var i = 0;
|
|
1476
|
+
let source;
|
|
1477
|
+
let i = this.sources.length - 1;
|
|
1415
1478
|
|
|
1416
1479
|
do {
|
|
1417
|
-
source = this.sources[i
|
|
1480
|
+
source = this.sources[i--];
|
|
1418
1481
|
if (!source) {
|
|
1482
|
+
this.intro = this.intro.replace(rx, '');
|
|
1419
1483
|
break;
|
|
1420
1484
|
}
|
|
1421
|
-
} while (!source.content.
|
|
1422
|
-
}
|
|
1485
|
+
} while (!source.content.trimEndAborted(charType));
|
|
1423
1486
|
|
|
1424
|
-
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
Bundle$1.prototype.trimEnd = function trimEnd (charType) {
|
|
1428
|
-
var rx = new RegExp((charType || '\\s') + '+$');
|
|
1429
|
-
|
|
1430
|
-
var source;
|
|
1431
|
-
var i = this.sources.length - 1;
|
|
1432
|
-
|
|
1433
|
-
do {
|
|
1434
|
-
source = this.sources[i--];
|
|
1435
|
-
if (!source) {
|
|
1436
|
-
this.intro = this.intro.replace(rx, '');
|
|
1437
|
-
break;
|
|
1438
|
-
}
|
|
1439
|
-
} while (!source.content.trimEndAborted(charType));
|
|
1440
|
-
|
|
1441
|
-
return this;
|
|
1442
|
-
};
|
|
1443
|
-
|
|
1444
|
-
const MagicString$1 = MagicString;
|
|
1487
|
+
return this;
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1445
1490
|
|
|
1446
1491
|
const ANY_SLASH_REGEX = /[/\\]/;
|
|
1447
1492
|
function relative(from, to) {
|
|
@@ -2296,9 +2341,19 @@ class ExternalModule {
|
|
|
2296
2341
|
}
|
|
2297
2342
|
}
|
|
2298
2343
|
|
|
2344
|
+
function getDefaultExportFromCjs (x) {
|
|
2345
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2299
2348
|
function getAugmentedNamespace(n) {
|
|
2300
|
-
|
|
2301
|
-
|
|
2349
|
+
var f = n.default;
|
|
2350
|
+
if (typeof f == "function") {
|
|
2351
|
+
var a = function () {
|
|
2352
|
+
return f.apply(this, arguments);
|
|
2353
|
+
};
|
|
2354
|
+
a.prototype = f.prototype;
|
|
2355
|
+
} else a = {};
|
|
2356
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
2302
2357
|
Object.keys(n).forEach(function (k) {
|
|
2303
2358
|
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
2304
2359
|
Object.defineProperty(a, k, d.get ? d : {
|
|
@@ -2311,6 +2366,8 @@ function getAugmentedNamespace(n) {
|
|
|
2311
2366
|
return a;
|
|
2312
2367
|
}
|
|
2313
2368
|
|
|
2369
|
+
var picomatch$1 = {exports: {}};
|
|
2370
|
+
|
|
2314
2371
|
var utils$3 = {};
|
|
2315
2372
|
|
|
2316
2373
|
const path$1 = require$$0;
|
|
@@ -2493,69 +2550,69 @@ var constants$2 = {
|
|
|
2493
2550
|
|
|
2494
2551
|
(function (exports) {
|
|
2495
2552
|
|
|
2496
|
-
const path = require$$0;
|
|
2497
|
-
const win32 = process.platform === 'win32';
|
|
2498
|
-
const {
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
} = constants$2;
|
|
2504
|
-
|
|
2505
|
-
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
2506
|
-
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
2507
|
-
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
2508
|
-
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
2509
|
-
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
2510
|
-
|
|
2511
|
-
exports.removeBackslashes = str => {
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
};
|
|
2553
|
+
const path = require$$0;
|
|
2554
|
+
const win32 = process.platform === 'win32';
|
|
2555
|
+
const {
|
|
2556
|
+
REGEX_BACKSLASH,
|
|
2557
|
+
REGEX_REMOVE_BACKSLASH,
|
|
2558
|
+
REGEX_SPECIAL_CHARS,
|
|
2559
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
2560
|
+
} = constants$2;
|
|
2561
|
+
|
|
2562
|
+
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
2563
|
+
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
2564
|
+
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
2565
|
+
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
2566
|
+
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
2567
|
+
|
|
2568
|
+
exports.removeBackslashes = str => {
|
|
2569
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
|
2570
|
+
return match === '\\' ? '' : match;
|
|
2571
|
+
});
|
|
2572
|
+
};
|
|
2516
2573
|
|
|
2517
|
-
exports.supportsLookbehinds = () => {
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
};
|
|
2574
|
+
exports.supportsLookbehinds = () => {
|
|
2575
|
+
const segs = process.version.slice(1).split('.').map(Number);
|
|
2576
|
+
if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
|
|
2577
|
+
return true;
|
|
2578
|
+
}
|
|
2579
|
+
return false;
|
|
2580
|
+
};
|
|
2524
2581
|
|
|
2525
|
-
exports.isWindows = options => {
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
};
|
|
2582
|
+
exports.isWindows = options => {
|
|
2583
|
+
if (options && typeof options.windows === 'boolean') {
|
|
2584
|
+
return options.windows;
|
|
2585
|
+
}
|
|
2586
|
+
return win32 === true || path.sep === '\\';
|
|
2587
|
+
};
|
|
2531
2588
|
|
|
2532
|
-
exports.escapeLast = (input, char, lastIdx) => {
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
};
|
|
2589
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
2590
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
2591
|
+
if (idx === -1) return input;
|
|
2592
|
+
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
|
2593
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
2594
|
+
};
|
|
2538
2595
|
|
|
2539
|
-
exports.removePrefix = (input, state = {}) => {
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
};
|
|
2596
|
+
exports.removePrefix = (input, state = {}) => {
|
|
2597
|
+
let output = input;
|
|
2598
|
+
if (output.startsWith('./')) {
|
|
2599
|
+
output = output.slice(2);
|
|
2600
|
+
state.prefix = './';
|
|
2601
|
+
}
|
|
2602
|
+
return output;
|
|
2603
|
+
};
|
|
2547
2604
|
|
|
2548
|
-
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
2549
|
-
|
|
2550
|
-
|
|
2605
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
2606
|
+
const prepend = options.contains ? '' : '^';
|
|
2607
|
+
const append = options.contains ? '' : '$';
|
|
2551
2608
|
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
};
|
|
2558
|
-
}(utils$3));
|
|
2609
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
2610
|
+
if (state.negated === true) {
|
|
2611
|
+
output = `(?:^(?!${output}).*$)`;
|
|
2612
|
+
}
|
|
2613
|
+
return output;
|
|
2614
|
+
};
|
|
2615
|
+
} (utils$3));
|
|
2559
2616
|
|
|
2560
2617
|
const utils$2 = utils$3;
|
|
2561
2618
|
const {
|
|
@@ -4059,9 +4116,9 @@ const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
|
4059
4116
|
* @api public
|
|
4060
4117
|
*/
|
|
4061
4118
|
|
|
4062
|
-
const picomatch
|
|
4119
|
+
const picomatch = (glob, options, returnState = false) => {
|
|
4063
4120
|
if (Array.isArray(glob)) {
|
|
4064
|
-
const fns = glob.map(input => picomatch
|
|
4121
|
+
const fns = glob.map(input => picomatch(input, options, returnState));
|
|
4065
4122
|
const arrayMatcher = str => {
|
|
4066
4123
|
for (const isMatch of fns) {
|
|
4067
4124
|
const state = isMatch(str);
|
|
@@ -4081,8 +4138,8 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
|
4081
4138
|
const opts = options || {};
|
|
4082
4139
|
const posix = utils.isWindows(options);
|
|
4083
4140
|
const regex = isState
|
|
4084
|
-
? picomatch
|
|
4085
|
-
: picomatch
|
|
4141
|
+
? picomatch.compileRe(glob, options)
|
|
4142
|
+
: picomatch.makeRe(glob, options, false, true);
|
|
4086
4143
|
|
|
4087
4144
|
const state = regex.state;
|
|
4088
4145
|
delete regex.state;
|
|
@@ -4090,11 +4147,11 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
|
4090
4147
|
let isIgnored = () => false;
|
|
4091
4148
|
if (opts.ignore) {
|
|
4092
4149
|
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
4093
|
-
isIgnored = picomatch
|
|
4150
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
4094
4151
|
}
|
|
4095
4152
|
|
|
4096
4153
|
const matcher = (input, returnObject = false) => {
|
|
4097
|
-
const { isMatch, match, output } = picomatch
|
|
4154
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
|
4098
4155
|
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
4099
4156
|
|
|
4100
4157
|
if (typeof opts.onResult === 'function') {
|
|
@@ -4144,7 +4201,7 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
|
4144
4201
|
* @api public
|
|
4145
4202
|
*/
|
|
4146
4203
|
|
|
4147
|
-
picomatch
|
|
4204
|
+
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
4148
4205
|
if (typeof input !== 'string') {
|
|
4149
4206
|
throw new TypeError('Expected input to be a string');
|
|
4150
4207
|
}
|
|
@@ -4165,7 +4222,7 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
|
4165
4222
|
|
|
4166
4223
|
if (match === false || opts.capture === true) {
|
|
4167
4224
|
if (opts.matchBase === true || opts.basename === true) {
|
|
4168
|
-
match = picomatch
|
|
4225
|
+
match = picomatch.matchBase(input, regex, options, posix);
|
|
4169
4226
|
} else {
|
|
4170
4227
|
match = regex.exec(output);
|
|
4171
4228
|
}
|
|
@@ -4188,8 +4245,8 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
|
4188
4245
|
* @api public
|
|
4189
4246
|
*/
|
|
4190
4247
|
|
|
4191
|
-
picomatch
|
|
4192
|
-
const regex = glob instanceof RegExp ? glob : picomatch
|
|
4248
|
+
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
4249
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
4193
4250
|
return regex.test(path.basename(input));
|
|
4194
4251
|
};
|
|
4195
4252
|
|
|
@@ -4210,7 +4267,7 @@ picomatch$1.matchBase = (input, glob, options, posix = utils.isWindows(options))
|
|
|
4210
4267
|
* @api public
|
|
4211
4268
|
*/
|
|
4212
4269
|
|
|
4213
|
-
picomatch
|
|
4270
|
+
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4214
4271
|
|
|
4215
4272
|
/**
|
|
4216
4273
|
* Parse a glob pattern to create the source string for a regular
|
|
@@ -4226,8 +4283,8 @@ picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)
|
|
|
4226
4283
|
* @api public
|
|
4227
4284
|
*/
|
|
4228
4285
|
|
|
4229
|
-
picomatch
|
|
4230
|
-
if (Array.isArray(pattern)) return pattern.map(p => picomatch
|
|
4286
|
+
picomatch.parse = (pattern, options) => {
|
|
4287
|
+
if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
|
|
4231
4288
|
return parse(pattern, { ...options, fastpaths: false });
|
|
4232
4289
|
};
|
|
4233
4290
|
|
|
@@ -4258,7 +4315,7 @@ picomatch$1.parse = (pattern, options) => {
|
|
|
4258
4315
|
* @api public
|
|
4259
4316
|
*/
|
|
4260
4317
|
|
|
4261
|
-
picomatch
|
|
4318
|
+
picomatch.scan = (input, options) => scan(input, options);
|
|
4262
4319
|
|
|
4263
4320
|
/**
|
|
4264
4321
|
* Compile a regular expression from the `state` object returned by the
|
|
@@ -4272,7 +4329,7 @@ picomatch$1.scan = (input, options) => scan(input, options);
|
|
|
4272
4329
|
* @api public
|
|
4273
4330
|
*/
|
|
4274
4331
|
|
|
4275
|
-
picomatch
|
|
4332
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
4276
4333
|
if (returnOutput === true) {
|
|
4277
4334
|
return state.output;
|
|
4278
4335
|
}
|
|
@@ -4286,7 +4343,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
|
|
|
4286
4343
|
source = `^(?!${source}).*$`;
|
|
4287
4344
|
}
|
|
4288
4345
|
|
|
4289
|
-
const regex = picomatch
|
|
4346
|
+
const regex = picomatch.toRegex(source, options);
|
|
4290
4347
|
if (returnState === true) {
|
|
4291
4348
|
regex.state = state;
|
|
4292
4349
|
}
|
|
@@ -4313,7 +4370,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
|
|
|
4313
4370
|
* @api public
|
|
4314
4371
|
*/
|
|
4315
4372
|
|
|
4316
|
-
picomatch
|
|
4373
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
4317
4374
|
if (!input || typeof input !== 'string') {
|
|
4318
4375
|
throw new TypeError('Expected a non-empty string');
|
|
4319
4376
|
}
|
|
@@ -4328,7 +4385,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
|
4328
4385
|
parsed = parse(input, options);
|
|
4329
4386
|
}
|
|
4330
4387
|
|
|
4331
|
-
return picomatch
|
|
4388
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
4332
4389
|
};
|
|
4333
4390
|
|
|
4334
4391
|
/**
|
|
@@ -4348,7 +4405,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
|
4348
4405
|
* @api public
|
|
4349
4406
|
*/
|
|
4350
4407
|
|
|
4351
|
-
picomatch
|
|
4408
|
+
picomatch.toRegex = (source, options) => {
|
|
4352
4409
|
try {
|
|
4353
4410
|
const opts = options || {};
|
|
4354
4411
|
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
@@ -4363,17 +4420,20 @@ picomatch$1.toRegex = (source, options) => {
|
|
|
4363
4420
|
* @return {Object}
|
|
4364
4421
|
*/
|
|
4365
4422
|
|
|
4366
|
-
picomatch
|
|
4423
|
+
picomatch.constants = constants;
|
|
4367
4424
|
|
|
4368
4425
|
/**
|
|
4369
4426
|
* Expose "picomatch"
|
|
4370
4427
|
*/
|
|
4371
4428
|
|
|
4372
|
-
var picomatch_1 = picomatch
|
|
4429
|
+
var picomatch_1 = picomatch;
|
|
4430
|
+
|
|
4431
|
+
(function (module) {
|
|
4373
4432
|
|
|
4374
|
-
|
|
4433
|
+
module.exports = picomatch_1;
|
|
4434
|
+
} (picomatch$1));
|
|
4375
4435
|
|
|
4376
|
-
const pm = picomatch;
|
|
4436
|
+
const pm = /*@__PURE__*/getDefaultExportFromCjs(picomatch$1.exports);
|
|
4377
4437
|
|
|
4378
4438
|
const extractors = {
|
|
4379
4439
|
ArrayPattern(names, param) {
|
|
@@ -4428,7 +4488,7 @@ const normalizePath = function normalizePath(filename) {
|
|
|
4428
4488
|
|
|
4429
4489
|
function getMatcherString(id, resolutionBase) {
|
|
4430
4490
|
if (resolutionBase === false || isAbsolute$1(id) || id.startsWith('*')) {
|
|
4431
|
-
return id;
|
|
4491
|
+
return normalizePath(id);
|
|
4432
4492
|
}
|
|
4433
4493
|
// resolve('') is valid and will default to process.cwd()
|
|
4434
4494
|
const basePath = normalizePath(resolve(resolutionBase || ''))
|
|
@@ -4438,7 +4498,7 @@ function getMatcherString(id, resolutionBase) {
|
|
|
4438
4498
|
// 1. the basePath has been normalized to use /
|
|
4439
4499
|
// 2. the incoming glob (id) matcher, also uses /
|
|
4440
4500
|
// otherwise Node will force backslash (\) on windows
|
|
4441
|
-
return posix.join(basePath, id);
|
|
4501
|
+
return posix.join(basePath, normalizePath(id));
|
|
4442
4502
|
}
|
|
4443
4503
|
const createFilter = function createFilter(include, exclude, options) {
|
|
4444
4504
|
const resolutionBase = options && options.resolve;
|
|
@@ -6866,6 +6926,7 @@ const knownGlobals = {
|
|
|
6866
6926
|
getOwnPropertyNames: PF,
|
|
6867
6927
|
getOwnPropertySymbols: PF,
|
|
6868
6928
|
getPrototypeOf: PF,
|
|
6929
|
+
hasOwn: PF,
|
|
6869
6930
|
is: PF,
|
|
6870
6931
|
isExtensible: PF,
|
|
6871
6932
|
isFrozen: PF,
|
|
@@ -12510,7 +12571,10 @@ class Module {
|
|
|
12510
12571
|
return [this.exportShimVariable];
|
|
12511
12572
|
}
|
|
12512
12573
|
const name = exportDeclaration.localName;
|
|
12513
|
-
const variable = this.traceVariable(name,
|
|
12574
|
+
const variable = this.traceVariable(name, {
|
|
12575
|
+
importerForSideEffects,
|
|
12576
|
+
searchedNamesAndModules
|
|
12577
|
+
});
|
|
12514
12578
|
if (importerForSideEffects) {
|
|
12515
12579
|
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, () => new Set()).add(this);
|
|
12516
12580
|
setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
|
|
@@ -12628,7 +12692,7 @@ class Module {
|
|
|
12628
12692
|
// By default, `id` is the file name. Custom resolvers and loaders
|
|
12629
12693
|
// can change that, but it makes sense to use it for the source file name
|
|
12630
12694
|
const fileName = this.id;
|
|
12631
|
-
this.magicString = new MagicString
|
|
12695
|
+
this.magicString = new MagicString(code, {
|
|
12632
12696
|
filename: (this.excludeFromSourcemap ? null : fileName),
|
|
12633
12697
|
indentExclusionRanges: []
|
|
12634
12698
|
});
|
|
@@ -12685,7 +12749,7 @@ class Module {
|
|
|
12685
12749
|
transformFiles: this.transformFiles
|
|
12686
12750
|
};
|
|
12687
12751
|
}
|
|
12688
|
-
traceVariable(name, importerForSideEffects) {
|
|
12752
|
+
traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
12689
12753
|
const localVariable = this.scope.variables.get(name);
|
|
12690
12754
|
if (localVariable) {
|
|
12691
12755
|
return localVariable;
|
|
@@ -12696,9 +12760,7 @@ class Module {
|
|
|
12696
12760
|
if (otherModule instanceof Module && importDeclaration.name === '*') {
|
|
12697
12761
|
return otherModule.namespace;
|
|
12698
12762
|
}
|
|
12699
|
-
const [declaration] = otherModule
|
|
12700
|
-
importerForSideEffects: importerForSideEffects || this
|
|
12701
|
-
});
|
|
12763
|
+
const [declaration] = getVariableForExportNameRecursive(otherModule, importDeclaration.name, importerForSideEffects || this, isExportAllSearch, searchedNamesAndModules);
|
|
12702
12764
|
if (!declaration) {
|
|
12703
12765
|
return this.error(errMissingExport(importDeclaration.name, this.id, otherModule.id), importDeclaration.start);
|
|
12704
12766
|
}
|
|
@@ -12903,7 +12965,10 @@ class Module {
|
|
|
12903
12965
|
if (module.info.syntheticNamedExports === name) {
|
|
12904
12966
|
continue;
|
|
12905
12967
|
}
|
|
12906
|
-
const [variable, indirectExternal] = getVariableForExportNameRecursive(module, name, importerForSideEffects, true,
|
|
12968
|
+
const [variable, indirectExternal] = getVariableForExportNameRecursive(module, name, importerForSideEffects, true,
|
|
12969
|
+
// We are creating a copy to handle the case where the same binding is
|
|
12970
|
+
// imported through different namespace reexports gracefully
|
|
12971
|
+
copyNameToModulesMap(searchedNamesAndModules));
|
|
12907
12972
|
if (module instanceof ExternalModule || indirectExternal) {
|
|
12908
12973
|
foundExternalDeclarations.add(variable);
|
|
12909
12974
|
}
|
|
@@ -13019,6 +13084,8 @@ function setAlternativeExporterIfCyclic(variable, importer, reexporter) {
|
|
|
13019
13084
|
}
|
|
13020
13085
|
}
|
|
13021
13086
|
}
|
|
13087
|
+
const copyNameToModulesMap = (searchedNamesAndModules) => searchedNamesAndModules &&
|
|
13088
|
+
new Map(Array.from(searchedNamesAndModules, ([name, modules]) => [name, new Set(modules)]));
|
|
13022
13089
|
|
|
13023
13090
|
function removeJsExtension(name) {
|
|
13024
13091
|
return name.endsWith('.js') ? name.slice(0, -3) : name;
|
|
@@ -14664,7 +14731,7 @@ class Chunk {
|
|
|
14664
14731
|
if (namespace.renderFirst())
|
|
14665
14732
|
hoistedSource += n + rendered;
|
|
14666
14733
|
else
|
|
14667
|
-
magicString.addSource(new MagicString
|
|
14734
|
+
magicString.addSource(new MagicString(rendered));
|
|
14668
14735
|
}
|
|
14669
14736
|
}
|
|
14670
14737
|
const { renderedExports, removedExports } = module.getRenderedExports();
|
|
@@ -16048,6 +16115,20 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
|
|
|
16048
16115
|
manualChunkAliasByEntry.set(module, alias);
|
|
16049
16116
|
}
|
|
16050
16117
|
|
|
16118
|
+
// This file was generated. Do not modify manually!
|
|
16119
|
+
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
16120
|
+
|
|
16121
|
+
// This file was generated. Do not modify manually!
|
|
16122
|
+
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
|
|
16123
|
+
|
|
16124
|
+
// This file was generated. Do not modify manually!
|
|
16125
|
+
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
|
16126
|
+
|
|
16127
|
+
// This file was generated. Do not modify manually!
|
|
16128
|
+
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
|
16129
|
+
|
|
16130
|
+
// These are a run-length and offset encoded representation of the
|
|
16131
|
+
|
|
16051
16132
|
// Reserved word lists for various dialects of the language
|
|
16052
16133
|
|
|
16053
16134
|
var reservedWords = {
|
|
@@ -16072,31 +16153,9 @@ var keywordRelationalOperator = /^in(stanceof)?$/;
|
|
|
16072
16153
|
|
|
16073
16154
|
// ## Character categories
|
|
16074
16155
|
|
|
16075
|
-
// Big ugly regular expressions that match characters in the
|
|
16076
|
-
// whitespace, identifier, and identifier-start categories. These
|
|
16077
|
-
// are only applied when a character is found to actually have a
|
|
16078
|
-
// code point above 128.
|
|
16079
|
-
// Generated by `bin/generate-identifier-regex.js`.
|
|
16080
|
-
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
|
16081
|
-
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
|
16082
|
-
|
|
16083
16156
|
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
16084
16157
|
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
16085
16158
|
|
|
16086
|
-
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
16087
|
-
|
|
16088
|
-
// These are a run-length and offset encoded representation of the
|
|
16089
|
-
// >0xffff code points that are a valid part of identifiers. The
|
|
16090
|
-
// offset starts at 0x10000, and each pair of numbers represents an
|
|
16091
|
-
// offset to the next range, and then a size of the range. They were
|
|
16092
|
-
// generated by bin/generate-identifier-regex.js
|
|
16093
|
-
|
|
16094
|
-
// eslint-disable-next-line comma-spacing
|
|
16095
|
-
var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2637,96,16,1070,4050,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,46,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,482,44,11,6,17,0,322,29,19,43,1269,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4152,8,221,3,5761,15,7472,3104,541,1507,4938];
|
|
16096
|
-
|
|
16097
|
-
// eslint-disable-next-line comma-spacing
|
|
16098
|
-
var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,357,0,62,13,1495,6,110,6,6,9,4759,9,787719,239];
|
|
16099
|
-
|
|
16100
16159
|
// This has a complexity linear to the value of the code. The
|
|
16101
16160
|
// assumption is that looking up astral identifier characters is
|
|
16102
16161
|
// rare.
|
|
@@ -16331,6 +16390,13 @@ function wordsRegexp(words) {
|
|
|
16331
16390
|
return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
|
|
16332
16391
|
}
|
|
16333
16392
|
|
|
16393
|
+
function codePointToString(code) {
|
|
16394
|
+
// UTF-16 Decoding
|
|
16395
|
+
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
16396
|
+
code -= 0x10000;
|
|
16397
|
+
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
16398
|
+
}
|
|
16399
|
+
|
|
16334
16400
|
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
|
|
16335
16401
|
|
|
16336
16402
|
// These are used when `options.locations` is on, for the
|
|
@@ -16698,6 +16764,7 @@ var pp$9 = Parser.prototype;
|
|
|
16698
16764
|
|
|
16699
16765
|
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
|
|
16700
16766
|
pp$9.strictDirective = function(start) {
|
|
16767
|
+
if (this.options.ecmaVersion < 5) { return false }
|
|
16701
16768
|
for (;;) {
|
|
16702
16769
|
// Try to find string literal.
|
|
16703
16770
|
skipWhiteSpace.lastIndex = start;
|
|
@@ -16800,14 +16867,14 @@ pp$9.unexpected = function(pos) {
|
|
|
16800
16867
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
16801
16868
|
};
|
|
16802
16869
|
|
|
16803
|
-
function DestructuringErrors() {
|
|
16870
|
+
var DestructuringErrors = function DestructuringErrors() {
|
|
16804
16871
|
this.shorthandAssign =
|
|
16805
16872
|
this.trailingComma =
|
|
16806
16873
|
this.parenthesizedAssign =
|
|
16807
16874
|
this.parenthesizedBind =
|
|
16808
16875
|
this.doubleProto =
|
|
16809
16876
|
-1;
|
|
16810
|
-
}
|
|
16877
|
+
};
|
|
16811
16878
|
|
|
16812
16879
|
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16813
16880
|
if (!refDestructuringErrors) { return }
|
|
@@ -17688,7 +17755,7 @@ pp$8.parseExport = function(node, exports) {
|
|
|
17688
17755
|
if (this.options.ecmaVersion >= 11) {
|
|
17689
17756
|
if (this.eatContextual("as")) {
|
|
17690
17757
|
node.exported = this.parseModuleExportName();
|
|
17691
|
-
this.checkExport(exports, node.exported
|
|
17758
|
+
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
17692
17759
|
} else {
|
|
17693
17760
|
node.exported = null;
|
|
17694
17761
|
}
|
|
@@ -17722,7 +17789,7 @@ pp$8.parseExport = function(node, exports) {
|
|
|
17722
17789
|
if (node.declaration.type === "VariableDeclaration")
|
|
17723
17790
|
{ this.checkVariableExport(exports, node.declaration.declarations); }
|
|
17724
17791
|
else
|
|
17725
|
-
{ this.checkExport(exports, node.declaration.id
|
|
17792
|
+
{ this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
|
|
17726
17793
|
node.specifiers = [];
|
|
17727
17794
|
node.source = null;
|
|
17728
17795
|
} else { // export { x, y as z } [from '...']
|
|
@@ -17754,6 +17821,8 @@ pp$8.parseExport = function(node, exports) {
|
|
|
17754
17821
|
|
|
17755
17822
|
pp$8.checkExport = function(exports, name, pos) {
|
|
17756
17823
|
if (!exports) { return }
|
|
17824
|
+
if (typeof name !== "string")
|
|
17825
|
+
{ name = name.type === "Identifier" ? name.name : name.value; }
|
|
17757
17826
|
if (hasOwn(exports, name))
|
|
17758
17827
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
17759
17828
|
exports[name] = true;
|
|
@@ -17762,7 +17831,7 @@ pp$8.checkExport = function(exports, name, pos) {
|
|
|
17762
17831
|
pp$8.checkPatternExport = function(exports, pat) {
|
|
17763
17832
|
var type = pat.type;
|
|
17764
17833
|
if (type === "Identifier")
|
|
17765
|
-
{ this.checkExport(exports, pat
|
|
17834
|
+
{ this.checkExport(exports, pat, pat.start); }
|
|
17766
17835
|
else if (type === "ObjectPattern")
|
|
17767
17836
|
{ for (var i = 0, list = pat.properties; i < list.length; i += 1)
|
|
17768
17837
|
{
|
|
@@ -17822,7 +17891,7 @@ pp$8.parseExportSpecifiers = function(exports) {
|
|
|
17822
17891
|
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
17823
17892
|
this.checkExport(
|
|
17824
17893
|
exports,
|
|
17825
|
-
node.exported
|
|
17894
|
+
node.exported,
|
|
17826
17895
|
node.exported.start
|
|
17827
17896
|
);
|
|
17828
17897
|
nodes.push(this.finishNode(node, "ExportSpecifier"));
|
|
@@ -19812,12 +19881,6 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
19812
19881
|
return false
|
|
19813
19882
|
};
|
|
19814
19883
|
|
|
19815
|
-
function codePointToString$1(ch) {
|
|
19816
|
-
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
|
|
19817
|
-
ch -= 0x10000;
|
|
19818
|
-
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
|
|
19819
|
-
}
|
|
19820
|
-
|
|
19821
19884
|
/**
|
|
19822
19885
|
* Validate the flags part of a given RegExpLiteral.
|
|
19823
19886
|
*
|
|
@@ -20182,9 +20245,9 @@ pp$1.regexp_eatGroupName = function(state) {
|
|
|
20182
20245
|
pp$1.regexp_eatRegExpIdentifierName = function(state) {
|
|
20183
20246
|
state.lastStringValue = "";
|
|
20184
20247
|
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
|
20185
|
-
state.lastStringValue += codePointToString
|
|
20248
|
+
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20186
20249
|
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
|
20187
|
-
state.lastStringValue += codePointToString
|
|
20250
|
+
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20188
20251
|
}
|
|
20189
20252
|
return true
|
|
20190
20253
|
}
|
|
@@ -20536,7 +20599,7 @@ pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
|
20536
20599
|
var ch = 0;
|
|
20537
20600
|
state.lastStringValue = "";
|
|
20538
20601
|
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
|
20539
|
-
state.lastStringValue += codePointToString
|
|
20602
|
+
state.lastStringValue += codePointToString(ch);
|
|
20540
20603
|
state.advance();
|
|
20541
20604
|
}
|
|
20542
20605
|
return state.lastStringValue !== ""
|
|
@@ -20551,7 +20614,7 @@ pp$1.regexp_eatUnicodePropertyValue = function(state) {
|
|
|
20551
20614
|
var ch = 0;
|
|
20552
20615
|
state.lastStringValue = "";
|
|
20553
20616
|
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
|
20554
|
-
state.lastStringValue += codePointToString
|
|
20617
|
+
state.lastStringValue += codePointToString(ch);
|
|
20555
20618
|
state.advance();
|
|
20556
20619
|
}
|
|
20557
20620
|
return state.lastStringValue !== ""
|
|
@@ -21334,13 +21397,6 @@ pp.readCodePoint = function() {
|
|
|
21334
21397
|
return code
|
|
21335
21398
|
};
|
|
21336
21399
|
|
|
21337
|
-
function codePointToString(code) {
|
|
21338
|
-
// UTF-16 Decoding
|
|
21339
|
-
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
21340
|
-
code -= 0x10000;
|
|
21341
|
-
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
21342
|
-
}
|
|
21343
|
-
|
|
21344
21400
|
pp.readString = function(quote) {
|
|
21345
21401
|
var out = "", chunkStart = ++this.pos;
|
|
21346
21402
|
for (;;) {
|
|
@@ -21585,7 +21641,7 @@ pp.readWord = function() {
|
|
|
21585
21641
|
|
|
21586
21642
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
21587
21643
|
|
|
21588
|
-
var version = "8.7.
|
|
21644
|
+
var version = "8.7.1";
|
|
21589
21645
|
|
|
21590
21646
|
Parser.acorn = {
|
|
21591
21647
|
Parser: Parser,
|
|
@@ -21894,7 +21950,7 @@ async function transform(source, module, pluginDriver, warn) {
|
|
|
21894
21950
|
getCombinedSourcemap() {
|
|
21895
21951
|
const combinedMap = collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, warn);
|
|
21896
21952
|
if (!combinedMap) {
|
|
21897
|
-
const magicString = new MagicString
|
|
21953
|
+
const magicString = new MagicString(originalCode);
|
|
21898
21954
|
return magicString.generateMap({ hires: true, includeContent: true, source: id });
|
|
21899
21955
|
}
|
|
21900
21956
|
if (originalSourcemap !== combinedMap) {
|
|
@@ -22484,41 +22540,6 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22484
22540
|
return context;
|
|
22485
22541
|
}
|
|
22486
22542
|
|
|
22487
|
-
const unfulfilledActions = new Set();
|
|
22488
|
-
function addUnresolvedAction(actionTuple) {
|
|
22489
|
-
unfulfilledActions.add(actionTuple);
|
|
22490
|
-
}
|
|
22491
|
-
function resolveAction(actionTuple) {
|
|
22492
|
-
unfulfilledActions.delete(actionTuple);
|
|
22493
|
-
}
|
|
22494
|
-
function formatAction([pluginName, hookName, args]) {
|
|
22495
|
-
const action = `(${pluginName}) ${hookName}`;
|
|
22496
|
-
const s = JSON.stringify;
|
|
22497
|
-
switch (hookName) {
|
|
22498
|
-
case 'resolveId':
|
|
22499
|
-
return `${action} ${s(args[0])} ${s(args[1])}`;
|
|
22500
|
-
case 'load':
|
|
22501
|
-
return `${action} ${s(args[0])}`;
|
|
22502
|
-
case 'transform':
|
|
22503
|
-
return `${action} ${s(args[1])}`;
|
|
22504
|
-
case 'shouldTransformCachedModule':
|
|
22505
|
-
return `${action} ${s(args[0].id)}`;
|
|
22506
|
-
case 'moduleParsed':
|
|
22507
|
-
return `${action} ${s(args[0].id)}`;
|
|
22508
|
-
}
|
|
22509
|
-
return action;
|
|
22510
|
-
}
|
|
22511
|
-
process$1.on('exit', () => {
|
|
22512
|
-
if (unfulfilledActions.size) {
|
|
22513
|
-
let err = '[!] Error: unfinished hook action(s) on exit:\n';
|
|
22514
|
-
for (const action of unfulfilledActions) {
|
|
22515
|
-
err += formatAction(action) + '\n';
|
|
22516
|
-
}
|
|
22517
|
-
console.error('%s', err);
|
|
22518
|
-
process$1.exitCode = 1;
|
|
22519
|
-
}
|
|
22520
|
-
});
|
|
22521
|
-
|
|
22522
22543
|
const inputHookNames = {
|
|
22523
22544
|
buildEnd: 1,
|
|
22524
22545
|
buildStart: 1,
|
|
@@ -22544,6 +22565,7 @@ class PluginDriver {
|
|
|
22544
22565
|
constructor(graph, options, userPlugins, pluginCache, basePluginDriver) {
|
|
22545
22566
|
this.graph = graph;
|
|
22546
22567
|
this.options = options;
|
|
22568
|
+
this.unfulfilledActions = new Set();
|
|
22547
22569
|
warnDeprecatedHooks(userPlugins, options);
|
|
22548
22570
|
this.pluginCache = pluginCache;
|
|
22549
22571
|
this.fileEmitter = new FileEmitter(graph, options, basePluginDriver && basePluginDriver.fileEmitter);
|
|
@@ -22570,6 +22592,9 @@ class PluginDriver {
|
|
|
22570
22592
|
createOutputPluginDriver(plugins) {
|
|
22571
22593
|
return new PluginDriver(this.graph, this.options, plugins, this.pluginCache, this);
|
|
22572
22594
|
}
|
|
22595
|
+
getUnfulfilledHookActions() {
|
|
22596
|
+
return this.unfulfilledActions;
|
|
22597
|
+
}
|
|
22573
22598
|
// chains, first non-null result stops and returns
|
|
22574
22599
|
hookFirst(hookName, args, replaceContext, skipped) {
|
|
22575
22600
|
let promise = Promise.resolve(undefined);
|
|
@@ -22685,22 +22710,21 @@ class PluginDriver {
|
|
|
22685
22710
|
// exit with a successful 0 return code but without producing any
|
|
22686
22711
|
// output, errors or warnings.
|
|
22687
22712
|
action = [plugin.name, hookName, args];
|
|
22688
|
-
|
|
22713
|
+
this.unfulfilledActions.add(action);
|
|
22689
22714
|
// Although it would be more elegant to just return hookResult here
|
|
22690
22715
|
// and put the .then() handler just above the .catch() handler below,
|
|
22691
22716
|
// doing so would subtly change the defacto async event dispatch order
|
|
22692
22717
|
// which at least one test and some plugins in the wild may depend on.
|
|
22693
|
-
|
|
22694
|
-
return promise.then(() => {
|
|
22718
|
+
return Promise.resolve(hookResult).then(result => {
|
|
22695
22719
|
// action was fulfilled
|
|
22696
|
-
|
|
22697
|
-
return
|
|
22720
|
+
this.unfulfilledActions.delete(action);
|
|
22721
|
+
return result;
|
|
22698
22722
|
});
|
|
22699
22723
|
})
|
|
22700
22724
|
.catch(err => {
|
|
22701
22725
|
if (action !== null) {
|
|
22702
22726
|
// action considered to be fulfilled since error being handled
|
|
22703
|
-
|
|
22727
|
+
this.unfulfilledActions.delete(action);
|
|
22704
22728
|
}
|
|
22705
22729
|
return throwPluginError(err, plugin.name, { hook: hookName });
|
|
22706
22730
|
});
|
|
@@ -22957,6 +22981,38 @@ function ensureArray(items) {
|
|
|
22957
22981
|
return [];
|
|
22958
22982
|
}
|
|
22959
22983
|
|
|
22984
|
+
function formatAction([pluginName, hookName, args]) {
|
|
22985
|
+
const action = `(${pluginName}) ${hookName}`;
|
|
22986
|
+
const s = JSON.stringify;
|
|
22987
|
+
switch (hookName) {
|
|
22988
|
+
case 'resolveId':
|
|
22989
|
+
return `${action} ${s(args[0])} ${s(args[1])}`;
|
|
22990
|
+
case 'load':
|
|
22991
|
+
return `${action} ${s(args[0])}`;
|
|
22992
|
+
case 'transform':
|
|
22993
|
+
return `${action} ${s(args[1])}`;
|
|
22994
|
+
case 'shouldTransformCachedModule':
|
|
22995
|
+
return `${action} ${s(args[0].id)}`;
|
|
22996
|
+
case 'moduleParsed':
|
|
22997
|
+
return `${action} ${s(args[0].id)}`;
|
|
22998
|
+
}
|
|
22999
|
+
return action;
|
|
23000
|
+
}
|
|
23001
|
+
async function catchUnfinishedHookActions(pluginDriver, callback) {
|
|
23002
|
+
let handleEmptyEventLoop;
|
|
23003
|
+
const emptyEventLoopPromise = new Promise((_, reject) => {
|
|
23004
|
+
handleEmptyEventLoop = () => {
|
|
23005
|
+
const unfulfilledActions = pluginDriver.getUnfulfilledHookActions();
|
|
23006
|
+
reject(new Error(`Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:\n` +
|
|
23007
|
+
[...unfulfilledActions].map(formatAction).join('\n')));
|
|
23008
|
+
};
|
|
23009
|
+
process$1.once('beforeExit', handleEmptyEventLoop);
|
|
23010
|
+
});
|
|
23011
|
+
const result = await Promise.race([callback(), emptyEventLoopPromise]);
|
|
23012
|
+
process$1.off('beforeExit', handleEmptyEventLoop);
|
|
23013
|
+
return result;
|
|
23014
|
+
}
|
|
23015
|
+
|
|
22960
23016
|
const defaultOnWarn = warning => console.warn(warning.message || warning);
|
|
22961
23017
|
function warnUnknownOptions(passedOptions, validOptions, optionType, warn, ignoredKeys = /$./) {
|
|
22962
23018
|
const validOptionSet = new Set(validOptions);
|
|
@@ -23026,8 +23082,7 @@ const objectifyOptionWithPresets = (presets, optionName, additionalValues) => (v
|
|
|
23026
23082
|
return objectifyOption(value);
|
|
23027
23083
|
};
|
|
23028
23084
|
const getOptionWithPreset = (value, presets, optionName, additionalValues) => {
|
|
23029
|
-
|
|
23030
|
-
const presetName = (_a = value) === null || _a === void 0 ? void 0 : _a.preset;
|
|
23085
|
+
const presetName = value === null || value === void 0 ? void 0 : value.preset;
|
|
23031
23086
|
if (presetName) {
|
|
23032
23087
|
const preset = presets[presetName];
|
|
23033
23088
|
if (preset) {
|
|
@@ -23524,20 +23579,22 @@ async function rollupInternal(rawInputOptions, watcher) {
|
|
|
23524
23579
|
delete inputOptions.cache;
|
|
23525
23580
|
delete rawInputOptions.cache;
|
|
23526
23581
|
timeStart('BUILD', 1);
|
|
23527
|
-
|
|
23528
|
-
|
|
23529
|
-
|
|
23530
|
-
|
|
23531
|
-
catch (err) {
|
|
23532
|
-
const watchFiles = Object.keys(graph.watchFiles);
|
|
23533
|
-
if (watchFiles.length > 0) {
|
|
23534
|
-
err.watchFiles = watchFiles;
|
|
23582
|
+
await catchUnfinishedHookActions(graph.pluginDriver, async () => {
|
|
23583
|
+
try {
|
|
23584
|
+
await graph.pluginDriver.hookParallel('buildStart', [inputOptions]);
|
|
23585
|
+
await graph.build();
|
|
23535
23586
|
}
|
|
23536
|
-
|
|
23537
|
-
|
|
23538
|
-
|
|
23539
|
-
|
|
23540
|
-
|
|
23587
|
+
catch (err) {
|
|
23588
|
+
const watchFiles = Object.keys(graph.watchFiles);
|
|
23589
|
+
if (watchFiles.length > 0) {
|
|
23590
|
+
err.watchFiles = watchFiles;
|
|
23591
|
+
}
|
|
23592
|
+
await graph.pluginDriver.hookParallel('buildEnd', [err]);
|
|
23593
|
+
await graph.pluginDriver.hookParallel('closeBundle', []);
|
|
23594
|
+
throw err;
|
|
23595
|
+
}
|
|
23596
|
+
await graph.pluginDriver.hookParallel('buildEnd', []);
|
|
23597
|
+
});
|
|
23541
23598
|
timeEnd('BUILD', 1);
|
|
23542
23599
|
const result = {
|
|
23543
23600
|
cache: useCache ? graph.getCache() : undefined,
|
|
@@ -23588,21 +23645,23 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
23588
23645
|
}
|
|
23589
23646
|
});
|
|
23590
23647
|
}
|
|
23591
|
-
|
|
23648
|
+
function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutputOptions, graph) {
|
|
23592
23649
|
const { options: outputOptions, outputPluginDriver, unsetOptions } = getOutputOptionsAndPluginDriver(rawOutputOptions, graph.pluginDriver, inputOptions, unsetInputOptions);
|
|
23593
|
-
|
|
23594
|
-
|
|
23595
|
-
|
|
23596
|
-
if (
|
|
23597
|
-
|
|
23598
|
-
|
|
23599
|
-
|
|
23600
|
-
|
|
23650
|
+
return catchUnfinishedHookActions(outputPluginDriver, async () => {
|
|
23651
|
+
const bundle = new Bundle(outputOptions, unsetOptions, inputOptions, outputPluginDriver, graph);
|
|
23652
|
+
const generated = await bundle.generate(isWrite);
|
|
23653
|
+
if (isWrite) {
|
|
23654
|
+
if (!outputOptions.dir && !outputOptions.file) {
|
|
23655
|
+
return error({
|
|
23656
|
+
code: 'MISSING_OPTION',
|
|
23657
|
+
message: 'You must specify "output.file" or "output.dir" for the build.'
|
|
23658
|
+
});
|
|
23659
|
+
}
|
|
23660
|
+
await Promise.all(Object.values(generated).map(chunk => writeOutputFile(chunk, outputOptions)));
|
|
23661
|
+
await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
|
|
23601
23662
|
}
|
|
23602
|
-
|
|
23603
|
-
|
|
23604
|
-
}
|
|
23605
|
-
return createOutput(generated);
|
|
23663
|
+
return createOutput(generated);
|
|
23664
|
+
});
|
|
23606
23665
|
}
|
|
23607
23666
|
function getOutputOptionsAndPluginDriver(rawOutputOptions, inputPluginDriver, inputOptions, unsetInputOptions) {
|
|
23608
23667
|
if (!rawOutputOptions) {
|
|
@@ -23751,4 +23810,4 @@ function watch(configs) {
|
|
|
23751
23810
|
return emitter;
|
|
23752
23811
|
}
|
|
23753
23812
|
|
|
23754
|
-
export { createFilter, defaultOnWarn, defineConfig, ensureArray, fseventsImporter, generatedCodePresets, getAugmentedNamespace, objectifyOption, objectifyOptionWithPresets, picomatch, rollup, rollupInternal, treeshakePresets, version$1 as version, warnUnknownOptions, watch };
|
|
23813
|
+
export { createFilter, defaultOnWarn, defineConfig, ensureArray, fseventsImporter, generatedCodePresets, getAugmentedNamespace, objectifyOption, objectifyOptionWithPresets, picomatch$1 as picomatch, rollup, rollupInternal, treeshakePresets, version$1 as version, warnUnknownOptions, watch };
|