vite 5.0.0-beta.7 → 5.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/chunks/{dep-cb981dcb.js → dep-6d23b7fa.js} +1 -1
- package/dist/node/chunks/{dep-8648c2fe.js → dep-e04185e5.js} +1 -1
- package/dist/node/chunks/{dep-7af400e9.js → dep-ffdf177d.js} +756 -1790
- package/dist/node/cli.js +11 -11
- package/dist/node/index.d.ts +40 -49
- package/dist/node/index.js +7 -7
- package/dist/node-cjs/publicUtils.cjs +0 -6
- package/index.cjs +0 -10
- package/package.json +6 -6
- package/types/import-meta.d.ts +5 -0
|
@@ -12,6 +12,7 @@ import * as require$$0$2 from 'fs';
|
|
|
12
12
|
import require$$0__default, { existsSync, readFileSync, statSync as statSync$1, readdirSync } from 'fs';
|
|
13
13
|
import require$$0$5 from 'events';
|
|
14
14
|
import require$$5 from 'assert';
|
|
15
|
+
import { createServer as createServer$3, STATUS_CODES, get as get$1 } from 'node:http';
|
|
15
16
|
import require$$0$6 from 'util';
|
|
16
17
|
import require$$4$1 from 'net';
|
|
17
18
|
import require$$0$9 from 'url';
|
|
@@ -23,25 +24,24 @@ import os$4 from 'node:os';
|
|
|
23
24
|
import { exec } from 'node:child_process';
|
|
24
25
|
import { createHash as createHash$2 } from 'node:crypto';
|
|
25
26
|
import { promises } from 'node:dns';
|
|
26
|
-
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEP_VERSION_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS,
|
|
27
|
+
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEP_VERSION_RE, SPECIAL_QUERY_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS, CSS_LANGS_RE, ESBUILD_MODULES_TARGET, KNOWN_ASSET_TYPES, CLIENT_DIR, JS_TYPES_RE, VERSION as VERSION$1, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
|
27
28
|
import require$$3$1 from 'crypto';
|
|
28
29
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
29
30
|
import require$$0$8, { createRequire as createRequire$2 } from 'module';
|
|
30
|
-
import { VERSION } from 'rollup';
|
|
31
31
|
import assert$1 from 'node:assert';
|
|
32
32
|
import process$1 from 'node:process';
|
|
33
33
|
import v8 from 'node:v8';
|
|
34
|
-
import {
|
|
34
|
+
import { VERSION } from 'rollup';
|
|
35
|
+
import * as qs from 'querystring';
|
|
36
|
+
import readline from 'node:readline';
|
|
37
|
+
import { EventEmitter as EventEmitter$4 } from 'node:events';
|
|
35
38
|
import { createServer as createServer$2 } from 'node:https';
|
|
36
39
|
import require$$0$a from 'zlib';
|
|
37
40
|
import require$$0$b from 'buffer';
|
|
38
41
|
import require$$1$2 from 'https';
|
|
39
42
|
import require$$4$2 from 'tls';
|
|
40
|
-
import require$$1 from 'worker_threads';
|
|
41
|
-
import * as qs from 'querystring';
|
|
42
|
-
import readline from 'node:readline';
|
|
43
|
-
import { EventEmitter as EventEmitter$4 } from 'node:events';
|
|
44
43
|
import zlib$1, { gzip } from 'node:zlib';
|
|
44
|
+
import require$$1 from 'worker_threads';
|
|
45
45
|
|
|
46
46
|
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
|
47
47
|
import { dirname as __cjs_dirname } from 'node:path';
|
|
@@ -2147,7 +2147,7 @@ const scan$1 = scan_1;
|
|
|
2147
2147
|
const parse$g = parse_1$3;
|
|
2148
2148
|
const utils$h = utils$k;
|
|
2149
2149
|
const constants$4 = constants$6;
|
|
2150
|
-
const isObject$
|
|
2150
|
+
const isObject$3 = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
2151
2151
|
|
|
2152
2152
|
/**
|
|
2153
2153
|
* Creates a matcher function from one or more glob patterns. The
|
|
@@ -2184,7 +2184,7 @@ const picomatch$5 = (glob, options, returnState = false) => {
|
|
|
2184
2184
|
return arrayMatcher;
|
|
2185
2185
|
}
|
|
2186
2186
|
|
|
2187
|
-
const isState = isObject$
|
|
2187
|
+
const isState = isObject$3(glob) && glob.tokens && glob.input;
|
|
2188
2188
|
|
|
2189
2189
|
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
|
2190
2190
|
throw new TypeError('Expected pattern to be a non-empty string');
|
|
@@ -6291,7 +6291,7 @@ function encodeInteger(buf, pos, state, segment, j) {
|
|
|
6291
6291
|
return pos;
|
|
6292
6292
|
}
|
|
6293
6293
|
|
|
6294
|
-
|
|
6294
|
+
class BitSet {
|
|
6295
6295
|
constructor(arg) {
|
|
6296
6296
|
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
6297
6297
|
}
|
|
@@ -6303,9 +6303,9 @@ let BitSet$1 = class BitSet {
|
|
|
6303
6303
|
has(n) {
|
|
6304
6304
|
return !!(this.bits[n >> 5] & (1 << (n & 31)));
|
|
6305
6305
|
}
|
|
6306
|
-
}
|
|
6306
|
+
}
|
|
6307
6307
|
|
|
6308
|
-
|
|
6308
|
+
class Chunk {
|
|
6309
6309
|
constructor(start, end, content) {
|
|
6310
6310
|
this.start = start;
|
|
6311
6311
|
this.end = end;
|
|
@@ -6400,6 +6400,13 @@ let Chunk$1 = class Chunk {
|
|
|
6400
6400
|
this.end = index;
|
|
6401
6401
|
|
|
6402
6402
|
if (this.edited) {
|
|
6403
|
+
// after split we should save the edit content record into the correct chunk
|
|
6404
|
+
// to make sure sourcemap correct
|
|
6405
|
+
// For example:
|
|
6406
|
+
// ' test'.trim()
|
|
6407
|
+
// split -> ' ' + 'test'
|
|
6408
|
+
// ✔️ edit -> '' + 'test'
|
|
6409
|
+
// ✖️ edit -> 'test' + ''
|
|
6403
6410
|
// TODO is this block necessary?...
|
|
6404
6411
|
newChunk.edit('', false);
|
|
6405
6412
|
this.content = '';
|
|
@@ -6428,6 +6435,10 @@ let Chunk$1 = class Chunk {
|
|
|
6428
6435
|
if (trimmed.length) {
|
|
6429
6436
|
if (trimmed !== this.content) {
|
|
6430
6437
|
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
6438
|
+
if (this.edited) {
|
|
6439
|
+
// save the change, if it has been edited
|
|
6440
|
+
this.edit(trimmed, this.storeName, true);
|
|
6441
|
+
}
|
|
6431
6442
|
}
|
|
6432
6443
|
return true;
|
|
6433
6444
|
} else {
|
|
@@ -6446,7 +6457,11 @@ let Chunk$1 = class Chunk {
|
|
|
6446
6457
|
|
|
6447
6458
|
if (trimmed.length) {
|
|
6448
6459
|
if (trimmed !== this.content) {
|
|
6449
|
-
this.split(this.end - trimmed.length);
|
|
6460
|
+
const newChunk = this.split(this.end - trimmed.length);
|
|
6461
|
+
if (this.edited) {
|
|
6462
|
+
// save the change, if it has been edited
|
|
6463
|
+
newChunk.edit(trimmed, this.storeName, true);
|
|
6464
|
+
}
|
|
6450
6465
|
this.edit('', undefined, true);
|
|
6451
6466
|
}
|
|
6452
6467
|
return true;
|
|
@@ -6457,9 +6472,9 @@ let Chunk$1 = class Chunk {
|
|
|
6457
6472
|
if (this.outro.length) return true;
|
|
6458
6473
|
}
|
|
6459
6474
|
}
|
|
6460
|
-
}
|
|
6475
|
+
}
|
|
6461
6476
|
|
|
6462
|
-
function getBtoa
|
|
6477
|
+
function getBtoa() {
|
|
6463
6478
|
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
|
|
6464
6479
|
return (str) => window.btoa(unescape(encodeURIComponent(str)));
|
|
6465
6480
|
} else if (typeof Buffer === 'function') {
|
|
@@ -6471,9 +6486,9 @@ function getBtoa$1 () {
|
|
|
6471
6486
|
}
|
|
6472
6487
|
}
|
|
6473
6488
|
|
|
6474
|
-
const btoa$
|
|
6489
|
+
const btoa$1 = /*#__PURE__*/ getBtoa();
|
|
6475
6490
|
|
|
6476
|
-
let SourceMap$
|
|
6491
|
+
let SourceMap$1 = class SourceMap {
|
|
6477
6492
|
constructor(properties) {
|
|
6478
6493
|
this.version = 3;
|
|
6479
6494
|
this.file = properties.file;
|
|
@@ -6481,6 +6496,9 @@ let SourceMap$2 = class SourceMap {
|
|
|
6481
6496
|
this.sourcesContent = properties.sourcesContent;
|
|
6482
6497
|
this.names = properties.names;
|
|
6483
6498
|
this.mappings = encode$1(properties.mappings);
|
|
6499
|
+
if (typeof properties.x_google_ignoreList !== 'undefined') {
|
|
6500
|
+
this.x_google_ignoreList = properties.x_google_ignoreList;
|
|
6501
|
+
}
|
|
6484
6502
|
}
|
|
6485
6503
|
|
|
6486
6504
|
toString() {
|
|
@@ -6488,11 +6506,11 @@ let SourceMap$2 = class SourceMap {
|
|
|
6488
6506
|
}
|
|
6489
6507
|
|
|
6490
6508
|
toUrl() {
|
|
6491
|
-
return 'data:application/json;charset=utf-8;base64,' + btoa$
|
|
6509
|
+
return 'data:application/json;charset=utf-8;base64,' + btoa$1(this.toString());
|
|
6492
6510
|
}
|
|
6493
6511
|
};
|
|
6494
6512
|
|
|
6495
|
-
function guessIndent
|
|
6513
|
+
function guessIndent(code) {
|
|
6496
6514
|
const lines = code.split('\n');
|
|
6497
6515
|
|
|
6498
6516
|
const tabbed = lines.filter((line) => /^\t+/.test(line));
|
|
@@ -6518,7 +6536,7 @@ function guessIndent$1(code) {
|
|
|
6518
6536
|
return new Array(min + 1).join(' ');
|
|
6519
6537
|
}
|
|
6520
6538
|
|
|
6521
|
-
function getRelativePath
|
|
6539
|
+
function getRelativePath(from, to) {
|
|
6522
6540
|
const fromParts = from.split(/[/\\]/);
|
|
6523
6541
|
const toParts = to.split(/[/\\]/);
|
|
6524
6542
|
|
|
@@ -6537,13 +6555,13 @@ function getRelativePath$1(from, to) {
|
|
|
6537
6555
|
return fromParts.concat(toParts).join('/');
|
|
6538
6556
|
}
|
|
6539
6557
|
|
|
6540
|
-
const toString$
|
|
6558
|
+
const toString$2 = Object.prototype.toString;
|
|
6541
6559
|
|
|
6542
|
-
function isObject$
|
|
6543
|
-
return toString$
|
|
6560
|
+
function isObject$2(thing) {
|
|
6561
|
+
return toString$2.call(thing) === '[object Object]';
|
|
6544
6562
|
}
|
|
6545
6563
|
|
|
6546
|
-
function getLocator
|
|
6564
|
+
function getLocator(source) {
|
|
6547
6565
|
const originalLines = source.split('\n');
|
|
6548
6566
|
const lineOffsets = [];
|
|
6549
6567
|
|
|
@@ -6569,7 +6587,9 @@ function getLocator$1(source) {
|
|
|
6569
6587
|
};
|
|
6570
6588
|
}
|
|
6571
6589
|
|
|
6572
|
-
|
|
6590
|
+
const wordRegex = /\w/;
|
|
6591
|
+
|
|
6592
|
+
class Mappings {
|
|
6573
6593
|
constructor(hires) {
|
|
6574
6594
|
this.hires = hires;
|
|
6575
6595
|
this.generatedCodeLine = 0;
|
|
@@ -6581,26 +6601,64 @@ let Mappings$1 = class Mappings {
|
|
|
6581
6601
|
|
|
6582
6602
|
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
6583
6603
|
if (content.length) {
|
|
6604
|
+
let contentLineEnd = content.indexOf('\n', 0);
|
|
6605
|
+
let previousContentLineEnd = -1;
|
|
6606
|
+
while (contentLineEnd >= 0) {
|
|
6607
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
6608
|
+
if (nameIndex >= 0) {
|
|
6609
|
+
segment.push(nameIndex);
|
|
6610
|
+
}
|
|
6611
|
+
this.rawSegments.push(segment);
|
|
6612
|
+
|
|
6613
|
+
this.generatedCodeLine += 1;
|
|
6614
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
6615
|
+
this.generatedCodeColumn = 0;
|
|
6616
|
+
|
|
6617
|
+
previousContentLineEnd = contentLineEnd;
|
|
6618
|
+
contentLineEnd = content.indexOf('\n', contentLineEnd + 1);
|
|
6619
|
+
}
|
|
6620
|
+
|
|
6584
6621
|
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
6585
6622
|
if (nameIndex >= 0) {
|
|
6586
6623
|
segment.push(nameIndex);
|
|
6587
6624
|
}
|
|
6588
6625
|
this.rawSegments.push(segment);
|
|
6626
|
+
|
|
6627
|
+
this.advance(content.slice(previousContentLineEnd + 1));
|
|
6589
6628
|
} else if (this.pending) {
|
|
6590
6629
|
this.rawSegments.push(this.pending);
|
|
6630
|
+
this.advance(content);
|
|
6591
6631
|
}
|
|
6592
6632
|
|
|
6593
|
-
this.advance(content);
|
|
6594
6633
|
this.pending = null;
|
|
6595
6634
|
}
|
|
6596
6635
|
|
|
6597
6636
|
addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
6598
6637
|
let originalCharIndex = chunk.start;
|
|
6599
6638
|
let first = true;
|
|
6639
|
+
// when iterating each char, check if it's in a word boundary
|
|
6640
|
+
let charInHiresBoundary = false;
|
|
6600
6641
|
|
|
6601
6642
|
while (originalCharIndex < chunk.end) {
|
|
6602
6643
|
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
|
|
6603
|
-
|
|
6644
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
6645
|
+
|
|
6646
|
+
if (this.hires === 'boundary') {
|
|
6647
|
+
// in hires "boundary", group segments per word boundary than per char
|
|
6648
|
+
if (wordRegex.test(original[originalCharIndex])) {
|
|
6649
|
+
// for first char in the boundary found, start the boundary by pushing a segment
|
|
6650
|
+
if (!charInHiresBoundary) {
|
|
6651
|
+
this.rawSegments.push(segment);
|
|
6652
|
+
charInHiresBoundary = true;
|
|
6653
|
+
}
|
|
6654
|
+
} else {
|
|
6655
|
+
// for non-word char, end the boundary by pushing a segment
|
|
6656
|
+
this.rawSegments.push(segment);
|
|
6657
|
+
charInHiresBoundary = false;
|
|
6658
|
+
}
|
|
6659
|
+
} else {
|
|
6660
|
+
this.rawSegments.push(segment);
|
|
6661
|
+
}
|
|
6604
6662
|
}
|
|
6605
6663
|
|
|
6606
6664
|
if (original[originalCharIndex] === '\n') {
|
|
@@ -6637,19 +6695,19 @@ let Mappings$1 = class Mappings {
|
|
|
6637
6695
|
|
|
6638
6696
|
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
6639
6697
|
}
|
|
6640
|
-
}
|
|
6698
|
+
}
|
|
6641
6699
|
|
|
6642
|
-
const n$
|
|
6700
|
+
const n$1 = '\n';
|
|
6643
6701
|
|
|
6644
|
-
const warned
|
|
6702
|
+
const warned = {
|
|
6645
6703
|
insertLeft: false,
|
|
6646
6704
|
insertRight: false,
|
|
6647
6705
|
storeName: false,
|
|
6648
6706
|
};
|
|
6649
6707
|
|
|
6650
|
-
|
|
6708
|
+
class MagicString {
|
|
6651
6709
|
constructor(string, options = {}) {
|
|
6652
|
-
const chunk = new Chunk
|
|
6710
|
+
const chunk = new Chunk(0, string.length, string);
|
|
6653
6711
|
|
|
6654
6712
|
Object.defineProperties(this, {
|
|
6655
6713
|
original: { writable: true, value: string },
|
|
@@ -6662,9 +6720,10 @@ let MagicString$1 = class MagicString {
|
|
|
6662
6720
|
byEnd: { writable: true, value: {} },
|
|
6663
6721
|
filename: { writable: true, value: options.filename },
|
|
6664
6722
|
indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
|
|
6665
|
-
sourcemapLocations: { writable: true, value: new BitSet
|
|
6723
|
+
sourcemapLocations: { writable: true, value: new BitSet() },
|
|
6666
6724
|
storedNames: { writable: true, value: {} },
|
|
6667
6725
|
indentStr: { writable: true, value: undefined },
|
|
6726
|
+
ignoreList: { writable: true, value: options.ignoreList },
|
|
6668
6727
|
});
|
|
6669
6728
|
|
|
6670
6729
|
this.byStart[0] = chunk;
|
|
@@ -6741,7 +6800,7 @@ let MagicString$1 = class MagicString {
|
|
|
6741
6800
|
cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
|
|
6742
6801
|
}
|
|
6743
6802
|
|
|
6744
|
-
cloned.sourcemapLocations = new BitSet
|
|
6803
|
+
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
|
|
6745
6804
|
|
|
6746
6805
|
cloned.intro = this.intro;
|
|
6747
6806
|
cloned.outro = this.outro;
|
|
@@ -6754,9 +6813,9 @@ let MagicString$1 = class MagicString {
|
|
|
6754
6813
|
|
|
6755
6814
|
const sourceIndex = 0;
|
|
6756
6815
|
const names = Object.keys(this.storedNames);
|
|
6757
|
-
const mappings = new Mappings
|
|
6816
|
+
const mappings = new Mappings(options.hires);
|
|
6758
6817
|
|
|
6759
|
-
const locate = getLocator
|
|
6818
|
+
const locate = getLocator(this.original);
|
|
6760
6819
|
|
|
6761
6820
|
if (this.intro) {
|
|
6762
6821
|
mappings.advance(this.intro);
|
|
@@ -6772,7 +6831,7 @@ let MagicString$1 = class MagicString {
|
|
|
6772
6831
|
sourceIndex,
|
|
6773
6832
|
chunk.content,
|
|
6774
6833
|
loc,
|
|
6775
|
-
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
6834
|
+
chunk.storeName ? names.indexOf(chunk.original) : -1,
|
|
6776
6835
|
);
|
|
6777
6836
|
} else {
|
|
6778
6837
|
mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
|
|
@@ -6782,21 +6841,24 @@ let MagicString$1 = class MagicString {
|
|
|
6782
6841
|
});
|
|
6783
6842
|
|
|
6784
6843
|
return {
|
|
6785
|
-
file: options.file ? options.file.split(/[/\\]/).pop() :
|
|
6786
|
-
sources: [
|
|
6787
|
-
|
|
6844
|
+
file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
|
|
6845
|
+
sources: [
|
|
6846
|
+
options.source ? getRelativePath(options.file || '', options.source) : options.file || '',
|
|
6847
|
+
],
|
|
6848
|
+
sourcesContent: options.includeContent ? [this.original] : undefined,
|
|
6788
6849
|
names,
|
|
6789
6850
|
mappings: mappings.raw,
|
|
6851
|
+
x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,
|
|
6790
6852
|
};
|
|
6791
6853
|
}
|
|
6792
6854
|
|
|
6793
6855
|
generateMap(options) {
|
|
6794
|
-
return new SourceMap$
|
|
6856
|
+
return new SourceMap$1(this.generateDecodedMap(options));
|
|
6795
6857
|
}
|
|
6796
6858
|
|
|
6797
6859
|
_ensureindentStr() {
|
|
6798
6860
|
if (this.indentStr === undefined) {
|
|
6799
|
-
this.indentStr = guessIndent
|
|
6861
|
+
this.indentStr = guessIndent(this.original);
|
|
6800
6862
|
}
|
|
6801
6863
|
}
|
|
6802
6864
|
|
|
@@ -6813,7 +6875,7 @@ let MagicString$1 = class MagicString {
|
|
|
6813
6875
|
indent(indentStr, options) {
|
|
6814
6876
|
const pattern = /^[^\r\n]/gm;
|
|
6815
6877
|
|
|
6816
|
-
if (isObject$
|
|
6878
|
+
if (isObject$2(indentStr)) {
|
|
6817
6879
|
options = indentStr;
|
|
6818
6880
|
indentStr = undefined;
|
|
6819
6881
|
}
|
|
@@ -6900,27 +6962,27 @@ let MagicString$1 = class MagicString {
|
|
|
6900
6962
|
|
|
6901
6963
|
insert() {
|
|
6902
6964
|
throw new Error(
|
|
6903
|
-
'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
|
|
6965
|
+
'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',
|
|
6904
6966
|
);
|
|
6905
6967
|
}
|
|
6906
6968
|
|
|
6907
6969
|
insertLeft(index, content) {
|
|
6908
|
-
if (!warned
|
|
6970
|
+
if (!warned.insertLeft) {
|
|
6909
6971
|
console.warn(
|
|
6910
|
-
'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
|
|
6972
|
+
'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',
|
|
6911
6973
|
); // eslint-disable-line no-console
|
|
6912
|
-
warned
|
|
6974
|
+
warned.insertLeft = true;
|
|
6913
6975
|
}
|
|
6914
6976
|
|
|
6915
6977
|
return this.appendLeft(index, content);
|
|
6916
6978
|
}
|
|
6917
6979
|
|
|
6918
6980
|
insertRight(index, content) {
|
|
6919
|
-
if (!warned
|
|
6981
|
+
if (!warned.insertRight) {
|
|
6920
6982
|
console.warn(
|
|
6921
|
-
'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
|
|
6983
|
+
'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',
|
|
6922
6984
|
); // eslint-disable-line no-console
|
|
6923
|
-
warned
|
|
6985
|
+
warned.insertRight = true;
|
|
6924
6986
|
}
|
|
6925
6987
|
|
|
6926
6988
|
return this.prependRight(index, content);
|
|
@@ -6977,18 +7039,18 @@ let MagicString$1 = class MagicString {
|
|
|
6977
7039
|
if (end > this.original.length) throw new Error('end is out of bounds');
|
|
6978
7040
|
if (start === end)
|
|
6979
7041
|
throw new Error(
|
|
6980
|
-
'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
|
|
7042
|
+
'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',
|
|
6981
7043
|
);
|
|
6982
7044
|
|
|
6983
7045
|
this._split(start);
|
|
6984
7046
|
this._split(end);
|
|
6985
7047
|
|
|
6986
7048
|
if (options === true) {
|
|
6987
|
-
if (!warned
|
|
7049
|
+
if (!warned.storeName) {
|
|
6988
7050
|
console.warn(
|
|
6989
|
-
'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
|
|
7051
|
+
'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',
|
|
6990
7052
|
); // eslint-disable-line no-console
|
|
6991
|
-
warned
|
|
7053
|
+
warned.storeName = true;
|
|
6992
7054
|
}
|
|
6993
7055
|
|
|
6994
7056
|
options = { storeName: true };
|
|
@@ -7021,7 +7083,7 @@ let MagicString$1 = class MagicString {
|
|
|
7021
7083
|
first.edit(content, storeName, !overwrite);
|
|
7022
7084
|
} else {
|
|
7023
7085
|
// must be inserting at the end
|
|
7024
|
-
const newChunk = new Chunk
|
|
7086
|
+
const newChunk = new Chunk(start, end, '').edit(content, storeName);
|
|
7025
7087
|
|
|
7026
7088
|
// TODO last chunk in the array may not be the last chunk, if it's moved...
|
|
7027
7089
|
last.next = newChunk;
|
|
@@ -7104,30 +7166,30 @@ let MagicString$1 = class MagicString {
|
|
|
7104
7166
|
}
|
|
7105
7167
|
|
|
7106
7168
|
lastLine() {
|
|
7107
|
-
let lineIndex = this.outro.lastIndexOf(n$
|
|
7169
|
+
let lineIndex = this.outro.lastIndexOf(n$1);
|
|
7108
7170
|
if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
|
|
7109
7171
|
let lineStr = this.outro;
|
|
7110
7172
|
let chunk = this.lastChunk;
|
|
7111
7173
|
do {
|
|
7112
7174
|
if (chunk.outro.length > 0) {
|
|
7113
|
-
lineIndex = chunk.outro.lastIndexOf(n$
|
|
7175
|
+
lineIndex = chunk.outro.lastIndexOf(n$1);
|
|
7114
7176
|
if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
|
|
7115
7177
|
lineStr = chunk.outro + lineStr;
|
|
7116
7178
|
}
|
|
7117
7179
|
|
|
7118
7180
|
if (chunk.content.length > 0) {
|
|
7119
|
-
lineIndex = chunk.content.lastIndexOf(n$
|
|
7181
|
+
lineIndex = chunk.content.lastIndexOf(n$1);
|
|
7120
7182
|
if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
|
|
7121
7183
|
lineStr = chunk.content + lineStr;
|
|
7122
7184
|
}
|
|
7123
7185
|
|
|
7124
7186
|
if (chunk.intro.length > 0) {
|
|
7125
|
-
lineIndex = chunk.intro.lastIndexOf(n$
|
|
7187
|
+
lineIndex = chunk.intro.lastIndexOf(n$1);
|
|
7126
7188
|
if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
|
|
7127
7189
|
lineStr = chunk.intro + lineStr;
|
|
7128
7190
|
}
|
|
7129
7191
|
} while ((chunk = chunk.previous));
|
|
7130
|
-
lineIndex = this.intro.lastIndexOf(n$
|
|
7192
|
+
lineIndex = this.intro.lastIndexOf(n$1);
|
|
7131
7193
|
if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
|
|
7132
7194
|
return this.intro + lineStr;
|
|
7133
7195
|
}
|
|
@@ -7206,9 +7268,9 @@ let MagicString$1 = class MagicString {
|
|
|
7206
7268
|
_splitChunk(chunk, index) {
|
|
7207
7269
|
if (chunk.edited && chunk.content.length) {
|
|
7208
7270
|
// zero-length edited chunks are a special case (overlapping replacements)
|
|
7209
|
-
const loc = getLocator
|
|
7271
|
+
const loc = getLocator(this.original)(index);
|
|
7210
7272
|
throw new Error(
|
|
7211
|
-
`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")
|
|
7273
|
+
`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`,
|
|
7212
7274
|
);
|
|
7213
7275
|
}
|
|
7214
7276
|
|
|
@@ -7367,7 +7429,7 @@ let MagicString$1 = class MagicString {
|
|
|
7367
7429
|
this.overwrite(
|
|
7368
7430
|
match.index,
|
|
7369
7431
|
match.index + match[0].length,
|
|
7370
|
-
getReplacement(match, this.original)
|
|
7432
|
+
getReplacement(match, this.original),
|
|
7371
7433
|
);
|
|
7372
7434
|
});
|
|
7373
7435
|
} else {
|
|
@@ -7376,7 +7438,7 @@ let MagicString$1 = class MagicString {
|
|
|
7376
7438
|
this.overwrite(
|
|
7377
7439
|
match.index,
|
|
7378
7440
|
match.index + match[0].length,
|
|
7379
|
-
getReplacement(match, this.original)
|
|
7441
|
+
getReplacement(match, this.original),
|
|
7380
7442
|
);
|
|
7381
7443
|
}
|
|
7382
7444
|
return this;
|
|
@@ -7422,13 +7484,13 @@ let MagicString$1 = class MagicString {
|
|
|
7422
7484
|
|
|
7423
7485
|
if (!searchValue.global) {
|
|
7424
7486
|
throw new TypeError(
|
|
7425
|
-
'MagicString.prototype.replaceAll called with a non-global RegExp argument'
|
|
7487
|
+
'MagicString.prototype.replaceAll called with a non-global RegExp argument',
|
|
7426
7488
|
);
|
|
7427
7489
|
}
|
|
7428
7490
|
|
|
7429
7491
|
return this._replaceRegexp(searchValue, replacement);
|
|
7430
7492
|
}
|
|
7431
|
-
}
|
|
7493
|
+
}
|
|
7432
7494
|
|
|
7433
7495
|
function isReference(node, parent) {
|
|
7434
7496
|
if (node.type === 'MemberExpression') {
|
|
@@ -7460,7 +7522,7 @@ function isReference(node, parent) {
|
|
|
7460
7522
|
return false;
|
|
7461
7523
|
}
|
|
7462
7524
|
|
|
7463
|
-
var version$3 = "25.0.
|
|
7525
|
+
var version$3 = "25.0.7";
|
|
7464
7526
|
var peerDependencies = {
|
|
7465
7527
|
rollup: "^2.68.0||^3.0.0||^4.0.0"
|
|
7466
7528
|
};
|
|
@@ -7883,7 +7945,7 @@ async function getStaticRequireProxy(id, requireReturnsDefault, loadModule) {
|
|
|
7883
7945
|
return `export { default } from ${JSON.stringify(id)};`;
|
|
7884
7946
|
}
|
|
7885
7947
|
|
|
7886
|
-
function getEntryProxy(id, defaultIsModuleExports, getModuleInfo) {
|
|
7948
|
+
function getEntryProxy(id, defaultIsModuleExports, getModuleInfo, shebang) {
|
|
7887
7949
|
const {
|
|
7888
7950
|
meta: { commonjs: commonjsMeta },
|
|
7889
7951
|
hasDefaultExport
|
|
@@ -7894,9 +7956,13 @@ function getEntryProxy(id, defaultIsModuleExports, getModuleInfo) {
|
|
|
7894
7956
|
if (hasDefaultExport) {
|
|
7895
7957
|
code += `export { default } from ${stringifiedId};`;
|
|
7896
7958
|
}
|
|
7897
|
-
return code;
|
|
7959
|
+
return shebang + code;
|
|
7898
7960
|
}
|
|
7899
|
-
|
|
7961
|
+
const result = getEsImportProxy(id, defaultIsModuleExports);
|
|
7962
|
+
return {
|
|
7963
|
+
...result,
|
|
7964
|
+
code: shebang + result.code
|
|
7965
|
+
};
|
|
7900
7966
|
}
|
|
7901
7967
|
|
|
7902
7968
|
function getEsImportProxy(id, defaultIsModuleExports) {
|
|
@@ -8936,7 +9002,7 @@ async function transformCommonjs(
|
|
|
8936
9002
|
commonjsMeta
|
|
8937
9003
|
) {
|
|
8938
9004
|
const ast = astCache || tryParse(parse, code, id);
|
|
8939
|
-
const magicString = new MagicString
|
|
9005
|
+
const magicString = new MagicString(code);
|
|
8940
9006
|
const uses = {
|
|
8941
9007
|
module: false,
|
|
8942
9008
|
exports: false,
|
|
@@ -9350,6 +9416,13 @@ async function transformCommonjs(
|
|
|
9350
9416
|
magicString.remove(0, commentEnd).trim();
|
|
9351
9417
|
}
|
|
9352
9418
|
|
|
9419
|
+
let shebang = '';
|
|
9420
|
+
if (code.startsWith('#!')) {
|
|
9421
|
+
const shebangEndPosition = code.indexOf('\n') + 1;
|
|
9422
|
+
shebang = code.slice(0, shebangEndPosition);
|
|
9423
|
+
magicString.remove(0, shebangEndPosition).trim();
|
|
9424
|
+
}
|
|
9425
|
+
|
|
9353
9426
|
const exportMode = isEsModule
|
|
9354
9427
|
? 'none'
|
|
9355
9428
|
: shouldWrap
|
|
@@ -9433,14 +9506,14 @@ function ${requireName} () {
|
|
|
9433
9506
|
|
|
9434
9507
|
magicString
|
|
9435
9508
|
.trim()
|
|
9436
|
-
.prepend(leadingComment + importBlock)
|
|
9509
|
+
.prepend(shebang + leadingComment + importBlock)
|
|
9437
9510
|
.append(exportBlock);
|
|
9438
9511
|
|
|
9439
9512
|
return {
|
|
9440
9513
|
code: magicString.toString(),
|
|
9441
9514
|
map: sourceMap ? magicString.generateMap() : null,
|
|
9442
9515
|
syntheticNamedExports: isEsModule || usesRequireWrapper ? false : '__moduleExports',
|
|
9443
|
-
meta: { commonjs: commonjsMeta }
|
|
9516
|
+
meta: { commonjs: { ...commonjsMeta, shebang } }
|
|
9444
9517
|
};
|
|
9445
9518
|
}
|
|
9446
9519
|
|
|
@@ -9682,7 +9755,16 @@ function commonjs(options = {}) {
|
|
|
9682
9755
|
// entry suffix is just appended to not mess up relative external resolution
|
|
9683
9756
|
if (id.endsWith(ENTRY_SUFFIX)) {
|
|
9684
9757
|
const acutalId = id.slice(0, -ENTRY_SUFFIX.length);
|
|
9685
|
-
|
|
9758
|
+
const {
|
|
9759
|
+
meta: { commonjs: commonjsMeta }
|
|
9760
|
+
} = this.getModuleInfo(acutalId);
|
|
9761
|
+
const shebang = commonjsMeta?.shebang ?? '';
|
|
9762
|
+
return getEntryProxy(
|
|
9763
|
+
acutalId,
|
|
9764
|
+
getDefaultIsModuleExports(acutalId),
|
|
9765
|
+
this.getModuleInfo,
|
|
9766
|
+
shebang
|
|
9767
|
+
);
|
|
9686
9768
|
}
|
|
9687
9769
|
|
|
9688
9770
|
if (isWrappedId(id, ES_IMPORT_SUFFIX)) {
|
|
@@ -10535,7 +10617,7 @@ function build$2(map, loader, importer, importerDepth) {
|
|
|
10535
10617
|
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
|
10536
10618
|
* provided to it.
|
|
10537
10619
|
*/
|
|
10538
|
-
|
|
10620
|
+
class SourceMap {
|
|
10539
10621
|
constructor(map, options) {
|
|
10540
10622
|
const out = options.decodedMappings ? toDecodedMap(map) : toEncodedMap(map);
|
|
10541
10623
|
this.version = out.version; // SourceMap spec says this should be first.
|
|
@@ -10551,7 +10633,7 @@ let SourceMap$1 = class SourceMap {
|
|
|
10551
10633
|
toString() {
|
|
10552
10634
|
return JSON.stringify(this);
|
|
10553
10635
|
}
|
|
10554
|
-
}
|
|
10636
|
+
}
|
|
10555
10637
|
|
|
10556
10638
|
/**
|
|
10557
10639
|
* Traces through all the mappings in the root sourcemap, through the sources
|
|
@@ -10571,7 +10653,7 @@ let SourceMap$1 = class SourceMap {
|
|
|
10571
10653
|
function remapping(input, loader, options) {
|
|
10572
10654
|
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
|
10573
10655
|
const tree = buildSourceMapTree(input, loader);
|
|
10574
|
-
return new SourceMap
|
|
10656
|
+
return new SourceMap(traceMappings(tree), opts);
|
|
10575
10657
|
}
|
|
10576
10658
|
|
|
10577
10659
|
var src$2 = {exports: {}};
|
|
@@ -12026,7 +12108,7 @@ const dataUrlRE = /^\s*data:/i;
|
|
|
12026
12108
|
const isDataUrl = (url) => dataUrlRE.test(url);
|
|
12027
12109
|
const virtualModuleRE = /^virtual-module:.*/;
|
|
12028
12110
|
const virtualModulePrefix = 'virtual-module:';
|
|
12029
|
-
const knownJsSrcRE = /\.(?:[jt]sx?|m[jt]s|vue|marko|svelte|astro|imba)(?:$|\?)/;
|
|
12111
|
+
const knownJsSrcRE = /\.(?:[jt]sx?|m[jt]s|vue|marko|svelte|astro|imba|mdx)(?:$|\?)/;
|
|
12030
12112
|
const isJSRequest = (url) => {
|
|
12031
12113
|
url = cleanUrl(url);
|
|
12032
12114
|
if (knownJsSrcRE.test(url)) {
|
|
@@ -12110,7 +12192,7 @@ function prettifyUrl(url, root) {
|
|
|
12110
12192
|
return colors$1.dim(url);
|
|
12111
12193
|
}
|
|
12112
12194
|
}
|
|
12113
|
-
function isObject$
|
|
12195
|
+
function isObject$1(value) {
|
|
12114
12196
|
return Object.prototype.toString.call(value) === '[object Object]';
|
|
12115
12197
|
}
|
|
12116
12198
|
function isDefined(value) {
|
|
@@ -12360,21 +12442,17 @@ function ensureWatchedFile(watcher, file, root) {
|
|
|
12360
12442
|
}
|
|
12361
12443
|
const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g;
|
|
12362
12444
|
const imageSetUrlRE = /^(?:[\w\-]+\(.*?\)|'.*?'|".*?"|\S*)/;
|
|
12363
|
-
function
|
|
12364
|
-
return ret.
|
|
12365
|
-
descriptor ??= '';
|
|
12366
|
-
return (prev +=
|
|
12367
|
-
url + ` ${descriptor}${index === ret.length - 1 ? '' : ', '}`);
|
|
12368
|
-
}, '');
|
|
12445
|
+
function joinSrcset(ret) {
|
|
12446
|
+
return ret.map(({ url, descriptor }) => `${url} ${descriptor}`).join(', ');
|
|
12369
12447
|
}
|
|
12370
12448
|
function splitSrcSetDescriptor(srcs) {
|
|
12371
12449
|
return splitSrcSet(srcs)
|
|
12372
12450
|
.map((s) => {
|
|
12373
12451
|
const src = s.replace(escapedSpaceCharacters, ' ').trim();
|
|
12374
|
-
const
|
|
12452
|
+
const url = imageSetUrlRE.exec(src)?.[0] ?? '';
|
|
12375
12453
|
return {
|
|
12376
12454
|
url,
|
|
12377
|
-
descriptor: src
|
|
12455
|
+
descriptor: src.slice(url.length).trim(),
|
|
12378
12456
|
};
|
|
12379
12457
|
})
|
|
12380
12458
|
.filter(({ url }) => !!url);
|
|
@@ -12383,10 +12461,10 @@ function processSrcSet(srcs, replacer) {
|
|
|
12383
12461
|
return Promise.all(splitSrcSetDescriptor(srcs).map(async ({ url, descriptor }) => ({
|
|
12384
12462
|
url: await replacer({ url, descriptor }),
|
|
12385
12463
|
descriptor,
|
|
12386
|
-
}))).then(
|
|
12464
|
+
}))).then(joinSrcset);
|
|
12387
12465
|
}
|
|
12388
12466
|
function processSrcSetSync(srcs, replacer) {
|
|
12389
|
-
return
|
|
12467
|
+
return joinSrcset(splitSrcSetDescriptor(srcs).map(({ url, descriptor }) => ({
|
|
12390
12468
|
url: replacer({ url, descriptor }),
|
|
12391
12469
|
descriptor,
|
|
12392
12470
|
})));
|
|
@@ -12584,12 +12662,6 @@ function arraify(target) {
|
|
|
12584
12662
|
const multilineCommentsRE$1 = /\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g;
|
|
12585
12663
|
const singlelineCommentsRE$1 = /\/\/.*/g;
|
|
12586
12664
|
const requestQuerySplitRE = /\?(?!.*[/|}])/;
|
|
12587
|
-
/**
|
|
12588
|
-
* Dynamically import files. It will make sure it's not being compiled away by TS/Rollup.
|
|
12589
|
-
*
|
|
12590
|
-
* @param file File path to import.
|
|
12591
|
-
*/
|
|
12592
|
-
const dynamicImport = new Function('file', 'return import(file)');
|
|
12593
12665
|
function parseRequest(id) {
|
|
12594
12666
|
const [_, search] = id.split(requestQuerySplitRE, 2);
|
|
12595
12667
|
if (!search) {
|
|
@@ -12653,7 +12725,7 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
|
12653
12725
|
merged[key] = [...arraify(existing ?? []), ...arraify(value ?? [])];
|
|
12654
12726
|
continue;
|
|
12655
12727
|
}
|
|
12656
|
-
if (isObject$
|
|
12728
|
+
if (isObject$1(existing) && isObject$1(value)) {
|
|
12657
12729
|
merged[key] = mergeConfigRecursively(existing, value, rootPath ? `${rootPath}.${key}` : key);
|
|
12658
12730
|
continue;
|
|
12659
12731
|
}
|
|
@@ -12672,7 +12744,7 @@ function mergeAlias(a, b) {
|
|
|
12672
12744
|
return b;
|
|
12673
12745
|
if (!b)
|
|
12674
12746
|
return a;
|
|
12675
|
-
if (isObject$
|
|
12747
|
+
if (isObject$1(a) && isObject$1(b)) {
|
|
12676
12748
|
return { ...a, ...b };
|
|
12677
12749
|
}
|
|
12678
12750
|
// the order is flipped because the alias is resolved from top-down,
|
|
@@ -14656,7 +14728,7 @@ async function reloadOnTsconfigChange(changedFile) {
|
|
|
14656
14728
|
// clear module graph to remove code compiled with outdated config
|
|
14657
14729
|
server.moduleGraph.invalidateAll();
|
|
14658
14730
|
// reset tsconfck so that recompile works with up2date configs
|
|
14659
|
-
tsconfckCache
|
|
14731
|
+
tsconfckCache?.clear();
|
|
14660
14732
|
// server may not be available if vite config is updated at the same time
|
|
14661
14733
|
if (server) {
|
|
14662
14734
|
// force full reload
|
|
@@ -14892,1645 +14964,444 @@ var jsonStableStringify = function (obj, opts) {
|
|
|
14892
14964
|
|
|
14893
14965
|
if (seen.indexOf(node) !== -1) {
|
|
14894
14966
|
if (cycles) { return json.stringify('__cycle__'); }
|
|
14895
|
-
throw new TypeError('Converting circular structure to JSON');
|
|
14896
|
-
} else { seen.push(node); }
|
|
14897
|
-
|
|
14898
|
-
var keys = objectKeys(node).sort(cmp && cmp(node));
|
|
14899
|
-
var out = [];
|
|
14900
|
-
for (var i = 0; i < keys.length; i++) {
|
|
14901
|
-
var key = keys[i];
|
|
14902
|
-
var value = stringify(node, key, node[key], level + 1);
|
|
14903
|
-
|
|
14904
|
-
if (!value) { continue; }
|
|
14905
|
-
|
|
14906
|
-
var keyValue = json.stringify(key)
|
|
14907
|
-
+ colonSeparator
|
|
14908
|
-
+ value;
|
|
14909
|
-
|
|
14910
|
-
out.push(indent + space + keyValue);
|
|
14911
|
-
}
|
|
14912
|
-
seen.splice(seen.indexOf(node), 1);
|
|
14913
|
-
return '{' + out.join(',') + indent + '}';
|
|
14914
|
-
|
|
14915
|
-
}({ '': obj }, '', obj, 0));
|
|
14916
|
-
};
|
|
14917
|
-
|
|
14918
|
-
var jsonStableStringify$1 = /*@__PURE__*/getDefaultExportFromCjs(jsonStableStringify);
|
|
14919
|
-
|
|
14920
|
-
const mimes$1 = {
|
|
14921
|
-
"ez": "application/andrew-inset",
|
|
14922
|
-
"aw": "application/applixware",
|
|
14923
|
-
"atom": "application/atom+xml",
|
|
14924
|
-
"atomcat": "application/atomcat+xml",
|
|
14925
|
-
"atomdeleted": "application/atomdeleted+xml",
|
|
14926
|
-
"atomsvc": "application/atomsvc+xml",
|
|
14927
|
-
"dwd": "application/atsc-dwd+xml",
|
|
14928
|
-
"held": "application/atsc-held+xml",
|
|
14929
|
-
"rsat": "application/atsc-rsat+xml",
|
|
14930
|
-
"bdoc": "application/bdoc",
|
|
14931
|
-
"xcs": "application/calendar+xml",
|
|
14932
|
-
"ccxml": "application/ccxml+xml",
|
|
14933
|
-
"cdfx": "application/cdfx+xml",
|
|
14934
|
-
"cdmia": "application/cdmi-capability",
|
|
14935
|
-
"cdmic": "application/cdmi-container",
|
|
14936
|
-
"cdmid": "application/cdmi-domain",
|
|
14937
|
-
"cdmio": "application/cdmi-object",
|
|
14938
|
-
"cdmiq": "application/cdmi-queue",
|
|
14939
|
-
"cu": "application/cu-seeme",
|
|
14940
|
-
"mpd": "application/dash+xml",
|
|
14941
|
-
"davmount": "application/davmount+xml",
|
|
14942
|
-
"dbk": "application/docbook+xml",
|
|
14943
|
-
"dssc": "application/dssc+der",
|
|
14944
|
-
"xdssc": "application/dssc+xml",
|
|
14945
|
-
"es": "application/ecmascript",
|
|
14946
|
-
"ecma": "application/ecmascript",
|
|
14947
|
-
"emma": "application/emma+xml",
|
|
14948
|
-
"emotionml": "application/emotionml+xml",
|
|
14949
|
-
"epub": "application/epub+zip",
|
|
14950
|
-
"exi": "application/exi",
|
|
14951
|
-
"fdt": "application/fdt+xml",
|
|
14952
|
-
"pfr": "application/font-tdpfr",
|
|
14953
|
-
"geojson": "application/geo+json",
|
|
14954
|
-
"gml": "application/gml+xml",
|
|
14955
|
-
"gpx": "application/gpx+xml",
|
|
14956
|
-
"gxf": "application/gxf",
|
|
14957
|
-
"gz": "application/gzip",
|
|
14958
|
-
"hjson": "application/hjson",
|
|
14959
|
-
"stk": "application/hyperstudio",
|
|
14960
|
-
"ink": "application/inkml+xml",
|
|
14961
|
-
"inkml": "application/inkml+xml",
|
|
14962
|
-
"ipfix": "application/ipfix",
|
|
14963
|
-
"its": "application/its+xml",
|
|
14964
|
-
"jar": "application/java-archive",
|
|
14965
|
-
"war": "application/java-archive",
|
|
14966
|
-
"ear": "application/java-archive",
|
|
14967
|
-
"ser": "application/java-serialized-object",
|
|
14968
|
-
"class": "application/java-vm",
|
|
14969
|
-
"js": "application/javascript",
|
|
14970
|
-
"mjs": "application/javascript",
|
|
14971
|
-
"json": "application/json",
|
|
14972
|
-
"map": "application/json",
|
|
14973
|
-
"json5": "application/json5",
|
|
14974
|
-
"jsonml": "application/jsonml+json",
|
|
14975
|
-
"jsonld": "application/ld+json",
|
|
14976
|
-
"lgr": "application/lgr+xml",
|
|
14977
|
-
"lostxml": "application/lost+xml",
|
|
14978
|
-
"hqx": "application/mac-binhex40",
|
|
14979
|
-
"cpt": "application/mac-compactpro",
|
|
14980
|
-
"mads": "application/mads+xml",
|
|
14981
|
-
"webmanifest": "application/manifest+json",
|
|
14982
|
-
"mrc": "application/marc",
|
|
14983
|
-
"mrcx": "application/marcxml+xml",
|
|
14984
|
-
"ma": "application/mathematica",
|
|
14985
|
-
"nb": "application/mathematica",
|
|
14986
|
-
"mb": "application/mathematica",
|
|
14987
|
-
"mathml": "application/mathml+xml",
|
|
14988
|
-
"mbox": "application/mbox",
|
|
14989
|
-
"mscml": "application/mediaservercontrol+xml",
|
|
14990
|
-
"metalink": "application/metalink+xml",
|
|
14991
|
-
"meta4": "application/metalink4+xml",
|
|
14992
|
-
"mets": "application/mets+xml",
|
|
14993
|
-
"maei": "application/mmt-aei+xml",
|
|
14994
|
-
"musd": "application/mmt-usd+xml",
|
|
14995
|
-
"mods": "application/mods+xml",
|
|
14996
|
-
"m21": "application/mp21",
|
|
14997
|
-
"mp21": "application/mp21",
|
|
14998
|
-
"mp4s": "application/mp4",
|
|
14999
|
-
"m4p": "application/mp4",
|
|
15000
|
-
"doc": "application/msword",
|
|
15001
|
-
"dot": "application/msword",
|
|
15002
|
-
"mxf": "application/mxf",
|
|
15003
|
-
"nq": "application/n-quads",
|
|
15004
|
-
"nt": "application/n-triples",
|
|
15005
|
-
"cjs": "application/node",
|
|
15006
|
-
"bin": "application/octet-stream",
|
|
15007
|
-
"dms": "application/octet-stream",
|
|
15008
|
-
"lrf": "application/octet-stream",
|
|
15009
|
-
"mar": "application/octet-stream",
|
|
15010
|
-
"so": "application/octet-stream",
|
|
15011
|
-
"dist": "application/octet-stream",
|
|
15012
|
-
"distz": "application/octet-stream",
|
|
15013
|
-
"pkg": "application/octet-stream",
|
|
15014
|
-
"bpk": "application/octet-stream",
|
|
15015
|
-
"dump": "application/octet-stream",
|
|
15016
|
-
"elc": "application/octet-stream",
|
|
15017
|
-
"deploy": "application/octet-stream",
|
|
15018
|
-
"exe": "application/octet-stream",
|
|
15019
|
-
"dll": "application/octet-stream",
|
|
15020
|
-
"deb": "application/octet-stream",
|
|
15021
|
-
"dmg": "application/octet-stream",
|
|
15022
|
-
"iso": "application/octet-stream",
|
|
15023
|
-
"img": "application/octet-stream",
|
|
15024
|
-
"msi": "application/octet-stream",
|
|
15025
|
-
"msp": "application/octet-stream",
|
|
15026
|
-
"msm": "application/octet-stream",
|
|
15027
|
-
"buffer": "application/octet-stream",
|
|
15028
|
-
"oda": "application/oda",
|
|
15029
|
-
"opf": "application/oebps-package+xml",
|
|
15030
|
-
"ogx": "application/ogg",
|
|
15031
|
-
"omdoc": "application/omdoc+xml",
|
|
15032
|
-
"onetoc": "application/onenote",
|
|
15033
|
-
"onetoc2": "application/onenote",
|
|
15034
|
-
"onetmp": "application/onenote",
|
|
15035
|
-
"onepkg": "application/onenote",
|
|
15036
|
-
"oxps": "application/oxps",
|
|
15037
|
-
"relo": "application/p2p-overlay+xml",
|
|
15038
|
-
"xer": "application/patch-ops-error+xml",
|
|
15039
|
-
"pdf": "application/pdf",
|
|
15040
|
-
"pgp": "application/pgp-encrypted",
|
|
15041
|
-
"asc": "application/pgp-signature",
|
|
15042
|
-
"sig": "application/pgp-signature",
|
|
15043
|
-
"prf": "application/pics-rules",
|
|
15044
|
-
"p10": "application/pkcs10",
|
|
15045
|
-
"p7m": "application/pkcs7-mime",
|
|
15046
|
-
"p7c": "application/pkcs7-mime",
|
|
15047
|
-
"p7s": "application/pkcs7-signature",
|
|
15048
|
-
"p8": "application/pkcs8",
|
|
15049
|
-
"ac": "application/pkix-attr-cert",
|
|
15050
|
-
"cer": "application/pkix-cert",
|
|
15051
|
-
"crl": "application/pkix-crl",
|
|
15052
|
-
"pkipath": "application/pkix-pkipath",
|
|
15053
|
-
"pki": "application/pkixcmp",
|
|
15054
|
-
"pls": "application/pls+xml",
|
|
15055
|
-
"ai": "application/postscript",
|
|
15056
|
-
"eps": "application/postscript",
|
|
15057
|
-
"ps": "application/postscript",
|
|
15058
|
-
"provx": "application/provenance+xml",
|
|
15059
|
-
"cww": "application/prs.cww",
|
|
15060
|
-
"pskcxml": "application/pskc+xml",
|
|
15061
|
-
"raml": "application/raml+yaml",
|
|
15062
|
-
"rdf": "application/rdf+xml",
|
|
15063
|
-
"owl": "application/rdf+xml",
|
|
15064
|
-
"rif": "application/reginfo+xml",
|
|
15065
|
-
"rnc": "application/relax-ng-compact-syntax",
|
|
15066
|
-
"rl": "application/resource-lists+xml",
|
|
15067
|
-
"rld": "application/resource-lists-diff+xml",
|
|
15068
|
-
"rs": "application/rls-services+xml",
|
|
15069
|
-
"rapd": "application/route-apd+xml",
|
|
15070
|
-
"sls": "application/route-s-tsid+xml",
|
|
15071
|
-
"rusd": "application/route-usd+xml",
|
|
15072
|
-
"gbr": "application/rpki-ghostbusters",
|
|
15073
|
-
"mft": "application/rpki-manifest",
|
|
15074
|
-
"roa": "application/rpki-roa",
|
|
15075
|
-
"rsd": "application/rsd+xml",
|
|
15076
|
-
"rss": "application/rss+xml",
|
|
15077
|
-
"rtf": "application/rtf",
|
|
15078
|
-
"sbml": "application/sbml+xml",
|
|
15079
|
-
"scq": "application/scvp-cv-request",
|
|
15080
|
-
"scs": "application/scvp-cv-response",
|
|
15081
|
-
"spq": "application/scvp-vp-request",
|
|
15082
|
-
"spp": "application/scvp-vp-response",
|
|
15083
|
-
"sdp": "application/sdp",
|
|
15084
|
-
"senmlx": "application/senml+xml",
|
|
15085
|
-
"sensmlx": "application/sensml+xml",
|
|
15086
|
-
"setpay": "application/set-payment-initiation",
|
|
15087
|
-
"setreg": "application/set-registration-initiation",
|
|
15088
|
-
"shf": "application/shf+xml",
|
|
15089
|
-
"siv": "application/sieve",
|
|
15090
|
-
"sieve": "application/sieve",
|
|
15091
|
-
"smi": "application/smil+xml",
|
|
15092
|
-
"smil": "application/smil+xml",
|
|
15093
|
-
"rq": "application/sparql-query",
|
|
15094
|
-
"srx": "application/sparql-results+xml",
|
|
15095
|
-
"gram": "application/srgs",
|
|
15096
|
-
"grxml": "application/srgs+xml",
|
|
15097
|
-
"sru": "application/sru+xml",
|
|
15098
|
-
"ssdl": "application/ssdl+xml",
|
|
15099
|
-
"ssml": "application/ssml+xml",
|
|
15100
|
-
"swidtag": "application/swid+xml",
|
|
15101
|
-
"tei": "application/tei+xml",
|
|
15102
|
-
"teicorpus": "application/tei+xml",
|
|
15103
|
-
"tfi": "application/thraud+xml",
|
|
15104
|
-
"tsd": "application/timestamped-data",
|
|
15105
|
-
"toml": "application/toml",
|
|
15106
|
-
"trig": "application/trig",
|
|
15107
|
-
"ttml": "application/ttml+xml",
|
|
15108
|
-
"ubj": "application/ubjson",
|
|
15109
|
-
"rsheet": "application/urc-ressheet+xml",
|
|
15110
|
-
"td": "application/urc-targetdesc+xml",
|
|
15111
|
-
"vxml": "application/voicexml+xml",
|
|
15112
|
-
"wasm": "application/wasm",
|
|
15113
|
-
"wgt": "application/widget",
|
|
15114
|
-
"hlp": "application/winhlp",
|
|
15115
|
-
"wsdl": "application/wsdl+xml",
|
|
15116
|
-
"wspolicy": "application/wspolicy+xml",
|
|
15117
|
-
"xaml": "application/xaml+xml",
|
|
15118
|
-
"xav": "application/xcap-att+xml",
|
|
15119
|
-
"xca": "application/xcap-caps+xml",
|
|
15120
|
-
"xdf": "application/xcap-diff+xml",
|
|
15121
|
-
"xel": "application/xcap-el+xml",
|
|
15122
|
-
"xns": "application/xcap-ns+xml",
|
|
15123
|
-
"xenc": "application/xenc+xml",
|
|
15124
|
-
"xhtml": "application/xhtml+xml",
|
|
15125
|
-
"xht": "application/xhtml+xml",
|
|
15126
|
-
"xlf": "application/xliff+xml",
|
|
15127
|
-
"xml": "application/xml",
|
|
15128
|
-
"xsl": "application/xml",
|
|
15129
|
-
"xsd": "application/xml",
|
|
15130
|
-
"rng": "application/xml",
|
|
15131
|
-
"dtd": "application/xml-dtd",
|
|
15132
|
-
"xop": "application/xop+xml",
|
|
15133
|
-
"xpl": "application/xproc+xml",
|
|
15134
|
-
"xslt": "application/xml",
|
|
15135
|
-
"xspf": "application/xspf+xml",
|
|
15136
|
-
"mxml": "application/xv+xml",
|
|
15137
|
-
"xhvml": "application/xv+xml",
|
|
15138
|
-
"xvml": "application/xv+xml",
|
|
15139
|
-
"xvm": "application/xv+xml",
|
|
15140
|
-
"yang": "application/yang",
|
|
15141
|
-
"yin": "application/yin+xml",
|
|
15142
|
-
"zip": "application/zip",
|
|
15143
|
-
"3gpp": "video/3gpp",
|
|
15144
|
-
"adp": "audio/adpcm",
|
|
15145
|
-
"amr": "audio/amr",
|
|
15146
|
-
"au": "audio/basic",
|
|
15147
|
-
"snd": "audio/basic",
|
|
15148
|
-
"mid": "audio/midi",
|
|
15149
|
-
"midi": "audio/midi",
|
|
15150
|
-
"kar": "audio/midi",
|
|
15151
|
-
"rmi": "audio/midi",
|
|
15152
|
-
"mxmf": "audio/mobile-xmf",
|
|
15153
|
-
"mp3": "audio/mpeg",
|
|
15154
|
-
"m4a": "audio/mp4",
|
|
15155
|
-
"mp4a": "audio/mp4",
|
|
15156
|
-
"mpga": "audio/mpeg",
|
|
15157
|
-
"mp2": "audio/mpeg",
|
|
15158
|
-
"mp2a": "audio/mpeg",
|
|
15159
|
-
"m2a": "audio/mpeg",
|
|
15160
|
-
"m3a": "audio/mpeg",
|
|
15161
|
-
"oga": "audio/ogg",
|
|
15162
|
-
"ogg": "audio/ogg",
|
|
15163
|
-
"spx": "audio/ogg",
|
|
15164
|
-
"opus": "audio/ogg",
|
|
15165
|
-
"s3m": "audio/s3m",
|
|
15166
|
-
"sil": "audio/silk",
|
|
15167
|
-
"wav": "audio/wav",
|
|
15168
|
-
"weba": "audio/webm",
|
|
15169
|
-
"xm": "audio/xm",
|
|
15170
|
-
"ttc": "font/collection",
|
|
15171
|
-
"otf": "font/otf",
|
|
15172
|
-
"ttf": "font/ttf",
|
|
15173
|
-
"woff": "font/woff",
|
|
15174
|
-
"woff2": "font/woff2",
|
|
15175
|
-
"exr": "image/aces",
|
|
15176
|
-
"apng": "image/apng",
|
|
15177
|
-
"avif": "image/avif",
|
|
15178
|
-
"bmp": "image/bmp",
|
|
15179
|
-
"cgm": "image/cgm",
|
|
15180
|
-
"drle": "image/dicom-rle",
|
|
15181
|
-
"emf": "image/emf",
|
|
15182
|
-
"fits": "image/fits",
|
|
15183
|
-
"g3": "image/g3fax",
|
|
15184
|
-
"gif": "image/gif",
|
|
15185
|
-
"heic": "image/heic",
|
|
15186
|
-
"heics": "image/heic-sequence",
|
|
15187
|
-
"heif": "image/heif",
|
|
15188
|
-
"heifs": "image/heif-sequence",
|
|
15189
|
-
"hej2": "image/hej2k",
|
|
15190
|
-
"hsj2": "image/hsj2",
|
|
15191
|
-
"ief": "image/ief",
|
|
15192
|
-
"jls": "image/jls",
|
|
15193
|
-
"jp2": "image/jp2",
|
|
15194
|
-
"jpg2": "image/jp2",
|
|
15195
|
-
"jpeg": "image/jpeg",
|
|
15196
|
-
"jpg": "image/jpeg",
|
|
15197
|
-
"jpe": "image/jpeg",
|
|
15198
|
-
"jph": "image/jph",
|
|
15199
|
-
"jhc": "image/jphc",
|
|
15200
|
-
"jpm": "image/jpm",
|
|
15201
|
-
"jpx": "image/jpx",
|
|
15202
|
-
"jpf": "image/jpx",
|
|
15203
|
-
"jxr": "image/jxr",
|
|
15204
|
-
"jxra": "image/jxra",
|
|
15205
|
-
"jxrs": "image/jxrs",
|
|
15206
|
-
"jxs": "image/jxs",
|
|
15207
|
-
"jxsc": "image/jxsc",
|
|
15208
|
-
"jxsi": "image/jxsi",
|
|
15209
|
-
"jxss": "image/jxss",
|
|
15210
|
-
"ktx": "image/ktx",
|
|
15211
|
-
"ktx2": "image/ktx2",
|
|
15212
|
-
"png": "image/png",
|
|
15213
|
-
"btif": "image/prs.btif",
|
|
15214
|
-
"pti": "image/prs.pti",
|
|
15215
|
-
"sgi": "image/sgi",
|
|
15216
|
-
"svg": "image/svg+xml",
|
|
15217
|
-
"svgz": "image/svg+xml",
|
|
15218
|
-
"t38": "image/t38",
|
|
15219
|
-
"tif": "image/tiff",
|
|
15220
|
-
"tiff": "image/tiff",
|
|
15221
|
-
"tfx": "image/tiff-fx",
|
|
15222
|
-
"webp": "image/webp",
|
|
15223
|
-
"wmf": "image/wmf",
|
|
15224
|
-
"disposition-notification": "message/disposition-notification",
|
|
15225
|
-
"u8msg": "message/global",
|
|
15226
|
-
"u8dsn": "message/global-delivery-status",
|
|
15227
|
-
"u8mdn": "message/global-disposition-notification",
|
|
15228
|
-
"u8hdr": "message/global-headers",
|
|
15229
|
-
"eml": "message/rfc822",
|
|
15230
|
-
"mime": "message/rfc822",
|
|
15231
|
-
"3mf": "model/3mf",
|
|
15232
|
-
"gltf": "model/gltf+json",
|
|
15233
|
-
"glb": "model/gltf-binary",
|
|
15234
|
-
"igs": "model/iges",
|
|
15235
|
-
"iges": "model/iges",
|
|
15236
|
-
"msh": "model/mesh",
|
|
15237
|
-
"mesh": "model/mesh",
|
|
15238
|
-
"silo": "model/mesh",
|
|
15239
|
-
"mtl": "model/mtl",
|
|
15240
|
-
"obj": "model/obj",
|
|
15241
|
-
"stpz": "model/step+zip",
|
|
15242
|
-
"stpxz": "model/step-xml+zip",
|
|
15243
|
-
"stl": "model/stl",
|
|
15244
|
-
"wrl": "model/vrml",
|
|
15245
|
-
"vrml": "model/vrml",
|
|
15246
|
-
"x3db": "model/x3d+fastinfoset",
|
|
15247
|
-
"x3dbz": "model/x3d+binary",
|
|
15248
|
-
"x3dv": "model/x3d-vrml",
|
|
15249
|
-
"x3dvz": "model/x3d+vrml",
|
|
15250
|
-
"x3d": "model/x3d+xml",
|
|
15251
|
-
"x3dz": "model/x3d+xml",
|
|
15252
|
-
"appcache": "text/cache-manifest",
|
|
15253
|
-
"manifest": "text/cache-manifest",
|
|
15254
|
-
"ics": "text/calendar",
|
|
15255
|
-
"ifb": "text/calendar",
|
|
15256
|
-
"coffee": "text/coffeescript",
|
|
15257
|
-
"litcoffee": "text/coffeescript",
|
|
15258
|
-
"css": "text/css",
|
|
15259
|
-
"csv": "text/csv",
|
|
15260
|
-
"html": "text/html",
|
|
15261
|
-
"htm": "text/html",
|
|
15262
|
-
"shtml": "text/html",
|
|
15263
|
-
"jade": "text/jade",
|
|
15264
|
-
"jsx": "text/jsx",
|
|
15265
|
-
"less": "text/less",
|
|
15266
|
-
"markdown": "text/markdown",
|
|
15267
|
-
"md": "text/markdown",
|
|
15268
|
-
"mml": "text/mathml",
|
|
15269
|
-
"mdx": "text/mdx",
|
|
15270
|
-
"n3": "text/n3",
|
|
15271
|
-
"txt": "text/plain",
|
|
15272
|
-
"text": "text/plain",
|
|
15273
|
-
"conf": "text/plain",
|
|
15274
|
-
"def": "text/plain",
|
|
15275
|
-
"list": "text/plain",
|
|
15276
|
-
"log": "text/plain",
|
|
15277
|
-
"in": "text/plain",
|
|
15278
|
-
"ini": "text/plain",
|
|
15279
|
-
"dsc": "text/prs.lines.tag",
|
|
15280
|
-
"rtx": "text/richtext",
|
|
15281
|
-
"sgml": "text/sgml",
|
|
15282
|
-
"sgm": "text/sgml",
|
|
15283
|
-
"shex": "text/shex",
|
|
15284
|
-
"slim": "text/slim",
|
|
15285
|
-
"slm": "text/slim",
|
|
15286
|
-
"spdx": "text/spdx",
|
|
15287
|
-
"stylus": "text/stylus",
|
|
15288
|
-
"styl": "text/stylus",
|
|
15289
|
-
"tsv": "text/tab-separated-values",
|
|
15290
|
-
"t": "text/troff",
|
|
15291
|
-
"tr": "text/troff",
|
|
15292
|
-
"roff": "text/troff",
|
|
15293
|
-
"man": "text/troff",
|
|
15294
|
-
"me": "text/troff",
|
|
15295
|
-
"ms": "text/troff",
|
|
15296
|
-
"ttl": "text/turtle",
|
|
15297
|
-
"uri": "text/uri-list",
|
|
15298
|
-
"uris": "text/uri-list",
|
|
15299
|
-
"urls": "text/uri-list",
|
|
15300
|
-
"vcard": "text/vcard",
|
|
15301
|
-
"vtt": "text/vtt",
|
|
15302
|
-
"yaml": "text/yaml",
|
|
15303
|
-
"yml": "text/yaml",
|
|
15304
|
-
"3gp": "video/3gpp",
|
|
15305
|
-
"3g2": "video/3gpp2",
|
|
15306
|
-
"h261": "video/h261",
|
|
15307
|
-
"h263": "video/h263",
|
|
15308
|
-
"h264": "video/h264",
|
|
15309
|
-
"m4s": "video/iso.segment",
|
|
15310
|
-
"jpgv": "video/jpeg",
|
|
15311
|
-
"jpgm": "image/jpm",
|
|
15312
|
-
"mj2": "video/mj2",
|
|
15313
|
-
"mjp2": "video/mj2",
|
|
15314
|
-
"ts": "video/mp2t",
|
|
15315
|
-
"mp4": "video/mp4",
|
|
15316
|
-
"mp4v": "video/mp4",
|
|
15317
|
-
"mpg4": "video/mp4",
|
|
15318
|
-
"mpeg": "video/mpeg",
|
|
15319
|
-
"mpg": "video/mpeg",
|
|
15320
|
-
"mpe": "video/mpeg",
|
|
15321
|
-
"m1v": "video/mpeg",
|
|
15322
|
-
"m2v": "video/mpeg",
|
|
15323
|
-
"ogv": "video/ogg",
|
|
15324
|
-
"qt": "video/quicktime",
|
|
15325
|
-
"mov": "video/quicktime",
|
|
15326
|
-
"webm": "video/webm"
|
|
15327
|
-
};
|
|
15328
|
-
|
|
15329
|
-
function lookup(extn) {
|
|
15330
|
-
let tmp = ('' + extn).trim().toLowerCase();
|
|
15331
|
-
let idx = tmp.lastIndexOf('.');
|
|
15332
|
-
return mimes$1[!~idx ? tmp : tmp.substring(++idx)];
|
|
15333
|
-
}
|
|
15334
|
-
|
|
15335
|
-
class BitSet {
|
|
15336
|
-
constructor(arg) {
|
|
15337
|
-
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
15338
|
-
}
|
|
15339
|
-
|
|
15340
|
-
add(n) {
|
|
15341
|
-
this.bits[n >> 5] |= 1 << (n & 31);
|
|
15342
|
-
}
|
|
15343
|
-
|
|
15344
|
-
has(n) {
|
|
15345
|
-
return !!(this.bits[n >> 5] & (1 << (n & 31)));
|
|
15346
|
-
}
|
|
15347
|
-
}
|
|
15348
|
-
|
|
15349
|
-
class Chunk {
|
|
15350
|
-
constructor(start, end, content) {
|
|
15351
|
-
this.start = start;
|
|
15352
|
-
this.end = end;
|
|
15353
|
-
this.original = content;
|
|
15354
|
-
|
|
15355
|
-
this.intro = '';
|
|
15356
|
-
this.outro = '';
|
|
15357
|
-
|
|
15358
|
-
this.content = content;
|
|
15359
|
-
this.storeName = false;
|
|
15360
|
-
this.edited = false;
|
|
15361
|
-
|
|
15362
|
-
{
|
|
15363
|
-
this.previous = null;
|
|
15364
|
-
this.next = null;
|
|
15365
|
-
}
|
|
15366
|
-
}
|
|
15367
|
-
|
|
15368
|
-
appendLeft(content) {
|
|
15369
|
-
this.outro += content;
|
|
15370
|
-
}
|
|
15371
|
-
|
|
15372
|
-
appendRight(content) {
|
|
15373
|
-
this.intro = this.intro + content;
|
|
15374
|
-
}
|
|
15375
|
-
|
|
15376
|
-
clone() {
|
|
15377
|
-
const chunk = new Chunk(this.start, this.end, this.original);
|
|
15378
|
-
|
|
15379
|
-
chunk.intro = this.intro;
|
|
15380
|
-
chunk.outro = this.outro;
|
|
15381
|
-
chunk.content = this.content;
|
|
15382
|
-
chunk.storeName = this.storeName;
|
|
15383
|
-
chunk.edited = this.edited;
|
|
15384
|
-
|
|
15385
|
-
return chunk;
|
|
15386
|
-
}
|
|
15387
|
-
|
|
15388
|
-
contains(index) {
|
|
15389
|
-
return this.start < index && index < this.end;
|
|
15390
|
-
}
|
|
15391
|
-
|
|
15392
|
-
eachNext(fn) {
|
|
15393
|
-
let chunk = this;
|
|
15394
|
-
while (chunk) {
|
|
15395
|
-
fn(chunk);
|
|
15396
|
-
chunk = chunk.next;
|
|
15397
|
-
}
|
|
15398
|
-
}
|
|
15399
|
-
|
|
15400
|
-
eachPrevious(fn) {
|
|
15401
|
-
let chunk = this;
|
|
15402
|
-
while (chunk) {
|
|
15403
|
-
fn(chunk);
|
|
15404
|
-
chunk = chunk.previous;
|
|
15405
|
-
}
|
|
15406
|
-
}
|
|
15407
|
-
|
|
15408
|
-
edit(content, storeName, contentOnly) {
|
|
15409
|
-
this.content = content;
|
|
15410
|
-
if (!contentOnly) {
|
|
15411
|
-
this.intro = '';
|
|
15412
|
-
this.outro = '';
|
|
15413
|
-
}
|
|
15414
|
-
this.storeName = storeName;
|
|
15415
|
-
|
|
15416
|
-
this.edited = true;
|
|
15417
|
-
|
|
15418
|
-
return this;
|
|
15419
|
-
}
|
|
15420
|
-
|
|
15421
|
-
prependLeft(content) {
|
|
15422
|
-
this.outro = content + this.outro;
|
|
15423
|
-
}
|
|
15424
|
-
|
|
15425
|
-
prependRight(content) {
|
|
15426
|
-
this.intro = content + this.intro;
|
|
15427
|
-
}
|
|
15428
|
-
|
|
15429
|
-
split(index) {
|
|
15430
|
-
const sliceIndex = index - this.start;
|
|
15431
|
-
|
|
15432
|
-
const originalBefore = this.original.slice(0, sliceIndex);
|
|
15433
|
-
const originalAfter = this.original.slice(sliceIndex);
|
|
15434
|
-
|
|
15435
|
-
this.original = originalBefore;
|
|
15436
|
-
|
|
15437
|
-
const newChunk = new Chunk(index, this.end, originalAfter);
|
|
15438
|
-
newChunk.outro = this.outro;
|
|
15439
|
-
this.outro = '';
|
|
15440
|
-
|
|
15441
|
-
this.end = index;
|
|
15442
|
-
|
|
15443
|
-
if (this.edited) {
|
|
15444
|
-
// after split we should save the edit content record into the correct chunk
|
|
15445
|
-
// to make sure sourcemap correct
|
|
15446
|
-
// For example:
|
|
15447
|
-
// ' test'.trim()
|
|
15448
|
-
// split -> ' ' + 'test'
|
|
15449
|
-
// ✔️ edit -> '' + 'test'
|
|
15450
|
-
// ✖️ edit -> 'test' + ''
|
|
15451
|
-
// TODO is this block necessary?...
|
|
15452
|
-
newChunk.edit('', false);
|
|
15453
|
-
this.content = '';
|
|
15454
|
-
} else {
|
|
15455
|
-
this.content = originalBefore;
|
|
15456
|
-
}
|
|
15457
|
-
|
|
15458
|
-
newChunk.next = this.next;
|
|
15459
|
-
if (newChunk.next) newChunk.next.previous = newChunk;
|
|
15460
|
-
newChunk.previous = this;
|
|
15461
|
-
this.next = newChunk;
|
|
15462
|
-
|
|
15463
|
-
return newChunk;
|
|
15464
|
-
}
|
|
15465
|
-
|
|
15466
|
-
toString() {
|
|
15467
|
-
return this.intro + this.content + this.outro;
|
|
15468
|
-
}
|
|
15469
|
-
|
|
15470
|
-
trimEnd(rx) {
|
|
15471
|
-
this.outro = this.outro.replace(rx, '');
|
|
15472
|
-
if (this.outro.length) return true;
|
|
15473
|
-
|
|
15474
|
-
const trimmed = this.content.replace(rx, '');
|
|
15475
|
-
|
|
15476
|
-
if (trimmed.length) {
|
|
15477
|
-
if (trimmed !== this.content) {
|
|
15478
|
-
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
15479
|
-
if (this.edited) {
|
|
15480
|
-
// save the change, if it has been edited
|
|
15481
|
-
this.edit(trimmed, this.storeName, true);
|
|
15482
|
-
}
|
|
15483
|
-
}
|
|
15484
|
-
return true;
|
|
15485
|
-
} else {
|
|
15486
|
-
this.edit('', undefined, true);
|
|
15487
|
-
|
|
15488
|
-
this.intro = this.intro.replace(rx, '');
|
|
15489
|
-
if (this.intro.length) return true;
|
|
15490
|
-
}
|
|
15491
|
-
}
|
|
15492
|
-
|
|
15493
|
-
trimStart(rx) {
|
|
15494
|
-
this.intro = this.intro.replace(rx, '');
|
|
15495
|
-
if (this.intro.length) return true;
|
|
15496
|
-
|
|
15497
|
-
const trimmed = this.content.replace(rx, '');
|
|
15498
|
-
|
|
15499
|
-
if (trimmed.length) {
|
|
15500
|
-
if (trimmed !== this.content) {
|
|
15501
|
-
const newChunk = this.split(this.end - trimmed.length);
|
|
15502
|
-
if (this.edited) {
|
|
15503
|
-
// save the change, if it has been edited
|
|
15504
|
-
newChunk.edit(trimmed, this.storeName, true);
|
|
15505
|
-
}
|
|
15506
|
-
this.edit('', undefined, true);
|
|
15507
|
-
}
|
|
15508
|
-
return true;
|
|
15509
|
-
} else {
|
|
15510
|
-
this.edit('', undefined, true);
|
|
15511
|
-
|
|
15512
|
-
this.outro = this.outro.replace(rx, '');
|
|
15513
|
-
if (this.outro.length) return true;
|
|
15514
|
-
}
|
|
15515
|
-
}
|
|
15516
|
-
}
|
|
15517
|
-
|
|
15518
|
-
function getBtoa() {
|
|
15519
|
-
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
|
|
15520
|
-
return (str) => window.btoa(unescape(encodeURIComponent(str)));
|
|
15521
|
-
} else if (typeof Buffer === 'function') {
|
|
15522
|
-
return (str) => Buffer.from(str, 'utf-8').toString('base64');
|
|
15523
|
-
} else {
|
|
15524
|
-
return () => {
|
|
15525
|
-
throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
|
|
15526
|
-
};
|
|
15527
|
-
}
|
|
15528
|
-
}
|
|
15529
|
-
|
|
15530
|
-
const btoa$1 = /*#__PURE__*/ getBtoa();
|
|
15531
|
-
|
|
15532
|
-
class SourceMap {
|
|
15533
|
-
constructor(properties) {
|
|
15534
|
-
this.version = 3;
|
|
15535
|
-
this.file = properties.file;
|
|
15536
|
-
this.sources = properties.sources;
|
|
15537
|
-
this.sourcesContent = properties.sourcesContent;
|
|
15538
|
-
this.names = properties.names;
|
|
15539
|
-
this.mappings = encode$1(properties.mappings);
|
|
15540
|
-
if (typeof properties.x_google_ignoreList !== 'undefined') {
|
|
15541
|
-
this.x_google_ignoreList = properties.x_google_ignoreList;
|
|
15542
|
-
}
|
|
15543
|
-
}
|
|
15544
|
-
|
|
15545
|
-
toString() {
|
|
15546
|
-
return JSON.stringify(this);
|
|
15547
|
-
}
|
|
15548
|
-
|
|
15549
|
-
toUrl() {
|
|
15550
|
-
return 'data:application/json;charset=utf-8;base64,' + btoa$1(this.toString());
|
|
15551
|
-
}
|
|
15552
|
-
}
|
|
15553
|
-
|
|
15554
|
-
function guessIndent(code) {
|
|
15555
|
-
const lines = code.split('\n');
|
|
15556
|
-
|
|
15557
|
-
const tabbed = lines.filter((line) => /^\t+/.test(line));
|
|
15558
|
-
const spaced = lines.filter((line) => /^ {2,}/.test(line));
|
|
15559
|
-
|
|
15560
|
-
if (tabbed.length === 0 && spaced.length === 0) {
|
|
15561
|
-
return null;
|
|
15562
|
-
}
|
|
15563
|
-
|
|
15564
|
-
// More lines tabbed than spaced? Assume tabs, and
|
|
15565
|
-
// default to tabs in the case of a tie (or nothing
|
|
15566
|
-
// to go on)
|
|
15567
|
-
if (tabbed.length >= spaced.length) {
|
|
15568
|
-
return '\t';
|
|
15569
|
-
}
|
|
15570
|
-
|
|
15571
|
-
// Otherwise, we need to guess the multiple
|
|
15572
|
-
const min = spaced.reduce((previous, current) => {
|
|
15573
|
-
const numSpaces = /^ +/.exec(current)[0].length;
|
|
15574
|
-
return Math.min(numSpaces, previous);
|
|
15575
|
-
}, Infinity);
|
|
15576
|
-
|
|
15577
|
-
return new Array(min + 1).join(' ');
|
|
15578
|
-
}
|
|
15579
|
-
|
|
15580
|
-
function getRelativePath(from, to) {
|
|
15581
|
-
const fromParts = from.split(/[/\\]/);
|
|
15582
|
-
const toParts = to.split(/[/\\]/);
|
|
15583
|
-
|
|
15584
|
-
fromParts.pop(); // get dirname
|
|
15585
|
-
|
|
15586
|
-
while (fromParts[0] === toParts[0]) {
|
|
15587
|
-
fromParts.shift();
|
|
15588
|
-
toParts.shift();
|
|
15589
|
-
}
|
|
15590
|
-
|
|
15591
|
-
if (fromParts.length) {
|
|
15592
|
-
let i = fromParts.length;
|
|
15593
|
-
while (i--) fromParts[i] = '..';
|
|
15594
|
-
}
|
|
15595
|
-
|
|
15596
|
-
return fromParts.concat(toParts).join('/');
|
|
15597
|
-
}
|
|
15598
|
-
|
|
15599
|
-
const toString$2 = Object.prototype.toString;
|
|
15600
|
-
|
|
15601
|
-
function isObject$1(thing) {
|
|
15602
|
-
return toString$2.call(thing) === '[object Object]';
|
|
15603
|
-
}
|
|
15604
|
-
|
|
15605
|
-
function getLocator(source) {
|
|
15606
|
-
const originalLines = source.split('\n');
|
|
15607
|
-
const lineOffsets = [];
|
|
15608
|
-
|
|
15609
|
-
for (let i = 0, pos = 0; i < originalLines.length; i++) {
|
|
15610
|
-
lineOffsets.push(pos);
|
|
15611
|
-
pos += originalLines[i].length + 1;
|
|
15612
|
-
}
|
|
15613
|
-
|
|
15614
|
-
return function locate(index) {
|
|
15615
|
-
let i = 0;
|
|
15616
|
-
let j = lineOffsets.length;
|
|
15617
|
-
while (i < j) {
|
|
15618
|
-
const m = (i + j) >> 1;
|
|
15619
|
-
if (index < lineOffsets[m]) {
|
|
15620
|
-
j = m;
|
|
15621
|
-
} else {
|
|
15622
|
-
i = m + 1;
|
|
15623
|
-
}
|
|
15624
|
-
}
|
|
15625
|
-
const line = i - 1;
|
|
15626
|
-
const column = index - lineOffsets[line];
|
|
15627
|
-
return { line, column };
|
|
15628
|
-
};
|
|
15629
|
-
}
|
|
15630
|
-
|
|
15631
|
-
const wordRegex = /\w/;
|
|
15632
|
-
|
|
15633
|
-
class Mappings {
|
|
15634
|
-
constructor(hires) {
|
|
15635
|
-
this.hires = hires;
|
|
15636
|
-
this.generatedCodeLine = 0;
|
|
15637
|
-
this.generatedCodeColumn = 0;
|
|
15638
|
-
this.raw = [];
|
|
15639
|
-
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
15640
|
-
this.pending = null;
|
|
15641
|
-
}
|
|
15642
|
-
|
|
15643
|
-
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
15644
|
-
if (content.length) {
|
|
15645
|
-
let contentLineEnd = content.indexOf('\n', 0);
|
|
15646
|
-
let previousContentLineEnd = -1;
|
|
15647
|
-
while (contentLineEnd >= 0) {
|
|
15648
|
-
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
15649
|
-
if (nameIndex >= 0) {
|
|
15650
|
-
segment.push(nameIndex);
|
|
15651
|
-
}
|
|
15652
|
-
this.rawSegments.push(segment);
|
|
15653
|
-
|
|
15654
|
-
this.generatedCodeLine += 1;
|
|
15655
|
-
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
15656
|
-
this.generatedCodeColumn = 0;
|
|
15657
|
-
|
|
15658
|
-
previousContentLineEnd = contentLineEnd;
|
|
15659
|
-
contentLineEnd = content.indexOf('\n', contentLineEnd + 1);
|
|
15660
|
-
}
|
|
15661
|
-
|
|
15662
|
-
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
15663
|
-
if (nameIndex >= 0) {
|
|
15664
|
-
segment.push(nameIndex);
|
|
15665
|
-
}
|
|
15666
|
-
this.rawSegments.push(segment);
|
|
15667
|
-
|
|
15668
|
-
this.advance(content.slice(previousContentLineEnd + 1));
|
|
15669
|
-
} else if (this.pending) {
|
|
15670
|
-
this.rawSegments.push(this.pending);
|
|
15671
|
-
this.advance(content);
|
|
15672
|
-
}
|
|
15673
|
-
|
|
15674
|
-
this.pending = null;
|
|
15675
|
-
}
|
|
15676
|
-
|
|
15677
|
-
addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
15678
|
-
let originalCharIndex = chunk.start;
|
|
15679
|
-
let first = true;
|
|
15680
|
-
// when iterating each char, check if it's in a word boundary
|
|
15681
|
-
let charInHiresBoundary = false;
|
|
15682
|
-
|
|
15683
|
-
while (originalCharIndex < chunk.end) {
|
|
15684
|
-
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
|
|
15685
|
-
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
15686
|
-
|
|
15687
|
-
if (this.hires === 'boundary') {
|
|
15688
|
-
// in hires "boundary", group segments per word boundary than per char
|
|
15689
|
-
if (wordRegex.test(original[originalCharIndex])) {
|
|
15690
|
-
// for first char in the boundary found, start the boundary by pushing a segment
|
|
15691
|
-
if (!charInHiresBoundary) {
|
|
15692
|
-
this.rawSegments.push(segment);
|
|
15693
|
-
charInHiresBoundary = true;
|
|
15694
|
-
}
|
|
15695
|
-
} else {
|
|
15696
|
-
// for non-word char, end the boundary by pushing a segment
|
|
15697
|
-
this.rawSegments.push(segment);
|
|
15698
|
-
charInHiresBoundary = false;
|
|
15699
|
-
}
|
|
15700
|
-
} else {
|
|
15701
|
-
this.rawSegments.push(segment);
|
|
15702
|
-
}
|
|
15703
|
-
}
|
|
15704
|
-
|
|
15705
|
-
if (original[originalCharIndex] === '\n') {
|
|
15706
|
-
loc.line += 1;
|
|
15707
|
-
loc.column = 0;
|
|
15708
|
-
this.generatedCodeLine += 1;
|
|
15709
|
-
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
15710
|
-
this.generatedCodeColumn = 0;
|
|
15711
|
-
first = true;
|
|
15712
|
-
} else {
|
|
15713
|
-
loc.column += 1;
|
|
15714
|
-
this.generatedCodeColumn += 1;
|
|
15715
|
-
first = false;
|
|
15716
|
-
}
|
|
15717
|
-
|
|
15718
|
-
originalCharIndex += 1;
|
|
15719
|
-
}
|
|
15720
|
-
|
|
15721
|
-
this.pending = null;
|
|
15722
|
-
}
|
|
15723
|
-
|
|
15724
|
-
advance(str) {
|
|
15725
|
-
if (!str) return;
|
|
15726
|
-
|
|
15727
|
-
const lines = str.split('\n');
|
|
15728
|
-
|
|
15729
|
-
if (lines.length > 1) {
|
|
15730
|
-
for (let i = 0; i < lines.length - 1; i++) {
|
|
15731
|
-
this.generatedCodeLine++;
|
|
15732
|
-
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
15733
|
-
}
|
|
15734
|
-
this.generatedCodeColumn = 0;
|
|
15735
|
-
}
|
|
15736
|
-
|
|
15737
|
-
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
15738
|
-
}
|
|
15739
|
-
}
|
|
15740
|
-
|
|
15741
|
-
const n$1 = '\n';
|
|
15742
|
-
|
|
15743
|
-
const warned = {
|
|
15744
|
-
insertLeft: false,
|
|
15745
|
-
insertRight: false,
|
|
15746
|
-
storeName: false,
|
|
15747
|
-
};
|
|
15748
|
-
|
|
15749
|
-
class MagicString {
|
|
15750
|
-
constructor(string, options = {}) {
|
|
15751
|
-
const chunk = new Chunk(0, string.length, string);
|
|
15752
|
-
|
|
15753
|
-
Object.defineProperties(this, {
|
|
15754
|
-
original: { writable: true, value: string },
|
|
15755
|
-
outro: { writable: true, value: '' },
|
|
15756
|
-
intro: { writable: true, value: '' },
|
|
15757
|
-
firstChunk: { writable: true, value: chunk },
|
|
15758
|
-
lastChunk: { writable: true, value: chunk },
|
|
15759
|
-
lastSearchedChunk: { writable: true, value: chunk },
|
|
15760
|
-
byStart: { writable: true, value: {} },
|
|
15761
|
-
byEnd: { writable: true, value: {} },
|
|
15762
|
-
filename: { writable: true, value: options.filename },
|
|
15763
|
-
indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
|
|
15764
|
-
sourcemapLocations: { writable: true, value: new BitSet() },
|
|
15765
|
-
storedNames: { writable: true, value: {} },
|
|
15766
|
-
indentStr: { writable: true, value: undefined },
|
|
15767
|
-
ignoreList: { writable: true, value: options.ignoreList },
|
|
15768
|
-
});
|
|
15769
|
-
|
|
15770
|
-
this.byStart[0] = chunk;
|
|
15771
|
-
this.byEnd[string.length] = chunk;
|
|
15772
|
-
}
|
|
15773
|
-
|
|
15774
|
-
addSourcemapLocation(char) {
|
|
15775
|
-
this.sourcemapLocations.add(char);
|
|
15776
|
-
}
|
|
15777
|
-
|
|
15778
|
-
append(content) {
|
|
15779
|
-
if (typeof content !== 'string') throw new TypeError('outro content must be a string');
|
|
15780
|
-
|
|
15781
|
-
this.outro += content;
|
|
15782
|
-
return this;
|
|
15783
|
-
}
|
|
15784
|
-
|
|
15785
|
-
appendLeft(index, content) {
|
|
15786
|
-
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
15787
|
-
|
|
15788
|
-
this._split(index);
|
|
15789
|
-
|
|
15790
|
-
const chunk = this.byEnd[index];
|
|
15791
|
-
|
|
15792
|
-
if (chunk) {
|
|
15793
|
-
chunk.appendLeft(content);
|
|
15794
|
-
} else {
|
|
15795
|
-
this.intro += content;
|
|
15796
|
-
}
|
|
15797
|
-
return this;
|
|
15798
|
-
}
|
|
15799
|
-
|
|
15800
|
-
appendRight(index, content) {
|
|
15801
|
-
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
15802
|
-
|
|
15803
|
-
this._split(index);
|
|
15804
|
-
|
|
15805
|
-
const chunk = this.byStart[index];
|
|
15806
|
-
|
|
15807
|
-
if (chunk) {
|
|
15808
|
-
chunk.appendRight(content);
|
|
15809
|
-
} else {
|
|
15810
|
-
this.outro += content;
|
|
15811
|
-
}
|
|
15812
|
-
return this;
|
|
15813
|
-
}
|
|
15814
|
-
|
|
15815
|
-
clone() {
|
|
15816
|
-
const cloned = new MagicString(this.original, { filename: this.filename });
|
|
15817
|
-
|
|
15818
|
-
let originalChunk = this.firstChunk;
|
|
15819
|
-
let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
|
|
15820
|
-
|
|
15821
|
-
while (originalChunk) {
|
|
15822
|
-
cloned.byStart[clonedChunk.start] = clonedChunk;
|
|
15823
|
-
cloned.byEnd[clonedChunk.end] = clonedChunk;
|
|
15824
|
-
|
|
15825
|
-
const nextOriginalChunk = originalChunk.next;
|
|
15826
|
-
const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
|
|
15827
|
-
|
|
15828
|
-
if (nextClonedChunk) {
|
|
15829
|
-
clonedChunk.next = nextClonedChunk;
|
|
15830
|
-
nextClonedChunk.previous = clonedChunk;
|
|
15831
|
-
|
|
15832
|
-
clonedChunk = nextClonedChunk;
|
|
15833
|
-
}
|
|
15834
|
-
|
|
15835
|
-
originalChunk = nextOriginalChunk;
|
|
15836
|
-
}
|
|
15837
|
-
|
|
15838
|
-
cloned.lastChunk = clonedChunk;
|
|
15839
|
-
|
|
15840
|
-
if (this.indentExclusionRanges) {
|
|
15841
|
-
cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
|
|
15842
|
-
}
|
|
15843
|
-
|
|
15844
|
-
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
|
|
15845
|
-
|
|
15846
|
-
cloned.intro = this.intro;
|
|
15847
|
-
cloned.outro = this.outro;
|
|
15848
|
-
|
|
15849
|
-
return cloned;
|
|
15850
|
-
}
|
|
15851
|
-
|
|
15852
|
-
generateDecodedMap(options) {
|
|
15853
|
-
options = options || {};
|
|
15854
|
-
|
|
15855
|
-
const sourceIndex = 0;
|
|
15856
|
-
const names = Object.keys(this.storedNames);
|
|
15857
|
-
const mappings = new Mappings(options.hires);
|
|
15858
|
-
|
|
15859
|
-
const locate = getLocator(this.original);
|
|
15860
|
-
|
|
15861
|
-
if (this.intro) {
|
|
15862
|
-
mappings.advance(this.intro);
|
|
15863
|
-
}
|
|
15864
|
-
|
|
15865
|
-
this.firstChunk.eachNext((chunk) => {
|
|
15866
|
-
const loc = locate(chunk.start);
|
|
15867
|
-
|
|
15868
|
-
if (chunk.intro.length) mappings.advance(chunk.intro);
|
|
15869
|
-
|
|
15870
|
-
if (chunk.edited) {
|
|
15871
|
-
mappings.addEdit(
|
|
15872
|
-
sourceIndex,
|
|
15873
|
-
chunk.content,
|
|
15874
|
-
loc,
|
|
15875
|
-
chunk.storeName ? names.indexOf(chunk.original) : -1,
|
|
15876
|
-
);
|
|
15877
|
-
} else {
|
|
15878
|
-
mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
|
|
15879
|
-
}
|
|
15880
|
-
|
|
15881
|
-
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
15882
|
-
});
|
|
15883
|
-
|
|
15884
|
-
return {
|
|
15885
|
-
file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
|
|
15886
|
-
sources: [
|
|
15887
|
-
options.source ? getRelativePath(options.file || '', options.source) : options.file || '',
|
|
15888
|
-
],
|
|
15889
|
-
sourcesContent: options.includeContent ? [this.original] : undefined,
|
|
15890
|
-
names,
|
|
15891
|
-
mappings: mappings.raw,
|
|
15892
|
-
x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,
|
|
15893
|
-
};
|
|
15894
|
-
}
|
|
15895
|
-
|
|
15896
|
-
generateMap(options) {
|
|
15897
|
-
return new SourceMap(this.generateDecodedMap(options));
|
|
15898
|
-
}
|
|
15899
|
-
|
|
15900
|
-
_ensureindentStr() {
|
|
15901
|
-
if (this.indentStr === undefined) {
|
|
15902
|
-
this.indentStr = guessIndent(this.original);
|
|
15903
|
-
}
|
|
15904
|
-
}
|
|
15905
|
-
|
|
15906
|
-
_getRawIndentString() {
|
|
15907
|
-
this._ensureindentStr();
|
|
15908
|
-
return this.indentStr;
|
|
15909
|
-
}
|
|
15910
|
-
|
|
15911
|
-
getIndentString() {
|
|
15912
|
-
this._ensureindentStr();
|
|
15913
|
-
return this.indentStr === null ? '\t' : this.indentStr;
|
|
15914
|
-
}
|
|
15915
|
-
|
|
15916
|
-
indent(indentStr, options) {
|
|
15917
|
-
const pattern = /^[^\r\n]/gm;
|
|
15918
|
-
|
|
15919
|
-
if (isObject$1(indentStr)) {
|
|
15920
|
-
options = indentStr;
|
|
15921
|
-
indentStr = undefined;
|
|
15922
|
-
}
|
|
15923
|
-
|
|
15924
|
-
if (indentStr === undefined) {
|
|
15925
|
-
this._ensureindentStr();
|
|
15926
|
-
indentStr = this.indentStr || '\t';
|
|
15927
|
-
}
|
|
15928
|
-
|
|
15929
|
-
if (indentStr === '') return this; // noop
|
|
15930
|
-
|
|
15931
|
-
options = options || {};
|
|
15932
|
-
|
|
15933
|
-
// Process exclusion ranges
|
|
15934
|
-
const isExcluded = {};
|
|
15935
|
-
|
|
15936
|
-
if (options.exclude) {
|
|
15937
|
-
const exclusions =
|
|
15938
|
-
typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
|
|
15939
|
-
exclusions.forEach((exclusion) => {
|
|
15940
|
-
for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
|
|
15941
|
-
isExcluded[i] = true;
|
|
15942
|
-
}
|
|
15943
|
-
});
|
|
15944
|
-
}
|
|
15945
|
-
|
|
15946
|
-
let shouldIndentNextCharacter = options.indentStart !== false;
|
|
15947
|
-
const replacer = (match) => {
|
|
15948
|
-
if (shouldIndentNextCharacter) return `${indentStr}${match}`;
|
|
15949
|
-
shouldIndentNextCharacter = true;
|
|
15950
|
-
return match;
|
|
15951
|
-
};
|
|
15952
|
-
|
|
15953
|
-
this.intro = this.intro.replace(pattern, replacer);
|
|
15954
|
-
|
|
15955
|
-
let charIndex = 0;
|
|
15956
|
-
let chunk = this.firstChunk;
|
|
15957
|
-
|
|
15958
|
-
while (chunk) {
|
|
15959
|
-
const end = chunk.end;
|
|
15960
|
-
|
|
15961
|
-
if (chunk.edited) {
|
|
15962
|
-
if (!isExcluded[charIndex]) {
|
|
15963
|
-
chunk.content = chunk.content.replace(pattern, replacer);
|
|
15964
|
-
|
|
15965
|
-
if (chunk.content.length) {
|
|
15966
|
-
shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
|
|
15967
|
-
}
|
|
15968
|
-
}
|
|
15969
|
-
} else {
|
|
15970
|
-
charIndex = chunk.start;
|
|
15971
|
-
|
|
15972
|
-
while (charIndex < end) {
|
|
15973
|
-
if (!isExcluded[charIndex]) {
|
|
15974
|
-
const char = this.original[charIndex];
|
|
15975
|
-
|
|
15976
|
-
if (char === '\n') {
|
|
15977
|
-
shouldIndentNextCharacter = true;
|
|
15978
|
-
} else if (char !== '\r' && shouldIndentNextCharacter) {
|
|
15979
|
-
shouldIndentNextCharacter = false;
|
|
15980
|
-
|
|
15981
|
-
if (charIndex === chunk.start) {
|
|
15982
|
-
chunk.prependRight(indentStr);
|
|
15983
|
-
} else {
|
|
15984
|
-
this._splitChunk(chunk, charIndex);
|
|
15985
|
-
chunk = chunk.next;
|
|
15986
|
-
chunk.prependRight(indentStr);
|
|
15987
|
-
}
|
|
15988
|
-
}
|
|
15989
|
-
}
|
|
15990
|
-
|
|
15991
|
-
charIndex += 1;
|
|
15992
|
-
}
|
|
15993
|
-
}
|
|
15994
|
-
|
|
15995
|
-
charIndex = chunk.end;
|
|
15996
|
-
chunk = chunk.next;
|
|
15997
|
-
}
|
|
15998
|
-
|
|
15999
|
-
this.outro = this.outro.replace(pattern, replacer);
|
|
16000
|
-
|
|
16001
|
-
return this;
|
|
16002
|
-
}
|
|
16003
|
-
|
|
16004
|
-
insert() {
|
|
16005
|
-
throw new Error(
|
|
16006
|
-
'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',
|
|
16007
|
-
);
|
|
16008
|
-
}
|
|
16009
|
-
|
|
16010
|
-
insertLeft(index, content) {
|
|
16011
|
-
if (!warned.insertLeft) {
|
|
16012
|
-
console.warn(
|
|
16013
|
-
'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',
|
|
16014
|
-
); // eslint-disable-line no-console
|
|
16015
|
-
warned.insertLeft = true;
|
|
16016
|
-
}
|
|
16017
|
-
|
|
16018
|
-
return this.appendLeft(index, content);
|
|
16019
|
-
}
|
|
16020
|
-
|
|
16021
|
-
insertRight(index, content) {
|
|
16022
|
-
if (!warned.insertRight) {
|
|
16023
|
-
console.warn(
|
|
16024
|
-
'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',
|
|
16025
|
-
); // eslint-disable-line no-console
|
|
16026
|
-
warned.insertRight = true;
|
|
16027
|
-
}
|
|
16028
|
-
|
|
16029
|
-
return this.prependRight(index, content);
|
|
16030
|
-
}
|
|
16031
|
-
|
|
16032
|
-
move(start, end, index) {
|
|
16033
|
-
if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');
|
|
16034
|
-
|
|
16035
|
-
this._split(start);
|
|
16036
|
-
this._split(end);
|
|
16037
|
-
this._split(index);
|
|
16038
|
-
|
|
16039
|
-
const first = this.byStart[start];
|
|
16040
|
-
const last = this.byEnd[end];
|
|
16041
|
-
|
|
16042
|
-
const oldLeft = first.previous;
|
|
16043
|
-
const oldRight = last.next;
|
|
16044
|
-
|
|
16045
|
-
const newRight = this.byStart[index];
|
|
16046
|
-
if (!newRight && last === this.lastChunk) return this;
|
|
16047
|
-
const newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
16048
|
-
|
|
16049
|
-
if (oldLeft) oldLeft.next = oldRight;
|
|
16050
|
-
if (oldRight) oldRight.previous = oldLeft;
|
|
16051
|
-
|
|
16052
|
-
if (newLeft) newLeft.next = first;
|
|
16053
|
-
if (newRight) newRight.previous = last;
|
|
16054
|
-
|
|
16055
|
-
if (!first.previous) this.firstChunk = last.next;
|
|
16056
|
-
if (!last.next) {
|
|
16057
|
-
this.lastChunk = first.previous;
|
|
16058
|
-
this.lastChunk.next = null;
|
|
16059
|
-
}
|
|
16060
|
-
|
|
16061
|
-
first.previous = newLeft;
|
|
16062
|
-
last.next = newRight || null;
|
|
16063
|
-
|
|
16064
|
-
if (!newLeft) this.firstChunk = first;
|
|
16065
|
-
if (!newRight) this.lastChunk = last;
|
|
16066
|
-
return this;
|
|
16067
|
-
}
|
|
16068
|
-
|
|
16069
|
-
overwrite(start, end, content, options) {
|
|
16070
|
-
options = options || {};
|
|
16071
|
-
return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
|
|
16072
|
-
}
|
|
16073
|
-
|
|
16074
|
-
update(start, end, content, options) {
|
|
16075
|
-
if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
|
|
16076
|
-
|
|
16077
|
-
while (start < 0) start += this.original.length;
|
|
16078
|
-
while (end < 0) end += this.original.length;
|
|
16079
|
-
|
|
16080
|
-
if (end > this.original.length) throw new Error('end is out of bounds');
|
|
16081
|
-
if (start === end)
|
|
16082
|
-
throw new Error(
|
|
16083
|
-
'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',
|
|
16084
|
-
);
|
|
16085
|
-
|
|
16086
|
-
this._split(start);
|
|
16087
|
-
this._split(end);
|
|
16088
|
-
|
|
16089
|
-
if (options === true) {
|
|
16090
|
-
if (!warned.storeName) {
|
|
16091
|
-
console.warn(
|
|
16092
|
-
'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',
|
|
16093
|
-
); // eslint-disable-line no-console
|
|
16094
|
-
warned.storeName = true;
|
|
16095
|
-
}
|
|
16096
|
-
|
|
16097
|
-
options = { storeName: true };
|
|
16098
|
-
}
|
|
16099
|
-
const storeName = options !== undefined ? options.storeName : false;
|
|
16100
|
-
const overwrite = options !== undefined ? options.overwrite : false;
|
|
16101
|
-
|
|
16102
|
-
if (storeName) {
|
|
16103
|
-
const original = this.original.slice(start, end);
|
|
16104
|
-
Object.defineProperty(this.storedNames, original, {
|
|
16105
|
-
writable: true,
|
|
16106
|
-
value: true,
|
|
16107
|
-
enumerable: true,
|
|
16108
|
-
});
|
|
16109
|
-
}
|
|
16110
|
-
|
|
16111
|
-
const first = this.byStart[start];
|
|
16112
|
-
const last = this.byEnd[end];
|
|
16113
|
-
|
|
16114
|
-
if (first) {
|
|
16115
|
-
let chunk = first;
|
|
16116
|
-
while (chunk !== last) {
|
|
16117
|
-
if (chunk.next !== this.byStart[chunk.end]) {
|
|
16118
|
-
throw new Error('Cannot overwrite across a split point');
|
|
16119
|
-
}
|
|
16120
|
-
chunk = chunk.next;
|
|
16121
|
-
chunk.edit('', false);
|
|
16122
|
-
}
|
|
16123
|
-
|
|
16124
|
-
first.edit(content, storeName, !overwrite);
|
|
16125
|
-
} else {
|
|
16126
|
-
// must be inserting at the end
|
|
16127
|
-
const newChunk = new Chunk(start, end, '').edit(content, storeName);
|
|
16128
|
-
|
|
16129
|
-
// TODO last chunk in the array may not be the last chunk, if it's moved...
|
|
16130
|
-
last.next = newChunk;
|
|
16131
|
-
newChunk.previous = last;
|
|
16132
|
-
}
|
|
16133
|
-
return this;
|
|
16134
|
-
}
|
|
16135
|
-
|
|
16136
|
-
prepend(content) {
|
|
16137
|
-
if (typeof content !== 'string') throw new TypeError('outro content must be a string');
|
|
16138
|
-
|
|
16139
|
-
this.intro = content + this.intro;
|
|
16140
|
-
return this;
|
|
16141
|
-
}
|
|
16142
|
-
|
|
16143
|
-
prependLeft(index, content) {
|
|
16144
|
-
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
16145
|
-
|
|
16146
|
-
this._split(index);
|
|
16147
|
-
|
|
16148
|
-
const chunk = this.byEnd[index];
|
|
16149
|
-
|
|
16150
|
-
if (chunk) {
|
|
16151
|
-
chunk.prependLeft(content);
|
|
16152
|
-
} else {
|
|
16153
|
-
this.intro = content + this.intro;
|
|
16154
|
-
}
|
|
16155
|
-
return this;
|
|
16156
|
-
}
|
|
16157
|
-
|
|
16158
|
-
prependRight(index, content) {
|
|
16159
|
-
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
16160
|
-
|
|
16161
|
-
this._split(index);
|
|
16162
|
-
|
|
16163
|
-
const chunk = this.byStart[index];
|
|
16164
|
-
|
|
16165
|
-
if (chunk) {
|
|
16166
|
-
chunk.prependRight(content);
|
|
16167
|
-
} else {
|
|
16168
|
-
this.outro = content + this.outro;
|
|
16169
|
-
}
|
|
16170
|
-
return this;
|
|
16171
|
-
}
|
|
16172
|
-
|
|
16173
|
-
remove(start, end) {
|
|
16174
|
-
while (start < 0) start += this.original.length;
|
|
16175
|
-
while (end < 0) end += this.original.length;
|
|
16176
|
-
|
|
16177
|
-
if (start === end) return this;
|
|
16178
|
-
|
|
16179
|
-
if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');
|
|
16180
|
-
if (start > end) throw new Error('end must be greater than start');
|
|
16181
|
-
|
|
16182
|
-
this._split(start);
|
|
16183
|
-
this._split(end);
|
|
16184
|
-
|
|
16185
|
-
let chunk = this.byStart[start];
|
|
16186
|
-
|
|
16187
|
-
while (chunk) {
|
|
16188
|
-
chunk.intro = '';
|
|
16189
|
-
chunk.outro = '';
|
|
16190
|
-
chunk.edit('');
|
|
16191
|
-
|
|
16192
|
-
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
16193
|
-
}
|
|
16194
|
-
return this;
|
|
16195
|
-
}
|
|
16196
|
-
|
|
16197
|
-
lastChar() {
|
|
16198
|
-
if (this.outro.length) return this.outro[this.outro.length - 1];
|
|
16199
|
-
let chunk = this.lastChunk;
|
|
16200
|
-
do {
|
|
16201
|
-
if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
|
|
16202
|
-
if (chunk.content.length) return chunk.content[chunk.content.length - 1];
|
|
16203
|
-
if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
|
|
16204
|
-
} while ((chunk = chunk.previous));
|
|
16205
|
-
if (this.intro.length) return this.intro[this.intro.length - 1];
|
|
16206
|
-
return '';
|
|
16207
|
-
}
|
|
16208
|
-
|
|
16209
|
-
lastLine() {
|
|
16210
|
-
let lineIndex = this.outro.lastIndexOf(n$1);
|
|
16211
|
-
if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
|
|
16212
|
-
let lineStr = this.outro;
|
|
16213
|
-
let chunk = this.lastChunk;
|
|
16214
|
-
do {
|
|
16215
|
-
if (chunk.outro.length > 0) {
|
|
16216
|
-
lineIndex = chunk.outro.lastIndexOf(n$1);
|
|
16217
|
-
if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
|
|
16218
|
-
lineStr = chunk.outro + lineStr;
|
|
16219
|
-
}
|
|
16220
|
-
|
|
16221
|
-
if (chunk.content.length > 0) {
|
|
16222
|
-
lineIndex = chunk.content.lastIndexOf(n$1);
|
|
16223
|
-
if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
|
|
16224
|
-
lineStr = chunk.content + lineStr;
|
|
16225
|
-
}
|
|
16226
|
-
|
|
16227
|
-
if (chunk.intro.length > 0) {
|
|
16228
|
-
lineIndex = chunk.intro.lastIndexOf(n$1);
|
|
16229
|
-
if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
|
|
16230
|
-
lineStr = chunk.intro + lineStr;
|
|
16231
|
-
}
|
|
16232
|
-
} while ((chunk = chunk.previous));
|
|
16233
|
-
lineIndex = this.intro.lastIndexOf(n$1);
|
|
16234
|
-
if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
|
|
16235
|
-
return this.intro + lineStr;
|
|
16236
|
-
}
|
|
16237
|
-
|
|
16238
|
-
slice(start = 0, end = this.original.length) {
|
|
16239
|
-
while (start < 0) start += this.original.length;
|
|
16240
|
-
while (end < 0) end += this.original.length;
|
|
16241
|
-
|
|
16242
|
-
let result = '';
|
|
16243
|
-
|
|
16244
|
-
// find start chunk
|
|
16245
|
-
let chunk = this.firstChunk;
|
|
16246
|
-
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
16247
|
-
// found end chunk before start
|
|
16248
|
-
if (chunk.start < end && chunk.end >= end) {
|
|
16249
|
-
return result;
|
|
16250
|
-
}
|
|
16251
|
-
|
|
16252
|
-
chunk = chunk.next;
|
|
16253
|
-
}
|
|
16254
|
-
|
|
16255
|
-
if (chunk && chunk.edited && chunk.start !== start)
|
|
16256
|
-
throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
|
|
16257
|
-
|
|
16258
|
-
const startChunk = chunk;
|
|
16259
|
-
while (chunk) {
|
|
16260
|
-
if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
|
|
16261
|
-
result += chunk.intro;
|
|
16262
|
-
}
|
|
16263
|
-
|
|
16264
|
-
const containsEnd = chunk.start < end && chunk.end >= end;
|
|
16265
|
-
if (containsEnd && chunk.edited && chunk.end !== end)
|
|
16266
|
-
throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
|
|
16267
|
-
|
|
16268
|
-
const sliceStart = startChunk === chunk ? start - chunk.start : 0;
|
|
16269
|
-
const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
|
|
16270
|
-
|
|
16271
|
-
result += chunk.content.slice(sliceStart, sliceEnd);
|
|
16272
|
-
|
|
16273
|
-
if (chunk.outro && (!containsEnd || chunk.end === end)) {
|
|
16274
|
-
result += chunk.outro;
|
|
16275
|
-
}
|
|
16276
|
-
|
|
16277
|
-
if (containsEnd) {
|
|
16278
|
-
break;
|
|
16279
|
-
}
|
|
16280
|
-
|
|
16281
|
-
chunk = chunk.next;
|
|
16282
|
-
}
|
|
16283
|
-
|
|
16284
|
-
return result;
|
|
16285
|
-
}
|
|
16286
|
-
|
|
16287
|
-
// TODO deprecate this? not really very useful
|
|
16288
|
-
snip(start, end) {
|
|
16289
|
-
const clone = this.clone();
|
|
16290
|
-
clone.remove(0, start);
|
|
16291
|
-
clone.remove(end, clone.original.length);
|
|
16292
|
-
|
|
16293
|
-
return clone;
|
|
16294
|
-
}
|
|
16295
|
-
|
|
16296
|
-
_split(index) {
|
|
16297
|
-
if (this.byStart[index] || this.byEnd[index]) return;
|
|
16298
|
-
|
|
16299
|
-
let chunk = this.lastSearchedChunk;
|
|
16300
|
-
const searchForward = index > chunk.end;
|
|
16301
|
-
|
|
16302
|
-
while (chunk) {
|
|
16303
|
-
if (chunk.contains(index)) return this._splitChunk(chunk, index);
|
|
16304
|
-
|
|
16305
|
-
chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
|
|
16306
|
-
}
|
|
16307
|
-
}
|
|
16308
|
-
|
|
16309
|
-
_splitChunk(chunk, index) {
|
|
16310
|
-
if (chunk.edited && chunk.content.length) {
|
|
16311
|
-
// zero-length edited chunks are a special case (overlapping replacements)
|
|
16312
|
-
const loc = getLocator(this.original)(index);
|
|
16313
|
-
throw new Error(
|
|
16314
|
-
`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`,
|
|
16315
|
-
);
|
|
16316
|
-
}
|
|
16317
|
-
|
|
16318
|
-
const newChunk = chunk.split(index);
|
|
16319
|
-
|
|
16320
|
-
this.byEnd[index] = chunk;
|
|
16321
|
-
this.byStart[index] = newChunk;
|
|
16322
|
-
this.byEnd[newChunk.end] = newChunk;
|
|
16323
|
-
|
|
16324
|
-
if (chunk === this.lastChunk) this.lastChunk = newChunk;
|
|
16325
|
-
|
|
16326
|
-
this.lastSearchedChunk = chunk;
|
|
16327
|
-
return true;
|
|
16328
|
-
}
|
|
16329
|
-
|
|
16330
|
-
toString() {
|
|
16331
|
-
let str = this.intro;
|
|
16332
|
-
|
|
16333
|
-
let chunk = this.firstChunk;
|
|
16334
|
-
while (chunk) {
|
|
16335
|
-
str += chunk.toString();
|
|
16336
|
-
chunk = chunk.next;
|
|
16337
|
-
}
|
|
16338
|
-
|
|
16339
|
-
return str + this.outro;
|
|
16340
|
-
}
|
|
16341
|
-
|
|
16342
|
-
isEmpty() {
|
|
16343
|
-
let chunk = this.firstChunk;
|
|
16344
|
-
do {
|
|
16345
|
-
if (
|
|
16346
|
-
(chunk.intro.length && chunk.intro.trim()) ||
|
|
16347
|
-
(chunk.content.length && chunk.content.trim()) ||
|
|
16348
|
-
(chunk.outro.length && chunk.outro.trim())
|
|
16349
|
-
)
|
|
16350
|
-
return false;
|
|
16351
|
-
} while ((chunk = chunk.next));
|
|
16352
|
-
return true;
|
|
16353
|
-
}
|
|
16354
|
-
|
|
16355
|
-
length() {
|
|
16356
|
-
let chunk = this.firstChunk;
|
|
16357
|
-
let length = 0;
|
|
16358
|
-
do {
|
|
16359
|
-
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
|
|
16360
|
-
} while ((chunk = chunk.next));
|
|
16361
|
-
return length;
|
|
16362
|
-
}
|
|
16363
|
-
|
|
16364
|
-
trimLines() {
|
|
16365
|
-
return this.trim('[\\r\\n]');
|
|
16366
|
-
}
|
|
16367
|
-
|
|
16368
|
-
trim(charType) {
|
|
16369
|
-
return this.trimStart(charType).trimEnd(charType);
|
|
16370
|
-
}
|
|
16371
|
-
|
|
16372
|
-
trimEndAborted(charType) {
|
|
16373
|
-
const rx = new RegExp((charType || '\\s') + '+$');
|
|
16374
|
-
|
|
16375
|
-
this.outro = this.outro.replace(rx, '');
|
|
16376
|
-
if (this.outro.length) return true;
|
|
16377
|
-
|
|
16378
|
-
let chunk = this.lastChunk;
|
|
16379
|
-
|
|
16380
|
-
do {
|
|
16381
|
-
const end = chunk.end;
|
|
16382
|
-
const aborted = chunk.trimEnd(rx);
|
|
16383
|
-
|
|
16384
|
-
// if chunk was trimmed, we have a new lastChunk
|
|
16385
|
-
if (chunk.end !== end) {
|
|
16386
|
-
if (this.lastChunk === chunk) {
|
|
16387
|
-
this.lastChunk = chunk.next;
|
|
16388
|
-
}
|
|
16389
|
-
|
|
16390
|
-
this.byEnd[chunk.end] = chunk;
|
|
16391
|
-
this.byStart[chunk.next.start] = chunk.next;
|
|
16392
|
-
this.byEnd[chunk.next.end] = chunk.next;
|
|
16393
|
-
}
|
|
16394
|
-
|
|
16395
|
-
if (aborted) return true;
|
|
16396
|
-
chunk = chunk.previous;
|
|
16397
|
-
} while (chunk);
|
|
16398
|
-
|
|
16399
|
-
return false;
|
|
16400
|
-
}
|
|
16401
|
-
|
|
16402
|
-
trimEnd(charType) {
|
|
16403
|
-
this.trimEndAborted(charType);
|
|
16404
|
-
return this;
|
|
16405
|
-
}
|
|
16406
|
-
trimStartAborted(charType) {
|
|
16407
|
-
const rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
16408
|
-
|
|
16409
|
-
this.intro = this.intro.replace(rx, '');
|
|
16410
|
-
if (this.intro.length) return true;
|
|
16411
|
-
|
|
16412
|
-
let chunk = this.firstChunk;
|
|
16413
|
-
|
|
16414
|
-
do {
|
|
16415
|
-
const end = chunk.end;
|
|
16416
|
-
const aborted = chunk.trimStart(rx);
|
|
16417
|
-
|
|
16418
|
-
if (chunk.end !== end) {
|
|
16419
|
-
// special case...
|
|
16420
|
-
if (chunk === this.lastChunk) this.lastChunk = chunk.next;
|
|
16421
|
-
|
|
16422
|
-
this.byEnd[chunk.end] = chunk;
|
|
16423
|
-
this.byStart[chunk.next.start] = chunk.next;
|
|
16424
|
-
this.byEnd[chunk.next.end] = chunk.next;
|
|
16425
|
-
}
|
|
16426
|
-
|
|
16427
|
-
if (aborted) return true;
|
|
16428
|
-
chunk = chunk.next;
|
|
16429
|
-
} while (chunk);
|
|
16430
|
-
|
|
16431
|
-
return false;
|
|
16432
|
-
}
|
|
16433
|
-
|
|
16434
|
-
trimStart(charType) {
|
|
16435
|
-
this.trimStartAborted(charType);
|
|
16436
|
-
return this;
|
|
16437
|
-
}
|
|
16438
|
-
|
|
16439
|
-
hasChanged() {
|
|
16440
|
-
return this.original !== this.toString();
|
|
16441
|
-
}
|
|
16442
|
-
|
|
16443
|
-
_replaceRegexp(searchValue, replacement) {
|
|
16444
|
-
function getReplacement(match, str) {
|
|
16445
|
-
if (typeof replacement === 'string') {
|
|
16446
|
-
return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
|
|
16447
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter
|
|
16448
|
-
if (i === '$') return '$';
|
|
16449
|
-
if (i === '&') return match[0];
|
|
16450
|
-
const num = +i;
|
|
16451
|
-
if (num < match.length) return match[+i];
|
|
16452
|
-
return `$${i}`;
|
|
16453
|
-
});
|
|
16454
|
-
} else {
|
|
16455
|
-
return replacement(...match, match.index, str, match.groups);
|
|
16456
|
-
}
|
|
16457
|
-
}
|
|
16458
|
-
function matchAll(re, str) {
|
|
16459
|
-
let match;
|
|
16460
|
-
const matches = [];
|
|
16461
|
-
while ((match = re.exec(str))) {
|
|
16462
|
-
matches.push(match);
|
|
16463
|
-
}
|
|
16464
|
-
return matches;
|
|
16465
|
-
}
|
|
16466
|
-
if (searchValue.global) {
|
|
16467
|
-
const matches = matchAll(searchValue, this.original);
|
|
16468
|
-
matches.forEach((match) => {
|
|
16469
|
-
if (match.index != null)
|
|
16470
|
-
this.overwrite(
|
|
16471
|
-
match.index,
|
|
16472
|
-
match.index + match[0].length,
|
|
16473
|
-
getReplacement(match, this.original),
|
|
16474
|
-
);
|
|
16475
|
-
});
|
|
16476
|
-
} else {
|
|
16477
|
-
const match = this.original.match(searchValue);
|
|
16478
|
-
if (match && match.index != null)
|
|
16479
|
-
this.overwrite(
|
|
16480
|
-
match.index,
|
|
16481
|
-
match.index + match[0].length,
|
|
16482
|
-
getReplacement(match, this.original),
|
|
16483
|
-
);
|
|
16484
|
-
}
|
|
16485
|
-
return this;
|
|
16486
|
-
}
|
|
16487
|
-
|
|
16488
|
-
_replaceString(string, replacement) {
|
|
16489
|
-
const { original } = this;
|
|
16490
|
-
const index = original.indexOf(string);
|
|
16491
|
-
|
|
16492
|
-
if (index !== -1) {
|
|
16493
|
-
this.overwrite(index, index + string.length, replacement);
|
|
16494
|
-
}
|
|
14967
|
+
throw new TypeError('Converting circular structure to JSON');
|
|
14968
|
+
} else { seen.push(node); }
|
|
16495
14969
|
|
|
16496
|
-
|
|
16497
|
-
|
|
14970
|
+
var keys = objectKeys(node).sort(cmp && cmp(node));
|
|
14971
|
+
var out = [];
|
|
14972
|
+
for (var i = 0; i < keys.length; i++) {
|
|
14973
|
+
var key = keys[i];
|
|
14974
|
+
var value = stringify(node, key, node[key], level + 1);
|
|
16498
14975
|
|
|
16499
|
-
|
|
16500
|
-
if (typeof searchValue === 'string') {
|
|
16501
|
-
return this._replaceString(searchValue, replacement);
|
|
16502
|
-
}
|
|
14976
|
+
if (!value) { continue; }
|
|
16503
14977
|
|
|
16504
|
-
|
|
16505
|
-
|
|
14978
|
+
var keyValue = json.stringify(key)
|
|
14979
|
+
+ colonSeparator
|
|
14980
|
+
+ value;
|
|
16506
14981
|
|
|
16507
|
-
|
|
16508
|
-
const { original } = this;
|
|
16509
|
-
const stringLength = string.length;
|
|
16510
|
-
for (
|
|
16511
|
-
let index = original.indexOf(string);
|
|
16512
|
-
index !== -1;
|
|
16513
|
-
index = original.indexOf(string, index + stringLength)
|
|
16514
|
-
) {
|
|
16515
|
-
this.overwrite(index, index + stringLength, replacement);
|
|
14982
|
+
out.push(indent + space + keyValue);
|
|
16516
14983
|
}
|
|
14984
|
+
seen.splice(seen.indexOf(node), 1);
|
|
14985
|
+
return '{' + out.join(',') + indent + '}';
|
|
16517
14986
|
|
|
16518
|
-
|
|
16519
|
-
|
|
14987
|
+
}({ '': obj }, '', obj, 0));
|
|
14988
|
+
};
|
|
16520
14989
|
|
|
16521
|
-
|
|
16522
|
-
if (typeof searchValue === 'string') {
|
|
16523
|
-
return this._replaceAllString(searchValue, replacement);
|
|
16524
|
-
}
|
|
14990
|
+
var jsonStableStringify$1 = /*@__PURE__*/getDefaultExportFromCjs(jsonStableStringify);
|
|
16525
14991
|
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
|
|
16529
|
-
|
|
16530
|
-
|
|
14992
|
+
const mimes$1 = {
|
|
14993
|
+
"ez": "application/andrew-inset",
|
|
14994
|
+
"aw": "application/applixware",
|
|
14995
|
+
"atom": "application/atom+xml",
|
|
14996
|
+
"atomcat": "application/atomcat+xml",
|
|
14997
|
+
"atomdeleted": "application/atomdeleted+xml",
|
|
14998
|
+
"atomsvc": "application/atomsvc+xml",
|
|
14999
|
+
"dwd": "application/atsc-dwd+xml",
|
|
15000
|
+
"held": "application/atsc-held+xml",
|
|
15001
|
+
"rsat": "application/atsc-rsat+xml",
|
|
15002
|
+
"bdoc": "application/bdoc",
|
|
15003
|
+
"xcs": "application/calendar+xml",
|
|
15004
|
+
"ccxml": "application/ccxml+xml",
|
|
15005
|
+
"cdfx": "application/cdfx+xml",
|
|
15006
|
+
"cdmia": "application/cdmi-capability",
|
|
15007
|
+
"cdmic": "application/cdmi-container",
|
|
15008
|
+
"cdmid": "application/cdmi-domain",
|
|
15009
|
+
"cdmio": "application/cdmi-object",
|
|
15010
|
+
"cdmiq": "application/cdmi-queue",
|
|
15011
|
+
"cu": "application/cu-seeme",
|
|
15012
|
+
"mpd": "application/dash+xml",
|
|
15013
|
+
"davmount": "application/davmount+xml",
|
|
15014
|
+
"dbk": "application/docbook+xml",
|
|
15015
|
+
"dssc": "application/dssc+der",
|
|
15016
|
+
"xdssc": "application/dssc+xml",
|
|
15017
|
+
"es": "application/ecmascript",
|
|
15018
|
+
"ecma": "application/ecmascript",
|
|
15019
|
+
"emma": "application/emma+xml",
|
|
15020
|
+
"emotionml": "application/emotionml+xml",
|
|
15021
|
+
"epub": "application/epub+zip",
|
|
15022
|
+
"exi": "application/exi",
|
|
15023
|
+
"fdt": "application/fdt+xml",
|
|
15024
|
+
"pfr": "application/font-tdpfr",
|
|
15025
|
+
"geojson": "application/geo+json",
|
|
15026
|
+
"gml": "application/gml+xml",
|
|
15027
|
+
"gpx": "application/gpx+xml",
|
|
15028
|
+
"gxf": "application/gxf",
|
|
15029
|
+
"gz": "application/gzip",
|
|
15030
|
+
"hjson": "application/hjson",
|
|
15031
|
+
"stk": "application/hyperstudio",
|
|
15032
|
+
"ink": "application/inkml+xml",
|
|
15033
|
+
"inkml": "application/inkml+xml",
|
|
15034
|
+
"ipfix": "application/ipfix",
|
|
15035
|
+
"its": "application/its+xml",
|
|
15036
|
+
"jar": "application/java-archive",
|
|
15037
|
+
"war": "application/java-archive",
|
|
15038
|
+
"ear": "application/java-archive",
|
|
15039
|
+
"ser": "application/java-serialized-object",
|
|
15040
|
+
"class": "application/java-vm",
|
|
15041
|
+
"js": "application/javascript",
|
|
15042
|
+
"mjs": "application/javascript",
|
|
15043
|
+
"json": "application/json",
|
|
15044
|
+
"map": "application/json",
|
|
15045
|
+
"json5": "application/json5",
|
|
15046
|
+
"jsonml": "application/jsonml+json",
|
|
15047
|
+
"jsonld": "application/ld+json",
|
|
15048
|
+
"lgr": "application/lgr+xml",
|
|
15049
|
+
"lostxml": "application/lost+xml",
|
|
15050
|
+
"hqx": "application/mac-binhex40",
|
|
15051
|
+
"cpt": "application/mac-compactpro",
|
|
15052
|
+
"mads": "application/mads+xml",
|
|
15053
|
+
"webmanifest": "application/manifest+json",
|
|
15054
|
+
"mrc": "application/marc",
|
|
15055
|
+
"mrcx": "application/marcxml+xml",
|
|
15056
|
+
"ma": "application/mathematica",
|
|
15057
|
+
"nb": "application/mathematica",
|
|
15058
|
+
"mb": "application/mathematica",
|
|
15059
|
+
"mathml": "application/mathml+xml",
|
|
15060
|
+
"mbox": "application/mbox",
|
|
15061
|
+
"mscml": "application/mediaservercontrol+xml",
|
|
15062
|
+
"metalink": "application/metalink+xml",
|
|
15063
|
+
"meta4": "application/metalink4+xml",
|
|
15064
|
+
"mets": "application/mets+xml",
|
|
15065
|
+
"maei": "application/mmt-aei+xml",
|
|
15066
|
+
"musd": "application/mmt-usd+xml",
|
|
15067
|
+
"mods": "application/mods+xml",
|
|
15068
|
+
"m21": "application/mp21",
|
|
15069
|
+
"mp21": "application/mp21",
|
|
15070
|
+
"mp4s": "application/mp4",
|
|
15071
|
+
"m4p": "application/mp4",
|
|
15072
|
+
"doc": "application/msword",
|
|
15073
|
+
"dot": "application/msword",
|
|
15074
|
+
"mxf": "application/mxf",
|
|
15075
|
+
"nq": "application/n-quads",
|
|
15076
|
+
"nt": "application/n-triples",
|
|
15077
|
+
"cjs": "application/node",
|
|
15078
|
+
"bin": "application/octet-stream",
|
|
15079
|
+
"dms": "application/octet-stream",
|
|
15080
|
+
"lrf": "application/octet-stream",
|
|
15081
|
+
"mar": "application/octet-stream",
|
|
15082
|
+
"so": "application/octet-stream",
|
|
15083
|
+
"dist": "application/octet-stream",
|
|
15084
|
+
"distz": "application/octet-stream",
|
|
15085
|
+
"pkg": "application/octet-stream",
|
|
15086
|
+
"bpk": "application/octet-stream",
|
|
15087
|
+
"dump": "application/octet-stream",
|
|
15088
|
+
"elc": "application/octet-stream",
|
|
15089
|
+
"deploy": "application/octet-stream",
|
|
15090
|
+
"exe": "application/octet-stream",
|
|
15091
|
+
"dll": "application/octet-stream",
|
|
15092
|
+
"deb": "application/octet-stream",
|
|
15093
|
+
"dmg": "application/octet-stream",
|
|
15094
|
+
"iso": "application/octet-stream",
|
|
15095
|
+
"img": "application/octet-stream",
|
|
15096
|
+
"msi": "application/octet-stream",
|
|
15097
|
+
"msp": "application/octet-stream",
|
|
15098
|
+
"msm": "application/octet-stream",
|
|
15099
|
+
"buffer": "application/octet-stream",
|
|
15100
|
+
"oda": "application/oda",
|
|
15101
|
+
"opf": "application/oebps-package+xml",
|
|
15102
|
+
"ogx": "application/ogg",
|
|
15103
|
+
"omdoc": "application/omdoc+xml",
|
|
15104
|
+
"onetoc": "application/onenote",
|
|
15105
|
+
"onetoc2": "application/onenote",
|
|
15106
|
+
"onetmp": "application/onenote",
|
|
15107
|
+
"onepkg": "application/onenote",
|
|
15108
|
+
"oxps": "application/oxps",
|
|
15109
|
+
"relo": "application/p2p-overlay+xml",
|
|
15110
|
+
"xer": "application/patch-ops-error+xml",
|
|
15111
|
+
"pdf": "application/pdf",
|
|
15112
|
+
"pgp": "application/pgp-encrypted",
|
|
15113
|
+
"asc": "application/pgp-signature",
|
|
15114
|
+
"sig": "application/pgp-signature",
|
|
15115
|
+
"prf": "application/pics-rules",
|
|
15116
|
+
"p10": "application/pkcs10",
|
|
15117
|
+
"p7m": "application/pkcs7-mime",
|
|
15118
|
+
"p7c": "application/pkcs7-mime",
|
|
15119
|
+
"p7s": "application/pkcs7-signature",
|
|
15120
|
+
"p8": "application/pkcs8",
|
|
15121
|
+
"ac": "application/pkix-attr-cert",
|
|
15122
|
+
"cer": "application/pkix-cert",
|
|
15123
|
+
"crl": "application/pkix-crl",
|
|
15124
|
+
"pkipath": "application/pkix-pkipath",
|
|
15125
|
+
"pki": "application/pkixcmp",
|
|
15126
|
+
"pls": "application/pls+xml",
|
|
15127
|
+
"ai": "application/postscript",
|
|
15128
|
+
"eps": "application/postscript",
|
|
15129
|
+
"ps": "application/postscript",
|
|
15130
|
+
"provx": "application/provenance+xml",
|
|
15131
|
+
"cww": "application/prs.cww",
|
|
15132
|
+
"pskcxml": "application/pskc+xml",
|
|
15133
|
+
"raml": "application/raml+yaml",
|
|
15134
|
+
"rdf": "application/rdf+xml",
|
|
15135
|
+
"owl": "application/rdf+xml",
|
|
15136
|
+
"rif": "application/reginfo+xml",
|
|
15137
|
+
"rnc": "application/relax-ng-compact-syntax",
|
|
15138
|
+
"rl": "application/resource-lists+xml",
|
|
15139
|
+
"rld": "application/resource-lists-diff+xml",
|
|
15140
|
+
"rs": "application/rls-services+xml",
|
|
15141
|
+
"rapd": "application/route-apd+xml",
|
|
15142
|
+
"sls": "application/route-s-tsid+xml",
|
|
15143
|
+
"rusd": "application/route-usd+xml",
|
|
15144
|
+
"gbr": "application/rpki-ghostbusters",
|
|
15145
|
+
"mft": "application/rpki-manifest",
|
|
15146
|
+
"roa": "application/rpki-roa",
|
|
15147
|
+
"rsd": "application/rsd+xml",
|
|
15148
|
+
"rss": "application/rss+xml",
|
|
15149
|
+
"rtf": "application/rtf",
|
|
15150
|
+
"sbml": "application/sbml+xml",
|
|
15151
|
+
"scq": "application/scvp-cv-request",
|
|
15152
|
+
"scs": "application/scvp-cv-response",
|
|
15153
|
+
"spq": "application/scvp-vp-request",
|
|
15154
|
+
"spp": "application/scvp-vp-response",
|
|
15155
|
+
"sdp": "application/sdp",
|
|
15156
|
+
"senmlx": "application/senml+xml",
|
|
15157
|
+
"sensmlx": "application/sensml+xml",
|
|
15158
|
+
"setpay": "application/set-payment-initiation",
|
|
15159
|
+
"setreg": "application/set-registration-initiation",
|
|
15160
|
+
"shf": "application/shf+xml",
|
|
15161
|
+
"siv": "application/sieve",
|
|
15162
|
+
"sieve": "application/sieve",
|
|
15163
|
+
"smi": "application/smil+xml",
|
|
15164
|
+
"smil": "application/smil+xml",
|
|
15165
|
+
"rq": "application/sparql-query",
|
|
15166
|
+
"srx": "application/sparql-results+xml",
|
|
15167
|
+
"gram": "application/srgs",
|
|
15168
|
+
"grxml": "application/srgs+xml",
|
|
15169
|
+
"sru": "application/sru+xml",
|
|
15170
|
+
"ssdl": "application/ssdl+xml",
|
|
15171
|
+
"ssml": "application/ssml+xml",
|
|
15172
|
+
"swidtag": "application/swid+xml",
|
|
15173
|
+
"tei": "application/tei+xml",
|
|
15174
|
+
"teicorpus": "application/tei+xml",
|
|
15175
|
+
"tfi": "application/thraud+xml",
|
|
15176
|
+
"tsd": "application/timestamped-data",
|
|
15177
|
+
"toml": "application/toml",
|
|
15178
|
+
"trig": "application/trig",
|
|
15179
|
+
"ttml": "application/ttml+xml",
|
|
15180
|
+
"ubj": "application/ubjson",
|
|
15181
|
+
"rsheet": "application/urc-ressheet+xml",
|
|
15182
|
+
"td": "application/urc-targetdesc+xml",
|
|
15183
|
+
"vxml": "application/voicexml+xml",
|
|
15184
|
+
"wasm": "application/wasm",
|
|
15185
|
+
"wgt": "application/widget",
|
|
15186
|
+
"hlp": "application/winhlp",
|
|
15187
|
+
"wsdl": "application/wsdl+xml",
|
|
15188
|
+
"wspolicy": "application/wspolicy+xml",
|
|
15189
|
+
"xaml": "application/xaml+xml",
|
|
15190
|
+
"xav": "application/xcap-att+xml",
|
|
15191
|
+
"xca": "application/xcap-caps+xml",
|
|
15192
|
+
"xdf": "application/xcap-diff+xml",
|
|
15193
|
+
"xel": "application/xcap-el+xml",
|
|
15194
|
+
"xns": "application/xcap-ns+xml",
|
|
15195
|
+
"xenc": "application/xenc+xml",
|
|
15196
|
+
"xhtml": "application/xhtml+xml",
|
|
15197
|
+
"xht": "application/xhtml+xml",
|
|
15198
|
+
"xlf": "application/xliff+xml",
|
|
15199
|
+
"xml": "application/xml",
|
|
15200
|
+
"xsl": "application/xml",
|
|
15201
|
+
"xsd": "application/xml",
|
|
15202
|
+
"rng": "application/xml",
|
|
15203
|
+
"dtd": "application/xml-dtd",
|
|
15204
|
+
"xop": "application/xop+xml",
|
|
15205
|
+
"xpl": "application/xproc+xml",
|
|
15206
|
+
"xslt": "application/xml",
|
|
15207
|
+
"xspf": "application/xspf+xml",
|
|
15208
|
+
"mxml": "application/xv+xml",
|
|
15209
|
+
"xhvml": "application/xv+xml",
|
|
15210
|
+
"xvml": "application/xv+xml",
|
|
15211
|
+
"xvm": "application/xv+xml",
|
|
15212
|
+
"yang": "application/yang",
|
|
15213
|
+
"yin": "application/yin+xml",
|
|
15214
|
+
"zip": "application/zip",
|
|
15215
|
+
"3gpp": "video/3gpp",
|
|
15216
|
+
"adp": "audio/adpcm",
|
|
15217
|
+
"amr": "audio/amr",
|
|
15218
|
+
"au": "audio/basic",
|
|
15219
|
+
"snd": "audio/basic",
|
|
15220
|
+
"mid": "audio/midi",
|
|
15221
|
+
"midi": "audio/midi",
|
|
15222
|
+
"kar": "audio/midi",
|
|
15223
|
+
"rmi": "audio/midi",
|
|
15224
|
+
"mxmf": "audio/mobile-xmf",
|
|
15225
|
+
"mp3": "audio/mpeg",
|
|
15226
|
+
"m4a": "audio/mp4",
|
|
15227
|
+
"mp4a": "audio/mp4",
|
|
15228
|
+
"mpga": "audio/mpeg",
|
|
15229
|
+
"mp2": "audio/mpeg",
|
|
15230
|
+
"mp2a": "audio/mpeg",
|
|
15231
|
+
"m2a": "audio/mpeg",
|
|
15232
|
+
"m3a": "audio/mpeg",
|
|
15233
|
+
"oga": "audio/ogg",
|
|
15234
|
+
"ogg": "audio/ogg",
|
|
15235
|
+
"spx": "audio/ogg",
|
|
15236
|
+
"opus": "audio/ogg",
|
|
15237
|
+
"s3m": "audio/s3m",
|
|
15238
|
+
"sil": "audio/silk",
|
|
15239
|
+
"wav": "audio/wav",
|
|
15240
|
+
"weba": "audio/webm",
|
|
15241
|
+
"xm": "audio/xm",
|
|
15242
|
+
"ttc": "font/collection",
|
|
15243
|
+
"otf": "font/otf",
|
|
15244
|
+
"ttf": "font/ttf",
|
|
15245
|
+
"woff": "font/woff",
|
|
15246
|
+
"woff2": "font/woff2",
|
|
15247
|
+
"exr": "image/aces",
|
|
15248
|
+
"apng": "image/apng",
|
|
15249
|
+
"avif": "image/avif",
|
|
15250
|
+
"bmp": "image/bmp",
|
|
15251
|
+
"cgm": "image/cgm",
|
|
15252
|
+
"drle": "image/dicom-rle",
|
|
15253
|
+
"emf": "image/emf",
|
|
15254
|
+
"fits": "image/fits",
|
|
15255
|
+
"g3": "image/g3fax",
|
|
15256
|
+
"gif": "image/gif",
|
|
15257
|
+
"heic": "image/heic",
|
|
15258
|
+
"heics": "image/heic-sequence",
|
|
15259
|
+
"heif": "image/heif",
|
|
15260
|
+
"heifs": "image/heif-sequence",
|
|
15261
|
+
"hej2": "image/hej2k",
|
|
15262
|
+
"hsj2": "image/hsj2",
|
|
15263
|
+
"ief": "image/ief",
|
|
15264
|
+
"jls": "image/jls",
|
|
15265
|
+
"jp2": "image/jp2",
|
|
15266
|
+
"jpg2": "image/jp2",
|
|
15267
|
+
"jpeg": "image/jpeg",
|
|
15268
|
+
"jpg": "image/jpeg",
|
|
15269
|
+
"jpe": "image/jpeg",
|
|
15270
|
+
"jph": "image/jph",
|
|
15271
|
+
"jhc": "image/jphc",
|
|
15272
|
+
"jpm": "image/jpm",
|
|
15273
|
+
"jpx": "image/jpx",
|
|
15274
|
+
"jpf": "image/jpx",
|
|
15275
|
+
"jxr": "image/jxr",
|
|
15276
|
+
"jxra": "image/jxra",
|
|
15277
|
+
"jxrs": "image/jxrs",
|
|
15278
|
+
"jxs": "image/jxs",
|
|
15279
|
+
"jxsc": "image/jxsc",
|
|
15280
|
+
"jxsi": "image/jxsi",
|
|
15281
|
+
"jxss": "image/jxss",
|
|
15282
|
+
"ktx": "image/ktx",
|
|
15283
|
+
"ktx2": "image/ktx2",
|
|
15284
|
+
"png": "image/png",
|
|
15285
|
+
"btif": "image/prs.btif",
|
|
15286
|
+
"pti": "image/prs.pti",
|
|
15287
|
+
"sgi": "image/sgi",
|
|
15288
|
+
"svg": "image/svg+xml",
|
|
15289
|
+
"svgz": "image/svg+xml",
|
|
15290
|
+
"t38": "image/t38",
|
|
15291
|
+
"tif": "image/tiff",
|
|
15292
|
+
"tiff": "image/tiff",
|
|
15293
|
+
"tfx": "image/tiff-fx",
|
|
15294
|
+
"webp": "image/webp",
|
|
15295
|
+
"wmf": "image/wmf",
|
|
15296
|
+
"disposition-notification": "message/disposition-notification",
|
|
15297
|
+
"u8msg": "message/global",
|
|
15298
|
+
"u8dsn": "message/global-delivery-status",
|
|
15299
|
+
"u8mdn": "message/global-disposition-notification",
|
|
15300
|
+
"u8hdr": "message/global-headers",
|
|
15301
|
+
"eml": "message/rfc822",
|
|
15302
|
+
"mime": "message/rfc822",
|
|
15303
|
+
"3mf": "model/3mf",
|
|
15304
|
+
"gltf": "model/gltf+json",
|
|
15305
|
+
"glb": "model/gltf-binary",
|
|
15306
|
+
"igs": "model/iges",
|
|
15307
|
+
"iges": "model/iges",
|
|
15308
|
+
"msh": "model/mesh",
|
|
15309
|
+
"mesh": "model/mesh",
|
|
15310
|
+
"silo": "model/mesh",
|
|
15311
|
+
"mtl": "model/mtl",
|
|
15312
|
+
"obj": "model/obj",
|
|
15313
|
+
"stpz": "model/step+zip",
|
|
15314
|
+
"stpxz": "model/step-xml+zip",
|
|
15315
|
+
"stl": "model/stl",
|
|
15316
|
+
"wrl": "model/vrml",
|
|
15317
|
+
"vrml": "model/vrml",
|
|
15318
|
+
"x3db": "model/x3d+fastinfoset",
|
|
15319
|
+
"x3dbz": "model/x3d+binary",
|
|
15320
|
+
"x3dv": "model/x3d-vrml",
|
|
15321
|
+
"x3dvz": "model/x3d+vrml",
|
|
15322
|
+
"x3d": "model/x3d+xml",
|
|
15323
|
+
"x3dz": "model/x3d+xml",
|
|
15324
|
+
"appcache": "text/cache-manifest",
|
|
15325
|
+
"manifest": "text/cache-manifest",
|
|
15326
|
+
"ics": "text/calendar",
|
|
15327
|
+
"ifb": "text/calendar",
|
|
15328
|
+
"coffee": "text/coffeescript",
|
|
15329
|
+
"litcoffee": "text/coffeescript",
|
|
15330
|
+
"css": "text/css",
|
|
15331
|
+
"csv": "text/csv",
|
|
15332
|
+
"html": "text/html",
|
|
15333
|
+
"htm": "text/html",
|
|
15334
|
+
"shtml": "text/html",
|
|
15335
|
+
"jade": "text/jade",
|
|
15336
|
+
"jsx": "text/jsx",
|
|
15337
|
+
"less": "text/less",
|
|
15338
|
+
"markdown": "text/markdown",
|
|
15339
|
+
"md": "text/markdown",
|
|
15340
|
+
"mml": "text/mathml",
|
|
15341
|
+
"mdx": "text/mdx",
|
|
15342
|
+
"n3": "text/n3",
|
|
15343
|
+
"txt": "text/plain",
|
|
15344
|
+
"text": "text/plain",
|
|
15345
|
+
"conf": "text/plain",
|
|
15346
|
+
"def": "text/plain",
|
|
15347
|
+
"list": "text/plain",
|
|
15348
|
+
"log": "text/plain",
|
|
15349
|
+
"in": "text/plain",
|
|
15350
|
+
"ini": "text/plain",
|
|
15351
|
+
"dsc": "text/prs.lines.tag",
|
|
15352
|
+
"rtx": "text/richtext",
|
|
15353
|
+
"sgml": "text/sgml",
|
|
15354
|
+
"sgm": "text/sgml",
|
|
15355
|
+
"shex": "text/shex",
|
|
15356
|
+
"slim": "text/slim",
|
|
15357
|
+
"slm": "text/slim",
|
|
15358
|
+
"spdx": "text/spdx",
|
|
15359
|
+
"stylus": "text/stylus",
|
|
15360
|
+
"styl": "text/stylus",
|
|
15361
|
+
"tsv": "text/tab-separated-values",
|
|
15362
|
+
"t": "text/troff",
|
|
15363
|
+
"tr": "text/troff",
|
|
15364
|
+
"roff": "text/troff",
|
|
15365
|
+
"man": "text/troff",
|
|
15366
|
+
"me": "text/troff",
|
|
15367
|
+
"ms": "text/troff",
|
|
15368
|
+
"ttl": "text/turtle",
|
|
15369
|
+
"uri": "text/uri-list",
|
|
15370
|
+
"uris": "text/uri-list",
|
|
15371
|
+
"urls": "text/uri-list",
|
|
15372
|
+
"vcard": "text/vcard",
|
|
15373
|
+
"vtt": "text/vtt",
|
|
15374
|
+
"yaml": "text/yaml",
|
|
15375
|
+
"yml": "text/yaml",
|
|
15376
|
+
"3gp": "video/3gpp",
|
|
15377
|
+
"3g2": "video/3gpp2",
|
|
15378
|
+
"h261": "video/h261",
|
|
15379
|
+
"h263": "video/h263",
|
|
15380
|
+
"h264": "video/h264",
|
|
15381
|
+
"m4s": "video/iso.segment",
|
|
15382
|
+
"jpgv": "video/jpeg",
|
|
15383
|
+
"jpgm": "image/jpm",
|
|
15384
|
+
"mj2": "video/mj2",
|
|
15385
|
+
"mjp2": "video/mj2",
|
|
15386
|
+
"ts": "video/mp2t",
|
|
15387
|
+
"mp4": "video/mp4",
|
|
15388
|
+
"mp4v": "video/mp4",
|
|
15389
|
+
"mpg4": "video/mp4",
|
|
15390
|
+
"mpeg": "video/mpeg",
|
|
15391
|
+
"mpg": "video/mpeg",
|
|
15392
|
+
"mpe": "video/mpeg",
|
|
15393
|
+
"m1v": "video/mpeg",
|
|
15394
|
+
"m2v": "video/mpeg",
|
|
15395
|
+
"ogv": "video/ogg",
|
|
15396
|
+
"qt": "video/quicktime",
|
|
15397
|
+
"mov": "video/quicktime",
|
|
15398
|
+
"webm": "video/webm"
|
|
15399
|
+
};
|
|
16531
15400
|
|
|
16532
|
-
|
|
16533
|
-
|
|
15401
|
+
function lookup(extn) {
|
|
15402
|
+
let tmp = ('' + extn).trim().toLowerCase();
|
|
15403
|
+
let idx = tmp.lastIndexOf('.');
|
|
15404
|
+
return mimes$1[!~idx ? tmp : tmp.substring(++idx)];
|
|
16534
15405
|
}
|
|
16535
15406
|
|
|
16536
15407
|
const assetUrlRE = /__VITE_ASSET__([a-z\d]+)__(?:\$_(.*?)__)?/g;
|
|
@@ -16636,8 +15507,8 @@ function assetPlugin(config) {
|
|
|
16636
15507
|
return;
|
|
16637
15508
|
}
|
|
16638
15509
|
id = id.replace(urlRE, '$1').replace(unnededFinalQueryCharRE, '');
|
|
16639
|
-
const url = await fileToUrl(id, config, this);
|
|
16640
|
-
return `export default ${JSON.stringify(url)}`;
|
|
15510
|
+
const url = await fileToUrl$1(id, config, this);
|
|
15511
|
+
return `export default ${JSON.stringify(config.command === 'serve' ? `${url}?t=${Date.now()}` : url)}`;
|
|
16641
15512
|
},
|
|
16642
15513
|
renderChunk(code, chunk, opts) {
|
|
16643
15514
|
const s = renderAssetUrlInJS(this, config, chunk, opts, code);
|
|
@@ -16687,7 +15558,7 @@ function checkPublicFile(url, { publicDir }) {
|
|
|
16687
15558
|
return;
|
|
16688
15559
|
}
|
|
16689
15560
|
}
|
|
16690
|
-
async function fileToUrl(id, config, ctx) {
|
|
15561
|
+
async function fileToUrl$1(id, config, ctx) {
|
|
16691
15562
|
if (config.command === 'serve') {
|
|
16692
15563
|
return fileToDevUrl(id, config);
|
|
16693
15564
|
}
|
|
@@ -29121,7 +27992,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
29121
27992
|
// https://github.com/defunctzombie/package-browser-field-spec
|
|
29122
27993
|
const browserEntry = typeof data.browser === 'string'
|
|
29123
27994
|
? data.browser
|
|
29124
|
-
: isObject$
|
|
27995
|
+
: isObject$1(data.browser) && data.browser['.'];
|
|
29125
27996
|
if (browserEntry) {
|
|
29126
27997
|
// check if the package also has a "module" field.
|
|
29127
27998
|
if (!options.isRequire &&
|
|
@@ -29181,7 +28052,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
29181
28052
|
else {
|
|
29182
28053
|
// resolve object browser field in package.json
|
|
29183
28054
|
const { browser: browserField } = data;
|
|
29184
|
-
if (targetWeb && options.browserField && isObject$
|
|
28055
|
+
if (targetWeb && options.browserField && isObject$1(browserField)) {
|
|
29185
28056
|
entry = mapWithBrowserField(entry, browserField) || entry;
|
|
29186
28057
|
}
|
|
29187
28058
|
}
|
|
@@ -29237,7 +28108,7 @@ function resolveDeepImport(id, { webResolvedImports, setResolvedCache, getResolv
|
|
|
29237
28108
|
const { exports: exportsField, browser: browserField } = data;
|
|
29238
28109
|
// map relative based on exports data
|
|
29239
28110
|
if (exportsField) {
|
|
29240
|
-
if (isObject$
|
|
28111
|
+
if (isObject$1(exportsField) && !Array.isArray(exportsField)) {
|
|
29241
28112
|
// resolve without postfix (see #7098)
|
|
29242
28113
|
const { file, postfix } = splitFileAndPostfix(relativeId);
|
|
29243
28114
|
const exportsId = resolveExportsOrImports(data, file, options, targetWeb, 'exports');
|
|
@@ -29257,7 +28128,7 @@ function resolveDeepImport(id, { webResolvedImports, setResolvedCache, getResolv
|
|
|
29257
28128
|
`${path$o.join(dir, 'package.json')}.`);
|
|
29258
28129
|
}
|
|
29259
28130
|
}
|
|
29260
|
-
else if (targetWeb && options.browserField && isObject$
|
|
28131
|
+
else if (targetWeb && options.browserField && isObject$1(browserField)) {
|
|
29261
28132
|
// resolve without postfix (see #7098)
|
|
29262
28133
|
const { file, postfix } = splitFileAndPostfix(relativeId);
|
|
29263
28134
|
const mapped = mapWithBrowserField(file, browserField);
|
|
@@ -29282,7 +28153,7 @@ function tryResolveBrowserMapping(id, importer, options, isFilePath, externalize
|
|
|
29282
28153
|
let res;
|
|
29283
28154
|
const pkg = importer &&
|
|
29284
28155
|
findNearestPackageData(path$o.dirname(importer), options.packageCache);
|
|
29285
|
-
if (pkg && isObject$
|
|
28156
|
+
if (pkg && isObject$1(pkg.data.browser)) {
|
|
29286
28157
|
const mapId = isFilePath ? './' + slash$1(path$o.relative(pkg.dir, id)) : id;
|
|
29287
28158
|
const browserMappedPath = mapWithBrowserField(mapId, pkg.data.browser);
|
|
29288
28159
|
if (browserMappedPath) {
|
|
@@ -38813,7 +37684,7 @@ function cssPlugin(config) {
|
|
|
38813
37684
|
}
|
|
38814
37685
|
const resolved = await resolveUrl(url, importer);
|
|
38815
37686
|
if (resolved) {
|
|
38816
|
-
return fileToUrl(resolved, config, this);
|
|
37687
|
+
return fileToUrl$1(resolved, config, this);
|
|
38817
37688
|
}
|
|
38818
37689
|
if (config.command === 'build') {
|
|
38819
37690
|
const isExternal = config.build.rollupOptions.external
|
|
@@ -38853,7 +37724,7 @@ function cssPlugin(config) {
|
|
|
38853
37724
|
for (const file of deps) {
|
|
38854
37725
|
depModules.add(isCSSRequest(file)
|
|
38855
37726
|
? moduleGraph.createFileOnlyEntry(file)
|
|
38856
|
-
: await moduleGraph.ensureEntryFromUrl(stripBase(await fileToUrl(file, config, this), (config.server?.origin ?? '') + devBase), ssr));
|
|
37727
|
+
: await moduleGraph.ensureEntryFromUrl(stripBase(await fileToUrl$1(file, config, this), (config.server?.origin ?? '') + devBase), ssr));
|
|
38857
37728
|
}
|
|
38858
37729
|
moduleGraph.updateModuleInfo(thisModule, depModules, null,
|
|
38859
37730
|
// The root CSS proxy module is self-accepting and should not
|
|
@@ -39539,8 +38410,8 @@ function createCachedImport(imp) {
|
|
|
39539
38410
|
return cached;
|
|
39540
38411
|
};
|
|
39541
38412
|
}
|
|
39542
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
39543
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
38413
|
+
const importPostcssImport = createCachedImport(() => import('./dep-e04185e5.js').then(function (n) { return n.i; }));
|
|
38414
|
+
const importPostcssModules = createCachedImport(() => import('./dep-6d23b7fa.js').then(function (n) { return n.i; }));
|
|
39544
38415
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
39545
38416
|
/**
|
|
39546
38417
|
* @experimental
|
|
@@ -39594,7 +38465,7 @@ async function resolvePostcssConfig(config) {
|
|
|
39594
38465
|
}
|
|
39595
38466
|
// inline postcss config via vite config
|
|
39596
38467
|
const inlineOptions = config.css?.postcss;
|
|
39597
|
-
if (isObject$
|
|
38468
|
+
if (isObject$1(inlineOptions)) {
|
|
39598
38469
|
const options = { ...inlineOptions };
|
|
39599
38470
|
delete options.plugins;
|
|
39600
38471
|
result = {
|
|
@@ -42911,7 +41782,7 @@ function clientInjectionsPlugin(config) {
|
|
|
42911
41782
|
const devBase = config.base;
|
|
42912
41783
|
const serverHost = `${resolvedServerHostname}:${resolvedServerPort}${devBase}`;
|
|
42913
41784
|
let hmrConfig = config.server.hmr;
|
|
42914
|
-
hmrConfig = isObject$
|
|
41785
|
+
hmrConfig = isObject$1(hmrConfig) ? hmrConfig : undefined;
|
|
42915
41786
|
const host = hmrConfig?.host || null;
|
|
42916
41787
|
const protocol = hmrConfig?.protocol || null;
|
|
42917
41788
|
const timeout = hmrConfig?.timeout || 30000;
|
|
@@ -43043,7 +41914,7 @@ const wasmHelperPlugin = (config) => {
|
|
|
43043
41914
|
if (!id.endsWith('.wasm?init')) {
|
|
43044
41915
|
return;
|
|
43045
41916
|
}
|
|
43046
|
-
const url = await fileToUrl(id, config, this);
|
|
41917
|
+
const url = await fileToUrl$1(id, config, this);
|
|
43047
41918
|
return `
|
|
43048
41919
|
import initWasm from "${wasmHelperId}"
|
|
43049
41920
|
export default opts => initWasm(opts, ${JSON.stringify(url)})
|
|
@@ -43335,7 +42206,7 @@ function webWorkerPlugin(config) {
|
|
|
43335
42206
|
}
|
|
43336
42207
|
}
|
|
43337
42208
|
else {
|
|
43338
|
-
url = await fileToUrl(cleanUrl(id), config, this);
|
|
42209
|
+
url = await fileToUrl$1(cleanUrl(id), config, this);
|
|
43339
42210
|
url = injectQuery(url, WORKER_FILE_ID);
|
|
43340
42211
|
url = injectQuery(url, `type=${workerType}`);
|
|
43341
42212
|
}
|
|
@@ -43743,7 +42614,7 @@ function workerImportMetaUrlPlugin(config) {
|
|
|
43743
42614
|
builtUrl = await workerFileToUrl(config, file, query);
|
|
43744
42615
|
}
|
|
43745
42616
|
else {
|
|
43746
|
-
builtUrl = await fileToUrl(cleanUrl(file), config, this);
|
|
42617
|
+
builtUrl = await fileToUrl$1(cleanUrl(file), config, this);
|
|
43747
42618
|
builtUrl = injectQuery(builtUrl, WORKER_FILE_ID);
|
|
43748
42619
|
builtUrl = injectQuery(builtUrl, `type=${workerType}`);
|
|
43749
42620
|
}
|
|
@@ -43856,10 +42727,10 @@ function assetImportMetaUrlPlugin(config) {
|
|
|
43856
42727
|
try {
|
|
43857
42728
|
if (isParentDirectory(normalizedPublicDir, file)) {
|
|
43858
42729
|
const publicPath = '/' + path$o.posix.relative(normalizedPublicDir, file);
|
|
43859
|
-
builtUrl = await fileToUrl(publicPath, config, this);
|
|
42730
|
+
builtUrl = await fileToUrl$1(publicPath, config, this);
|
|
43860
42731
|
}
|
|
43861
42732
|
else {
|
|
43862
|
-
builtUrl = await fileToUrl(file, config, this);
|
|
42733
|
+
builtUrl = await fileToUrl$1(file, config, this);
|
|
43863
42734
|
}
|
|
43864
42735
|
}
|
|
43865
42736
|
catch {
|
|
@@ -44125,14 +42996,17 @@ function parseDynamicImportPattern(strings) {
|
|
|
44125
42996
|
}
|
|
44126
42997
|
const [userPattern] = userPatternQuery.split(requestQuerySplitRE, 2);
|
|
44127
42998
|
const [rawPattern] = filename.split(requestQuerySplitRE, 2);
|
|
44128
|
-
|
|
44129
|
-
|
|
44130
|
-
|
|
44131
|
-
|
|
44132
|
-
|
|
42999
|
+
const as = ['worker', 'url', 'raw'].find((key) => rawQuery && key in rawQuery);
|
|
43000
|
+
if (as) {
|
|
43001
|
+
globParams = {
|
|
43002
|
+
as,
|
|
43003
|
+
import: '*',
|
|
43004
|
+
};
|
|
44133
43005
|
}
|
|
44134
|
-
if (rawQuery
|
|
44135
|
-
globParams = {
|
|
43006
|
+
else if (rawQuery) {
|
|
43007
|
+
globParams = {
|
|
43008
|
+
query: rawQuery,
|
|
43009
|
+
};
|
|
44136
43010
|
}
|
|
44137
43011
|
return {
|
|
44138
43012
|
globParams,
|
|
@@ -44154,9 +43028,7 @@ async function transformDynamicImport(importSource, importer, resolve, root) {
|
|
|
44154
43028
|
return null;
|
|
44155
43029
|
}
|
|
44156
43030
|
const { globParams, rawPattern, userPattern } = dynamicImportPattern;
|
|
44157
|
-
const params = globParams
|
|
44158
|
-
? `, ${JSON.stringify({ ...globParams, import: '*' })}`
|
|
44159
|
-
: '';
|
|
43031
|
+
const params = globParams ? `, ${JSON.stringify(globParams)}` : '';
|
|
44160
43032
|
let newRawPattern = posix$1.relative(posix$1.dirname(importer), await toAbsoluteGlob(rawPattern, root, importer, resolve));
|
|
44161
43033
|
if (!relativePathRE.test(newRawPattern)) {
|
|
44162
43034
|
newRawPattern = `./${newRawPattern}`;
|
|
@@ -44966,7 +43838,7 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
44966
43838
|
const handler = 'handler' in plugin.load ? plugin.load.handler : plugin.load;
|
|
44967
43839
|
const result = await handleHookPromise(handler.call(ctx, id, { ssr }));
|
|
44968
43840
|
if (result != null) {
|
|
44969
|
-
if (isObject$
|
|
43841
|
+
if (isObject$1(result)) {
|
|
44970
43842
|
updateModuleInfo(id, result);
|
|
44971
43843
|
}
|
|
44972
43844
|
return result;
|
|
@@ -45001,7 +43873,7 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
45001
43873
|
if (!result)
|
|
45002
43874
|
continue;
|
|
45003
43875
|
debugPluginTransform?.(timeFrom(start), plugin.name, prettifyUrl(id, root));
|
|
45004
|
-
if (isObject$
|
|
43876
|
+
if (isObject$1(result)) {
|
|
45005
43877
|
if (result.code !== undefined) {
|
|
45006
43878
|
code = result.code;
|
|
45007
43879
|
if (result.map) {
|
|
@@ -45151,7 +44023,7 @@ async function computeEntries(config) {
|
|
|
45151
44023
|
else if (Array.isArray(buildInput)) {
|
|
45152
44024
|
entries = buildInput.map(resolvePath);
|
|
45153
44025
|
}
|
|
45154
|
-
else if (isObject$
|
|
44026
|
+
else if (isObject$1(buildInput)) {
|
|
45155
44027
|
entries = Object.values(buildInput).map(resolvePath);
|
|
45156
44028
|
}
|
|
45157
44029
|
else {
|
|
@@ -55583,7 +54455,7 @@ async function resolveHttpServer({ proxy }, app, httpsOptions) {
|
|
|
55583
54455
|
async function resolveHttpsConfig(https) {
|
|
55584
54456
|
if (!https)
|
|
55585
54457
|
return undefined;
|
|
55586
|
-
if (!isObject$
|
|
54458
|
+
if (!isObject$1(https))
|
|
55587
54459
|
return {};
|
|
55588
54460
|
const [ca, cert, key, pfx] = await Promise.all([
|
|
55589
54461
|
readFileIfExists(https.ca),
|
|
@@ -55784,7 +54656,7 @@ async function loadAndTransform(id, url, server, options, timestamp, mod, resolv
|
|
|
55784
54656
|
}
|
|
55785
54657
|
else {
|
|
55786
54658
|
debugLoad?.(`${timeFrom(loadStart)} [plugin] ${prettyUrl}`);
|
|
55787
|
-
if (isObject$
|
|
54659
|
+
if (isObject$1(loadResult)) {
|
|
55788
54660
|
code = loadResult.code;
|
|
55789
54661
|
map = loadResult.map;
|
|
55790
54662
|
}
|
|
@@ -55821,7 +54693,7 @@ async function loadAndTransform(id, url, server, options, timestamp, mod, resolv
|
|
|
55821
54693
|
});
|
|
55822
54694
|
const originalCode = code;
|
|
55823
54695
|
if (transformResult == null ||
|
|
55824
|
-
(isObject$
|
|
54696
|
+
(isObject$1(transformResult) && transformResult.code == null)) {
|
|
55825
54697
|
// no transform applied, keep code as-is
|
|
55826
54698
|
debugTransform?.(timeFrom(transformStart) + colors$1.dim(` [skipped] ${prettyUrl}`));
|
|
55827
54699
|
}
|
|
@@ -56881,7 +55753,7 @@ async function nodeImport(id, importer, resolveOptions) {
|
|
|
56881
55753
|
}
|
|
56882
55754
|
url = pathToFileURL(resolved.id).toString();
|
|
56883
55755
|
}
|
|
56884
|
-
const mod = await
|
|
55756
|
+
const mod = await import(url);
|
|
56885
55757
|
return proxyESM(mod);
|
|
56886
55758
|
}
|
|
56887
55759
|
// rollup-style default import interop for cjs
|
|
@@ -62597,7 +61469,7 @@ const wsServerEvents = [
|
|
|
62597
61469
|
function createWebSocketServer(server, config, httpsOptions) {
|
|
62598
61470
|
let wss;
|
|
62599
61471
|
let wsHttpServer = undefined;
|
|
62600
|
-
const hmr = isObject$
|
|
61472
|
+
const hmr = isObject$1(config.server.hmr) && config.server.hmr;
|
|
62601
61473
|
const hmrServer = hmr && hmr.server;
|
|
62602
61474
|
const hmrPort = hmr && hmr.port;
|
|
62603
61475
|
// TODO: the main server port may not have been chosen yet as it may use the next available
|
|
@@ -62825,9 +61697,9 @@ function baseMiddleware({ config, }) {
|
|
|
62825
61697
|
res.end();
|
|
62826
61698
|
return;
|
|
62827
61699
|
}
|
|
62828
|
-
|
|
62829
|
-
|
|
62830
|
-
|
|
61700
|
+
// non-based page visit
|
|
61701
|
+
const redirectPath = withTrailingSlash(url) !== base ? joinUrlSegments(base, url) : base;
|
|
61702
|
+
if (req.headers.accept?.includes('text/html')) {
|
|
62831
61703
|
res.writeHead(404, {
|
|
62832
61704
|
'Content-Type': 'text/html',
|
|
62833
61705
|
});
|
|
@@ -62835,7 +61707,15 @@ function baseMiddleware({ config, }) {
|
|
|
62835
61707
|
`did you mean to visit <a href="${redirectPath}">${redirectPath}</a> instead?`);
|
|
62836
61708
|
return;
|
|
62837
61709
|
}
|
|
62838
|
-
|
|
61710
|
+
else {
|
|
61711
|
+
// not found for resources
|
|
61712
|
+
res.writeHead(404, {
|
|
61713
|
+
'Content-Type': 'text/plain',
|
|
61714
|
+
});
|
|
61715
|
+
res.end(`The server is configured with a public base URL of ${base} - ` +
|
|
61716
|
+
`did you mean to visit ${redirectPath} instead?`);
|
|
61717
|
+
return;
|
|
61718
|
+
}
|
|
62839
61719
|
};
|
|
62840
61720
|
}
|
|
62841
61721
|
|
|
@@ -65382,31 +64262,24 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
|
|
|
65382
64262
|
url = injectQuery(url, `t=${mod.lastHMRTimestamp}`);
|
|
65383
64263
|
}
|
|
65384
64264
|
}
|
|
65385
|
-
|
|
65386
|
-
|
|
65387
|
-
//
|
|
65388
|
-
|
|
65389
|
-
|
|
65390
|
-
|
|
65391
|
-
|
|
65392
|
-
|
|
65393
|
-
|
|
65394
|
-
else if ((url[0] === '.' || startsWithWordCharRE.test(url)) &&
|
|
65395
|
-
originalUrl &&
|
|
65396
|
-
originalUrl !== '/' &&
|
|
65397
|
-
htmlPath === '/index.html') {
|
|
64265
|
+
if ((url[0] === '/' && url[1] !== '/') ||
|
|
64266
|
+
// #3230 if some request url (localhost:3000/a/b) return to fallback html, the relative assets
|
|
64267
|
+
// path will add `/a/` prefix, it will caused 404.
|
|
64268
|
+
// rewrite before `./index.js` -> `localhost:5173/a/index.js`.
|
|
64269
|
+
// rewrite after `../index.js` -> `localhost:5173/index.js`.
|
|
64270
|
+
((url[0] === '.' || startsWithWordCharRE.test(url)) &&
|
|
64271
|
+
originalUrl &&
|
|
64272
|
+
originalUrl !== '/' &&
|
|
64273
|
+
htmlPath === '/index.html')) {
|
|
65398
64274
|
// prefix with base (dev only, base is never relative)
|
|
65399
64275
|
const replacer = (url) => {
|
|
64276
|
+
const devBase = config.base;
|
|
65400
64277
|
const fullUrl = path$o.posix.join(devBase, url);
|
|
65401
64278
|
if (server && shouldPreTransform(url, config)) {
|
|
65402
64279
|
preTransformRequest(server, fullUrl, devBase);
|
|
65403
64280
|
}
|
|
65404
64281
|
return fullUrl;
|
|
65405
64282
|
};
|
|
65406
|
-
// #3230 if some request url (localhost:3000/a/b) return to fallback html, the relative assets
|
|
65407
|
-
// path will add `/a/` prefix, it will caused 404.
|
|
65408
|
-
// rewrite before `./index.js` -> `localhost:5173/a/index.js`.
|
|
65409
|
-
// rewrite after `../index.js` -> `localhost:5173/index.js`.
|
|
65410
64283
|
const processedUrl = useSrcSetReplacer
|
|
65411
64284
|
? processSrcSetSync(url, ({ url }) => replacer(url))
|
|
65412
64285
|
: replacer(url);
|
|
@@ -65732,7 +64605,11 @@ class ModuleGraph {
|
|
|
65732
64605
|
mod.ssrTransformResult = null;
|
|
65733
64606
|
mod.ssrModule = null;
|
|
65734
64607
|
mod.ssrError = null;
|
|
65735
|
-
//
|
|
64608
|
+
// https://github.com/vitejs/vite/issues/3033
|
|
64609
|
+
// Given b.js -> c.js -> b.js (arrow means top-level import), if c.js self-accepts
|
|
64610
|
+
// and refetches itself, the execution order becomes c.js -> b.js -> c.js. The import
|
|
64611
|
+
// order matters here as it will fail. The workaround for now is to not hmr invalidate
|
|
64612
|
+
// b.js so that c.js refetches the already cached b.js, skipping the import loop.
|
|
65736
64613
|
if (hmrBoundaries.includes(mod)) {
|
|
65737
64614
|
return;
|
|
65738
64615
|
}
|
|
@@ -65934,6 +64811,71 @@ class ModuleGraph {
|
|
|
65934
64811
|
}
|
|
65935
64812
|
}
|
|
65936
64813
|
|
|
64814
|
+
function warmupFiles(server) {
|
|
64815
|
+
const options = server.config.server.warmup;
|
|
64816
|
+
const root = server.config.root;
|
|
64817
|
+
if (options?.clientFiles?.length) {
|
|
64818
|
+
mapFiles(options.clientFiles, root).then((files) => {
|
|
64819
|
+
for (const file of files) {
|
|
64820
|
+
warmupFile(server, file, false);
|
|
64821
|
+
}
|
|
64822
|
+
});
|
|
64823
|
+
}
|
|
64824
|
+
if (options?.ssrFiles?.length) {
|
|
64825
|
+
mapFiles(options.ssrFiles, root).then((files) => {
|
|
64826
|
+
for (const file of files) {
|
|
64827
|
+
warmupFile(server, file, true);
|
|
64828
|
+
}
|
|
64829
|
+
});
|
|
64830
|
+
}
|
|
64831
|
+
}
|
|
64832
|
+
async function warmupFile(server, file, ssr) {
|
|
64833
|
+
try {
|
|
64834
|
+
// transform html with the `transformIndexHtml` hook as Vite internals would
|
|
64835
|
+
// pre-transform the imported JS modules linked. this may cause `transformIndexHtml`
|
|
64836
|
+
// plugins to be executed twice, but that's probably fine.
|
|
64837
|
+
if (file.endsWith('.html')) {
|
|
64838
|
+
const url = htmlFileToUrl(file, server.config.root);
|
|
64839
|
+
if (url) {
|
|
64840
|
+
const html = await fsp.readFile(file, 'utf-8');
|
|
64841
|
+
await server.transformIndexHtml(url, html);
|
|
64842
|
+
}
|
|
64843
|
+
}
|
|
64844
|
+
// for other files, pass it through `transformRequest`. this is what Vite uses
|
|
64845
|
+
// for it's `server.preTransformRequests` option.
|
|
64846
|
+
else {
|
|
64847
|
+
const url = fileToUrl(file, server.config.root);
|
|
64848
|
+
await server.transformRequest(url, { ssr });
|
|
64849
|
+
}
|
|
64850
|
+
}
|
|
64851
|
+
catch (e) {
|
|
64852
|
+
server.config.logger.error(colors$1.red(`Failed to warm up ${colors$1.cyan(file)}:\n`) + e.message);
|
|
64853
|
+
}
|
|
64854
|
+
}
|
|
64855
|
+
function htmlFileToUrl(file, root) {
|
|
64856
|
+
const url = path$o.relative(root, file);
|
|
64857
|
+
// out of root, ignore file
|
|
64858
|
+
if (url[0] === '.')
|
|
64859
|
+
return;
|
|
64860
|
+
// file within root, create root-relative url
|
|
64861
|
+
return '/' + normalizePath$3(url);
|
|
64862
|
+
}
|
|
64863
|
+
function fileToUrl(file, root) {
|
|
64864
|
+
const url = path$o.relative(root, file);
|
|
64865
|
+
// out of root, use /@fs/ prefix
|
|
64866
|
+
if (url[0] === '.') {
|
|
64867
|
+
return path$o.posix.join(FS_PREFIX, normalizePath$3(file));
|
|
64868
|
+
}
|
|
64869
|
+
// file within root, create root-relative url
|
|
64870
|
+
return '/' + normalizePath$3(url);
|
|
64871
|
+
}
|
|
64872
|
+
function mapFiles(files, root) {
|
|
64873
|
+
return glob(files, {
|
|
64874
|
+
cwd: root,
|
|
64875
|
+
absolute: true,
|
|
64876
|
+
});
|
|
64877
|
+
}
|
|
64878
|
+
|
|
65937
64879
|
function createServer(inlineConfig = {}) {
|
|
65938
64880
|
return _createServer(inlineConfig, { ws: true });
|
|
65939
64881
|
}
|
|
@@ -66014,6 +64956,29 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
66014
64956
|
const path = typeof options.open === 'string'
|
|
66015
64957
|
? new URL(options.open, url).href
|
|
66016
64958
|
: url;
|
|
64959
|
+
// We know the url that the browser would be opened to, so we can
|
|
64960
|
+
// start the request while we are awaiting the browser. This will
|
|
64961
|
+
// start the crawling of static imports ~500ms before.
|
|
64962
|
+
// preTransformRequests needs to be enabled for this optimization.
|
|
64963
|
+
if (server.config.server.preTransformRequests) {
|
|
64964
|
+
setTimeout(() => {
|
|
64965
|
+
get$1(path, {
|
|
64966
|
+
headers: {
|
|
64967
|
+
// Allow the history middleware to redirect to /index.html
|
|
64968
|
+
Accept: 'text/html',
|
|
64969
|
+
},
|
|
64970
|
+
}, (res) => {
|
|
64971
|
+
res.on('end', () => {
|
|
64972
|
+
// Ignore response, scripts discovered while processing the entry
|
|
64973
|
+
// will be preprocessed (server.config.server.preTransformRequests)
|
|
64974
|
+
});
|
|
64975
|
+
})
|
|
64976
|
+
.on('error', () => {
|
|
64977
|
+
// Ignore errors
|
|
64978
|
+
})
|
|
64979
|
+
.end();
|
|
64980
|
+
}, 0);
|
|
64981
|
+
}
|
|
66017
64982
|
openBrowser(path, true, server.config.logger);
|
|
66018
64983
|
}
|
|
66019
64984
|
else {
|
|
@@ -66217,6 +65182,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
66217
65182
|
if (isDepsOptimizerEnabled(config, false)) {
|
|
66218
65183
|
await initDepsOptimizer(config, server);
|
|
66219
65184
|
}
|
|
65185
|
+
warmupFiles(server);
|
|
66220
65186
|
initingServer = undefined;
|
|
66221
65187
|
serverInited = true;
|
|
66222
65188
|
})();
|
|
@@ -67059,7 +66025,7 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
|
67059
66025
|
const config = await (typeof userConfig === 'function'
|
|
67060
66026
|
? userConfig(configEnv)
|
|
67061
66027
|
: userConfig);
|
|
67062
|
-
if (!isObject$
|
|
66028
|
+
if (!isObject$1(config)) {
|
|
67063
66029
|
throw new Error(`config must export or return an object.`);
|
|
67064
66030
|
}
|
|
67065
66031
|
return {
|
|
@@ -67204,7 +66170,7 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
|
|
|
67204
66170
|
const fileUrl = `${pathToFileURL(fileBase)}.mjs`;
|
|
67205
66171
|
await fsp.writeFile(fileNameTmp, bundledCode);
|
|
67206
66172
|
try {
|
|
67207
|
-
return (await
|
|
66173
|
+
return (await import(fileUrl)).default;
|
|
67208
66174
|
}
|
|
67209
66175
|
finally {
|
|
67210
66176
|
fs$l.unlink(fileNameTmp, () => { }); // Ignore errors
|
|
@@ -67260,4 +66226,4 @@ function isDepsOptimizerEnabled(config, ssr) {
|
|
|
67260
66226
|
(command === 'serve' && disabled === 'dev'));
|
|
67261
66227
|
}
|
|
67262
66228
|
|
|
67263
|
-
export {
|
|
66229
|
+
export { index$1 as A, build$1 as B, index as C, preview$1 as D, preprocessCSS as a, build as b, createServer as c, defineConfig as d, buildErrorMessage as e, formatPostcssSourceMap as f, mergeAlias as g, createFilter as h, isInNodeModules$1 as i, send$2 as j, createLogger as k, loadConfigFromFile as l, mergeConfig as m, normalizePath$3 as n, optimizeDeps as o, preview as p, searchForWorkspaceRoot as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, isFileServingAllowed as u, loadEnv as v, resolveEnvPrefix as w, colors$1 as x, getDefaultExportFromCjs as y, commonjsGlobal as z };
|