rollup 1.25.2 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/LICENSE.md +27 -0
- package/dist/bin/rollup +3 -2
- package/dist/rollup.browser.es.js +3 -3
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.es.js +1328 -1309
- package/dist/rollup.js +1323 -1304
- package/dist/shared/index.js +3 -3
- package/package.json +7 -6
package/dist/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v1.
|
|
4
|
-
|
|
3
|
+
Rollup.js v1.26.0
|
|
4
|
+
Sun, 27 Oct 2019 19:40:08 GMT - commit 53fb6fe344376cad0af73d43a6d9790cb7a1e2b9
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -17,6 +17,7 @@ var util = require('util');
|
|
|
17
17
|
var path = require('path');
|
|
18
18
|
var fs = require('fs');
|
|
19
19
|
var acorn = require('acorn');
|
|
20
|
+
var crypto = require('crypto');
|
|
20
21
|
var events = require('events');
|
|
21
22
|
require('module');
|
|
22
23
|
|
|
@@ -53,965 +54,422 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
var charToInteger = {};
|
|
58
|
+
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
59
|
+
for (var i = 0; i < chars.length; i++) {
|
|
60
|
+
charToInteger[chars.charCodeAt(i)] = i;
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
function decode(mappings) {
|
|
63
|
+
var generatedCodeColumn = 0; // first field
|
|
64
|
+
var sourceFileIndex = 0; // second field
|
|
65
|
+
var sourceCodeLine = 0; // third field
|
|
66
|
+
var sourceCodeColumn = 0; // fourth field
|
|
67
|
+
var nameIndex = 0; // fifth field
|
|
68
|
+
var decoded = [];
|
|
69
|
+
var line = [];
|
|
70
|
+
var segment = [];
|
|
71
|
+
for (var i = 0, j = 0, shift = 0, value = 0, len = mappings.length; i < len; i++) {
|
|
72
|
+
var c = mappings.charCodeAt(i);
|
|
73
|
+
if (c === 44) { // ","
|
|
74
|
+
if (segment.length)
|
|
75
|
+
line.push(segment);
|
|
76
|
+
segment = [];
|
|
77
|
+
j = 0;
|
|
78
|
+
}
|
|
79
|
+
else if (c === 59) { // ";"
|
|
80
|
+
if (segment.length)
|
|
81
|
+
line.push(segment);
|
|
82
|
+
segment = [];
|
|
83
|
+
j = 0;
|
|
84
|
+
decoded.push(line);
|
|
85
|
+
line = [];
|
|
86
|
+
generatedCodeColumn = 0;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
var integer = charToInteger[c];
|
|
90
|
+
if (integer === undefined) {
|
|
91
|
+
throw new Error('Invalid character (' + String.fromCharCode(c) + ')');
|
|
92
|
+
}
|
|
93
|
+
var hasContinuationBit = integer & 32;
|
|
94
|
+
integer &= 31;
|
|
95
|
+
value += integer << shift;
|
|
96
|
+
if (hasContinuationBit) {
|
|
97
|
+
shift += 5;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
var shouldNegate = value & 1;
|
|
101
|
+
value >>>= 1;
|
|
102
|
+
if (shouldNegate) {
|
|
103
|
+
value = -value;
|
|
104
|
+
if (value === 0)
|
|
105
|
+
value = -0x80000000;
|
|
77
106
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
else {
|
|
82
|
-
// old school shim for old browsers
|
|
83
|
-
module.exports = function inherits(ctor, superCtor) {
|
|
84
|
-
ctor.super_ = superCtor;
|
|
85
|
-
var TempCtor = function () { };
|
|
86
|
-
TempCtor.prototype = superCtor.prototype;
|
|
87
|
-
ctor.prototype = new TempCtor();
|
|
88
|
-
ctor.prototype.constructor = ctor;
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
var inherits = index.createCommonjsModule(function (module) {
|
|
94
|
-
try {
|
|
95
|
-
var util$1 = util;
|
|
96
|
-
if (typeof util$1.inherits !== 'function')
|
|
97
|
-
throw '';
|
|
98
|
-
module.exports = util$1.inherits;
|
|
99
|
-
}
|
|
100
|
-
catch (e) {
|
|
101
|
-
module.exports = inherits_browser;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
var inherits_1 = inherits;
|
|
106
|
-
function isSurrogatePair(msg, i) {
|
|
107
|
-
if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
if (i < 0 || i + 1 >= msg.length) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
|
|
114
|
-
}
|
|
115
|
-
function toArray(msg, enc) {
|
|
116
|
-
if (Array.isArray(msg))
|
|
117
|
-
return msg.slice();
|
|
118
|
-
if (!msg)
|
|
119
|
-
return [];
|
|
120
|
-
var res = [];
|
|
121
|
-
if (typeof msg === 'string') {
|
|
122
|
-
if (!enc) {
|
|
123
|
-
// Inspired by stringToUtf8ByteArray() in closure-library by Google
|
|
124
|
-
// https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
|
|
125
|
-
// Apache License 2.0
|
|
126
|
-
// https://github.com/google/closure-library/blob/master/LICENSE
|
|
127
|
-
var p = 0;
|
|
128
|
-
for (var i = 0; i < msg.length; i++) {
|
|
129
|
-
var c = msg.charCodeAt(i);
|
|
130
|
-
if (c < 128) {
|
|
131
|
-
res[p++] = c;
|
|
107
|
+
if (j == 0) {
|
|
108
|
+
generatedCodeColumn += value;
|
|
109
|
+
segment.push(generatedCodeColumn);
|
|
132
110
|
}
|
|
133
|
-
else if (
|
|
134
|
-
|
|
135
|
-
|
|
111
|
+
else if (j === 1) {
|
|
112
|
+
sourceFileIndex += value;
|
|
113
|
+
segment.push(sourceFileIndex);
|
|
136
114
|
}
|
|
137
|
-
else if (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
res[p++] = ((c >> 12) & 63) | 128;
|
|
141
|
-
res[p++] = ((c >> 6) & 63) | 128;
|
|
142
|
-
res[p++] = (c & 63) | 128;
|
|
115
|
+
else if (j === 2) {
|
|
116
|
+
sourceCodeLine += value;
|
|
117
|
+
segment.push(sourceCodeLine);
|
|
143
118
|
}
|
|
144
|
-
else {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
119
|
+
else if (j === 3) {
|
|
120
|
+
sourceCodeColumn += value;
|
|
121
|
+
segment.push(sourceCodeColumn);
|
|
122
|
+
}
|
|
123
|
+
else if (j === 4) {
|
|
124
|
+
nameIndex += value;
|
|
125
|
+
segment.push(nameIndex);
|
|
148
126
|
}
|
|
127
|
+
j++;
|
|
128
|
+
value = shift = 0; // reset
|
|
149
129
|
}
|
|
150
130
|
}
|
|
151
|
-
else if (enc === 'hex') {
|
|
152
|
-
msg = msg.replace(/[^a-z0-9]+/ig, '');
|
|
153
|
-
if (msg.length % 2 !== 0)
|
|
154
|
-
msg = '0' + msg;
|
|
155
|
-
for (i = 0; i < msg.length; i += 2)
|
|
156
|
-
res.push(parseInt(msg[i] + msg[i + 1], 16));
|
|
157
|
-
}
|
|
158
131
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return res;
|
|
164
|
-
}
|
|
165
|
-
var toArray_1 = toArray;
|
|
166
|
-
function toHex(msg) {
|
|
167
|
-
var res = '';
|
|
168
|
-
for (var i = 0; i < msg.length; i++)
|
|
169
|
-
res += zero2(msg[i].toString(16));
|
|
170
|
-
return res;
|
|
171
|
-
}
|
|
172
|
-
var toHex_1 = toHex;
|
|
173
|
-
function htonl(w) {
|
|
174
|
-
var res = (w >>> 24) |
|
|
175
|
-
((w >>> 8) & 0xff00) |
|
|
176
|
-
((w << 8) & 0xff0000) |
|
|
177
|
-
((w & 0xff) << 24);
|
|
178
|
-
return res >>> 0;
|
|
132
|
+
if (segment.length)
|
|
133
|
+
line.push(segment);
|
|
134
|
+
decoded.push(line);
|
|
135
|
+
return decoded;
|
|
179
136
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
var
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
137
|
+
function encode(decoded) {
|
|
138
|
+
var sourceFileIndex = 0; // second field
|
|
139
|
+
var sourceCodeLine = 0; // third field
|
|
140
|
+
var sourceCodeColumn = 0; // fourth field
|
|
141
|
+
var nameIndex = 0; // fifth field
|
|
142
|
+
var mappings = '';
|
|
143
|
+
for (var i = 0; i < decoded.length; i++) {
|
|
144
|
+
var line = decoded[i];
|
|
145
|
+
if (i > 0)
|
|
146
|
+
mappings += ';';
|
|
147
|
+
if (line.length === 0)
|
|
148
|
+
continue;
|
|
149
|
+
var generatedCodeColumn = 0; // first field
|
|
150
|
+
var lineMappings = [];
|
|
151
|
+
for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
|
|
152
|
+
var segment = line_1[_i];
|
|
153
|
+
var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
|
|
154
|
+
generatedCodeColumn = segment[0];
|
|
155
|
+
if (segment.length > 1) {
|
|
156
|
+
segmentMappings +=
|
|
157
|
+
encodeInteger(segment[1] - sourceFileIndex) +
|
|
158
|
+
encodeInteger(segment[2] - sourceCodeLine) +
|
|
159
|
+
encodeInteger(segment[3] - sourceCodeColumn);
|
|
160
|
+
sourceFileIndex = segment[1];
|
|
161
|
+
sourceCodeLine = segment[2];
|
|
162
|
+
sourceCodeColumn = segment[3];
|
|
163
|
+
}
|
|
164
|
+
if (segment.length === 5) {
|
|
165
|
+
segmentMappings += encodeInteger(segment[4] - nameIndex);
|
|
166
|
+
nameIndex = segment[4];
|
|
167
|
+
}
|
|
168
|
+
lineMappings.push(segmentMappings);
|
|
169
|
+
}
|
|
170
|
+
mappings += lineMappings.join(',');
|
|
188
171
|
}
|
|
189
|
-
return
|
|
172
|
+
return mappings;
|
|
190
173
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
174
|
+
function encodeInteger(num) {
|
|
175
|
+
var result = '';
|
|
176
|
+
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
177
|
+
do {
|
|
178
|
+
var clamped = num & 31;
|
|
179
|
+
num >>>= 5;
|
|
180
|
+
if (num > 0) {
|
|
181
|
+
clamped |= 32;
|
|
182
|
+
}
|
|
183
|
+
result += chars[clamped];
|
|
184
|
+
} while (num > 0);
|
|
185
|
+
return result;
|
|
197
186
|
}
|
|
198
|
-
|
|
199
|
-
function
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
187
|
+
|
|
188
|
+
var Chunk = function Chunk(start, end, content) {
|
|
189
|
+
this.start = start;
|
|
190
|
+
this.end = end;
|
|
191
|
+
this.original = content;
|
|
192
|
+
this.intro = '';
|
|
193
|
+
this.outro = '';
|
|
194
|
+
this.content = content;
|
|
195
|
+
this.storeName = false;
|
|
196
|
+
this.edited = false;
|
|
197
|
+
// we make these non-enumerable, for sanity while debugging
|
|
198
|
+
Object.defineProperties(this, {
|
|
199
|
+
previous: { writable: true, value: null },
|
|
200
|
+
next: { writable: true, value: null }
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
Chunk.prototype.appendLeft = function appendLeft(content) {
|
|
204
|
+
this.outro += content;
|
|
205
|
+
};
|
|
206
|
+
Chunk.prototype.appendRight = function appendRight(content) {
|
|
207
|
+
this.intro = this.intro + content;
|
|
208
|
+
};
|
|
209
|
+
Chunk.prototype.clone = function clone() {
|
|
210
|
+
var chunk = new Chunk(this.start, this.end, this.original);
|
|
211
|
+
chunk.intro = this.intro;
|
|
212
|
+
chunk.outro = this.outro;
|
|
213
|
+
chunk.content = this.content;
|
|
214
|
+
chunk.storeName = this.storeName;
|
|
215
|
+
chunk.edited = this.edited;
|
|
216
|
+
return chunk;
|
|
217
|
+
};
|
|
218
|
+
Chunk.prototype.contains = function contains(index) {
|
|
219
|
+
return this.start < index && index < this.end;
|
|
220
|
+
};
|
|
221
|
+
Chunk.prototype.eachNext = function eachNext(fn) {
|
|
222
|
+
var chunk = this;
|
|
223
|
+
while (chunk) {
|
|
224
|
+
fn(chunk);
|
|
225
|
+
chunk = chunk.next;
|
|
229
226
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
var
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
227
|
+
};
|
|
228
|
+
Chunk.prototype.eachPrevious = function eachPrevious(fn) {
|
|
229
|
+
var chunk = this;
|
|
230
|
+
while (chunk) {
|
|
231
|
+
fn(chunk);
|
|
232
|
+
chunk = chunk.previous;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
Chunk.prototype.edit = function edit(content, storeName, contentOnly) {
|
|
236
|
+
this.content = content;
|
|
237
|
+
if (!contentOnly) {
|
|
238
|
+
this.intro = '';
|
|
239
|
+
this.outro = '';
|
|
240
|
+
}
|
|
241
|
+
this.storeName = storeName;
|
|
242
|
+
this.edited = true;
|
|
243
|
+
return this;
|
|
244
|
+
};
|
|
245
|
+
Chunk.prototype.prependLeft = function prependLeft(content) {
|
|
246
|
+
this.outro = content + this.outro;
|
|
247
|
+
};
|
|
248
|
+
Chunk.prototype.prependRight = function prependRight(content) {
|
|
249
|
+
this.intro = content + this.intro;
|
|
250
|
+
};
|
|
251
|
+
Chunk.prototype.split = function split(index) {
|
|
252
|
+
var sliceIndex = index - this.start;
|
|
253
|
+
var originalBefore = this.original.slice(0, sliceIndex);
|
|
254
|
+
var originalAfter = this.original.slice(sliceIndex);
|
|
255
|
+
this.original = originalBefore;
|
|
256
|
+
var newChunk = new Chunk(index, this.end, originalAfter);
|
|
257
|
+
newChunk.outro = this.outro;
|
|
258
|
+
this.outro = '';
|
|
259
|
+
this.end = index;
|
|
260
|
+
if (this.edited) {
|
|
261
|
+
// TODO is this block necessary?...
|
|
262
|
+
newChunk.edit('', false);
|
|
263
|
+
this.content = '';
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
this.content = originalBefore;
|
|
267
|
+
}
|
|
268
|
+
newChunk.next = this.next;
|
|
269
|
+
if (newChunk.next) {
|
|
270
|
+
newChunk.next.previous = newChunk;
|
|
271
|
+
}
|
|
272
|
+
newChunk.previous = this;
|
|
273
|
+
this.next = newChunk;
|
|
274
|
+
return newChunk;
|
|
275
|
+
};
|
|
276
|
+
Chunk.prototype.toString = function toString() {
|
|
277
|
+
return this.intro + this.content + this.outro;
|
|
278
|
+
};
|
|
279
|
+
Chunk.prototype.trimEnd = function trimEnd(rx) {
|
|
280
|
+
this.outro = this.outro.replace(rx, '');
|
|
281
|
+
if (this.outro.length) {
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
var trimmed = this.content.replace(rx, '');
|
|
285
|
+
if (trimmed.length) {
|
|
286
|
+
if (trimmed !== this.content) {
|
|
287
|
+
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
242
288
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
this.edit('', undefined, true);
|
|
293
|
+
this.intro = this.intro.replace(rx, '');
|
|
294
|
+
if (this.intro.length) {
|
|
295
|
+
return true;
|
|
248
296
|
}
|
|
249
297
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
var
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
298
|
+
};
|
|
299
|
+
Chunk.prototype.trimStart = function trimStart(rx) {
|
|
300
|
+
this.intro = this.intro.replace(rx, '');
|
|
301
|
+
if (this.intro.length) {
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
var trimmed = this.content.replace(rx, '');
|
|
305
|
+
if (trimmed.length) {
|
|
306
|
+
if (trimmed !== this.content) {
|
|
307
|
+
this.split(this.end - trimmed.length);
|
|
308
|
+
this.edit('', undefined, true);
|
|
309
|
+
}
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
this.edit('', undefined, true);
|
|
314
|
+
this.outro = this.outro.replace(rx, '');
|
|
315
|
+
if (this.outro.length) {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
var btoa = function () {
|
|
321
|
+
throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
|
|
322
|
+
};
|
|
323
|
+
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
|
|
324
|
+
btoa = function (str) { return window.btoa(unescape(encodeURIComponent(str))); };
|
|
263
325
|
}
|
|
264
|
-
|
|
265
|
-
function
|
|
266
|
-
return (a + b + c) >>> 0;
|
|
326
|
+
else if (typeof Buffer === 'function') {
|
|
327
|
+
btoa = function (str) { return Buffer.from(str, 'utf-8').toString('base64'); };
|
|
267
328
|
}
|
|
268
|
-
var
|
|
269
|
-
|
|
270
|
-
|
|
329
|
+
var SourceMap = function SourceMap(properties) {
|
|
330
|
+
this.version = 3;
|
|
331
|
+
this.file = properties.file;
|
|
332
|
+
this.sources = properties.sources;
|
|
333
|
+
this.sourcesContent = properties.sourcesContent;
|
|
334
|
+
this.names = properties.names;
|
|
335
|
+
this.mappings = encode(properties.mappings);
|
|
336
|
+
};
|
|
337
|
+
SourceMap.prototype.toString = function toString() {
|
|
338
|
+
return JSON.stringify(this);
|
|
339
|
+
};
|
|
340
|
+
SourceMap.prototype.toUrl = function toUrl() {
|
|
341
|
+
return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());
|
|
342
|
+
};
|
|
343
|
+
function guessIndent(code) {
|
|
344
|
+
var lines = code.split('\n');
|
|
345
|
+
var tabbed = lines.filter(function (line) { return /^\t+/.test(line); });
|
|
346
|
+
var spaced = lines.filter(function (line) { return /^ {2,}/.test(line); });
|
|
347
|
+
if (tabbed.length === 0 && spaced.length === 0) {
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
// More lines tabbed than spaced? Assume tabs, and
|
|
351
|
+
// default to tabs in the case of a tie (or nothing
|
|
352
|
+
// to go on)
|
|
353
|
+
if (tabbed.length >= spaced.length) {
|
|
354
|
+
return '\t';
|
|
355
|
+
}
|
|
356
|
+
// Otherwise, we need to guess the multiple
|
|
357
|
+
var min = spaced.reduce(function (previous, current) {
|
|
358
|
+
var numSpaces = /^ +/.exec(current)[0].length;
|
|
359
|
+
return Math.min(numSpaces, previous);
|
|
360
|
+
}, Infinity);
|
|
361
|
+
return new Array(min + 1).join(' ');
|
|
271
362
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
363
|
+
function getRelativePath(from, to) {
|
|
364
|
+
var fromParts = from.split(/[/\\]/);
|
|
365
|
+
var toParts = to.split(/[/\\]/);
|
|
366
|
+
fromParts.pop(); // get dirname
|
|
367
|
+
while (fromParts[0] === toParts[0]) {
|
|
368
|
+
fromParts.shift();
|
|
369
|
+
toParts.shift();
|
|
370
|
+
}
|
|
371
|
+
if (fromParts.length) {
|
|
372
|
+
var i = fromParts.length;
|
|
373
|
+
while (i--) {
|
|
374
|
+
fromParts[i] = '..';
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return fromParts.concat(toParts).join('/');
|
|
275
378
|
}
|
|
276
|
-
var
|
|
277
|
-
function
|
|
278
|
-
|
|
279
|
-
var bl = buf[pos + 1];
|
|
280
|
-
var lo = (al + bl) >>> 0;
|
|
281
|
-
var hi = (lo < al ? 1 : 0) + ah + bh;
|
|
282
|
-
buf[pos] = hi >>> 0;
|
|
283
|
-
buf[pos + 1] = lo;
|
|
379
|
+
var toString = Object.prototype.toString;
|
|
380
|
+
function isObject(thing) {
|
|
381
|
+
return toString.call(thing) === '[object Object]';
|
|
284
382
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
var
|
|
288
|
-
var
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
function
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
var
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
var sum64_4_hi_1 = sum64_4_hi;
|
|
310
|
-
function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
|
|
311
|
-
var lo = al + bl + cl + dl;
|
|
312
|
-
return lo >>> 0;
|
|
313
|
-
}
|
|
314
|
-
var sum64_4_lo_1 = sum64_4_lo;
|
|
315
|
-
function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
|
|
316
|
-
var carry = 0;
|
|
317
|
-
var lo = al;
|
|
318
|
-
lo = (lo + bl) >>> 0;
|
|
319
|
-
carry += lo < al ? 1 : 0;
|
|
320
|
-
lo = (lo + cl) >>> 0;
|
|
321
|
-
carry += lo < cl ? 1 : 0;
|
|
322
|
-
lo = (lo + dl) >>> 0;
|
|
323
|
-
carry += lo < dl ? 1 : 0;
|
|
324
|
-
lo = (lo + el) >>> 0;
|
|
325
|
-
carry += lo < el ? 1 : 0;
|
|
326
|
-
var hi = ah + bh + ch + dh + eh + carry;
|
|
327
|
-
return hi >>> 0;
|
|
328
|
-
}
|
|
329
|
-
var sum64_5_hi_1 = sum64_5_hi;
|
|
330
|
-
function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
|
|
331
|
-
var lo = al + bl + cl + dl + el;
|
|
332
|
-
return lo >>> 0;
|
|
333
|
-
}
|
|
334
|
-
var sum64_5_lo_1 = sum64_5_lo;
|
|
335
|
-
function rotr64_hi(ah, al, num) {
|
|
336
|
-
var r = (al << (32 - num)) | (ah >>> num);
|
|
337
|
-
return r >>> 0;
|
|
338
|
-
}
|
|
339
|
-
var rotr64_hi_1 = rotr64_hi;
|
|
340
|
-
function rotr64_lo(ah, al, num) {
|
|
341
|
-
var r = (ah << (32 - num)) | (al >>> num);
|
|
342
|
-
return r >>> 0;
|
|
343
|
-
}
|
|
344
|
-
var rotr64_lo_1 = rotr64_lo;
|
|
345
|
-
function shr64_hi(ah, al, num) {
|
|
346
|
-
return ah >>> num;
|
|
347
|
-
}
|
|
348
|
-
var shr64_hi_1 = shr64_hi;
|
|
349
|
-
function shr64_lo(ah, al, num) {
|
|
350
|
-
var r = (ah << (32 - num)) | (al >>> num);
|
|
351
|
-
return r >>> 0;
|
|
383
|
+
function getLocator(source) {
|
|
384
|
+
var originalLines = source.split('\n');
|
|
385
|
+
var lineOffsets = [];
|
|
386
|
+
for (var i = 0, pos = 0; i < originalLines.length; i++) {
|
|
387
|
+
lineOffsets.push(pos);
|
|
388
|
+
pos += originalLines[i].length + 1;
|
|
389
|
+
}
|
|
390
|
+
return function locate(index) {
|
|
391
|
+
var i = 0;
|
|
392
|
+
var j = lineOffsets.length;
|
|
393
|
+
while (i < j) {
|
|
394
|
+
var m = (i + j) >> 1;
|
|
395
|
+
if (index < lineOffsets[m]) {
|
|
396
|
+
j = m;
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
i = m + 1;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
var line = i - 1;
|
|
403
|
+
var column = index - lineOffsets[line];
|
|
404
|
+
return { line: line, column: column };
|
|
405
|
+
};
|
|
352
406
|
}
|
|
353
|
-
var
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
toHex32: toHex32_1,
|
|
360
|
-
zero2: zero2_1,
|
|
361
|
-
zero8: zero8_1,
|
|
362
|
-
join32: join32_1,
|
|
363
|
-
split32: split32_1,
|
|
364
|
-
rotr32: rotr32_1,
|
|
365
|
-
rotl32: rotl32_1,
|
|
366
|
-
sum32: sum32_1,
|
|
367
|
-
sum32_3: sum32_3_1,
|
|
368
|
-
sum32_4: sum32_4_1,
|
|
369
|
-
sum32_5: sum32_5_1,
|
|
370
|
-
sum64: sum64_1,
|
|
371
|
-
sum64_hi: sum64_hi_1,
|
|
372
|
-
sum64_lo: sum64_lo_1,
|
|
373
|
-
sum64_4_hi: sum64_4_hi_1,
|
|
374
|
-
sum64_4_lo: sum64_4_lo_1,
|
|
375
|
-
sum64_5_hi: sum64_5_hi_1,
|
|
376
|
-
sum64_5_lo: sum64_5_lo_1,
|
|
377
|
-
rotr64_hi: rotr64_hi_1,
|
|
378
|
-
rotr64_lo: rotr64_lo_1,
|
|
379
|
-
shr64_hi: shr64_hi_1,
|
|
380
|
-
shr64_lo: shr64_lo_1
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
function BlockHash() {
|
|
407
|
+
var Mappings = function Mappings(hires) {
|
|
408
|
+
this.hires = hires;
|
|
409
|
+
this.generatedCodeLine = 0;
|
|
410
|
+
this.generatedCodeColumn = 0;
|
|
411
|
+
this.raw = [];
|
|
412
|
+
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
384
413
|
this.pending = null;
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
var BlockHash_1 = BlockHash;
|
|
395
|
-
BlockHash.prototype.update = function update(msg, enc) {
|
|
396
|
-
// Convert message to array, pad it, and join into 32bit blocks
|
|
397
|
-
msg = utils.toArray(msg, enc);
|
|
398
|
-
if (!this.pending)
|
|
399
|
-
this.pending = msg;
|
|
400
|
-
else
|
|
401
|
-
this.pending = this.pending.concat(msg);
|
|
402
|
-
this.pendingTotal += msg.length;
|
|
403
|
-
// Enough data, try updating
|
|
404
|
-
if (this.pending.length >= this._delta8) {
|
|
405
|
-
msg = this.pending;
|
|
406
|
-
// Process pending data in blocks
|
|
407
|
-
var r = msg.length % this._delta8;
|
|
408
|
-
this.pending = msg.slice(msg.length - r, msg.length);
|
|
409
|
-
if (this.pending.length === 0)
|
|
410
|
-
this.pending = null;
|
|
411
|
-
msg = utils.join32(msg, 0, msg.length - r, this.endian);
|
|
412
|
-
for (var i = 0; i < msg.length; i += this._delta32)
|
|
413
|
-
this._update(msg, i, i + this._delta32);
|
|
414
|
+
};
|
|
415
|
+
Mappings.prototype.addEdit = function addEdit(sourceIndex, content, loc, nameIndex) {
|
|
416
|
+
if (content.length) {
|
|
417
|
+
var segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
418
|
+
if (nameIndex >= 0) {
|
|
419
|
+
segment.push(nameIndex);
|
|
420
|
+
}
|
|
421
|
+
this.rawSegments.push(segment);
|
|
414
422
|
}
|
|
415
|
-
|
|
423
|
+
else if (this.pending) {
|
|
424
|
+
this.rawSegments.push(this.pending);
|
|
425
|
+
}
|
|
426
|
+
this.advance(content);
|
|
427
|
+
this.pending = null;
|
|
416
428
|
};
|
|
417
|
-
|
|
418
|
-
this
|
|
419
|
-
|
|
420
|
-
|
|
429
|
+
Mappings.prototype.addUneditedChunk = function addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
430
|
+
var this$1 = this;
|
|
431
|
+
var originalCharIndex = chunk.start;
|
|
432
|
+
var first = true;
|
|
433
|
+
while (originalCharIndex < chunk.end) {
|
|
434
|
+
if (this$1.hires || first || sourcemapLocations[originalCharIndex]) {
|
|
435
|
+
this$1.rawSegments.push([this$1.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
|
|
436
|
+
}
|
|
437
|
+
if (original[originalCharIndex] === '\n') {
|
|
438
|
+
loc.line += 1;
|
|
439
|
+
loc.column = 0;
|
|
440
|
+
this$1.generatedCodeLine += 1;
|
|
441
|
+
this$1.raw[this$1.generatedCodeLine] = this$1.rawSegments = [];
|
|
442
|
+
this$1.generatedCodeColumn = 0;
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
loc.column += 1;
|
|
446
|
+
this$1.generatedCodeColumn += 1;
|
|
447
|
+
}
|
|
448
|
+
originalCharIndex += 1;
|
|
449
|
+
first = false;
|
|
450
|
+
}
|
|
451
|
+
this.pending = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
421
452
|
};
|
|
422
|
-
|
|
423
|
-
var
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
var res = new Array(k + this.padLength);
|
|
427
|
-
res[0] = 0x80;
|
|
428
|
-
for (var i = 1; i < k; i++)
|
|
429
|
-
res[i] = 0;
|
|
430
|
-
// Append length
|
|
431
|
-
len <<= 3;
|
|
432
|
-
if (this.endian === 'big') {
|
|
433
|
-
for (var t = 8; t < this.padLength; t++)
|
|
434
|
-
res[i++] = 0;
|
|
435
|
-
res[i++] = 0;
|
|
436
|
-
res[i++] = 0;
|
|
437
|
-
res[i++] = 0;
|
|
438
|
-
res[i++] = 0;
|
|
439
|
-
res[i++] = (len >>> 24) & 0xff;
|
|
440
|
-
res[i++] = (len >>> 16) & 0xff;
|
|
441
|
-
res[i++] = (len >>> 8) & 0xff;
|
|
442
|
-
res[i++] = len & 0xff;
|
|
453
|
+
Mappings.prototype.advance = function advance(str) {
|
|
454
|
+
var this$1 = this;
|
|
455
|
+
if (!str) {
|
|
456
|
+
return;
|
|
443
457
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
res[i++] = 0;
|
|
452
|
-
res[i++] = 0;
|
|
453
|
-
for (t = 8; t < this.padLength; t++)
|
|
454
|
-
res[i++] = 0;
|
|
458
|
+
var lines = str.split('\n');
|
|
459
|
+
if (lines.length > 1) {
|
|
460
|
+
for (var i = 0; i < lines.length - 1; i++) {
|
|
461
|
+
this$1.generatedCodeLine++;
|
|
462
|
+
this$1.raw[this$1.generatedCodeLine] = this$1.rawSegments = [];
|
|
463
|
+
}
|
|
464
|
+
this.generatedCodeColumn = 0;
|
|
455
465
|
}
|
|
456
|
-
|
|
466
|
+
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
457
467
|
};
|
|
458
|
-
var
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
function ft_1(s, x, y, z) {
|
|
464
|
-
if (s === 0)
|
|
465
|
-
return ch32(x, y, z);
|
|
466
|
-
if (s === 1 || s === 3)
|
|
467
|
-
return p32(x, y, z);
|
|
468
|
-
if (s === 2)
|
|
469
|
-
return maj32(x, y, z);
|
|
470
|
-
}
|
|
471
|
-
var ft_1_1 = ft_1;
|
|
472
|
-
function ch32(x, y, z) {
|
|
473
|
-
return (x & y) ^ ((~x) & z);
|
|
474
|
-
}
|
|
475
|
-
var ch32_1 = ch32;
|
|
476
|
-
function maj32(x, y, z) {
|
|
477
|
-
return (x & y) ^ (x & z) ^ (y & z);
|
|
478
|
-
}
|
|
479
|
-
var maj32_1 = maj32;
|
|
480
|
-
function p32(x, y, z) {
|
|
481
|
-
return x ^ y ^ z;
|
|
482
|
-
}
|
|
483
|
-
var p32_1 = p32;
|
|
484
|
-
function s0_256(x) {
|
|
485
|
-
return rotr32$1(x, 2) ^ rotr32$1(x, 13) ^ rotr32$1(x, 22);
|
|
486
|
-
}
|
|
487
|
-
var s0_256_1 = s0_256;
|
|
488
|
-
function s1_256(x) {
|
|
489
|
-
return rotr32$1(x, 6) ^ rotr32$1(x, 11) ^ rotr32$1(x, 25);
|
|
490
|
-
}
|
|
491
|
-
var s1_256_1 = s1_256;
|
|
492
|
-
function g0_256(x) {
|
|
493
|
-
return rotr32$1(x, 7) ^ rotr32$1(x, 18) ^ (x >>> 3);
|
|
494
|
-
}
|
|
495
|
-
var g0_256_1 = g0_256;
|
|
496
|
-
function g1_256(x) {
|
|
497
|
-
return rotr32$1(x, 17) ^ rotr32$1(x, 19) ^ (x >>> 10);
|
|
498
|
-
}
|
|
499
|
-
var g1_256_1 = g1_256;
|
|
500
|
-
var common$1 = {
|
|
501
|
-
ft_1: ft_1_1,
|
|
502
|
-
ch32: ch32_1,
|
|
503
|
-
maj32: maj32_1,
|
|
504
|
-
p32: p32_1,
|
|
505
|
-
s0_256: s0_256_1,
|
|
506
|
-
s1_256: s1_256_1,
|
|
507
|
-
g0_256: g0_256_1,
|
|
508
|
-
g1_256: g1_256_1
|
|
509
|
-
};
|
|
510
|
-
|
|
511
|
-
var sum32$1 = utils.sum32;
|
|
512
|
-
var sum32_4$1 = utils.sum32_4;
|
|
513
|
-
var sum32_5$1 = utils.sum32_5;
|
|
514
|
-
var ch32$1 = common$1.ch32;
|
|
515
|
-
var maj32$1 = common$1.maj32;
|
|
516
|
-
var s0_256$1 = common$1.s0_256;
|
|
517
|
-
var s1_256$1 = common$1.s1_256;
|
|
518
|
-
var g0_256$1 = common$1.g0_256;
|
|
519
|
-
var g1_256$1 = common$1.g1_256;
|
|
520
|
-
var BlockHash$1 = common.BlockHash;
|
|
521
|
-
var sha256_K = [
|
|
522
|
-
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
|
523
|
-
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
524
|
-
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
|
525
|
-
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
526
|
-
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
|
|
527
|
-
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
528
|
-
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
|
|
529
|
-
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
530
|
-
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
|
531
|
-
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
532
|
-
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
|
|
533
|
-
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
534
|
-
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
|
|
535
|
-
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
536
|
-
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
|
537
|
-
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
|
538
|
-
];
|
|
539
|
-
function SHA256() {
|
|
540
|
-
if (!(this instanceof SHA256))
|
|
541
|
-
return new SHA256();
|
|
542
|
-
BlockHash$1.call(this);
|
|
543
|
-
this.h = [
|
|
544
|
-
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
|
|
545
|
-
0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
|
|
546
|
-
];
|
|
547
|
-
this.k = sha256_K;
|
|
548
|
-
this.W = new Array(64);
|
|
549
|
-
}
|
|
550
|
-
utils.inherits(SHA256, BlockHash$1);
|
|
551
|
-
var _256 = SHA256;
|
|
552
|
-
SHA256.blockSize = 512;
|
|
553
|
-
SHA256.outSize = 256;
|
|
554
|
-
SHA256.hmacStrength = 192;
|
|
555
|
-
SHA256.padLength = 64;
|
|
556
|
-
SHA256.prototype._update = function _update(msg, start) {
|
|
557
|
-
var W = this.W;
|
|
558
|
-
for (var i = 0; i < 16; i++)
|
|
559
|
-
W[i] = msg[start + i];
|
|
560
|
-
for (; i < W.length; i++)
|
|
561
|
-
W[i] = sum32_4$1(g1_256$1(W[i - 2]), W[i - 7], g0_256$1(W[i - 15]), W[i - 16]);
|
|
562
|
-
var a = this.h[0];
|
|
563
|
-
var b = this.h[1];
|
|
564
|
-
var c = this.h[2];
|
|
565
|
-
var d = this.h[3];
|
|
566
|
-
var e = this.h[4];
|
|
567
|
-
var f = this.h[5];
|
|
568
|
-
var g = this.h[6];
|
|
569
|
-
var h = this.h[7];
|
|
570
|
-
minimalisticAssert(this.k.length === W.length);
|
|
571
|
-
for (i = 0; i < W.length; i++) {
|
|
572
|
-
var T1 = sum32_5$1(h, s1_256$1(e), ch32$1(e, f, g), this.k[i], W[i]);
|
|
573
|
-
var T2 = sum32$1(s0_256$1(a), maj32$1(a, b, c));
|
|
574
|
-
h = g;
|
|
575
|
-
g = f;
|
|
576
|
-
f = e;
|
|
577
|
-
e = sum32$1(d, T1);
|
|
578
|
-
d = c;
|
|
579
|
-
c = b;
|
|
580
|
-
b = a;
|
|
581
|
-
a = sum32$1(T1, T2);
|
|
582
|
-
}
|
|
583
|
-
this.h[0] = sum32$1(this.h[0], a);
|
|
584
|
-
this.h[1] = sum32$1(this.h[1], b);
|
|
585
|
-
this.h[2] = sum32$1(this.h[2], c);
|
|
586
|
-
this.h[3] = sum32$1(this.h[3], d);
|
|
587
|
-
this.h[4] = sum32$1(this.h[4], e);
|
|
588
|
-
this.h[5] = sum32$1(this.h[5], f);
|
|
589
|
-
this.h[6] = sum32$1(this.h[6], g);
|
|
590
|
-
this.h[7] = sum32$1(this.h[7], h);
|
|
591
|
-
};
|
|
592
|
-
SHA256.prototype._digest = function digest(enc) {
|
|
593
|
-
if (enc === 'hex')
|
|
594
|
-
return utils.toHex32(this.h, 'big');
|
|
595
|
-
else
|
|
596
|
-
return utils.split32(this.h, 'big');
|
|
597
|
-
};
|
|
598
|
-
|
|
599
|
-
var charToInteger = {};
|
|
600
|
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
601
|
-
for (var i = 0; i < chars.length; i++) {
|
|
602
|
-
charToInteger[chars.charCodeAt(i)] = i;
|
|
603
|
-
}
|
|
604
|
-
function decode(mappings) {
|
|
605
|
-
var generatedCodeColumn = 0; // first field
|
|
606
|
-
var sourceFileIndex = 0; // second field
|
|
607
|
-
var sourceCodeLine = 0; // third field
|
|
608
|
-
var sourceCodeColumn = 0; // fourth field
|
|
609
|
-
var nameIndex = 0; // fifth field
|
|
610
|
-
var decoded = [];
|
|
611
|
-
var line = [];
|
|
612
|
-
var segment = [];
|
|
613
|
-
for (var i = 0, j = 0, shift = 0, value = 0, len = mappings.length; i < len; i++) {
|
|
614
|
-
var c = mappings.charCodeAt(i);
|
|
615
|
-
if (c === 44) { // ","
|
|
616
|
-
if (segment.length)
|
|
617
|
-
line.push(segment);
|
|
618
|
-
segment = [];
|
|
619
|
-
j = 0;
|
|
620
|
-
}
|
|
621
|
-
else if (c === 59) { // ";"
|
|
622
|
-
if (segment.length)
|
|
623
|
-
line.push(segment);
|
|
624
|
-
segment = [];
|
|
625
|
-
j = 0;
|
|
626
|
-
decoded.push(line);
|
|
627
|
-
line = [];
|
|
628
|
-
generatedCodeColumn = 0;
|
|
629
|
-
}
|
|
630
|
-
else {
|
|
631
|
-
var integer = charToInteger[c];
|
|
632
|
-
if (integer === undefined) {
|
|
633
|
-
throw new Error('Invalid character (' + String.fromCharCode(c) + ')');
|
|
634
|
-
}
|
|
635
|
-
var hasContinuationBit = integer & 32;
|
|
636
|
-
integer &= 31;
|
|
637
|
-
value += integer << shift;
|
|
638
|
-
if (hasContinuationBit) {
|
|
639
|
-
shift += 5;
|
|
640
|
-
}
|
|
641
|
-
else {
|
|
642
|
-
var shouldNegate = value & 1;
|
|
643
|
-
value >>>= 1;
|
|
644
|
-
if (shouldNegate) {
|
|
645
|
-
value = -value;
|
|
646
|
-
if (value === 0)
|
|
647
|
-
value = -0x80000000;
|
|
648
|
-
}
|
|
649
|
-
if (j == 0) {
|
|
650
|
-
generatedCodeColumn += value;
|
|
651
|
-
segment.push(generatedCodeColumn);
|
|
652
|
-
}
|
|
653
|
-
else if (j === 1) {
|
|
654
|
-
sourceFileIndex += value;
|
|
655
|
-
segment.push(sourceFileIndex);
|
|
656
|
-
}
|
|
657
|
-
else if (j === 2) {
|
|
658
|
-
sourceCodeLine += value;
|
|
659
|
-
segment.push(sourceCodeLine);
|
|
660
|
-
}
|
|
661
|
-
else if (j === 3) {
|
|
662
|
-
sourceCodeColumn += value;
|
|
663
|
-
segment.push(sourceCodeColumn);
|
|
664
|
-
}
|
|
665
|
-
else if (j === 4) {
|
|
666
|
-
nameIndex += value;
|
|
667
|
-
segment.push(nameIndex);
|
|
668
|
-
}
|
|
669
|
-
j++;
|
|
670
|
-
value = shift = 0; // reset
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
if (segment.length)
|
|
675
|
-
line.push(segment);
|
|
676
|
-
decoded.push(line);
|
|
677
|
-
return decoded;
|
|
678
|
-
}
|
|
679
|
-
function encode(decoded) {
|
|
680
|
-
var sourceFileIndex = 0; // second field
|
|
681
|
-
var sourceCodeLine = 0; // third field
|
|
682
|
-
var sourceCodeColumn = 0; // fourth field
|
|
683
|
-
var nameIndex = 0; // fifth field
|
|
684
|
-
var mappings = '';
|
|
685
|
-
for (var i = 0; i < decoded.length; i++) {
|
|
686
|
-
var line = decoded[i];
|
|
687
|
-
if (i > 0)
|
|
688
|
-
mappings += ';';
|
|
689
|
-
if (line.length === 0)
|
|
690
|
-
continue;
|
|
691
|
-
var generatedCodeColumn = 0; // first field
|
|
692
|
-
var lineMappings = [];
|
|
693
|
-
for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
|
|
694
|
-
var segment = line_1[_i];
|
|
695
|
-
var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
|
|
696
|
-
generatedCodeColumn = segment[0];
|
|
697
|
-
if (segment.length > 1) {
|
|
698
|
-
segmentMappings +=
|
|
699
|
-
encodeInteger(segment[1] - sourceFileIndex) +
|
|
700
|
-
encodeInteger(segment[2] - sourceCodeLine) +
|
|
701
|
-
encodeInteger(segment[3] - sourceCodeColumn);
|
|
702
|
-
sourceFileIndex = segment[1];
|
|
703
|
-
sourceCodeLine = segment[2];
|
|
704
|
-
sourceCodeColumn = segment[3];
|
|
705
|
-
}
|
|
706
|
-
if (segment.length === 5) {
|
|
707
|
-
segmentMappings += encodeInteger(segment[4] - nameIndex);
|
|
708
|
-
nameIndex = segment[4];
|
|
709
|
-
}
|
|
710
|
-
lineMappings.push(segmentMappings);
|
|
711
|
-
}
|
|
712
|
-
mappings += lineMappings.join(',');
|
|
713
|
-
}
|
|
714
|
-
return mappings;
|
|
715
|
-
}
|
|
716
|
-
function encodeInteger(num) {
|
|
717
|
-
var result = '';
|
|
718
|
-
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
719
|
-
do {
|
|
720
|
-
var clamped = num & 31;
|
|
721
|
-
num >>>= 5;
|
|
722
|
-
if (num > 0) {
|
|
723
|
-
clamped |= 32;
|
|
724
|
-
}
|
|
725
|
-
result += chars[clamped];
|
|
726
|
-
} while (num > 0);
|
|
727
|
-
return result;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
var Chunk = function Chunk(start, end, content) {
|
|
731
|
-
this.start = start;
|
|
732
|
-
this.end = end;
|
|
733
|
-
this.original = content;
|
|
734
|
-
this.intro = '';
|
|
735
|
-
this.outro = '';
|
|
736
|
-
this.content = content;
|
|
737
|
-
this.storeName = false;
|
|
738
|
-
this.edited = false;
|
|
739
|
-
// we make these non-enumerable, for sanity while debugging
|
|
740
|
-
Object.defineProperties(this, {
|
|
741
|
-
previous: { writable: true, value: null },
|
|
742
|
-
next: { writable: true, value: null }
|
|
743
|
-
});
|
|
744
|
-
};
|
|
745
|
-
Chunk.prototype.appendLeft = function appendLeft(content) {
|
|
746
|
-
this.outro += content;
|
|
747
|
-
};
|
|
748
|
-
Chunk.prototype.appendRight = function appendRight(content) {
|
|
749
|
-
this.intro = this.intro + content;
|
|
750
|
-
};
|
|
751
|
-
Chunk.prototype.clone = function clone() {
|
|
752
|
-
var chunk = new Chunk(this.start, this.end, this.original);
|
|
753
|
-
chunk.intro = this.intro;
|
|
754
|
-
chunk.outro = this.outro;
|
|
755
|
-
chunk.content = this.content;
|
|
756
|
-
chunk.storeName = this.storeName;
|
|
757
|
-
chunk.edited = this.edited;
|
|
758
|
-
return chunk;
|
|
759
|
-
};
|
|
760
|
-
Chunk.prototype.contains = function contains(index) {
|
|
761
|
-
return this.start < index && index < this.end;
|
|
762
|
-
};
|
|
763
|
-
Chunk.prototype.eachNext = function eachNext(fn) {
|
|
764
|
-
var chunk = this;
|
|
765
|
-
while (chunk) {
|
|
766
|
-
fn(chunk);
|
|
767
|
-
chunk = chunk.next;
|
|
768
|
-
}
|
|
769
|
-
};
|
|
770
|
-
Chunk.prototype.eachPrevious = function eachPrevious(fn) {
|
|
771
|
-
var chunk = this;
|
|
772
|
-
while (chunk) {
|
|
773
|
-
fn(chunk);
|
|
774
|
-
chunk = chunk.previous;
|
|
775
|
-
}
|
|
776
|
-
};
|
|
777
|
-
Chunk.prototype.edit = function edit(content, storeName, contentOnly) {
|
|
778
|
-
this.content = content;
|
|
779
|
-
if (!contentOnly) {
|
|
780
|
-
this.intro = '';
|
|
781
|
-
this.outro = '';
|
|
782
|
-
}
|
|
783
|
-
this.storeName = storeName;
|
|
784
|
-
this.edited = true;
|
|
785
|
-
return this;
|
|
786
|
-
};
|
|
787
|
-
Chunk.prototype.prependLeft = function prependLeft(content) {
|
|
788
|
-
this.outro = content + this.outro;
|
|
789
|
-
};
|
|
790
|
-
Chunk.prototype.prependRight = function prependRight(content) {
|
|
791
|
-
this.intro = content + this.intro;
|
|
792
|
-
};
|
|
793
|
-
Chunk.prototype.split = function split(index) {
|
|
794
|
-
var sliceIndex = index - this.start;
|
|
795
|
-
var originalBefore = this.original.slice(0, sliceIndex);
|
|
796
|
-
var originalAfter = this.original.slice(sliceIndex);
|
|
797
|
-
this.original = originalBefore;
|
|
798
|
-
var newChunk = new Chunk(index, this.end, originalAfter);
|
|
799
|
-
newChunk.outro = this.outro;
|
|
800
|
-
this.outro = '';
|
|
801
|
-
this.end = index;
|
|
802
|
-
if (this.edited) {
|
|
803
|
-
// TODO is this block necessary?...
|
|
804
|
-
newChunk.edit('', false);
|
|
805
|
-
this.content = '';
|
|
806
|
-
}
|
|
807
|
-
else {
|
|
808
|
-
this.content = originalBefore;
|
|
809
|
-
}
|
|
810
|
-
newChunk.next = this.next;
|
|
811
|
-
if (newChunk.next) {
|
|
812
|
-
newChunk.next.previous = newChunk;
|
|
813
|
-
}
|
|
814
|
-
newChunk.previous = this;
|
|
815
|
-
this.next = newChunk;
|
|
816
|
-
return newChunk;
|
|
817
|
-
};
|
|
818
|
-
Chunk.prototype.toString = function toString() {
|
|
819
|
-
return this.intro + this.content + this.outro;
|
|
820
|
-
};
|
|
821
|
-
Chunk.prototype.trimEnd = function trimEnd(rx) {
|
|
822
|
-
this.outro = this.outro.replace(rx, '');
|
|
823
|
-
if (this.outro.length) {
|
|
824
|
-
return true;
|
|
825
|
-
}
|
|
826
|
-
var trimmed = this.content.replace(rx, '');
|
|
827
|
-
if (trimmed.length) {
|
|
828
|
-
if (trimmed !== this.content) {
|
|
829
|
-
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
830
|
-
}
|
|
831
|
-
return true;
|
|
832
|
-
}
|
|
833
|
-
else {
|
|
834
|
-
this.edit('', undefined, true);
|
|
835
|
-
this.intro = this.intro.replace(rx, '');
|
|
836
|
-
if (this.intro.length) {
|
|
837
|
-
return true;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
};
|
|
841
|
-
Chunk.prototype.trimStart = function trimStart(rx) {
|
|
842
|
-
this.intro = this.intro.replace(rx, '');
|
|
843
|
-
if (this.intro.length) {
|
|
844
|
-
return true;
|
|
845
|
-
}
|
|
846
|
-
var trimmed = this.content.replace(rx, '');
|
|
847
|
-
if (trimmed.length) {
|
|
848
|
-
if (trimmed !== this.content) {
|
|
849
|
-
this.split(this.end - trimmed.length);
|
|
850
|
-
this.edit('', undefined, true);
|
|
851
|
-
}
|
|
852
|
-
return true;
|
|
853
|
-
}
|
|
854
|
-
else {
|
|
855
|
-
this.edit('', undefined, true);
|
|
856
|
-
this.outro = this.outro.replace(rx, '');
|
|
857
|
-
if (this.outro.length) {
|
|
858
|
-
return true;
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
};
|
|
862
|
-
var btoa = function () {
|
|
863
|
-
throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
|
|
864
|
-
};
|
|
865
|
-
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
|
|
866
|
-
btoa = function (str) { return window.btoa(unescape(encodeURIComponent(str))); };
|
|
867
|
-
}
|
|
868
|
-
else if (typeof Buffer === 'function') {
|
|
869
|
-
btoa = function (str) { return Buffer.from(str, 'utf-8').toString('base64'); };
|
|
870
|
-
}
|
|
871
|
-
var SourceMap = function SourceMap(properties) {
|
|
872
|
-
this.version = 3;
|
|
873
|
-
this.file = properties.file;
|
|
874
|
-
this.sources = properties.sources;
|
|
875
|
-
this.sourcesContent = properties.sourcesContent;
|
|
876
|
-
this.names = properties.names;
|
|
877
|
-
this.mappings = encode(properties.mappings);
|
|
878
|
-
};
|
|
879
|
-
SourceMap.prototype.toString = function toString() {
|
|
880
|
-
return JSON.stringify(this);
|
|
881
|
-
};
|
|
882
|
-
SourceMap.prototype.toUrl = function toUrl() {
|
|
883
|
-
return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());
|
|
884
|
-
};
|
|
885
|
-
function guessIndent(code) {
|
|
886
|
-
var lines = code.split('\n');
|
|
887
|
-
var tabbed = lines.filter(function (line) { return /^\t+/.test(line); });
|
|
888
|
-
var spaced = lines.filter(function (line) { return /^ {2,}/.test(line); });
|
|
889
|
-
if (tabbed.length === 0 && spaced.length === 0) {
|
|
890
|
-
return null;
|
|
891
|
-
}
|
|
892
|
-
// More lines tabbed than spaced? Assume tabs, and
|
|
893
|
-
// default to tabs in the case of a tie (or nothing
|
|
894
|
-
// to go on)
|
|
895
|
-
if (tabbed.length >= spaced.length) {
|
|
896
|
-
return '\t';
|
|
897
|
-
}
|
|
898
|
-
// Otherwise, we need to guess the multiple
|
|
899
|
-
var min = spaced.reduce(function (previous, current) {
|
|
900
|
-
var numSpaces = /^ +/.exec(current)[0].length;
|
|
901
|
-
return Math.min(numSpaces, previous);
|
|
902
|
-
}, Infinity);
|
|
903
|
-
return new Array(min + 1).join(' ');
|
|
904
|
-
}
|
|
905
|
-
function getRelativePath(from, to) {
|
|
906
|
-
var fromParts = from.split(/[/\\]/);
|
|
907
|
-
var toParts = to.split(/[/\\]/);
|
|
908
|
-
fromParts.pop(); // get dirname
|
|
909
|
-
while (fromParts[0] === toParts[0]) {
|
|
910
|
-
fromParts.shift();
|
|
911
|
-
toParts.shift();
|
|
912
|
-
}
|
|
913
|
-
if (fromParts.length) {
|
|
914
|
-
var i = fromParts.length;
|
|
915
|
-
while (i--) {
|
|
916
|
-
fromParts[i] = '..';
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
return fromParts.concat(toParts).join('/');
|
|
920
|
-
}
|
|
921
|
-
var toString = Object.prototype.toString;
|
|
922
|
-
function isObject(thing) {
|
|
923
|
-
return toString.call(thing) === '[object Object]';
|
|
924
|
-
}
|
|
925
|
-
function getLocator(source) {
|
|
926
|
-
var originalLines = source.split('\n');
|
|
927
|
-
var lineOffsets = [];
|
|
928
|
-
for (var i = 0, pos = 0; i < originalLines.length; i++) {
|
|
929
|
-
lineOffsets.push(pos);
|
|
930
|
-
pos += originalLines[i].length + 1;
|
|
931
|
-
}
|
|
932
|
-
return function locate(index) {
|
|
933
|
-
var i = 0;
|
|
934
|
-
var j = lineOffsets.length;
|
|
935
|
-
while (i < j) {
|
|
936
|
-
var m = (i + j) >> 1;
|
|
937
|
-
if (index < lineOffsets[m]) {
|
|
938
|
-
j = m;
|
|
939
|
-
}
|
|
940
|
-
else {
|
|
941
|
-
i = m + 1;
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
var line = i - 1;
|
|
945
|
-
var column = index - lineOffsets[line];
|
|
946
|
-
return { line: line, column: column };
|
|
947
|
-
};
|
|
948
|
-
}
|
|
949
|
-
var Mappings = function Mappings(hires) {
|
|
950
|
-
this.hires = hires;
|
|
951
|
-
this.generatedCodeLine = 0;
|
|
952
|
-
this.generatedCodeColumn = 0;
|
|
953
|
-
this.raw = [];
|
|
954
|
-
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
955
|
-
this.pending = null;
|
|
956
|
-
};
|
|
957
|
-
Mappings.prototype.addEdit = function addEdit(sourceIndex, content, loc, nameIndex) {
|
|
958
|
-
if (content.length) {
|
|
959
|
-
var segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
960
|
-
if (nameIndex >= 0) {
|
|
961
|
-
segment.push(nameIndex);
|
|
962
|
-
}
|
|
963
|
-
this.rawSegments.push(segment);
|
|
964
|
-
}
|
|
965
|
-
else if (this.pending) {
|
|
966
|
-
this.rawSegments.push(this.pending);
|
|
967
|
-
}
|
|
968
|
-
this.advance(content);
|
|
969
|
-
this.pending = null;
|
|
970
|
-
};
|
|
971
|
-
Mappings.prototype.addUneditedChunk = function addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
972
|
-
var this$1 = this;
|
|
973
|
-
var originalCharIndex = chunk.start;
|
|
974
|
-
var first = true;
|
|
975
|
-
while (originalCharIndex < chunk.end) {
|
|
976
|
-
if (this$1.hires || first || sourcemapLocations[originalCharIndex]) {
|
|
977
|
-
this$1.rawSegments.push([this$1.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
|
|
978
|
-
}
|
|
979
|
-
if (original[originalCharIndex] === '\n') {
|
|
980
|
-
loc.line += 1;
|
|
981
|
-
loc.column = 0;
|
|
982
|
-
this$1.generatedCodeLine += 1;
|
|
983
|
-
this$1.raw[this$1.generatedCodeLine] = this$1.rawSegments = [];
|
|
984
|
-
this$1.generatedCodeColumn = 0;
|
|
985
|
-
}
|
|
986
|
-
else {
|
|
987
|
-
loc.column += 1;
|
|
988
|
-
this$1.generatedCodeColumn += 1;
|
|
989
|
-
}
|
|
990
|
-
originalCharIndex += 1;
|
|
991
|
-
first = false;
|
|
992
|
-
}
|
|
993
|
-
this.pending = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
994
|
-
};
|
|
995
|
-
Mappings.prototype.advance = function advance(str) {
|
|
996
|
-
var this$1 = this;
|
|
997
|
-
if (!str) {
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
var lines = str.split('\n');
|
|
1001
|
-
if (lines.length > 1) {
|
|
1002
|
-
for (var i = 0; i < lines.length - 1; i++) {
|
|
1003
|
-
this$1.generatedCodeLine++;
|
|
1004
|
-
this$1.raw[this$1.generatedCodeLine] = this$1.rawSegments = [];
|
|
1005
|
-
}
|
|
1006
|
-
this.generatedCodeColumn = 0;
|
|
1007
|
-
}
|
|
1008
|
-
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
1009
|
-
};
|
|
1010
|
-
var n = '\n';
|
|
1011
|
-
var warned = {
|
|
1012
|
-
insertLeft: false,
|
|
1013
|
-
insertRight: false,
|
|
1014
|
-
storeName: false
|
|
468
|
+
var n = '\n';
|
|
469
|
+
var warned = {
|
|
470
|
+
insertLeft: false,
|
|
471
|
+
insertRight: false,
|
|
472
|
+
storeName: false
|
|
1015
473
|
};
|
|
1016
474
|
var MagicString = function MagicString(string, options) {
|
|
1017
475
|
if (options === void 0)
|
|
@@ -1712,162 +1170,707 @@ Bundle.prototype.generateDecodedMap = function generateDecodedMap(options) {
|
|
|
1712
1170
|
if (this.intro) {
|
|
1713
1171
|
mappings.advance(this.intro);
|
|
1714
1172
|
}
|
|
1715
|
-
this.sources.forEach(function (source, i) {
|
|
1716
|
-
if (i > 0) {
|
|
1717
|
-
mappings.advance(this$1.separator);
|
|
1718
|
-
}
|
|
1719
|
-
var sourceIndex = source.filename ? this$1.uniqueSourceIndexByFilename[source.filename] : -1;
|
|
1720
|
-
var magicString = source.content;
|
|
1721
|
-
var locate = getLocator(magicString.original);
|
|
1722
|
-
if (magicString.intro) {
|
|
1723
|
-
mappings.advance(magicString.intro);
|
|
1724
|
-
}
|
|
1725
|
-
magicString.firstChunk.eachNext(function (chunk) {
|
|
1726
|
-
var loc = locate(chunk.start);
|
|
1727
|
-
if (chunk.intro.length) {
|
|
1728
|
-
mappings.advance(chunk.intro);
|
|
1729
|
-
}
|
|
1730
|
-
if (source.filename) {
|
|
1731
|
-
if (chunk.edited) {
|
|
1732
|
-
mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);
|
|
1173
|
+
this.sources.forEach(function (source, i) {
|
|
1174
|
+
if (i > 0) {
|
|
1175
|
+
mappings.advance(this$1.separator);
|
|
1176
|
+
}
|
|
1177
|
+
var sourceIndex = source.filename ? this$1.uniqueSourceIndexByFilename[source.filename] : -1;
|
|
1178
|
+
var magicString = source.content;
|
|
1179
|
+
var locate = getLocator(magicString.original);
|
|
1180
|
+
if (magicString.intro) {
|
|
1181
|
+
mappings.advance(magicString.intro);
|
|
1182
|
+
}
|
|
1183
|
+
magicString.firstChunk.eachNext(function (chunk) {
|
|
1184
|
+
var loc = locate(chunk.start);
|
|
1185
|
+
if (chunk.intro.length) {
|
|
1186
|
+
mappings.advance(chunk.intro);
|
|
1187
|
+
}
|
|
1188
|
+
if (source.filename) {
|
|
1189
|
+
if (chunk.edited) {
|
|
1190
|
+
mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);
|
|
1191
|
+
}
|
|
1192
|
+
else {
|
|
1193
|
+
mappings.addUneditedChunk(sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
else {
|
|
1197
|
+
mappings.advance(chunk.content);
|
|
1198
|
+
}
|
|
1199
|
+
if (chunk.outro.length) {
|
|
1200
|
+
mappings.advance(chunk.outro);
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
if (magicString.outro) {
|
|
1204
|
+
mappings.advance(magicString.outro);
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
return {
|
|
1208
|
+
file: options.file ? options.file.split(/[/\\]/).pop() : null,
|
|
1209
|
+
sources: this.uniqueSources.map(function (source) {
|
|
1210
|
+
return options.file ? getRelativePath(options.file, source.filename) : source.filename;
|
|
1211
|
+
}),
|
|
1212
|
+
sourcesContent: this.uniqueSources.map(function (source) {
|
|
1213
|
+
return options.includeContent ? source.content : null;
|
|
1214
|
+
}),
|
|
1215
|
+
names: names,
|
|
1216
|
+
mappings: mappings.raw
|
|
1217
|
+
};
|
|
1218
|
+
};
|
|
1219
|
+
Bundle.prototype.generateMap = function generateMap(options) {
|
|
1220
|
+
return new SourceMap(this.generateDecodedMap(options));
|
|
1221
|
+
};
|
|
1222
|
+
Bundle.prototype.getIndentString = function getIndentString() {
|
|
1223
|
+
var indentStringCounts = {};
|
|
1224
|
+
this.sources.forEach(function (source) {
|
|
1225
|
+
var indentStr = source.content.indentStr;
|
|
1226
|
+
if (indentStr === null) {
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
if (!indentStringCounts[indentStr]) {
|
|
1230
|
+
indentStringCounts[indentStr] = 0;
|
|
1231
|
+
}
|
|
1232
|
+
indentStringCounts[indentStr] += 1;
|
|
1233
|
+
});
|
|
1234
|
+
return (Object.keys(indentStringCounts).sort(function (a, b) {
|
|
1235
|
+
return indentStringCounts[a] - indentStringCounts[b];
|
|
1236
|
+
})[0] || '\t');
|
|
1237
|
+
};
|
|
1238
|
+
Bundle.prototype.indent = function indent(indentStr) {
|
|
1239
|
+
var this$1 = this;
|
|
1240
|
+
if (!arguments.length) {
|
|
1241
|
+
indentStr = this.getIndentString();
|
|
1242
|
+
}
|
|
1243
|
+
if (indentStr === '') {
|
|
1244
|
+
return this;
|
|
1245
|
+
} // noop
|
|
1246
|
+
var trailingNewline = !this.intro || this.intro.slice(-1) === '\n';
|
|
1247
|
+
this.sources.forEach(function (source, i) {
|
|
1248
|
+
var separator = source.separator !== undefined ? source.separator : this$1.separator;
|
|
1249
|
+
var indentStart = trailingNewline || (i > 0 && /\r?\n$/.test(separator));
|
|
1250
|
+
source.content.indent(indentStr, {
|
|
1251
|
+
exclude: source.indentExclusionRanges,
|
|
1252
|
+
indentStart: indentStart //: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator )
|
|
1253
|
+
});
|
|
1254
|
+
trailingNewline = source.content.lastChar() === '\n';
|
|
1255
|
+
});
|
|
1256
|
+
if (this.intro) {
|
|
1257
|
+
this.intro =
|
|
1258
|
+
indentStr +
|
|
1259
|
+
this.intro.replace(/^[^\n]/gm, function (match, index) {
|
|
1260
|
+
return index > 0 ? indentStr + match : match;
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
return this;
|
|
1264
|
+
};
|
|
1265
|
+
Bundle.prototype.prepend = function prepend(str) {
|
|
1266
|
+
this.intro = str + this.intro;
|
|
1267
|
+
return this;
|
|
1268
|
+
};
|
|
1269
|
+
Bundle.prototype.toString = function toString() {
|
|
1270
|
+
var this$1 = this;
|
|
1271
|
+
var body = this.sources
|
|
1272
|
+
.map(function (source, i) {
|
|
1273
|
+
var separator = source.separator !== undefined ? source.separator : this$1.separator;
|
|
1274
|
+
var str = (i > 0 ? separator : '') + source.content.toString();
|
|
1275
|
+
return str;
|
|
1276
|
+
})
|
|
1277
|
+
.join('');
|
|
1278
|
+
return this.intro + body;
|
|
1279
|
+
};
|
|
1280
|
+
Bundle.prototype.isEmpty = function isEmpty() {
|
|
1281
|
+
if (this.intro.length && this.intro.trim()) {
|
|
1282
|
+
return false;
|
|
1283
|
+
}
|
|
1284
|
+
if (this.sources.some(function (source) { return !source.content.isEmpty(); })) {
|
|
1285
|
+
return false;
|
|
1286
|
+
}
|
|
1287
|
+
return true;
|
|
1288
|
+
};
|
|
1289
|
+
Bundle.prototype.length = function length() {
|
|
1290
|
+
return this.sources.reduce(function (length, source) { return length + source.content.length(); }, this.intro.length);
|
|
1291
|
+
};
|
|
1292
|
+
Bundle.prototype.trimLines = function trimLines() {
|
|
1293
|
+
return this.trim('[\\r\\n]');
|
|
1294
|
+
};
|
|
1295
|
+
Bundle.prototype.trim = function trim(charType) {
|
|
1296
|
+
return this.trimStart(charType).trimEnd(charType);
|
|
1297
|
+
};
|
|
1298
|
+
Bundle.prototype.trimStart = function trimStart(charType) {
|
|
1299
|
+
var this$1 = this;
|
|
1300
|
+
var rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
1301
|
+
this.intro = this.intro.replace(rx, '');
|
|
1302
|
+
if (!this.intro) {
|
|
1303
|
+
var source;
|
|
1304
|
+
var i = 0;
|
|
1305
|
+
do {
|
|
1306
|
+
source = this$1.sources[i++];
|
|
1307
|
+
if (!source) {
|
|
1308
|
+
break;
|
|
1309
|
+
}
|
|
1310
|
+
} while (!source.content.trimStartAborted(charType));
|
|
1311
|
+
}
|
|
1312
|
+
return this;
|
|
1313
|
+
};
|
|
1314
|
+
Bundle.prototype.trimEnd = function trimEnd(charType) {
|
|
1315
|
+
var this$1 = this;
|
|
1316
|
+
var rx = new RegExp((charType || '\\s') + '+$');
|
|
1317
|
+
var source;
|
|
1318
|
+
var i = this.sources.length - 1;
|
|
1319
|
+
do {
|
|
1320
|
+
source = this$1.sources[i--];
|
|
1321
|
+
if (!source) {
|
|
1322
|
+
this$1.intro = this$1.intro.replace(rx, '');
|
|
1323
|
+
break;
|
|
1324
|
+
}
|
|
1325
|
+
} while (!source.content.trimEndAborted(charType));
|
|
1326
|
+
return this;
|
|
1327
|
+
};
|
|
1328
|
+
|
|
1329
|
+
var minimalisticAssert = assert;
|
|
1330
|
+
function assert(val, msg) {
|
|
1331
|
+
if (!val)
|
|
1332
|
+
throw new Error(msg || 'Assertion failed');
|
|
1333
|
+
}
|
|
1334
|
+
assert.equal = function assertEqual(l, r, msg) {
|
|
1335
|
+
if (l != r)
|
|
1336
|
+
throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1339
|
+
var inherits_browser = index.createCommonjsModule(function (module) {
|
|
1340
|
+
if (typeof Object.create === 'function') {
|
|
1341
|
+
// implementation from standard node.js 'util' module
|
|
1342
|
+
module.exports = function inherits(ctor, superCtor) {
|
|
1343
|
+
ctor.super_ = superCtor;
|
|
1344
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
|
1345
|
+
constructor: {
|
|
1346
|
+
value: ctor,
|
|
1347
|
+
enumerable: false,
|
|
1348
|
+
writable: true,
|
|
1349
|
+
configurable: true
|
|
1350
|
+
}
|
|
1351
|
+
});
|
|
1352
|
+
};
|
|
1353
|
+
}
|
|
1354
|
+
else {
|
|
1355
|
+
// old school shim for old browsers
|
|
1356
|
+
module.exports = function inherits(ctor, superCtor) {
|
|
1357
|
+
ctor.super_ = superCtor;
|
|
1358
|
+
var TempCtor = function () { };
|
|
1359
|
+
TempCtor.prototype = superCtor.prototype;
|
|
1360
|
+
ctor.prototype = new TempCtor();
|
|
1361
|
+
ctor.prototype.constructor = ctor;
|
|
1362
|
+
};
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
|
|
1366
|
+
var inherits = index.createCommonjsModule(function (module) {
|
|
1367
|
+
try {
|
|
1368
|
+
var util$1 = util;
|
|
1369
|
+
if (typeof util$1.inherits !== 'function')
|
|
1370
|
+
throw '';
|
|
1371
|
+
module.exports = util$1.inherits;
|
|
1372
|
+
}
|
|
1373
|
+
catch (e) {
|
|
1374
|
+
module.exports = inherits_browser;
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
|
|
1378
|
+
var inherits_1 = inherits;
|
|
1379
|
+
function isSurrogatePair(msg, i) {
|
|
1380
|
+
if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
|
|
1381
|
+
return false;
|
|
1382
|
+
}
|
|
1383
|
+
if (i < 0 || i + 1 >= msg.length) {
|
|
1384
|
+
return false;
|
|
1385
|
+
}
|
|
1386
|
+
return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
|
|
1387
|
+
}
|
|
1388
|
+
function toArray(msg, enc) {
|
|
1389
|
+
if (Array.isArray(msg))
|
|
1390
|
+
return msg.slice();
|
|
1391
|
+
if (!msg)
|
|
1392
|
+
return [];
|
|
1393
|
+
var res = [];
|
|
1394
|
+
if (typeof msg === 'string') {
|
|
1395
|
+
if (!enc) {
|
|
1396
|
+
// Inspired by stringToUtf8ByteArray() in closure-library by Google
|
|
1397
|
+
// https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
|
|
1398
|
+
// Apache License 2.0
|
|
1399
|
+
// https://github.com/google/closure-library/blob/master/LICENSE
|
|
1400
|
+
var p = 0;
|
|
1401
|
+
for (var i = 0; i < msg.length; i++) {
|
|
1402
|
+
var c = msg.charCodeAt(i);
|
|
1403
|
+
if (c < 128) {
|
|
1404
|
+
res[p++] = c;
|
|
1405
|
+
}
|
|
1406
|
+
else if (c < 2048) {
|
|
1407
|
+
res[p++] = (c >> 6) | 192;
|
|
1408
|
+
res[p++] = (c & 63) | 128;
|
|
1409
|
+
}
|
|
1410
|
+
else if (isSurrogatePair(msg, i)) {
|
|
1411
|
+
c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);
|
|
1412
|
+
res[p++] = (c >> 18) | 240;
|
|
1413
|
+
res[p++] = ((c >> 12) & 63) | 128;
|
|
1414
|
+
res[p++] = ((c >> 6) & 63) | 128;
|
|
1415
|
+
res[p++] = (c & 63) | 128;
|
|
1733
1416
|
}
|
|
1734
1417
|
else {
|
|
1735
|
-
|
|
1418
|
+
res[p++] = (c >> 12) | 224;
|
|
1419
|
+
res[p++] = ((c >> 6) & 63) | 128;
|
|
1420
|
+
res[p++] = (c & 63) | 128;
|
|
1736
1421
|
}
|
|
1737
1422
|
}
|
|
1738
|
-
else {
|
|
1739
|
-
mappings.advance(chunk.content);
|
|
1740
|
-
}
|
|
1741
|
-
if (chunk.outro.length) {
|
|
1742
|
-
mappings.advance(chunk.outro);
|
|
1743
|
-
}
|
|
1744
|
-
});
|
|
1745
|
-
if (magicString.outro) {
|
|
1746
|
-
mappings.advance(magicString.outro);
|
|
1747
1423
|
}
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
sourcesContent: this.uniqueSources.map(function (source) {
|
|
1755
|
-
return options.includeContent ? source.content : null;
|
|
1756
|
-
}),
|
|
1757
|
-
names: names,
|
|
1758
|
-
mappings: mappings.raw
|
|
1759
|
-
};
|
|
1760
|
-
};
|
|
1761
|
-
Bundle.prototype.generateMap = function generateMap(options) {
|
|
1762
|
-
return new SourceMap(this.generateDecodedMap(options));
|
|
1763
|
-
};
|
|
1764
|
-
Bundle.prototype.getIndentString = function getIndentString() {
|
|
1765
|
-
var indentStringCounts = {};
|
|
1766
|
-
this.sources.forEach(function (source) {
|
|
1767
|
-
var indentStr = source.content.indentStr;
|
|
1768
|
-
if (indentStr === null) {
|
|
1769
|
-
return;
|
|
1424
|
+
else if (enc === 'hex') {
|
|
1425
|
+
msg = msg.replace(/[^a-z0-9]+/ig, '');
|
|
1426
|
+
if (msg.length % 2 !== 0)
|
|
1427
|
+
msg = '0' + msg;
|
|
1428
|
+
for (i = 0; i < msg.length; i += 2)
|
|
1429
|
+
res.push(parseInt(msg[i] + msg[i + 1], 16));
|
|
1770
1430
|
}
|
|
1771
|
-
|
|
1772
|
-
|
|
1431
|
+
}
|
|
1432
|
+
else {
|
|
1433
|
+
for (i = 0; i < msg.length; i++)
|
|
1434
|
+
res[i] = msg[i] | 0;
|
|
1435
|
+
}
|
|
1436
|
+
return res;
|
|
1437
|
+
}
|
|
1438
|
+
var toArray_1 = toArray;
|
|
1439
|
+
function toHex(msg) {
|
|
1440
|
+
var res = '';
|
|
1441
|
+
for (var i = 0; i < msg.length; i++)
|
|
1442
|
+
res += zero2(msg[i].toString(16));
|
|
1443
|
+
return res;
|
|
1444
|
+
}
|
|
1445
|
+
var toHex_1 = toHex;
|
|
1446
|
+
function htonl(w) {
|
|
1447
|
+
var res = (w >>> 24) |
|
|
1448
|
+
((w >>> 8) & 0xff00) |
|
|
1449
|
+
((w << 8) & 0xff0000) |
|
|
1450
|
+
((w & 0xff) << 24);
|
|
1451
|
+
return res >>> 0;
|
|
1452
|
+
}
|
|
1453
|
+
var htonl_1 = htonl;
|
|
1454
|
+
function toHex32(msg, endian) {
|
|
1455
|
+
var res = '';
|
|
1456
|
+
for (var i = 0; i < msg.length; i++) {
|
|
1457
|
+
var w = msg[i];
|
|
1458
|
+
if (endian === 'little')
|
|
1459
|
+
w = htonl(w);
|
|
1460
|
+
res += zero8(w.toString(16));
|
|
1461
|
+
}
|
|
1462
|
+
return res;
|
|
1463
|
+
}
|
|
1464
|
+
var toHex32_1 = toHex32;
|
|
1465
|
+
function zero2(word) {
|
|
1466
|
+
if (word.length === 1)
|
|
1467
|
+
return '0' + word;
|
|
1468
|
+
else
|
|
1469
|
+
return word;
|
|
1470
|
+
}
|
|
1471
|
+
var zero2_1 = zero2;
|
|
1472
|
+
function zero8(word) {
|
|
1473
|
+
if (word.length === 7)
|
|
1474
|
+
return '0' + word;
|
|
1475
|
+
else if (word.length === 6)
|
|
1476
|
+
return '00' + word;
|
|
1477
|
+
else if (word.length === 5)
|
|
1478
|
+
return '000' + word;
|
|
1479
|
+
else if (word.length === 4)
|
|
1480
|
+
return '0000' + word;
|
|
1481
|
+
else if (word.length === 3)
|
|
1482
|
+
return '00000' + word;
|
|
1483
|
+
else if (word.length === 2)
|
|
1484
|
+
return '000000' + word;
|
|
1485
|
+
else if (word.length === 1)
|
|
1486
|
+
return '0000000' + word;
|
|
1487
|
+
else
|
|
1488
|
+
return word;
|
|
1489
|
+
}
|
|
1490
|
+
var zero8_1 = zero8;
|
|
1491
|
+
function join32(msg, start, end, endian) {
|
|
1492
|
+
var len = end - start;
|
|
1493
|
+
minimalisticAssert(len % 4 === 0);
|
|
1494
|
+
var res = new Array(len / 4);
|
|
1495
|
+
for (var i = 0, k = start; i < res.length; i++, k += 4) {
|
|
1496
|
+
var w;
|
|
1497
|
+
if (endian === 'big')
|
|
1498
|
+
w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
|
|
1499
|
+
else
|
|
1500
|
+
w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
|
|
1501
|
+
res[i] = w >>> 0;
|
|
1502
|
+
}
|
|
1503
|
+
return res;
|
|
1504
|
+
}
|
|
1505
|
+
var join32_1 = join32;
|
|
1506
|
+
function split32(msg, endian) {
|
|
1507
|
+
var res = new Array(msg.length * 4);
|
|
1508
|
+
for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
|
|
1509
|
+
var m = msg[i];
|
|
1510
|
+
if (endian === 'big') {
|
|
1511
|
+
res[k] = m >>> 24;
|
|
1512
|
+
res[k + 1] = (m >>> 16) & 0xff;
|
|
1513
|
+
res[k + 2] = (m >>> 8) & 0xff;
|
|
1514
|
+
res[k + 3] = m & 0xff;
|
|
1773
1515
|
}
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1516
|
+
else {
|
|
1517
|
+
res[k + 3] = m >>> 24;
|
|
1518
|
+
res[k + 2] = (m >>> 16) & 0xff;
|
|
1519
|
+
res[k + 1] = (m >>> 8) & 0xff;
|
|
1520
|
+
res[k] = m & 0xff;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
return res;
|
|
1524
|
+
}
|
|
1525
|
+
var split32_1 = split32;
|
|
1526
|
+
function rotr32(w, b) {
|
|
1527
|
+
return (w >>> b) | (w << (32 - b));
|
|
1528
|
+
}
|
|
1529
|
+
var rotr32_1 = rotr32;
|
|
1530
|
+
function rotl32(w, b) {
|
|
1531
|
+
return (w << b) | (w >>> (32 - b));
|
|
1532
|
+
}
|
|
1533
|
+
var rotl32_1 = rotl32;
|
|
1534
|
+
function sum32(a, b) {
|
|
1535
|
+
return (a + b) >>> 0;
|
|
1536
|
+
}
|
|
1537
|
+
var sum32_1 = sum32;
|
|
1538
|
+
function sum32_3(a, b, c) {
|
|
1539
|
+
return (a + b + c) >>> 0;
|
|
1540
|
+
}
|
|
1541
|
+
var sum32_3_1 = sum32_3;
|
|
1542
|
+
function sum32_4(a, b, c, d) {
|
|
1543
|
+
return (a + b + c + d) >>> 0;
|
|
1544
|
+
}
|
|
1545
|
+
var sum32_4_1 = sum32_4;
|
|
1546
|
+
function sum32_5(a, b, c, d, e) {
|
|
1547
|
+
return (a + b + c + d + e) >>> 0;
|
|
1548
|
+
}
|
|
1549
|
+
var sum32_5_1 = sum32_5;
|
|
1550
|
+
function sum64(buf, pos, ah, al) {
|
|
1551
|
+
var bh = buf[pos];
|
|
1552
|
+
var bl = buf[pos + 1];
|
|
1553
|
+
var lo = (al + bl) >>> 0;
|
|
1554
|
+
var hi = (lo < al ? 1 : 0) + ah + bh;
|
|
1555
|
+
buf[pos] = hi >>> 0;
|
|
1556
|
+
buf[pos + 1] = lo;
|
|
1557
|
+
}
|
|
1558
|
+
var sum64_1 = sum64;
|
|
1559
|
+
function sum64_hi(ah, al, bh, bl) {
|
|
1560
|
+
var lo = (al + bl) >>> 0;
|
|
1561
|
+
var hi = (lo < al ? 1 : 0) + ah + bh;
|
|
1562
|
+
return hi >>> 0;
|
|
1563
|
+
}
|
|
1564
|
+
var sum64_hi_1 = sum64_hi;
|
|
1565
|
+
function sum64_lo(ah, al, bh, bl) {
|
|
1566
|
+
var lo = al + bl;
|
|
1567
|
+
return lo >>> 0;
|
|
1568
|
+
}
|
|
1569
|
+
var sum64_lo_1 = sum64_lo;
|
|
1570
|
+
function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
|
|
1571
|
+
var carry = 0;
|
|
1572
|
+
var lo = al;
|
|
1573
|
+
lo = (lo + bl) >>> 0;
|
|
1574
|
+
carry += lo < al ? 1 : 0;
|
|
1575
|
+
lo = (lo + cl) >>> 0;
|
|
1576
|
+
carry += lo < cl ? 1 : 0;
|
|
1577
|
+
lo = (lo + dl) >>> 0;
|
|
1578
|
+
carry += lo < dl ? 1 : 0;
|
|
1579
|
+
var hi = ah + bh + ch + dh + carry;
|
|
1580
|
+
return hi >>> 0;
|
|
1581
|
+
}
|
|
1582
|
+
var sum64_4_hi_1 = sum64_4_hi;
|
|
1583
|
+
function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
|
|
1584
|
+
var lo = al + bl + cl + dl;
|
|
1585
|
+
return lo >>> 0;
|
|
1586
|
+
}
|
|
1587
|
+
var sum64_4_lo_1 = sum64_4_lo;
|
|
1588
|
+
function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
|
|
1589
|
+
var carry = 0;
|
|
1590
|
+
var lo = al;
|
|
1591
|
+
lo = (lo + bl) >>> 0;
|
|
1592
|
+
carry += lo < al ? 1 : 0;
|
|
1593
|
+
lo = (lo + cl) >>> 0;
|
|
1594
|
+
carry += lo < cl ? 1 : 0;
|
|
1595
|
+
lo = (lo + dl) >>> 0;
|
|
1596
|
+
carry += lo < dl ? 1 : 0;
|
|
1597
|
+
lo = (lo + el) >>> 0;
|
|
1598
|
+
carry += lo < el ? 1 : 0;
|
|
1599
|
+
var hi = ah + bh + ch + dh + eh + carry;
|
|
1600
|
+
return hi >>> 0;
|
|
1601
|
+
}
|
|
1602
|
+
var sum64_5_hi_1 = sum64_5_hi;
|
|
1603
|
+
function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
|
|
1604
|
+
var lo = al + bl + cl + dl + el;
|
|
1605
|
+
return lo >>> 0;
|
|
1606
|
+
}
|
|
1607
|
+
var sum64_5_lo_1 = sum64_5_lo;
|
|
1608
|
+
function rotr64_hi(ah, al, num) {
|
|
1609
|
+
var r = (al << (32 - num)) | (ah >>> num);
|
|
1610
|
+
return r >>> 0;
|
|
1611
|
+
}
|
|
1612
|
+
var rotr64_hi_1 = rotr64_hi;
|
|
1613
|
+
function rotr64_lo(ah, al, num) {
|
|
1614
|
+
var r = (ah << (32 - num)) | (al >>> num);
|
|
1615
|
+
return r >>> 0;
|
|
1616
|
+
}
|
|
1617
|
+
var rotr64_lo_1 = rotr64_lo;
|
|
1618
|
+
function shr64_hi(ah, al, num) {
|
|
1619
|
+
return ah >>> num;
|
|
1620
|
+
}
|
|
1621
|
+
var shr64_hi_1 = shr64_hi;
|
|
1622
|
+
function shr64_lo(ah, al, num) {
|
|
1623
|
+
var r = (ah << (32 - num)) | (al >>> num);
|
|
1624
|
+
return r >>> 0;
|
|
1625
|
+
}
|
|
1626
|
+
var shr64_lo_1 = shr64_lo;
|
|
1627
|
+
var utils = {
|
|
1628
|
+
inherits: inherits_1,
|
|
1629
|
+
toArray: toArray_1,
|
|
1630
|
+
toHex: toHex_1,
|
|
1631
|
+
htonl: htonl_1,
|
|
1632
|
+
toHex32: toHex32_1,
|
|
1633
|
+
zero2: zero2_1,
|
|
1634
|
+
zero8: zero8_1,
|
|
1635
|
+
join32: join32_1,
|
|
1636
|
+
split32: split32_1,
|
|
1637
|
+
rotr32: rotr32_1,
|
|
1638
|
+
rotl32: rotl32_1,
|
|
1639
|
+
sum32: sum32_1,
|
|
1640
|
+
sum32_3: sum32_3_1,
|
|
1641
|
+
sum32_4: sum32_4_1,
|
|
1642
|
+
sum32_5: sum32_5_1,
|
|
1643
|
+
sum64: sum64_1,
|
|
1644
|
+
sum64_hi: sum64_hi_1,
|
|
1645
|
+
sum64_lo: sum64_lo_1,
|
|
1646
|
+
sum64_4_hi: sum64_4_hi_1,
|
|
1647
|
+
sum64_4_lo: sum64_4_lo_1,
|
|
1648
|
+
sum64_5_hi: sum64_5_hi_1,
|
|
1649
|
+
sum64_5_lo: sum64_5_lo_1,
|
|
1650
|
+
rotr64_hi: rotr64_hi_1,
|
|
1651
|
+
rotr64_lo: rotr64_lo_1,
|
|
1652
|
+
shr64_hi: shr64_hi_1,
|
|
1653
|
+
shr64_lo: shr64_lo_1
|
|
1779
1654
|
};
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
this.
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
this.
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1655
|
+
|
|
1656
|
+
function BlockHash() {
|
|
1657
|
+
this.pending = null;
|
|
1658
|
+
this.pendingTotal = 0;
|
|
1659
|
+
this.blockSize = this.constructor.blockSize;
|
|
1660
|
+
this.outSize = this.constructor.outSize;
|
|
1661
|
+
this.hmacStrength = this.constructor.hmacStrength;
|
|
1662
|
+
this.padLength = this.constructor.padLength / 8;
|
|
1663
|
+
this.endian = 'big';
|
|
1664
|
+
this._delta8 = this.blockSize / 8;
|
|
1665
|
+
this._delta32 = this.blockSize / 32;
|
|
1666
|
+
}
|
|
1667
|
+
var BlockHash_1 = BlockHash;
|
|
1668
|
+
BlockHash.prototype.update = function update(msg, enc) {
|
|
1669
|
+
// Convert message to array, pad it, and join into 32bit blocks
|
|
1670
|
+
msg = utils.toArray(msg, enc);
|
|
1671
|
+
if (!this.pending)
|
|
1672
|
+
this.pending = msg;
|
|
1673
|
+
else
|
|
1674
|
+
this.pending = this.pending.concat(msg);
|
|
1675
|
+
this.pendingTotal += msg.length;
|
|
1676
|
+
// Enough data, try updating
|
|
1677
|
+
if (this.pending.length >= this._delta8) {
|
|
1678
|
+
msg = this.pending;
|
|
1679
|
+
// Process pending data in blocks
|
|
1680
|
+
var r = msg.length % this._delta8;
|
|
1681
|
+
this.pending = msg.slice(msg.length - r, msg.length);
|
|
1682
|
+
if (this.pending.length === 0)
|
|
1683
|
+
this.pending = null;
|
|
1684
|
+
msg = utils.join32(msg, 0, msg.length - r, this.endian);
|
|
1685
|
+
for (var i = 0; i < msg.length; i += this._delta32)
|
|
1686
|
+
this._update(msg, i, i + this._delta32);
|
|
1804
1687
|
}
|
|
1805
1688
|
return this;
|
|
1806
1689
|
};
|
|
1807
|
-
|
|
1808
|
-
this.
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
Bundle.prototype.toString = function toString() {
|
|
1812
|
-
var this$1 = this;
|
|
1813
|
-
var body = this.sources
|
|
1814
|
-
.map(function (source, i) {
|
|
1815
|
-
var separator = source.separator !== undefined ? source.separator : this$1.separator;
|
|
1816
|
-
var str = (i > 0 ? separator : '') + source.content.toString();
|
|
1817
|
-
return str;
|
|
1818
|
-
})
|
|
1819
|
-
.join('');
|
|
1820
|
-
return this.intro + body;
|
|
1690
|
+
BlockHash.prototype.digest = function digest(enc) {
|
|
1691
|
+
this.update(this._pad());
|
|
1692
|
+
minimalisticAssert(this.pending === null);
|
|
1693
|
+
return this._digest(enc);
|
|
1821
1694
|
};
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1695
|
+
BlockHash.prototype._pad = function pad() {
|
|
1696
|
+
var len = this.pendingTotal;
|
|
1697
|
+
var bytes = this._delta8;
|
|
1698
|
+
var k = bytes - ((len + this.padLength) % bytes);
|
|
1699
|
+
var res = new Array(k + this.padLength);
|
|
1700
|
+
res[0] = 0x80;
|
|
1701
|
+
for (var i = 1; i < k; i++)
|
|
1702
|
+
res[i] = 0;
|
|
1703
|
+
// Append length
|
|
1704
|
+
len <<= 3;
|
|
1705
|
+
if (this.endian === 'big') {
|
|
1706
|
+
for (var t = 8; t < this.padLength; t++)
|
|
1707
|
+
res[i++] = 0;
|
|
1708
|
+
res[i++] = 0;
|
|
1709
|
+
res[i++] = 0;
|
|
1710
|
+
res[i++] = 0;
|
|
1711
|
+
res[i++] = 0;
|
|
1712
|
+
res[i++] = (len >>> 24) & 0xff;
|
|
1713
|
+
res[i++] = (len >>> 16) & 0xff;
|
|
1714
|
+
res[i++] = (len >>> 8) & 0xff;
|
|
1715
|
+
res[i++] = len & 0xff;
|
|
1825
1716
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1717
|
+
else {
|
|
1718
|
+
res[i++] = len & 0xff;
|
|
1719
|
+
res[i++] = (len >>> 8) & 0xff;
|
|
1720
|
+
res[i++] = (len >>> 16) & 0xff;
|
|
1721
|
+
res[i++] = (len >>> 24) & 0xff;
|
|
1722
|
+
res[i++] = 0;
|
|
1723
|
+
res[i++] = 0;
|
|
1724
|
+
res[i++] = 0;
|
|
1725
|
+
res[i++] = 0;
|
|
1726
|
+
for (t = 8; t < this.padLength; t++)
|
|
1727
|
+
res[i++] = 0;
|
|
1828
1728
|
}
|
|
1829
|
-
return
|
|
1830
|
-
};
|
|
1831
|
-
Bundle.prototype.length = function length() {
|
|
1832
|
-
return this.sources.reduce(function (length, source) { return length + source.content.length(); }, this.intro.length);
|
|
1833
|
-
};
|
|
1834
|
-
Bundle.prototype.trimLines = function trimLines() {
|
|
1835
|
-
return this.trim('[\\r\\n]');
|
|
1729
|
+
return res;
|
|
1836
1730
|
};
|
|
1837
|
-
|
|
1838
|
-
|
|
1731
|
+
var common = {
|
|
1732
|
+
BlockHash: BlockHash_1
|
|
1839
1733
|
};
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1734
|
+
|
|
1735
|
+
var rotr32$1 = utils.rotr32;
|
|
1736
|
+
function ft_1(s, x, y, z) {
|
|
1737
|
+
if (s === 0)
|
|
1738
|
+
return ch32(x, y, z);
|
|
1739
|
+
if (s === 1 || s === 3)
|
|
1740
|
+
return p32(x, y, z);
|
|
1741
|
+
if (s === 2)
|
|
1742
|
+
return maj32(x, y, z);
|
|
1743
|
+
}
|
|
1744
|
+
var ft_1_1 = ft_1;
|
|
1745
|
+
function ch32(x, y, z) {
|
|
1746
|
+
return (x & y) ^ ((~x) & z);
|
|
1747
|
+
}
|
|
1748
|
+
var ch32_1 = ch32;
|
|
1749
|
+
function maj32(x, y, z) {
|
|
1750
|
+
return (x & y) ^ (x & z) ^ (y & z);
|
|
1751
|
+
}
|
|
1752
|
+
var maj32_1 = maj32;
|
|
1753
|
+
function p32(x, y, z) {
|
|
1754
|
+
return x ^ y ^ z;
|
|
1755
|
+
}
|
|
1756
|
+
var p32_1 = p32;
|
|
1757
|
+
function s0_256(x) {
|
|
1758
|
+
return rotr32$1(x, 2) ^ rotr32$1(x, 13) ^ rotr32$1(x, 22);
|
|
1759
|
+
}
|
|
1760
|
+
var s0_256_1 = s0_256;
|
|
1761
|
+
function s1_256(x) {
|
|
1762
|
+
return rotr32$1(x, 6) ^ rotr32$1(x, 11) ^ rotr32$1(x, 25);
|
|
1763
|
+
}
|
|
1764
|
+
var s1_256_1 = s1_256;
|
|
1765
|
+
function g0_256(x) {
|
|
1766
|
+
return rotr32$1(x, 7) ^ rotr32$1(x, 18) ^ (x >>> 3);
|
|
1767
|
+
}
|
|
1768
|
+
var g0_256_1 = g0_256;
|
|
1769
|
+
function g1_256(x) {
|
|
1770
|
+
return rotr32$1(x, 17) ^ rotr32$1(x, 19) ^ (x >>> 10);
|
|
1771
|
+
}
|
|
1772
|
+
var g1_256_1 = g1_256;
|
|
1773
|
+
var common$1 = {
|
|
1774
|
+
ft_1: ft_1_1,
|
|
1775
|
+
ch32: ch32_1,
|
|
1776
|
+
maj32: maj32_1,
|
|
1777
|
+
p32: p32_1,
|
|
1778
|
+
s0_256: s0_256_1,
|
|
1779
|
+
s1_256: s1_256_1,
|
|
1780
|
+
g0_256: g0_256_1,
|
|
1781
|
+
g1_256: g1_256_1
|
|
1782
|
+
};
|
|
1783
|
+
|
|
1784
|
+
var sum32$1 = utils.sum32;
|
|
1785
|
+
var sum32_4$1 = utils.sum32_4;
|
|
1786
|
+
var sum32_5$1 = utils.sum32_5;
|
|
1787
|
+
var ch32$1 = common$1.ch32;
|
|
1788
|
+
var maj32$1 = common$1.maj32;
|
|
1789
|
+
var s0_256$1 = common$1.s0_256;
|
|
1790
|
+
var s1_256$1 = common$1.s1_256;
|
|
1791
|
+
var g0_256$1 = common$1.g0_256;
|
|
1792
|
+
var g1_256$1 = common$1.g1_256;
|
|
1793
|
+
var BlockHash$1 = common.BlockHash;
|
|
1794
|
+
var sha256_K = [
|
|
1795
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
|
1796
|
+
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
1797
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
|
1798
|
+
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
1799
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
|
|
1800
|
+
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
1801
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
|
|
1802
|
+
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
1803
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
|
1804
|
+
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
1805
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
|
|
1806
|
+
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
1807
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
|
|
1808
|
+
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
1809
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
|
1810
|
+
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
|
1811
|
+
];
|
|
1812
|
+
function SHA256() {
|
|
1813
|
+
if (!(this instanceof SHA256))
|
|
1814
|
+
return new SHA256();
|
|
1815
|
+
BlockHash$1.call(this);
|
|
1816
|
+
this.h = [
|
|
1817
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
|
|
1818
|
+
0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
|
|
1819
|
+
];
|
|
1820
|
+
this.k = sha256_K;
|
|
1821
|
+
this.W = new Array(64);
|
|
1822
|
+
}
|
|
1823
|
+
utils.inherits(SHA256, BlockHash$1);
|
|
1824
|
+
var _256 = SHA256;
|
|
1825
|
+
SHA256.blockSize = 512;
|
|
1826
|
+
SHA256.outSize = 256;
|
|
1827
|
+
SHA256.hmacStrength = 192;
|
|
1828
|
+
SHA256.padLength = 64;
|
|
1829
|
+
SHA256.prototype._update = function _update(msg, start) {
|
|
1830
|
+
var W = this.W;
|
|
1831
|
+
for (var i = 0; i < 16; i++)
|
|
1832
|
+
W[i] = msg[start + i];
|
|
1833
|
+
for (; i < W.length; i++)
|
|
1834
|
+
W[i] = sum32_4$1(g1_256$1(W[i - 2]), W[i - 7], g0_256$1(W[i - 15]), W[i - 16]);
|
|
1835
|
+
var a = this.h[0];
|
|
1836
|
+
var b = this.h[1];
|
|
1837
|
+
var c = this.h[2];
|
|
1838
|
+
var d = this.h[3];
|
|
1839
|
+
var e = this.h[4];
|
|
1840
|
+
var f = this.h[5];
|
|
1841
|
+
var g = this.h[6];
|
|
1842
|
+
var h = this.h[7];
|
|
1843
|
+
minimalisticAssert(this.k.length === W.length);
|
|
1844
|
+
for (i = 0; i < W.length; i++) {
|
|
1845
|
+
var T1 = sum32_5$1(h, s1_256$1(e), ch32$1(e, f, g), this.k[i], W[i]);
|
|
1846
|
+
var T2 = sum32$1(s0_256$1(a), maj32$1(a, b, c));
|
|
1847
|
+
h = g;
|
|
1848
|
+
g = f;
|
|
1849
|
+
f = e;
|
|
1850
|
+
e = sum32$1(d, T1);
|
|
1851
|
+
d = c;
|
|
1852
|
+
c = b;
|
|
1853
|
+
b = a;
|
|
1854
|
+
a = sum32$1(T1, T2);
|
|
1853
1855
|
}
|
|
1854
|
-
|
|
1856
|
+
this.h[0] = sum32$1(this.h[0], a);
|
|
1857
|
+
this.h[1] = sum32$1(this.h[1], b);
|
|
1858
|
+
this.h[2] = sum32$1(this.h[2], c);
|
|
1859
|
+
this.h[3] = sum32$1(this.h[3], d);
|
|
1860
|
+
this.h[4] = sum32$1(this.h[4], e);
|
|
1861
|
+
this.h[5] = sum32$1(this.h[5], f);
|
|
1862
|
+
this.h[6] = sum32$1(this.h[6], g);
|
|
1863
|
+
this.h[7] = sum32$1(this.h[7], h);
|
|
1855
1864
|
};
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
do {
|
|
1862
|
-
source = this$1.sources[i--];
|
|
1863
|
-
if (!source) {
|
|
1864
|
-
this$1.intro = this$1.intro.replace(rx, '');
|
|
1865
|
-
break;
|
|
1866
|
-
}
|
|
1867
|
-
} while (!source.content.trimEndAborted(charType));
|
|
1868
|
-
return this;
|
|
1865
|
+
SHA256.prototype._digest = function digest(enc) {
|
|
1866
|
+
if (enc === 'hex')
|
|
1867
|
+
return utils.toHex32(this.h, 'big');
|
|
1868
|
+
else
|
|
1869
|
+
return utils.split32(this.h, 'big');
|
|
1869
1870
|
};
|
|
1870
1871
|
|
|
1872
|
+
const createHash = () => _256();
|
|
1873
|
+
|
|
1871
1874
|
function relative(from, to) {
|
|
1872
1875
|
const fromParts = from.split(/[/\\]/).filter(Boolean);
|
|
1873
1876
|
const toParts = to.split(/[/\\]/).filter(Boolean);
|
|
@@ -1936,11 +1939,9 @@ function createHasEffectsContext() {
|
|
|
1936
1939
|
};
|
|
1937
1940
|
}
|
|
1938
1941
|
|
|
1939
|
-
const BLANK = Object.create(null);
|
|
1940
|
-
|
|
1941
1942
|
const BlockStatement = 'BlockStatement';
|
|
1942
1943
|
const CallExpression = 'CallExpression';
|
|
1943
|
-
const
|
|
1944
|
+
const ExportNamespaceSpecifier = 'ExportNamespaceSpecifier';
|
|
1944
1945
|
const ExpressionStatement = 'ExpressionStatement';
|
|
1945
1946
|
const FunctionExpression = 'FunctionExpression';
|
|
1946
1947
|
const Identifier = 'Identifier';
|
|
@@ -1949,7 +1950,6 @@ const ImportNamespaceSpecifier = 'ImportNamespaceSpecifier';
|
|
|
1949
1950
|
const Program = 'Program';
|
|
1950
1951
|
const Property = 'Property';
|
|
1951
1952
|
const ReturnStatement = 'ReturnStatement';
|
|
1952
|
-
const VariableDeclaration = 'VariableDeclaration';
|
|
1953
1953
|
|
|
1954
1954
|
function treeshakeNode(node, code, start, end) {
|
|
1955
1955
|
code.remove(start, end);
|
|
@@ -2672,19 +2672,18 @@ class ExternalVariable extends Variable {
|
|
|
2672
2672
|
|
|
2673
2673
|
const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'.split(' ');
|
|
2674
2674
|
const builtins = 'Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'.split(' ');
|
|
2675
|
-
const blacklisted =
|
|
2676
|
-
reservedWords.concat(builtins).forEach(word => (blacklisted[word] = true));
|
|
2675
|
+
const blacklisted = new Set(reservedWords.concat(builtins));
|
|
2677
2676
|
const illegalCharacters = /[^$_a-zA-Z0-9]/g;
|
|
2678
2677
|
const startsWithDigit = (str) => /\d/.test(str[0]);
|
|
2679
2678
|
function isLegal(str) {
|
|
2680
|
-
if (startsWithDigit(str) || blacklisted
|
|
2679
|
+
if (startsWithDigit(str) || blacklisted.has(str)) {
|
|
2681
2680
|
return false;
|
|
2682
2681
|
}
|
|
2683
2682
|
return !illegalCharacters.test(str);
|
|
2684
2683
|
}
|
|
2685
2684
|
function makeLegal(str) {
|
|
2686
2685
|
str = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(illegalCharacters, '_');
|
|
2687
|
-
if (startsWithDigit(str) || blacklisted
|
|
2686
|
+
if (startsWithDigit(str) || blacklisted.has(str))
|
|
2688
2687
|
str = `_${str}`;
|
|
2689
2688
|
return str || '_';
|
|
2690
2689
|
}
|
|
@@ -3484,6 +3483,8 @@ function isReference(node, parent) {
|
|
|
3484
3483
|
return false;
|
|
3485
3484
|
}
|
|
3486
3485
|
|
|
3486
|
+
const BLANK = Object.create(null);
|
|
3487
|
+
|
|
3487
3488
|
const ValueProperties = Symbol('Value Properties');
|
|
3488
3489
|
const PURE = { pure: true };
|
|
3489
3490
|
const IMPURE = { pure: false };
|
|
@@ -4652,7 +4653,8 @@ class ExportDefaultDeclaration extends NodeBase {
|
|
|
4652
4653
|
this.variable = this.scope.addExportDefaultDeclaration(this.declarationName || this.context.getModuleName(), this, this.context);
|
|
4653
4654
|
this.context.addExport(this);
|
|
4654
4655
|
}
|
|
4655
|
-
render(code, options,
|
|
4656
|
+
render(code, options, nodeRenderOptions) {
|
|
4657
|
+
const { start, end } = nodeRenderOptions;
|
|
4656
4658
|
const declarationStart = getDeclarationStart(code.original, this.start);
|
|
4657
4659
|
if (this.declaration instanceof FunctionDeclaration) {
|
|
4658
4660
|
this.renderNamedDeclaration(code, declarationStart, 'function', this.declaration.id === null, options);
|
|
@@ -4917,9 +4919,9 @@ function getExportBlock(exports, dependencies, namedExportsMode, interop, compac
|
|
|
4917
4919
|
}
|
|
4918
4920
|
let exportBlock = '';
|
|
4919
4921
|
// star exports must always output first for precedence
|
|
4920
|
-
|
|
4922
|
+
for (const { name, reexports } of dependencies) {
|
|
4921
4923
|
if (reexports && namedExportsMode) {
|
|
4922
|
-
|
|
4924
|
+
for (const specifier of reexports) {
|
|
4923
4925
|
if (specifier.reexported === '*') {
|
|
4924
4926
|
if (exportBlock)
|
|
4925
4927
|
exportBlock += n;
|
|
@@ -4938,9 +4940,9 @@ function getExportBlock(exports, dependencies, namedExportsMode, interop, compac
|
|
|
4938
4940
|
`${t}if${_}(k${_}!==${_}'default')${_}exports[k]${_}=${_}${name}[k];${n}});`;
|
|
4939
4941
|
}
|
|
4940
4942
|
}
|
|
4941
|
-
}
|
|
4943
|
+
}
|
|
4942
4944
|
}
|
|
4943
|
-
}
|
|
4945
|
+
}
|
|
4944
4946
|
for (const { name, imports, reexports, isChunk, namedExportsMode: depNamedExportsMode, exportsNames } of dependencies) {
|
|
4945
4947
|
if (reexports && namedExportsMode) {
|
|
4946
4948
|
for (const specifier of reexports) {
|
|
@@ -5195,26 +5197,48 @@ function cjs(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
5195
5197
|
function esm(magicString, { intro, outro, dependencies, exports }, options) {
|
|
5196
5198
|
const _ = options.compact ? '' : ' ';
|
|
5197
5199
|
const n = options.compact ? '' : '\n';
|
|
5198
|
-
const importBlock = dependencies
|
|
5199
|
-
|
|
5200
|
+
const importBlock = getImportBlock(dependencies, _);
|
|
5201
|
+
if (importBlock.length > 0)
|
|
5202
|
+
intro += importBlock.join(n) + n + n;
|
|
5203
|
+
if (intro)
|
|
5204
|
+
magicString.prepend(intro);
|
|
5205
|
+
const exportBlock = getExportBlock$1(exports, _);
|
|
5206
|
+
if (exportBlock.length)
|
|
5207
|
+
magicString.append(n + n + exportBlock.join(n).trim());
|
|
5208
|
+
if (outro)
|
|
5209
|
+
magicString.append(outro);
|
|
5210
|
+
return magicString.trim();
|
|
5211
|
+
}
|
|
5212
|
+
function getImportBlock(dependencies, _) {
|
|
5213
|
+
const importBlock = [];
|
|
5214
|
+
for (const { id, reexports, imports, name } of dependencies) {
|
|
5200
5215
|
if (!reexports && !imports) {
|
|
5201
|
-
|
|
5216
|
+
importBlock.push(`import${_}'${id}';`);
|
|
5217
|
+
continue;
|
|
5202
5218
|
}
|
|
5203
|
-
let output = '';
|
|
5204
5219
|
if (imports) {
|
|
5205
|
-
|
|
5206
|
-
|
|
5220
|
+
let defaultImport = null;
|
|
5221
|
+
let starImport = null;
|
|
5222
|
+
const importedNames = [];
|
|
5223
|
+
for (const specifier of imports) {
|
|
5224
|
+
if (specifier.imported === 'default') {
|
|
5225
|
+
defaultImport = specifier;
|
|
5226
|
+
}
|
|
5227
|
+
else if (specifier.imported === '*') {
|
|
5228
|
+
starImport = specifier;
|
|
5229
|
+
}
|
|
5230
|
+
else {
|
|
5231
|
+
importedNames.push(specifier);
|
|
5232
|
+
}
|
|
5233
|
+
}
|
|
5207
5234
|
if (starImport) {
|
|
5208
|
-
|
|
5209
|
-
if (imports.length > 1)
|
|
5210
|
-
output += n;
|
|
5235
|
+
importBlock.push(`import${_}*${_}as ${starImport.local} from${_}'${id}';`);
|
|
5211
5236
|
}
|
|
5212
|
-
if (defaultImport &&
|
|
5213
|
-
|
|
5237
|
+
if (defaultImport && importedNames.length === 0) {
|
|
5238
|
+
importBlock.push(`import ${defaultImport.local} from${_}'${id}';`);
|
|
5214
5239
|
}
|
|
5215
|
-
else if (
|
|
5216
|
-
|
|
5217
|
-
.filter(specifier => specifier !== defaultImport && specifier !== starImport)
|
|
5240
|
+
else if (importedNames.length > 0) {
|
|
5241
|
+
importBlock.push(`import ${defaultImport ? `${defaultImport.local},${_}` : ''}{${_}${importedNames
|
|
5218
5242
|
.map(specifier => {
|
|
5219
5243
|
if (specifier.imported === specifier.local) {
|
|
5220
5244
|
return specifier.imported;
|
|
@@ -5223,55 +5247,56 @@ function esm(magicString, { intro, outro, dependencies, exports }, options) {
|
|
|
5223
5247
|
return `${specifier.imported} as ${specifier.local}`;
|
|
5224
5248
|
}
|
|
5225
5249
|
})
|
|
5226
|
-
.join(`,${_}`)}${_}}${_}from${_}'${id}'
|
|
5250
|
+
.join(`,${_}`)}${_}}${_}from${_}'${id}';`);
|
|
5227
5251
|
}
|
|
5228
5252
|
}
|
|
5229
5253
|
if (reexports) {
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
const
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
if (reexports.length === 1) {
|
|
5237
|
-
return output;
|
|
5254
|
+
let starExport = null;
|
|
5255
|
+
const namespaceReexports = [];
|
|
5256
|
+
const namedReexports = [];
|
|
5257
|
+
for (const specifier of reexports) {
|
|
5258
|
+
if (specifier.reexported === '*') {
|
|
5259
|
+
starExport = specifier;
|
|
5238
5260
|
}
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
output += `import${_}*${_}as ${name} from${_}'${id}';${n}`;
|
|
5245
|
-
output += `export${_}{${_}${name === namespaceReexport.reexported
|
|
5246
|
-
? name
|
|
5247
|
-
: `${name} as ${namespaceReexport.reexported}`} };`;
|
|
5248
|
-
if (reexports.length === (starExport ? 2 : 1)) {
|
|
5249
|
-
return output;
|
|
5261
|
+
else if (specifier.imported === '*') {
|
|
5262
|
+
namespaceReexports.push(specifier);
|
|
5263
|
+
}
|
|
5264
|
+
else {
|
|
5265
|
+
namedReexports.push(specifier);
|
|
5250
5266
|
}
|
|
5251
|
-
output += n;
|
|
5252
5267
|
}
|
|
5253
|
-
|
|
5254
|
-
.
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5268
|
+
if (starExport) {
|
|
5269
|
+
importBlock.push(`export${_}*${_}from${_}'${id}';`);
|
|
5270
|
+
}
|
|
5271
|
+
if (namespaceReexports.length > 0) {
|
|
5272
|
+
if (!imports ||
|
|
5273
|
+
!imports.some(specifier => specifier.imported === '*' && specifier.local === name)) {
|
|
5274
|
+
importBlock.push(`import${_}*${_}as ${name} from${_}'${id}';`);
|
|
5258
5275
|
}
|
|
5259
|
-
|
|
5260
|
-
|
|
5276
|
+
for (const specifier of namespaceReexports) {
|
|
5277
|
+
importBlock.push(`export${_}{${_}${name === specifier.reexported ? name : `${name} as ${specifier.reexported}`} };`);
|
|
5261
5278
|
}
|
|
5262
|
-
}
|
|
5263
|
-
|
|
5279
|
+
}
|
|
5280
|
+
if (namedReexports.length > 0) {
|
|
5281
|
+
importBlock.push(`export${_}{${_}${namedReexports
|
|
5282
|
+
.map(specifier => {
|
|
5283
|
+
if (specifier.imported === specifier.reexported) {
|
|
5284
|
+
return specifier.imported;
|
|
5285
|
+
}
|
|
5286
|
+
else {
|
|
5287
|
+
return `${specifier.imported} as ${specifier.reexported}`;
|
|
5288
|
+
}
|
|
5289
|
+
})
|
|
5290
|
+
.join(`,${_}`)}${_}}${_}from${_}'${id}';`);
|
|
5291
|
+
}
|
|
5264
5292
|
}
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
intro += importBlock + n + n;
|
|
5270
|
-
if (intro)
|
|
5271
|
-
magicString.prepend(intro);
|
|
5293
|
+
}
|
|
5294
|
+
return importBlock;
|
|
5295
|
+
}
|
|
5296
|
+
function getExportBlock$1(exports, _) {
|
|
5272
5297
|
const exportBlock = [];
|
|
5273
5298
|
const exportDeclaration = [];
|
|
5274
|
-
|
|
5299
|
+
for (const specifier of exports) {
|
|
5275
5300
|
if (specifier.exported === 'default') {
|
|
5276
5301
|
exportBlock.push(`export default ${specifier.local};`);
|
|
5277
5302
|
}
|
|
@@ -5280,15 +5305,11 @@ function esm(magicString, { intro, outro, dependencies, exports }, options) {
|
|
|
5280
5305
|
? specifier.local
|
|
5281
5306
|
: `${specifier.local} as ${specifier.exported}`);
|
|
5282
5307
|
}
|
|
5283
|
-
}
|
|
5308
|
+
}
|
|
5284
5309
|
if (exportDeclaration.length) {
|
|
5285
5310
|
exportBlock.push(`export${_}{${_}${exportDeclaration.join(`,${_}`)}${_}};`);
|
|
5286
5311
|
}
|
|
5287
|
-
|
|
5288
|
-
magicString.append(n + n + exportBlock.join(n).trim());
|
|
5289
|
-
if (outro)
|
|
5290
|
-
magicString.append(outro);
|
|
5291
|
-
return magicString.trim();
|
|
5312
|
+
return exportBlock;
|
|
5292
5313
|
}
|
|
5293
5314
|
|
|
5294
5315
|
function spaces(i) {
|
|
@@ -5559,7 +5580,7 @@ function iife(magicString, { dependencies, exports, hasExports, indentString: t,
|
|
|
5559
5580
|
if (name && useVariableAssignment && !isLegal(name)) {
|
|
5560
5581
|
error({
|
|
5561
5582
|
code: 'ILLEGAL_IDENTIFIER_AS_NAME',
|
|
5562
|
-
message: `Given name
|
|
5583
|
+
message: `Given name "${name}" is not a legal JS identifier. If you need this, you can try "output.extend: true".`
|
|
5563
5584
|
});
|
|
5564
5585
|
}
|
|
5565
5586
|
warnOnBuiltins(warn, dependencies);
|
|
@@ -5567,9 +5588,8 @@ function iife(magicString, { dependencies, exports, hasExports, indentString: t,
|
|
|
5567
5588
|
const deps = external.map(dep => dep.globalName || 'null');
|
|
5568
5589
|
const args = external.map(m => m.name);
|
|
5569
5590
|
if (hasExports && !name) {
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
message: `You must supply "output.name" for IIFE bundles.`
|
|
5591
|
+
warn({
|
|
5592
|
+
message: `If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.`
|
|
5573
5593
|
});
|
|
5574
5594
|
}
|
|
5575
5595
|
if (namedExportsMode && hasExports) {
|
|
@@ -5584,7 +5604,7 @@ function iife(magicString, { dependencies, exports, hasExports, indentString: t,
|
|
|
5584
5604
|
}
|
|
5585
5605
|
const useStrict = options.strict !== false ? `${t}'use strict';${n}${n}` : ``;
|
|
5586
5606
|
let wrapperIntro = `(function${_}(${args.join(`,${_}`)})${_}{${n}${useStrict}`;
|
|
5587
|
-
if (hasExports && (!extend || !namedExportsMode)) {
|
|
5607
|
+
if (hasExports && (!extend || !namedExportsMode) && name) {
|
|
5588
5608
|
wrapperIntro =
|
|
5589
5609
|
(useVariableAssignment ? `${varOrConst} ${name}` : thisProp(name)) +
|
|
5590
5610
|
`${_}=${_}${wrapperIntro}`;
|
|
@@ -5619,13 +5639,14 @@ function getStarExcludes({ dependencies, exports }) {
|
|
|
5619
5639
|
if (!starExcludes.has('default'))
|
|
5620
5640
|
starExcludes.add('default');
|
|
5621
5641
|
// also include reexport names
|
|
5622
|
-
|
|
5623
|
-
if (reexports)
|
|
5624
|
-
|
|
5642
|
+
for (const { reexports } of dependencies) {
|
|
5643
|
+
if (reexports) {
|
|
5644
|
+
for (const reexport of reexports) {
|
|
5625
5645
|
if (reexport.imported !== '*' && !starExcludes.has(reexport.reexported))
|
|
5626
5646
|
starExcludes.add(reexport.reexported);
|
|
5627
|
-
}
|
|
5628
|
-
|
|
5647
|
+
}
|
|
5648
|
+
}
|
|
5649
|
+
}
|
|
5629
5650
|
return starExcludes;
|
|
5630
5651
|
}
|
|
5631
5652
|
const getStarExcludesBlock = (starExcludes, varOrConst, _, t, n) => starExcludes
|
|
@@ -5656,10 +5677,10 @@ function system(magicString, { accessedGlobals, dependencies, exports, hasExport
|
|
|
5656
5677
|
const importBindings = [];
|
|
5657
5678
|
let starExcludes;
|
|
5658
5679
|
const setters = [];
|
|
5659
|
-
|
|
5680
|
+
for (const { imports, reexports } of dependencies) {
|
|
5660
5681
|
const setter = [];
|
|
5661
5682
|
if (imports) {
|
|
5662
|
-
|
|
5683
|
+
for (const specifier of imports) {
|
|
5663
5684
|
importBindings.push(specifier.local);
|
|
5664
5685
|
if (specifier.imported === '*') {
|
|
5665
5686
|
setter.push(`${specifier.local}${_}=${_}module;`);
|
|
@@ -5667,7 +5688,7 @@ function system(magicString, { accessedGlobals, dependencies, exports, hasExport
|
|
|
5667
5688
|
else {
|
|
5668
5689
|
setter.push(`${specifier.local}${_}=${_}module.${specifier.imported};`);
|
|
5669
5690
|
}
|
|
5670
|
-
}
|
|
5691
|
+
}
|
|
5671
5692
|
}
|
|
5672
5693
|
if (reexports) {
|
|
5673
5694
|
let createdSetter = false;
|
|
@@ -5676,9 +5697,9 @@ function system(magicString, { accessedGlobals, dependencies, exports, hasExport
|
|
|
5676
5697
|
(reexports.length === 1 &&
|
|
5677
5698
|
(reexports[0].reexported === '*' || reexports[0].imported === '*'))) {
|
|
5678
5699
|
// star reexports
|
|
5679
|
-
|
|
5700
|
+
for (const specifier of reexports) {
|
|
5680
5701
|
if (specifier.reexported !== '*')
|
|
5681
|
-
|
|
5702
|
+
continue;
|
|
5682
5703
|
// need own exports list for deduping in star export case
|
|
5683
5704
|
if (!starExcludes) {
|
|
5684
5705
|
starExcludes = getStarExcludes({ dependencies, exports });
|
|
@@ -5690,36 +5711,36 @@ function system(magicString, { accessedGlobals, dependencies, exports, hasExport
|
|
|
5690
5711
|
setter.push(`for${_}(var _$p${_}in${_}module)${_}{`);
|
|
5691
5712
|
setter.push(`${t}if${_}(!_starExcludes[_$p])${_}_setter[_$p]${_}=${_}module[_$p];`);
|
|
5692
5713
|
setter.push('}');
|
|
5693
|
-
}
|
|
5714
|
+
}
|
|
5694
5715
|
// star import reexport
|
|
5695
|
-
|
|
5716
|
+
for (const specifier of reexports) {
|
|
5696
5717
|
if (specifier.imported !== '*' || specifier.reexported === '*')
|
|
5697
|
-
|
|
5718
|
+
continue;
|
|
5698
5719
|
setter.push(`exports('${specifier.reexported}',${_}module);`);
|
|
5699
|
-
}
|
|
5720
|
+
}
|
|
5700
5721
|
// reexports
|
|
5701
|
-
|
|
5722
|
+
for (const specifier of reexports) {
|
|
5702
5723
|
if (specifier.reexported === '*' || specifier.imported === '*')
|
|
5703
|
-
|
|
5724
|
+
continue;
|
|
5704
5725
|
if (!createdSetter) {
|
|
5705
5726
|
setter.push(`${varOrConst} _setter${_}=${_}{};`);
|
|
5706
5727
|
createdSetter = true;
|
|
5707
5728
|
}
|
|
5708
5729
|
setter.push(`_setter.${specifier.reexported}${_}=${_}module.${specifier.imported};`);
|
|
5709
|
-
}
|
|
5730
|
+
}
|
|
5710
5731
|
if (createdSetter) {
|
|
5711
5732
|
setter.push('exports(_setter);');
|
|
5712
5733
|
}
|
|
5713
5734
|
}
|
|
5714
5735
|
else {
|
|
5715
5736
|
// single reexport
|
|
5716
|
-
|
|
5737
|
+
for (const specifier of reexports) {
|
|
5717
5738
|
setter.push(`exports('${specifier.reexported}',${_}module.${specifier.imported});`);
|
|
5718
|
-
}
|
|
5739
|
+
}
|
|
5719
5740
|
}
|
|
5720
5741
|
}
|
|
5721
5742
|
setters.push(setter.join(`${n}${t}${t}${t}`));
|
|
5722
|
-
}
|
|
5743
|
+
}
|
|
5723
5744
|
const registeredName = options.name ? `'${options.name}',${_}` : '';
|
|
5724
5745
|
const wrapperParams = accessedGlobals.has('module')
|
|
5725
5746
|
? `exports,${_}module`
|
|
@@ -5892,6 +5913,15 @@ const extractAssignedNames = function extractAssignedNames(param) {
|
|
|
5892
5913
|
return names;
|
|
5893
5914
|
};
|
|
5894
5915
|
|
|
5916
|
+
class ExportAllDeclaration extends NodeBase {
|
|
5917
|
+
hasEffects() {
|
|
5918
|
+
return false;
|
|
5919
|
+
}
|
|
5920
|
+
initialise() {
|
|
5921
|
+
this.context.addExport(this);
|
|
5922
|
+
}
|
|
5923
|
+
}
|
|
5924
|
+
|
|
5895
5925
|
class ArrayExpression extends NodeBase {
|
|
5896
5926
|
bind() {
|
|
5897
5927
|
super.bind();
|
|
@@ -6740,19 +6770,6 @@ class EmptyStatement extends NodeBase {
|
|
|
6740
6770
|
}
|
|
6741
6771
|
}
|
|
6742
6772
|
|
|
6743
|
-
class ExportAllDeclaration$1 extends NodeBase {
|
|
6744
|
-
hasEffects() {
|
|
6745
|
-
return false;
|
|
6746
|
-
}
|
|
6747
|
-
initialise() {
|
|
6748
|
-
this.context.addExport(this);
|
|
6749
|
-
}
|
|
6750
|
-
render(code, _options, { start, end } = BLANK) {
|
|
6751
|
-
code.remove(start, end);
|
|
6752
|
-
}
|
|
6753
|
-
}
|
|
6754
|
-
ExportAllDeclaration$1.prototype.needsBoundaries = true;
|
|
6755
|
-
|
|
6756
6773
|
class ExportNamedDeclaration extends NodeBase {
|
|
6757
6774
|
bind() {
|
|
6758
6775
|
// Do not bind specifiers
|
|
@@ -6765,7 +6782,8 @@ class ExportNamedDeclaration extends NodeBase {
|
|
|
6765
6782
|
initialise() {
|
|
6766
6783
|
this.context.addExport(this);
|
|
6767
6784
|
}
|
|
6768
|
-
render(code, options,
|
|
6785
|
+
render(code, options, nodeRenderOptions) {
|
|
6786
|
+
const { start, end } = nodeRenderOptions;
|
|
6769
6787
|
if (this.declaration === null) {
|
|
6770
6788
|
code.remove(start, end);
|
|
6771
6789
|
}
|
|
@@ -7023,8 +7041,8 @@ class ImportDeclaration extends NodeBase {
|
|
|
7023
7041
|
initialise() {
|
|
7024
7042
|
this.context.addImport(this);
|
|
7025
7043
|
}
|
|
7026
|
-
render(code, _options,
|
|
7027
|
-
code.remove(start, end);
|
|
7044
|
+
render(code, _options, nodeRenderOptions) {
|
|
7045
|
+
code.remove(nodeRenderOptions.start, nodeRenderOptions.end);
|
|
7028
7046
|
}
|
|
7029
7047
|
}
|
|
7030
7048
|
ImportDeclaration.prototype.needsBoundaries = true;
|
|
@@ -8776,7 +8794,7 @@ function areAllDeclarationsIncludedAndNotExported(declarations) {
|
|
|
8776
8794
|
}
|
|
8777
8795
|
return true;
|
|
8778
8796
|
}
|
|
8779
|
-
class VariableDeclaration
|
|
8797
|
+
class VariableDeclaration extends NodeBase {
|
|
8780
8798
|
deoptimizePath() {
|
|
8781
8799
|
for (const declarator of this.declarations) {
|
|
8782
8800
|
declarator.deoptimizePath(EMPTY_PATH);
|
|
@@ -9007,7 +9025,7 @@ const nodeConstructors = {
|
|
|
9007
9025
|
ContinueStatement,
|
|
9008
9026
|
DoWhileStatement,
|
|
9009
9027
|
EmptyStatement,
|
|
9010
|
-
ExportAllDeclaration
|
|
9028
|
+
ExportAllDeclaration,
|
|
9011
9029
|
ExportDefaultDeclaration,
|
|
9012
9030
|
ExportNamedDeclaration,
|
|
9013
9031
|
ExpressionStatement: ExpressionStatement$1,
|
|
@@ -9046,7 +9064,7 @@ const nodeConstructors = {
|
|
|
9046
9064
|
UnaryExpression,
|
|
9047
9065
|
UnknownNode,
|
|
9048
9066
|
UpdateExpression,
|
|
9049
|
-
VariableDeclaration
|
|
9067
|
+
VariableDeclaration,
|
|
9050
9068
|
VariableDeclarator,
|
|
9051
9069
|
WhileStatement,
|
|
9052
9070
|
YieldExpression
|
|
@@ -9442,9 +9460,9 @@ function timeEndImpl(label, level = 3) {
|
|
|
9442
9460
|
}
|
|
9443
9461
|
function getTimings() {
|
|
9444
9462
|
const newTimings = {};
|
|
9445
|
-
Object.keys(timers)
|
|
9463
|
+
for (const label of Object.keys(timers)) {
|
|
9446
9464
|
newTimings[label] = [timers[label].time, timers[label].memory, timers[label].totalMemory];
|
|
9447
|
-
}
|
|
9465
|
+
}
|
|
9448
9466
|
return newTimings;
|
|
9449
9467
|
}
|
|
9450
9468
|
let timeStart = NOOP, timeEnd = NOOP;
|
|
@@ -9534,6 +9552,7 @@ const MISSING_EXPORT_SHIM_DESCRIPTION = {
|
|
|
9534
9552
|
};
|
|
9535
9553
|
class Module {
|
|
9536
9554
|
constructor(graph, id, moduleSideEffects, isEntry) {
|
|
9555
|
+
this.chunk = null;
|
|
9537
9556
|
this.chunkFileNames = new Set();
|
|
9538
9557
|
this.chunkName = null;
|
|
9539
9558
|
this.comments = [];
|
|
@@ -9543,8 +9562,8 @@ class Module {
|
|
|
9543
9562
|
this.dynamicImports = [];
|
|
9544
9563
|
this.entryPointsHash = new Uint8Array(10);
|
|
9545
9564
|
this.execIndex = Infinity;
|
|
9546
|
-
this.exportAllModules =
|
|
9547
|
-
this.exportAllSources =
|
|
9565
|
+
this.exportAllModules = [];
|
|
9566
|
+
this.exportAllSources = new Set();
|
|
9548
9567
|
this.exports = Object.create(null);
|
|
9549
9568
|
this.exportsAll = Object.create(null);
|
|
9550
9569
|
this.exportShimVariable = new ExportShimVariable(this);
|
|
@@ -9555,12 +9574,14 @@ class Module {
|
|
|
9555
9574
|
this.isExecuted = false;
|
|
9556
9575
|
this.isUserDefinedEntryPoint = false;
|
|
9557
9576
|
this.manualChunkAlias = null;
|
|
9558
|
-
this.
|
|
9559
|
-
this.sources =
|
|
9577
|
+
this.reexportDescriptions = Object.create(null);
|
|
9578
|
+
this.sources = new Set();
|
|
9560
9579
|
this.userChunkNames = new Set();
|
|
9561
9580
|
this.usesTopLevelAwait = false;
|
|
9562
|
-
this.
|
|
9581
|
+
this.allExportNames = null;
|
|
9582
|
+
this.namespaceVariable = null;
|
|
9563
9583
|
this.transformDependencies = [];
|
|
9584
|
+
this.transitiveReexports = null;
|
|
9564
9585
|
this.id = id;
|
|
9565
9586
|
this.graph = graph;
|
|
9566
9587
|
this.excludeFromSourcemap = /\0/.test(id);
|
|
@@ -9613,7 +9634,7 @@ class Module {
|
|
|
9613
9634
|
for (const name of Object.keys(this.exports)) {
|
|
9614
9635
|
allExportNames.add(name);
|
|
9615
9636
|
}
|
|
9616
|
-
for (const name of Object.keys(this.
|
|
9637
|
+
for (const name of Object.keys(this.reexportDescriptions)) {
|
|
9617
9638
|
allExportNames.add(name);
|
|
9618
9639
|
}
|
|
9619
9640
|
for (const module of this.exportAllModules) {
|
|
@@ -9677,7 +9698,7 @@ class Module {
|
|
|
9677
9698
|
// to avoid infinite recursion when using circular `export * from X`
|
|
9678
9699
|
this.transitiveReexports = [];
|
|
9679
9700
|
const reexports = new Set();
|
|
9680
|
-
for (const name in this.
|
|
9701
|
+
for (const name in this.reexportDescriptions) {
|
|
9681
9702
|
reexports.add(name);
|
|
9682
9703
|
}
|
|
9683
9704
|
for (const module of this.exportAllModules) {
|
|
@@ -9718,7 +9739,7 @@ class Module {
|
|
|
9718
9739
|
}
|
|
9719
9740
|
}
|
|
9720
9741
|
// export { foo } from './other'
|
|
9721
|
-
const reexportDeclaration = this.
|
|
9742
|
+
const reexportDeclaration = this.reexportDescriptions[name];
|
|
9722
9743
|
if (reexportDeclaration) {
|
|
9723
9744
|
const declaration = reexportDeclaration.module.getVariableForExportName(reexportDeclaration.localName);
|
|
9724
9745
|
if (!declaration) {
|
|
@@ -9799,18 +9820,14 @@ class Module {
|
|
|
9799
9820
|
this.dynamicDependencies.push(resolution);
|
|
9800
9821
|
}
|
|
9801
9822
|
}
|
|
9802
|
-
this.
|
|
9803
|
-
this.
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
const
|
|
9807
|
-
|
|
9808
|
-
}
|
|
9809
|
-
|
|
9810
|
-
const aExternal = moduleA instanceof ExternalModule;
|
|
9811
|
-
const bExternal = moduleB instanceof ExternalModule;
|
|
9812
|
-
return aExternal === bExternal ? 0 : aExternal ? 1 : -1;
|
|
9813
|
-
});
|
|
9823
|
+
this.addModulesToImportDescriptions(this.importDescriptions);
|
|
9824
|
+
this.addModulesToImportDescriptions(this.reexportDescriptions);
|
|
9825
|
+
const externalExportAllModules = [];
|
|
9826
|
+
for (const source of this.exportAllSources) {
|
|
9827
|
+
const module = this.graph.moduleById.get(this.resolvedIds[source].id);
|
|
9828
|
+
(module instanceof ExternalModule ? externalExportAllModules : this.exportAllModules).push(module);
|
|
9829
|
+
}
|
|
9830
|
+
this.exportAllModules = this.exportAllModules.concat(externalExportAllModules);
|
|
9814
9831
|
}
|
|
9815
9832
|
render(options) {
|
|
9816
9833
|
const magicString = this.magicString.clone();
|
|
@@ -9936,58 +9953,40 @@ class Module {
|
|
|
9936
9953
|
this.dynamicImports.push({ node, resolution: null });
|
|
9937
9954
|
}
|
|
9938
9955
|
addExport(node) {
|
|
9939
|
-
|
|
9940
|
-
// export { name } from './other'
|
|
9941
|
-
if (source) {
|
|
9942
|
-
if (this.sources.indexOf(source) === -1)
|
|
9943
|
-
this.sources.push(source);
|
|
9944
|
-
if (node.type === ExportAllDeclaration) {
|
|
9945
|
-
// Store `export * from '...'` statements in an array of delegates.
|
|
9946
|
-
// When an unknown import is encountered, we see if one of them can satisfy it.
|
|
9947
|
-
this.exportAllSources.push(source);
|
|
9948
|
-
}
|
|
9949
|
-
else {
|
|
9950
|
-
for (const specifier of node.specifiers) {
|
|
9951
|
-
const name = specifier.exported.name;
|
|
9952
|
-
if (this.exports[name] || this.reexports[name]) {
|
|
9953
|
-
this.error({
|
|
9954
|
-
code: 'DUPLICATE_EXPORT',
|
|
9955
|
-
message: `A module cannot have multiple exports with the same name ('${name}')`
|
|
9956
|
-
}, specifier.start);
|
|
9957
|
-
}
|
|
9958
|
-
this.reexports[name] = {
|
|
9959
|
-
localName: specifier.local.name,
|
|
9960
|
-
module: null,
|
|
9961
|
-
source,
|
|
9962
|
-
start: specifier.start
|
|
9963
|
-
};
|
|
9964
|
-
}
|
|
9965
|
-
}
|
|
9966
|
-
}
|
|
9967
|
-
else if (node instanceof ExportDefaultDeclaration) {
|
|
9968
|
-
// export default function foo () {}
|
|
9956
|
+
if (node instanceof ExportDefaultDeclaration) {
|
|
9969
9957
|
// export default foo;
|
|
9970
|
-
// export default 42;
|
|
9971
|
-
if (this.exports.default) {
|
|
9972
|
-
this.error({
|
|
9973
|
-
code: 'DUPLICATE_EXPORT',
|
|
9974
|
-
message: `A module can only have one default export`
|
|
9975
|
-
}, node.start);
|
|
9976
|
-
}
|
|
9977
9958
|
this.exports.default = {
|
|
9978
9959
|
identifier: node.variable.getAssignedVariableName(),
|
|
9979
9960
|
localName: 'default'
|
|
9980
9961
|
};
|
|
9981
9962
|
}
|
|
9963
|
+
else if (node instanceof ExportAllDeclaration) {
|
|
9964
|
+
// export * from './other'
|
|
9965
|
+
const source = node.source.value;
|
|
9966
|
+
this.sources.add(source);
|
|
9967
|
+
this.exportAllSources.add(source);
|
|
9968
|
+
}
|
|
9969
|
+
else if (node.source !== null) {
|
|
9970
|
+
// export { name } from './other'
|
|
9971
|
+
const source = node.source.value;
|
|
9972
|
+
this.sources.add(source);
|
|
9973
|
+
for (const specifier of node.specifiers) {
|
|
9974
|
+
const name = specifier.exported.name;
|
|
9975
|
+
this.reexportDescriptions[name] = {
|
|
9976
|
+
localName: specifier.type === ExportNamespaceSpecifier ? '*' : specifier.local.name,
|
|
9977
|
+
module: null,
|
|
9978
|
+
source,
|
|
9979
|
+
start: specifier.start
|
|
9980
|
+
};
|
|
9981
|
+
}
|
|
9982
|
+
}
|
|
9982
9983
|
else if (node.declaration) {
|
|
9983
|
-
// export var { foo, bar } = ...
|
|
9984
|
-
// export var foo = 42;
|
|
9985
|
-
// export var a = 1, b = 2, c = 3;
|
|
9986
|
-
// export function foo () {}
|
|
9987
9984
|
const declaration = node.declaration;
|
|
9988
|
-
if (declaration
|
|
9989
|
-
|
|
9990
|
-
|
|
9985
|
+
if (declaration instanceof VariableDeclaration) {
|
|
9986
|
+
// export var { foo, bar } = ...
|
|
9987
|
+
// export var foo = 1, bar = 2;
|
|
9988
|
+
for (const declarator of declaration.declarations) {
|
|
9989
|
+
for (const localName of extractAssignedNames(declarator.id)) {
|
|
9991
9990
|
this.exports[localName] = { identifier: null, localName };
|
|
9992
9991
|
}
|
|
9993
9992
|
}
|
|
@@ -10003,20 +10002,13 @@ class Module {
|
|
|
10003
10002
|
for (const specifier of node.specifiers) {
|
|
10004
10003
|
const localName = specifier.local.name;
|
|
10005
10004
|
const exportedName = specifier.exported.name;
|
|
10006
|
-
if (this.exports[exportedName] || this.reexports[exportedName]) {
|
|
10007
|
-
this.error({
|
|
10008
|
-
code: 'DUPLICATE_EXPORT',
|
|
10009
|
-
message: `A module cannot have multiple exports with the same name ('${exportedName}')`
|
|
10010
|
-
}, specifier.start);
|
|
10011
|
-
}
|
|
10012
10005
|
this.exports[exportedName] = { identifier: null, localName };
|
|
10013
10006
|
}
|
|
10014
10007
|
}
|
|
10015
10008
|
}
|
|
10016
10009
|
addImport(node) {
|
|
10017
10010
|
const source = node.source.value;
|
|
10018
|
-
|
|
10019
|
-
this.sources.push(source);
|
|
10011
|
+
this.sources.add(source);
|
|
10020
10012
|
for (const specifier of node.specifiers) {
|
|
10021
10013
|
const localName = specifier.local.name;
|
|
10022
10014
|
if (this.importDescriptions[localName]) {
|
|
@@ -10038,9 +10030,9 @@ class Module {
|
|
|
10038
10030
|
addImportMeta(node) {
|
|
10039
10031
|
this.importMetas.push(node);
|
|
10040
10032
|
}
|
|
10041
|
-
|
|
10042
|
-
for (const name of Object.keys(
|
|
10043
|
-
const specifier =
|
|
10033
|
+
addModulesToImportDescriptions(importDescription) {
|
|
10034
|
+
for (const name of Object.keys(importDescription)) {
|
|
10035
|
+
const specifier = importDescription[name];
|
|
10044
10036
|
const id = this.resolvedIds[specifier.source].id;
|
|
10045
10037
|
specifier.module = this.graph.moduleById.get(id);
|
|
10046
10038
|
}
|
|
@@ -10739,7 +10731,7 @@ class Chunk$1 {
|
|
|
10739
10731
|
return this.renderedHash;
|
|
10740
10732
|
if (!this.renderedSource)
|
|
10741
10733
|
return '';
|
|
10742
|
-
const hash =
|
|
10734
|
+
const hash = createHash();
|
|
10743
10735
|
const hashAugmentation = this.calculateHashAugmentation();
|
|
10744
10736
|
hash.update(hashAugmentation);
|
|
10745
10737
|
hash.update(this.renderedSource.toString());
|
|
@@ -11151,7 +11143,7 @@ class Chunk$1 {
|
|
|
11151
11143
|
return hashAugmentation;
|
|
11152
11144
|
}
|
|
11153
11145
|
computeContentHashWithDependencies(addons, options, existingNames) {
|
|
11154
|
-
const hash =
|
|
11146
|
+
const hash = createHash();
|
|
11155
11147
|
hash.update([addons.intro, addons.outro, addons.banner, addons.footer].map(addon => addon || '').join(':'));
|
|
11156
11148
|
hash.update(options.format);
|
|
11157
11149
|
this.visitDependencies(dep => {
|
|
@@ -11431,8 +11423,8 @@ class Chunk$1 {
|
|
|
11431
11423
|
}
|
|
11432
11424
|
}
|
|
11433
11425
|
if (module.getOrCreateNamespace().included) {
|
|
11434
|
-
for (const reexportName of Object.keys(module.
|
|
11435
|
-
const reexport = module.
|
|
11426
|
+
for (const reexportName of Object.keys(module.reexportDescriptions)) {
|
|
11427
|
+
const reexport = module.reexportDescriptions[reexportName];
|
|
11436
11428
|
const variable = reexport.module.getVariableForExportName(reexport.localName);
|
|
11437
11429
|
if (variable.module.chunk !== this) {
|
|
11438
11430
|
this.imports.add(variable);
|
|
@@ -11559,25 +11551,54 @@ function optimizeChunks(chunks, options, CHUNK_GROUPING_SIZE, inputBase) {
|
|
|
11559
11551
|
return chunks;
|
|
11560
11552
|
}
|
|
11561
11553
|
|
|
11562
|
-
const tt = acorn.tokTypes;
|
|
11563
11554
|
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
11555
|
+
const tt = acorn.tokTypes;
|
|
11556
|
+
var acornExportNsFrom = function (Parser) {
|
|
11557
|
+
return class extends Parser {
|
|
11558
|
+
parseExport(node, exports) {
|
|
11559
|
+
skipWhiteSpace.lastIndex = this.pos;
|
|
11560
|
+
const skip = skipWhiteSpace.exec(this.input);
|
|
11561
|
+
const next = this.input.charAt(this.pos + skip[0].length);
|
|
11562
|
+
if (next !== "*")
|
|
11563
|
+
return super.parseExport(node, exports);
|
|
11564
|
+
this.next();
|
|
11565
|
+
const specifier = this.startNode();
|
|
11566
|
+
this.expect(tt.star);
|
|
11567
|
+
if (this.eatContextual("as")) {
|
|
11568
|
+
node.declaration = null;
|
|
11569
|
+
specifier.exported = this.parseIdent(true);
|
|
11570
|
+
this.checkExport(exports, specifier.exported.name, this.lastTokStart);
|
|
11571
|
+
node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")];
|
|
11572
|
+
}
|
|
11573
|
+
this.expectContextual("from");
|
|
11574
|
+
if (this.type !== tt.string)
|
|
11575
|
+
this.unexpected();
|
|
11576
|
+
node.source = this.parseExprAtom();
|
|
11577
|
+
this.semicolon();
|
|
11578
|
+
return this.finishNode(node, node.specifiers ? "ExportNamedDeclaration" : "ExportAllDeclaration");
|
|
11579
|
+
}
|
|
11580
|
+
};
|
|
11581
|
+
};
|
|
11582
|
+
|
|
11583
|
+
const tt$1 = acorn.tokTypes;
|
|
11584
|
+
const skipWhiteSpace$1 = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
11564
11585
|
const nextTokenIsDot = parser => {
|
|
11565
|
-
skipWhiteSpace.lastIndex = parser.pos;
|
|
11566
|
-
let skip = skipWhiteSpace.exec(parser.input);
|
|
11586
|
+
skipWhiteSpace$1.lastIndex = parser.pos;
|
|
11587
|
+
let skip = skipWhiteSpace$1.exec(parser.input);
|
|
11567
11588
|
let next = parser.pos + skip[0].length;
|
|
11568
11589
|
return parser.input.slice(next, next + 1) === ".";
|
|
11569
11590
|
};
|
|
11570
11591
|
var acornImportMeta = function (Parser) {
|
|
11571
11592
|
return class extends Parser {
|
|
11572
11593
|
parseExprAtom(refDestructuringErrors) {
|
|
11573
|
-
if (this.type !== tt._import || !nextTokenIsDot(this))
|
|
11594
|
+
if (this.type !== tt$1._import || !nextTokenIsDot(this))
|
|
11574
11595
|
return super.parseExprAtom(refDestructuringErrors);
|
|
11575
11596
|
if (!this.options.allowImportExportEverywhere && !this.inModule) {
|
|
11576
11597
|
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
|
|
11577
11598
|
}
|
|
11578
11599
|
let node = this.startNode();
|
|
11579
11600
|
node.meta = this.parseIdent(true);
|
|
11580
|
-
this.expect(tt.dot);
|
|
11601
|
+
this.expect(tt$1.dot);
|
|
11581
11602
|
node.property = this.parseIdent(true);
|
|
11582
11603
|
if (node.property.name !== "meta") {
|
|
11583
11604
|
this.raiseRecoverable(node.property.start, "The only valid meta property for import is import.meta");
|
|
@@ -11588,7 +11609,7 @@ var acornImportMeta = function (Parser) {
|
|
|
11588
11609
|
return this.finishNode(node, "MetaProperty");
|
|
11589
11610
|
}
|
|
11590
11611
|
parseStatement(context, topLevel, exports) {
|
|
11591
|
-
if (this.type !== tt._import || !nextTokenIsDot(this)) {
|
|
11612
|
+
if (this.type !== tt$1._import || !nextTokenIsDot(this)) {
|
|
11592
11613
|
return super.parseStatement(context, topLevel, exports);
|
|
11593
11614
|
}
|
|
11594
11615
|
let node = this.startNode();
|
|
@@ -11629,11 +11650,13 @@ var BuildPhase;
|
|
|
11629
11650
|
BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
|
|
11630
11651
|
})(BuildPhase || (BuildPhase = {}));
|
|
11631
11652
|
|
|
11653
|
+
const createHash$1 = () => crypto.createHash('sha256');
|
|
11654
|
+
|
|
11632
11655
|
function generateAssetFileName(name, source, output) {
|
|
11633
11656
|
const emittedName = name || 'asset';
|
|
11634
11657
|
return makeUnique(renderNamePattern(output.assetFileNames, 'output.assetFileNames', {
|
|
11635
11658
|
hash() {
|
|
11636
|
-
const hash =
|
|
11659
|
+
const hash = createHash$1();
|
|
11637
11660
|
hash.update(emittedName);
|
|
11638
11661
|
hash.update(':');
|
|
11639
11662
|
hash.update(source);
|
|
@@ -11810,7 +11833,7 @@ class FileEmitter {
|
|
|
11810
11833
|
assignReferenceId(file, idBase) {
|
|
11811
11834
|
let referenceId;
|
|
11812
11835
|
do {
|
|
11813
|
-
const hash =
|
|
11836
|
+
const hash = createHash$1();
|
|
11814
11837
|
if (referenceId) {
|
|
11815
11838
|
hash.update(referenceId);
|
|
11816
11839
|
}
|
|
@@ -11957,7 +11980,7 @@ function createPluginDriver(graph, options, pluginCache, watcher) {
|
|
|
11957
11980
|
id: foundModule.id,
|
|
11958
11981
|
importedIds: foundModule instanceof ExternalModule
|
|
11959
11982
|
? []
|
|
11960
|
-
: foundModule.sources.map(id => foundModule.resolvedIds[id].id),
|
|
11983
|
+
: Array.from(foundModule.sources).map(id => foundModule.resolvedIds[id].id),
|
|
11961
11984
|
isEntry: foundModule instanceof Module && foundModule.isEntryPoint,
|
|
11962
11985
|
isExternal: foundModule instanceof ExternalModule
|
|
11963
11986
|
};
|
|
@@ -12546,26 +12569,29 @@ class ModuleLoader {
|
|
|
12546
12569
|
return getCombinedPromise().then(() => loadNewModulesPromise);
|
|
12547
12570
|
}
|
|
12548
12571
|
fetchAllDependencies(module) {
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
return
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
dynamicImport
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12572
|
+
return Promise.all([
|
|
12573
|
+
...Array.from(module.sources).map((source) => __awaiter(this, void 0, void 0, function* () {
|
|
12574
|
+
return this.fetchResolvedDependency(source, module.id, (module.resolvedIds[source] =
|
|
12575
|
+
module.resolvedIds[source] ||
|
|
12576
|
+
this.handleMissingImports(yield this.resolveId(source, module.id), source, module.id)));
|
|
12577
|
+
})),
|
|
12578
|
+
...module.getDynamicImportExpressions().map((specifier, index$1) => this.resolveDynamicImport(module, specifier, module.id).then(resolvedId => {
|
|
12579
|
+
if (resolvedId === null)
|
|
12580
|
+
return;
|
|
12581
|
+
const dynamicImport = module.dynamicImports[index$1];
|
|
12582
|
+
if (typeof resolvedId === 'string') {
|
|
12583
|
+
dynamicImport.resolution = resolvedId;
|
|
12584
|
+
return;
|
|
12585
|
+
}
|
|
12586
|
+
return this.fetchResolvedDependency(index.relativeId(resolvedId.id), module.id, resolvedId).then(module => {
|
|
12587
|
+
dynamicImport.resolution = module;
|
|
12588
|
+
});
|
|
12589
|
+
}))
|
|
12590
|
+
]);
|
|
12563
12591
|
}
|
|
12564
12592
|
fetchModule(id, importer, moduleSideEffects, isEntry) {
|
|
12565
12593
|
const existingModule = this.modulesById.get(id);
|
|
12566
|
-
if (existingModule) {
|
|
12567
|
-
if (existingModule instanceof ExternalModule)
|
|
12568
|
-
throw new Error(`Cannot fetch external module ${id}`);
|
|
12594
|
+
if (existingModule instanceof Module) {
|
|
12569
12595
|
existingModule.isEntryPoint = existingModule.isEntryPoint || isEntry;
|
|
12570
12596
|
return Promise.resolve(existingModule);
|
|
12571
12597
|
}
|
|
@@ -12620,11 +12646,11 @@ class ModuleLoader {
|
|
|
12620
12646
|
module.exportsAll[name] = module.id;
|
|
12621
12647
|
}
|
|
12622
12648
|
}
|
|
12623
|
-
module.exportAllSources
|
|
12649
|
+
for (const source of module.exportAllSources) {
|
|
12624
12650
|
const id = module.resolvedIds[source].id;
|
|
12625
12651
|
const exportAllModule = this.modulesById.get(id);
|
|
12626
12652
|
if (exportAllModule instanceof ExternalModule)
|
|
12627
|
-
|
|
12653
|
+
continue;
|
|
12628
12654
|
for (const name in exportAllModule.exportsAll) {
|
|
12629
12655
|
if (name in module.exportsAll) {
|
|
12630
12656
|
this.graph.warn(errNamespaceConflict(name, module, exportAllModule));
|
|
@@ -12633,7 +12659,7 @@ class ModuleLoader {
|
|
|
12633
12659
|
module.exportsAll[name] = exportAllModule.exportsAll[name];
|
|
12634
12660
|
}
|
|
12635
12661
|
}
|
|
12636
|
-
}
|
|
12662
|
+
}
|
|
12637
12663
|
return module;
|
|
12638
12664
|
});
|
|
12639
12665
|
});
|
|
@@ -12703,13 +12729,6 @@ class ModuleLoader {
|
|
|
12703
12729
|
: this.hasModuleSideEffects(id, external)
|
|
12704
12730
|
};
|
|
12705
12731
|
}
|
|
12706
|
-
resolveAndFetchDependency(module, source) {
|
|
12707
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
12708
|
-
return this.fetchResolvedDependency(source, module.id, (module.resolvedIds[source] =
|
|
12709
|
-
module.resolvedIds[source] ||
|
|
12710
|
-
this.handleMissingImports(yield this.resolveId(source, module.id), source, module.id)));
|
|
12711
|
-
});
|
|
12712
|
-
}
|
|
12713
12732
|
resolveDynamicImport(module, specifier, importer) {
|
|
12714
12733
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12715
12734
|
// TODO we only should expose the acorn AST here
|
|
@@ -12926,7 +12945,7 @@ class Graph {
|
|
|
12926
12945
|
}
|
|
12927
12946
|
this.acornOptions = options.acorn ? Object.assign({}, options.acorn) : {};
|
|
12928
12947
|
const acornPluginsToInject = [];
|
|
12929
|
-
acornPluginsToInject.push(acornImportMeta);
|
|
12948
|
+
acornPluginsToInject.push(acornImportMeta, acornExportNsFrom);
|
|
12930
12949
|
if (options.experimentalTopLevelAwait) {
|
|
12931
12950
|
this.acornOptions.allowAwaitOutsideFunction = true;
|
|
12932
12951
|
}
|
|
@@ -16758,12 +16777,12 @@ class FileWatcher {
|
|
|
16758
16777
|
}
|
|
16759
16778
|
}
|
|
16760
16779
|
trigger(id) {
|
|
16761
|
-
this.tasks
|
|
16780
|
+
for (const task of this.tasks) {
|
|
16762
16781
|
task.invalidate(id, false);
|
|
16763
|
-
}
|
|
16764
|
-
this.transformDependencyTasks
|
|
16782
|
+
}
|
|
16783
|
+
for (const task of this.transformDependencyTasks) {
|
|
16765
16784
|
task.invalidate(id, true);
|
|
16766
|
-
}
|
|
16785
|
+
}
|
|
16767
16786
|
}
|
|
16768
16787
|
}
|
|
16769
16788
|
|