unplugin-env 0.1.3 → 0.1.5
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/{chunk-MNU7HARO.js → chunk-2KZLPXSE.js} +1284 -1147
- package/dist/{chunk-YGAPXDJU.js → chunk-5EP4GEYR.js} +1 -1
- package/dist/{chunk-TZPPLLDV.js → chunk-QAX3K5V3.js} +1 -1
- package/dist/esbuild.cjs +1601 -1464
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +1601 -1464
- package/dist/index.js +1 -1
- package/dist/nuxt.cjs +1601 -1464
- package/dist/nuxt.js +3 -3
- package/dist/rollup.cjs +1601 -1464
- package/dist/rollup.js +1 -1
- package/dist/types.d.cts +11 -4
- package/dist/types.d.ts +11 -4
- package/dist/vite.cjs +1601 -1464
- package/dist/vite.js +2 -2
- package/dist/webpack.cjs +1601 -1464
- package/dist/webpack.js +2 -2
- package/package.json +25 -24
|
@@ -107,9 +107,9 @@ var require_path = __commonJS({
|
|
|
107
107
|
"use strict";
|
|
108
108
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
109
109
|
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
|
|
110
|
-
var
|
|
110
|
+
var os2 = __require("os");
|
|
111
111
|
var path2 = __require("path");
|
|
112
|
-
var IS_WINDOWS_PLATFORM =
|
|
112
|
+
var IS_WINDOWS_PLATFORM = os2.platform() === "win32";
|
|
113
113
|
var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
114
114
|
var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
|
115
115
|
var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
@@ -3444,8 +3444,8 @@ var require_utils3 = __commonJS({
|
|
|
3444
3444
|
exports.array = array;
|
|
3445
3445
|
var errno = require_errno();
|
|
3446
3446
|
exports.errno = errno;
|
|
3447
|
-
var
|
|
3448
|
-
exports.fs =
|
|
3447
|
+
var fs4 = require_fs();
|
|
3448
|
+
exports.fs = fs4;
|
|
3449
3449
|
var path2 = require_path();
|
|
3450
3450
|
exports.path = path2;
|
|
3451
3451
|
var pattern = require_pattern();
|
|
@@ -3629,12 +3629,12 @@ var require_fs2 = __commonJS({
|
|
|
3629
3629
|
"use strict";
|
|
3630
3630
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3631
3631
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
3632
|
-
var
|
|
3632
|
+
var fs4 = __require("fs");
|
|
3633
3633
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
3634
|
-
lstat:
|
|
3635
|
-
stat:
|
|
3636
|
-
lstatSync:
|
|
3637
|
-
statSync:
|
|
3634
|
+
lstat: fs4.lstat,
|
|
3635
|
+
stat: fs4.stat,
|
|
3636
|
+
lstatSync: fs4.lstatSync,
|
|
3637
|
+
statSync: fs4.statSync
|
|
3638
3638
|
};
|
|
3639
3639
|
function createFileSystemAdapter(fsMethods) {
|
|
3640
3640
|
if (fsMethods === void 0) {
|
|
@@ -3651,12 +3651,12 @@ var require_settings = __commonJS({
|
|
|
3651
3651
|
"node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
|
|
3652
3652
|
"use strict";
|
|
3653
3653
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3654
|
-
var
|
|
3654
|
+
var fs4 = require_fs2();
|
|
3655
3655
|
var Settings = class {
|
|
3656
3656
|
constructor(_options = {}) {
|
|
3657
3657
|
this._options = _options;
|
|
3658
3658
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
3659
|
-
this.fs =
|
|
3659
|
+
this.fs = fs4.createFileSystemAdapter(this._options.fs);
|
|
3660
3660
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
3661
3661
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
3662
3662
|
}
|
|
@@ -3816,8 +3816,8 @@ var require_utils4 = __commonJS({
|
|
|
3816
3816
|
"use strict";
|
|
3817
3817
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3818
3818
|
exports.fs = void 0;
|
|
3819
|
-
var
|
|
3820
|
-
exports.fs =
|
|
3819
|
+
var fs4 = require_fs3();
|
|
3820
|
+
exports.fs = fs4;
|
|
3821
3821
|
}
|
|
3822
3822
|
});
|
|
3823
3823
|
|
|
@@ -4012,14 +4012,14 @@ var require_fs4 = __commonJS({
|
|
|
4012
4012
|
"use strict";
|
|
4013
4013
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4014
4014
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
4015
|
-
var
|
|
4015
|
+
var fs4 = __require("fs");
|
|
4016
4016
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
4017
|
-
lstat:
|
|
4018
|
-
stat:
|
|
4019
|
-
lstatSync:
|
|
4020
|
-
statSync:
|
|
4021
|
-
readdir:
|
|
4022
|
-
readdirSync:
|
|
4017
|
+
lstat: fs4.lstat,
|
|
4018
|
+
stat: fs4.stat,
|
|
4019
|
+
lstatSync: fs4.lstatSync,
|
|
4020
|
+
statSync: fs4.statSync,
|
|
4021
|
+
readdir: fs4.readdir,
|
|
4022
|
+
readdirSync: fs4.readdirSync
|
|
4023
4023
|
};
|
|
4024
4024
|
function createFileSystemAdapter(fsMethods) {
|
|
4025
4025
|
if (fsMethods === void 0) {
|
|
@@ -4038,12 +4038,12 @@ var require_settings2 = __commonJS({
|
|
|
4038
4038
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4039
4039
|
var path2 = __require("path");
|
|
4040
4040
|
var fsStat = require_out();
|
|
4041
|
-
var
|
|
4041
|
+
var fs4 = require_fs4();
|
|
4042
4042
|
var Settings = class {
|
|
4043
4043
|
constructor(_options = {}) {
|
|
4044
4044
|
this._options = _options;
|
|
4045
4045
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
4046
|
-
this.fs =
|
|
4046
|
+
this.fs = fs4.createFileSystemAdapter(this._options.fs);
|
|
4047
4047
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path2.sep);
|
|
4048
4048
|
this.stats = this._getValue(this._options.stats, false);
|
|
4049
4049
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
@@ -4124,19 +4124,19 @@ var require_reusify = __commonJS({
|
|
|
4124
4124
|
}
|
|
4125
4125
|
});
|
|
4126
4126
|
|
|
4127
|
-
// node_modules/.pnpm/fastq@1.
|
|
4127
|
+
// node_modules/.pnpm/fastq@1.17.1/node_modules/fastq/queue.js
|
|
4128
4128
|
var require_queue = __commonJS({
|
|
4129
|
-
"node_modules/.pnpm/fastq@1.
|
|
4129
|
+
"node_modules/.pnpm/fastq@1.17.1/node_modules/fastq/queue.js"(exports, module2) {
|
|
4130
4130
|
"use strict";
|
|
4131
4131
|
var reusify = require_reusify();
|
|
4132
|
-
function fastqueue(context, worker,
|
|
4132
|
+
function fastqueue(context, worker, _concurrency) {
|
|
4133
4133
|
if (typeof context === "function") {
|
|
4134
|
-
|
|
4134
|
+
_concurrency = worker;
|
|
4135
4135
|
worker = context;
|
|
4136
4136
|
context = null;
|
|
4137
4137
|
}
|
|
4138
|
-
if (
|
|
4139
|
-
throw new Error("fastqueue concurrency must be greater than 1");
|
|
4138
|
+
if (!(_concurrency >= 1)) {
|
|
4139
|
+
throw new Error("fastqueue concurrency must be equal to or greater than 1");
|
|
4140
4140
|
}
|
|
4141
4141
|
var cache = reusify(Task);
|
|
4142
4142
|
var queueHead = null;
|
|
@@ -4149,7 +4149,21 @@ var require_queue = __commonJS({
|
|
|
4149
4149
|
saturated: noop,
|
|
4150
4150
|
pause,
|
|
4151
4151
|
paused: false,
|
|
4152
|
-
concurrency
|
|
4152
|
+
get concurrency() {
|
|
4153
|
+
return _concurrency;
|
|
4154
|
+
},
|
|
4155
|
+
set concurrency(value) {
|
|
4156
|
+
if (!(value >= 1)) {
|
|
4157
|
+
throw new Error("fastqueue concurrency must be equal to or greater than 1");
|
|
4158
|
+
}
|
|
4159
|
+
_concurrency = value;
|
|
4160
|
+
if (self.paused)
|
|
4161
|
+
return;
|
|
4162
|
+
for (; queueHead && _running < _concurrency; ) {
|
|
4163
|
+
_running++;
|
|
4164
|
+
release();
|
|
4165
|
+
}
|
|
4166
|
+
},
|
|
4153
4167
|
running,
|
|
4154
4168
|
resume,
|
|
4155
4169
|
idle,
|
|
@@ -4190,7 +4204,12 @@ var require_queue = __commonJS({
|
|
|
4190
4204
|
if (!self.paused)
|
|
4191
4205
|
return;
|
|
4192
4206
|
self.paused = false;
|
|
4193
|
-
|
|
4207
|
+
if (queueHead === null) {
|
|
4208
|
+
_running++;
|
|
4209
|
+
release();
|
|
4210
|
+
return;
|
|
4211
|
+
}
|
|
4212
|
+
for (; queueHead && _running < _concurrency; ) {
|
|
4194
4213
|
_running++;
|
|
4195
4214
|
release();
|
|
4196
4215
|
}
|
|
@@ -4205,7 +4224,7 @@ var require_queue = __commonJS({
|
|
|
4205
4224
|
current.value = value;
|
|
4206
4225
|
current.callback = done || noop;
|
|
4207
4226
|
current.errorHandler = errorHandler;
|
|
4208
|
-
if (_running
|
|
4227
|
+
if (_running >= _concurrency || self.paused) {
|
|
4209
4228
|
if (queueTail) {
|
|
4210
4229
|
queueTail.next = current;
|
|
4211
4230
|
queueTail = current;
|
|
@@ -4225,7 +4244,8 @@ var require_queue = __commonJS({
|
|
|
4225
4244
|
current.release = release;
|
|
4226
4245
|
current.value = value;
|
|
4227
4246
|
current.callback = done || noop;
|
|
4228
|
-
|
|
4247
|
+
current.errorHandler = errorHandler;
|
|
4248
|
+
if (_running >= _concurrency || self.paused) {
|
|
4229
4249
|
if (queueHead) {
|
|
4230
4250
|
current.next = queueHead;
|
|
4231
4251
|
queueHead = current;
|
|
@@ -4244,7 +4264,7 @@ var require_queue = __commonJS({
|
|
|
4244
4264
|
cache.release(holder);
|
|
4245
4265
|
}
|
|
4246
4266
|
var next = queueHead;
|
|
4247
|
-
if (next) {
|
|
4267
|
+
if (next && _running <= _concurrency) {
|
|
4248
4268
|
if (!self.paused) {
|
|
4249
4269
|
if (queueTail === queueHead) {
|
|
4250
4270
|
queueTail = null;
|
|
@@ -4300,9 +4320,9 @@ var require_queue = __commonJS({
|
|
|
4300
4320
|
self.release(self);
|
|
4301
4321
|
};
|
|
4302
4322
|
}
|
|
4303
|
-
function queueAsPromised(context, worker,
|
|
4323
|
+
function queueAsPromised(context, worker, _concurrency) {
|
|
4304
4324
|
if (typeof context === "function") {
|
|
4305
|
-
|
|
4325
|
+
_concurrency = worker;
|
|
4306
4326
|
worker = context;
|
|
4307
4327
|
context = null;
|
|
4308
4328
|
}
|
|
@@ -4311,7 +4331,7 @@ var require_queue = __commonJS({
|
|
|
4311
4331
|
cb(null, res);
|
|
4312
4332
|
}, cb);
|
|
4313
4333
|
}
|
|
4314
|
-
var queue = fastqueue(context, asyncWrapper,
|
|
4334
|
+
var queue = fastqueue(context, asyncWrapper, _concurrency);
|
|
4315
4335
|
var pushCb = queue.push;
|
|
4316
4336
|
var unshiftCb = queue.unshift;
|
|
4317
4337
|
queue.push = push;
|
|
@@ -5359,16 +5379,16 @@ var require_settings4 = __commonJS({
|
|
|
5359
5379
|
"use strict";
|
|
5360
5380
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5361
5381
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
5362
|
-
var
|
|
5363
|
-
var
|
|
5364
|
-
var CPU_COUNT = Math.max(
|
|
5382
|
+
var fs4 = __require("fs");
|
|
5383
|
+
var os2 = __require("os");
|
|
5384
|
+
var CPU_COUNT = Math.max(os2.cpus().length, 1);
|
|
5365
5385
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
5366
|
-
lstat:
|
|
5367
|
-
lstatSync:
|
|
5368
|
-
stat:
|
|
5369
|
-
statSync:
|
|
5370
|
-
readdir:
|
|
5371
|
-
readdirSync:
|
|
5386
|
+
lstat: fs4.lstat,
|
|
5387
|
+
lstatSync: fs4.lstatSync,
|
|
5388
|
+
stat: fs4.stat,
|
|
5389
|
+
statSync: fs4.statSync,
|
|
5390
|
+
readdir: fs4.readdir,
|
|
5391
|
+
readdirSync: fs4.readdirSync
|
|
5372
5392
|
};
|
|
5373
5393
|
var Settings = class {
|
|
5374
5394
|
constructor(_options = {}) {
|
|
@@ -5514,9 +5534,9 @@ var require_out4 = __commonJS({
|
|
|
5514
5534
|
}
|
|
5515
5535
|
});
|
|
5516
5536
|
|
|
5517
|
-
// node_modules/.pnpm/source-map-js@1.0
|
|
5537
|
+
// node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/base64.js
|
|
5518
5538
|
var require_base64 = __commonJS({
|
|
5519
|
-
"node_modules/.pnpm/source-map-js@1.0
|
|
5539
|
+
"node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/base64.js"(exports) {
|
|
5520
5540
|
"use strict";
|
|
5521
5541
|
var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
|
|
5522
5542
|
exports.encode = function(number) {
|
|
@@ -5556,9 +5576,9 @@ var require_base64 = __commonJS({
|
|
|
5556
5576
|
}
|
|
5557
5577
|
});
|
|
5558
5578
|
|
|
5559
|
-
// node_modules/.pnpm/source-map-js@1.0
|
|
5579
|
+
// node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/base64-vlq.js
|
|
5560
5580
|
var require_base64_vlq = __commonJS({
|
|
5561
|
-
"node_modules/.pnpm/source-map-js@1.0
|
|
5581
|
+
"node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/base64-vlq.js"(exports) {
|
|
5562
5582
|
"use strict";
|
|
5563
5583
|
var base64 = require_base64();
|
|
5564
5584
|
var VLQ_BASE_SHIFT = 5;
|
|
@@ -5611,9 +5631,9 @@ var require_base64_vlq = __commonJS({
|
|
|
5611
5631
|
}
|
|
5612
5632
|
});
|
|
5613
5633
|
|
|
5614
|
-
// node_modules/.pnpm/source-map-js@1.0
|
|
5634
|
+
// node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/util.js
|
|
5615
5635
|
var require_util = __commonJS({
|
|
5616
|
-
"node_modules/.pnpm/source-map-js@1.0
|
|
5636
|
+
"node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/util.js"(exports) {
|
|
5617
5637
|
"use strict";
|
|
5618
5638
|
function getArg(aArgs, aName, aDefaultValue) {
|
|
5619
5639
|
if (aName in aArgs) {
|
|
@@ -5992,9 +6012,9 @@ var require_util = __commonJS({
|
|
|
5992
6012
|
}
|
|
5993
6013
|
});
|
|
5994
6014
|
|
|
5995
|
-
// node_modules/.pnpm/source-map-js@1.0
|
|
6015
|
+
// node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/array-set.js
|
|
5996
6016
|
var require_array_set = __commonJS({
|
|
5997
|
-
"node_modules/.pnpm/source-map-js@1.0
|
|
6017
|
+
"node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/array-set.js"(exports) {
|
|
5998
6018
|
"use strict";
|
|
5999
6019
|
var util = require_util();
|
|
6000
6020
|
var has = Object.prototype.hasOwnProperty;
|
|
@@ -6063,9 +6083,9 @@ var require_array_set = __commonJS({
|
|
|
6063
6083
|
}
|
|
6064
6084
|
});
|
|
6065
6085
|
|
|
6066
|
-
// node_modules/.pnpm/source-map-js@1.0
|
|
6086
|
+
// node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/mapping-list.js
|
|
6067
6087
|
var require_mapping_list = __commonJS({
|
|
6068
|
-
"node_modules/.pnpm/source-map-js@1.0
|
|
6088
|
+
"node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/mapping-list.js"(exports) {
|
|
6069
6089
|
"use strict";
|
|
6070
6090
|
var util = require_util();
|
|
6071
6091
|
function generatedPositionAfter(mappingA, mappingB) {
|
|
@@ -6103,9 +6123,9 @@ var require_mapping_list = __commonJS({
|
|
|
6103
6123
|
}
|
|
6104
6124
|
});
|
|
6105
6125
|
|
|
6106
|
-
// node_modules/.pnpm/source-map-js@1.0
|
|
6126
|
+
// node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/source-map-generator.js
|
|
6107
6127
|
var require_source_map_generator = __commonJS({
|
|
6108
|
-
"node_modules/.pnpm/source-map-js@1.0
|
|
6128
|
+
"node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/source-map-generator.js"(exports) {
|
|
6109
6129
|
"use strict";
|
|
6110
6130
|
var base64VLQ = require_base64_vlq();
|
|
6111
6131
|
var util = require_util();
|
|
@@ -6118,18 +6138,19 @@ var require_source_map_generator = __commonJS({
|
|
|
6118
6138
|
this._file = util.getArg(aArgs, "file", null);
|
|
6119
6139
|
this._sourceRoot = util.getArg(aArgs, "sourceRoot", null);
|
|
6120
6140
|
this._skipValidation = util.getArg(aArgs, "skipValidation", false);
|
|
6141
|
+
this._ignoreInvalidMapping = util.getArg(aArgs, "ignoreInvalidMapping", false);
|
|
6121
6142
|
this._sources = new ArraySet();
|
|
6122
6143
|
this._names = new ArraySet();
|
|
6123
6144
|
this._mappings = new MappingList();
|
|
6124
6145
|
this._sourcesContents = null;
|
|
6125
6146
|
}
|
|
6126
6147
|
SourceMapGenerator2.prototype._version = 3;
|
|
6127
|
-
SourceMapGenerator2.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
|
|
6148
|
+
SourceMapGenerator2.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {
|
|
6128
6149
|
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
|
6129
|
-
var generator = new SourceMapGenerator2({
|
|
6150
|
+
var generator = new SourceMapGenerator2(Object.assign(generatorOps || {}, {
|
|
6130
6151
|
file: aSourceMapConsumer.file,
|
|
6131
6152
|
sourceRoot
|
|
6132
|
-
});
|
|
6153
|
+
}));
|
|
6133
6154
|
aSourceMapConsumer.eachMapping(function(mapping) {
|
|
6134
6155
|
var newMapping = {
|
|
6135
6156
|
generated: {
|
|
@@ -6173,7 +6194,9 @@ var require_source_map_generator = __commonJS({
|
|
|
6173
6194
|
var source = util.getArg(aArgs, "source", null);
|
|
6174
6195
|
var name = util.getArg(aArgs, "name", null);
|
|
6175
6196
|
if (!this._skipValidation) {
|
|
6176
|
-
this._validateMapping(generated, original, source, name)
|
|
6197
|
+
if (this._validateMapping(generated, original, source, name) === false) {
|
|
6198
|
+
return;
|
|
6199
|
+
}
|
|
6177
6200
|
}
|
|
6178
6201
|
if (source != null) {
|
|
6179
6202
|
source = String(source);
|
|
@@ -6276,21 +6299,35 @@ var require_source_map_generator = __commonJS({
|
|
|
6276
6299
|
};
|
|
6277
6300
|
SourceMapGenerator2.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
|
|
6278
6301
|
if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6302
|
+
var message = "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";
|
|
6303
|
+
if (this._ignoreInvalidMapping) {
|
|
6304
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
6305
|
+
console.warn(message);
|
|
6306
|
+
}
|
|
6307
|
+
return false;
|
|
6308
|
+
} else {
|
|
6309
|
+
throw new Error(message);
|
|
6310
|
+
}
|
|
6282
6311
|
}
|
|
6283
6312
|
if (aGenerated && "line" in aGenerated && "column" in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
|
|
6284
6313
|
return;
|
|
6285
6314
|
} else if (aGenerated && "line" in aGenerated && "column" in aGenerated && aOriginal && "line" in aOriginal && "column" in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
|
|
6286
6315
|
return;
|
|
6287
6316
|
} else {
|
|
6288
|
-
|
|
6317
|
+
var message = "Invalid mapping: " + JSON.stringify({
|
|
6289
6318
|
generated: aGenerated,
|
|
6290
6319
|
source: aSource,
|
|
6291
6320
|
original: aOriginal,
|
|
6292
6321
|
name: aName
|
|
6293
|
-
})
|
|
6322
|
+
});
|
|
6323
|
+
if (this._ignoreInvalidMapping) {
|
|
6324
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
6325
|
+
console.warn(message);
|
|
6326
|
+
}
|
|
6327
|
+
return false;
|
|
6328
|
+
} else {
|
|
6329
|
+
throw new Error(message);
|
|
6330
|
+
}
|
|
6294
6331
|
}
|
|
6295
6332
|
};
|
|
6296
6333
|
SourceMapGenerator2.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
|
|
@@ -6380,9 +6417,9 @@ var require_source_map_generator = __commonJS({
|
|
|
6380
6417
|
}
|
|
6381
6418
|
});
|
|
6382
6419
|
|
|
6383
|
-
// node_modules/.pnpm/source-map-js@1.0
|
|
6420
|
+
// node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/binary-search.js
|
|
6384
6421
|
var require_binary_search = __commonJS({
|
|
6385
|
-
"node_modules/.pnpm/source-map-js@1.0
|
|
6422
|
+
"node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/binary-search.js"(exports) {
|
|
6386
6423
|
"use strict";
|
|
6387
6424
|
exports.GREATEST_LOWER_BOUND = 1;
|
|
6388
6425
|
exports.LEAST_UPPER_BOUND = 2;
|
|
@@ -6437,9 +6474,9 @@ var require_binary_search = __commonJS({
|
|
|
6437
6474
|
}
|
|
6438
6475
|
});
|
|
6439
6476
|
|
|
6440
|
-
// node_modules/.pnpm/source-map-js@1.0
|
|
6477
|
+
// node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/quick-sort.js
|
|
6441
6478
|
var require_quick_sort = __commonJS({
|
|
6442
|
-
"node_modules/.pnpm/source-map-js@1.0
|
|
6479
|
+
"node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/quick-sort.js"(exports) {
|
|
6443
6480
|
"use strict";
|
|
6444
6481
|
function SortTemplate(comparator) {
|
|
6445
6482
|
function swap(ary, x, y) {
|
|
@@ -6487,9 +6524,9 @@ var require_quick_sort = __commonJS({
|
|
|
6487
6524
|
}
|
|
6488
6525
|
});
|
|
6489
6526
|
|
|
6490
|
-
// node_modules/.pnpm/source-map-js@1.0
|
|
6527
|
+
// node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/source-map-consumer.js
|
|
6491
6528
|
var require_source_map_consumer = __commonJS({
|
|
6492
|
-
"node_modules/.pnpm/source-map-js@1.0
|
|
6529
|
+
"node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/source-map-consumer.js"(exports) {
|
|
6493
6530
|
"use strict";
|
|
6494
6531
|
var util = require_util();
|
|
6495
6532
|
var binarySearch = require_binary_search();
|
|
@@ -7062,7 +7099,7 @@ var require_source_map_consumer = __commonJS({
|
|
|
7062
7099
|
for (var i = 0; i < this._sections.length; i++) {
|
|
7063
7100
|
var section = this._sections[i];
|
|
7064
7101
|
var content = section.consumer.sourceContentFor(aSource, true);
|
|
7065
|
-
if (content) {
|
|
7102
|
+
if (content || content === "") {
|
|
7066
7103
|
return content;
|
|
7067
7104
|
}
|
|
7068
7105
|
}
|
|
@@ -7131,9 +7168,9 @@ var require_source_map_consumer = __commonJS({
|
|
|
7131
7168
|
}
|
|
7132
7169
|
});
|
|
7133
7170
|
|
|
7134
|
-
// node_modules/.pnpm/source-map-js@1.0
|
|
7171
|
+
// node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/source-node.js
|
|
7135
7172
|
var require_source_node = __commonJS({
|
|
7136
|
-
"node_modules/.pnpm/source-map-js@1.0
|
|
7173
|
+
"node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/lib/source-node.js"(exports) {
|
|
7137
7174
|
"use strict";
|
|
7138
7175
|
var SourceMapGenerator2 = require_source_map_generator().SourceMapGenerator;
|
|
7139
7176
|
var util = require_util();
|
|
@@ -7398,9 +7435,9 @@ var require_source_node = __commonJS({
|
|
|
7398
7435
|
}
|
|
7399
7436
|
});
|
|
7400
7437
|
|
|
7401
|
-
// node_modules/.pnpm/source-map-js@1.0
|
|
7438
|
+
// node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/source-map.js
|
|
7402
7439
|
var require_source_map = __commonJS({
|
|
7403
|
-
"node_modules/.pnpm/source-map-js@1.0
|
|
7440
|
+
"node_modules/.pnpm/source-map-js@1.2.0/node_modules/source-map-js/source-map.js"(exports) {
|
|
7404
7441
|
"use strict";
|
|
7405
7442
|
exports.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
|
|
7406
7443
|
exports.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
|
|
@@ -7408,9 +7445,9 @@ var require_source_map = __commonJS({
|
|
|
7408
7445
|
}
|
|
7409
7446
|
});
|
|
7410
7447
|
|
|
7411
|
-
// node_modules/.pnpm/@babel+parser@7.
|
|
7448
|
+
// node_modules/.pnpm/@babel+parser@7.24.4/node_modules/@babel/parser/lib/index.js
|
|
7412
7449
|
var require_lib = __commonJS({
|
|
7413
|
-
"node_modules/.pnpm/@babel+parser@7.
|
|
7450
|
+
"node_modules/.pnpm/@babel+parser@7.24.4/node_modules/@babel/parser/lib/index.js"(exports) {
|
|
7414
7451
|
"use strict";
|
|
7415
7452
|
Object.defineProperty(exports, "__esModule", {
|
|
7416
7453
|
value: true
|
|
@@ -7751,8 +7788,8 @@ var require_lib = __commonJS({
|
|
|
7751
7788
|
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
|
|
7752
7789
|
PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
|
|
7753
7790
|
};
|
|
7754
|
-
var _excluded
|
|
7755
|
-
var _excluded2
|
|
7791
|
+
var _excluded = ["toMessage"];
|
|
7792
|
+
var _excluded2 = ["message"];
|
|
7756
7793
|
function defineHidden(obj, key, value) {
|
|
7757
7794
|
Object.defineProperty(obj, key, {
|
|
7758
7795
|
enumerable: false,
|
|
@@ -7763,11 +7800,8 @@ var require_lib = __commonJS({
|
|
|
7763
7800
|
function toParseErrorConstructor(_ref) {
|
|
7764
7801
|
let {
|
|
7765
7802
|
toMessage
|
|
7766
|
-
} = _ref, properties = _objectWithoutPropertiesLoose(_ref, _excluded
|
|
7767
|
-
return function constructor({
|
|
7768
|
-
loc,
|
|
7769
|
-
details
|
|
7770
|
-
}) {
|
|
7803
|
+
} = _ref, properties = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
7804
|
+
return function constructor(loc, details) {
|
|
7771
7805
|
const error = new SyntaxError();
|
|
7772
7806
|
Object.assign(error, properties, {
|
|
7773
7807
|
loc,
|
|
@@ -7785,10 +7819,7 @@ var require_lib = __commonJS({
|
|
|
7785
7819
|
column,
|
|
7786
7820
|
index
|
|
7787
7821
|
} = (_overrides$loc = overrides.loc) != null ? _overrides$loc : loc;
|
|
7788
|
-
return constructor({
|
|
7789
|
-
loc: new Position(line, column, index),
|
|
7790
|
-
details: Object.assign({}, details, overrides.details)
|
|
7791
|
-
});
|
|
7822
|
+
return constructor(new Position(line, column, index), Object.assign({}, details, overrides.details));
|
|
7792
7823
|
});
|
|
7793
7824
|
defineHidden(error, "details", details);
|
|
7794
7825
|
Object.defineProperty(error, "message", {
|
|
@@ -7821,7 +7852,7 @@ var require_lib = __commonJS({
|
|
|
7821
7852
|
message: template
|
|
7822
7853
|
} : template, {
|
|
7823
7854
|
message
|
|
7824
|
-
} = _ref2, rest = _objectWithoutPropertiesLoose(_ref2, _excluded2
|
|
7855
|
+
} = _ref2, rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
7825
7856
|
const toMessage = typeof message === "string" ? () => message : message;
|
|
7826
7857
|
ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
|
|
7827
7858
|
code: "BABEL_PARSER_SYNTAX_ERROR",
|
|
@@ -8067,13 +8098,9 @@ var require_lib = __commonJS({
|
|
|
8067
8098
|
}
|
|
8068
8099
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
8069
8100
|
if (prop.kind === "get" || prop.kind === "set") {
|
|
8070
|
-
this.raise(Errors.PatternHasAccessor,
|
|
8071
|
-
at: prop.key
|
|
8072
|
-
});
|
|
8101
|
+
this.raise(Errors.PatternHasAccessor, prop.key);
|
|
8073
8102
|
} else if (prop.method) {
|
|
8074
|
-
this.raise(Errors.PatternHasMethod,
|
|
8075
|
-
at: prop.key
|
|
8076
|
-
});
|
|
8103
|
+
this.raise(Errors.PatternHasMethod, prop.key);
|
|
8077
8104
|
} else {
|
|
8078
8105
|
super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
8079
8106
|
}
|
|
@@ -8821,9 +8848,9 @@ var require_lib = __commonJS({
|
|
|
8821
8848
|
}
|
|
8822
8849
|
var Scope = class {
|
|
8823
8850
|
constructor(flags) {
|
|
8824
|
-
this.
|
|
8825
|
-
this.
|
|
8826
|
-
this.
|
|
8851
|
+
this.flags = 0;
|
|
8852
|
+
this.names = /* @__PURE__ */ new Map();
|
|
8853
|
+
this.firstLexicalName = "";
|
|
8827
8854
|
this.flags = flags;
|
|
8828
8855
|
}
|
|
8829
8856
|
};
|
|
@@ -8891,11 +8918,16 @@ var require_lib = __commonJS({
|
|
|
8891
8918
|
let scope = this.currentScope();
|
|
8892
8919
|
if (bindingType & 8 || bindingType & 16) {
|
|
8893
8920
|
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
8921
|
+
let type = scope.names.get(name) || 0;
|
|
8894
8922
|
if (bindingType & 16) {
|
|
8895
|
-
|
|
8923
|
+
type = type | 4;
|
|
8896
8924
|
} else {
|
|
8897
|
-
scope.
|
|
8925
|
+
if (!scope.firstLexicalName) {
|
|
8926
|
+
scope.firstLexicalName = name;
|
|
8927
|
+
}
|
|
8928
|
+
type = type | 2;
|
|
8898
8929
|
}
|
|
8930
|
+
scope.names.set(name, type);
|
|
8899
8931
|
if (bindingType & 8) {
|
|
8900
8932
|
this.maybeExportDefined(scope, name);
|
|
8901
8933
|
}
|
|
@@ -8903,7 +8935,7 @@ var require_lib = __commonJS({
|
|
|
8903
8935
|
for (let i = this.scopeStack.length - 1; i >= 0; --i) {
|
|
8904
8936
|
scope = this.scopeStack[i];
|
|
8905
8937
|
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
8906
|
-
scope.
|
|
8938
|
+
scope.names.set(name, (scope.names.get(name) || 0) | 1);
|
|
8907
8939
|
this.maybeExportDefined(scope, name);
|
|
8908
8940
|
if (scope.flags & 387)
|
|
8909
8941
|
break;
|
|
@@ -8920,8 +8952,7 @@ var require_lib = __commonJS({
|
|
|
8920
8952
|
}
|
|
8921
8953
|
checkRedeclarationInScope(scope, name, bindingType, loc) {
|
|
8922
8954
|
if (this.isRedeclaredInScope(scope, name, bindingType)) {
|
|
8923
|
-
this.parser.raise(Errors.VarRedeclaration, {
|
|
8924
|
-
at: loc,
|
|
8955
|
+
this.parser.raise(Errors.VarRedeclaration, loc, {
|
|
8925
8956
|
identifierName: name
|
|
8926
8957
|
});
|
|
8927
8958
|
}
|
|
@@ -8930,19 +8961,20 @@ var require_lib = __commonJS({
|
|
|
8930
8961
|
if (!(bindingType & 1))
|
|
8931
8962
|
return false;
|
|
8932
8963
|
if (bindingType & 8) {
|
|
8933
|
-
return scope.
|
|
8964
|
+
return scope.names.has(name);
|
|
8934
8965
|
}
|
|
8966
|
+
const type = scope.names.get(name);
|
|
8935
8967
|
if (bindingType & 16) {
|
|
8936
|
-
return
|
|
8968
|
+
return (type & 2) > 0 || !this.treatFunctionsAsVarInScope(scope) && (type & 1) > 0;
|
|
8937
8969
|
}
|
|
8938
|
-
return
|
|
8970
|
+
return (type & 2) > 0 && !(scope.flags & 8 && scope.firstLexicalName === name) || !this.treatFunctionsAsVarInScope(scope) && (type & 4) > 0;
|
|
8939
8971
|
}
|
|
8940
8972
|
checkLocalExport(id) {
|
|
8941
8973
|
const {
|
|
8942
8974
|
name
|
|
8943
8975
|
} = id;
|
|
8944
8976
|
const topLevelScope = this.scopeStack[0];
|
|
8945
|
-
if (!topLevelScope.
|
|
8977
|
+
if (!topLevelScope.names.has(name)) {
|
|
8946
8978
|
this.undefinedExports.set(name, id.loc.start);
|
|
8947
8979
|
}
|
|
8948
8980
|
}
|
|
@@ -8993,8 +9025,9 @@ var require_lib = __commonJS({
|
|
|
8993
9025
|
isRedeclaredInScope(scope, name, bindingType) {
|
|
8994
9026
|
if (super.isRedeclaredInScope(scope, name, bindingType))
|
|
8995
9027
|
return true;
|
|
8996
|
-
if (bindingType & 2048) {
|
|
8997
|
-
|
|
9028
|
+
if (bindingType & 2048 && !scope.declareFunctions.has(name)) {
|
|
9029
|
+
const type = scope.names.get(name);
|
|
9030
|
+
return (type & 4) > 0 || (type & 2) > 0;
|
|
8998
9031
|
}
|
|
8999
9032
|
return false;
|
|
9000
9033
|
}
|
|
@@ -9068,7 +9101,13 @@ var require_lib = __commonJS({
|
|
|
9068
9101
|
addComment(comment) {
|
|
9069
9102
|
if (this.filename)
|
|
9070
9103
|
comment.loc.filename = this.filename;
|
|
9071
|
-
|
|
9104
|
+
const {
|
|
9105
|
+
commentsLen
|
|
9106
|
+
} = this.state;
|
|
9107
|
+
if (this.comments.length != commentsLen)
|
|
9108
|
+
this.comments.length = commentsLen;
|
|
9109
|
+
this.comments.push(comment);
|
|
9110
|
+
this.state.commentsLen++;
|
|
9072
9111
|
}
|
|
9073
9112
|
processComment(node) {
|
|
9074
9113
|
const {
|
|
@@ -9260,7 +9299,7 @@ var require_lib = __commonJS({
|
|
|
9260
9299
|
}
|
|
9261
9300
|
var State = class _State {
|
|
9262
9301
|
constructor() {
|
|
9263
|
-
this.
|
|
9302
|
+
this.flags = 1024;
|
|
9264
9303
|
this.curLine = void 0;
|
|
9265
9304
|
this.lineStart = void 0;
|
|
9266
9305
|
this.startLoc = void 0;
|
|
@@ -9269,21 +9308,12 @@ var require_lib = __commonJS({
|
|
|
9269
9308
|
this.potentialArrowAt = -1;
|
|
9270
9309
|
this.noArrowAt = [];
|
|
9271
9310
|
this.noArrowParamsConversionAt = [];
|
|
9272
|
-
this.maybeInArrowParameters = false;
|
|
9273
|
-
this.inType = false;
|
|
9274
|
-
this.noAnonFunctionType = false;
|
|
9275
|
-
this.hasFlowComment = false;
|
|
9276
|
-
this.isAmbientContext = false;
|
|
9277
|
-
this.inAbstractClass = false;
|
|
9278
|
-
this.inDisallowConditionalTypesContext = false;
|
|
9279
9311
|
this.topicContext = {
|
|
9280
9312
|
maxNumOfResolvableTopics: 0,
|
|
9281
9313
|
maxTopicIndex: null
|
|
9282
9314
|
};
|
|
9283
|
-
this.soloAwait = false;
|
|
9284
|
-
this.inFSharpPipelineDirectBody = false;
|
|
9285
9315
|
this.labels = [];
|
|
9286
|
-
this.
|
|
9316
|
+
this.commentsLen = 0;
|
|
9287
9317
|
this.commentStack = [];
|
|
9288
9318
|
this.pos = 0;
|
|
9289
9319
|
this.type = 139;
|
|
@@ -9292,14 +9322,21 @@ var require_lib = __commonJS({
|
|
|
9292
9322
|
this.end = 0;
|
|
9293
9323
|
this.lastTokEndLoc = null;
|
|
9294
9324
|
this.lastTokStartLoc = null;
|
|
9295
|
-
this.lastTokStart = 0;
|
|
9296
9325
|
this.context = [types.brace];
|
|
9297
|
-
this.canStartJSXElement = true;
|
|
9298
|
-
this.containsEsc = false;
|
|
9299
9326
|
this.firstInvalidTemplateEscapePos = null;
|
|
9300
9327
|
this.strictErrors = /* @__PURE__ */ new Map();
|
|
9301
9328
|
this.tokensLength = 0;
|
|
9302
9329
|
}
|
|
9330
|
+
get strict() {
|
|
9331
|
+
return (this.flags & 1) > 0;
|
|
9332
|
+
}
|
|
9333
|
+
set strict(value) {
|
|
9334
|
+
if (value) {
|
|
9335
|
+
this.flags |= 1;
|
|
9336
|
+
} else {
|
|
9337
|
+
this.flags &= ~1;
|
|
9338
|
+
}
|
|
9339
|
+
}
|
|
9303
9340
|
init({
|
|
9304
9341
|
strictMode,
|
|
9305
9342
|
sourceType,
|
|
@@ -9311,20 +9348,145 @@ var require_lib = __commonJS({
|
|
|
9311
9348
|
this.lineStart = -startColumn;
|
|
9312
9349
|
this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
|
|
9313
9350
|
}
|
|
9351
|
+
get maybeInArrowParameters() {
|
|
9352
|
+
return (this.flags & 2) > 0;
|
|
9353
|
+
}
|
|
9354
|
+
set maybeInArrowParameters(value) {
|
|
9355
|
+
if (value) {
|
|
9356
|
+
this.flags |= 2;
|
|
9357
|
+
} else {
|
|
9358
|
+
this.flags &= ~2;
|
|
9359
|
+
}
|
|
9360
|
+
}
|
|
9361
|
+
get inType() {
|
|
9362
|
+
return (this.flags & 4) > 0;
|
|
9363
|
+
}
|
|
9364
|
+
set inType(value) {
|
|
9365
|
+
if (value) {
|
|
9366
|
+
this.flags |= 4;
|
|
9367
|
+
} else {
|
|
9368
|
+
this.flags &= ~4;
|
|
9369
|
+
}
|
|
9370
|
+
}
|
|
9371
|
+
get noAnonFunctionType() {
|
|
9372
|
+
return (this.flags & 8) > 0;
|
|
9373
|
+
}
|
|
9374
|
+
set noAnonFunctionType(value) {
|
|
9375
|
+
if (value) {
|
|
9376
|
+
this.flags |= 8;
|
|
9377
|
+
} else {
|
|
9378
|
+
this.flags &= ~8;
|
|
9379
|
+
}
|
|
9380
|
+
}
|
|
9381
|
+
get hasFlowComment() {
|
|
9382
|
+
return (this.flags & 16) > 0;
|
|
9383
|
+
}
|
|
9384
|
+
set hasFlowComment(value) {
|
|
9385
|
+
if (value) {
|
|
9386
|
+
this.flags |= 16;
|
|
9387
|
+
} else {
|
|
9388
|
+
this.flags &= ~16;
|
|
9389
|
+
}
|
|
9390
|
+
}
|
|
9391
|
+
get isAmbientContext() {
|
|
9392
|
+
return (this.flags & 32) > 0;
|
|
9393
|
+
}
|
|
9394
|
+
set isAmbientContext(value) {
|
|
9395
|
+
if (value) {
|
|
9396
|
+
this.flags |= 32;
|
|
9397
|
+
} else {
|
|
9398
|
+
this.flags &= ~32;
|
|
9399
|
+
}
|
|
9400
|
+
}
|
|
9401
|
+
get inAbstractClass() {
|
|
9402
|
+
return (this.flags & 64) > 0;
|
|
9403
|
+
}
|
|
9404
|
+
set inAbstractClass(value) {
|
|
9405
|
+
if (value) {
|
|
9406
|
+
this.flags |= 64;
|
|
9407
|
+
} else {
|
|
9408
|
+
this.flags &= ~64;
|
|
9409
|
+
}
|
|
9410
|
+
}
|
|
9411
|
+
get inDisallowConditionalTypesContext() {
|
|
9412
|
+
return (this.flags & 128) > 0;
|
|
9413
|
+
}
|
|
9414
|
+
set inDisallowConditionalTypesContext(value) {
|
|
9415
|
+
if (value) {
|
|
9416
|
+
this.flags |= 128;
|
|
9417
|
+
} else {
|
|
9418
|
+
this.flags &= ~128;
|
|
9419
|
+
}
|
|
9420
|
+
}
|
|
9421
|
+
get soloAwait() {
|
|
9422
|
+
return (this.flags & 256) > 0;
|
|
9423
|
+
}
|
|
9424
|
+
set soloAwait(value) {
|
|
9425
|
+
if (value) {
|
|
9426
|
+
this.flags |= 256;
|
|
9427
|
+
} else {
|
|
9428
|
+
this.flags &= ~256;
|
|
9429
|
+
}
|
|
9430
|
+
}
|
|
9431
|
+
get inFSharpPipelineDirectBody() {
|
|
9432
|
+
return (this.flags & 512) > 0;
|
|
9433
|
+
}
|
|
9434
|
+
set inFSharpPipelineDirectBody(value) {
|
|
9435
|
+
if (value) {
|
|
9436
|
+
this.flags |= 512;
|
|
9437
|
+
} else {
|
|
9438
|
+
this.flags &= ~512;
|
|
9439
|
+
}
|
|
9440
|
+
}
|
|
9441
|
+
get canStartJSXElement() {
|
|
9442
|
+
return (this.flags & 1024) > 0;
|
|
9443
|
+
}
|
|
9444
|
+
set canStartJSXElement(value) {
|
|
9445
|
+
if (value) {
|
|
9446
|
+
this.flags |= 1024;
|
|
9447
|
+
} else {
|
|
9448
|
+
this.flags &= ~1024;
|
|
9449
|
+
}
|
|
9450
|
+
}
|
|
9451
|
+
get containsEsc() {
|
|
9452
|
+
return (this.flags & 2048) > 0;
|
|
9453
|
+
}
|
|
9454
|
+
set containsEsc(value) {
|
|
9455
|
+
if (value) {
|
|
9456
|
+
this.flags |= 2048;
|
|
9457
|
+
} else {
|
|
9458
|
+
this.flags &= ~2048;
|
|
9459
|
+
}
|
|
9460
|
+
}
|
|
9314
9461
|
curPosition() {
|
|
9315
9462
|
return new Position(this.curLine, this.pos - this.lineStart, this.pos);
|
|
9316
9463
|
}
|
|
9317
|
-
clone(
|
|
9464
|
+
clone() {
|
|
9318
9465
|
const state = new _State();
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9466
|
+
state.flags = this.flags;
|
|
9467
|
+
state.curLine = this.curLine;
|
|
9468
|
+
state.lineStart = this.lineStart;
|
|
9469
|
+
state.startLoc = this.startLoc;
|
|
9470
|
+
state.endLoc = this.endLoc;
|
|
9471
|
+
state.errors = this.errors.slice();
|
|
9472
|
+
state.potentialArrowAt = this.potentialArrowAt;
|
|
9473
|
+
state.noArrowAt = this.noArrowAt.slice();
|
|
9474
|
+
state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
|
|
9475
|
+
state.topicContext = this.topicContext;
|
|
9476
|
+
state.labels = this.labels.slice();
|
|
9477
|
+
state.commentsLen = this.commentsLen;
|
|
9478
|
+
state.commentStack = this.commentStack.slice();
|
|
9479
|
+
state.pos = this.pos;
|
|
9480
|
+
state.type = this.type;
|
|
9481
|
+
state.value = this.value;
|
|
9482
|
+
state.start = this.start;
|
|
9483
|
+
state.end = this.end;
|
|
9484
|
+
state.lastTokEndLoc = this.lastTokEndLoc;
|
|
9485
|
+
state.lastTokStartLoc = this.lastTokStartLoc;
|
|
9486
|
+
state.context = this.context.slice();
|
|
9487
|
+
state.firstInvalidTemplateEscapePos = this.firstInvalidTemplateEscapePos;
|
|
9488
|
+
state.strictErrors = this.strictErrors;
|
|
9489
|
+
state.tokensLength = this.tokensLength;
|
|
9328
9490
|
return state;
|
|
9329
9491
|
}
|
|
9330
9492
|
};
|
|
@@ -9613,8 +9775,6 @@ var require_lib = __commonJS({
|
|
|
9613
9775
|
pos
|
|
9614
9776
|
};
|
|
9615
9777
|
}
|
|
9616
|
-
var _excluded = ["at"];
|
|
9617
|
-
var _excluded2 = ["at"];
|
|
9618
9778
|
function buildPosition(pos, lineStart, curLine) {
|
|
9619
9779
|
return new Position(curLine, pos - lineStart, pos);
|
|
9620
9780
|
}
|
|
@@ -9637,8 +9797,7 @@ var require_lib = __commonJS({
|
|
|
9637
9797
|
invalidDigit: (pos, lineStart, curLine, radix) => {
|
|
9638
9798
|
if (!this.options.errorRecovery)
|
|
9639
9799
|
return false;
|
|
9640
|
-
this.raise(Errors.InvalidDigit, {
|
|
9641
|
-
at: buildPosition(pos, lineStart, curLine),
|
|
9800
|
+
this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
|
|
9642
9801
|
radix
|
|
9643
9802
|
});
|
|
9644
9803
|
return true;
|
|
@@ -9652,28 +9811,23 @@ var require_lib = __commonJS({
|
|
|
9652
9811
|
});
|
|
9653
9812
|
this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
|
|
9654
9813
|
strictNumericEscape: (pos, lineStart, curLine) => {
|
|
9655
|
-
this.recordStrictModeErrors(Errors.StrictNumericEscape,
|
|
9656
|
-
at: buildPosition(pos, lineStart, curLine)
|
|
9657
|
-
});
|
|
9814
|
+
this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos, lineStart, curLine));
|
|
9658
9815
|
},
|
|
9659
9816
|
unterminated: (pos, lineStart, curLine) => {
|
|
9660
|
-
throw this.raise(Errors.UnterminatedString,
|
|
9661
|
-
at: buildPosition(pos - 1, lineStart, curLine)
|
|
9662
|
-
});
|
|
9817
|
+
throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1, lineStart, curLine));
|
|
9663
9818
|
}
|
|
9664
9819
|
});
|
|
9665
9820
|
this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
|
|
9666
9821
|
strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
|
|
9667
9822
|
unterminated: (pos, lineStart, curLine) => {
|
|
9668
|
-
throw this.raise(Errors.UnterminatedTemplate,
|
|
9669
|
-
at: buildPosition(pos, lineStart, curLine)
|
|
9670
|
-
});
|
|
9823
|
+
throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos, lineStart, curLine));
|
|
9671
9824
|
}
|
|
9672
9825
|
});
|
|
9673
9826
|
this.state = new State();
|
|
9674
9827
|
this.state.init(options);
|
|
9675
9828
|
this.input = input;
|
|
9676
9829
|
this.length = input.length;
|
|
9830
|
+
this.comments = [];
|
|
9677
9831
|
this.isLookahead = false;
|
|
9678
9832
|
}
|
|
9679
9833
|
pushToken(token) {
|
|
@@ -9686,7 +9840,6 @@ var require_lib = __commonJS({
|
|
|
9686
9840
|
if (this.options.tokens) {
|
|
9687
9841
|
this.pushToken(new Token(this.state));
|
|
9688
9842
|
}
|
|
9689
|
-
this.state.lastTokStart = this.state.start;
|
|
9690
9843
|
this.state.lastTokEndLoc = this.state.endLoc;
|
|
9691
9844
|
this.state.lastTokStartLoc = this.state.startLoc;
|
|
9692
9845
|
this.nextToken();
|
|
@@ -9761,9 +9914,7 @@ var require_lib = __commonJS({
|
|
|
9761
9914
|
setStrict(strict) {
|
|
9762
9915
|
this.state.strict = strict;
|
|
9763
9916
|
if (strict) {
|
|
9764
|
-
this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError,
|
|
9765
|
-
at
|
|
9766
|
-
}));
|
|
9917
|
+
this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, at));
|
|
9767
9918
|
this.state.strictErrors.clear();
|
|
9768
9919
|
}
|
|
9769
9920
|
}
|
|
@@ -9788,9 +9939,7 @@ var require_lib = __commonJS({
|
|
|
9788
9939
|
const start = this.state.pos;
|
|
9789
9940
|
const end = this.input.indexOf(commentEnd, start + 2);
|
|
9790
9941
|
if (end === -1) {
|
|
9791
|
-
throw this.raise(Errors.UnterminatedComment,
|
|
9792
|
-
at: this.state.curPosition()
|
|
9793
|
-
});
|
|
9942
|
+
throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
|
|
9794
9943
|
}
|
|
9795
9944
|
this.state.pos = end + commentEnd.length;
|
|
9796
9945
|
lineBreakG.lastIndex = start + 2;
|
|
@@ -9950,16 +10099,12 @@ var require_lib = __commonJS({
|
|
|
9950
10099
|
const nextPos = this.state.pos + 1;
|
|
9951
10100
|
const next = this.codePointAtPos(nextPos);
|
|
9952
10101
|
if (next >= 48 && next <= 57) {
|
|
9953
|
-
throw this.raise(Errors.UnexpectedDigitAfterHash,
|
|
9954
|
-
at: this.state.curPosition()
|
|
9955
|
-
});
|
|
10102
|
+
throw this.raise(Errors.UnexpectedDigitAfterHash, this.state.curPosition());
|
|
9956
10103
|
}
|
|
9957
10104
|
if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
|
|
9958
10105
|
this.expectPlugin("recordAndTuple");
|
|
9959
10106
|
if (this.getPluginOption("recordAndTuple", "syntaxType") === "bar") {
|
|
9960
|
-
throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType,
|
|
9961
|
-
at: this.state.curPosition()
|
|
9962
|
-
});
|
|
10107
|
+
throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, this.state.curPosition());
|
|
9963
10108
|
}
|
|
9964
10109
|
this.state.pos += 2;
|
|
9965
10110
|
if (next === 123) {
|
|
@@ -10046,9 +10191,7 @@ var require_lib = __commonJS({
|
|
|
10046
10191
|
}
|
|
10047
10192
|
if (this.hasPlugin("recordAndTuple") && next === 125) {
|
|
10048
10193
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
10049
|
-
throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType,
|
|
10050
|
-
at: this.state.curPosition()
|
|
10051
|
-
});
|
|
10194
|
+
throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
|
|
10052
10195
|
}
|
|
10053
10196
|
this.state.pos += 2;
|
|
10054
10197
|
this.finishToken(9);
|
|
@@ -10056,9 +10199,7 @@ var require_lib = __commonJS({
|
|
|
10056
10199
|
}
|
|
10057
10200
|
if (this.hasPlugin("recordAndTuple") && next === 93) {
|
|
10058
10201
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
10059
|
-
throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType,
|
|
10060
|
-
at: this.state.curPosition()
|
|
10061
|
-
});
|
|
10202
|
+
throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
|
|
10062
10203
|
}
|
|
10063
10204
|
this.state.pos += 2;
|
|
10064
10205
|
this.finishToken(4);
|
|
@@ -10204,9 +10345,7 @@ var require_lib = __commonJS({
|
|
|
10204
10345
|
case 91:
|
|
10205
10346
|
if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
|
|
10206
10347
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
10207
|
-
throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType,
|
|
10208
|
-
at: this.state.curPosition()
|
|
10209
|
-
});
|
|
10348
|
+
throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
|
|
10210
10349
|
}
|
|
10211
10350
|
this.state.pos += 2;
|
|
10212
10351
|
this.finishToken(2);
|
|
@@ -10222,9 +10361,7 @@ var require_lib = __commonJS({
|
|
|
10222
10361
|
case 123:
|
|
10223
10362
|
if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
|
|
10224
10363
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
10225
|
-
throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType,
|
|
10226
|
-
at: this.state.curPosition()
|
|
10227
|
-
});
|
|
10364
|
+
throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
|
|
10228
10365
|
}
|
|
10229
10366
|
this.state.pos += 2;
|
|
10230
10367
|
this.finishToken(6);
|
|
@@ -10327,8 +10464,7 @@ var require_lib = __commonJS({
|
|
|
10327
10464
|
return;
|
|
10328
10465
|
}
|
|
10329
10466
|
}
|
|
10330
|
-
throw this.raise(Errors.InvalidOrUnexpectedToken, {
|
|
10331
|
-
at: this.state.curPosition(),
|
|
10467
|
+
throw this.raise(Errors.InvalidOrUnexpectedToken, this.state.curPosition(), {
|
|
10332
10468
|
unexpected: String.fromCodePoint(code2)
|
|
10333
10469
|
});
|
|
10334
10470
|
}
|
|
@@ -10346,15 +10482,11 @@ var require_lib = __commonJS({
|
|
|
10346
10482
|
} = this.state;
|
|
10347
10483
|
for (; ; ++pos) {
|
|
10348
10484
|
if (pos >= this.length) {
|
|
10349
|
-
throw this.raise(Errors.UnterminatedRegExp,
|
|
10350
|
-
at: createPositionWithColumnOffset(startLoc, 1)
|
|
10351
|
-
});
|
|
10485
|
+
throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
|
|
10352
10486
|
}
|
|
10353
10487
|
const ch = this.input.charCodeAt(pos);
|
|
10354
10488
|
if (isNewLine(ch)) {
|
|
10355
|
-
throw this.raise(Errors.UnterminatedRegExp,
|
|
10356
|
-
at: createPositionWithColumnOffset(startLoc, 1)
|
|
10357
|
-
});
|
|
10489
|
+
throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
|
|
10358
10490
|
}
|
|
10359
10491
|
if (escaped) {
|
|
10360
10492
|
escaped = false;
|
|
@@ -10379,26 +10511,18 @@ var require_lib = __commonJS({
|
|
|
10379
10511
|
if (VALID_REGEX_FLAGS.has(cp)) {
|
|
10380
10512
|
if (cp === 118) {
|
|
10381
10513
|
if (mods.includes("u")) {
|
|
10382
|
-
this.raise(Errors.IncompatibleRegExpUVFlags,
|
|
10383
|
-
at: nextPos()
|
|
10384
|
-
});
|
|
10514
|
+
this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
|
|
10385
10515
|
}
|
|
10386
10516
|
} else if (cp === 117) {
|
|
10387
10517
|
if (mods.includes("v")) {
|
|
10388
|
-
this.raise(Errors.IncompatibleRegExpUVFlags,
|
|
10389
|
-
at: nextPos()
|
|
10390
|
-
});
|
|
10518
|
+
this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
|
|
10391
10519
|
}
|
|
10392
10520
|
}
|
|
10393
10521
|
if (mods.includes(char)) {
|
|
10394
|
-
this.raise(Errors.DuplicateRegExpFlags,
|
|
10395
|
-
at: nextPos()
|
|
10396
|
-
});
|
|
10522
|
+
this.raise(Errors.DuplicateRegExpFlags, nextPos());
|
|
10397
10523
|
}
|
|
10398
10524
|
} else if (isIdentifierChar(cp) || cp === 92) {
|
|
10399
|
-
this.raise(Errors.MalformedRegExpFlags,
|
|
10400
|
-
at: nextPos()
|
|
10401
|
-
});
|
|
10525
|
+
this.raise(Errors.MalformedRegExpFlags, nextPos());
|
|
10402
10526
|
} else {
|
|
10403
10527
|
break;
|
|
10404
10528
|
}
|
|
@@ -10425,8 +10549,7 @@ var require_lib = __commonJS({
|
|
|
10425
10549
|
this.state.pos += 2;
|
|
10426
10550
|
const val = this.readInt(radix);
|
|
10427
10551
|
if (val == null) {
|
|
10428
|
-
this.raise(Errors.InvalidDigit, {
|
|
10429
|
-
at: createPositionWithColumnOffset(startLoc, 2),
|
|
10552
|
+
this.raise(Errors.InvalidDigit, createPositionWithColumnOffset(startLoc, 2), {
|
|
10430
10553
|
radix
|
|
10431
10554
|
});
|
|
10432
10555
|
}
|
|
@@ -10435,14 +10558,10 @@ var require_lib = __commonJS({
|
|
|
10435
10558
|
++this.state.pos;
|
|
10436
10559
|
isBigInt = true;
|
|
10437
10560
|
} else if (next === 109) {
|
|
10438
|
-
throw this.raise(Errors.InvalidDecimal,
|
|
10439
|
-
at: startLoc
|
|
10440
|
-
});
|
|
10561
|
+
throw this.raise(Errors.InvalidDecimal, startLoc);
|
|
10441
10562
|
}
|
|
10442
10563
|
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
|
|
10443
|
-
throw this.raise(Errors.NumberIdentifier,
|
|
10444
|
-
at: this.state.curPosition()
|
|
10445
|
-
});
|
|
10564
|
+
throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
10446
10565
|
}
|
|
10447
10566
|
if (isBigInt) {
|
|
10448
10567
|
const str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, "");
|
|
@@ -10460,22 +10579,16 @@ var require_lib = __commonJS({
|
|
|
10460
10579
|
let hasExponent = false;
|
|
10461
10580
|
let isOctal = false;
|
|
10462
10581
|
if (!startsWithDot && this.readInt(10) === null) {
|
|
10463
|
-
this.raise(Errors.InvalidNumber,
|
|
10464
|
-
at: this.state.curPosition()
|
|
10465
|
-
});
|
|
10582
|
+
this.raise(Errors.InvalidNumber, this.state.curPosition());
|
|
10466
10583
|
}
|
|
10467
10584
|
const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
10468
10585
|
if (hasLeadingZero) {
|
|
10469
10586
|
const integer = this.input.slice(start, this.state.pos);
|
|
10470
|
-
this.recordStrictModeErrors(Errors.StrictOctalLiteral,
|
|
10471
|
-
at: startLoc
|
|
10472
|
-
});
|
|
10587
|
+
this.recordStrictModeErrors(Errors.StrictOctalLiteral, startLoc);
|
|
10473
10588
|
if (!this.state.strict) {
|
|
10474
10589
|
const underscorePos = integer.indexOf("_");
|
|
10475
10590
|
if (underscorePos > 0) {
|
|
10476
|
-
this.raise(Errors.ZeroDigitNumericSeparator,
|
|
10477
|
-
at: createPositionWithColumnOffset(startLoc, underscorePos)
|
|
10478
|
-
});
|
|
10591
|
+
this.raise(Errors.ZeroDigitNumericSeparator, createPositionWithColumnOffset(startLoc, underscorePos));
|
|
10479
10592
|
}
|
|
10480
10593
|
}
|
|
10481
10594
|
isOctal = hasLeadingZero && !/[89]/.test(integer);
|
|
@@ -10493,9 +10606,7 @@ var require_lib = __commonJS({
|
|
|
10493
10606
|
++this.state.pos;
|
|
10494
10607
|
}
|
|
10495
10608
|
if (this.readInt(10) === null) {
|
|
10496
|
-
this.raise(Errors.InvalidOrMissingExponent,
|
|
10497
|
-
at: startLoc
|
|
10498
|
-
});
|
|
10609
|
+
this.raise(Errors.InvalidOrMissingExponent, startLoc);
|
|
10499
10610
|
}
|
|
10500
10611
|
isFloat = true;
|
|
10501
10612
|
hasExponent = true;
|
|
@@ -10503,9 +10614,7 @@ var require_lib = __commonJS({
|
|
|
10503
10614
|
}
|
|
10504
10615
|
if (next === 110) {
|
|
10505
10616
|
if (isFloat || hasLeadingZero) {
|
|
10506
|
-
this.raise(Errors.InvalidBigIntLiteral,
|
|
10507
|
-
at: startLoc
|
|
10508
|
-
});
|
|
10617
|
+
this.raise(Errors.InvalidBigIntLiteral, startLoc);
|
|
10509
10618
|
}
|
|
10510
10619
|
++this.state.pos;
|
|
10511
10620
|
isBigInt = true;
|
|
@@ -10513,17 +10622,13 @@ var require_lib = __commonJS({
|
|
|
10513
10622
|
if (next === 109) {
|
|
10514
10623
|
this.expectPlugin("decimal", this.state.curPosition());
|
|
10515
10624
|
if (hasExponent || hasLeadingZero) {
|
|
10516
|
-
this.raise(Errors.InvalidDecimal,
|
|
10517
|
-
at: startLoc
|
|
10518
|
-
});
|
|
10625
|
+
this.raise(Errors.InvalidDecimal, startLoc);
|
|
10519
10626
|
}
|
|
10520
10627
|
++this.state.pos;
|
|
10521
10628
|
isDecimal = true;
|
|
10522
10629
|
}
|
|
10523
10630
|
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
|
|
10524
|
-
throw this.raise(Errors.NumberIdentifier,
|
|
10525
|
-
at: this.state.curPosition()
|
|
10526
|
-
});
|
|
10631
|
+
throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
10527
10632
|
}
|
|
10528
10633
|
const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
|
|
10529
10634
|
if (isBigInt) {
|
|
@@ -10586,14 +10691,10 @@ var require_lib = __commonJS({
|
|
|
10586
10691
|
this.finishToken(25, firstInvalidLoc ? null : opening + str + "${");
|
|
10587
10692
|
}
|
|
10588
10693
|
}
|
|
10589
|
-
recordStrictModeErrors(toParseError, {
|
|
10590
|
-
at
|
|
10591
|
-
}) {
|
|
10694
|
+
recordStrictModeErrors(toParseError, at) {
|
|
10592
10695
|
const index = at.index;
|
|
10593
10696
|
if (this.state.strict && !this.state.strictErrors.has(index)) {
|
|
10594
|
-
this.raise(toParseError,
|
|
10595
|
-
at
|
|
10596
|
-
});
|
|
10697
|
+
this.raise(toParseError, at);
|
|
10597
10698
|
} else {
|
|
10598
10699
|
this.state.strictErrors.set(index, [toParseError, at]);
|
|
10599
10700
|
}
|
|
@@ -10616,9 +10717,7 @@ var require_lib = __commonJS({
|
|
|
10616
10717
|
const escStart = this.state.curPosition();
|
|
10617
10718
|
const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar;
|
|
10618
10719
|
if (this.input.charCodeAt(++this.state.pos) !== 117) {
|
|
10619
|
-
this.raise(Errors.MissingUnicodeEscape,
|
|
10620
|
-
at: this.state.curPosition()
|
|
10621
|
-
});
|
|
10720
|
+
this.raise(Errors.MissingUnicodeEscape, this.state.curPosition());
|
|
10622
10721
|
chunkStart = this.state.pos - 1;
|
|
10623
10722
|
continue;
|
|
10624
10723
|
}
|
|
@@ -10626,9 +10725,7 @@ var require_lib = __commonJS({
|
|
|
10626
10725
|
const esc = this.readCodePoint(true);
|
|
10627
10726
|
if (esc !== null) {
|
|
10628
10727
|
if (!identifierCheck(esc)) {
|
|
10629
|
-
this.raise(Errors.EscapedCharNotAnIdentifier,
|
|
10630
|
-
at: escStart
|
|
10631
|
-
});
|
|
10728
|
+
this.raise(Errors.EscapedCharNotAnIdentifier, escStart);
|
|
10632
10729
|
}
|
|
10633
10730
|
word += String.fromCodePoint(esc);
|
|
10634
10731
|
}
|
|
@@ -10653,77 +10750,59 @@ var require_lib = __commonJS({
|
|
|
10653
10750
|
type
|
|
10654
10751
|
} = this.state;
|
|
10655
10752
|
if (tokenIsKeyword(type) && this.state.containsEsc) {
|
|
10656
|
-
this.raise(Errors.InvalidEscapedReservedWord, {
|
|
10657
|
-
at: this.state.startLoc,
|
|
10753
|
+
this.raise(Errors.InvalidEscapedReservedWord, this.state.startLoc, {
|
|
10658
10754
|
reservedWord: tokenLabelName(type)
|
|
10659
10755
|
});
|
|
10660
10756
|
}
|
|
10661
10757
|
}
|
|
10662
|
-
raise(toParseError,
|
|
10663
|
-
const {
|
|
10664
|
-
at
|
|
10665
|
-
} = raiseProperties, details = _objectWithoutPropertiesLoose(raiseProperties, _excluded);
|
|
10758
|
+
raise(toParseError, at, details = {}) {
|
|
10666
10759
|
const loc = at instanceof Position ? at : at.loc.start;
|
|
10667
|
-
const error = toParseError(
|
|
10668
|
-
loc,
|
|
10669
|
-
details
|
|
10670
|
-
});
|
|
10760
|
+
const error = toParseError(loc, details);
|
|
10671
10761
|
if (!this.options.errorRecovery)
|
|
10672
10762
|
throw error;
|
|
10673
10763
|
if (!this.isLookahead)
|
|
10674
10764
|
this.state.errors.push(error);
|
|
10675
10765
|
return error;
|
|
10676
10766
|
}
|
|
10677
|
-
raiseOverwrite(toParseError,
|
|
10678
|
-
const {
|
|
10679
|
-
at
|
|
10680
|
-
} = raiseProperties, details = _objectWithoutPropertiesLoose(raiseProperties, _excluded2);
|
|
10767
|
+
raiseOverwrite(toParseError, at, details = {}) {
|
|
10681
10768
|
const loc = at instanceof Position ? at : at.loc.start;
|
|
10682
10769
|
const pos = loc.index;
|
|
10683
10770
|
const errors = this.state.errors;
|
|
10684
10771
|
for (let i = errors.length - 1; i >= 0; i--) {
|
|
10685
10772
|
const error = errors[i];
|
|
10686
10773
|
if (error.loc.index === pos) {
|
|
10687
|
-
return errors[i] = toParseError(
|
|
10688
|
-
loc,
|
|
10689
|
-
details
|
|
10690
|
-
});
|
|
10774
|
+
return errors[i] = toParseError(loc, details);
|
|
10691
10775
|
}
|
|
10692
10776
|
if (error.loc.index < pos)
|
|
10693
10777
|
break;
|
|
10694
10778
|
}
|
|
10695
|
-
return this.raise(toParseError,
|
|
10779
|
+
return this.raise(toParseError, at, details);
|
|
10696
10780
|
}
|
|
10697
10781
|
updateContext(prevType) {
|
|
10698
10782
|
}
|
|
10699
10783
|
unexpected(loc, type) {
|
|
10700
|
-
throw this.raise(Errors.UnexpectedToken, {
|
|
10701
|
-
expected: type ? tokenLabelName(type) : null
|
|
10702
|
-
at: loc != null ? loc : this.state.startLoc
|
|
10784
|
+
throw this.raise(Errors.UnexpectedToken, loc != null ? loc : this.state.startLoc, {
|
|
10785
|
+
expected: type ? tokenLabelName(type) : null
|
|
10703
10786
|
});
|
|
10704
10787
|
}
|
|
10705
10788
|
expectPlugin(pluginName, loc) {
|
|
10706
10789
|
if (this.hasPlugin(pluginName)) {
|
|
10707
10790
|
return true;
|
|
10708
10791
|
}
|
|
10709
|
-
throw this.raise(Errors.MissingPlugin, {
|
|
10710
|
-
at: loc != null ? loc : this.state.startLoc,
|
|
10792
|
+
throw this.raise(Errors.MissingPlugin, loc != null ? loc : this.state.startLoc, {
|
|
10711
10793
|
missingPlugin: [pluginName]
|
|
10712
10794
|
});
|
|
10713
10795
|
}
|
|
10714
10796
|
expectOnePlugin(pluginNames) {
|
|
10715
10797
|
if (!pluginNames.some((name) => this.hasPlugin(name))) {
|
|
10716
|
-
throw this.raise(Errors.MissingOneOfPlugins, {
|
|
10717
|
-
at: this.state.startLoc,
|
|
10798
|
+
throw this.raise(Errors.MissingOneOfPlugins, this.state.startLoc, {
|
|
10718
10799
|
missingPlugin: pluginNames
|
|
10719
10800
|
});
|
|
10720
10801
|
}
|
|
10721
10802
|
}
|
|
10722
10803
|
errorBuilder(error) {
|
|
10723
10804
|
return (pos, lineStart, curLine) => {
|
|
10724
|
-
this.raise(error,
|
|
10725
|
-
at: buildPosition(pos, lineStart, curLine)
|
|
10726
|
-
});
|
|
10805
|
+
this.raise(error, buildPosition(pos, lineStart, curLine));
|
|
10727
10806
|
};
|
|
10728
10807
|
}
|
|
10729
10808
|
};
|
|
@@ -10756,8 +10835,7 @@ var require_lib = __commonJS({
|
|
|
10756
10835
|
current.undefinedPrivateNames.set(name, loc);
|
|
10757
10836
|
}
|
|
10758
10837
|
} else {
|
|
10759
|
-
this.parser.raise(Errors.InvalidPrivateFieldResolution, {
|
|
10760
|
-
at: loc,
|
|
10838
|
+
this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
|
|
10761
10839
|
identifierName: name
|
|
10762
10840
|
});
|
|
10763
10841
|
}
|
|
@@ -10785,8 +10863,7 @@ var require_lib = __commonJS({
|
|
|
10785
10863
|
}
|
|
10786
10864
|
}
|
|
10787
10865
|
if (redefined) {
|
|
10788
|
-
this.parser.raise(Errors.PrivateNameRedeclaration, {
|
|
10789
|
-
at: loc,
|
|
10866
|
+
this.parser.raise(Errors.PrivateNameRedeclaration, loc, {
|
|
10790
10867
|
identifierName: name
|
|
10791
10868
|
});
|
|
10792
10869
|
}
|
|
@@ -10802,8 +10879,7 @@ var require_lib = __commonJS({
|
|
|
10802
10879
|
if (classScope) {
|
|
10803
10880
|
classScope.undefinedPrivateNames.set(name, loc);
|
|
10804
10881
|
} else {
|
|
10805
|
-
this.parser.raise(Errors.InvalidPrivateFieldResolution, {
|
|
10806
|
-
at: loc,
|
|
10882
|
+
this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
|
|
10807
10883
|
identifierName: name
|
|
10808
10884
|
});
|
|
10809
10885
|
}
|
|
@@ -10825,9 +10901,7 @@ var require_lib = __commonJS({
|
|
|
10825
10901
|
super(type);
|
|
10826
10902
|
this.declarationErrors = /* @__PURE__ */ new Map();
|
|
10827
10903
|
}
|
|
10828
|
-
recordDeclarationError(ParsingErrorClass, {
|
|
10829
|
-
at
|
|
10830
|
-
}) {
|
|
10904
|
+
recordDeclarationError(ParsingErrorClass, at) {
|
|
10831
10905
|
const index = at.index;
|
|
10832
10906
|
this.declarationErrors.set(index, [ParsingErrorClass, at]);
|
|
10833
10907
|
}
|
|
@@ -10850,12 +10924,8 @@ var require_lib = __commonJS({
|
|
|
10850
10924
|
exit() {
|
|
10851
10925
|
this.stack.pop();
|
|
10852
10926
|
}
|
|
10853
|
-
recordParameterInitializerError(toParseError, {
|
|
10854
|
-
|
|
10855
|
-
}) {
|
|
10856
|
-
const origin = {
|
|
10857
|
-
at: node.loc.start
|
|
10858
|
-
};
|
|
10927
|
+
recordParameterInitializerError(toParseError, node) {
|
|
10928
|
+
const origin = node.loc.start;
|
|
10859
10929
|
const {
|
|
10860
10930
|
stack
|
|
10861
10931
|
} = this;
|
|
@@ -10871,16 +10941,12 @@ var require_lib = __commonJS({
|
|
|
10871
10941
|
}
|
|
10872
10942
|
this.parser.raise(toParseError, origin);
|
|
10873
10943
|
}
|
|
10874
|
-
recordArrowParameterBindingError(error, {
|
|
10875
|
-
at: node
|
|
10876
|
-
}) {
|
|
10944
|
+
recordArrowParameterBindingError(error, node) {
|
|
10877
10945
|
const {
|
|
10878
10946
|
stack
|
|
10879
10947
|
} = this;
|
|
10880
10948
|
const scope = stack[stack.length - 1];
|
|
10881
|
-
const origin =
|
|
10882
|
-
at: node.loc.start
|
|
10883
|
-
};
|
|
10949
|
+
const origin = node.loc.start;
|
|
10884
10950
|
if (scope.isCertainlyParameterDeclaration()) {
|
|
10885
10951
|
this.parser.raise(error, origin);
|
|
10886
10952
|
} else if (scope.canBeArrowParameterDeclaration()) {
|
|
@@ -10889,9 +10955,7 @@ var require_lib = __commonJS({
|
|
|
10889
10955
|
return;
|
|
10890
10956
|
}
|
|
10891
10957
|
}
|
|
10892
|
-
recordAsyncArrowParametersError({
|
|
10893
|
-
at
|
|
10894
|
-
}) {
|
|
10958
|
+
recordAsyncArrowParametersError(at) {
|
|
10895
10959
|
const {
|
|
10896
10960
|
stack
|
|
10897
10961
|
} = this;
|
|
@@ -10899,9 +10963,7 @@ var require_lib = __commonJS({
|
|
|
10899
10963
|
let scope = stack[i];
|
|
10900
10964
|
while (scope.canBeArrowParameterDeclaration()) {
|
|
10901
10965
|
if (scope.type === 2) {
|
|
10902
|
-
scope.recordDeclarationError(Errors.AwaitBindingIdentifier,
|
|
10903
|
-
at
|
|
10904
|
-
});
|
|
10966
|
+
scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at);
|
|
10905
10967
|
}
|
|
10906
10968
|
scope = stack[--i];
|
|
10907
10969
|
}
|
|
@@ -10914,9 +10976,7 @@ var require_lib = __commonJS({
|
|
|
10914
10976
|
if (!currentScope.canBeArrowParameterDeclaration())
|
|
10915
10977
|
return;
|
|
10916
10978
|
currentScope.iterateErrors(([toParseError, loc]) => {
|
|
10917
|
-
this.parser.raise(toParseError,
|
|
10918
|
-
at: loc
|
|
10919
|
-
});
|
|
10979
|
+
this.parser.raise(toParseError, loc);
|
|
10920
10980
|
let i = stack.length - 2;
|
|
10921
10981
|
let scope = stack[i];
|
|
10922
10982
|
while (scope.canBeArrowParameterDeclaration()) {
|
|
@@ -11006,9 +11066,7 @@ var require_lib = __commonJS({
|
|
|
11006
11066
|
expectContextual(token, toParseError) {
|
|
11007
11067
|
if (!this.eatContextual(token)) {
|
|
11008
11068
|
if (toParseError != null) {
|
|
11009
|
-
throw this.raise(toParseError,
|
|
11010
|
-
at: this.state.startLoc
|
|
11011
|
-
});
|
|
11069
|
+
throw this.raise(toParseError, this.state.startLoc);
|
|
11012
11070
|
}
|
|
11013
11071
|
this.unexpected(null, token);
|
|
11014
11072
|
}
|
|
@@ -11029,9 +11087,7 @@ var require_lib = __commonJS({
|
|
|
11029
11087
|
semicolon(allowAsi = true) {
|
|
11030
11088
|
if (allowAsi ? this.isLineTerminator() : this.eat(13))
|
|
11031
11089
|
return;
|
|
11032
|
-
this.raise(Errors.MissingSemicolon,
|
|
11033
|
-
at: this.state.lastTokEndLoc
|
|
11034
|
-
});
|
|
11090
|
+
this.raise(Errors.MissingSemicolon, this.state.lastTokEndLoc);
|
|
11035
11091
|
}
|
|
11036
11092
|
expect(type, loc) {
|
|
11037
11093
|
this.eat(type) || this.unexpected(loc, type);
|
|
@@ -11102,19 +11158,13 @@ var require_lib = __commonJS({
|
|
|
11102
11158
|
return hasErrors;
|
|
11103
11159
|
}
|
|
11104
11160
|
if (shorthandAssignLoc != null) {
|
|
11105
|
-
this.raise(Errors.InvalidCoverInitializedName,
|
|
11106
|
-
at: shorthandAssignLoc
|
|
11107
|
-
});
|
|
11161
|
+
this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
|
|
11108
11162
|
}
|
|
11109
11163
|
if (doubleProtoLoc != null) {
|
|
11110
|
-
this.raise(Errors.DuplicateProto,
|
|
11111
|
-
at: doubleProtoLoc
|
|
11112
|
-
});
|
|
11164
|
+
this.raise(Errors.DuplicateProto, doubleProtoLoc);
|
|
11113
11165
|
}
|
|
11114
11166
|
if (privateKeyLoc != null) {
|
|
11115
|
-
this.raise(Errors.UnexpectedPrivateField,
|
|
11116
|
-
at: privateKeyLoc
|
|
11117
|
-
});
|
|
11167
|
+
this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
|
|
11118
11168
|
}
|
|
11119
11169
|
if (optionalParametersLoc != null) {
|
|
11120
11170
|
this.unexpected(optionalParametersLoc);
|
|
@@ -11269,7 +11319,8 @@ var require_lib = __commonJS({
|
|
|
11269
11319
|
}
|
|
11270
11320
|
var NodeUtils = class extends UtilParser {
|
|
11271
11321
|
startNode() {
|
|
11272
|
-
|
|
11322
|
+
const loc = this.state.startLoc;
|
|
11323
|
+
return new Node(this, loc.index, loc);
|
|
11273
11324
|
}
|
|
11274
11325
|
startNodeAt(loc) {
|
|
11275
11326
|
return new Node(this, loc.index, loc);
|
|
@@ -11471,10 +11522,8 @@ var require_lib = __commonJS({
|
|
|
11471
11522
|
const moduloLoc = this.state.startLoc;
|
|
11472
11523
|
this.next();
|
|
11473
11524
|
this.expectContextual(110);
|
|
11474
|
-
if (this.state.
|
|
11475
|
-
this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks,
|
|
11476
|
-
at: moduloLoc
|
|
11477
|
-
});
|
|
11525
|
+
if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) {
|
|
11526
|
+
this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, moduloLoc);
|
|
11478
11527
|
}
|
|
11479
11528
|
if (this.eat(10)) {
|
|
11480
11529
|
node.value = super.parseExpression();
|
|
@@ -11543,9 +11592,7 @@ var require_lib = __commonJS({
|
|
|
11543
11592
|
return this.flowParseDeclareModuleExports(node);
|
|
11544
11593
|
} else {
|
|
11545
11594
|
if (insideModule) {
|
|
11546
|
-
this.raise(FlowErrors.NestedDeclareModule,
|
|
11547
|
-
at: this.state.lastTokStartLoc
|
|
11548
|
-
});
|
|
11595
|
+
this.raise(FlowErrors.NestedDeclareModule, this.state.lastTokStartLoc);
|
|
11549
11596
|
}
|
|
11550
11597
|
return this.flowParseDeclareModule(node);
|
|
11551
11598
|
}
|
|
@@ -11583,9 +11630,7 @@ var require_lib = __commonJS({
|
|
|
11583
11630
|
if (this.match(83)) {
|
|
11584
11631
|
this.next();
|
|
11585
11632
|
if (!this.isContextual(130) && !this.match(87)) {
|
|
11586
|
-
this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule,
|
|
11587
|
-
at: this.state.lastTokStartLoc
|
|
11588
|
-
});
|
|
11633
|
+
this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
|
|
11589
11634
|
}
|
|
11590
11635
|
super.parseImport(bodyNode2);
|
|
11591
11636
|
} else {
|
|
@@ -11602,21 +11647,15 @@ var require_lib = __commonJS({
|
|
|
11602
11647
|
body.forEach((bodyElement) => {
|
|
11603
11648
|
if (isEsModuleType(bodyElement)) {
|
|
11604
11649
|
if (kind === "CommonJS") {
|
|
11605
|
-
this.raise(FlowErrors.AmbiguousDeclareModuleKind,
|
|
11606
|
-
at: bodyElement
|
|
11607
|
-
});
|
|
11650
|
+
this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
|
|
11608
11651
|
}
|
|
11609
11652
|
kind = "ES";
|
|
11610
11653
|
} else if (bodyElement.type === "DeclareModuleExports") {
|
|
11611
11654
|
if (hasModuleExport) {
|
|
11612
|
-
this.raise(FlowErrors.DuplicateDeclareModuleExports,
|
|
11613
|
-
at: bodyElement
|
|
11614
|
-
});
|
|
11655
|
+
this.raise(FlowErrors.DuplicateDeclareModuleExports, bodyElement);
|
|
11615
11656
|
}
|
|
11616
11657
|
if (kind === "ES") {
|
|
11617
|
-
this.raise(FlowErrors.AmbiguousDeclareModuleKind,
|
|
11618
|
-
at: bodyElement
|
|
11619
|
-
});
|
|
11658
|
+
this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
|
|
11620
11659
|
}
|
|
11621
11660
|
kind = "CommonJS";
|
|
11622
11661
|
hasModuleExport = true;
|
|
@@ -11639,8 +11678,7 @@ var require_lib = __commonJS({
|
|
|
11639
11678
|
} else {
|
|
11640
11679
|
if (this.match(75) || this.isLet() || (this.isContextual(130) || this.isContextual(129)) && !insideModule) {
|
|
11641
11680
|
const label = this.state.value;
|
|
11642
|
-
throw this.raise(FlowErrors.UnsupportedDeclareExportKind, {
|
|
11643
|
-
at: this.state.startLoc,
|
|
11681
|
+
throw this.raise(FlowErrors.UnsupportedDeclareExportKind, this.state.startLoc, {
|
|
11644
11682
|
unsupportedExportKind: label,
|
|
11645
11683
|
suggestion: exportSuggestions[label]
|
|
11646
11684
|
});
|
|
@@ -11738,16 +11776,13 @@ var require_lib = __commonJS({
|
|
|
11738
11776
|
}
|
|
11739
11777
|
checkNotUnderscore(word) {
|
|
11740
11778
|
if (word === "_") {
|
|
11741
|
-
this.raise(FlowErrors.UnexpectedReservedUnderscore,
|
|
11742
|
-
at: this.state.startLoc
|
|
11743
|
-
});
|
|
11779
|
+
this.raise(FlowErrors.UnexpectedReservedUnderscore, this.state.startLoc);
|
|
11744
11780
|
}
|
|
11745
11781
|
}
|
|
11746
11782
|
checkReservedType(word, startLoc, declaration) {
|
|
11747
11783
|
if (!reservedTypes.has(word))
|
|
11748
11784
|
return;
|
|
11749
|
-
this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, {
|
|
11750
|
-
at: startLoc,
|
|
11785
|
+
this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, startLoc, {
|
|
11751
11786
|
reservedType: word
|
|
11752
11787
|
});
|
|
11753
11788
|
}
|
|
@@ -11800,9 +11835,7 @@ var require_lib = __commonJS({
|
|
|
11800
11835
|
node.default = this.flowParseType();
|
|
11801
11836
|
} else {
|
|
11802
11837
|
if (requireDefault) {
|
|
11803
|
-
this.raise(FlowErrors.MissingTypeParamDefault,
|
|
11804
|
-
at: nodeStartLoc
|
|
11805
|
-
});
|
|
11838
|
+
this.raise(FlowErrors.MissingTypeParamDefault, nodeStartLoc);
|
|
11806
11839
|
}
|
|
11807
11840
|
}
|
|
11808
11841
|
return this.finishNode(node, "TypeParameter");
|
|
@@ -12042,9 +12075,7 @@ var require_lib = __commonJS({
|
|
|
12042
12075
|
}
|
|
12043
12076
|
this.flowObjectTypeSemicolon();
|
|
12044
12077
|
if (inexactStartLoc && !this.match(8) && !this.match(9)) {
|
|
12045
|
-
this.raise(FlowErrors.UnexpectedExplicitInexactInObject,
|
|
12046
|
-
at: inexactStartLoc
|
|
12047
|
-
});
|
|
12078
|
+
this.raise(FlowErrors.UnexpectedExplicitInexactInObject, inexactStartLoc);
|
|
12048
12079
|
}
|
|
12049
12080
|
}
|
|
12050
12081
|
this.expect(endDelim);
|
|
@@ -12060,33 +12091,23 @@ var require_lib = __commonJS({
|
|
|
12060
12091
|
const isInexactToken = this.match(12) || this.match(13) || this.match(8) || this.match(9);
|
|
12061
12092
|
if (isInexactToken) {
|
|
12062
12093
|
if (!allowSpread) {
|
|
12063
|
-
this.raise(FlowErrors.InexactInsideNonObject,
|
|
12064
|
-
at: this.state.lastTokStartLoc
|
|
12065
|
-
});
|
|
12094
|
+
this.raise(FlowErrors.InexactInsideNonObject, this.state.lastTokStartLoc);
|
|
12066
12095
|
} else if (!allowInexact) {
|
|
12067
|
-
this.raise(FlowErrors.InexactInsideExact,
|
|
12068
|
-
at: this.state.lastTokStartLoc
|
|
12069
|
-
});
|
|
12096
|
+
this.raise(FlowErrors.InexactInsideExact, this.state.lastTokStartLoc);
|
|
12070
12097
|
}
|
|
12071
12098
|
if (variance) {
|
|
12072
|
-
this.raise(FlowErrors.InexactVariance,
|
|
12073
|
-
at: variance
|
|
12074
|
-
});
|
|
12099
|
+
this.raise(FlowErrors.InexactVariance, variance);
|
|
12075
12100
|
}
|
|
12076
12101
|
return null;
|
|
12077
12102
|
}
|
|
12078
12103
|
if (!allowSpread) {
|
|
12079
|
-
this.raise(FlowErrors.UnexpectedSpreadType,
|
|
12080
|
-
at: this.state.lastTokStartLoc
|
|
12081
|
-
});
|
|
12104
|
+
this.raise(FlowErrors.UnexpectedSpreadType, this.state.lastTokStartLoc);
|
|
12082
12105
|
}
|
|
12083
12106
|
if (protoStartLoc != null) {
|
|
12084
12107
|
this.unexpected(protoStartLoc);
|
|
12085
12108
|
}
|
|
12086
12109
|
if (variance) {
|
|
12087
|
-
this.raise(FlowErrors.SpreadVariance,
|
|
12088
|
-
at: variance
|
|
12089
|
-
});
|
|
12110
|
+
this.raise(FlowErrors.SpreadVariance, variance);
|
|
12090
12111
|
}
|
|
12091
12112
|
node.argument = this.flowParseType();
|
|
12092
12113
|
return this.finishNode(node, "ObjectTypeSpreadProperty");
|
|
@@ -12109,9 +12130,7 @@ var require_lib = __commonJS({
|
|
|
12109
12130
|
this.flowCheckGetterSetterParams(node);
|
|
12110
12131
|
}
|
|
12111
12132
|
if (!allowSpread && node.key.name === "constructor" && node.value.this) {
|
|
12112
|
-
this.raise(FlowErrors.ThisParamBannedInConstructor,
|
|
12113
|
-
at: node.value.this
|
|
12114
|
-
});
|
|
12133
|
+
this.raise(FlowErrors.ThisParamBannedInConstructor, node.value.this);
|
|
12115
12134
|
}
|
|
12116
12135
|
} else {
|
|
12117
12136
|
if (kind !== "init")
|
|
@@ -12131,19 +12150,13 @@ var require_lib = __commonJS({
|
|
|
12131
12150
|
const paramCount = property.kind === "get" ? 0 : 1;
|
|
12132
12151
|
const length = property.value.params.length + (property.value.rest ? 1 : 0);
|
|
12133
12152
|
if (property.value.this) {
|
|
12134
|
-
this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam,
|
|
12135
|
-
at: property.value.this
|
|
12136
|
-
});
|
|
12153
|
+
this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, property.value.this);
|
|
12137
12154
|
}
|
|
12138
12155
|
if (length !== paramCount) {
|
|
12139
|
-
this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity,
|
|
12140
|
-
at: property
|
|
12141
|
-
});
|
|
12156
|
+
this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, property);
|
|
12142
12157
|
}
|
|
12143
12158
|
if (property.kind === "set" && property.value.rest) {
|
|
12144
|
-
this.raise(Errors.BadSetterRestParameter,
|
|
12145
|
-
at: property
|
|
12146
|
-
});
|
|
12159
|
+
this.raise(Errors.BadSetterRestParameter, property);
|
|
12147
12160
|
}
|
|
12148
12161
|
}
|
|
12149
12162
|
flowObjectTypeSemicolon() {
|
|
@@ -12200,17 +12213,13 @@ var require_lib = __commonJS({
|
|
|
12200
12213
|
const isThis = this.state.type === 78;
|
|
12201
12214
|
if (lh.type === 14 || lh.type === 17) {
|
|
12202
12215
|
if (isThis && !first) {
|
|
12203
|
-
this.raise(FlowErrors.ThisParamMustBeFirst,
|
|
12204
|
-
at: node
|
|
12205
|
-
});
|
|
12216
|
+
this.raise(FlowErrors.ThisParamMustBeFirst, node);
|
|
12206
12217
|
}
|
|
12207
12218
|
name = this.parseIdentifier(isThis);
|
|
12208
12219
|
if (this.eat(17)) {
|
|
12209
12220
|
optional = true;
|
|
12210
12221
|
if (isThis) {
|
|
12211
|
-
this.raise(FlowErrors.ThisParamMayNotBeOptional,
|
|
12212
|
-
at: node
|
|
12213
|
-
});
|
|
12222
|
+
this.raise(FlowErrors.ThisParamMayNotBeOptional, node);
|
|
12214
12223
|
}
|
|
12215
12224
|
}
|
|
12216
12225
|
typeAnnotation = this.flowParseTypeInitialiser();
|
|
@@ -12366,9 +12375,7 @@ var require_lib = __commonJS({
|
|
|
12366
12375
|
if (this.match(135)) {
|
|
12367
12376
|
return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
|
|
12368
12377
|
}
|
|
12369
|
-
throw this.raise(FlowErrors.UnexpectedSubtractionOperand,
|
|
12370
|
-
at: this.state.startLoc
|
|
12371
|
-
});
|
|
12378
|
+
throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
|
|
12372
12379
|
}
|
|
12373
12380
|
this.unexpected();
|
|
12374
12381
|
return;
|
|
@@ -12633,9 +12640,7 @@ var require_lib = __commonJS({
|
|
|
12633
12640
|
[valid, invalid] = this.getArrowLikeExpressions(consequent);
|
|
12634
12641
|
}
|
|
12635
12642
|
if (failed && valid.length > 1) {
|
|
12636
|
-
this.raise(FlowErrors.AmbiguousConditionalArrow,
|
|
12637
|
-
at: state.startLoc
|
|
12638
|
-
});
|
|
12643
|
+
this.raise(FlowErrors.AmbiguousConditionalArrow, state.startLoc);
|
|
12639
12644
|
}
|
|
12640
12645
|
if (failed && valid.length === 1) {
|
|
12641
12646
|
this.state = state;
|
|
@@ -12797,13 +12802,9 @@ var require_lib = __commonJS({
|
|
|
12797
12802
|
super.parseClassMember(classBody, member, state);
|
|
12798
12803
|
if (member.declare) {
|
|
12799
12804
|
if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") {
|
|
12800
|
-
this.raise(FlowErrors.DeclareClassElement,
|
|
12801
|
-
at: startLoc
|
|
12802
|
-
});
|
|
12805
|
+
this.raise(FlowErrors.DeclareClassElement, startLoc);
|
|
12803
12806
|
} else if (member.value) {
|
|
12804
|
-
this.raise(FlowErrors.DeclareClassFieldInitializer,
|
|
12805
|
-
at: member.value
|
|
12806
|
-
});
|
|
12807
|
+
this.raise(FlowErrors.DeclareClassFieldInitializer, member.value);
|
|
12807
12808
|
}
|
|
12808
12809
|
}
|
|
12809
12810
|
}
|
|
@@ -12814,8 +12815,7 @@ var require_lib = __commonJS({
|
|
|
12814
12815
|
const word = super.readWord1();
|
|
12815
12816
|
const fullWord = "@@" + word;
|
|
12816
12817
|
if (!this.isIterator(word) || !this.state.inType) {
|
|
12817
|
-
this.raise(Errors.InvalidIdentifier, {
|
|
12818
|
-
at: this.state.curPosition(),
|
|
12818
|
+
this.raise(Errors.InvalidIdentifier, this.state.curPosition(), {
|
|
12819
12819
|
identifierName: fullWord
|
|
12820
12820
|
});
|
|
12821
12821
|
}
|
|
@@ -12867,9 +12867,7 @@ var require_lib = __commonJS({
|
|
|
12867
12867
|
var _expr$extra;
|
|
12868
12868
|
const expr = exprList[i];
|
|
12869
12869
|
if (expr && expr.type === "TypeCastExpression" && !((_expr$extra = expr.extra) != null && _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) {
|
|
12870
|
-
this.raise(FlowErrors.TypeCastInPattern,
|
|
12871
|
-
at: expr.typeAnnotation
|
|
12872
|
-
});
|
|
12870
|
+
this.raise(FlowErrors.TypeCastInPattern, expr.typeAnnotation);
|
|
12873
12871
|
}
|
|
12874
12872
|
}
|
|
12875
12873
|
return exprList;
|
|
@@ -12917,16 +12915,12 @@ var require_lib = __commonJS({
|
|
|
12917
12915
|
if (method.params && isConstructor) {
|
|
12918
12916
|
const params = method.params;
|
|
12919
12917
|
if (params.length > 0 && this.isThisParam(params[0])) {
|
|
12920
|
-
this.raise(FlowErrors.ThisParamBannedInConstructor,
|
|
12921
|
-
at: method
|
|
12922
|
-
});
|
|
12918
|
+
this.raise(FlowErrors.ThisParamBannedInConstructor, method);
|
|
12923
12919
|
}
|
|
12924
12920
|
} else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
|
|
12925
12921
|
const params = method.value.params;
|
|
12926
12922
|
if (params.length > 0 && this.isThisParam(params[0])) {
|
|
12927
|
-
this.raise(FlowErrors.ThisParamBannedInConstructor,
|
|
12928
|
-
at: method
|
|
12929
|
-
});
|
|
12923
|
+
this.raise(FlowErrors.ThisParamBannedInConstructor, method);
|
|
12930
12924
|
}
|
|
12931
12925
|
}
|
|
12932
12926
|
}
|
|
@@ -12966,13 +12960,9 @@ var require_lib = __commonJS({
|
|
|
12966
12960
|
if (params.length > 0) {
|
|
12967
12961
|
const param = params[0];
|
|
12968
12962
|
if (this.isThisParam(param) && method.kind === "get") {
|
|
12969
|
-
this.raise(FlowErrors.GetterMayNotHaveThisParam,
|
|
12970
|
-
at: param
|
|
12971
|
-
});
|
|
12963
|
+
this.raise(FlowErrors.GetterMayNotHaveThisParam, param);
|
|
12972
12964
|
} else if (this.isThisParam(param)) {
|
|
12973
|
-
this.raise(FlowErrors.SetterMayNotHaveThisParam,
|
|
12974
|
-
at: param
|
|
12975
|
-
});
|
|
12965
|
+
this.raise(FlowErrors.SetterMayNotHaveThisParam, param);
|
|
12976
12966
|
}
|
|
12977
12967
|
}
|
|
12978
12968
|
}
|
|
@@ -12999,28 +12989,20 @@ var require_lib = __commonJS({
|
|
|
12999
12989
|
parseAssignableListItemTypes(param) {
|
|
13000
12990
|
if (this.eat(17)) {
|
|
13001
12991
|
if (param.type !== "Identifier") {
|
|
13002
|
-
this.raise(FlowErrors.PatternIsOptional,
|
|
13003
|
-
at: param
|
|
13004
|
-
});
|
|
12992
|
+
this.raise(FlowErrors.PatternIsOptional, param);
|
|
13005
12993
|
}
|
|
13006
12994
|
if (this.isThisParam(param)) {
|
|
13007
|
-
this.raise(FlowErrors.ThisParamMayNotBeOptional,
|
|
13008
|
-
at: param
|
|
13009
|
-
});
|
|
12995
|
+
this.raise(FlowErrors.ThisParamMayNotBeOptional, param);
|
|
13010
12996
|
}
|
|
13011
12997
|
param.optional = true;
|
|
13012
12998
|
}
|
|
13013
12999
|
if (this.match(14)) {
|
|
13014
13000
|
param.typeAnnotation = this.flowParseTypeAnnotation();
|
|
13015
13001
|
} else if (this.isThisParam(param)) {
|
|
13016
|
-
this.raise(FlowErrors.ThisParamAnnotationRequired,
|
|
13017
|
-
at: param
|
|
13018
|
-
});
|
|
13002
|
+
this.raise(FlowErrors.ThisParamAnnotationRequired, param);
|
|
13019
13003
|
}
|
|
13020
13004
|
if (this.match(29) && this.isThisParam(param)) {
|
|
13021
|
-
this.raise(FlowErrors.ThisParamNoDefault,
|
|
13022
|
-
at: param
|
|
13023
|
-
});
|
|
13005
|
+
this.raise(FlowErrors.ThisParamNoDefault, param);
|
|
13024
13006
|
}
|
|
13025
13007
|
this.resetEndLocation(param);
|
|
13026
13008
|
return param;
|
|
@@ -13028,18 +13010,14 @@ var require_lib = __commonJS({
|
|
|
13028
13010
|
parseMaybeDefault(startLoc, left) {
|
|
13029
13011
|
const node = super.parseMaybeDefault(startLoc, left);
|
|
13030
13012
|
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
|
|
13031
|
-
this.raise(FlowErrors.TypeBeforeInitializer,
|
|
13032
|
-
at: node.typeAnnotation
|
|
13033
|
-
});
|
|
13013
|
+
this.raise(FlowErrors.TypeBeforeInitializer, node.typeAnnotation);
|
|
13034
13014
|
}
|
|
13035
13015
|
return node;
|
|
13036
13016
|
}
|
|
13037
13017
|
checkImportReflection(node) {
|
|
13038
13018
|
super.checkImportReflection(node);
|
|
13039
13019
|
if (node.module && node.importKind !== "value") {
|
|
13040
|
-
this.raise(FlowErrors.ImportReflectionHasImportType,
|
|
13041
|
-
at: node.specifiers[0].loc.start
|
|
13042
|
-
});
|
|
13020
|
+
this.raise(FlowErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
|
|
13043
13021
|
}
|
|
13044
13022
|
}
|
|
13045
13023
|
parseImportSpecifierLocal(node, specifier, type) {
|
|
@@ -13098,8 +13076,7 @@ var require_lib = __commonJS({
|
|
|
13098
13076
|
specifier.importKind = specifierTypeKind;
|
|
13099
13077
|
} else {
|
|
13100
13078
|
if (importedIsString) {
|
|
13101
|
-
throw this.raise(Errors.ImportBindingIsString, {
|
|
13102
|
-
at: specifier,
|
|
13079
|
+
throw this.raise(Errors.ImportBindingIsString, specifier, {
|
|
13103
13080
|
importName: firstIdent.value
|
|
13104
13081
|
});
|
|
13105
13082
|
}
|
|
@@ -13115,9 +13092,7 @@ var require_lib = __commonJS({
|
|
|
13115
13092
|
}
|
|
13116
13093
|
const specifierIsTypeImport = hasTypeImportKind(specifier);
|
|
13117
13094
|
if (isInTypeOnlyImport && specifierIsTypeImport) {
|
|
13118
|
-
this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport,
|
|
13119
|
-
at: specifier
|
|
13120
|
-
});
|
|
13095
|
+
this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, specifier);
|
|
13121
13096
|
}
|
|
13122
13097
|
if (isInTypeOnlyImport || specifierIsTypeImport) {
|
|
13123
13098
|
this.checkReservedType(specifier.local.name, specifier.local.loc.start, true);
|
|
@@ -13203,9 +13178,7 @@ var require_lib = __commonJS({
|
|
|
13203
13178
|
if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
|
|
13204
13179
|
if (!arrow.error && !arrow.aborted) {
|
|
13205
13180
|
if (arrow.node.async) {
|
|
13206
|
-
this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction,
|
|
13207
|
-
at: typeParameters
|
|
13208
|
-
});
|
|
13181
|
+
this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, typeParameters);
|
|
13209
13182
|
}
|
|
13210
13183
|
return arrow.node;
|
|
13211
13184
|
}
|
|
@@ -13223,9 +13196,7 @@ var require_lib = __commonJS({
|
|
|
13223
13196
|
throw jsx2.error;
|
|
13224
13197
|
if (arrow.thrown)
|
|
13225
13198
|
throw arrow.error;
|
|
13226
|
-
throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter,
|
|
13227
|
-
at: typeParameters
|
|
13228
|
-
});
|
|
13199
|
+
throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, typeParameters);
|
|
13229
13200
|
}
|
|
13230
13201
|
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
13231
13202
|
}
|
|
@@ -13267,9 +13238,7 @@ var require_lib = __commonJS({
|
|
|
13267
13238
|
}
|
|
13268
13239
|
for (let i = 0; i < node.params.length; i++) {
|
|
13269
13240
|
if (this.isThisParam(node.params[i]) && i > 0) {
|
|
13270
|
-
this.raise(FlowErrors.ThisParamMustBeFirst,
|
|
13271
|
-
at: node.params[i]
|
|
13272
|
-
});
|
|
13241
|
+
this.raise(FlowErrors.ThisParamMustBeFirst, node.params[i]);
|
|
13273
13242
|
}
|
|
13274
13243
|
}
|
|
13275
13244
|
super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
|
|
@@ -13375,18 +13344,14 @@ var require_lib = __commonJS({
|
|
|
13375
13344
|
parseTopLevel(file, program) {
|
|
13376
13345
|
const fileNode = super.parseTopLevel(file, program);
|
|
13377
13346
|
if (this.state.hasFlowComment) {
|
|
13378
|
-
this.raise(FlowErrors.UnterminatedFlowComment,
|
|
13379
|
-
at: this.state.curPosition()
|
|
13380
|
-
});
|
|
13347
|
+
this.raise(FlowErrors.UnterminatedFlowComment, this.state.curPosition());
|
|
13381
13348
|
}
|
|
13382
13349
|
return fileNode;
|
|
13383
13350
|
}
|
|
13384
13351
|
skipBlockComment() {
|
|
13385
13352
|
if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
|
|
13386
13353
|
if (this.state.hasFlowComment) {
|
|
13387
|
-
throw this.raise(FlowErrors.NestedFlowComment,
|
|
13388
|
-
at: this.state.startLoc
|
|
13389
|
-
});
|
|
13354
|
+
throw this.raise(FlowErrors.NestedFlowComment, this.state.startLoc);
|
|
13390
13355
|
}
|
|
13391
13356
|
this.hasFlowCommentCompletion();
|
|
13392
13357
|
const commentSkip = this.skipFlowComment();
|
|
@@ -13422,43 +13387,26 @@ var require_lib = __commonJS({
|
|
|
13422
13387
|
hasFlowCommentCompletion() {
|
|
13423
13388
|
const end = this.input.indexOf("*/", this.state.pos);
|
|
13424
13389
|
if (end === -1) {
|
|
13425
|
-
throw this.raise(Errors.UnterminatedComment,
|
|
13426
|
-
at: this.state.curPosition()
|
|
13427
|
-
});
|
|
13390
|
+
throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
|
|
13428
13391
|
}
|
|
13429
13392
|
}
|
|
13430
13393
|
flowEnumErrorBooleanMemberNotInitialized(loc, {
|
|
13431
13394
|
enumName,
|
|
13432
13395
|
memberName
|
|
13433
13396
|
}) {
|
|
13434
|
-
this.raise(FlowErrors.EnumBooleanMemberNotInitialized, {
|
|
13435
|
-
at: loc,
|
|
13397
|
+
this.raise(FlowErrors.EnumBooleanMemberNotInitialized, loc, {
|
|
13436
13398
|
memberName,
|
|
13437
13399
|
enumName
|
|
13438
13400
|
});
|
|
13439
13401
|
}
|
|
13440
13402
|
flowEnumErrorInvalidMemberInitializer(loc, enumContext) {
|
|
13441
|
-
return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType,
|
|
13442
|
-
at: loc
|
|
13443
|
-
}, enumContext));
|
|
13403
|
+
return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, loc, enumContext);
|
|
13444
13404
|
}
|
|
13445
|
-
flowEnumErrorNumberMemberNotInitialized(loc, {
|
|
13446
|
-
|
|
13447
|
-
memberName
|
|
13448
|
-
}) {
|
|
13449
|
-
this.raise(FlowErrors.EnumNumberMemberNotInitialized, {
|
|
13450
|
-
at: loc,
|
|
13451
|
-
enumName,
|
|
13452
|
-
memberName
|
|
13453
|
-
});
|
|
13405
|
+
flowEnumErrorNumberMemberNotInitialized(loc, details) {
|
|
13406
|
+
this.raise(FlowErrors.EnumNumberMemberNotInitialized, loc, details);
|
|
13454
13407
|
}
|
|
13455
|
-
flowEnumErrorStringMemberInconsistentlyInitialized(node, {
|
|
13456
|
-
|
|
13457
|
-
}) {
|
|
13458
|
-
this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, {
|
|
13459
|
-
at: node,
|
|
13460
|
-
enumName
|
|
13461
|
-
});
|
|
13408
|
+
flowEnumErrorStringMemberInconsistentlyInitialized(node, details) {
|
|
13409
|
+
this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, node, details);
|
|
13462
13410
|
}
|
|
13463
13411
|
flowEnumMemberInit() {
|
|
13464
13412
|
const startLoc = this.state.startLoc;
|
|
@@ -13564,16 +13512,14 @@ var require_lib = __commonJS({
|
|
|
13564
13512
|
continue;
|
|
13565
13513
|
}
|
|
13566
13514
|
if (/^[a-z]/.test(memberName)) {
|
|
13567
|
-
this.raise(FlowErrors.EnumInvalidMemberName, {
|
|
13568
|
-
at: id,
|
|
13515
|
+
this.raise(FlowErrors.EnumInvalidMemberName, id, {
|
|
13569
13516
|
memberName,
|
|
13570
13517
|
suggestion: memberName[0].toUpperCase() + memberName.slice(1),
|
|
13571
13518
|
enumName
|
|
13572
13519
|
});
|
|
13573
13520
|
}
|
|
13574
13521
|
if (seenNames.has(memberName)) {
|
|
13575
|
-
this.raise(FlowErrors.EnumDuplicateMemberName, {
|
|
13576
|
-
at: id,
|
|
13522
|
+
this.raise(FlowErrors.EnumDuplicateMemberName, id, {
|
|
13577
13523
|
memberName,
|
|
13578
13524
|
enumName
|
|
13579
13525
|
});
|
|
@@ -13658,8 +13604,7 @@ var require_lib = __commonJS({
|
|
|
13658
13604
|
if (!this.eatContextual(102))
|
|
13659
13605
|
return null;
|
|
13660
13606
|
if (!tokenIsIdentifier(this.state.type)) {
|
|
13661
|
-
throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, {
|
|
13662
|
-
at: this.state.startLoc,
|
|
13607
|
+
throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, {
|
|
13663
13608
|
enumName
|
|
13664
13609
|
});
|
|
13665
13610
|
}
|
|
@@ -13668,8 +13613,7 @@ var require_lib = __commonJS({
|
|
|
13668
13613
|
} = this.state;
|
|
13669
13614
|
this.next();
|
|
13670
13615
|
if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") {
|
|
13671
|
-
this.raise(FlowErrors.EnumInvalidExplicitType, {
|
|
13672
|
-
at: this.state.startLoc,
|
|
13616
|
+
this.raise(FlowErrors.EnumInvalidExplicitType, this.state.startLoc, {
|
|
13673
13617
|
enumName,
|
|
13674
13618
|
invalidEnumType: value
|
|
13675
13619
|
});
|
|
@@ -13753,8 +13697,7 @@ var require_lib = __commonJS({
|
|
|
13753
13697
|
this.expect(8);
|
|
13754
13698
|
return this.finishNode(node, "EnumNumberBody");
|
|
13755
13699
|
} else {
|
|
13756
|
-
this.raise(FlowErrors.EnumInconsistentMemberValues, {
|
|
13757
|
-
at: nameLoc,
|
|
13700
|
+
this.raise(FlowErrors.EnumInconsistentMemberValues, nameLoc, {
|
|
13758
13701
|
enumName
|
|
13759
13702
|
});
|
|
13760
13703
|
return empty();
|
|
@@ -14072,9 +14015,7 @@ var require_lib = __commonJS({
|
|
|
14072
14015
|
let chunkStart = this.state.pos;
|
|
14073
14016
|
for (; ; ) {
|
|
14074
14017
|
if (this.state.pos >= this.length) {
|
|
14075
|
-
throw this.raise(JsxErrors.UnterminatedJsxContent,
|
|
14076
|
-
at: this.state.startLoc
|
|
14077
|
-
});
|
|
14018
|
+
throw this.raise(JsxErrors.UnterminatedJsxContent, this.state.startLoc);
|
|
14078
14019
|
}
|
|
14079
14020
|
const ch = this.input.charCodeAt(this.state.pos);
|
|
14080
14021
|
switch (ch) {
|
|
@@ -14129,9 +14070,7 @@ var require_lib = __commonJS({
|
|
|
14129
14070
|
let chunkStart = ++this.state.pos;
|
|
14130
14071
|
for (; ; ) {
|
|
14131
14072
|
if (this.state.pos >= this.length) {
|
|
14132
|
-
throw this.raise(Errors.UnterminatedString,
|
|
14133
|
-
at: this.state.startLoc
|
|
14134
|
-
});
|
|
14073
|
+
throw this.raise(Errors.UnterminatedString, this.state.startLoc);
|
|
14135
14074
|
}
|
|
14136
14075
|
const ch = this.input.charCodeAt(this.state.pos);
|
|
14137
14076
|
if (ch === quote)
|
|
@@ -14236,18 +14175,14 @@ var require_lib = __commonJS({
|
|
|
14236
14175
|
this.next();
|
|
14237
14176
|
node = this.jsxParseExpressionContainer(node, types.j_oTag);
|
|
14238
14177
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
14239
|
-
this.raise(JsxErrors.AttributeIsEmpty,
|
|
14240
|
-
at: node
|
|
14241
|
-
});
|
|
14178
|
+
this.raise(JsxErrors.AttributeIsEmpty, node);
|
|
14242
14179
|
}
|
|
14243
14180
|
return node;
|
|
14244
14181
|
case 142:
|
|
14245
14182
|
case 133:
|
|
14246
14183
|
return this.parseExprAtom();
|
|
14247
14184
|
default:
|
|
14248
|
-
throw this.raise(JsxErrors.UnsupportedJsxValue,
|
|
14249
|
-
at: this.state.startLoc
|
|
14250
|
-
});
|
|
14185
|
+
throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
|
|
14251
14186
|
}
|
|
14252
14187
|
}
|
|
14253
14188
|
jsxParseEmptyExpression() {
|
|
@@ -14354,18 +14289,14 @@ var require_lib = __commonJS({
|
|
|
14354
14289
|
}
|
|
14355
14290
|
}
|
|
14356
14291
|
if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) {
|
|
14357
|
-
this.raise(JsxErrors.MissingClosingTagFragment,
|
|
14358
|
-
at: closingElement
|
|
14359
|
-
});
|
|
14292
|
+
this.raise(JsxErrors.MissingClosingTagFragment, closingElement);
|
|
14360
14293
|
} else if (!isFragment(openingElement) && isFragment(closingElement)) {
|
|
14361
|
-
this.raise(JsxErrors.MissingClosingTagElement, {
|
|
14362
|
-
at: closingElement,
|
|
14294
|
+
this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
|
|
14363
14295
|
openingTagName: getQualifiedJSXName(openingElement.name)
|
|
14364
14296
|
});
|
|
14365
14297
|
} else if (!isFragment(openingElement) && !isFragment(closingElement)) {
|
|
14366
14298
|
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
|
|
14367
|
-
this.raise(JsxErrors.MissingClosingTagElement, {
|
|
14368
|
-
at: closingElement,
|
|
14299
|
+
this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
|
|
14369
14300
|
openingTagName: getQualifiedJSXName(openingElement.name)
|
|
14370
14301
|
});
|
|
14371
14302
|
}
|
|
@@ -14380,9 +14311,7 @@ var require_lib = __commonJS({
|
|
|
14380
14311
|
}
|
|
14381
14312
|
node.children = children;
|
|
14382
14313
|
if (this.match(47)) {
|
|
14383
|
-
throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements,
|
|
14384
|
-
at: this.state.startLoc
|
|
14385
|
-
});
|
|
14314
|
+
throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, this.state.startLoc);
|
|
14386
14315
|
}
|
|
14387
14316
|
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
|
|
14388
14317
|
}
|
|
@@ -14469,11 +14398,7 @@ var require_lib = __commonJS({
|
|
|
14469
14398
|
var TypeScriptScope = class extends Scope {
|
|
14470
14399
|
constructor(...args) {
|
|
14471
14400
|
super(...args);
|
|
14472
|
-
this.
|
|
14473
|
-
this.enums = /* @__PURE__ */ new Set();
|
|
14474
|
-
this.constEnums = /* @__PURE__ */ new Set();
|
|
14475
|
-
this.classes = /* @__PURE__ */ new Set();
|
|
14476
|
-
this.exportOnlyBindings = /* @__PURE__ */ new Set();
|
|
14401
|
+
this.tsNames = /* @__PURE__ */ new Map();
|
|
14477
14402
|
}
|
|
14478
14403
|
};
|
|
14479
14404
|
var TypeScriptScopeHandler = class extends ScopeHandler {
|
|
@@ -14514,8 +14439,7 @@ var require_lib = __commonJS({
|
|
|
14514
14439
|
declareName(name, bindingType, loc) {
|
|
14515
14440
|
if (bindingType & 4096) {
|
|
14516
14441
|
if (this.hasImport(name, true)) {
|
|
14517
|
-
this.parser.raise(Errors.VarRedeclaration, {
|
|
14518
|
-
at: loc,
|
|
14442
|
+
this.parser.raise(Errors.VarRedeclaration, loc, {
|
|
14519
14443
|
identifierName: name
|
|
14520
14444
|
});
|
|
14521
14445
|
}
|
|
@@ -14523,9 +14447,10 @@ var require_lib = __commonJS({
|
|
|
14523
14447
|
return;
|
|
14524
14448
|
}
|
|
14525
14449
|
const scope = this.currentScope();
|
|
14450
|
+
let type = scope.tsNames.get(name) || 0;
|
|
14526
14451
|
if (bindingType & 1024) {
|
|
14527
14452
|
this.maybeExportDefined(scope, name);
|
|
14528
|
-
scope.
|
|
14453
|
+
scope.tsNames.set(name, type | 16);
|
|
14529
14454
|
return;
|
|
14530
14455
|
}
|
|
14531
14456
|
super.declareName(name, bindingType, loc);
|
|
@@ -14534,33 +14459,38 @@ var require_lib = __commonJS({
|
|
|
14534
14459
|
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
14535
14460
|
this.maybeExportDefined(scope, name);
|
|
14536
14461
|
}
|
|
14537
|
-
|
|
14462
|
+
type = type | 1;
|
|
14463
|
+
}
|
|
14464
|
+
if (bindingType & 256) {
|
|
14465
|
+
type = type | 2;
|
|
14538
14466
|
}
|
|
14539
|
-
if (bindingType & 256)
|
|
14540
|
-
scope.enums.add(name);
|
|
14541
14467
|
if (bindingType & 512) {
|
|
14542
|
-
|
|
14468
|
+
type = type | 4;
|
|
14469
|
+
}
|
|
14470
|
+
if (bindingType & 128) {
|
|
14471
|
+
type = type | 8;
|
|
14543
14472
|
}
|
|
14544
|
-
if (
|
|
14545
|
-
scope.
|
|
14473
|
+
if (type)
|
|
14474
|
+
scope.tsNames.set(name, type);
|
|
14546
14475
|
}
|
|
14547
14476
|
isRedeclaredInScope(scope, name, bindingType) {
|
|
14548
|
-
|
|
14477
|
+
const type = scope.tsNames.get(name);
|
|
14478
|
+
if ((type & 2) > 0) {
|
|
14549
14479
|
if (bindingType & 256) {
|
|
14550
14480
|
const isConst = !!(bindingType & 512);
|
|
14551
|
-
const wasConst =
|
|
14481
|
+
const wasConst = (type & 4) > 0;
|
|
14552
14482
|
return isConst !== wasConst;
|
|
14553
14483
|
}
|
|
14554
14484
|
return true;
|
|
14555
14485
|
}
|
|
14556
|
-
if (bindingType & 128 &&
|
|
14557
|
-
if (scope.
|
|
14486
|
+
if (bindingType & 128 && (type & 8) > 0) {
|
|
14487
|
+
if (scope.names.get(name) & 2) {
|
|
14558
14488
|
return !!(bindingType & 1);
|
|
14559
14489
|
} else {
|
|
14560
14490
|
return false;
|
|
14561
14491
|
}
|
|
14562
14492
|
}
|
|
14563
|
-
if (bindingType & 2 &&
|
|
14493
|
+
if (bindingType & 2 && (type & 1) > 0) {
|
|
14564
14494
|
return true;
|
|
14565
14495
|
}
|
|
14566
14496
|
return super.isRedeclaredInScope(scope, name, bindingType);
|
|
@@ -14574,13 +14504,15 @@ var require_lib = __commonJS({
|
|
|
14574
14504
|
const len = this.scopeStack.length;
|
|
14575
14505
|
for (let i = len - 1; i >= 0; i--) {
|
|
14576
14506
|
const scope = this.scopeStack[i];
|
|
14577
|
-
|
|
14507
|
+
const type = scope.tsNames.get(name);
|
|
14508
|
+
if ((type & 1) > 0 || (type & 16) > 0) {
|
|
14578
14509
|
return;
|
|
14510
|
+
}
|
|
14579
14511
|
}
|
|
14580
14512
|
super.checkLocalExport(id);
|
|
14581
14513
|
}
|
|
14582
14514
|
};
|
|
14583
|
-
var getOwn$1 = (object, key) =>
|
|
14515
|
+
var getOwn$1 = (object, key) => hasOwnProperty.call(object, key) && object[key];
|
|
14584
14516
|
var unwrapParenthesizedExpression = (node) => {
|
|
14585
14517
|
return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
|
|
14586
14518
|
};
|
|
@@ -14592,18 +14524,12 @@ var require_lib = __commonJS({
|
|
|
14592
14524
|
parenthesized = unwrapParenthesizedExpression(node);
|
|
14593
14525
|
if (isLHS) {
|
|
14594
14526
|
if (parenthesized.type === "Identifier") {
|
|
14595
|
-
this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment,
|
|
14596
|
-
at: node
|
|
14597
|
-
});
|
|
14527
|
+
this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, node);
|
|
14598
14528
|
} else if (parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) {
|
|
14599
|
-
this.raise(Errors.InvalidParenthesizedAssignment,
|
|
14600
|
-
at: node
|
|
14601
|
-
});
|
|
14529
|
+
this.raise(Errors.InvalidParenthesizedAssignment, node);
|
|
14602
14530
|
}
|
|
14603
14531
|
} else {
|
|
14604
|
-
this.raise(Errors.InvalidParenthesizedAssignment,
|
|
14605
|
-
at: node
|
|
14606
|
-
});
|
|
14532
|
+
this.raise(Errors.InvalidParenthesizedAssignment, node);
|
|
14607
14533
|
}
|
|
14608
14534
|
}
|
|
14609
14535
|
switch (node.type) {
|
|
@@ -14621,9 +14547,7 @@ var require_lib = __commonJS({
|
|
|
14621
14547
|
const isLast = i === last;
|
|
14622
14548
|
this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
14623
14549
|
if (isLast && prop.type === "RestElement" && (_node$extra2 = node.extra) != null && _node$extra2.trailingCommaLoc) {
|
|
14624
|
-
this.raise(Errors.RestTrailingComma,
|
|
14625
|
-
at: node.extra.trailingCommaLoc
|
|
14626
|
-
});
|
|
14550
|
+
this.raise(Errors.RestTrailingComma, node.extra.trailingCommaLoc);
|
|
14627
14551
|
}
|
|
14628
14552
|
}
|
|
14629
14553
|
break;
|
|
@@ -14647,9 +14571,7 @@ var require_lib = __commonJS({
|
|
|
14647
14571
|
break;
|
|
14648
14572
|
case "AssignmentExpression":
|
|
14649
14573
|
if (node.operator !== "=") {
|
|
14650
|
-
this.raise(Errors.MissingEqInAssignment,
|
|
14651
|
-
at: node.left.loc.end
|
|
14652
|
-
});
|
|
14574
|
+
this.raise(Errors.MissingEqInAssignment, node.left.loc.end);
|
|
14653
14575
|
}
|
|
14654
14576
|
node.type = "AssignmentPattern";
|
|
14655
14577
|
delete node.operator;
|
|
@@ -14662,18 +14584,14 @@ var require_lib = __commonJS({
|
|
|
14662
14584
|
}
|
|
14663
14585
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
14664
14586
|
if (prop.type === "ObjectMethod") {
|
|
14665
|
-
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod,
|
|
14666
|
-
at: prop.key
|
|
14667
|
-
});
|
|
14587
|
+
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, prop.key);
|
|
14668
14588
|
} else if (prop.type === "SpreadElement") {
|
|
14669
14589
|
prop.type = "RestElement";
|
|
14670
14590
|
const arg = prop.argument;
|
|
14671
14591
|
this.checkToRestConversion(arg, false);
|
|
14672
14592
|
this.toAssignable(arg, isLHS);
|
|
14673
14593
|
if (!isLast) {
|
|
14674
|
-
this.raise(Errors.RestTrailingComma,
|
|
14675
|
-
at: prop
|
|
14676
|
-
});
|
|
14594
|
+
this.raise(Errors.RestTrailingComma, prop);
|
|
14677
14595
|
}
|
|
14678
14596
|
} else {
|
|
14679
14597
|
this.toAssignable(prop, isLHS);
|
|
@@ -14695,13 +14613,9 @@ var require_lib = __commonJS({
|
|
|
14695
14613
|
}
|
|
14696
14614
|
if (elt.type === "RestElement") {
|
|
14697
14615
|
if (i < end) {
|
|
14698
|
-
this.raise(Errors.RestTrailingComma,
|
|
14699
|
-
at: elt
|
|
14700
|
-
});
|
|
14616
|
+
this.raise(Errors.RestTrailingComma, elt);
|
|
14701
14617
|
} else if (trailingCommaLoc) {
|
|
14702
|
-
this.raise(Errors.RestTrailingComma,
|
|
14703
|
-
at: trailingCommaLoc
|
|
14704
|
-
});
|
|
14618
|
+
this.raise(Errors.RestTrailingComma, trailingCommaLoc);
|
|
14705
14619
|
}
|
|
14706
14620
|
}
|
|
14707
14621
|
}
|
|
@@ -14796,9 +14710,7 @@ var require_lib = __commonJS({
|
|
|
14796
14710
|
} else {
|
|
14797
14711
|
const decorators = [];
|
|
14798
14712
|
if (this.match(26) && this.hasPlugin("decorators")) {
|
|
14799
|
-
this.raise(Errors.UnsupportedParameterDecorator,
|
|
14800
|
-
at: this.state.startLoc
|
|
14801
|
-
});
|
|
14713
|
+
this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc);
|
|
14802
14714
|
}
|
|
14803
14715
|
while (this.match(26)) {
|
|
14804
14716
|
decorators.push(this.parseDecorator());
|
|
@@ -14884,16 +14796,13 @@ var require_lib = __commonJS({
|
|
|
14884
14796
|
if (isOptionalMemberExpression) {
|
|
14885
14797
|
this.expectPlugin("optionalChainingAssign", expression.loc.start);
|
|
14886
14798
|
if (ancestor.type !== "AssignmentExpression") {
|
|
14887
|
-
this.raise(Errors.InvalidLhsOptionalChaining, {
|
|
14888
|
-
at: expression,
|
|
14799
|
+
this.raise(Errors.InvalidLhsOptionalChaining, expression, {
|
|
14889
14800
|
ancestor
|
|
14890
14801
|
});
|
|
14891
14802
|
}
|
|
14892
14803
|
}
|
|
14893
14804
|
if (binding !== 64) {
|
|
14894
|
-
this.raise(Errors.InvalidPropertyBindingPattern,
|
|
14895
|
-
at: expression
|
|
14896
|
-
});
|
|
14805
|
+
this.raise(Errors.InvalidPropertyBindingPattern, expression);
|
|
14897
14806
|
}
|
|
14898
14807
|
return;
|
|
14899
14808
|
}
|
|
@@ -14904,9 +14813,7 @@ var require_lib = __commonJS({
|
|
|
14904
14813
|
} = expression;
|
|
14905
14814
|
if (checkClashes) {
|
|
14906
14815
|
if (checkClashes.has(name)) {
|
|
14907
|
-
this.raise(Errors.ParamDupe,
|
|
14908
|
-
at: expression
|
|
14909
|
-
});
|
|
14816
|
+
this.raise(Errors.ParamDupe, expression);
|
|
14910
14817
|
} else {
|
|
14911
14818
|
checkClashes.add(name);
|
|
14912
14819
|
}
|
|
@@ -14918,8 +14825,7 @@ var require_lib = __commonJS({
|
|
|
14918
14825
|
return;
|
|
14919
14826
|
if (validity === false) {
|
|
14920
14827
|
const ParseErrorClass = binding === 64 ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
|
|
14921
|
-
this.raise(ParseErrorClass, {
|
|
14922
|
-
at: expression,
|
|
14828
|
+
this.raise(ParseErrorClass, expression, {
|
|
14923
14829
|
ancestor
|
|
14924
14830
|
});
|
|
14925
14831
|
return;
|
|
@@ -14943,21 +14849,17 @@ var require_lib = __commonJS({
|
|
|
14943
14849
|
checkIdentifier(at, bindingType, strictModeChanged = false) {
|
|
14944
14850
|
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
|
|
14945
14851
|
if (bindingType === 64) {
|
|
14946
|
-
this.raise(Errors.StrictEvalArguments, {
|
|
14947
|
-
at,
|
|
14852
|
+
this.raise(Errors.StrictEvalArguments, at, {
|
|
14948
14853
|
referenceName: at.name
|
|
14949
14854
|
});
|
|
14950
14855
|
} else {
|
|
14951
|
-
this.raise(Errors.StrictEvalArgumentsBinding, {
|
|
14952
|
-
at,
|
|
14856
|
+
this.raise(Errors.StrictEvalArgumentsBinding, at, {
|
|
14953
14857
|
bindingName: at.name
|
|
14954
14858
|
});
|
|
14955
14859
|
}
|
|
14956
14860
|
}
|
|
14957
14861
|
if (bindingType & 8192 && at.name === "let") {
|
|
14958
|
-
this.raise(Errors.LetInLexicalBinding,
|
|
14959
|
-
at
|
|
14960
|
-
});
|
|
14862
|
+
this.raise(Errors.LetInLexicalBinding, at);
|
|
14961
14863
|
}
|
|
14962
14864
|
if (!(bindingType & 64)) {
|
|
14963
14865
|
this.declareNameFromIdentifier(at, bindingType);
|
|
@@ -14979,22 +14881,18 @@ var require_lib = __commonJS({
|
|
|
14979
14881
|
if (allowPattern)
|
|
14980
14882
|
break;
|
|
14981
14883
|
default:
|
|
14982
|
-
this.raise(Errors.InvalidRestAssignmentPattern,
|
|
14983
|
-
at: node
|
|
14984
|
-
});
|
|
14884
|
+
this.raise(Errors.InvalidRestAssignmentPattern, node);
|
|
14985
14885
|
}
|
|
14986
14886
|
}
|
|
14987
14887
|
checkCommaAfterRest(close) {
|
|
14988
14888
|
if (!this.match(12)) {
|
|
14989
14889
|
return false;
|
|
14990
14890
|
}
|
|
14991
|
-
this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest,
|
|
14992
|
-
at: this.state.startLoc
|
|
14993
|
-
});
|
|
14891
|
+
this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, this.state.startLoc);
|
|
14994
14892
|
return true;
|
|
14995
14893
|
}
|
|
14996
14894
|
};
|
|
14997
|
-
var getOwn = (object, key) =>
|
|
14895
|
+
var getOwn = (object, key) => hasOwnProperty.call(object, key) && object[key];
|
|
14998
14896
|
function nonNull(x) {
|
|
14999
14897
|
if (x == null) {
|
|
15000
14898
|
throw new Error(`Unexpected ${x} value.`);
|
|
@@ -15186,16 +15084,14 @@ var require_lib = __commonJS({
|
|
|
15186
15084
|
}, modified) {
|
|
15187
15085
|
const enforceOrder = (loc, modifier, before, after) => {
|
|
15188
15086
|
if (modifier === before && modified[after]) {
|
|
15189
|
-
this.raise(TSErrors.InvalidModifiersOrder, {
|
|
15190
|
-
at: loc,
|
|
15087
|
+
this.raise(TSErrors.InvalidModifiersOrder, loc, {
|
|
15191
15088
|
orderedModifiers: [before, after]
|
|
15192
15089
|
});
|
|
15193
15090
|
}
|
|
15194
15091
|
};
|
|
15195
15092
|
const incompatible = (loc, modifier, mod1, mod2) => {
|
|
15196
15093
|
if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) {
|
|
15197
|
-
this.raise(TSErrors.IncompatibleModifiers, {
|
|
15198
|
-
at: loc,
|
|
15094
|
+
this.raise(TSErrors.IncompatibleModifiers, loc, {
|
|
15199
15095
|
modifiers: [mod1, mod2]
|
|
15200
15096
|
});
|
|
15201
15097
|
}
|
|
@@ -15209,8 +15105,7 @@ var require_lib = __commonJS({
|
|
|
15209
15105
|
break;
|
|
15210
15106
|
if (tsIsAccessModifier(modifier)) {
|
|
15211
15107
|
if (modified.accessibility) {
|
|
15212
|
-
this.raise(TSErrors.DuplicateAccessibilityModifier, {
|
|
15213
|
-
at: startLoc,
|
|
15108
|
+
this.raise(TSErrors.DuplicateAccessibilityModifier, startLoc, {
|
|
15214
15109
|
modifier
|
|
15215
15110
|
});
|
|
15216
15111
|
} else {
|
|
@@ -15221,17 +15116,15 @@ var require_lib = __commonJS({
|
|
|
15221
15116
|
}
|
|
15222
15117
|
} else if (tsIsVarianceAnnotations(modifier)) {
|
|
15223
15118
|
if (modified[modifier]) {
|
|
15224
|
-
this.raise(TSErrors.DuplicateModifier, {
|
|
15225
|
-
at: startLoc,
|
|
15119
|
+
this.raise(TSErrors.DuplicateModifier, startLoc, {
|
|
15226
15120
|
modifier
|
|
15227
15121
|
});
|
|
15228
15122
|
}
|
|
15229
15123
|
modified[modifier] = true;
|
|
15230
15124
|
enforceOrder(startLoc, modifier, "in", "out");
|
|
15231
15125
|
} else {
|
|
15232
|
-
if (
|
|
15233
|
-
this.raise(TSErrors.DuplicateModifier, {
|
|
15234
|
-
at: startLoc,
|
|
15126
|
+
if (hasOwnProperty.call(modified, modifier)) {
|
|
15127
|
+
this.raise(TSErrors.DuplicateModifier, startLoc, {
|
|
15235
15128
|
modifier
|
|
15236
15129
|
});
|
|
15237
15130
|
} else {
|
|
@@ -15245,8 +15138,7 @@ var require_lib = __commonJS({
|
|
|
15245
15138
|
modified[modifier] = true;
|
|
15246
15139
|
}
|
|
15247
15140
|
if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
|
|
15248
|
-
this.raise(errorTemplate, {
|
|
15249
|
-
at: startLoc,
|
|
15141
|
+
this.raise(errorTemplate, startLoc, {
|
|
15250
15142
|
modifier
|
|
15251
15143
|
});
|
|
15252
15144
|
}
|
|
@@ -15289,7 +15181,7 @@ var require_lib = __commonJS({
|
|
|
15289
15181
|
}
|
|
15290
15182
|
result.push(element);
|
|
15291
15183
|
if (this.eat(12)) {
|
|
15292
|
-
trailingCommaPos = this.state.
|
|
15184
|
+
trailingCommaPos = this.state.lastTokStartLoc.index;
|
|
15293
15185
|
continue;
|
|
15294
15186
|
}
|
|
15295
15187
|
if (this.tsIsListTerminator(kind)) {
|
|
@@ -15326,11 +15218,19 @@ var require_lib = __commonJS({
|
|
|
15326
15218
|
this.expect(83);
|
|
15327
15219
|
this.expect(10);
|
|
15328
15220
|
if (!this.match(133)) {
|
|
15329
|
-
this.raise(TSErrors.UnsupportedImportTypeArgument,
|
|
15330
|
-
at: this.state.startLoc
|
|
15331
|
-
});
|
|
15221
|
+
this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
|
|
15332
15222
|
}
|
|
15333
15223
|
node.argument = super.parseExprAtom();
|
|
15224
|
+
if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
|
|
15225
|
+
node.options = null;
|
|
15226
|
+
}
|
|
15227
|
+
if (this.eat(12)) {
|
|
15228
|
+
this.expectImportAttributesPlugin();
|
|
15229
|
+
if (!this.match(11)) {
|
|
15230
|
+
node.options = super.parseMaybeAssignAllowIn();
|
|
15231
|
+
this.eat(12);
|
|
15232
|
+
}
|
|
15233
|
+
}
|
|
15334
15234
|
this.expect(11);
|
|
15335
15235
|
if (this.eat(16)) {
|
|
15336
15236
|
node.qualifier = this.tsParseEntityName();
|
|
@@ -15409,9 +15309,7 @@ var require_lib = __commonJS({
|
|
|
15409
15309
|
};
|
|
15410
15310
|
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
15411
15311
|
if (node.params.length === 0) {
|
|
15412
|
-
this.raise(TSErrors.EmptyTypeParameters,
|
|
15413
|
-
at: node
|
|
15414
|
-
});
|
|
15312
|
+
this.raise(TSErrors.EmptyTypeParameters, node);
|
|
15415
15313
|
}
|
|
15416
15314
|
if (refTrailingCommaPos.value !== -1) {
|
|
15417
15315
|
this.addExtra(node, "trailingComma", refTrailingCommaPos.value);
|
|
@@ -15438,8 +15336,7 @@ var require_lib = __commonJS({
|
|
|
15438
15336
|
type
|
|
15439
15337
|
} = pattern;
|
|
15440
15338
|
if (type === "AssignmentPattern" || type === "TSParameterProperty") {
|
|
15441
|
-
this.raise(TSErrors.UnsupportedSignatureParameterKind, {
|
|
15442
|
-
at: pattern,
|
|
15339
|
+
this.raise(TSErrors.UnsupportedSignatureParameterKind, pattern, {
|
|
15443
15340
|
type
|
|
15444
15341
|
});
|
|
15445
15342
|
}
|
|
@@ -15486,15 +15383,11 @@ var require_lib = __commonJS({
|
|
|
15486
15383
|
const nodeAny = node;
|
|
15487
15384
|
if (this.match(10) || this.match(47)) {
|
|
15488
15385
|
if (readonly) {
|
|
15489
|
-
this.raise(TSErrors.ReadonlyForMethodSignature,
|
|
15490
|
-
at: node
|
|
15491
|
-
});
|
|
15386
|
+
this.raise(TSErrors.ReadonlyForMethodSignature, node);
|
|
15492
15387
|
}
|
|
15493
15388
|
const method = nodeAny;
|
|
15494
15389
|
if (method.kind && this.match(47)) {
|
|
15495
|
-
this.raise(TSErrors.AccesorCannotHaveTypeParameters,
|
|
15496
|
-
at: this.state.curPosition()
|
|
15497
|
-
});
|
|
15390
|
+
this.raise(TSErrors.AccesorCannotHaveTypeParameters, this.state.curPosition());
|
|
15498
15391
|
}
|
|
15499
15392
|
this.tsFillSignature(14, method);
|
|
15500
15393
|
this.tsParseTypeMemberSemicolon();
|
|
@@ -15502,42 +15395,28 @@ var require_lib = __commonJS({
|
|
|
15502
15395
|
const returnTypeKey = "typeAnnotation";
|
|
15503
15396
|
if (method.kind === "get") {
|
|
15504
15397
|
if (method[paramsKey].length > 0) {
|
|
15505
|
-
this.raise(Errors.BadGetterArity,
|
|
15506
|
-
at: this.state.curPosition()
|
|
15507
|
-
});
|
|
15398
|
+
this.raise(Errors.BadGetterArity, this.state.curPosition());
|
|
15508
15399
|
if (this.isThisParam(method[paramsKey][0])) {
|
|
15509
|
-
this.raise(TSErrors.AccesorCannotDeclareThisParameter,
|
|
15510
|
-
at: this.state.curPosition()
|
|
15511
|
-
});
|
|
15400
|
+
this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
|
|
15512
15401
|
}
|
|
15513
15402
|
}
|
|
15514
15403
|
} else if (method.kind === "set") {
|
|
15515
15404
|
if (method[paramsKey].length !== 1) {
|
|
15516
|
-
this.raise(Errors.BadSetterArity,
|
|
15517
|
-
at: this.state.curPosition()
|
|
15518
|
-
});
|
|
15405
|
+
this.raise(Errors.BadSetterArity, this.state.curPosition());
|
|
15519
15406
|
} else {
|
|
15520
15407
|
const firstParameter = method[paramsKey][0];
|
|
15521
15408
|
if (this.isThisParam(firstParameter)) {
|
|
15522
|
-
this.raise(TSErrors.AccesorCannotDeclareThisParameter,
|
|
15523
|
-
at: this.state.curPosition()
|
|
15524
|
-
});
|
|
15409
|
+
this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
|
|
15525
15410
|
}
|
|
15526
15411
|
if (firstParameter.type === "Identifier" && firstParameter.optional) {
|
|
15527
|
-
this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter,
|
|
15528
|
-
at: this.state.curPosition()
|
|
15529
|
-
});
|
|
15412
|
+
this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, this.state.curPosition());
|
|
15530
15413
|
}
|
|
15531
15414
|
if (firstParameter.type === "RestElement") {
|
|
15532
|
-
this.raise(TSErrors.SetAccesorCannotHaveRestParameter,
|
|
15533
|
-
at: this.state.curPosition()
|
|
15534
|
-
});
|
|
15415
|
+
this.raise(TSErrors.SetAccesorCannotHaveRestParameter, this.state.curPosition());
|
|
15535
15416
|
}
|
|
15536
15417
|
}
|
|
15537
15418
|
if (method[returnTypeKey]) {
|
|
15538
|
-
this.raise(TSErrors.SetAccesorCannotHaveReturnType,
|
|
15539
|
-
at: method[returnTypeKey]
|
|
15540
|
-
});
|
|
15419
|
+
this.raise(TSErrors.SetAccesorCannotHaveReturnType, method[returnTypeKey]);
|
|
15541
15420
|
}
|
|
15542
15421
|
} else {
|
|
15543
15422
|
method.kind = "method";
|
|
@@ -15654,9 +15533,7 @@ var require_lib = __commonJS({
|
|
|
15654
15533
|
type
|
|
15655
15534
|
} = elementNode;
|
|
15656
15535
|
if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) {
|
|
15657
|
-
this.raise(TSErrors.OptionalTypeBeforeRequired,
|
|
15658
|
-
at: elementNode
|
|
15659
|
-
});
|
|
15536
|
+
this.raise(TSErrors.OptionalTypeBeforeRequired, elementNode);
|
|
15660
15537
|
}
|
|
15661
15538
|
seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
|
|
15662
15539
|
});
|
|
@@ -15709,16 +15586,12 @@ var require_lib = __commonJS({
|
|
|
15709
15586
|
labeledNode.elementType = type;
|
|
15710
15587
|
if (this.eat(17)) {
|
|
15711
15588
|
labeledNode.optional = true;
|
|
15712
|
-
this.raise(TSErrors.TupleOptionalAfterType,
|
|
15713
|
-
at: this.state.lastTokStartLoc
|
|
15714
|
-
});
|
|
15589
|
+
this.raise(TSErrors.TupleOptionalAfterType, this.state.lastTokStartLoc);
|
|
15715
15590
|
}
|
|
15716
15591
|
} else {
|
|
15717
15592
|
labeledNode = this.startNodeAtNode(type);
|
|
15718
15593
|
labeledNode.optional = optional;
|
|
15719
|
-
this.raise(TSErrors.InvalidTupleMemberLabel,
|
|
15720
|
-
at: type
|
|
15721
|
-
});
|
|
15594
|
+
this.raise(TSErrors.InvalidTupleMemberLabel, type);
|
|
15722
15595
|
labeledNode.label = type;
|
|
15723
15596
|
labeledNode.elementType = this.tsParseType();
|
|
15724
15597
|
}
|
|
@@ -15872,9 +15745,7 @@ var require_lib = __commonJS({
|
|
|
15872
15745
|
case "TSArrayType":
|
|
15873
15746
|
return;
|
|
15874
15747
|
default:
|
|
15875
|
-
this.raise(TSErrors.UnexpectedReadonly,
|
|
15876
|
-
at: node
|
|
15877
|
-
});
|
|
15748
|
+
this.raise(TSErrors.UnexpectedReadonly, node);
|
|
15878
15749
|
}
|
|
15879
15750
|
}
|
|
15880
15751
|
tsParseInferType() {
|
|
@@ -16042,8 +15913,7 @@ var require_lib = __commonJS({
|
|
|
16042
15913
|
return false;
|
|
16043
15914
|
}
|
|
16044
15915
|
if (containsEsc) {
|
|
16045
|
-
this.raise(Errors.InvalidEscapedReservedWord, {
|
|
16046
|
-
at: this.state.lastTokStartLoc,
|
|
15916
|
+
this.raise(Errors.InvalidEscapedReservedWord, this.state.lastTokStartLoc, {
|
|
16047
15917
|
reservedWord: "asserts"
|
|
16048
15918
|
});
|
|
16049
15919
|
}
|
|
@@ -16088,9 +15958,7 @@ var require_lib = __commonJS({
|
|
|
16088
15958
|
}
|
|
16089
15959
|
tsParseTypeAssertion() {
|
|
16090
15960
|
if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
|
|
16091
|
-
this.raise(TSErrors.ReservedTypeAssertion,
|
|
16092
|
-
at: this.state.startLoc
|
|
16093
|
-
});
|
|
15961
|
+
this.raise(TSErrors.ReservedTypeAssertion, this.state.startLoc);
|
|
16094
15962
|
}
|
|
16095
15963
|
const node = this.startNode();
|
|
16096
15964
|
node.typeAnnotation = this.tsInType(() => {
|
|
@@ -16112,8 +15980,7 @@ var require_lib = __commonJS({
|
|
|
16112
15980
|
return this.finishNode(node, "TSExpressionWithTypeArguments");
|
|
16113
15981
|
});
|
|
16114
15982
|
if (!delimitedList.length) {
|
|
16115
|
-
this.raise(TSErrors.EmptyHeritageClauseType, {
|
|
16116
|
-
at: originalStartLoc,
|
|
15983
|
+
this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
|
|
16117
15984
|
token
|
|
16118
15985
|
});
|
|
16119
15986
|
}
|
|
@@ -16130,9 +15997,7 @@ var require_lib = __commonJS({
|
|
|
16130
15997
|
this.checkIdentifier(node.id, 130);
|
|
16131
15998
|
} else {
|
|
16132
15999
|
node.id = null;
|
|
16133
|
-
this.raise(TSErrors.MissingInterfaceName,
|
|
16134
|
-
at: this.state.startLoc
|
|
16135
|
-
});
|
|
16000
|
+
this.raise(TSErrors.MissingInterfaceName, this.state.startLoc);
|
|
16136
16001
|
}
|
|
16137
16002
|
node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
|
|
16138
16003
|
if (this.eat(81)) {
|
|
@@ -16286,9 +16151,7 @@ var require_lib = __commonJS({
|
|
|
16286
16151
|
this.expect(29);
|
|
16287
16152
|
const moduleReference = this.tsParseModuleReference();
|
|
16288
16153
|
if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
|
|
16289
|
-
this.raise(TSErrors.ImportAliasHasImportType,
|
|
16290
|
-
at: moduleReference
|
|
16291
|
-
});
|
|
16154
|
+
this.raise(TSErrors.ImportAliasHasImportType, moduleReference);
|
|
16292
16155
|
}
|
|
16293
16156
|
node.moduleReference = moduleReference;
|
|
16294
16157
|
this.semicolon();
|
|
@@ -16479,9 +16342,7 @@ var require_lib = __commonJS({
|
|
|
16479
16342
|
return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
|
|
16480
16343
|
}));
|
|
16481
16344
|
if (node.params.length === 0) {
|
|
16482
|
-
this.raise(TSErrors.EmptyTypeArguments,
|
|
16483
|
-
at: node
|
|
16484
|
-
});
|
|
16345
|
+
this.raise(TSErrors.EmptyTypeArguments, node);
|
|
16485
16346
|
} else if (!this.state.inType && this.curContext() === types.brace) {
|
|
16486
16347
|
this.reScan_lt_gt();
|
|
16487
16348
|
}
|
|
@@ -16506,9 +16367,7 @@ var require_lib = __commonJS({
|
|
|
16506
16367
|
const override = modified.override;
|
|
16507
16368
|
const readonly = modified.readonly;
|
|
16508
16369
|
if (!(flags & 4) && (accessibility || readonly || override)) {
|
|
16509
|
-
this.raise(TSErrors.UnexpectedParameterModifier,
|
|
16510
|
-
at: startLoc
|
|
16511
|
-
});
|
|
16370
|
+
this.raise(TSErrors.UnexpectedParameterModifier, startLoc);
|
|
16512
16371
|
}
|
|
16513
16372
|
const left = this.parseMaybeDefault();
|
|
16514
16373
|
this.parseAssignableListItemTypes(left, flags);
|
|
@@ -16525,9 +16384,7 @@ var require_lib = __commonJS({
|
|
|
16525
16384
|
if (override)
|
|
16526
16385
|
pp.override = override;
|
|
16527
16386
|
if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
|
|
16528
|
-
this.raise(TSErrors.UnsupportedParameterPropertyKind,
|
|
16529
|
-
at: pp
|
|
16530
|
-
});
|
|
16387
|
+
this.raise(TSErrors.UnsupportedParameterPropertyKind, pp);
|
|
16531
16388
|
}
|
|
16532
16389
|
pp.parameter = elt;
|
|
16533
16390
|
return this.finishNode(pp, "TSParameterProperty");
|
|
@@ -16543,9 +16400,7 @@ var require_lib = __commonJS({
|
|
|
16543
16400
|
tsDisallowOptionalPattern(node) {
|
|
16544
16401
|
for (const param of node.params) {
|
|
16545
16402
|
if (param.type !== "Identifier" && param.optional && !this.state.isAmbientContext) {
|
|
16546
|
-
this.raise(TSErrors.PatternIsOptional,
|
|
16547
|
-
at: param
|
|
16548
|
-
});
|
|
16403
|
+
this.raise(TSErrors.PatternIsOptional, param);
|
|
16549
16404
|
}
|
|
16550
16405
|
}
|
|
16551
16406
|
}
|
|
@@ -16562,9 +16417,7 @@ var require_lib = __commonJS({
|
|
|
16562
16417
|
return this.finishNode(node, bodilessType);
|
|
16563
16418
|
}
|
|
16564
16419
|
if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
|
|
16565
|
-
this.raise(TSErrors.DeclareFunctionHasImplementation,
|
|
16566
|
-
at: node
|
|
16567
|
-
});
|
|
16420
|
+
this.raise(TSErrors.DeclareFunctionHasImplementation, node);
|
|
16568
16421
|
if (node.declare) {
|
|
16569
16422
|
return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
|
|
16570
16423
|
}
|
|
@@ -16582,9 +16435,7 @@ var require_lib = __commonJS({
|
|
|
16582
16435
|
tsCheckForInvalidTypeCasts(items) {
|
|
16583
16436
|
items.forEach((node) => {
|
|
16584
16437
|
if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") {
|
|
16585
|
-
this.raise(TSErrors.UnexpectedTypeAnnotation,
|
|
16586
|
-
at: node.typeAnnotation
|
|
16587
|
-
});
|
|
16438
|
+
this.raise(TSErrors.UnexpectedTypeAnnotation, node.typeAnnotation);
|
|
16588
16439
|
}
|
|
16589
16440
|
});
|
|
16590
16441
|
}
|
|
@@ -16662,9 +16513,7 @@ var require_lib = __commonJS({
|
|
|
16662
16513
|
}
|
|
16663
16514
|
if (result) {
|
|
16664
16515
|
if (result.type === "TSInstantiationExpression" && (this.match(16) || this.match(18) && this.lookaheadCharCode() !== 40)) {
|
|
16665
|
-
this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression,
|
|
16666
|
-
at: this.state.startLoc
|
|
16667
|
-
});
|
|
16516
|
+
this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, this.state.startLoc);
|
|
16668
16517
|
}
|
|
16669
16518
|
return result;
|
|
16670
16519
|
}
|
|
@@ -16691,8 +16540,7 @@ var require_lib = __commonJS({
|
|
|
16691
16540
|
this.next();
|
|
16692
16541
|
if (this.match(75)) {
|
|
16693
16542
|
if (isSatisfies) {
|
|
16694
|
-
this.raise(Errors.UnexpectedKeyword, {
|
|
16695
|
-
at: this.state.startLoc,
|
|
16543
|
+
this.raise(Errors.UnexpectedKeyword, this.state.startLoc, {
|
|
16696
16544
|
keyword: "const"
|
|
16697
16545
|
});
|
|
16698
16546
|
}
|
|
@@ -16714,9 +16562,7 @@ var require_lib = __commonJS({
|
|
|
16714
16562
|
checkImportReflection(node) {
|
|
16715
16563
|
super.checkImportReflection(node);
|
|
16716
16564
|
if (node.module && node.importKind !== "value") {
|
|
16717
|
-
this.raise(TSErrors.ImportReflectionHasImportType,
|
|
16718
|
-
at: node.specifiers[0].loc.start
|
|
16719
|
-
});
|
|
16565
|
+
this.raise(TSErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
|
|
16720
16566
|
}
|
|
16721
16567
|
}
|
|
16722
16568
|
checkDuplicateExports() {
|
|
@@ -16758,9 +16604,7 @@ var require_lib = __commonJS({
|
|
|
16758
16604
|
importNode = super.parseImport(node);
|
|
16759
16605
|
}
|
|
16760
16606
|
if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
|
|
16761
|
-
this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed,
|
|
16762
|
-
at: importNode
|
|
16763
|
-
});
|
|
16607
|
+
this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, importNode);
|
|
16764
16608
|
}
|
|
16765
16609
|
return importNode;
|
|
16766
16610
|
}
|
|
@@ -16821,13 +16665,9 @@ var require_lib = __commonJS({
|
|
|
16821
16665
|
if (!init)
|
|
16822
16666
|
continue;
|
|
16823
16667
|
if (kind !== "const" || !!id.typeAnnotation) {
|
|
16824
|
-
this.raise(TSErrors.InitializerNotAllowedInAmbientContext,
|
|
16825
|
-
at: init
|
|
16826
|
-
});
|
|
16668
|
+
this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init);
|
|
16827
16669
|
} else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
|
|
16828
|
-
this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference,
|
|
16829
|
-
at: init
|
|
16830
|
-
});
|
|
16670
|
+
this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, init);
|
|
16831
16671
|
}
|
|
16832
16672
|
}
|
|
16833
16673
|
return declaration;
|
|
@@ -16877,9 +16717,7 @@ var require_lib = __commonJS({
|
|
|
16877
16717
|
this.next();
|
|
16878
16718
|
this.next();
|
|
16879
16719
|
if (this.tsHasSomeModifiers(member, modifiers)) {
|
|
16880
|
-
this.raise(TSErrors.StaticBlockCannotHaveModifier,
|
|
16881
|
-
at: this.state.curPosition()
|
|
16882
|
-
});
|
|
16720
|
+
this.raise(TSErrors.StaticBlockCannotHaveModifier, this.state.curPosition());
|
|
16883
16721
|
}
|
|
16884
16722
|
super.parseClassStaticBlock(classBody, member);
|
|
16885
16723
|
} else {
|
|
@@ -16897,38 +16735,27 @@ var require_lib = __commonJS({
|
|
|
16897
16735
|
if (idx) {
|
|
16898
16736
|
classBody.body.push(idx);
|
|
16899
16737
|
if (member.abstract) {
|
|
16900
|
-
this.raise(TSErrors.IndexSignatureHasAbstract,
|
|
16901
|
-
at: member
|
|
16902
|
-
});
|
|
16738
|
+
this.raise(TSErrors.IndexSignatureHasAbstract, member);
|
|
16903
16739
|
}
|
|
16904
16740
|
if (member.accessibility) {
|
|
16905
|
-
this.raise(TSErrors.IndexSignatureHasAccessibility, {
|
|
16906
|
-
at: member,
|
|
16741
|
+
this.raise(TSErrors.IndexSignatureHasAccessibility, member, {
|
|
16907
16742
|
modifier: member.accessibility
|
|
16908
16743
|
});
|
|
16909
16744
|
}
|
|
16910
16745
|
if (member.declare) {
|
|
16911
|
-
this.raise(TSErrors.IndexSignatureHasDeclare,
|
|
16912
|
-
at: member
|
|
16913
|
-
});
|
|
16746
|
+
this.raise(TSErrors.IndexSignatureHasDeclare, member);
|
|
16914
16747
|
}
|
|
16915
16748
|
if (member.override) {
|
|
16916
|
-
this.raise(TSErrors.IndexSignatureHasOverride,
|
|
16917
|
-
at: member
|
|
16918
|
-
});
|
|
16749
|
+
this.raise(TSErrors.IndexSignatureHasOverride, member);
|
|
16919
16750
|
}
|
|
16920
16751
|
return;
|
|
16921
16752
|
}
|
|
16922
16753
|
if (!this.state.inAbstractClass && member.abstract) {
|
|
16923
|
-
this.raise(TSErrors.NonAbstractClassHasAbstractMethod,
|
|
16924
|
-
at: member
|
|
16925
|
-
});
|
|
16754
|
+
this.raise(TSErrors.NonAbstractClassHasAbstractMethod, member);
|
|
16926
16755
|
}
|
|
16927
16756
|
if (member.override) {
|
|
16928
16757
|
if (!state.hadSuperClass) {
|
|
16929
|
-
this.raise(TSErrors.OverrideNotInSubClass,
|
|
16930
|
-
at: member
|
|
16931
|
-
});
|
|
16758
|
+
this.raise(TSErrors.OverrideNotInSubClass, member);
|
|
16932
16759
|
}
|
|
16933
16760
|
}
|
|
16934
16761
|
super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
|
|
@@ -16938,14 +16765,10 @@ var require_lib = __commonJS({
|
|
|
16938
16765
|
if (optional)
|
|
16939
16766
|
methodOrProp.optional = true;
|
|
16940
16767
|
if (methodOrProp.readonly && this.match(10)) {
|
|
16941
|
-
this.raise(TSErrors.ClassMethodHasReadonly,
|
|
16942
|
-
at: methodOrProp
|
|
16943
|
-
});
|
|
16768
|
+
this.raise(TSErrors.ClassMethodHasReadonly, methodOrProp);
|
|
16944
16769
|
}
|
|
16945
16770
|
if (methodOrProp.declare && this.match(10)) {
|
|
16946
|
-
this.raise(TSErrors.ClassMethodHasDeclare,
|
|
16947
|
-
at: methodOrProp
|
|
16948
|
-
});
|
|
16771
|
+
this.raise(TSErrors.ClassMethodHasDeclare, methodOrProp);
|
|
16949
16772
|
}
|
|
16950
16773
|
}
|
|
16951
16774
|
parseExpressionStatement(node, expr, decorators) {
|
|
@@ -16993,9 +16816,7 @@ var require_lib = __commonJS({
|
|
|
16993
16816
|
const startLoc = this.state.startLoc;
|
|
16994
16817
|
const isDeclare = this.eatContextual(125);
|
|
16995
16818
|
if (isDeclare && (this.isContextual(125) || !this.shouldParseExportDeclaration())) {
|
|
16996
|
-
throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare,
|
|
16997
|
-
at: this.state.startLoc
|
|
16998
|
-
});
|
|
16819
|
+
throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
|
|
16999
16820
|
}
|
|
17000
16821
|
const isIdentifier = tokenIsIdentifier(this.state.type);
|
|
17001
16822
|
const declaration = isIdentifier && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
|
|
@@ -17034,16 +16855,13 @@ var require_lib = __commonJS({
|
|
|
17034
16855
|
parseClassProperty(node) {
|
|
17035
16856
|
this.parseClassPropertyAnnotation(node);
|
|
17036
16857
|
if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) {
|
|
17037
|
-
this.raise(TSErrors.DeclareClassFieldHasInitializer,
|
|
17038
|
-
at: this.state.startLoc
|
|
17039
|
-
});
|
|
16858
|
+
this.raise(TSErrors.DeclareClassFieldHasInitializer, this.state.startLoc);
|
|
17040
16859
|
}
|
|
17041
16860
|
if (node.abstract && this.match(29)) {
|
|
17042
16861
|
const {
|
|
17043
16862
|
key
|
|
17044
16863
|
} = node;
|
|
17045
|
-
this.raise(TSErrors.AbstractPropertyHasInitializer, {
|
|
17046
|
-
at: this.state.startLoc,
|
|
16864
|
+
this.raise(TSErrors.AbstractPropertyHasInitializer, this.state.startLoc, {
|
|
17047
16865
|
propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
|
|
17048
16866
|
});
|
|
17049
16867
|
}
|
|
@@ -17051,13 +16869,10 @@ var require_lib = __commonJS({
|
|
|
17051
16869
|
}
|
|
17052
16870
|
parseClassPrivateProperty(node) {
|
|
17053
16871
|
if (node.abstract) {
|
|
17054
|
-
this.raise(TSErrors.PrivateElementHasAbstract,
|
|
17055
|
-
at: node
|
|
17056
|
-
});
|
|
16872
|
+
this.raise(TSErrors.PrivateElementHasAbstract, node);
|
|
17057
16873
|
}
|
|
17058
16874
|
if (node.accessibility) {
|
|
17059
|
-
this.raise(TSErrors.PrivateElementHasAccessibility, {
|
|
17060
|
-
at: node,
|
|
16875
|
+
this.raise(TSErrors.PrivateElementHasAccessibility, node, {
|
|
17061
16876
|
modifier: node.accessibility
|
|
17062
16877
|
});
|
|
17063
16878
|
}
|
|
@@ -17067,26 +16882,21 @@ var require_lib = __commonJS({
|
|
|
17067
16882
|
parseClassAccessorProperty(node) {
|
|
17068
16883
|
this.parseClassPropertyAnnotation(node);
|
|
17069
16884
|
if (node.optional) {
|
|
17070
|
-
this.raise(TSErrors.AccessorCannotBeOptional,
|
|
17071
|
-
at: node
|
|
17072
|
-
});
|
|
16885
|
+
this.raise(TSErrors.AccessorCannotBeOptional, node);
|
|
17073
16886
|
}
|
|
17074
16887
|
return super.parseClassAccessorProperty(node);
|
|
17075
16888
|
}
|
|
17076
16889
|
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
|
17077
16890
|
const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
|
|
17078
16891
|
if (typeParameters && isConstructor) {
|
|
17079
|
-
this.raise(TSErrors.ConstructorHasTypeParameters,
|
|
17080
|
-
at: typeParameters
|
|
17081
|
-
});
|
|
16892
|
+
this.raise(TSErrors.ConstructorHasTypeParameters, typeParameters);
|
|
17082
16893
|
}
|
|
17083
16894
|
const {
|
|
17084
16895
|
declare = false,
|
|
17085
16896
|
kind
|
|
17086
16897
|
} = method;
|
|
17087
16898
|
if (declare && (kind === "get" || kind === "set")) {
|
|
17088
|
-
this.raise(TSErrors.DeclareAccessor, {
|
|
17089
|
-
at: method,
|
|
16899
|
+
this.raise(TSErrors.DeclareAccessor, method, {
|
|
17090
16900
|
kind
|
|
17091
16901
|
});
|
|
17092
16902
|
}
|
|
@@ -17212,9 +17022,7 @@ var require_lib = __commonJS({
|
|
|
17212
17022
|
reportReservedArrowTypeParam(node) {
|
|
17213
17023
|
var _node$extra;
|
|
17214
17024
|
if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
|
|
17215
|
-
this.raise(TSErrors.ReservedArrowTypeParam,
|
|
17216
|
-
at: node
|
|
17217
|
-
});
|
|
17025
|
+
this.raise(TSErrors.ReservedArrowTypeParam, node);
|
|
17218
17026
|
}
|
|
17219
17027
|
}
|
|
17220
17028
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
@@ -17273,13 +17081,9 @@ var require_lib = __commonJS({
|
|
|
17273
17081
|
case "TSNonNullExpression":
|
|
17274
17082
|
case "TSTypeAssertion":
|
|
17275
17083
|
if (isLHS) {
|
|
17276
|
-
this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter,
|
|
17277
|
-
at: node
|
|
17278
|
-
});
|
|
17084
|
+
this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
17279
17085
|
} else {
|
|
17280
|
-
this.raise(TSErrors.UnexpectedTypeCastInParameter,
|
|
17281
|
-
at: node
|
|
17282
|
-
});
|
|
17086
|
+
this.raise(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
17283
17087
|
}
|
|
17284
17088
|
this.toAssignable(node.expression, isLHS);
|
|
17285
17089
|
break;
|
|
@@ -17360,9 +17164,7 @@ var require_lib = __commonJS({
|
|
|
17360
17164
|
parseMaybeDefault(startLoc, left) {
|
|
17361
17165
|
const node = super.parseMaybeDefault(startLoc, left);
|
|
17362
17166
|
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
|
|
17363
|
-
this.raise(TSErrors.TypeAnnotationAfterAssign,
|
|
17364
|
-
at: node.typeAnnotation
|
|
17365
|
-
});
|
|
17167
|
+
this.raise(TSErrors.TypeAnnotationAfterAssign, node.typeAnnotation);
|
|
17366
17168
|
}
|
|
17367
17169
|
return node;
|
|
17368
17170
|
}
|
|
@@ -17477,9 +17279,7 @@ var require_lib = __commonJS({
|
|
|
17477
17279
|
} else if (this.isContextual(129)) {
|
|
17478
17280
|
if (!this.hasFollowingLineBreak()) {
|
|
17479
17281
|
node.abstract = true;
|
|
17480
|
-
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer,
|
|
17481
|
-
at: node
|
|
17482
|
-
});
|
|
17282
|
+
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, node);
|
|
17483
17283
|
return this.tsParseInterfaceDeclaration(node);
|
|
17484
17284
|
}
|
|
17485
17285
|
} else {
|
|
@@ -17494,8 +17294,7 @@ var require_lib = __commonJS({
|
|
|
17494
17294
|
const {
|
|
17495
17295
|
key
|
|
17496
17296
|
} = method;
|
|
17497
|
-
this.raise(TSErrors.AbstractMethodHasImplementation, {
|
|
17498
|
-
at: method,
|
|
17297
|
+
this.raise(TSErrors.AbstractMethodHasImplementation, method, {
|
|
17499
17298
|
methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
|
|
17500
17299
|
});
|
|
17501
17300
|
}
|
|
@@ -17577,9 +17376,7 @@ var require_lib = __commonJS({
|
|
|
17577
17376
|
}
|
|
17578
17377
|
}
|
|
17579
17378
|
if (hasTypeSpecifier && isInTypeOnlyImportExport) {
|
|
17580
|
-
this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports,
|
|
17581
|
-
at: loc
|
|
17582
|
-
});
|
|
17379
|
+
this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, loc);
|
|
17583
17380
|
}
|
|
17584
17381
|
node[leftOfAsKey] = leftOfAs;
|
|
17585
17382
|
node[rightOfAsKey] = rightOfAs;
|
|
@@ -17769,9 +17566,7 @@ var require_lib = __commonJS({
|
|
|
17769
17566
|
node.body = this.finishPlaceholder(placeholder, "ClassBody");
|
|
17770
17567
|
return this.finishNode(node, type);
|
|
17771
17568
|
} else {
|
|
17772
|
-
throw this.raise(PlaceholderErrors.ClassNameIsRequired,
|
|
17773
|
-
at: this.state.startLoc
|
|
17774
|
-
});
|
|
17569
|
+
throw this.raise(PlaceholderErrors.ClassNameIsRequired, this.state.startLoc);
|
|
17775
17570
|
}
|
|
17776
17571
|
} else {
|
|
17777
17572
|
this.parseClassId(node, isStatement, optionalId);
|
|
@@ -17852,9 +17647,7 @@ var require_lib = __commonJS({
|
|
|
17852
17647
|
}
|
|
17853
17648
|
assertNoSpace() {
|
|
17854
17649
|
if (this.state.start > this.state.lastTokEndLoc.index) {
|
|
17855
|
-
this.raise(PlaceholderErrors.UnexpectedSpace,
|
|
17856
|
-
at: this.state.lastTokEndLoc
|
|
17857
|
-
});
|
|
17650
|
+
this.raise(PlaceholderErrors.UnexpectedSpace, this.state.lastTokEndLoc);
|
|
17858
17651
|
}
|
|
17859
17652
|
}
|
|
17860
17653
|
};
|
|
@@ -18043,9 +17836,7 @@ var require_lib = __commonJS({
|
|
|
18043
17836
|
const name = key.type === "Identifier" ? key.name : key.value;
|
|
18044
17837
|
if (name === "__proto__") {
|
|
18045
17838
|
if (isRecord) {
|
|
18046
|
-
this.raise(Errors.RecordNoProto,
|
|
18047
|
-
at: key
|
|
18048
|
-
});
|
|
17839
|
+
this.raise(Errors.RecordNoProto, key);
|
|
18049
17840
|
return;
|
|
18050
17841
|
}
|
|
18051
17842
|
if (protoRef.used) {
|
|
@@ -18054,9 +17845,7 @@ var require_lib = __commonJS({
|
|
|
18054
17845
|
refExpressionErrors.doubleProtoLoc = key.loc.start;
|
|
18055
17846
|
}
|
|
18056
17847
|
} else {
|
|
18057
|
-
this.raise(Errors.DuplicateProto,
|
|
18058
|
-
at: key
|
|
18059
|
-
});
|
|
17848
|
+
this.raise(Errors.DuplicateProto, key);
|
|
18060
17849
|
}
|
|
18061
17850
|
}
|
|
18062
17851
|
protoRef.used = true;
|
|
@@ -18073,7 +17862,7 @@ var require_lib = __commonJS({
|
|
|
18073
17862
|
this.unexpected();
|
|
18074
17863
|
}
|
|
18075
17864
|
this.finalizeRemainingComments();
|
|
18076
|
-
expr.comments = this.
|
|
17865
|
+
expr.comments = this.comments;
|
|
18077
17866
|
expr.errors = this.state.errors;
|
|
18078
17867
|
if (this.options.tokens) {
|
|
18079
17868
|
expr.tokens = this.tokens;
|
|
@@ -18206,8 +17995,7 @@ var require_lib = __commonJS({
|
|
|
18206
17995
|
if (this.isPrivateName(left)) {
|
|
18207
17996
|
const value = this.getPrivateNameSV(left);
|
|
18208
17997
|
if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
|
|
18209
|
-
this.raise(Errors.PrivateInExpectedIn, {
|
|
18210
|
-
at: left,
|
|
17998
|
+
this.raise(Errors.PrivateInExpectedIn, left, {
|
|
18211
17999
|
identifierName: value
|
|
18212
18000
|
});
|
|
18213
18001
|
}
|
|
@@ -18237,18 +18025,14 @@ var require_lib = __commonJS({
|
|
|
18237
18025
|
proposal: "minimal"
|
|
18238
18026
|
}])) {
|
|
18239
18027
|
if (this.state.type === 96 && this.prodParam.hasAwait) {
|
|
18240
|
-
throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody,
|
|
18241
|
-
at: this.state.startLoc
|
|
18242
|
-
});
|
|
18028
|
+
throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, this.state.startLoc);
|
|
18243
18029
|
}
|
|
18244
18030
|
}
|
|
18245
18031
|
node.right = this.parseExprOpRightExpr(op, prec);
|
|
18246
18032
|
const finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
|
|
18247
18033
|
const nextOp = this.state.type;
|
|
18248
18034
|
if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
|
|
18249
|
-
throw this.raise(Errors.MixingCoalesceWithLogical,
|
|
18250
|
-
at: this.state.startLoc
|
|
18251
|
-
});
|
|
18035
|
+
throw this.raise(Errors.MixingCoalesceWithLogical, this.state.startLoc);
|
|
18252
18036
|
}
|
|
18253
18037
|
return this.parseExprOp(finishedNode, leftStartLoc, minPrec);
|
|
18254
18038
|
}
|
|
@@ -18267,9 +18051,7 @@ var require_lib = __commonJS({
|
|
|
18267
18051
|
case "smart":
|
|
18268
18052
|
return this.withTopicBindingContext(() => {
|
|
18269
18053
|
if (this.prodParam.hasYield && this.isContextual(108)) {
|
|
18270
|
-
throw this.raise(Errors.PipeBodyIsTighter,
|
|
18271
|
-
at: this.state.startLoc
|
|
18272
|
-
});
|
|
18054
|
+
throw this.raise(Errors.PipeBodyIsTighter, this.state.startLoc);
|
|
18273
18055
|
}
|
|
18274
18056
|
return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc);
|
|
18275
18057
|
});
|
|
@@ -18294,23 +18076,18 @@ var require_lib = __commonJS({
|
|
|
18294
18076
|
const body = this.parseMaybeAssign();
|
|
18295
18077
|
const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
|
|
18296
18078
|
if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
|
|
18297
|
-
this.raise(Errors.PipeUnparenthesizedBody, {
|
|
18298
|
-
at: startLoc,
|
|
18079
|
+
this.raise(Errors.PipeUnparenthesizedBody, startLoc, {
|
|
18299
18080
|
type: body.type
|
|
18300
18081
|
});
|
|
18301
18082
|
}
|
|
18302
18083
|
if (!this.topicReferenceWasUsedInCurrentContext()) {
|
|
18303
|
-
this.raise(Errors.PipeTopicUnused,
|
|
18304
|
-
at: startLoc
|
|
18305
|
-
});
|
|
18084
|
+
this.raise(Errors.PipeTopicUnused, startLoc);
|
|
18306
18085
|
}
|
|
18307
18086
|
return body;
|
|
18308
18087
|
}
|
|
18309
18088
|
checkExponentialAfterUnary(node) {
|
|
18310
18089
|
if (this.match(57)) {
|
|
18311
|
-
this.raise(Errors.UnexpectedTokenUnaryExponentiation,
|
|
18312
|
-
at: node.argument
|
|
18313
|
-
});
|
|
18090
|
+
this.raise(Errors.UnexpectedTokenUnaryExponentiation, node.argument);
|
|
18314
18091
|
}
|
|
18315
18092
|
}
|
|
18316
18093
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
@@ -18338,13 +18115,9 @@ var require_lib = __commonJS({
|
|
|
18338
18115
|
if (this.state.strict && isDelete) {
|
|
18339
18116
|
const arg = node.argument;
|
|
18340
18117
|
if (arg.type === "Identifier") {
|
|
18341
|
-
this.raise(Errors.StrictDelete,
|
|
18342
|
-
at: node
|
|
18343
|
-
});
|
|
18118
|
+
this.raise(Errors.StrictDelete, node);
|
|
18344
18119
|
} else if (this.hasPropertyAsPrivateName(arg)) {
|
|
18345
|
-
this.raise(Errors.DeletePrivateField,
|
|
18346
|
-
at: node
|
|
18347
|
-
});
|
|
18120
|
+
this.raise(Errors.DeletePrivateField, node);
|
|
18348
18121
|
}
|
|
18349
18122
|
}
|
|
18350
18123
|
if (!update) {
|
|
@@ -18361,9 +18134,7 @@ var require_lib = __commonJS({
|
|
|
18361
18134
|
} = this.state;
|
|
18362
18135
|
const startsExpr2 = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54);
|
|
18363
18136
|
if (startsExpr2 && !this.isAmbiguousAwait()) {
|
|
18364
|
-
this.raiseOverwrite(Errors.AwaitNotInAsyncContext,
|
|
18365
|
-
at: startLoc
|
|
18366
|
-
});
|
|
18137
|
+
this.raiseOverwrite(Errors.AwaitNotInAsyncContext, startLoc);
|
|
18367
18138
|
return this.parseAwait(startLoc);
|
|
18368
18139
|
}
|
|
18369
18140
|
}
|
|
@@ -18426,9 +18197,7 @@ var require_lib = __commonJS({
|
|
|
18426
18197
|
let optional = false;
|
|
18427
18198
|
if (type === 18) {
|
|
18428
18199
|
if (noCalls) {
|
|
18429
|
-
this.raise(Errors.OptionalChainingNoNew,
|
|
18430
|
-
at: this.state.startLoc
|
|
18431
|
-
});
|
|
18200
|
+
this.raise(Errors.OptionalChainingNoNew, this.state.startLoc);
|
|
18432
18201
|
if (this.lookaheadCharCode() === 40) {
|
|
18433
18202
|
state.stop = true;
|
|
18434
18203
|
return base;
|
|
@@ -18458,9 +18227,7 @@ var require_lib = __commonJS({
|
|
|
18458
18227
|
this.expect(3);
|
|
18459
18228
|
} else if (this.match(138)) {
|
|
18460
18229
|
if (base.type === "Super") {
|
|
18461
|
-
this.raise(Errors.SuperPrivateField,
|
|
18462
|
-
at: startLoc
|
|
18463
|
-
});
|
|
18230
|
+
this.raise(Errors.SuperPrivateField, startLoc);
|
|
18464
18231
|
}
|
|
18465
18232
|
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
18466
18233
|
node.property = this.parsePrivateName();
|
|
@@ -18530,9 +18297,7 @@ var require_lib = __commonJS({
|
|
|
18530
18297
|
node.tag = base;
|
|
18531
18298
|
node.quasi = this.parseTemplate(true);
|
|
18532
18299
|
if (state.optionalChainMember) {
|
|
18533
|
-
this.raise(Errors.OptionalChainingNoTemplate,
|
|
18534
|
-
at: startLoc
|
|
18535
|
-
});
|
|
18300
|
+
this.raise(Errors.OptionalChainingNoTemplate, startLoc);
|
|
18536
18301
|
}
|
|
18537
18302
|
return this.finishNode(node, "TaggedTemplateExpression");
|
|
18538
18303
|
}
|
|
@@ -18554,16 +18319,13 @@ var require_lib = __commonJS({
|
|
|
18554
18319
|
}
|
|
18555
18320
|
}
|
|
18556
18321
|
if (node.arguments.length === 0 || node.arguments.length > 2) {
|
|
18557
|
-
this.raise(Errors.ImportCallArity, {
|
|
18558
|
-
at: node,
|
|
18322
|
+
this.raise(Errors.ImportCallArity, node, {
|
|
18559
18323
|
maxArgumentCount: this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1
|
|
18560
18324
|
});
|
|
18561
18325
|
} else {
|
|
18562
18326
|
for (const arg of node.arguments) {
|
|
18563
18327
|
if (arg.type === "SpreadElement") {
|
|
18564
|
-
this.raise(Errors.ImportCallSpreadArgument,
|
|
18565
|
-
at: arg
|
|
18566
|
-
});
|
|
18328
|
+
this.raise(Errors.ImportCallSpreadArgument, arg);
|
|
18567
18329
|
}
|
|
18568
18330
|
}
|
|
18569
18331
|
}
|
|
@@ -18582,9 +18344,7 @@ var require_lib = __commonJS({
|
|
|
18582
18344
|
this.expect(12);
|
|
18583
18345
|
if (this.match(close)) {
|
|
18584
18346
|
if (dynamicImport && !this.hasPlugin("importAttributes") && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
|
|
18585
|
-
this.raise(Errors.ImportCallArgumentTrailingComma,
|
|
18586
|
-
at: this.state.lastTokStartLoc
|
|
18587
|
-
});
|
|
18347
|
+
this.raise(Errors.ImportCallArgumentTrailingComma, this.state.lastTokStartLoc);
|
|
18588
18348
|
}
|
|
18589
18349
|
if (nodeForExtra) {
|
|
18590
18350
|
this.addTrailingCommaExtraToNode(nodeForExtra);
|
|
@@ -18640,9 +18400,7 @@ var require_lib = __commonJS({
|
|
|
18640
18400
|
return this.finishNode(node, "Import");
|
|
18641
18401
|
}
|
|
18642
18402
|
} else {
|
|
18643
|
-
this.raise(Errors.UnsupportedImport,
|
|
18644
|
-
at: this.state.lastTokStartLoc
|
|
18645
|
-
});
|
|
18403
|
+
this.raise(Errors.UnsupportedImport, this.state.lastTokStartLoc);
|
|
18646
18404
|
return this.finishNode(node, "Import");
|
|
18647
18405
|
}
|
|
18648
18406
|
case 78:
|
|
@@ -18708,14 +18466,11 @@ var require_lib = __commonJS({
|
|
|
18708
18466
|
if (callee.type === "MemberExpression") {
|
|
18709
18467
|
return this.finishNode(node, "BindExpression");
|
|
18710
18468
|
} else {
|
|
18711
|
-
throw this.raise(Errors.UnsupportedBind,
|
|
18712
|
-
at: callee
|
|
18713
|
-
});
|
|
18469
|
+
throw this.raise(Errors.UnsupportedBind, callee);
|
|
18714
18470
|
}
|
|
18715
18471
|
}
|
|
18716
18472
|
case 138: {
|
|
18717
|
-
this.raise(Errors.PrivateInExpectedIn, {
|
|
18718
|
-
at: this.state.startLoc,
|
|
18473
|
+
this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, {
|
|
18719
18474
|
identifierName: this.state.value
|
|
18720
18475
|
});
|
|
18721
18476
|
return this.parsePrivateName();
|
|
@@ -18810,15 +18565,12 @@ var require_lib = __commonJS({
|
|
|
18810
18565
|
if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
|
|
18811
18566
|
const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference";
|
|
18812
18567
|
if (!this.topicReferenceIsAllowedInCurrentContext()) {
|
|
18813
|
-
this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound,
|
|
18814
|
-
at: startLoc
|
|
18815
|
-
});
|
|
18568
|
+
this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, startLoc);
|
|
18816
18569
|
}
|
|
18817
18570
|
this.registerTopicReference();
|
|
18818
18571
|
return this.finishNode(node, nodeType);
|
|
18819
18572
|
} else {
|
|
18820
|
-
throw this.raise(Errors.PipeTopicUnconfiguredToken, {
|
|
18821
|
-
at: startLoc,
|
|
18573
|
+
throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, {
|
|
18822
18574
|
token: tokenLabelName(tokenType)
|
|
18823
18575
|
});
|
|
18824
18576
|
}
|
|
@@ -18833,9 +18585,7 @@ var require_lib = __commonJS({
|
|
|
18833
18585
|
case "smart":
|
|
18834
18586
|
return tokenType === 27;
|
|
18835
18587
|
default:
|
|
18836
|
-
throw this.raise(Errors.PipeTopicRequiresHackPipes,
|
|
18837
|
-
at: startLoc
|
|
18838
|
-
});
|
|
18588
|
+
throw this.raise(Errors.PipeTopicRequiresHackPipes, startLoc);
|
|
18839
18589
|
}
|
|
18840
18590
|
}
|
|
18841
18591
|
parseAsyncArrowUnaryFunction(node) {
|
|
@@ -18843,9 +18593,7 @@ var require_lib = __commonJS({
|
|
|
18843
18593
|
const params = [this.parseIdentifier()];
|
|
18844
18594
|
this.prodParam.exit();
|
|
18845
18595
|
if (this.hasPrecedingLineBreak()) {
|
|
18846
|
-
this.raise(Errors.LineTerminatorBeforeArrow,
|
|
18847
|
-
at: this.state.curPosition()
|
|
18848
|
-
});
|
|
18596
|
+
this.raise(Errors.LineTerminatorBeforeArrow, this.state.curPosition());
|
|
18849
18597
|
}
|
|
18850
18598
|
this.expect(19);
|
|
18851
18599
|
return this.parseArrowExpression(node, params, true);
|
|
@@ -18873,18 +18621,12 @@ var require_lib = __commonJS({
|
|
|
18873
18621
|
const node = this.startNode();
|
|
18874
18622
|
this.next();
|
|
18875
18623
|
if (this.match(10) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) {
|
|
18876
|
-
this.raise(Errors.SuperNotAllowed,
|
|
18877
|
-
at: node
|
|
18878
|
-
});
|
|
18624
|
+
this.raise(Errors.SuperNotAllowed, node);
|
|
18879
18625
|
} else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) {
|
|
18880
|
-
this.raise(Errors.UnexpectedSuper,
|
|
18881
|
-
at: node
|
|
18882
|
-
});
|
|
18626
|
+
this.raise(Errors.UnexpectedSuper, node);
|
|
18883
18627
|
}
|
|
18884
18628
|
if (!this.match(10) && !this.match(0) && !this.match(16)) {
|
|
18885
|
-
this.raise(Errors.UnsupportedSuper,
|
|
18886
|
-
at: node
|
|
18887
|
-
});
|
|
18629
|
+
this.raise(Errors.UnsupportedSuper, node);
|
|
18888
18630
|
}
|
|
18889
18631
|
return this.finishNode(node, "Super");
|
|
18890
18632
|
}
|
|
@@ -18916,8 +18658,7 @@ var require_lib = __commonJS({
|
|
|
18916
18658
|
const containsEsc = this.state.containsEsc;
|
|
18917
18659
|
node.property = this.parseIdentifier(true);
|
|
18918
18660
|
if (node.property.name !== propertyName || containsEsc) {
|
|
18919
|
-
this.raise(Errors.UnsupportedMetaProperty, {
|
|
18920
|
-
at: node.property,
|
|
18661
|
+
this.raise(Errors.UnsupportedMetaProperty, node.property, {
|
|
18921
18662
|
target: meta.name,
|
|
18922
18663
|
onlyValidPropertyName: propertyName
|
|
18923
18664
|
});
|
|
@@ -18929,9 +18670,7 @@ var require_lib = __commonJS({
|
|
|
18929
18670
|
this.next();
|
|
18930
18671
|
if (this.isContextual(101)) {
|
|
18931
18672
|
if (!this.inModule) {
|
|
18932
|
-
this.raise(Errors.ImportMetaOutsideModule,
|
|
18933
|
-
at: id
|
|
18934
|
-
});
|
|
18673
|
+
this.raise(Errors.ImportMetaOutsideModule, id);
|
|
18935
18674
|
}
|
|
18936
18675
|
this.sawUnambiguousESM = true;
|
|
18937
18676
|
} else if (this.isContextual(105) || this.isContextual(97)) {
|
|
@@ -18940,8 +18679,7 @@ var require_lib = __commonJS({
|
|
|
18940
18679
|
this.unexpected();
|
|
18941
18680
|
this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
|
|
18942
18681
|
if (!this.options.createImportExpressions) {
|
|
18943
|
-
throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, {
|
|
18944
|
-
at: this.state.startLoc,
|
|
18682
|
+
throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
|
|
18945
18683
|
phase: this.state.value
|
|
18946
18684
|
});
|
|
18947
18685
|
}
|
|
@@ -19089,9 +18827,7 @@ var require_lib = __commonJS({
|
|
|
19089
18827
|
this.next();
|
|
19090
18828
|
const metaProp = this.parseMetaProperty(node, meta, "target");
|
|
19091
18829
|
if (!this.scope.inNonArrowFunction && !this.scope.inClass && !this.options.allowNewTargetOutsideFunction) {
|
|
19092
|
-
this.raise(Errors.UnexpectedNewTarget,
|
|
19093
|
-
at: metaProp
|
|
19094
|
-
});
|
|
18830
|
+
this.raise(Errors.UnexpectedNewTarget, metaProp);
|
|
19095
18831
|
}
|
|
19096
18832
|
return metaProp;
|
|
19097
18833
|
}
|
|
@@ -19113,9 +18849,7 @@ var require_lib = __commonJS({
|
|
|
19113
18849
|
const callee = this.parseNoCallExpr();
|
|
19114
18850
|
node.callee = callee;
|
|
19115
18851
|
if (isImport && (callee.type === "Import" || callee.type === "ImportExpression")) {
|
|
19116
|
-
this.raise(Errors.ImportCallNotNewExpression,
|
|
19117
|
-
at: callee
|
|
19118
|
-
});
|
|
18852
|
+
this.raise(Errors.ImportCallNotNewExpression, callee);
|
|
19119
18853
|
}
|
|
19120
18854
|
}
|
|
19121
18855
|
parseTemplateElement(isTagged) {
|
|
@@ -19129,9 +18863,7 @@ var require_lib = __commonJS({
|
|
|
19129
18863
|
const elem = this.startNodeAt(createPositionWithColumnOffset(startLoc, 1));
|
|
19130
18864
|
if (value === null) {
|
|
19131
18865
|
if (!isTagged) {
|
|
19132
|
-
this.raise(Errors.InvalidEscapeSequenceTemplate,
|
|
19133
|
-
at: createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1)
|
|
19134
|
-
});
|
|
18866
|
+
this.raise(Errors.InvalidEscapeSequenceTemplate, createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1));
|
|
19135
18867
|
}
|
|
19136
18868
|
}
|
|
19137
18869
|
const isTail = this.match(24);
|
|
@@ -19191,9 +18923,7 @@ var require_lib = __commonJS({
|
|
|
19191
18923
|
this.checkProto(prop, isRecord, propHash, refExpressionErrors);
|
|
19192
18924
|
}
|
|
19193
18925
|
if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
|
|
19194
|
-
this.raise(Errors.InvalidRecordProperty,
|
|
19195
|
-
at: prop
|
|
19196
|
-
});
|
|
18926
|
+
this.raise(Errors.InvalidRecordProperty, prop);
|
|
19197
18927
|
}
|
|
19198
18928
|
if (prop.shorthand) {
|
|
19199
18929
|
this.addExtra(prop, "shorthand", true);
|
|
@@ -19211,7 +18941,7 @@ var require_lib = __commonJS({
|
|
|
19211
18941
|
return this.finishNode(node, type);
|
|
19212
18942
|
}
|
|
19213
18943
|
addTrailingCommaExtraToNode(node) {
|
|
19214
|
-
this.addExtra(node, "trailingComma", this.state.
|
|
18944
|
+
this.addExtra(node, "trailingComma", this.state.lastTokStartLoc.index);
|
|
19215
18945
|
this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false);
|
|
19216
18946
|
}
|
|
19217
18947
|
maybeAsyncOrAccessorProp(prop) {
|
|
@@ -19221,9 +18951,7 @@ var require_lib = __commonJS({
|
|
|
19221
18951
|
let decorators = [];
|
|
19222
18952
|
if (this.match(26)) {
|
|
19223
18953
|
if (this.hasPlugin("decorators")) {
|
|
19224
|
-
this.raise(Errors.UnsupportedPropertyDecorator,
|
|
19225
|
-
at: this.state.startLoc
|
|
19226
|
-
});
|
|
18954
|
+
this.raise(Errors.UnsupportedPropertyDecorator, this.state.startLoc);
|
|
19227
18955
|
}
|
|
19228
18956
|
while (this.match(26)) {
|
|
19229
18957
|
decorators.push(this.parseDecorator());
|
|
@@ -19264,8 +18992,7 @@ var require_lib = __commonJS({
|
|
|
19264
18992
|
prop.kind = keyName;
|
|
19265
18993
|
if (this.match(55)) {
|
|
19266
18994
|
isGenerator = true;
|
|
19267
|
-
this.raise(Errors.AccessorIsGenerator, {
|
|
19268
|
-
at: this.state.curPosition(),
|
|
18995
|
+
this.raise(Errors.AccessorIsGenerator, this.state.curPosition(), {
|
|
19269
18996
|
kind: keyName
|
|
19270
18997
|
});
|
|
19271
18998
|
this.next();
|
|
@@ -19286,14 +19013,10 @@ var require_lib = __commonJS({
|
|
|
19286
19013
|
const paramCount = this.getGetterSetterExpectedParamCount(method);
|
|
19287
19014
|
const params = this.getObjectOrClassMethodParams(method);
|
|
19288
19015
|
if (params.length !== paramCount) {
|
|
19289
|
-
this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity,
|
|
19290
|
-
at: method
|
|
19291
|
-
});
|
|
19016
|
+
this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, method);
|
|
19292
19017
|
}
|
|
19293
19018
|
if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") {
|
|
19294
|
-
this.raise(Errors.BadSetterRestParameter,
|
|
19295
|
-
at: method
|
|
19296
|
-
});
|
|
19019
|
+
this.raise(Errors.BadSetterRestParameter, method);
|
|
19297
19020
|
}
|
|
19298
19021
|
}
|
|
19299
19022
|
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
|
|
@@ -19327,9 +19050,7 @@ var require_lib = __commonJS({
|
|
|
19327
19050
|
refExpressionErrors.shorthandAssignLoc = shorthandAssignLoc;
|
|
19328
19051
|
}
|
|
19329
19052
|
} else {
|
|
19330
|
-
this.raise(Errors.InvalidCoverInitializedName,
|
|
19331
|
-
at: shorthandAssignLoc
|
|
19332
|
-
});
|
|
19053
|
+
this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
|
|
19333
19054
|
}
|
|
19334
19055
|
prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key));
|
|
19335
19056
|
} else {
|
|
@@ -19379,9 +19100,7 @@ var require_lib = __commonJS({
|
|
|
19379
19100
|
refExpressionErrors.privateKeyLoc = privateKeyLoc;
|
|
19380
19101
|
}
|
|
19381
19102
|
} else {
|
|
19382
|
-
this.raise(Errors.UnexpectedPrivateField,
|
|
19383
|
-
at: privateKeyLoc
|
|
19384
|
-
});
|
|
19103
|
+
this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
|
|
19385
19104
|
}
|
|
19386
19105
|
key = this.parsePrivateName();
|
|
19387
19106
|
break;
|
|
@@ -19467,9 +19186,7 @@ var require_lib = __commonJS({
|
|
|
19467
19186
|
node.body = this.parseBlock(true, false, (hasStrictModeDirective) => {
|
|
19468
19187
|
const nonSimple = !this.isSimpleParamList(node.params);
|
|
19469
19188
|
if (hasStrictModeDirective && nonSimple) {
|
|
19470
|
-
this.raise(Errors.IllegalLanguageModeDirective,
|
|
19471
|
-
at: (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node
|
|
19472
|
-
});
|
|
19189
|
+
this.raise(Errors.IllegalLanguageModeDirective, (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node);
|
|
19473
19190
|
}
|
|
19474
19191
|
const strictModeChanged = !oldStrict && this.state.strict;
|
|
19475
19192
|
this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
|
|
@@ -19530,8 +19247,7 @@ var require_lib = __commonJS({
|
|
|
19530
19247
|
let elt;
|
|
19531
19248
|
if (this.match(12)) {
|
|
19532
19249
|
if (!allowEmpty) {
|
|
19533
|
-
this.raise(Errors.UnexpectedToken, {
|
|
19534
|
-
at: this.state.curPosition(),
|
|
19250
|
+
this.raise(Errors.UnexpectedToken, this.state.curPosition(), {
|
|
19535
19251
|
unexpected: ","
|
|
19536
19252
|
});
|
|
19537
19253
|
}
|
|
@@ -19542,9 +19258,7 @@ var require_lib = __commonJS({
|
|
|
19542
19258
|
} else if (this.match(17)) {
|
|
19543
19259
|
this.expectPlugin("partialApplication");
|
|
19544
19260
|
if (!allowPlaceholder) {
|
|
19545
|
-
this.raise(Errors.UnexpectedArgumentPlaceholder,
|
|
19546
|
-
at: this.state.startLoc
|
|
19547
|
-
});
|
|
19261
|
+
this.raise(Errors.UnexpectedArgumentPlaceholder, this.state.startLoc);
|
|
19548
19262
|
}
|
|
19549
19263
|
const node = this.startNode();
|
|
19550
19264
|
this.next();
|
|
@@ -19594,47 +19308,35 @@ var require_lib = __commonJS({
|
|
|
19594
19308
|
return;
|
|
19595
19309
|
}
|
|
19596
19310
|
if (checkKeywords && isKeyword(word)) {
|
|
19597
|
-
this.raise(Errors.UnexpectedKeyword, {
|
|
19598
|
-
at: startLoc,
|
|
19311
|
+
this.raise(Errors.UnexpectedKeyword, startLoc, {
|
|
19599
19312
|
keyword: word
|
|
19600
19313
|
});
|
|
19601
19314
|
return;
|
|
19602
19315
|
}
|
|
19603
19316
|
const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;
|
|
19604
19317
|
if (reservedTest(word, this.inModule)) {
|
|
19605
|
-
this.raise(Errors.UnexpectedReservedWord, {
|
|
19606
|
-
at: startLoc,
|
|
19318
|
+
this.raise(Errors.UnexpectedReservedWord, startLoc, {
|
|
19607
19319
|
reservedWord: word
|
|
19608
19320
|
});
|
|
19609
19321
|
return;
|
|
19610
19322
|
} else if (word === "yield") {
|
|
19611
19323
|
if (this.prodParam.hasYield) {
|
|
19612
|
-
this.raise(Errors.YieldBindingIdentifier,
|
|
19613
|
-
at: startLoc
|
|
19614
|
-
});
|
|
19324
|
+
this.raise(Errors.YieldBindingIdentifier, startLoc);
|
|
19615
19325
|
return;
|
|
19616
19326
|
}
|
|
19617
19327
|
} else if (word === "await") {
|
|
19618
19328
|
if (this.prodParam.hasAwait) {
|
|
19619
|
-
this.raise(Errors.AwaitBindingIdentifier,
|
|
19620
|
-
at: startLoc
|
|
19621
|
-
});
|
|
19329
|
+
this.raise(Errors.AwaitBindingIdentifier, startLoc);
|
|
19622
19330
|
return;
|
|
19623
19331
|
}
|
|
19624
19332
|
if (this.scope.inStaticBlock) {
|
|
19625
|
-
this.raise(Errors.AwaitBindingIdentifierInStaticBlock,
|
|
19626
|
-
at: startLoc
|
|
19627
|
-
});
|
|
19333
|
+
this.raise(Errors.AwaitBindingIdentifierInStaticBlock, startLoc);
|
|
19628
19334
|
return;
|
|
19629
19335
|
}
|
|
19630
|
-
this.expressionScope.recordAsyncArrowParametersError(
|
|
19631
|
-
at: startLoc
|
|
19632
|
-
});
|
|
19336
|
+
this.expressionScope.recordAsyncArrowParametersError(startLoc);
|
|
19633
19337
|
} else if (word === "arguments") {
|
|
19634
19338
|
if (this.scope.inClassAndNotInNonArrowFunction) {
|
|
19635
|
-
this.raise(Errors.ArgumentsInClass,
|
|
19636
|
-
at: startLoc
|
|
19637
|
-
});
|
|
19339
|
+
this.raise(Errors.ArgumentsInClass, startLoc);
|
|
19638
19340
|
return;
|
|
19639
19341
|
}
|
|
19640
19342
|
}
|
|
@@ -19649,13 +19351,9 @@ var require_lib = __commonJS({
|
|
|
19649
19351
|
}
|
|
19650
19352
|
parseAwait(startLoc) {
|
|
19651
19353
|
const node = this.startNodeAt(startLoc);
|
|
19652
|
-
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter,
|
|
19653
|
-
at: node
|
|
19654
|
-
});
|
|
19354
|
+
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, node);
|
|
19655
19355
|
if (this.eat(55)) {
|
|
19656
|
-
this.raise(Errors.ObsoleteAwaitStar,
|
|
19657
|
-
at: node
|
|
19658
|
-
});
|
|
19356
|
+
this.raise(Errors.ObsoleteAwaitStar, node);
|
|
19659
19357
|
}
|
|
19660
19358
|
if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) {
|
|
19661
19359
|
if (this.isAmbiguousAwait()) {
|
|
@@ -19679,9 +19377,7 @@ var require_lib = __commonJS({
|
|
|
19679
19377
|
}
|
|
19680
19378
|
parseYield() {
|
|
19681
19379
|
const node = this.startNode();
|
|
19682
|
-
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter,
|
|
19683
|
-
at: node
|
|
19684
|
-
});
|
|
19380
|
+
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, node);
|
|
19685
19381
|
this.next();
|
|
19686
19382
|
let delegating = false;
|
|
19687
19383
|
let argument = null;
|
|
@@ -19727,9 +19423,7 @@ var require_lib = __commonJS({
|
|
|
19727
19423
|
proposal: "smart"
|
|
19728
19424
|
}])) {
|
|
19729
19425
|
if (left.type === "SequenceExpression") {
|
|
19730
|
-
this.raise(Errors.PipelineHeadSequenceExpression,
|
|
19731
|
-
at: leftStartLoc
|
|
19732
|
-
});
|
|
19426
|
+
this.raise(Errors.PipelineHeadSequenceExpression, leftStartLoc);
|
|
19733
19427
|
}
|
|
19734
19428
|
}
|
|
19735
19429
|
}
|
|
@@ -19757,14 +19451,10 @@ var require_lib = __commonJS({
|
|
|
19757
19451
|
}
|
|
19758
19452
|
checkSmartPipeTopicBodyEarlyErrors(startLoc) {
|
|
19759
19453
|
if (this.match(19)) {
|
|
19760
|
-
throw this.raise(Errors.PipelineBodyNoArrow,
|
|
19761
|
-
at: this.state.startLoc
|
|
19762
|
-
});
|
|
19454
|
+
throw this.raise(Errors.PipelineBodyNoArrow, this.state.startLoc);
|
|
19763
19455
|
}
|
|
19764
19456
|
if (!this.topicReferenceWasUsedInCurrentContext()) {
|
|
19765
|
-
this.raise(Errors.PipelineTopicUnused,
|
|
19766
|
-
at: startLoc
|
|
19767
|
-
});
|
|
19457
|
+
this.raise(Errors.PipelineTopicUnused, startLoc);
|
|
19768
19458
|
}
|
|
19769
19459
|
}
|
|
19770
19460
|
withTopicBindingContext(callback) {
|
|
@@ -19872,10 +19562,10 @@ var require_lib = __commonJS({
|
|
|
19872
19562
|
}
|
|
19873
19563
|
};
|
|
19874
19564
|
var loopLabel = {
|
|
19875
|
-
kind:
|
|
19565
|
+
kind: 1
|
|
19876
19566
|
};
|
|
19877
19567
|
var switchLabel = {
|
|
19878
|
-
kind:
|
|
19568
|
+
kind: 2
|
|
19879
19569
|
};
|
|
19880
19570
|
var loneSurrogate = /[\uD800-\uDFFF]/u;
|
|
19881
19571
|
var keywordRelationalOperator = /in(?:stanceof)?/y;
|
|
@@ -19989,7 +19679,7 @@ var require_lib = __commonJS({
|
|
|
19989
19679
|
var StatementParser = class extends ExpressionParser {
|
|
19990
19680
|
parseTopLevel(file, program) {
|
|
19991
19681
|
file.program = this.parseProgram(program);
|
|
19992
|
-
file.comments = this.
|
|
19682
|
+
file.comments = this.comments;
|
|
19993
19683
|
if (this.options.tokens) {
|
|
19994
19684
|
file.tokens = babel7CompatTokens(this.tokens, this.input);
|
|
19995
19685
|
}
|
|
@@ -20001,8 +19691,7 @@ var require_lib = __commonJS({
|
|
|
20001
19691
|
this.parseBlockBody(program, true, true, end);
|
|
20002
19692
|
if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
|
|
20003
19693
|
for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
|
|
20004
|
-
this.raise(Errors.ModuleExportUndefined, {
|
|
20005
|
-
at,
|
|
19694
|
+
this.raise(Errors.ModuleExportUndefined, at, {
|
|
20006
19695
|
localName
|
|
20007
19696
|
});
|
|
20008
19697
|
}
|
|
@@ -20145,9 +19834,7 @@ var require_lib = __commonJS({
|
|
|
20145
19834
|
if (this.lookaheadCharCode() === 46)
|
|
20146
19835
|
break;
|
|
20147
19836
|
if (!allowFunctionDeclaration) {
|
|
20148
|
-
this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction,
|
|
20149
|
-
at: this.state.startLoc
|
|
20150
|
-
});
|
|
19837
|
+
this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, this.state.startLoc);
|
|
20151
19838
|
}
|
|
20152
19839
|
return this.parseFunctionStatement(node, false, !allowDeclaration && allowFunctionDeclaration);
|
|
20153
19840
|
case 80:
|
|
@@ -20167,13 +19854,9 @@ var require_lib = __commonJS({
|
|
|
20167
19854
|
case 96:
|
|
20168
19855
|
if (!this.state.containsEsc && this.startsAwaitUsing()) {
|
|
20169
19856
|
if (!this.isAwaitAllowed()) {
|
|
20170
|
-
this.raise(Errors.AwaitUsingNotInAsyncContext,
|
|
20171
|
-
at: node
|
|
20172
|
-
});
|
|
19857
|
+
this.raise(Errors.AwaitUsingNotInAsyncContext, node);
|
|
20173
19858
|
} else if (!allowDeclaration) {
|
|
20174
|
-
this.raise(Errors.UnexpectedLexicalDeclaration,
|
|
20175
|
-
at: node
|
|
20176
|
-
});
|
|
19859
|
+
this.raise(Errors.UnexpectedLexicalDeclaration, node);
|
|
20177
19860
|
}
|
|
20178
19861
|
this.next();
|
|
20179
19862
|
return this.parseVarStatement(node, "await using");
|
|
@@ -20185,13 +19868,9 @@ var require_lib = __commonJS({
|
|
|
20185
19868
|
}
|
|
20186
19869
|
this.expectPlugin("explicitResourceManagement");
|
|
20187
19870
|
if (!this.scope.inModule && this.scope.inTopLevel) {
|
|
20188
|
-
this.raise(Errors.UnexpectedUsingDeclaration,
|
|
20189
|
-
at: this.state.startLoc
|
|
20190
|
-
});
|
|
19871
|
+
this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
|
|
20191
19872
|
} else if (!allowDeclaration) {
|
|
20192
|
-
this.raise(Errors.UnexpectedLexicalDeclaration,
|
|
20193
|
-
at: this.state.startLoc
|
|
20194
|
-
});
|
|
19873
|
+
this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
20195
19874
|
}
|
|
20196
19875
|
return this.parseVarStatement(node, "using");
|
|
20197
19876
|
case 100: {
|
|
@@ -20210,9 +19889,7 @@ var require_lib = __commonJS({
|
|
|
20210
19889
|
}
|
|
20211
19890
|
case 75: {
|
|
20212
19891
|
if (!allowDeclaration) {
|
|
20213
|
-
this.raise(Errors.UnexpectedLexicalDeclaration,
|
|
20214
|
-
at: this.state.startLoc
|
|
20215
|
-
});
|
|
19892
|
+
this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
20216
19893
|
}
|
|
20217
19894
|
}
|
|
20218
19895
|
case 74: {
|
|
@@ -20235,9 +19912,7 @@ var require_lib = __commonJS({
|
|
|
20235
19912
|
}
|
|
20236
19913
|
case 82: {
|
|
20237
19914
|
if (!this.options.allowImportExportEverywhere && !topLevel) {
|
|
20238
|
-
this.raise(Errors.UnexpectedImportExport,
|
|
20239
|
-
at: this.state.startLoc
|
|
20240
|
-
});
|
|
19915
|
+
this.raise(Errors.UnexpectedImportExport, this.state.startLoc);
|
|
20241
19916
|
}
|
|
20242
19917
|
this.next();
|
|
20243
19918
|
let result;
|
|
@@ -20258,9 +19933,7 @@ var require_lib = __commonJS({
|
|
|
20258
19933
|
default: {
|
|
20259
19934
|
if (this.isAsyncFunction()) {
|
|
20260
19935
|
if (!allowDeclaration) {
|
|
20261
|
-
this.raise(Errors.AsyncFunctionInSingleStatementContext,
|
|
20262
|
-
at: this.state.startLoc
|
|
20263
|
-
});
|
|
19936
|
+
this.raise(Errors.AsyncFunctionInSingleStatementContext, this.state.startLoc);
|
|
20264
19937
|
}
|
|
20265
19938
|
this.next();
|
|
20266
19939
|
return this.parseFunctionStatement(node, true, !allowDeclaration && allowFunctionDeclaration);
|
|
@@ -20277,9 +19950,7 @@ var require_lib = __commonJS({
|
|
|
20277
19950
|
}
|
|
20278
19951
|
assertModuleNodeAllowed(node) {
|
|
20279
19952
|
if (!this.options.allowImportExportEverywhere && !this.inModule) {
|
|
20280
|
-
this.raise(Errors.ImportOutsideModule,
|
|
20281
|
-
at: node
|
|
20282
|
-
});
|
|
19953
|
+
this.raise(Errors.ImportOutsideModule, node);
|
|
20283
19954
|
}
|
|
20284
19955
|
}
|
|
20285
19956
|
decoratorsEnabledBeforeExport() {
|
|
@@ -20291,9 +19962,7 @@ var require_lib = __commonJS({
|
|
|
20291
19962
|
if (maybeDecorators) {
|
|
20292
19963
|
if (classNode.decorators && classNode.decorators.length > 0) {
|
|
20293
19964
|
if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") {
|
|
20294
|
-
this.raise(Errors.DecoratorsBeforeAfterExport,
|
|
20295
|
-
at: classNode.decorators[0]
|
|
20296
|
-
});
|
|
19965
|
+
this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
|
|
20297
19966
|
}
|
|
20298
19967
|
classNode.decorators.unshift(...maybeDecorators);
|
|
20299
19968
|
} else {
|
|
@@ -20318,14 +19987,10 @@ var require_lib = __commonJS({
|
|
|
20318
19987
|
this.unexpected();
|
|
20319
19988
|
}
|
|
20320
19989
|
if (!this.decoratorsEnabledBeforeExport()) {
|
|
20321
|
-
this.raise(Errors.DecoratorExportClass,
|
|
20322
|
-
at: this.state.startLoc
|
|
20323
|
-
});
|
|
19990
|
+
this.raise(Errors.DecoratorExportClass, this.state.startLoc);
|
|
20324
19991
|
}
|
|
20325
19992
|
} else if (!this.canHaveLeadingDecorator()) {
|
|
20326
|
-
throw this.raise(Errors.UnexpectedLeadingDecorator,
|
|
20327
|
-
at: this.state.startLoc
|
|
20328
|
-
});
|
|
19993
|
+
throw this.raise(Errors.UnexpectedLeadingDecorator, this.state.startLoc);
|
|
20329
19994
|
}
|
|
20330
19995
|
return decorators;
|
|
20331
19996
|
}
|
|
@@ -20345,9 +20010,7 @@ var require_lib = __commonJS({
|
|
|
20345
20010
|
const paramsStartLoc = this.state.startLoc;
|
|
20346
20011
|
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
20347
20012
|
if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
|
|
20348
|
-
this.raise(Errors.DecoratorArgumentsOutsideParentheses,
|
|
20349
|
-
at: paramsStartLoc
|
|
20350
|
-
});
|
|
20013
|
+
this.raise(Errors.DecoratorArgumentsOutsideParentheses, paramsStartLoc);
|
|
20351
20014
|
}
|
|
20352
20015
|
} else {
|
|
20353
20016
|
expr = this.parseIdentifier(false);
|
|
@@ -20396,16 +20059,16 @@ var require_lib = __commonJS({
|
|
|
20396
20059
|
for (i = 0; i < this.state.labels.length; ++i) {
|
|
20397
20060
|
const lab = this.state.labels[i];
|
|
20398
20061
|
if (node.label == null || lab.name === node.label.name) {
|
|
20399
|
-
if (lab.kind != null && (isBreak || lab.kind ===
|
|
20062
|
+
if (lab.kind != null && (isBreak || lab.kind === 1)) {
|
|
20400
20063
|
break;
|
|
20064
|
+
}
|
|
20401
20065
|
if (node.label && isBreak)
|
|
20402
20066
|
break;
|
|
20403
20067
|
}
|
|
20404
20068
|
}
|
|
20405
20069
|
if (i === this.state.labels.length) {
|
|
20406
20070
|
const type = isBreak ? "BreakStatement" : "ContinueStatement";
|
|
20407
|
-
this.raise(Errors.IllegalBreakContinue, {
|
|
20408
|
-
at: node,
|
|
20071
|
+
this.raise(Errors.IllegalBreakContinue, node, {
|
|
20409
20072
|
type
|
|
20410
20073
|
});
|
|
20411
20074
|
}
|
|
@@ -20457,9 +20120,7 @@ var require_lib = __commonJS({
|
|
|
20457
20120
|
if (startsWithAwaitUsing) {
|
|
20458
20121
|
kind = "await using";
|
|
20459
20122
|
if (!this.isAwaitAllowed()) {
|
|
20460
|
-
this.raise(Errors.AwaitUsingNotInAsyncContext,
|
|
20461
|
-
at: this.state.startLoc
|
|
20462
|
-
});
|
|
20123
|
+
this.raise(Errors.AwaitUsingNotInAsyncContext, this.state.startLoc);
|
|
20463
20124
|
}
|
|
20464
20125
|
this.next();
|
|
20465
20126
|
} else {
|
|
@@ -20470,9 +20131,7 @@ var require_lib = __commonJS({
|
|
|
20470
20131
|
const init2 = this.finishNode(initNode, "VariableDeclaration");
|
|
20471
20132
|
const isForIn = this.match(58);
|
|
20472
20133
|
if (isForIn && starsWithUsingDeclaration) {
|
|
20473
|
-
this.raise(Errors.ForInUsing,
|
|
20474
|
-
at: init2
|
|
20475
|
-
});
|
|
20134
|
+
this.raise(Errors.ForInUsing, init2);
|
|
20476
20135
|
}
|
|
20477
20136
|
if ((isForIn || this.isContextual(102)) && init2.declarations.length === 1) {
|
|
20478
20137
|
return this.parseForIn(node, init2, awaitAt);
|
|
@@ -20489,14 +20148,10 @@ var require_lib = __commonJS({
|
|
|
20489
20148
|
const isForOf = this.isContextual(102);
|
|
20490
20149
|
if (isForOf) {
|
|
20491
20150
|
if (startsWithLet) {
|
|
20492
|
-
this.raise(Errors.ForOfLet,
|
|
20493
|
-
at: init
|
|
20494
|
-
});
|
|
20151
|
+
this.raise(Errors.ForOfLet, init);
|
|
20495
20152
|
}
|
|
20496
20153
|
if (awaitAt === null && startsWithAsync && init.type === "Identifier") {
|
|
20497
|
-
this.raise(Errors.ForOfAsync,
|
|
20498
|
-
at: init
|
|
20499
|
-
});
|
|
20154
|
+
this.raise(Errors.ForOfAsync, init);
|
|
20500
20155
|
}
|
|
20501
20156
|
}
|
|
20502
20157
|
if (isForOf || this.match(58)) {
|
|
@@ -20530,9 +20185,7 @@ var require_lib = __commonJS({
|
|
|
20530
20185
|
}
|
|
20531
20186
|
parseReturnStatement(node) {
|
|
20532
20187
|
if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) {
|
|
20533
|
-
this.raise(Errors.IllegalReturn,
|
|
20534
|
-
at: this.state.startLoc
|
|
20535
|
-
});
|
|
20188
|
+
this.raise(Errors.IllegalReturn, this.state.startLoc);
|
|
20536
20189
|
}
|
|
20537
20190
|
this.next();
|
|
20538
20191
|
if (this.isLineTerminator()) {
|
|
@@ -20563,9 +20216,7 @@ var require_lib = __commonJS({
|
|
|
20563
20216
|
cur.test = this.parseExpression();
|
|
20564
20217
|
} else {
|
|
20565
20218
|
if (sawDefault) {
|
|
20566
|
-
this.raise(Errors.MultipleDefaultsInSwitch,
|
|
20567
|
-
at: this.state.lastTokStartLoc
|
|
20568
|
-
});
|
|
20219
|
+
this.raise(Errors.MultipleDefaultsInSwitch, this.state.lastTokStartLoc);
|
|
20569
20220
|
}
|
|
20570
20221
|
sawDefault = true;
|
|
20571
20222
|
cur.test = null;
|
|
@@ -20589,9 +20240,7 @@ var require_lib = __commonJS({
|
|
|
20589
20240
|
parseThrowStatement(node) {
|
|
20590
20241
|
this.next();
|
|
20591
20242
|
if (this.hasPrecedingLineBreak()) {
|
|
20592
|
-
this.raise(Errors.NewlineAfterThrow,
|
|
20593
|
-
at: this.state.lastTokEndLoc
|
|
20594
|
-
});
|
|
20243
|
+
this.raise(Errors.NewlineAfterThrow, this.state.lastTokEndLoc);
|
|
20595
20244
|
}
|
|
20596
20245
|
node.argument = this.parseExpression();
|
|
20597
20246
|
this.semicolon();
|
|
@@ -20629,9 +20278,7 @@ var require_lib = __commonJS({
|
|
|
20629
20278
|
}
|
|
20630
20279
|
node.finalizer = this.eat(67) ? this.parseBlock() : null;
|
|
20631
20280
|
if (!node.handler && !node.finalizer) {
|
|
20632
|
-
this.raise(Errors.NoCatchOrFinally,
|
|
20633
|
-
at: node
|
|
20634
|
-
});
|
|
20281
|
+
this.raise(Errors.NoCatchOrFinally, node);
|
|
20635
20282
|
}
|
|
20636
20283
|
return this.finishNode(node, "TryStatement");
|
|
20637
20284
|
}
|
|
@@ -20651,9 +20298,7 @@ var require_lib = __commonJS({
|
|
|
20651
20298
|
}
|
|
20652
20299
|
parseWithStatement(node) {
|
|
20653
20300
|
if (this.state.strict) {
|
|
20654
|
-
this.raise(Errors.StrictWith,
|
|
20655
|
-
at: this.state.startLoc
|
|
20656
|
-
});
|
|
20301
|
+
this.raise(Errors.StrictWith, this.state.startLoc);
|
|
20657
20302
|
}
|
|
20658
20303
|
this.next();
|
|
20659
20304
|
node.object = this.parseHeaderExpression();
|
|
@@ -20667,13 +20312,12 @@ var require_lib = __commonJS({
|
|
|
20667
20312
|
parseLabeledStatement(node, maybeName, expr, flags) {
|
|
20668
20313
|
for (const label of this.state.labels) {
|
|
20669
20314
|
if (label.name === maybeName) {
|
|
20670
|
-
this.raise(Errors.LabelRedeclaration, {
|
|
20671
|
-
at: expr,
|
|
20315
|
+
this.raise(Errors.LabelRedeclaration, expr, {
|
|
20672
20316
|
labelName: maybeName
|
|
20673
20317
|
});
|
|
20674
20318
|
}
|
|
20675
20319
|
}
|
|
20676
|
-
const kind = tokenIsLoop(this.state.type) ?
|
|
20320
|
+
const kind = tokenIsLoop(this.state.type) ? 1 : this.match(71) ? 2 : null;
|
|
20677
20321
|
for (let i = this.state.labels.length - 1; i >= 0; i--) {
|
|
20678
20322
|
const label = this.state.labels[i];
|
|
20679
20323
|
if (label.statementStart === node.start) {
|
|
@@ -20770,14 +20414,12 @@ var require_lib = __commonJS({
|
|
|
20770
20414
|
node.await = awaitAt !== null;
|
|
20771
20415
|
}
|
|
20772
20416
|
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || !this.options.annexB || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) {
|
|
20773
|
-
this.raise(Errors.ForInOfLoopInitializer, {
|
|
20774
|
-
at: init,
|
|
20417
|
+
this.raise(Errors.ForInOfLoopInitializer, init, {
|
|
20775
20418
|
type: isForIn ? "ForInStatement" : "ForOfStatement"
|
|
20776
20419
|
});
|
|
20777
20420
|
}
|
|
20778
20421
|
if (init.type === "AssignmentPattern") {
|
|
20779
|
-
this.raise(Errors.InvalidLhs, {
|
|
20780
|
-
at: init,
|
|
20422
|
+
this.raise(Errors.InvalidLhs, init, {
|
|
20781
20423
|
ancestor: {
|
|
20782
20424
|
type: "ForStatement"
|
|
20783
20425
|
}
|
|
@@ -20800,14 +20442,12 @@ var require_lib = __commonJS({
|
|
|
20800
20442
|
decl.init = !this.eat(29) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
|
|
20801
20443
|
if (decl.init === null && !allowMissingInitializer) {
|
|
20802
20444
|
if (decl.id.type !== "Identifier" && !(isFor && (this.match(58) || this.isContextual(102)))) {
|
|
20803
|
-
this.raise(Errors.DeclarationMissingInitializer, {
|
|
20804
|
-
at: this.state.lastTokEndLoc,
|
|
20445
|
+
this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
|
|
20805
20446
|
kind: "destructuring"
|
|
20806
20447
|
});
|
|
20807
|
-
} else if (kind === "const" && !(this.match(58) || this.isContextual(102))) {
|
|
20808
|
-
this.raise(Errors.DeclarationMissingInitializer, {
|
|
20809
|
-
|
|
20810
|
-
kind: "const"
|
|
20448
|
+
} else if ((kind === "const" || kind === "using" || kind === "await using") && !(this.match(58) || this.isContextual(102))) {
|
|
20449
|
+
this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
|
|
20450
|
+
kind
|
|
20811
20451
|
});
|
|
20812
20452
|
}
|
|
20813
20453
|
}
|
|
@@ -20838,9 +20478,7 @@ var require_lib = __commonJS({
|
|
|
20838
20478
|
this.initFunction(node, isAsync);
|
|
20839
20479
|
if (this.match(55)) {
|
|
20840
20480
|
if (hangingDeclaration) {
|
|
20841
|
-
this.raise(Errors.GeneratorInSingleStatementContext,
|
|
20842
|
-
at: this.state.startLoc
|
|
20843
|
-
});
|
|
20481
|
+
this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc);
|
|
20844
20482
|
}
|
|
20845
20483
|
this.next();
|
|
20846
20484
|
node.generator = true;
|
|
@@ -20913,9 +20551,7 @@ var require_lib = __commonJS({
|
|
|
20913
20551
|
while (!this.match(8)) {
|
|
20914
20552
|
if (this.eat(13)) {
|
|
20915
20553
|
if (decorators.length > 0) {
|
|
20916
|
-
throw this.raise(Errors.DecoratorSemicolon,
|
|
20917
|
-
at: this.state.lastTokEndLoc
|
|
20918
|
-
});
|
|
20554
|
+
throw this.raise(Errors.DecoratorSemicolon, this.state.lastTokEndLoc);
|
|
20919
20555
|
}
|
|
20920
20556
|
continue;
|
|
20921
20557
|
}
|
|
@@ -20931,18 +20567,14 @@ var require_lib = __commonJS({
|
|
|
20931
20567
|
}
|
|
20932
20568
|
this.parseClassMember(classBody, member, state);
|
|
20933
20569
|
if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
|
|
20934
|
-
this.raise(Errors.DecoratorConstructor,
|
|
20935
|
-
at: member
|
|
20936
|
-
});
|
|
20570
|
+
this.raise(Errors.DecoratorConstructor, member);
|
|
20937
20571
|
}
|
|
20938
20572
|
}
|
|
20939
20573
|
});
|
|
20940
20574
|
this.state.strict = oldStrict;
|
|
20941
20575
|
this.next();
|
|
20942
20576
|
if (decorators.length) {
|
|
20943
|
-
throw this.raise(Errors.TrailingDecorator,
|
|
20944
|
-
at: this.state.startLoc
|
|
20945
|
-
});
|
|
20577
|
+
throw this.raise(Errors.TrailingDecorator, this.state.startLoc);
|
|
20946
20578
|
}
|
|
20947
20579
|
this.classScope.exit();
|
|
20948
20580
|
return this.finishNode(classBody, "ClassBody");
|
|
@@ -21000,9 +20632,7 @@ var require_lib = __commonJS({
|
|
|
21000
20632
|
return;
|
|
21001
20633
|
}
|
|
21002
20634
|
if (this.isNonstaticConstructor(publicMethod)) {
|
|
21003
|
-
this.raise(Errors.ConstructorIsGenerator,
|
|
21004
|
-
at: publicMethod.key
|
|
21005
|
-
});
|
|
20635
|
+
this.raise(Errors.ConstructorIsGenerator, publicMethod.key);
|
|
21006
20636
|
}
|
|
21007
20637
|
this.pushClassMethod(classBody, publicMethod, true, false, false, false);
|
|
21008
20638
|
return;
|
|
@@ -21023,14 +20653,10 @@ var require_lib = __commonJS({
|
|
|
21023
20653
|
if (isConstructor) {
|
|
21024
20654
|
publicMethod.kind = "constructor";
|
|
21025
20655
|
if (state.hadConstructor && !this.hasPlugin("typescript")) {
|
|
21026
|
-
this.raise(Errors.DuplicateConstructor,
|
|
21027
|
-
at: key
|
|
21028
|
-
});
|
|
20656
|
+
this.raise(Errors.DuplicateConstructor, key);
|
|
21029
20657
|
}
|
|
21030
20658
|
if (isConstructor && this.hasPlugin("typescript") && member.override) {
|
|
21031
|
-
this.raise(Errors.OverrideOnConstructor,
|
|
21032
|
-
at: key
|
|
21033
|
-
});
|
|
20659
|
+
this.raise(Errors.OverrideOnConstructor, key);
|
|
21034
20660
|
}
|
|
21035
20661
|
state.hadConstructor = true;
|
|
21036
20662
|
allowsDirectSuper = state.hadSuperClass;
|
|
@@ -21056,9 +20682,7 @@ var require_lib = __commonJS({
|
|
|
21056
20682
|
this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
|
|
21057
20683
|
} else {
|
|
21058
20684
|
if (this.isNonstaticConstructor(publicMethod)) {
|
|
21059
|
-
this.raise(Errors.ConstructorIsAsync,
|
|
21060
|
-
at: publicMethod.key
|
|
21061
|
-
});
|
|
20685
|
+
this.raise(Errors.ConstructorIsAsync, publicMethod.key);
|
|
21062
20686
|
}
|
|
21063
20687
|
this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
|
|
21064
20688
|
}
|
|
@@ -21071,9 +20695,7 @@ var require_lib = __commonJS({
|
|
|
21071
20695
|
this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
21072
20696
|
} else {
|
|
21073
20697
|
if (this.isNonstaticConstructor(publicMethod)) {
|
|
21074
|
-
this.raise(Errors.ConstructorIsAccessor,
|
|
21075
|
-
at: publicMethod.key
|
|
21076
|
-
});
|
|
20698
|
+
this.raise(Errors.ConstructorIsAccessor, publicMethod.key);
|
|
21077
20699
|
}
|
|
21078
20700
|
this.pushClassMethod(classBody, publicMethod, false, false, false, false);
|
|
21079
20701
|
}
|
|
@@ -21100,15 +20722,11 @@ var require_lib = __commonJS({
|
|
|
21100
20722
|
value
|
|
21101
20723
|
} = this.state;
|
|
21102
20724
|
if ((type === 132 || type === 133) && member.static && value === "prototype") {
|
|
21103
|
-
this.raise(Errors.StaticPrototype,
|
|
21104
|
-
at: this.state.startLoc
|
|
21105
|
-
});
|
|
20725
|
+
this.raise(Errors.StaticPrototype, this.state.startLoc);
|
|
21106
20726
|
}
|
|
21107
20727
|
if (type === 138) {
|
|
21108
20728
|
if (value === "constructor") {
|
|
21109
|
-
this.raise(Errors.ConstructorClassPrivateField,
|
|
21110
|
-
at: this.state.startLoc
|
|
21111
|
-
});
|
|
20729
|
+
this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
|
|
21112
20730
|
}
|
|
21113
20731
|
const key = this.parsePrivateName();
|
|
21114
20732
|
member.key = key;
|
|
@@ -21129,16 +20747,12 @@ var require_lib = __commonJS({
|
|
|
21129
20747
|
this.state.labels = oldLabels;
|
|
21130
20748
|
classBody.body.push(this.finishNode(member, "StaticBlock"));
|
|
21131
20749
|
if ((_member$decorators = member.decorators) != null && _member$decorators.length) {
|
|
21132
|
-
this.raise(Errors.DecoratorStaticBlock,
|
|
21133
|
-
at: member
|
|
21134
|
-
});
|
|
20750
|
+
this.raise(Errors.DecoratorStaticBlock, member);
|
|
21135
20751
|
}
|
|
21136
20752
|
}
|
|
21137
20753
|
pushClassProperty(classBody, prop) {
|
|
21138
20754
|
if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) {
|
|
21139
|
-
this.raise(Errors.ConstructorClassField,
|
|
21140
|
-
at: prop.key
|
|
21141
|
-
});
|
|
20755
|
+
this.raise(Errors.ConstructorClassField, prop.key);
|
|
21142
20756
|
}
|
|
21143
20757
|
classBody.body.push(this.parseClassProperty(prop));
|
|
21144
20758
|
}
|
|
@@ -21151,9 +20765,7 @@ var require_lib = __commonJS({
|
|
|
21151
20765
|
if (!isPrivate && !prop.computed) {
|
|
21152
20766
|
const key = prop.key;
|
|
21153
20767
|
if (key.name === "constructor" || key.value === "constructor") {
|
|
21154
|
-
this.raise(Errors.ConstructorClassField,
|
|
21155
|
-
at: key
|
|
21156
|
-
});
|
|
20768
|
+
this.raise(Errors.ConstructorClassField, key);
|
|
21157
20769
|
}
|
|
21158
20770
|
}
|
|
21159
20771
|
const node = this.parseClassAccessorProperty(prop);
|
|
@@ -21210,9 +20822,7 @@ var require_lib = __commonJS({
|
|
|
21210
20822
|
if (optionalId || !isStatement) {
|
|
21211
20823
|
node.id = null;
|
|
21212
20824
|
} else {
|
|
21213
|
-
throw this.raise(Errors.MissingClassName,
|
|
21214
|
-
at: this.state.startLoc
|
|
21215
|
-
});
|
|
20825
|
+
throw this.raise(Errors.MissingClassName, this.state.startLoc);
|
|
21216
20826
|
}
|
|
21217
20827
|
}
|
|
21218
20828
|
}
|
|
@@ -21231,9 +20841,7 @@ var require_lib = __commonJS({
|
|
|
21231
20841
|
if (hasDefault)
|
|
21232
20842
|
this.unexpected();
|
|
21233
20843
|
if (decorators) {
|
|
21234
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
21235
|
-
at: node
|
|
21236
|
-
});
|
|
20844
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
21237
20845
|
}
|
|
21238
20846
|
this.parseExportFrom(node, true);
|
|
21239
20847
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
@@ -21249,9 +20857,7 @@ var require_lib = __commonJS({
|
|
|
21249
20857
|
if (isFromRequired || hasSpecifiers) {
|
|
21250
20858
|
hasDeclaration = false;
|
|
21251
20859
|
if (decorators) {
|
|
21252
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
21253
|
-
at: node
|
|
21254
|
-
});
|
|
20860
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
21255
20861
|
}
|
|
21256
20862
|
this.parseExportFrom(node, isFromRequired);
|
|
21257
20863
|
} else {
|
|
@@ -21264,9 +20870,7 @@ var require_lib = __commonJS({
|
|
|
21264
20870
|
if (((_node2$declaration = node2.declaration) == null ? void 0 : _node2$declaration.type) === "ClassDeclaration") {
|
|
21265
20871
|
this.maybeTakeDecorators(decorators, node2.declaration, node2);
|
|
21266
20872
|
} else if (decorators) {
|
|
21267
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
21268
|
-
at: node
|
|
21269
|
-
});
|
|
20873
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
21270
20874
|
}
|
|
21271
20875
|
return this.finishNode(node2, "ExportNamedDeclaration");
|
|
21272
20876
|
}
|
|
@@ -21277,9 +20881,7 @@ var require_lib = __commonJS({
|
|
|
21277
20881
|
if (decl.type === "ClassDeclaration") {
|
|
21278
20882
|
this.maybeTakeDecorators(decorators, decl, node2);
|
|
21279
20883
|
} else if (decorators) {
|
|
21280
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
21281
|
-
at: node
|
|
21282
|
-
});
|
|
20884
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
21283
20885
|
}
|
|
21284
20886
|
this.checkExport(node2, true, true);
|
|
21285
20887
|
return this.finishNode(node2, "ExportDefaultDeclaration");
|
|
@@ -21360,16 +20962,12 @@ var require_lib = __commonJS({
|
|
|
21360
20962
|
}
|
|
21361
20963
|
if (this.match(26)) {
|
|
21362
20964
|
if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
|
|
21363
|
-
this.raise(Errors.DecoratorBeforeExport,
|
|
21364
|
-
at: this.state.startLoc
|
|
21365
|
-
});
|
|
20965
|
+
this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
|
|
21366
20966
|
}
|
|
21367
20967
|
return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
|
|
21368
20968
|
}
|
|
21369
20969
|
if (this.match(75) || this.match(74) || this.isLet()) {
|
|
21370
|
-
throw this.raise(Errors.UnsupportedDefaultExport,
|
|
21371
|
-
at: this.state.startLoc
|
|
21372
|
-
});
|
|
20970
|
+
throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
|
|
21373
20971
|
}
|
|
21374
20972
|
const res = this.parseMaybeAssignAllowIn();
|
|
21375
20973
|
this.semicolon();
|
|
@@ -21432,9 +21030,7 @@ var require_lib = __commonJS({
|
|
|
21432
21030
|
this.expectOnePlugin(["decorators", "decorators-legacy"]);
|
|
21433
21031
|
if (this.hasPlugin("decorators")) {
|
|
21434
21032
|
if (this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
|
|
21435
|
-
this.raise(Errors.DecoratorBeforeExport,
|
|
21436
|
-
at: this.state.startLoc
|
|
21437
|
-
});
|
|
21033
|
+
this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
|
|
21438
21034
|
}
|
|
21439
21035
|
return true;
|
|
21440
21036
|
}
|
|
@@ -21450,9 +21046,7 @@ var require_lib = __commonJS({
|
|
|
21450
21046
|
var _declaration$extra;
|
|
21451
21047
|
const declaration = node.declaration;
|
|
21452
21048
|
if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
|
|
21453
|
-
this.raise(Errors.ExportDefaultFromAsIdentifier,
|
|
21454
|
-
at: declaration
|
|
21455
|
-
});
|
|
21049
|
+
this.raise(Errors.ExportDefaultFromAsIdentifier, declaration);
|
|
21456
21050
|
}
|
|
21457
21051
|
}
|
|
21458
21052
|
} else if ((_node$specifiers = node.specifiers) != null && _node$specifiers.length) {
|
|
@@ -21467,8 +21061,7 @@ var require_lib = __commonJS({
|
|
|
21467
21061
|
local
|
|
21468
21062
|
} = specifier;
|
|
21469
21063
|
if (local.type !== "Identifier") {
|
|
21470
|
-
this.raise(Errors.ExportBindingIsString, {
|
|
21471
|
-
at: specifier,
|
|
21064
|
+
this.raise(Errors.ExportBindingIsString, specifier, {
|
|
21472
21065
|
localName: local.value,
|
|
21473
21066
|
exportName
|
|
21474
21067
|
});
|
|
@@ -21516,12 +21109,9 @@ var require_lib = __commonJS({
|
|
|
21516
21109
|
checkDuplicateExports(node, exportName) {
|
|
21517
21110
|
if (this.exportedIdentifiers.has(exportName)) {
|
|
21518
21111
|
if (exportName === "default") {
|
|
21519
|
-
this.raise(Errors.DuplicateDefaultExport,
|
|
21520
|
-
at: node
|
|
21521
|
-
});
|
|
21112
|
+
this.raise(Errors.DuplicateDefaultExport, node);
|
|
21522
21113
|
} else {
|
|
21523
|
-
this.raise(Errors.DuplicateExport, {
|
|
21524
|
-
at: node,
|
|
21114
|
+
this.raise(Errors.DuplicateExport, node, {
|
|
21525
21115
|
exportName
|
|
21526
21116
|
});
|
|
21527
21117
|
}
|
|
@@ -21563,8 +21153,7 @@ var require_lib = __commonJS({
|
|
|
21563
21153
|
const result = this.parseStringLiteral(this.state.value);
|
|
21564
21154
|
const surrogate = result.value.match(loneSurrogate);
|
|
21565
21155
|
if (surrogate) {
|
|
21566
|
-
this.raise(Errors.ModuleExportNameHasLoneSurrogate, {
|
|
21567
|
-
at: result,
|
|
21156
|
+
this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, {
|
|
21568
21157
|
surrogateCharCode: surrogate[0].charCodeAt(0)
|
|
21569
21158
|
});
|
|
21570
21159
|
}
|
|
@@ -21590,27 +21179,19 @@ var require_lib = __commonJS({
|
|
|
21590
21179
|
const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
|
|
21591
21180
|
if (node.phase === "source") {
|
|
21592
21181
|
if (singleBindingType !== "ImportDefaultSpecifier") {
|
|
21593
|
-
this.raise(Errors.SourcePhaseImportRequiresDefault,
|
|
21594
|
-
at: specifiers[0].loc.start
|
|
21595
|
-
});
|
|
21182
|
+
this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0].loc.start);
|
|
21596
21183
|
}
|
|
21597
21184
|
} else if (node.phase === "defer") {
|
|
21598
21185
|
if (singleBindingType !== "ImportNamespaceSpecifier") {
|
|
21599
|
-
this.raise(Errors.DeferImportRequiresNamespace,
|
|
21600
|
-
at: specifiers[0].loc.start
|
|
21601
|
-
});
|
|
21186
|
+
this.raise(Errors.DeferImportRequiresNamespace, specifiers[0].loc.start);
|
|
21602
21187
|
}
|
|
21603
21188
|
} else if (node.module) {
|
|
21604
21189
|
var _node$assertions;
|
|
21605
21190
|
if (singleBindingType !== "ImportDefaultSpecifier") {
|
|
21606
|
-
this.raise(Errors.ImportReflectionNotBinding,
|
|
21607
|
-
at: specifiers[0].loc.start
|
|
21608
|
-
});
|
|
21191
|
+
this.raise(Errors.ImportReflectionNotBinding, specifiers[0].loc.start);
|
|
21609
21192
|
}
|
|
21610
21193
|
if (((_node$assertions = node.assertions) == null ? void 0 : _node$assertions.length) > 0) {
|
|
21611
|
-
this.raise(Errors.ImportReflectionHasAssertion,
|
|
21612
|
-
at: node.specifiers[0].loc.start
|
|
21613
|
-
});
|
|
21194
|
+
this.raise(Errors.ImportReflectionHasAssertion, specifiers[0].loc.start);
|
|
21614
21195
|
}
|
|
21615
21196
|
}
|
|
21616
21197
|
}
|
|
@@ -21632,9 +21213,7 @@ var require_lib = __commonJS({
|
|
|
21632
21213
|
}
|
|
21633
21214
|
});
|
|
21634
21215
|
if (nonDefaultNamedSpecifier !== void 0) {
|
|
21635
|
-
this.raise(Errors.ImportJSONBindingNotDefault,
|
|
21636
|
-
at: nonDefaultNamedSpecifier.loc.start
|
|
21637
|
-
});
|
|
21216
|
+
this.raise(Errors.ImportJSONBindingNotDefault, nonDefaultNamedSpecifier.loc.start);
|
|
21638
21217
|
}
|
|
21639
21218
|
}
|
|
21640
21219
|
}
|
|
@@ -21744,8 +21323,7 @@ var require_lib = __commonJS({
|
|
|
21744
21323
|
const node = this.startNode();
|
|
21745
21324
|
const keyName = this.state.value;
|
|
21746
21325
|
if (attrNames.has(keyName)) {
|
|
21747
|
-
this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
|
|
21748
|
-
at: this.state.startLoc,
|
|
21326
|
+
this.raise(Errors.ModuleAttributesWithDuplicateKeys, this.state.startLoc, {
|
|
21749
21327
|
key: keyName
|
|
21750
21328
|
});
|
|
21751
21329
|
}
|
|
@@ -21757,9 +21335,7 @@ var require_lib = __commonJS({
|
|
|
21757
21335
|
}
|
|
21758
21336
|
this.expect(14);
|
|
21759
21337
|
if (!this.match(133)) {
|
|
21760
|
-
throw this.raise(Errors.ModuleAttributeInvalidValue,
|
|
21761
|
-
at: this.state.startLoc
|
|
21762
|
-
});
|
|
21338
|
+
throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
21763
21339
|
}
|
|
21764
21340
|
node.value = this.parseStringLiteral(this.state.value);
|
|
21765
21341
|
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
@@ -21774,22 +21350,17 @@ var require_lib = __commonJS({
|
|
|
21774
21350
|
const node = this.startNode();
|
|
21775
21351
|
node.key = this.parseIdentifier(true);
|
|
21776
21352
|
if (node.key.name !== "type") {
|
|
21777
|
-
this.raise(Errors.ModuleAttributeDifferentFromType,
|
|
21778
|
-
at: node.key
|
|
21779
|
-
});
|
|
21353
|
+
this.raise(Errors.ModuleAttributeDifferentFromType, node.key);
|
|
21780
21354
|
}
|
|
21781
21355
|
if (attributes.has(node.key.name)) {
|
|
21782
|
-
this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
|
|
21783
|
-
at: node.key,
|
|
21356
|
+
this.raise(Errors.ModuleAttributesWithDuplicateKeys, node.key, {
|
|
21784
21357
|
key: node.key.name
|
|
21785
21358
|
});
|
|
21786
21359
|
}
|
|
21787
21360
|
attributes.add(node.key.name);
|
|
21788
21361
|
this.expect(14);
|
|
21789
21362
|
if (!this.match(133)) {
|
|
21790
|
-
throw this.raise(Errors.ModuleAttributeInvalidValue,
|
|
21791
|
-
at: this.state.startLoc
|
|
21792
|
-
});
|
|
21363
|
+
throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
21793
21364
|
}
|
|
21794
21365
|
node.value = this.parseStringLiteral(this.state.value);
|
|
21795
21366
|
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
@@ -21816,9 +21387,7 @@ var require_lib = __commonJS({
|
|
|
21816
21387
|
} else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
|
|
21817
21388
|
if (this.hasPlugin("importAttributes")) {
|
|
21818
21389
|
if (this.getPluginOption("importAttributes", "deprecatedAssertSyntax") !== true) {
|
|
21819
|
-
this.raise(Errors.ImportAttributesUseAssert,
|
|
21820
|
-
at: this.state.startLoc
|
|
21821
|
-
});
|
|
21390
|
+
this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
|
|
21822
21391
|
}
|
|
21823
21392
|
this.addExtra(node, "deprecatedAssertSyntax", true);
|
|
21824
21393
|
} else {
|
|
@@ -21870,9 +21439,7 @@ var require_lib = __commonJS({
|
|
|
21870
21439
|
first = false;
|
|
21871
21440
|
} else {
|
|
21872
21441
|
if (this.eat(14)) {
|
|
21873
|
-
throw this.raise(Errors.DestructureNamedImport,
|
|
21874
|
-
at: this.state.startLoc
|
|
21875
|
-
});
|
|
21442
|
+
throw this.raise(Errors.DestructureNamedImport, this.state.startLoc);
|
|
21876
21443
|
}
|
|
21877
21444
|
this.expect(12);
|
|
21878
21445
|
if (this.eat(8))
|
|
@@ -21894,8 +21461,7 @@ var require_lib = __commonJS({
|
|
|
21894
21461
|
imported
|
|
21895
21462
|
} = specifier;
|
|
21896
21463
|
if (importedIsString) {
|
|
21897
|
-
throw this.raise(Errors.ImportBindingIsString, {
|
|
21898
|
-
at: specifier,
|
|
21464
|
+
throw this.raise(Errors.ImportBindingIsString, specifier, {
|
|
21899
21465
|
importName: imported.value
|
|
21900
21466
|
});
|
|
21901
21467
|
}
|
|
@@ -21930,6 +21496,7 @@ var require_lib = __commonJS({
|
|
|
21930
21496
|
file.errors = null;
|
|
21931
21497
|
this.parseTopLevel(file, program);
|
|
21932
21498
|
file.errors = this.state.errors;
|
|
21499
|
+
file.comments.length = this.state.commentsLen;
|
|
21933
21500
|
return file;
|
|
21934
21501
|
}
|
|
21935
21502
|
};
|
|
@@ -22019,7 +21586,8 @@ var require_lib = __commonJS({
|
|
|
22019
21586
|
});
|
|
22020
21587
|
|
|
22021
21588
|
// src/index.ts
|
|
22022
|
-
import { promises as
|
|
21589
|
+
import { promises as fs3 } from "node:fs";
|
|
21590
|
+
import process5 from "node:process";
|
|
22023
21591
|
import { createUnplugin } from "unplugin";
|
|
22024
21592
|
|
|
22025
21593
|
// src/core/generate.ts
|
|
@@ -22028,7 +21596,7 @@ import path, { resolve } from "node:path";
|
|
|
22028
21596
|
import { promises as fs } from "node:fs";
|
|
22029
21597
|
import process2 from "node:process";
|
|
22030
21598
|
|
|
22031
|
-
// node_modules/.pnpm/magicast@0.3.
|
|
21599
|
+
// node_modules/.pnpm/magicast@0.3.3/node_modules/magicast/dist/index.mjs
|
|
22032
21600
|
import { promises } from "node:fs";
|
|
22033
21601
|
var import_source_map_js = __toESM(require_source_map(), 1);
|
|
22034
21602
|
var babelParser = __toESM(require_lib(), 1);
|
|
@@ -30149,8 +29717,13 @@ function createImportsProxy(root, mod) {
|
|
|
30149
29717
|
item.from = value.from;
|
|
30150
29718
|
return true;
|
|
30151
29719
|
}
|
|
30152
|
-
const specifier = value.imported === "default" ? b$3.importDefaultSpecifier(b$3.identifier(local)) : value.imported === "*" ? b$3.importNamespaceSpecifier(b$3.identifier(local)) : b$3.importSpecifier(
|
|
30153
|
-
|
|
29720
|
+
const specifier = value.imported === "default" ? b$3.importDefaultSpecifier(b$3.identifier(local)) : value.imported === "*" ? b$3.importNamespaceSpecifier(b$3.identifier(local)) : b$3.importSpecifier(
|
|
29721
|
+
b$3.identifier(value.imported),
|
|
29722
|
+
b$3.identifier(local)
|
|
29723
|
+
);
|
|
29724
|
+
const declaration = (_a = imports.find(
|
|
29725
|
+
(i) => i.from === value.from
|
|
29726
|
+
)) == null ? void 0 : _a.$declaration;
|
|
30154
29727
|
if (declaration) {
|
|
30155
29728
|
declaration.specifiers.push(specifier);
|
|
30156
29729
|
} else {
|
|
@@ -30338,6 +29911,21 @@ function proxifyFunctionCall(node, mod) {
|
|
|
30338
29911
|
{}
|
|
30339
29912
|
);
|
|
30340
29913
|
}
|
|
29914
|
+
function proxifyArrowFunctionExpression(node, mod) {
|
|
29915
|
+
if (node.type !== "ArrowFunctionExpression") {
|
|
29916
|
+
throw new MagicastError("Not an arrow function expression");
|
|
29917
|
+
}
|
|
29918
|
+
const parametersProxy = proxifyArrayElements(node, node.params, mod);
|
|
29919
|
+
return createProxy(
|
|
29920
|
+
node,
|
|
29921
|
+
{
|
|
29922
|
+
$type: "arrow-function-expression",
|
|
29923
|
+
$params: parametersProxy,
|
|
29924
|
+
$body: proxify(node.body, mod)
|
|
29925
|
+
},
|
|
29926
|
+
{}
|
|
29927
|
+
);
|
|
29928
|
+
}
|
|
30341
29929
|
var b$2 = builders$1;
|
|
30342
29930
|
function proxifyObject(node, mod) {
|
|
30343
29931
|
if (!("properties" in node)) {
|
|
@@ -30499,6 +30087,10 @@ function proxify(node, mod) {
|
|
|
30499
30087
|
proxy = proxifyFunctionCall(node, mod);
|
|
30500
30088
|
break;
|
|
30501
30089
|
}
|
|
30090
|
+
case "ArrowFunctionExpression": {
|
|
30091
|
+
proxy = proxifyArrowFunctionExpression(node, mod);
|
|
30092
|
+
break;
|
|
30093
|
+
}
|
|
30502
30094
|
case "NewExpression": {
|
|
30503
30095
|
proxy = proxifyNewExpression(node, mod);
|
|
30504
30096
|
break;
|
|
@@ -30751,7 +30343,7 @@ async function loadFile(filename, options = {}) {
|
|
|
30751
30343
|
import { deepMerge } from "@antfu/utils";
|
|
30752
30344
|
async function generateScript(options, mode) {
|
|
30753
30345
|
const { dir, fileName, globalName, serve, build } = options.env;
|
|
30754
|
-
const folder = await findFolder(process2.cwd(), dir
|
|
30346
|
+
const folder = await findFolder(process2.cwd(), dir);
|
|
30755
30347
|
const files = await (0, import_fast_glob.default)("*.+(js|ts)", {
|
|
30756
30348
|
absolute: true,
|
|
30757
30349
|
cwd: folder
|
|
@@ -30760,13 +30352,17 @@ async function generateScript(options, mode) {
|
|
|
30760
30352
|
let target = {};
|
|
30761
30353
|
const source = [];
|
|
30762
30354
|
let code = "";
|
|
30763
|
-
const name = fileName
|
|
30355
|
+
const name = fileName;
|
|
30764
30356
|
for (const file of files) {
|
|
30765
|
-
|
|
30766
|
-
|
|
30767
|
-
|
|
30768
|
-
|
|
30769
|
-
|
|
30357
|
+
try {
|
|
30358
|
+
const mod = await loadFile(file);
|
|
30359
|
+
if (testReg == null ? void 0 : testReg.test(file))
|
|
30360
|
+
target = mod.exports.default;
|
|
30361
|
+
else
|
|
30362
|
+
source.push(mod.exports.default);
|
|
30363
|
+
} catch (error) {
|
|
30364
|
+
console.error(`Error loading file ${file}:`, error);
|
|
30365
|
+
}
|
|
30770
30366
|
}
|
|
30771
30367
|
const returnedTarget = deepMerge({}, source, target);
|
|
30772
30368
|
const versionInfo = await generateVersion(options, mode);
|
|
@@ -30781,7 +30377,7 @@ async function generateScript(options, mode) {
|
|
|
30781
30377
|
fileName: name,
|
|
30782
30378
|
source: formatCode
|
|
30783
30379
|
},
|
|
30784
|
-
|
|
30380
|
+
watchFiles: files
|
|
30785
30381
|
};
|
|
30786
30382
|
}
|
|
30787
30383
|
async function generateVersion(options, mode) {
|
|
@@ -30794,20 +30390,20 @@ async function generateVersion(options, mode) {
|
|
|
30794
30390
|
return `console.info("Version: ${packageJson.version} - ${mode === "serve" ? "runtime" : "built"} on ${options.date}")`;
|
|
30795
30391
|
}
|
|
30796
30392
|
async function findFolder(directoryPath, dir) {
|
|
30797
|
-
const ignore = ["dist", "node_modules", "playground", "example", "test", "jest", "tests", "locales", "public", ".git", ".github", ".vscode"];
|
|
30798
|
-
|
|
30799
|
-
|
|
30800
|
-
|
|
30801
|
-
|
|
30802
|
-
const
|
|
30803
|
-
const stat = await fs.stat(
|
|
30393
|
+
const ignore = /* @__PURE__ */ new Set(["dist", "node_modules", "playground", "example", "test", "jest", "tests", "locales", "public", ".git", ".github", ".vscode"]);
|
|
30394
|
+
const files = await fs.readdir(directoryPath);
|
|
30395
|
+
const filePaths = files.filter((item) => !ignore.has(item));
|
|
30396
|
+
let nestedFolder = "";
|
|
30397
|
+
for (const file of filePaths) {
|
|
30398
|
+
const fullFilePath = path.join(directoryPath, file);
|
|
30399
|
+
const stat = await fs.stat(fullFilePath);
|
|
30804
30400
|
if (stat.isDirectory()) {
|
|
30805
30401
|
if (file.toLowerCase() === dir) {
|
|
30806
|
-
return
|
|
30402
|
+
return fullFilePath;
|
|
30807
30403
|
} else {
|
|
30808
|
-
|
|
30809
|
-
if (
|
|
30810
|
-
return
|
|
30404
|
+
nestedFolder = await findFolder(fullFilePath, dir);
|
|
30405
|
+
if (nestedFolder)
|
|
30406
|
+
return nestedFolder;
|
|
30811
30407
|
}
|
|
30812
30408
|
}
|
|
30813
30409
|
}
|
|
@@ -30816,7 +30412,7 @@ async function findFolder(directoryPath, dir) {
|
|
|
30816
30412
|
|
|
30817
30413
|
// src/core/options.ts
|
|
30818
30414
|
import { deepMerge as deepMerge2 } from "@antfu/utils";
|
|
30819
|
-
|
|
30415
|
+
function resolveOptions(options) {
|
|
30820
30416
|
const defaults2 = {
|
|
30821
30417
|
env: {
|
|
30822
30418
|
dir: "config",
|
|
@@ -30824,6 +30420,10 @@ async function resolveOptions(options) {
|
|
|
30824
30420
|
globalName: "manifest",
|
|
30825
30421
|
serve: /dev|development/i,
|
|
30826
30422
|
build: /prod|production/i
|
|
30423
|
+
},
|
|
30424
|
+
compress: {
|
|
30425
|
+
outDir: "dist",
|
|
30426
|
+
ignoreBase: true
|
|
30827
30427
|
}
|
|
30828
30428
|
};
|
|
30829
30429
|
const mergeOptions = deepMerge2(defaults2, options);
|
|
@@ -30833,6 +30433,536 @@ async function resolveOptions(options) {
|
|
|
30833
30433
|
};
|
|
30834
30434
|
}
|
|
30835
30435
|
|
|
30436
|
+
// src/core/compress.ts
|
|
30437
|
+
import fs2 from "node:fs";
|
|
30438
|
+
import process4 from "node:process";
|
|
30439
|
+
import archiver from "archiver";
|
|
30440
|
+
|
|
30441
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
30442
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
30443
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
30444
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
30445
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
30446
|
+
var styles = {
|
|
30447
|
+
modifier: {
|
|
30448
|
+
reset: [0, 0],
|
|
30449
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
30450
|
+
bold: [1, 22],
|
|
30451
|
+
dim: [2, 22],
|
|
30452
|
+
italic: [3, 23],
|
|
30453
|
+
underline: [4, 24],
|
|
30454
|
+
overline: [53, 55],
|
|
30455
|
+
inverse: [7, 27],
|
|
30456
|
+
hidden: [8, 28],
|
|
30457
|
+
strikethrough: [9, 29]
|
|
30458
|
+
},
|
|
30459
|
+
color: {
|
|
30460
|
+
black: [30, 39],
|
|
30461
|
+
red: [31, 39],
|
|
30462
|
+
green: [32, 39],
|
|
30463
|
+
yellow: [33, 39],
|
|
30464
|
+
blue: [34, 39],
|
|
30465
|
+
magenta: [35, 39],
|
|
30466
|
+
cyan: [36, 39],
|
|
30467
|
+
white: [37, 39],
|
|
30468
|
+
// Bright color
|
|
30469
|
+
blackBright: [90, 39],
|
|
30470
|
+
gray: [90, 39],
|
|
30471
|
+
// Alias of `blackBright`
|
|
30472
|
+
grey: [90, 39],
|
|
30473
|
+
// Alias of `blackBright`
|
|
30474
|
+
redBright: [91, 39],
|
|
30475
|
+
greenBright: [92, 39],
|
|
30476
|
+
yellowBright: [93, 39],
|
|
30477
|
+
blueBright: [94, 39],
|
|
30478
|
+
magentaBright: [95, 39],
|
|
30479
|
+
cyanBright: [96, 39],
|
|
30480
|
+
whiteBright: [97, 39]
|
|
30481
|
+
},
|
|
30482
|
+
bgColor: {
|
|
30483
|
+
bgBlack: [40, 49],
|
|
30484
|
+
bgRed: [41, 49],
|
|
30485
|
+
bgGreen: [42, 49],
|
|
30486
|
+
bgYellow: [43, 49],
|
|
30487
|
+
bgBlue: [44, 49],
|
|
30488
|
+
bgMagenta: [45, 49],
|
|
30489
|
+
bgCyan: [46, 49],
|
|
30490
|
+
bgWhite: [47, 49],
|
|
30491
|
+
// Bright color
|
|
30492
|
+
bgBlackBright: [100, 49],
|
|
30493
|
+
bgGray: [100, 49],
|
|
30494
|
+
// Alias of `bgBlackBright`
|
|
30495
|
+
bgGrey: [100, 49],
|
|
30496
|
+
// Alias of `bgBlackBright`
|
|
30497
|
+
bgRedBright: [101, 49],
|
|
30498
|
+
bgGreenBright: [102, 49],
|
|
30499
|
+
bgYellowBright: [103, 49],
|
|
30500
|
+
bgBlueBright: [104, 49],
|
|
30501
|
+
bgMagentaBright: [105, 49],
|
|
30502
|
+
bgCyanBright: [106, 49],
|
|
30503
|
+
bgWhiteBright: [107, 49]
|
|
30504
|
+
}
|
|
30505
|
+
};
|
|
30506
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
30507
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
30508
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
30509
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
30510
|
+
function assembleStyles() {
|
|
30511
|
+
const codes = /* @__PURE__ */ new Map();
|
|
30512
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
30513
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
30514
|
+
styles[styleName] = {
|
|
30515
|
+
open: `\x1B[${style[0]}m`,
|
|
30516
|
+
close: `\x1B[${style[1]}m`
|
|
30517
|
+
};
|
|
30518
|
+
group[styleName] = styles[styleName];
|
|
30519
|
+
codes.set(style[0], style[1]);
|
|
30520
|
+
}
|
|
30521
|
+
Object.defineProperty(styles, groupName, {
|
|
30522
|
+
value: group,
|
|
30523
|
+
enumerable: false
|
|
30524
|
+
});
|
|
30525
|
+
}
|
|
30526
|
+
Object.defineProperty(styles, "codes", {
|
|
30527
|
+
value: codes,
|
|
30528
|
+
enumerable: false
|
|
30529
|
+
});
|
|
30530
|
+
styles.color.close = "\x1B[39m";
|
|
30531
|
+
styles.bgColor.close = "\x1B[49m";
|
|
30532
|
+
styles.color.ansi = wrapAnsi16();
|
|
30533
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
30534
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
30535
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
30536
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
30537
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
30538
|
+
Object.defineProperties(styles, {
|
|
30539
|
+
rgbToAnsi256: {
|
|
30540
|
+
value(red, green, blue) {
|
|
30541
|
+
if (red === green && green === blue) {
|
|
30542
|
+
if (red < 8) {
|
|
30543
|
+
return 16;
|
|
30544
|
+
}
|
|
30545
|
+
if (red > 248) {
|
|
30546
|
+
return 231;
|
|
30547
|
+
}
|
|
30548
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
30549
|
+
}
|
|
30550
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
30551
|
+
},
|
|
30552
|
+
enumerable: false
|
|
30553
|
+
},
|
|
30554
|
+
hexToRgb: {
|
|
30555
|
+
value(hex) {
|
|
30556
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
30557
|
+
if (!matches) {
|
|
30558
|
+
return [0, 0, 0];
|
|
30559
|
+
}
|
|
30560
|
+
let [colorString] = matches;
|
|
30561
|
+
if (colorString.length === 3) {
|
|
30562
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
30563
|
+
}
|
|
30564
|
+
const integer = Number.parseInt(colorString, 16);
|
|
30565
|
+
return [
|
|
30566
|
+
/* eslint-disable no-bitwise */
|
|
30567
|
+
integer >> 16 & 255,
|
|
30568
|
+
integer >> 8 & 255,
|
|
30569
|
+
integer & 255
|
|
30570
|
+
/* eslint-enable no-bitwise */
|
|
30571
|
+
];
|
|
30572
|
+
},
|
|
30573
|
+
enumerable: false
|
|
30574
|
+
},
|
|
30575
|
+
hexToAnsi256: {
|
|
30576
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
30577
|
+
enumerable: false
|
|
30578
|
+
},
|
|
30579
|
+
ansi256ToAnsi: {
|
|
30580
|
+
value(code) {
|
|
30581
|
+
if (code < 8) {
|
|
30582
|
+
return 30 + code;
|
|
30583
|
+
}
|
|
30584
|
+
if (code < 16) {
|
|
30585
|
+
return 90 + (code - 8);
|
|
30586
|
+
}
|
|
30587
|
+
let red;
|
|
30588
|
+
let green;
|
|
30589
|
+
let blue;
|
|
30590
|
+
if (code >= 232) {
|
|
30591
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
30592
|
+
green = red;
|
|
30593
|
+
blue = red;
|
|
30594
|
+
} else {
|
|
30595
|
+
code -= 16;
|
|
30596
|
+
const remainder = code % 36;
|
|
30597
|
+
red = Math.floor(code / 36) / 5;
|
|
30598
|
+
green = Math.floor(remainder / 6) / 5;
|
|
30599
|
+
blue = remainder % 6 / 5;
|
|
30600
|
+
}
|
|
30601
|
+
const value = Math.max(red, green, blue) * 2;
|
|
30602
|
+
if (value === 0) {
|
|
30603
|
+
return 30;
|
|
30604
|
+
}
|
|
30605
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
30606
|
+
if (value === 2) {
|
|
30607
|
+
result += 60;
|
|
30608
|
+
}
|
|
30609
|
+
return result;
|
|
30610
|
+
},
|
|
30611
|
+
enumerable: false
|
|
30612
|
+
},
|
|
30613
|
+
rgbToAnsi: {
|
|
30614
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
30615
|
+
enumerable: false
|
|
30616
|
+
},
|
|
30617
|
+
hexToAnsi: {
|
|
30618
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
30619
|
+
enumerable: false
|
|
30620
|
+
}
|
|
30621
|
+
});
|
|
30622
|
+
return styles;
|
|
30623
|
+
}
|
|
30624
|
+
var ansiStyles = assembleStyles();
|
|
30625
|
+
var ansi_styles_default = ansiStyles;
|
|
30626
|
+
|
|
30627
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
|
|
30628
|
+
import process3 from "node:process";
|
|
30629
|
+
import os from "node:os";
|
|
30630
|
+
import tty from "node:tty";
|
|
30631
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process3.argv) {
|
|
30632
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
30633
|
+
const position = argv.indexOf(prefix + flag);
|
|
30634
|
+
const terminatorPosition = argv.indexOf("--");
|
|
30635
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
30636
|
+
}
|
|
30637
|
+
var { env } = process3;
|
|
30638
|
+
var flagForceColor;
|
|
30639
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
30640
|
+
flagForceColor = 0;
|
|
30641
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
30642
|
+
flagForceColor = 1;
|
|
30643
|
+
}
|
|
30644
|
+
function envForceColor() {
|
|
30645
|
+
if ("FORCE_COLOR" in env) {
|
|
30646
|
+
if (env.FORCE_COLOR === "true") {
|
|
30647
|
+
return 1;
|
|
30648
|
+
}
|
|
30649
|
+
if (env.FORCE_COLOR === "false") {
|
|
30650
|
+
return 0;
|
|
30651
|
+
}
|
|
30652
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
30653
|
+
}
|
|
30654
|
+
}
|
|
30655
|
+
function translateLevel(level) {
|
|
30656
|
+
if (level === 0) {
|
|
30657
|
+
return false;
|
|
30658
|
+
}
|
|
30659
|
+
return {
|
|
30660
|
+
level,
|
|
30661
|
+
hasBasic: true,
|
|
30662
|
+
has256: level >= 2,
|
|
30663
|
+
has16m: level >= 3
|
|
30664
|
+
};
|
|
30665
|
+
}
|
|
30666
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
30667
|
+
const noFlagForceColor = envForceColor();
|
|
30668
|
+
if (noFlagForceColor !== void 0) {
|
|
30669
|
+
flagForceColor = noFlagForceColor;
|
|
30670
|
+
}
|
|
30671
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
30672
|
+
if (forceColor === 0) {
|
|
30673
|
+
return 0;
|
|
30674
|
+
}
|
|
30675
|
+
if (sniffFlags) {
|
|
30676
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
30677
|
+
return 3;
|
|
30678
|
+
}
|
|
30679
|
+
if (hasFlag("color=256")) {
|
|
30680
|
+
return 2;
|
|
30681
|
+
}
|
|
30682
|
+
}
|
|
30683
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
30684
|
+
return 1;
|
|
30685
|
+
}
|
|
30686
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
30687
|
+
return 0;
|
|
30688
|
+
}
|
|
30689
|
+
const min = forceColor || 0;
|
|
30690
|
+
if (env.TERM === "dumb") {
|
|
30691
|
+
return min;
|
|
30692
|
+
}
|
|
30693
|
+
if (process3.platform === "win32") {
|
|
30694
|
+
const osRelease = os.release().split(".");
|
|
30695
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
30696
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
30697
|
+
}
|
|
30698
|
+
return 1;
|
|
30699
|
+
}
|
|
30700
|
+
if ("CI" in env) {
|
|
30701
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
|
30702
|
+
return 3;
|
|
30703
|
+
}
|
|
30704
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
30705
|
+
return 1;
|
|
30706
|
+
}
|
|
30707
|
+
return min;
|
|
30708
|
+
}
|
|
30709
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
30710
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
30711
|
+
}
|
|
30712
|
+
if (env.COLORTERM === "truecolor") {
|
|
30713
|
+
return 3;
|
|
30714
|
+
}
|
|
30715
|
+
if (env.TERM === "xterm-kitty") {
|
|
30716
|
+
return 3;
|
|
30717
|
+
}
|
|
30718
|
+
if ("TERM_PROGRAM" in env) {
|
|
30719
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
30720
|
+
switch (env.TERM_PROGRAM) {
|
|
30721
|
+
case "iTerm.app": {
|
|
30722
|
+
return version >= 3 ? 3 : 2;
|
|
30723
|
+
}
|
|
30724
|
+
case "Apple_Terminal": {
|
|
30725
|
+
return 2;
|
|
30726
|
+
}
|
|
30727
|
+
}
|
|
30728
|
+
}
|
|
30729
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
30730
|
+
return 2;
|
|
30731
|
+
}
|
|
30732
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
30733
|
+
return 1;
|
|
30734
|
+
}
|
|
30735
|
+
if ("COLORTERM" in env) {
|
|
30736
|
+
return 1;
|
|
30737
|
+
}
|
|
30738
|
+
return min;
|
|
30739
|
+
}
|
|
30740
|
+
function createSupportsColor(stream, options = {}) {
|
|
30741
|
+
const level = _supportsColor(stream, {
|
|
30742
|
+
streamIsTTY: stream && stream.isTTY,
|
|
30743
|
+
...options
|
|
30744
|
+
});
|
|
30745
|
+
return translateLevel(level);
|
|
30746
|
+
}
|
|
30747
|
+
var supportsColor = {
|
|
30748
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
30749
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
30750
|
+
};
|
|
30751
|
+
var supports_color_default = supportsColor;
|
|
30752
|
+
|
|
30753
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
|
30754
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
30755
|
+
let index = string.indexOf(substring);
|
|
30756
|
+
if (index === -1) {
|
|
30757
|
+
return string;
|
|
30758
|
+
}
|
|
30759
|
+
const substringLength = substring.length;
|
|
30760
|
+
let endIndex = 0;
|
|
30761
|
+
let returnValue = "";
|
|
30762
|
+
do {
|
|
30763
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
30764
|
+
endIndex = index + substringLength;
|
|
30765
|
+
index = string.indexOf(substring, endIndex);
|
|
30766
|
+
} while (index !== -1);
|
|
30767
|
+
returnValue += string.slice(endIndex);
|
|
30768
|
+
return returnValue;
|
|
30769
|
+
}
|
|
30770
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
30771
|
+
let endIndex = 0;
|
|
30772
|
+
let returnValue = "";
|
|
30773
|
+
do {
|
|
30774
|
+
const gotCR = string[index - 1] === "\r";
|
|
30775
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
30776
|
+
endIndex = index + 1;
|
|
30777
|
+
index = string.indexOf("\n", endIndex);
|
|
30778
|
+
} while (index !== -1);
|
|
30779
|
+
returnValue += string.slice(endIndex);
|
|
30780
|
+
return returnValue;
|
|
30781
|
+
}
|
|
30782
|
+
|
|
30783
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
|
30784
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
30785
|
+
var GENERATOR = Symbol("GENERATOR");
|
|
30786
|
+
var STYLER = Symbol("STYLER");
|
|
30787
|
+
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
30788
|
+
var levelMapping = [
|
|
30789
|
+
"ansi",
|
|
30790
|
+
"ansi",
|
|
30791
|
+
"ansi256",
|
|
30792
|
+
"ansi16m"
|
|
30793
|
+
];
|
|
30794
|
+
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
30795
|
+
var applyOptions = (object, options = {}) => {
|
|
30796
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
30797
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
30798
|
+
}
|
|
30799
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
30800
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
30801
|
+
};
|
|
30802
|
+
var chalkFactory = (options) => {
|
|
30803
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
30804
|
+
applyOptions(chalk2, options);
|
|
30805
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
30806
|
+
return chalk2;
|
|
30807
|
+
};
|
|
30808
|
+
function createChalk(options) {
|
|
30809
|
+
return chalkFactory(options);
|
|
30810
|
+
}
|
|
30811
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
30812
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
30813
|
+
styles2[styleName] = {
|
|
30814
|
+
get() {
|
|
30815
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
30816
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
30817
|
+
return builder;
|
|
30818
|
+
}
|
|
30819
|
+
};
|
|
30820
|
+
}
|
|
30821
|
+
styles2.visible = {
|
|
30822
|
+
get() {
|
|
30823
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
30824
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
30825
|
+
return builder;
|
|
30826
|
+
}
|
|
30827
|
+
};
|
|
30828
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
30829
|
+
if (model === "rgb") {
|
|
30830
|
+
if (level === "ansi16m") {
|
|
30831
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
30832
|
+
}
|
|
30833
|
+
if (level === "ansi256") {
|
|
30834
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
30835
|
+
}
|
|
30836
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
30837
|
+
}
|
|
30838
|
+
if (model === "hex") {
|
|
30839
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
30840
|
+
}
|
|
30841
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
30842
|
+
};
|
|
30843
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
30844
|
+
for (const model of usedModels) {
|
|
30845
|
+
styles2[model] = {
|
|
30846
|
+
get() {
|
|
30847
|
+
const { level } = this;
|
|
30848
|
+
return function(...arguments_) {
|
|
30849
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
30850
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
30851
|
+
};
|
|
30852
|
+
}
|
|
30853
|
+
};
|
|
30854
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
30855
|
+
styles2[bgModel] = {
|
|
30856
|
+
get() {
|
|
30857
|
+
const { level } = this;
|
|
30858
|
+
return function(...arguments_) {
|
|
30859
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
30860
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
30861
|
+
};
|
|
30862
|
+
}
|
|
30863
|
+
};
|
|
30864
|
+
}
|
|
30865
|
+
var proto = Object.defineProperties(() => {
|
|
30866
|
+
}, {
|
|
30867
|
+
...styles2,
|
|
30868
|
+
level: {
|
|
30869
|
+
enumerable: true,
|
|
30870
|
+
get() {
|
|
30871
|
+
return this[GENERATOR].level;
|
|
30872
|
+
},
|
|
30873
|
+
set(level) {
|
|
30874
|
+
this[GENERATOR].level = level;
|
|
30875
|
+
}
|
|
30876
|
+
}
|
|
30877
|
+
});
|
|
30878
|
+
var createStyler = (open, close, parent) => {
|
|
30879
|
+
let openAll;
|
|
30880
|
+
let closeAll;
|
|
30881
|
+
if (parent === void 0) {
|
|
30882
|
+
openAll = open;
|
|
30883
|
+
closeAll = close;
|
|
30884
|
+
} else {
|
|
30885
|
+
openAll = parent.openAll + open;
|
|
30886
|
+
closeAll = close + parent.closeAll;
|
|
30887
|
+
}
|
|
30888
|
+
return {
|
|
30889
|
+
open,
|
|
30890
|
+
close,
|
|
30891
|
+
openAll,
|
|
30892
|
+
closeAll,
|
|
30893
|
+
parent
|
|
30894
|
+
};
|
|
30895
|
+
};
|
|
30896
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
30897
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
30898
|
+
Object.setPrototypeOf(builder, proto);
|
|
30899
|
+
builder[GENERATOR] = self;
|
|
30900
|
+
builder[STYLER] = _styler;
|
|
30901
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
30902
|
+
return builder;
|
|
30903
|
+
};
|
|
30904
|
+
var applyStyle = (self, string) => {
|
|
30905
|
+
if (self.level <= 0 || !string) {
|
|
30906
|
+
return self[IS_EMPTY] ? "" : string;
|
|
30907
|
+
}
|
|
30908
|
+
let styler = self[STYLER];
|
|
30909
|
+
if (styler === void 0) {
|
|
30910
|
+
return string;
|
|
30911
|
+
}
|
|
30912
|
+
const { openAll, closeAll } = styler;
|
|
30913
|
+
if (string.includes("\x1B")) {
|
|
30914
|
+
while (styler !== void 0) {
|
|
30915
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
30916
|
+
styler = styler.parent;
|
|
30917
|
+
}
|
|
30918
|
+
}
|
|
30919
|
+
const lfIndex = string.indexOf("\n");
|
|
30920
|
+
if (lfIndex !== -1) {
|
|
30921
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
30922
|
+
}
|
|
30923
|
+
return openAll + string + closeAll;
|
|
30924
|
+
};
|
|
30925
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
30926
|
+
var chalk = createChalk();
|
|
30927
|
+
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
30928
|
+
var source_default = chalk;
|
|
30929
|
+
|
|
30930
|
+
// src/core/log.ts
|
|
30931
|
+
var log = console.log;
|
|
30932
|
+
var Log = class {
|
|
30933
|
+
static log(key, msg) {
|
|
30934
|
+
log(source_default.bold(`${key}: ${msg}`));
|
|
30935
|
+
}
|
|
30936
|
+
static error(key, msg) {
|
|
30937
|
+
log(source_default.bold.red(`${key}: ${msg}`));
|
|
30938
|
+
}
|
|
30939
|
+
static success(key, msg) {
|
|
30940
|
+
log(source_default.bold.green(`${key}: ${msg}`));
|
|
30941
|
+
}
|
|
30942
|
+
};
|
|
30943
|
+
|
|
30944
|
+
// src/core/compress.ts
|
|
30945
|
+
async function createCompress(options) {
|
|
30946
|
+
const { outDir, ignoreBase } = options;
|
|
30947
|
+
const zipFilePath = `${outDir}.zip`;
|
|
30948
|
+
Log.log("Compressing the directory", outDir);
|
|
30949
|
+
try {
|
|
30950
|
+
const output = fs2.createWriteStream(zipFilePath);
|
|
30951
|
+
const archive = archiver("zip", {
|
|
30952
|
+
zlib: { level: 9 }
|
|
30953
|
+
// 设置压缩级别为最高
|
|
30954
|
+
});
|
|
30955
|
+
archive.pipe(output);
|
|
30956
|
+
archive.directory(outDir, ignoreBase ? outDir : false);
|
|
30957
|
+
await archive.finalize();
|
|
30958
|
+
Log.success("Successfully compressed the directory", outDir);
|
|
30959
|
+
process4.exit(0);
|
|
30960
|
+
} catch (error) {
|
|
30961
|
+
Log.error("Error compressing the directory", error);
|
|
30962
|
+
throw error;
|
|
30963
|
+
}
|
|
30964
|
+
}
|
|
30965
|
+
|
|
30836
30966
|
// src/index.ts
|
|
30837
30967
|
var virtualEnvId = "virtual:env";
|
|
30838
30968
|
var resolvedVirtualEnvId = `\0${virtualEnvId}`;
|
|
@@ -30848,8 +30978,10 @@ var unpluginFactory = (options = {}) => {
|
|
|
30848
30978
|
},
|
|
30849
30979
|
async load(id) {
|
|
30850
30980
|
if (id.startsWith(resolvedVirtualEnvId)) {
|
|
30851
|
-
const
|
|
30852
|
-
|
|
30981
|
+
const { code, watchFiles } = await generateScript(resolved, "serve");
|
|
30982
|
+
watchFiles.forEach((file) => {
|
|
30983
|
+
this.addWatchFile(file);
|
|
30984
|
+
});
|
|
30853
30985
|
return code;
|
|
30854
30986
|
}
|
|
30855
30987
|
}
|
|
@@ -30862,20 +30994,25 @@ var unpluginFactory = (options = {}) => {
|
|
|
30862
30994
|
return resolvedVirtualEnvId;
|
|
30863
30995
|
},
|
|
30864
30996
|
async load(id) {
|
|
30865
|
-
const
|
|
30866
|
-
const { emit, script } = await generateScript(config, "build");
|
|
30997
|
+
const { emit, script } = await generateScript(resolved, "build");
|
|
30867
30998
|
if (id.startsWith(resolvedVirtualEnvId)) {
|
|
30868
30999
|
this.emitFile(emit);
|
|
30869
31000
|
return "";
|
|
30870
31001
|
}
|
|
30871
31002
|
if (id.endsWith(".html")) {
|
|
30872
|
-
let code = await
|
|
31003
|
+
let code = await fs3.readFile(id, "utf8");
|
|
30873
31004
|
code = code.replace(/<\/head>/gm, script);
|
|
30874
31005
|
return {
|
|
30875
31006
|
code
|
|
30876
31007
|
};
|
|
30877
31008
|
}
|
|
30878
31009
|
return null;
|
|
31010
|
+
},
|
|
31011
|
+
buildEnd: () => {
|
|
31012
|
+
process5.on("beforeExit", async () => {
|
|
31013
|
+
const { compress } = resolved;
|
|
31014
|
+
await createCompress(compress);
|
|
31015
|
+
});
|
|
30879
31016
|
}
|
|
30880
31017
|
}];
|
|
30881
31018
|
};
|