vite 2.9.0-beta.3 → 2.9.0-beta.4
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.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
- package/LICENSE.md +1 -1
- package/dist/node/chunks/{dep-ca2a26a1.js → dep-0d07874d.js} +3 -3
- package/dist/node/chunks/{dep-ec2e68f4.js → dep-5633cdf8.js} +0 -0
- package/dist/node/chunks/{dep-19d0f55f.js → dep-5a245411.js} +2309 -1141
- package/dist/node/chunks/{dep-f14ba655.js → dep-8a000299.js} +1 -1
- package/dist/node/chunks/{dep-192b3800.js → dep-dd016db2.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/index.d.ts +53 -28
- package/dist/node/index.js +1 -1
- package/dist/node/terser.js +90 -15
- package/package.json +15 -15
- package/types/ws.d.ts +54 -29
|
@@ -1726,7 +1726,7 @@ class TraceMap {
|
|
|
1726
1726
|
this.resolvedSources = sources.map((s) => resolve$2(s || '', from));
|
|
1727
1727
|
}
|
|
1728
1728
|
else {
|
|
1729
|
-
this.resolvedSources = sources;
|
|
1729
|
+
this.resolvedSources = sources.map((s) => s || '');
|
|
1730
1730
|
}
|
|
1731
1731
|
const { mappings } = parsed;
|
|
1732
1732
|
if (typeof mappings === 'string') {
|
|
@@ -1979,14 +1979,15 @@ function buildSourceMapTree(input, loader) {
|
|
|
1979
1979
|
'Did you specify these with the most recent transformation maps first?');
|
|
1980
1980
|
}
|
|
1981
1981
|
}
|
|
1982
|
-
let tree = build$2(map, '',
|
|
1982
|
+
let tree = build$2(map, loader, '', 0);
|
|
1983
1983
|
for (let i = maps.length - 1; i >= 0; i--) {
|
|
1984
1984
|
tree = new SourceMapTree(maps[i], [tree]);
|
|
1985
1985
|
}
|
|
1986
1986
|
return tree;
|
|
1987
1987
|
}
|
|
1988
|
-
function build$2(map, importer,
|
|
1988
|
+
function build$2(map, loader, importer, importerDepth) {
|
|
1989
1989
|
const { resolvedSources, sourcesContent } = map;
|
|
1990
|
+
const depth = importerDepth + 1;
|
|
1990
1991
|
const children = resolvedSources.map((sourceFile, i) => {
|
|
1991
1992
|
// The loading context gives the loader more information about why this file is being loaded
|
|
1992
1993
|
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
|
@@ -1994,6 +1995,7 @@ function build$2(map, importer, loader) {
|
|
|
1994
1995
|
// an unmodified source file.
|
|
1995
1996
|
const ctx = {
|
|
1996
1997
|
importer,
|
|
1998
|
+
depth,
|
|
1997
1999
|
source: sourceFile || '',
|
|
1998
2000
|
content: undefined,
|
|
1999
2001
|
};
|
|
@@ -2011,7 +2013,7 @@ function build$2(map, importer, loader) {
|
|
|
2011
2013
|
}
|
|
2012
2014
|
// Else, it's a real sourcemap, and we need to recurse into it to load its
|
|
2013
2015
|
// source files.
|
|
2014
|
-
return build$2(new TraceMap(sourceMap, source), source,
|
|
2016
|
+
return build$2(new TraceMap(sourceMap, source), loader, source, depth);
|
|
2015
2017
|
});
|
|
2016
2018
|
return new SourceMapTree(map, children);
|
|
2017
2019
|
}
|
|
@@ -2020,7 +2022,7 @@ function build$2(map, importer, loader) {
|
|
|
2020
2022
|
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
|
2021
2023
|
* provided to it.
|
|
2022
2024
|
*/
|
|
2023
|
-
class SourceMap$
|
|
2025
|
+
class SourceMap$2 {
|
|
2024
2026
|
constructor(map, options) {
|
|
2025
2027
|
this.version = 3; // SourceMap spec says this should be first.
|
|
2026
2028
|
this.file = map.file;
|
|
@@ -2055,7 +2057,7 @@ class SourceMap$1 {
|
|
|
2055
2057
|
function remapping(input, loader, options) {
|
|
2056
2058
|
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
|
2057
2059
|
const tree = buildSourceMapTree(input, loader);
|
|
2058
|
-
return new SourceMap$
|
|
2060
|
+
return new SourceMap$2(traceMappings(tree), opts);
|
|
2059
2061
|
}
|
|
2060
2062
|
|
|
2061
2063
|
function slash$1(p) {
|
|
@@ -2294,7 +2296,7 @@ function prettifyUrl(url, root) {
|
|
|
2294
2296
|
return colors$1.dim(url);
|
|
2295
2297
|
}
|
|
2296
2298
|
}
|
|
2297
|
-
function isObject$
|
|
2299
|
+
function isObject$4(value) {
|
|
2298
2300
|
return Object.prototype.toString.call(value) === '[object Object]';
|
|
2299
2301
|
}
|
|
2300
2302
|
function isDefined(value) {
|
|
@@ -2925,204 +2927,208 @@ function encodeInteger(num) {
|
|
|
2925
2927
|
return result;
|
|
2926
2928
|
}
|
|
2927
2929
|
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
BitSet.prototype.add = function add (n) {
|
|
2933
|
-
this.bits[n >> 5] |= 1 << (n & 31);
|
|
2934
|
-
};
|
|
2930
|
+
class BitSet$1 {
|
|
2931
|
+
constructor(arg) {
|
|
2932
|
+
this.bits = arg instanceof BitSet$1 ? arg.bits.slice() : [];
|
|
2933
|
+
}
|
|
2935
2934
|
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
}
|
|
2935
|
+
add(n) {
|
|
2936
|
+
this.bits[n >> 5] |= 1 << (n & 31);
|
|
2937
|
+
}
|
|
2939
2938
|
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2939
|
+
has(n) {
|
|
2940
|
+
return !!(this.bits[n >> 5] & (1 << (n & 31)));
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2944
2943
|
|
|
2945
|
-
|
|
2946
|
-
|
|
2944
|
+
class Chunk$1 {
|
|
2945
|
+
constructor(start, end, content) {
|
|
2946
|
+
this.start = start;
|
|
2947
|
+
this.end = end;
|
|
2948
|
+
this.original = content;
|
|
2947
2949
|
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
this.edited = false;
|
|
2950
|
+
this.intro = '';
|
|
2951
|
+
this.outro = '';
|
|
2951
2952
|
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
next: { writable: true, value: null }
|
|
2956
|
-
});
|
|
2957
|
-
};
|
|
2953
|
+
this.content = content;
|
|
2954
|
+
this.storeName = false;
|
|
2955
|
+
this.edited = false;
|
|
2958
2956
|
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
}
|
|
2957
|
+
// we make these non-enumerable, for sanity while debugging
|
|
2958
|
+
Object.defineProperties(this, {
|
|
2959
|
+
previous: { writable: true, value: null },
|
|
2960
|
+
next: { writable: true, value: null },
|
|
2961
|
+
});
|
|
2962
|
+
}
|
|
2962
2963
|
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
}
|
|
2964
|
+
appendLeft(content) {
|
|
2965
|
+
this.outro += content;
|
|
2966
|
+
}
|
|
2966
2967
|
|
|
2967
|
-
|
|
2968
|
-
|
|
2968
|
+
appendRight(content) {
|
|
2969
|
+
this.intro = this.intro + content;
|
|
2970
|
+
}
|
|
2969
2971
|
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
chunk.content = this.content;
|
|
2973
|
-
chunk.storeName = this.storeName;
|
|
2974
|
-
chunk.edited = this.edited;
|
|
2972
|
+
clone() {
|
|
2973
|
+
const chunk = new Chunk$1(this.start, this.end, this.original);
|
|
2975
2974
|
|
|
2976
|
-
|
|
2977
|
-
|
|
2975
|
+
chunk.intro = this.intro;
|
|
2976
|
+
chunk.outro = this.outro;
|
|
2977
|
+
chunk.content = this.content;
|
|
2978
|
+
chunk.storeName = this.storeName;
|
|
2979
|
+
chunk.edited = this.edited;
|
|
2978
2980
|
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
};
|
|
2981
|
+
return chunk;
|
|
2982
|
+
}
|
|
2982
2983
|
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
while (chunk) {
|
|
2986
|
-
fn(chunk);
|
|
2987
|
-
chunk = chunk.next;
|
|
2984
|
+
contains(index) {
|
|
2985
|
+
return this.start < index && index < this.end;
|
|
2988
2986
|
}
|
|
2989
|
-
};
|
|
2990
2987
|
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2988
|
+
eachNext(fn) {
|
|
2989
|
+
let chunk = this;
|
|
2990
|
+
while (chunk) {
|
|
2991
|
+
fn(chunk);
|
|
2992
|
+
chunk = chunk.next;
|
|
2993
|
+
}
|
|
2996
2994
|
}
|
|
2997
|
-
};
|
|
2998
2995
|
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
2996
|
+
eachPrevious(fn) {
|
|
2997
|
+
let chunk = this;
|
|
2998
|
+
while (chunk) {
|
|
2999
|
+
fn(chunk);
|
|
3000
|
+
chunk = chunk.previous;
|
|
3001
|
+
}
|
|
3004
3002
|
}
|
|
3005
|
-
this.storeName = storeName;
|
|
3006
3003
|
|
|
3007
|
-
|
|
3004
|
+
edit(content, storeName, contentOnly) {
|
|
3005
|
+
this.content = content;
|
|
3006
|
+
if (!contentOnly) {
|
|
3007
|
+
this.intro = '';
|
|
3008
|
+
this.outro = '';
|
|
3009
|
+
}
|
|
3010
|
+
this.storeName = storeName;
|
|
3008
3011
|
|
|
3009
|
-
|
|
3010
|
-
};
|
|
3012
|
+
this.edited = true;
|
|
3011
3013
|
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
};
|
|
3014
|
+
return this;
|
|
3015
|
+
}
|
|
3015
3016
|
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
}
|
|
3017
|
+
prependLeft(content) {
|
|
3018
|
+
this.outro = content + this.outro;
|
|
3019
|
+
}
|
|
3019
3020
|
|
|
3020
|
-
|
|
3021
|
-
|
|
3021
|
+
prependRight(content) {
|
|
3022
|
+
this.intro = content + this.intro;
|
|
3023
|
+
}
|
|
3022
3024
|
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
+
split(index) {
|
|
3026
|
+
const sliceIndex = index - this.start;
|
|
3025
3027
|
|
|
3026
|
-
|
|
3028
|
+
const originalBefore = this.original.slice(0, sliceIndex);
|
|
3029
|
+
const originalAfter = this.original.slice(sliceIndex);
|
|
3027
3030
|
|
|
3028
|
-
|
|
3029
|
-
newChunk.outro = this.outro;
|
|
3030
|
-
this.outro = '';
|
|
3031
|
+
this.original = originalBefore;
|
|
3031
3032
|
|
|
3032
|
-
|
|
3033
|
+
const newChunk = new Chunk$1(index, this.end, originalAfter);
|
|
3034
|
+
newChunk.outro = this.outro;
|
|
3035
|
+
this.outro = '';
|
|
3033
3036
|
|
|
3034
|
-
|
|
3035
|
-
// TODO is this block necessary?...
|
|
3036
|
-
newChunk.edit('', false);
|
|
3037
|
-
this.content = '';
|
|
3038
|
-
} else {
|
|
3039
|
-
this.content = originalBefore;
|
|
3040
|
-
}
|
|
3037
|
+
this.end = index;
|
|
3041
3038
|
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3039
|
+
if (this.edited) {
|
|
3040
|
+
// TODO is this block necessary?...
|
|
3041
|
+
newChunk.edit('', false);
|
|
3042
|
+
this.content = '';
|
|
3043
|
+
} else {
|
|
3044
|
+
this.content = originalBefore;
|
|
3045
|
+
}
|
|
3046
3046
|
|
|
3047
|
-
|
|
3048
|
-
|
|
3047
|
+
newChunk.next = this.next;
|
|
3048
|
+
if (newChunk.next) newChunk.next.previous = newChunk;
|
|
3049
|
+
newChunk.previous = this;
|
|
3050
|
+
this.next = newChunk;
|
|
3049
3051
|
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
};
|
|
3052
|
+
return newChunk;
|
|
3053
|
+
}
|
|
3053
3054
|
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3055
|
+
toString() {
|
|
3056
|
+
return this.intro + this.content + this.outro;
|
|
3057
|
+
}
|
|
3057
3058
|
|
|
3058
|
-
|
|
3059
|
+
trimEnd(rx) {
|
|
3060
|
+
this.outro = this.outro.replace(rx, '');
|
|
3061
|
+
if (this.outro.length) return true;
|
|
3059
3062
|
|
|
3060
|
-
|
|
3061
|
-
if (trimmed !== this.content) {
|
|
3062
|
-
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
3063
|
-
}
|
|
3064
|
-
return true;
|
|
3063
|
+
const trimmed = this.content.replace(rx, '');
|
|
3065
3064
|
|
|
3066
|
-
|
|
3067
|
-
|
|
3065
|
+
if (trimmed.length) {
|
|
3066
|
+
if (trimmed !== this.content) {
|
|
3067
|
+
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
3068
|
+
}
|
|
3069
|
+
return true;
|
|
3070
|
+
} else {
|
|
3071
|
+
this.edit('', undefined, true);
|
|
3068
3072
|
|
|
3069
|
-
|
|
3070
|
-
|
|
3073
|
+
this.intro = this.intro.replace(rx, '');
|
|
3074
|
+
if (this.intro.length) return true;
|
|
3075
|
+
}
|
|
3071
3076
|
}
|
|
3072
|
-
};
|
|
3073
3077
|
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3078
|
+
trimStart(rx) {
|
|
3079
|
+
this.intro = this.intro.replace(rx, '');
|
|
3080
|
+
if (this.intro.length) return true;
|
|
3077
3081
|
|
|
3078
|
-
|
|
3082
|
+
const trimmed = this.content.replace(rx, '');
|
|
3079
3083
|
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3084
|
+
if (trimmed.length) {
|
|
3085
|
+
if (trimmed !== this.content) {
|
|
3086
|
+
this.split(this.end - trimmed.length);
|
|
3087
|
+
this.edit('', undefined, true);
|
|
3088
|
+
}
|
|
3089
|
+
return true;
|
|
3090
|
+
} else {
|
|
3083
3091
|
this.edit('', undefined, true);
|
|
3084
|
-
}
|
|
3085
|
-
return true;
|
|
3086
|
-
|
|
3087
|
-
} else {
|
|
3088
|
-
this.edit('', undefined, true);
|
|
3089
3092
|
|
|
3090
|
-
|
|
3091
|
-
|
|
3093
|
+
this.outro = this.outro.replace(rx, '');
|
|
3094
|
+
if (this.outro.length) return true;
|
|
3095
|
+
}
|
|
3092
3096
|
}
|
|
3093
|
-
}
|
|
3097
|
+
}
|
|
3094
3098
|
|
|
3095
|
-
|
|
3099
|
+
let btoa$2 = () => {
|
|
3096
3100
|
throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
|
|
3097
3101
|
};
|
|
3098
3102
|
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
|
|
3099
|
-
btoa$
|
|
3103
|
+
btoa$2 = (str) => window.btoa(unescape(encodeURIComponent(str)));
|
|
3100
3104
|
} else if (typeof Buffer === 'function') {
|
|
3101
|
-
btoa$
|
|
3105
|
+
btoa$2 = (str) => Buffer.from(str, 'utf-8').toString('base64');
|
|
3102
3106
|
}
|
|
3103
3107
|
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3108
|
+
class SourceMap$1 {
|
|
3109
|
+
constructor(properties) {
|
|
3110
|
+
this.version = 3;
|
|
3111
|
+
this.file = properties.file;
|
|
3112
|
+
this.sources = properties.sources;
|
|
3113
|
+
this.sourcesContent = properties.sourcesContent;
|
|
3114
|
+
this.names = properties.names;
|
|
3115
|
+
this.mappings = encode(properties.mappings);
|
|
3116
|
+
}
|
|
3112
3117
|
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
}
|
|
3118
|
+
toString() {
|
|
3119
|
+
return JSON.stringify(this);
|
|
3120
|
+
}
|
|
3116
3121
|
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
}
|
|
3122
|
+
toUrl() {
|
|
3123
|
+
return 'data:application/json;charset=utf-8;base64,' + btoa$2(this.toString());
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3120
3126
|
|
|
3121
|
-
function guessIndent(code) {
|
|
3122
|
-
|
|
3127
|
+
function guessIndent$1(code) {
|
|
3128
|
+
const lines = code.split('\n');
|
|
3123
3129
|
|
|
3124
|
-
|
|
3125
|
-
|
|
3130
|
+
const tabbed = lines.filter((line) => /^\t+/.test(line));
|
|
3131
|
+
const spaced = lines.filter((line) => /^ {2,}/.test(line));
|
|
3126
3132
|
|
|
3127
3133
|
if (tabbed.length === 0 && spaced.length === 0) {
|
|
3128
3134
|
return null;
|
|
@@ -3136,17 +3142,17 @@ function guessIndent(code) {
|
|
|
3136
3142
|
}
|
|
3137
3143
|
|
|
3138
3144
|
// Otherwise, we need to guess the multiple
|
|
3139
|
-
|
|
3140
|
-
|
|
3145
|
+
const min = spaced.reduce((previous, current) => {
|
|
3146
|
+
const numSpaces = /^ +/.exec(current)[0].length;
|
|
3141
3147
|
return Math.min(numSpaces, previous);
|
|
3142
3148
|
}, Infinity);
|
|
3143
3149
|
|
|
3144
3150
|
return new Array(min + 1).join(' ');
|
|
3145
3151
|
}
|
|
3146
3152
|
|
|
3147
|
-
function getRelativePath(from, to) {
|
|
3148
|
-
|
|
3149
|
-
|
|
3153
|
+
function getRelativePath$1(from, to) {
|
|
3154
|
+
const fromParts = from.split(/[/\\]/);
|
|
3155
|
+
const toParts = to.split(/[/\\]/);
|
|
3150
3156
|
|
|
3151
3157
|
fromParts.pop(); // get dirname
|
|
3152
3158
|
|
|
@@ -3156,791 +3162,838 @@ function getRelativePath(from, to) {
|
|
|
3156
3162
|
}
|
|
3157
3163
|
|
|
3158
3164
|
if (fromParts.length) {
|
|
3159
|
-
|
|
3160
|
-
while (i--)
|
|
3165
|
+
let i = fromParts.length;
|
|
3166
|
+
while (i--) fromParts[i] = '..';
|
|
3161
3167
|
}
|
|
3162
3168
|
|
|
3163
3169
|
return fromParts.concat(toParts).join('/');
|
|
3164
3170
|
}
|
|
3165
3171
|
|
|
3166
|
-
|
|
3172
|
+
const toString$3 = Object.prototype.toString;
|
|
3167
3173
|
|
|
3168
|
-
function isObject$
|
|
3169
|
-
return toString$
|
|
3174
|
+
function isObject$3(thing) {
|
|
3175
|
+
return toString$3.call(thing) === '[object Object]';
|
|
3170
3176
|
}
|
|
3171
3177
|
|
|
3172
|
-
function getLocator(source) {
|
|
3173
|
-
|
|
3174
|
-
|
|
3178
|
+
function getLocator$1(source) {
|
|
3179
|
+
const originalLines = source.split('\n');
|
|
3180
|
+
const lineOffsets = [];
|
|
3175
3181
|
|
|
3176
|
-
for (
|
|
3182
|
+
for (let i = 0, pos = 0; i < originalLines.length; i++) {
|
|
3177
3183
|
lineOffsets.push(pos);
|
|
3178
3184
|
pos += originalLines[i].length + 1;
|
|
3179
3185
|
}
|
|
3180
3186
|
|
|
3181
3187
|
return function locate(index) {
|
|
3182
|
-
|
|
3183
|
-
|
|
3188
|
+
let i = 0;
|
|
3189
|
+
let j = lineOffsets.length;
|
|
3184
3190
|
while (i < j) {
|
|
3185
|
-
|
|
3191
|
+
const m = (i + j) >> 1;
|
|
3186
3192
|
if (index < lineOffsets[m]) {
|
|
3187
3193
|
j = m;
|
|
3188
3194
|
} else {
|
|
3189
3195
|
i = m + 1;
|
|
3190
3196
|
}
|
|
3191
3197
|
}
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
return { line
|
|
3198
|
+
const line = i - 1;
|
|
3199
|
+
const column = index - lineOffsets[line];
|
|
3200
|
+
return { line, column };
|
|
3195
3201
|
};
|
|
3196
3202
|
}
|
|
3197
3203
|
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3204
|
+
class Mappings$1 {
|
|
3205
|
+
constructor(hires) {
|
|
3206
|
+
this.hires = hires;
|
|
3207
|
+
this.generatedCodeLine = 0;
|
|
3208
|
+
this.generatedCodeColumn = 0;
|
|
3209
|
+
this.raw = [];
|
|
3210
|
+
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
3211
|
+
this.pending = null;
|
|
3212
|
+
}
|
|
3206
3213
|
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3214
|
+
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
3215
|
+
if (content.length) {
|
|
3216
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
3217
|
+
if (nameIndex >= 0) {
|
|
3218
|
+
segment.push(nameIndex);
|
|
3219
|
+
}
|
|
3220
|
+
this.rawSegments.push(segment);
|
|
3221
|
+
} else if (this.pending) {
|
|
3222
|
+
this.rawSegments.push(this.pending);
|
|
3212
3223
|
}
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
this.
|
|
3224
|
+
|
|
3225
|
+
this.advance(content);
|
|
3226
|
+
this.pending = null;
|
|
3216
3227
|
}
|
|
3217
3228
|
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3229
|
+
addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
3230
|
+
let originalCharIndex = chunk.start;
|
|
3231
|
+
let first = true;
|
|
3221
3232
|
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3233
|
+
while (originalCharIndex < chunk.end) {
|
|
3234
|
+
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
|
|
3235
|
+
this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
|
|
3236
|
+
}
|
|
3225
3237
|
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3238
|
+
if (original[originalCharIndex] === '\n') {
|
|
3239
|
+
loc.line += 1;
|
|
3240
|
+
loc.column = 0;
|
|
3241
|
+
this.generatedCodeLine += 1;
|
|
3242
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
3243
|
+
this.generatedCodeColumn = 0;
|
|
3244
|
+
first = true;
|
|
3245
|
+
} else {
|
|
3246
|
+
loc.column += 1;
|
|
3247
|
+
this.generatedCodeColumn += 1;
|
|
3248
|
+
first = false;
|
|
3249
|
+
}
|
|
3230
3250
|
|
|
3231
|
-
|
|
3232
|
-
loc.line += 1;
|
|
3233
|
-
loc.column = 0;
|
|
3234
|
-
this.generatedCodeLine += 1;
|
|
3235
|
-
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
3236
|
-
this.generatedCodeColumn = 0;
|
|
3237
|
-
first = true;
|
|
3238
|
-
} else {
|
|
3239
|
-
loc.column += 1;
|
|
3240
|
-
this.generatedCodeColumn += 1;
|
|
3241
|
-
first = false;
|
|
3251
|
+
originalCharIndex += 1;
|
|
3242
3252
|
}
|
|
3243
3253
|
|
|
3244
|
-
|
|
3254
|
+
this.pending = null;
|
|
3245
3255
|
}
|
|
3246
3256
|
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
Mappings.prototype.advance = function advance (str) {
|
|
3251
|
-
if (!str) { return; }
|
|
3257
|
+
advance(str) {
|
|
3258
|
+
if (!str) return;
|
|
3252
3259
|
|
|
3253
|
-
|
|
3260
|
+
const lines = str.split('\n');
|
|
3254
3261
|
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3262
|
+
if (lines.length > 1) {
|
|
3263
|
+
for (let i = 0; i < lines.length - 1; i++) {
|
|
3264
|
+
this.generatedCodeLine++;
|
|
3265
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
3266
|
+
}
|
|
3267
|
+
this.generatedCodeColumn = 0;
|
|
3259
3268
|
}
|
|
3260
|
-
this.generatedCodeColumn = 0;
|
|
3261
|
-
}
|
|
3262
3269
|
|
|
3263
|
-
|
|
3264
|
-
}
|
|
3270
|
+
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3265
3273
|
|
|
3266
|
-
|
|
3274
|
+
const n$1 = '\n';
|
|
3267
3275
|
|
|
3268
|
-
|
|
3276
|
+
const warned$2 = {
|
|
3269
3277
|
insertLeft: false,
|
|
3270
3278
|
insertRight: false,
|
|
3271
|
-
storeName: false
|
|
3272
|
-
};
|
|
3279
|
+
storeName: false,
|
|
3280
|
+
};
|
|
3281
|
+
|
|
3282
|
+
class MagicString$1 {
|
|
3283
|
+
constructor(string, options = {}) {
|
|
3284
|
+
const chunk = new Chunk$1(0, string.length, string);
|
|
3285
|
+
|
|
3286
|
+
Object.defineProperties(this, {
|
|
3287
|
+
original: { writable: true, value: string },
|
|
3288
|
+
outro: { writable: true, value: '' },
|
|
3289
|
+
intro: { writable: true, value: '' },
|
|
3290
|
+
firstChunk: { writable: true, value: chunk },
|
|
3291
|
+
lastChunk: { writable: true, value: chunk },
|
|
3292
|
+
lastSearchedChunk: { writable: true, value: chunk },
|
|
3293
|
+
byStart: { writable: true, value: {} },
|
|
3294
|
+
byEnd: { writable: true, value: {} },
|
|
3295
|
+
filename: { writable: true, value: options.filename },
|
|
3296
|
+
indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
|
|
3297
|
+
sourcemapLocations: { writable: true, value: new BitSet$1() },
|
|
3298
|
+
storedNames: { writable: true, value: {} },
|
|
3299
|
+
indentStr: { writable: true, value: guessIndent$1(string) },
|
|
3300
|
+
});
|
|
3273
3301
|
|
|
3274
|
-
|
|
3275
|
-
|
|
3302
|
+
this.byStart[0] = chunk;
|
|
3303
|
+
this.byEnd[string.length] = chunk;
|
|
3304
|
+
}
|
|
3276
3305
|
|
|
3277
|
-
|
|
3306
|
+
addSourcemapLocation(char) {
|
|
3307
|
+
this.sourcemapLocations.add(char);
|
|
3308
|
+
}
|
|
3278
3309
|
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
outro: { writable: true, value: '' },
|
|
3282
|
-
intro: { writable: true, value: '' },
|
|
3283
|
-
firstChunk: { writable: true, value: chunk },
|
|
3284
|
-
lastChunk: { writable: true, value: chunk },
|
|
3285
|
-
lastSearchedChunk: { writable: true, value: chunk },
|
|
3286
|
-
byStart: { writable: true, value: {} },
|
|
3287
|
-
byEnd: { writable: true, value: {} },
|
|
3288
|
-
filename: { writable: true, value: options.filename },
|
|
3289
|
-
indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
|
|
3290
|
-
sourcemapLocations: { writable: true, value: new BitSet() },
|
|
3291
|
-
storedNames: { writable: true, value: {} },
|
|
3292
|
-
indentStr: { writable: true, value: guessIndent(string) }
|
|
3293
|
-
});
|
|
3310
|
+
append(content) {
|
|
3311
|
+
if (typeof content !== 'string') throw new TypeError('outro content must be a string');
|
|
3294
3312
|
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
}
|
|
3313
|
+
this.outro += content;
|
|
3314
|
+
return this;
|
|
3315
|
+
}
|
|
3298
3316
|
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
};
|
|
3317
|
+
appendLeft(index, content) {
|
|
3318
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
3302
3319
|
|
|
3303
|
-
|
|
3304
|
-
if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
|
|
3320
|
+
this._split(index);
|
|
3305
3321
|
|
|
3306
|
-
|
|
3307
|
-
return this;
|
|
3308
|
-
};
|
|
3322
|
+
const chunk = this.byEnd[index];
|
|
3309
3323
|
|
|
3310
|
-
|
|
3311
|
-
|
|
3324
|
+
if (chunk) {
|
|
3325
|
+
chunk.appendLeft(content);
|
|
3326
|
+
} else {
|
|
3327
|
+
this.intro += content;
|
|
3328
|
+
}
|
|
3329
|
+
return this;
|
|
3330
|
+
}
|
|
3312
3331
|
|
|
3313
|
-
|
|
3332
|
+
appendRight(index, content) {
|
|
3333
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
3314
3334
|
|
|
3315
|
-
|
|
3335
|
+
this._split(index);
|
|
3316
3336
|
|
|
3317
|
-
|
|
3318
|
-
chunk.appendLeft(content);
|
|
3319
|
-
} else {
|
|
3320
|
-
this.intro += content;
|
|
3321
|
-
}
|
|
3322
|
-
return this;
|
|
3323
|
-
};
|
|
3337
|
+
const chunk = this.byStart[index];
|
|
3324
3338
|
|
|
3325
|
-
|
|
3326
|
-
|
|
3339
|
+
if (chunk) {
|
|
3340
|
+
chunk.appendRight(content);
|
|
3341
|
+
} else {
|
|
3342
|
+
this.outro += content;
|
|
3343
|
+
}
|
|
3344
|
+
return this;
|
|
3345
|
+
}
|
|
3327
3346
|
|
|
3328
|
-
|
|
3347
|
+
clone() {
|
|
3348
|
+
const cloned = new MagicString$1(this.original, { filename: this.filename });
|
|
3329
3349
|
|
|
3330
|
-
|
|
3350
|
+
let originalChunk = this.firstChunk;
|
|
3351
|
+
let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
|
|
3331
3352
|
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
this.outro += content;
|
|
3336
|
-
}
|
|
3337
|
-
return this;
|
|
3338
|
-
};
|
|
3353
|
+
while (originalChunk) {
|
|
3354
|
+
cloned.byStart[clonedChunk.start] = clonedChunk;
|
|
3355
|
+
cloned.byEnd[clonedChunk.end] = clonedChunk;
|
|
3339
3356
|
|
|
3340
|
-
|
|
3341
|
-
|
|
3357
|
+
const nextOriginalChunk = originalChunk.next;
|
|
3358
|
+
const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
|
|
3342
3359
|
|
|
3343
|
-
|
|
3344
|
-
|
|
3360
|
+
if (nextClonedChunk) {
|
|
3361
|
+
clonedChunk.next = nextClonedChunk;
|
|
3362
|
+
nextClonedChunk.previous = clonedChunk;
|
|
3345
3363
|
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
cloned.byEnd[clonedChunk.end] = clonedChunk;
|
|
3364
|
+
clonedChunk = nextClonedChunk;
|
|
3365
|
+
}
|
|
3349
3366
|
|
|
3350
|
-
|
|
3351
|
-
|
|
3367
|
+
originalChunk = nextOriginalChunk;
|
|
3368
|
+
}
|
|
3352
3369
|
|
|
3353
|
-
|
|
3354
|
-
clonedChunk.next = nextClonedChunk;
|
|
3355
|
-
nextClonedChunk.previous = clonedChunk;
|
|
3370
|
+
cloned.lastChunk = clonedChunk;
|
|
3356
3371
|
|
|
3357
|
-
|
|
3372
|
+
if (this.indentExclusionRanges) {
|
|
3373
|
+
cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
|
|
3358
3374
|
}
|
|
3359
3375
|
|
|
3360
|
-
|
|
3361
|
-
}
|
|
3376
|
+
cloned.sourcemapLocations = new BitSet$1(this.sourcemapLocations);
|
|
3362
3377
|
|
|
3363
|
-
|
|
3378
|
+
cloned.intro = this.intro;
|
|
3379
|
+
cloned.outro = this.outro;
|
|
3364
3380
|
|
|
3365
|
-
|
|
3366
|
-
cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
|
|
3381
|
+
return cloned;
|
|
3367
3382
|
}
|
|
3368
3383
|
|
|
3369
|
-
|
|
3384
|
+
generateDecodedMap(options) {
|
|
3385
|
+
options = options || {};
|
|
3370
3386
|
|
|
3371
|
-
|
|
3372
|
-
|
|
3387
|
+
const sourceIndex = 0;
|
|
3388
|
+
const names = Object.keys(this.storedNames);
|
|
3389
|
+
const mappings = new Mappings$1(options.hires);
|
|
3373
3390
|
|
|
3374
|
-
|
|
3375
|
-
};
|
|
3391
|
+
const locate = getLocator$1(this.original);
|
|
3376
3392
|
|
|
3377
|
-
|
|
3378
|
-
|
|
3393
|
+
if (this.intro) {
|
|
3394
|
+
mappings.advance(this.intro);
|
|
3395
|
+
}
|
|
3379
3396
|
|
|
3380
|
-
|
|
3397
|
+
this.firstChunk.eachNext((chunk) => {
|
|
3398
|
+
const loc = locate(chunk.start);
|
|
3381
3399
|
|
|
3382
|
-
|
|
3383
|
-
var names = Object.keys(this.storedNames);
|
|
3384
|
-
var mappings = new Mappings(options.hires);
|
|
3400
|
+
if (chunk.intro.length) mappings.advance(chunk.intro);
|
|
3385
3401
|
|
|
3386
|
-
|
|
3402
|
+
if (chunk.edited) {
|
|
3403
|
+
mappings.addEdit(
|
|
3404
|
+
sourceIndex,
|
|
3405
|
+
chunk.content,
|
|
3406
|
+
loc,
|
|
3407
|
+
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
3408
|
+
);
|
|
3409
|
+
} else {
|
|
3410
|
+
mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
|
|
3411
|
+
}
|
|
3387
3412
|
|
|
3388
|
-
|
|
3389
|
-
|
|
3413
|
+
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
3414
|
+
});
|
|
3415
|
+
|
|
3416
|
+
return {
|
|
3417
|
+
file: options.file ? options.file.split(/[/\\]/).pop() : null,
|
|
3418
|
+
sources: [options.source ? getRelativePath$1(options.file || '', options.source) : null],
|
|
3419
|
+
sourcesContent: options.includeContent ? [this.original] : [null],
|
|
3420
|
+
names,
|
|
3421
|
+
mappings: mappings.raw,
|
|
3422
|
+
};
|
|
3390
3423
|
}
|
|
3391
3424
|
|
|
3392
|
-
|
|
3393
|
-
|
|
3425
|
+
generateMap(options) {
|
|
3426
|
+
return new SourceMap$1(this.generateDecodedMap(options));
|
|
3427
|
+
}
|
|
3394
3428
|
|
|
3395
|
-
|
|
3429
|
+
getIndentString() {
|
|
3430
|
+
return this.indentStr === null ? '\t' : this.indentStr;
|
|
3431
|
+
}
|
|
3396
3432
|
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
);
|
|
3404
|
-
} else {
|
|
3405
|
-
mappings.addUneditedChunk(sourceIndex, chunk, this$1$1.original, loc, this$1$1.sourcemapLocations);
|
|
3433
|
+
indent(indentStr, options) {
|
|
3434
|
+
const pattern = /^[^\r\n]/gm;
|
|
3435
|
+
|
|
3436
|
+
if (isObject$3(indentStr)) {
|
|
3437
|
+
options = indentStr;
|
|
3438
|
+
indentStr = undefined;
|
|
3406
3439
|
}
|
|
3407
3440
|
|
|
3408
|
-
|
|
3409
|
-
});
|
|
3441
|
+
indentStr = indentStr !== undefined ? indentStr : this.indentStr || '\t';
|
|
3410
3442
|
|
|
3411
|
-
|
|
3412
|
-
file: options.file ? options.file.split(/[/\\]/).pop() : null,
|
|
3413
|
-
sources: [options.source ? getRelativePath(options.file || '', options.source) : null],
|
|
3414
|
-
sourcesContent: options.includeContent ? [this.original] : [null],
|
|
3415
|
-
names: names,
|
|
3416
|
-
mappings: mappings.raw
|
|
3417
|
-
};
|
|
3418
|
-
};
|
|
3443
|
+
if (indentStr === '') return this; // noop
|
|
3419
3444
|
|
|
3420
|
-
|
|
3421
|
-
return new SourceMap(this.generateDecodedMap(options));
|
|
3422
|
-
};
|
|
3445
|
+
options = options || {};
|
|
3423
3446
|
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
};
|
|
3447
|
+
// Process exclusion ranges
|
|
3448
|
+
const isExcluded = {};
|
|
3427
3449
|
|
|
3428
|
-
|
|
3429
|
-
|
|
3450
|
+
if (options.exclude) {
|
|
3451
|
+
const exclusions =
|
|
3452
|
+
typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
|
|
3453
|
+
exclusions.forEach((exclusion) => {
|
|
3454
|
+
for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
|
|
3455
|
+
isExcluded[i] = true;
|
|
3456
|
+
}
|
|
3457
|
+
});
|
|
3458
|
+
}
|
|
3430
3459
|
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3460
|
+
let shouldIndentNextCharacter = options.indentStart !== false;
|
|
3461
|
+
const replacer = (match) => {
|
|
3462
|
+
if (shouldIndentNextCharacter) return `${indentStr}${match}`;
|
|
3463
|
+
shouldIndentNextCharacter = true;
|
|
3464
|
+
return match;
|
|
3465
|
+
};
|
|
3435
3466
|
|
|
3436
|
-
|
|
3467
|
+
this.intro = this.intro.replace(pattern, replacer);
|
|
3437
3468
|
|
|
3438
|
-
|
|
3469
|
+
let charIndex = 0;
|
|
3470
|
+
let chunk = this.firstChunk;
|
|
3439
3471
|
|
|
3440
|
-
|
|
3472
|
+
while (chunk) {
|
|
3473
|
+
const end = chunk.end;
|
|
3441
3474
|
|
|
3442
|
-
|
|
3443
|
-
|
|
3475
|
+
if (chunk.edited) {
|
|
3476
|
+
if (!isExcluded[charIndex]) {
|
|
3477
|
+
chunk.content = chunk.content.replace(pattern, replacer);
|
|
3444
3478
|
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3479
|
+
if (chunk.content.length) {
|
|
3480
|
+
shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
} else {
|
|
3484
|
+
charIndex = chunk.start;
|
|
3485
|
+
|
|
3486
|
+
while (charIndex < end) {
|
|
3487
|
+
if (!isExcluded[charIndex]) {
|
|
3488
|
+
const char = this.original[charIndex];
|
|
3489
|
+
|
|
3490
|
+
if (char === '\n') {
|
|
3491
|
+
shouldIndentNextCharacter = true;
|
|
3492
|
+
} else if (char !== '\r' && shouldIndentNextCharacter) {
|
|
3493
|
+
shouldIndentNextCharacter = false;
|
|
3494
|
+
|
|
3495
|
+
if (charIndex === chunk.start) {
|
|
3496
|
+
chunk.prependRight(indentStr);
|
|
3497
|
+
} else {
|
|
3498
|
+
this._splitChunk(chunk, charIndex);
|
|
3499
|
+
chunk = chunk.next;
|
|
3500
|
+
chunk.prependRight(indentStr);
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
|
|
3505
|
+
charIndex += 1;
|
|
3506
|
+
}
|
|
3451
3507
|
}
|
|
3452
|
-
|
|
3508
|
+
|
|
3509
|
+
charIndex = chunk.end;
|
|
3510
|
+
chunk = chunk.next;
|
|
3511
|
+
}
|
|
3512
|
+
|
|
3513
|
+
this.outro = this.outro.replace(pattern, replacer);
|
|
3514
|
+
|
|
3515
|
+
return this;
|
|
3453
3516
|
}
|
|
3454
3517
|
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
};
|
|
3518
|
+
insert() {
|
|
3519
|
+
throw new Error(
|
|
3520
|
+
'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
|
|
3521
|
+
);
|
|
3522
|
+
}
|
|
3461
3523
|
|
|
3462
|
-
|
|
3524
|
+
insertLeft(index, content) {
|
|
3525
|
+
if (!warned$2.insertLeft) {
|
|
3526
|
+
console.warn(
|
|
3527
|
+
'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
|
|
3528
|
+
); // eslint-disable-line no-console
|
|
3529
|
+
warned$2.insertLeft = true;
|
|
3530
|
+
}
|
|
3463
3531
|
|
|
3464
|
-
|
|
3465
|
-
|
|
3532
|
+
return this.appendLeft(index, content);
|
|
3533
|
+
}
|
|
3466
3534
|
|
|
3467
|
-
|
|
3468
|
-
|
|
3535
|
+
insertRight(index, content) {
|
|
3536
|
+
if (!warned$2.insertRight) {
|
|
3537
|
+
console.warn(
|
|
3538
|
+
'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
|
|
3539
|
+
); // eslint-disable-line no-console
|
|
3540
|
+
warned$2.insertRight = true;
|
|
3541
|
+
}
|
|
3469
3542
|
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
chunk.content = chunk.content.replace(pattern, replacer);
|
|
3543
|
+
return this.prependRight(index, content);
|
|
3544
|
+
}
|
|
3473
3545
|
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
}
|
|
3477
|
-
}
|
|
3478
|
-
} else {
|
|
3479
|
-
charIndex = chunk.start;
|
|
3546
|
+
move(start, end, index) {
|
|
3547
|
+
if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');
|
|
3480
3548
|
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3549
|
+
this._split(start);
|
|
3550
|
+
this._split(end);
|
|
3551
|
+
this._split(index);
|
|
3484
3552
|
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
} else if (char !== '\r' && shouldIndentNextCharacter) {
|
|
3488
|
-
shouldIndentNextCharacter = false;
|
|
3553
|
+
const first = this.byStart[start];
|
|
3554
|
+
const last = this.byEnd[end];
|
|
3489
3555
|
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
} else {
|
|
3493
|
-
this._splitChunk(chunk, charIndex);
|
|
3494
|
-
chunk = chunk.next;
|
|
3495
|
-
chunk.prependRight(indentStr);
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
}
|
|
3556
|
+
const oldLeft = first.previous;
|
|
3557
|
+
const oldRight = last.next;
|
|
3499
3558
|
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3559
|
+
const newRight = this.byStart[index];
|
|
3560
|
+
if (!newRight && last === this.lastChunk) return this;
|
|
3561
|
+
const newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
3503
3562
|
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
}
|
|
3563
|
+
if (oldLeft) oldLeft.next = oldRight;
|
|
3564
|
+
if (oldRight) oldRight.previous = oldLeft;
|
|
3507
3565
|
|
|
3508
|
-
|
|
3566
|
+
if (newLeft) newLeft.next = first;
|
|
3567
|
+
if (newRight) newRight.previous = last;
|
|
3509
3568
|
|
|
3510
|
-
|
|
3511
|
-
|
|
3569
|
+
if (!first.previous) this.firstChunk = last.next;
|
|
3570
|
+
if (!last.next) {
|
|
3571
|
+
this.lastChunk = first.previous;
|
|
3572
|
+
this.lastChunk.next = null;
|
|
3573
|
+
}
|
|
3512
3574
|
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
};
|
|
3575
|
+
first.previous = newLeft;
|
|
3576
|
+
last.next = newRight || null;
|
|
3516
3577
|
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
warned$1.insertLeft = true;
|
|
3578
|
+
if (!newLeft) this.firstChunk = first;
|
|
3579
|
+
if (!newRight) this.lastChunk = last;
|
|
3580
|
+
return this;
|
|
3521
3581
|
}
|
|
3522
3582
|
|
|
3523
|
-
|
|
3524
|
-
|
|
3583
|
+
overwrite(start, end, content, options) {
|
|
3584
|
+
if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
|
|
3525
3585
|
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
console.warn('magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'); // eslint-disable-line no-console
|
|
3529
|
-
warned$1.insertRight = true;
|
|
3530
|
-
}
|
|
3586
|
+
while (start < 0) start += this.original.length;
|
|
3587
|
+
while (end < 0) end += this.original.length;
|
|
3531
3588
|
|
|
3532
|
-
|
|
3533
|
-
|
|
3589
|
+
if (end > this.original.length) throw new Error('end is out of bounds');
|
|
3590
|
+
if (start === end)
|
|
3591
|
+
throw new Error(
|
|
3592
|
+
'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
|
|
3593
|
+
);
|
|
3534
3594
|
|
|
3535
|
-
|
|
3536
|
-
|
|
3595
|
+
this._split(start);
|
|
3596
|
+
this._split(end);
|
|
3537
3597
|
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3598
|
+
if (options === true) {
|
|
3599
|
+
if (!warned$2.storeName) {
|
|
3600
|
+
console.warn(
|
|
3601
|
+
'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
|
|
3602
|
+
); // eslint-disable-line no-console
|
|
3603
|
+
warned$2.storeName = true;
|
|
3604
|
+
}
|
|
3541
3605
|
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3606
|
+
options = { storeName: true };
|
|
3607
|
+
}
|
|
3608
|
+
const storeName = options !== undefined ? options.storeName : false;
|
|
3609
|
+
const contentOnly = options !== undefined ? options.contentOnly : false;
|
|
3610
|
+
|
|
3611
|
+
if (storeName) {
|
|
3612
|
+
const original = this.original.slice(start, end);
|
|
3613
|
+
Object.defineProperty(this.storedNames, original, {
|
|
3614
|
+
writable: true,
|
|
3615
|
+
value: true,
|
|
3616
|
+
enumerable: true,
|
|
3617
|
+
});
|
|
3618
|
+
}
|
|
3547
3619
|
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
var newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
3620
|
+
const first = this.byStart[start];
|
|
3621
|
+
const last = this.byEnd[end];
|
|
3551
3622
|
|
|
3552
|
-
|
|
3553
|
-
|
|
3623
|
+
if (first) {
|
|
3624
|
+
let chunk = first;
|
|
3625
|
+
while (chunk !== last) {
|
|
3626
|
+
if (chunk.next !== this.byStart[chunk.end]) {
|
|
3627
|
+
throw new Error('Cannot overwrite across a split point');
|
|
3628
|
+
}
|
|
3629
|
+
chunk = chunk.next;
|
|
3630
|
+
chunk.edit('', false);
|
|
3631
|
+
}
|
|
3554
3632
|
|
|
3555
|
-
|
|
3556
|
-
|
|
3633
|
+
first.edit(content, storeName, contentOnly);
|
|
3634
|
+
} else {
|
|
3635
|
+
// must be inserting at the end
|
|
3636
|
+
const newChunk = new Chunk$1(start, end, '').edit(content, storeName);
|
|
3557
3637
|
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3638
|
+
// TODO last chunk in the array may not be the last chunk, if it's moved...
|
|
3639
|
+
last.next = newChunk;
|
|
3640
|
+
newChunk.previous = last;
|
|
3641
|
+
}
|
|
3642
|
+
return this;
|
|
3562
3643
|
}
|
|
3563
3644
|
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
if (!newLeft) { this.firstChunk = first; }
|
|
3568
|
-
if (!newRight) { this.lastChunk = last; }
|
|
3569
|
-
return this;
|
|
3570
|
-
};
|
|
3645
|
+
prepend(content) {
|
|
3646
|
+
if (typeof content !== 'string') throw new TypeError('outro content must be a string');
|
|
3571
3647
|
|
|
3572
|
-
|
|
3573
|
-
|
|
3648
|
+
this.intro = content + this.intro;
|
|
3649
|
+
return this;
|
|
3650
|
+
}
|
|
3574
3651
|
|
|
3575
|
-
|
|
3576
|
-
|
|
3652
|
+
prependLeft(index, content) {
|
|
3653
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
3577
3654
|
|
|
3578
|
-
|
|
3579
|
-
if (start === end)
|
|
3580
|
-
{ throw new Error('Cannot overwrite a zero-length range – use appendLeft or prependRight instead'); }
|
|
3655
|
+
this._split(index);
|
|
3581
3656
|
|
|
3582
|
-
|
|
3583
|
-
this._split(end);
|
|
3657
|
+
const chunk = this.byEnd[index];
|
|
3584
3658
|
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3659
|
+
if (chunk) {
|
|
3660
|
+
chunk.prependLeft(content);
|
|
3661
|
+
} else {
|
|
3662
|
+
this.intro = content + this.intro;
|
|
3589
3663
|
}
|
|
3590
|
-
|
|
3591
|
-
options = { storeName: true };
|
|
3664
|
+
return this;
|
|
3592
3665
|
}
|
|
3593
|
-
var storeName = options !== undefined ? options.storeName : false;
|
|
3594
|
-
var contentOnly = options !== undefined ? options.contentOnly : false;
|
|
3595
3666
|
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
this.storedNames[original] = true;
|
|
3599
|
-
}
|
|
3667
|
+
prependRight(index, content) {
|
|
3668
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
3600
3669
|
|
|
3601
|
-
|
|
3602
|
-
var last = this.byEnd[end];
|
|
3670
|
+
this._split(index);
|
|
3603
3671
|
|
|
3604
|
-
|
|
3605
|
-
if (end > first.end && first.next !== this.byStart[first.end]) {
|
|
3606
|
-
throw new Error('Cannot overwrite across a split point');
|
|
3607
|
-
}
|
|
3608
|
-
|
|
3609
|
-
first.edit(content, storeName, contentOnly);
|
|
3610
|
-
|
|
3611
|
-
if (first !== last) {
|
|
3612
|
-
var chunk = first.next;
|
|
3613
|
-
while (chunk !== last) {
|
|
3614
|
-
chunk.edit('', false);
|
|
3615
|
-
chunk = chunk.next;
|
|
3616
|
-
}
|
|
3672
|
+
const chunk = this.byStart[index];
|
|
3617
3673
|
|
|
3618
|
-
|
|
3674
|
+
if (chunk) {
|
|
3675
|
+
chunk.prependRight(content);
|
|
3676
|
+
} else {
|
|
3677
|
+
this.outro = content + this.outro;
|
|
3619
3678
|
}
|
|
3620
|
-
|
|
3621
|
-
// must be inserting at the end
|
|
3622
|
-
var newChunk = new Chunk(start, end, '').edit(content, storeName);
|
|
3623
|
-
|
|
3624
|
-
// TODO last chunk in the array may not be the last chunk, if it's moved...
|
|
3625
|
-
last.next = newChunk;
|
|
3626
|
-
newChunk.previous = last;
|
|
3679
|
+
return this;
|
|
3627
3680
|
}
|
|
3628
|
-
return this;
|
|
3629
|
-
};
|
|
3630
3681
|
|
|
3631
|
-
|
|
3632
|
-
|
|
3682
|
+
remove(start, end) {
|
|
3683
|
+
while (start < 0) start += this.original.length;
|
|
3684
|
+
while (end < 0) end += this.original.length;
|
|
3633
3685
|
|
|
3634
|
-
|
|
3635
|
-
return this;
|
|
3636
|
-
};
|
|
3686
|
+
if (start === end) return this;
|
|
3637
3687
|
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
this._split(index);
|
|
3642
|
-
|
|
3643
|
-
var chunk = this.byEnd[index];
|
|
3688
|
+
if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');
|
|
3689
|
+
if (start > end) throw new Error('end must be greater than start');
|
|
3644
3690
|
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
} else {
|
|
3648
|
-
this.intro = content + this.intro;
|
|
3649
|
-
}
|
|
3650
|
-
return this;
|
|
3651
|
-
};
|
|
3691
|
+
this._split(start);
|
|
3692
|
+
this._split(end);
|
|
3652
3693
|
|
|
3653
|
-
|
|
3654
|
-
if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
|
|
3694
|
+
let chunk = this.byStart[start];
|
|
3655
3695
|
|
|
3656
|
-
|
|
3696
|
+
while (chunk) {
|
|
3697
|
+
chunk.intro = '';
|
|
3698
|
+
chunk.outro = '';
|
|
3699
|
+
chunk.edit('');
|
|
3657
3700
|
|
|
3658
|
-
|
|
3701
|
+
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
3702
|
+
}
|
|
3703
|
+
return this;
|
|
3704
|
+
}
|
|
3659
3705
|
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3706
|
+
lastChar() {
|
|
3707
|
+
if (this.outro.length) return this.outro[this.outro.length - 1];
|
|
3708
|
+
let chunk = this.lastChunk;
|
|
3709
|
+
do {
|
|
3710
|
+
if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
|
|
3711
|
+
if (chunk.content.length) return chunk.content[chunk.content.length - 1];
|
|
3712
|
+
if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
|
|
3713
|
+
} while ((chunk = chunk.previous));
|
|
3714
|
+
if (this.intro.length) return this.intro[this.intro.length - 1];
|
|
3715
|
+
return '';
|
|
3664
3716
|
}
|
|
3665
|
-
return this;
|
|
3666
|
-
};
|
|
3667
3717
|
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3718
|
+
lastLine() {
|
|
3719
|
+
let lineIndex = this.outro.lastIndexOf(n$1);
|
|
3720
|
+
if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
|
|
3721
|
+
let lineStr = this.outro;
|
|
3722
|
+
let chunk = this.lastChunk;
|
|
3723
|
+
do {
|
|
3724
|
+
if (chunk.outro.length > 0) {
|
|
3725
|
+
lineIndex = chunk.outro.lastIndexOf(n$1);
|
|
3726
|
+
if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
|
|
3727
|
+
lineStr = chunk.outro + lineStr;
|
|
3728
|
+
}
|
|
3671
3729
|
|
|
3672
|
-
|
|
3730
|
+
if (chunk.content.length > 0) {
|
|
3731
|
+
lineIndex = chunk.content.lastIndexOf(n$1);
|
|
3732
|
+
if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
|
|
3733
|
+
lineStr = chunk.content + lineStr;
|
|
3734
|
+
}
|
|
3673
3735
|
|
|
3674
|
-
|
|
3675
|
-
|
|
3736
|
+
if (chunk.intro.length > 0) {
|
|
3737
|
+
lineIndex = chunk.intro.lastIndexOf(n$1);
|
|
3738
|
+
if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
|
|
3739
|
+
lineStr = chunk.intro + lineStr;
|
|
3740
|
+
}
|
|
3741
|
+
} while ((chunk = chunk.previous));
|
|
3742
|
+
lineIndex = this.intro.lastIndexOf(n$1);
|
|
3743
|
+
if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
|
|
3744
|
+
return this.intro + lineStr;
|
|
3745
|
+
}
|
|
3676
3746
|
|
|
3677
|
-
this.
|
|
3678
|
-
|
|
3747
|
+
slice(start = 0, end = this.original.length) {
|
|
3748
|
+
while (start < 0) start += this.original.length;
|
|
3749
|
+
while (end < 0) end += this.original.length;
|
|
3679
3750
|
|
|
3680
|
-
|
|
3751
|
+
let result = '';
|
|
3681
3752
|
|
|
3682
|
-
|
|
3683
|
-
chunk
|
|
3684
|
-
chunk.
|
|
3685
|
-
|
|
3753
|
+
// find start chunk
|
|
3754
|
+
let chunk = this.firstChunk;
|
|
3755
|
+
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
3756
|
+
// found end chunk before start
|
|
3757
|
+
if (chunk.start < end && chunk.end >= end) {
|
|
3758
|
+
return result;
|
|
3759
|
+
}
|
|
3686
3760
|
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
return this;
|
|
3690
|
-
};
|
|
3761
|
+
chunk = chunk.next;
|
|
3762
|
+
}
|
|
3691
3763
|
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
{ return this.outro[this.outro.length - 1]; }
|
|
3695
|
-
var chunk = this.lastChunk;
|
|
3696
|
-
do {
|
|
3697
|
-
if (chunk.outro.length)
|
|
3698
|
-
{ return chunk.outro[chunk.outro.length - 1]; }
|
|
3699
|
-
if (chunk.content.length)
|
|
3700
|
-
{ return chunk.content[chunk.content.length - 1]; }
|
|
3701
|
-
if (chunk.intro.length)
|
|
3702
|
-
{ return chunk.intro[chunk.intro.length - 1]; }
|
|
3703
|
-
} while (chunk = chunk.previous);
|
|
3704
|
-
if (this.intro.length)
|
|
3705
|
-
{ return this.intro[this.intro.length - 1]; }
|
|
3706
|
-
return '';
|
|
3707
|
-
};
|
|
3764
|
+
if (chunk && chunk.edited && chunk.start !== start)
|
|
3765
|
+
throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
|
|
3708
3766
|
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
var chunk = this.lastChunk;
|
|
3715
|
-
do {
|
|
3716
|
-
if (chunk.outro.length > 0) {
|
|
3717
|
-
lineIndex = chunk.outro.lastIndexOf(n);
|
|
3718
|
-
if (lineIndex !== -1)
|
|
3719
|
-
{ return chunk.outro.substr(lineIndex + 1) + lineStr; }
|
|
3720
|
-
lineStr = chunk.outro + lineStr;
|
|
3721
|
-
}
|
|
3767
|
+
const startChunk = chunk;
|
|
3768
|
+
while (chunk) {
|
|
3769
|
+
if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
|
|
3770
|
+
result += chunk.intro;
|
|
3771
|
+
}
|
|
3722
3772
|
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
{ return chunk.content.substr(lineIndex + 1) + lineStr; }
|
|
3727
|
-
lineStr = chunk.content + lineStr;
|
|
3728
|
-
}
|
|
3773
|
+
const containsEnd = chunk.start < end && chunk.end >= end;
|
|
3774
|
+
if (containsEnd && chunk.edited && chunk.end !== end)
|
|
3775
|
+
throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
|
|
3729
3776
|
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
if (lineIndex !== -1)
|
|
3733
|
-
{ return chunk.intro.substr(lineIndex + 1) + lineStr; }
|
|
3734
|
-
lineStr = chunk.intro + lineStr;
|
|
3735
|
-
}
|
|
3736
|
-
} while (chunk = chunk.previous);
|
|
3737
|
-
lineIndex = this.intro.lastIndexOf(n);
|
|
3738
|
-
if (lineIndex !== -1)
|
|
3739
|
-
{ return this.intro.substr(lineIndex + 1) + lineStr; }
|
|
3740
|
-
return this.intro + lineStr;
|
|
3741
|
-
};
|
|
3777
|
+
const sliceStart = startChunk === chunk ? start - chunk.start : 0;
|
|
3778
|
+
const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
|
|
3742
3779
|
|
|
3743
|
-
|
|
3744
|
-
if ( start === void 0 ) start = 0;
|
|
3745
|
-
if ( end === void 0 ) end = this.original.length;
|
|
3780
|
+
result += chunk.content.slice(sliceStart, sliceEnd);
|
|
3746
3781
|
|
|
3747
|
-
|
|
3748
|
-
|
|
3782
|
+
if (chunk.outro && (!containsEnd || chunk.end === end)) {
|
|
3783
|
+
result += chunk.outro;
|
|
3784
|
+
}
|
|
3749
3785
|
|
|
3750
|
-
|
|
3786
|
+
if (containsEnd) {
|
|
3787
|
+
break;
|
|
3788
|
+
}
|
|
3751
3789
|
|
|
3752
|
-
|
|
3753
|
-
var chunk = this.firstChunk;
|
|
3754
|
-
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
3755
|
-
// found end chunk before start
|
|
3756
|
-
if (chunk.start < end && chunk.end >= end) {
|
|
3757
|
-
return result;
|
|
3790
|
+
chunk = chunk.next;
|
|
3758
3791
|
}
|
|
3759
3792
|
|
|
3760
|
-
|
|
3793
|
+
return result;
|
|
3761
3794
|
}
|
|
3762
3795
|
|
|
3763
|
-
|
|
3764
|
-
|
|
3796
|
+
// TODO deprecate this? not really very useful
|
|
3797
|
+
snip(start, end) {
|
|
3798
|
+
const clone = this.clone();
|
|
3799
|
+
clone.remove(0, start);
|
|
3800
|
+
clone.remove(end, clone.original.length);
|
|
3765
3801
|
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
|
|
3769
|
-
result += chunk.intro;
|
|
3770
|
-
}
|
|
3802
|
+
return clone;
|
|
3803
|
+
}
|
|
3771
3804
|
|
|
3772
|
-
|
|
3773
|
-
if (
|
|
3774
|
-
{ throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); }
|
|
3805
|
+
_split(index) {
|
|
3806
|
+
if (this.byStart[index] || this.byEnd[index]) return;
|
|
3775
3807
|
|
|
3776
|
-
|
|
3777
|
-
|
|
3808
|
+
let chunk = this.lastSearchedChunk;
|
|
3809
|
+
const searchForward = index > chunk.end;
|
|
3778
3810
|
|
|
3779
|
-
|
|
3811
|
+
while (chunk) {
|
|
3812
|
+
if (chunk.contains(index)) return this._splitChunk(chunk, index);
|
|
3780
3813
|
|
|
3781
|
-
|
|
3782
|
-
result += chunk.outro;
|
|
3814
|
+
chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
|
|
3783
3815
|
}
|
|
3816
|
+
}
|
|
3784
3817
|
|
|
3785
|
-
|
|
3786
|
-
|
|
3818
|
+
_splitChunk(chunk, index) {
|
|
3819
|
+
if (chunk.edited && chunk.content.length) {
|
|
3820
|
+
// zero-length edited chunks are a special case (overlapping replacements)
|
|
3821
|
+
const loc = getLocator$1(this.original)(index);
|
|
3822
|
+
throw new Error(
|
|
3823
|
+
`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`
|
|
3824
|
+
);
|
|
3787
3825
|
}
|
|
3788
3826
|
|
|
3789
|
-
|
|
3790
|
-
}
|
|
3827
|
+
const newChunk = chunk.split(index);
|
|
3791
3828
|
|
|
3792
|
-
|
|
3793
|
-
|
|
3829
|
+
this.byEnd[index] = chunk;
|
|
3830
|
+
this.byStart[index] = newChunk;
|
|
3831
|
+
this.byEnd[newChunk.end] = newChunk;
|
|
3794
3832
|
|
|
3795
|
-
|
|
3796
|
-
MagicString.prototype.snip = function snip (start, end) {
|
|
3797
|
-
var clone = this.clone();
|
|
3798
|
-
clone.remove(0, start);
|
|
3799
|
-
clone.remove(end, clone.original.length);
|
|
3800
|
-
|
|
3801
|
-
return clone;
|
|
3802
|
-
};
|
|
3833
|
+
if (chunk === this.lastChunk) this.lastChunk = newChunk;
|
|
3803
3834
|
|
|
3804
|
-
|
|
3805
|
-
|
|
3835
|
+
this.lastSearchedChunk = chunk;
|
|
3836
|
+
return true;
|
|
3837
|
+
}
|
|
3806
3838
|
|
|
3807
|
-
|
|
3808
|
-
|
|
3839
|
+
toString() {
|
|
3840
|
+
let str = this.intro;
|
|
3809
3841
|
|
|
3810
|
-
|
|
3811
|
-
|
|
3842
|
+
let chunk = this.firstChunk;
|
|
3843
|
+
while (chunk) {
|
|
3844
|
+
str += chunk.toString();
|
|
3845
|
+
chunk = chunk.next;
|
|
3846
|
+
}
|
|
3812
3847
|
|
|
3813
|
-
|
|
3848
|
+
return str + this.outro;
|
|
3814
3849
|
}
|
|
3815
|
-
};
|
|
3816
3850
|
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3851
|
+
isEmpty() {
|
|
3852
|
+
let chunk = this.firstChunk;
|
|
3853
|
+
do {
|
|
3854
|
+
if (
|
|
3855
|
+
(chunk.intro.length && chunk.intro.trim()) ||
|
|
3856
|
+
(chunk.content.length && chunk.content.trim()) ||
|
|
3857
|
+
(chunk.outro.length && chunk.outro.trim())
|
|
3858
|
+
)
|
|
3859
|
+
return false;
|
|
3860
|
+
} while ((chunk = chunk.next));
|
|
3861
|
+
return true;
|
|
3824
3862
|
}
|
|
3825
3863
|
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
this.lastSearchedChunk = chunk;
|
|
3835
|
-
return true;
|
|
3836
|
-
};
|
|
3864
|
+
length() {
|
|
3865
|
+
let chunk = this.firstChunk;
|
|
3866
|
+
let length = 0;
|
|
3867
|
+
do {
|
|
3868
|
+
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
|
|
3869
|
+
} while ((chunk = chunk.next));
|
|
3870
|
+
return length;
|
|
3871
|
+
}
|
|
3837
3872
|
|
|
3838
|
-
|
|
3839
|
-
|
|
3873
|
+
trimLines() {
|
|
3874
|
+
return this.trim('[\\r\\n]');
|
|
3875
|
+
}
|
|
3840
3876
|
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
str += chunk.toString();
|
|
3844
|
-
chunk = chunk.next;
|
|
3877
|
+
trim(charType) {
|
|
3878
|
+
return this.trimStart(charType).trimEnd(charType);
|
|
3845
3879
|
}
|
|
3846
3880
|
|
|
3847
|
-
|
|
3848
|
-
|
|
3881
|
+
trimEndAborted(charType) {
|
|
3882
|
+
const rx = new RegExp((charType || '\\s') + '+$');
|
|
3849
3883
|
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
do {
|
|
3853
|
-
if (chunk.intro.length && chunk.intro.trim() ||
|
|
3854
|
-
chunk.content.length && chunk.content.trim() ||
|
|
3855
|
-
chunk.outro.length && chunk.outro.trim())
|
|
3856
|
-
{ return false; }
|
|
3857
|
-
} while (chunk = chunk.next);
|
|
3858
|
-
return true;
|
|
3859
|
-
};
|
|
3884
|
+
this.outro = this.outro.replace(rx, '');
|
|
3885
|
+
if (this.outro.length) return true;
|
|
3860
3886
|
|
|
3861
|
-
|
|
3862
|
-
var chunk = this.firstChunk;
|
|
3863
|
-
var length = 0;
|
|
3864
|
-
do {
|
|
3865
|
-
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
|
|
3866
|
-
} while (chunk = chunk.next);
|
|
3867
|
-
return length;
|
|
3868
|
-
};
|
|
3887
|
+
let chunk = this.lastChunk;
|
|
3869
3888
|
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3889
|
+
do {
|
|
3890
|
+
const end = chunk.end;
|
|
3891
|
+
const aborted = chunk.trimEnd(rx);
|
|
3873
3892
|
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3893
|
+
// if chunk was trimmed, we have a new lastChunk
|
|
3894
|
+
if (chunk.end !== end) {
|
|
3895
|
+
if (this.lastChunk === chunk) {
|
|
3896
|
+
this.lastChunk = chunk.next;
|
|
3897
|
+
}
|
|
3877
3898
|
|
|
3878
|
-
|
|
3879
|
-
|
|
3899
|
+
this.byEnd[chunk.end] = chunk;
|
|
3900
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
3901
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
3902
|
+
}
|
|
3880
3903
|
|
|
3881
|
-
|
|
3882
|
-
|
|
3904
|
+
if (aborted) return true;
|
|
3905
|
+
chunk = chunk.previous;
|
|
3906
|
+
} while (chunk);
|
|
3883
3907
|
|
|
3884
|
-
|
|
3908
|
+
return false;
|
|
3909
|
+
}
|
|
3885
3910
|
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3911
|
+
trimEnd(charType) {
|
|
3912
|
+
this.trimEndAborted(charType);
|
|
3913
|
+
return this;
|
|
3914
|
+
}
|
|
3915
|
+
trimStartAborted(charType) {
|
|
3916
|
+
const rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
3889
3917
|
|
|
3890
|
-
|
|
3891
|
-
if (
|
|
3892
|
-
if (this.lastChunk === chunk) {
|
|
3893
|
-
this.lastChunk = chunk.next;
|
|
3894
|
-
}
|
|
3918
|
+
this.intro = this.intro.replace(rx, '');
|
|
3919
|
+
if (this.intro.length) return true;
|
|
3895
3920
|
|
|
3896
|
-
|
|
3897
|
-
this.byStart[chunk.next.start] = chunk.next;
|
|
3898
|
-
this.byEnd[chunk.next.end] = chunk.next;
|
|
3899
|
-
}
|
|
3921
|
+
let chunk = this.firstChunk;
|
|
3900
3922
|
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3923
|
+
do {
|
|
3924
|
+
const end = chunk.end;
|
|
3925
|
+
const aborted = chunk.trimStart(rx);
|
|
3904
3926
|
|
|
3905
|
-
|
|
3906
|
-
|
|
3927
|
+
if (chunk.end !== end) {
|
|
3928
|
+
// special case...
|
|
3929
|
+
if (chunk === this.lastChunk) this.lastChunk = chunk.next;
|
|
3907
3930
|
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
}
|
|
3912
|
-
MagicString.prototype.trimStartAborted = function trimStartAborted (charType) {
|
|
3913
|
-
var rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
3931
|
+
this.byEnd[chunk.end] = chunk;
|
|
3932
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
3933
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
3934
|
+
}
|
|
3914
3935
|
|
|
3915
|
-
|
|
3916
|
-
|
|
3936
|
+
if (aborted) return true;
|
|
3937
|
+
chunk = chunk.next;
|
|
3938
|
+
} while (chunk);
|
|
3917
3939
|
|
|
3918
|
-
|
|
3940
|
+
return false;
|
|
3941
|
+
}
|
|
3919
3942
|
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3943
|
+
trimStart(charType) {
|
|
3944
|
+
this.trimStartAborted(charType);
|
|
3945
|
+
return this;
|
|
3946
|
+
}
|
|
3923
3947
|
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3948
|
+
hasChanged() {
|
|
3949
|
+
return this.original !== this.toString();
|
|
3950
|
+
}
|
|
3927
3951
|
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3952
|
+
replace(searchValue, replacement) {
|
|
3953
|
+
function getReplacement(match, str) {
|
|
3954
|
+
if (typeof replacement === 'string') {
|
|
3955
|
+
return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
|
|
3956
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter
|
|
3957
|
+
if (i === '$') return '$';
|
|
3958
|
+
if (i === '&') return match[0];
|
|
3959
|
+
const num = +i;
|
|
3960
|
+
if (num < match.length) return match[+i];
|
|
3961
|
+
return `$${i}`;
|
|
3962
|
+
});
|
|
3963
|
+
} else {
|
|
3964
|
+
return replacement(...match, match.index, str, match.groups);
|
|
3965
|
+
}
|
|
3931
3966
|
}
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3967
|
+
function matchAll(re, str) {
|
|
3968
|
+
let match;
|
|
3969
|
+
const matches = [];
|
|
3970
|
+
while ((match = re.exec(str))) {
|
|
3971
|
+
matches.push(match);
|
|
3972
|
+
}
|
|
3973
|
+
return matches;
|
|
3974
|
+
}
|
|
3975
|
+
if (typeof searchValue !== 'string' && searchValue.global) {
|
|
3976
|
+
const matches = matchAll(searchValue, this.original);
|
|
3977
|
+
matches.forEach((match) => {
|
|
3978
|
+
if (match.index != null)
|
|
3979
|
+
this.overwrite(
|
|
3980
|
+
match.index,
|
|
3981
|
+
match.index + match[0].length,
|
|
3982
|
+
getReplacement(match, this.original)
|
|
3983
|
+
);
|
|
3984
|
+
});
|
|
3985
|
+
} else {
|
|
3986
|
+
const match = this.original.match(searchValue);
|
|
3987
|
+
if (match && match.index != null)
|
|
3988
|
+
this.overwrite(
|
|
3989
|
+
match.index,
|
|
3990
|
+
match.index + match[0].length,
|
|
3991
|
+
getReplacement(match, this.original)
|
|
3992
|
+
);
|
|
3993
|
+
}
|
|
3994
|
+
return this;
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3944
3997
|
|
|
3945
3998
|
const mimes$1 = {
|
|
3946
3999
|
"ez": "application/andrew-inset",
|
|
@@ -4418,7 +4471,7 @@ function assetPlugin(config) {
|
|
|
4418
4471
|
// var inlined = ".inlined{color:green;background:url(__VITE_ASSET__5aa0ddc0__)}\n";
|
|
4419
4472
|
// In both cases, the wrapping should already be fine
|
|
4420
4473
|
while ((match = assetUrlRE.exec(code))) {
|
|
4421
|
-
s = s || (s = new MagicString(code));
|
|
4474
|
+
s = s || (s = new MagicString$1(code));
|
|
4422
4475
|
const [full, hash, postfix = ''] = match;
|
|
4423
4476
|
// some internal plugins may still need to emit chunks (e.g. worker) so
|
|
4424
4477
|
// fallback to this.getFileName for that.
|
|
@@ -5397,7 +5450,7 @@ var toRegexRange_1 = toRegexRange$1;
|
|
|
5397
5450
|
const util$3 = require$$0__default$1;
|
|
5398
5451
|
const toRegexRange = toRegexRange_1;
|
|
5399
5452
|
|
|
5400
|
-
const isObject$
|
|
5453
|
+
const isObject$2 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
5401
5454
|
|
|
5402
5455
|
const transform$1 = toNumber => {
|
|
5403
5456
|
return value => toNumber === true ? Number(value) : String(value);
|
|
@@ -5613,7 +5666,7 @@ const fill$2 = (start, end, step, options = {}) => {
|
|
|
5613
5666
|
return fill$2(start, end, 1, { transform: step });
|
|
5614
5667
|
}
|
|
5615
5668
|
|
|
5616
|
-
if (isObject$
|
|
5669
|
+
if (isObject$2(step)) {
|
|
5617
5670
|
return fill$2(start, end, 0, step);
|
|
5618
5671
|
}
|
|
5619
5672
|
|
|
@@ -5622,7 +5675,7 @@ const fill$2 = (start, end, step, options = {}) => {
|
|
|
5622
5675
|
step = step || opts.step || 1;
|
|
5623
5676
|
|
|
5624
5677
|
if (!isNumber(step)) {
|
|
5625
|
-
if (step != null && !isObject$
|
|
5678
|
+
if (step != null && !isObject$2(step)) return invalidStep(step, opts);
|
|
5626
5679
|
return fill$2(start, end, 1, step);
|
|
5627
5680
|
}
|
|
5628
5681
|
|
|
@@ -8074,7 +8127,7 @@ const scan = scan_1;
|
|
|
8074
8127
|
const parse$i = parse_1$1;
|
|
8075
8128
|
const utils$c = utils$f;
|
|
8076
8129
|
const constants$3 = constants$5;
|
|
8077
|
-
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
8130
|
+
const isObject$1 = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
8078
8131
|
|
|
8079
8132
|
/**
|
|
8080
8133
|
* Creates a matcher function from one or more glob patterns. The
|
|
@@ -8111,7 +8164,7 @@ const picomatch$4 = (glob, options, returnState = false) => {
|
|
|
8111
8164
|
return arrayMatcher;
|
|
8112
8165
|
}
|
|
8113
8166
|
|
|
8114
|
-
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
8167
|
+
const isState = isObject$1(glob) && glob.tokens && glob.input;
|
|
8115
8168
|
|
|
8116
8169
|
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
|
8117
8170
|
throw new TypeError('Expected pattern to be a non-empty string');
|
|
@@ -16621,10 +16674,10 @@ function warnFileDeprecation(filename) {
|
|
|
16621
16674
|
warn(`The endpoint 'yaml/${path}' will be removed in a future release.`, 'DeprecationWarning');
|
|
16622
16675
|
}
|
|
16623
16676
|
}
|
|
16624
|
-
const warned = {};
|
|
16677
|
+
const warned$1 = {};
|
|
16625
16678
|
function warnOptionDeprecation(name, alternative) {
|
|
16626
|
-
if (!warned[name] && shouldWarn(true)) {
|
|
16627
|
-
warned[name] = true;
|
|
16679
|
+
if (!warned$1[name] && shouldWarn(true)) {
|
|
16680
|
+
warned$1[name] = true;
|
|
16628
16681
|
let msg = `The option '${name}' will be removed in a future release`;
|
|
16629
16682
|
msg += alternative ? `, use '${alternative}' instead.` : '.';
|
|
16630
16683
|
warn(msg, 'DeprecationWarning');
|
|
@@ -18433,24 +18486,32 @@ function serializeObject(obj, indent, baseIndent) {
|
|
|
18433
18486
|
return `${output}${indent ? `\n${baseIndent}` : ''}}`;
|
|
18434
18487
|
}
|
|
18435
18488
|
function serialize(obj, indent, baseIndent) {
|
|
18436
|
-
if (obj ===
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18442
|
-
|
|
18443
|
-
return `new Date(${obj.getTime()})`;
|
|
18444
|
-
if (obj instanceof RegExp)
|
|
18445
|
-
return obj.toString();
|
|
18446
|
-
if (obj !== obj)
|
|
18447
|
-
return 'NaN'; // eslint-disable-line no-self-compare
|
|
18448
|
-
if (Array.isArray(obj))
|
|
18449
|
-
return serializeArray(obj, indent, baseIndent);
|
|
18450
|
-
if (obj === null)
|
|
18451
|
-
return 'null';
|
|
18452
|
-
if (typeof obj === 'object')
|
|
18489
|
+
if (typeof obj === 'object' && obj !== null) {
|
|
18490
|
+
if (Array.isArray(obj))
|
|
18491
|
+
return serializeArray(obj, indent, baseIndent);
|
|
18492
|
+
if (obj instanceof Date)
|
|
18493
|
+
return `new Date(${obj.getTime()})`;
|
|
18494
|
+
if (obj instanceof RegExp)
|
|
18495
|
+
return obj.toString();
|
|
18453
18496
|
return serializeObject(obj, indent, baseIndent);
|
|
18497
|
+
}
|
|
18498
|
+
if (typeof obj === 'number') {
|
|
18499
|
+
if (obj === Infinity)
|
|
18500
|
+
return 'Infinity';
|
|
18501
|
+
if (obj === -Infinity)
|
|
18502
|
+
return '-Infinity';
|
|
18503
|
+
if (obj === 0)
|
|
18504
|
+
return 1 / obj === Infinity ? '0' : '-0';
|
|
18505
|
+
if (obj !== obj)
|
|
18506
|
+
return 'NaN'; // eslint-disable-line no-self-compare
|
|
18507
|
+
}
|
|
18508
|
+
if (typeof obj === 'symbol') {
|
|
18509
|
+
const key = Symbol.keyFor(obj);
|
|
18510
|
+
if (key !== undefined)
|
|
18511
|
+
return `Symbol.for(${stringify$1(key)})`;
|
|
18512
|
+
}
|
|
18513
|
+
if (typeof obj === 'bigint')
|
|
18514
|
+
return `${obj}n`;
|
|
18454
18515
|
return stringify$1(obj);
|
|
18455
18516
|
}
|
|
18456
18517
|
const dataToEsm = function dataToEsm(data, options = {}) {
|
|
@@ -18736,7 +18797,7 @@ function cssPostPlugin(config) {
|
|
|
18736
18797
|
`${style}.innerHTML = ${JSON.stringify(chunkCSS)};` +
|
|
18737
18798
|
`document.head.appendChild(${style});`;
|
|
18738
18799
|
if (config.build.sourcemap) {
|
|
18739
|
-
const s = new MagicString(code);
|
|
18800
|
+
const s = new MagicString$1(code);
|
|
18740
18801
|
s.prepend(injectCode);
|
|
18741
18802
|
return {
|
|
18742
18803
|
code: s.toString(),
|
|
@@ -18917,7 +18978,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
18917
18978
|
const postcssPlugins = postcssConfig && postcssConfig.plugins ? postcssConfig.plugins.slice() : [];
|
|
18918
18979
|
if (needInlineImport) {
|
|
18919
18980
|
const isHTMLProxy = htmlProxyRE$1.test(id);
|
|
18920
|
-
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-
|
|
18981
|
+
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-5633cdf8.js'); }).then(function (n) { return n.index; })).default({
|
|
18921
18982
|
async resolve(id, basedir) {
|
|
18922
18983
|
const publicFile = checkPublicFile(id, config);
|
|
18923
18984
|
if (isHTMLProxy && publicFile) {
|
|
@@ -18935,7 +18996,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
18935
18996
|
replacer: urlReplacer
|
|
18936
18997
|
}));
|
|
18937
18998
|
if (isModule) {
|
|
18938
|
-
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-
|
|
18999
|
+
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-0d07874d.js'); }).then(function (n) { return n.index; })).default({
|
|
18939
19000
|
...modulesOptions,
|
|
18940
19001
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
18941
19002
|
modules = _modules;
|
|
@@ -19029,7 +19090,7 @@ async function resolvePostcssConfig(config) {
|
|
|
19029
19090
|
}
|
|
19030
19091
|
// inline postcss config via vite config
|
|
19031
19092
|
const inlineOptions = (_a = config.css) === null || _a === void 0 ? void 0 : _a.postcss;
|
|
19032
|
-
if (isObject$
|
|
19093
|
+
if (isObject$4(inlineOptions)) {
|
|
19033
19094
|
const options = { ...inlineOptions };
|
|
19034
19095
|
delete options.plugins;
|
|
19035
19096
|
result = {
|
|
@@ -19411,8 +19472,8 @@ function isPreProcessor(lang) {
|
|
|
19411
19472
|
return lang && lang in preProcessors;
|
|
19412
19473
|
}
|
|
19413
19474
|
|
|
19414
|
-
/* es-module-lexer 0.
|
|
19415
|
-
const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse$f(E,I="@"){if(!B)return init.then(()=>parse$f(E));const g=E.length+1,D=(B.__heap_base.value||B.__heap_base)+4*g-B.memory.buffer.byteLength;D>0&&B.memory.grow(Math.ceil(D/65536));const w=B.sa(g-1);if((A?C:Q)(E,new Uint16Array(B.memory.buffer,w,g)),!B.parse())throw Object.assign(new Error(`Parse error ${I}:${E.slice(0,B.e()).split("\n").length}:${B.e()-E.lastIndexOf("\n",B.e()-1)}`),{idx:B.e()});const L=[],k=[];for(;B.ri();){const A=B.is(),Q=B.ie(),C=B.ai(),I=B.id(),g=B.ss(),D=B.se();let w;B.ip()&&(w=J(E.slice(-1===I?A-1:A,-1===I?Q+1:Q))),L.push({n:w,s:A,e:Q,ss:g,se:D,d:I,a:C});}for(;B.re();){const A=E.slice(B.es(),B.ee()),Q=A[0];k.push('"'===Q||"'"===Q?J(A):A);}function J(A){try{return (0, eval)(A)}catch(A){}}return [L,k,!!B.f()]}function Q(A,Q){const C=A.length;let B=0;for(;B<C;){const C=A.charCodeAt(B);Q[B++]=(255&C)<<8|C>>>8;}}function C(A,Q){const C=A.length;let B=0;for(;B<C;)Q[B]=A.charCodeAt(B++);}let B;const init=WebAssembly.compile((E="AGFzbQEAAAABXA1gAX8Bf2AEf39/fwBgAn9/AGAAAX9gBn9/f39/fwF/YAAAYAF/AGAEf39/fwF/YAN/f38Bf2AHf39/f39/fwF/YAV/f39/fwF/YAJ/fwF/YAh/f39/f39/fwF/AzEwAAECAwMDAwMDAwMDAwMDAwAABAUFBQYFBgAAAAAFBQAEBwgJCgsMAAIAAAALAwkMBAUBcAEBAQUDAQABBg8CfwFB8PAAC38AQfDwAAsHZBEGbWVtb3J5AgACc2EAAAFlAAMC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C8BCCAFRw0AIAAvAQYgBEcNACAALwEEIANHDQAgAC8BAiACRw0AIAAvAQAgAUYhCAsgCAsLHwIAQYAICwIAAABBhAgLEAEAAAACAAAAAAQAAHA4AAA=","undefined"!=typeof Buffer?Buffer.from(E,"base64"):Uint8Array.from(atob(E),A=>A.charCodeAt(0)))).then(WebAssembly.instantiate).then(({exports:A})=>{B=A;});var E;
|
|
19475
|
+
/* es-module-lexer 0.10.0 */
|
|
19476
|
+
const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse$f(E,g="@"){if(!C)return init.then(()=>parse$f(E));const I=E.length+1,o=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;o>0&&C.memory.grow(Math.ceil(o/65536));const k=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,k,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const J=[],i=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),o=C.se();let k;C.ip()&&(k=w(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),J.push({n:k,s:A,e:Q,ss:I,se:o,d:g,a:B});}for(;C.re();){const A=E.slice(C.es(),C.ee()),Q=A[0];i.push('"'===Q||"'"===Q?w(A):A);}function w(A){try{return (0, eval)(A)}catch(A){}}return [J,i,!!C.f()]}function Q(A,Q){const B=A.length;let C=0;for(;C<B;){const B=A.charCodeAt(C);Q[C++]=(255&B)<<8|B>>>8;}}function B(A,Q){const B=A.length;let C=0;for(;C<B;)Q[C]=A.charCodeAt(C++);}let C;const init=WebAssembly.compile((E="AGFzbQEAAAABKghgAX8Bf2AEf39/fwBgAn9/AGAAAX9gAABgAX8AYAN/f38Bf2ACf38BfwMqKQABAgMDAwMDAwMDAwMDAwMAAAQEBAUEBQAAAAAEBAAGBwACAAAABwMGBAUBcAEBAQUDAQABBg8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AgAkH2AEYNBSACQfsARw0CQQAgA0ECajYCiApBARAhIQNBACgCiAohAQNAAkACQCADQf//A3EiAkEiRg0AIAJBJ0YNACACECQaQQAoAogKIQIMAQsgAhAXQQBBACgCiApBAmoiAjYCiAoLQQEQIRoCQCABIAIQJiIDQSxHDQBBAEEAKAKICkECajYCiApBARAhIQMLQQAoAogKIQICQCADQf0ARg0AIAIgAUYNBSACIQEgAkEAKAKMCk0NAQwFCwtBACACQQJqNgKICgwBC0EAIANBAmo2AogKQQEQIRpBACgCiAoiAiACECYaC0EBECEhAgtBACgCiAohAwJAIAJB5gBHDQAgA0ECakGeCEEGECgNAEEAIANBCGo2AogKIABBARAhECIPC0EAIANBfmo2AogKDAMLEB0PCwJAIAMpAAJC7ICEg7COwDlSDQAgAy8BChAeRQ0AQQAgA0EKajYCiApBARAhIQJBACgCiAohAyACECQaIANBACgCiAoQAkEAQQAoAogKQX5qNgKICg8LQQAgA0EEaiIDNgKICgtBACADQQRqIgI2AogKQQBBADoA5AkDQEEAIAJBAmo2AogKQQEQISEDQQAoAogKIQICQCADECRBIHJB+wBHDQBBAEEAKAKICkF+ajYCiAoPC0EAKAKICiIDIAJGDQEgAiADEAICQEEBECEiAkEsRg0AAkAgAkE9Rw0AQQBBACgCiApBfmo2AogKDwtBAEEAKAKICkF+ajYCiAoPC0EAKAKICiECDAALCw8LQQAgA0EKajYCiApBARAhGkEAKAKICiEDC0EAIANBEGo2AogKAkBBARAhIgJBKkcNAEEAQQAoAogKQQJqNgKICkEBECEhAgtBACgCiAohAyACECQaIANBACgCiAoQAkEAQQAoAogKQX5qNgKICg8LIAMgA0EOahACC6sGAQR/QQBBACgCiAoiAEEMaiIBNgKICgJAAkACQAJAAkACQAJAAkACQAJAQQEQISICQVlqDggCCAECAQEBBwALIAJBIkYNASACQfsARg0CC0EAKAKICiABRg0HC0EALwHqCQ0BQQAoAogKIQJBACgCjAohAwNAIAIgA08NBAJAAkAgAi8BACIBQSdGDQAgAUEiRw0BCyAAIAEQIg8LQQAgAkECaiICNgKICgwACwtBACgCiAohAkEALwHqCQ0BAkADQAJAAkACQCACQQAoAowKTw0AQQEQISICQSJGDQEgAkEnRg0BIAJB/QBHDQJBAEEAKAKICkECajYCiAoLQQEQIRpBACgCiAoiAikAAELmgMiD8I3ANlINBkEAIAJBCGo2AogKQQEQISICQSJGDQMgAkEnRg0DDAYLIAIQFwtBAEEAKAKICkECaiICNgKICgwACwsgACACECIMBQtBAEEAKAKICkF+ajYCiAoPC0EAIAJBfmo2AogKDwsQHQ8LQQBBACgCiApBAmo2AogKQQEQIUHtAEcNAUEAKAKICiICQQJqQZYIQQYQKA0BQQAoAvAJLwEAQS5GDQEgACAAIAJBCGpBACgCqAkQAQ8LQQAoAvwJQQAvAeoJIgJBAnRqQQAoAogKNgIAQQAgAkEBajsB6glBACgC8AkvAQBBLkYNAEEAQQAoAogKIgFBAmo2AogKQQEQISECIABBACgCiApBACABEAFBAEEALwHoCSIBQQFqOwHoCUEAKAKACiABQQJ0akEAKALECTYCAAJAIAJBIkYNACACQSdGDQBBAEEAKAKICkF+ajYCiAoPCyACEBdBAEEAKAKICkECaiICNgKICgJAAkACQEEBECFBV2oOBAECAgACC0EAQQAoAogKQQJqNgKICkEBECEaQQAoAsQJIgEgAjYCBCABQQE6ABggAUEAKAKICiICNgIQQQAgAkF+ajYCiAoPC0EAKALECSIBIAI2AgQgAUEBOgAYQQBBAC8B6glBf2o7AeoJIAFBACgCiApBAmo2AgxBAEEALwHoCUF/ajsB6AkPC0EAQQAoAogKQX5qNgKICg8LC0cBA39BACgCiApBAmohAEEAKAKMCiEBAkADQCAAIgJBfmogAU8NASACQQJqIQAgAi8BAEF2ag4EAQAAAQALC0EAIAI2AogKC5gBAQN/QQBBACgCiAoiAUECajYCiAogAUEGaiEBQQAoAowKIQIDQAJAAkACQCABQXxqIAJPDQAgAUF+ai8BACEDAkACQCAADQAgA0EqRg0BIANBdmoOBAIEBAIECyADQSpHDQMLIAEvAQBBL0cNAkEAIA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oOBAIBAQIBCyAAQQRqIQAMAAsLQQAgAjYCiAoQHUEADwtBACACNgKICkHdAAtJAQN/QQAhAwJAIAJFDQACQANAIAAtAAAiBCABLQAAIgVHDQEgAUEBaiEBIABBAWohACACQX9qIgINAAwCCwsgBCAFayEDCyADCwvCAQIAQYAIC6QBAAB4AHAAbwByAHQAbQBwAG8AcgB0AGUAdABhAGYAcgBvAG0AcwBzAGUAcgB0AHYAbwB5AGkAZQBkAGUAbABlAGkAbgBzAHQAYQBuAHQAeQByAGUAdAB1AHIAZABlAGIAdQBnAGcAZQBhAHcAYQBpAHQAaAByAHcAaABpAGwAZQBmAG8AcgBpAGYAYwBhAHQAYwBmAGkAbgBhAGwAbABlAGwAcwAAQaQJCxABAAAAAgAAAAAEAAAQOQAA","undefined"!=typeof Buffer?Buffer.from(E,"base64"):Uint8Array.from(atob(E),A=>A.charCodeAt(0)))).then(WebAssembly.instantiate).then(({exports:A})=>{C=A;});var E;
|
|
19416
19477
|
|
|
19417
19478
|
// This is a generated file. Do not edit.
|
|
19418
19479
|
var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
@@ -21096,10 +21157,10 @@ function buildImportAnalysisPlugin(config) {
|
|
|
21096
21157
|
return null;
|
|
21097
21158
|
}
|
|
21098
21159
|
let s;
|
|
21099
|
-
const str = () => s || (s = new MagicString(source));
|
|
21160
|
+
const str = () => s || (s = new MagicString$1(source));
|
|
21100
21161
|
let needPreloadHelper = false;
|
|
21101
21162
|
for (let index = 0; index < imports.length; index++) {
|
|
21102
|
-
const { s: start, e: end, ss: expStart, n: specifier, d: dynamicIndex } = imports[index];
|
|
21163
|
+
const { s: start, e: end, ss: expStart, se: expEnd, n: specifier, d: dynamicIndex } = imports[index];
|
|
21103
21164
|
// import.meta.glob
|
|
21104
21165
|
if (source.slice(start, end) === 'import.meta' &&
|
|
21105
21166
|
source.slice(end, end + 5) === '.glob') {
|
|
@@ -21113,10 +21174,9 @@ function buildImportAnalysisPlugin(config) {
|
|
|
21113
21174
|
}
|
|
21114
21175
|
if (dynamicIndex > -1 && insertPreload) {
|
|
21115
21176
|
needPreloadHelper = true;
|
|
21116
|
-
const
|
|
21117
|
-
const original = source.slice(dynamicIndex, dynamicEnd);
|
|
21177
|
+
const original = source.slice(expStart, expEnd);
|
|
21118
21178
|
const replacement = `${preloadMethod}(() => ${original},${isModernFlag}?"${preloadMarker}":void 0)`;
|
|
21119
|
-
str().overwrite(
|
|
21179
|
+
str().overwrite(expStart, expEnd, replacement);
|
|
21120
21180
|
}
|
|
21121
21181
|
// Differentiate CSS imports that use the default export from those that
|
|
21122
21182
|
// do not by injecting a ?used query - this allows us to avoid including
|
|
@@ -21149,7 +21209,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
21149
21209
|
const re = new RegExp(isModernFlag, 'g');
|
|
21150
21210
|
const isModern = String(format === 'es');
|
|
21151
21211
|
if (config.build.sourcemap) {
|
|
21152
|
-
const s = new MagicString(code);
|
|
21212
|
+
const s = new MagicString$1(code);
|
|
21153
21213
|
let match;
|
|
21154
21214
|
while ((match = re.exec(code))) {
|
|
21155
21215
|
s.overwrite(match.index, match.index + isModernFlag.length, isModern);
|
|
@@ -21183,10 +21243,10 @@ function buildImportAnalysisPlugin(config) {
|
|
|
21183
21243
|
this.error(e, e.idx);
|
|
21184
21244
|
}
|
|
21185
21245
|
if (imports.length) {
|
|
21186
|
-
const s = new MagicString(code);
|
|
21246
|
+
const s = new MagicString$1(code);
|
|
21187
21247
|
for (let index = 0; index < imports.length; index++) {
|
|
21188
21248
|
// To handle escape sequences in specifier strings, the .n field will be provided where possible.
|
|
21189
|
-
const { n: name, s: start, e: end,
|
|
21249
|
+
const { n: name, s: start, e: end, ss: expStart, se: expEnd } = imports[index];
|
|
21190
21250
|
// check the chunk being imported
|
|
21191
21251
|
let url = name;
|
|
21192
21252
|
if (!url) {
|
|
@@ -21224,7 +21284,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
21224
21284
|
});
|
|
21225
21285
|
hasRemovedPureCssChunk = true;
|
|
21226
21286
|
}
|
|
21227
|
-
s.overwrite(
|
|
21287
|
+
s.overwrite(expStart, expEnd, 'Promise.resolve({})');
|
|
21228
21288
|
}
|
|
21229
21289
|
}
|
|
21230
21290
|
};
|
|
@@ -21393,7 +21453,7 @@ const assetAttrsConfig = {
|
|
|
21393
21453
|
const isAsyncScriptMap = new WeakMap();
|
|
21394
21454
|
async function traverseHtml(html, filePath, visitor) {
|
|
21395
21455
|
// lazy load compiler
|
|
21396
|
-
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-
|
|
21456
|
+
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-8a000299.js'); }).then(function (n) { return n.compilerDom_cjs; });
|
|
21397
21457
|
// @vue/compiler-core doesn't like lowercase doctypes
|
|
21398
21458
|
html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
|
|
21399
21459
|
try {
|
|
@@ -21473,7 +21533,7 @@ function buildHtmlPlugin(config) {
|
|
|
21473
21533
|
filename: id
|
|
21474
21534
|
});
|
|
21475
21535
|
let js = '';
|
|
21476
|
-
const s = new MagicString(html);
|
|
21536
|
+
const s = new MagicString$1(html);
|
|
21477
21537
|
const assetUrls = [];
|
|
21478
21538
|
const scriptUrls = [];
|
|
21479
21539
|
let inlineModuleIndex = -1;
|
|
@@ -21517,7 +21577,9 @@ function buildHtmlPlugin(config) {
|
|
|
21517
21577
|
someScriptsAreDefer || (someScriptsAreDefer = !isAsync);
|
|
21518
21578
|
}
|
|
21519
21579
|
else if (url && !isPublicFile) {
|
|
21520
|
-
|
|
21580
|
+
if (!isExcludedUrl(url)) {
|
|
21581
|
+
config.logger.warn(`<script src="${url}"> in "${publicPath}" can't be bundled without type="module" attribute`);
|
|
21582
|
+
}
|
|
21521
21583
|
}
|
|
21522
21584
|
else if (node.children.length) {
|
|
21523
21585
|
const scriptNode = node.children.pop();
|
|
@@ -21741,7 +21803,7 @@ function buildHtmlPlugin(config) {
|
|
|
21741
21803
|
let match;
|
|
21742
21804
|
let s;
|
|
21743
21805
|
while ((match = inlineCSSRE.exec(result))) {
|
|
21744
|
-
s || (s = new MagicString(result));
|
|
21806
|
+
s || (s = new MagicString$1(result));
|
|
21745
21807
|
const { 0: full, 1: scopedName } = match;
|
|
21746
21808
|
const cssTransformedCode = htmlProxyResult.get(scopedName);
|
|
21747
21809
|
s.overwrite(match.index, match.index + full.length, cssTransformedCode);
|
|
@@ -26456,316 +26518,1333 @@ Glob.prototype._processSimple = function (prefix, index, cb) {
|
|
|
26456
26518
|
self._processSimple2(prefix, index, er, exists, cb);
|
|
26457
26519
|
});
|
|
26458
26520
|
};
|
|
26459
|
-
Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
|
|
26521
|
+
Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
|
|
26522
|
+
|
|
26523
|
+
//console.error('ps2', prefix, exists)
|
|
26524
|
+
|
|
26525
|
+
if (!this.matches[index])
|
|
26526
|
+
this.matches[index] = Object.create(null);
|
|
26527
|
+
|
|
26528
|
+
// If it doesn't exist, then just mark the lack of results
|
|
26529
|
+
if (!exists)
|
|
26530
|
+
return cb()
|
|
26531
|
+
|
|
26532
|
+
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
26533
|
+
var trail = /[\/\\]$/.test(prefix);
|
|
26534
|
+
if (prefix.charAt(0) === '/') {
|
|
26535
|
+
prefix = path$a.join(this.root, prefix);
|
|
26536
|
+
} else {
|
|
26537
|
+
prefix = path$a.resolve(this.root, prefix);
|
|
26538
|
+
if (trail)
|
|
26539
|
+
prefix += '/';
|
|
26540
|
+
}
|
|
26541
|
+
}
|
|
26542
|
+
|
|
26543
|
+
if (process.platform === 'win32')
|
|
26544
|
+
prefix = prefix.replace(/\\/g, '/');
|
|
26545
|
+
|
|
26546
|
+
// Mark this as a match
|
|
26547
|
+
this._emitMatch(index, prefix);
|
|
26548
|
+
cb();
|
|
26549
|
+
};
|
|
26550
|
+
|
|
26551
|
+
// Returns either 'DIR', 'FILE', or false
|
|
26552
|
+
Glob.prototype._stat = function (f, cb) {
|
|
26553
|
+
var abs = this._makeAbs(f);
|
|
26554
|
+
var needDir = f.slice(-1) === '/';
|
|
26555
|
+
|
|
26556
|
+
if (f.length > this.maxLength)
|
|
26557
|
+
return cb()
|
|
26558
|
+
|
|
26559
|
+
if (!this.stat && ownProp(this.cache, abs)) {
|
|
26560
|
+
var c = this.cache[abs];
|
|
26561
|
+
|
|
26562
|
+
if (Array.isArray(c))
|
|
26563
|
+
c = 'DIR';
|
|
26564
|
+
|
|
26565
|
+
// It exists, but maybe not how we need it
|
|
26566
|
+
if (!needDir || c === 'DIR')
|
|
26567
|
+
return cb(null, c)
|
|
26568
|
+
|
|
26569
|
+
if (needDir && c === 'FILE')
|
|
26570
|
+
return cb()
|
|
26571
|
+
|
|
26572
|
+
// otherwise we have to stat, because maybe c=true
|
|
26573
|
+
// if we know it exists, but not what it is.
|
|
26574
|
+
}
|
|
26575
|
+
var stat = this.statCache[abs];
|
|
26576
|
+
if (stat !== undefined) {
|
|
26577
|
+
if (stat === false)
|
|
26578
|
+
return cb(null, stat)
|
|
26579
|
+
else {
|
|
26580
|
+
var type = stat.isDirectory() ? 'DIR' : 'FILE';
|
|
26581
|
+
if (needDir && type === 'FILE')
|
|
26582
|
+
return cb()
|
|
26583
|
+
else
|
|
26584
|
+
return cb(null, type, stat)
|
|
26585
|
+
}
|
|
26586
|
+
}
|
|
26587
|
+
|
|
26588
|
+
var self = this;
|
|
26589
|
+
var statcb = inflight('stat\0' + abs, lstatcb_);
|
|
26590
|
+
if (statcb)
|
|
26591
|
+
self.fs.lstat(abs, statcb);
|
|
26592
|
+
|
|
26593
|
+
function lstatcb_ (er, lstat) {
|
|
26594
|
+
if (lstat && lstat.isSymbolicLink()) {
|
|
26595
|
+
// If it's a symlink, then treat it as the target, unless
|
|
26596
|
+
// the target does not exist, then treat it as a file.
|
|
26597
|
+
return self.fs.stat(abs, function (er, stat) {
|
|
26598
|
+
if (er)
|
|
26599
|
+
self._stat2(f, abs, null, lstat, cb);
|
|
26600
|
+
else
|
|
26601
|
+
self._stat2(f, abs, er, stat, cb);
|
|
26602
|
+
})
|
|
26603
|
+
} else {
|
|
26604
|
+
self._stat2(f, abs, er, lstat, cb);
|
|
26605
|
+
}
|
|
26606
|
+
}
|
|
26607
|
+
};
|
|
26608
|
+
|
|
26609
|
+
Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
|
26610
|
+
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
|
26611
|
+
this.statCache[abs] = false;
|
|
26612
|
+
return cb()
|
|
26613
|
+
}
|
|
26614
|
+
|
|
26615
|
+
var needDir = f.slice(-1) === '/';
|
|
26616
|
+
this.statCache[abs] = stat;
|
|
26617
|
+
|
|
26618
|
+
if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
|
|
26619
|
+
return cb(null, false, stat)
|
|
26620
|
+
|
|
26621
|
+
var c = true;
|
|
26622
|
+
if (stat)
|
|
26623
|
+
c = stat.isDirectory() ? 'DIR' : 'FILE';
|
|
26624
|
+
this.cache[abs] = this.cache[abs] || c;
|
|
26625
|
+
|
|
26626
|
+
if (needDir && c === 'FILE')
|
|
26627
|
+
return cb()
|
|
26628
|
+
|
|
26629
|
+
return cb(null, c, stat)
|
|
26630
|
+
};
|
|
26631
|
+
|
|
26632
|
+
// @ts-check
|
|
26633
|
+
/** @typedef { import('estree').BaseNode} BaseNode */
|
|
26634
|
+
|
|
26635
|
+
/** @typedef {{
|
|
26636
|
+
skip: () => void;
|
|
26637
|
+
remove: () => void;
|
|
26638
|
+
replace: (node: BaseNode) => void;
|
|
26639
|
+
}} WalkerContext */
|
|
26640
|
+
|
|
26641
|
+
class WalkerBase {
|
|
26642
|
+
constructor() {
|
|
26643
|
+
/** @type {boolean} */
|
|
26644
|
+
this.should_skip = false;
|
|
26645
|
+
|
|
26646
|
+
/** @type {boolean} */
|
|
26647
|
+
this.should_remove = false;
|
|
26648
|
+
|
|
26649
|
+
/** @type {BaseNode | null} */
|
|
26650
|
+
this.replacement = null;
|
|
26651
|
+
|
|
26652
|
+
/** @type {WalkerContext} */
|
|
26653
|
+
this.context = {
|
|
26654
|
+
skip: () => (this.should_skip = true),
|
|
26655
|
+
remove: () => (this.should_remove = true),
|
|
26656
|
+
replace: (node) => (this.replacement = node)
|
|
26657
|
+
};
|
|
26658
|
+
}
|
|
26659
|
+
|
|
26660
|
+
/**
|
|
26661
|
+
*
|
|
26662
|
+
* @param {any} parent
|
|
26663
|
+
* @param {string} prop
|
|
26664
|
+
* @param {number} index
|
|
26665
|
+
* @param {BaseNode} node
|
|
26666
|
+
*/
|
|
26667
|
+
replace(parent, prop, index, node) {
|
|
26668
|
+
if (parent) {
|
|
26669
|
+
if (index !== null) {
|
|
26670
|
+
parent[prop][index] = node;
|
|
26671
|
+
} else {
|
|
26672
|
+
parent[prop] = node;
|
|
26673
|
+
}
|
|
26674
|
+
}
|
|
26675
|
+
}
|
|
26676
|
+
|
|
26677
|
+
/**
|
|
26678
|
+
*
|
|
26679
|
+
* @param {any} parent
|
|
26680
|
+
* @param {string} prop
|
|
26681
|
+
* @param {number} index
|
|
26682
|
+
*/
|
|
26683
|
+
remove(parent, prop, index) {
|
|
26684
|
+
if (parent) {
|
|
26685
|
+
if (index !== null) {
|
|
26686
|
+
parent[prop].splice(index, 1);
|
|
26687
|
+
} else {
|
|
26688
|
+
delete parent[prop];
|
|
26689
|
+
}
|
|
26690
|
+
}
|
|
26691
|
+
}
|
|
26692
|
+
}
|
|
26693
|
+
|
|
26694
|
+
// @ts-check
|
|
26695
|
+
|
|
26696
|
+
/** @typedef { import('estree').BaseNode} BaseNode */
|
|
26697
|
+
/** @typedef { import('./walker.js').WalkerContext} WalkerContext */
|
|
26698
|
+
|
|
26699
|
+
/** @typedef {(
|
|
26700
|
+
* this: WalkerContext,
|
|
26701
|
+
* node: BaseNode,
|
|
26702
|
+
* parent: BaseNode,
|
|
26703
|
+
* key: string,
|
|
26704
|
+
* index: number
|
|
26705
|
+
* ) => void} SyncHandler */
|
|
26706
|
+
|
|
26707
|
+
class SyncWalker extends WalkerBase {
|
|
26708
|
+
/**
|
|
26709
|
+
*
|
|
26710
|
+
* @param {SyncHandler} enter
|
|
26711
|
+
* @param {SyncHandler} leave
|
|
26712
|
+
*/
|
|
26713
|
+
constructor(enter, leave) {
|
|
26714
|
+
super();
|
|
26715
|
+
|
|
26716
|
+
/** @type {SyncHandler} */
|
|
26717
|
+
this.enter = enter;
|
|
26718
|
+
|
|
26719
|
+
/** @type {SyncHandler} */
|
|
26720
|
+
this.leave = leave;
|
|
26721
|
+
}
|
|
26722
|
+
|
|
26723
|
+
/**
|
|
26724
|
+
*
|
|
26725
|
+
* @param {BaseNode} node
|
|
26726
|
+
* @param {BaseNode} parent
|
|
26727
|
+
* @param {string} [prop]
|
|
26728
|
+
* @param {number} [index]
|
|
26729
|
+
* @returns {BaseNode}
|
|
26730
|
+
*/
|
|
26731
|
+
visit(node, parent, prop, index) {
|
|
26732
|
+
if (node) {
|
|
26733
|
+
if (this.enter) {
|
|
26734
|
+
const _should_skip = this.should_skip;
|
|
26735
|
+
const _should_remove = this.should_remove;
|
|
26736
|
+
const _replacement = this.replacement;
|
|
26737
|
+
this.should_skip = false;
|
|
26738
|
+
this.should_remove = false;
|
|
26739
|
+
this.replacement = null;
|
|
26740
|
+
|
|
26741
|
+
this.enter.call(this.context, node, parent, prop, index);
|
|
26742
|
+
|
|
26743
|
+
if (this.replacement) {
|
|
26744
|
+
node = this.replacement;
|
|
26745
|
+
this.replace(parent, prop, index, node);
|
|
26746
|
+
}
|
|
26747
|
+
|
|
26748
|
+
if (this.should_remove) {
|
|
26749
|
+
this.remove(parent, prop, index);
|
|
26750
|
+
}
|
|
26751
|
+
|
|
26752
|
+
const skipped = this.should_skip;
|
|
26753
|
+
const removed = this.should_remove;
|
|
26754
|
+
|
|
26755
|
+
this.should_skip = _should_skip;
|
|
26756
|
+
this.should_remove = _should_remove;
|
|
26757
|
+
this.replacement = _replacement;
|
|
26758
|
+
|
|
26759
|
+
if (skipped) return node;
|
|
26760
|
+
if (removed) return null;
|
|
26761
|
+
}
|
|
26762
|
+
|
|
26763
|
+
for (const key in node) {
|
|
26764
|
+
const value = node[key];
|
|
26765
|
+
|
|
26766
|
+
if (typeof value !== "object") {
|
|
26767
|
+
continue;
|
|
26768
|
+
} else if (Array.isArray(value)) {
|
|
26769
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
26770
|
+
if (value[i] !== null && typeof value[i].type === 'string') {
|
|
26771
|
+
if (!this.visit(value[i], node, key, i)) {
|
|
26772
|
+
// removed
|
|
26773
|
+
i--;
|
|
26774
|
+
}
|
|
26775
|
+
}
|
|
26776
|
+
}
|
|
26777
|
+
} else if (value !== null && typeof value.type === "string") {
|
|
26778
|
+
this.visit(value, node, key, null);
|
|
26779
|
+
}
|
|
26780
|
+
}
|
|
26781
|
+
|
|
26782
|
+
if (this.leave) {
|
|
26783
|
+
const _replacement = this.replacement;
|
|
26784
|
+
const _should_remove = this.should_remove;
|
|
26785
|
+
this.replacement = null;
|
|
26786
|
+
this.should_remove = false;
|
|
26787
|
+
|
|
26788
|
+
this.leave.call(this.context, node, parent, prop, index);
|
|
26789
|
+
|
|
26790
|
+
if (this.replacement) {
|
|
26791
|
+
node = this.replacement;
|
|
26792
|
+
this.replace(parent, prop, index, node);
|
|
26793
|
+
}
|
|
26794
|
+
|
|
26795
|
+
if (this.should_remove) {
|
|
26796
|
+
this.remove(parent, prop, index);
|
|
26797
|
+
}
|
|
26798
|
+
|
|
26799
|
+
const removed = this.should_remove;
|
|
26800
|
+
|
|
26801
|
+
this.replacement = _replacement;
|
|
26802
|
+
this.should_remove = _should_remove;
|
|
26803
|
+
|
|
26804
|
+
if (removed) return null;
|
|
26805
|
+
}
|
|
26806
|
+
}
|
|
26807
|
+
|
|
26808
|
+
return node;
|
|
26809
|
+
}
|
|
26810
|
+
}
|
|
26811
|
+
|
|
26812
|
+
// @ts-check
|
|
26813
|
+
|
|
26814
|
+
/** @typedef { import('estree').BaseNode} BaseNode */
|
|
26815
|
+
/** @typedef { import('./sync.js').SyncHandler} SyncHandler */
|
|
26816
|
+
/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */
|
|
26817
|
+
|
|
26818
|
+
/**
|
|
26819
|
+
*
|
|
26820
|
+
* @param {BaseNode} ast
|
|
26821
|
+
* @param {{
|
|
26822
|
+
* enter?: SyncHandler
|
|
26823
|
+
* leave?: SyncHandler
|
|
26824
|
+
* }} walker
|
|
26825
|
+
* @returns {BaseNode}
|
|
26826
|
+
*/
|
|
26827
|
+
function walk$1(ast, { enter, leave }) {
|
|
26828
|
+
const instance = new SyncWalker(enter, leave);
|
|
26829
|
+
return instance.visit(ast, null);
|
|
26830
|
+
}
|
|
26831
|
+
|
|
26832
|
+
var BitSet = function BitSet(arg) {
|
|
26833
|
+
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
26834
|
+
};
|
|
26835
|
+
|
|
26836
|
+
BitSet.prototype.add = function add (n) {
|
|
26837
|
+
this.bits[n >> 5] |= 1 << (n & 31);
|
|
26838
|
+
};
|
|
26839
|
+
|
|
26840
|
+
BitSet.prototype.has = function has (n) {
|
|
26841
|
+
return !!(this.bits[n >> 5] & (1 << (n & 31)));
|
|
26842
|
+
};
|
|
26843
|
+
|
|
26844
|
+
var Chunk = function Chunk(start, end, content) {
|
|
26845
|
+
this.start = start;
|
|
26846
|
+
this.end = end;
|
|
26847
|
+
this.original = content;
|
|
26848
|
+
|
|
26849
|
+
this.intro = '';
|
|
26850
|
+
this.outro = '';
|
|
26851
|
+
|
|
26852
|
+
this.content = content;
|
|
26853
|
+
this.storeName = false;
|
|
26854
|
+
this.edited = false;
|
|
26855
|
+
|
|
26856
|
+
// we make these non-enumerable, for sanity while debugging
|
|
26857
|
+
Object.defineProperties(this, {
|
|
26858
|
+
previous: { writable: true, value: null },
|
|
26859
|
+
next: { writable: true, value: null }
|
|
26860
|
+
});
|
|
26861
|
+
};
|
|
26862
|
+
|
|
26863
|
+
Chunk.prototype.appendLeft = function appendLeft (content) {
|
|
26864
|
+
this.outro += content;
|
|
26865
|
+
};
|
|
26866
|
+
|
|
26867
|
+
Chunk.prototype.appendRight = function appendRight (content) {
|
|
26868
|
+
this.intro = this.intro + content;
|
|
26869
|
+
};
|
|
26870
|
+
|
|
26871
|
+
Chunk.prototype.clone = function clone () {
|
|
26872
|
+
var chunk = new Chunk(this.start, this.end, this.original);
|
|
26873
|
+
|
|
26874
|
+
chunk.intro = this.intro;
|
|
26875
|
+
chunk.outro = this.outro;
|
|
26876
|
+
chunk.content = this.content;
|
|
26877
|
+
chunk.storeName = this.storeName;
|
|
26878
|
+
chunk.edited = this.edited;
|
|
26879
|
+
|
|
26880
|
+
return chunk;
|
|
26881
|
+
};
|
|
26882
|
+
|
|
26883
|
+
Chunk.prototype.contains = function contains (index) {
|
|
26884
|
+
return this.start < index && index < this.end;
|
|
26885
|
+
};
|
|
26886
|
+
|
|
26887
|
+
Chunk.prototype.eachNext = function eachNext (fn) {
|
|
26888
|
+
var chunk = this;
|
|
26889
|
+
while (chunk) {
|
|
26890
|
+
fn(chunk);
|
|
26891
|
+
chunk = chunk.next;
|
|
26892
|
+
}
|
|
26893
|
+
};
|
|
26894
|
+
|
|
26895
|
+
Chunk.prototype.eachPrevious = function eachPrevious (fn) {
|
|
26896
|
+
var chunk = this;
|
|
26897
|
+
while (chunk) {
|
|
26898
|
+
fn(chunk);
|
|
26899
|
+
chunk = chunk.previous;
|
|
26900
|
+
}
|
|
26901
|
+
};
|
|
26902
|
+
|
|
26903
|
+
Chunk.prototype.edit = function edit (content, storeName, contentOnly) {
|
|
26904
|
+
this.content = content;
|
|
26905
|
+
if (!contentOnly) {
|
|
26906
|
+
this.intro = '';
|
|
26907
|
+
this.outro = '';
|
|
26908
|
+
}
|
|
26909
|
+
this.storeName = storeName;
|
|
26910
|
+
|
|
26911
|
+
this.edited = true;
|
|
26912
|
+
|
|
26913
|
+
return this;
|
|
26914
|
+
};
|
|
26915
|
+
|
|
26916
|
+
Chunk.prototype.prependLeft = function prependLeft (content) {
|
|
26917
|
+
this.outro = content + this.outro;
|
|
26918
|
+
};
|
|
26919
|
+
|
|
26920
|
+
Chunk.prototype.prependRight = function prependRight (content) {
|
|
26921
|
+
this.intro = content + this.intro;
|
|
26922
|
+
};
|
|
26923
|
+
|
|
26924
|
+
Chunk.prototype.split = function split (index) {
|
|
26925
|
+
var sliceIndex = index - this.start;
|
|
26926
|
+
|
|
26927
|
+
var originalBefore = this.original.slice(0, sliceIndex);
|
|
26928
|
+
var originalAfter = this.original.slice(sliceIndex);
|
|
26929
|
+
|
|
26930
|
+
this.original = originalBefore;
|
|
26931
|
+
|
|
26932
|
+
var newChunk = new Chunk(index, this.end, originalAfter);
|
|
26933
|
+
newChunk.outro = this.outro;
|
|
26934
|
+
this.outro = '';
|
|
26935
|
+
|
|
26936
|
+
this.end = index;
|
|
26937
|
+
|
|
26938
|
+
if (this.edited) {
|
|
26939
|
+
// TODO is this block necessary?...
|
|
26940
|
+
newChunk.edit('', false);
|
|
26941
|
+
this.content = '';
|
|
26942
|
+
} else {
|
|
26943
|
+
this.content = originalBefore;
|
|
26944
|
+
}
|
|
26945
|
+
|
|
26946
|
+
newChunk.next = this.next;
|
|
26947
|
+
if (newChunk.next) { newChunk.next.previous = newChunk; }
|
|
26948
|
+
newChunk.previous = this;
|
|
26949
|
+
this.next = newChunk;
|
|
26950
|
+
|
|
26951
|
+
return newChunk;
|
|
26952
|
+
};
|
|
26953
|
+
|
|
26954
|
+
Chunk.prototype.toString = function toString () {
|
|
26955
|
+
return this.intro + this.content + this.outro;
|
|
26956
|
+
};
|
|
26957
|
+
|
|
26958
|
+
Chunk.prototype.trimEnd = function trimEnd (rx) {
|
|
26959
|
+
this.outro = this.outro.replace(rx, '');
|
|
26960
|
+
if (this.outro.length) { return true; }
|
|
26961
|
+
|
|
26962
|
+
var trimmed = this.content.replace(rx, '');
|
|
26963
|
+
|
|
26964
|
+
if (trimmed.length) {
|
|
26965
|
+
if (trimmed !== this.content) {
|
|
26966
|
+
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
26967
|
+
}
|
|
26968
|
+
return true;
|
|
26969
|
+
|
|
26970
|
+
} else {
|
|
26971
|
+
this.edit('', undefined, true);
|
|
26972
|
+
|
|
26973
|
+
this.intro = this.intro.replace(rx, '');
|
|
26974
|
+
if (this.intro.length) { return true; }
|
|
26975
|
+
}
|
|
26976
|
+
};
|
|
26977
|
+
|
|
26978
|
+
Chunk.prototype.trimStart = function trimStart (rx) {
|
|
26979
|
+
this.intro = this.intro.replace(rx, '');
|
|
26980
|
+
if (this.intro.length) { return true; }
|
|
26981
|
+
|
|
26982
|
+
var trimmed = this.content.replace(rx, '');
|
|
26983
|
+
|
|
26984
|
+
if (trimmed.length) {
|
|
26985
|
+
if (trimmed !== this.content) {
|
|
26986
|
+
this.split(this.end - trimmed.length);
|
|
26987
|
+
this.edit('', undefined, true);
|
|
26988
|
+
}
|
|
26989
|
+
return true;
|
|
26990
|
+
|
|
26991
|
+
} else {
|
|
26992
|
+
this.edit('', undefined, true);
|
|
26993
|
+
|
|
26994
|
+
this.outro = this.outro.replace(rx, '');
|
|
26995
|
+
if (this.outro.length) { return true; }
|
|
26996
|
+
}
|
|
26997
|
+
};
|
|
26998
|
+
|
|
26999
|
+
var btoa$1 = function () {
|
|
27000
|
+
throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
|
|
27001
|
+
};
|
|
27002
|
+
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
|
|
27003
|
+
btoa$1 = function (str) { return window.btoa(unescape(encodeURIComponent(str))); };
|
|
27004
|
+
} else if (typeof Buffer === 'function') {
|
|
27005
|
+
btoa$1 = function (str) { return Buffer.from(str, 'utf-8').toString('base64'); };
|
|
27006
|
+
}
|
|
27007
|
+
|
|
27008
|
+
var SourceMap = function SourceMap(properties) {
|
|
27009
|
+
this.version = 3;
|
|
27010
|
+
this.file = properties.file;
|
|
27011
|
+
this.sources = properties.sources;
|
|
27012
|
+
this.sourcesContent = properties.sourcesContent;
|
|
27013
|
+
this.names = properties.names;
|
|
27014
|
+
this.mappings = encode(properties.mappings);
|
|
27015
|
+
};
|
|
27016
|
+
|
|
27017
|
+
SourceMap.prototype.toString = function toString () {
|
|
27018
|
+
return JSON.stringify(this);
|
|
27019
|
+
};
|
|
27020
|
+
|
|
27021
|
+
SourceMap.prototype.toUrl = function toUrl () {
|
|
27022
|
+
return 'data:application/json;charset=utf-8;base64,' + btoa$1(this.toString());
|
|
27023
|
+
};
|
|
27024
|
+
|
|
27025
|
+
function guessIndent(code) {
|
|
27026
|
+
var lines = code.split('\n');
|
|
27027
|
+
|
|
27028
|
+
var tabbed = lines.filter(function (line) { return /^\t+/.test(line); });
|
|
27029
|
+
var spaced = lines.filter(function (line) { return /^ {2,}/.test(line); });
|
|
27030
|
+
|
|
27031
|
+
if (tabbed.length === 0 && spaced.length === 0) {
|
|
27032
|
+
return null;
|
|
27033
|
+
}
|
|
27034
|
+
|
|
27035
|
+
// More lines tabbed than spaced? Assume tabs, and
|
|
27036
|
+
// default to tabs in the case of a tie (or nothing
|
|
27037
|
+
// to go on)
|
|
27038
|
+
if (tabbed.length >= spaced.length) {
|
|
27039
|
+
return '\t';
|
|
27040
|
+
}
|
|
27041
|
+
|
|
27042
|
+
// Otherwise, we need to guess the multiple
|
|
27043
|
+
var min = spaced.reduce(function (previous, current) {
|
|
27044
|
+
var numSpaces = /^ +/.exec(current)[0].length;
|
|
27045
|
+
return Math.min(numSpaces, previous);
|
|
27046
|
+
}, Infinity);
|
|
27047
|
+
|
|
27048
|
+
return new Array(min + 1).join(' ');
|
|
27049
|
+
}
|
|
27050
|
+
|
|
27051
|
+
function getRelativePath(from, to) {
|
|
27052
|
+
var fromParts = from.split(/[/\\]/);
|
|
27053
|
+
var toParts = to.split(/[/\\]/);
|
|
27054
|
+
|
|
27055
|
+
fromParts.pop(); // get dirname
|
|
27056
|
+
|
|
27057
|
+
while (fromParts[0] === toParts[0]) {
|
|
27058
|
+
fromParts.shift();
|
|
27059
|
+
toParts.shift();
|
|
27060
|
+
}
|
|
27061
|
+
|
|
27062
|
+
if (fromParts.length) {
|
|
27063
|
+
var i = fromParts.length;
|
|
27064
|
+
while (i--) { fromParts[i] = '..'; }
|
|
27065
|
+
}
|
|
27066
|
+
|
|
27067
|
+
return fromParts.concat(toParts).join('/');
|
|
27068
|
+
}
|
|
27069
|
+
|
|
27070
|
+
var toString$2 = Object.prototype.toString;
|
|
27071
|
+
|
|
27072
|
+
function isObject(thing) {
|
|
27073
|
+
return toString$2.call(thing) === '[object Object]';
|
|
27074
|
+
}
|
|
27075
|
+
|
|
27076
|
+
function getLocator(source) {
|
|
27077
|
+
var originalLines = source.split('\n');
|
|
27078
|
+
var lineOffsets = [];
|
|
27079
|
+
|
|
27080
|
+
for (var i = 0, pos = 0; i < originalLines.length; i++) {
|
|
27081
|
+
lineOffsets.push(pos);
|
|
27082
|
+
pos += originalLines[i].length + 1;
|
|
27083
|
+
}
|
|
27084
|
+
|
|
27085
|
+
return function locate(index) {
|
|
27086
|
+
var i = 0;
|
|
27087
|
+
var j = lineOffsets.length;
|
|
27088
|
+
while (i < j) {
|
|
27089
|
+
var m = (i + j) >> 1;
|
|
27090
|
+
if (index < lineOffsets[m]) {
|
|
27091
|
+
j = m;
|
|
27092
|
+
} else {
|
|
27093
|
+
i = m + 1;
|
|
27094
|
+
}
|
|
27095
|
+
}
|
|
27096
|
+
var line = i - 1;
|
|
27097
|
+
var column = index - lineOffsets[line];
|
|
27098
|
+
return { line: line, column: column };
|
|
27099
|
+
};
|
|
27100
|
+
}
|
|
27101
|
+
|
|
27102
|
+
var Mappings = function Mappings(hires) {
|
|
27103
|
+
this.hires = hires;
|
|
27104
|
+
this.generatedCodeLine = 0;
|
|
27105
|
+
this.generatedCodeColumn = 0;
|
|
27106
|
+
this.raw = [];
|
|
27107
|
+
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
27108
|
+
this.pending = null;
|
|
27109
|
+
};
|
|
27110
|
+
|
|
27111
|
+
Mappings.prototype.addEdit = function addEdit (sourceIndex, content, loc, nameIndex) {
|
|
27112
|
+
if (content.length) {
|
|
27113
|
+
var segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
27114
|
+
if (nameIndex >= 0) {
|
|
27115
|
+
segment.push(nameIndex);
|
|
27116
|
+
}
|
|
27117
|
+
this.rawSegments.push(segment);
|
|
27118
|
+
} else if (this.pending) {
|
|
27119
|
+
this.rawSegments.push(this.pending);
|
|
27120
|
+
}
|
|
27121
|
+
|
|
27122
|
+
this.advance(content);
|
|
27123
|
+
this.pending = null;
|
|
27124
|
+
};
|
|
27125
|
+
|
|
27126
|
+
Mappings.prototype.addUneditedChunk = function addUneditedChunk (sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
27127
|
+
var originalCharIndex = chunk.start;
|
|
27128
|
+
var first = true;
|
|
27129
|
+
|
|
27130
|
+
while (originalCharIndex < chunk.end) {
|
|
27131
|
+
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
|
|
27132
|
+
this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
|
|
27133
|
+
}
|
|
27134
|
+
|
|
27135
|
+
if (original[originalCharIndex] === '\n') {
|
|
27136
|
+
loc.line += 1;
|
|
27137
|
+
loc.column = 0;
|
|
27138
|
+
this.generatedCodeLine += 1;
|
|
27139
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
27140
|
+
this.generatedCodeColumn = 0;
|
|
27141
|
+
first = true;
|
|
27142
|
+
} else {
|
|
27143
|
+
loc.column += 1;
|
|
27144
|
+
this.generatedCodeColumn += 1;
|
|
27145
|
+
first = false;
|
|
27146
|
+
}
|
|
27147
|
+
|
|
27148
|
+
originalCharIndex += 1;
|
|
27149
|
+
}
|
|
27150
|
+
|
|
27151
|
+
this.pending = null;
|
|
27152
|
+
};
|
|
27153
|
+
|
|
27154
|
+
Mappings.prototype.advance = function advance (str) {
|
|
27155
|
+
if (!str) { return; }
|
|
27156
|
+
|
|
27157
|
+
var lines = str.split('\n');
|
|
27158
|
+
|
|
27159
|
+
if (lines.length > 1) {
|
|
27160
|
+
for (var i = 0; i < lines.length - 1; i++) {
|
|
27161
|
+
this.generatedCodeLine++;
|
|
27162
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
27163
|
+
}
|
|
27164
|
+
this.generatedCodeColumn = 0;
|
|
27165
|
+
}
|
|
27166
|
+
|
|
27167
|
+
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
27168
|
+
};
|
|
27169
|
+
|
|
27170
|
+
var n = '\n';
|
|
27171
|
+
|
|
27172
|
+
var warned = {
|
|
27173
|
+
insertLeft: false,
|
|
27174
|
+
insertRight: false,
|
|
27175
|
+
storeName: false
|
|
27176
|
+
};
|
|
27177
|
+
|
|
27178
|
+
var MagicString = function MagicString(string, options) {
|
|
27179
|
+
if ( options === void 0 ) options = {};
|
|
27180
|
+
|
|
27181
|
+
var chunk = new Chunk(0, string.length, string);
|
|
27182
|
+
|
|
27183
|
+
Object.defineProperties(this, {
|
|
27184
|
+
original: { writable: true, value: string },
|
|
27185
|
+
outro: { writable: true, value: '' },
|
|
27186
|
+
intro: { writable: true, value: '' },
|
|
27187
|
+
firstChunk: { writable: true, value: chunk },
|
|
27188
|
+
lastChunk: { writable: true, value: chunk },
|
|
27189
|
+
lastSearchedChunk: { writable: true, value: chunk },
|
|
27190
|
+
byStart: { writable: true, value: {} },
|
|
27191
|
+
byEnd: { writable: true, value: {} },
|
|
27192
|
+
filename: { writable: true, value: options.filename },
|
|
27193
|
+
indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
|
|
27194
|
+
sourcemapLocations: { writable: true, value: new BitSet() },
|
|
27195
|
+
storedNames: { writable: true, value: {} },
|
|
27196
|
+
indentStr: { writable: true, value: guessIndent(string) }
|
|
27197
|
+
});
|
|
27198
|
+
|
|
27199
|
+
this.byStart[0] = chunk;
|
|
27200
|
+
this.byEnd[string.length] = chunk;
|
|
27201
|
+
};
|
|
27202
|
+
|
|
27203
|
+
MagicString.prototype.addSourcemapLocation = function addSourcemapLocation (char) {
|
|
27204
|
+
this.sourcemapLocations.add(char);
|
|
27205
|
+
};
|
|
27206
|
+
|
|
27207
|
+
MagicString.prototype.append = function append (content) {
|
|
27208
|
+
if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
|
|
27209
|
+
|
|
27210
|
+
this.outro += content;
|
|
27211
|
+
return this;
|
|
27212
|
+
};
|
|
27213
|
+
|
|
27214
|
+
MagicString.prototype.appendLeft = function appendLeft (index, content) {
|
|
27215
|
+
if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
|
|
27216
|
+
|
|
27217
|
+
this._split(index);
|
|
27218
|
+
|
|
27219
|
+
var chunk = this.byEnd[index];
|
|
27220
|
+
|
|
27221
|
+
if (chunk) {
|
|
27222
|
+
chunk.appendLeft(content);
|
|
27223
|
+
} else {
|
|
27224
|
+
this.intro += content;
|
|
27225
|
+
}
|
|
27226
|
+
return this;
|
|
27227
|
+
};
|
|
27228
|
+
|
|
27229
|
+
MagicString.prototype.appendRight = function appendRight (index, content) {
|
|
27230
|
+
if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
|
|
27231
|
+
|
|
27232
|
+
this._split(index);
|
|
27233
|
+
|
|
27234
|
+
var chunk = this.byStart[index];
|
|
27235
|
+
|
|
27236
|
+
if (chunk) {
|
|
27237
|
+
chunk.appendRight(content);
|
|
27238
|
+
} else {
|
|
27239
|
+
this.outro += content;
|
|
27240
|
+
}
|
|
27241
|
+
return this;
|
|
27242
|
+
};
|
|
27243
|
+
|
|
27244
|
+
MagicString.prototype.clone = function clone () {
|
|
27245
|
+
var cloned = new MagicString(this.original, { filename: this.filename });
|
|
27246
|
+
|
|
27247
|
+
var originalChunk = this.firstChunk;
|
|
27248
|
+
var clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
|
|
27249
|
+
|
|
27250
|
+
while (originalChunk) {
|
|
27251
|
+
cloned.byStart[clonedChunk.start] = clonedChunk;
|
|
27252
|
+
cloned.byEnd[clonedChunk.end] = clonedChunk;
|
|
27253
|
+
|
|
27254
|
+
var nextOriginalChunk = originalChunk.next;
|
|
27255
|
+
var nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
|
|
27256
|
+
|
|
27257
|
+
if (nextClonedChunk) {
|
|
27258
|
+
clonedChunk.next = nextClonedChunk;
|
|
27259
|
+
nextClonedChunk.previous = clonedChunk;
|
|
27260
|
+
|
|
27261
|
+
clonedChunk = nextClonedChunk;
|
|
27262
|
+
}
|
|
27263
|
+
|
|
27264
|
+
originalChunk = nextOriginalChunk;
|
|
27265
|
+
}
|
|
27266
|
+
|
|
27267
|
+
cloned.lastChunk = clonedChunk;
|
|
27268
|
+
|
|
27269
|
+
if (this.indentExclusionRanges) {
|
|
27270
|
+
cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
|
|
27271
|
+
}
|
|
27272
|
+
|
|
27273
|
+
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
|
|
27274
|
+
|
|
27275
|
+
cloned.intro = this.intro;
|
|
27276
|
+
cloned.outro = this.outro;
|
|
27277
|
+
|
|
27278
|
+
return cloned;
|
|
27279
|
+
};
|
|
27280
|
+
|
|
27281
|
+
MagicString.prototype.generateDecodedMap = function generateDecodedMap (options) {
|
|
27282
|
+
var this$1$1 = this;
|
|
27283
|
+
|
|
27284
|
+
options = options || {};
|
|
27285
|
+
|
|
27286
|
+
var sourceIndex = 0;
|
|
27287
|
+
var names = Object.keys(this.storedNames);
|
|
27288
|
+
var mappings = new Mappings(options.hires);
|
|
27289
|
+
|
|
27290
|
+
var locate = getLocator(this.original);
|
|
27291
|
+
|
|
27292
|
+
if (this.intro) {
|
|
27293
|
+
mappings.advance(this.intro);
|
|
27294
|
+
}
|
|
27295
|
+
|
|
27296
|
+
this.firstChunk.eachNext(function (chunk) {
|
|
27297
|
+
var loc = locate(chunk.start);
|
|
27298
|
+
|
|
27299
|
+
if (chunk.intro.length) { mappings.advance(chunk.intro); }
|
|
27300
|
+
|
|
27301
|
+
if (chunk.edited) {
|
|
27302
|
+
mappings.addEdit(
|
|
27303
|
+
sourceIndex,
|
|
27304
|
+
chunk.content,
|
|
27305
|
+
loc,
|
|
27306
|
+
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
27307
|
+
);
|
|
27308
|
+
} else {
|
|
27309
|
+
mappings.addUneditedChunk(sourceIndex, chunk, this$1$1.original, loc, this$1$1.sourcemapLocations);
|
|
27310
|
+
}
|
|
27311
|
+
|
|
27312
|
+
if (chunk.outro.length) { mappings.advance(chunk.outro); }
|
|
27313
|
+
});
|
|
27314
|
+
|
|
27315
|
+
return {
|
|
27316
|
+
file: options.file ? options.file.split(/[/\\]/).pop() : null,
|
|
27317
|
+
sources: [options.source ? getRelativePath(options.file || '', options.source) : null],
|
|
27318
|
+
sourcesContent: options.includeContent ? [this.original] : [null],
|
|
27319
|
+
names: names,
|
|
27320
|
+
mappings: mappings.raw
|
|
27321
|
+
};
|
|
27322
|
+
};
|
|
27323
|
+
|
|
27324
|
+
MagicString.prototype.generateMap = function generateMap (options) {
|
|
27325
|
+
return new SourceMap(this.generateDecodedMap(options));
|
|
27326
|
+
};
|
|
27327
|
+
|
|
27328
|
+
MagicString.prototype.getIndentString = function getIndentString () {
|
|
27329
|
+
return this.indentStr === null ? '\t' : this.indentStr;
|
|
27330
|
+
};
|
|
27331
|
+
|
|
27332
|
+
MagicString.prototype.indent = function indent (indentStr, options) {
|
|
27333
|
+
var pattern = /^[^\r\n]/gm;
|
|
27334
|
+
|
|
27335
|
+
if (isObject(indentStr)) {
|
|
27336
|
+
options = indentStr;
|
|
27337
|
+
indentStr = undefined;
|
|
27338
|
+
}
|
|
27339
|
+
|
|
27340
|
+
indentStr = indentStr !== undefined ? indentStr : this.indentStr || '\t';
|
|
27341
|
+
|
|
27342
|
+
if (indentStr === '') { return this; } // noop
|
|
27343
|
+
|
|
27344
|
+
options = options || {};
|
|
27345
|
+
|
|
27346
|
+
// Process exclusion ranges
|
|
27347
|
+
var isExcluded = {};
|
|
27348
|
+
|
|
27349
|
+
if (options.exclude) {
|
|
27350
|
+
var exclusions =
|
|
27351
|
+
typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
|
|
27352
|
+
exclusions.forEach(function (exclusion) {
|
|
27353
|
+
for (var i = exclusion[0]; i < exclusion[1]; i += 1) {
|
|
27354
|
+
isExcluded[i] = true;
|
|
27355
|
+
}
|
|
27356
|
+
});
|
|
27357
|
+
}
|
|
27358
|
+
|
|
27359
|
+
var shouldIndentNextCharacter = options.indentStart !== false;
|
|
27360
|
+
var replacer = function (match) {
|
|
27361
|
+
if (shouldIndentNextCharacter) { return ("" + indentStr + match); }
|
|
27362
|
+
shouldIndentNextCharacter = true;
|
|
27363
|
+
return match;
|
|
27364
|
+
};
|
|
27365
|
+
|
|
27366
|
+
this.intro = this.intro.replace(pattern, replacer);
|
|
27367
|
+
|
|
27368
|
+
var charIndex = 0;
|
|
27369
|
+
var chunk = this.firstChunk;
|
|
27370
|
+
|
|
27371
|
+
while (chunk) {
|
|
27372
|
+
var end = chunk.end;
|
|
27373
|
+
|
|
27374
|
+
if (chunk.edited) {
|
|
27375
|
+
if (!isExcluded[charIndex]) {
|
|
27376
|
+
chunk.content = chunk.content.replace(pattern, replacer);
|
|
27377
|
+
|
|
27378
|
+
if (chunk.content.length) {
|
|
27379
|
+
shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
|
|
27380
|
+
}
|
|
27381
|
+
}
|
|
27382
|
+
} else {
|
|
27383
|
+
charIndex = chunk.start;
|
|
27384
|
+
|
|
27385
|
+
while (charIndex < end) {
|
|
27386
|
+
if (!isExcluded[charIndex]) {
|
|
27387
|
+
var char = this.original[charIndex];
|
|
27388
|
+
|
|
27389
|
+
if (char === '\n') {
|
|
27390
|
+
shouldIndentNextCharacter = true;
|
|
27391
|
+
} else if (char !== '\r' && shouldIndentNextCharacter) {
|
|
27392
|
+
shouldIndentNextCharacter = false;
|
|
27393
|
+
|
|
27394
|
+
if (charIndex === chunk.start) {
|
|
27395
|
+
chunk.prependRight(indentStr);
|
|
27396
|
+
} else {
|
|
27397
|
+
this._splitChunk(chunk, charIndex);
|
|
27398
|
+
chunk = chunk.next;
|
|
27399
|
+
chunk.prependRight(indentStr);
|
|
27400
|
+
}
|
|
27401
|
+
}
|
|
27402
|
+
}
|
|
27403
|
+
|
|
27404
|
+
charIndex += 1;
|
|
27405
|
+
}
|
|
27406
|
+
}
|
|
27407
|
+
|
|
27408
|
+
charIndex = chunk.end;
|
|
27409
|
+
chunk = chunk.next;
|
|
27410
|
+
}
|
|
27411
|
+
|
|
27412
|
+
this.outro = this.outro.replace(pattern, replacer);
|
|
27413
|
+
|
|
27414
|
+
return this;
|
|
27415
|
+
};
|
|
27416
|
+
|
|
27417
|
+
MagicString.prototype.insert = function insert () {
|
|
27418
|
+
throw new Error('magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)');
|
|
27419
|
+
};
|
|
27420
|
+
|
|
27421
|
+
MagicString.prototype.insertLeft = function insertLeft (index, content) {
|
|
27422
|
+
if (!warned.insertLeft) {
|
|
27423
|
+
console.warn('magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'); // eslint-disable-line no-console
|
|
27424
|
+
warned.insertLeft = true;
|
|
27425
|
+
}
|
|
27426
|
+
|
|
27427
|
+
return this.appendLeft(index, content);
|
|
27428
|
+
};
|
|
27429
|
+
|
|
27430
|
+
MagicString.prototype.insertRight = function insertRight (index, content) {
|
|
27431
|
+
if (!warned.insertRight) {
|
|
27432
|
+
console.warn('magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'); // eslint-disable-line no-console
|
|
27433
|
+
warned.insertRight = true;
|
|
27434
|
+
}
|
|
27435
|
+
|
|
27436
|
+
return this.prependRight(index, content);
|
|
27437
|
+
};
|
|
27438
|
+
|
|
27439
|
+
MagicString.prototype.move = function move (start, end, index) {
|
|
27440
|
+
if (index >= start && index <= end) { throw new Error('Cannot move a selection inside itself'); }
|
|
27441
|
+
|
|
27442
|
+
this._split(start);
|
|
27443
|
+
this._split(end);
|
|
27444
|
+
this._split(index);
|
|
27445
|
+
|
|
27446
|
+
var first = this.byStart[start];
|
|
27447
|
+
var last = this.byEnd[end];
|
|
27448
|
+
|
|
27449
|
+
var oldLeft = first.previous;
|
|
27450
|
+
var oldRight = last.next;
|
|
27451
|
+
|
|
27452
|
+
var newRight = this.byStart[index];
|
|
27453
|
+
if (!newRight && last === this.lastChunk) { return this; }
|
|
27454
|
+
var newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
27455
|
+
|
|
27456
|
+
if (oldLeft) { oldLeft.next = oldRight; }
|
|
27457
|
+
if (oldRight) { oldRight.previous = oldLeft; }
|
|
27458
|
+
|
|
27459
|
+
if (newLeft) { newLeft.next = first; }
|
|
27460
|
+
if (newRight) { newRight.previous = last; }
|
|
27461
|
+
|
|
27462
|
+
if (!first.previous) { this.firstChunk = last.next; }
|
|
27463
|
+
if (!last.next) {
|
|
27464
|
+
this.lastChunk = first.previous;
|
|
27465
|
+
this.lastChunk.next = null;
|
|
27466
|
+
}
|
|
27467
|
+
|
|
27468
|
+
first.previous = newLeft;
|
|
27469
|
+
last.next = newRight || null;
|
|
27470
|
+
|
|
27471
|
+
if (!newLeft) { this.firstChunk = first; }
|
|
27472
|
+
if (!newRight) { this.lastChunk = last; }
|
|
27473
|
+
return this;
|
|
27474
|
+
};
|
|
27475
|
+
|
|
27476
|
+
MagicString.prototype.overwrite = function overwrite (start, end, content, options) {
|
|
27477
|
+
if (typeof content !== 'string') { throw new TypeError('replacement content must be a string'); }
|
|
27478
|
+
|
|
27479
|
+
while (start < 0) { start += this.original.length; }
|
|
27480
|
+
while (end < 0) { end += this.original.length; }
|
|
27481
|
+
|
|
27482
|
+
if (end > this.original.length) { throw new Error('end is out of bounds'); }
|
|
27483
|
+
if (start === end)
|
|
27484
|
+
{ throw new Error('Cannot overwrite a zero-length range – use appendLeft or prependRight instead'); }
|
|
27485
|
+
|
|
27486
|
+
this._split(start);
|
|
27487
|
+
this._split(end);
|
|
27488
|
+
|
|
27489
|
+
if (options === true) {
|
|
27490
|
+
if (!warned.storeName) {
|
|
27491
|
+
console.warn('The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'); // eslint-disable-line no-console
|
|
27492
|
+
warned.storeName = true;
|
|
27493
|
+
}
|
|
27494
|
+
|
|
27495
|
+
options = { storeName: true };
|
|
27496
|
+
}
|
|
27497
|
+
var storeName = options !== undefined ? options.storeName : false;
|
|
27498
|
+
var contentOnly = options !== undefined ? options.contentOnly : false;
|
|
27499
|
+
|
|
27500
|
+
if (storeName) {
|
|
27501
|
+
var original = this.original.slice(start, end);
|
|
27502
|
+
this.storedNames[original] = true;
|
|
27503
|
+
}
|
|
27504
|
+
|
|
27505
|
+
var first = this.byStart[start];
|
|
27506
|
+
var last = this.byEnd[end];
|
|
27507
|
+
|
|
27508
|
+
if (first) {
|
|
27509
|
+
if (end > first.end && first.next !== this.byStart[first.end]) {
|
|
27510
|
+
throw new Error('Cannot overwrite across a split point');
|
|
27511
|
+
}
|
|
27512
|
+
|
|
27513
|
+
first.edit(content, storeName, contentOnly);
|
|
27514
|
+
|
|
27515
|
+
if (first !== last) {
|
|
27516
|
+
var chunk = first.next;
|
|
27517
|
+
while (chunk !== last) {
|
|
27518
|
+
chunk.edit('', false);
|
|
27519
|
+
chunk = chunk.next;
|
|
27520
|
+
}
|
|
27521
|
+
|
|
27522
|
+
chunk.edit('', false);
|
|
27523
|
+
}
|
|
27524
|
+
} else {
|
|
27525
|
+
// must be inserting at the end
|
|
27526
|
+
var newChunk = new Chunk(start, end, '').edit(content, storeName);
|
|
27527
|
+
|
|
27528
|
+
// TODO last chunk in the array may not be the last chunk, if it's moved...
|
|
27529
|
+
last.next = newChunk;
|
|
27530
|
+
newChunk.previous = last;
|
|
27531
|
+
}
|
|
27532
|
+
return this;
|
|
27533
|
+
};
|
|
27534
|
+
|
|
27535
|
+
MagicString.prototype.prepend = function prepend (content) {
|
|
27536
|
+
if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
|
|
27537
|
+
|
|
27538
|
+
this.intro = content + this.intro;
|
|
27539
|
+
return this;
|
|
27540
|
+
};
|
|
27541
|
+
|
|
27542
|
+
MagicString.prototype.prependLeft = function prependLeft (index, content) {
|
|
27543
|
+
if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
|
|
27544
|
+
|
|
27545
|
+
this._split(index);
|
|
27546
|
+
|
|
27547
|
+
var chunk = this.byEnd[index];
|
|
27548
|
+
|
|
27549
|
+
if (chunk) {
|
|
27550
|
+
chunk.prependLeft(content);
|
|
27551
|
+
} else {
|
|
27552
|
+
this.intro = content + this.intro;
|
|
27553
|
+
}
|
|
27554
|
+
return this;
|
|
27555
|
+
};
|
|
27556
|
+
|
|
27557
|
+
MagicString.prototype.prependRight = function prependRight (index, content) {
|
|
27558
|
+
if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
|
|
27559
|
+
|
|
27560
|
+
this._split(index);
|
|
27561
|
+
|
|
27562
|
+
var chunk = this.byStart[index];
|
|
27563
|
+
|
|
27564
|
+
if (chunk) {
|
|
27565
|
+
chunk.prependRight(content);
|
|
27566
|
+
} else {
|
|
27567
|
+
this.outro = content + this.outro;
|
|
27568
|
+
}
|
|
27569
|
+
return this;
|
|
27570
|
+
};
|
|
26460
27571
|
|
|
26461
|
-
|
|
27572
|
+
MagicString.prototype.remove = function remove (start, end) {
|
|
27573
|
+
while (start < 0) { start += this.original.length; }
|
|
27574
|
+
while (end < 0) { end += this.original.length; }
|
|
26462
27575
|
|
|
26463
|
-
|
|
26464
|
-
this.matches[index] = Object.create(null);
|
|
27576
|
+
if (start === end) { return this; }
|
|
26465
27577
|
|
|
26466
|
-
|
|
26467
|
-
|
|
26468
|
-
return cb()
|
|
27578
|
+
if (start < 0 || end > this.original.length) { throw new Error('Character is out of bounds'); }
|
|
27579
|
+
if (start > end) { throw new Error('end must be greater than start'); }
|
|
26469
27580
|
|
|
26470
|
-
|
|
26471
|
-
|
|
26472
|
-
if (prefix.charAt(0) === '/') {
|
|
26473
|
-
prefix = path$a.join(this.root, prefix);
|
|
26474
|
-
} else {
|
|
26475
|
-
prefix = path$a.resolve(this.root, prefix);
|
|
26476
|
-
if (trail)
|
|
26477
|
-
prefix += '/';
|
|
26478
|
-
}
|
|
26479
|
-
}
|
|
27581
|
+
this._split(start);
|
|
27582
|
+
this._split(end);
|
|
26480
27583
|
|
|
26481
|
-
|
|
26482
|
-
prefix = prefix.replace(/\\/g, '/');
|
|
27584
|
+
var chunk = this.byStart[start];
|
|
26483
27585
|
|
|
26484
|
-
|
|
26485
|
-
|
|
26486
|
-
|
|
27586
|
+
while (chunk) {
|
|
27587
|
+
chunk.intro = '';
|
|
27588
|
+
chunk.outro = '';
|
|
27589
|
+
chunk.edit('');
|
|
27590
|
+
|
|
27591
|
+
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
27592
|
+
}
|
|
27593
|
+
return this;
|
|
26487
27594
|
};
|
|
26488
27595
|
|
|
26489
|
-
|
|
26490
|
-
|
|
26491
|
-
|
|
26492
|
-
|
|
27596
|
+
MagicString.prototype.lastChar = function lastChar () {
|
|
27597
|
+
if (this.outro.length)
|
|
27598
|
+
{ return this.outro[this.outro.length - 1]; }
|
|
27599
|
+
var chunk = this.lastChunk;
|
|
27600
|
+
do {
|
|
27601
|
+
if (chunk.outro.length)
|
|
27602
|
+
{ return chunk.outro[chunk.outro.length - 1]; }
|
|
27603
|
+
if (chunk.content.length)
|
|
27604
|
+
{ return chunk.content[chunk.content.length - 1]; }
|
|
27605
|
+
if (chunk.intro.length)
|
|
27606
|
+
{ return chunk.intro[chunk.intro.length - 1]; }
|
|
27607
|
+
} while (chunk = chunk.previous);
|
|
27608
|
+
if (this.intro.length)
|
|
27609
|
+
{ return this.intro[this.intro.length - 1]; }
|
|
27610
|
+
return '';
|
|
27611
|
+
};
|
|
26493
27612
|
|
|
26494
|
-
|
|
26495
|
-
|
|
27613
|
+
MagicString.prototype.lastLine = function lastLine () {
|
|
27614
|
+
var lineIndex = this.outro.lastIndexOf(n);
|
|
27615
|
+
if (lineIndex !== -1)
|
|
27616
|
+
{ return this.outro.substr(lineIndex + 1); }
|
|
27617
|
+
var lineStr = this.outro;
|
|
27618
|
+
var chunk = this.lastChunk;
|
|
27619
|
+
do {
|
|
27620
|
+
if (chunk.outro.length > 0) {
|
|
27621
|
+
lineIndex = chunk.outro.lastIndexOf(n);
|
|
27622
|
+
if (lineIndex !== -1)
|
|
27623
|
+
{ return chunk.outro.substr(lineIndex + 1) + lineStr; }
|
|
27624
|
+
lineStr = chunk.outro + lineStr;
|
|
27625
|
+
}
|
|
26496
27626
|
|
|
26497
|
-
|
|
26498
|
-
|
|
27627
|
+
if (chunk.content.length > 0) {
|
|
27628
|
+
lineIndex = chunk.content.lastIndexOf(n);
|
|
27629
|
+
if (lineIndex !== -1)
|
|
27630
|
+
{ return chunk.content.substr(lineIndex + 1) + lineStr; }
|
|
27631
|
+
lineStr = chunk.content + lineStr;
|
|
27632
|
+
}
|
|
26499
27633
|
|
|
26500
|
-
|
|
26501
|
-
|
|
27634
|
+
if (chunk.intro.length > 0) {
|
|
27635
|
+
lineIndex = chunk.intro.lastIndexOf(n);
|
|
27636
|
+
if (lineIndex !== -1)
|
|
27637
|
+
{ return chunk.intro.substr(lineIndex + 1) + lineStr; }
|
|
27638
|
+
lineStr = chunk.intro + lineStr;
|
|
27639
|
+
}
|
|
27640
|
+
} while (chunk = chunk.previous);
|
|
27641
|
+
lineIndex = this.intro.lastIndexOf(n);
|
|
27642
|
+
if (lineIndex !== -1)
|
|
27643
|
+
{ return this.intro.substr(lineIndex + 1) + lineStr; }
|
|
27644
|
+
return this.intro + lineStr;
|
|
27645
|
+
};
|
|
26502
27646
|
|
|
26503
|
-
|
|
26504
|
-
|
|
26505
|
-
|
|
27647
|
+
MagicString.prototype.slice = function slice (start, end) {
|
|
27648
|
+
if ( start === void 0 ) start = 0;
|
|
27649
|
+
if ( end === void 0 ) end = this.original.length;
|
|
26506
27650
|
|
|
26507
|
-
|
|
26508
|
-
|
|
27651
|
+
while (start < 0) { start += this.original.length; }
|
|
27652
|
+
while (end < 0) { end += this.original.length; }
|
|
26509
27653
|
|
|
26510
|
-
|
|
26511
|
-
// if we know it exists, but not what it is.
|
|
26512
|
-
}
|
|
26513
|
-
var stat = this.statCache[abs];
|
|
26514
|
-
if (stat !== undefined) {
|
|
26515
|
-
if (stat === false)
|
|
26516
|
-
return cb(null, stat)
|
|
26517
|
-
else {
|
|
26518
|
-
var type = stat.isDirectory() ? 'DIR' : 'FILE';
|
|
26519
|
-
if (needDir && type === 'FILE')
|
|
26520
|
-
return cb()
|
|
26521
|
-
else
|
|
26522
|
-
return cb(null, type, stat)
|
|
26523
|
-
}
|
|
26524
|
-
}
|
|
27654
|
+
var result = '';
|
|
26525
27655
|
|
|
26526
|
-
|
|
26527
|
-
|
|
26528
|
-
|
|
26529
|
-
|
|
27656
|
+
// find start chunk
|
|
27657
|
+
var chunk = this.firstChunk;
|
|
27658
|
+
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
27659
|
+
// found end chunk before start
|
|
27660
|
+
if (chunk.start < end && chunk.end >= end) {
|
|
27661
|
+
return result;
|
|
27662
|
+
}
|
|
26530
27663
|
|
|
26531
|
-
|
|
26532
|
-
|
|
26533
|
-
// If it's a symlink, then treat it as the target, unless
|
|
26534
|
-
// the target does not exist, then treat it as a file.
|
|
26535
|
-
return self.fs.stat(abs, function (er, stat) {
|
|
26536
|
-
if (er)
|
|
26537
|
-
self._stat2(f, abs, null, lstat, cb);
|
|
26538
|
-
else
|
|
26539
|
-
self._stat2(f, abs, er, stat, cb);
|
|
26540
|
-
})
|
|
26541
|
-
} else {
|
|
26542
|
-
self._stat2(f, abs, er, lstat, cb);
|
|
26543
|
-
}
|
|
26544
|
-
}
|
|
26545
|
-
};
|
|
27664
|
+
chunk = chunk.next;
|
|
27665
|
+
}
|
|
26546
27666
|
|
|
26547
|
-
|
|
26548
|
-
|
|
26549
|
-
this.statCache[abs] = false;
|
|
26550
|
-
return cb()
|
|
26551
|
-
}
|
|
27667
|
+
if (chunk && chunk.edited && chunk.start !== start)
|
|
27668
|
+
{ throw new Error(("Cannot use replaced character " + start + " as slice start anchor.")); }
|
|
26552
27669
|
|
|
26553
|
-
|
|
26554
|
-
|
|
27670
|
+
var startChunk = chunk;
|
|
27671
|
+
while (chunk) {
|
|
27672
|
+
if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
|
|
27673
|
+
result += chunk.intro;
|
|
27674
|
+
}
|
|
26555
27675
|
|
|
26556
|
-
|
|
26557
|
-
|
|
27676
|
+
var containsEnd = chunk.start < end && chunk.end >= end;
|
|
27677
|
+
if (containsEnd && chunk.edited && chunk.end !== end)
|
|
27678
|
+
{ throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); }
|
|
26558
27679
|
|
|
26559
|
-
|
|
26560
|
-
|
|
26561
|
-
c = stat.isDirectory() ? 'DIR' : 'FILE';
|
|
26562
|
-
this.cache[abs] = this.cache[abs] || c;
|
|
27680
|
+
var sliceStart = startChunk === chunk ? start - chunk.start : 0;
|
|
27681
|
+
var sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
|
|
26563
27682
|
|
|
26564
|
-
|
|
26565
|
-
return cb()
|
|
27683
|
+
result += chunk.content.slice(sliceStart, sliceEnd);
|
|
26566
27684
|
|
|
26567
|
-
|
|
26568
|
-
|
|
27685
|
+
if (chunk.outro && (!containsEnd || chunk.end === end)) {
|
|
27686
|
+
result += chunk.outro;
|
|
27687
|
+
}
|
|
26569
27688
|
|
|
26570
|
-
|
|
26571
|
-
|
|
27689
|
+
if (containsEnd) {
|
|
27690
|
+
break;
|
|
27691
|
+
}
|
|
26572
27692
|
|
|
26573
|
-
|
|
26574
|
-
|
|
26575
|
-
remove: () => void;
|
|
26576
|
-
replace: (node: BaseNode) => void;
|
|
26577
|
-
}} WalkerContext */
|
|
27693
|
+
chunk = chunk.next;
|
|
27694
|
+
}
|
|
26578
27695
|
|
|
26579
|
-
|
|
26580
|
-
|
|
26581
|
-
/** @type {boolean} */
|
|
26582
|
-
this.should_skip = false;
|
|
27696
|
+
return result;
|
|
27697
|
+
};
|
|
26583
27698
|
|
|
26584
|
-
|
|
26585
|
-
|
|
27699
|
+
// TODO deprecate this? not really very useful
|
|
27700
|
+
MagicString.prototype.snip = function snip (start, end) {
|
|
27701
|
+
var clone = this.clone();
|
|
27702
|
+
clone.remove(0, start);
|
|
27703
|
+
clone.remove(end, clone.original.length);
|
|
26586
27704
|
|
|
26587
|
-
|
|
26588
|
-
|
|
27705
|
+
return clone;
|
|
27706
|
+
};
|
|
26589
27707
|
|
|
26590
|
-
|
|
26591
|
-
|
|
26592
|
-
skip: () => (this.should_skip = true),
|
|
26593
|
-
remove: () => (this.should_remove = true),
|
|
26594
|
-
replace: (node) => (this.replacement = node)
|
|
26595
|
-
};
|
|
26596
|
-
}
|
|
27708
|
+
MagicString.prototype._split = function _split (index) {
|
|
27709
|
+
if (this.byStart[index] || this.byEnd[index]) { return; }
|
|
26597
27710
|
|
|
26598
|
-
|
|
26599
|
-
|
|
26600
|
-
|
|
26601
|
-
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
26605
|
-
replace(parent, prop, index, node) {
|
|
26606
|
-
if (parent) {
|
|
26607
|
-
if (index !== null) {
|
|
26608
|
-
parent[prop][index] = node;
|
|
26609
|
-
} else {
|
|
26610
|
-
parent[prop] = node;
|
|
26611
|
-
}
|
|
26612
|
-
}
|
|
27711
|
+
var chunk = this.lastSearchedChunk;
|
|
27712
|
+
var searchForward = index > chunk.end;
|
|
27713
|
+
|
|
27714
|
+
while (chunk) {
|
|
27715
|
+
if (chunk.contains(index)) { return this._splitChunk(chunk, index); }
|
|
27716
|
+
|
|
27717
|
+
chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
|
|
26613
27718
|
}
|
|
27719
|
+
};
|
|
26614
27720
|
|
|
26615
|
-
|
|
26616
|
-
|
|
26617
|
-
|
|
26618
|
-
|
|
26619
|
-
|
|
26620
|
-
|
|
26621
|
-
|
|
26622
|
-
if (parent) {
|
|
26623
|
-
if (index !== null) {
|
|
26624
|
-
parent[prop].splice(index, 1);
|
|
26625
|
-
} else {
|
|
26626
|
-
delete parent[prop];
|
|
26627
|
-
}
|
|
26628
|
-
}
|
|
27721
|
+
MagicString.prototype._splitChunk = function _splitChunk (chunk, index) {
|
|
27722
|
+
if (chunk.edited && chunk.content.length) {
|
|
27723
|
+
// zero-length edited chunks are a special case (overlapping replacements)
|
|
27724
|
+
var loc = getLocator(this.original)(index);
|
|
27725
|
+
throw new Error(
|
|
27726
|
+
("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")")
|
|
27727
|
+
);
|
|
26629
27728
|
}
|
|
26630
|
-
}
|
|
26631
27729
|
|
|
26632
|
-
|
|
27730
|
+
var newChunk = chunk.split(index);
|
|
26633
27731
|
|
|
26634
|
-
|
|
26635
|
-
|
|
27732
|
+
this.byEnd[index] = chunk;
|
|
27733
|
+
this.byStart[index] = newChunk;
|
|
27734
|
+
this.byEnd[newChunk.end] = newChunk;
|
|
26636
27735
|
|
|
26637
|
-
|
|
26638
|
-
* this: WalkerContext,
|
|
26639
|
-
* node: BaseNode,
|
|
26640
|
-
* parent: BaseNode,
|
|
26641
|
-
* key: string,
|
|
26642
|
-
* index: number
|
|
26643
|
-
* ) => void} SyncHandler */
|
|
27736
|
+
if (chunk === this.lastChunk) { this.lastChunk = newChunk; }
|
|
26644
27737
|
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
* @param {SyncHandler} enter
|
|
26649
|
-
* @param {SyncHandler} leave
|
|
26650
|
-
*/
|
|
26651
|
-
constructor(enter, leave) {
|
|
26652
|
-
super();
|
|
27738
|
+
this.lastSearchedChunk = chunk;
|
|
27739
|
+
return true;
|
|
27740
|
+
};
|
|
26653
27741
|
|
|
26654
|
-
|
|
26655
|
-
|
|
27742
|
+
MagicString.prototype.toString = function toString () {
|
|
27743
|
+
var str = this.intro;
|
|
26656
27744
|
|
|
26657
|
-
|
|
26658
|
-
|
|
27745
|
+
var chunk = this.firstChunk;
|
|
27746
|
+
while (chunk) {
|
|
27747
|
+
str += chunk.toString();
|
|
27748
|
+
chunk = chunk.next;
|
|
26659
27749
|
}
|
|
26660
27750
|
|
|
26661
|
-
|
|
26662
|
-
|
|
26663
|
-
* @param {BaseNode} node
|
|
26664
|
-
* @param {BaseNode} parent
|
|
26665
|
-
* @param {string} [prop]
|
|
26666
|
-
* @param {number} [index]
|
|
26667
|
-
* @returns {BaseNode}
|
|
26668
|
-
*/
|
|
26669
|
-
visit(node, parent, prop, index) {
|
|
26670
|
-
if (node) {
|
|
26671
|
-
if (this.enter) {
|
|
26672
|
-
const _should_skip = this.should_skip;
|
|
26673
|
-
const _should_remove = this.should_remove;
|
|
26674
|
-
const _replacement = this.replacement;
|
|
26675
|
-
this.should_skip = false;
|
|
26676
|
-
this.should_remove = false;
|
|
26677
|
-
this.replacement = null;
|
|
27751
|
+
return str + this.outro;
|
|
27752
|
+
};
|
|
26678
27753
|
|
|
26679
|
-
|
|
27754
|
+
MagicString.prototype.isEmpty = function isEmpty () {
|
|
27755
|
+
var chunk = this.firstChunk;
|
|
27756
|
+
do {
|
|
27757
|
+
if (chunk.intro.length && chunk.intro.trim() ||
|
|
27758
|
+
chunk.content.length && chunk.content.trim() ||
|
|
27759
|
+
chunk.outro.length && chunk.outro.trim())
|
|
27760
|
+
{ return false; }
|
|
27761
|
+
} while (chunk = chunk.next);
|
|
27762
|
+
return true;
|
|
27763
|
+
};
|
|
26680
27764
|
|
|
26681
|
-
|
|
26682
|
-
|
|
26683
|
-
|
|
26684
|
-
|
|
27765
|
+
MagicString.prototype.length = function length () {
|
|
27766
|
+
var chunk = this.firstChunk;
|
|
27767
|
+
var length = 0;
|
|
27768
|
+
do {
|
|
27769
|
+
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
|
|
27770
|
+
} while (chunk = chunk.next);
|
|
27771
|
+
return length;
|
|
27772
|
+
};
|
|
26685
27773
|
|
|
26686
|
-
|
|
26687
|
-
|
|
26688
|
-
|
|
27774
|
+
MagicString.prototype.trimLines = function trimLines () {
|
|
27775
|
+
return this.trim('[\\r\\n]');
|
|
27776
|
+
};
|
|
26689
27777
|
|
|
26690
|
-
|
|
26691
|
-
|
|
27778
|
+
MagicString.prototype.trim = function trim (charType) {
|
|
27779
|
+
return this.trimStart(charType).trimEnd(charType);
|
|
27780
|
+
};
|
|
26692
27781
|
|
|
26693
|
-
|
|
26694
|
-
|
|
26695
|
-
this.replacement = _replacement;
|
|
27782
|
+
MagicString.prototype.trimEndAborted = function trimEndAborted (charType) {
|
|
27783
|
+
var rx = new RegExp((charType || '\\s') + '+$');
|
|
26696
27784
|
|
|
26697
|
-
|
|
26698
|
-
|
|
26699
|
-
}
|
|
27785
|
+
this.outro = this.outro.replace(rx, '');
|
|
27786
|
+
if (this.outro.length) { return true; }
|
|
26700
27787
|
|
|
26701
|
-
|
|
26702
|
-
const value = node[key];
|
|
27788
|
+
var chunk = this.lastChunk;
|
|
26703
27789
|
|
|
26704
|
-
|
|
26705
|
-
|
|
26706
|
-
|
|
26707
|
-
|
|
26708
|
-
|
|
26709
|
-
|
|
26710
|
-
|
|
26711
|
-
|
|
26712
|
-
}
|
|
26713
|
-
}
|
|
26714
|
-
}
|
|
26715
|
-
} else if (value !== null && typeof value.type === "string") {
|
|
26716
|
-
this.visit(value, node, key, null);
|
|
26717
|
-
}
|
|
27790
|
+
do {
|
|
27791
|
+
var end = chunk.end;
|
|
27792
|
+
var aborted = chunk.trimEnd(rx);
|
|
27793
|
+
|
|
27794
|
+
// if chunk was trimmed, we have a new lastChunk
|
|
27795
|
+
if (chunk.end !== end) {
|
|
27796
|
+
if (this.lastChunk === chunk) {
|
|
27797
|
+
this.lastChunk = chunk.next;
|
|
26718
27798
|
}
|
|
26719
27799
|
|
|
26720
|
-
|
|
26721
|
-
|
|
26722
|
-
|
|
26723
|
-
|
|
26724
|
-
this.should_remove = false;
|
|
27800
|
+
this.byEnd[chunk.end] = chunk;
|
|
27801
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
27802
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
27803
|
+
}
|
|
26725
27804
|
|
|
26726
|
-
|
|
27805
|
+
if (aborted) { return true; }
|
|
27806
|
+
chunk = chunk.previous;
|
|
27807
|
+
} while (chunk);
|
|
26727
27808
|
|
|
26728
|
-
|
|
26729
|
-
|
|
26730
|
-
this.replace(parent, prop, index, node);
|
|
26731
|
-
}
|
|
27809
|
+
return false;
|
|
27810
|
+
};
|
|
26732
27811
|
|
|
26733
|
-
|
|
26734
|
-
|
|
26735
|
-
|
|
27812
|
+
MagicString.prototype.trimEnd = function trimEnd (charType) {
|
|
27813
|
+
this.trimEndAborted(charType);
|
|
27814
|
+
return this;
|
|
27815
|
+
};
|
|
27816
|
+
MagicString.prototype.trimStartAborted = function trimStartAborted (charType) {
|
|
27817
|
+
var rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
26736
27818
|
|
|
26737
|
-
|
|
27819
|
+
this.intro = this.intro.replace(rx, '');
|
|
27820
|
+
if (this.intro.length) { return true; }
|
|
26738
27821
|
|
|
26739
|
-
|
|
26740
|
-
this.should_remove = _should_remove;
|
|
27822
|
+
var chunk = this.firstChunk;
|
|
26741
27823
|
|
|
26742
|
-
|
|
26743
|
-
|
|
26744
|
-
|
|
27824
|
+
do {
|
|
27825
|
+
var end = chunk.end;
|
|
27826
|
+
var aborted = chunk.trimStart(rx);
|
|
26745
27827
|
|
|
26746
|
-
|
|
26747
|
-
|
|
26748
|
-
}
|
|
27828
|
+
if (chunk.end !== end) {
|
|
27829
|
+
// special case...
|
|
27830
|
+
if (chunk === this.lastChunk) { this.lastChunk = chunk.next; }
|
|
26749
27831
|
|
|
26750
|
-
|
|
27832
|
+
this.byEnd[chunk.end] = chunk;
|
|
27833
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
27834
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
27835
|
+
}
|
|
26751
27836
|
|
|
26752
|
-
|
|
26753
|
-
|
|
26754
|
-
|
|
27837
|
+
if (aborted) { return true; }
|
|
27838
|
+
chunk = chunk.next;
|
|
27839
|
+
} while (chunk);
|
|
26755
27840
|
|
|
26756
|
-
|
|
26757
|
-
|
|
26758
|
-
|
|
26759
|
-
|
|
26760
|
-
|
|
26761
|
-
|
|
26762
|
-
|
|
26763
|
-
* @returns {BaseNode}
|
|
26764
|
-
*/
|
|
26765
|
-
function walk$1(ast, { enter, leave }) {
|
|
26766
|
-
const instance = new SyncWalker(enter, leave);
|
|
26767
|
-
return instance.visit(ast, null);
|
|
26768
|
-
}
|
|
27841
|
+
return false;
|
|
27842
|
+
};
|
|
27843
|
+
|
|
27844
|
+
MagicString.prototype.trimStart = function trimStart (charType) {
|
|
27845
|
+
this.trimStartAborted(charType);
|
|
27846
|
+
return this;
|
|
27847
|
+
};
|
|
26769
27848
|
|
|
26770
27849
|
function isReference(node, parent) {
|
|
26771
27850
|
if (node.type === 'MemberExpression') {
|
|
@@ -26941,7 +28020,7 @@ export function commonjsRegister (path, loader) {
|
|
|
26941
28020
|
}
|
|
26942
28021
|
|
|
26943
28022
|
export function commonjsRegisterOrShort (path, to) {
|
|
26944
|
-
|
|
28023
|
+
var resolvedPath = commonjsResolveImpl(path, null, true);
|
|
26945
28024
|
if (resolvedPath !== null && DYNAMIC_REQUIRE_CACHE[resolvedPath]) {
|
|
26946
28025
|
DYNAMIC_REQUIRE_CACHE[path] = DYNAMIC_REQUIRE_CACHE[resolvedPath];
|
|
26947
28026
|
} else {
|
|
@@ -26949,24 +28028,24 @@ export function commonjsRegisterOrShort (path, to) {
|
|
|
26949
28028
|
}
|
|
26950
28029
|
}
|
|
26951
28030
|
|
|
26952
|
-
|
|
26953
|
-
|
|
26954
|
-
|
|
26955
|
-
|
|
28031
|
+
var DYNAMIC_REQUIRE_LOADERS = Object.create(null);
|
|
28032
|
+
var DYNAMIC_REQUIRE_CACHE = Object.create(null);
|
|
28033
|
+
var DYNAMIC_REQUIRE_SHORTS = Object.create(null);
|
|
28034
|
+
var DEFAULT_PARENT_MODULE = {
|
|
26956
28035
|
id: '<' + 'rollup>', exports: {}, parent: undefined, filename: null, loaded: false, children: [], paths: []
|
|
26957
28036
|
};
|
|
26958
|
-
|
|
28037
|
+
var CHECKED_EXTENSIONS = ['', '.js', '.json'];
|
|
26959
28038
|
|
|
26960
28039
|
function normalize (path) {
|
|
26961
28040
|
path = path.replace(/\\\\/g, '/');
|
|
26962
|
-
|
|
26963
|
-
|
|
26964
|
-
for (
|
|
28041
|
+
var parts = path.split('/');
|
|
28042
|
+
var slashed = parts[0] === '';
|
|
28043
|
+
for (var i = 1; i < parts.length; i++) {
|
|
26965
28044
|
if (parts[i] === '.' || parts[i] === '') {
|
|
26966
28045
|
parts.splice(i--, 1);
|
|
26967
28046
|
}
|
|
26968
28047
|
}
|
|
26969
|
-
for (
|
|
28048
|
+
for (var i = 1; i < parts.length; i++) {
|
|
26970
28049
|
if (parts[i] !== '..') continue;
|
|
26971
28050
|
if (i > 0 && parts[i - 1] !== '..' && parts[i - 1] !== '.') {
|
|
26972
28051
|
parts.splice(--i, 2);
|
|
@@ -26984,9 +28063,9 @@ function normalize (path) {
|
|
|
26984
28063
|
function join () {
|
|
26985
28064
|
if (arguments.length === 0)
|
|
26986
28065
|
return '.';
|
|
26987
|
-
|
|
26988
|
-
for (
|
|
26989
|
-
|
|
28066
|
+
var joined;
|
|
28067
|
+
for (var i = 0; i < arguments.length; ++i) {
|
|
28068
|
+
var arg = arguments[i];
|
|
26990
28069
|
if (arg.length > 0) {
|
|
26991
28070
|
if (joined === undefined)
|
|
26992
28071
|
joined = arg;
|
|
@@ -27001,9 +28080,9 @@ function join () {
|
|
|
27001
28080
|
}
|
|
27002
28081
|
|
|
27003
28082
|
function isPossibleNodeModulesPath (modulePath) {
|
|
27004
|
-
|
|
28083
|
+
var c0 = modulePath[0];
|
|
27005
28084
|
if (c0 === '/' || c0 === '\\\\') return false;
|
|
27006
|
-
|
|
28085
|
+
var c1 = modulePath[1], c2 = modulePath[2];
|
|
27007
28086
|
if ((c0 === '.' && (!c1 || c1 === '/' || c1 === '\\\\')) ||
|
|
27008
28087
|
(c0 === '.' && c1 === '.' && (!c2 || c2 === '/' || c2 === '\\\\'))) return false;
|
|
27009
28088
|
if (c1 === ':' && (c2 === '/' || c2 === '\\\\'))
|
|
@@ -27015,9 +28094,9 @@ function dirname (path) {
|
|
|
27015
28094
|
if (path.length === 0)
|
|
27016
28095
|
return '.';
|
|
27017
28096
|
|
|
27018
|
-
|
|
28097
|
+
var i = path.length - 1;
|
|
27019
28098
|
while (i > 0) {
|
|
27020
|
-
|
|
28099
|
+
var c = path.charCodeAt(i);
|
|
27021
28100
|
if ((c === 47 || c === 92) && i !== path.length - 1)
|
|
27022
28101
|
break;
|
|
27023
28102
|
i--;
|
|
@@ -27033,9 +28112,9 @@ function dirname (path) {
|
|
|
27033
28112
|
}
|
|
27034
28113
|
|
|
27035
28114
|
export function commonjsResolveImpl (path, originalModuleDir, testCache) {
|
|
27036
|
-
|
|
28115
|
+
var shouldTryNodeModules = isPossibleNodeModulesPath(path);
|
|
27037
28116
|
path = normalize(path);
|
|
27038
|
-
|
|
28117
|
+
var relPath;
|
|
27039
28118
|
if (path[0] === '/') {
|
|
27040
28119
|
originalModuleDir = '/';
|
|
27041
28120
|
}
|
|
@@ -27052,8 +28131,8 @@ export function commonjsResolveImpl (path, originalModuleDir, testCache) {
|
|
|
27052
28131
|
break; // Travelled too far up, avoid infinite loop
|
|
27053
28132
|
}
|
|
27054
28133
|
|
|
27055
|
-
for (
|
|
27056
|
-
|
|
28134
|
+
for (var extensionIndex = 0; extensionIndex < CHECKED_EXTENSIONS.length; extensionIndex++) {
|
|
28135
|
+
var resolvedPath = relPath + CHECKED_EXTENSIONS[extensionIndex];
|
|
27057
28136
|
if (DYNAMIC_REQUIRE_CACHE[resolvedPath]) {
|
|
27058
28137
|
return resolvedPath;
|
|
27059
28138
|
}
|
|
@@ -27065,7 +28144,7 @@ export function commonjsResolveImpl (path, originalModuleDir, testCache) {
|
|
|
27065
28144
|
}
|
|
27066
28145
|
}
|
|
27067
28146
|
if (!shouldTryNodeModules) break;
|
|
27068
|
-
|
|
28147
|
+
var nextDir = normalize(originalModuleDir + '/..');
|
|
27069
28148
|
if (nextDir === originalModuleDir) break;
|
|
27070
28149
|
originalModuleDir = nextDir;
|
|
27071
28150
|
}
|
|
@@ -27073,7 +28152,7 @@ export function commonjsResolveImpl (path, originalModuleDir, testCache) {
|
|
|
27073
28152
|
}
|
|
27074
28153
|
|
|
27075
28154
|
export function commonjsResolve (path, originalModuleDir) {
|
|
27076
|
-
|
|
28155
|
+
var resolvedPath = commonjsResolveImpl(path, originalModuleDir);
|
|
27077
28156
|
if (resolvedPath !== null) {
|
|
27078
28157
|
return resolvedPath;
|
|
27079
28158
|
}
|
|
@@ -27081,18 +28160,18 @@ export function commonjsResolve (path, originalModuleDir) {
|
|
|
27081
28160
|
}
|
|
27082
28161
|
|
|
27083
28162
|
export function commonjsRequire (path, originalModuleDir) {
|
|
27084
|
-
|
|
28163
|
+
var resolvedPath = commonjsResolveImpl(path, originalModuleDir, true);
|
|
27085
28164
|
if (resolvedPath !== null) {
|
|
27086
|
-
|
|
28165
|
+
var cachedModule = DYNAMIC_REQUIRE_CACHE[resolvedPath];
|
|
27087
28166
|
if (cachedModule) return cachedModule.exports;
|
|
27088
|
-
|
|
28167
|
+
var shortTo = DYNAMIC_REQUIRE_SHORTS[resolvedPath];
|
|
27089
28168
|
if (shortTo) {
|
|
27090
28169
|
cachedModule = DYNAMIC_REQUIRE_CACHE[shortTo];
|
|
27091
28170
|
if (cachedModule)
|
|
27092
28171
|
return cachedModule.exports;
|
|
27093
28172
|
resolvedPath = commonjsResolveImpl(shortTo, null, true);
|
|
27094
28173
|
}
|
|
27095
|
-
|
|
28174
|
+
var loader = DYNAMIC_REQUIRE_LOADERS[resolvedPath];
|
|
27096
28175
|
if (loader) {
|
|
27097
28176
|
DYNAMIC_REQUIRE_CACHE[resolvedPath] = cachedModule = {
|
|
27098
28177
|
id: resolvedPath,
|
|
@@ -35057,7 +36136,7 @@ async function createPluginContainer({ plugins, logger, root, build: { rollupOpt
|
|
|
35057
36136
|
}
|
|
35058
36137
|
if (!combinedMap) {
|
|
35059
36138
|
return createIfNull
|
|
35060
|
-
? new MagicString(this.originalCode).generateMap({
|
|
36139
|
+
? new MagicString$1(this.originalCode).generateMap({
|
|
35061
36140
|
includeContent: true,
|
|
35062
36141
|
hires: true,
|
|
35063
36142
|
source: this.filename
|
|
@@ -35158,7 +36237,7 @@ async function createPluginContainer({ plugins, logger, root, build: { rollupOpt
|
|
|
35158
36237
|
ctx._activePlugin = plugin;
|
|
35159
36238
|
const result = await plugin.load.call(ctx, id, { ssr });
|
|
35160
36239
|
if (result != null) {
|
|
35161
|
-
if (isObject$
|
|
36240
|
+
if (isObject$4(result)) {
|
|
35162
36241
|
updateModuleInfo(id, result);
|
|
35163
36242
|
}
|
|
35164
36243
|
return result;
|
|
@@ -35189,7 +36268,7 @@ async function createPluginContainer({ plugins, logger, root, build: { rollupOpt
|
|
|
35189
36268
|
continue;
|
|
35190
36269
|
isDebug &&
|
|
35191
36270
|
debugPluginTransform(timeFrom(start), plugin.name, prettifyUrl(id, root));
|
|
35192
|
-
if (isObject$
|
|
36271
|
+
if (isObject$4(result)) {
|
|
35193
36272
|
if (result.code !== undefined) {
|
|
35194
36273
|
code = result.code;
|
|
35195
36274
|
if (result.map) {
|
|
@@ -35247,7 +36326,7 @@ async function scanImports(config) {
|
|
|
35247
36326
|
else if (Array.isArray(buildInput)) {
|
|
35248
36327
|
entries = buildInput.map(resolvePath);
|
|
35249
36328
|
}
|
|
35250
|
-
else if (isObject$
|
|
36329
|
+
else if (isObject$4(buildInput)) {
|
|
35251
36330
|
entries = Object.values(buildInput).map(resolvePath);
|
|
35252
36331
|
}
|
|
35253
36332
|
else {
|
|
@@ -35573,7 +36652,7 @@ async function transformGlob(source, importer, root, loader, resolve, logger) {
|
|
|
35573
36652
|
}
|
|
35574
36653
|
await init;
|
|
35575
36654
|
const imports = parse$f(source)[0];
|
|
35576
|
-
const s = new MagicString(source);
|
|
36655
|
+
const s = new MagicString$1(source);
|
|
35577
36656
|
for (let index = 0; index < imports.length; index++) {
|
|
35578
36657
|
const { s: start, e: end, ss: expStart } = imports[index];
|
|
35579
36658
|
const url = source.slice(start, end);
|
|
@@ -35627,6 +36706,8 @@ function isScannable(id) {
|
|
|
35627
36706
|
|
|
35628
36707
|
const debug$d = createDebugger('vite:deps');
|
|
35629
36708
|
const isDebugEnabled = _debug('vite:deps').enabled;
|
|
36709
|
+
const jsExtensionRE = /\.js$/i;
|
|
36710
|
+
const jsMapExtensionRE = /\.js\.map$/i;
|
|
35630
36711
|
/**
|
|
35631
36712
|
* Used by Vite CLI when running `vite optimize`
|
|
35632
36713
|
*/
|
|
@@ -35662,13 +36743,14 @@ ssr) {
|
|
|
35662
36743
|
hash: mainHash,
|
|
35663
36744
|
browserHash: mainHash,
|
|
35664
36745
|
optimized: {},
|
|
36746
|
+
chunks: {},
|
|
35665
36747
|
discovered: {}
|
|
35666
36748
|
};
|
|
35667
36749
|
if (!force) {
|
|
35668
36750
|
let prevData;
|
|
35669
36751
|
try {
|
|
35670
36752
|
const prevDataPath = path__default.join(depsCacheDir, '_metadata.json');
|
|
35671
|
-
prevData = parseOptimizedDepsMetadata(fs__default.readFileSync(prevDataPath, 'utf-8'), depsCacheDir
|
|
36753
|
+
prevData = parseOptimizedDepsMetadata(fs__default.readFileSync(prevDataPath, 'utf-8'), depsCacheDir);
|
|
35672
36754
|
}
|
|
35673
36755
|
catch (e) { }
|
|
35674
36756
|
// hash is consistent, no need to re-bundle
|
|
@@ -35754,7 +36836,7 @@ ssr) {
|
|
|
35754
36836
|
// We prebundle dependencies with esbuild and cache them, but there is no need
|
|
35755
36837
|
// to wait here. Code that needs to access the cached deps needs to await
|
|
35756
36838
|
// the optimizeDepInfo.processing promise for each dep
|
|
35757
|
-
var _a, _b, _c, _d;
|
|
36839
|
+
var _a, _b, _c, _d, _e;
|
|
35758
36840
|
const qualifiedIds = Object.keys(deps);
|
|
35759
36841
|
if (!qualifiedIds.length) {
|
|
35760
36842
|
return {
|
|
@@ -35881,7 +36963,7 @@ ssr) {
|
|
|
35881
36963
|
for (const id in deps) {
|
|
35882
36964
|
const optimizedInfo = metadata.optimized[id];
|
|
35883
36965
|
optimizedInfo.needsInterop = needsInterop(id, idToExports[id], meta.outputs, processingCacheDirOutputPath);
|
|
35884
|
-
const output = meta.outputs[path__default.relative(process.cwd(),
|
|
36966
|
+
const output = meta.outputs[path__default.relative(process.cwd(), getProcessingDepPath(id, config))];
|
|
35885
36967
|
if (output) {
|
|
35886
36968
|
// We only need to hash the output.imports in to check for stability, but adding the hash
|
|
35887
36969
|
// and file path gives us a unique hash that may be useful for other things in the future
|
|
@@ -35903,19 +36985,38 @@ ssr) {
|
|
|
35903
36985
|
});
|
|
35904
36986
|
debug$d(`optimized deps have altered files: ${alteredFiles}`);
|
|
35905
36987
|
}
|
|
35906
|
-
|
|
35907
|
-
|
|
35908
|
-
|
|
35909
|
-
|
|
35910
|
-
|
|
35911
|
-
|
|
36988
|
+
for (const o of Object.keys(meta.outputs)) {
|
|
36989
|
+
if (!o.match(jsMapExtensionRE)) {
|
|
36990
|
+
const id = path__default
|
|
36991
|
+
.relative(processingCacheDirOutputPath, o)
|
|
36992
|
+
.replace(jsExtensionRE, '');
|
|
36993
|
+
const file = getOptimizedDepPath(id, config);
|
|
36994
|
+
if (!findFileInfo(metadata.optimized, file)) {
|
|
36995
|
+
metadata.chunks[id] = {
|
|
36996
|
+
file,
|
|
36997
|
+
src: '',
|
|
36998
|
+
needsInterop: false,
|
|
36999
|
+
browserHash: (!alteredFiles && ((_e = currentData === null || currentData === void 0 ? void 0 : currentData.chunks[id]) === null || _e === void 0 ? void 0 : _e.browserHash)) ||
|
|
37000
|
+
newBrowserHash
|
|
37001
|
+
};
|
|
37002
|
+
}
|
|
35912
37003
|
}
|
|
37004
|
+
}
|
|
37005
|
+
if (alteredFiles) {
|
|
35913
37006
|
metadata.browserHash = newBrowserHash;
|
|
35914
37007
|
}
|
|
35915
37008
|
debug$d(`deps bundled in ${(perf_hooks.performance.now() - start).toFixed(2)}ms`);
|
|
35916
37009
|
return {
|
|
35917
37010
|
alteredFiles,
|
|
35918
37011
|
commit() {
|
|
37012
|
+
if (alteredFiles) {
|
|
37013
|
+
// Overwrite individual hashes with the new global browserHash, a full page reload is required
|
|
37014
|
+
// New deps that ended up with a different hash replaced while doing analysis import are going to
|
|
37015
|
+
// return a not found so the browser doesn't cache them. And will properly get loaded after the reload
|
|
37016
|
+
for (const id in deps) {
|
|
37017
|
+
metadata.optimized[id].browserHash = newBrowserHash;
|
|
37018
|
+
}
|
|
37019
|
+
}
|
|
35919
37020
|
// Write metadata file, delete `deps` folder and rename the new `processing` folder to `deps` in sync
|
|
35920
37021
|
commitProcessingDepsCacheSync();
|
|
35921
37022
|
processing.resolve();
|
|
@@ -35983,9 +37084,8 @@ function depsFromOptimizedDepInfo(depsInfo) {
|
|
|
35983
37084
|
function getHash(text) {
|
|
35984
37085
|
return require$$1$1.createHash('sha256').update(text).digest('hex').substring(0, 8);
|
|
35985
37086
|
}
|
|
35986
|
-
function getOptimizedBrowserHash(hash, deps
|
|
35987
|
-
|
|
35988
|
-
return getHash(hash + JSON.stringify(deps) + (missing ? JSON.stringify(missing) : ''));
|
|
37087
|
+
function getOptimizedBrowserHash(hash, deps) {
|
|
37088
|
+
return getHash(hash + JSON.stringify(deps));
|
|
35989
37089
|
}
|
|
35990
37090
|
function getCachedDepFilePath(id, depsCacheDir) {
|
|
35991
37091
|
return normalizePath$4(path__default.resolve(depsCacheDir, flattenId(id) + '.js'));
|
|
@@ -35996,6 +37096,12 @@ function getOptimizedDepPath(id, config) {
|
|
|
35996
37096
|
function getDepsCacheDir(config) {
|
|
35997
37097
|
return normalizePath$4(path__default.resolve(config.cacheDir, 'deps'));
|
|
35998
37098
|
}
|
|
37099
|
+
function getProcessingDepFilePath(id, processingCacheDir) {
|
|
37100
|
+
return normalizePath$4(path__default.resolve(processingCacheDir, flattenId(id) + '.js'));
|
|
37101
|
+
}
|
|
37102
|
+
function getProcessingDepPath(id, config) {
|
|
37103
|
+
return getProcessingDepFilePath(id, getProcessingDepsCacheDir(config));
|
|
37104
|
+
}
|
|
35999
37105
|
function getProcessingDepsCacheDir(config) {
|
|
36000
37106
|
return normalizePath$4(path__default.resolve(config.cacheDir, 'processing'));
|
|
36001
37107
|
}
|
|
@@ -36018,7 +37124,7 @@ function createIsOptimizedDepUrl(config) {
|
|
|
36018
37124
|
return url.startsWith(depsCacheDirPrefix);
|
|
36019
37125
|
};
|
|
36020
37126
|
}
|
|
36021
|
-
function parseOptimizedDepsMetadata(jsonMetadata, depsCacheDir
|
|
37127
|
+
function parseOptimizedDepsMetadata(jsonMetadata, depsCacheDir) {
|
|
36022
37128
|
const metadata = JSON.parse(jsonMetadata, (key, value) => {
|
|
36023
37129
|
// Paths can be absolute or relative to the deps cache dir where
|
|
36024
37130
|
// the _metadata.json is located
|
|
@@ -36027,19 +37133,57 @@ function parseOptimizedDepsMetadata(jsonMetadata, depsCacheDir, processing) {
|
|
|
36027
37133
|
}
|
|
36028
37134
|
return value;
|
|
36029
37135
|
});
|
|
37136
|
+
const { browserHash } = metadata;
|
|
36030
37137
|
for (const o of Object.keys(metadata.optimized)) {
|
|
36031
|
-
metadata.optimized[o]
|
|
37138
|
+
const depInfo = metadata.optimized[o];
|
|
37139
|
+
depInfo.browserHash = browserHash;
|
|
36032
37140
|
}
|
|
36033
|
-
|
|
37141
|
+
metadata.chunks || (metadata.chunks = {}); // Support missing chunks for back compat
|
|
37142
|
+
for (const o of Object.keys(metadata.chunks)) {
|
|
37143
|
+
const depInfo = metadata.chunks[o];
|
|
37144
|
+
depInfo.src = '';
|
|
37145
|
+
depInfo.browserHash = browserHash;
|
|
37146
|
+
}
|
|
37147
|
+
metadata.discovered = {};
|
|
37148
|
+
return metadata;
|
|
36034
37149
|
}
|
|
37150
|
+
/**
|
|
37151
|
+
* Stringify metadata for deps cache. Remove processing promises
|
|
37152
|
+
* and individual dep info browserHash. Once the cache is reload
|
|
37153
|
+
* the next time the server start we need to use the global
|
|
37154
|
+
* browserHash to allow long term caching
|
|
37155
|
+
*/
|
|
36035
37156
|
function stringifyOptimizedDepsMetadata(metadata, depsCacheDir) {
|
|
36036
37157
|
return JSON.stringify(metadata, (key, value) => {
|
|
36037
|
-
if (key === '
|
|
37158
|
+
if (key === 'discovered' || key === 'processing') {
|
|
36038
37159
|
return;
|
|
36039
37160
|
}
|
|
36040
37161
|
if (key === 'file' || key === 'src') {
|
|
36041
37162
|
return normalizePath$4(path__default.relative(depsCacheDir, value));
|
|
36042
37163
|
}
|
|
37164
|
+
if (key === 'optimized') {
|
|
37165
|
+
// Only remove browserHash for individual dep info
|
|
37166
|
+
const cleaned = {};
|
|
37167
|
+
for (const dep of Object.keys(value)) {
|
|
37168
|
+
const { browserHash, ...c } = value[dep];
|
|
37169
|
+
cleaned[dep] = c;
|
|
37170
|
+
}
|
|
37171
|
+
return cleaned;
|
|
37172
|
+
}
|
|
37173
|
+
if (key === 'optimized') {
|
|
37174
|
+
return Object.keys(value).reduce((cleaned, dep) => {
|
|
37175
|
+
const { browserHash, ...c } = value[dep];
|
|
37176
|
+
cleaned[dep] = c;
|
|
37177
|
+
return cleaned;
|
|
37178
|
+
}, {});
|
|
37179
|
+
}
|
|
37180
|
+
if (key === 'chunks') {
|
|
37181
|
+
return Object.keys(value).reduce((cleaned, dep) => {
|
|
37182
|
+
const { browserHash, needsInterop, src, ...c } = value[dep];
|
|
37183
|
+
cleaned[dep] = c;
|
|
37184
|
+
return cleaned;
|
|
37185
|
+
}, {});
|
|
37186
|
+
}
|
|
36043
37187
|
return value;
|
|
36044
37188
|
}, 2);
|
|
36045
37189
|
}
|
|
@@ -36109,7 +37253,8 @@ function getDepHash(root, config) {
|
|
|
36109
37253
|
}
|
|
36110
37254
|
function optimizeDepInfoFromFile(metadata, file) {
|
|
36111
37255
|
return (findFileInfo(metadata.optimized, file) ||
|
|
36112
|
-
findFileInfo(metadata.discovered, file)
|
|
37256
|
+
findFileInfo(metadata.discovered, file) ||
|
|
37257
|
+
findFileInfo(metadata.chunks, file));
|
|
36113
37258
|
}
|
|
36114
37259
|
function findFileInfo(dependenciesInfo, file) {
|
|
36115
37260
|
for (const o of Object.keys(dependenciesInfo)) {
|
|
@@ -36135,10 +37280,9 @@ var index$1 = {
|
|
|
36135
37280
|
findKnownImports: findKnownImports,
|
|
36136
37281
|
newDepOptimizationProcessing: newDepOptimizationProcessing,
|
|
36137
37282
|
depsFromOptimizedDepInfo: depsFromOptimizedDepInfo,
|
|
36138
|
-
|
|
37283
|
+
getHash: getHash,
|
|
36139
37284
|
getOptimizedDepPath: getOptimizedDepPath,
|
|
36140
37285
|
getDepsCacheDir: getDepsCacheDir,
|
|
36141
|
-
getProcessingDepsCacheDir: getProcessingDepsCacheDir,
|
|
36142
37286
|
isOptimizedDepFile: isOptimizedDepFile,
|
|
36143
37287
|
createIsOptimizedDepUrl: createIsOptimizedDepUrl,
|
|
36144
37288
|
optimizeDepInfoFromFile: optimizeDepInfoFromFile,
|
|
@@ -36396,7 +37540,7 @@ function resolvePlugin(baseOptions) {
|
|
|
36396
37540
|
isOptimizedDepUrl = createIsOptimizedDepUrl(server.config);
|
|
36397
37541
|
},
|
|
36398
37542
|
resolveId(id, importer, resolveOpts) {
|
|
36399
|
-
var _a, _b, _c;
|
|
37543
|
+
var _a, _b, _c, _d;
|
|
36400
37544
|
const ssr = (resolveOpts === null || resolveOpts === void 0 ? void 0 : resolveOpts.ssr) === true;
|
|
36401
37545
|
if (id.startsWith(browserExternalId)) {
|
|
36402
37546
|
return id;
|
|
@@ -36446,6 +37590,17 @@ function resolvePlugin(baseOptions) {
|
|
|
36446
37590
|
const fsPath = path__default.resolve(basedir, id);
|
|
36447
37591
|
// handle browser field mapping for relative imports
|
|
36448
37592
|
const normalizedFsPath = normalizePath$4(fsPath);
|
|
37593
|
+
if (server && isOptimizedDepFile(normalizedFsPath, server.config)) {
|
|
37594
|
+
// Optimized files could not yet exist in disk, resolve to the full path
|
|
37595
|
+
// Inject the current browserHash version if the path doesn't have one
|
|
37596
|
+
if (!normalizedFsPath.match(DEP_VERSION_RE)) {
|
|
37597
|
+
const browserHash = (_d = optimizeDepInfoFromFile(server._optimizeDepsMetadata, normalizedFsPath)) === null || _d === void 0 ? void 0 : _d.browserHash;
|
|
37598
|
+
if (browserHash) {
|
|
37599
|
+
return injectQuery(normalizedFsPath, `v=${browserHash}`);
|
|
37600
|
+
}
|
|
37601
|
+
}
|
|
37602
|
+
return normalizedFsPath;
|
|
37603
|
+
}
|
|
36449
37604
|
const pathFromBasedir = normalizedFsPath.slice(basedir.length);
|
|
36450
37605
|
if (pathFromBasedir.startsWith('/node_modules/')) {
|
|
36451
37606
|
// normalize direct imports from node_modules to bare imports, so the
|
|
@@ -36764,6 +37919,10 @@ function tryOptimizedResolve(id, server, importer) {
|
|
|
36764
37919
|
if (isOptimized) {
|
|
36765
37920
|
return getOptimizedUrl(isOptimized);
|
|
36766
37921
|
}
|
|
37922
|
+
const isChunk = depData.chunks[id];
|
|
37923
|
+
if (isChunk) {
|
|
37924
|
+
return getOptimizedUrl(isChunk);
|
|
37925
|
+
}
|
|
36767
37926
|
if (!importer)
|
|
36768
37927
|
return;
|
|
36769
37928
|
// further check if id is imported by nested dependency
|
|
@@ -36814,7 +37973,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
36814
37973
|
// https://github.com/defunctzombie/package-browser-field-spec
|
|
36815
37974
|
const browserEntry = typeof data.browser === 'string'
|
|
36816
37975
|
? data.browser
|
|
36817
|
-
: isObject$
|
|
37976
|
+
: isObject$4(data.browser) && data.browser['.'];
|
|
36818
37977
|
if (browserEntry) {
|
|
36819
37978
|
// check if the package also has a "module" field.
|
|
36820
37979
|
if (typeof data.module === 'string' && data.module !== browserEntry) {
|
|
@@ -36863,7 +38022,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
36863
38022
|
}
|
|
36864
38023
|
// resolve object browser field in package.json
|
|
36865
38024
|
const { browser: browserField } = data;
|
|
36866
|
-
if (targetWeb && isObject$
|
|
38025
|
+
if (targetWeb && isObject$4(browserField)) {
|
|
36867
38026
|
entry = mapWithBrowserField(entry, browserField) || entry;
|
|
36868
38027
|
}
|
|
36869
38028
|
const entryPointPath = path__default.join(dir, entry);
|
|
@@ -36909,7 +38068,7 @@ function resolveDeepImport(id, { webResolvedImports, setResolvedCache, getResolv
|
|
|
36909
38068
|
const { exports: exportsField, browser: browserField } = data;
|
|
36910
38069
|
// map relative based on exports data
|
|
36911
38070
|
if (exportsField) {
|
|
36912
|
-
if (isObject$
|
|
38071
|
+
if (isObject$4(exportsField) && !Array.isArray(exportsField)) {
|
|
36913
38072
|
relativeId = resolveExports(data, cleanUrl(relativeId), options, targetWeb);
|
|
36914
38073
|
}
|
|
36915
38074
|
else {
|
|
@@ -36921,7 +38080,7 @@ function resolveDeepImport(id, { webResolvedImports, setResolvedCache, getResolv
|
|
|
36921
38080
|
`${path__default.join(dir, 'package.json')}.`);
|
|
36922
38081
|
}
|
|
36923
38082
|
}
|
|
36924
|
-
else if (targetWeb && isObject$
|
|
38083
|
+
else if (targetWeb && isObject$4(browserField)) {
|
|
36925
38084
|
const mapped = mapWithBrowserField(relativeId, browserField);
|
|
36926
38085
|
if (mapped) {
|
|
36927
38086
|
relativeId = mapped;
|
|
@@ -36944,7 +38103,7 @@ function resolveDeepImport(id, { webResolvedImports, setResolvedCache, getResolv
|
|
|
36944
38103
|
function tryResolveBrowserMapping(id, importer, options, isFilePath) {
|
|
36945
38104
|
let res;
|
|
36946
38105
|
const pkg = importer && idToPkgMap.get(importer);
|
|
36947
|
-
if (pkg && isObject$
|
|
38106
|
+
if (pkg && isObject$4(pkg.data.browser)) {
|
|
36948
38107
|
const mapId = isFilePath ? './' + slash$1(path__default.relative(pkg.dir, id)) : id;
|
|
36949
38108
|
const browserMappedPath = mapWithBrowserField(mapId, pkg.data.browser);
|
|
36950
38109
|
if (browserMappedPath) {
|
|
@@ -37195,32 +38354,30 @@ function ssrManifestPlugin(config) {
|
|
|
37195
38354
|
}
|
|
37196
38355
|
if (imports.length) {
|
|
37197
38356
|
for (let index = 0; index < imports.length; index++) {
|
|
37198
|
-
const { s: start, e: end, n: name
|
|
37199
|
-
|
|
37200
|
-
|
|
37201
|
-
|
|
37202
|
-
|
|
37203
|
-
|
|
37204
|
-
|
|
37205
|
-
|
|
37206
|
-
|
|
37207
|
-
|
|
37208
|
-
|
|
37209
|
-
|
|
37210
|
-
|
|
37211
|
-
|
|
37212
|
-
|
|
37213
|
-
|
|
37214
|
-
|
|
37215
|
-
|
|
37216
|
-
|
|
37217
|
-
|
|
37218
|
-
|
|
37219
|
-
|
|
37220
|
-
|
|
37221
|
-
|
|
37222
|
-
ssrManifest[path$p.basename(name)] = deps;
|
|
37223
|
-
}
|
|
38357
|
+
const { s: start, e: end, n: name } = imports[index];
|
|
38358
|
+
// check the chunk being imported
|
|
38359
|
+
const url = code.slice(start, end);
|
|
38360
|
+
const deps = [];
|
|
38361
|
+
const ownerFilename = chunk.fileName;
|
|
38362
|
+
// literal import - trace direct imports and add to deps
|
|
38363
|
+
const analyzed = new Set();
|
|
38364
|
+
const addDeps = (filename) => {
|
|
38365
|
+
if (filename === ownerFilename)
|
|
38366
|
+
return;
|
|
38367
|
+
if (analyzed.has(filename))
|
|
38368
|
+
return;
|
|
38369
|
+
analyzed.add(filename);
|
|
38370
|
+
const chunk = bundle[filename];
|
|
38371
|
+
if (chunk) {
|
|
38372
|
+
chunk.viteMetadata.importedCss.forEach((file) => {
|
|
38373
|
+
deps.push(`/${file}`);
|
|
38374
|
+
});
|
|
38375
|
+
chunk.imports.forEach(addDeps);
|
|
38376
|
+
}
|
|
38377
|
+
};
|
|
38378
|
+
const normalizedFile = normalizePath$4(path$p.join(path$p.dirname(chunk.fileName), url.slice(1, -1)));
|
|
38379
|
+
addDeps(normalizedFile);
|
|
38380
|
+
ssrManifest[path$p.basename(name)] = deps;
|
|
37224
38381
|
}
|
|
37225
38382
|
}
|
|
37226
38383
|
}
|
|
@@ -37263,7 +38420,7 @@ function assetImportMetaUrlPlugin(config) {
|
|
|
37263
38420
|
while ((match = importMetaUrlRE.exec(noCommentsCode))) {
|
|
37264
38421
|
const { 0: exp, 1: rawUrl, index } = match;
|
|
37265
38422
|
if (!s)
|
|
37266
|
-
s = new MagicString(code);
|
|
38423
|
+
s = new MagicString$1(code);
|
|
37267
38424
|
// potential dynamic template string
|
|
37268
38425
|
if (rawUrl[0] === '`' && /\$\{/.test(rawUrl)) {
|
|
37269
38426
|
const ast = this.parse(rawUrl);
|
|
@@ -43466,7 +44623,7 @@ async function resolveHttpServer({ proxy }, app, httpsOptions) {
|
|
|
43466
44623
|
async function resolveHttpsConfig(https, cacheDir) {
|
|
43467
44624
|
if (!https)
|
|
43468
44625
|
return undefined;
|
|
43469
|
-
const httpsOption = isObject$
|
|
44626
|
+
const httpsOption = isObject$4(https) ? { ...https } : {};
|
|
43470
44627
|
const { ca, cert, key, pfx } = httpsOption;
|
|
43471
44628
|
Object.assign(httpsOption, {
|
|
43472
44629
|
ca: readFileIfExists(ca),
|
|
@@ -43503,7 +44660,7 @@ async function getCertificate(cacheDir) {
|
|
|
43503
44660
|
return content;
|
|
43504
44661
|
}
|
|
43505
44662
|
catch {
|
|
43506
|
-
const content = (await Promise.resolve().then(function () { return require('./dep-
|
|
44663
|
+
const content = (await Promise.resolve().then(function () { return require('./dep-dd016db2.js'); })).createCertificate();
|
|
43507
44664
|
fs$n.promises
|
|
43508
44665
|
.mkdir(cacheDir, { recursive: true })
|
|
43509
44666
|
.then(() => fs$n.promises.writeFile(cachePath, content))
|
|
@@ -47734,7 +48891,7 @@ const HMR_HEADER = 'vite-hmr';
|
|
|
47734
48891
|
function createWebSocketServer(server, config, httpsOptions) {
|
|
47735
48892
|
let wss;
|
|
47736
48893
|
let httpsServer = undefined;
|
|
47737
|
-
const hmr = isObject$
|
|
48894
|
+
const hmr = isObject$4(config.server.hmr) && config.server.hmr;
|
|
47738
48895
|
const wsServer = (hmr && hmr.server) ||
|
|
47739
48896
|
((!(hmr && hmr.port) || hmr.port !== config.server.port) && server);
|
|
47740
48897
|
if (wsServer) {
|
|
@@ -49931,7 +51088,7 @@ function proxyMiddleware(httpServer, config) {
|
|
|
49931
51088
|
debug$4(`bypass: ${req.url} -> ${bypassResult}`);
|
|
49932
51089
|
return next();
|
|
49933
51090
|
}
|
|
49934
|
-
else if (isObject$
|
|
51091
|
+
else if (isObject$4(bypassResult)) {
|
|
49935
51092
|
Object.assign(options, bypassResult);
|
|
49936
51093
|
debug$4(`bypass: ${req.url} use modified options: %O`, options);
|
|
49937
51094
|
return next();
|
|
@@ -50252,7 +51409,8 @@ function send$1(req, res, content, type, options) {
|
|
|
50252
51409
|
}
|
|
50253
51410
|
if (req.headers['if-none-match'] === etag) {
|
|
50254
51411
|
res.statusCode = 304;
|
|
50255
|
-
|
|
51412
|
+
res.end();
|
|
51413
|
+
return;
|
|
50256
51414
|
}
|
|
50257
51415
|
res.setHeader('Content-Type', alias$1[type] || type);
|
|
50258
51416
|
res.setHeader('Cache-Control', cacheControl);
|
|
@@ -50270,7 +51428,8 @@ function send$1(req, res, content, type, options) {
|
|
|
50270
51428
|
content += genSourceMapString(map);
|
|
50271
51429
|
}
|
|
50272
51430
|
res.statusCode = 200;
|
|
50273
|
-
|
|
51431
|
+
res.end(content);
|
|
51432
|
+
return;
|
|
50274
51433
|
}
|
|
50275
51434
|
function genSourceMapString(map) {
|
|
50276
51435
|
if (typeof map !== 'string') {
|
|
@@ -50562,7 +51721,7 @@ const ssrDynamicImportKey = `__vite_ssr_dynamic_import__`;
|
|
|
50562
51721
|
const ssrExportAllKey = `__vite_ssr_exportAll__`;
|
|
50563
51722
|
const ssrImportMetaKey = `__vite_ssr_import_meta__`;
|
|
50564
51723
|
async function ssrTransform(code, inMap, url) {
|
|
50565
|
-
const s = new MagicString(code);
|
|
51724
|
+
const s = new MagicString$1(code);
|
|
50566
51725
|
let ast;
|
|
50567
51726
|
try {
|
|
50568
51727
|
ast = parser.parse(code, {
|
|
@@ -51391,7 +52550,7 @@ function transformRequest(url, server, options = {}) {
|
|
|
51391
52550
|
// In all cases, the next time this module is requested, it should be
|
|
51392
52551
|
// re-processed.
|
|
51393
52552
|
//
|
|
51394
|
-
// We save the
|
|
52553
|
+
// We save the timestamp when we start processing and compare it with the
|
|
51395
52554
|
// last time this module is invalidated
|
|
51396
52555
|
const timestamp = Date.now();
|
|
51397
52556
|
const pending = server._pendingRequests.get(cacheKey);
|
|
@@ -51495,7 +52654,7 @@ async function doTransform(url, server, options, timestamp) {
|
|
|
51495
52654
|
}
|
|
51496
52655
|
else {
|
|
51497
52656
|
isDebug$3 && debugLoad(`${timeFrom(loadStart)} [plugin] ${prettyUrl}`);
|
|
51498
|
-
if (isObject$
|
|
52657
|
+
if (isObject$4(loadResult)) {
|
|
51499
52658
|
code = loadResult.code;
|
|
51500
52659
|
map = loadResult.map;
|
|
51501
52660
|
}
|
|
@@ -51524,7 +52683,7 @@ async function doTransform(url, server, options, timestamp) {
|
|
|
51524
52683
|
ssr
|
|
51525
52684
|
});
|
|
51526
52685
|
if (transformResult == null ||
|
|
51527
|
-
(isObject$
|
|
52686
|
+
(isObject$4(transformResult) && transformResult.code == null)) {
|
|
51528
52687
|
// no transform applied, keep code as-is
|
|
51529
52688
|
isDebug$3 &&
|
|
51530
52689
|
debugTransform(timeFrom(transformStart) + colors$1.dim(` [skipped] ${prettyUrl}`));
|
|
@@ -51833,7 +52992,7 @@ const processNodeUrl = (node, s, config, htmlPath, originalUrl, moduleGraph) =>
|
|
|
51833
52992
|
const devHtmlHook = async (html, { path: htmlPath, server, originalUrl }) => {
|
|
51834
52993
|
const { config, moduleGraph } = server;
|
|
51835
52994
|
const base = config.base || '/';
|
|
51836
|
-
const s = new MagicString(html);
|
|
52995
|
+
const s = new MagicString$1(html);
|
|
51837
52996
|
let inlineModuleIndex = -1;
|
|
51838
52997
|
const filePath = cleanUrl(htmlPath);
|
|
51839
52998
|
const addInlineModule = (node, ext) => {
|
|
@@ -54215,7 +55374,7 @@ function ssrRequireHookPlugin(config) {
|
|
|
54215
55374
|
transform(code, id) {
|
|
54216
55375
|
const moduleInfo = this.getModuleInfo(id);
|
|
54217
55376
|
if (moduleInfo === null || moduleInfo === void 0 ? void 0 : moduleInfo.isEntry) {
|
|
54218
|
-
const s = new MagicString(code);
|
|
55377
|
+
const s = new MagicString$1(code);
|
|
54219
55378
|
s.prepend(`;(${dedupeRequire.toString()})(${JSON.stringify(config.resolve.dedupe)});\n`);
|
|
54220
55379
|
return {
|
|
54221
55380
|
code: s.toString(),
|
|
@@ -54600,11 +55759,22 @@ function createMissingImporterRegisterFn(server, initialProcessingPromise) {
|
|
|
54600
55759
|
path: '*'
|
|
54601
55760
|
});
|
|
54602
55761
|
}
|
|
55762
|
+
const discoveredTimestamp = Date.now();
|
|
55763
|
+
function getDiscoveredBrowserHash(hash, deps, missing) {
|
|
55764
|
+
return getHash(hash +
|
|
55765
|
+
JSON.stringify(deps) +
|
|
55766
|
+
JSON.stringify(missing) +
|
|
55767
|
+
discoveredTimestamp);
|
|
55768
|
+
}
|
|
54603
55769
|
return function registerMissingImport(id, resolved, ssr) {
|
|
54604
55770
|
const optimized = metadata.optimized[id];
|
|
54605
55771
|
if (optimized) {
|
|
54606
55772
|
return optimized;
|
|
54607
55773
|
}
|
|
55774
|
+
const chunk = metadata.chunks[id];
|
|
55775
|
+
if (chunk) {
|
|
55776
|
+
return chunk;
|
|
55777
|
+
}
|
|
54608
55778
|
let missing = metadata.discovered[id];
|
|
54609
55779
|
if (missing) {
|
|
54610
55780
|
// We are already discover this dependency
|
|
@@ -54619,7 +55789,7 @@ function createMissingImporterRegisterFn(server, initialProcessingPromise) {
|
|
|
54619
55789
|
// the current state of known + missing deps. If its optimizeDeps run
|
|
54620
55790
|
// doesn't alter the bundled files of previous known dependendencies,
|
|
54621
55791
|
// we don't need a full reload and this browserHash will be kept
|
|
54622
|
-
browserHash:
|
|
55792
|
+
browserHash: getDiscoveredBrowserHash(metadata.hash, depsFromOptimizedDepInfo(metadata.optimized), depsFromOptimizedDepInfo(metadata.discovered)),
|
|
54623
55793
|
// loading of this pre-bundled dep needs to await for its processing
|
|
54624
55794
|
// promise to be resolved
|
|
54625
55795
|
processing: depOptimizationProcessing.promise
|
|
@@ -55480,12 +56650,10 @@ function importAnalysisPlugin(config) {
|
|
|
55480
56650
|
extensions: []
|
|
55481
56651
|
});
|
|
55482
56652
|
let server;
|
|
55483
|
-
let isOptimizedDepUrl;
|
|
55484
56653
|
return {
|
|
55485
56654
|
name: 'vite:import-analysis',
|
|
55486
56655
|
configureServer(_server) {
|
|
55487
56656
|
server = _server;
|
|
55488
|
-
isOptimizedDepUrl = createIsOptimizedDepUrl(server.config);
|
|
55489
56657
|
},
|
|
55490
56658
|
async transform(source, importer, options) {
|
|
55491
56659
|
const ssr = (options === null || options === void 0 ? void 0 : options.ssr) === true;
|
|
@@ -55526,7 +56694,7 @@ function importAnalysisPlugin(config) {
|
|
|
55526
56694
|
let hasEnv = false;
|
|
55527
56695
|
let needQueryInjectHelper = false;
|
|
55528
56696
|
let s;
|
|
55529
|
-
const str = () => s || (s = new MagicString(source));
|
|
56697
|
+
const str = () => s || (s = new MagicString$1(source));
|
|
55530
56698
|
// vite-only server context
|
|
55531
56699
|
const { moduleGraph } = server;
|
|
55532
56700
|
// since we are already in the transform phase of the importer, it must
|
|
@@ -55599,8 +56767,8 @@ function importAnalysisPlugin(config) {
|
|
|
55599
56767
|
// do not do this for unknown type imports, otherwise the appended
|
|
55600
56768
|
// query can break 3rd party plugin's extension checks.
|
|
55601
56769
|
if ((isRelative || isSelfImport) &&
|
|
55602
|
-
|
|
55603
|
-
|
|
56770
|
+
!/[\?&]import=?\b/.test(url) &&
|
|
56771
|
+
!url.match(DEP_VERSION_RE)) {
|
|
55604
56772
|
const versionMatch = importer.match(DEP_VERSION_RE);
|
|
55605
56773
|
if (versionMatch) {
|
|
55606
56774
|
url = injectQuery(url, versionMatch[1]);
|
|
@@ -55677,7 +56845,7 @@ function importAnalysisPlugin(config) {
|
|
|
55677
56845
|
}
|
|
55678
56846
|
continue;
|
|
55679
56847
|
}
|
|
55680
|
-
const isDynamicImport = dynamicIndex
|
|
56848
|
+
const isDynamicImport = dynamicIndex > -1;
|
|
55681
56849
|
// static import or valid string in dynamic import
|
|
55682
56850
|
// If resolvable, let's resolve it
|
|
55683
56851
|
if (specifier) {
|
|
@@ -55736,7 +56904,7 @@ function importAnalysisPlugin(config) {
|
|
|
55736
56904
|
debug$1(`${url} needs interop`);
|
|
55737
56905
|
if (isDynamicImport) {
|
|
55738
56906
|
// rewrite `import('package')` to expose the default directly
|
|
55739
|
-
str().overwrite(
|
|
56907
|
+
str().overwrite(expStart, expEnd, `import('${url}').then(m => m.default && m.default.__esModule ? m.default : ({ ...m.default, default: m.default }))`);
|
|
55740
56908
|
}
|
|
55741
56909
|
else {
|
|
55742
56910
|
const exp = source.slice(expStart, expEnd);
|
|
@@ -55999,7 +57167,7 @@ function clientInjectionsPlugin(config) {
|
|
|
55999
57167
|
const timeout = options.timeout || 30000;
|
|
56000
57168
|
const overlay = options.overlay !== false;
|
|
56001
57169
|
let port;
|
|
56002
|
-
if (isObject$
|
|
57170
|
+
if (isObject$4(config.server.hmr)) {
|
|
56003
57171
|
port = config.server.hmr.clientPort || config.server.hmr.port;
|
|
56004
57172
|
}
|
|
56005
57173
|
if (config.server.middlewareMode) {
|
|
@@ -56321,7 +57489,7 @@ function definePlugin(config) {
|
|
|
56321
57489
|
return '' + replacements[match];
|
|
56322
57490
|
});
|
|
56323
57491
|
}
|
|
56324
|
-
const s = new MagicString(code);
|
|
57492
|
+
const s = new MagicString$1(code);
|
|
56325
57493
|
let hasReplaced = false;
|
|
56326
57494
|
let match;
|
|
56327
57495
|
while ((match = pattern.exec(code))) {
|
|
@@ -56430,7 +57598,7 @@ function workerImportMetaUrlPlugin(config) {
|
|
|
56430
57598
|
if (rawUrl[0] === '`' && /\$\{/.test(rawUrl)) {
|
|
56431
57599
|
this.error(`\`new URL(url, import.meta.url)\` is not supported in dynamic template string.`, urlIndex);
|
|
56432
57600
|
}
|
|
56433
|
-
s || (s = new MagicString(code));
|
|
57601
|
+
s || (s = new MagicString$1(code));
|
|
56434
57602
|
const workerType = getWorkerType(code, noCommentsCode, index + allExp.length);
|
|
56435
57603
|
const file = path__default.resolve(path__default.dirname(id), rawUrl.slice(1, -1));
|
|
56436
57604
|
let url;
|
|
@@ -57067,7 +58235,7 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
|
57067
58235
|
merged[key] = [...arraify(existing !== null && existing !== void 0 ? existing : []), ...arraify(value !== null && value !== void 0 ? value : [])];
|
|
57068
58236
|
continue;
|
|
57069
58237
|
}
|
|
57070
|
-
if (isObject$
|
|
58238
|
+
if (isObject$4(existing) && isObject$4(value)) {
|
|
57071
58239
|
merged[key] = mergeConfigRecursively(existing, value, rootPath ? `${rootPath}.${key}` : key);
|
|
57072
58240
|
continue;
|
|
57073
58241
|
}
|
|
@@ -57083,7 +58251,7 @@ function mergeAlias(a, b) {
|
|
|
57083
58251
|
return b;
|
|
57084
58252
|
if (!b)
|
|
57085
58253
|
return a;
|
|
57086
|
-
if (isObject$
|
|
58254
|
+
if (isObject$4(a) && isObject$4(b)) {
|
|
57087
58255
|
return { ...a, ...b };
|
|
57088
58256
|
}
|
|
57089
58257
|
// the order is flipped because the alias is resolved from top-down,
|
|
@@ -57223,7 +58391,7 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
|
57223
58391
|
const config = await (typeof userConfig === 'function'
|
|
57224
58392
|
? userConfig(configEnv)
|
|
57225
58393
|
: userConfig);
|
|
57226
|
-
if (!isObject$
|
|
58394
|
+
if (!isObject$4(config)) {
|
|
57227
58395
|
throw new Error(`config must export or return an object.`);
|
|
57228
58396
|
}
|
|
57229
58397
|
return {
|