unplugin-env 0.1.6 → 0.1.7
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-5IZPPKKA.js → chunk-BH25AOMD.js} +975 -801
- package/dist/{chunk-YLYGXRIS.js → chunk-NYX6TIRV.js} +1 -1
- package/dist/{chunk-T3FDATSR.js → chunk-Q4AFCMOU.js} +1 -1
- package/dist/esbuild.cjs +975 -801
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +975 -801
- package/dist/index.js +1 -1
- package/dist/nuxt.cjs +975 -801
- package/dist/nuxt.js +3 -3
- package/dist/rollup.cjs +975 -801
- package/dist/rollup.js +1 -1
- package/dist/vite.cjs +975 -801
- package/dist/vite.js +2 -2
- package/dist/webpack.cjs +975 -801
- package/dist/webpack.js +2 -2
- package/package.json +9 -9
|
@@ -108,7 +108,7 @@ var require_path = __commonJS({
|
|
|
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
110
|
var os2 = __require("os");
|
|
111
|
-
var
|
|
111
|
+
var path3 = __require("path");
|
|
112
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;
|
|
@@ -120,7 +120,7 @@ var require_path = __commonJS({
|
|
|
120
120
|
}
|
|
121
121
|
exports.unixify = unixify;
|
|
122
122
|
function makeAbsolute(cwd, filepath) {
|
|
123
|
-
return
|
|
123
|
+
return path3.resolve(cwd, filepath);
|
|
124
124
|
}
|
|
125
125
|
exports.makeAbsolute = makeAbsolute;
|
|
126
126
|
function removeLeadingDotSegment(entry) {
|
|
@@ -1443,7 +1443,7 @@ var require_braces = __commonJS({
|
|
|
1443
1443
|
var require_constants2 = __commonJS({
|
|
1444
1444
|
"node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports, module2) {
|
|
1445
1445
|
"use strict";
|
|
1446
|
-
var
|
|
1446
|
+
var path3 = __require("path");
|
|
1447
1447
|
var WIN_SLASH = "\\\\/";
|
|
1448
1448
|
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1449
1449
|
var DOT_LITERAL = "\\.";
|
|
@@ -1613,7 +1613,7 @@ var require_constants2 = __commonJS({
|
|
|
1613
1613
|
/* | */
|
|
1614
1614
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
1615
1615
|
/* \uFEFF */
|
|
1616
|
-
SEP:
|
|
1616
|
+
SEP: path3.sep,
|
|
1617
1617
|
/**
|
|
1618
1618
|
* Create EXTGLOB_CHARS
|
|
1619
1619
|
*/
|
|
@@ -1640,7 +1640,7 @@ var require_constants2 = __commonJS({
|
|
|
1640
1640
|
var require_utils2 = __commonJS({
|
|
1641
1641
|
"node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports) {
|
|
1642
1642
|
"use strict";
|
|
1643
|
-
var
|
|
1643
|
+
var path3 = __require("path");
|
|
1644
1644
|
var win32 = process.platform === "win32";
|
|
1645
1645
|
var {
|
|
1646
1646
|
REGEX_BACKSLASH,
|
|
@@ -1669,7 +1669,7 @@ var require_utils2 = __commonJS({
|
|
|
1669
1669
|
if (options && typeof options.windows === "boolean") {
|
|
1670
1670
|
return options.windows;
|
|
1671
1671
|
}
|
|
1672
|
-
return win32 === true ||
|
|
1672
|
+
return win32 === true || path3.sep === "\\";
|
|
1673
1673
|
};
|
|
1674
1674
|
exports.escapeLast = (input, char, lastIdx) => {
|
|
1675
1675
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
@@ -2817,7 +2817,7 @@ var require_parse2 = __commonJS({
|
|
|
2817
2817
|
var require_picomatch = __commonJS({
|
|
2818
2818
|
"node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports, module2) {
|
|
2819
2819
|
"use strict";
|
|
2820
|
-
var
|
|
2820
|
+
var path3 = __require("path");
|
|
2821
2821
|
var scan = require_scan();
|
|
2822
2822
|
var parse3 = require_parse2();
|
|
2823
2823
|
var utils = require_utils2();
|
|
@@ -2903,7 +2903,7 @@ var require_picomatch = __commonJS({
|
|
|
2903
2903
|
};
|
|
2904
2904
|
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
2905
2905
|
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
2906
|
-
return regex.test(
|
|
2906
|
+
return regex.test(path3.basename(input));
|
|
2907
2907
|
};
|
|
2908
2908
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
2909
2909
|
picomatch.parse = (pattern, options) => {
|
|
@@ -3133,7 +3133,7 @@ var require_pattern = __commonJS({
|
|
|
3133
3133
|
"use strict";
|
|
3134
3134
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3135
3135
|
exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
|
|
3136
|
-
var
|
|
3136
|
+
var path3 = __require("path");
|
|
3137
3137
|
var globParent = require_glob_parent();
|
|
3138
3138
|
var micromatch = require_micromatch();
|
|
3139
3139
|
var GLOBSTAR = "**";
|
|
@@ -3228,7 +3228,7 @@ var require_pattern = __commonJS({
|
|
|
3228
3228
|
}
|
|
3229
3229
|
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
3230
3230
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
3231
|
-
const basename =
|
|
3231
|
+
const basename = path3.basename(pattern);
|
|
3232
3232
|
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
|
3233
3233
|
}
|
|
3234
3234
|
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -3446,8 +3446,8 @@ var require_utils3 = __commonJS({
|
|
|
3446
3446
|
exports.errno = errno;
|
|
3447
3447
|
var fs4 = require_fs();
|
|
3448
3448
|
exports.fs = fs4;
|
|
3449
|
-
var
|
|
3450
|
-
exports.path =
|
|
3449
|
+
var path3 = require_path();
|
|
3450
|
+
exports.path = path3;
|
|
3451
3451
|
var pattern = require_pattern();
|
|
3452
3452
|
exports.pattern = pattern;
|
|
3453
3453
|
var stream = require_stream();
|
|
@@ -3559,8 +3559,8 @@ var require_async = __commonJS({
|
|
|
3559
3559
|
"use strict";
|
|
3560
3560
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3561
3561
|
exports.read = void 0;
|
|
3562
|
-
function read(
|
|
3563
|
-
settings.fs.lstat(
|
|
3562
|
+
function read(path3, settings, callback) {
|
|
3563
|
+
settings.fs.lstat(path3, (lstatError, lstat) => {
|
|
3564
3564
|
if (lstatError !== null) {
|
|
3565
3565
|
callFailureCallback(callback, lstatError);
|
|
3566
3566
|
return;
|
|
@@ -3569,7 +3569,7 @@ var require_async = __commonJS({
|
|
|
3569
3569
|
callSuccessCallback(callback, lstat);
|
|
3570
3570
|
return;
|
|
3571
3571
|
}
|
|
3572
|
-
settings.fs.stat(
|
|
3572
|
+
settings.fs.stat(path3, (statError, stat) => {
|
|
3573
3573
|
if (statError !== null) {
|
|
3574
3574
|
if (settings.throwErrorOnBrokenSymbolicLink) {
|
|
3575
3575
|
callFailureCallback(callback, statError);
|
|
@@ -3601,13 +3601,13 @@ var require_sync = __commonJS({
|
|
|
3601
3601
|
"use strict";
|
|
3602
3602
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3603
3603
|
exports.read = void 0;
|
|
3604
|
-
function read(
|
|
3605
|
-
const lstat = settings.fs.lstatSync(
|
|
3604
|
+
function read(path3, settings) {
|
|
3605
|
+
const lstat = settings.fs.lstatSync(path3);
|
|
3606
3606
|
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
|
3607
3607
|
return lstat;
|
|
3608
3608
|
}
|
|
3609
3609
|
try {
|
|
3610
|
-
const stat = settings.fs.statSync(
|
|
3610
|
+
const stat = settings.fs.statSync(path3);
|
|
3611
3611
|
if (settings.markSymbolicLink) {
|
|
3612
3612
|
stat.isSymbolicLink = () => true;
|
|
3613
3613
|
}
|
|
@@ -3678,17 +3678,17 @@ var require_out = __commonJS({
|
|
|
3678
3678
|
var sync = require_sync();
|
|
3679
3679
|
var settings_1 = require_settings();
|
|
3680
3680
|
exports.Settings = settings_1.default;
|
|
3681
|
-
function stat(
|
|
3681
|
+
function stat(path3, optionsOrSettingsOrCallback, callback) {
|
|
3682
3682
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
3683
|
-
async.read(
|
|
3683
|
+
async.read(path3, getSettings(), optionsOrSettingsOrCallback);
|
|
3684
3684
|
return;
|
|
3685
3685
|
}
|
|
3686
|
-
async.read(
|
|
3686
|
+
async.read(path3, getSettings(optionsOrSettingsOrCallback), callback);
|
|
3687
3687
|
}
|
|
3688
3688
|
exports.stat = stat;
|
|
3689
|
-
function statSync(
|
|
3689
|
+
function statSync(path3, optionsOrSettings) {
|
|
3690
3690
|
const settings = getSettings(optionsOrSettings);
|
|
3691
|
-
return sync.read(
|
|
3691
|
+
return sync.read(path3, settings);
|
|
3692
3692
|
}
|
|
3693
3693
|
exports.statSync = statSync;
|
|
3694
3694
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -3909,16 +3909,16 @@ var require_async2 = __commonJS({
|
|
|
3909
3909
|
return;
|
|
3910
3910
|
}
|
|
3911
3911
|
const tasks = names.map((name) => {
|
|
3912
|
-
const
|
|
3912
|
+
const path3 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
|
3913
3913
|
return (done) => {
|
|
3914
|
-
fsStat.stat(
|
|
3914
|
+
fsStat.stat(path3, settings.fsStatSettings, (error, stats) => {
|
|
3915
3915
|
if (error !== null) {
|
|
3916
3916
|
done(error);
|
|
3917
3917
|
return;
|
|
3918
3918
|
}
|
|
3919
3919
|
const entry = {
|
|
3920
3920
|
name,
|
|
3921
|
-
path:
|
|
3921
|
+
path: path3,
|
|
3922
3922
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
3923
3923
|
};
|
|
3924
3924
|
if (settings.stats) {
|
|
@@ -4036,7 +4036,7 @@ var require_settings2 = __commonJS({
|
|
|
4036
4036
|
"node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js"(exports) {
|
|
4037
4037
|
"use strict";
|
|
4038
4038
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4039
|
-
var
|
|
4039
|
+
var path3 = __require("path");
|
|
4040
4040
|
var fsStat = require_out();
|
|
4041
4041
|
var fs4 = require_fs4();
|
|
4042
4042
|
var Settings = class {
|
|
@@ -4044,7 +4044,7 @@ var require_settings2 = __commonJS({
|
|
|
4044
4044
|
this._options = _options;
|
|
4045
4045
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
4046
4046
|
this.fs = fs4.createFileSystemAdapter(this._options.fs);
|
|
4047
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
4047
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path3.sep);
|
|
4048
4048
|
this.stats = this._getValue(this._options.stats, false);
|
|
4049
4049
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
4050
4050
|
this.fsStatSettings = new fsStat.Settings({
|
|
@@ -4071,17 +4071,17 @@ var require_out2 = __commonJS({
|
|
|
4071
4071
|
var sync = require_sync2();
|
|
4072
4072
|
var settings_1 = require_settings2();
|
|
4073
4073
|
exports.Settings = settings_1.default;
|
|
4074
|
-
function scandir(
|
|
4074
|
+
function scandir(path3, optionsOrSettingsOrCallback, callback) {
|
|
4075
4075
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
4076
|
-
async.read(
|
|
4076
|
+
async.read(path3, getSettings(), optionsOrSettingsOrCallback);
|
|
4077
4077
|
return;
|
|
4078
4078
|
}
|
|
4079
|
-
async.read(
|
|
4079
|
+
async.read(path3, getSettings(optionsOrSettingsOrCallback), callback);
|
|
4080
4080
|
}
|
|
4081
4081
|
exports.scandir = scandir;
|
|
4082
|
-
function scandirSync(
|
|
4082
|
+
function scandirSync(path3, optionsOrSettings) {
|
|
4083
4083
|
const settings = getSettings(optionsOrSettings);
|
|
4084
|
-
return sync.read(
|
|
4084
|
+
return sync.read(path3, settings);
|
|
4085
4085
|
}
|
|
4086
4086
|
exports.scandirSync = scandirSync;
|
|
4087
4087
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -4705,7 +4705,7 @@ var require_settings3 = __commonJS({
|
|
|
4705
4705
|
"node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js"(exports) {
|
|
4706
4706
|
"use strict";
|
|
4707
4707
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4708
|
-
var
|
|
4708
|
+
var path3 = __require("path");
|
|
4709
4709
|
var fsScandir = require_out2();
|
|
4710
4710
|
var Settings = class {
|
|
4711
4711
|
constructor(_options = {}) {
|
|
@@ -4715,7 +4715,7 @@ var require_settings3 = __commonJS({
|
|
|
4715
4715
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
4716
4716
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
4717
4717
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
4718
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
4718
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path3.sep);
|
|
4719
4719
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
4720
4720
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
4721
4721
|
fs: this._options.fs,
|
|
@@ -4777,7 +4777,7 @@ var require_reader2 = __commonJS({
|
|
|
4777
4777
|
"node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/readers/reader.js"(exports) {
|
|
4778
4778
|
"use strict";
|
|
4779
4779
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4780
|
-
var
|
|
4780
|
+
var path3 = __require("path");
|
|
4781
4781
|
var fsStat = require_out();
|
|
4782
4782
|
var utils = require_utils3();
|
|
4783
4783
|
var Reader = class {
|
|
@@ -4790,7 +4790,7 @@ var require_reader2 = __commonJS({
|
|
|
4790
4790
|
});
|
|
4791
4791
|
}
|
|
4792
4792
|
_getFullEntryPath(filepath) {
|
|
4793
|
-
return
|
|
4793
|
+
return path3.resolve(this._settings.cwd, filepath);
|
|
4794
4794
|
}
|
|
4795
4795
|
_makeEntry(stats, pattern) {
|
|
4796
4796
|
const entry = {
|
|
@@ -5184,7 +5184,7 @@ var require_provider = __commonJS({
|
|
|
5184
5184
|
"node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/provider.js"(exports) {
|
|
5185
5185
|
"use strict";
|
|
5186
5186
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5187
|
-
var
|
|
5187
|
+
var path3 = __require("path");
|
|
5188
5188
|
var deep_1 = require_deep();
|
|
5189
5189
|
var entry_1 = require_entry();
|
|
5190
5190
|
var error_1 = require_error();
|
|
@@ -5198,7 +5198,7 @@ var require_provider = __commonJS({
|
|
|
5198
5198
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
5199
5199
|
}
|
|
5200
5200
|
_getRootDirectory(task) {
|
|
5201
|
-
return
|
|
5201
|
+
return path3.resolve(this._settings.cwd, task.base);
|
|
5202
5202
|
}
|
|
5203
5203
|
_getReaderOptions(task) {
|
|
5204
5204
|
const basePath = task.base === "." ? "" : task.base;
|
|
@@ -5706,27 +5706,27 @@ var require_util = __commonJS({
|
|
|
5706
5706
|
};
|
|
5707
5707
|
}
|
|
5708
5708
|
var normalize2 = lruMemoize(function normalize3(aPath) {
|
|
5709
|
-
var
|
|
5709
|
+
var path3 = aPath;
|
|
5710
5710
|
var url = urlParse(aPath);
|
|
5711
5711
|
if (url) {
|
|
5712
5712
|
if (!url.path) {
|
|
5713
5713
|
return aPath;
|
|
5714
5714
|
}
|
|
5715
|
-
|
|
5715
|
+
path3 = url.path;
|
|
5716
5716
|
}
|
|
5717
|
-
var isAbsolute = exports.isAbsolute(
|
|
5717
|
+
var isAbsolute = exports.isAbsolute(path3);
|
|
5718
5718
|
var parts = [];
|
|
5719
5719
|
var start = 0;
|
|
5720
5720
|
var i = 0;
|
|
5721
5721
|
while (true) {
|
|
5722
5722
|
start = i;
|
|
5723
|
-
i =
|
|
5723
|
+
i = path3.indexOf("/", start);
|
|
5724
5724
|
if (i === -1) {
|
|
5725
|
-
parts.push(
|
|
5725
|
+
parts.push(path3.slice(start));
|
|
5726
5726
|
break;
|
|
5727
5727
|
} else {
|
|
5728
|
-
parts.push(
|
|
5729
|
-
while (i <
|
|
5728
|
+
parts.push(path3.slice(start, i));
|
|
5729
|
+
while (i < path3.length && path3[i] === "/") {
|
|
5730
5730
|
i++;
|
|
5731
5731
|
}
|
|
5732
5732
|
}
|
|
@@ -5747,15 +5747,15 @@ var require_util = __commonJS({
|
|
|
5747
5747
|
}
|
|
5748
5748
|
}
|
|
5749
5749
|
}
|
|
5750
|
-
|
|
5751
|
-
if (
|
|
5752
|
-
|
|
5750
|
+
path3 = parts.join("/");
|
|
5751
|
+
if (path3 === "") {
|
|
5752
|
+
path3 = isAbsolute ? "/" : ".";
|
|
5753
5753
|
}
|
|
5754
5754
|
if (url) {
|
|
5755
|
-
url.path =
|
|
5755
|
+
url.path = path3;
|
|
5756
5756
|
return urlGenerate(url);
|
|
5757
5757
|
}
|
|
5758
|
-
return
|
|
5758
|
+
return path3;
|
|
5759
5759
|
});
|
|
5760
5760
|
exports.normalize = normalize2;
|
|
5761
5761
|
function join(aRoot, aPath) {
|
|
@@ -7445,9 +7445,9 @@ var require_source_map = __commonJS({
|
|
|
7445
7445
|
}
|
|
7446
7446
|
});
|
|
7447
7447
|
|
|
7448
|
-
// node_modules/.pnpm/@babel+parser@7.24.
|
|
7448
|
+
// node_modules/.pnpm/@babel+parser@7.24.5/node_modules/@babel/parser/lib/index.js
|
|
7449
7449
|
var require_lib = __commonJS({
|
|
7450
|
-
"node_modules/.pnpm/@babel+parser@7.24.
|
|
7450
|
+
"node_modules/.pnpm/@babel+parser@7.24.5/node_modules/@babel/parser/lib/index.js"(exports) {
|
|
7451
7451
|
"use strict";
|
|
7452
7452
|
Object.defineProperty(exports, "__esModule", {
|
|
7453
7453
|
value: true
|
|
@@ -7530,10 +7530,7 @@ var require_lib = __commonJS({
|
|
|
7530
7530
|
VariableDeclarator: "variable declaration",
|
|
7531
7531
|
YieldExpression: "yield expression"
|
|
7532
7532
|
};
|
|
7533
|
-
var toNodeDescription = ({
|
|
7534
|
-
type,
|
|
7535
|
-
prefix: prefix2
|
|
7536
|
-
}) => type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[String(prefix2)] : NodeDescriptions[type];
|
|
7533
|
+
var toNodeDescription = (node) => node.type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[`${node.prefix}`] : NodeDescriptions[node.type];
|
|
7537
7534
|
var StandardErrors = {
|
|
7538
7535
|
AccessorIsGenerator: ({
|
|
7539
7536
|
kind
|
|
@@ -7746,6 +7743,7 @@ var require_lib = __commonJS({
|
|
|
7746
7743
|
UnterminatedRegExp: "Unterminated regular expression.",
|
|
7747
7744
|
UnterminatedString: "Unterminated string constant.",
|
|
7748
7745
|
UnterminatedTemplate: "Unterminated template.",
|
|
7746
|
+
UsingDeclarationExport: "Using declaration cannot be exported.",
|
|
7749
7747
|
UsingDeclarationHasBindingPattern: "Using declaration cannot have destructuring patterns.",
|
|
7750
7748
|
VarRedeclaration: ({
|
|
7751
7749
|
identifierName
|
|
@@ -8033,6 +8031,11 @@ var require_lib = __commonJS({
|
|
|
8033
8031
|
}
|
|
8034
8032
|
return this.finishNode(node, "MethodDefinition");
|
|
8035
8033
|
}
|
|
8034
|
+
nameIsConstructor(key) {
|
|
8035
|
+
if (key.type === "Literal")
|
|
8036
|
+
return key.value === "constructor";
|
|
8037
|
+
return super.nameIsConstructor(key);
|
|
8038
|
+
}
|
|
8036
8039
|
parseClassProperty(...args) {
|
|
8037
8040
|
const propertyNode = super.parseClassProperty(...args);
|
|
8038
8041
|
{
|
|
@@ -8097,9 +8100,9 @@ var require_lib = __commonJS({
|
|
|
8097
8100
|
}
|
|
8098
8101
|
}
|
|
8099
8102
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
8100
|
-
if (prop.kind === "get" || prop.kind === "set") {
|
|
8103
|
+
if (prop.type === "Property" && (prop.kind === "get" || prop.kind === "set")) {
|
|
8101
8104
|
this.raise(Errors.PatternHasAccessor, prop.key);
|
|
8102
|
-
} else if (prop.method) {
|
|
8105
|
+
} else if (prop.type === "Property" && prop.method) {
|
|
8103
8106
|
this.raise(Errors.PatternHasMethod, prop.key);
|
|
8104
8107
|
} else {
|
|
8105
8108
|
super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
@@ -8111,9 +8114,9 @@ var require_lib = __commonJS({
|
|
|
8111
8114
|
node.type = "ImportExpression";
|
|
8112
8115
|
node.source = node.arguments[0];
|
|
8113
8116
|
if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
|
|
8114
|
-
var
|
|
8115
|
-
node.options = (
|
|
8116
|
-
node.attributes = (
|
|
8117
|
+
var _ref, _ref2;
|
|
8118
|
+
node.options = (_ref = node.arguments[1]) != null ? _ref : null;
|
|
8119
|
+
node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
|
|
8117
8120
|
}
|
|
8118
8121
|
delete node.arguments;
|
|
8119
8122
|
delete node.callee;
|
|
@@ -8185,7 +8188,7 @@ var require_lib = __commonJS({
|
|
|
8185
8188
|
return node.type === "Property" && node.kind === "init" && !node.method;
|
|
8186
8189
|
}
|
|
8187
8190
|
isObjectMethod(node) {
|
|
8188
|
-
return node.method || node.kind === "get" || node.kind === "set";
|
|
8191
|
+
return node.type === "Property" && (node.method || node.kind === "get" || node.kind === "set");
|
|
8189
8192
|
}
|
|
8190
8193
|
finishNodeAt(node, type, endLoc) {
|
|
8191
8194
|
return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
|
|
@@ -9104,8 +9107,9 @@ var require_lib = __commonJS({
|
|
|
9104
9107
|
const {
|
|
9105
9108
|
commentsLen
|
|
9106
9109
|
} = this.state;
|
|
9107
|
-
if (this.comments.length
|
|
9110
|
+
if (this.comments.length !== commentsLen) {
|
|
9108
9111
|
this.comments.length = commentsLen;
|
|
9112
|
+
}
|
|
9109
9113
|
this.comments.push(comment);
|
|
9110
9114
|
this.state.commentsLen++;
|
|
9111
9115
|
}
|
|
@@ -12314,18 +12318,21 @@ var require_lib = __commonJS({
|
|
|
12314
12318
|
type = this.flowParseTupleType();
|
|
12315
12319
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
12316
12320
|
return type;
|
|
12317
|
-
case 47:
|
|
12318
|
-
|
|
12321
|
+
case 47: {
|
|
12322
|
+
const node2 = this.startNode();
|
|
12323
|
+
node2.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
12319
12324
|
this.expect(10);
|
|
12320
12325
|
tmp = this.flowParseFunctionTypeParams();
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
|
|
12326
|
+
node2.params = tmp.params;
|
|
12327
|
+
node2.rest = tmp.rest;
|
|
12328
|
+
node2.this = tmp._this;
|
|
12324
12329
|
this.expect(11);
|
|
12325
12330
|
this.expect(19);
|
|
12326
|
-
|
|
12327
|
-
return this.finishNode(
|
|
12328
|
-
|
|
12331
|
+
node2.returnType = this.flowParseType();
|
|
12332
|
+
return this.finishNode(node2, "FunctionTypeAnnotation");
|
|
12333
|
+
}
|
|
12334
|
+
case 10: {
|
|
12335
|
+
const node2 = this.startNode();
|
|
12329
12336
|
this.next();
|
|
12330
12337
|
if (!this.match(11) && !this.match(21)) {
|
|
12331
12338
|
if (tokenIsIdentifier(this.state.type) || this.match(78)) {
|
|
@@ -12351,14 +12358,15 @@ var require_lib = __commonJS({
|
|
|
12351
12358
|
} else {
|
|
12352
12359
|
tmp = this.flowParseFunctionTypeParams();
|
|
12353
12360
|
}
|
|
12354
|
-
|
|
12355
|
-
|
|
12356
|
-
|
|
12361
|
+
node2.params = tmp.params;
|
|
12362
|
+
node2.rest = tmp.rest;
|
|
12363
|
+
node2.this = tmp._this;
|
|
12357
12364
|
this.expect(11);
|
|
12358
12365
|
this.expect(19);
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
return this.finishNode(
|
|
12366
|
+
node2.returnType = this.flowParseType();
|
|
12367
|
+
node2.typeParameters = null;
|
|
12368
|
+
return this.finishNode(node2, "FunctionTypeAnnotation");
|
|
12369
|
+
}
|
|
12362
12370
|
case 133:
|
|
12363
12371
|
return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
|
|
12364
12372
|
case 85:
|
|
@@ -12675,7 +12683,7 @@ var require_lib = __commonJS({
|
|
|
12675
12683
|
const arrows = [];
|
|
12676
12684
|
while (stack.length !== 0) {
|
|
12677
12685
|
const node2 = stack.pop();
|
|
12678
|
-
if (node2.type === "ArrowFunctionExpression") {
|
|
12686
|
+
if (node2.type === "ArrowFunctionExpression" && node2.body.type !== "BlockStatement") {
|
|
12679
12687
|
if (node2.typeParameters || !node2.returnType) {
|
|
12680
12688
|
this.finishArrowValidation(node2);
|
|
12681
12689
|
} else {
|
|
@@ -12712,18 +12720,18 @@ var require_lib = __commonJS({
|
|
|
12712
12720
|
return result;
|
|
12713
12721
|
}
|
|
12714
12722
|
parseParenItem(node, startLoc) {
|
|
12715
|
-
|
|
12723
|
+
const newNode = super.parseParenItem(node, startLoc);
|
|
12716
12724
|
if (this.eat(17)) {
|
|
12717
|
-
|
|
12725
|
+
newNode.optional = true;
|
|
12718
12726
|
this.resetEndLocation(node);
|
|
12719
12727
|
}
|
|
12720
12728
|
if (this.match(14)) {
|
|
12721
12729
|
const typeCastNode = this.startNodeAt(startLoc);
|
|
12722
|
-
typeCastNode.expression =
|
|
12730
|
+
typeCastNode.expression = newNode;
|
|
12723
12731
|
typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
|
|
12724
12732
|
return this.finishNode(typeCastNode, "TypeCastExpression");
|
|
12725
12733
|
}
|
|
12726
|
-
return
|
|
12734
|
+
return newNode;
|
|
12727
12735
|
}
|
|
12728
12736
|
assertModuleNodeAllowed(node) {
|
|
12729
12737
|
if (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "ExportAllDeclaration" && node.exportKind === "type") {
|
|
@@ -14107,7 +14115,7 @@ var require_lib = __commonJS({
|
|
|
14107
14115
|
} else {
|
|
14108
14116
|
let count = 0;
|
|
14109
14117
|
let semi = false;
|
|
14110
|
-
while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos)
|
|
14118
|
+
while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos) === 59)) {
|
|
14111
14119
|
++this.state.pos;
|
|
14112
14120
|
}
|
|
14113
14121
|
if (semi) {
|
|
@@ -14271,7 +14279,7 @@ var require_lib = __commonJS({
|
|
|
14271
14279
|
children.push(this.jsxParseElementAt(startLoc));
|
|
14272
14280
|
break;
|
|
14273
14281
|
case 141:
|
|
14274
|
-
children.push(this.
|
|
14282
|
+
children.push(this.parseLiteral(this.state.value, "JSXText"));
|
|
14275
14283
|
break;
|
|
14276
14284
|
case 5: {
|
|
14277
14285
|
const node2 = this.startNode();
|
|
@@ -14327,9 +14335,7 @@ var require_lib = __commonJS({
|
|
|
14327
14335
|
context[context.length - 1] = newContext;
|
|
14328
14336
|
}
|
|
14329
14337
|
parseExprAtom(refExpressionErrors) {
|
|
14330
|
-
if (this.match(
|
|
14331
|
-
return this.parseLiteral(this.state.value, "JSXText");
|
|
14332
|
-
} else if (this.match(142)) {
|
|
14338
|
+
if (this.match(142)) {
|
|
14333
14339
|
return this.jsxParseElement();
|
|
14334
14340
|
} else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
|
|
14335
14341
|
this.replaceToken(142);
|
|
@@ -14411,14 +14417,14 @@ var require_lib = __commonJS({
|
|
|
14411
14417
|
return new TypeScriptScope(flags);
|
|
14412
14418
|
}
|
|
14413
14419
|
enter(flags) {
|
|
14414
|
-
if (flags
|
|
14420
|
+
if (flags === 256) {
|
|
14415
14421
|
this.importsStack.push(/* @__PURE__ */ new Set());
|
|
14416
14422
|
}
|
|
14417
14423
|
super.enter(flags);
|
|
14418
14424
|
}
|
|
14419
14425
|
exit() {
|
|
14420
14426
|
const flags = super.exit();
|
|
14421
|
-
if (flags
|
|
14427
|
+
if (flags === 256) {
|
|
14422
14428
|
this.importsStack.pop();
|
|
14423
14429
|
}
|
|
14424
14430
|
return flags;
|
|
@@ -14727,14 +14733,15 @@ var require_lib = __commonJS({
|
|
|
14727
14733
|
return this.finishNode(prop, "RestElement");
|
|
14728
14734
|
}
|
|
14729
14735
|
parseBindingProperty() {
|
|
14730
|
-
const prop = this.startNode();
|
|
14731
14736
|
const {
|
|
14732
14737
|
type,
|
|
14733
14738
|
startLoc
|
|
14734
14739
|
} = this.state;
|
|
14735
14740
|
if (type === 21) {
|
|
14736
|
-
return this.parseBindingRestProperty(
|
|
14737
|
-
}
|
|
14741
|
+
return this.parseBindingRestProperty(this.startNode());
|
|
14742
|
+
}
|
|
14743
|
+
const prop = this.startNode();
|
|
14744
|
+
if (type === 138) {
|
|
14738
14745
|
this.expectPlugin("destructuringPrivate", startLoc);
|
|
14739
14746
|
this.classScope.usePrivateName(this.state.value, startLoc);
|
|
14740
14747
|
prop.key = this.parsePrivateName();
|
|
@@ -16611,13 +16618,14 @@ var require_lib = __commonJS({
|
|
|
16611
16618
|
parseExport(node, decorators) {
|
|
16612
16619
|
if (this.match(83)) {
|
|
16613
16620
|
this.next();
|
|
16621
|
+
const nodeImportEquals = node;
|
|
16614
16622
|
let maybeDefaultIdentifier = null;
|
|
16615
16623
|
if (this.isContextual(130) && this.isPotentialImportPhase(false)) {
|
|
16616
|
-
maybeDefaultIdentifier = this.parseMaybeImportPhase(
|
|
16624
|
+
maybeDefaultIdentifier = this.parseMaybeImportPhase(nodeImportEquals, false);
|
|
16617
16625
|
} else {
|
|
16618
|
-
|
|
16626
|
+
nodeImportEquals.importKind = "value";
|
|
16619
16627
|
}
|
|
16620
|
-
return this.tsParseImportEqualsDeclaration(
|
|
16628
|
+
return this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier, true);
|
|
16621
16629
|
} else if (this.eat(29)) {
|
|
16622
16630
|
const assign = node;
|
|
16623
16631
|
assign.expression = super.parseExpression();
|
|
@@ -16796,9 +16804,9 @@ var require_lib = __commonJS({
|
|
|
16796
16804
|
return result.node;
|
|
16797
16805
|
}
|
|
16798
16806
|
parseParenItem(node, startLoc) {
|
|
16799
|
-
|
|
16807
|
+
const newNode = super.parseParenItem(node, startLoc);
|
|
16800
16808
|
if (this.eat(17)) {
|
|
16801
|
-
|
|
16809
|
+
newNode.optional = true;
|
|
16802
16810
|
this.resetEndLocation(node);
|
|
16803
16811
|
}
|
|
16804
16812
|
if (this.match(14)) {
|
|
@@ -16913,8 +16921,9 @@ var require_lib = __commonJS({
|
|
|
16913
16921
|
declareClassPrivateMethodInScope(node, kind) {
|
|
16914
16922
|
if (node.type === "TSDeclareMethod")
|
|
16915
16923
|
return;
|
|
16916
|
-
if (node.type === "MethodDefinition" && !node.value
|
|
16924
|
+
if (node.type === "MethodDefinition" && !hasOwnProperty.call(node.value, "body")) {
|
|
16917
16925
|
return;
|
|
16926
|
+
}
|
|
16918
16927
|
super.declareClassPrivateMethodInScope(node, kind);
|
|
16919
16928
|
}
|
|
16920
16929
|
parseClassSuper(node) {
|
|
@@ -17481,9 +17490,12 @@ var require_lib = __commonJS({
|
|
|
17481
17490
|
}
|
|
17482
17491
|
}
|
|
17483
17492
|
finishPlaceholder(node, expectedNode) {
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
-
|
|
17493
|
+
let placeholder = node;
|
|
17494
|
+
if (!placeholder.expectedNode || !placeholder.type) {
|
|
17495
|
+
placeholder = this.finishNode(placeholder, "Placeholder");
|
|
17496
|
+
}
|
|
17497
|
+
placeholder.expectedNode = expectedNode;
|
|
17498
|
+
return placeholder;
|
|
17487
17499
|
}
|
|
17488
17500
|
getTokenFromCode(code2) {
|
|
17489
17501
|
if (code2 === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
|
|
@@ -17544,8 +17556,9 @@ var require_lib = __commonJS({
|
|
|
17544
17556
|
return this.finishNode(stmt, "LabeledStatement");
|
|
17545
17557
|
}
|
|
17546
17558
|
this.semicolon();
|
|
17547
|
-
|
|
17548
|
-
|
|
17559
|
+
const stmtPlaceholder = node;
|
|
17560
|
+
stmtPlaceholder.name = expr.name;
|
|
17561
|
+
return this.finishPlaceholder(stmtPlaceholder, "Statement");
|
|
17549
17562
|
}
|
|
17550
17563
|
parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse) {
|
|
17551
17564
|
return this.parsePlaceholder("BlockStatement") || super.parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse);
|
|
@@ -17579,17 +17592,18 @@ var require_lib = __commonJS({
|
|
|
17579
17592
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
17580
17593
|
if (!placeholder)
|
|
17581
17594
|
return super.parseExport(node, decorators);
|
|
17595
|
+
const node2 = node;
|
|
17582
17596
|
if (!this.isContextual(98) && !this.match(12)) {
|
|
17583
|
-
|
|
17584
|
-
|
|
17585
|
-
|
|
17586
|
-
return this.finishNode(
|
|
17597
|
+
node2.specifiers = [];
|
|
17598
|
+
node2.source = null;
|
|
17599
|
+
node2.declaration = this.finishPlaceholder(placeholder, "Declaration");
|
|
17600
|
+
return this.finishNode(node2, "ExportNamedDeclaration");
|
|
17587
17601
|
}
|
|
17588
17602
|
this.expectPlugin("exportDefaultFrom");
|
|
17589
17603
|
const specifier = this.startNode();
|
|
17590
17604
|
specifier.exported = placeholder;
|
|
17591
|
-
|
|
17592
|
-
return super.parseExport(
|
|
17605
|
+
node2.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
|
|
17606
|
+
return super.parseExport(node2, decorators);
|
|
17593
17607
|
}
|
|
17594
17608
|
isExportDefaultSpecifier() {
|
|
17595
17609
|
if (this.match(65)) {
|
|
@@ -18881,14 +18895,16 @@ var require_lib = __commonJS({
|
|
|
18881
18895
|
}
|
|
18882
18896
|
parseTemplate(isTagged) {
|
|
18883
18897
|
const node = this.startNode();
|
|
18884
|
-
node.expressions = [];
|
|
18885
18898
|
let curElt = this.parseTemplateElement(isTagged);
|
|
18886
|
-
|
|
18899
|
+
const quasis = [curElt];
|
|
18900
|
+
const substitutions = [];
|
|
18887
18901
|
while (!curElt.tail) {
|
|
18888
|
-
|
|
18902
|
+
substitutions.push(this.parseTemplateSubstitution());
|
|
18889
18903
|
this.readTemplateContinuation();
|
|
18890
|
-
|
|
18904
|
+
quasis.push(curElt = this.parseTemplateElement(isTagged));
|
|
18891
18905
|
}
|
|
18906
|
+
node.expressions = substitutions;
|
|
18907
|
+
node.quasis = quasis;
|
|
18892
18908
|
return this.finishNode(node, "TemplateLiteral");
|
|
18893
18909
|
}
|
|
18894
18910
|
parseTemplateSubstitution() {
|
|
@@ -18977,8 +18993,11 @@ var require_lib = __commonJS({
|
|
|
18977
18993
|
let isGenerator = this.eat(55);
|
|
18978
18994
|
this.parsePropertyNamePrefixOperator(prop);
|
|
18979
18995
|
const containsEsc = this.state.containsEsc;
|
|
18980
|
-
|
|
18996
|
+
this.parsePropertyName(prop, refExpressionErrors);
|
|
18981
18997
|
if (!isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop)) {
|
|
18998
|
+
const {
|
|
18999
|
+
key
|
|
19000
|
+
} = prop;
|
|
18982
19001
|
const keyName = key.name;
|
|
18983
19002
|
if (keyName === "async" && !this.hasPrecedingLineBreak()) {
|
|
18984
19003
|
isAsync = true;
|
|
@@ -19114,7 +19133,6 @@ var require_lib = __commonJS({
|
|
|
19114
19133
|
prop.computed = false;
|
|
19115
19134
|
}
|
|
19116
19135
|
}
|
|
19117
|
-
return prop.key;
|
|
19118
19136
|
}
|
|
19119
19137
|
initFunction(node, isAsync) {
|
|
19120
19138
|
node.id = null;
|
|
@@ -20534,8 +20552,11 @@ var require_lib = __commonJS({
|
|
|
20534
20552
|
isClassMethod() {
|
|
20535
20553
|
return this.match(10);
|
|
20536
20554
|
}
|
|
20555
|
+
nameIsConstructor(key) {
|
|
20556
|
+
return key.type === "Identifier" && key.name === "constructor" || key.type === "StringLiteral" && key.value === "constructor";
|
|
20557
|
+
}
|
|
20537
20558
|
isNonstaticConstructor(method) {
|
|
20538
|
-
return !method.computed && !method.static && (method.key
|
|
20559
|
+
return !method.computed && !method.static && this.nameIsConstructor(method.key);
|
|
20539
20560
|
}
|
|
20540
20561
|
parseClassBody(hadSuperClass, oldStrict) {
|
|
20541
20562
|
this.classScope.enter();
|
|
@@ -20637,9 +20658,10 @@ var require_lib = __commonJS({
|
|
|
20637
20658
|
this.pushClassMethod(classBody, publicMethod, true, false, false, false);
|
|
20638
20659
|
return;
|
|
20639
20660
|
}
|
|
20640
|
-
const isContextual =
|
|
20641
|
-
const isPrivate = this.match(138);
|
|
20661
|
+
const isContextual = !this.state.containsEsc && tokenIsIdentifier(this.state.type);
|
|
20642
20662
|
const key = this.parseClassElementName(member);
|
|
20663
|
+
const maybeContextualKw = isContextual ? key.name : null;
|
|
20664
|
+
const isPrivate = this.isPrivateName(key);
|
|
20643
20665
|
const maybeQuestionTokenStartLoc = this.state.startLoc;
|
|
20644
20666
|
this.parsePostMemberNameModifiers(publicMember);
|
|
20645
20667
|
if (this.isClassMethod()) {
|
|
@@ -20668,7 +20690,7 @@ var require_lib = __commonJS({
|
|
|
20668
20690
|
} else {
|
|
20669
20691
|
this.pushClassProperty(classBody, publicProp);
|
|
20670
20692
|
}
|
|
20671
|
-
} else if (
|
|
20693
|
+
} else if (maybeContextualKw === "async" && !this.isLineTerminator()) {
|
|
20672
20694
|
this.resetPreviousNodeTrailingComments(key);
|
|
20673
20695
|
const isGenerator = this.eat(55);
|
|
20674
20696
|
if (publicMember.optional) {
|
|
@@ -20686,9 +20708,9 @@ var require_lib = __commonJS({
|
|
|
20686
20708
|
}
|
|
20687
20709
|
this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
|
|
20688
20710
|
}
|
|
20689
|
-
} else if (
|
|
20711
|
+
} else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(55) && this.isLineTerminator())) {
|
|
20690
20712
|
this.resetPreviousNodeTrailingComments(key);
|
|
20691
|
-
method.kind =
|
|
20713
|
+
method.kind = maybeContextualKw;
|
|
20692
20714
|
const isPrivate2 = this.match(138);
|
|
20693
20715
|
this.parseClassElementName(publicMethod);
|
|
20694
20716
|
if (isPrivate2) {
|
|
@@ -20700,7 +20722,7 @@ var require_lib = __commonJS({
|
|
|
20700
20722
|
this.pushClassMethod(classBody, publicMethod, false, false, false, false);
|
|
20701
20723
|
}
|
|
20702
20724
|
this.checkGetterSetterParams(publicMethod);
|
|
20703
|
-
} else if (
|
|
20725
|
+
} else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
|
|
20704
20726
|
this.expectPlugin("decoratorAutoAccessors");
|
|
20705
20727
|
this.resetPreviousNodeTrailingComments(key);
|
|
20706
20728
|
const isPrivate2 = this.match(138);
|
|
@@ -20732,7 +20754,8 @@ var require_lib = __commonJS({
|
|
|
20732
20754
|
member.key = key;
|
|
20733
20755
|
return key;
|
|
20734
20756
|
}
|
|
20735
|
-
|
|
20757
|
+
this.parsePropertyName(member);
|
|
20758
|
+
return member.key;
|
|
20736
20759
|
}
|
|
20737
20760
|
parseClassStaticBlock(classBody, member) {
|
|
20738
20761
|
var _member$decorators;
|
|
@@ -20751,7 +20774,7 @@ var require_lib = __commonJS({
|
|
|
20751
20774
|
}
|
|
20752
20775
|
}
|
|
20753
20776
|
pushClassProperty(classBody, prop) {
|
|
20754
|
-
if (!prop.computed && (prop.key
|
|
20777
|
+
if (!prop.computed && this.nameIsConstructor(prop.key)) {
|
|
20755
20778
|
this.raise(Errors.ConstructorClassField, prop.key);
|
|
20756
20779
|
}
|
|
20757
20780
|
classBody.body.push(this.parseClassProperty(prop));
|
|
@@ -20762,11 +20785,8 @@ var require_lib = __commonJS({
|
|
|
20762
20785
|
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.loc.start);
|
|
20763
20786
|
}
|
|
20764
20787
|
pushClassAccessorProperty(classBody, prop, isPrivate) {
|
|
20765
|
-
if (!isPrivate && !prop.computed) {
|
|
20766
|
-
|
|
20767
|
-
if (key.name === "constructor" || key.value === "constructor") {
|
|
20768
|
-
this.raise(Errors.ConstructorClassField, key);
|
|
20769
|
-
}
|
|
20788
|
+
if (!isPrivate && !prop.computed && this.nameIsConstructor(prop.key)) {
|
|
20789
|
+
this.raise(Errors.ConstructorClassField, prop.key);
|
|
20770
20790
|
}
|
|
20771
20791
|
const node = this.parseClassAccessorProperty(prop);
|
|
20772
20792
|
classBody.body.push(node);
|
|
@@ -20904,8 +20924,8 @@ var require_lib = __commonJS({
|
|
|
20904
20924
|
}
|
|
20905
20925
|
maybeParseExportNamespaceSpecifier(node) {
|
|
20906
20926
|
if (this.isContextual(93)) {
|
|
20907
|
-
|
|
20908
|
-
|
|
20927
|
+
var _ref, _ref$specifiers;
|
|
20928
|
+
(_ref$specifiers = (_ref = node).specifiers) != null ? _ref$specifiers : _ref.specifiers = [];
|
|
20909
20929
|
const specifier = this.startNodeAt(this.state.lastTokStartLoc);
|
|
20910
20930
|
this.next();
|
|
20911
20931
|
specifier.exported = this.parseModuleExportName();
|
|
@@ -20916,14 +20936,15 @@ var require_lib = __commonJS({
|
|
|
20916
20936
|
}
|
|
20917
20937
|
maybeParseExportNamedSpecifiers(node) {
|
|
20918
20938
|
if (this.match(5)) {
|
|
20919
|
-
|
|
20920
|
-
|
|
20921
|
-
|
|
20922
|
-
|
|
20923
|
-
|
|
20924
|
-
|
|
20939
|
+
const node2 = node;
|
|
20940
|
+
if (!node2.specifiers)
|
|
20941
|
+
node2.specifiers = [];
|
|
20942
|
+
const isTypeExport = node2.exportKind === "type";
|
|
20943
|
+
node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport));
|
|
20944
|
+
node2.source = null;
|
|
20945
|
+
node2.declaration = null;
|
|
20925
20946
|
if (this.hasPlugin("importAssertions")) {
|
|
20926
|
-
|
|
20947
|
+
node2.assertions = [];
|
|
20927
20948
|
}
|
|
20928
20949
|
return true;
|
|
20929
20950
|
}
|
|
@@ -21035,6 +21056,14 @@ var require_lib = __commonJS({
|
|
|
21035
21056
|
return true;
|
|
21036
21057
|
}
|
|
21037
21058
|
}
|
|
21059
|
+
if (this.isContextual(107)) {
|
|
21060
|
+
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
21061
|
+
return true;
|
|
21062
|
+
}
|
|
21063
|
+
if (this.isContextual(96) && this.startsAwaitUsing()) {
|
|
21064
|
+
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
21065
|
+
return true;
|
|
21066
|
+
}
|
|
21038
21067
|
return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
|
|
21039
21068
|
}
|
|
21040
21069
|
checkExport(node, checkNames, isDefault, isFrom) {
|
|
@@ -21072,13 +21101,16 @@ var require_lib = __commonJS({
|
|
|
21072
21101
|
}
|
|
21073
21102
|
}
|
|
21074
21103
|
} else if (node.declaration) {
|
|
21075
|
-
|
|
21076
|
-
|
|
21104
|
+
const decl = node.declaration;
|
|
21105
|
+
if (decl.type === "FunctionDeclaration" || decl.type === "ClassDeclaration") {
|
|
21106
|
+
const {
|
|
21107
|
+
id
|
|
21108
|
+
} = decl;
|
|
21077
21109
|
if (!id)
|
|
21078
21110
|
throw new Error("Assertion failure");
|
|
21079
21111
|
this.checkDuplicateExports(node, id.name);
|
|
21080
|
-
} else if (
|
|
21081
|
-
for (const declaration of
|
|
21112
|
+
} else if (decl.type === "VariableDeclaration") {
|
|
21113
|
+
for (const declaration of decl.declarations) {
|
|
21082
21114
|
this.checkDeclaration(declaration.id);
|
|
21083
21115
|
}
|
|
21084
21116
|
}
|
|
@@ -21585,9 +21617,9 @@ var require_lib = __commonJS({
|
|
|
21585
21617
|
}
|
|
21586
21618
|
});
|
|
21587
21619
|
|
|
21588
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
21620
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/output.js
|
|
21589
21621
|
var require_output = __commonJS({
|
|
21590
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
21622
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/output.js"(exports, module2) {
|
|
21591
21623
|
"use strict";
|
|
21592
21624
|
function OutputLine(parent) {
|
|
21593
21625
|
this.__parent = parent;
|
|
@@ -21908,9 +21940,9 @@ var require_output = __commonJS({
|
|
|
21908
21940
|
}
|
|
21909
21941
|
});
|
|
21910
21942
|
|
|
21911
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
21943
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/token.js
|
|
21912
21944
|
var require_token = __commonJS({
|
|
21913
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
21945
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/token.js"(exports, module2) {
|
|
21914
21946
|
"use strict";
|
|
21915
21947
|
function Token(type, text, newlines, whitespace_before) {
|
|
21916
21948
|
this.type = type;
|
|
@@ -21929,28 +21961,29 @@ var require_token = __commonJS({
|
|
|
21929
21961
|
}
|
|
21930
21962
|
});
|
|
21931
21963
|
|
|
21932
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
21964
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/acorn.js
|
|
21933
21965
|
var require_acorn = __commonJS({
|
|
21934
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
21966
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/acorn.js"(exports) {
|
|
21935
21967
|
"use strict";
|
|
21936
21968
|
var baseASCIIidentifierStartChars = "\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a";
|
|
21937
21969
|
var baseASCIIidentifierChars = "\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a";
|
|
21938
21970
|
var nonASCIIidentifierStartChars = "\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc";
|
|
21939
21971
|
var nonASCIIidentifierChars = "\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f";
|
|
21940
|
-
var
|
|
21941
|
-
var
|
|
21972
|
+
var unicodeEscapeOrCodePoint = "\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}";
|
|
21973
|
+
var identifierStart = "(?:" + unicodeEscapeOrCodePoint + "|[" + baseASCIIidentifierStartChars + nonASCIIidentifierStartChars + "])";
|
|
21974
|
+
var identifierChars = "(?:" + unicodeEscapeOrCodePoint + "|[" + baseASCIIidentifierChars + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "])*";
|
|
21942
21975
|
exports.identifier = new RegExp(identifierStart + identifierChars, "g");
|
|
21943
21976
|
exports.identifierStart = new RegExp(identifierStart);
|
|
21944
|
-
exports.identifierMatch = new RegExp("(
|
|
21977
|
+
exports.identifierMatch = new RegExp("(?:" + unicodeEscapeOrCodePoint + "|[" + baseASCIIidentifierChars + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "])+");
|
|
21945
21978
|
exports.newline = /[\n\r\u2028\u2029]/;
|
|
21946
21979
|
exports.lineBreak = new RegExp("\r\n|" + exports.newline.source);
|
|
21947
21980
|
exports.allLineBreaks = new RegExp(exports.lineBreak.source, "g");
|
|
21948
21981
|
}
|
|
21949
21982
|
});
|
|
21950
21983
|
|
|
21951
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
21984
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/options.js
|
|
21952
21985
|
var require_options = __commonJS({
|
|
21953
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
21986
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/options.js"(exports, module2) {
|
|
21954
21987
|
"use strict";
|
|
21955
21988
|
function Options(options, merge_child_field) {
|
|
21956
21989
|
this.raw_options = _mergeOpts(options, merge_child_field);
|
|
@@ -21974,7 +22007,7 @@ var require_options = __commonJS({
|
|
|
21974
22007
|
}
|
|
21975
22008
|
this.wrap_line_length = this._get_number("wrap_line_length", this._get_number("max_char"));
|
|
21976
22009
|
this.indent_empty_lines = this._get_boolean("indent_empty_lines");
|
|
21977
|
-
this.templating = this._get_selection_list("templating", ["auto", "none", "django", "erb", "handlebars", "php", "smarty"], ["auto"]);
|
|
22010
|
+
this.templating = this._get_selection_list("templating", ["auto", "none", "angular", "django", "erb", "handlebars", "php", "smarty"], ["auto"]);
|
|
21978
22011
|
}
|
|
21979
22012
|
Options.prototype._get_array = function(name, default_value) {
|
|
21980
22013
|
var option_value = this.raw_options[name];
|
|
@@ -22074,9 +22107,9 @@ var require_options = __commonJS({
|
|
|
22074
22107
|
}
|
|
22075
22108
|
});
|
|
22076
22109
|
|
|
22077
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22110
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/options.js
|
|
22078
22111
|
var require_options2 = __commonJS({
|
|
22079
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22112
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/options.js"(exports, module2) {
|
|
22080
22113
|
"use strict";
|
|
22081
22114
|
var BaseOptions = require_options().Options;
|
|
22082
22115
|
var validPositionValues = ["before-newline", "after-newline", "preserve-newline"];
|
|
@@ -22123,9 +22156,9 @@ var require_options2 = __commonJS({
|
|
|
22123
22156
|
}
|
|
22124
22157
|
});
|
|
22125
22158
|
|
|
22126
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22159
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/inputscanner.js
|
|
22127
22160
|
var require_inputscanner = __commonJS({
|
|
22128
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22161
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/inputscanner.js"(exports, module2) {
|
|
22129
22162
|
"use strict";
|
|
22130
22163
|
var regexp_has_sticky = RegExp.prototype.hasOwnProperty("sticky");
|
|
22131
22164
|
function InputScanner(input_string) {
|
|
@@ -22258,9 +22291,9 @@ var require_inputscanner = __commonJS({
|
|
|
22258
22291
|
}
|
|
22259
22292
|
});
|
|
22260
22293
|
|
|
22261
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22294
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/tokenstream.js
|
|
22262
22295
|
var require_tokenstream = __commonJS({
|
|
22263
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22296
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/tokenstream.js"(exports, module2) {
|
|
22264
22297
|
"use strict";
|
|
22265
22298
|
function TokenStream(parent_token) {
|
|
22266
22299
|
this.__tokens = [];
|
|
@@ -22305,9 +22338,9 @@ var require_tokenstream = __commonJS({
|
|
|
22305
22338
|
}
|
|
22306
22339
|
});
|
|
22307
22340
|
|
|
22308
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22341
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/pattern.js
|
|
22309
22342
|
var require_pattern2 = __commonJS({
|
|
22310
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22343
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/pattern.js"(exports, module2) {
|
|
22311
22344
|
"use strict";
|
|
22312
22345
|
function Pattern(input_scanner, parent) {
|
|
22313
22346
|
this._input = input_scanner;
|
|
@@ -22367,9 +22400,9 @@ var require_pattern2 = __commonJS({
|
|
|
22367
22400
|
}
|
|
22368
22401
|
});
|
|
22369
22402
|
|
|
22370
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22403
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/whitespacepattern.js
|
|
22371
22404
|
var require_whitespacepattern = __commonJS({
|
|
22372
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22405
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/whitespacepattern.js"(exports, module2) {
|
|
22373
22406
|
"use strict";
|
|
22374
22407
|
var Pattern = require_pattern2().Pattern;
|
|
22375
22408
|
function WhitespacePattern(input_scanner, parent) {
|
|
@@ -22437,9 +22470,9 @@ var require_whitespacepattern = __commonJS({
|
|
|
22437
22470
|
}
|
|
22438
22471
|
});
|
|
22439
22472
|
|
|
22440
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22473
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/tokenizer.js
|
|
22441
22474
|
var require_tokenizer = __commonJS({
|
|
22442
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22475
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/tokenizer.js"(exports, module2) {
|
|
22443
22476
|
"use strict";
|
|
22444
22477
|
var InputScanner = require_inputscanner().InputScanner;
|
|
22445
22478
|
var Token = require_token().Token;
|
|
@@ -22533,9 +22566,9 @@ var require_tokenizer = __commonJS({
|
|
|
22533
22566
|
}
|
|
22534
22567
|
});
|
|
22535
22568
|
|
|
22536
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22569
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/directives.js
|
|
22537
22570
|
var require_directives = __commonJS({
|
|
22538
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22571
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/directives.js"(exports, module2) {
|
|
22539
22572
|
"use strict";
|
|
22540
22573
|
function Directives(start_block_pattern, end_block_pattern) {
|
|
22541
22574
|
start_block_pattern = typeof start_block_pattern === "string" ? start_block_pattern : start_block_pattern.source;
|
|
@@ -22564,9 +22597,9 @@ var require_directives = __commonJS({
|
|
|
22564
22597
|
}
|
|
22565
22598
|
});
|
|
22566
22599
|
|
|
22567
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22600
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/templatablepattern.js
|
|
22568
22601
|
var require_templatablepattern = __commonJS({
|
|
22569
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22602
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/templatablepattern.js"(exports, module2) {
|
|
22570
22603
|
"use strict";
|
|
22571
22604
|
var Pattern = require_pattern2().Pattern;
|
|
22572
22605
|
var template_names = {
|
|
@@ -22574,7 +22607,8 @@ var require_templatablepattern = __commonJS({
|
|
|
22574
22607
|
erb: false,
|
|
22575
22608
|
handlebars: false,
|
|
22576
22609
|
php: false,
|
|
22577
|
-
smarty: false
|
|
22610
|
+
smarty: false,
|
|
22611
|
+
angular: false
|
|
22578
22612
|
};
|
|
22579
22613
|
function TemplatablePattern(input_scanner, parent) {
|
|
22580
22614
|
Pattern.call(this, input_scanner, parent);
|
|
@@ -22715,9 +22749,9 @@ var require_templatablepattern = __commonJS({
|
|
|
22715
22749
|
}
|
|
22716
22750
|
});
|
|
22717
22751
|
|
|
22718
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22752
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/tokenizer.js
|
|
22719
22753
|
var require_tokenizer2 = __commonJS({
|
|
22720
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22754
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/tokenizer.js"(exports, module2) {
|
|
22721
22755
|
"use strict";
|
|
22722
22756
|
var InputScanner = require_inputscanner().InputScanner;
|
|
22723
22757
|
var BaseTokenizer = require_tokenizer().Tokenizer;
|
|
@@ -22760,7 +22794,7 @@ var require_tokenizer2 = __commonJS({
|
|
|
22760
22794
|
punct = punct.replace(/ /g, "|");
|
|
22761
22795
|
var punct_pattern = new RegExp(punct);
|
|
22762
22796
|
var line_starters = "continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(",");
|
|
22763
|
-
var reserved_words = line_starters.concat(["do", "in", "of", "else", "get", "set", "new", "catch", "finally", "typeof", "yield", "async", "await", "from", "as"]);
|
|
22797
|
+
var reserved_words = line_starters.concat(["do", "in", "of", "else", "get", "set", "new", "catch", "finally", "typeof", "yield", "async", "await", "from", "as", "class", "extends"]);
|
|
22764
22798
|
var reserved_word_pattern = new RegExp("^(?:" + reserved_words.join("|") + ")$");
|
|
22765
22799
|
var in_html_comment;
|
|
22766
22800
|
var Tokenizer = function(input_string, options) {
|
|
@@ -22813,6 +22847,7 @@ var require_tokenizer2 = __commonJS({
|
|
|
22813
22847
|
}
|
|
22814
22848
|
token = token || this._read_non_javascript(c);
|
|
22815
22849
|
token = token || this._read_string(c);
|
|
22850
|
+
token = token || this._read_pair(c, this._input.peek(1));
|
|
22816
22851
|
token = token || this._read_word(previous_token);
|
|
22817
22852
|
token = token || this._read_singles(c);
|
|
22818
22853
|
token = token || this._read_comment(c);
|
|
@@ -22828,7 +22863,7 @@ var require_tokenizer2 = __commonJS({
|
|
|
22828
22863
|
if (resulting_string !== "") {
|
|
22829
22864
|
resulting_string = resulting_string.replace(acorn.allLineBreaks, "\n");
|
|
22830
22865
|
if (!(previous_token.type === TOKEN.DOT || previous_token.type === TOKEN.RESERVED && (previous_token.text === "set" || previous_token.text === "get")) && reserved_word_pattern.test(resulting_string)) {
|
|
22831
|
-
if (resulting_string === "in" || resulting_string === "of") {
|
|
22866
|
+
if ((resulting_string === "in" || resulting_string === "of") && (previous_token.type === TOKEN.WORD || previous_token.type === TOKEN.STRING)) {
|
|
22832
22867
|
return this._create_token(TOKEN.OPERATOR, resulting_string);
|
|
22833
22868
|
}
|
|
22834
22869
|
return this._create_token(TOKEN.RESERVED, resulting_string);
|
|
@@ -22862,6 +22897,17 @@ var require_tokenizer2 = __commonJS({
|
|
|
22862
22897
|
}
|
|
22863
22898
|
return token;
|
|
22864
22899
|
};
|
|
22900
|
+
Tokenizer.prototype._read_pair = function(c, d) {
|
|
22901
|
+
var token = null;
|
|
22902
|
+
if (c === "#" && d === "{") {
|
|
22903
|
+
token = this._create_token(TOKEN.START_BLOCK, c + d);
|
|
22904
|
+
}
|
|
22905
|
+
if (token) {
|
|
22906
|
+
this._input.next();
|
|
22907
|
+
this._input.next();
|
|
22908
|
+
}
|
|
22909
|
+
return token;
|
|
22910
|
+
};
|
|
22865
22911
|
Tokenizer.prototype._read_punctuation = function() {
|
|
22866
22912
|
var resulting_string = this.__patterns.punct.read();
|
|
22867
22913
|
if (resulting_string !== "") {
|
|
@@ -23055,6 +23101,9 @@ var require_tokenizer2 = __commonJS({
|
|
|
23055
23101
|
matched = input_scan.match(/x([0-9A-Fa-f]{2})/g);
|
|
23056
23102
|
} else if (input_scan.peek() === "u") {
|
|
23057
23103
|
matched = input_scan.match(/u([0-9A-Fa-f]{4})/g);
|
|
23104
|
+
if (!matched) {
|
|
23105
|
+
matched = input_scan.match(/u\{([0-9A-Fa-f]+)\}/g);
|
|
23106
|
+
}
|
|
23058
23107
|
} else {
|
|
23059
23108
|
out += "\\";
|
|
23060
23109
|
if (input_scan.hasNext()) {
|
|
@@ -23070,7 +23119,8 @@ var require_tokenizer2 = __commonJS({
|
|
|
23070
23119
|
return s;
|
|
23071
23120
|
} else if (escaped >= 0 && escaped < 32) {
|
|
23072
23121
|
out += "\\" + matched[0];
|
|
23073
|
-
|
|
23122
|
+
} else if (escaped > 1114111) {
|
|
23123
|
+
out += "\\" + matched[0];
|
|
23074
23124
|
} else if (escaped === 34 || escaped === 39 || escaped === 92) {
|
|
23075
23125
|
out += "\\" + String.fromCharCode(escaped);
|
|
23076
23126
|
} else {
|
|
@@ -23134,9 +23184,9 @@ var require_tokenizer2 = __commonJS({
|
|
|
23134
23184
|
}
|
|
23135
23185
|
});
|
|
23136
23186
|
|
|
23137
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
23187
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/beautifier.js
|
|
23138
23188
|
var require_beautifier = __commonJS({
|
|
23139
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
23189
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/beautifier.js"(exports, module2) {
|
|
23140
23190
|
"use strict";
|
|
23141
23191
|
var Output = require_output().Output;
|
|
23142
23192
|
var Token = require_token().Token;
|
|
@@ -23261,6 +23311,8 @@ var require_beautifier = __commonJS({
|
|
|
23261
23311
|
inline_frame: false,
|
|
23262
23312
|
if_block: false,
|
|
23263
23313
|
else_block: false,
|
|
23314
|
+
class_start_block: false,
|
|
23315
|
+
// class A { INSIDE HERE } or class B extends C { INSIDE HERE }
|
|
23264
23316
|
do_block: false,
|
|
23265
23317
|
do_while: false,
|
|
23266
23318
|
import_block: false,
|
|
@@ -23566,6 +23618,8 @@ var require_beautifier = __commonJS({
|
|
|
23566
23618
|
if (peek_back_two.text === "{" || peek_back_two.text === "," || peek_back_two.text === "*" && (peek_back_three.text === "{" || peek_back_three.text === ",")) {
|
|
23567
23619
|
this._output.space_before_token = true;
|
|
23568
23620
|
}
|
|
23621
|
+
} else if (this._flags.parent && this._flags.parent.class_start_block) {
|
|
23622
|
+
this._output.space_before_token = true;
|
|
23569
23623
|
}
|
|
23570
23624
|
}
|
|
23571
23625
|
} else {
|
|
@@ -23638,6 +23692,11 @@ var require_beautifier = __commonJS({
|
|
|
23638
23692
|
} else {
|
|
23639
23693
|
this.set_mode(MODE.BlockStatement);
|
|
23640
23694
|
}
|
|
23695
|
+
if (this._flags.last_token) {
|
|
23696
|
+
if (reserved_array(this._flags.last_token.previous, ["class", "extends"])) {
|
|
23697
|
+
this._flags.class_start_block = true;
|
|
23698
|
+
}
|
|
23699
|
+
}
|
|
23641
23700
|
var empty_braces = !next_token.comments_before && next_token.text === "}";
|
|
23642
23701
|
var empty_anonymous_function = empty_braces && this._flags.last_word === "function" && this._flags.last_token.type === TOKEN.END_EXPR;
|
|
23643
23702
|
if (this._options.brace_preserve_inline) {
|
|
@@ -23671,7 +23730,7 @@ var require_beautifier = __commonJS({
|
|
|
23671
23730
|
}
|
|
23672
23731
|
}
|
|
23673
23732
|
if (this._flags.last_token.type !== TOKEN.OPERATOR && this._flags.last_token.type !== TOKEN.START_EXPR) {
|
|
23674
|
-
if (this._flags.last_token.type
|
|
23733
|
+
if (in_array(this._flags.last_token.type, [TOKEN.START_BLOCK, TOKEN.SEMICOLON]) && !this._flags.inline_frame) {
|
|
23675
23734
|
this.print_newline();
|
|
23676
23735
|
} else {
|
|
23677
23736
|
this._output.space_before_token = true;
|
|
@@ -23769,7 +23828,8 @@ var require_beautifier = __commonJS({
|
|
|
23769
23828
|
return;
|
|
23770
23829
|
}
|
|
23771
23830
|
if (this._flags.last_token.type === TOKEN.COMMA || this._flags.last_token.type === TOKEN.START_EXPR || this._flags.last_token.type === TOKEN.EQUALS || this._flags.last_token.type === TOKEN.OPERATOR) {
|
|
23772
|
-
if (!this.start_of_object_property()
|
|
23831
|
+
if (!this.start_of_object_property() && !// start of object property is different for numeric values with +/- prefix operators
|
|
23832
|
+
(in_array(this._flags.last_token.text, ["+", "-"]) && this._last_last_text === ":" && this._flags.parent.mode === MODE.ObjectLiteral)) {
|
|
23773
23833
|
this.allow_wrap_or_preserved_newline(current_token);
|
|
23774
23834
|
}
|
|
23775
23835
|
}
|
|
@@ -23968,16 +24028,15 @@ var require_beautifier = __commonJS({
|
|
|
23968
24028
|
var preserve_statement_flags = !isGeneratorAsterisk;
|
|
23969
24029
|
this.handle_whitespace_and_comments(current_token, preserve_statement_flags);
|
|
23970
24030
|
}
|
|
23971
|
-
if (
|
|
23972
|
-
this._output.space_before_token = true;
|
|
24031
|
+
if (current_token.text === "*" && this._flags.last_token.type === TOKEN.DOT) {
|
|
23973
24032
|
this.print_token(current_token);
|
|
23974
24033
|
return;
|
|
23975
24034
|
}
|
|
23976
|
-
if (current_token.text === "
|
|
24035
|
+
if (current_token.text === "::") {
|
|
23977
24036
|
this.print_token(current_token);
|
|
23978
24037
|
return;
|
|
23979
24038
|
}
|
|
23980
|
-
if (current_token.text
|
|
24039
|
+
if (in_array(current_token.text, ["-", "+"]) && this.start_of_object_property()) {
|
|
23981
24040
|
this.print_token(current_token);
|
|
23982
24041
|
return;
|
|
23983
24042
|
}
|
|
@@ -24065,7 +24124,11 @@ var require_beautifier = __commonJS({
|
|
|
24065
24124
|
space_before = false;
|
|
24066
24125
|
space_after = false;
|
|
24067
24126
|
if (current_token.newlines && (current_token.text === "--" || current_token.text === "++" || current_token.text === "~")) {
|
|
24068
|
-
this.
|
|
24127
|
+
var new_line_needed = reserved_array(this._flags.last_token, special_words) && current_token.newlines;
|
|
24128
|
+
if (new_line_needed && (this._previous_flags.if_block || this._previous_flags.else_block)) {
|
|
24129
|
+
this.restore_mode();
|
|
24130
|
+
}
|
|
24131
|
+
this.print_newline(new_line_needed, true);
|
|
24069
24132
|
}
|
|
24070
24133
|
if (this._flags.last_token.text === ";" && is_expression(this._flags.mode)) {
|
|
24071
24134
|
space_before = true;
|
|
@@ -24163,6 +24226,9 @@ var require_beautifier = __commonJS({
|
|
|
24163
24226
|
} else {
|
|
24164
24227
|
this.handle_whitespace_and_comments(current_token, true);
|
|
24165
24228
|
}
|
|
24229
|
+
if (this._flags.last_token.text.match("^[0-9]+$")) {
|
|
24230
|
+
this._output.space_before_token = true;
|
|
24231
|
+
}
|
|
24166
24232
|
if (reserved_array(this._flags.last_token, special_words)) {
|
|
24167
24233
|
this._output.space_before_token = false;
|
|
24168
24234
|
} else {
|
|
@@ -24192,9 +24258,9 @@ var require_beautifier = __commonJS({
|
|
|
24192
24258
|
}
|
|
24193
24259
|
});
|
|
24194
24260
|
|
|
24195
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24261
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/index.js
|
|
24196
24262
|
var require_javascript = __commonJS({
|
|
24197
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24263
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/index.js"(exports, module2) {
|
|
24198
24264
|
"use strict";
|
|
24199
24265
|
var Beautifier = require_beautifier().Beautifier;
|
|
24200
24266
|
var Options = require_options2().Options;
|
|
@@ -24209,9 +24275,9 @@ var require_javascript = __commonJS({
|
|
|
24209
24275
|
}
|
|
24210
24276
|
});
|
|
24211
24277
|
|
|
24212
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24278
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/options.js
|
|
24213
24279
|
var require_options3 = __commonJS({
|
|
24214
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24280
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/options.js"(exports, module2) {
|
|
24215
24281
|
"use strict";
|
|
24216
24282
|
var BaseOptions = require_options().Options;
|
|
24217
24283
|
function Options(options) {
|
|
@@ -24235,9 +24301,9 @@ var require_options3 = __commonJS({
|
|
|
24235
24301
|
}
|
|
24236
24302
|
});
|
|
24237
24303
|
|
|
24238
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24304
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/beautifier.js
|
|
24239
24305
|
var require_beautifier2 = __commonJS({
|
|
24240
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24306
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/beautifier.js"(exports, module2) {
|
|
24241
24307
|
"use strict";
|
|
24242
24308
|
var Options = require_options3().Options;
|
|
24243
24309
|
var Output = require_output().Output;
|
|
@@ -24256,20 +24322,21 @@ var require_beautifier2 = __commonJS({
|
|
|
24256
24322
|
this._ch = null;
|
|
24257
24323
|
this._input = null;
|
|
24258
24324
|
this.NESTED_AT_RULE = {
|
|
24259
|
-
"
|
|
24260
|
-
"
|
|
24261
|
-
"
|
|
24325
|
+
"page": true,
|
|
24326
|
+
"font-face": true,
|
|
24327
|
+
"keyframes": true,
|
|
24262
24328
|
// also in CONDITIONAL_GROUP_RULE below
|
|
24263
|
-
"
|
|
24264
|
-
"
|
|
24265
|
-
"
|
|
24329
|
+
"media": true,
|
|
24330
|
+
"supports": true,
|
|
24331
|
+
"document": true
|
|
24266
24332
|
};
|
|
24267
24333
|
this.CONDITIONAL_GROUP_RULE = {
|
|
24268
|
-
"
|
|
24269
|
-
"
|
|
24270
|
-
"
|
|
24334
|
+
"media": true,
|
|
24335
|
+
"supports": true,
|
|
24336
|
+
"document": true
|
|
24271
24337
|
};
|
|
24272
24338
|
this.NON_SEMICOLON_NEWLINE_PROPERTY = [
|
|
24339
|
+
"grid-template-areas",
|
|
24273
24340
|
"grid-template"
|
|
24274
24341
|
];
|
|
24275
24342
|
}
|
|
@@ -24364,8 +24431,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24364
24431
|
var insideRule = false;
|
|
24365
24432
|
var insidePropertyValue = false;
|
|
24366
24433
|
var enteringConditionalGroup = false;
|
|
24367
|
-
var
|
|
24368
|
-
var insideAtImport = false;
|
|
24434
|
+
var insideNonNestedAtRule = false;
|
|
24369
24435
|
var insideScssMap = false;
|
|
24370
24436
|
var topCharacter = this._ch;
|
|
24371
24437
|
var insideNonSemiColonValues = false;
|
|
@@ -24399,7 +24465,20 @@ var require_beautifier2 = __commonJS({
|
|
|
24399
24465
|
this._input.back();
|
|
24400
24466
|
this.print_string(this._input.read(comment_pattern));
|
|
24401
24467
|
this.eatWhitespace(true);
|
|
24402
|
-
} else if (this._ch === "
|
|
24468
|
+
} else if (this._ch === "$") {
|
|
24469
|
+
this.preserveSingleSpace(isAfterSpace);
|
|
24470
|
+
this.print_string(this._ch);
|
|
24471
|
+
var variable = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);
|
|
24472
|
+
if (variable.match(/[ :]$/)) {
|
|
24473
|
+
variable = this.eatString(": ").replace(/\s+$/, "");
|
|
24474
|
+
this.print_string(variable);
|
|
24475
|
+
this._output.space_before_token = true;
|
|
24476
|
+
}
|
|
24477
|
+
if (parenLevel === 0 && variable.indexOf(":") !== -1) {
|
|
24478
|
+
insidePropertyValue = true;
|
|
24479
|
+
this.indent();
|
|
24480
|
+
}
|
|
24481
|
+
} else if (this._ch === "@") {
|
|
24403
24482
|
this.preserveSingleSpace(isAfterSpace);
|
|
24404
24483
|
if (this._input.peek() === "{") {
|
|
24405
24484
|
this.print_string(this._ch + this.eatString("}"));
|
|
@@ -24407,24 +24486,20 @@ var require_beautifier2 = __commonJS({
|
|
|
24407
24486
|
this.print_string(this._ch);
|
|
24408
24487
|
var variableOrRule = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);
|
|
24409
24488
|
if (variableOrRule.match(/[ :]$/)) {
|
|
24410
|
-
variableOrRule = this.eatString(": ").replace(/\s
|
|
24489
|
+
variableOrRule = this.eatString(": ").replace(/\s+$/, "");
|
|
24411
24490
|
this.print_string(variableOrRule);
|
|
24412
24491
|
this._output.space_before_token = true;
|
|
24413
24492
|
}
|
|
24414
|
-
|
|
24415
|
-
|
|
24416
|
-
|
|
24417
|
-
} else if (variableOrRule
|
|
24418
|
-
insideAtImport = true;
|
|
24419
|
-
}
|
|
24420
|
-
if (variableOrRule in this.NESTED_AT_RULE) {
|
|
24493
|
+
if (parenLevel === 0 && variableOrRule.indexOf(":") !== -1) {
|
|
24494
|
+
insidePropertyValue = true;
|
|
24495
|
+
this.indent();
|
|
24496
|
+
} else if (variableOrRule in this.NESTED_AT_RULE) {
|
|
24421
24497
|
this._nestedLevel += 1;
|
|
24422
24498
|
if (variableOrRule in this.CONDITIONAL_GROUP_RULE) {
|
|
24423
24499
|
enteringConditionalGroup = true;
|
|
24424
24500
|
}
|
|
24425
|
-
} else if (
|
|
24426
|
-
|
|
24427
|
-
this.indent();
|
|
24501
|
+
} else if (parenLevel === 0 && !insidePropertyValue) {
|
|
24502
|
+
insideNonNestedAtRule = true;
|
|
24428
24503
|
}
|
|
24429
24504
|
}
|
|
24430
24505
|
} else if (this._ch === "#" && this._input.peek() === "{") {
|
|
@@ -24435,6 +24510,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24435
24510
|
insidePropertyValue = false;
|
|
24436
24511
|
this.outdent();
|
|
24437
24512
|
}
|
|
24513
|
+
insideNonNestedAtRule = false;
|
|
24438
24514
|
if (enteringConditionalGroup) {
|
|
24439
24515
|
enteringConditionalGroup = false;
|
|
24440
24516
|
insideRule = this._indentLevel >= this._nestedLevel;
|
|
@@ -24468,8 +24544,6 @@ var require_beautifier2 = __commonJS({
|
|
|
24468
24544
|
if (previous_ch === "{") {
|
|
24469
24545
|
this._output.trim(true);
|
|
24470
24546
|
}
|
|
24471
|
-
insideAtImport = false;
|
|
24472
|
-
insideAtExtend = false;
|
|
24473
24547
|
if (insidePropertyValue) {
|
|
24474
24548
|
this.outdent();
|
|
24475
24549
|
insidePropertyValue = false;
|
|
@@ -24499,7 +24573,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24499
24573
|
break;
|
|
24500
24574
|
}
|
|
24501
24575
|
}
|
|
24502
|
-
if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !
|
|
24576
|
+
if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideNonNestedAtRule && parenLevel === 0) {
|
|
24503
24577
|
this.print_string(":");
|
|
24504
24578
|
if (!insidePropertyValue) {
|
|
24505
24579
|
insidePropertyValue = true;
|
|
@@ -24519,7 +24593,8 @@ var require_beautifier2 = __commonJS({
|
|
|
24519
24593
|
}
|
|
24520
24594
|
}
|
|
24521
24595
|
} else if (this._ch === '"' || this._ch === "'") {
|
|
24522
|
-
|
|
24596
|
+
var preserveQuoteSpace = previous_ch === '"' || previous_ch === "'";
|
|
24597
|
+
this.preserveSingleSpace(preserveQuoteSpace || isAfterSpace);
|
|
24523
24598
|
this.print_string(this._ch + this.eatString(this._ch));
|
|
24524
24599
|
this.eatWhitespace(true);
|
|
24525
24600
|
} else if (this._ch === ";") {
|
|
@@ -24529,8 +24604,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24529
24604
|
this.outdent();
|
|
24530
24605
|
insidePropertyValue = false;
|
|
24531
24606
|
}
|
|
24532
|
-
|
|
24533
|
-
insideAtImport = false;
|
|
24607
|
+
insideNonNestedAtRule = false;
|
|
24534
24608
|
this.print_string(this._ch);
|
|
24535
24609
|
this.eatWhitespace(true);
|
|
24536
24610
|
if (this._input.peek() !== "/") {
|
|
@@ -24558,7 +24632,11 @@ var require_beautifier2 = __commonJS({
|
|
|
24558
24632
|
}
|
|
24559
24633
|
}
|
|
24560
24634
|
} else {
|
|
24561
|
-
|
|
24635
|
+
var space_needed = false;
|
|
24636
|
+
if (this._input.lookBack("with")) {
|
|
24637
|
+
space_needed = true;
|
|
24638
|
+
}
|
|
24639
|
+
this.preserveSingleSpace(isAfterSpace || space_needed);
|
|
24562
24640
|
this.print_string(this._ch);
|
|
24563
24641
|
if (insidePropertyValue && previous_ch === "$" && this._options.selector_separator_newline) {
|
|
24564
24642
|
this._output.add_new_line();
|
|
@@ -24583,7 +24661,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24583
24661
|
} else if (this._ch === ",") {
|
|
24584
24662
|
this.print_string(this._ch);
|
|
24585
24663
|
this.eatWhitespace(true);
|
|
24586
|
-
if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !
|
|
24664
|
+
if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideNonNestedAtRule) {
|
|
24587
24665
|
this._output.add_new_line();
|
|
24588
24666
|
} else {
|
|
24589
24667
|
this._output.space_before_token = true;
|
|
@@ -24612,7 +24690,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24612
24690
|
this._ch = "";
|
|
24613
24691
|
}
|
|
24614
24692
|
} else if (this._ch === "!" && !this._input.lookBack("\\")) {
|
|
24615
|
-
this.
|
|
24693
|
+
this._output.space_before_token = true;
|
|
24616
24694
|
this.print_string(this._ch);
|
|
24617
24695
|
} else {
|
|
24618
24696
|
var preserveAfterSpace = previous_ch === '"' || previous_ch === "'";
|
|
@@ -24630,9 +24708,9 @@ var require_beautifier2 = __commonJS({
|
|
|
24630
24708
|
}
|
|
24631
24709
|
});
|
|
24632
24710
|
|
|
24633
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24711
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/index.js
|
|
24634
24712
|
var require_css = __commonJS({
|
|
24635
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24713
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/index.js"(exports, module2) {
|
|
24636
24714
|
"use strict";
|
|
24637
24715
|
var Beautifier = require_beautifier2().Beautifier;
|
|
24638
24716
|
var Options = require_options3().Options;
|
|
@@ -24647,9 +24725,9 @@ var require_css = __commonJS({
|
|
|
24647
24725
|
}
|
|
24648
24726
|
});
|
|
24649
24727
|
|
|
24650
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24728
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/options.js
|
|
24651
24729
|
var require_options4 = __commonJS({
|
|
24652
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24730
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/options.js"(exports, module2) {
|
|
24653
24731
|
"use strict";
|
|
24654
24732
|
var BaseOptions = require_options().Options;
|
|
24655
24733
|
function Options(options) {
|
|
@@ -24665,6 +24743,7 @@ var require_options4 = __commonJS({
|
|
|
24665
24743
|
"wrap_attributes",
|
|
24666
24744
|
["auto", "force", "force-aligned", "force-expand-multiline", "aligned-multiple", "preserve", "preserve-aligned"]
|
|
24667
24745
|
);
|
|
24746
|
+
this.wrap_attributes_min_attrs = this._get_number("wrap_attributes_min_attrs", 2);
|
|
24668
24747
|
this.wrap_attributes_indent_size = this._get_number("wrap_attributes_indent_size", this.indent_size);
|
|
24669
24748
|
this.extra_liners = this._get_array("extra_liners", ["head", "body", "/html"]);
|
|
24670
24749
|
this.inline = this._get_array("inline", [
|
|
@@ -24728,6 +24807,7 @@ var require_options4 = __commonJS({
|
|
|
24728
24807
|
"strike",
|
|
24729
24808
|
"tt"
|
|
24730
24809
|
]);
|
|
24810
|
+
this.inline_custom_elements = this._get_boolean("inline_custom_elements", true);
|
|
24731
24811
|
this.void_elements = this._get_array("void_elements", [
|
|
24732
24812
|
// HTLM void elements - aka self-closing tags - aka singletons
|
|
24733
24813
|
// https://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements
|
|
@@ -24771,9 +24851,9 @@ var require_options4 = __commonJS({
|
|
|
24771
24851
|
}
|
|
24772
24852
|
});
|
|
24773
24853
|
|
|
24774
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24854
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/tokenizer.js
|
|
24775
24855
|
var require_tokenizer3 = __commonJS({
|
|
24776
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24856
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/tokenizer.js"(exports, module2) {
|
|
24777
24857
|
"use strict";
|
|
24778
24858
|
var BaseTokenizer = require_tokenizer().Tokenizer;
|
|
24779
24859
|
var BASETOKEN = require_tokenizer().TOKEN;
|
|
@@ -24783,6 +24863,8 @@ var require_tokenizer3 = __commonJS({
|
|
|
24783
24863
|
var TOKEN = {
|
|
24784
24864
|
TAG_OPEN: "TK_TAG_OPEN",
|
|
24785
24865
|
TAG_CLOSE: "TK_TAG_CLOSE",
|
|
24866
|
+
CONTROL_FLOW_OPEN: "TK_CONTROL_FLOW_OPEN",
|
|
24867
|
+
CONTROL_FLOW_CLOSE: "TK_CONTROL_FLOW_CLOSE",
|
|
24786
24868
|
ATTRIBUTE: "TK_ATTRIBUTE",
|
|
24787
24869
|
EQUALS: "TK_EQUALS",
|
|
24788
24870
|
VALUE: "TK_VALUE",
|
|
@@ -24801,10 +24883,12 @@ var require_tokenizer3 = __commonJS({
|
|
|
24801
24883
|
var pattern_reader = new Pattern(this._input);
|
|
24802
24884
|
this.__patterns = {
|
|
24803
24885
|
word: templatable_reader.until(/[\n\r\t <]/),
|
|
24886
|
+
word_control_flow_close_excluded: templatable_reader.until(/[\n\r\t <}]/),
|
|
24804
24887
|
single_quote: templatable_reader.until_after(/'/),
|
|
24805
24888
|
double_quote: templatable_reader.until_after(/"/),
|
|
24806
24889
|
attribute: templatable_reader.until(/[\n\r\t =>]|\/>/),
|
|
24807
24890
|
element_name: templatable_reader.until(/[\n\r\t >\/]/),
|
|
24891
|
+
angular_control_flow_start: pattern_reader.matching(/\@[a-zA-Z]+[^({]*[({]/),
|
|
24808
24892
|
handlebars_comment: pattern_reader.starting_with(/{{!--/).until_after(/--}}/),
|
|
24809
24893
|
handlebars: pattern_reader.starting_with(/{{/).until_after(/}}/),
|
|
24810
24894
|
handlebars_open: pattern_reader.until(/[\n\r\t }]/),
|
|
@@ -24817,6 +24901,7 @@ var require_tokenizer3 = __commonJS({
|
|
|
24817
24901
|
};
|
|
24818
24902
|
if (this._options.indent_handlebars) {
|
|
24819
24903
|
this.__patterns.word = this.__patterns.word.exclude("handlebars");
|
|
24904
|
+
this.__patterns.word_control_flow_close_excluded = this.__patterns.word_control_flow_close_excluded.exclude("handlebars");
|
|
24820
24905
|
}
|
|
24821
24906
|
this._unformatted_content_delimiter = null;
|
|
24822
24907
|
if (this._options.unformatted_content_delimiter) {
|
|
@@ -24829,10 +24914,10 @@ var require_tokenizer3 = __commonJS({
|
|
|
24829
24914
|
return false;
|
|
24830
24915
|
};
|
|
24831
24916
|
Tokenizer.prototype._is_opening = function(current_token) {
|
|
24832
|
-
return current_token.type === TOKEN.TAG_OPEN;
|
|
24917
|
+
return current_token.type === TOKEN.TAG_OPEN || current_token.type === TOKEN.CONTROL_FLOW_OPEN;
|
|
24833
24918
|
};
|
|
24834
24919
|
Tokenizer.prototype._is_closing = function(current_token, open_token) {
|
|
24835
|
-
return current_token.type === TOKEN.TAG_CLOSE && (open_token && ((current_token.text === ">" || current_token.text === "/>") && open_token.text[0] === "<" || current_token.text === "}}" && open_token.text[0] === "{" && open_token.text[1] === "{"));
|
|
24920
|
+
return current_token.type === TOKEN.TAG_CLOSE && (open_token && ((current_token.text === ">" || current_token.text === "/>") && open_token.text[0] === "<" || current_token.text === "}}" && open_token.text[0] === "{" && open_token.text[1] === "{")) || current_token.type === TOKEN.CONTROL_FLOW_CLOSE && (current_token.text === "}" && open_token.text.endsWith("{"));
|
|
24836
24921
|
};
|
|
24837
24922
|
Tokenizer.prototype._reset = function() {
|
|
24838
24923
|
this._current_tag_name = "";
|
|
@@ -24847,8 +24932,9 @@ var require_tokenizer3 = __commonJS({
|
|
|
24847
24932
|
token = token || this._read_open_handlebars(c, open_token);
|
|
24848
24933
|
token = token || this._read_attribute(c, previous_token, open_token);
|
|
24849
24934
|
token = token || this._read_close(c, open_token);
|
|
24935
|
+
token = token || this._read_control_flows(c, open_token);
|
|
24850
24936
|
token = token || this._read_raw_content(c, previous_token, open_token);
|
|
24851
|
-
token = token || this._read_content_word(c);
|
|
24937
|
+
token = token || this._read_content_word(c, open_token);
|
|
24852
24938
|
token = token || this._read_comment_or_cdata(c);
|
|
24853
24939
|
token = token || this._read_processing(c);
|
|
24854
24940
|
token = token || this._read_open(c, open_token);
|
|
@@ -24899,7 +24985,7 @@ var require_tokenizer3 = __commonJS({
|
|
|
24899
24985
|
Tokenizer.prototype._read_open = function(c, open_token) {
|
|
24900
24986
|
var resulting_string = null;
|
|
24901
24987
|
var token = null;
|
|
24902
|
-
if (!open_token) {
|
|
24988
|
+
if (!open_token || open_token.type === TOKEN.CONTROL_FLOW_OPEN) {
|
|
24903
24989
|
if (c === "<") {
|
|
24904
24990
|
resulting_string = this._input.next();
|
|
24905
24991
|
if (this._input.peek() === "/") {
|
|
@@ -24914,7 +25000,7 @@ var require_tokenizer3 = __commonJS({
|
|
|
24914
25000
|
Tokenizer.prototype._read_open_handlebars = function(c, open_token) {
|
|
24915
25001
|
var resulting_string = null;
|
|
24916
25002
|
var token = null;
|
|
24917
|
-
if (!open_token) {
|
|
25003
|
+
if (!open_token || open_token.type === TOKEN.CONTROL_FLOW_OPEN) {
|
|
24918
25004
|
if (this._options.indent_handlebars && c === "{" && this._input.peek(1) === "{") {
|
|
24919
25005
|
if (this._input.peek(2) === "!") {
|
|
24920
25006
|
resulting_string = this.__patterns.handlebars_comment.read();
|
|
@@ -24928,10 +25014,41 @@ var require_tokenizer3 = __commonJS({
|
|
|
24928
25014
|
}
|
|
24929
25015
|
return token;
|
|
24930
25016
|
};
|
|
25017
|
+
Tokenizer.prototype._read_control_flows = function(c, open_token) {
|
|
25018
|
+
var resulting_string = "";
|
|
25019
|
+
var token = null;
|
|
25020
|
+
if (!this._options.templating.includes("angular") || !this._options.indent_handlebars) {
|
|
25021
|
+
return token;
|
|
25022
|
+
}
|
|
25023
|
+
if (c === "@") {
|
|
25024
|
+
resulting_string = this.__patterns.angular_control_flow_start.read();
|
|
25025
|
+
if (resulting_string === "") {
|
|
25026
|
+
return token;
|
|
25027
|
+
}
|
|
25028
|
+
var opening_parentheses_count = resulting_string.endsWith("(") ? 1 : 0;
|
|
25029
|
+
var closing_parentheses_count = 0;
|
|
25030
|
+
while (!(resulting_string.endsWith("{") && opening_parentheses_count === closing_parentheses_count)) {
|
|
25031
|
+
var next_char = this._input.next();
|
|
25032
|
+
if (next_char === null) {
|
|
25033
|
+
break;
|
|
25034
|
+
} else if (next_char === "(") {
|
|
25035
|
+
opening_parentheses_count++;
|
|
25036
|
+
} else if (next_char === ")") {
|
|
25037
|
+
closing_parentheses_count++;
|
|
25038
|
+
}
|
|
25039
|
+
resulting_string += next_char;
|
|
25040
|
+
}
|
|
25041
|
+
token = this._create_token(TOKEN.CONTROL_FLOW_OPEN, resulting_string);
|
|
25042
|
+
} else if (c === "}" && open_token && open_token.type === TOKEN.CONTROL_FLOW_OPEN) {
|
|
25043
|
+
resulting_string = this._input.next();
|
|
25044
|
+
token = this._create_token(TOKEN.CONTROL_FLOW_CLOSE, resulting_string);
|
|
25045
|
+
}
|
|
25046
|
+
return token;
|
|
25047
|
+
};
|
|
24931
25048
|
Tokenizer.prototype._read_close = function(c, open_token) {
|
|
24932
25049
|
var resulting_string = null;
|
|
24933
25050
|
var token = null;
|
|
24934
|
-
if (open_token) {
|
|
25051
|
+
if (open_token && open_token.type === TOKEN.TAG_OPEN) {
|
|
24935
25052
|
if (open_token.text[0] === "<" && (c === ">" || c === "/" && this._input.peek(1) === ">")) {
|
|
24936
25053
|
resulting_string = this._input.next();
|
|
24937
25054
|
if (c === "/") {
|
|
@@ -24998,7 +25115,7 @@ var require_tokenizer3 = __commonJS({
|
|
|
24998
25115
|
}
|
|
24999
25116
|
return null;
|
|
25000
25117
|
};
|
|
25001
|
-
Tokenizer.prototype._read_content_word = function(c) {
|
|
25118
|
+
Tokenizer.prototype._read_content_word = function(c, open_token) {
|
|
25002
25119
|
var resulting_string = "";
|
|
25003
25120
|
if (this._options.unformatted_content_delimiter) {
|
|
25004
25121
|
if (c === this._options.unformatted_content_delimiter[0]) {
|
|
@@ -25006,7 +25123,7 @@ var require_tokenizer3 = __commonJS({
|
|
|
25006
25123
|
}
|
|
25007
25124
|
}
|
|
25008
25125
|
if (!resulting_string) {
|
|
25009
|
-
resulting_string = this.__patterns.word.read();
|
|
25126
|
+
resulting_string = open_token && open_token.type === TOKEN.CONTROL_FLOW_OPEN ? this.__patterns.word_control_flow_close_excluded.read() : this.__patterns.word.read();
|
|
25010
25127
|
}
|
|
25011
25128
|
if (resulting_string) {
|
|
25012
25129
|
return this._create_token(TOKEN.TEXT, resulting_string);
|
|
@@ -25017,9 +25134,9 @@ var require_tokenizer3 = __commonJS({
|
|
|
25017
25134
|
}
|
|
25018
25135
|
});
|
|
25019
25136
|
|
|
25020
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
25137
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/beautifier.js
|
|
25021
25138
|
var require_beautifier3 = __commonJS({
|
|
25022
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
25139
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/beautifier.js"(exports, module2) {
|
|
25023
25140
|
"use strict";
|
|
25024
25141
|
var Options = require_options4().Options;
|
|
25025
25142
|
var Output = require_output().Output;
|
|
@@ -25085,6 +25202,12 @@ var require_beautifier3 = __commonJS({
|
|
|
25085
25202
|
Printer3.prototype.indent = function() {
|
|
25086
25203
|
this.indent_level++;
|
|
25087
25204
|
};
|
|
25205
|
+
Printer3.prototype.deindent = function() {
|
|
25206
|
+
if (this.indent_level > 0) {
|
|
25207
|
+
this.indent_level--;
|
|
25208
|
+
this._output.set_indent(this.indent_level, this.alignment_size);
|
|
25209
|
+
}
|
|
25210
|
+
};
|
|
25088
25211
|
Printer3.prototype.get_full_indent = function(level) {
|
|
25089
25212
|
level = this.indent_level + (level || 0);
|
|
25090
25213
|
if (level < 1) {
|
|
@@ -25222,14 +25345,18 @@ var require_beautifier3 = __commonJS({
|
|
|
25222
25345
|
var raw_token = tokens.next();
|
|
25223
25346
|
while (raw_token.type !== TOKEN.EOF) {
|
|
25224
25347
|
if (raw_token.type === TOKEN.TAG_OPEN || raw_token.type === TOKEN.COMMENT) {
|
|
25225
|
-
parser_token = this._handle_tag_open(printer, raw_token, last_tag_token, last_token);
|
|
25348
|
+
parser_token = this._handle_tag_open(printer, raw_token, last_tag_token, last_token, tokens);
|
|
25226
25349
|
last_tag_token = parser_token;
|
|
25227
25350
|
} else if (raw_token.type === TOKEN.ATTRIBUTE || raw_token.type === TOKEN.EQUALS || raw_token.type === TOKEN.VALUE || raw_token.type === TOKEN.TEXT && !last_tag_token.tag_complete) {
|
|
25228
|
-
parser_token = this._handle_inside_tag(printer, raw_token, last_tag_token,
|
|
25351
|
+
parser_token = this._handle_inside_tag(printer, raw_token, last_tag_token, last_token);
|
|
25229
25352
|
} else if (raw_token.type === TOKEN.TAG_CLOSE) {
|
|
25230
25353
|
parser_token = this._handle_tag_close(printer, raw_token, last_tag_token);
|
|
25231
25354
|
} else if (raw_token.type === TOKEN.TEXT) {
|
|
25232
25355
|
parser_token = this._handle_text(printer, raw_token, last_tag_token);
|
|
25356
|
+
} else if (raw_token.type === TOKEN.CONTROL_FLOW_OPEN) {
|
|
25357
|
+
parser_token = this._handle_control_flow_open(printer, raw_token);
|
|
25358
|
+
} else if (raw_token.type === TOKEN.CONTROL_FLOW_CLOSE) {
|
|
25359
|
+
parser_token = this._handle_control_flow_close(printer, raw_token);
|
|
25233
25360
|
} else {
|
|
25234
25361
|
printer.add_raw_token(raw_token);
|
|
25235
25362
|
}
|
|
@@ -25239,6 +25366,35 @@ var require_beautifier3 = __commonJS({
|
|
|
25239
25366
|
var sweet_code = printer._output.get_code(eol);
|
|
25240
25367
|
return sweet_code;
|
|
25241
25368
|
};
|
|
25369
|
+
Beautifier.prototype._handle_control_flow_open = function(printer, raw_token) {
|
|
25370
|
+
var parser_token = {
|
|
25371
|
+
text: raw_token.text,
|
|
25372
|
+
type: raw_token.type
|
|
25373
|
+
};
|
|
25374
|
+
printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== "", true);
|
|
25375
|
+
if (raw_token.newlines) {
|
|
25376
|
+
printer.print_preserved_newlines(raw_token);
|
|
25377
|
+
} else {
|
|
25378
|
+
printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== "", true);
|
|
25379
|
+
}
|
|
25380
|
+
printer.print_token(raw_token);
|
|
25381
|
+
printer.indent();
|
|
25382
|
+
return parser_token;
|
|
25383
|
+
};
|
|
25384
|
+
Beautifier.prototype._handle_control_flow_close = function(printer, raw_token) {
|
|
25385
|
+
var parser_token = {
|
|
25386
|
+
text: raw_token.text,
|
|
25387
|
+
type: raw_token.type
|
|
25388
|
+
};
|
|
25389
|
+
printer.deindent();
|
|
25390
|
+
if (raw_token.newlines) {
|
|
25391
|
+
printer.print_preserved_newlines(raw_token);
|
|
25392
|
+
} else {
|
|
25393
|
+
printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== "", true);
|
|
25394
|
+
}
|
|
25395
|
+
printer.print_token(raw_token);
|
|
25396
|
+
return parser_token;
|
|
25397
|
+
};
|
|
25242
25398
|
Beautifier.prototype._handle_tag_close = function(printer, raw_token, last_tag_token) {
|
|
25243
25399
|
var parser_token = {
|
|
25244
25400
|
text: raw_token.text,
|
|
@@ -25267,7 +25423,7 @@ var require_beautifier3 = __commonJS({
|
|
|
25267
25423
|
}
|
|
25268
25424
|
return parser_token;
|
|
25269
25425
|
};
|
|
25270
|
-
Beautifier.prototype._handle_inside_tag = function(printer, raw_token, last_tag_token,
|
|
25426
|
+
Beautifier.prototype._handle_inside_tag = function(printer, raw_token, last_tag_token, last_token) {
|
|
25271
25427
|
var wrapped = last_tag_token.has_wrapped_attrs;
|
|
25272
25428
|
var parser_token = {
|
|
25273
25429
|
text: raw_token.text,
|
|
@@ -25286,7 +25442,6 @@ var require_beautifier3 = __commonJS({
|
|
|
25286
25442
|
} else {
|
|
25287
25443
|
if (raw_token.type === TOKEN.ATTRIBUTE) {
|
|
25288
25444
|
printer.set_space_before_token(true);
|
|
25289
|
-
last_tag_token.attr_count += 1;
|
|
25290
25445
|
} else if (raw_token.type === TOKEN.EQUALS) {
|
|
25291
25446
|
printer.set_space_before_token(false);
|
|
25292
25447
|
} else if (raw_token.type === TOKEN.VALUE && raw_token.previous.type === TOKEN.EQUALS) {
|
|
@@ -25297,26 +25452,10 @@ var require_beautifier3 = __commonJS({
|
|
|
25297
25452
|
printer.traverse_whitespace(raw_token);
|
|
25298
25453
|
wrapped = wrapped || raw_token.newlines !== 0;
|
|
25299
25454
|
}
|
|
25300
|
-
if (this._is_wrap_attributes_force
|
|
25301
|
-
|
|
25302
|
-
|
|
25303
|
-
|
|
25304
|
-
var peek_index = 0;
|
|
25305
|
-
var peek_token;
|
|
25306
|
-
do {
|
|
25307
|
-
peek_token = tokens.peek(peek_index);
|
|
25308
|
-
if (peek_token.type === TOKEN.ATTRIBUTE) {
|
|
25309
|
-
is_only_attribute = false;
|
|
25310
|
-
break;
|
|
25311
|
-
}
|
|
25312
|
-
peek_index += 1;
|
|
25313
|
-
} while (peek_index < 4 && peek_token.type !== TOKEN.EOF && peek_token.type !== TOKEN.TAG_CLOSE);
|
|
25314
|
-
force_attr_wrap = !is_only_attribute;
|
|
25315
|
-
}
|
|
25316
|
-
if (force_attr_wrap) {
|
|
25317
|
-
printer.print_newline(false);
|
|
25318
|
-
wrapped = true;
|
|
25319
|
-
}
|
|
25455
|
+
if (this._is_wrap_attributes_force && last_tag_token.attr_count >= this._options.wrap_attributes_min_attrs && (last_token.type !== TOKEN.TAG_OPEN || // ie. second attribute and beyond
|
|
25456
|
+
this._is_wrap_attributes_force_expand_multiline)) {
|
|
25457
|
+
printer.print_newline(false);
|
|
25458
|
+
wrapped = true;
|
|
25320
25459
|
}
|
|
25321
25460
|
}
|
|
25322
25461
|
printer.print_token(raw_token);
|
|
@@ -25413,9 +25552,9 @@ var require_beautifier3 = __commonJS({
|
|
|
25413
25552
|
}
|
|
25414
25553
|
}
|
|
25415
25554
|
};
|
|
25416
|
-
Beautifier.prototype._handle_tag_open = function(printer, raw_token, last_tag_token, last_token) {
|
|
25555
|
+
Beautifier.prototype._handle_tag_open = function(printer, raw_token, last_tag_token, last_token, tokens) {
|
|
25417
25556
|
var parser_token = this._get_tag_open_token(raw_token);
|
|
25418
|
-
if ((last_tag_token.is_unformatted || last_tag_token.is_content_unformatted) && !last_tag_token.is_empty_element && raw_token.type === TOKEN.TAG_OPEN &&
|
|
25557
|
+
if ((last_tag_token.is_unformatted || last_tag_token.is_content_unformatted) && !last_tag_token.is_empty_element && raw_token.type === TOKEN.TAG_OPEN && !parser_token.is_start_tag) {
|
|
25419
25558
|
printer.add_raw_token(raw_token);
|
|
25420
25559
|
parser_token.start_tag_token = this._tag_stack.try_pop(parser_token.tag_name);
|
|
25421
25560
|
} else {
|
|
@@ -25426,6 +25565,17 @@ var require_beautifier3 = __commonJS({
|
|
|
25426
25565
|
}
|
|
25427
25566
|
printer.print_token(raw_token);
|
|
25428
25567
|
}
|
|
25568
|
+
if (parser_token.is_start_tag && this._is_wrap_attributes_force) {
|
|
25569
|
+
var peek_index = 0;
|
|
25570
|
+
var peek_token;
|
|
25571
|
+
do {
|
|
25572
|
+
peek_token = tokens.peek(peek_index);
|
|
25573
|
+
if (peek_token.type === TOKEN.ATTRIBUTE) {
|
|
25574
|
+
parser_token.attr_count += 1;
|
|
25575
|
+
}
|
|
25576
|
+
peek_index += 1;
|
|
25577
|
+
} while (peek_token.type !== TOKEN.EOF && peek_token.type !== TOKEN.TAG_CLOSE);
|
|
25578
|
+
}
|
|
25429
25579
|
if (this._is_wrap_attributes_force_aligned || this._is_wrap_attributes_aligned_multiple || this._is_wrap_attributes_preserve_aligned) {
|
|
25430
25580
|
parser_token.alignment_size = raw_token.text.length + 1;
|
|
25431
25581
|
}
|
|
@@ -25465,10 +25615,14 @@ var require_beautifier3 = __commonJS({
|
|
|
25465
25615
|
tag_check_match = raw_token.text.match(/^<([^\s>]*)/);
|
|
25466
25616
|
this.tag_check = tag_check_match ? tag_check_match[1] : "";
|
|
25467
25617
|
} else {
|
|
25468
|
-
tag_check_match = raw_token.text.match(/^{{(?:[\^]|#\*?)?([^\s}]+)/);
|
|
25618
|
+
tag_check_match = raw_token.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/);
|
|
25469
25619
|
this.tag_check = tag_check_match ? tag_check_match[1] : "";
|
|
25470
|
-
if (raw_token.text
|
|
25471
|
-
this.tag_check
|
|
25620
|
+
if ((raw_token.text.startsWith("{{#>") || raw_token.text.startsWith("{{~#>")) && this.tag_check[0] === ">") {
|
|
25621
|
+
if (this.tag_check === ">" && raw_token.next !== null) {
|
|
25622
|
+
this.tag_check = raw_token.next.text.split(" ")[0];
|
|
25623
|
+
} else {
|
|
25624
|
+
this.tag_check = raw_token.text.split(">")[1];
|
|
25625
|
+
}
|
|
25472
25626
|
}
|
|
25473
25627
|
}
|
|
25474
25628
|
this.tag_check = this.tag_check.toLowerCase();
|
|
@@ -25478,7 +25632,13 @@ var require_beautifier3 = __commonJS({
|
|
|
25478
25632
|
this.is_start_tag = this.tag_check.charAt(0) !== "/";
|
|
25479
25633
|
this.tag_name = !this.is_start_tag ? this.tag_check.substr(1) : this.tag_check;
|
|
25480
25634
|
this.is_end_tag = !this.is_start_tag || raw_token.closed && raw_token.closed.text === "/>";
|
|
25481
|
-
|
|
25635
|
+
var handlebar_starts = 2;
|
|
25636
|
+
if (this.tag_start_char === "{" && this.text.length >= 3) {
|
|
25637
|
+
if (this.text.charAt(2) === "~") {
|
|
25638
|
+
handlebar_starts = 3;
|
|
25639
|
+
}
|
|
25640
|
+
}
|
|
25641
|
+
this.is_end_tag = this.is_end_tag || this.tag_start_char === "{" && (this.text.length < 3 || /[^#\^]/.test(this.text.charAt(handlebar_starts)));
|
|
25482
25642
|
}
|
|
25483
25643
|
};
|
|
25484
25644
|
Beautifier.prototype._get_tag_open_token = function(raw_token) {
|
|
@@ -25488,7 +25648,7 @@ var require_beautifier3 = __commonJS({
|
|
|
25488
25648
|
parser_token.is_empty_element = parser_token.tag_complete || parser_token.is_start_tag && parser_token.is_end_tag;
|
|
25489
25649
|
parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted);
|
|
25490
25650
|
parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted);
|
|
25491
|
-
parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_start_char === "{";
|
|
25651
|
+
parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || this._options.inline_custom_elements && parser_token.tag_name.includes("-") || parser_token.tag_start_char === "{";
|
|
25492
25652
|
return parser_token;
|
|
25493
25653
|
};
|
|
25494
25654
|
Beautifier.prototype._set_tag_position = function(printer, raw_token, parser_token, last_tag_token, last_token) {
|
|
@@ -25561,7 +25721,7 @@ var require_beautifier3 = __commonJS({
|
|
|
25561
25721
|
parser_token.parent.multiline_content = true;
|
|
25562
25722
|
}
|
|
25563
25723
|
};
|
|
25564
|
-
var p_closers = ["address", "article", "aside", "blockquote", "details", "div", "dl", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hr", "main", "nav", "ol", "p", "pre", "section", "table", "ul"];
|
|
25724
|
+
var p_closers = ["address", "article", "aside", "blockquote", "details", "div", "dl", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hr", "main", "menu", "nav", "ol", "p", "pre", "section", "table", "ul"];
|
|
25565
25725
|
var p_parent_excludes = ["a", "audio", "del", "ins", "map", "noscript", "video"];
|
|
25566
25726
|
Beautifier.prototype._do_optional_end_element = function(parser_token) {
|
|
25567
25727
|
var result = null;
|
|
@@ -25571,7 +25731,7 @@ var require_beautifier3 = __commonJS({
|
|
|
25571
25731
|
if (parser_token.tag_name === "body") {
|
|
25572
25732
|
result = result || this._tag_stack.try_pop("head");
|
|
25573
25733
|
} else if (parser_token.tag_name === "li") {
|
|
25574
|
-
result = result || this._tag_stack.try_pop("li", ["ol", "ul"]);
|
|
25734
|
+
result = result || this._tag_stack.try_pop("li", ["ol", "ul", "menu"]);
|
|
25575
25735
|
} else if (parser_token.tag_name === "dd" || parser_token.tag_name === "dt") {
|
|
25576
25736
|
result = result || this._tag_stack.try_pop("dt", ["dl"]);
|
|
25577
25737
|
result = result || this._tag_stack.try_pop("dd", ["dl"]);
|
|
@@ -25612,9 +25772,9 @@ var require_beautifier3 = __commonJS({
|
|
|
25612
25772
|
}
|
|
25613
25773
|
});
|
|
25614
25774
|
|
|
25615
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
25775
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/index.js
|
|
25616
25776
|
var require_html = __commonJS({
|
|
25617
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
25777
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/index.js"(exports, module2) {
|
|
25618
25778
|
"use strict";
|
|
25619
25779
|
var Beautifier = require_beautifier3().Beautifier;
|
|
25620
25780
|
var Options = require_options4().Options;
|
|
@@ -25629,9 +25789,9 @@ var require_html = __commonJS({
|
|
|
25629
25789
|
}
|
|
25630
25790
|
});
|
|
25631
25791
|
|
|
25632
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
25792
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/index.js
|
|
25633
25793
|
var require_src = __commonJS({
|
|
25634
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
25794
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/index.js"(exports, module2) {
|
|
25635
25795
|
"use strict";
|
|
25636
25796
|
var js_beautify2 = require_javascript();
|
|
25637
25797
|
var css_beautify = require_css();
|
|
@@ -25648,9 +25808,9 @@ var require_src = __commonJS({
|
|
|
25648
25808
|
}
|
|
25649
25809
|
});
|
|
25650
25810
|
|
|
25651
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
25811
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/index.js
|
|
25652
25812
|
var require_js = __commonJS({
|
|
25653
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
25813
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/index.js"(exports, module2) {
|
|
25654
25814
|
"use strict";
|
|
25655
25815
|
function get_beautify(js_beautify2, css_beautify, html_beautify) {
|
|
25656
25816
|
var beautify = function(src, config) {
|
|
@@ -26422,18 +26582,18 @@ function pathPlugin(fork2) {
|
|
|
26422
26582
|
this.__childCache = null;
|
|
26423
26583
|
};
|
|
26424
26584
|
var Pp2 = Path2.prototype;
|
|
26425
|
-
function getChildCache(
|
|
26426
|
-
return
|
|
26585
|
+
function getChildCache(path3) {
|
|
26586
|
+
return path3.__childCache || (path3.__childCache = /* @__PURE__ */ Object.create(null));
|
|
26427
26587
|
}
|
|
26428
|
-
function getChildPath(
|
|
26429
|
-
var cache = getChildCache(
|
|
26430
|
-
var actualChildValue =
|
|
26588
|
+
function getChildPath(path3, name) {
|
|
26589
|
+
var cache = getChildCache(path3);
|
|
26590
|
+
var actualChildValue = path3.getValueProperty(name);
|
|
26431
26591
|
var childPath = cache[name];
|
|
26432
26592
|
if (!hasOwn$5.call(cache, name) || // Ensure consistency between cache and reality.
|
|
26433
26593
|
childPath.value !== actualChildValue) {
|
|
26434
|
-
childPath = cache[name] = new
|
|
26594
|
+
childPath = cache[name] = new path3.constructor(
|
|
26435
26595
|
actualChildValue,
|
|
26436
|
-
|
|
26596
|
+
path3,
|
|
26437
26597
|
name
|
|
26438
26598
|
);
|
|
26439
26599
|
}
|
|
@@ -26443,12 +26603,12 @@ function pathPlugin(fork2) {
|
|
|
26443
26603
|
return this.value[name];
|
|
26444
26604
|
};
|
|
26445
26605
|
Pp2.get = function get(...names) {
|
|
26446
|
-
var
|
|
26606
|
+
var path3 = this;
|
|
26447
26607
|
var count = names.length;
|
|
26448
26608
|
for (var i = 0; i < count; ++i) {
|
|
26449
|
-
|
|
26609
|
+
path3 = getChildPath(path3, names[i]);
|
|
26450
26610
|
}
|
|
26451
|
-
return
|
|
26611
|
+
return path3;
|
|
26452
26612
|
};
|
|
26453
26613
|
Pp2.each = function each2(callback, context) {
|
|
26454
26614
|
var childPaths = [];
|
|
@@ -26484,12 +26644,12 @@ function pathPlugin(fork2) {
|
|
|
26484
26644
|
};
|
|
26485
26645
|
function emptyMoves() {
|
|
26486
26646
|
}
|
|
26487
|
-
function getMoves(
|
|
26488
|
-
isArray2.assert(
|
|
26647
|
+
function getMoves(path3, offset, start, end) {
|
|
26648
|
+
isArray2.assert(path3.value);
|
|
26489
26649
|
if (offset === 0) {
|
|
26490
26650
|
return emptyMoves;
|
|
26491
26651
|
}
|
|
26492
|
-
var length =
|
|
26652
|
+
var length = path3.value.length;
|
|
26493
26653
|
if (length < 1) {
|
|
26494
26654
|
return emptyMoves;
|
|
26495
26655
|
}
|
|
@@ -26507,10 +26667,10 @@ function pathPlugin(fork2) {
|
|
|
26507
26667
|
isNumber2.assert(start);
|
|
26508
26668
|
isNumber2.assert(end);
|
|
26509
26669
|
var moves = /* @__PURE__ */ Object.create(null);
|
|
26510
|
-
var cache = getChildCache(
|
|
26670
|
+
var cache = getChildCache(path3);
|
|
26511
26671
|
for (var i = start; i < end; ++i) {
|
|
26512
|
-
if (hasOwn$5.call(
|
|
26513
|
-
var childPath =
|
|
26672
|
+
if (hasOwn$5.call(path3.value, i)) {
|
|
26673
|
+
var childPath = path3.get(i);
|
|
26514
26674
|
if (childPath.name !== i) {
|
|
26515
26675
|
throw new Error("");
|
|
26516
26676
|
}
|
|
@@ -26528,7 +26688,7 @@ function pathPlugin(fork2) {
|
|
|
26528
26688
|
throw new Error("");
|
|
26529
26689
|
}
|
|
26530
26690
|
cache[newIndex2] = childPath2;
|
|
26531
|
-
|
|
26691
|
+
path3.value[newIndex2] = childPath2.value;
|
|
26532
26692
|
}
|
|
26533
26693
|
};
|
|
26534
26694
|
}
|
|
@@ -26587,34 +26747,34 @@ function pathPlugin(fork2) {
|
|
|
26587
26747
|
}
|
|
26588
26748
|
return pp.insertAt.apply(pp, insertAtArgs);
|
|
26589
26749
|
};
|
|
26590
|
-
function repairRelationshipWithParent(
|
|
26591
|
-
if (!(
|
|
26750
|
+
function repairRelationshipWithParent(path3) {
|
|
26751
|
+
if (!(path3 instanceof Path2)) {
|
|
26592
26752
|
throw new Error("");
|
|
26593
26753
|
}
|
|
26594
|
-
var pp =
|
|
26754
|
+
var pp = path3.parentPath;
|
|
26595
26755
|
if (!pp) {
|
|
26596
|
-
return
|
|
26756
|
+
return path3;
|
|
26597
26757
|
}
|
|
26598
26758
|
var parentValue = pp.value;
|
|
26599
26759
|
var parentCache = getChildCache(pp);
|
|
26600
|
-
if (parentValue[
|
|
26601
|
-
parentCache[
|
|
26760
|
+
if (parentValue[path3.name] === path3.value) {
|
|
26761
|
+
parentCache[path3.name] = path3;
|
|
26602
26762
|
} else if (isArray2.check(parentValue)) {
|
|
26603
|
-
var i = parentValue.indexOf(
|
|
26763
|
+
var i = parentValue.indexOf(path3.value);
|
|
26604
26764
|
if (i >= 0) {
|
|
26605
|
-
parentCache[
|
|
26765
|
+
parentCache[path3.name = i] = path3;
|
|
26606
26766
|
}
|
|
26607
26767
|
} else {
|
|
26608
|
-
parentValue[
|
|
26609
|
-
parentCache[
|
|
26768
|
+
parentValue[path3.name] = path3.value;
|
|
26769
|
+
parentCache[path3.name] = path3;
|
|
26610
26770
|
}
|
|
26611
|
-
if (parentValue[
|
|
26771
|
+
if (parentValue[path3.name] !== path3.value) {
|
|
26612
26772
|
throw new Error("");
|
|
26613
26773
|
}
|
|
26614
|
-
if (
|
|
26774
|
+
if (path3.parentPath.get(path3.name) !== path3) {
|
|
26615
26775
|
throw new Error("");
|
|
26616
26776
|
}
|
|
26617
|
-
return
|
|
26777
|
+
return path3;
|
|
26618
26778
|
}
|
|
26619
26779
|
Pp2.replace = function replace(replacement) {
|
|
26620
26780
|
var results = [];
|
|
@@ -26683,12 +26843,12 @@ function scopePlugin(fork2) {
|
|
|
26683
26843
|
var Expression2 = namedTypes2.Expression;
|
|
26684
26844
|
var isArray2 = types.builtInTypes.array;
|
|
26685
26845
|
var b = types.builders;
|
|
26686
|
-
const Scope = function Scope2(
|
|
26846
|
+
const Scope = function Scope2(path3, parentScope) {
|
|
26687
26847
|
if (!(this instanceof Scope2)) {
|
|
26688
26848
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
26689
26849
|
}
|
|
26690
|
-
if (!TypeParameterScopeType.check(
|
|
26691
|
-
ScopeType.assert(
|
|
26850
|
+
if (!TypeParameterScopeType.check(path3.value)) {
|
|
26851
|
+
ScopeType.assert(path3.value);
|
|
26692
26852
|
}
|
|
26693
26853
|
var depth;
|
|
26694
26854
|
if (parentScope) {
|
|
@@ -26701,8 +26861,8 @@ function scopePlugin(fork2) {
|
|
|
26701
26861
|
depth = 0;
|
|
26702
26862
|
}
|
|
26703
26863
|
Object.defineProperties(this, {
|
|
26704
|
-
path: { value:
|
|
26705
|
-
node: { value:
|
|
26864
|
+
path: { value: path3 },
|
|
26865
|
+
node: { value: path3.value },
|
|
26706
26866
|
isGlobal: { value: !parentScope, enumerable: true },
|
|
26707
26867
|
depth: { value: depth },
|
|
26708
26868
|
parent: { value: parentScope },
|
|
@@ -26797,10 +26957,10 @@ function scopePlugin(fork2) {
|
|
|
26797
26957
|
this.scan();
|
|
26798
26958
|
return this.types;
|
|
26799
26959
|
};
|
|
26800
|
-
function scanScope(
|
|
26801
|
-
var node =
|
|
26960
|
+
function scanScope(path3, bindings, scopeTypes) {
|
|
26961
|
+
var node = path3.value;
|
|
26802
26962
|
if (TypeParameterScopeType.check(node)) {
|
|
26803
|
-
const params =
|
|
26963
|
+
const params = path3.get("typeParameters", "params");
|
|
26804
26964
|
if (isArray2.check(params.value)) {
|
|
26805
26965
|
params.each((childPath) => {
|
|
26806
26966
|
addTypeParameter(childPath, scopeTypes);
|
|
@@ -26809,46 +26969,46 @@ function scopePlugin(fork2) {
|
|
|
26809
26969
|
}
|
|
26810
26970
|
if (ScopeType.check(node)) {
|
|
26811
26971
|
if (namedTypes2.CatchClause.check(node)) {
|
|
26812
|
-
addPattern(
|
|
26972
|
+
addPattern(path3.get("param"), bindings);
|
|
26813
26973
|
} else {
|
|
26814
|
-
recursiveScanScope(
|
|
26974
|
+
recursiveScanScope(path3, bindings, scopeTypes);
|
|
26815
26975
|
}
|
|
26816
26976
|
}
|
|
26817
26977
|
}
|
|
26818
|
-
function recursiveScanScope(
|
|
26819
|
-
var node =
|
|
26820
|
-
if (
|
|
26821
|
-
addPattern(
|
|
26978
|
+
function recursiveScanScope(path3, bindings, scopeTypes) {
|
|
26979
|
+
var node = path3.value;
|
|
26980
|
+
if (path3.parent && namedTypes2.FunctionExpression.check(path3.parent.node) && path3.parent.node.id) {
|
|
26981
|
+
addPattern(path3.parent.get("id"), bindings);
|
|
26822
26982
|
}
|
|
26823
26983
|
if (!node)
|
|
26824
26984
|
;
|
|
26825
26985
|
else if (isArray2.check(node)) {
|
|
26826
|
-
|
|
26986
|
+
path3.each((childPath) => {
|
|
26827
26987
|
recursiveScanChild(childPath, bindings, scopeTypes);
|
|
26828
26988
|
});
|
|
26829
26989
|
} else if (namedTypes2.Function.check(node)) {
|
|
26830
|
-
|
|
26990
|
+
path3.get("params").each((paramPath) => {
|
|
26831
26991
|
addPattern(paramPath, bindings);
|
|
26832
26992
|
});
|
|
26833
|
-
recursiveScanChild(
|
|
26834
|
-
recursiveScanScope(
|
|
26993
|
+
recursiveScanChild(path3.get("body"), bindings, scopeTypes);
|
|
26994
|
+
recursiveScanScope(path3.get("typeParameters"), bindings, scopeTypes);
|
|
26835
26995
|
} else if (namedTypes2.TypeAlias && namedTypes2.TypeAlias.check(node) || namedTypes2.InterfaceDeclaration && namedTypes2.InterfaceDeclaration.check(node) || namedTypes2.TSTypeAliasDeclaration && namedTypes2.TSTypeAliasDeclaration.check(node) || namedTypes2.TSInterfaceDeclaration && namedTypes2.TSInterfaceDeclaration.check(node)) {
|
|
26836
|
-
addTypePattern(
|
|
26996
|
+
addTypePattern(path3.get("id"), scopeTypes);
|
|
26837
26997
|
} else if (namedTypes2.VariableDeclarator.check(node)) {
|
|
26838
|
-
addPattern(
|
|
26839
|
-
recursiveScanChild(
|
|
26998
|
+
addPattern(path3.get("id"), bindings);
|
|
26999
|
+
recursiveScanChild(path3.get("init"), bindings, scopeTypes);
|
|
26840
27000
|
} else if (node.type === "ImportSpecifier" || node.type === "ImportNamespaceSpecifier" || node.type === "ImportDefaultSpecifier") {
|
|
26841
27001
|
addPattern(
|
|
26842
27002
|
// Esprima used to use the .name field to refer to the local
|
|
26843
27003
|
// binding identifier for ImportSpecifier nodes, but .id for
|
|
26844
27004
|
// ImportNamespaceSpecifier and ImportDefaultSpecifier nodes.
|
|
26845
27005
|
// ESTree/Acorn/ESpree use .local for all three node types.
|
|
26846
|
-
|
|
27006
|
+
path3.get(node.local ? "local" : node.name ? "name" : "id"),
|
|
26847
27007
|
bindings
|
|
26848
27008
|
);
|
|
26849
27009
|
} else if (Node.check(node) && !Expression2.check(node)) {
|
|
26850
27010
|
types.eachField(node, function(name, child) {
|
|
26851
|
-
var childPath =
|
|
27011
|
+
var childPath = path3.get(name);
|
|
26852
27012
|
if (!pathHasValue(childPath, child)) {
|
|
26853
27013
|
throw new Error("");
|
|
26854
27014
|
}
|
|
@@ -26856,38 +27016,38 @@ function scopePlugin(fork2) {
|
|
|
26856
27016
|
});
|
|
26857
27017
|
}
|
|
26858
27018
|
}
|
|
26859
|
-
function pathHasValue(
|
|
26860
|
-
if (
|
|
27019
|
+
function pathHasValue(path3, value) {
|
|
27020
|
+
if (path3.value === value) {
|
|
26861
27021
|
return true;
|
|
26862
27022
|
}
|
|
26863
|
-
if (Array.isArray(
|
|
27023
|
+
if (Array.isArray(path3.value) && path3.value.length === 0 && Array.isArray(value) && value.length === 0) {
|
|
26864
27024
|
return true;
|
|
26865
27025
|
}
|
|
26866
27026
|
return false;
|
|
26867
27027
|
}
|
|
26868
|
-
function recursiveScanChild(
|
|
26869
|
-
var node =
|
|
27028
|
+
function recursiveScanChild(path3, bindings, scopeTypes) {
|
|
27029
|
+
var node = path3.value;
|
|
26870
27030
|
if (!node || Expression2.check(node))
|
|
26871
27031
|
;
|
|
26872
27032
|
else if (namedTypes2.FunctionDeclaration.check(node) && node.id !== null) {
|
|
26873
|
-
addPattern(
|
|
27033
|
+
addPattern(path3.get("id"), bindings);
|
|
26874
27034
|
} else if (namedTypes2.ClassDeclaration && namedTypes2.ClassDeclaration.check(node) && node.id !== null) {
|
|
26875
|
-
addPattern(
|
|
26876
|
-
recursiveScanScope(
|
|
27035
|
+
addPattern(path3.get("id"), bindings);
|
|
27036
|
+
recursiveScanScope(path3.get("typeParameters"), bindings, scopeTypes);
|
|
26877
27037
|
} else if (namedTypes2.InterfaceDeclaration && namedTypes2.InterfaceDeclaration.check(node) || namedTypes2.TSInterfaceDeclaration && namedTypes2.TSInterfaceDeclaration.check(node)) {
|
|
26878
|
-
addTypePattern(
|
|
27038
|
+
addTypePattern(path3.get("id"), scopeTypes);
|
|
26879
27039
|
} else if (ScopeType.check(node)) {
|
|
26880
27040
|
if (namedTypes2.CatchClause.check(node) && // TODO Broaden this to accept any pattern.
|
|
26881
27041
|
namedTypes2.Identifier.check(node.param)) {
|
|
26882
27042
|
var catchParamName = node.param.name;
|
|
26883
27043
|
var hadBinding = hasOwn$4.call(bindings, catchParamName);
|
|
26884
|
-
recursiveScanScope(
|
|
27044
|
+
recursiveScanScope(path3.get("body"), bindings, scopeTypes);
|
|
26885
27045
|
if (!hadBinding) {
|
|
26886
27046
|
delete bindings[catchParamName];
|
|
26887
27047
|
}
|
|
26888
27048
|
}
|
|
26889
27049
|
} else {
|
|
26890
|
-
recursiveScanScope(
|
|
27050
|
+
recursiveScanScope(path3, bindings, scopeTypes);
|
|
26891
27051
|
}
|
|
26892
27052
|
}
|
|
26893
27053
|
function addPattern(patternPath, bindings) {
|
|
@@ -27219,53 +27379,53 @@ function nodePathPlugin(fork2) {
|
|
|
27219
27379
|
NPp.firstInStatement = function() {
|
|
27220
27380
|
return firstInStatement(this);
|
|
27221
27381
|
};
|
|
27222
|
-
function firstInStatement(
|
|
27223
|
-
for (var node, parent;
|
|
27224
|
-
node =
|
|
27225
|
-
parent =
|
|
27226
|
-
if (n2.BlockStatement.check(parent) &&
|
|
27382
|
+
function firstInStatement(path3) {
|
|
27383
|
+
for (var node, parent; path3.parent; path3 = path3.parent) {
|
|
27384
|
+
node = path3.node;
|
|
27385
|
+
parent = path3.parent.node;
|
|
27386
|
+
if (n2.BlockStatement.check(parent) && path3.parent.name === "body" && path3.name === 0) {
|
|
27227
27387
|
if (parent.body[0] !== node) {
|
|
27228
27388
|
throw new Error("Nodes must be equal");
|
|
27229
27389
|
}
|
|
27230
27390
|
return true;
|
|
27231
27391
|
}
|
|
27232
|
-
if (n2.ExpressionStatement.check(parent) &&
|
|
27392
|
+
if (n2.ExpressionStatement.check(parent) && path3.name === "expression") {
|
|
27233
27393
|
if (parent.expression !== node) {
|
|
27234
27394
|
throw new Error("Nodes must be equal");
|
|
27235
27395
|
}
|
|
27236
27396
|
return true;
|
|
27237
27397
|
}
|
|
27238
|
-
if (n2.SequenceExpression.check(parent) &&
|
|
27398
|
+
if (n2.SequenceExpression.check(parent) && path3.parent.name === "expressions" && path3.name === 0) {
|
|
27239
27399
|
if (parent.expressions[0] !== node) {
|
|
27240
27400
|
throw new Error("Nodes must be equal");
|
|
27241
27401
|
}
|
|
27242
27402
|
continue;
|
|
27243
27403
|
}
|
|
27244
|
-
if (n2.CallExpression.check(parent) &&
|
|
27404
|
+
if (n2.CallExpression.check(parent) && path3.name === "callee") {
|
|
27245
27405
|
if (parent.callee !== node) {
|
|
27246
27406
|
throw new Error("Nodes must be equal");
|
|
27247
27407
|
}
|
|
27248
27408
|
continue;
|
|
27249
27409
|
}
|
|
27250
|
-
if (n2.MemberExpression.check(parent) &&
|
|
27410
|
+
if (n2.MemberExpression.check(parent) && path3.name === "object") {
|
|
27251
27411
|
if (parent.object !== node) {
|
|
27252
27412
|
throw new Error("Nodes must be equal");
|
|
27253
27413
|
}
|
|
27254
27414
|
continue;
|
|
27255
27415
|
}
|
|
27256
|
-
if (n2.ConditionalExpression.check(parent) &&
|
|
27416
|
+
if (n2.ConditionalExpression.check(parent) && path3.name === "test") {
|
|
27257
27417
|
if (parent.test !== node) {
|
|
27258
27418
|
throw new Error("Nodes must be equal");
|
|
27259
27419
|
}
|
|
27260
27420
|
continue;
|
|
27261
27421
|
}
|
|
27262
|
-
if (isBinary2(parent) &&
|
|
27422
|
+
if (isBinary2(parent) && path3.name === "left") {
|
|
27263
27423
|
if (parent.left !== node) {
|
|
27264
27424
|
throw new Error("Nodes must be equal");
|
|
27265
27425
|
}
|
|
27266
27426
|
continue;
|
|
27267
27427
|
}
|
|
27268
|
-
if (n2.UnaryExpression.check(parent) && !parent.prefix &&
|
|
27428
|
+
if (n2.UnaryExpression.check(parent) && !parent.prefix && path3.name === "argument") {
|
|
27269
27429
|
if (parent.argument !== node) {
|
|
27270
27430
|
throw new Error("Nodes must be equal");
|
|
27271
27431
|
}
|
|
@@ -27429,36 +27589,36 @@ function pathVisitorPlugin(fork2) {
|
|
|
27429
27589
|
};
|
|
27430
27590
|
PVp.reset = function(_path) {
|
|
27431
27591
|
};
|
|
27432
|
-
PVp.visitWithoutReset = function(
|
|
27592
|
+
PVp.visitWithoutReset = function(path3) {
|
|
27433
27593
|
if (this instanceof this.Context) {
|
|
27434
|
-
return this.visitor.visitWithoutReset(
|
|
27594
|
+
return this.visitor.visitWithoutReset(path3);
|
|
27435
27595
|
}
|
|
27436
|
-
if (!(
|
|
27596
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27437
27597
|
throw new Error("");
|
|
27438
27598
|
}
|
|
27439
|
-
var value =
|
|
27599
|
+
var value = path3.value;
|
|
27440
27600
|
var methodName = value && typeof value === "object" && typeof value.type === "string" && this._methodNameTable[value.type];
|
|
27441
27601
|
if (methodName) {
|
|
27442
|
-
var context = this.acquireContext(
|
|
27602
|
+
var context = this.acquireContext(path3);
|
|
27443
27603
|
try {
|
|
27444
27604
|
return context.invokeVisitorMethod(methodName);
|
|
27445
27605
|
} finally {
|
|
27446
27606
|
this.releaseContext(context);
|
|
27447
27607
|
}
|
|
27448
27608
|
} else {
|
|
27449
|
-
return visitChildren(
|
|
27609
|
+
return visitChildren(path3, this);
|
|
27450
27610
|
}
|
|
27451
27611
|
};
|
|
27452
|
-
function visitChildren(
|
|
27453
|
-
if (!(
|
|
27612
|
+
function visitChildren(path3, visitor) {
|
|
27613
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27454
27614
|
throw new Error("");
|
|
27455
27615
|
}
|
|
27456
27616
|
if (!(visitor instanceof PathVisitor2)) {
|
|
27457
27617
|
throw new Error("");
|
|
27458
27618
|
}
|
|
27459
|
-
var value =
|
|
27619
|
+
var value = path3.value;
|
|
27460
27620
|
if (isArray2.check(value)) {
|
|
27461
|
-
|
|
27621
|
+
path3.each(visitor.visitWithoutReset, visitor);
|
|
27462
27622
|
} else if (!isObject2.check(value))
|
|
27463
27623
|
;
|
|
27464
27624
|
else {
|
|
@@ -27473,19 +27633,19 @@ function pathVisitorPlugin(fork2) {
|
|
|
27473
27633
|
if (!hasOwn$3.call(value, childName)) {
|
|
27474
27634
|
value[childName] = types.getFieldValue(value, childName);
|
|
27475
27635
|
}
|
|
27476
|
-
childPaths.push(
|
|
27636
|
+
childPaths.push(path3.get(childName));
|
|
27477
27637
|
}
|
|
27478
27638
|
for (var i = 0; i < childCount; ++i) {
|
|
27479
27639
|
visitor.visitWithoutReset(childPaths[i]);
|
|
27480
27640
|
}
|
|
27481
27641
|
}
|
|
27482
|
-
return
|
|
27642
|
+
return path3.value;
|
|
27483
27643
|
}
|
|
27484
|
-
PVp.acquireContext = function(
|
|
27644
|
+
PVp.acquireContext = function(path3) {
|
|
27485
27645
|
if (this._reusableContextStack.length === 0) {
|
|
27486
|
-
return new this.Context(
|
|
27646
|
+
return new this.Context(path3);
|
|
27487
27647
|
}
|
|
27488
|
-
return this._reusableContextStack.pop().reset(
|
|
27648
|
+
return this._reusableContextStack.pop().reset(path3);
|
|
27489
27649
|
};
|
|
27490
27650
|
PVp.releaseContext = function(context) {
|
|
27491
27651
|
if (!(context instanceof this.Context)) {
|
|
@@ -27501,14 +27661,14 @@ function pathVisitorPlugin(fork2) {
|
|
|
27501
27661
|
return this._changeReported;
|
|
27502
27662
|
};
|
|
27503
27663
|
function makeContextConstructor(visitor) {
|
|
27504
|
-
function Context(
|
|
27664
|
+
function Context(path3) {
|
|
27505
27665
|
if (!(this instanceof Context)) {
|
|
27506
27666
|
throw new Error("");
|
|
27507
27667
|
}
|
|
27508
27668
|
if (!(this instanceof PathVisitor2)) {
|
|
27509
27669
|
throw new Error("");
|
|
27510
27670
|
}
|
|
27511
|
-
if (!(
|
|
27671
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27512
27672
|
throw new Error("");
|
|
27513
27673
|
}
|
|
27514
27674
|
Object.defineProperty(this, "visitor", {
|
|
@@ -27517,7 +27677,7 @@ function pathVisitorPlugin(fork2) {
|
|
|
27517
27677
|
enumerable: true,
|
|
27518
27678
|
configurable: false
|
|
27519
27679
|
});
|
|
27520
|
-
this.currentPath =
|
|
27680
|
+
this.currentPath = path3;
|
|
27521
27681
|
this.needToCallTraverse = true;
|
|
27522
27682
|
Object.seal(this);
|
|
27523
27683
|
}
|
|
@@ -27530,14 +27690,14 @@ function pathVisitorPlugin(fork2) {
|
|
|
27530
27690
|
return Context;
|
|
27531
27691
|
}
|
|
27532
27692
|
var sharedContextProtoMethods = /* @__PURE__ */ Object.create(null);
|
|
27533
|
-
sharedContextProtoMethods.reset = function reset(
|
|
27693
|
+
sharedContextProtoMethods.reset = function reset(path3) {
|
|
27534
27694
|
if (!(this instanceof this.Context)) {
|
|
27535
27695
|
throw new Error("");
|
|
27536
27696
|
}
|
|
27537
|
-
if (!(
|
|
27697
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27538
27698
|
throw new Error("");
|
|
27539
27699
|
}
|
|
27540
|
-
this.currentPath =
|
|
27700
|
+
this.currentPath = path3;
|
|
27541
27701
|
this.needToCallTraverse = true;
|
|
27542
27702
|
return this;
|
|
27543
27703
|
};
|
|
@@ -27562,29 +27722,29 @@ function pathVisitorPlugin(fork2) {
|
|
|
27562
27722
|
"Must either call this.traverse or return false in " + methodName
|
|
27563
27723
|
);
|
|
27564
27724
|
}
|
|
27565
|
-
var
|
|
27566
|
-
return
|
|
27725
|
+
var path3 = this.currentPath;
|
|
27726
|
+
return path3 && path3.value;
|
|
27567
27727
|
};
|
|
27568
|
-
sharedContextProtoMethods.traverse = function traverse(
|
|
27728
|
+
sharedContextProtoMethods.traverse = function traverse(path3, newVisitor) {
|
|
27569
27729
|
if (!(this instanceof this.Context)) {
|
|
27570
27730
|
throw new Error("");
|
|
27571
27731
|
}
|
|
27572
|
-
if (!(
|
|
27732
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27573
27733
|
throw new Error("");
|
|
27574
27734
|
}
|
|
27575
27735
|
if (!(this.currentPath instanceof NodePath2)) {
|
|
27576
27736
|
throw new Error("");
|
|
27577
27737
|
}
|
|
27578
27738
|
this.needToCallTraverse = false;
|
|
27579
|
-
return visitChildren(
|
|
27739
|
+
return visitChildren(path3, PathVisitor2.fromMethodsObject(
|
|
27580
27740
|
newVisitor || this.visitor
|
|
27581
27741
|
));
|
|
27582
27742
|
};
|
|
27583
|
-
sharedContextProtoMethods.visit = function visit2(
|
|
27743
|
+
sharedContextProtoMethods.visit = function visit2(path3, newVisitor) {
|
|
27584
27744
|
if (!(this instanceof this.Context)) {
|
|
27585
27745
|
throw new Error("");
|
|
27586
27746
|
}
|
|
27587
|
-
if (!(
|
|
27747
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27588
27748
|
throw new Error("");
|
|
27589
27749
|
}
|
|
27590
27750
|
if (!(this.currentPath instanceof NodePath2)) {
|
|
@@ -27593,7 +27753,7 @@ function pathVisitorPlugin(fork2) {
|
|
|
27593
27753
|
this.needToCallTraverse = false;
|
|
27594
27754
|
return PathVisitor2.fromMethodsObject(
|
|
27595
27755
|
newVisitor || this.visitor
|
|
27596
|
-
).visitWithoutReset(
|
|
27756
|
+
).visitWithoutReset(path3);
|
|
27597
27757
|
};
|
|
27598
27758
|
sharedContextProtoMethods.reportChanged = function reportChanged() {
|
|
27599
27759
|
this.visitor.reportChanged();
|
|
@@ -29201,9 +29361,9 @@ function isExportDeclaration(node) {
|
|
|
29201
29361
|
}
|
|
29202
29362
|
return false;
|
|
29203
29363
|
}
|
|
29204
|
-
function getParentExportDeclaration(
|
|
29205
|
-
const parentNode =
|
|
29206
|
-
if (
|
|
29364
|
+
function getParentExportDeclaration(path3) {
|
|
29365
|
+
const parentNode = path3.getParentNode();
|
|
29366
|
+
if (path3.getName() === "declaration" && isExportDeclaration(parentNode)) {
|
|
29207
29367
|
return parentNode;
|
|
29208
29368
|
}
|
|
29209
29369
|
return null;
|
|
@@ -30212,16 +30372,16 @@ function printTrailingComment(commentPath, print2) {
|
|
|
30212
30372
|
parts.push(print2(commentPath));
|
|
30213
30373
|
return concat(parts);
|
|
30214
30374
|
}
|
|
30215
|
-
function printComments(
|
|
30216
|
-
const value =
|
|
30217
|
-
const innerLines = print2(
|
|
30375
|
+
function printComments(path3, print2) {
|
|
30376
|
+
const value = path3.getValue();
|
|
30377
|
+
const innerLines = print2(path3);
|
|
30218
30378
|
const comments = n$1.Node.check(value) && getFieldValue(value, "comments");
|
|
30219
30379
|
if (!comments || comments.length === 0) {
|
|
30220
30380
|
return innerLines;
|
|
30221
30381
|
}
|
|
30222
30382
|
const leadingParts = [];
|
|
30223
30383
|
const trailingParts = [innerLines];
|
|
30224
|
-
|
|
30384
|
+
path3.each(function(commentPath) {
|
|
30225
30385
|
const comment = commentPath.getValue();
|
|
30226
30386
|
const leading = getFieldValue(comment, "leading");
|
|
30227
30387
|
const trailing = getFieldValue(comment, "trailing");
|
|
@@ -30470,8 +30630,8 @@ FPp.valueIsDuplicate = function() {
|
|
|
30470
30630
|
const valueIndex = s.length - 1;
|
|
30471
30631
|
return s.lastIndexOf(s[valueIndex], valueIndex - 1) >= 0;
|
|
30472
30632
|
};
|
|
30473
|
-
function getNodeHelper(
|
|
30474
|
-
const s =
|
|
30633
|
+
function getNodeHelper(path3, count) {
|
|
30634
|
+
const s = path3.stack;
|
|
30475
30635
|
for (let i = s.length - 1; i >= 0; i -= 2) {
|
|
30476
30636
|
const value = s[i];
|
|
30477
30637
|
if (n.Node.check(value) && --count < 0) {
|
|
@@ -30915,15 +31075,15 @@ Pp.deleteComments = function(node) {
|
|
|
30915
31075
|
}
|
|
30916
31076
|
});
|
|
30917
31077
|
};
|
|
30918
|
-
function getReprinter(
|
|
30919
|
-
const node =
|
|
31078
|
+
function getReprinter(path3) {
|
|
31079
|
+
const node = path3.getValue();
|
|
30920
31080
|
if (!Printable.check(node))
|
|
30921
31081
|
return;
|
|
30922
31082
|
const orig = node.original;
|
|
30923
31083
|
const origLoc = orig && orig.loc;
|
|
30924
31084
|
const lines = origLoc && origLoc.lines;
|
|
30925
31085
|
const reprints = [];
|
|
30926
|
-
if (!lines || !findReprints(
|
|
31086
|
+
if (!lines || !findReprints(path3, reprints))
|
|
30927
31087
|
return;
|
|
30928
31088
|
return function(print2) {
|
|
30929
31089
|
const patcher = new Patcher(lines);
|
|
@@ -30960,7 +31120,7 @@ function getReprinter(path2) {
|
|
|
30960
31120
|
patcher.replace(oldNode.loc, newLines);
|
|
30961
31121
|
});
|
|
30962
31122
|
const patchedLines = patcher.get(origLoc).indentTail(-orig.loc.indent);
|
|
30963
|
-
if (
|
|
31123
|
+
if (path3.needsParens()) {
|
|
30964
31124
|
return concat(["(", patchedLines, ")"]);
|
|
30965
31125
|
}
|
|
30966
31126
|
return patchedLines;
|
|
@@ -31142,13 +31302,13 @@ var Printer = function Printer2(config) {
|
|
|
31142
31302
|
config.sourceFileName = null;
|
|
31143
31303
|
function makePrintFunctionWith(options, overrides) {
|
|
31144
31304
|
options = Object.assign({}, options, overrides);
|
|
31145
|
-
return (
|
|
31305
|
+
return (path3) => print2(path3, options);
|
|
31146
31306
|
}
|
|
31147
|
-
function print2(
|
|
31307
|
+
function print2(path3, options) {
|
|
31148
31308
|
options = options || {};
|
|
31149
31309
|
if (options.includeComments) {
|
|
31150
31310
|
return printComments(
|
|
31151
|
-
|
|
31311
|
+
path3,
|
|
31152
31312
|
makePrintFunctionWith(options, {
|
|
31153
31313
|
includeComments: false
|
|
31154
31314
|
})
|
|
@@ -31156,12 +31316,12 @@ var Printer = function Printer2(config) {
|
|
|
31156
31316
|
}
|
|
31157
31317
|
const oldTabWidth = config.tabWidth;
|
|
31158
31318
|
if (!explicitTabWidth) {
|
|
31159
|
-
const loc =
|
|
31319
|
+
const loc = path3.getNode().loc;
|
|
31160
31320
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
31161
31321
|
config.tabWidth = loc.lines.guessTabWidth();
|
|
31162
31322
|
}
|
|
31163
31323
|
}
|
|
31164
|
-
const reprinter = getReprinter(
|
|
31324
|
+
const reprinter = getReprinter(path3);
|
|
31165
31325
|
const lines = reprinter ? (
|
|
31166
31326
|
// Since the print function that we pass to the reprinter will
|
|
31167
31327
|
// be used to print "new" nodes, it's tempting to think we
|
|
@@ -31173,7 +31333,7 @@ var Printer = function Printer2(config) {
|
|
|
31173
31333
|
// such nodes using their original source.
|
|
31174
31334
|
reprinter(print2)
|
|
31175
31335
|
) : genericPrint(
|
|
31176
|
-
|
|
31336
|
+
path3,
|
|
31177
31337
|
config,
|
|
31178
31338
|
options,
|
|
31179
31339
|
makePrintFunctionWith(options, {
|
|
@@ -31207,8 +31367,8 @@ var Printer = function Printer2(config) {
|
|
|
31207
31367
|
function printGenerically(path22) {
|
|
31208
31368
|
return printComments(
|
|
31209
31369
|
path22,
|
|
31210
|
-
(
|
|
31211
|
-
|
|
31370
|
+
(path32) => genericPrint(
|
|
31371
|
+
path32,
|
|
31212
31372
|
config,
|
|
31213
31373
|
{
|
|
31214
31374
|
includeComments: true,
|
|
@@ -31218,26 +31378,26 @@ var Printer = function Printer2(config) {
|
|
|
31218
31378
|
)
|
|
31219
31379
|
);
|
|
31220
31380
|
}
|
|
31221
|
-
const
|
|
31381
|
+
const path3 = FastPath.from(ast);
|
|
31222
31382
|
const oldReuseWhitespace = config.reuseWhitespace;
|
|
31223
31383
|
config.reuseWhitespace = false;
|
|
31224
|
-
const pr = new PrintResult(printGenerically(
|
|
31384
|
+
const pr = new PrintResult(printGenerically(path3).toString(config));
|
|
31225
31385
|
config.reuseWhitespace = oldReuseWhitespace;
|
|
31226
31386
|
return pr;
|
|
31227
31387
|
};
|
|
31228
31388
|
};
|
|
31229
|
-
function genericPrint(
|
|
31230
|
-
const node =
|
|
31389
|
+
function genericPrint(path3, config, options, printPath) {
|
|
31390
|
+
const node = path3.getValue();
|
|
31231
31391
|
const parts = [];
|
|
31232
|
-
const linesWithoutParens = genericPrintNoParens(
|
|
31392
|
+
const linesWithoutParens = genericPrintNoParens(path3, config, printPath);
|
|
31233
31393
|
if (!node || linesWithoutParens.isEmpty()) {
|
|
31234
31394
|
return linesWithoutParens;
|
|
31235
31395
|
}
|
|
31236
31396
|
let shouldAddParens = false;
|
|
31237
|
-
const decoratorsLines = printDecorators(
|
|
31397
|
+
const decoratorsLines = printDecorators(path3, printPath);
|
|
31238
31398
|
if (decoratorsLines.isEmpty()) {
|
|
31239
31399
|
if (!options.avoidRootParens) {
|
|
31240
|
-
shouldAddParens =
|
|
31400
|
+
shouldAddParens = path3.needsParens();
|
|
31241
31401
|
}
|
|
31242
31402
|
} else {
|
|
31243
31403
|
parts.push(decoratorsLines);
|
|
@@ -31251,8 +31411,8 @@ function genericPrint(path2, config, options, printPath) {
|
|
|
31251
31411
|
}
|
|
31252
31412
|
return concat(parts);
|
|
31253
31413
|
}
|
|
31254
|
-
function genericPrintNoParens(
|
|
31255
|
-
const n2 =
|
|
31414
|
+
function genericPrintNoParens(path3, options, print2) {
|
|
31415
|
+
const n2 = path3.getValue();
|
|
31256
31416
|
if (!n2) {
|
|
31257
31417
|
return fromString("");
|
|
31258
31418
|
}
|
|
@@ -31263,18 +31423,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31263
31423
|
const parts = [];
|
|
31264
31424
|
switch (n2.type) {
|
|
31265
31425
|
case "File":
|
|
31266
|
-
return
|
|
31426
|
+
return path3.call(print2, "program");
|
|
31267
31427
|
case "Program":
|
|
31268
31428
|
if (n2.directives) {
|
|
31269
|
-
|
|
31429
|
+
path3.each(function(childPath) {
|
|
31270
31430
|
parts.push(print2(childPath), ";\n");
|
|
31271
31431
|
}, "directives");
|
|
31272
31432
|
}
|
|
31273
31433
|
if (n2.interpreter) {
|
|
31274
|
-
parts.push(
|
|
31434
|
+
parts.push(path3.call(print2, "interpreter"));
|
|
31275
31435
|
}
|
|
31276
31436
|
parts.push(
|
|
31277
|
-
|
|
31437
|
+
path3.call(
|
|
31278
31438
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
31279
31439
|
"body"
|
|
31280
31440
|
)
|
|
@@ -31284,27 +31444,27 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31284
31444
|
case "EmptyStatement":
|
|
31285
31445
|
return fromString("");
|
|
31286
31446
|
case "ExpressionStatement":
|
|
31287
|
-
return concat([
|
|
31447
|
+
return concat([path3.call(print2, "expression"), ";"]);
|
|
31288
31448
|
case "ParenthesizedExpression":
|
|
31289
|
-
return concat(["(",
|
|
31449
|
+
return concat(["(", path3.call(print2, "expression"), ")"]);
|
|
31290
31450
|
case "BinaryExpression":
|
|
31291
31451
|
case "LogicalExpression":
|
|
31292
31452
|
case "AssignmentExpression":
|
|
31293
31453
|
return fromString(" ").join([
|
|
31294
|
-
|
|
31454
|
+
path3.call(print2, "left"),
|
|
31295
31455
|
n2.operator,
|
|
31296
|
-
|
|
31456
|
+
path3.call(print2, "right")
|
|
31297
31457
|
]);
|
|
31298
31458
|
case "AssignmentPattern":
|
|
31299
31459
|
return concat([
|
|
31300
|
-
|
|
31460
|
+
path3.call(print2, "left"),
|
|
31301
31461
|
" = ",
|
|
31302
|
-
|
|
31462
|
+
path3.call(print2, "right")
|
|
31303
31463
|
]);
|
|
31304
31464
|
case "MemberExpression":
|
|
31305
31465
|
case "OptionalMemberExpression": {
|
|
31306
|
-
parts.push(
|
|
31307
|
-
const property =
|
|
31466
|
+
parts.push(path3.call(print2, "object"));
|
|
31467
|
+
const property = path3.call(print2, "property");
|
|
31308
31468
|
const optional = getFieldValue(n2, "optional");
|
|
31309
31469
|
if (n2.computed) {
|
|
31310
31470
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
@@ -31314,18 +31474,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31314
31474
|
return concat(parts);
|
|
31315
31475
|
}
|
|
31316
31476
|
case "ChainExpression":
|
|
31317
|
-
return
|
|
31477
|
+
return path3.call(print2, "expression");
|
|
31318
31478
|
case "MetaProperty":
|
|
31319
31479
|
return concat([
|
|
31320
|
-
|
|
31480
|
+
path3.call(print2, "meta"),
|
|
31321
31481
|
".",
|
|
31322
|
-
|
|
31482
|
+
path3.call(print2, "property")
|
|
31323
31483
|
]);
|
|
31324
31484
|
case "BindExpression":
|
|
31325
31485
|
if (n2.object) {
|
|
31326
|
-
parts.push(
|
|
31486
|
+
parts.push(path3.call(print2, "object"));
|
|
31327
31487
|
}
|
|
31328
|
-
parts.push("::",
|
|
31488
|
+
parts.push("::", path3.call(print2, "callee"));
|
|
31329
31489
|
return concat(parts);
|
|
31330
31490
|
case "Path":
|
|
31331
31491
|
return fromString(".").join(n2.body);
|
|
@@ -31333,7 +31493,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31333
31493
|
return concat([
|
|
31334
31494
|
fromString(n2.name, options),
|
|
31335
31495
|
n2.optional ? "?" : "",
|
|
31336
|
-
|
|
31496
|
+
path3.call(print2, "typeAnnotation")
|
|
31337
31497
|
]);
|
|
31338
31498
|
case "SpreadElement":
|
|
31339
31499
|
case "SpreadElementPattern":
|
|
@@ -31344,8 +31504,8 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31344
31504
|
case "RestElement":
|
|
31345
31505
|
return concat([
|
|
31346
31506
|
"...",
|
|
31347
|
-
|
|
31348
|
-
|
|
31507
|
+
path3.call(print2, "argument"),
|
|
31508
|
+
path3.call(print2, "typeAnnotation")
|
|
31349
31509
|
]);
|
|
31350
31510
|
case "FunctionDeclaration":
|
|
31351
31511
|
case "FunctionExpression":
|
|
@@ -31362,22 +31522,22 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31362
31522
|
if (n2.id) {
|
|
31363
31523
|
parts.push(
|
|
31364
31524
|
" ",
|
|
31365
|
-
|
|
31366
|
-
|
|
31525
|
+
path3.call(print2, "id"),
|
|
31526
|
+
path3.call(print2, "typeParameters")
|
|
31367
31527
|
);
|
|
31368
31528
|
} else {
|
|
31369
31529
|
if (n2.typeParameters) {
|
|
31370
|
-
parts.push(
|
|
31530
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31371
31531
|
}
|
|
31372
31532
|
}
|
|
31373
31533
|
parts.push(
|
|
31374
31534
|
"(",
|
|
31375
|
-
printFunctionParams(
|
|
31535
|
+
printFunctionParams(path3, options, print2),
|
|
31376
31536
|
")",
|
|
31377
|
-
|
|
31537
|
+
path3.call(print2, "returnType")
|
|
31378
31538
|
);
|
|
31379
31539
|
if (n2.body) {
|
|
31380
|
-
parts.push(" ",
|
|
31540
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
31381
31541
|
}
|
|
31382
31542
|
return concat(parts);
|
|
31383
31543
|
case "ArrowFunctionExpression":
|
|
@@ -31385,48 +31545,48 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31385
31545
|
parts.push("async ");
|
|
31386
31546
|
}
|
|
31387
31547
|
if (n2.typeParameters) {
|
|
31388
|
-
parts.push(
|
|
31548
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31389
31549
|
}
|
|
31390
31550
|
if (!options.arrowParensAlways && n2.params.length === 1 && !n2.rest && n2.params[0].type === "Identifier" && !n2.params[0].typeAnnotation && !n2.returnType) {
|
|
31391
|
-
parts.push(
|
|
31551
|
+
parts.push(path3.call(print2, "params", 0));
|
|
31392
31552
|
} else {
|
|
31393
31553
|
parts.push(
|
|
31394
31554
|
"(",
|
|
31395
|
-
printFunctionParams(
|
|
31555
|
+
printFunctionParams(path3, options, print2),
|
|
31396
31556
|
")",
|
|
31397
|
-
|
|
31557
|
+
path3.call(print2, "returnType")
|
|
31398
31558
|
);
|
|
31399
31559
|
}
|
|
31400
|
-
parts.push(" => ",
|
|
31560
|
+
parts.push(" => ", path3.call(print2, "body"));
|
|
31401
31561
|
return concat(parts);
|
|
31402
31562
|
case "MethodDefinition":
|
|
31403
|
-
return printMethod(
|
|
31563
|
+
return printMethod(path3, options, print2);
|
|
31404
31564
|
case "YieldExpression":
|
|
31405
31565
|
parts.push("yield");
|
|
31406
31566
|
if (n2.delegate)
|
|
31407
31567
|
parts.push("*");
|
|
31408
31568
|
if (n2.argument)
|
|
31409
|
-
parts.push(" ",
|
|
31569
|
+
parts.push(" ", path3.call(print2, "argument"));
|
|
31410
31570
|
return concat(parts);
|
|
31411
31571
|
case "AwaitExpression":
|
|
31412
31572
|
parts.push("await");
|
|
31413
31573
|
if (n2.all)
|
|
31414
31574
|
parts.push("*");
|
|
31415
31575
|
if (n2.argument)
|
|
31416
|
-
parts.push(" ",
|
|
31576
|
+
parts.push(" ", path3.call(print2, "argument"));
|
|
31417
31577
|
return concat(parts);
|
|
31418
31578
|
case "ModuleExpression":
|
|
31419
31579
|
return concat([
|
|
31420
31580
|
"module {\n",
|
|
31421
|
-
|
|
31581
|
+
path3.call(print2, "body").indent(options.tabWidth),
|
|
31422
31582
|
"\n}"
|
|
31423
31583
|
]);
|
|
31424
31584
|
case "ModuleDeclaration":
|
|
31425
|
-
parts.push("module",
|
|
31585
|
+
parts.push("module", path3.call(print2, "id"));
|
|
31426
31586
|
if (n2.source) {
|
|
31427
|
-
parts.push("from",
|
|
31587
|
+
parts.push("from", path3.call(print2, "source"));
|
|
31428
31588
|
} else {
|
|
31429
|
-
parts.push(
|
|
31589
|
+
parts.push(path3.call(print2, "body"));
|
|
31430
31590
|
}
|
|
31431
31591
|
return fromString(" ").join(parts);
|
|
31432
31592
|
case "ImportSpecifier":
|
|
@@ -31434,14 +31594,14 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31434
31594
|
parts.push(n2.importKind + " ");
|
|
31435
31595
|
}
|
|
31436
31596
|
if (n2.imported) {
|
|
31437
|
-
parts.push(
|
|
31597
|
+
parts.push(path3.call(print2, "imported"));
|
|
31438
31598
|
if (n2.local && n2.local.name !== n2.imported.name) {
|
|
31439
|
-
parts.push(" as ",
|
|
31599
|
+
parts.push(" as ", path3.call(print2, "local"));
|
|
31440
31600
|
}
|
|
31441
31601
|
} else if (n2.id) {
|
|
31442
|
-
parts.push(
|
|
31602
|
+
parts.push(path3.call(print2, "id"));
|
|
31443
31603
|
if (n2.name) {
|
|
31444
|
-
parts.push(" as ",
|
|
31604
|
+
parts.push(" as ", path3.call(print2, "name"));
|
|
31445
31605
|
}
|
|
31446
31606
|
}
|
|
31447
31607
|
return concat(parts);
|
|
@@ -31450,14 +31610,14 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31450
31610
|
parts.push(n2.exportKind + " ");
|
|
31451
31611
|
}
|
|
31452
31612
|
if (n2.local) {
|
|
31453
|
-
parts.push(
|
|
31613
|
+
parts.push(path3.call(print2, "local"));
|
|
31454
31614
|
if (n2.exported && n2.exported.name !== n2.local.name) {
|
|
31455
|
-
parts.push(" as ",
|
|
31615
|
+
parts.push(" as ", path3.call(print2, "exported"));
|
|
31456
31616
|
}
|
|
31457
31617
|
} else if (n2.id) {
|
|
31458
|
-
parts.push(
|
|
31618
|
+
parts.push(path3.call(print2, "id"));
|
|
31459
31619
|
if (n2.name) {
|
|
31460
|
-
parts.push(" as ",
|
|
31620
|
+
parts.push(" as ", path3.call(print2, "name"));
|
|
31461
31621
|
}
|
|
31462
31622
|
}
|
|
31463
31623
|
return concat(parts);
|
|
@@ -31466,40 +31626,40 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31466
31626
|
case "ImportNamespaceSpecifier":
|
|
31467
31627
|
parts.push("* as ");
|
|
31468
31628
|
if (n2.local) {
|
|
31469
|
-
parts.push(
|
|
31629
|
+
parts.push(path3.call(print2, "local"));
|
|
31470
31630
|
} else if (n2.id) {
|
|
31471
|
-
parts.push(
|
|
31631
|
+
parts.push(path3.call(print2, "id"));
|
|
31472
31632
|
}
|
|
31473
31633
|
return concat(parts);
|
|
31474
31634
|
case "ImportDefaultSpecifier":
|
|
31475
31635
|
if (n2.local) {
|
|
31476
|
-
return
|
|
31636
|
+
return path3.call(print2, "local");
|
|
31477
31637
|
}
|
|
31478
|
-
return
|
|
31638
|
+
return path3.call(print2, "id");
|
|
31479
31639
|
case "TSExportAssignment":
|
|
31480
|
-
return concat(["export = ",
|
|
31640
|
+
return concat(["export = ", path3.call(print2, "expression")]);
|
|
31481
31641
|
case "ExportDeclaration":
|
|
31482
31642
|
case "ExportDefaultDeclaration":
|
|
31483
31643
|
case "ExportNamedDeclaration":
|
|
31484
|
-
return printExportDeclaration(
|
|
31644
|
+
return printExportDeclaration(path3, options, print2);
|
|
31485
31645
|
case "ExportAllDeclaration":
|
|
31486
31646
|
parts.push("export *");
|
|
31487
31647
|
if (n2.exported) {
|
|
31488
|
-
parts.push(" as ",
|
|
31648
|
+
parts.push(" as ", path3.call(print2, "exported"));
|
|
31489
31649
|
}
|
|
31490
|
-
parts.push(" from ",
|
|
31650
|
+
parts.push(" from ", path3.call(print2, "source"), ";");
|
|
31491
31651
|
return concat(parts);
|
|
31492
31652
|
case "TSNamespaceExportDeclaration":
|
|
31493
|
-
parts.push("export as namespace ",
|
|
31653
|
+
parts.push("export as namespace ", path3.call(print2, "id"));
|
|
31494
31654
|
return maybeAddSemicolon(concat(parts));
|
|
31495
31655
|
case "ExportNamespaceSpecifier":
|
|
31496
|
-
return concat(["* as ",
|
|
31656
|
+
return concat(["* as ", path3.call(print2, "exported")]);
|
|
31497
31657
|
case "ExportDefaultSpecifier":
|
|
31498
|
-
return
|
|
31658
|
+
return path3.call(print2, "exported");
|
|
31499
31659
|
case "Import":
|
|
31500
31660
|
return fromString("import", options);
|
|
31501
31661
|
case "ImportExpression":
|
|
31502
|
-
return concat(["import(",
|
|
31662
|
+
return concat(["import(", path3.call(print2, "source"), ")"]);
|
|
31503
31663
|
case "ImportDeclaration": {
|
|
31504
31664
|
parts.push("import ");
|
|
31505
31665
|
if (n2.importKind && n2.importKind !== "value") {
|
|
@@ -31508,7 +31668,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31508
31668
|
if (n2.specifiers && n2.specifiers.length > 0) {
|
|
31509
31669
|
const unbracedSpecifiers = [];
|
|
31510
31670
|
const bracedSpecifiers = [];
|
|
31511
|
-
|
|
31671
|
+
path3.each(function(specifierPath) {
|
|
31512
31672
|
const spec = specifierPath.getValue();
|
|
31513
31673
|
if (spec.type === "ImportSpecifier") {
|
|
31514
31674
|
bracedSpecifiers.push(print2(specifierPath));
|
|
@@ -31544,18 +31704,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31544
31704
|
parts.push(" from ");
|
|
31545
31705
|
}
|
|
31546
31706
|
parts.push(
|
|
31547
|
-
|
|
31548
|
-
maybePrintImportAssertions(
|
|
31707
|
+
path3.call(print2, "source"),
|
|
31708
|
+
maybePrintImportAssertions(path3, options, print2),
|
|
31549
31709
|
";"
|
|
31550
31710
|
);
|
|
31551
31711
|
return concat(parts);
|
|
31552
31712
|
}
|
|
31553
31713
|
case "ImportAttribute":
|
|
31554
|
-
return concat([
|
|
31714
|
+
return concat([path3.call(print2, "key"), ": ", path3.call(print2, "value")]);
|
|
31555
31715
|
case "StaticBlock":
|
|
31556
31716
|
parts.push("static ");
|
|
31557
31717
|
case "BlockStatement": {
|
|
31558
|
-
const naked =
|
|
31718
|
+
const naked = path3.call(
|
|
31559
31719
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
31560
31720
|
"body"
|
|
31561
31721
|
);
|
|
@@ -31567,7 +31727,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31567
31727
|
}
|
|
31568
31728
|
parts.push("{\n");
|
|
31569
31729
|
if (n2.directives) {
|
|
31570
|
-
|
|
31730
|
+
path3.each(function(childPath) {
|
|
31571
31731
|
parts.push(
|
|
31572
31732
|
maybeAddSemicolon(print2(childPath).indent(options.tabWidth)),
|
|
31573
31733
|
n2.directives.length > 1 || !naked.isEmpty() ? "\n" : ""
|
|
@@ -31581,7 +31741,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31581
31741
|
case "ReturnStatement": {
|
|
31582
31742
|
parts.push("return");
|
|
31583
31743
|
if (n2.argument) {
|
|
31584
|
-
const argLines =
|
|
31744
|
+
const argLines = path3.call(print2, "argument");
|
|
31585
31745
|
if (argLines.startsWithComment() || argLines.length > 1 && namedTypes.JSXElement && namedTypes.JSXElement.check(n2.argument)) {
|
|
31586
31746
|
parts.push(" (\n", argLines.indent(options.tabWidth), "\n)");
|
|
31587
31747
|
} else {
|
|
@@ -31593,17 +31753,17 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31593
31753
|
}
|
|
31594
31754
|
case "CallExpression":
|
|
31595
31755
|
case "OptionalCallExpression":
|
|
31596
|
-
parts.push(
|
|
31756
|
+
parts.push(path3.call(print2, "callee"));
|
|
31597
31757
|
if (n2.typeParameters) {
|
|
31598
|
-
parts.push(
|
|
31758
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31599
31759
|
}
|
|
31600
31760
|
if (n2.typeArguments) {
|
|
31601
|
-
parts.push(
|
|
31761
|
+
parts.push(path3.call(print2, "typeArguments"));
|
|
31602
31762
|
}
|
|
31603
31763
|
if (getFieldValue(n2, "optional")) {
|
|
31604
31764
|
parts.push("?.");
|
|
31605
31765
|
}
|
|
31606
|
-
parts.push(printArgumentsList(
|
|
31766
|
+
parts.push(printArgumentsList(path3, options, print2));
|
|
31607
31767
|
return concat(parts);
|
|
31608
31768
|
case "RecordExpression":
|
|
31609
31769
|
parts.push("#");
|
|
@@ -31632,7 +31792,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31632
31792
|
const leftBraceIndex = parts.length - 1;
|
|
31633
31793
|
let i = 0;
|
|
31634
31794
|
fields.forEach(function(field) {
|
|
31635
|
-
|
|
31795
|
+
path3.each(function(childPath) {
|
|
31636
31796
|
let lines = print2(childPath);
|
|
31637
31797
|
if (!oneLine) {
|
|
31638
31798
|
lines = lines.indent(options.tabWidth);
|
|
@@ -31670,32 +31830,32 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31670
31830
|
parts[parts.length - 1] = " " + rightBrace;
|
|
31671
31831
|
}
|
|
31672
31832
|
if (n2.typeAnnotation) {
|
|
31673
|
-
parts.push(
|
|
31833
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
31674
31834
|
}
|
|
31675
31835
|
return concat(parts);
|
|
31676
31836
|
}
|
|
31677
31837
|
case "PropertyPattern":
|
|
31678
31838
|
return concat([
|
|
31679
|
-
|
|
31839
|
+
path3.call(print2, "key"),
|
|
31680
31840
|
": ",
|
|
31681
|
-
|
|
31841
|
+
path3.call(print2, "pattern")
|
|
31682
31842
|
]);
|
|
31683
31843
|
case "ObjectProperty":
|
|
31684
31844
|
case "Property": {
|
|
31685
31845
|
if (n2.method || n2.kind === "get" || n2.kind === "set") {
|
|
31686
|
-
return printMethod(
|
|
31846
|
+
return printMethod(path3, options, print2);
|
|
31687
31847
|
}
|
|
31688
31848
|
if (n2.shorthand && n2.value.type === "AssignmentPattern") {
|
|
31689
|
-
return
|
|
31849
|
+
return path3.call(print2, "value");
|
|
31690
31850
|
}
|
|
31691
|
-
const key =
|
|
31851
|
+
const key = path3.call(print2, "key");
|
|
31692
31852
|
if (n2.computed) {
|
|
31693
31853
|
parts.push("[", key, "]");
|
|
31694
31854
|
} else {
|
|
31695
31855
|
parts.push(key);
|
|
31696
31856
|
}
|
|
31697
31857
|
if (!n2.shorthand || n2.key.name !== n2.value.name) {
|
|
31698
|
-
parts.push(": ",
|
|
31858
|
+
parts.push(": ", path3.call(print2, "value"));
|
|
31699
31859
|
}
|
|
31700
31860
|
return concat(parts);
|
|
31701
31861
|
}
|
|
@@ -31703,18 +31863,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31703
31863
|
case "ObjectMethod":
|
|
31704
31864
|
case "ClassPrivateMethod":
|
|
31705
31865
|
case "TSDeclareMethod":
|
|
31706
|
-
return printMethod(
|
|
31866
|
+
return printMethod(path3, options, print2);
|
|
31707
31867
|
case "PrivateName":
|
|
31708
|
-
return concat(["#",
|
|
31868
|
+
return concat(["#", path3.call(print2, "id")]);
|
|
31709
31869
|
case "Decorator":
|
|
31710
|
-
return concat(["@",
|
|
31870
|
+
return concat(["@", path3.call(print2, "expression")]);
|
|
31711
31871
|
case "TupleExpression":
|
|
31712
31872
|
parts.push("#");
|
|
31713
31873
|
case "ArrayExpression":
|
|
31714
31874
|
case "ArrayPattern": {
|
|
31715
31875
|
const elems = n2.elements;
|
|
31716
31876
|
const len = elems.length;
|
|
31717
|
-
const printed =
|
|
31877
|
+
const printed = path3.map(print2, "elements");
|
|
31718
31878
|
const joined = fromString(", ").join(printed);
|
|
31719
31879
|
const oneLine = joined.getLineLength(1) <= options.wrapColumn;
|
|
31720
31880
|
if (oneLine) {
|
|
@@ -31726,7 +31886,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31726
31886
|
} else {
|
|
31727
31887
|
parts.push("[\n");
|
|
31728
31888
|
}
|
|
31729
|
-
|
|
31889
|
+
path3.each(function(elemPath) {
|
|
31730
31890
|
const i = elemPath.getName();
|
|
31731
31891
|
const elem = elemPath.getValue();
|
|
31732
31892
|
if (!elem) {
|
|
@@ -31752,12 +31912,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31752
31912
|
parts.push("]");
|
|
31753
31913
|
}
|
|
31754
31914
|
if (n2.typeAnnotation) {
|
|
31755
|
-
parts.push(
|
|
31915
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
31756
31916
|
}
|
|
31757
31917
|
return concat(parts);
|
|
31758
31918
|
}
|
|
31759
31919
|
case "SequenceExpression":
|
|
31760
|
-
return fromString(", ").join(
|
|
31920
|
+
return fromString(", ").join(path3.map(print2, "expressions"));
|
|
31761
31921
|
case "ThisExpression":
|
|
31762
31922
|
return fromString("this");
|
|
31763
31923
|
case "Super":
|
|
@@ -31784,7 +31944,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31784
31944
|
options
|
|
31785
31945
|
);
|
|
31786
31946
|
case "Directive":
|
|
31787
|
-
return
|
|
31947
|
+
return path3.call(print2, "value");
|
|
31788
31948
|
case "DirectiveLiteral":
|
|
31789
31949
|
return fromString(
|
|
31790
31950
|
getPossibleRaw(n2) || nodeStr(n2.value, options),
|
|
@@ -31802,32 +31962,32 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31802
31962
|
parts.push(n2.operator);
|
|
31803
31963
|
if (/[a-z]$/.test(n2.operator))
|
|
31804
31964
|
parts.push(" ");
|
|
31805
|
-
parts.push(
|
|
31965
|
+
parts.push(path3.call(print2, "argument"));
|
|
31806
31966
|
return concat(parts);
|
|
31807
31967
|
case "UpdateExpression":
|
|
31808
|
-
parts.push(
|
|
31968
|
+
parts.push(path3.call(print2, "argument"), n2.operator);
|
|
31809
31969
|
if (n2.prefix)
|
|
31810
31970
|
parts.reverse();
|
|
31811
31971
|
return concat(parts);
|
|
31812
31972
|
case "ConditionalExpression":
|
|
31813
31973
|
return concat([
|
|
31814
|
-
|
|
31974
|
+
path3.call(print2, "test"),
|
|
31815
31975
|
" ? ",
|
|
31816
|
-
|
|
31976
|
+
path3.call(print2, "consequent"),
|
|
31817
31977
|
" : ",
|
|
31818
|
-
|
|
31978
|
+
path3.call(print2, "alternate")
|
|
31819
31979
|
]);
|
|
31820
31980
|
case "NewExpression": {
|
|
31821
|
-
parts.push("new ",
|
|
31981
|
+
parts.push("new ", path3.call(print2, "callee"));
|
|
31822
31982
|
if (n2.typeParameters) {
|
|
31823
|
-
parts.push(
|
|
31983
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31824
31984
|
}
|
|
31825
31985
|
if (n2.typeArguments) {
|
|
31826
|
-
parts.push(
|
|
31986
|
+
parts.push(path3.call(print2, "typeArguments"));
|
|
31827
31987
|
}
|
|
31828
31988
|
const args = n2.arguments;
|
|
31829
31989
|
if (args) {
|
|
31830
|
-
parts.push(printArgumentsList(
|
|
31990
|
+
parts.push(printArgumentsList(path3, options, print2));
|
|
31831
31991
|
}
|
|
31832
31992
|
return concat(parts);
|
|
31833
31993
|
}
|
|
@@ -31837,7 +31997,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31837
31997
|
}
|
|
31838
31998
|
parts.push(n2.kind, " ");
|
|
31839
31999
|
let maxLen = 0;
|
|
31840
|
-
const printed =
|
|
32000
|
+
const printed = path3.map(function(childPath) {
|
|
31841
32001
|
const lines = print2(childPath);
|
|
31842
32002
|
maxLen = Math.max(lines.length, maxLen);
|
|
31843
32003
|
return lines;
|
|
@@ -31851,7 +32011,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31851
32011
|
} else {
|
|
31852
32012
|
parts.push(printed[0]);
|
|
31853
32013
|
}
|
|
31854
|
-
const parentNode =
|
|
32014
|
+
const parentNode = path3.getParentNode();
|
|
31855
32015
|
if (!namedTypes.ForStatement.check(parentNode) && !namedTypes.ForInStatement.check(parentNode) && !(namedTypes.ForOfStatement && namedTypes.ForOfStatement.check(parentNode)) && !(namedTypes.ForAwaitStatement && namedTypes.ForAwaitStatement.check(parentNode))) {
|
|
31856
32016
|
parts.push(";");
|
|
31857
32017
|
}
|
|
@@ -31859,33 +32019,33 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31859
32019
|
}
|
|
31860
32020
|
case "VariableDeclarator":
|
|
31861
32021
|
return n2.init ? fromString(" = ").join([
|
|
31862
|
-
|
|
31863
|
-
|
|
31864
|
-
]) :
|
|
32022
|
+
path3.call(print2, "id"),
|
|
32023
|
+
path3.call(print2, "init")
|
|
32024
|
+
]) : path3.call(print2, "id");
|
|
31865
32025
|
case "WithStatement":
|
|
31866
32026
|
return concat([
|
|
31867
32027
|
"with (",
|
|
31868
|
-
|
|
32028
|
+
path3.call(print2, "object"),
|
|
31869
32029
|
") ",
|
|
31870
|
-
|
|
32030
|
+
path3.call(print2, "body")
|
|
31871
32031
|
]);
|
|
31872
32032
|
case "IfStatement": {
|
|
31873
|
-
const con = adjustClause(
|
|
31874
|
-
parts.push("if (",
|
|
32033
|
+
const con = adjustClause(path3.call(print2, "consequent"), options);
|
|
32034
|
+
parts.push("if (", path3.call(print2, "test"), ")", con);
|
|
31875
32035
|
if (n2.alternate)
|
|
31876
32036
|
parts.push(
|
|
31877
32037
|
endsWithBrace(con) ? " else" : "\nelse",
|
|
31878
|
-
adjustClause(
|
|
32038
|
+
adjustClause(path3.call(print2, "alternate"), options)
|
|
31879
32039
|
);
|
|
31880
32040
|
return concat(parts);
|
|
31881
32041
|
}
|
|
31882
32042
|
case "ForStatement": {
|
|
31883
|
-
const init =
|
|
32043
|
+
const init = path3.call(print2, "init");
|
|
31884
32044
|
const sep = init.length > 1 ? ";\n" : "; ";
|
|
31885
32045
|
const forParen = "for (";
|
|
31886
|
-
const indented = fromString(sep).join([init,
|
|
32046
|
+
const indented = fromString(sep).join([init, path3.call(print2, "test"), path3.call(print2, "update")]).indentTail(forParen.length);
|
|
31887
32047
|
const head = concat([forParen, indented, ")"]);
|
|
31888
|
-
let clause = adjustClause(
|
|
32048
|
+
let clause = adjustClause(path3.call(print2, "body"), options);
|
|
31889
32049
|
parts.push(head);
|
|
31890
32050
|
if (head.length > 1) {
|
|
31891
32051
|
parts.push("\n");
|
|
@@ -31897,18 +32057,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31897
32057
|
case "WhileStatement":
|
|
31898
32058
|
return concat([
|
|
31899
32059
|
"while (",
|
|
31900
|
-
|
|
32060
|
+
path3.call(print2, "test"),
|
|
31901
32061
|
")",
|
|
31902
|
-
adjustClause(
|
|
32062
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31903
32063
|
]);
|
|
31904
32064
|
case "ForInStatement":
|
|
31905
32065
|
return concat([
|
|
31906
32066
|
n2.each ? "for each (" : "for (",
|
|
31907
|
-
|
|
32067
|
+
path3.call(print2, "left"),
|
|
31908
32068
|
" in ",
|
|
31909
|
-
|
|
32069
|
+
path3.call(print2, "right"),
|
|
31910
32070
|
")",
|
|
31911
|
-
adjustClause(
|
|
32071
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31912
32072
|
]);
|
|
31913
32073
|
case "ForOfStatement":
|
|
31914
32074
|
case "ForAwaitStatement":
|
|
@@ -31918,28 +32078,28 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31918
32078
|
}
|
|
31919
32079
|
parts.push(
|
|
31920
32080
|
"(",
|
|
31921
|
-
|
|
32081
|
+
path3.call(print2, "left"),
|
|
31922
32082
|
" of ",
|
|
31923
|
-
|
|
32083
|
+
path3.call(print2, "right"),
|
|
31924
32084
|
")",
|
|
31925
|
-
adjustClause(
|
|
32085
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31926
32086
|
);
|
|
31927
32087
|
return concat(parts);
|
|
31928
32088
|
case "DoWhileStatement": {
|
|
31929
32089
|
const doBody = concat([
|
|
31930
32090
|
"do",
|
|
31931
|
-
adjustClause(
|
|
32091
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31932
32092
|
]);
|
|
31933
32093
|
parts.push(doBody);
|
|
31934
32094
|
if (endsWithBrace(doBody))
|
|
31935
32095
|
parts.push(" while");
|
|
31936
32096
|
else
|
|
31937
32097
|
parts.push("\nwhile");
|
|
31938
|
-
parts.push(" (",
|
|
32098
|
+
parts.push(" (", path3.call(print2, "test"), ");");
|
|
31939
32099
|
return concat(parts);
|
|
31940
32100
|
}
|
|
31941
32101
|
case "DoExpression": {
|
|
31942
|
-
const statements =
|
|
32102
|
+
const statements = path3.call(
|
|
31943
32103
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
31944
32104
|
"body"
|
|
31945
32105
|
);
|
|
@@ -31948,66 +32108,66 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31948
32108
|
case "BreakStatement":
|
|
31949
32109
|
parts.push("break");
|
|
31950
32110
|
if (n2.label)
|
|
31951
|
-
parts.push(" ",
|
|
32111
|
+
parts.push(" ", path3.call(print2, "label"));
|
|
31952
32112
|
parts.push(";");
|
|
31953
32113
|
return concat(parts);
|
|
31954
32114
|
case "ContinueStatement":
|
|
31955
32115
|
parts.push("continue");
|
|
31956
32116
|
if (n2.label)
|
|
31957
|
-
parts.push(" ",
|
|
32117
|
+
parts.push(" ", path3.call(print2, "label"));
|
|
31958
32118
|
parts.push(";");
|
|
31959
32119
|
return concat(parts);
|
|
31960
32120
|
case "LabeledStatement":
|
|
31961
32121
|
return concat([
|
|
31962
|
-
|
|
32122
|
+
path3.call(print2, "label"),
|
|
31963
32123
|
":\n",
|
|
31964
|
-
|
|
32124
|
+
path3.call(print2, "body")
|
|
31965
32125
|
]);
|
|
31966
32126
|
case "TryStatement":
|
|
31967
|
-
parts.push("try ",
|
|
32127
|
+
parts.push("try ", path3.call(print2, "block"));
|
|
31968
32128
|
if (n2.handler) {
|
|
31969
|
-
parts.push(" ",
|
|
32129
|
+
parts.push(" ", path3.call(print2, "handler"));
|
|
31970
32130
|
} else if (n2.handlers) {
|
|
31971
|
-
|
|
32131
|
+
path3.each(function(handlerPath) {
|
|
31972
32132
|
parts.push(" ", print2(handlerPath));
|
|
31973
32133
|
}, "handlers");
|
|
31974
32134
|
}
|
|
31975
32135
|
if (n2.finalizer) {
|
|
31976
|
-
parts.push(" finally ",
|
|
32136
|
+
parts.push(" finally ", path3.call(print2, "finalizer"));
|
|
31977
32137
|
}
|
|
31978
32138
|
return concat(parts);
|
|
31979
32139
|
case "CatchClause":
|
|
31980
32140
|
parts.push("catch ");
|
|
31981
32141
|
if (n2.param) {
|
|
31982
|
-
parts.push("(",
|
|
32142
|
+
parts.push("(", path3.call(print2, "param"));
|
|
31983
32143
|
}
|
|
31984
32144
|
if (n2.guard) {
|
|
31985
|
-
parts.push(" if ",
|
|
32145
|
+
parts.push(" if ", path3.call(print2, "guard"));
|
|
31986
32146
|
}
|
|
31987
32147
|
if (n2.param) {
|
|
31988
32148
|
parts.push(") ");
|
|
31989
32149
|
}
|
|
31990
|
-
parts.push(
|
|
32150
|
+
parts.push(path3.call(print2, "body"));
|
|
31991
32151
|
return concat(parts);
|
|
31992
32152
|
case "ThrowStatement":
|
|
31993
|
-
return concat(["throw ",
|
|
32153
|
+
return concat(["throw ", path3.call(print2, "argument"), ";"]);
|
|
31994
32154
|
case "SwitchStatement":
|
|
31995
32155
|
return concat([
|
|
31996
32156
|
"switch (",
|
|
31997
|
-
|
|
32157
|
+
path3.call(print2, "discriminant"),
|
|
31998
32158
|
") {\n",
|
|
31999
|
-
fromString("\n").join(
|
|
32159
|
+
fromString("\n").join(path3.map(print2, "cases")),
|
|
32000
32160
|
"\n}"
|
|
32001
32161
|
]);
|
|
32002
32162
|
case "SwitchCase":
|
|
32003
32163
|
if (n2.test)
|
|
32004
|
-
parts.push("case ",
|
|
32164
|
+
parts.push("case ", path3.call(print2, "test"), ":");
|
|
32005
32165
|
else
|
|
32006
32166
|
parts.push("default:");
|
|
32007
32167
|
if (n2.consequent.length > 0) {
|
|
32008
32168
|
parts.push(
|
|
32009
32169
|
"\n",
|
|
32010
|
-
|
|
32170
|
+
path3.call(
|
|
32011
32171
|
(consequentPath) => printStatementSequence(consequentPath, options, print2),
|
|
32012
32172
|
"consequent"
|
|
32013
32173
|
).indent(options.tabWidth)
|
|
@@ -32017,38 +32177,38 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32017
32177
|
case "DebuggerStatement":
|
|
32018
32178
|
return fromString("debugger;");
|
|
32019
32179
|
case "JSXAttribute":
|
|
32020
|
-
parts.push(
|
|
32180
|
+
parts.push(path3.call(print2, "name"));
|
|
32021
32181
|
if (n2.value)
|
|
32022
|
-
parts.push("=",
|
|
32182
|
+
parts.push("=", path3.call(print2, "value"));
|
|
32023
32183
|
return concat(parts);
|
|
32024
32184
|
case "JSXIdentifier":
|
|
32025
32185
|
return fromString(n2.name, options);
|
|
32026
32186
|
case "JSXNamespacedName":
|
|
32027
32187
|
return fromString(":").join([
|
|
32028
|
-
|
|
32029
|
-
|
|
32188
|
+
path3.call(print2, "namespace"),
|
|
32189
|
+
path3.call(print2, "name")
|
|
32030
32190
|
]);
|
|
32031
32191
|
case "JSXMemberExpression":
|
|
32032
32192
|
return fromString(".").join([
|
|
32033
|
-
|
|
32034
|
-
|
|
32193
|
+
path3.call(print2, "object"),
|
|
32194
|
+
path3.call(print2, "property")
|
|
32035
32195
|
]);
|
|
32036
32196
|
case "JSXSpreadAttribute":
|
|
32037
|
-
return concat(["{...",
|
|
32197
|
+
return concat(["{...", path3.call(print2, "argument"), "}"]);
|
|
32038
32198
|
case "JSXSpreadChild":
|
|
32039
|
-
return concat(["{...",
|
|
32199
|
+
return concat(["{...", path3.call(print2, "expression"), "}"]);
|
|
32040
32200
|
case "JSXExpressionContainer":
|
|
32041
|
-
return concat(["{",
|
|
32201
|
+
return concat(["{", path3.call(print2, "expression"), "}"]);
|
|
32042
32202
|
case "JSXElement":
|
|
32043
32203
|
case "JSXFragment": {
|
|
32044
32204
|
const openingPropName = "opening" + (n2.type === "JSXElement" ? "Element" : "Fragment");
|
|
32045
32205
|
const closingPropName = "closing" + (n2.type === "JSXElement" ? "Element" : "Fragment");
|
|
32046
|
-
const openingLines =
|
|
32206
|
+
const openingLines = path3.call(print2, openingPropName);
|
|
32047
32207
|
if (n2[openingPropName].selfClosing) {
|
|
32048
32208
|
return openingLines;
|
|
32049
32209
|
}
|
|
32050
32210
|
const childLines = concat(
|
|
32051
|
-
|
|
32211
|
+
path3.map(function(childPath) {
|
|
32052
32212
|
const child = childPath.getValue();
|
|
32053
32213
|
if (namedTypes.Literal.check(child) && typeof child.value === "string") {
|
|
32054
32214
|
if (/\S/.test(child.value)) {
|
|
@@ -32060,13 +32220,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32060
32220
|
return print2(childPath);
|
|
32061
32221
|
}, "children")
|
|
32062
32222
|
).indentTail(options.tabWidth);
|
|
32063
|
-
const closingLines =
|
|
32223
|
+
const closingLines = path3.call(print2, closingPropName);
|
|
32064
32224
|
return concat([openingLines, childLines, closingLines]);
|
|
32065
32225
|
}
|
|
32066
32226
|
case "JSXOpeningElement": {
|
|
32067
|
-
parts.push("<",
|
|
32227
|
+
parts.push("<", path3.call(print2, "name"));
|
|
32068
32228
|
const attrParts = [];
|
|
32069
|
-
|
|
32229
|
+
path3.each(function(attrPath) {
|
|
32070
32230
|
attrParts.push(" ", print2(attrPath));
|
|
32071
32231
|
}, "attributes");
|
|
32072
32232
|
let attrLines = concat(attrParts);
|
|
@@ -32083,7 +32243,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32083
32243
|
return concat(parts);
|
|
32084
32244
|
}
|
|
32085
32245
|
case "JSXClosingElement":
|
|
32086
|
-
return concat(["</",
|
|
32246
|
+
return concat(["</", path3.call(print2, "name"), ">"]);
|
|
32087
32247
|
case "JSXOpeningFragment":
|
|
32088
32248
|
return fromString("<>");
|
|
32089
32249
|
case "JSXClosingFragment":
|
|
@@ -32094,9 +32254,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32094
32254
|
return fromString("");
|
|
32095
32255
|
case "TypeAnnotatedIdentifier":
|
|
32096
32256
|
return concat([
|
|
32097
|
-
|
|
32257
|
+
path3.call(print2, "annotation"),
|
|
32098
32258
|
" ",
|
|
32099
|
-
|
|
32259
|
+
path3.call(print2, "identifier")
|
|
32100
32260
|
]);
|
|
32101
32261
|
case "ClassBody":
|
|
32102
32262
|
if (n2.body.length === 0) {
|
|
@@ -32104,14 +32264,14 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32104
32264
|
}
|
|
32105
32265
|
return concat([
|
|
32106
32266
|
"{\n",
|
|
32107
|
-
|
|
32267
|
+
path3.call(
|
|
32108
32268
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
32109
32269
|
"body"
|
|
32110
32270
|
).indent(options.tabWidth),
|
|
32111
32271
|
"\n}"
|
|
32112
32272
|
]);
|
|
32113
32273
|
case "ClassPropertyDefinition":
|
|
32114
|
-
parts.push("static ",
|
|
32274
|
+
parts.push("static ", path3.call(print2, "definition"));
|
|
32115
32275
|
if (!namedTypes.MethodDefinition.check(n2.definition))
|
|
32116
32276
|
parts.push(";");
|
|
32117
32277
|
return concat(parts);
|
|
@@ -32132,12 +32292,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32132
32292
|
if (n2.readonly) {
|
|
32133
32293
|
parts.push("readonly ");
|
|
32134
32294
|
}
|
|
32135
|
-
let key =
|
|
32295
|
+
let key = path3.call(print2, "key");
|
|
32136
32296
|
if (n2.computed) {
|
|
32137
32297
|
key = concat(["[", key, "]"]);
|
|
32138
32298
|
}
|
|
32139
32299
|
if (n2.variance) {
|
|
32140
|
-
key = concat([printVariance(
|
|
32300
|
+
key = concat([printVariance(path3, print2), key]);
|
|
32141
32301
|
}
|
|
32142
32302
|
parts.push(key);
|
|
32143
32303
|
if (n2.optional) {
|
|
@@ -32147,10 +32307,10 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32147
32307
|
parts.push("!");
|
|
32148
32308
|
}
|
|
32149
32309
|
if (n2.typeAnnotation) {
|
|
32150
|
-
parts.push(
|
|
32310
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32151
32311
|
}
|
|
32152
32312
|
if (n2.value) {
|
|
32153
|
-
parts.push(" = ",
|
|
32313
|
+
parts.push(" = ", path3.call(print2, "value"));
|
|
32154
32314
|
}
|
|
32155
32315
|
parts.push(";");
|
|
32156
32316
|
return concat(parts);
|
|
@@ -32159,12 +32319,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32159
32319
|
if (n2.static) {
|
|
32160
32320
|
parts.push("static ");
|
|
32161
32321
|
}
|
|
32162
|
-
parts.push(
|
|
32322
|
+
parts.push(path3.call(print2, "key"));
|
|
32163
32323
|
if (n2.typeAnnotation) {
|
|
32164
|
-
parts.push(
|
|
32324
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32165
32325
|
}
|
|
32166
32326
|
if (n2.value) {
|
|
32167
|
-
parts.push(" = ",
|
|
32327
|
+
parts.push(" = ", path3.call(print2, "value"));
|
|
32168
32328
|
}
|
|
32169
32329
|
parts.push(";");
|
|
32170
32330
|
return concat(parts);
|
|
@@ -32174,9 +32334,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32174
32334
|
"accessor "
|
|
32175
32335
|
);
|
|
32176
32336
|
if (n2.computed) {
|
|
32177
|
-
parts.push("[",
|
|
32337
|
+
parts.push("[", path3.call(print2, "key"), "]");
|
|
32178
32338
|
} else {
|
|
32179
|
-
parts.push(
|
|
32339
|
+
parts.push(path3.call(print2, "key"));
|
|
32180
32340
|
}
|
|
32181
32341
|
if (n2.optional) {
|
|
32182
32342
|
parts.push("?");
|
|
@@ -32185,10 +32345,10 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32185
32345
|
parts.push("!");
|
|
32186
32346
|
}
|
|
32187
32347
|
if (n2.typeAnnotation) {
|
|
32188
|
-
parts.push(
|
|
32348
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32189
32349
|
}
|
|
32190
32350
|
if (n2.value) {
|
|
32191
|
-
parts.push(" = ",
|
|
32351
|
+
parts.push(" = ", path3.call(print2, "value"));
|
|
32192
32352
|
}
|
|
32193
32353
|
parts.push(";");
|
|
32194
32354
|
return concat(parts);
|
|
@@ -32204,42 +32364,42 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32204
32364
|
}
|
|
32205
32365
|
parts.push("class");
|
|
32206
32366
|
if (n2.id) {
|
|
32207
|
-
parts.push(" ",
|
|
32367
|
+
parts.push(" ", path3.call(print2, "id"));
|
|
32208
32368
|
}
|
|
32209
32369
|
if (n2.typeParameters) {
|
|
32210
|
-
parts.push(
|
|
32370
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
32211
32371
|
}
|
|
32212
32372
|
if (n2.superClass) {
|
|
32213
32373
|
parts.push(
|
|
32214
32374
|
" extends ",
|
|
32215
|
-
|
|
32216
|
-
|
|
32375
|
+
path3.call(print2, "superClass"),
|
|
32376
|
+
path3.call(print2, "superTypeParameters")
|
|
32217
32377
|
);
|
|
32218
32378
|
}
|
|
32219
32379
|
if (n2.extends && n2.extends.length > 0) {
|
|
32220
32380
|
parts.push(
|
|
32221
32381
|
" extends ",
|
|
32222
|
-
fromString(", ").join(
|
|
32382
|
+
fromString(", ").join(path3.map(print2, "extends"))
|
|
32223
32383
|
);
|
|
32224
32384
|
}
|
|
32225
32385
|
if (n2["implements"] && n2["implements"].length > 0) {
|
|
32226
32386
|
parts.push(
|
|
32227
32387
|
" implements ",
|
|
32228
|
-
fromString(", ").join(
|
|
32388
|
+
fromString(", ").join(path3.map(print2, "implements"))
|
|
32229
32389
|
);
|
|
32230
32390
|
}
|
|
32231
|
-
parts.push(" ",
|
|
32391
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
32232
32392
|
if (n2.type === "DeclareClass") {
|
|
32233
|
-
return printFlowDeclaration(
|
|
32393
|
+
return printFlowDeclaration(path3, parts);
|
|
32234
32394
|
} else {
|
|
32235
32395
|
return concat(parts);
|
|
32236
32396
|
}
|
|
32237
32397
|
case "TemplateElement":
|
|
32238
32398
|
return fromString(n2.value.raw, options).lockIndentTail();
|
|
32239
32399
|
case "TemplateLiteral": {
|
|
32240
|
-
const expressions =
|
|
32400
|
+
const expressions = path3.map(print2, "expressions");
|
|
32241
32401
|
parts.push("`");
|
|
32242
|
-
|
|
32402
|
+
path3.each(function(childPath) {
|
|
32243
32403
|
const i = childPath.getName();
|
|
32244
32404
|
parts.push(print2(childPath));
|
|
32245
32405
|
if (i < expressions.length) {
|
|
@@ -32250,7 +32410,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32250
32410
|
return concat(parts).lockIndentTail();
|
|
32251
32411
|
}
|
|
32252
32412
|
case "TaggedTemplateExpression":
|
|
32253
|
-
return concat([
|
|
32413
|
+
return concat([path3.call(print2, "tag"), path3.call(print2, "quasi")]);
|
|
32254
32414
|
case "Node":
|
|
32255
32415
|
case "Printable":
|
|
32256
32416
|
case "SourceLocation":
|
|
@@ -32284,7 +32444,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32284
32444
|
if (n2.typeAnnotation.type !== "FunctionTypeAnnotation") {
|
|
32285
32445
|
parts.push(": ");
|
|
32286
32446
|
}
|
|
32287
|
-
parts.push(
|
|
32447
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32288
32448
|
return concat(parts);
|
|
32289
32449
|
}
|
|
32290
32450
|
return fromString("");
|
|
@@ -32298,9 +32458,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32298
32458
|
case "MixedTypeAnnotation":
|
|
32299
32459
|
return fromString("mixed", options);
|
|
32300
32460
|
case "ArrayTypeAnnotation":
|
|
32301
|
-
return concat([
|
|
32461
|
+
return concat([path3.call(print2, "elementType"), "[]"]);
|
|
32302
32462
|
case "TupleTypeAnnotation": {
|
|
32303
|
-
const printed =
|
|
32463
|
+
const printed = path3.map(print2, "types");
|
|
32304
32464
|
const joined = fromString(", ").join(printed);
|
|
32305
32465
|
const oneLine = joined.getLineLength(1) <= options.wrapColumn;
|
|
32306
32466
|
if (oneLine) {
|
|
@@ -32312,7 +32472,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32312
32472
|
} else {
|
|
32313
32473
|
parts.push("[\n");
|
|
32314
32474
|
}
|
|
32315
|
-
|
|
32475
|
+
path3.each(function(elemPath) {
|
|
32316
32476
|
const i = elemPath.getName();
|
|
32317
32477
|
const elem = elemPath.getValue();
|
|
32318
32478
|
if (!elem) {
|
|
@@ -32348,39 +32508,39 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32348
32508
|
if (n2.extends && n2.extends.length > 0) {
|
|
32349
32509
|
parts.push(
|
|
32350
32510
|
" extends ",
|
|
32351
|
-
fromString(", ").join(
|
|
32511
|
+
fromString(", ").join(path3.map(print2, "extends"))
|
|
32352
32512
|
);
|
|
32353
32513
|
}
|
|
32354
|
-
parts.push(" ",
|
|
32514
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
32355
32515
|
return concat(parts);
|
|
32356
32516
|
case "DeclareFunction":
|
|
32357
|
-
return printFlowDeclaration(
|
|
32517
|
+
return printFlowDeclaration(path3, [
|
|
32358
32518
|
"function ",
|
|
32359
|
-
|
|
32519
|
+
path3.call(print2, "id"),
|
|
32360
32520
|
";"
|
|
32361
32521
|
]);
|
|
32362
32522
|
case "DeclareModule":
|
|
32363
|
-
return printFlowDeclaration(
|
|
32523
|
+
return printFlowDeclaration(path3, [
|
|
32364
32524
|
"module ",
|
|
32365
|
-
|
|
32525
|
+
path3.call(print2, "id"),
|
|
32366
32526
|
" ",
|
|
32367
|
-
|
|
32527
|
+
path3.call(print2, "body")
|
|
32368
32528
|
]);
|
|
32369
32529
|
case "DeclareModuleExports":
|
|
32370
|
-
return printFlowDeclaration(
|
|
32530
|
+
return printFlowDeclaration(path3, [
|
|
32371
32531
|
"module.exports",
|
|
32372
|
-
|
|
32532
|
+
path3.call(print2, "typeAnnotation")
|
|
32373
32533
|
]);
|
|
32374
32534
|
case "DeclareVariable":
|
|
32375
|
-
return printFlowDeclaration(
|
|
32535
|
+
return printFlowDeclaration(path3, ["var ", path3.call(print2, "id"), ";"]);
|
|
32376
32536
|
case "DeclareExportDeclaration":
|
|
32377
32537
|
case "DeclareExportAllDeclaration":
|
|
32378
|
-
return concat(["declare ", printExportDeclaration(
|
|
32538
|
+
return concat(["declare ", printExportDeclaration(path3, options, print2)]);
|
|
32379
32539
|
case "EnumDeclaration":
|
|
32380
32540
|
return concat([
|
|
32381
32541
|
"enum ",
|
|
32382
|
-
|
|
32383
|
-
|
|
32542
|
+
path3.call(print2, "id"),
|
|
32543
|
+
path3.call(print2, "body")
|
|
32384
32544
|
]);
|
|
32385
32545
|
case "EnumBooleanBody":
|
|
32386
32546
|
case "EnumNumberBody":
|
|
@@ -32395,29 +32555,29 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32395
32555
|
}
|
|
32396
32556
|
parts.push(
|
|
32397
32557
|
" {\n",
|
|
32398
|
-
fromString("\n").join(
|
|
32558
|
+
fromString("\n").join(path3.map(print2, "members")).indent(options.tabWidth),
|
|
32399
32559
|
"\n}"
|
|
32400
32560
|
);
|
|
32401
32561
|
return concat(parts);
|
|
32402
32562
|
}
|
|
32403
32563
|
case "EnumDefaultedMember":
|
|
32404
|
-
return concat([
|
|
32564
|
+
return concat([path3.call(print2, "id"), ","]);
|
|
32405
32565
|
case "EnumBooleanMember":
|
|
32406
32566
|
case "EnumNumberMember":
|
|
32407
32567
|
case "EnumStringMember":
|
|
32408
32568
|
return concat([
|
|
32409
|
-
|
|
32569
|
+
path3.call(print2, "id"),
|
|
32410
32570
|
" = ",
|
|
32411
|
-
|
|
32571
|
+
path3.call(print2, "init"),
|
|
32412
32572
|
","
|
|
32413
32573
|
]);
|
|
32414
32574
|
case "InferredPredicate":
|
|
32415
32575
|
return fromString("%checks", options);
|
|
32416
32576
|
case "DeclaredPredicate":
|
|
32417
|
-
return concat(["%checks(",
|
|
32577
|
+
return concat(["%checks(", path3.call(print2, "value"), ")"]);
|
|
32418
32578
|
case "FunctionTypeAnnotation": {
|
|
32419
|
-
const parent =
|
|
32420
|
-
const isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) || namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method || namedTypes.DeclareFunction.check(
|
|
32579
|
+
const parent = path3.getParentNode(0);
|
|
32580
|
+
const isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) || namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method || namedTypes.DeclareFunction.check(path3.getParentNode(2)));
|
|
32421
32581
|
const needsColon = isArrowFunctionTypeAnnotation && !namedTypes.FunctionTypeParam.check(parent) && !namedTypes.TypeAlias.check(parent);
|
|
32422
32582
|
if (needsColon) {
|
|
32423
32583
|
parts.push(": ");
|
|
@@ -32425,21 +32585,21 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32425
32585
|
const hasTypeParameters = !!n2.typeParameters;
|
|
32426
32586
|
const needsParens = hasTypeParameters || n2.params.length !== 1 || n2.params[0].name;
|
|
32427
32587
|
parts.push(
|
|
32428
|
-
hasTypeParameters ?
|
|
32588
|
+
hasTypeParameters ? path3.call(print2, "typeParameters") : "",
|
|
32429
32589
|
needsParens ? "(" : "",
|
|
32430
|
-
printFunctionParams(
|
|
32590
|
+
printFunctionParams(path3, options, print2),
|
|
32431
32591
|
needsParens ? ")" : ""
|
|
32432
32592
|
);
|
|
32433
32593
|
if (n2.returnType) {
|
|
32434
32594
|
parts.push(
|
|
32435
32595
|
isArrowFunctionTypeAnnotation ? " => " : ": ",
|
|
32436
|
-
|
|
32596
|
+
path3.call(print2, "returnType")
|
|
32437
32597
|
);
|
|
32438
32598
|
}
|
|
32439
32599
|
return concat(parts);
|
|
32440
32600
|
}
|
|
32441
32601
|
case "FunctionTypeParam": {
|
|
32442
|
-
const name =
|
|
32602
|
+
const name = path3.call(print2, "name");
|
|
32443
32603
|
parts.push(name);
|
|
32444
32604
|
if (n2.optional) {
|
|
32445
32605
|
parts.push("?");
|
|
@@ -32447,13 +32607,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32447
32607
|
if (name.infos[0].line) {
|
|
32448
32608
|
parts.push(": ");
|
|
32449
32609
|
}
|
|
32450
|
-
parts.push(
|
|
32610
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32451
32611
|
return concat(parts);
|
|
32452
32612
|
}
|
|
32453
32613
|
case "GenericTypeAnnotation":
|
|
32454
32614
|
return concat([
|
|
32455
|
-
|
|
32456
|
-
|
|
32615
|
+
path3.call(print2, "id"),
|
|
32616
|
+
path3.call(print2, "typeParameters")
|
|
32457
32617
|
]);
|
|
32458
32618
|
case "DeclareInterface":
|
|
32459
32619
|
parts.push("declare ");
|
|
@@ -32464,31 +32624,31 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32464
32624
|
}
|
|
32465
32625
|
parts.push(
|
|
32466
32626
|
"interface ",
|
|
32467
|
-
|
|
32468
|
-
|
|
32627
|
+
path3.call(print2, "id"),
|
|
32628
|
+
path3.call(print2, "typeParameters"),
|
|
32469
32629
|
" "
|
|
32470
32630
|
);
|
|
32471
32631
|
if (n2["extends"] && n2["extends"].length > 0) {
|
|
32472
32632
|
parts.push(
|
|
32473
32633
|
"extends ",
|
|
32474
|
-
fromString(", ").join(
|
|
32634
|
+
fromString(", ").join(path3.map(print2, "extends")),
|
|
32475
32635
|
" "
|
|
32476
32636
|
);
|
|
32477
32637
|
}
|
|
32478
32638
|
if (n2.body) {
|
|
32479
|
-
parts.push(
|
|
32639
|
+
parts.push(path3.call(print2, "body"));
|
|
32480
32640
|
}
|
|
32481
32641
|
return concat(parts);
|
|
32482
32642
|
case "ClassImplements":
|
|
32483
32643
|
case "InterfaceExtends":
|
|
32484
32644
|
return concat([
|
|
32485
|
-
|
|
32486
|
-
|
|
32645
|
+
path3.call(print2, "id"),
|
|
32646
|
+
path3.call(print2, "typeParameters")
|
|
32487
32647
|
]);
|
|
32488
32648
|
case "IntersectionTypeAnnotation":
|
|
32489
|
-
return fromString(" & ").join(
|
|
32649
|
+
return fromString(" & ").join(path3.map(print2, "types"));
|
|
32490
32650
|
case "NullableTypeAnnotation":
|
|
32491
|
-
return concat(["?",
|
|
32651
|
+
return concat(["?", path3.call(print2, "typeAnnotation")]);
|
|
32492
32652
|
case "NullLiteralTypeAnnotation":
|
|
32493
32653
|
return fromString("null", options);
|
|
32494
32654
|
case "ThisTypeAnnotation":
|
|
@@ -32496,40 +32656,40 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32496
32656
|
case "NumberTypeAnnotation":
|
|
32497
32657
|
return fromString("number", options);
|
|
32498
32658
|
case "ObjectTypeCallProperty":
|
|
32499
|
-
return
|
|
32659
|
+
return path3.call(print2, "value");
|
|
32500
32660
|
case "ObjectTypeIndexer":
|
|
32501
32661
|
if (n2.static) {
|
|
32502
32662
|
parts.push("static ");
|
|
32503
32663
|
}
|
|
32504
|
-
parts.push(printVariance(
|
|
32664
|
+
parts.push(printVariance(path3, print2), "[");
|
|
32505
32665
|
if (n2.id) {
|
|
32506
|
-
parts.push(
|
|
32666
|
+
parts.push(path3.call(print2, "id"), ": ");
|
|
32507
32667
|
}
|
|
32508
|
-
parts.push(
|
|
32668
|
+
parts.push(path3.call(print2, "key"), "]: ", path3.call(print2, "value"));
|
|
32509
32669
|
return concat(parts);
|
|
32510
32670
|
case "ObjectTypeProperty":
|
|
32511
32671
|
return concat([
|
|
32512
|
-
printVariance(
|
|
32513
|
-
|
|
32672
|
+
printVariance(path3, print2),
|
|
32673
|
+
path3.call(print2, "key"),
|
|
32514
32674
|
n2.optional ? "?" : "",
|
|
32515
32675
|
": ",
|
|
32516
|
-
|
|
32676
|
+
path3.call(print2, "value")
|
|
32517
32677
|
]);
|
|
32518
32678
|
case "ObjectTypeInternalSlot":
|
|
32519
32679
|
return concat([
|
|
32520
32680
|
n2.static ? "static " : "",
|
|
32521
32681
|
"[[",
|
|
32522
|
-
|
|
32682
|
+
path3.call(print2, "id"),
|
|
32523
32683
|
"]]",
|
|
32524
32684
|
n2.optional ? "?" : "",
|
|
32525
32685
|
n2.value.type !== "FunctionTypeAnnotation" ? ": " : "",
|
|
32526
|
-
|
|
32686
|
+
path3.call(print2, "value")
|
|
32527
32687
|
]);
|
|
32528
32688
|
case "QualifiedTypeIdentifier":
|
|
32529
32689
|
return concat([
|
|
32530
|
-
|
|
32690
|
+
path3.call(print2, "qualification"),
|
|
32531
32691
|
".",
|
|
32532
|
-
|
|
32692
|
+
path3.call(print2, "id")
|
|
32533
32693
|
]);
|
|
32534
32694
|
case "StringLiteralTypeAnnotation":
|
|
32535
32695
|
return fromString(nodeStr(n2.value, options), options);
|
|
@@ -32545,10 +32705,10 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32545
32705
|
case "TypeAlias":
|
|
32546
32706
|
return concat([
|
|
32547
32707
|
"type ",
|
|
32548
|
-
|
|
32549
|
-
|
|
32708
|
+
path3.call(print2, "id"),
|
|
32709
|
+
path3.call(print2, "typeParameters"),
|
|
32550
32710
|
" = ",
|
|
32551
|
-
|
|
32711
|
+
path3.call(print2, "right"),
|
|
32552
32712
|
";"
|
|
32553
32713
|
]);
|
|
32554
32714
|
case "DeclareOpaqueType":
|
|
@@ -32556,29 +32716,29 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32556
32716
|
case "OpaqueType":
|
|
32557
32717
|
parts.push(
|
|
32558
32718
|
"opaque type ",
|
|
32559
|
-
|
|
32560
|
-
|
|
32719
|
+
path3.call(print2, "id"),
|
|
32720
|
+
path3.call(print2, "typeParameters")
|
|
32561
32721
|
);
|
|
32562
32722
|
if (n2["supertype"]) {
|
|
32563
|
-
parts.push(": ",
|
|
32723
|
+
parts.push(": ", path3.call(print2, "supertype"));
|
|
32564
32724
|
}
|
|
32565
32725
|
if (n2["impltype"]) {
|
|
32566
|
-
parts.push(" = ",
|
|
32726
|
+
parts.push(" = ", path3.call(print2, "impltype"));
|
|
32567
32727
|
}
|
|
32568
32728
|
parts.push(";");
|
|
32569
32729
|
return concat(parts);
|
|
32570
32730
|
case "TypeCastExpression":
|
|
32571
32731
|
return concat([
|
|
32572
32732
|
"(",
|
|
32573
|
-
|
|
32574
|
-
|
|
32733
|
+
path3.call(print2, "expression"),
|
|
32734
|
+
path3.call(print2, "typeAnnotation"),
|
|
32575
32735
|
")"
|
|
32576
32736
|
]);
|
|
32577
32737
|
case "TypeParameterDeclaration":
|
|
32578
32738
|
case "TypeParameterInstantiation":
|
|
32579
32739
|
return concat([
|
|
32580
32740
|
"<",
|
|
32581
|
-
fromString(", ").join(
|
|
32741
|
+
fromString(", ").join(path3.map(print2, "params")),
|
|
32582
32742
|
">"
|
|
32583
32743
|
]);
|
|
32584
32744
|
case "Variance":
|
|
@@ -32591,32 +32751,32 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32591
32751
|
return fromString("");
|
|
32592
32752
|
case "TypeParameter":
|
|
32593
32753
|
if (n2.variance) {
|
|
32594
|
-
parts.push(printVariance(
|
|
32754
|
+
parts.push(printVariance(path3, print2));
|
|
32595
32755
|
}
|
|
32596
|
-
parts.push(
|
|
32756
|
+
parts.push(path3.call(print2, "name"));
|
|
32597
32757
|
if (n2.bound) {
|
|
32598
|
-
parts.push(
|
|
32758
|
+
parts.push(path3.call(print2, "bound"));
|
|
32599
32759
|
}
|
|
32600
32760
|
if (n2["default"]) {
|
|
32601
|
-
parts.push("=",
|
|
32761
|
+
parts.push("=", path3.call(print2, "default"));
|
|
32602
32762
|
}
|
|
32603
32763
|
return concat(parts);
|
|
32604
32764
|
case "TypeofTypeAnnotation":
|
|
32605
32765
|
return concat([
|
|
32606
32766
|
fromString("typeof ", options),
|
|
32607
|
-
|
|
32767
|
+
path3.call(print2, "argument")
|
|
32608
32768
|
]);
|
|
32609
32769
|
case "IndexedAccessType":
|
|
32610
32770
|
case "OptionalIndexedAccessType":
|
|
32611
32771
|
return concat([
|
|
32612
|
-
|
|
32772
|
+
path3.call(print2, "objectType"),
|
|
32613
32773
|
n2.optional ? "?." : "",
|
|
32614
32774
|
"[",
|
|
32615
|
-
|
|
32775
|
+
path3.call(print2, "indexType"),
|
|
32616
32776
|
"]"
|
|
32617
32777
|
]);
|
|
32618
32778
|
case "UnionTypeAnnotation":
|
|
32619
|
-
return fromString(" | ").join(
|
|
32779
|
+
return fromString(" | ").join(path3.map(print2, "types"));
|
|
32620
32780
|
case "VoidTypeAnnotation":
|
|
32621
32781
|
return fromString("void", options);
|
|
32622
32782
|
case "NullTypeAnnotation":
|
|
@@ -32656,92 +32816,92 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32656
32816
|
case "TSNeverKeyword":
|
|
32657
32817
|
return fromString("never", options);
|
|
32658
32818
|
case "TSArrayType":
|
|
32659
|
-
return concat([
|
|
32819
|
+
return concat([path3.call(print2, "elementType"), "[]"]);
|
|
32660
32820
|
case "TSLiteralType":
|
|
32661
|
-
return
|
|
32821
|
+
return path3.call(print2, "literal");
|
|
32662
32822
|
case "TSUnionType":
|
|
32663
|
-
return fromString(" | ").join(
|
|
32823
|
+
return fromString(" | ").join(path3.map(print2, "types"));
|
|
32664
32824
|
case "TSIntersectionType":
|
|
32665
|
-
return fromString(" & ").join(
|
|
32825
|
+
return fromString(" & ").join(path3.map(print2, "types"));
|
|
32666
32826
|
case "TSConditionalType":
|
|
32667
32827
|
parts.push(
|
|
32668
|
-
|
|
32828
|
+
path3.call(print2, "checkType"),
|
|
32669
32829
|
" extends ",
|
|
32670
|
-
|
|
32830
|
+
path3.call(print2, "extendsType"),
|
|
32671
32831
|
" ? ",
|
|
32672
|
-
|
|
32832
|
+
path3.call(print2, "trueType"),
|
|
32673
32833
|
" : ",
|
|
32674
|
-
|
|
32834
|
+
path3.call(print2, "falseType")
|
|
32675
32835
|
);
|
|
32676
32836
|
return concat(parts);
|
|
32677
32837
|
case "TSInferType":
|
|
32678
|
-
parts.push("infer ",
|
|
32838
|
+
parts.push("infer ", path3.call(print2, "typeParameter"));
|
|
32679
32839
|
return concat(parts);
|
|
32680
32840
|
case "TSParenthesizedType":
|
|
32681
|
-
return concat(["(",
|
|
32841
|
+
return concat(["(", path3.call(print2, "typeAnnotation"), ")"]);
|
|
32682
32842
|
case "TSFunctionType":
|
|
32683
32843
|
return concat([
|
|
32684
|
-
|
|
32844
|
+
path3.call(print2, "typeParameters"),
|
|
32685
32845
|
"(",
|
|
32686
|
-
printFunctionParams(
|
|
32846
|
+
printFunctionParams(path3, options, print2),
|
|
32687
32847
|
") => ",
|
|
32688
|
-
|
|
32848
|
+
path3.call(print2, "typeAnnotation", "typeAnnotation")
|
|
32689
32849
|
]);
|
|
32690
32850
|
case "TSConstructorType":
|
|
32691
32851
|
return concat([
|
|
32692
32852
|
"new ",
|
|
32693
|
-
|
|
32853
|
+
path3.call(print2, "typeParameters"),
|
|
32694
32854
|
"(",
|
|
32695
|
-
printFunctionParams(
|
|
32855
|
+
printFunctionParams(path3, options, print2),
|
|
32696
32856
|
") => ",
|
|
32697
|
-
|
|
32857
|
+
path3.call(print2, "typeAnnotation", "typeAnnotation")
|
|
32698
32858
|
]);
|
|
32699
32859
|
case "TSMappedType": {
|
|
32700
32860
|
parts.push(
|
|
32701
32861
|
n2.readonly ? "readonly " : "",
|
|
32702
32862
|
"[",
|
|
32703
|
-
|
|
32863
|
+
path3.call(print2, "typeParameter"),
|
|
32704
32864
|
"]",
|
|
32705
32865
|
n2.optional ? "?" : ""
|
|
32706
32866
|
);
|
|
32707
32867
|
if (n2.typeAnnotation) {
|
|
32708
|
-
parts.push(": ",
|
|
32868
|
+
parts.push(": ", path3.call(print2, "typeAnnotation"), ";");
|
|
32709
32869
|
}
|
|
32710
32870
|
return concat(["{\n", concat(parts).indent(options.tabWidth), "\n}"]);
|
|
32711
32871
|
}
|
|
32712
32872
|
case "TSTupleType":
|
|
32713
32873
|
return concat([
|
|
32714
32874
|
"[",
|
|
32715
|
-
fromString(", ").join(
|
|
32875
|
+
fromString(", ").join(path3.map(print2, "elementTypes")),
|
|
32716
32876
|
"]"
|
|
32717
32877
|
]);
|
|
32718
32878
|
case "TSNamedTupleMember":
|
|
32719
|
-
parts.push(
|
|
32879
|
+
parts.push(path3.call(print2, "label"));
|
|
32720
32880
|
if (n2.optional) {
|
|
32721
32881
|
parts.push("?");
|
|
32722
32882
|
}
|
|
32723
|
-
parts.push(": ",
|
|
32883
|
+
parts.push(": ", path3.call(print2, "elementType"));
|
|
32724
32884
|
return concat(parts);
|
|
32725
32885
|
case "TSRestType":
|
|
32726
|
-
return concat(["...",
|
|
32886
|
+
return concat(["...", path3.call(print2, "typeAnnotation")]);
|
|
32727
32887
|
case "TSOptionalType":
|
|
32728
|
-
return concat([
|
|
32888
|
+
return concat([path3.call(print2, "typeAnnotation"), "?"]);
|
|
32729
32889
|
case "TSIndexedAccessType":
|
|
32730
32890
|
return concat([
|
|
32731
|
-
|
|
32891
|
+
path3.call(print2, "objectType"),
|
|
32732
32892
|
"[",
|
|
32733
|
-
|
|
32893
|
+
path3.call(print2, "indexType"),
|
|
32734
32894
|
"]"
|
|
32735
32895
|
]);
|
|
32736
32896
|
case "TSTypeOperator":
|
|
32737
32897
|
return concat([
|
|
32738
|
-
|
|
32898
|
+
path3.call(print2, "operator"),
|
|
32739
32899
|
" ",
|
|
32740
|
-
|
|
32900
|
+
path3.call(print2, "typeAnnotation")
|
|
32741
32901
|
]);
|
|
32742
32902
|
case "TSTypeLiteral": {
|
|
32743
32903
|
const members = fromString("\n").join(
|
|
32744
|
-
|
|
32904
|
+
path3.map(print2, "members").map((member) => {
|
|
32745
32905
|
if (lastNonSpaceCharacter(member) !== ";") {
|
|
32746
32906
|
return member.concat(";");
|
|
32747
32907
|
}
|
|
@@ -32755,13 +32915,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32755
32915
|
return concat(parts);
|
|
32756
32916
|
}
|
|
32757
32917
|
case "TSEnumMember":
|
|
32758
|
-
parts.push(
|
|
32918
|
+
parts.push(path3.call(print2, "id"));
|
|
32759
32919
|
if (n2.initializer) {
|
|
32760
|
-
parts.push(" = ",
|
|
32920
|
+
parts.push(" = ", path3.call(print2, "initializer"));
|
|
32761
32921
|
}
|
|
32762
32922
|
return concat(parts);
|
|
32763
32923
|
case "TSTypeQuery":
|
|
32764
|
-
return concat(["typeof ",
|
|
32924
|
+
return concat(["typeof ", path3.call(print2, "exprName")]);
|
|
32765
32925
|
case "TSParameterProperty":
|
|
32766
32926
|
if (n2.accessibility) {
|
|
32767
32927
|
parts.push(n2.accessibility, " ");
|
|
@@ -32775,132 +32935,132 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32775
32935
|
if (n2.readonly) {
|
|
32776
32936
|
parts.push("readonly ");
|
|
32777
32937
|
}
|
|
32778
|
-
parts.push(
|
|
32938
|
+
parts.push(path3.call(print2, "parameter"));
|
|
32779
32939
|
return concat(parts);
|
|
32780
32940
|
case "TSTypeReference":
|
|
32781
32941
|
return concat([
|
|
32782
|
-
|
|
32783
|
-
|
|
32942
|
+
path3.call(print2, "typeName"),
|
|
32943
|
+
path3.call(print2, "typeParameters")
|
|
32784
32944
|
]);
|
|
32785
32945
|
case "TSQualifiedName":
|
|
32786
|
-
return concat([
|
|
32946
|
+
return concat([path3.call(print2, "left"), ".", path3.call(print2, "right")]);
|
|
32787
32947
|
case "TSAsExpression":
|
|
32788
32948
|
case "TSSatisfiesExpression": {
|
|
32789
|
-
const expression =
|
|
32949
|
+
const expression = path3.call(print2, "expression");
|
|
32790
32950
|
parts.push(
|
|
32791
32951
|
expression,
|
|
32792
32952
|
n2.type === "TSSatisfiesExpression" ? " satisfies " : " as ",
|
|
32793
|
-
|
|
32953
|
+
path3.call(print2, "typeAnnotation")
|
|
32794
32954
|
);
|
|
32795
32955
|
return concat(parts);
|
|
32796
32956
|
}
|
|
32797
32957
|
case "TSTypeCastExpression":
|
|
32798
32958
|
return concat([
|
|
32799
|
-
|
|
32800
|
-
|
|
32959
|
+
path3.call(print2, "expression"),
|
|
32960
|
+
path3.call(print2, "typeAnnotation")
|
|
32801
32961
|
]);
|
|
32802
32962
|
case "TSNonNullExpression":
|
|
32803
|
-
return concat([
|
|
32963
|
+
return concat([path3.call(print2, "expression"), "!"]);
|
|
32804
32964
|
case "TSTypeAnnotation":
|
|
32805
|
-
return concat([": ",
|
|
32965
|
+
return concat([": ", path3.call(print2, "typeAnnotation")]);
|
|
32806
32966
|
case "TSIndexSignature":
|
|
32807
32967
|
return concat([
|
|
32808
32968
|
n2.readonly ? "readonly " : "",
|
|
32809
32969
|
"[",
|
|
32810
|
-
|
|
32970
|
+
path3.map(print2, "parameters"),
|
|
32811
32971
|
"]",
|
|
32812
|
-
|
|
32972
|
+
path3.call(print2, "typeAnnotation")
|
|
32813
32973
|
]);
|
|
32814
32974
|
case "TSPropertySignature":
|
|
32815
|
-
parts.push(printVariance(
|
|
32975
|
+
parts.push(printVariance(path3, print2), n2.readonly ? "readonly " : "");
|
|
32816
32976
|
if (n2.computed) {
|
|
32817
|
-
parts.push("[",
|
|
32977
|
+
parts.push("[", path3.call(print2, "key"), "]");
|
|
32818
32978
|
} else {
|
|
32819
|
-
parts.push(
|
|
32979
|
+
parts.push(path3.call(print2, "key"));
|
|
32820
32980
|
}
|
|
32821
|
-
parts.push(n2.optional ? "?" : "",
|
|
32981
|
+
parts.push(n2.optional ? "?" : "", path3.call(print2, "typeAnnotation"));
|
|
32822
32982
|
return concat(parts);
|
|
32823
32983
|
case "TSMethodSignature":
|
|
32824
32984
|
if (n2.computed) {
|
|
32825
|
-
parts.push("[",
|
|
32985
|
+
parts.push("[", path3.call(print2, "key"), "]");
|
|
32826
32986
|
} else {
|
|
32827
|
-
parts.push(
|
|
32987
|
+
parts.push(path3.call(print2, "key"));
|
|
32828
32988
|
}
|
|
32829
32989
|
if (n2.optional) {
|
|
32830
32990
|
parts.push("?");
|
|
32831
32991
|
}
|
|
32832
32992
|
parts.push(
|
|
32833
|
-
|
|
32993
|
+
path3.call(print2, "typeParameters"),
|
|
32834
32994
|
"(",
|
|
32835
|
-
printFunctionParams(
|
|
32995
|
+
printFunctionParams(path3, options, print2),
|
|
32836
32996
|
")",
|
|
32837
|
-
|
|
32997
|
+
path3.call(print2, "typeAnnotation")
|
|
32838
32998
|
);
|
|
32839
32999
|
return concat(parts);
|
|
32840
33000
|
case "TSTypePredicate":
|
|
32841
33001
|
if (n2.asserts) {
|
|
32842
33002
|
parts.push("asserts ");
|
|
32843
33003
|
}
|
|
32844
|
-
parts.push(
|
|
33004
|
+
parts.push(path3.call(print2, "parameterName"));
|
|
32845
33005
|
if (n2.typeAnnotation) {
|
|
32846
33006
|
parts.push(
|
|
32847
33007
|
" is ",
|
|
32848
|
-
|
|
33008
|
+
path3.call(print2, "typeAnnotation", "typeAnnotation")
|
|
32849
33009
|
);
|
|
32850
33010
|
}
|
|
32851
33011
|
return concat(parts);
|
|
32852
33012
|
case "TSCallSignatureDeclaration":
|
|
32853
33013
|
return concat([
|
|
32854
|
-
|
|
33014
|
+
path3.call(print2, "typeParameters"),
|
|
32855
33015
|
"(",
|
|
32856
|
-
printFunctionParams(
|
|
33016
|
+
printFunctionParams(path3, options, print2),
|
|
32857
33017
|
")",
|
|
32858
|
-
|
|
33018
|
+
path3.call(print2, "typeAnnotation")
|
|
32859
33019
|
]);
|
|
32860
33020
|
case "TSConstructSignatureDeclaration":
|
|
32861
33021
|
if (n2.typeParameters) {
|
|
32862
|
-
parts.push("new",
|
|
33022
|
+
parts.push("new", path3.call(print2, "typeParameters"));
|
|
32863
33023
|
} else {
|
|
32864
33024
|
parts.push("new ");
|
|
32865
33025
|
}
|
|
32866
33026
|
parts.push(
|
|
32867
33027
|
"(",
|
|
32868
|
-
printFunctionParams(
|
|
33028
|
+
printFunctionParams(path3, options, print2),
|
|
32869
33029
|
")",
|
|
32870
|
-
|
|
33030
|
+
path3.call(print2, "typeAnnotation")
|
|
32871
33031
|
);
|
|
32872
33032
|
return concat(parts);
|
|
32873
33033
|
case "TSTypeAliasDeclaration":
|
|
32874
33034
|
return concat([
|
|
32875
33035
|
n2.declare ? "declare " : "",
|
|
32876
33036
|
"type ",
|
|
32877
|
-
|
|
32878
|
-
|
|
33037
|
+
path3.call(print2, "id"),
|
|
33038
|
+
path3.call(print2, "typeParameters"),
|
|
32879
33039
|
" = ",
|
|
32880
|
-
|
|
33040
|
+
path3.call(print2, "typeAnnotation"),
|
|
32881
33041
|
";"
|
|
32882
33042
|
]);
|
|
32883
33043
|
case "TSTypeParameter": {
|
|
32884
|
-
parts.push(
|
|
32885
|
-
const parent =
|
|
33044
|
+
parts.push(path3.call(print2, "name"));
|
|
33045
|
+
const parent = path3.getParentNode(0);
|
|
32886
33046
|
const isInMappedType = namedTypes.TSMappedType.check(parent);
|
|
32887
33047
|
if (n2.constraint) {
|
|
32888
33048
|
parts.push(
|
|
32889
33049
|
isInMappedType ? " in " : " extends ",
|
|
32890
|
-
|
|
33050
|
+
path3.call(print2, "constraint")
|
|
32891
33051
|
);
|
|
32892
33052
|
}
|
|
32893
33053
|
if (n2["default"]) {
|
|
32894
|
-
parts.push(" = ",
|
|
33054
|
+
parts.push(" = ", path3.call(print2, "default"));
|
|
32895
33055
|
}
|
|
32896
33056
|
return concat(parts);
|
|
32897
33057
|
}
|
|
32898
33058
|
case "TSTypeAssertion": {
|
|
32899
33059
|
parts.push(
|
|
32900
33060
|
"<",
|
|
32901
|
-
|
|
33061
|
+
path3.call(print2, "typeAnnotation"),
|
|
32902
33062
|
"> ",
|
|
32903
|
-
|
|
33063
|
+
path3.call(print2, "expression")
|
|
32904
33064
|
);
|
|
32905
33065
|
return concat(parts);
|
|
32906
33066
|
}
|
|
@@ -32908,7 +33068,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32908
33068
|
case "TSTypeParameterInstantiation":
|
|
32909
33069
|
return concat([
|
|
32910
33070
|
"<",
|
|
32911
|
-
fromString(", ").join(
|
|
33071
|
+
fromString(", ").join(path3.map(print2, "params")),
|
|
32912
33072
|
">"
|
|
32913
33073
|
]);
|
|
32914
33074
|
case "TSEnumDeclaration": {
|
|
@@ -32916,9 +33076,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32916
33076
|
n2.declare ? "declare " : "",
|
|
32917
33077
|
n2.const ? "const " : "",
|
|
32918
33078
|
"enum ",
|
|
32919
|
-
|
|
33079
|
+
path3.call(print2, "id")
|
|
32920
33080
|
);
|
|
32921
|
-
const memberLines = fromString(",\n").join(
|
|
33081
|
+
const memberLines = fromString(",\n").join(path3.map(print2, "members"));
|
|
32922
33082
|
if (memberLines.isEmpty()) {
|
|
32923
33083
|
parts.push(" {}");
|
|
32924
33084
|
} else {
|
|
@@ -32928,12 +33088,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32928
33088
|
}
|
|
32929
33089
|
case "TSExpressionWithTypeArguments":
|
|
32930
33090
|
return concat([
|
|
32931
|
-
|
|
32932
|
-
|
|
33091
|
+
path3.call(print2, "expression"),
|
|
33092
|
+
path3.call(print2, "typeParameters")
|
|
32933
33093
|
]);
|
|
32934
33094
|
case "TSInterfaceBody": {
|
|
32935
33095
|
const lines = fromString("\n").join(
|
|
32936
|
-
|
|
33096
|
+
path3.map(print2, "body").map((element) => {
|
|
32937
33097
|
if (lastNonSpaceCharacter(element) !== ";") {
|
|
32938
33098
|
return element.concat(";");
|
|
32939
33099
|
}
|
|
@@ -32946,12 +33106,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32946
33106
|
return concat(["{\n", lines.indent(options.tabWidth), "\n}"]);
|
|
32947
33107
|
}
|
|
32948
33108
|
case "TSImportType":
|
|
32949
|
-
parts.push("import(",
|
|
33109
|
+
parts.push("import(", path3.call(print2, "argument"), ")");
|
|
32950
33110
|
if (n2.qualifier) {
|
|
32951
|
-
parts.push(".",
|
|
33111
|
+
parts.push(".", path3.call(print2, "qualifier"));
|
|
32952
33112
|
}
|
|
32953
33113
|
if (n2.typeParameters) {
|
|
32954
|
-
parts.push(
|
|
33114
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
32955
33115
|
}
|
|
32956
33116
|
return concat(parts);
|
|
32957
33117
|
case "TSImportEqualsDeclaration":
|
|
@@ -32960,15 +33120,15 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32960
33120
|
}
|
|
32961
33121
|
parts.push(
|
|
32962
33122
|
"import ",
|
|
32963
|
-
|
|
33123
|
+
path3.call(print2, "id"),
|
|
32964
33124
|
" = ",
|
|
32965
|
-
|
|
33125
|
+
path3.call(print2, "moduleReference")
|
|
32966
33126
|
);
|
|
32967
33127
|
return maybeAddSemicolon(concat(parts));
|
|
32968
33128
|
case "TSExternalModuleReference":
|
|
32969
|
-
return concat(["require(",
|
|
33129
|
+
return concat(["require(", path3.call(print2, "expression"), ")"]);
|
|
32970
33130
|
case "TSModuleDeclaration": {
|
|
32971
|
-
const parent =
|
|
33131
|
+
const parent = path3.getParentNode();
|
|
32972
33132
|
if (parent.type === "TSModuleDeclaration") {
|
|
32973
33133
|
parts.push(".");
|
|
32974
33134
|
} else {
|
|
@@ -32991,15 +33151,15 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32991
33151
|
}
|
|
32992
33152
|
}
|
|
32993
33153
|
}
|
|
32994
|
-
parts.push(
|
|
33154
|
+
parts.push(path3.call(print2, "id"));
|
|
32995
33155
|
if (n2.body) {
|
|
32996
33156
|
parts.push(" ");
|
|
32997
|
-
parts.push(
|
|
33157
|
+
parts.push(path3.call(print2, "body"));
|
|
32998
33158
|
}
|
|
32999
33159
|
return concat(parts);
|
|
33000
33160
|
}
|
|
33001
33161
|
case "TSModuleBlock": {
|
|
33002
|
-
const naked =
|
|
33162
|
+
const naked = path3.call(
|
|
33003
33163
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
33004
33164
|
"body"
|
|
33005
33165
|
);
|
|
@@ -33012,13 +33172,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
33012
33172
|
}
|
|
33013
33173
|
case "TSInstantiationExpression": {
|
|
33014
33174
|
parts.push(
|
|
33015
|
-
|
|
33016
|
-
|
|
33175
|
+
path3.call(print2, "expression"),
|
|
33176
|
+
path3.call(print2, "typeParameters")
|
|
33017
33177
|
);
|
|
33018
33178
|
return concat(parts);
|
|
33019
33179
|
}
|
|
33020
33180
|
case "V8IntrinsicIdentifier":
|
|
33021
|
-
return concat(["%",
|
|
33181
|
+
return concat(["%", path3.call(print2, "name")]);
|
|
33022
33182
|
case "TopicReference":
|
|
33023
33183
|
return fromString("#");
|
|
33024
33184
|
case "ClassHeritage":
|
|
@@ -33054,17 +33214,17 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
33054
33214
|
throw new Error("unknown type: " + JSON.stringify(n2.type));
|
|
33055
33215
|
}
|
|
33056
33216
|
}
|
|
33057
|
-
function printDecorators(
|
|
33217
|
+
function printDecorators(path3, printPath) {
|
|
33058
33218
|
const parts = [];
|
|
33059
|
-
const node =
|
|
33219
|
+
const node = path3.getValue();
|
|
33060
33220
|
if (node.decorators && node.decorators.length > 0 && // If the parent node is an export declaration, it will be
|
|
33061
33221
|
// responsible for printing node.decorators.
|
|
33062
|
-
!getParentExportDeclaration(
|
|
33063
|
-
|
|
33222
|
+
!getParentExportDeclaration(path3)) {
|
|
33223
|
+
path3.each(function(decoratorPath) {
|
|
33064
33224
|
parts.push(printPath(decoratorPath), "\n");
|
|
33065
33225
|
}, "decorators");
|
|
33066
33226
|
} else if (isExportDeclaration(node) && node.declaration && node.declaration.decorators) {
|
|
33067
|
-
|
|
33227
|
+
path3.each(
|
|
33068
33228
|
function(decoratorPath) {
|
|
33069
33229
|
parts.push(printPath(decoratorPath), "\n");
|
|
33070
33230
|
},
|
|
@@ -33074,9 +33234,9 @@ function printDecorators(path2, printPath) {
|
|
|
33074
33234
|
}
|
|
33075
33235
|
return concat(parts);
|
|
33076
33236
|
}
|
|
33077
|
-
function printStatementSequence(
|
|
33237
|
+
function printStatementSequence(path3, options, print2) {
|
|
33078
33238
|
const filtered = [];
|
|
33079
|
-
|
|
33239
|
+
path3.each(function(stmtPath) {
|
|
33080
33240
|
const stmt = stmtPath.getValue();
|
|
33081
33241
|
if (!stmt) {
|
|
33082
33242
|
return;
|
|
@@ -33182,8 +33342,8 @@ function printClassMemberModifiers(node) {
|
|
|
33182
33342
|
}
|
|
33183
33343
|
return parts;
|
|
33184
33344
|
}
|
|
33185
|
-
function printMethod(
|
|
33186
|
-
const node =
|
|
33345
|
+
function printMethod(path3, options, print2) {
|
|
33346
|
+
const node = path3.getNode();
|
|
33187
33347
|
const kind = node.kind;
|
|
33188
33348
|
const parts = [];
|
|
33189
33349
|
let nodeValue = node.value;
|
|
@@ -33200,7 +33360,7 @@ function printMethod(path2, options, print2) {
|
|
|
33200
33360
|
if (kind === "get" || kind === "set") {
|
|
33201
33361
|
parts.push(kind, " ");
|
|
33202
33362
|
}
|
|
33203
|
-
let key =
|
|
33363
|
+
let key = path3.call(print2, "key");
|
|
33204
33364
|
if (node.computed) {
|
|
33205
33365
|
key = concat(["[", key, "]"]);
|
|
33206
33366
|
}
|
|
@@ -33210,38 +33370,38 @@ function printMethod(path2, options, print2) {
|
|
|
33210
33370
|
}
|
|
33211
33371
|
if (node === nodeValue) {
|
|
33212
33372
|
parts.push(
|
|
33213
|
-
|
|
33373
|
+
path3.call(print2, "typeParameters"),
|
|
33214
33374
|
"(",
|
|
33215
|
-
printFunctionParams(
|
|
33375
|
+
printFunctionParams(path3, options, print2),
|
|
33216
33376
|
")",
|
|
33217
|
-
|
|
33377
|
+
path3.call(print2, "returnType")
|
|
33218
33378
|
);
|
|
33219
33379
|
if (node.body) {
|
|
33220
|
-
parts.push(" ",
|
|
33380
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
33221
33381
|
} else {
|
|
33222
33382
|
parts.push(";");
|
|
33223
33383
|
}
|
|
33224
33384
|
} else {
|
|
33225
33385
|
parts.push(
|
|
33226
|
-
|
|
33386
|
+
path3.call(print2, "value", "typeParameters"),
|
|
33227
33387
|
"(",
|
|
33228
|
-
|
|
33388
|
+
path3.call(
|
|
33229
33389
|
(valuePath) => printFunctionParams(valuePath, options, print2),
|
|
33230
33390
|
"value"
|
|
33231
33391
|
),
|
|
33232
33392
|
")",
|
|
33233
|
-
|
|
33393
|
+
path3.call(print2, "value", "returnType")
|
|
33234
33394
|
);
|
|
33235
33395
|
if (nodeValue.body) {
|
|
33236
|
-
parts.push(" ",
|
|
33396
|
+
parts.push(" ", path3.call(print2, "value", "body"));
|
|
33237
33397
|
} else {
|
|
33238
33398
|
parts.push(";");
|
|
33239
33399
|
}
|
|
33240
33400
|
}
|
|
33241
33401
|
return concat(parts);
|
|
33242
33402
|
}
|
|
33243
|
-
function printArgumentsList(
|
|
33244
|
-
const printed =
|
|
33403
|
+
function printArgumentsList(path3, options, print2) {
|
|
33404
|
+
const printed = path3.map(print2, "arguments");
|
|
33245
33405
|
const trailingComma = isTrailingCommaEnabled(options, "parameters");
|
|
33246
33406
|
let joined = fromString(", ").join(printed);
|
|
33247
33407
|
if (joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -33254,19 +33414,19 @@ function printArgumentsList(path2, options, print2) {
|
|
|
33254
33414
|
}
|
|
33255
33415
|
return concat(["(", joined, ")"]);
|
|
33256
33416
|
}
|
|
33257
|
-
function printFunctionParams(
|
|
33258
|
-
const fun =
|
|
33417
|
+
function printFunctionParams(path3, options, print2) {
|
|
33418
|
+
const fun = path3.getValue();
|
|
33259
33419
|
let params;
|
|
33260
33420
|
let printed = [];
|
|
33261
33421
|
if (fun.params) {
|
|
33262
33422
|
params = fun.params;
|
|
33263
|
-
printed =
|
|
33423
|
+
printed = path3.map(print2, "params");
|
|
33264
33424
|
} else if (fun.parameters) {
|
|
33265
33425
|
params = fun.parameters;
|
|
33266
|
-
printed =
|
|
33426
|
+
printed = path3.map(print2, "parameters");
|
|
33267
33427
|
}
|
|
33268
33428
|
if (fun.defaults) {
|
|
33269
|
-
|
|
33429
|
+
path3.each(function(defExprPath) {
|
|
33270
33430
|
const i = defExprPath.getName();
|
|
33271
33431
|
const p = printed[i];
|
|
33272
33432
|
if (p && defExprPath.getValue()) {
|
|
@@ -33275,7 +33435,7 @@ function printFunctionParams(path2, options, print2) {
|
|
|
33275
33435
|
}, "defaults");
|
|
33276
33436
|
}
|
|
33277
33437
|
if (fun.rest) {
|
|
33278
|
-
printed.push(concat(["...",
|
|
33438
|
+
printed.push(concat(["...", path3.call(print2, "rest")]));
|
|
33279
33439
|
}
|
|
33280
33440
|
let joined = fromString(", ").join(printed);
|
|
33281
33441
|
if (joined.length > 1 || joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -33289,11 +33449,11 @@ function printFunctionParams(path2, options, print2) {
|
|
|
33289
33449
|
}
|
|
33290
33450
|
return joined;
|
|
33291
33451
|
}
|
|
33292
|
-
function maybePrintImportAssertions(
|
|
33293
|
-
const n2 =
|
|
33452
|
+
function maybePrintImportAssertions(path3, options, print2) {
|
|
33453
|
+
const n2 = path3.getValue();
|
|
33294
33454
|
if (n2.assertions && n2.assertions.length > 0) {
|
|
33295
33455
|
const parts = [" assert {"];
|
|
33296
|
-
const printed =
|
|
33456
|
+
const printed = path3.map(print2, "assertions");
|
|
33297
33457
|
const flat = fromString(", ").join(printed);
|
|
33298
33458
|
if (flat.length > 1 || flat.getLineLength(1) > options.wrapColumn) {
|
|
33299
33459
|
parts.push(
|
|
@@ -33308,8 +33468,8 @@ function maybePrintImportAssertions(path2, options, print2) {
|
|
|
33308
33468
|
}
|
|
33309
33469
|
return fromString("");
|
|
33310
33470
|
}
|
|
33311
|
-
function printExportDeclaration(
|
|
33312
|
-
const decl =
|
|
33471
|
+
function printExportDeclaration(path3, options, print2) {
|
|
33472
|
+
const decl = path3.getValue();
|
|
33313
33473
|
const parts = ["export "];
|
|
33314
33474
|
if (decl.exportKind && decl.exportKind === "type") {
|
|
33315
33475
|
if (!decl.declaration) {
|
|
@@ -33322,7 +33482,7 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33322
33482
|
parts.push("default ");
|
|
33323
33483
|
}
|
|
33324
33484
|
if (decl.declaration) {
|
|
33325
|
-
parts.push(
|
|
33485
|
+
parts.push(path3.call(print2, "declaration"));
|
|
33326
33486
|
} else if (decl.specifiers) {
|
|
33327
33487
|
if (decl.specifiers.length === 1 && decl.specifiers[0].type === "ExportBatchSpecifier") {
|
|
33328
33488
|
parts.push("*");
|
|
@@ -33331,7 +33491,7 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33331
33491
|
} else if (decl.specifiers[0].type === "ExportDefaultSpecifier") {
|
|
33332
33492
|
const unbracedSpecifiers = [];
|
|
33333
33493
|
const bracedSpecifiers = [];
|
|
33334
|
-
|
|
33494
|
+
path3.each(function(specifierPath) {
|
|
33335
33495
|
const spec = specifierPath.getValue();
|
|
33336
33496
|
if (spec.type === "ExportDefaultSpecifier") {
|
|
33337
33497
|
unbracedSpecifiers.push(print2(specifierPath));
|
|
@@ -33367,15 +33527,15 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33367
33527
|
} else {
|
|
33368
33528
|
parts.push(
|
|
33369
33529
|
shouldPrintSpaces ? "{ " : "{",
|
|
33370
|
-
fromString(", ").join(
|
|
33530
|
+
fromString(", ").join(path3.map(print2, "specifiers")),
|
|
33371
33531
|
shouldPrintSpaces ? " }" : "}"
|
|
33372
33532
|
);
|
|
33373
33533
|
}
|
|
33374
33534
|
if (decl.source) {
|
|
33375
33535
|
parts.push(
|
|
33376
33536
|
" from ",
|
|
33377
|
-
|
|
33378
|
-
maybePrintImportAssertions(
|
|
33537
|
+
path3.call(print2, "source"),
|
|
33538
|
+
maybePrintImportAssertions(path3, options, print2)
|
|
33379
33539
|
);
|
|
33380
33540
|
}
|
|
33381
33541
|
}
|
|
@@ -33385,8 +33545,8 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33385
33545
|
}
|
|
33386
33546
|
return lines;
|
|
33387
33547
|
}
|
|
33388
|
-
function printFlowDeclaration(
|
|
33389
|
-
const parentExportDecl = getParentExportDeclaration(
|
|
33548
|
+
function printFlowDeclaration(path3, parts) {
|
|
33549
|
+
const parentExportDecl = getParentExportDeclaration(path3);
|
|
33390
33550
|
if (parentExportDecl)
|
|
33391
33551
|
;
|
|
33392
33552
|
else {
|
|
@@ -33394,8 +33554,8 @@ function printFlowDeclaration(path2, parts) {
|
|
|
33394
33554
|
}
|
|
33395
33555
|
return concat(parts);
|
|
33396
33556
|
}
|
|
33397
|
-
function printVariance(
|
|
33398
|
-
return
|
|
33557
|
+
function printVariance(path3, print2) {
|
|
33558
|
+
return path3.call(function(variancePath) {
|
|
33399
33559
|
const value = variancePath.getValue();
|
|
33400
33560
|
if (value) {
|
|
33401
33561
|
if (value === "plus") {
|
|
@@ -34567,6 +34727,7 @@ function resolveOptions(options) {
|
|
|
34567
34727
|
|
|
34568
34728
|
// src/core/compress.ts
|
|
34569
34729
|
import fs2 from "node:fs";
|
|
34730
|
+
import path2 from "node:path";
|
|
34570
34731
|
import process4 from "node:process";
|
|
34571
34732
|
import archiver from "archiver";
|
|
34572
34733
|
|
|
@@ -35076,23 +35237,35 @@ var Log = class {
|
|
|
35076
35237
|
// src/core/compress.ts
|
|
35077
35238
|
async function createCompress(options) {
|
|
35078
35239
|
const { outDir, ignoreBase } = options;
|
|
35079
|
-
const zipFilePath = `${outDir}.zip
|
|
35240
|
+
const zipFilePath = path2.resolve(process4.cwd(), `${path2.basename(outDir)}.zip`);
|
|
35080
35241
|
Log.log("Compressing the directory", outDir);
|
|
35081
|
-
|
|
35082
|
-
|
|
35083
|
-
|
|
35084
|
-
|
|
35085
|
-
|
|
35086
|
-
|
|
35087
|
-
|
|
35088
|
-
|
|
35089
|
-
|
|
35090
|
-
|
|
35091
|
-
|
|
35092
|
-
|
|
35093
|
-
|
|
35094
|
-
|
|
35095
|
-
|
|
35242
|
+
return new Promise((resolve2, reject) => {
|
|
35243
|
+
try {
|
|
35244
|
+
const output = fs2.createWriteStream(zipFilePath);
|
|
35245
|
+
const archive = archiver("zip");
|
|
35246
|
+
output.on("close", () => {
|
|
35247
|
+
Log.success("Successfully compressed to", `${zipFilePath} (${archive.pointer()} bytes)`);
|
|
35248
|
+
resolve2(null);
|
|
35249
|
+
});
|
|
35250
|
+
archive.on("warning", (err) => {
|
|
35251
|
+
if (err.code === "ENOENT")
|
|
35252
|
+
Log.log("File not found during compression:", err.message);
|
|
35253
|
+
else
|
|
35254
|
+
Log.log("Compression warning:", err.message);
|
|
35255
|
+
});
|
|
35256
|
+
archive.on("error", (err) => {
|
|
35257
|
+
Log.error("Compression error:", err);
|
|
35258
|
+
reject(err);
|
|
35259
|
+
});
|
|
35260
|
+
archive.pipe(output);
|
|
35261
|
+
const absoluteOutDir = path2.resolve(outDir);
|
|
35262
|
+
archive.directory(absoluteOutDir, ignoreBase ? false : path2.basename(outDir));
|
|
35263
|
+
archive.finalize();
|
|
35264
|
+
} catch (error) {
|
|
35265
|
+
Log.error("Error compressing the directory", error);
|
|
35266
|
+
throw error;
|
|
35267
|
+
}
|
|
35268
|
+
});
|
|
35096
35269
|
}
|
|
35097
35270
|
|
|
35098
35271
|
// src/index.ts
|
|
@@ -35144,6 +35317,7 @@ var unpluginFactory = (options = {}) => {
|
|
|
35144
35317
|
process5.on("beforeExit", async () => {
|
|
35145
35318
|
const { compress } = resolved;
|
|
35146
35319
|
await createCompress(compress);
|
|
35320
|
+
process5.exit(0);
|
|
35147
35321
|
});
|
|
35148
35322
|
}
|
|
35149
35323
|
}];
|