re2js 1.2.3 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.cjs.cjs +206 -16
- package/build/index.cjs.cjs.map +1 -1
- package/build/index.esm.d.ts +5 -0
- package/build/index.esm.d.ts.map +1 -1
- package/build/index.esm.js +206 -17
- package/build/index.esm.js.map +1 -1
- package/build/index.umd.js +206 -16
- package/build/index.umd.js.map +1 -1
- package/package.json +1 -1
package/build/index.esm.d.ts
CHANGED
|
@@ -395,6 +395,11 @@ export class RE2JS {
|
|
|
395
395
|
*/
|
|
396
396
|
export class RE2JSCompileException extends RE2JSException {
|
|
397
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* An exception thrown by DFA
|
|
400
|
+
*/
|
|
401
|
+
export class RE2JSDfaMemoryException extends RE2JSException {
|
|
402
|
+
}
|
|
398
403
|
export class RE2JSException extends Error {
|
|
399
404
|
/** @param {string} message */
|
|
400
405
|
constructor(message: string);
|
package/build/index.esm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.d.ts","sourceRoot":"","sources":["index.esm.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.d.ts","sourceRoot":"","sources":["index.esm.js"],"names":[],"mappings":"AAs6BA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IACE;;;;;;OAMG;IACH,6BAHW,MAAM,GACJ,MAAM,CAalB;IACD;;;;OAIG;IACH,qBAHW,KAAK,SACL,gBAAgB,GAAC,iBAAiB,GAAC,MAAM,EAAE,GAAC,MAAM,EA0B5D;IAnBC,oBAA2B;IAG3B,qBAAqB;IACrB,mBADW,MAAM,CACqC;IAEtD,uBAAuB;IACvB,QADW,MAAM,EAAE,CACH;IAChB,qCAAqC;IACrC,aADW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CACC;IAClC,qBAAqB;IACrB,sBADW,MAAM,CACqC;IAUxD;;;O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,GAAC,IAAI,EAcrB;IAJC,qBAAqB;IACrB,OADW,MAAM,CACC;IAClB,0BAA0B;IAC1B,OADW,MAAM,GAAC,IAAI,CACJ;IAGpB;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,cAFa,MAAM,GAAC,IAAI,CAIvB;CACF;AAnID;IACE,yBAGC;IADC,WAAkB;IAEpB,mBAEC;IACD;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,WAFa,MAAM,EAAE,CAIpB;IAED;;;OAGG;IACH,UAFa,MAAM,CAIlB;CACF;AACD;IACE,gCAGC;IADC,kBAAgC;IAElC,mBAEC;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,WAFa,MAAM,EAAE,CAIpB;IAED;;;OAGG;IACH,UAFa,MAAM,CAIlB;CACF;AAzFD;;GAEG;AACH;IACE,8BAAkD;IAClD,oBAEC;IAED;;;OAGG;IACH,kBAFa,OAAO,CAInB;IAED;;;OAGG;IACH,mBAFa,OAAO,CAInB;CACF"}
|
package/build/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* re2js
|
|
3
3
|
* RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
|
|
4
4
|
*
|
|
5
|
-
* @version v1.
|
|
5
|
+
* @version v1.3.0
|
|
6
6
|
* @author Alexey Vasiliev
|
|
7
7
|
* @homepage https://github.com/le0pard/re2js#readme
|
|
8
8
|
* @repository github:le0pard/re2js
|
|
@@ -921,6 +921,17 @@ class RE2JSFlagsException extends RE2JSException {
|
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
923
|
|
|
924
|
+
/**
|
|
925
|
+
* An exception thrown by DFA
|
|
926
|
+
*/
|
|
927
|
+
class RE2JSDfaMemoryException extends RE2JSException {
|
|
928
|
+
/** @param {string} message */
|
|
929
|
+
constructor(message) {
|
|
930
|
+
super(message);
|
|
931
|
+
this.name = 'RE2JSDfaMemoryException';
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
924
935
|
/**
|
|
925
936
|
* A stateful iterator that interprets a regex {@code RE2JS} on a specific input.
|
|
926
937
|
*
|
|
@@ -2110,6 +2121,160 @@ class Machine {
|
|
|
2110
2121
|
}
|
|
2111
2122
|
}
|
|
2112
2123
|
|
|
2124
|
+
class DFAState {
|
|
2125
|
+
constructor(id, nfaStates, isMatch) {
|
|
2126
|
+
this.id = id; // Stringified NFA state list (e.g., "1,4,7")
|
|
2127
|
+
this.nfaStates = nfaStates; // Array of Instruction PCs
|
|
2128
|
+
this.isMatch = isMatch; // Boolean
|
|
2129
|
+
this.nextAscii = new Array(Unicode.MAX_ASCII + 1).fill(null); // Flat array for blisteringly fast ASCII lookups (unanchored)
|
|
2130
|
+
this.nextMap = new Map(); // Cache of Char -> DFAState
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
class DFA {
|
|
2134
|
+
constructor(prog) {
|
|
2135
|
+
this.prog = prog;
|
|
2136
|
+
this.stateCache = new Map(); // id -> DFAState
|
|
2137
|
+
this.startState = null;
|
|
2138
|
+
this.stateLimit = 10000; // Prevent memory explosion (ReDoS protection), like RE2 max_mem
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
// Follows epsilon (empty) transitions to find all reachable states without consuming a char
|
|
2142
|
+
computeClosure(pcs) {
|
|
2143
|
+
const closure = new Set();
|
|
2144
|
+
const stack = [...pcs];
|
|
2145
|
+
let isMatch = false;
|
|
2146
|
+
while (stack.length > 0) {
|
|
2147
|
+
const pc = stack.pop();
|
|
2148
|
+
if (closure.has(pc)) continue;
|
|
2149
|
+
closure.add(pc);
|
|
2150
|
+
const inst = this.prog.getInst(pc);
|
|
2151
|
+
switch (inst.op) {
|
|
2152
|
+
case Inst.MATCH:
|
|
2153
|
+
isMatch = true;
|
|
2154
|
+
break;
|
|
2155
|
+
case Inst.ALT:
|
|
2156
|
+
case Inst.ALT_MATCH:
|
|
2157
|
+
stack.push(inst.out);
|
|
2158
|
+
stack.push(inst.arg);
|
|
2159
|
+
break;
|
|
2160
|
+
case Inst.NOP:
|
|
2161
|
+
case Inst.CAPTURE:
|
|
2162
|
+
stack.push(inst.out);
|
|
2163
|
+
break;
|
|
2164
|
+
// Bailing out on complex empty-width assertions to keep DFA fast.
|
|
2165
|
+
// Engine will seamlessly fall back to the NFA.
|
|
2166
|
+
case Inst.EMPTY_WIDTH:
|
|
2167
|
+
return null;
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
const sortedPCs = Int32Array.from(closure).sort();
|
|
2171
|
+
return {
|
|
2172
|
+
pcs: sortedPCs,
|
|
2173
|
+
isMatch
|
|
2174
|
+
};
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
// Get or create a DFA state from a list of NFA PCs
|
|
2178
|
+
getState(pcs) {
|
|
2179
|
+
const closureResult = this.computeClosure(pcs);
|
|
2180
|
+
if (!closureResult) return null; // Bailout to NFA required
|
|
2181
|
+
|
|
2182
|
+
const id = closureResult.pcs.join(',');
|
|
2183
|
+
if (this.stateCache.has(id)) {
|
|
2184
|
+
return this.stateCache.get(id);
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2187
|
+
// Safety: prevent memory exhaustion from state explosion
|
|
2188
|
+
if (this.stateCache.size > this.stateLimit) {
|
|
2189
|
+
throw new RE2JSDfaMemoryException('dfa error: Out of memory exception');
|
|
2190
|
+
}
|
|
2191
|
+
const state = new DFAState(id, closureResult.pcs, closureResult.isMatch);
|
|
2192
|
+
this.stateCache.set(id, state);
|
|
2193
|
+
return state;
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
// Compute the next DFA state given a current state and a character
|
|
2197
|
+
step(state, charCode, anchor) {
|
|
2198
|
+
// OPTIMIZATION: ASCII Fast-Path
|
|
2199
|
+
if (anchor === RE2Flags.UNANCHORED && charCode <= Unicode.MAX_ASCII) {
|
|
2200
|
+
const next = state.nextAscii[charCode];
|
|
2201
|
+
if (next !== null) {
|
|
2202
|
+
return next;
|
|
2203
|
+
}
|
|
2204
|
+
} else {
|
|
2205
|
+
const key = charCode + (anchor === RE2Flags.UNANCHORED ? 0 : Unicode.MAX_RUNE + 1);
|
|
2206
|
+
if (state.nextMap.has(key)) {
|
|
2207
|
+
return state.nextMap.get(key);
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
const nextPCs = [];
|
|
2211
|
+
for (let i = 0; i < state.nfaStates.length; i++) {
|
|
2212
|
+
const pc = state.nfaStates[i];
|
|
2213
|
+
const inst = this.prog.getInst(pc);
|
|
2214
|
+
if (Inst.isRuneOp(inst.op) && inst.matchRune(charCode)) {
|
|
2215
|
+
nextPCs.push(inst.out);
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
if (anchor === RE2Flags.UNANCHORED) {
|
|
2219
|
+
nextPCs.push(this.prog.start);
|
|
2220
|
+
}
|
|
2221
|
+
const nextState = this.getState(nextPCs);
|
|
2222
|
+
|
|
2223
|
+
// Cache the result
|
|
2224
|
+
if (anchor === RE2Flags.UNANCHORED && charCode <= Unicode.MAX_ASCII) {
|
|
2225
|
+
state.nextAscii[charCode] = nextState;
|
|
2226
|
+
} else {
|
|
2227
|
+
const key = charCode + (anchor === RE2Flags.UNANCHORED ? 0 : Unicode.MAX_RUNE + 1);
|
|
2228
|
+
state.nextMap.set(key, nextState);
|
|
2229
|
+
}
|
|
2230
|
+
return nextState;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
// The hot loop: Execute the Lazy DFA
|
|
2234
|
+
match(input, pos, anchor) {
|
|
2235
|
+
if ((anchor === RE2Flags.ANCHOR_START || anchor === RE2Flags.ANCHOR_BOTH) && pos !== 0) {
|
|
2236
|
+
return false;
|
|
2237
|
+
}
|
|
2238
|
+
if (!this.startState) {
|
|
2239
|
+
this.startState = this.getState([this.prog.start]);
|
|
2240
|
+
if (!this.startState) return null; // Fallback to NFA
|
|
2241
|
+
}
|
|
2242
|
+
let endPos = input.endPos();
|
|
2243
|
+
let currentState = this.startState;
|
|
2244
|
+
if (currentState.isMatch) {
|
|
2245
|
+
if (anchor === RE2Flags.ANCHOR_BOTH) {
|
|
2246
|
+
if (pos === endPos) return true;
|
|
2247
|
+
} else {
|
|
2248
|
+
return true;
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
let i = pos;
|
|
2252
|
+
while (i < endPos) {
|
|
2253
|
+
const r = input.step(i);
|
|
2254
|
+
const rune = r >> 3;
|
|
2255
|
+
const width = r & 7;
|
|
2256
|
+
currentState = this.step(currentState, rune, anchor);
|
|
2257
|
+
|
|
2258
|
+
// If we hit an unrecoverable DFA error or bailout, signal fallback
|
|
2259
|
+
if (currentState === null) return null;
|
|
2260
|
+
if (currentState.isMatch) {
|
|
2261
|
+
if (anchor === RE2Flags.ANCHOR_BOTH) {
|
|
2262
|
+
if (i + width === endPos) return true;
|
|
2263
|
+
} else {
|
|
2264
|
+
return true;
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
// If we hit a dead end, and anchored, fail early
|
|
2269
|
+
if (currentState.nfaStates.length === 0) {
|
|
2270
|
+
if (anchor !== RE2Flags.UNANCHORED) return false;
|
|
2271
|
+
}
|
|
2272
|
+
i += width;
|
|
2273
|
+
}
|
|
2274
|
+
return false;
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2113
2278
|
/**
|
|
2114
2279
|
* Regular expression abstract syntax tree. Produced by parser, used by compiler. NB, this
|
|
2115
2280
|
* corresponds to {@code syntax.regexp} in the Go implementation; Go's {@code regexp} is called
|
|
@@ -5242,6 +5407,30 @@ class RE2 {
|
|
|
5242
5407
|
this.prefixComplete = false; // true if prefix is the entire regexp
|
|
5243
5408
|
this.prefixRune = 0; // first rune in prefix
|
|
5244
5409
|
this.pooled = new AtomicReference(); // Cache of machines for running regexp. Forms a Treiber stack.
|
|
5410
|
+
this.dfa = new DFA(prog); // Initialize the Lazy DFA
|
|
5411
|
+
}
|
|
5412
|
+
executeEngine(input, pos, anchor, ncap) {
|
|
5413
|
+
// If the user wants capturing groups (ncap > 0), the DFA mathematically CANNOT do it.
|
|
5414
|
+
// We must use the NFA.
|
|
5415
|
+
if (ncap > 0) {
|
|
5416
|
+
return this.doExecuteNFA(input, pos, anchor, ncap);
|
|
5417
|
+
}
|
|
5418
|
+
try {
|
|
5419
|
+
const dfaResult = this.dfa.match(input, pos, anchor);
|
|
5420
|
+
if (dfaResult !== null) {
|
|
5421
|
+
// DFA succeeded (returned true or false)
|
|
5422
|
+
return dfaResult ? [] : null; // Return empty array to signify "matched but no captures"
|
|
5423
|
+
}
|
|
5424
|
+
} catch (e) {
|
|
5425
|
+
if (e instanceof RE2JSDfaMemoryException) {
|
|
5426
|
+
this.dfa = new DFA(this.prog); // flush cache
|
|
5427
|
+
} else {
|
|
5428
|
+
throw e;
|
|
5429
|
+
}
|
|
5430
|
+
}
|
|
5431
|
+
|
|
5432
|
+
// Fallback to NFA
|
|
5433
|
+
return this.doExecuteNFA(input, pos, anchor, ncap);
|
|
5245
5434
|
}
|
|
5246
5435
|
|
|
5247
5436
|
/**
|
|
@@ -5326,10 +5515,10 @@ class RE2 {
|
|
|
5326
5515
|
return this.expr;
|
|
5327
5516
|
}
|
|
5328
5517
|
|
|
5329
|
-
//
|
|
5518
|
+
// doExecuteNFA() finds the leftmost match in the input and returns
|
|
5330
5519
|
// the position of its subexpressions.
|
|
5331
5520
|
// Derived from exec.go.
|
|
5332
|
-
|
|
5521
|
+
doExecuteNFA(input, pos, anchor, ncap) {
|
|
5333
5522
|
let m = this.get();
|
|
5334
5523
|
// The Treiber stack cannot reuse nodes, unless the node to be reused has only ever been at
|
|
5335
5524
|
// the bottom of the stack (i.e., next == null).
|
|
@@ -5347,7 +5536,7 @@ class RE2 {
|
|
|
5347
5536
|
return cap;
|
|
5348
5537
|
}
|
|
5349
5538
|
match(s) {
|
|
5350
|
-
return this.
|
|
5539
|
+
return this.executeEngine(MachineInput.fromUTF16(s), 0, RE2Flags.UNANCHORED, 0) !== null;
|
|
5351
5540
|
}
|
|
5352
5541
|
|
|
5353
5542
|
/**
|
|
@@ -5375,7 +5564,7 @@ class RE2 {
|
|
|
5375
5564
|
return [false, null];
|
|
5376
5565
|
}
|
|
5377
5566
|
const machineInput = input.isUTF16Encoding() ? MachineInput.fromUTF16(input.asCharSequence(), 0, end) : MachineInput.fromUTF8(input.asBytes(), 0, end);
|
|
5378
|
-
const groupMatch = this.
|
|
5567
|
+
const groupMatch = this.executeEngine(machineInput, start, anchor, 2 * ngroup);
|
|
5379
5568
|
if (groupMatch === null) {
|
|
5380
5569
|
return [false, null];
|
|
5381
5570
|
}
|
|
@@ -5387,7 +5576,7 @@ class RE2 {
|
|
|
5387
5576
|
*/
|
|
5388
5577
|
// This is visible for testing.
|
|
5389
5578
|
matchUTF8(b) {
|
|
5390
|
-
return this.
|
|
5579
|
+
return this.executeEngine(MachineInput.fromUTF8(b), 0, RE2Flags.UNANCHORED, 0) !== null;
|
|
5391
5580
|
}
|
|
5392
5581
|
|
|
5393
5582
|
/**
|
|
@@ -5424,7 +5613,7 @@ class RE2 {
|
|
|
5424
5613
|
const input = MachineInput.fromUTF16(src);
|
|
5425
5614
|
let numReplaces = 0;
|
|
5426
5615
|
while (searchPos <= src.length) {
|
|
5427
|
-
const a = this.
|
|
5616
|
+
const a = this.executeEngine(input, searchPos, RE2Flags.UNANCHORED, 2);
|
|
5428
5617
|
if (a === null || a.length === 0) {
|
|
5429
5618
|
break;
|
|
5430
5619
|
}
|
|
@@ -5482,7 +5671,7 @@ class RE2 {
|
|
|
5482
5671
|
let i = 0;
|
|
5483
5672
|
let prevMatchEnd = -1;
|
|
5484
5673
|
while (i < n && pos <= end) {
|
|
5485
|
-
const matches = this.
|
|
5674
|
+
const matches = this.executeEngine(input, pos, RE2Flags.UNANCHORED, this.prog.numCap);
|
|
5486
5675
|
if (matches === null || matches.length === 0) {
|
|
5487
5676
|
break;
|
|
5488
5677
|
}
|
|
@@ -5553,7 +5742,7 @@ class RE2 {
|
|
|
5553
5742
|
*/
|
|
5554
5743
|
// This is visible for testing.
|
|
5555
5744
|
findUTF8(b) {
|
|
5556
|
-
const a = this.
|
|
5745
|
+
const a = this.executeEngine(MachineInput.fromUTF8(b), 0, RE2Flags.UNANCHORED, 2);
|
|
5557
5746
|
if (a === null) {
|
|
5558
5747
|
return null;
|
|
5559
5748
|
}
|
|
@@ -5568,7 +5757,7 @@ class RE2 {
|
|
|
5568
5757
|
*/
|
|
5569
5758
|
// This is visible for testing.
|
|
5570
5759
|
findUTF8Index(b) {
|
|
5571
|
-
const a = this.
|
|
5760
|
+
const a = this.executeEngine(MachineInput.fromUTF8(b), 0, RE2Flags.UNANCHORED, 2);
|
|
5572
5761
|
if (a === null) {
|
|
5573
5762
|
return null;
|
|
5574
5763
|
}
|
|
@@ -5585,7 +5774,7 @@ class RE2 {
|
|
|
5585
5774
|
*/
|
|
5586
5775
|
// This is visible for testing.
|
|
5587
5776
|
find(s) {
|
|
5588
|
-
const a = this.
|
|
5777
|
+
const a = this.executeEngine(MachineInput.fromUTF16(s), 0, RE2Flags.UNANCHORED, 2);
|
|
5589
5778
|
if (a === null) {
|
|
5590
5779
|
return '';
|
|
5591
5780
|
}
|
|
@@ -5601,7 +5790,7 @@ class RE2 {
|
|
|
5601
5790
|
*/
|
|
5602
5791
|
// This is visible for testing.
|
|
5603
5792
|
findIndex(s) {
|
|
5604
|
-
return this.
|
|
5793
|
+
return this.executeEngine(MachineInput.fromUTF16(s), 0, RE2Flags.UNANCHORED, 2);
|
|
5605
5794
|
}
|
|
5606
5795
|
|
|
5607
5796
|
/**
|
|
@@ -5613,7 +5802,7 @@ class RE2 {
|
|
|
5613
5802
|
*/
|
|
5614
5803
|
// This is visible for testing.
|
|
5615
5804
|
findUTF8Submatch(b) {
|
|
5616
|
-
const a = this.
|
|
5805
|
+
const a = this.executeEngine(MachineInput.fromUTF8(b), 0, RE2Flags.UNANCHORED, this.prog.numCap);
|
|
5617
5806
|
if (a === null) {
|
|
5618
5807
|
return null;
|
|
5619
5808
|
}
|
|
@@ -5635,7 +5824,7 @@ class RE2 {
|
|
|
5635
5824
|
*/
|
|
5636
5825
|
// This is visible for testing.
|
|
5637
5826
|
findUTF8SubmatchIndex(b) {
|
|
5638
|
-
return this.pad(this.
|
|
5827
|
+
return this.pad(this.executeEngine(MachineInput.fromUTF8(b), 0, RE2Flags.UNANCHORED, this.prog.numCap));
|
|
5639
5828
|
}
|
|
5640
5829
|
|
|
5641
5830
|
/**
|
|
@@ -5647,7 +5836,7 @@ class RE2 {
|
|
|
5647
5836
|
*/
|
|
5648
5837
|
// This is visible for testing.
|
|
5649
5838
|
findSubmatch(s) {
|
|
5650
|
-
const a = this.
|
|
5839
|
+
const a = this.executeEngine(MachineInput.fromUTF16(s), 0, RE2Flags.UNANCHORED, this.prog.numCap);
|
|
5651
5840
|
if (a === null) {
|
|
5652
5841
|
return null;
|
|
5653
5842
|
}
|
|
@@ -5669,7 +5858,7 @@ class RE2 {
|
|
|
5669
5858
|
*/
|
|
5670
5859
|
// This is visible for testing.
|
|
5671
5860
|
findSubmatchIndex(s) {
|
|
5672
|
-
return this.pad(this.
|
|
5861
|
+
return this.pad(this.executeEngine(MachineInput.fromUTF16(s), 0, RE2Flags.UNANCHORED, this.prog.numCap));
|
|
5673
5862
|
}
|
|
5674
5863
|
|
|
5675
5864
|
/**
|
|
@@ -6239,5 +6428,5 @@ class RE2JS {
|
|
|
6239
6428
|
}
|
|
6240
6429
|
}
|
|
6241
6430
|
|
|
6242
|
-
export { Matcher, RE2JS, RE2JSCompileException, RE2JSException, RE2JSFlagsException, RE2JSGroupException, RE2JSSyntaxException };
|
|
6431
|
+
export { Matcher, RE2JS, RE2JSCompileException, RE2JSDfaMemoryException, RE2JSException, RE2JSFlagsException, RE2JSGroupException, RE2JSSyntaxException };
|
|
6243
6432
|
//# sourceMappingURL=index.esm.js.map
|