@vixt/react 0.7.4 → 0.8.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/dist/index.mjs +620 -620
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -28,8 +28,8 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
28
28
|
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
29
29
|
var __copyProps = (to, from, except, desc) => {
|
|
30
30
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
31
|
-
for (var keys = __getOwnPropNames(from), i
|
|
32
|
-
key = keys[i
|
|
31
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
32
|
+
key = keys[i];
|
|
33
33
|
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
34
34
|
__defProp(to, key, {
|
|
35
35
|
get: ((k) => from[k]).bind(null, key),
|
|
@@ -52,8 +52,8 @@ var require_universalify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
52
52
|
exports.fromCallback = function(fn) {
|
|
53
53
|
return Object.defineProperty(function(...args) {
|
|
54
54
|
if (typeof args[args.length - 1] === "function") fn.apply(this, args);
|
|
55
|
-
else return new Promise((resolve
|
|
56
|
-
args.push((err, res) => err != null ? reject(err) : resolve
|
|
55
|
+
else return new Promise((resolve, reject) => {
|
|
56
|
+
args.push((err, res) => err != null ? reject(err) : resolve(res));
|
|
57
57
|
fn.apply(this, args);
|
|
58
58
|
});
|
|
59
59
|
}, "name", { value: fn.name });
|
|
@@ -64,7 +64,7 @@ var require_universalify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
64
64
|
if (typeof cb !== "function") return fn.apply(this, args);
|
|
65
65
|
else {
|
|
66
66
|
args.pop();
|
|
67
|
-
fn.apply(this, args).then((r
|
|
67
|
+
fn.apply(this, args).then((r) => cb(null, r), cb);
|
|
68
68
|
}
|
|
69
69
|
}, "name", { value: fn.name });
|
|
70
70
|
};
|
|
@@ -93,47 +93,47 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
93
93
|
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
94
94
|
}
|
|
95
95
|
module.exports = patch;
|
|
96
|
-
function patch(fs
|
|
97
|
-
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs
|
|
98
|
-
if (!fs
|
|
99
|
-
fs
|
|
100
|
-
fs
|
|
101
|
-
fs
|
|
102
|
-
fs
|
|
103
|
-
fs
|
|
104
|
-
fs
|
|
105
|
-
fs
|
|
106
|
-
fs
|
|
107
|
-
fs
|
|
108
|
-
fs
|
|
109
|
-
fs
|
|
110
|
-
fs
|
|
111
|
-
fs
|
|
112
|
-
fs
|
|
113
|
-
fs
|
|
114
|
-
fs
|
|
115
|
-
fs
|
|
116
|
-
fs
|
|
117
|
-
if (fs
|
|
118
|
-
fs
|
|
96
|
+
function patch(fs) {
|
|
97
|
+
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
|
|
98
|
+
if (!fs.lutimes) patchLutimes(fs);
|
|
99
|
+
fs.chown = chownFix(fs.chown);
|
|
100
|
+
fs.fchown = chownFix(fs.fchown);
|
|
101
|
+
fs.lchown = chownFix(fs.lchown);
|
|
102
|
+
fs.chmod = chmodFix(fs.chmod);
|
|
103
|
+
fs.fchmod = chmodFix(fs.fchmod);
|
|
104
|
+
fs.lchmod = chmodFix(fs.lchmod);
|
|
105
|
+
fs.chownSync = chownFixSync(fs.chownSync);
|
|
106
|
+
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
107
|
+
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
108
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
109
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
110
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
111
|
+
fs.stat = statFix(fs.stat);
|
|
112
|
+
fs.fstat = statFix(fs.fstat);
|
|
113
|
+
fs.lstat = statFix(fs.lstat);
|
|
114
|
+
fs.statSync = statFixSync(fs.statSync);
|
|
115
|
+
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
116
|
+
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
117
|
+
if (fs.chmod && !fs.lchmod) {
|
|
118
|
+
fs.lchmod = function(path, mode, cb) {
|
|
119
119
|
if (cb) process.nextTick(cb);
|
|
120
120
|
};
|
|
121
|
-
fs
|
|
121
|
+
fs.lchmodSync = function() {};
|
|
122
122
|
}
|
|
123
|
-
if (fs
|
|
124
|
-
fs
|
|
123
|
+
if (fs.chown && !fs.lchown) {
|
|
124
|
+
fs.lchown = function(path, uid, gid, cb) {
|
|
125
125
|
if (cb) process.nextTick(cb);
|
|
126
126
|
};
|
|
127
|
-
fs
|
|
127
|
+
fs.lchownSync = function() {};
|
|
128
128
|
}
|
|
129
|
-
if (platform === "win32") fs
|
|
129
|
+
if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
|
|
130
130
|
function rename(from, to, cb) {
|
|
131
131
|
var start = Date.now();
|
|
132
132
|
var backoff = 0;
|
|
133
133
|
fs$rename(from, to, function CB(er) {
|
|
134
134
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
135
135
|
setTimeout(function() {
|
|
136
|
-
fs
|
|
136
|
+
fs.stat(to, function(stater, st) {
|
|
137
137
|
if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
|
|
138
138
|
else cb(er);
|
|
139
139
|
});
|
|
@@ -146,30 +146,30 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
146
146
|
}
|
|
147
147
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
148
148
|
return rename;
|
|
149
|
-
})(fs
|
|
150
|
-
fs
|
|
151
|
-
function read
|
|
149
|
+
})(fs.rename);
|
|
150
|
+
fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
|
|
151
|
+
function read(fd, buffer, offset, length, position, callback_) {
|
|
152
152
|
var callback;
|
|
153
153
|
if (callback_ && typeof callback_ === "function") {
|
|
154
154
|
var eagCounter = 0;
|
|
155
155
|
callback = function(er, _, __) {
|
|
156
156
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
157
157
|
eagCounter++;
|
|
158
|
-
return fs$read.call(fs
|
|
158
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
159
159
|
}
|
|
160
160
|
callback_.apply(this, arguments);
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
|
-
return fs$read.call(fs
|
|
163
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
164
164
|
}
|
|
165
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(read
|
|
166
|
-
return read
|
|
167
|
-
})(fs
|
|
168
|
-
fs
|
|
165
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
166
|
+
return read;
|
|
167
|
+
})(fs.read);
|
|
168
|
+
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
|
|
169
169
|
return function(fd, buffer, offset, length, position) {
|
|
170
170
|
var eagCounter = 0;
|
|
171
171
|
while (true) try {
|
|
172
|
-
return fs$readSync.call(fs
|
|
172
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
173
173
|
} catch (er) {
|
|
174
174
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
175
175
|
eagCounter++;
|
|
@@ -178,78 +178,78 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
178
178
|
throw er;
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
|
-
})(fs
|
|
182
|
-
function patchLchmod(fs
|
|
183
|
-
fs
|
|
184
|
-
fs
|
|
181
|
+
})(fs.readSync);
|
|
182
|
+
function patchLchmod(fs) {
|
|
183
|
+
fs.lchmod = function(path, mode, callback) {
|
|
184
|
+
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
|
|
185
185
|
if (err) {
|
|
186
186
|
if (callback) callback(err);
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
|
-
fs
|
|
190
|
-
fs
|
|
191
|
-
if (callback) callback(err
|
|
189
|
+
fs.fchmod(fd, mode, function(err) {
|
|
190
|
+
fs.close(fd, function(err2) {
|
|
191
|
+
if (callback) callback(err || err2);
|
|
192
192
|
});
|
|
193
193
|
});
|
|
194
194
|
});
|
|
195
195
|
};
|
|
196
|
-
fs
|
|
197
|
-
var fd = fs
|
|
196
|
+
fs.lchmodSync = function(path, mode) {
|
|
197
|
+
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
198
198
|
var threw = true;
|
|
199
199
|
var ret;
|
|
200
200
|
try {
|
|
201
|
-
ret = fs
|
|
201
|
+
ret = fs.fchmodSync(fd, mode);
|
|
202
202
|
threw = false;
|
|
203
203
|
} finally {
|
|
204
204
|
if (threw) try {
|
|
205
|
-
fs
|
|
205
|
+
fs.closeSync(fd);
|
|
206
206
|
} catch (er) {}
|
|
207
|
-
else fs
|
|
207
|
+
else fs.closeSync(fd);
|
|
208
208
|
}
|
|
209
209
|
return ret;
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
function patchLutimes(fs
|
|
213
|
-
if (constants.hasOwnProperty("O_SYMLINK") && fs
|
|
214
|
-
fs
|
|
215
|
-
fs
|
|
212
|
+
function patchLutimes(fs) {
|
|
213
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
|
|
214
|
+
fs.lutimes = function(path, at, mt, cb) {
|
|
215
|
+
fs.open(path, constants.O_SYMLINK, function(er, fd) {
|
|
216
216
|
if (er) {
|
|
217
217
|
if (cb) cb(er);
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
|
-
fs
|
|
221
|
-
fs
|
|
222
|
-
if (cb) cb(er
|
|
220
|
+
fs.futimes(fd, at, mt, function(er) {
|
|
221
|
+
fs.close(fd, function(er2) {
|
|
222
|
+
if (cb) cb(er || er2);
|
|
223
223
|
});
|
|
224
224
|
});
|
|
225
225
|
});
|
|
226
226
|
};
|
|
227
|
-
fs
|
|
228
|
-
var fd = fs
|
|
227
|
+
fs.lutimesSync = function(path, at, mt) {
|
|
228
|
+
var fd = fs.openSync(path, constants.O_SYMLINK);
|
|
229
229
|
var ret;
|
|
230
230
|
var threw = true;
|
|
231
231
|
try {
|
|
232
|
-
ret = fs
|
|
232
|
+
ret = fs.futimesSync(fd, at, mt);
|
|
233
233
|
threw = false;
|
|
234
234
|
} finally {
|
|
235
235
|
if (threw) try {
|
|
236
|
-
fs
|
|
236
|
+
fs.closeSync(fd);
|
|
237
237
|
} catch (er) {}
|
|
238
|
-
else fs
|
|
238
|
+
else fs.closeSync(fd);
|
|
239
239
|
}
|
|
240
240
|
return ret;
|
|
241
241
|
};
|
|
242
|
-
} else if (fs
|
|
243
|
-
fs
|
|
242
|
+
} else if (fs.futimes) {
|
|
243
|
+
fs.lutimes = function(_a, _b, _c, cb) {
|
|
244
244
|
if (cb) process.nextTick(cb);
|
|
245
245
|
};
|
|
246
|
-
fs
|
|
246
|
+
fs.lutimesSync = function() {};
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
function chmodFix(orig) {
|
|
250
250
|
if (!orig) return orig;
|
|
251
251
|
return function(target, mode, cb) {
|
|
252
|
-
return orig.call(fs
|
|
252
|
+
return orig.call(fs, target, mode, function(er) {
|
|
253
253
|
if (chownErOk(er)) er = null;
|
|
254
254
|
if (cb) cb.apply(this, arguments);
|
|
255
255
|
});
|
|
@@ -259,7 +259,7 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
259
259
|
if (!orig) return orig;
|
|
260
260
|
return function(target, mode) {
|
|
261
261
|
try {
|
|
262
|
-
return orig.call(fs
|
|
262
|
+
return orig.call(fs, target, mode);
|
|
263
263
|
} catch (er) {
|
|
264
264
|
if (!chownErOk(er)) throw er;
|
|
265
265
|
}
|
|
@@ -268,7 +268,7 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
268
268
|
function chownFix(orig) {
|
|
269
269
|
if (!orig) return orig;
|
|
270
270
|
return function(target, uid, gid, cb) {
|
|
271
|
-
return orig.call(fs
|
|
271
|
+
return orig.call(fs, target, uid, gid, function(er) {
|
|
272
272
|
if (chownErOk(er)) er = null;
|
|
273
273
|
if (cb) cb.apply(this, arguments);
|
|
274
274
|
});
|
|
@@ -278,7 +278,7 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
278
278
|
if (!orig) return orig;
|
|
279
279
|
return function(target, uid, gid) {
|
|
280
280
|
try {
|
|
281
|
-
return orig.call(fs
|
|
281
|
+
return orig.call(fs, target, uid, gid);
|
|
282
282
|
} catch (er) {
|
|
283
283
|
if (!chownErOk(er)) throw er;
|
|
284
284
|
}
|
|
@@ -298,13 +298,13 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
298
298
|
}
|
|
299
299
|
if (cb) cb.apply(this, arguments);
|
|
300
300
|
}
|
|
301
|
-
return options ? orig.call(fs
|
|
301
|
+
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
304
|
function statFixSync(orig) {
|
|
305
305
|
if (!orig) return orig;
|
|
306
306
|
return function(target, options) {
|
|
307
|
-
var stats = options ? orig.call(fs
|
|
307
|
+
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
308
308
|
if (stats) {
|
|
309
309
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
310
310
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -328,16 +328,16 @@ var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
328
328
|
var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
329
329
|
var Stream = __require("stream").Stream;
|
|
330
330
|
module.exports = legacy;
|
|
331
|
-
function legacy(fs
|
|
331
|
+
function legacy(fs) {
|
|
332
332
|
return {
|
|
333
333
|
ReadStream,
|
|
334
334
|
WriteStream
|
|
335
335
|
};
|
|
336
|
-
function ReadStream(path
|
|
337
|
-
if (!(this instanceof ReadStream)) return new ReadStream(path
|
|
336
|
+
function ReadStream(path, options) {
|
|
337
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
338
338
|
Stream.call(this);
|
|
339
339
|
var self = this;
|
|
340
|
-
this.path = path
|
|
340
|
+
this.path = path;
|
|
341
341
|
this.fd = null;
|
|
342
342
|
this.readable = true;
|
|
343
343
|
this.paused = false;
|
|
@@ -364,7 +364,7 @@ var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
364
364
|
});
|
|
365
365
|
return;
|
|
366
366
|
}
|
|
367
|
-
fs
|
|
367
|
+
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
368
368
|
if (err) {
|
|
369
369
|
self.emit("error", err);
|
|
370
370
|
self.readable = false;
|
|
@@ -375,10 +375,10 @@ var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
375
375
|
self._read();
|
|
376
376
|
});
|
|
377
377
|
}
|
|
378
|
-
function WriteStream(path
|
|
379
|
-
if (!(this instanceof WriteStream)) return new WriteStream(path
|
|
378
|
+
function WriteStream(path, options) {
|
|
379
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
380
380
|
Stream.call(this);
|
|
381
|
-
this.path = path
|
|
381
|
+
this.path = path;
|
|
382
382
|
this.fd = null;
|
|
383
383
|
this.writable = true;
|
|
384
384
|
this.flags = "w";
|
|
@@ -399,7 +399,7 @@ var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
399
399
|
this.busy = false;
|
|
400
400
|
this._queue = [];
|
|
401
401
|
if (this.fd === null) {
|
|
402
|
-
this._open = fs
|
|
402
|
+
this._open = fs.open;
|
|
403
403
|
this._queue.push([
|
|
404
404
|
this._open,
|
|
405
405
|
this.path,
|
|
@@ -494,124 +494,124 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
494
494
|
module.exports = patch(fs$4);
|
|
495
495
|
fs$4.__patched = true;
|
|
496
496
|
}
|
|
497
|
-
function patch(fs
|
|
498
|
-
polyfills(fs
|
|
499
|
-
fs
|
|
500
|
-
fs
|
|
501
|
-
fs
|
|
502
|
-
var fs$readFile = fs
|
|
503
|
-
fs
|
|
504
|
-
function readFile(path
|
|
497
|
+
function patch(fs) {
|
|
498
|
+
polyfills(fs);
|
|
499
|
+
fs.gracefulify = patch;
|
|
500
|
+
fs.createReadStream = createReadStream;
|
|
501
|
+
fs.createWriteStream = createWriteStream;
|
|
502
|
+
var fs$readFile = fs.readFile;
|
|
503
|
+
fs.readFile = readFile;
|
|
504
|
+
function readFile(path, options, cb) {
|
|
505
505
|
if (typeof options === "function") cb = options, options = null;
|
|
506
|
-
return go$readFile(path
|
|
507
|
-
function go$readFile(path
|
|
508
|
-
return fs$readFile(path
|
|
506
|
+
return go$readFile(path, options, cb);
|
|
507
|
+
function go$readFile(path, options, cb, startTime) {
|
|
508
|
+
return fs$readFile(path, options, function(err) {
|
|
509
509
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
510
510
|
go$readFile,
|
|
511
511
|
[
|
|
512
|
-
path
|
|
513
|
-
options
|
|
514
|
-
cb
|
|
512
|
+
path,
|
|
513
|
+
options,
|
|
514
|
+
cb
|
|
515
515
|
],
|
|
516
516
|
err,
|
|
517
517
|
startTime || Date.now(),
|
|
518
518
|
Date.now()
|
|
519
519
|
]);
|
|
520
|
-
else if (typeof cb
|
|
520
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
521
521
|
});
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
|
-
var fs$writeFile = fs
|
|
525
|
-
fs
|
|
526
|
-
function writeFile(path
|
|
524
|
+
var fs$writeFile = fs.writeFile;
|
|
525
|
+
fs.writeFile = writeFile;
|
|
526
|
+
function writeFile(path, data, options, cb) {
|
|
527
527
|
if (typeof options === "function") cb = options, options = null;
|
|
528
|
-
return go$writeFile(path
|
|
529
|
-
function go$writeFile(path
|
|
530
|
-
return fs$writeFile(path
|
|
528
|
+
return go$writeFile(path, data, options, cb);
|
|
529
|
+
function go$writeFile(path, data, options, cb, startTime) {
|
|
530
|
+
return fs$writeFile(path, data, options, function(err) {
|
|
531
531
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
532
532
|
go$writeFile,
|
|
533
533
|
[
|
|
534
|
-
path
|
|
535
|
-
data
|
|
536
|
-
options
|
|
537
|
-
cb
|
|
534
|
+
path,
|
|
535
|
+
data,
|
|
536
|
+
options,
|
|
537
|
+
cb
|
|
538
538
|
],
|
|
539
539
|
err,
|
|
540
540
|
startTime || Date.now(),
|
|
541
541
|
Date.now()
|
|
542
542
|
]);
|
|
543
|
-
else if (typeof cb
|
|
543
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
544
544
|
});
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
var fs$appendFile = fs
|
|
548
|
-
if (fs$appendFile) fs
|
|
549
|
-
function appendFile(path
|
|
547
|
+
var fs$appendFile = fs.appendFile;
|
|
548
|
+
if (fs$appendFile) fs.appendFile = appendFile;
|
|
549
|
+
function appendFile(path, data, options, cb) {
|
|
550
550
|
if (typeof options === "function") cb = options, options = null;
|
|
551
|
-
return go$appendFile(path
|
|
552
|
-
function go$appendFile(path
|
|
553
|
-
return fs$appendFile(path
|
|
551
|
+
return go$appendFile(path, data, options, cb);
|
|
552
|
+
function go$appendFile(path, data, options, cb, startTime) {
|
|
553
|
+
return fs$appendFile(path, data, options, function(err) {
|
|
554
554
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
555
555
|
go$appendFile,
|
|
556
556
|
[
|
|
557
|
-
path
|
|
558
|
-
data
|
|
559
|
-
options
|
|
560
|
-
cb
|
|
557
|
+
path,
|
|
558
|
+
data,
|
|
559
|
+
options,
|
|
560
|
+
cb
|
|
561
561
|
],
|
|
562
562
|
err,
|
|
563
563
|
startTime || Date.now(),
|
|
564
564
|
Date.now()
|
|
565
565
|
]);
|
|
566
|
-
else if (typeof cb
|
|
566
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
var fs$copyFile = fs
|
|
571
|
-
if (fs$copyFile) fs
|
|
570
|
+
var fs$copyFile = fs.copyFile;
|
|
571
|
+
if (fs$copyFile) fs.copyFile = copyFile;
|
|
572
572
|
function copyFile(src, dest, flags, cb) {
|
|
573
573
|
if (typeof flags === "function") {
|
|
574
574
|
cb = flags;
|
|
575
575
|
flags = 0;
|
|
576
576
|
}
|
|
577
577
|
return go$copyFile(src, dest, flags, cb);
|
|
578
|
-
function go$copyFile(src
|
|
579
|
-
return fs$copyFile(src
|
|
578
|
+
function go$copyFile(src, dest, flags, cb, startTime) {
|
|
579
|
+
return fs$copyFile(src, dest, flags, function(err) {
|
|
580
580
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
581
581
|
go$copyFile,
|
|
582
582
|
[
|
|
583
|
-
src
|
|
584
|
-
dest
|
|
585
|
-
flags
|
|
586
|
-
cb
|
|
583
|
+
src,
|
|
584
|
+
dest,
|
|
585
|
+
flags,
|
|
586
|
+
cb
|
|
587
587
|
],
|
|
588
588
|
err,
|
|
589
589
|
startTime || Date.now(),
|
|
590
590
|
Date.now()
|
|
591
591
|
]);
|
|
592
|
-
else if (typeof cb
|
|
592
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
|
-
var fs$readdir = fs
|
|
597
|
-
fs
|
|
596
|
+
var fs$readdir = fs.readdir;
|
|
597
|
+
fs.readdir = readdir;
|
|
598
598
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
599
|
-
function readdir(path
|
|
599
|
+
function readdir(path, options, cb) {
|
|
600
600
|
if (typeof options === "function") cb = options, options = null;
|
|
601
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir
|
|
602
|
-
return fs$readdir(path
|
|
603
|
-
} : function go$readdir
|
|
604
|
-
return fs$readdir(path
|
|
601
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
|
|
602
|
+
return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
|
|
603
|
+
} : function go$readdir(path, options, cb, startTime) {
|
|
604
|
+
return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
|
|
605
605
|
};
|
|
606
|
-
return go$readdir(path
|
|
607
|
-
function fs$readdirCallback(path
|
|
606
|
+
return go$readdir(path, options, cb);
|
|
607
|
+
function fs$readdirCallback(path, options, cb, startTime) {
|
|
608
608
|
return function(err, files) {
|
|
609
609
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
610
610
|
go$readdir,
|
|
611
611
|
[
|
|
612
|
-
path
|
|
613
|
-
options
|
|
614
|
-
cb
|
|
612
|
+
path,
|
|
613
|
+
options,
|
|
614
|
+
cb
|
|
615
615
|
],
|
|
616
616
|
err,
|
|
617
617
|
startTime || Date.now(),
|
|
@@ -619,27 +619,27 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
619
619
|
]);
|
|
620
620
|
else {
|
|
621
621
|
if (files && files.sort) files.sort();
|
|
622
|
-
if (typeof cb
|
|
622
|
+
if (typeof cb === "function") cb.call(this, err, files);
|
|
623
623
|
}
|
|
624
624
|
};
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
628
|
-
var legStreams = legacy(fs
|
|
628
|
+
var legStreams = legacy(fs);
|
|
629
629
|
ReadStream = legStreams.ReadStream;
|
|
630
630
|
WriteStream = legStreams.WriteStream;
|
|
631
631
|
}
|
|
632
|
-
var fs$ReadStream = fs
|
|
632
|
+
var fs$ReadStream = fs.ReadStream;
|
|
633
633
|
if (fs$ReadStream) {
|
|
634
634
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
635
635
|
ReadStream.prototype.open = ReadStream$open;
|
|
636
636
|
}
|
|
637
|
-
var fs$WriteStream = fs
|
|
637
|
+
var fs$WriteStream = fs.WriteStream;
|
|
638
638
|
if (fs$WriteStream) {
|
|
639
639
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
640
640
|
WriteStream.prototype.open = WriteStream$open;
|
|
641
641
|
}
|
|
642
|
-
Object.defineProperty(fs
|
|
642
|
+
Object.defineProperty(fs, "ReadStream", {
|
|
643
643
|
get: function() {
|
|
644
644
|
return ReadStream;
|
|
645
645
|
},
|
|
@@ -649,7 +649,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
649
649
|
enumerable: true,
|
|
650
650
|
configurable: true
|
|
651
651
|
});
|
|
652
|
-
Object.defineProperty(fs
|
|
652
|
+
Object.defineProperty(fs, "WriteStream", {
|
|
653
653
|
get: function() {
|
|
654
654
|
return WriteStream;
|
|
655
655
|
},
|
|
@@ -660,7 +660,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
660
660
|
configurable: true
|
|
661
661
|
});
|
|
662
662
|
var FileReadStream = ReadStream;
|
|
663
|
-
Object.defineProperty(fs
|
|
663
|
+
Object.defineProperty(fs, "FileReadStream", {
|
|
664
664
|
get: function() {
|
|
665
665
|
return FileReadStream;
|
|
666
666
|
},
|
|
@@ -671,7 +671,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
671
671
|
configurable: true
|
|
672
672
|
});
|
|
673
673
|
var FileWriteStream = WriteStream;
|
|
674
|
-
Object.defineProperty(fs
|
|
674
|
+
Object.defineProperty(fs, "FileWriteStream", {
|
|
675
675
|
get: function() {
|
|
676
676
|
return FileWriteStream;
|
|
677
677
|
},
|
|
@@ -681,7 +681,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
681
681
|
enumerable: true,
|
|
682
682
|
configurable: true
|
|
683
683
|
});
|
|
684
|
-
function ReadStream(path
|
|
684
|
+
function ReadStream(path, options) {
|
|
685
685
|
if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
|
|
686
686
|
else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
687
687
|
}
|
|
@@ -698,7 +698,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
698
698
|
}
|
|
699
699
|
});
|
|
700
700
|
}
|
|
701
|
-
function WriteStream(path
|
|
701
|
+
function WriteStream(path, options) {
|
|
702
702
|
if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
|
|
703
703
|
else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
704
704
|
}
|
|
@@ -714,36 +714,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
714
714
|
}
|
|
715
715
|
});
|
|
716
716
|
}
|
|
717
|
-
function createReadStream(path
|
|
718
|
-
return new fs
|
|
717
|
+
function createReadStream(path, options) {
|
|
718
|
+
return new fs.ReadStream(path, options);
|
|
719
719
|
}
|
|
720
|
-
function createWriteStream(path
|
|
721
|
-
return new fs
|
|
720
|
+
function createWriteStream(path, options) {
|
|
721
|
+
return new fs.WriteStream(path, options);
|
|
722
722
|
}
|
|
723
|
-
var fs$open = fs
|
|
724
|
-
fs
|
|
725
|
-
function open(path
|
|
723
|
+
var fs$open = fs.open;
|
|
724
|
+
fs.open = open;
|
|
725
|
+
function open(path, flags, mode, cb) {
|
|
726
726
|
if (typeof mode === "function") cb = mode, mode = null;
|
|
727
|
-
return go$open(path
|
|
728
|
-
function go$open(path
|
|
729
|
-
return fs$open(path
|
|
727
|
+
return go$open(path, flags, mode, cb);
|
|
728
|
+
function go$open(path, flags, mode, cb, startTime) {
|
|
729
|
+
return fs$open(path, flags, mode, function(err, fd) {
|
|
730
730
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
731
731
|
go$open,
|
|
732
732
|
[
|
|
733
|
-
path
|
|
734
|
-
flags
|
|
735
|
-
mode
|
|
736
|
-
cb
|
|
733
|
+
path,
|
|
734
|
+
flags,
|
|
735
|
+
mode,
|
|
736
|
+
cb
|
|
737
737
|
],
|
|
738
738
|
err,
|
|
739
739
|
startTime || Date.now(),
|
|
740
740
|
Date.now()
|
|
741
741
|
]);
|
|
742
|
-
else if (typeof cb
|
|
742
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
743
743
|
});
|
|
744
744
|
}
|
|
745
745
|
}
|
|
746
|
-
return fs
|
|
746
|
+
return fs;
|
|
747
747
|
}
|
|
748
748
|
function enqueue(elem) {
|
|
749
749
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
@@ -753,9 +753,9 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
753
753
|
var retryTimer;
|
|
754
754
|
function resetQueue() {
|
|
755
755
|
var now = Date.now();
|
|
756
|
-
for (var i
|
|
757
|
-
fs$4[gracefulQueue][i
|
|
758
|
-
fs$4[gracefulQueue][i
|
|
756
|
+
for (var i = 0; i < fs$4[gracefulQueue].length; ++i) if (fs$4[gracefulQueue][i].length > 2) {
|
|
757
|
+
fs$4[gracefulQueue][i][3] = now;
|
|
758
|
+
fs$4[gracefulQueue][i][4] = now;
|
|
759
759
|
}
|
|
760
760
|
retry();
|
|
761
761
|
}
|
|
@@ -841,54 +841,54 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
841
841
|
});
|
|
842
842
|
exports.exists = function(filename, callback) {
|
|
843
843
|
if (typeof callback === "function") return fs.exists(filename, callback);
|
|
844
|
-
return new Promise((resolve
|
|
845
|
-
return fs.exists(filename, resolve
|
|
844
|
+
return new Promise((resolve) => {
|
|
845
|
+
return fs.exists(filename, resolve);
|
|
846
846
|
});
|
|
847
847
|
};
|
|
848
848
|
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
849
849
|
if (typeof callback === "function") return fs.read(fd, buffer, offset, length, position, callback);
|
|
850
|
-
return new Promise((resolve
|
|
851
|
-
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer
|
|
850
|
+
return new Promise((resolve, reject) => {
|
|
851
|
+
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
|
|
852
852
|
if (err) return reject(err);
|
|
853
|
-
resolve
|
|
853
|
+
resolve({
|
|
854
854
|
bytesRead,
|
|
855
|
-
buffer
|
|
855
|
+
buffer
|
|
856
856
|
});
|
|
857
857
|
});
|
|
858
858
|
});
|
|
859
859
|
};
|
|
860
860
|
exports.write = function(fd, buffer, ...args) {
|
|
861
861
|
if (typeof args[args.length - 1] === "function") return fs.write(fd, buffer, ...args);
|
|
862
|
-
return new Promise((resolve
|
|
863
|
-
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer
|
|
862
|
+
return new Promise((resolve, reject) => {
|
|
863
|
+
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
|
|
864
864
|
if (err) return reject(err);
|
|
865
|
-
resolve
|
|
865
|
+
resolve({
|
|
866
866
|
bytesWritten,
|
|
867
|
-
buffer
|
|
867
|
+
buffer
|
|
868
868
|
});
|
|
869
869
|
});
|
|
870
870
|
});
|
|
871
871
|
};
|
|
872
872
|
exports.readv = function(fd, buffers, ...args) {
|
|
873
873
|
if (typeof args[args.length - 1] === "function") return fs.readv(fd, buffers, ...args);
|
|
874
|
-
return new Promise((resolve
|
|
875
|
-
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers
|
|
874
|
+
return new Promise((resolve, reject) => {
|
|
875
|
+
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => {
|
|
876
876
|
if (err) return reject(err);
|
|
877
|
-
resolve
|
|
877
|
+
resolve({
|
|
878
878
|
bytesRead,
|
|
879
|
-
buffers
|
|
879
|
+
buffers
|
|
880
880
|
});
|
|
881
881
|
});
|
|
882
882
|
});
|
|
883
883
|
};
|
|
884
884
|
exports.writev = function(fd, buffers, ...args) {
|
|
885
885
|
if (typeof args[args.length - 1] === "function") return fs.writev(fd, buffers, ...args);
|
|
886
|
-
return new Promise((resolve
|
|
887
|
-
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers
|
|
886
|
+
return new Promise((resolve, reject) => {
|
|
887
|
+
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
|
|
888
888
|
if (err) return reject(err);
|
|
889
|
-
resolve
|
|
889
|
+
resolve({
|
|
890
890
|
bytesWritten,
|
|
891
|
-
buffers
|
|
891
|
+
buffers
|
|
892
892
|
});
|
|
893
893
|
});
|
|
894
894
|
});
|
|
@@ -962,8 +962,8 @@ var require_mkdirs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
962
962
|
var require_path_exists = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
963
963
|
const u = require_universalify().fromPromise;
|
|
964
964
|
const fs = require_fs();
|
|
965
|
-
function pathExists(path
|
|
966
|
-
return fs.access(path
|
|
965
|
+
function pathExists(path) {
|
|
966
|
+
return fs.access(path).then(() => true).catch(() => false);
|
|
967
967
|
}
|
|
968
968
|
module.exports = {
|
|
969
969
|
pathExists: u(pathExists),
|
|
@@ -976,8 +976,8 @@ var require_path_exists = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
976
976
|
var require_utimes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
977
977
|
const fs = require_fs();
|
|
978
978
|
const u = require_universalify().fromPromise;
|
|
979
|
-
async function utimesMillis(path
|
|
980
|
-
const fd = await fs.open(path
|
|
979
|
+
async function utimesMillis(path, atime, mtime) {
|
|
980
|
+
const fd = await fs.open(path, "r+");
|
|
981
981
|
let closeErr = null;
|
|
982
982
|
try {
|
|
983
983
|
await fs.futimes(fd, atime, mtime);
|
|
@@ -990,8 +990,8 @@ var require_utimes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
990
990
|
}
|
|
991
991
|
if (closeErr) throw closeErr;
|
|
992
992
|
}
|
|
993
|
-
function utimesMillisSync(path
|
|
994
|
-
const fd = fs.openSync(path
|
|
993
|
+
function utimesMillisSync(path, atime, mtime) {
|
|
994
|
+
const fd = fs.openSync(path, "r+");
|
|
995
995
|
fs.futimesSync(fd, atime, mtime);
|
|
996
996
|
return fs.closeSync(fd);
|
|
997
997
|
}
|
|
@@ -1111,9 +1111,9 @@ var require_stat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1111
1111
|
return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
1112
1112
|
}
|
|
1113
1113
|
function isSrcSubdir(src, dest) {
|
|
1114
|
-
const srcArr = path$11.resolve(src).split(path$11.sep).filter((i
|
|
1115
|
-
const destArr = path$11.resolve(dest).split(path$11.sep).filter((i
|
|
1116
|
-
return srcArr.every((cur, i
|
|
1114
|
+
const srcArr = path$11.resolve(src).split(path$11.sep).filter((i) => i);
|
|
1115
|
+
const destArr = path$11.resolve(dest).split(path$11.sep).filter((i) => i);
|
|
1116
|
+
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
1117
1117
|
}
|
|
1118
1118
|
function errMsg(src, dest, funcName) {
|
|
1119
1119
|
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
|
|
@@ -1205,8 +1205,8 @@ var require_copy$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1205
1205
|
const srcItem = path$10.join(src, item.name);
|
|
1206
1206
|
const destItem = path$10.join(dest, item.name);
|
|
1207
1207
|
if (await runFilter(srcItem, destItem, opts)) {
|
|
1208
|
-
const { destStat
|
|
1209
|
-
await getStatsAndPerformCopy(destStat
|
|
1208
|
+
const { destStat } = await stat.checkPaths(srcItem, destItem, "copy", opts);
|
|
1209
|
+
await getStatsAndPerformCopy(destStat, srcItem, destItem, opts);
|
|
1210
1210
|
}
|
|
1211
1211
|
});
|
|
1212
1212
|
if (!destStat) await fs.chmod(dest, srcStat.mode);
|
|
@@ -1362,14 +1362,14 @@ var require_copy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1362
1362
|
var require_remove = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1363
1363
|
const fs = require_graceful_fs();
|
|
1364
1364
|
const u = require_universalify().fromCallback;
|
|
1365
|
-
function remove(path
|
|
1366
|
-
fs.rm(path
|
|
1365
|
+
function remove(path, callback) {
|
|
1366
|
+
fs.rm(path, {
|
|
1367
1367
|
recursive: true,
|
|
1368
1368
|
force: true
|
|
1369
1369
|
}, callback);
|
|
1370
1370
|
}
|
|
1371
|
-
function removeSync(path
|
|
1372
|
-
fs.rmSync(path
|
|
1371
|
+
function removeSync(path) {
|
|
1372
|
+
fs.rmSync(path, {
|
|
1373
1373
|
recursive: true,
|
|
1374
1374
|
force: true
|
|
1375
1375
|
});
|
|
@@ -1649,9 +1649,9 @@ var require_symlink = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1649
1649
|
const [srcStat, dstStat] = await Promise.all([fs.stat(srcpath), fs.stat(dstpath)]);
|
|
1650
1650
|
if (areIdentical(srcStat, dstStat)) return;
|
|
1651
1651
|
}
|
|
1652
|
-
const relative
|
|
1653
|
-
srcpath = relative
|
|
1654
|
-
const toType = await symlinkType(relative
|
|
1652
|
+
const relative = await symlinkPaths(srcpath, dstpath);
|
|
1653
|
+
srcpath = relative.toDst;
|
|
1654
|
+
const toType = await symlinkType(relative.toCwd, type);
|
|
1655
1655
|
const dir = path$4.dirname(dstpath);
|
|
1656
1656
|
if (!await pathExists(dir)) await mkdirs(dir);
|
|
1657
1657
|
return fs.symlink(srcpath, dstpath, toType);
|
|
@@ -1664,9 +1664,9 @@ var require_symlink = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1664
1664
|
if (stats && stats.isSymbolicLink()) {
|
|
1665
1665
|
if (areIdentical(fs.statSync(srcpath), fs.statSync(dstpath))) return;
|
|
1666
1666
|
}
|
|
1667
|
-
const relative
|
|
1668
|
-
srcpath = relative
|
|
1669
|
-
type = symlinkTypeSync(relative
|
|
1667
|
+
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
1668
|
+
srcpath = relative.toDst;
|
|
1669
|
+
type = symlinkTypeSync(relative.toCwd, type);
|
|
1670
1670
|
const dir = path$4.dirname(dstpath);
|
|
1671
1671
|
if (fs.existsSync(dir)) return fs.symlinkSync(srcpath, dstpath, type);
|
|
1672
1672
|
mkdirsSync(dir);
|
|
@@ -1730,13 +1730,13 @@ var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1730
1730
|
const { stringify, stripBom } = require_utils();
|
|
1731
1731
|
async function _readFile(file, options = {}) {
|
|
1732
1732
|
if (typeof options === "string") options = { encoding: options };
|
|
1733
|
-
const fs
|
|
1733
|
+
const fs = options.fs || _fs;
|
|
1734
1734
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
1735
|
-
let data
|
|
1736
|
-
data
|
|
1735
|
+
let data = await universalify.fromCallback(fs.readFile)(file, options);
|
|
1736
|
+
data = stripBom(data);
|
|
1737
1737
|
let obj;
|
|
1738
1738
|
try {
|
|
1739
|
-
obj = JSON.parse(data
|
|
1739
|
+
obj = JSON.parse(data, options ? options.reviver : null);
|
|
1740
1740
|
} catch (err) {
|
|
1741
1741
|
if (shouldThrow) {
|
|
1742
1742
|
err.message = `${file}: ${err.message}`;
|
|
@@ -1748,10 +1748,10 @@ var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1748
1748
|
const readFile = universalify.fromPromise(_readFile);
|
|
1749
1749
|
function readFileSync(file, options = {}) {
|
|
1750
1750
|
if (typeof options === "string") options = { encoding: options };
|
|
1751
|
-
const fs
|
|
1751
|
+
const fs = options.fs || _fs;
|
|
1752
1752
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
1753
1753
|
try {
|
|
1754
|
-
let content = fs
|
|
1754
|
+
let content = fs.readFileSync(file, options);
|
|
1755
1755
|
content = stripBom(content);
|
|
1756
1756
|
return JSON.parse(content, options.reviver);
|
|
1757
1757
|
} catch (err) {
|
|
@@ -1762,15 +1762,15 @@ var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1762
1762
|
}
|
|
1763
1763
|
}
|
|
1764
1764
|
async function _writeFile(file, obj, options = {}) {
|
|
1765
|
-
const fs
|
|
1765
|
+
const fs = options.fs || _fs;
|
|
1766
1766
|
const str = stringify(obj, options);
|
|
1767
|
-
await universalify.fromCallback(fs
|
|
1767
|
+
await universalify.fromCallback(fs.writeFile)(file, str, options);
|
|
1768
1768
|
}
|
|
1769
1769
|
const writeFile = universalify.fromPromise(_writeFile);
|
|
1770
1770
|
function writeFileSync(file, obj, options = {}) {
|
|
1771
|
-
const fs
|
|
1771
|
+
const fs = options.fs || _fs;
|
|
1772
1772
|
const str = stringify(obj, options);
|
|
1773
|
-
return fs
|
|
1773
|
+
return fs.writeFileSync(file, str, options);
|
|
1774
1774
|
}
|
|
1775
1775
|
module.exports = {
|
|
1776
1776
|
readFile,
|
|
@@ -1800,10 +1800,10 @@ var require_output_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1800
1800
|
const path$3 = __require("path");
|
|
1801
1801
|
const mkdir = require_mkdirs();
|
|
1802
1802
|
const pathExists = require_path_exists().pathExists;
|
|
1803
|
-
async function outputFile(file, data
|
|
1803
|
+
async function outputFile(file, data, encoding = "utf-8") {
|
|
1804
1804
|
const dir = path$3.dirname(file);
|
|
1805
1805
|
if (!await pathExists(dir)) await mkdir.mkdirs(dir);
|
|
1806
|
-
return fs.writeFile(file, data
|
|
1806
|
+
return fs.writeFile(file, data, encoding);
|
|
1807
1807
|
}
|
|
1808
1808
|
function outputFileSync(file, ...args) {
|
|
1809
1809
|
const dir = path$3.dirname(file);
|
|
@@ -1821,8 +1821,8 @@ var require_output_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1821
1821
|
var require_output_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1822
1822
|
const { stringify } = require_utils();
|
|
1823
1823
|
const { outputFile } = require_output_file();
|
|
1824
|
-
async function outputJson(file, data
|
|
1825
|
-
await outputFile(file, stringify(data
|
|
1824
|
+
async function outputJson(file, data, options = {}) {
|
|
1825
|
+
await outputFile(file, stringify(data, options), options);
|
|
1826
1826
|
}
|
|
1827
1827
|
module.exports = outputJson;
|
|
1828
1828
|
}));
|
|
@@ -1832,8 +1832,8 @@ var require_output_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1832
1832
|
var require_output_json_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1833
1833
|
const { stringify } = require_utils();
|
|
1834
1834
|
const { outputFileSync } = require_output_file();
|
|
1835
|
-
function outputJsonSync(file, data
|
|
1836
|
-
outputFileSync(file, stringify(data
|
|
1835
|
+
function outputJsonSync(file, data, options) {
|
|
1836
|
+
outputFileSync(file, stringify(data, options), options);
|
|
1837
1837
|
}
|
|
1838
1838
|
module.exports = outputJsonSync;
|
|
1839
1839
|
}));
|
|
@@ -2910,14 +2910,14 @@ var keywords$1 = {
|
|
|
2910
2910
|
6: ecma5AndLessKeywords + " const class extends export import super"
|
|
2911
2911
|
};
|
|
2912
2912
|
var keywordRelationalOperator = /^in(stanceof)?$/;
|
|
2913
|
-
var nonASCIIidentifierStart =
|
|
2914
|
-
var nonASCIIidentifier =
|
|
2913
|
+
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
2914
|
+
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
2915
2915
|
function isInAstralSet(code, set) {
|
|
2916
2916
|
var pos = 65536;
|
|
2917
|
-
for (var i
|
|
2918
|
-
pos += set[i
|
|
2917
|
+
for (var i = 0; i < set.length; i += 2) {
|
|
2918
|
+
pos += set[i];
|
|
2919
2919
|
if (pos > code) return false;
|
|
2920
|
-
pos += set[i
|
|
2920
|
+
pos += set[i + 1];
|
|
2921
2921
|
if (pos >= code) return true;
|
|
2922
2922
|
}
|
|
2923
2923
|
return false;
|
|
@@ -2942,7 +2942,7 @@ function isIdentifierChar(code, astral) {
|
|
|
2942
2942
|
if (astral === false) return false;
|
|
2943
2943
|
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
|
2944
2944
|
}
|
|
2945
|
-
var TokenType = function TokenType
|
|
2945
|
+
var TokenType = function TokenType(label, conf) {
|
|
2946
2946
|
if (conf === void 0) conf = {};
|
|
2947
2947
|
this.label = label;
|
|
2948
2948
|
this.keyword = conf.keyword;
|
|
@@ -2955,18 +2955,18 @@ var TokenType = function TokenType$1(label, conf) {
|
|
|
2955
2955
|
this.binop = conf.binop || null;
|
|
2956
2956
|
this.updateContext = null;
|
|
2957
2957
|
};
|
|
2958
|
-
function binop(name
|
|
2959
|
-
return new TokenType(name
|
|
2958
|
+
function binop(name, prec) {
|
|
2959
|
+
return new TokenType(name, {
|
|
2960
2960
|
beforeExpr: true,
|
|
2961
2961
|
binop: prec
|
|
2962
2962
|
});
|
|
2963
2963
|
}
|
|
2964
2964
|
var beforeExpr = { beforeExpr: true }, startsExpr = { startsExpr: true };
|
|
2965
2965
|
var keywords = {};
|
|
2966
|
-
function kw(name
|
|
2966
|
+
function kw(name, options) {
|
|
2967
2967
|
if (options === void 0) options = {};
|
|
2968
|
-
options.keyword = name
|
|
2969
|
-
return keywords[name
|
|
2968
|
+
options.keyword = name;
|
|
2969
|
+
return keywords[name] = new TokenType(name, options);
|
|
2970
2970
|
}
|
|
2971
2971
|
var types$1 = {
|
|
2972
2972
|
num: new TokenType("num", startsExpr),
|
|
@@ -3109,9 +3109,9 @@ function isNewLine(code) {
|
|
|
3109
3109
|
}
|
|
3110
3110
|
function nextLineBreak(code, from, end) {
|
|
3111
3111
|
if (end === void 0) end = code.length;
|
|
3112
|
-
for (var i
|
|
3113
|
-
var next = code.charCodeAt(i
|
|
3114
|
-
if (isNewLine(next)) return i
|
|
3112
|
+
for (var i = from; i < end; i++) {
|
|
3113
|
+
var next = code.charCodeAt(i);
|
|
3114
|
+
if (isNewLine(next)) return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1;
|
|
3115
3115
|
}
|
|
3116
3116
|
return -1;
|
|
3117
3117
|
}
|
|
@@ -3128,7 +3128,7 @@ var isArray = Array.isArray || (function(obj) {
|
|
|
3128
3128
|
});
|
|
3129
3129
|
var regexpCache = Object.create(null);
|
|
3130
3130
|
function wordsRegexp(words) {
|
|
3131
|
-
return regexpCache[words] || (regexpCache[words] =
|
|
3131
|
+
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
|
|
3132
3132
|
}
|
|
3133
3133
|
function codePointToString(code) {
|
|
3134
3134
|
if (code <= 65535) return String.fromCharCode(code);
|
|
@@ -3136,14 +3136,14 @@ function codePointToString(code) {
|
|
|
3136
3136
|
return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320);
|
|
3137
3137
|
}
|
|
3138
3138
|
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
|
|
3139
|
-
var Position = function Position
|
|
3139
|
+
var Position = function Position(line, col) {
|
|
3140
3140
|
this.line = line;
|
|
3141
3141
|
this.column = col;
|
|
3142
3142
|
};
|
|
3143
3143
|
Position.prototype.offset = function offset(n) {
|
|
3144
3144
|
return new Position(this.line, this.column + n);
|
|
3145
3145
|
};
|
|
3146
|
-
var SourceLocation = function SourceLocation
|
|
3146
|
+
var SourceLocation = function SourceLocation(p, start, end) {
|
|
3147
3147
|
this.start = start;
|
|
3148
3148
|
this.end = end;
|
|
3149
3149
|
if (p.sourceFile !== null) this.source = p.sourceFile;
|
|
@@ -3218,7 +3218,7 @@ function functionFlags(async, generator) {
|
|
|
3218
3218
|
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
|
|
3219
3219
|
}
|
|
3220
3220
|
var BIND_NONE = 0, BIND_VAR = 1, BIND_LEXICAL = 2, BIND_FUNCTION = 3, BIND_SIMPLE_CATCH = 4, BIND_OUTSIDE = 5;
|
|
3221
|
-
var Parser = function Parser
|
|
3221
|
+
var Parser = function Parser(options, input, startPos) {
|
|
3222
3222
|
this.options = options = getOptions(options);
|
|
3223
3223
|
this.sourceFile = options.sourceFile;
|
|
3224
3224
|
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
@@ -3273,7 +3273,7 @@ var prototypeAccessors = {
|
|
|
3273
3273
|
allowNewDotTarget: { configurable: true },
|
|
3274
3274
|
inClassStaticBlock: { configurable: true }
|
|
3275
3275
|
};
|
|
3276
|
-
Parser.prototype.parse = function parse
|
|
3276
|
+
Parser.prototype.parse = function parse() {
|
|
3277
3277
|
var node = this.options.program || this.startNode();
|
|
3278
3278
|
this.nextToken();
|
|
3279
3279
|
return this.parseTopLevel(node);
|
|
@@ -3288,8 +3288,8 @@ prototypeAccessors.inAsync.get = function() {
|
|
|
3288
3288
|
return (this.currentVarScope().flags & SCOPE_ASYNC) > 0;
|
|
3289
3289
|
};
|
|
3290
3290
|
prototypeAccessors.canAwait.get = function() {
|
|
3291
|
-
for (var i
|
|
3292
|
-
var flags = this.scopeStack[i
|
|
3291
|
+
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
3292
|
+
var flags = this.scopeStack[i].flags;
|
|
3293
3293
|
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) return false;
|
|
3294
3294
|
if (flags & SCOPE_FUNCTION) return (flags & SCOPE_ASYNC) > 0;
|
|
3295
3295
|
}
|
|
@@ -3305,8 +3305,8 @@ prototypeAccessors.treatFunctionsAsVar.get = function() {
|
|
|
3305
3305
|
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
3306
3306
|
};
|
|
3307
3307
|
prototypeAccessors.allowNewDotTarget.get = function() {
|
|
3308
|
-
for (var i
|
|
3309
|
-
var flags = this.scopeStack[i
|
|
3308
|
+
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
3309
|
+
var flags = this.scopeStack[i].flags;
|
|
3310
3310
|
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) || flags & SCOPE_FUNCTION && !(flags & SCOPE_ARROW)) return true;
|
|
3311
3311
|
}
|
|
3312
3312
|
return false;
|
|
@@ -3318,10 +3318,10 @@ Parser.extend = function extend() {
|
|
|
3318
3318
|
var plugins = [], len = arguments.length;
|
|
3319
3319
|
while (len--) plugins[len] = arguments[len];
|
|
3320
3320
|
var cls = this;
|
|
3321
|
-
for (var i
|
|
3321
|
+
for (var i = 0; i < plugins.length; i++) cls = plugins[i](cls);
|
|
3322
3322
|
return cls;
|
|
3323
3323
|
};
|
|
3324
|
-
Parser.parse = function parse
|
|
3324
|
+
Parser.parse = function parse(input, options) {
|
|
3325
3325
|
return new this(options, input).parse();
|
|
3326
3326
|
};
|
|
3327
3327
|
Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) {
|
|
@@ -3360,16 +3360,16 @@ pp$9.eat = function(type) {
|
|
|
3360
3360
|
return true;
|
|
3361
3361
|
} else return false;
|
|
3362
3362
|
};
|
|
3363
|
-
pp$9.isContextual = function(name
|
|
3364
|
-
return this.type === types$1.name && this.value === name
|
|
3363
|
+
pp$9.isContextual = function(name) {
|
|
3364
|
+
return this.type === types$1.name && this.value === name && !this.containsEsc;
|
|
3365
3365
|
};
|
|
3366
|
-
pp$9.eatContextual = function(name
|
|
3367
|
-
if (!this.isContextual(name
|
|
3366
|
+
pp$9.eatContextual = function(name) {
|
|
3367
|
+
if (!this.isContextual(name)) return false;
|
|
3368
3368
|
this.next();
|
|
3369
3369
|
return true;
|
|
3370
3370
|
};
|
|
3371
|
-
pp$9.expectContextual = function(name
|
|
3372
|
-
if (!this.eatContextual(name
|
|
3371
|
+
pp$9.expectContextual = function(name) {
|
|
3372
|
+
if (!this.eatContextual(name)) this.unexpected();
|
|
3373
3373
|
};
|
|
3374
3374
|
pp$9.canInsertSemicolon = function() {
|
|
3375
3375
|
return this.type === types$1.eof || this.type === types$1.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
|
|
@@ -3396,7 +3396,7 @@ pp$9.expect = function(type) {
|
|
|
3396
3396
|
pp$9.unexpected = function(pos) {
|
|
3397
3397
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
3398
3398
|
};
|
|
3399
|
-
var DestructuringErrors = function DestructuringErrors
|
|
3399
|
+
var DestructuringErrors = function DestructuringErrors() {
|
|
3400
3400
|
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
|
|
3401
3401
|
};
|
|
3402
3402
|
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
@@ -3423,15 +3423,15 @@ pp$9.isSimpleAssignTarget = function(expr) {
|
|
|
3423
3423
|
};
|
|
3424
3424
|
var pp$8 = Parser.prototype;
|
|
3425
3425
|
pp$8.parseTopLevel = function(node) {
|
|
3426
|
-
var exports
|
|
3426
|
+
var exports = Object.create(null);
|
|
3427
3427
|
if (!node.body) node.body = [];
|
|
3428
3428
|
while (this.type !== types$1.eof) {
|
|
3429
|
-
var stmt = this.parseStatement(null, true, exports
|
|
3429
|
+
var stmt = this.parseStatement(null, true, exports);
|
|
3430
3430
|
node.body.push(stmt);
|
|
3431
3431
|
}
|
|
3432
|
-
if (this.inModule) for (var i
|
|
3433
|
-
var name
|
|
3434
|
-
this.raiseRecoverable(this.undefinedExports[name
|
|
3432
|
+
if (this.inModule) for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1) {
|
|
3433
|
+
var name = list[i];
|
|
3434
|
+
this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined");
|
|
3435
3435
|
}
|
|
3436
3436
|
this.adaptDirectivePrologue(node.body);
|
|
3437
3437
|
this.next();
|
|
@@ -3491,7 +3491,7 @@ pp$8.isAwaitUsing = function(isFor) {
|
|
|
3491
3491
|
pp$8.isUsing = function(isFor) {
|
|
3492
3492
|
return this.isUsingKeyword(false, isFor);
|
|
3493
3493
|
};
|
|
3494
|
-
pp$8.parseStatement = function(context, topLevel, exports
|
|
3494
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
3495
3495
|
var starttype = this.type, node = this.startNode(), kind;
|
|
3496
3496
|
if (this.isLet(context)) {
|
|
3497
3497
|
starttype = types$1._var;
|
|
@@ -3535,7 +3535,7 @@ pp$8.parseStatement = function(context, topLevel, exports$1) {
|
|
|
3535
3535
|
if (!topLevel) this.raise(this.start, "'import' and 'export' may only appear at the top level");
|
|
3536
3536
|
if (!this.inModule) this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
|
|
3537
3537
|
}
|
|
3538
|
-
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports
|
|
3538
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports);
|
|
3539
3539
|
default:
|
|
3540
3540
|
if (this.isAsyncFunction()) {
|
|
3541
3541
|
if (context) this.unexpected();
|
|
@@ -3568,15 +3568,15 @@ pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
|
3568
3568
|
node.label = this.parseIdent();
|
|
3569
3569
|
this.semicolon();
|
|
3570
3570
|
}
|
|
3571
|
-
var i
|
|
3572
|
-
for (; i
|
|
3573
|
-
var lab = this.labels[i
|
|
3571
|
+
var i = 0;
|
|
3572
|
+
for (; i < this.labels.length; ++i) {
|
|
3573
|
+
var lab = this.labels[i];
|
|
3574
3574
|
if (node.label == null || lab.name === node.label.name) {
|
|
3575
3575
|
if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
|
|
3576
3576
|
if (node.label && isBreak) break;
|
|
3577
3577
|
}
|
|
3578
3578
|
}
|
|
3579
|
-
if (i
|
|
3579
|
+
if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword);
|
|
3580
3580
|
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
|
|
3581
3581
|
};
|
|
3582
3582
|
pp$8.parseDebuggerStatement = function(node) {
|
|
@@ -3768,10 +3768,10 @@ pp$8.parseEmptyStatement = function(node) {
|
|
|
3768
3768
|
return this.finishNode(node, "EmptyStatement");
|
|
3769
3769
|
};
|
|
3770
3770
|
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
3771
|
-
for (var i$1 = 0, list
|
|
3771
|
+
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1) if (list[i$1].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
3772
3772
|
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
3773
|
-
for (var i
|
|
3774
|
-
var label$1 = this.labels[i
|
|
3773
|
+
for (var i = this.labels.length - 1; i >= 0; i--) {
|
|
3774
|
+
var label$1 = this.labels[i];
|
|
3775
3775
|
if (label$1.statementStart === node.start) {
|
|
3776
3776
|
label$1.statementStart = this.start;
|
|
3777
3777
|
label$1.kind = kind;
|
|
@@ -3910,7 +3910,7 @@ pp$8.parseClass = function(node, isStatement) {
|
|
|
3910
3910
|
};
|
|
3911
3911
|
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
3912
3912
|
if (this.eat(types$1.semi)) return null;
|
|
3913
|
-
var ecmaVersion
|
|
3913
|
+
var ecmaVersion = this.options.ecmaVersion;
|
|
3914
3914
|
var node = this.startNode();
|
|
3915
3915
|
var keyName = "";
|
|
3916
3916
|
var isGenerator = false;
|
|
@@ -3918,7 +3918,7 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
|
3918
3918
|
var kind = "method";
|
|
3919
3919
|
var isStatic = false;
|
|
3920
3920
|
if (this.eatContextual("static")) {
|
|
3921
|
-
if (ecmaVersion
|
|
3921
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
3922
3922
|
this.parseClassStaticBlock(node);
|
|
3923
3923
|
return node;
|
|
3924
3924
|
}
|
|
@@ -3926,9 +3926,9 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
|
3926
3926
|
else keyName = "static";
|
|
3927
3927
|
}
|
|
3928
3928
|
node.static = isStatic;
|
|
3929
|
-
if (!keyName && ecmaVersion
|
|
3929
|
+
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) isAsync = true;
|
|
3930
3930
|
else keyName = "async";
|
|
3931
|
-
if (!keyName && (ecmaVersion
|
|
3931
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) isGenerator = true;
|
|
3932
3932
|
if (!keyName && !isAsync && !isGenerator) {
|
|
3933
3933
|
var lastValue = this.value;
|
|
3934
3934
|
if (this.eatContextual("get") || this.eatContextual("set")) if (this.isClassElementNameStart()) kind = lastValue;
|
|
@@ -3940,7 +3940,7 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
|
3940
3940
|
node.key.name = keyName;
|
|
3941
3941
|
this.finishNode(node.key, "Identifier");
|
|
3942
3942
|
} else this.parseClassElementName(node);
|
|
3943
|
-
if (ecmaVersion
|
|
3943
|
+
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
3944
3944
|
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
3945
3945
|
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
3946
3946
|
if (isConstructor && kind !== "method") this.raise(node.key.start, "Constructor can't have get/set modifier");
|
|
@@ -4017,40 +4017,40 @@ pp$8.enterClassBody = function() {
|
|
|
4017
4017
|
return element.declared;
|
|
4018
4018
|
};
|
|
4019
4019
|
pp$8.exitClassBody = function() {
|
|
4020
|
-
var ref
|
|
4021
|
-
var declared = ref
|
|
4022
|
-
var used = ref
|
|
4020
|
+
var ref = this.privateNameStack.pop();
|
|
4021
|
+
var declared = ref.declared;
|
|
4022
|
+
var used = ref.used;
|
|
4023
4023
|
if (!this.options.checkPrivateFields) return;
|
|
4024
4024
|
var len = this.privateNameStack.length;
|
|
4025
4025
|
var parent = len === 0 ? null : this.privateNameStack[len - 1];
|
|
4026
|
-
for (var i
|
|
4027
|
-
var id = used[i
|
|
4026
|
+
for (var i = 0; i < used.length; ++i) {
|
|
4027
|
+
var id = used[i];
|
|
4028
4028
|
if (!hasOwn(declared, id.name)) if (parent) parent.used.push(id);
|
|
4029
4029
|
else this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class");
|
|
4030
4030
|
}
|
|
4031
4031
|
};
|
|
4032
4032
|
function isPrivateNameConflicted(privateNameMap, element) {
|
|
4033
|
-
var name
|
|
4034
|
-
var curr = privateNameMap[name
|
|
4033
|
+
var name = element.key.name;
|
|
4034
|
+
var curr = privateNameMap[name];
|
|
4035
4035
|
var next = "true";
|
|
4036
4036
|
if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) next = (element.static ? "s" : "i") + element.kind;
|
|
4037
4037
|
if (curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget") {
|
|
4038
|
-
privateNameMap[name
|
|
4038
|
+
privateNameMap[name] = "true";
|
|
4039
4039
|
return false;
|
|
4040
4040
|
} else if (!curr) {
|
|
4041
|
-
privateNameMap[name
|
|
4041
|
+
privateNameMap[name] = next;
|
|
4042
4042
|
return false;
|
|
4043
4043
|
} else return true;
|
|
4044
4044
|
}
|
|
4045
|
-
function checkKeyName(node, name
|
|
4045
|
+
function checkKeyName(node, name) {
|
|
4046
4046
|
var computed = node.computed;
|
|
4047
4047
|
var key = node.key;
|
|
4048
|
-
return !computed && (key.type === "Identifier" && key.name === name
|
|
4048
|
+
return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name);
|
|
4049
4049
|
}
|
|
4050
|
-
pp$8.parseExportAllDeclaration = function(node, exports
|
|
4050
|
+
pp$8.parseExportAllDeclaration = function(node, exports) {
|
|
4051
4051
|
if (this.options.ecmaVersion >= 11) if (this.eatContextual("as")) {
|
|
4052
4052
|
node.exported = this.parseModuleExportName();
|
|
4053
|
-
this.checkExport(exports
|
|
4053
|
+
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
4054
4054
|
} else node.exported = null;
|
|
4055
4055
|
this.expectContextual("from");
|
|
4056
4056
|
if (this.type !== types$1.string) this.unexpected();
|
|
@@ -4059,31 +4059,31 @@ pp$8.parseExportAllDeclaration = function(node, exports$1) {
|
|
|
4059
4059
|
this.semicolon();
|
|
4060
4060
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
4061
4061
|
};
|
|
4062
|
-
pp$8.parseExport = function(node, exports
|
|
4062
|
+
pp$8.parseExport = function(node, exports) {
|
|
4063
4063
|
this.next();
|
|
4064
|
-
if (this.eat(types$1.star)) return this.parseExportAllDeclaration(node, exports
|
|
4064
|
+
if (this.eat(types$1.star)) return this.parseExportAllDeclaration(node, exports);
|
|
4065
4065
|
if (this.eat(types$1._default)) {
|
|
4066
|
-
this.checkExport(exports
|
|
4066
|
+
this.checkExport(exports, "default", this.lastTokStart);
|
|
4067
4067
|
node.declaration = this.parseExportDefaultDeclaration();
|
|
4068
4068
|
return this.finishNode(node, "ExportDefaultDeclaration");
|
|
4069
4069
|
}
|
|
4070
4070
|
if (this.shouldParseExportStatement()) {
|
|
4071
4071
|
node.declaration = this.parseExportDeclaration(node);
|
|
4072
|
-
if (node.declaration.type === "VariableDeclaration") this.checkVariableExport(exports
|
|
4073
|
-
else this.checkExport(exports
|
|
4072
|
+
if (node.declaration.type === "VariableDeclaration") this.checkVariableExport(exports, node.declaration.declarations);
|
|
4073
|
+
else this.checkExport(exports, node.declaration.id, node.declaration.id.start);
|
|
4074
4074
|
node.specifiers = [];
|
|
4075
4075
|
node.source = null;
|
|
4076
4076
|
if (this.options.ecmaVersion >= 16) node.attributes = [];
|
|
4077
4077
|
} else {
|
|
4078
4078
|
node.declaration = null;
|
|
4079
|
-
node.specifiers = this.parseExportSpecifiers(exports
|
|
4079
|
+
node.specifiers = this.parseExportSpecifiers(exports);
|
|
4080
4080
|
if (this.eatContextual("from")) {
|
|
4081
4081
|
if (this.type !== types$1.string) this.unexpected();
|
|
4082
4082
|
node.source = this.parseExprAtom();
|
|
4083
4083
|
if (this.options.ecmaVersion >= 16) node.attributes = this.parseWithClause();
|
|
4084
4084
|
} else {
|
|
4085
|
-
for (var i
|
|
4086
|
-
var spec = list
|
|
4085
|
+
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
4086
|
+
var spec = list[i];
|
|
4087
4087
|
this.checkUnreserved(spec.local);
|
|
4088
4088
|
this.checkLocalExport(spec.local);
|
|
4089
4089
|
if (spec.local.type === "Literal") this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
|
|
@@ -4114,45 +4114,45 @@ pp$8.parseExportDefaultDeclaration = function() {
|
|
|
4114
4114
|
return declaration;
|
|
4115
4115
|
}
|
|
4116
4116
|
};
|
|
4117
|
-
pp$8.checkExport = function(exports
|
|
4118
|
-
if (!exports
|
|
4119
|
-
if (typeof name
|
|
4120
|
-
if (hasOwn(exports
|
|
4121
|
-
exports
|
|
4117
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
4118
|
+
if (!exports) return;
|
|
4119
|
+
if (typeof name !== "string") name = name.type === "Identifier" ? name.name : name.value;
|
|
4120
|
+
if (hasOwn(exports, name)) this.raiseRecoverable(pos, "Duplicate export '" + name + "'");
|
|
4121
|
+
exports[name] = true;
|
|
4122
4122
|
};
|
|
4123
|
-
pp$8.checkPatternExport = function(exports
|
|
4123
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
4124
4124
|
var type = pat.type;
|
|
4125
|
-
if (type === "Identifier") this.checkExport(exports
|
|
4126
|
-
else if (type === "ObjectPattern") for (var i
|
|
4127
|
-
var prop = list
|
|
4128
|
-
this.checkPatternExport(exports
|
|
4125
|
+
if (type === "Identifier") this.checkExport(exports, pat, pat.start);
|
|
4126
|
+
else if (type === "ObjectPattern") for (var i = 0, list = pat.properties; i < list.length; i += 1) {
|
|
4127
|
+
var prop = list[i];
|
|
4128
|
+
this.checkPatternExport(exports, prop);
|
|
4129
4129
|
}
|
|
4130
|
-
else if (type === "ArrayPattern") for (var i$1
|
|
4131
|
-
var elt = list$1
|
|
4132
|
-
if (elt) this.checkPatternExport(exports
|
|
4130
|
+
else if (type === "ArrayPattern") for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
|
|
4131
|
+
var elt = list$1[i$1];
|
|
4132
|
+
if (elt) this.checkPatternExport(exports, elt);
|
|
4133
4133
|
}
|
|
4134
|
-
else if (type === "Property") this.checkPatternExport(exports
|
|
4135
|
-
else if (type === "AssignmentPattern") this.checkPatternExport(exports
|
|
4136
|
-
else if (type === "RestElement") this.checkPatternExport(exports
|
|
4134
|
+
else if (type === "Property") this.checkPatternExport(exports, pat.value);
|
|
4135
|
+
else if (type === "AssignmentPattern") this.checkPatternExport(exports, pat.left);
|
|
4136
|
+
else if (type === "RestElement") this.checkPatternExport(exports, pat.argument);
|
|
4137
4137
|
};
|
|
4138
|
-
pp$8.checkVariableExport = function(exports
|
|
4139
|
-
if (!exports
|
|
4140
|
-
for (var i
|
|
4141
|
-
var decl = list
|
|
4142
|
-
this.checkPatternExport(exports
|
|
4138
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
4139
|
+
if (!exports) return;
|
|
4140
|
+
for (var i = 0, list = decls; i < list.length; i += 1) {
|
|
4141
|
+
var decl = list[i];
|
|
4142
|
+
this.checkPatternExport(exports, decl.id);
|
|
4143
4143
|
}
|
|
4144
4144
|
};
|
|
4145
4145
|
pp$8.shouldParseExportStatement = function() {
|
|
4146
4146
|
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
|
|
4147
4147
|
};
|
|
4148
|
-
pp$8.parseExportSpecifier = function(exports
|
|
4148
|
+
pp$8.parseExportSpecifier = function(exports) {
|
|
4149
4149
|
var node = this.startNode();
|
|
4150
4150
|
node.local = this.parseModuleExportName();
|
|
4151
4151
|
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
4152
|
-
this.checkExport(exports
|
|
4152
|
+
this.checkExport(exports, node.exported, node.exported.start);
|
|
4153
4153
|
return this.finishNode(node, "ExportSpecifier");
|
|
4154
4154
|
};
|
|
4155
|
-
pp$8.parseExportSpecifiers = function(exports
|
|
4155
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
4156
4156
|
var nodes = [], first = true;
|
|
4157
4157
|
this.expect(types$1.braceL);
|
|
4158
4158
|
while (!this.eat(types$1.braceR)) {
|
|
@@ -4160,7 +4160,7 @@ pp$8.parseExportSpecifiers = function(exports$1) {
|
|
|
4160
4160
|
this.expect(types$1.comma);
|
|
4161
4161
|
if (this.afterTrailingComma(types$1.braceR)) break;
|
|
4162
4162
|
} else first = false;
|
|
4163
|
-
nodes.push(this.parseExportSpecifier(exports
|
|
4163
|
+
nodes.push(this.parseExportSpecifier(exports));
|
|
4164
4164
|
}
|
|
4165
4165
|
return nodes;
|
|
4166
4166
|
};
|
|
@@ -4259,7 +4259,7 @@ pp$8.parseModuleExportName = function() {
|
|
|
4259
4259
|
return this.parseIdent(true);
|
|
4260
4260
|
};
|
|
4261
4261
|
pp$8.adaptDirectivePrologue = function(statements) {
|
|
4262
|
-
for (var i
|
|
4262
|
+
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
4263
4263
|
};
|
|
4264
4264
|
pp$8.isDirectiveCandidate = function(statement) {
|
|
4265
4265
|
return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && (this.input[statement.start] === "\"" || this.input[statement.start] === "'");
|
|
@@ -4277,8 +4277,8 @@ pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
|
4277
4277
|
case "ObjectExpression":
|
|
4278
4278
|
node.type = "ObjectPattern";
|
|
4279
4279
|
if (refDestructuringErrors) this.checkPatternErrors(refDestructuringErrors, true);
|
|
4280
|
-
for (var i
|
|
4281
|
-
var prop = list
|
|
4280
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
|
4281
|
+
var prop = list[i];
|
|
4282
4282
|
this.toAssignable(prop, isBinding);
|
|
4283
4283
|
if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) this.raise(prop.argument.start, "Unexpected token");
|
|
4284
4284
|
}
|
|
@@ -4317,8 +4317,8 @@ pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
|
4317
4317
|
};
|
|
4318
4318
|
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
4319
4319
|
var end = exprList.length;
|
|
4320
|
-
for (var i
|
|
4321
|
-
var elt = exprList[i
|
|
4320
|
+
for (var i = 0; i < end; i++) {
|
|
4321
|
+
var elt = exprList[i];
|
|
4322
4322
|
if (elt) this.toAssignable(elt, isBinding);
|
|
4323
4323
|
}
|
|
4324
4324
|
if (end) {
|
|
@@ -4416,14 +4416,14 @@ pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
|
4416
4416
|
if (bindingType === void 0) bindingType = BIND_NONE;
|
|
4417
4417
|
switch (expr.type) {
|
|
4418
4418
|
case "ObjectPattern":
|
|
4419
|
-
for (var i
|
|
4420
|
-
var prop = list
|
|
4419
|
+
for (var i = 0, list = expr.properties; i < list.length; i += 1) {
|
|
4420
|
+
var prop = list[i];
|
|
4421
4421
|
this.checkLValInnerPattern(prop, bindingType, checkClashes);
|
|
4422
4422
|
}
|
|
4423
4423
|
break;
|
|
4424
4424
|
case "ArrayPattern":
|
|
4425
|
-
for (var i$1
|
|
4426
|
-
var elem = list$1
|
|
4425
|
+
for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
|
|
4426
|
+
var elem = list$1[i$1];
|
|
4427
4427
|
if (elem) this.checkLValInnerPattern(elem, bindingType, checkClashes);
|
|
4428
4428
|
}
|
|
4429
4429
|
break;
|
|
@@ -4445,7 +4445,7 @@ pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
|
4445
4445
|
default: this.checkLValPattern(expr, bindingType, checkClashes);
|
|
4446
4446
|
}
|
|
4447
4447
|
};
|
|
4448
|
-
var TokContext = function TokContext
|
|
4448
|
+
var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
|
|
4449
4449
|
this.token = token;
|
|
4450
4450
|
this.isExpr = !!isExpr;
|
|
4451
4451
|
this.preserveSpace = !!preserveSpace;
|
|
@@ -4484,8 +4484,8 @@ pp$6.braceIsBlock = function(prevType) {
|
|
|
4484
4484
|
return !this.exprAllowed;
|
|
4485
4485
|
};
|
|
4486
4486
|
pp$6.inGeneratorContext = function() {
|
|
4487
|
-
for (var i
|
|
4488
|
-
var context = this.context[i
|
|
4487
|
+
for (var i = this.context.length - 1; i >= 1; i--) {
|
|
4488
|
+
var context = this.context[i];
|
|
4489
4489
|
if (context.token === "function") return context.generator;
|
|
4490
4490
|
}
|
|
4491
4491
|
return false;
|
|
@@ -4556,19 +4556,19 @@ pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
4556
4556
|
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") return;
|
|
4557
4557
|
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) return;
|
|
4558
4558
|
var key = prop.key;
|
|
4559
|
-
var name
|
|
4559
|
+
var name;
|
|
4560
4560
|
switch (key.type) {
|
|
4561
4561
|
case "Identifier":
|
|
4562
|
-
name
|
|
4562
|
+
name = key.name;
|
|
4563
4563
|
break;
|
|
4564
4564
|
case "Literal":
|
|
4565
|
-
name
|
|
4565
|
+
name = String(key.value);
|
|
4566
4566
|
break;
|
|
4567
4567
|
default: return;
|
|
4568
4568
|
}
|
|
4569
4569
|
var kind = prop.kind;
|
|
4570
4570
|
if (this.options.ecmaVersion >= 6) {
|
|
4571
|
-
if (name
|
|
4571
|
+
if (name === "__proto__" && kind === "init") {
|
|
4572
4572
|
if (propHash.proto) if (refDestructuringErrors) {
|
|
4573
4573
|
if (refDestructuringErrors.doubleProto < 0) refDestructuringErrors.doubleProto = key.start;
|
|
4574
4574
|
} else this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
|
|
@@ -4576,14 +4576,14 @@ pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
4576
4576
|
}
|
|
4577
4577
|
return;
|
|
4578
4578
|
}
|
|
4579
|
-
name
|
|
4580
|
-
var other = propHash[name
|
|
4579
|
+
name = "$" + name;
|
|
4580
|
+
var other = propHash[name];
|
|
4581
4581
|
if (other) {
|
|
4582
4582
|
var redefinition;
|
|
4583
4583
|
if (kind === "init") redefinition = this.strict && other.init || other.get || other.set;
|
|
4584
4584
|
else redefinition = other.init || other[kind];
|
|
4585
4585
|
if (redefinition) this.raiseRecoverable(key.start, "Redefinition of property");
|
|
4586
|
-
} else other = propHash[name
|
|
4586
|
+
} else other = propHash[name] = {
|
|
4587
4587
|
init: false,
|
|
4588
4588
|
get: false,
|
|
4589
4589
|
set: false
|
|
@@ -5026,8 +5026,8 @@ pp$5.parseNew = function() {
|
|
|
5026
5026
|
else node.arguments = empty;
|
|
5027
5027
|
return this.finishNode(node, "NewExpression");
|
|
5028
5028
|
};
|
|
5029
|
-
pp$5.parseTemplateElement = function(ref
|
|
5030
|
-
var isTagged = ref
|
|
5029
|
+
pp$5.parseTemplateElement = function(ref) {
|
|
5030
|
+
var isTagged = ref.isTagged;
|
|
5031
5031
|
var elem = this.startNode();
|
|
5032
5032
|
if (this.type === types$1.invalidTemplate) {
|
|
5033
5033
|
if (!isTagged) this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
@@ -5043,9 +5043,9 @@ pp$5.parseTemplateElement = function(ref$1) {
|
|
|
5043
5043
|
elem.tail = this.type === types$1.backQuote;
|
|
5044
5044
|
return this.finishNode(elem, "TemplateElement");
|
|
5045
5045
|
};
|
|
5046
|
-
pp$5.parseTemplate = function(ref
|
|
5047
|
-
if (ref
|
|
5048
|
-
var isTagged = ref
|
|
5046
|
+
pp$5.parseTemplate = function(ref) {
|
|
5047
|
+
if (ref === void 0) ref = {};
|
|
5048
|
+
var isTagged = ref.isTagged;
|
|
5049
5049
|
if (isTagged === void 0) isTagged = false;
|
|
5050
5050
|
var node = this.startNode();
|
|
5051
5051
|
this.next();
|
|
@@ -5222,13 +5222,13 @@ pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
|
5222
5222
|
this.exitScope();
|
|
5223
5223
|
};
|
|
5224
5224
|
pp$5.isSimpleParamList = function(params) {
|
|
5225
|
-
for (var i
|
|
5225
|
+
for (var i = 0, list = params; i < list.length; i += 1) if (list[i].type !== "Identifier") return false;
|
|
5226
5226
|
return true;
|
|
5227
5227
|
};
|
|
5228
5228
|
pp$5.checkParams = function(node, allowDuplicates) {
|
|
5229
5229
|
var nameHash = Object.create(null);
|
|
5230
|
-
for (var i
|
|
5231
|
-
var param = list
|
|
5230
|
+
for (var i = 0, list = node.params; i < list.length; i += 1) {
|
|
5231
|
+
var param = list[i];
|
|
5232
5232
|
this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
|
|
5233
5233
|
}
|
|
5234
5234
|
};
|
|
@@ -5249,19 +5249,19 @@ pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
|
|
|
5249
5249
|
}
|
|
5250
5250
|
return elts;
|
|
5251
5251
|
};
|
|
5252
|
-
pp$5.checkUnreserved = function(ref
|
|
5253
|
-
var start = ref
|
|
5254
|
-
var end = ref
|
|
5255
|
-
var name
|
|
5256
|
-
if (this.inGenerator && name
|
|
5257
|
-
if (this.inAsync && name
|
|
5258
|
-
if (!(this.currentThisScope().flags & SCOPE_VAR) && name
|
|
5259
|
-
if (this.inClassStaticBlock && (name
|
|
5260
|
-
if (this.keywords.test(name
|
|
5252
|
+
pp$5.checkUnreserved = function(ref) {
|
|
5253
|
+
var start = ref.start;
|
|
5254
|
+
var end = ref.end;
|
|
5255
|
+
var name = ref.name;
|
|
5256
|
+
if (this.inGenerator && name === "yield") this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator");
|
|
5257
|
+
if (this.inAsync && name === "await") this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function");
|
|
5258
|
+
if (!(this.currentThisScope().flags & SCOPE_VAR) && name === "arguments") this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer");
|
|
5259
|
+
if (this.inClassStaticBlock && (name === "arguments" || name === "await")) this.raise(start, "Cannot use " + name + " in class static initialization block");
|
|
5260
|
+
if (this.keywords.test(name)) this.raise(start, "Unexpected keyword '" + name + "'");
|
|
5261
5261
|
if (this.options.ecmaVersion < 6 && this.input.slice(start, end).indexOf("\\") !== -1) return;
|
|
5262
|
-
if ((this.strict ? this.reservedWordsStrict : this.reservedWords).test(name
|
|
5263
|
-
if (!this.inAsync && name
|
|
5264
|
-
this.raiseRecoverable(start, "The keyword '" + name
|
|
5262
|
+
if ((this.strict ? this.reservedWordsStrict : this.reservedWords).test(name)) {
|
|
5263
|
+
if (!this.inAsync && name === "await") this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function");
|
|
5264
|
+
this.raiseRecoverable(start, "The keyword '" + name + "' is reserved");
|
|
5265
5265
|
}
|
|
5266
5266
|
};
|
|
5267
5267
|
pp$5.parseIdent = function(liberal) {
|
|
@@ -5330,7 +5330,7 @@ pp$4.curPosition = function() {
|
|
|
5330
5330
|
if (this.options.locations) return new Position(this.curLine, this.pos - this.lineStart);
|
|
5331
5331
|
};
|
|
5332
5332
|
var pp$3 = Parser.prototype;
|
|
5333
|
-
var Scope = function Scope
|
|
5333
|
+
var Scope = function Scope(flags) {
|
|
5334
5334
|
this.flags = flags;
|
|
5335
5335
|
this.var = [];
|
|
5336
5336
|
this.lexical = [];
|
|
@@ -5345,30 +5345,30 @@ pp$3.exitScope = function() {
|
|
|
5345
5345
|
pp$3.treatFunctionsAsVarInScope = function(scope) {
|
|
5346
5346
|
return scope.flags & SCOPE_FUNCTION || !this.inModule && scope.flags & SCOPE_TOP;
|
|
5347
5347
|
};
|
|
5348
|
-
pp$3.declareName = function(name
|
|
5348
|
+
pp$3.declareName = function(name, bindingType, pos) {
|
|
5349
5349
|
var redeclared = false;
|
|
5350
5350
|
if (bindingType === BIND_LEXICAL) {
|
|
5351
5351
|
var scope = this.currentScope();
|
|
5352
|
-
redeclared = scope.lexical.indexOf(name
|
|
5353
|
-
scope.lexical.push(name
|
|
5354
|
-
if (this.inModule && scope.flags & SCOPE_TOP) delete this.undefinedExports[name
|
|
5355
|
-
} else if (bindingType === BIND_SIMPLE_CATCH) this.currentScope().lexical.push(name
|
|
5352
|
+
redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
|
|
5353
|
+
scope.lexical.push(name);
|
|
5354
|
+
if (this.inModule && scope.flags & SCOPE_TOP) delete this.undefinedExports[name];
|
|
5355
|
+
} else if (bindingType === BIND_SIMPLE_CATCH) this.currentScope().lexical.push(name);
|
|
5356
5356
|
else if (bindingType === BIND_FUNCTION) {
|
|
5357
5357
|
var scope$2 = this.currentScope();
|
|
5358
|
-
if (this.treatFunctionsAsVar) redeclared = scope$2.lexical.indexOf(name
|
|
5359
|
-
else redeclared = scope$2.lexical.indexOf(name
|
|
5360
|
-
scope$2.functions.push(name
|
|
5361
|
-
} else for (var i
|
|
5362
|
-
var scope$3 = this.scopeStack[i
|
|
5363
|
-
if (scope$3.lexical.indexOf(name
|
|
5358
|
+
if (this.treatFunctionsAsVar) redeclared = scope$2.lexical.indexOf(name) > -1;
|
|
5359
|
+
else redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1;
|
|
5360
|
+
scope$2.functions.push(name);
|
|
5361
|
+
} else for (var i = this.scopeStack.length - 1; i >= 0; --i) {
|
|
5362
|
+
var scope$3 = this.scopeStack[i];
|
|
5363
|
+
if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
|
|
5364
5364
|
redeclared = true;
|
|
5365
5365
|
break;
|
|
5366
5366
|
}
|
|
5367
|
-
scope$3.var.push(name
|
|
5368
|
-
if (this.inModule && scope$3.flags & SCOPE_TOP) delete this.undefinedExports[name
|
|
5367
|
+
scope$3.var.push(name);
|
|
5368
|
+
if (this.inModule && scope$3.flags & SCOPE_TOP) delete this.undefinedExports[name];
|
|
5369
5369
|
if (scope$3.flags & SCOPE_VAR) break;
|
|
5370
5370
|
}
|
|
5371
|
-
if (redeclared) this.raiseRecoverable(pos, "Identifier '" + name
|
|
5371
|
+
if (redeclared) this.raiseRecoverable(pos, "Identifier '" + name + "' has already been declared");
|
|
5372
5372
|
};
|
|
5373
5373
|
pp$3.checkLocalExport = function(id) {
|
|
5374
5374
|
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && this.scopeStack[0].var.indexOf(id.name) === -1) this.undefinedExports[id.name] = id;
|
|
@@ -5377,18 +5377,18 @@ pp$3.currentScope = function() {
|
|
|
5377
5377
|
return this.scopeStack[this.scopeStack.length - 1];
|
|
5378
5378
|
};
|
|
5379
5379
|
pp$3.currentVarScope = function() {
|
|
5380
|
-
for (var i
|
|
5381
|
-
var scope = this.scopeStack[i
|
|
5380
|
+
for (var i = this.scopeStack.length - 1;; i--) {
|
|
5381
|
+
var scope = this.scopeStack[i];
|
|
5382
5382
|
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) return scope;
|
|
5383
5383
|
}
|
|
5384
5384
|
};
|
|
5385
5385
|
pp$3.currentThisScope = function() {
|
|
5386
|
-
for (var i
|
|
5387
|
-
var scope = this.scopeStack[i
|
|
5386
|
+
for (var i = this.scopeStack.length - 1;; i--) {
|
|
5387
|
+
var scope = this.scopeStack[i];
|
|
5388
5388
|
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) && !(scope.flags & SCOPE_ARROW)) return scope;
|
|
5389
5389
|
}
|
|
5390
5390
|
};
|
|
5391
|
-
var Node = function Node
|
|
5391
|
+
var Node = function Node(parser, pos, loc) {
|
|
5392
5392
|
this.type = "";
|
|
5393
5393
|
this.start = pos;
|
|
5394
5394
|
this.end = 0;
|
|
@@ -5461,13 +5461,13 @@ var unicodeScriptValues = {
|
|
|
5461
5461
|
14: ecma14ScriptValues
|
|
5462
5462
|
};
|
|
5463
5463
|
var data = {};
|
|
5464
|
-
function buildUnicodeData(ecmaVersion
|
|
5465
|
-
var d = data[ecmaVersion
|
|
5466
|
-
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion
|
|
5467
|
-
binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion
|
|
5464
|
+
function buildUnicodeData(ecmaVersion) {
|
|
5465
|
+
var d = data[ecmaVersion] = {
|
|
5466
|
+
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
|
|
5467
|
+
binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
|
|
5468
5468
|
nonBinary: {
|
|
5469
5469
|
General_Category: wordsRegexp(unicodeGeneralCategoryValues),
|
|
5470
|
-
Script: wordsRegexp(unicodeScriptValues[ecmaVersion
|
|
5470
|
+
Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
|
|
5471
5471
|
}
|
|
5472
5472
|
};
|
|
5473
5473
|
d.nonBinary.Script_Extensions = d.nonBinary.Script;
|
|
@@ -5487,7 +5487,7 @@ for (var i = 0, list = [
|
|
|
5487
5487
|
buildUnicodeData(ecmaVersion);
|
|
5488
5488
|
}
|
|
5489
5489
|
var pp$1 = Parser.prototype;
|
|
5490
|
-
var BranchID = function BranchID
|
|
5490
|
+
var BranchID = function BranchID(parent, base) {
|
|
5491
5491
|
this.parent = parent;
|
|
5492
5492
|
this.base = base || this;
|
|
5493
5493
|
};
|
|
@@ -5498,7 +5498,7 @@ BranchID.prototype.separatedFrom = function separatedFrom(alt) {
|
|
|
5498
5498
|
BranchID.prototype.sibling = function sibling() {
|
|
5499
5499
|
return new BranchID(this.parent, this.base);
|
|
5500
5500
|
};
|
|
5501
|
-
var RegExpValidationState = function RegExpValidationState
|
|
5501
|
+
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
5502
5502
|
this.parser = parser;
|
|
5503
5503
|
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
|
|
5504
5504
|
this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
|
|
@@ -5537,24 +5537,24 @@ RegExpValidationState.prototype.reset = function reset(start, pattern, flags) {
|
|
|
5537
5537
|
RegExpValidationState.prototype.raise = function raise(message) {
|
|
5538
5538
|
this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + message);
|
|
5539
5539
|
};
|
|
5540
|
-
RegExpValidationState.prototype.at = function at(i
|
|
5540
|
+
RegExpValidationState.prototype.at = function at(i, forceU) {
|
|
5541
5541
|
if (forceU === void 0) forceU = false;
|
|
5542
5542
|
var s = this.source;
|
|
5543
5543
|
var l = s.length;
|
|
5544
|
-
if (i
|
|
5545
|
-
var c = s.charCodeAt(i
|
|
5546
|
-
if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i
|
|
5547
|
-
var next = s.charCodeAt(i
|
|
5544
|
+
if (i >= l) return -1;
|
|
5545
|
+
var c = s.charCodeAt(i);
|
|
5546
|
+
if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i + 1 >= l) return c;
|
|
5547
|
+
var next = s.charCodeAt(i + 1);
|
|
5548
5548
|
return next >= 56320 && next <= 57343 ? (c << 10) + next - 56613888 : c;
|
|
5549
5549
|
};
|
|
5550
|
-
RegExpValidationState.prototype.nextIndex = function nextIndex(i
|
|
5550
|
+
RegExpValidationState.prototype.nextIndex = function nextIndex(i, forceU) {
|
|
5551
5551
|
if (forceU === void 0) forceU = false;
|
|
5552
5552
|
var s = this.source;
|
|
5553
5553
|
var l = s.length;
|
|
5554
|
-
if (i
|
|
5555
|
-
var c = s.charCodeAt(i
|
|
5556
|
-
if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i
|
|
5557
|
-
return i
|
|
5554
|
+
if (i >= l) return l;
|
|
5555
|
+
var c = s.charCodeAt(i), next;
|
|
5556
|
+
if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i + 1 >= l || (next = s.charCodeAt(i + 1)) < 56320 || next > 57343) return i + 1;
|
|
5557
|
+
return i + 2;
|
|
5558
5558
|
};
|
|
5559
5559
|
RegExpValidationState.prototype.current = function current(forceU) {
|
|
5560
5560
|
if (forceU === void 0) forceU = false;
|
|
@@ -5579,8 +5579,8 @@ RegExpValidationState.prototype.eat = function eat(ch, forceU) {
|
|
|
5579
5579
|
RegExpValidationState.prototype.eatChars = function eatChars(chs, forceU) {
|
|
5580
5580
|
if (forceU === void 0) forceU = false;
|
|
5581
5581
|
var pos = this.pos;
|
|
5582
|
-
for (var i
|
|
5583
|
-
var ch = list
|
|
5582
|
+
for (var i = 0, list = chs; i < list.length; i += 1) {
|
|
5583
|
+
var ch = list[i];
|
|
5584
5584
|
var current = this.at(pos, forceU);
|
|
5585
5585
|
if (current === -1 || current !== ch) return false;
|
|
5586
5586
|
pos = this.nextIndex(pos, forceU);
|
|
@@ -5599,10 +5599,10 @@ pp$1.validateRegExpFlags = function(state) {
|
|
|
5599
5599
|
var flags = state.flags;
|
|
5600
5600
|
var u = false;
|
|
5601
5601
|
var v = false;
|
|
5602
|
-
for (var i
|
|
5603
|
-
var flag = flags.charAt(i
|
|
5602
|
+
for (var i = 0; i < flags.length; i++) {
|
|
5603
|
+
var flag = flags.charAt(i);
|
|
5604
5604
|
if (validFlags.indexOf(flag) === -1) this.raise(state.start, "Invalid regular expression flag");
|
|
5605
|
-
if (flags.indexOf(flag, i
|
|
5605
|
+
if (flags.indexOf(flag, i + 1) > -1) this.raise(state.start, "Duplicate regular expression flag");
|
|
5606
5606
|
if (flag === "u") u = true;
|
|
5607
5607
|
if (flag === "v") v = true;
|
|
5608
5608
|
}
|
|
@@ -5641,9 +5641,9 @@ pp$1.regexp_pattern = function(state) {
|
|
|
5641
5641
|
if (state.eat(93) || state.eat(125)) state.raise("Lone quantifier brackets");
|
|
5642
5642
|
}
|
|
5643
5643
|
if (state.maxBackReference > state.numCapturingParens) state.raise("Invalid escape");
|
|
5644
|
-
for (var i
|
|
5645
|
-
var name
|
|
5646
|
-
if (!state.groupNames[name
|
|
5644
|
+
for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
|
|
5645
|
+
var name = list[i];
|
|
5646
|
+
if (!state.groupNames[name]) state.raise("Invalid named capture referenced");
|
|
5647
5647
|
}
|
|
5648
5648
|
};
|
|
5649
5649
|
pp$1.regexp_disjunction = function(state) {
|
|
@@ -5742,16 +5742,16 @@ pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
|
5742
5742
|
var addModifiers = this.regexp_eatModifiers(state);
|
|
5743
5743
|
var hasHyphen = state.eat(45);
|
|
5744
5744
|
if (addModifiers || hasHyphen) {
|
|
5745
|
-
for (var i
|
|
5746
|
-
var modifier = addModifiers.charAt(i
|
|
5747
|
-
if (addModifiers.indexOf(modifier, i
|
|
5745
|
+
for (var i = 0; i < addModifiers.length; i++) {
|
|
5746
|
+
var modifier = addModifiers.charAt(i);
|
|
5747
|
+
if (addModifiers.indexOf(modifier, i + 1) > -1) state.raise("Duplicate regular expression modifiers");
|
|
5748
5748
|
}
|
|
5749
5749
|
if (hasHyphen) {
|
|
5750
5750
|
var removeModifiers = this.regexp_eatModifiers(state);
|
|
5751
5751
|
if (!addModifiers && !removeModifiers && state.current() === 58) state.raise("Invalid regular expression modifiers");
|
|
5752
|
-
for (var i$1
|
|
5753
|
-
var modifier$1 = removeModifiers.charAt(i$1
|
|
5754
|
-
if (removeModifiers.indexOf(modifier$1, i$1
|
|
5752
|
+
for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {
|
|
5753
|
+
var modifier$1 = removeModifiers.charAt(i$1);
|
|
5754
|
+
if (removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 || addModifiers.indexOf(modifier$1) > -1) state.raise("Duplicate regular expression modifiers");
|
|
5755
5755
|
}
|
|
5756
5756
|
}
|
|
5757
5757
|
}
|
|
@@ -5830,7 +5830,7 @@ pp$1.regexp_groupSpecifier = function(state) {
|
|
|
5830
5830
|
var trackDisjunction = this.options.ecmaVersion >= 16;
|
|
5831
5831
|
var known = state.groupNames[state.lastStringValue];
|
|
5832
5832
|
if (known) if (trackDisjunction) {
|
|
5833
|
-
for (var i
|
|
5833
|
+
for (var i = 0, list = known; i < list.length; i += 1) if (!list[i].separatedFrom(state.branchID)) state.raise("Duplicate capture group name");
|
|
5834
5834
|
} else state.raise("Duplicate capture group name");
|
|
5835
5835
|
if (trackDisjunction) (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);
|
|
5836
5836
|
else state.groupNames[state.lastStringValue] = true;
|
|
@@ -6064,10 +6064,10 @@ function isCharacterClassEscape(ch) {
|
|
|
6064
6064
|
pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
6065
6065
|
var start = state.pos;
|
|
6066
6066
|
if (this.regexp_eatUnicodePropertyName(state) && state.eat(61)) {
|
|
6067
|
-
var name
|
|
6067
|
+
var name = state.lastStringValue;
|
|
6068
6068
|
if (this.regexp_eatUnicodePropertyValue(state)) {
|
|
6069
6069
|
var value = state.lastStringValue;
|
|
6070
|
-
this.regexp_validateUnicodePropertyNameAndValue(state, name
|
|
6070
|
+
this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
|
|
6071
6071
|
return CharSetOk;
|
|
6072
6072
|
}
|
|
6073
6073
|
}
|
|
@@ -6078,9 +6078,9 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
6078
6078
|
}
|
|
6079
6079
|
return CharSetNone;
|
|
6080
6080
|
};
|
|
6081
|
-
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name
|
|
6082
|
-
if (!hasOwn(state.unicodeProperties.nonBinary, name
|
|
6083
|
-
if (!state.unicodeProperties.nonBinary[name
|
|
6081
|
+
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
6082
|
+
if (!hasOwn(state.unicodeProperties.nonBinary, name)) state.raise("Invalid property name");
|
|
6083
|
+
if (!state.unicodeProperties.nonBinary[name].test(value)) state.raise("Invalid property value");
|
|
6084
6084
|
};
|
|
6085
6085
|
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
6086
6086
|
if (state.unicodeProperties.binary.test(nameOrValue)) return CharSetOk;
|
|
@@ -6371,7 +6371,7 @@ function isOctalDigit(ch) {
|
|
|
6371
6371
|
pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
6372
6372
|
var start = state.pos;
|
|
6373
6373
|
state.lastIntValue = 0;
|
|
6374
|
-
for (var i
|
|
6374
|
+
for (var i = 0; i < length; ++i) {
|
|
6375
6375
|
var ch = state.current();
|
|
6376
6376
|
if (!isHexDigit(ch)) {
|
|
6377
6377
|
state.pos = start;
|
|
@@ -6382,7 +6382,7 @@ pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
|
6382
6382
|
}
|
|
6383
6383
|
return true;
|
|
6384
6384
|
};
|
|
6385
|
-
var Token = function Token
|
|
6385
|
+
var Token = function Token(p) {
|
|
6386
6386
|
this.type = p.type;
|
|
6387
6387
|
this.value = p.value;
|
|
6388
6388
|
this.start = p.start;
|
|
@@ -6580,15 +6580,15 @@ pp.readToken_eq_excl = function(code) {
|
|
|
6580
6580
|
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1);
|
|
6581
6581
|
};
|
|
6582
6582
|
pp.readToken_question = function() {
|
|
6583
|
-
var ecmaVersion
|
|
6584
|
-
if (ecmaVersion
|
|
6583
|
+
var ecmaVersion = this.options.ecmaVersion;
|
|
6584
|
+
if (ecmaVersion >= 11) {
|
|
6585
6585
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
6586
6586
|
if (next === 46) {
|
|
6587
6587
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
6588
6588
|
if (next2 < 48 || next2 > 57) return this.finishOp(types$1.questionDot, 2);
|
|
6589
6589
|
}
|
|
6590
6590
|
if (next === 63) {
|
|
6591
|
-
if (ecmaVersion
|
|
6591
|
+
if (ecmaVersion >= 12) {
|
|
6592
6592
|
if (this.input.charCodeAt(this.pos + 2) === 61) return this.finishOp(types$1.assign, 3);
|
|
6593
6593
|
}
|
|
6594
6594
|
return this.finishOp(types$1.coalesce, 2);
|
|
@@ -6597,9 +6597,9 @@ pp.readToken_question = function() {
|
|
|
6597
6597
|
return this.finishOp(types$1.question, 1);
|
|
6598
6598
|
};
|
|
6599
6599
|
pp.readToken_numberSign = function() {
|
|
6600
|
-
var ecmaVersion
|
|
6600
|
+
var ecmaVersion = this.options.ecmaVersion;
|
|
6601
6601
|
var code = 35;
|
|
6602
|
-
if (ecmaVersion
|
|
6602
|
+
if (ecmaVersion >= 13) {
|
|
6603
6603
|
++this.pos;
|
|
6604
6604
|
code = this.fullCharCodeAtPos();
|
|
6605
6605
|
if (isIdentifierStart(code, true) || code === 92) return this.finishToken(types$1.privateId, this.readWord1());
|
|
@@ -6718,12 +6718,12 @@ pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
|
|
|
6718
6718
|
var allowSeparators = this.options.ecmaVersion >= 12 && len === void 0;
|
|
6719
6719
|
var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
|
|
6720
6720
|
var start = this.pos, total = 0, lastCode = 0;
|
|
6721
|
-
for (var i
|
|
6721
|
+
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
|
|
6722
6722
|
var code = this.input.charCodeAt(this.pos), val = void 0;
|
|
6723
6723
|
if (allowSeparators && code === 95) {
|
|
6724
6724
|
if (isLegacyOctalNumericLiteral) this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals");
|
|
6725
6725
|
if (lastCode === 95) this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore");
|
|
6726
|
-
if (i
|
|
6726
|
+
if (i === 0) this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits");
|
|
6727
6727
|
lastCode = code;
|
|
6728
6728
|
continue;
|
|
6729
6729
|
}
|
|
@@ -7000,7 +7000,7 @@ Parser.acorn = {
|
|
|
7000
7000
|
};
|
|
7001
7001
|
|
|
7002
7002
|
//#endregion
|
|
7003
|
-
//#region ../../node_modules/.pnpm/ufo@1.6.
|
|
7003
|
+
//#region ../../node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs
|
|
7004
7004
|
const r = String.fromCharCode;
|
|
7005
7005
|
const TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
|
|
7006
7006
|
const JOIN_LEADING_SLASH_RE = /^\.?\//;
|
|
@@ -7011,15 +7011,15 @@ function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
|
|
7011
7011
|
function withTrailingSlash(input = "", respectQueryAndFragment) {
|
|
7012
7012
|
if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
|
|
7013
7013
|
if (hasTrailingSlash(input, true)) return input || "/";
|
|
7014
|
-
let path
|
|
7014
|
+
let path = input;
|
|
7015
7015
|
let fragment = "";
|
|
7016
7016
|
const fragmentIndex = input.indexOf("#");
|
|
7017
7017
|
if (fragmentIndex !== -1) {
|
|
7018
|
-
path
|
|
7018
|
+
path = input.slice(0, fragmentIndex);
|
|
7019
7019
|
fragment = input.slice(fragmentIndex);
|
|
7020
|
-
if (!path
|
|
7020
|
+
if (!path) return fragment;
|
|
7021
7021
|
}
|
|
7022
|
-
const [s0, ...s] = path
|
|
7022
|
+
const [s0, ...s] = path.split("?");
|
|
7023
7023
|
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
7024
7024
|
}
|
|
7025
7025
|
function isNonEmptyURL(url) {
|
|
@@ -7039,41 +7039,41 @@ const protocolRelative = Symbol.for("ufo:protocolRelative");
|
|
|
7039
7039
|
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
7040
7040
|
let _lazyMatch = () => {
|
|
7041
7041
|
var __lib__ = (() => {
|
|
7042
|
-
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r
|
|
7043
|
-
for (var n in e) m(r
|
|
7042
|
+
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
7043
|
+
for (var n in e) m(r, n, {
|
|
7044
7044
|
get: e[n],
|
|
7045
7045
|
enumerable: true
|
|
7046
7046
|
});
|
|
7047
|
-
}, H = (r
|
|
7048
|
-
if (e && typeof e == "object" || typeof e == "function") for (let t of G(e)) !T.call(r
|
|
7047
|
+
}, H = (r, e, n, a) => {
|
|
7048
|
+
if (e && typeof e == "object" || typeof e == "function") for (let t of G(e)) !T.call(r, t) && t !== n && m(r, t, {
|
|
7049
7049
|
get: () => e[t],
|
|
7050
7050
|
enumerable: !(a = V(e, t)) || a.enumerable
|
|
7051
7051
|
});
|
|
7052
|
-
return r
|
|
7053
|
-
}, J = (r
|
|
7052
|
+
return r;
|
|
7053
|
+
}, J = (r) => H(m({}, "__esModule", { value: true }), r), w = {};
|
|
7054
7054
|
q(w, { default: () => re });
|
|
7055
|
-
var A = (r
|
|
7055
|
+
var A = (r) => Array.isArray(r), d = (r) => typeof r == "function", Q = (r) => r.length === 0, W = (r) => typeof r == "number", K = (r) => typeof r == "object" && r !== null, X = (r) => r instanceof RegExp, b = (r) => typeof r == "string", h = (r) => r === void 0, Y = (r) => {
|
|
7056
7056
|
const e = /* @__PURE__ */ new Map();
|
|
7057
7057
|
return (n) => {
|
|
7058
7058
|
const a = e.get(n);
|
|
7059
7059
|
if (a) return a;
|
|
7060
|
-
const t = r
|
|
7060
|
+
const t = r(n);
|
|
7061
7061
|
return e.set(n, t), t;
|
|
7062
7062
|
};
|
|
7063
|
-
}, rr = (r
|
|
7063
|
+
}, rr = (r, e, n = {}) => {
|
|
7064
7064
|
const a = {
|
|
7065
7065
|
cache: {},
|
|
7066
|
-
input: r
|
|
7066
|
+
input: r,
|
|
7067
7067
|
index: 0,
|
|
7068
7068
|
indexMax: 0,
|
|
7069
7069
|
options: n,
|
|
7070
7070
|
output: []
|
|
7071
7071
|
};
|
|
7072
|
-
if (v(e)(a) && a.index === r
|
|
7072
|
+
if (v(e)(a) && a.index === r.length) return a.output;
|
|
7073
7073
|
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
7074
|
-
}, i
|
|
7074
|
+
}, i = (r, e) => A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e) => {
|
|
7075
7075
|
const n = {};
|
|
7076
|
-
for (const a of r
|
|
7076
|
+
for (const a of r) {
|
|
7077
7077
|
if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
|
|
7078
7078
|
const t = a.charCodeAt(0);
|
|
7079
7079
|
n[t] = true;
|
|
@@ -7091,8 +7091,8 @@ let _lazyMatch = () => {
|
|
|
7091
7091
|
}
|
|
7092
7092
|
return true;
|
|
7093
7093
|
};
|
|
7094
|
-
}, nr = (r
|
|
7095
|
-
const n = r
|
|
7094
|
+
}, nr = (r, e) => {
|
|
7095
|
+
const n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
|
|
7096
7096
|
return g((o) => {
|
|
7097
7097
|
t.lastIndex = o.index;
|
|
7098
7098
|
const u = t.exec(o.input);
|
|
@@ -7104,16 +7104,16 @@ let _lazyMatch = () => {
|
|
|
7104
7104
|
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
|
|
7105
7105
|
} else return false;
|
|
7106
7106
|
});
|
|
7107
|
-
}, ar = (r
|
|
7108
|
-
if (n.input.startsWith(r
|
|
7107
|
+
}, ar = (r, e) => (n) => {
|
|
7108
|
+
if (n.input.startsWith(r, n.index)) {
|
|
7109
7109
|
if (!h(e) && !n.options.silent) {
|
|
7110
|
-
const t = d(e) ? e(r
|
|
7110
|
+
const t = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
7111
7111
|
h(t) || n.output.push(t);
|
|
7112
7112
|
}
|
|
7113
|
-
return n.index += r
|
|
7113
|
+
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), true;
|
|
7114
7114
|
} else return false;
|
|
7115
|
-
}, C = (r
|
|
7116
|
-
const t = v(r
|
|
7115
|
+
}, C = (r, e, n, a) => {
|
|
7116
|
+
const t = v(r);
|
|
7117
7117
|
return g(_(M((o) => {
|
|
7118
7118
|
let u = 0;
|
|
7119
7119
|
for (; u < n;) {
|
|
@@ -7122,30 +7122,30 @@ let _lazyMatch = () => {
|
|
|
7122
7122
|
}
|
|
7123
7123
|
return u >= e;
|
|
7124
7124
|
})));
|
|
7125
|
-
}, tr = (r
|
|
7126
|
-
const n = r
|
|
7125
|
+
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, Infinity), x = (r, e) => {
|
|
7126
|
+
const n = r.map(v);
|
|
7127
7127
|
return g(_(M((a) => {
|
|
7128
7128
|
for (let t = 0, o = n.length; t < o; t++) if (!n[t](a)) return false;
|
|
7129
7129
|
return true;
|
|
7130
7130
|
})));
|
|
7131
|
-
}, l = (r
|
|
7132
|
-
const n = r
|
|
7131
|
+
}, l = (r, e) => {
|
|
7132
|
+
const n = r.map(v);
|
|
7133
7133
|
return g(_((a) => {
|
|
7134
7134
|
for (let t = 0, o = n.length; t < o; t++) if (n[t](a)) return true;
|
|
7135
7135
|
return false;
|
|
7136
7136
|
}));
|
|
7137
|
-
}, M = (r
|
|
7138
|
-
const n = v(r
|
|
7137
|
+
}, M = (r, e = false) => {
|
|
7138
|
+
const n = v(r);
|
|
7139
7139
|
return (a) => {
|
|
7140
7140
|
const t = a.index, o = a.output.length, u = n(a);
|
|
7141
7141
|
return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
|
|
7142
7142
|
};
|
|
7143
|
-
}, _ = (r
|
|
7144
|
-
return v(r
|
|
7143
|
+
}, _ = (r, e) => {
|
|
7144
|
+
return v(r);
|
|
7145
7145
|
}, g = (() => {
|
|
7146
|
-
let r
|
|
7146
|
+
let r = 0;
|
|
7147
7147
|
return (e) => {
|
|
7148
|
-
const n = v(e), a = r
|
|
7148
|
+
const n = v(e), a = r += 1;
|
|
7149
7149
|
return (t) => {
|
|
7150
7150
|
var o;
|
|
7151
7151
|
if (t.options.memoization === false) return n(t);
|
|
@@ -7169,55 +7169,55 @@ let _lazyMatch = () => {
|
|
|
7169
7169
|
}
|
|
7170
7170
|
};
|
|
7171
7171
|
};
|
|
7172
|
-
})(), E = (r
|
|
7172
|
+
})(), E = (r) => {
|
|
7173
7173
|
let e;
|
|
7174
|
-
return (n) => (e || (e = v(r
|
|
7175
|
-
}, v = Y((r
|
|
7176
|
-
if (d(r
|
|
7177
|
-
if (b(r
|
|
7178
|
-
if (A(r
|
|
7179
|
-
if (K(r
|
|
7174
|
+
return (n) => (e || (e = v(r())), e(n));
|
|
7175
|
+
}, v = Y((r) => {
|
|
7176
|
+
if (d(r)) return Q(r) ? E(r) : r;
|
|
7177
|
+
if (b(r) || X(r)) return i(r);
|
|
7178
|
+
if (A(r)) return x(r);
|
|
7179
|
+
if (K(r)) return l(Object.values(r));
|
|
7180
7180
|
throw new Error("Invalid rule");
|
|
7181
|
-
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r
|
|
7181
|
+
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
|
|
7182
7182
|
let e = "";
|
|
7183
|
-
for (; r
|
|
7183
|
+
for (; r > 0;) e = P[(r - 1) % 26] + e, r = Math.floor((r - 1) / 26);
|
|
7184
7184
|
return e;
|
|
7185
|
-
}, O = (r
|
|
7185
|
+
}, O = (r) => {
|
|
7186
7186
|
let e = 0;
|
|
7187
|
-
for (let n = 0, a = r
|
|
7187
|
+
for (let n = 0, a = r.length; n < a; n++) e = e * 26 + P.indexOf(r[n]) + 1;
|
|
7188
7188
|
return e;
|
|
7189
|
-
}, S = (r
|
|
7190
|
-
if (e < r
|
|
7189
|
+
}, S = (r, e) => {
|
|
7190
|
+
if (e < r) return S(e, r);
|
|
7191
7191
|
const n = [];
|
|
7192
|
-
for (; r
|
|
7192
|
+
for (; r <= e;) n.push(r++);
|
|
7193
7193
|
return n;
|
|
7194
|
-
}, or = (r
|
|
7194
|
+
}, or = (r, e, n) => S(r, e).map((a) => String(a).padStart(n, "0")), R = (r, e) => S(O(r), O(e)).map(ir), p = (r) => r, z = (r) => ur((e) => rr(e, r, { memoization: false }).join("")), ur = (r) => {
|
|
7195
7195
|
const e = {};
|
|
7196
|
-
return (n) => e[n] ?? (e[n] = r
|
|
7197
|
-
}, sr = i
|
|
7198
|
-
i
|
|
7199
|
-
i
|
|
7200
|
-
i
|
|
7201
|
-
i
|
|
7202
|
-
]), N = l([i
|
|
7196
|
+
return (n) => e[n] ?? (e[n] = r(n));
|
|
7197
|
+
}, sr = i(/^\*\*\/\*$/, ".*"), cr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, a) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i(/\\./, p), pr = i(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i(/./, p), fr = l([i(/^(?:!!)*!(.*)$/, (r, e) => `(?!^${L(e)}$).*?`), i(/^(!!)+/, "")]), j = l([
|
|
7198
|
+
i(/\/(\*\*\/)+/, "(?:/.+/|/)"),
|
|
7199
|
+
i(/^(\*\*\/)+/, "(?:^|.*/)"),
|
|
7200
|
+
i(/\/(\*\*)$/, "(?:/.*|$)"),
|
|
7201
|
+
i(/\*\*/, ".*")
|
|
7202
|
+
]), N = l([i(/\*\/(?!\*\*\/)/, "[^/]*/"), i(/\*/, "[^/]*")]), k = i("?", "[^/]"), $r = i("[", p), wr = i("]", p), Ar = i(/[!^]/, "^/"), br = i(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Er = l([
|
|
7203
7203
|
y,
|
|
7204
|
-
i
|
|
7204
|
+
i(/[$.*+?^(){}[\|]/, (r) => `\\${r}`),
|
|
7205
7205
|
br,
|
|
7206
|
-
i
|
|
7206
|
+
i(/[^\]]/, p)
|
|
7207
7207
|
]), B = x([
|
|
7208
7208
|
$r,
|
|
7209
7209
|
tr(Ar),
|
|
7210
7210
|
f(Er),
|
|
7211
7211
|
wr
|
|
7212
|
-
]), Pr = i
|
|
7212
|
+
]), Pr = i("{", "(?:"), Or = i("}", ")"), I = x([
|
|
7213
7213
|
Pr,
|
|
7214
7214
|
l([
|
|
7215
|
-
i
|
|
7216
|
-
i
|
|
7217
|
-
i
|
|
7215
|
+
i(/(\d+)\.\.(\d+)/, (r, e, n) => or(+e, +n, Math.min(e.length, n.length)).join("|")),
|
|
7216
|
+
i(/([a-z]+)\.\.([a-z]+)/, (r, e, n) => R(e, n).join("|")),
|
|
7217
|
+
i(/([A-Z]+)\.\.([A-Z]+)/, (r, e, n) => R(e.toLowerCase(), n.toLowerCase()).join("|").toUpperCase())
|
|
7218
7218
|
]),
|
|
7219
7219
|
Or
|
|
7220
|
-
]), kr = i
|
|
7220
|
+
]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i(/[^}]/, p), F = x([
|
|
7221
7221
|
kr,
|
|
7222
7222
|
f(l([
|
|
7223
7223
|
j,
|
|
@@ -7246,36 +7246,36 @@ let _lazyMatch = () => {
|
|
|
7246
7246
|
y,
|
|
7247
7247
|
pr,
|
|
7248
7248
|
vr
|
|
7249
|
-
]))), Tr = i
|
|
7249
|
+
]))), Tr = i(/\\./, p), qr = i(/./, p), Yr = z(f(l([
|
|
7250
7250
|
Tr,
|
|
7251
|
-
i
|
|
7252
|
-
i
|
|
7253
|
-
i
|
|
7251
|
+
i(/\*\*\*+/, "*"),
|
|
7252
|
+
i(/([^/{[(!])\*\*/, (r, e) => `${e}*`),
|
|
7253
|
+
i(/(^|.)\*\*(?=[^*/)\]}])/, (r, e) => `${e}*`),
|
|
7254
7254
|
qr
|
|
7255
|
-
]))), $ = (r
|
|
7256
|
-
const n = Array.isArray(r
|
|
7255
|
+
]))), $ = (r, e) => {
|
|
7256
|
+
const n = Array.isArray(r) ? r : [r];
|
|
7257
7257
|
if (!n.length) return false;
|
|
7258
7258
|
const a = n.map($.compile), t = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
|
|
7259
7259
|
return a.some((s) => s.test(o));
|
|
7260
7260
|
};
|
|
7261
|
-
$.compile = (r
|
|
7261
|
+
$.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
|
|
7262
7262
|
var re = $;
|
|
7263
7263
|
return J(w);
|
|
7264
7264
|
})();
|
|
7265
7265
|
return __lib__.default || __lib__;
|
|
7266
7266
|
};
|
|
7267
7267
|
let _match;
|
|
7268
|
-
const zeptomatch = (path
|
|
7268
|
+
const zeptomatch = (path, pattern) => {
|
|
7269
7269
|
if (!_match) {
|
|
7270
7270
|
_match = _lazyMatch();
|
|
7271
7271
|
_lazyMatch = null;
|
|
7272
7272
|
}
|
|
7273
|
-
return _match(path
|
|
7273
|
+
return _match(path, pattern);
|
|
7274
7274
|
};
|
|
7275
7275
|
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
7276
7276
|
function normalizeWindowsPath(input = "") {
|
|
7277
7277
|
if (!input) return input;
|
|
7278
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r
|
|
7278
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
7279
7279
|
}
|
|
7280
7280
|
const _UNC_REGEX = /^[/\\]{2}/;
|
|
7281
7281
|
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
@@ -7284,37 +7284,37 @@ const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
|
7284
7284
|
const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
7285
7285
|
const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
7286
7286
|
const sep = "/";
|
|
7287
|
-
const normalize = function(path
|
|
7288
|
-
if (path
|
|
7289
|
-
path
|
|
7290
|
-
const isUNCPath = path
|
|
7291
|
-
const isPathAbsolute = isAbsolute(path
|
|
7292
|
-
const trailingSeparator = path
|
|
7293
|
-
path
|
|
7294
|
-
if (path
|
|
7287
|
+
const normalize = function(path) {
|
|
7288
|
+
if (path.length === 0) return ".";
|
|
7289
|
+
path = normalizeWindowsPath(path);
|
|
7290
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
7291
|
+
const isPathAbsolute = isAbsolute(path);
|
|
7292
|
+
const trailingSeparator = path[path.length - 1] === "/";
|
|
7293
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
7294
|
+
if (path.length === 0) {
|
|
7295
7295
|
if (isPathAbsolute) return "/";
|
|
7296
7296
|
return trailingSeparator ? "./" : ".";
|
|
7297
7297
|
}
|
|
7298
|
-
if (trailingSeparator) path
|
|
7299
|
-
if (_DRIVE_LETTER_RE.test(path
|
|
7298
|
+
if (trailingSeparator) path += "/";
|
|
7299
|
+
if (_DRIVE_LETTER_RE.test(path)) path += "/";
|
|
7300
7300
|
if (isUNCPath) {
|
|
7301
|
-
if (!isPathAbsolute) return `//./${path
|
|
7302
|
-
return `//${path
|
|
7301
|
+
if (!isPathAbsolute) return `//./${path}`;
|
|
7302
|
+
return `//${path}`;
|
|
7303
7303
|
}
|
|
7304
|
-
return isPathAbsolute && !isAbsolute(path
|
|
7304
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
7305
7305
|
};
|
|
7306
7306
|
const join = function(...segments) {
|
|
7307
|
-
let path
|
|
7307
|
+
let path = "";
|
|
7308
7308
|
for (const seg of segments) {
|
|
7309
7309
|
if (!seg) continue;
|
|
7310
|
-
if (path
|
|
7311
|
-
const pathTrailing = path
|
|
7310
|
+
if (path.length > 0) {
|
|
7311
|
+
const pathTrailing = path[path.length - 1] === "/";
|
|
7312
7312
|
const segLeading = seg[0] === "/";
|
|
7313
|
-
if (pathTrailing && segLeading) path
|
|
7314
|
-
else path
|
|
7315
|
-
} else path
|
|
7313
|
+
if (pathTrailing && segLeading) path += seg.slice(1);
|
|
7314
|
+
else path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
7315
|
+
} else path += seg;
|
|
7316
7316
|
}
|
|
7317
|
-
return normalize(path
|
|
7317
|
+
return normalize(path);
|
|
7318
7318
|
};
|
|
7319
7319
|
function cwd$1() {
|
|
7320
7320
|
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
|
@@ -7325,23 +7325,23 @@ const resolve = function(...arguments_) {
|
|
|
7325
7325
|
let resolvedPath = "";
|
|
7326
7326
|
let resolvedAbsolute = false;
|
|
7327
7327
|
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
7328
|
-
const path
|
|
7329
|
-
if (!path
|
|
7330
|
-
resolvedPath = `${path
|
|
7331
|
-
resolvedAbsolute = isAbsolute(path
|
|
7328
|
+
const path = index >= 0 ? arguments_[index] : cwd$1();
|
|
7329
|
+
if (!path || path.length === 0) continue;
|
|
7330
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
7331
|
+
resolvedAbsolute = isAbsolute(path);
|
|
7332
7332
|
}
|
|
7333
7333
|
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
7334
7334
|
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
|
7335
7335
|
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
7336
7336
|
};
|
|
7337
|
-
function normalizeString(path
|
|
7337
|
+
function normalizeString(path, allowAboveRoot) {
|
|
7338
7338
|
let res = "";
|
|
7339
7339
|
let lastSegmentLength = 0;
|
|
7340
7340
|
let lastSlash = -1;
|
|
7341
7341
|
let dots = 0;
|
|
7342
7342
|
let char = null;
|
|
7343
|
-
for (let index = 0; index <= path
|
|
7344
|
-
if (index < path
|
|
7343
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
7344
|
+
if (index < path.length) char = path[index];
|
|
7345
7345
|
else if (char === "/") break;
|
|
7346
7346
|
else char = "/";
|
|
7347
7347
|
if (char === "/") {
|
|
@@ -7373,8 +7373,8 @@ function normalizeString(path$13, allowAboveRoot) {
|
|
|
7373
7373
|
lastSegmentLength = 2;
|
|
7374
7374
|
}
|
|
7375
7375
|
} else {
|
|
7376
|
-
if (res.length > 0) res += `/${path
|
|
7377
|
-
else res = path
|
|
7376
|
+
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
7377
|
+
else res = path.slice(lastSlash + 1, index);
|
|
7378
7378
|
lastSegmentLength = index - lastSlash - 1;
|
|
7379
7379
|
}
|
|
7380
7380
|
lastSlash = index;
|
|
@@ -7424,8 +7424,8 @@ const format$1 = function(p) {
|
|
|
7424
7424
|
const basename = function(p, extension) {
|
|
7425
7425
|
const segments = normalizeWindowsPath(p).split("/");
|
|
7426
7426
|
let lastSegment = "";
|
|
7427
|
-
for (let i
|
|
7428
|
-
const val = segments[i
|
|
7427
|
+
for (let i = segments.length - 1; i >= 0; i--) {
|
|
7428
|
+
const val = segments[i];
|
|
7429
7429
|
if (val) {
|
|
7430
7430
|
lastSegment = val;
|
|
7431
7431
|
break;
|
|
@@ -7445,8 +7445,8 @@ const parse$1 = function(p) {
|
|
|
7445
7445
|
name: base.slice(0, base.length - extension.length)
|
|
7446
7446
|
};
|
|
7447
7447
|
};
|
|
7448
|
-
const matchesGlob = (path
|
|
7449
|
-
return zeptomatch(pattern, normalize(path
|
|
7448
|
+
const matchesGlob = (path, pattern) => {
|
|
7449
|
+
return zeptomatch(pattern, normalize(path));
|
|
7450
7450
|
};
|
|
7451
7451
|
const _path = {
|
|
7452
7452
|
__proto__: null,
|
|
@@ -7487,8 +7487,8 @@ const win32 = /* @__PURE__ */ mix(";");
|
|
|
7487
7487
|
//#endregion
|
|
7488
7488
|
//#region ../../node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist/index.mjs
|
|
7489
7489
|
const BUILTIN_MODULES = new Set(builtinModules);
|
|
7490
|
-
function normalizeSlash(path
|
|
7491
|
-
return path
|
|
7490
|
+
function normalizeSlash(path) {
|
|
7491
|
+
return path.replace(/\\/g, "/");
|
|
7492
7492
|
}
|
|
7493
7493
|
/**
|
|
7494
7494
|
* @typedef ErrnoExceptionFields
|
|
@@ -7540,39 +7540,39 @@ codes.ERR_INVALID_ARG_TYPE = createError(
|
|
|
7540
7540
|
* @param {Array<string> | string} expected
|
|
7541
7541
|
* @param {unknown} actual
|
|
7542
7542
|
*/
|
|
7543
|
-
(name
|
|
7544
|
-
assert(typeof name
|
|
7543
|
+
(name, expected, actual) => {
|
|
7544
|
+
assert(typeof name === "string", "'name' must be a string");
|
|
7545
7545
|
if (!Array.isArray(expected)) expected = [expected];
|
|
7546
7546
|
let message = "The ";
|
|
7547
|
-
if (name
|
|
7547
|
+
if (name.endsWith(" argument")) message += `${name} `;
|
|
7548
7548
|
else {
|
|
7549
|
-
const type = name
|
|
7550
|
-
message += `"${name
|
|
7549
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
7550
|
+
message += `"${name}" ${type} `;
|
|
7551
7551
|
}
|
|
7552
7552
|
message += "must be ";
|
|
7553
7553
|
/** @type {Array<string>} */
|
|
7554
|
-
const types
|
|
7554
|
+
const types = [];
|
|
7555
7555
|
/** @type {Array<string>} */
|
|
7556
7556
|
const instances = [];
|
|
7557
7557
|
/** @type {Array<string>} */
|
|
7558
7558
|
const other = [];
|
|
7559
7559
|
for (const value of expected) {
|
|
7560
7560
|
assert(typeof value === "string", "All expected entries have to be of type string");
|
|
7561
|
-
if (kTypes.has(value)) types
|
|
7561
|
+
if (kTypes.has(value)) types.push(value.toLowerCase());
|
|
7562
7562
|
else if (classRegExp.exec(value) === null) {
|
|
7563
7563
|
assert(value !== "object", "The value \"object\" should be written as \"Object\"");
|
|
7564
7564
|
other.push(value);
|
|
7565
7565
|
} else instances.push(value);
|
|
7566
7566
|
}
|
|
7567
7567
|
if (instances.length > 0) {
|
|
7568
|
-
const pos = types
|
|
7568
|
+
const pos = types.indexOf("object");
|
|
7569
7569
|
if (pos !== -1) {
|
|
7570
|
-
types
|
|
7570
|
+
types.slice(pos, 1);
|
|
7571
7571
|
instances.push("Object");
|
|
7572
7572
|
}
|
|
7573
7573
|
}
|
|
7574
|
-
if (types
|
|
7575
|
-
message += `${types
|
|
7574
|
+
if (types.length > 0) {
|
|
7575
|
+
message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`;
|
|
7576
7576
|
if (instances.length > 0 || other.length > 0) message += " or ";
|
|
7577
7577
|
}
|
|
7578
7578
|
if (instances.length > 0) {
|
|
@@ -7608,8 +7608,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
|
|
|
7608
7608
|
* @param {string} [base]
|
|
7609
7609
|
* @param {string} [message]
|
|
7610
7610
|
*/
|
|
7611
|
-
(path
|
|
7612
|
-
return `Invalid package config ${path
|
|
7611
|
+
(path, base, message) => {
|
|
7612
|
+
return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
7613
7613
|
},
|
|
7614
7614
|
Error
|
|
7615
7615
|
);
|
|
@@ -7639,8 +7639,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
|
|
|
7639
7639
|
* @param {string} base
|
|
7640
7640
|
* @param {boolean} [exactUrl]
|
|
7641
7641
|
*/
|
|
7642
|
-
(path
|
|
7643
|
-
return `Cannot find ${exactUrl ? "module" : "package"} '${path
|
|
7642
|
+
(path, base, exactUrl = false) => {
|
|
7643
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
|
|
7644
7644
|
},
|
|
7645
7645
|
Error
|
|
7646
7646
|
);
|
|
@@ -7678,8 +7678,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
|
7678
7678
|
* @param {string} extension
|
|
7679
7679
|
* @param {string} path
|
|
7680
7680
|
*/
|
|
7681
|
-
(extension, path
|
|
7682
|
-
return `Unknown file extension "${extension}" for ${path
|
|
7681
|
+
(extension, path) => {
|
|
7682
|
+
return `Unknown file extension "${extension}" for ${path}`;
|
|
7683
7683
|
},
|
|
7684
7684
|
TypeError
|
|
7685
7685
|
);
|
|
@@ -7690,10 +7690,10 @@ codes.ERR_INVALID_ARG_VALUE = createError(
|
|
|
7690
7690
|
* @param {unknown} value
|
|
7691
7691
|
* @param {string} [reason='is invalid']
|
|
7692
7692
|
*/
|
|
7693
|
-
(name
|
|
7693
|
+
(name, value, reason = "is invalid") => {
|
|
7694
7694
|
let inspected = inspect(value);
|
|
7695
7695
|
if (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`;
|
|
7696
|
-
return `The ${name
|
|
7696
|
+
return `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
|
|
7697
7697
|
},
|
|
7698
7698
|
TypeError
|
|
7699
7699
|
);
|
|
@@ -7985,8 +7985,8 @@ function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
|
|
|
7985
7985
|
if (packageType === "none" || packageType === "commonjs") return "commonjs";
|
|
7986
7986
|
return "module";
|
|
7987
7987
|
}
|
|
7988
|
-
const format
|
|
7989
|
-
if (format
|
|
7988
|
+
const format = extensionFormatMap[value];
|
|
7989
|
+
if (format) return format;
|
|
7990
7990
|
if (ignoreErrors) return;
|
|
7991
7991
|
throw new ERR_UNKNOWN_FILE_EXTENSION(value, fileURLToPath(url));
|
|
7992
7992
|
}
|
|
@@ -8048,9 +8048,9 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
|
8048
8048
|
* @param {string} path
|
|
8049
8049
|
* @returns {Stats | undefined}
|
|
8050
8050
|
*/
|
|
8051
|
-
function tryStatSync(path
|
|
8051
|
+
function tryStatSync(path) {
|
|
8052
8052
|
try {
|
|
8053
|
-
return statSync(path
|
|
8053
|
+
return statSync(path);
|
|
8054
8054
|
} catch {}
|
|
8055
8055
|
}
|
|
8056
8056
|
/**
|
|
@@ -8081,7 +8081,7 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
|
8081
8081
|
if (packageConfig.main !== void 0) {
|
|
8082
8082
|
guess = new URL$1(packageConfig.main, packageJsonUrl);
|
|
8083
8083
|
if (fileExists(guess)) return guess;
|
|
8084
|
-
const tries
|
|
8084
|
+
const tries = [
|
|
8085
8085
|
`./${packageConfig.main}.js`,
|
|
8086
8086
|
`./${packageConfig.main}.json`,
|
|
8087
8087
|
`./${packageConfig.main}.node`,
|
|
@@ -8089,9 +8089,9 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
|
8089
8089
|
`./${packageConfig.main}/index.json`,
|
|
8090
8090
|
`./${packageConfig.main}/index.node`
|
|
8091
8091
|
];
|
|
8092
|
-
let i
|
|
8093
|
-
while (++i
|
|
8094
|
-
guess = new URL$1(tries
|
|
8092
|
+
let i = -1;
|
|
8093
|
+
while (++i < tries.length) {
|
|
8094
|
+
guess = new URL$1(tries[i], packageJsonUrl);
|
|
8095
8095
|
if (fileExists(guess)) break;
|
|
8096
8096
|
guess = void 0;
|
|
8097
8097
|
}
|
|
@@ -8105,9 +8105,9 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
|
8105
8105
|
"./index.json",
|
|
8106
8106
|
"./index.node"
|
|
8107
8107
|
];
|
|
8108
|
-
let i
|
|
8109
|
-
while (++i
|
|
8110
|
-
guess = new URL$1(tries[i
|
|
8108
|
+
let i = -1;
|
|
8109
|
+
while (++i < tries.length) {
|
|
8110
|
+
guess = new URL$1(tries[i], packageJsonUrl);
|
|
8111
8111
|
if (fileExists(guess)) break;
|
|
8112
8112
|
guess = void 0;
|
|
8113
8113
|
}
|
|
@@ -8270,9 +8270,9 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b
|
|
|
8270
8270
|
if (targetList.length === 0) return null;
|
|
8271
8271
|
/** @type {ErrnoException | null | undefined} */
|
|
8272
8272
|
let lastException;
|
|
8273
|
-
let i
|
|
8274
|
-
while (++i
|
|
8275
|
-
const targetItem = targetList[i
|
|
8273
|
+
let i = -1;
|
|
8274
|
+
while (++i < targetList.length) {
|
|
8275
|
+
const targetItem = targetList[i];
|
|
8276
8276
|
/** @type {URL | null} */
|
|
8277
8277
|
let resolveResult;
|
|
8278
8278
|
try {
|
|
@@ -8295,14 +8295,14 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b
|
|
|
8295
8295
|
}
|
|
8296
8296
|
if (typeof target === "object" && target !== null) {
|
|
8297
8297
|
const keys = Object.getOwnPropertyNames(target);
|
|
8298
|
-
let i
|
|
8299
|
-
while (++i
|
|
8300
|
-
const key = keys[i
|
|
8298
|
+
let i = -1;
|
|
8299
|
+
while (++i < keys.length) {
|
|
8300
|
+
const key = keys[i];
|
|
8301
8301
|
if (isArrayIndex(key)) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(packageJsonUrl), base, "\"exports\" cannot contain numeric property keys.");
|
|
8302
8302
|
}
|
|
8303
|
-
i
|
|
8304
|
-
while (++i
|
|
8305
|
-
const key = keys[i
|
|
8303
|
+
i = -1;
|
|
8304
|
+
while (++i < keys.length) {
|
|
8305
|
+
const key = keys[i];
|
|
8306
8306
|
if (key === "default" || conditions && conditions.has(key)) {
|
|
8307
8307
|
const conditionalTarget = target[key];
|
|
8308
8308
|
const resolveResult = resolvePackageTarget(packageJsonUrl, conditionalTarget, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions);
|
|
@@ -8321,17 +8321,17 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b
|
|
|
8321
8321
|
* @param {URL} base
|
|
8322
8322
|
* @returns {boolean}
|
|
8323
8323
|
*/
|
|
8324
|
-
function isConditionalExportsMainSugar(exports
|
|
8325
|
-
if (typeof exports
|
|
8326
|
-
if (typeof exports
|
|
8327
|
-
const keys = Object.getOwnPropertyNames(exports
|
|
8324
|
+
function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
|
|
8325
|
+
if (typeof exports === "string" || Array.isArray(exports)) return true;
|
|
8326
|
+
if (typeof exports !== "object" || exports === null) return false;
|
|
8327
|
+
const keys = Object.getOwnPropertyNames(exports);
|
|
8328
8328
|
let isConditionalSugar = false;
|
|
8329
|
-
let i
|
|
8329
|
+
let i = 0;
|
|
8330
8330
|
let keyIndex = -1;
|
|
8331
8331
|
while (++keyIndex < keys.length) {
|
|
8332
8332
|
const key = keys[keyIndex];
|
|
8333
8333
|
const currentIsConditionalSugar = key === "" || key[0] !== ".";
|
|
8334
|
-
if (i
|
|
8334
|
+
if (i++ === 0) isConditionalSugar = currentIsConditionalSugar;
|
|
8335
8335
|
else if (isConditionalSugar !== currentIsConditionalSugar) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(packageJsonUrl), base, "\"exports\" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.");
|
|
8336
8336
|
}
|
|
8337
8337
|
return isConditionalSugar;
|
|
@@ -8357,20 +8357,20 @@ function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
|
|
|
8357
8357
|
* @returns {URL}
|
|
8358
8358
|
*/
|
|
8359
8359
|
function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) {
|
|
8360
|
-
let exports
|
|
8361
|
-
if (isConditionalExportsMainSugar(exports
|
|
8362
|
-
if (own.call(exports
|
|
8363
|
-
const target = exports
|
|
8360
|
+
let exports = packageConfig.exports;
|
|
8361
|
+
if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) exports = { ".": exports };
|
|
8362
|
+
if (own.call(exports, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) {
|
|
8363
|
+
const target = exports[packageSubpath];
|
|
8364
8364
|
const resolveResult = resolvePackageTarget(packageJsonUrl, target, "", packageSubpath, base, false, false, false, conditions);
|
|
8365
8365
|
if (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
8366
8366
|
return resolveResult;
|
|
8367
8367
|
}
|
|
8368
8368
|
let bestMatch = "";
|
|
8369
8369
|
let bestMatchSubpath = "";
|
|
8370
|
-
const keys = Object.getOwnPropertyNames(exports
|
|
8371
|
-
let i
|
|
8372
|
-
while (++i
|
|
8373
|
-
const key = keys[i
|
|
8370
|
+
const keys = Object.getOwnPropertyNames(exports);
|
|
8371
|
+
let i = -1;
|
|
8372
|
+
while (++i < keys.length) {
|
|
8373
|
+
const key = keys[i];
|
|
8374
8374
|
const patternIndex = key.indexOf("*");
|
|
8375
8375
|
if (patternIndex !== -1 && packageSubpath.startsWith(key.slice(0, patternIndex))) {
|
|
8376
8376
|
if (packageSubpath.endsWith("/")) emitTrailingSlashPatternDeprecation(packageSubpath, packageJsonUrl, base);
|
|
@@ -8382,7 +8382,7 @@ function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, ba
|
|
|
8382
8382
|
}
|
|
8383
8383
|
}
|
|
8384
8384
|
if (bestMatch) {
|
|
8385
|
-
const target = exports
|
|
8385
|
+
const target = exports[bestMatch];
|
|
8386
8386
|
const resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, true, false, packageSubpath.endsWith("/"), conditions);
|
|
8387
8387
|
if (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
8388
8388
|
return resolveResult;
|
|
@@ -8412,30 +8412,30 @@ function patternKeyCompare(a, b) {
|
|
|
8412
8412
|
* @param {Set<string>} [conditions]
|
|
8413
8413
|
* @returns {URL}
|
|
8414
8414
|
*/
|
|
8415
|
-
function packageImportsResolve(name
|
|
8416
|
-
if (name
|
|
8415
|
+
function packageImportsResolve(name, base, conditions) {
|
|
8416
|
+
if (name === "#" || name.startsWith("#/") || name.endsWith("/")) throw new ERR_INVALID_MODULE_SPECIFIER(name, "is not a valid internal imports specifier name", fileURLToPath(base));
|
|
8417
8417
|
/** @type {URL | undefined} */
|
|
8418
8418
|
let packageJsonUrl;
|
|
8419
8419
|
const packageConfig = getPackageScopeConfig(base);
|
|
8420
8420
|
if (packageConfig.exists) {
|
|
8421
8421
|
packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);
|
|
8422
8422
|
const imports = packageConfig.imports;
|
|
8423
|
-
if (imports) if (own.call(imports, name
|
|
8424
|
-
const resolveResult = resolvePackageTarget(packageJsonUrl, imports[name
|
|
8423
|
+
if (imports) if (own.call(imports, name) && !name.includes("*")) {
|
|
8424
|
+
const resolveResult = resolvePackageTarget(packageJsonUrl, imports[name], "", name, base, false, true, false, conditions);
|
|
8425
8425
|
if (resolveResult !== null && resolveResult !== void 0) return resolveResult;
|
|
8426
8426
|
} else {
|
|
8427
8427
|
let bestMatch = "";
|
|
8428
8428
|
let bestMatchSubpath = "";
|
|
8429
8429
|
const keys = Object.getOwnPropertyNames(imports);
|
|
8430
|
-
let i
|
|
8431
|
-
while (++i
|
|
8432
|
-
const key = keys[i
|
|
8430
|
+
let i = -1;
|
|
8431
|
+
while (++i < keys.length) {
|
|
8432
|
+
const key = keys[i];
|
|
8433
8433
|
const patternIndex = key.indexOf("*");
|
|
8434
|
-
if (patternIndex !== -1 && name
|
|
8434
|
+
if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) {
|
|
8435
8435
|
const patternTrailer = key.slice(patternIndex + 1);
|
|
8436
|
-
if (name
|
|
8436
|
+
if (name.length >= key.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) {
|
|
8437
8437
|
bestMatch = key;
|
|
8438
|
-
bestMatchSubpath = name
|
|
8438
|
+
bestMatchSubpath = name.slice(patternIndex, name.length - patternTrailer.length);
|
|
8439
8439
|
}
|
|
8440
8440
|
}
|
|
8441
8441
|
}
|
|
@@ -8446,7 +8446,7 @@ function packageImportsResolve(name$3, base, conditions) {
|
|
|
8446
8446
|
}
|
|
8447
8447
|
}
|
|
8448
8448
|
}
|
|
8449
|
-
throw importNotDefined(name
|
|
8449
|
+
throw importNotDefined(name, packageJsonUrl, base);
|
|
8450
8450
|
}
|
|
8451
8451
|
/**
|
|
8452
8452
|
* @param {string} specifier
|
|
@@ -8482,8 +8482,8 @@ function packageResolve(specifier, base, conditions) {
|
|
|
8482
8482
|
const packageConfig = getPackageScopeConfig(base);
|
|
8483
8483
|
/* c8 ignore next 16 */
|
|
8484
8484
|
if (packageConfig.exists) {
|
|
8485
|
-
const packageJsonUrl
|
|
8486
|
-
if (packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(packageJsonUrl
|
|
8485
|
+
const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);
|
|
8486
|
+
if (packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions);
|
|
8487
8487
|
}
|
|
8488
8488
|
let packageJsonUrl = new URL$1("./node_modules/" + packageName + "/package.json", base);
|
|
8489
8489
|
let packageJsonPath = fileURLToPath(packageJsonUrl);
|
|
@@ -8497,12 +8497,12 @@ function packageResolve(specifier, base, conditions) {
|
|
|
8497
8497
|
packageJsonPath = fileURLToPath(packageJsonUrl);
|
|
8498
8498
|
continue;
|
|
8499
8499
|
}
|
|
8500
|
-
const packageConfig
|
|
8500
|
+
const packageConfig = read(packageJsonPath, {
|
|
8501
8501
|
base,
|
|
8502
8502
|
specifier
|
|
8503
8503
|
});
|
|
8504
|
-
if (packageConfig
|
|
8505
|
-
if (packageSubpath === ".") return legacyMainResolve(packageJsonUrl, packageConfig
|
|
8504
|
+
if (packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions);
|
|
8505
|
+
if (packageSubpath === ".") return legacyMainResolve(packageJsonUrl, packageConfig, base);
|
|
8506
8506
|
return new URL$1(packageSubpath, packageJsonUrl);
|
|
8507
8507
|
} while (packageJsonPath.length !== lastPath.length);
|
|
8508
8508
|
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), false);
|
|
@@ -8712,7 +8712,7 @@ const routeJSXReg = /^\s+(route)\s+/gm;
|
|
|
8712
8712
|
function parseJSX(code) {
|
|
8713
8713
|
return extractComments(code).slice(0, 1).filter((comment) => routeJSXReg.test(comment.value) && comment.value.includes(":") && comment.loc.start.line === 1);
|
|
8714
8714
|
}
|
|
8715
|
-
function parseYamlComment(code, path
|
|
8715
|
+
function parseYamlComment(code, path) {
|
|
8716
8716
|
return code.reduce((memo, item) => {
|
|
8717
8717
|
const { value } = item;
|
|
8718
8718
|
const v = value.replace(routeJSXReg, "");
|
|
@@ -8723,12 +8723,12 @@ function parseYamlComment(code, path$13) {
|
|
|
8723
8723
|
...yamlResult
|
|
8724
8724
|
};
|
|
8725
8725
|
} catch (err) {
|
|
8726
|
-
throw new Error(`Invalid YAML format of comment in ${path
|
|
8726
|
+
throw new Error(`Invalid YAML format of comment in ${path}\n${err.message}`);
|
|
8727
8727
|
}
|
|
8728
8728
|
}, {});
|
|
8729
8729
|
}
|
|
8730
|
-
function getRouteBlock(path
|
|
8731
|
-
return parseYamlComment(parseJSX(import_lib.default.readFileSync(path
|
|
8730
|
+
function getRouteBlock(path) {
|
|
8731
|
+
return parseYamlComment(parseJSX(import_lib.default.readFileSync(path, "utf-8")), path);
|
|
8732
8732
|
}
|
|
8733
8733
|
function extendRoute(route) {
|
|
8734
8734
|
if (!route.element) return;
|
|
@@ -8745,9 +8745,9 @@ const name$2 = "vixt:preset-react";
|
|
|
8745
8745
|
var preset_react_default = defineVixtModule({
|
|
8746
8746
|
meta: { name: name$2 },
|
|
8747
8747
|
setup(_, vixt) {
|
|
8748
|
-
const { components = [], constants
|
|
8748
|
+
const { components = [], constants = [], hooks = [], layouts = [], pages = [], stores = [], utils = [] } = resolveLayersDirs([...vixt._layers].reverse());
|
|
8749
8749
|
const { buildTypesDir } = vixt.options;
|
|
8750
|
-
const defaultOptions
|
|
8750
|
+
const defaultOptions = {
|
|
8751
8751
|
react: {},
|
|
8752
8752
|
pages: {
|
|
8753
8753
|
dirs: pages,
|
|
@@ -8769,7 +8769,7 @@ var preset_react_default = defineVixtModule({
|
|
|
8769
8769
|
],
|
|
8770
8770
|
dts: `${buildTypesDir}/auto-imports.d.ts`,
|
|
8771
8771
|
dirs: [
|
|
8772
|
-
constants
|
|
8772
|
+
constants,
|
|
8773
8773
|
hooks,
|
|
8774
8774
|
stores,
|
|
8775
8775
|
utils
|
|
@@ -8777,7 +8777,7 @@ var preset_react_default = defineVixtModule({
|
|
|
8777
8777
|
},
|
|
8778
8778
|
unocss: {}
|
|
8779
8779
|
};
|
|
8780
|
-
const options = vixt.options = defu(vixt.options, defaultOptions
|
|
8780
|
+
const options = vixt.options = defu(vixt.options, defaultOptions);
|
|
8781
8781
|
return [
|
|
8782
8782
|
UnoCSS(options.unocss),
|
|
8783
8783
|
React(options.react),
|
|
@@ -8824,8 +8824,8 @@ var virtual_root_component_default = defineVixtModule({
|
|
|
8824
8824
|
},
|
|
8825
8825
|
load(id) {
|
|
8826
8826
|
if (id === name$1) {
|
|
8827
|
-
const { path
|
|
8828
|
-
this.addWatchFile(path
|
|
8827
|
+
const { path, code } = resolveRootComponent(vixt);
|
|
8828
|
+
this.addWatchFile(path);
|
|
8829
8829
|
return code;
|
|
8830
8830
|
}
|
|
8831
8831
|
}
|