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
package/dist/index.cjs
CHANGED
|
@@ -107,7 +107,7 @@ var require_path = __commonJS({
|
|
|
107
107
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
108
108
|
exports2.convertPosixPathToPattern = exports2.convertWindowsPathToPattern = exports2.convertPathToPattern = exports2.escapePosixPath = exports2.escapeWindowsPath = exports2.escape = exports2.removeLeadingDotSegment = exports2.makeAbsolute = exports2.unixify = void 0;
|
|
109
109
|
var os2 = require("os");
|
|
110
|
-
var
|
|
110
|
+
var path3 = require("path");
|
|
111
111
|
var IS_WINDOWS_PLATFORM = os2.platform() === "win32";
|
|
112
112
|
var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
113
113
|
var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
|
@@ -119,7 +119,7 @@ var require_path = __commonJS({
|
|
|
119
119
|
}
|
|
120
120
|
exports2.unixify = unixify;
|
|
121
121
|
function makeAbsolute(cwd, filepath) {
|
|
122
|
-
return
|
|
122
|
+
return path3.resolve(cwd, filepath);
|
|
123
123
|
}
|
|
124
124
|
exports2.makeAbsolute = makeAbsolute;
|
|
125
125
|
function removeLeadingDotSegment(entry) {
|
|
@@ -1442,7 +1442,7 @@ var require_braces = __commonJS({
|
|
|
1442
1442
|
var require_constants2 = __commonJS({
|
|
1443
1443
|
"node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports2, module2) {
|
|
1444
1444
|
"use strict";
|
|
1445
|
-
var
|
|
1445
|
+
var path3 = require("path");
|
|
1446
1446
|
var WIN_SLASH = "\\\\/";
|
|
1447
1447
|
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1448
1448
|
var DOT_LITERAL = "\\.";
|
|
@@ -1612,7 +1612,7 @@ var require_constants2 = __commonJS({
|
|
|
1612
1612
|
/* | */
|
|
1613
1613
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
1614
1614
|
/* \uFEFF */
|
|
1615
|
-
SEP:
|
|
1615
|
+
SEP: path3.sep,
|
|
1616
1616
|
/**
|
|
1617
1617
|
* Create EXTGLOB_CHARS
|
|
1618
1618
|
*/
|
|
@@ -1639,7 +1639,7 @@ var require_constants2 = __commonJS({
|
|
|
1639
1639
|
var require_utils2 = __commonJS({
|
|
1640
1640
|
"node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports2) {
|
|
1641
1641
|
"use strict";
|
|
1642
|
-
var
|
|
1642
|
+
var path3 = require("path");
|
|
1643
1643
|
var win32 = process.platform === "win32";
|
|
1644
1644
|
var {
|
|
1645
1645
|
REGEX_BACKSLASH,
|
|
@@ -1668,7 +1668,7 @@ var require_utils2 = __commonJS({
|
|
|
1668
1668
|
if (options && typeof options.windows === "boolean") {
|
|
1669
1669
|
return options.windows;
|
|
1670
1670
|
}
|
|
1671
|
-
return win32 === true ||
|
|
1671
|
+
return win32 === true || path3.sep === "\\";
|
|
1672
1672
|
};
|
|
1673
1673
|
exports2.escapeLast = (input, char, lastIdx) => {
|
|
1674
1674
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
@@ -2816,7 +2816,7 @@ var require_parse2 = __commonJS({
|
|
|
2816
2816
|
var require_picomatch = __commonJS({
|
|
2817
2817
|
"node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
|
|
2818
2818
|
"use strict";
|
|
2819
|
-
var
|
|
2819
|
+
var path3 = require("path");
|
|
2820
2820
|
var scan = require_scan();
|
|
2821
2821
|
var parse3 = require_parse2();
|
|
2822
2822
|
var utils = require_utils2();
|
|
@@ -2902,7 +2902,7 @@ var require_picomatch = __commonJS({
|
|
|
2902
2902
|
};
|
|
2903
2903
|
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
2904
2904
|
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
2905
|
-
return regex.test(
|
|
2905
|
+
return regex.test(path3.basename(input));
|
|
2906
2906
|
};
|
|
2907
2907
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
2908
2908
|
picomatch.parse = (pattern, options) => {
|
|
@@ -3132,7 +3132,7 @@ var require_pattern = __commonJS({
|
|
|
3132
3132
|
"use strict";
|
|
3133
3133
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3134
3134
|
exports2.removeDuplicateSlashes = exports2.matchAny = exports2.convertPatternsToRe = exports2.makeRe = exports2.getPatternParts = exports2.expandBraceExpansion = exports2.expandPatternsWithBraceExpansion = exports2.isAffectDepthOfReadingPattern = exports2.endsWithSlashGlobStar = exports2.hasGlobStar = exports2.getBaseDirectory = exports2.isPatternRelatedToParentDirectory = exports2.getPatternsOutsideCurrentDirectory = exports2.getPatternsInsideCurrentDirectory = exports2.getPositivePatterns = exports2.getNegativePatterns = exports2.isPositivePattern = exports2.isNegativePattern = exports2.convertToNegativePattern = exports2.convertToPositivePattern = exports2.isDynamicPattern = exports2.isStaticPattern = void 0;
|
|
3135
|
-
var
|
|
3135
|
+
var path3 = require("path");
|
|
3136
3136
|
var globParent = require_glob_parent();
|
|
3137
3137
|
var micromatch = require_micromatch();
|
|
3138
3138
|
var GLOBSTAR = "**";
|
|
@@ -3227,7 +3227,7 @@ var require_pattern = __commonJS({
|
|
|
3227
3227
|
}
|
|
3228
3228
|
exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
3229
3229
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
3230
|
-
const basename =
|
|
3230
|
+
const basename = path3.basename(pattern);
|
|
3231
3231
|
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
|
3232
3232
|
}
|
|
3233
3233
|
exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -3445,8 +3445,8 @@ var require_utils3 = __commonJS({
|
|
|
3445
3445
|
exports2.errno = errno;
|
|
3446
3446
|
var fs4 = require_fs();
|
|
3447
3447
|
exports2.fs = fs4;
|
|
3448
|
-
var
|
|
3449
|
-
exports2.path =
|
|
3448
|
+
var path3 = require_path();
|
|
3449
|
+
exports2.path = path3;
|
|
3450
3450
|
var pattern = require_pattern();
|
|
3451
3451
|
exports2.pattern = pattern;
|
|
3452
3452
|
var stream = require_stream();
|
|
@@ -3558,8 +3558,8 @@ var require_async = __commonJS({
|
|
|
3558
3558
|
"use strict";
|
|
3559
3559
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3560
3560
|
exports2.read = void 0;
|
|
3561
|
-
function read(
|
|
3562
|
-
settings.fs.lstat(
|
|
3561
|
+
function read(path3, settings, callback) {
|
|
3562
|
+
settings.fs.lstat(path3, (lstatError, lstat) => {
|
|
3563
3563
|
if (lstatError !== null) {
|
|
3564
3564
|
callFailureCallback(callback, lstatError);
|
|
3565
3565
|
return;
|
|
@@ -3568,7 +3568,7 @@ var require_async = __commonJS({
|
|
|
3568
3568
|
callSuccessCallback(callback, lstat);
|
|
3569
3569
|
return;
|
|
3570
3570
|
}
|
|
3571
|
-
settings.fs.stat(
|
|
3571
|
+
settings.fs.stat(path3, (statError, stat) => {
|
|
3572
3572
|
if (statError !== null) {
|
|
3573
3573
|
if (settings.throwErrorOnBrokenSymbolicLink) {
|
|
3574
3574
|
callFailureCallback(callback, statError);
|
|
@@ -3600,13 +3600,13 @@ var require_sync = __commonJS({
|
|
|
3600
3600
|
"use strict";
|
|
3601
3601
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3602
3602
|
exports2.read = void 0;
|
|
3603
|
-
function read(
|
|
3604
|
-
const lstat = settings.fs.lstatSync(
|
|
3603
|
+
function read(path3, settings) {
|
|
3604
|
+
const lstat = settings.fs.lstatSync(path3);
|
|
3605
3605
|
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
|
3606
3606
|
return lstat;
|
|
3607
3607
|
}
|
|
3608
3608
|
try {
|
|
3609
|
-
const stat = settings.fs.statSync(
|
|
3609
|
+
const stat = settings.fs.statSync(path3);
|
|
3610
3610
|
if (settings.markSymbolicLink) {
|
|
3611
3611
|
stat.isSymbolicLink = () => true;
|
|
3612
3612
|
}
|
|
@@ -3677,17 +3677,17 @@ var require_out = __commonJS({
|
|
|
3677
3677
|
var sync = require_sync();
|
|
3678
3678
|
var settings_1 = require_settings();
|
|
3679
3679
|
exports2.Settings = settings_1.default;
|
|
3680
|
-
function stat(
|
|
3680
|
+
function stat(path3, optionsOrSettingsOrCallback, callback) {
|
|
3681
3681
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
3682
|
-
async.read(
|
|
3682
|
+
async.read(path3, getSettings(), optionsOrSettingsOrCallback);
|
|
3683
3683
|
return;
|
|
3684
3684
|
}
|
|
3685
|
-
async.read(
|
|
3685
|
+
async.read(path3, getSettings(optionsOrSettingsOrCallback), callback);
|
|
3686
3686
|
}
|
|
3687
3687
|
exports2.stat = stat;
|
|
3688
|
-
function statSync(
|
|
3688
|
+
function statSync(path3, optionsOrSettings) {
|
|
3689
3689
|
const settings = getSettings(optionsOrSettings);
|
|
3690
|
-
return sync.read(
|
|
3690
|
+
return sync.read(path3, settings);
|
|
3691
3691
|
}
|
|
3692
3692
|
exports2.statSync = statSync;
|
|
3693
3693
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -3908,16 +3908,16 @@ var require_async2 = __commonJS({
|
|
|
3908
3908
|
return;
|
|
3909
3909
|
}
|
|
3910
3910
|
const tasks = names.map((name) => {
|
|
3911
|
-
const
|
|
3911
|
+
const path3 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
|
3912
3912
|
return (done) => {
|
|
3913
|
-
fsStat.stat(
|
|
3913
|
+
fsStat.stat(path3, settings.fsStatSettings, (error, stats) => {
|
|
3914
3914
|
if (error !== null) {
|
|
3915
3915
|
done(error);
|
|
3916
3916
|
return;
|
|
3917
3917
|
}
|
|
3918
3918
|
const entry = {
|
|
3919
3919
|
name,
|
|
3920
|
-
path:
|
|
3920
|
+
path: path3,
|
|
3921
3921
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
3922
3922
|
};
|
|
3923
3923
|
if (settings.stats) {
|
|
@@ -4035,7 +4035,7 @@ var require_settings2 = __commonJS({
|
|
|
4035
4035
|
"node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) {
|
|
4036
4036
|
"use strict";
|
|
4037
4037
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4038
|
-
var
|
|
4038
|
+
var path3 = require("path");
|
|
4039
4039
|
var fsStat = require_out();
|
|
4040
4040
|
var fs4 = require_fs4();
|
|
4041
4041
|
var Settings = class {
|
|
@@ -4043,7 +4043,7 @@ var require_settings2 = __commonJS({
|
|
|
4043
4043
|
this._options = _options;
|
|
4044
4044
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
4045
4045
|
this.fs = fs4.createFileSystemAdapter(this._options.fs);
|
|
4046
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
4046
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path3.sep);
|
|
4047
4047
|
this.stats = this._getValue(this._options.stats, false);
|
|
4048
4048
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
4049
4049
|
this.fsStatSettings = new fsStat.Settings({
|
|
@@ -4070,17 +4070,17 @@ var require_out2 = __commonJS({
|
|
|
4070
4070
|
var sync = require_sync2();
|
|
4071
4071
|
var settings_1 = require_settings2();
|
|
4072
4072
|
exports2.Settings = settings_1.default;
|
|
4073
|
-
function scandir(
|
|
4073
|
+
function scandir(path3, optionsOrSettingsOrCallback, callback) {
|
|
4074
4074
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
4075
|
-
async.read(
|
|
4075
|
+
async.read(path3, getSettings(), optionsOrSettingsOrCallback);
|
|
4076
4076
|
return;
|
|
4077
4077
|
}
|
|
4078
|
-
async.read(
|
|
4078
|
+
async.read(path3, getSettings(optionsOrSettingsOrCallback), callback);
|
|
4079
4079
|
}
|
|
4080
4080
|
exports2.scandir = scandir;
|
|
4081
|
-
function scandirSync(
|
|
4081
|
+
function scandirSync(path3, optionsOrSettings) {
|
|
4082
4082
|
const settings = getSettings(optionsOrSettings);
|
|
4083
|
-
return sync.read(
|
|
4083
|
+
return sync.read(path3, settings);
|
|
4084
4084
|
}
|
|
4085
4085
|
exports2.scandirSync = scandirSync;
|
|
4086
4086
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -4704,7 +4704,7 @@ var require_settings3 = __commonJS({
|
|
|
4704
4704
|
"node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js"(exports2) {
|
|
4705
4705
|
"use strict";
|
|
4706
4706
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4707
|
-
var
|
|
4707
|
+
var path3 = require("path");
|
|
4708
4708
|
var fsScandir = require_out2();
|
|
4709
4709
|
var Settings = class {
|
|
4710
4710
|
constructor(_options = {}) {
|
|
@@ -4714,7 +4714,7 @@ var require_settings3 = __commonJS({
|
|
|
4714
4714
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
4715
4715
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
4716
4716
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
4717
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
4717
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path3.sep);
|
|
4718
4718
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
4719
4719
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
4720
4720
|
fs: this._options.fs,
|
|
@@ -4776,7 +4776,7 @@ var require_reader2 = __commonJS({
|
|
|
4776
4776
|
"node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/readers/reader.js"(exports2) {
|
|
4777
4777
|
"use strict";
|
|
4778
4778
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4779
|
-
var
|
|
4779
|
+
var path3 = require("path");
|
|
4780
4780
|
var fsStat = require_out();
|
|
4781
4781
|
var utils = require_utils3();
|
|
4782
4782
|
var Reader = class {
|
|
@@ -4789,7 +4789,7 @@ var require_reader2 = __commonJS({
|
|
|
4789
4789
|
});
|
|
4790
4790
|
}
|
|
4791
4791
|
_getFullEntryPath(filepath) {
|
|
4792
|
-
return
|
|
4792
|
+
return path3.resolve(this._settings.cwd, filepath);
|
|
4793
4793
|
}
|
|
4794
4794
|
_makeEntry(stats, pattern) {
|
|
4795
4795
|
const entry = {
|
|
@@ -5183,7 +5183,7 @@ var require_provider = __commonJS({
|
|
|
5183
5183
|
"node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/provider.js"(exports2) {
|
|
5184
5184
|
"use strict";
|
|
5185
5185
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5186
|
-
var
|
|
5186
|
+
var path3 = require("path");
|
|
5187
5187
|
var deep_1 = require_deep();
|
|
5188
5188
|
var entry_1 = require_entry();
|
|
5189
5189
|
var error_1 = require_error();
|
|
@@ -5197,7 +5197,7 @@ var require_provider = __commonJS({
|
|
|
5197
5197
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
5198
5198
|
}
|
|
5199
5199
|
_getRootDirectory(task) {
|
|
5200
|
-
return
|
|
5200
|
+
return path3.resolve(this._settings.cwd, task.base);
|
|
5201
5201
|
}
|
|
5202
5202
|
_getReaderOptions(task) {
|
|
5203
5203
|
const basePath = task.base === "." ? "" : task.base;
|
|
@@ -5705,27 +5705,27 @@ var require_util = __commonJS({
|
|
|
5705
5705
|
};
|
|
5706
5706
|
}
|
|
5707
5707
|
var normalize2 = lruMemoize(function normalize3(aPath) {
|
|
5708
|
-
var
|
|
5708
|
+
var path3 = aPath;
|
|
5709
5709
|
var url = urlParse(aPath);
|
|
5710
5710
|
if (url) {
|
|
5711
5711
|
if (!url.path) {
|
|
5712
5712
|
return aPath;
|
|
5713
5713
|
}
|
|
5714
|
-
|
|
5714
|
+
path3 = url.path;
|
|
5715
5715
|
}
|
|
5716
|
-
var isAbsolute = exports2.isAbsolute(
|
|
5716
|
+
var isAbsolute = exports2.isAbsolute(path3);
|
|
5717
5717
|
var parts = [];
|
|
5718
5718
|
var start = 0;
|
|
5719
5719
|
var i = 0;
|
|
5720
5720
|
while (true) {
|
|
5721
5721
|
start = i;
|
|
5722
|
-
i =
|
|
5722
|
+
i = path3.indexOf("/", start);
|
|
5723
5723
|
if (i === -1) {
|
|
5724
|
-
parts.push(
|
|
5724
|
+
parts.push(path3.slice(start));
|
|
5725
5725
|
break;
|
|
5726
5726
|
} else {
|
|
5727
|
-
parts.push(
|
|
5728
|
-
while (i <
|
|
5727
|
+
parts.push(path3.slice(start, i));
|
|
5728
|
+
while (i < path3.length && path3[i] === "/") {
|
|
5729
5729
|
i++;
|
|
5730
5730
|
}
|
|
5731
5731
|
}
|
|
@@ -5746,15 +5746,15 @@ var require_util = __commonJS({
|
|
|
5746
5746
|
}
|
|
5747
5747
|
}
|
|
5748
5748
|
}
|
|
5749
|
-
|
|
5750
|
-
if (
|
|
5751
|
-
|
|
5749
|
+
path3 = parts.join("/");
|
|
5750
|
+
if (path3 === "") {
|
|
5751
|
+
path3 = isAbsolute ? "/" : ".";
|
|
5752
5752
|
}
|
|
5753
5753
|
if (url) {
|
|
5754
|
-
url.path =
|
|
5754
|
+
url.path = path3;
|
|
5755
5755
|
return urlGenerate(url);
|
|
5756
5756
|
}
|
|
5757
|
-
return
|
|
5757
|
+
return path3;
|
|
5758
5758
|
});
|
|
5759
5759
|
exports2.normalize = normalize2;
|
|
5760
5760
|
function join(aRoot, aPath) {
|
|
@@ -7444,9 +7444,9 @@ var require_source_map = __commonJS({
|
|
|
7444
7444
|
}
|
|
7445
7445
|
});
|
|
7446
7446
|
|
|
7447
|
-
// node_modules/.pnpm/@babel+parser@7.24.
|
|
7447
|
+
// node_modules/.pnpm/@babel+parser@7.24.5/node_modules/@babel/parser/lib/index.js
|
|
7448
7448
|
var require_lib = __commonJS({
|
|
7449
|
-
"node_modules/.pnpm/@babel+parser@7.24.
|
|
7449
|
+
"node_modules/.pnpm/@babel+parser@7.24.5/node_modules/@babel/parser/lib/index.js"(exports2) {
|
|
7450
7450
|
"use strict";
|
|
7451
7451
|
Object.defineProperty(exports2, "__esModule", {
|
|
7452
7452
|
value: true
|
|
@@ -7529,10 +7529,7 @@ var require_lib = __commonJS({
|
|
|
7529
7529
|
VariableDeclarator: "variable declaration",
|
|
7530
7530
|
YieldExpression: "yield expression"
|
|
7531
7531
|
};
|
|
7532
|
-
var toNodeDescription = ({
|
|
7533
|
-
type,
|
|
7534
|
-
prefix: prefix2
|
|
7535
|
-
}) => type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[String(prefix2)] : NodeDescriptions[type];
|
|
7532
|
+
var toNodeDescription = (node) => node.type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[`${node.prefix}`] : NodeDescriptions[node.type];
|
|
7536
7533
|
var StandardErrors = {
|
|
7537
7534
|
AccessorIsGenerator: ({
|
|
7538
7535
|
kind
|
|
@@ -7745,6 +7742,7 @@ var require_lib = __commonJS({
|
|
|
7745
7742
|
UnterminatedRegExp: "Unterminated regular expression.",
|
|
7746
7743
|
UnterminatedString: "Unterminated string constant.",
|
|
7747
7744
|
UnterminatedTemplate: "Unterminated template.",
|
|
7745
|
+
UsingDeclarationExport: "Using declaration cannot be exported.",
|
|
7748
7746
|
UsingDeclarationHasBindingPattern: "Using declaration cannot have destructuring patterns.",
|
|
7749
7747
|
VarRedeclaration: ({
|
|
7750
7748
|
identifierName
|
|
@@ -8032,6 +8030,11 @@ var require_lib = __commonJS({
|
|
|
8032
8030
|
}
|
|
8033
8031
|
return this.finishNode(node, "MethodDefinition");
|
|
8034
8032
|
}
|
|
8033
|
+
nameIsConstructor(key) {
|
|
8034
|
+
if (key.type === "Literal")
|
|
8035
|
+
return key.value === "constructor";
|
|
8036
|
+
return super.nameIsConstructor(key);
|
|
8037
|
+
}
|
|
8035
8038
|
parseClassProperty(...args) {
|
|
8036
8039
|
const propertyNode = super.parseClassProperty(...args);
|
|
8037
8040
|
{
|
|
@@ -8096,9 +8099,9 @@ var require_lib = __commonJS({
|
|
|
8096
8099
|
}
|
|
8097
8100
|
}
|
|
8098
8101
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
8099
|
-
if (prop.kind === "get" || prop.kind === "set") {
|
|
8102
|
+
if (prop.type === "Property" && (prop.kind === "get" || prop.kind === "set")) {
|
|
8100
8103
|
this.raise(Errors.PatternHasAccessor, prop.key);
|
|
8101
|
-
} else if (prop.method) {
|
|
8104
|
+
} else if (prop.type === "Property" && prop.method) {
|
|
8102
8105
|
this.raise(Errors.PatternHasMethod, prop.key);
|
|
8103
8106
|
} else {
|
|
8104
8107
|
super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
@@ -8110,9 +8113,9 @@ var require_lib = __commonJS({
|
|
|
8110
8113
|
node.type = "ImportExpression";
|
|
8111
8114
|
node.source = node.arguments[0];
|
|
8112
8115
|
if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
|
|
8113
|
-
var
|
|
8114
|
-
node.options = (
|
|
8115
|
-
node.attributes = (
|
|
8116
|
+
var _ref, _ref2;
|
|
8117
|
+
node.options = (_ref = node.arguments[1]) != null ? _ref : null;
|
|
8118
|
+
node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
|
|
8116
8119
|
}
|
|
8117
8120
|
delete node.arguments;
|
|
8118
8121
|
delete node.callee;
|
|
@@ -8184,7 +8187,7 @@ var require_lib = __commonJS({
|
|
|
8184
8187
|
return node.type === "Property" && node.kind === "init" && !node.method;
|
|
8185
8188
|
}
|
|
8186
8189
|
isObjectMethod(node) {
|
|
8187
|
-
return node.method || node.kind === "get" || node.kind === "set";
|
|
8190
|
+
return node.type === "Property" && (node.method || node.kind === "get" || node.kind === "set");
|
|
8188
8191
|
}
|
|
8189
8192
|
finishNodeAt(node, type, endLoc) {
|
|
8190
8193
|
return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
|
|
@@ -9103,8 +9106,9 @@ var require_lib = __commonJS({
|
|
|
9103
9106
|
const {
|
|
9104
9107
|
commentsLen
|
|
9105
9108
|
} = this.state;
|
|
9106
|
-
if (this.comments.length
|
|
9109
|
+
if (this.comments.length !== commentsLen) {
|
|
9107
9110
|
this.comments.length = commentsLen;
|
|
9111
|
+
}
|
|
9108
9112
|
this.comments.push(comment);
|
|
9109
9113
|
this.state.commentsLen++;
|
|
9110
9114
|
}
|
|
@@ -12313,18 +12317,21 @@ var require_lib = __commonJS({
|
|
|
12313
12317
|
type = this.flowParseTupleType();
|
|
12314
12318
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
12315
12319
|
return type;
|
|
12316
|
-
case 47:
|
|
12317
|
-
|
|
12320
|
+
case 47: {
|
|
12321
|
+
const node2 = this.startNode();
|
|
12322
|
+
node2.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
12318
12323
|
this.expect(10);
|
|
12319
12324
|
tmp = this.flowParseFunctionTypeParams();
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12325
|
+
node2.params = tmp.params;
|
|
12326
|
+
node2.rest = tmp.rest;
|
|
12327
|
+
node2.this = tmp._this;
|
|
12323
12328
|
this.expect(11);
|
|
12324
12329
|
this.expect(19);
|
|
12325
|
-
|
|
12326
|
-
return this.finishNode(
|
|
12327
|
-
|
|
12330
|
+
node2.returnType = this.flowParseType();
|
|
12331
|
+
return this.finishNode(node2, "FunctionTypeAnnotation");
|
|
12332
|
+
}
|
|
12333
|
+
case 10: {
|
|
12334
|
+
const node2 = this.startNode();
|
|
12328
12335
|
this.next();
|
|
12329
12336
|
if (!this.match(11) && !this.match(21)) {
|
|
12330
12337
|
if (tokenIsIdentifier(this.state.type) || this.match(78)) {
|
|
@@ -12350,14 +12357,15 @@ var require_lib = __commonJS({
|
|
|
12350
12357
|
} else {
|
|
12351
12358
|
tmp = this.flowParseFunctionTypeParams();
|
|
12352
12359
|
}
|
|
12353
|
-
|
|
12354
|
-
|
|
12355
|
-
|
|
12360
|
+
node2.params = tmp.params;
|
|
12361
|
+
node2.rest = tmp.rest;
|
|
12362
|
+
node2.this = tmp._this;
|
|
12356
12363
|
this.expect(11);
|
|
12357
12364
|
this.expect(19);
|
|
12358
|
-
|
|
12359
|
-
|
|
12360
|
-
return this.finishNode(
|
|
12365
|
+
node2.returnType = this.flowParseType();
|
|
12366
|
+
node2.typeParameters = null;
|
|
12367
|
+
return this.finishNode(node2, "FunctionTypeAnnotation");
|
|
12368
|
+
}
|
|
12361
12369
|
case 133:
|
|
12362
12370
|
return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
|
|
12363
12371
|
case 85:
|
|
@@ -12674,7 +12682,7 @@ var require_lib = __commonJS({
|
|
|
12674
12682
|
const arrows = [];
|
|
12675
12683
|
while (stack.length !== 0) {
|
|
12676
12684
|
const node2 = stack.pop();
|
|
12677
|
-
if (node2.type === "ArrowFunctionExpression") {
|
|
12685
|
+
if (node2.type === "ArrowFunctionExpression" && node2.body.type !== "BlockStatement") {
|
|
12678
12686
|
if (node2.typeParameters || !node2.returnType) {
|
|
12679
12687
|
this.finishArrowValidation(node2);
|
|
12680
12688
|
} else {
|
|
@@ -12711,18 +12719,18 @@ var require_lib = __commonJS({
|
|
|
12711
12719
|
return result;
|
|
12712
12720
|
}
|
|
12713
12721
|
parseParenItem(node, startLoc) {
|
|
12714
|
-
|
|
12722
|
+
const newNode = super.parseParenItem(node, startLoc);
|
|
12715
12723
|
if (this.eat(17)) {
|
|
12716
|
-
|
|
12724
|
+
newNode.optional = true;
|
|
12717
12725
|
this.resetEndLocation(node);
|
|
12718
12726
|
}
|
|
12719
12727
|
if (this.match(14)) {
|
|
12720
12728
|
const typeCastNode = this.startNodeAt(startLoc);
|
|
12721
|
-
typeCastNode.expression =
|
|
12729
|
+
typeCastNode.expression = newNode;
|
|
12722
12730
|
typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
|
|
12723
12731
|
return this.finishNode(typeCastNode, "TypeCastExpression");
|
|
12724
12732
|
}
|
|
12725
|
-
return
|
|
12733
|
+
return newNode;
|
|
12726
12734
|
}
|
|
12727
12735
|
assertModuleNodeAllowed(node) {
|
|
12728
12736
|
if (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "ExportAllDeclaration" && node.exportKind === "type") {
|
|
@@ -14106,7 +14114,7 @@ var require_lib = __commonJS({
|
|
|
14106
14114
|
} else {
|
|
14107
14115
|
let count = 0;
|
|
14108
14116
|
let semi = false;
|
|
14109
|
-
while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos)
|
|
14117
|
+
while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos) === 59)) {
|
|
14110
14118
|
++this.state.pos;
|
|
14111
14119
|
}
|
|
14112
14120
|
if (semi) {
|
|
@@ -14270,7 +14278,7 @@ var require_lib = __commonJS({
|
|
|
14270
14278
|
children.push(this.jsxParseElementAt(startLoc));
|
|
14271
14279
|
break;
|
|
14272
14280
|
case 141:
|
|
14273
|
-
children.push(this.
|
|
14281
|
+
children.push(this.parseLiteral(this.state.value, "JSXText"));
|
|
14274
14282
|
break;
|
|
14275
14283
|
case 5: {
|
|
14276
14284
|
const node2 = this.startNode();
|
|
@@ -14326,9 +14334,7 @@ var require_lib = __commonJS({
|
|
|
14326
14334
|
context[context.length - 1] = newContext;
|
|
14327
14335
|
}
|
|
14328
14336
|
parseExprAtom(refExpressionErrors) {
|
|
14329
|
-
if (this.match(
|
|
14330
|
-
return this.parseLiteral(this.state.value, "JSXText");
|
|
14331
|
-
} else if (this.match(142)) {
|
|
14337
|
+
if (this.match(142)) {
|
|
14332
14338
|
return this.jsxParseElement();
|
|
14333
14339
|
} else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
|
|
14334
14340
|
this.replaceToken(142);
|
|
@@ -14410,14 +14416,14 @@ var require_lib = __commonJS({
|
|
|
14410
14416
|
return new TypeScriptScope(flags);
|
|
14411
14417
|
}
|
|
14412
14418
|
enter(flags) {
|
|
14413
|
-
if (flags
|
|
14419
|
+
if (flags === 256) {
|
|
14414
14420
|
this.importsStack.push(/* @__PURE__ */ new Set());
|
|
14415
14421
|
}
|
|
14416
14422
|
super.enter(flags);
|
|
14417
14423
|
}
|
|
14418
14424
|
exit() {
|
|
14419
14425
|
const flags = super.exit();
|
|
14420
|
-
if (flags
|
|
14426
|
+
if (flags === 256) {
|
|
14421
14427
|
this.importsStack.pop();
|
|
14422
14428
|
}
|
|
14423
14429
|
return flags;
|
|
@@ -14726,14 +14732,15 @@ var require_lib = __commonJS({
|
|
|
14726
14732
|
return this.finishNode(prop, "RestElement");
|
|
14727
14733
|
}
|
|
14728
14734
|
parseBindingProperty() {
|
|
14729
|
-
const prop = this.startNode();
|
|
14730
14735
|
const {
|
|
14731
14736
|
type,
|
|
14732
14737
|
startLoc
|
|
14733
14738
|
} = this.state;
|
|
14734
14739
|
if (type === 21) {
|
|
14735
|
-
return this.parseBindingRestProperty(
|
|
14736
|
-
}
|
|
14740
|
+
return this.parseBindingRestProperty(this.startNode());
|
|
14741
|
+
}
|
|
14742
|
+
const prop = this.startNode();
|
|
14743
|
+
if (type === 138) {
|
|
14737
14744
|
this.expectPlugin("destructuringPrivate", startLoc);
|
|
14738
14745
|
this.classScope.usePrivateName(this.state.value, startLoc);
|
|
14739
14746
|
prop.key = this.parsePrivateName();
|
|
@@ -16610,13 +16617,14 @@ var require_lib = __commonJS({
|
|
|
16610
16617
|
parseExport(node, decorators) {
|
|
16611
16618
|
if (this.match(83)) {
|
|
16612
16619
|
this.next();
|
|
16620
|
+
const nodeImportEquals = node;
|
|
16613
16621
|
let maybeDefaultIdentifier = null;
|
|
16614
16622
|
if (this.isContextual(130) && this.isPotentialImportPhase(false)) {
|
|
16615
|
-
maybeDefaultIdentifier = this.parseMaybeImportPhase(
|
|
16623
|
+
maybeDefaultIdentifier = this.parseMaybeImportPhase(nodeImportEquals, false);
|
|
16616
16624
|
} else {
|
|
16617
|
-
|
|
16625
|
+
nodeImportEquals.importKind = "value";
|
|
16618
16626
|
}
|
|
16619
|
-
return this.tsParseImportEqualsDeclaration(
|
|
16627
|
+
return this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier, true);
|
|
16620
16628
|
} else if (this.eat(29)) {
|
|
16621
16629
|
const assign = node;
|
|
16622
16630
|
assign.expression = super.parseExpression();
|
|
@@ -16795,9 +16803,9 @@ var require_lib = __commonJS({
|
|
|
16795
16803
|
return result.node;
|
|
16796
16804
|
}
|
|
16797
16805
|
parseParenItem(node, startLoc) {
|
|
16798
|
-
|
|
16806
|
+
const newNode = super.parseParenItem(node, startLoc);
|
|
16799
16807
|
if (this.eat(17)) {
|
|
16800
|
-
|
|
16808
|
+
newNode.optional = true;
|
|
16801
16809
|
this.resetEndLocation(node);
|
|
16802
16810
|
}
|
|
16803
16811
|
if (this.match(14)) {
|
|
@@ -16912,8 +16920,9 @@ var require_lib = __commonJS({
|
|
|
16912
16920
|
declareClassPrivateMethodInScope(node, kind) {
|
|
16913
16921
|
if (node.type === "TSDeclareMethod")
|
|
16914
16922
|
return;
|
|
16915
|
-
if (node.type === "MethodDefinition" && !node.value
|
|
16923
|
+
if (node.type === "MethodDefinition" && !hasOwnProperty.call(node.value, "body")) {
|
|
16916
16924
|
return;
|
|
16925
|
+
}
|
|
16917
16926
|
super.declareClassPrivateMethodInScope(node, kind);
|
|
16918
16927
|
}
|
|
16919
16928
|
parseClassSuper(node) {
|
|
@@ -17480,9 +17489,12 @@ var require_lib = __commonJS({
|
|
|
17480
17489
|
}
|
|
17481
17490
|
}
|
|
17482
17491
|
finishPlaceholder(node, expectedNode) {
|
|
17483
|
-
|
|
17484
|
-
|
|
17485
|
-
|
|
17492
|
+
let placeholder = node;
|
|
17493
|
+
if (!placeholder.expectedNode || !placeholder.type) {
|
|
17494
|
+
placeholder = this.finishNode(placeholder, "Placeholder");
|
|
17495
|
+
}
|
|
17496
|
+
placeholder.expectedNode = expectedNode;
|
|
17497
|
+
return placeholder;
|
|
17486
17498
|
}
|
|
17487
17499
|
getTokenFromCode(code2) {
|
|
17488
17500
|
if (code2 === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
|
|
@@ -17543,8 +17555,9 @@ var require_lib = __commonJS({
|
|
|
17543
17555
|
return this.finishNode(stmt, "LabeledStatement");
|
|
17544
17556
|
}
|
|
17545
17557
|
this.semicolon();
|
|
17546
|
-
|
|
17547
|
-
|
|
17558
|
+
const stmtPlaceholder = node;
|
|
17559
|
+
stmtPlaceholder.name = expr.name;
|
|
17560
|
+
return this.finishPlaceholder(stmtPlaceholder, "Statement");
|
|
17548
17561
|
}
|
|
17549
17562
|
parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse) {
|
|
17550
17563
|
return this.parsePlaceholder("BlockStatement") || super.parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse);
|
|
@@ -17578,17 +17591,18 @@ var require_lib = __commonJS({
|
|
|
17578
17591
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
17579
17592
|
if (!placeholder)
|
|
17580
17593
|
return super.parseExport(node, decorators);
|
|
17594
|
+
const node2 = node;
|
|
17581
17595
|
if (!this.isContextual(98) && !this.match(12)) {
|
|
17582
|
-
|
|
17583
|
-
|
|
17584
|
-
|
|
17585
|
-
return this.finishNode(
|
|
17596
|
+
node2.specifiers = [];
|
|
17597
|
+
node2.source = null;
|
|
17598
|
+
node2.declaration = this.finishPlaceholder(placeholder, "Declaration");
|
|
17599
|
+
return this.finishNode(node2, "ExportNamedDeclaration");
|
|
17586
17600
|
}
|
|
17587
17601
|
this.expectPlugin("exportDefaultFrom");
|
|
17588
17602
|
const specifier = this.startNode();
|
|
17589
17603
|
specifier.exported = placeholder;
|
|
17590
|
-
|
|
17591
|
-
return super.parseExport(
|
|
17604
|
+
node2.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
|
|
17605
|
+
return super.parseExport(node2, decorators);
|
|
17592
17606
|
}
|
|
17593
17607
|
isExportDefaultSpecifier() {
|
|
17594
17608
|
if (this.match(65)) {
|
|
@@ -18880,14 +18894,16 @@ var require_lib = __commonJS({
|
|
|
18880
18894
|
}
|
|
18881
18895
|
parseTemplate(isTagged) {
|
|
18882
18896
|
const node = this.startNode();
|
|
18883
|
-
node.expressions = [];
|
|
18884
18897
|
let curElt = this.parseTemplateElement(isTagged);
|
|
18885
|
-
|
|
18898
|
+
const quasis = [curElt];
|
|
18899
|
+
const substitutions = [];
|
|
18886
18900
|
while (!curElt.tail) {
|
|
18887
|
-
|
|
18901
|
+
substitutions.push(this.parseTemplateSubstitution());
|
|
18888
18902
|
this.readTemplateContinuation();
|
|
18889
|
-
|
|
18903
|
+
quasis.push(curElt = this.parseTemplateElement(isTagged));
|
|
18890
18904
|
}
|
|
18905
|
+
node.expressions = substitutions;
|
|
18906
|
+
node.quasis = quasis;
|
|
18891
18907
|
return this.finishNode(node, "TemplateLiteral");
|
|
18892
18908
|
}
|
|
18893
18909
|
parseTemplateSubstitution() {
|
|
@@ -18976,8 +18992,11 @@ var require_lib = __commonJS({
|
|
|
18976
18992
|
let isGenerator = this.eat(55);
|
|
18977
18993
|
this.parsePropertyNamePrefixOperator(prop);
|
|
18978
18994
|
const containsEsc = this.state.containsEsc;
|
|
18979
|
-
|
|
18995
|
+
this.parsePropertyName(prop, refExpressionErrors);
|
|
18980
18996
|
if (!isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop)) {
|
|
18997
|
+
const {
|
|
18998
|
+
key
|
|
18999
|
+
} = prop;
|
|
18981
19000
|
const keyName = key.name;
|
|
18982
19001
|
if (keyName === "async" && !this.hasPrecedingLineBreak()) {
|
|
18983
19002
|
isAsync = true;
|
|
@@ -19113,7 +19132,6 @@ var require_lib = __commonJS({
|
|
|
19113
19132
|
prop.computed = false;
|
|
19114
19133
|
}
|
|
19115
19134
|
}
|
|
19116
|
-
return prop.key;
|
|
19117
19135
|
}
|
|
19118
19136
|
initFunction(node, isAsync) {
|
|
19119
19137
|
node.id = null;
|
|
@@ -20533,8 +20551,11 @@ var require_lib = __commonJS({
|
|
|
20533
20551
|
isClassMethod() {
|
|
20534
20552
|
return this.match(10);
|
|
20535
20553
|
}
|
|
20554
|
+
nameIsConstructor(key) {
|
|
20555
|
+
return key.type === "Identifier" && key.name === "constructor" || key.type === "StringLiteral" && key.value === "constructor";
|
|
20556
|
+
}
|
|
20536
20557
|
isNonstaticConstructor(method) {
|
|
20537
|
-
return !method.computed && !method.static && (method.key
|
|
20558
|
+
return !method.computed && !method.static && this.nameIsConstructor(method.key);
|
|
20538
20559
|
}
|
|
20539
20560
|
parseClassBody(hadSuperClass, oldStrict) {
|
|
20540
20561
|
this.classScope.enter();
|
|
@@ -20636,9 +20657,10 @@ var require_lib = __commonJS({
|
|
|
20636
20657
|
this.pushClassMethod(classBody, publicMethod, true, false, false, false);
|
|
20637
20658
|
return;
|
|
20638
20659
|
}
|
|
20639
|
-
const isContextual =
|
|
20640
|
-
const isPrivate = this.match(138);
|
|
20660
|
+
const isContextual = !this.state.containsEsc && tokenIsIdentifier(this.state.type);
|
|
20641
20661
|
const key = this.parseClassElementName(member);
|
|
20662
|
+
const maybeContextualKw = isContextual ? key.name : null;
|
|
20663
|
+
const isPrivate = this.isPrivateName(key);
|
|
20642
20664
|
const maybeQuestionTokenStartLoc = this.state.startLoc;
|
|
20643
20665
|
this.parsePostMemberNameModifiers(publicMember);
|
|
20644
20666
|
if (this.isClassMethod()) {
|
|
@@ -20667,7 +20689,7 @@ var require_lib = __commonJS({
|
|
|
20667
20689
|
} else {
|
|
20668
20690
|
this.pushClassProperty(classBody, publicProp);
|
|
20669
20691
|
}
|
|
20670
|
-
} else if (
|
|
20692
|
+
} else if (maybeContextualKw === "async" && !this.isLineTerminator()) {
|
|
20671
20693
|
this.resetPreviousNodeTrailingComments(key);
|
|
20672
20694
|
const isGenerator = this.eat(55);
|
|
20673
20695
|
if (publicMember.optional) {
|
|
@@ -20685,9 +20707,9 @@ var require_lib = __commonJS({
|
|
|
20685
20707
|
}
|
|
20686
20708
|
this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
|
|
20687
20709
|
}
|
|
20688
|
-
} else if (
|
|
20710
|
+
} else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(55) && this.isLineTerminator())) {
|
|
20689
20711
|
this.resetPreviousNodeTrailingComments(key);
|
|
20690
|
-
method.kind =
|
|
20712
|
+
method.kind = maybeContextualKw;
|
|
20691
20713
|
const isPrivate2 = this.match(138);
|
|
20692
20714
|
this.parseClassElementName(publicMethod);
|
|
20693
20715
|
if (isPrivate2) {
|
|
@@ -20699,7 +20721,7 @@ var require_lib = __commonJS({
|
|
|
20699
20721
|
this.pushClassMethod(classBody, publicMethod, false, false, false, false);
|
|
20700
20722
|
}
|
|
20701
20723
|
this.checkGetterSetterParams(publicMethod);
|
|
20702
|
-
} else if (
|
|
20724
|
+
} else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
|
|
20703
20725
|
this.expectPlugin("decoratorAutoAccessors");
|
|
20704
20726
|
this.resetPreviousNodeTrailingComments(key);
|
|
20705
20727
|
const isPrivate2 = this.match(138);
|
|
@@ -20731,7 +20753,8 @@ var require_lib = __commonJS({
|
|
|
20731
20753
|
member.key = key;
|
|
20732
20754
|
return key;
|
|
20733
20755
|
}
|
|
20734
|
-
|
|
20756
|
+
this.parsePropertyName(member);
|
|
20757
|
+
return member.key;
|
|
20735
20758
|
}
|
|
20736
20759
|
parseClassStaticBlock(classBody, member) {
|
|
20737
20760
|
var _member$decorators;
|
|
@@ -20750,7 +20773,7 @@ var require_lib = __commonJS({
|
|
|
20750
20773
|
}
|
|
20751
20774
|
}
|
|
20752
20775
|
pushClassProperty(classBody, prop) {
|
|
20753
|
-
if (!prop.computed && (prop.key
|
|
20776
|
+
if (!prop.computed && this.nameIsConstructor(prop.key)) {
|
|
20754
20777
|
this.raise(Errors.ConstructorClassField, prop.key);
|
|
20755
20778
|
}
|
|
20756
20779
|
classBody.body.push(this.parseClassProperty(prop));
|
|
@@ -20761,11 +20784,8 @@ var require_lib = __commonJS({
|
|
|
20761
20784
|
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.loc.start);
|
|
20762
20785
|
}
|
|
20763
20786
|
pushClassAccessorProperty(classBody, prop, isPrivate) {
|
|
20764
|
-
if (!isPrivate && !prop.computed) {
|
|
20765
|
-
|
|
20766
|
-
if (key.name === "constructor" || key.value === "constructor") {
|
|
20767
|
-
this.raise(Errors.ConstructorClassField, key);
|
|
20768
|
-
}
|
|
20787
|
+
if (!isPrivate && !prop.computed && this.nameIsConstructor(prop.key)) {
|
|
20788
|
+
this.raise(Errors.ConstructorClassField, prop.key);
|
|
20769
20789
|
}
|
|
20770
20790
|
const node = this.parseClassAccessorProperty(prop);
|
|
20771
20791
|
classBody.body.push(node);
|
|
@@ -20903,8 +20923,8 @@ var require_lib = __commonJS({
|
|
|
20903
20923
|
}
|
|
20904
20924
|
maybeParseExportNamespaceSpecifier(node) {
|
|
20905
20925
|
if (this.isContextual(93)) {
|
|
20906
|
-
|
|
20907
|
-
|
|
20926
|
+
var _ref, _ref$specifiers;
|
|
20927
|
+
(_ref$specifiers = (_ref = node).specifiers) != null ? _ref$specifiers : _ref.specifiers = [];
|
|
20908
20928
|
const specifier = this.startNodeAt(this.state.lastTokStartLoc);
|
|
20909
20929
|
this.next();
|
|
20910
20930
|
specifier.exported = this.parseModuleExportName();
|
|
@@ -20915,14 +20935,15 @@ var require_lib = __commonJS({
|
|
|
20915
20935
|
}
|
|
20916
20936
|
maybeParseExportNamedSpecifiers(node) {
|
|
20917
20937
|
if (this.match(5)) {
|
|
20918
|
-
|
|
20919
|
-
|
|
20920
|
-
|
|
20921
|
-
|
|
20922
|
-
|
|
20923
|
-
|
|
20938
|
+
const node2 = node;
|
|
20939
|
+
if (!node2.specifiers)
|
|
20940
|
+
node2.specifiers = [];
|
|
20941
|
+
const isTypeExport = node2.exportKind === "type";
|
|
20942
|
+
node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport));
|
|
20943
|
+
node2.source = null;
|
|
20944
|
+
node2.declaration = null;
|
|
20924
20945
|
if (this.hasPlugin("importAssertions")) {
|
|
20925
|
-
|
|
20946
|
+
node2.assertions = [];
|
|
20926
20947
|
}
|
|
20927
20948
|
return true;
|
|
20928
20949
|
}
|
|
@@ -21034,6 +21055,14 @@ var require_lib = __commonJS({
|
|
|
21034
21055
|
return true;
|
|
21035
21056
|
}
|
|
21036
21057
|
}
|
|
21058
|
+
if (this.isContextual(107)) {
|
|
21059
|
+
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
21060
|
+
return true;
|
|
21061
|
+
}
|
|
21062
|
+
if (this.isContextual(96) && this.startsAwaitUsing()) {
|
|
21063
|
+
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
21064
|
+
return true;
|
|
21065
|
+
}
|
|
21037
21066
|
return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
|
|
21038
21067
|
}
|
|
21039
21068
|
checkExport(node, checkNames, isDefault, isFrom) {
|
|
@@ -21071,13 +21100,16 @@ var require_lib = __commonJS({
|
|
|
21071
21100
|
}
|
|
21072
21101
|
}
|
|
21073
21102
|
} else if (node.declaration) {
|
|
21074
|
-
|
|
21075
|
-
|
|
21103
|
+
const decl = node.declaration;
|
|
21104
|
+
if (decl.type === "FunctionDeclaration" || decl.type === "ClassDeclaration") {
|
|
21105
|
+
const {
|
|
21106
|
+
id
|
|
21107
|
+
} = decl;
|
|
21076
21108
|
if (!id)
|
|
21077
21109
|
throw new Error("Assertion failure");
|
|
21078
21110
|
this.checkDuplicateExports(node, id.name);
|
|
21079
|
-
} else if (
|
|
21080
|
-
for (const declaration of
|
|
21111
|
+
} else if (decl.type === "VariableDeclaration") {
|
|
21112
|
+
for (const declaration of decl.declarations) {
|
|
21081
21113
|
this.checkDeclaration(declaration.id);
|
|
21082
21114
|
}
|
|
21083
21115
|
}
|
|
@@ -21584,9 +21616,9 @@ var require_lib = __commonJS({
|
|
|
21584
21616
|
}
|
|
21585
21617
|
});
|
|
21586
21618
|
|
|
21587
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
21619
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/output.js
|
|
21588
21620
|
var require_output = __commonJS({
|
|
21589
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
21621
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/output.js"(exports2, module2) {
|
|
21590
21622
|
"use strict";
|
|
21591
21623
|
function OutputLine(parent) {
|
|
21592
21624
|
this.__parent = parent;
|
|
@@ -21907,9 +21939,9 @@ var require_output = __commonJS({
|
|
|
21907
21939
|
}
|
|
21908
21940
|
});
|
|
21909
21941
|
|
|
21910
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
21942
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/token.js
|
|
21911
21943
|
var require_token = __commonJS({
|
|
21912
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
21944
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/token.js"(exports2, module2) {
|
|
21913
21945
|
"use strict";
|
|
21914
21946
|
function Token(type, text, newlines, whitespace_before) {
|
|
21915
21947
|
this.type = type;
|
|
@@ -21928,28 +21960,29 @@ var require_token = __commonJS({
|
|
|
21928
21960
|
}
|
|
21929
21961
|
});
|
|
21930
21962
|
|
|
21931
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
21963
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/acorn.js
|
|
21932
21964
|
var require_acorn = __commonJS({
|
|
21933
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
21965
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/acorn.js"(exports2) {
|
|
21934
21966
|
"use strict";
|
|
21935
21967
|
var baseASCIIidentifierStartChars = "\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a";
|
|
21936
21968
|
var baseASCIIidentifierChars = "\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a";
|
|
21937
21969
|
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";
|
|
21938
21970
|
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";
|
|
21939
|
-
var
|
|
21940
|
-
var
|
|
21971
|
+
var unicodeEscapeOrCodePoint = "\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}";
|
|
21972
|
+
var identifierStart = "(?:" + unicodeEscapeOrCodePoint + "|[" + baseASCIIidentifierStartChars + nonASCIIidentifierStartChars + "])";
|
|
21973
|
+
var identifierChars = "(?:" + unicodeEscapeOrCodePoint + "|[" + baseASCIIidentifierChars + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "])*";
|
|
21941
21974
|
exports2.identifier = new RegExp(identifierStart + identifierChars, "g");
|
|
21942
21975
|
exports2.identifierStart = new RegExp(identifierStart);
|
|
21943
|
-
exports2.identifierMatch = new RegExp("(
|
|
21976
|
+
exports2.identifierMatch = new RegExp("(?:" + unicodeEscapeOrCodePoint + "|[" + baseASCIIidentifierChars + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "])+");
|
|
21944
21977
|
exports2.newline = /[\n\r\u2028\u2029]/;
|
|
21945
21978
|
exports2.lineBreak = new RegExp("\r\n|" + exports2.newline.source);
|
|
21946
21979
|
exports2.allLineBreaks = new RegExp(exports2.lineBreak.source, "g");
|
|
21947
21980
|
}
|
|
21948
21981
|
});
|
|
21949
21982
|
|
|
21950
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
21983
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/options.js
|
|
21951
21984
|
var require_options = __commonJS({
|
|
21952
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
21985
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/options.js"(exports2, module2) {
|
|
21953
21986
|
"use strict";
|
|
21954
21987
|
function Options(options, merge_child_field) {
|
|
21955
21988
|
this.raw_options = _mergeOpts(options, merge_child_field);
|
|
@@ -21973,7 +22006,7 @@ var require_options = __commonJS({
|
|
|
21973
22006
|
}
|
|
21974
22007
|
this.wrap_line_length = this._get_number("wrap_line_length", this._get_number("max_char"));
|
|
21975
22008
|
this.indent_empty_lines = this._get_boolean("indent_empty_lines");
|
|
21976
|
-
this.templating = this._get_selection_list("templating", ["auto", "none", "django", "erb", "handlebars", "php", "smarty"], ["auto"]);
|
|
22009
|
+
this.templating = this._get_selection_list("templating", ["auto", "none", "angular", "django", "erb", "handlebars", "php", "smarty"], ["auto"]);
|
|
21977
22010
|
}
|
|
21978
22011
|
Options.prototype._get_array = function(name, default_value) {
|
|
21979
22012
|
var option_value = this.raw_options[name];
|
|
@@ -22073,9 +22106,9 @@ var require_options = __commonJS({
|
|
|
22073
22106
|
}
|
|
22074
22107
|
});
|
|
22075
22108
|
|
|
22076
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22109
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/options.js
|
|
22077
22110
|
var require_options2 = __commonJS({
|
|
22078
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22111
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/options.js"(exports2, module2) {
|
|
22079
22112
|
"use strict";
|
|
22080
22113
|
var BaseOptions = require_options().Options;
|
|
22081
22114
|
var validPositionValues = ["before-newline", "after-newline", "preserve-newline"];
|
|
@@ -22122,9 +22155,9 @@ var require_options2 = __commonJS({
|
|
|
22122
22155
|
}
|
|
22123
22156
|
});
|
|
22124
22157
|
|
|
22125
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22158
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/inputscanner.js
|
|
22126
22159
|
var require_inputscanner = __commonJS({
|
|
22127
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22160
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/inputscanner.js"(exports2, module2) {
|
|
22128
22161
|
"use strict";
|
|
22129
22162
|
var regexp_has_sticky = RegExp.prototype.hasOwnProperty("sticky");
|
|
22130
22163
|
function InputScanner(input_string) {
|
|
@@ -22257,9 +22290,9 @@ var require_inputscanner = __commonJS({
|
|
|
22257
22290
|
}
|
|
22258
22291
|
});
|
|
22259
22292
|
|
|
22260
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22293
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/tokenstream.js
|
|
22261
22294
|
var require_tokenstream = __commonJS({
|
|
22262
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22295
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/tokenstream.js"(exports2, module2) {
|
|
22263
22296
|
"use strict";
|
|
22264
22297
|
function TokenStream(parent_token) {
|
|
22265
22298
|
this.__tokens = [];
|
|
@@ -22304,9 +22337,9 @@ var require_tokenstream = __commonJS({
|
|
|
22304
22337
|
}
|
|
22305
22338
|
});
|
|
22306
22339
|
|
|
22307
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22340
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/pattern.js
|
|
22308
22341
|
var require_pattern2 = __commonJS({
|
|
22309
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22342
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/pattern.js"(exports2, module2) {
|
|
22310
22343
|
"use strict";
|
|
22311
22344
|
function Pattern(input_scanner, parent) {
|
|
22312
22345
|
this._input = input_scanner;
|
|
@@ -22366,9 +22399,9 @@ var require_pattern2 = __commonJS({
|
|
|
22366
22399
|
}
|
|
22367
22400
|
});
|
|
22368
22401
|
|
|
22369
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22402
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/whitespacepattern.js
|
|
22370
22403
|
var require_whitespacepattern = __commonJS({
|
|
22371
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22404
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/whitespacepattern.js"(exports2, module2) {
|
|
22372
22405
|
"use strict";
|
|
22373
22406
|
var Pattern = require_pattern2().Pattern;
|
|
22374
22407
|
function WhitespacePattern(input_scanner, parent) {
|
|
@@ -22436,9 +22469,9 @@ var require_whitespacepattern = __commonJS({
|
|
|
22436
22469
|
}
|
|
22437
22470
|
});
|
|
22438
22471
|
|
|
22439
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22472
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/tokenizer.js
|
|
22440
22473
|
var require_tokenizer = __commonJS({
|
|
22441
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22474
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/tokenizer.js"(exports2, module2) {
|
|
22442
22475
|
"use strict";
|
|
22443
22476
|
var InputScanner = require_inputscanner().InputScanner;
|
|
22444
22477
|
var Token = require_token().Token;
|
|
@@ -22532,9 +22565,9 @@ var require_tokenizer = __commonJS({
|
|
|
22532
22565
|
}
|
|
22533
22566
|
});
|
|
22534
22567
|
|
|
22535
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22568
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/directives.js
|
|
22536
22569
|
var require_directives = __commonJS({
|
|
22537
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22570
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/directives.js"(exports2, module2) {
|
|
22538
22571
|
"use strict";
|
|
22539
22572
|
function Directives(start_block_pattern, end_block_pattern) {
|
|
22540
22573
|
start_block_pattern = typeof start_block_pattern === "string" ? start_block_pattern : start_block_pattern.source;
|
|
@@ -22563,9 +22596,9 @@ var require_directives = __commonJS({
|
|
|
22563
22596
|
}
|
|
22564
22597
|
});
|
|
22565
22598
|
|
|
22566
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22599
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/templatablepattern.js
|
|
22567
22600
|
var require_templatablepattern = __commonJS({
|
|
22568
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22601
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/core/templatablepattern.js"(exports2, module2) {
|
|
22569
22602
|
"use strict";
|
|
22570
22603
|
var Pattern = require_pattern2().Pattern;
|
|
22571
22604
|
var template_names = {
|
|
@@ -22573,7 +22606,8 @@ var require_templatablepattern = __commonJS({
|
|
|
22573
22606
|
erb: false,
|
|
22574
22607
|
handlebars: false,
|
|
22575
22608
|
php: false,
|
|
22576
|
-
smarty: false
|
|
22609
|
+
smarty: false,
|
|
22610
|
+
angular: false
|
|
22577
22611
|
};
|
|
22578
22612
|
function TemplatablePattern(input_scanner, parent) {
|
|
22579
22613
|
Pattern.call(this, input_scanner, parent);
|
|
@@ -22714,9 +22748,9 @@ var require_templatablepattern = __commonJS({
|
|
|
22714
22748
|
}
|
|
22715
22749
|
});
|
|
22716
22750
|
|
|
22717
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
22751
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/tokenizer.js
|
|
22718
22752
|
var require_tokenizer2 = __commonJS({
|
|
22719
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
22753
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/tokenizer.js"(exports2, module2) {
|
|
22720
22754
|
"use strict";
|
|
22721
22755
|
var InputScanner = require_inputscanner().InputScanner;
|
|
22722
22756
|
var BaseTokenizer = require_tokenizer().Tokenizer;
|
|
@@ -22759,7 +22793,7 @@ var require_tokenizer2 = __commonJS({
|
|
|
22759
22793
|
punct = punct.replace(/ /g, "|");
|
|
22760
22794
|
var punct_pattern = new RegExp(punct);
|
|
22761
22795
|
var line_starters = "continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(",");
|
|
22762
|
-
var reserved_words = line_starters.concat(["do", "in", "of", "else", "get", "set", "new", "catch", "finally", "typeof", "yield", "async", "await", "from", "as"]);
|
|
22796
|
+
var reserved_words = line_starters.concat(["do", "in", "of", "else", "get", "set", "new", "catch", "finally", "typeof", "yield", "async", "await", "from", "as", "class", "extends"]);
|
|
22763
22797
|
var reserved_word_pattern = new RegExp("^(?:" + reserved_words.join("|") + ")$");
|
|
22764
22798
|
var in_html_comment;
|
|
22765
22799
|
var Tokenizer = function(input_string, options) {
|
|
@@ -22812,6 +22846,7 @@ var require_tokenizer2 = __commonJS({
|
|
|
22812
22846
|
}
|
|
22813
22847
|
token = token || this._read_non_javascript(c);
|
|
22814
22848
|
token = token || this._read_string(c);
|
|
22849
|
+
token = token || this._read_pair(c, this._input.peek(1));
|
|
22815
22850
|
token = token || this._read_word(previous_token);
|
|
22816
22851
|
token = token || this._read_singles(c);
|
|
22817
22852
|
token = token || this._read_comment(c);
|
|
@@ -22827,7 +22862,7 @@ var require_tokenizer2 = __commonJS({
|
|
|
22827
22862
|
if (resulting_string !== "") {
|
|
22828
22863
|
resulting_string = resulting_string.replace(acorn.allLineBreaks, "\n");
|
|
22829
22864
|
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)) {
|
|
22830
|
-
if (resulting_string === "in" || resulting_string === "of") {
|
|
22865
|
+
if ((resulting_string === "in" || resulting_string === "of") && (previous_token.type === TOKEN.WORD || previous_token.type === TOKEN.STRING)) {
|
|
22831
22866
|
return this._create_token(TOKEN.OPERATOR, resulting_string);
|
|
22832
22867
|
}
|
|
22833
22868
|
return this._create_token(TOKEN.RESERVED, resulting_string);
|
|
@@ -22861,6 +22896,17 @@ var require_tokenizer2 = __commonJS({
|
|
|
22861
22896
|
}
|
|
22862
22897
|
return token;
|
|
22863
22898
|
};
|
|
22899
|
+
Tokenizer.prototype._read_pair = function(c, d) {
|
|
22900
|
+
var token = null;
|
|
22901
|
+
if (c === "#" && d === "{") {
|
|
22902
|
+
token = this._create_token(TOKEN.START_BLOCK, c + d);
|
|
22903
|
+
}
|
|
22904
|
+
if (token) {
|
|
22905
|
+
this._input.next();
|
|
22906
|
+
this._input.next();
|
|
22907
|
+
}
|
|
22908
|
+
return token;
|
|
22909
|
+
};
|
|
22864
22910
|
Tokenizer.prototype._read_punctuation = function() {
|
|
22865
22911
|
var resulting_string = this.__patterns.punct.read();
|
|
22866
22912
|
if (resulting_string !== "") {
|
|
@@ -23054,6 +23100,9 @@ var require_tokenizer2 = __commonJS({
|
|
|
23054
23100
|
matched = input_scan.match(/x([0-9A-Fa-f]{2})/g);
|
|
23055
23101
|
} else if (input_scan.peek() === "u") {
|
|
23056
23102
|
matched = input_scan.match(/u([0-9A-Fa-f]{4})/g);
|
|
23103
|
+
if (!matched) {
|
|
23104
|
+
matched = input_scan.match(/u\{([0-9A-Fa-f]+)\}/g);
|
|
23105
|
+
}
|
|
23057
23106
|
} else {
|
|
23058
23107
|
out += "\\";
|
|
23059
23108
|
if (input_scan.hasNext()) {
|
|
@@ -23069,7 +23118,8 @@ var require_tokenizer2 = __commonJS({
|
|
|
23069
23118
|
return s;
|
|
23070
23119
|
} else if (escaped >= 0 && escaped < 32) {
|
|
23071
23120
|
out += "\\" + matched[0];
|
|
23072
|
-
|
|
23121
|
+
} else if (escaped > 1114111) {
|
|
23122
|
+
out += "\\" + matched[0];
|
|
23073
23123
|
} else if (escaped === 34 || escaped === 39 || escaped === 92) {
|
|
23074
23124
|
out += "\\" + String.fromCharCode(escaped);
|
|
23075
23125
|
} else {
|
|
@@ -23133,9 +23183,9 @@ var require_tokenizer2 = __commonJS({
|
|
|
23133
23183
|
}
|
|
23134
23184
|
});
|
|
23135
23185
|
|
|
23136
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
23186
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/beautifier.js
|
|
23137
23187
|
var require_beautifier = __commonJS({
|
|
23138
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
23188
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/beautifier.js"(exports2, module2) {
|
|
23139
23189
|
"use strict";
|
|
23140
23190
|
var Output = require_output().Output;
|
|
23141
23191
|
var Token = require_token().Token;
|
|
@@ -23260,6 +23310,8 @@ var require_beautifier = __commonJS({
|
|
|
23260
23310
|
inline_frame: false,
|
|
23261
23311
|
if_block: false,
|
|
23262
23312
|
else_block: false,
|
|
23313
|
+
class_start_block: false,
|
|
23314
|
+
// class A { INSIDE HERE } or class B extends C { INSIDE HERE }
|
|
23263
23315
|
do_block: false,
|
|
23264
23316
|
do_while: false,
|
|
23265
23317
|
import_block: false,
|
|
@@ -23565,6 +23617,8 @@ var require_beautifier = __commonJS({
|
|
|
23565
23617
|
if (peek_back_two.text === "{" || peek_back_two.text === "," || peek_back_two.text === "*" && (peek_back_three.text === "{" || peek_back_three.text === ",")) {
|
|
23566
23618
|
this._output.space_before_token = true;
|
|
23567
23619
|
}
|
|
23620
|
+
} else if (this._flags.parent && this._flags.parent.class_start_block) {
|
|
23621
|
+
this._output.space_before_token = true;
|
|
23568
23622
|
}
|
|
23569
23623
|
}
|
|
23570
23624
|
} else {
|
|
@@ -23637,6 +23691,11 @@ var require_beautifier = __commonJS({
|
|
|
23637
23691
|
} else {
|
|
23638
23692
|
this.set_mode(MODE.BlockStatement);
|
|
23639
23693
|
}
|
|
23694
|
+
if (this._flags.last_token) {
|
|
23695
|
+
if (reserved_array(this._flags.last_token.previous, ["class", "extends"])) {
|
|
23696
|
+
this._flags.class_start_block = true;
|
|
23697
|
+
}
|
|
23698
|
+
}
|
|
23640
23699
|
var empty_braces = !next_token.comments_before && next_token.text === "}";
|
|
23641
23700
|
var empty_anonymous_function = empty_braces && this._flags.last_word === "function" && this._flags.last_token.type === TOKEN.END_EXPR;
|
|
23642
23701
|
if (this._options.brace_preserve_inline) {
|
|
@@ -23670,7 +23729,7 @@ var require_beautifier = __commonJS({
|
|
|
23670
23729
|
}
|
|
23671
23730
|
}
|
|
23672
23731
|
if (this._flags.last_token.type !== TOKEN.OPERATOR && this._flags.last_token.type !== TOKEN.START_EXPR) {
|
|
23673
|
-
if (this._flags.last_token.type
|
|
23732
|
+
if (in_array(this._flags.last_token.type, [TOKEN.START_BLOCK, TOKEN.SEMICOLON]) && !this._flags.inline_frame) {
|
|
23674
23733
|
this.print_newline();
|
|
23675
23734
|
} else {
|
|
23676
23735
|
this._output.space_before_token = true;
|
|
@@ -23768,7 +23827,8 @@ var require_beautifier = __commonJS({
|
|
|
23768
23827
|
return;
|
|
23769
23828
|
}
|
|
23770
23829
|
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) {
|
|
23771
|
-
if (!this.start_of_object_property()
|
|
23830
|
+
if (!this.start_of_object_property() && !// start of object property is different for numeric values with +/- prefix operators
|
|
23831
|
+
(in_array(this._flags.last_token.text, ["+", "-"]) && this._last_last_text === ":" && this._flags.parent.mode === MODE.ObjectLiteral)) {
|
|
23772
23832
|
this.allow_wrap_or_preserved_newline(current_token);
|
|
23773
23833
|
}
|
|
23774
23834
|
}
|
|
@@ -23967,16 +24027,15 @@ var require_beautifier = __commonJS({
|
|
|
23967
24027
|
var preserve_statement_flags = !isGeneratorAsterisk;
|
|
23968
24028
|
this.handle_whitespace_and_comments(current_token, preserve_statement_flags);
|
|
23969
24029
|
}
|
|
23970
|
-
if (
|
|
23971
|
-
this._output.space_before_token = true;
|
|
24030
|
+
if (current_token.text === "*" && this._flags.last_token.type === TOKEN.DOT) {
|
|
23972
24031
|
this.print_token(current_token);
|
|
23973
24032
|
return;
|
|
23974
24033
|
}
|
|
23975
|
-
if (current_token.text === "
|
|
24034
|
+
if (current_token.text === "::") {
|
|
23976
24035
|
this.print_token(current_token);
|
|
23977
24036
|
return;
|
|
23978
24037
|
}
|
|
23979
|
-
if (current_token.text
|
|
24038
|
+
if (in_array(current_token.text, ["-", "+"]) && this.start_of_object_property()) {
|
|
23980
24039
|
this.print_token(current_token);
|
|
23981
24040
|
return;
|
|
23982
24041
|
}
|
|
@@ -24064,7 +24123,11 @@ var require_beautifier = __commonJS({
|
|
|
24064
24123
|
space_before = false;
|
|
24065
24124
|
space_after = false;
|
|
24066
24125
|
if (current_token.newlines && (current_token.text === "--" || current_token.text === "++" || current_token.text === "~")) {
|
|
24067
|
-
this.
|
|
24126
|
+
var new_line_needed = reserved_array(this._flags.last_token, special_words) && current_token.newlines;
|
|
24127
|
+
if (new_line_needed && (this._previous_flags.if_block || this._previous_flags.else_block)) {
|
|
24128
|
+
this.restore_mode();
|
|
24129
|
+
}
|
|
24130
|
+
this.print_newline(new_line_needed, true);
|
|
24068
24131
|
}
|
|
24069
24132
|
if (this._flags.last_token.text === ";" && is_expression(this._flags.mode)) {
|
|
24070
24133
|
space_before = true;
|
|
@@ -24162,6 +24225,9 @@ var require_beautifier = __commonJS({
|
|
|
24162
24225
|
} else {
|
|
24163
24226
|
this.handle_whitespace_and_comments(current_token, true);
|
|
24164
24227
|
}
|
|
24228
|
+
if (this._flags.last_token.text.match("^[0-9]+$")) {
|
|
24229
|
+
this._output.space_before_token = true;
|
|
24230
|
+
}
|
|
24165
24231
|
if (reserved_array(this._flags.last_token, special_words)) {
|
|
24166
24232
|
this._output.space_before_token = false;
|
|
24167
24233
|
} else {
|
|
@@ -24191,9 +24257,9 @@ var require_beautifier = __commonJS({
|
|
|
24191
24257
|
}
|
|
24192
24258
|
});
|
|
24193
24259
|
|
|
24194
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24260
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/index.js
|
|
24195
24261
|
var require_javascript = __commonJS({
|
|
24196
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24262
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/javascript/index.js"(exports2, module2) {
|
|
24197
24263
|
"use strict";
|
|
24198
24264
|
var Beautifier = require_beautifier().Beautifier;
|
|
24199
24265
|
var Options = require_options2().Options;
|
|
@@ -24208,9 +24274,9 @@ var require_javascript = __commonJS({
|
|
|
24208
24274
|
}
|
|
24209
24275
|
});
|
|
24210
24276
|
|
|
24211
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24277
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/options.js
|
|
24212
24278
|
var require_options3 = __commonJS({
|
|
24213
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24279
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/options.js"(exports2, module2) {
|
|
24214
24280
|
"use strict";
|
|
24215
24281
|
var BaseOptions = require_options().Options;
|
|
24216
24282
|
function Options(options) {
|
|
@@ -24234,9 +24300,9 @@ var require_options3 = __commonJS({
|
|
|
24234
24300
|
}
|
|
24235
24301
|
});
|
|
24236
24302
|
|
|
24237
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24303
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/beautifier.js
|
|
24238
24304
|
var require_beautifier2 = __commonJS({
|
|
24239
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24305
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/beautifier.js"(exports2, module2) {
|
|
24240
24306
|
"use strict";
|
|
24241
24307
|
var Options = require_options3().Options;
|
|
24242
24308
|
var Output = require_output().Output;
|
|
@@ -24255,20 +24321,21 @@ var require_beautifier2 = __commonJS({
|
|
|
24255
24321
|
this._ch = null;
|
|
24256
24322
|
this._input = null;
|
|
24257
24323
|
this.NESTED_AT_RULE = {
|
|
24258
|
-
"
|
|
24259
|
-
"
|
|
24260
|
-
"
|
|
24324
|
+
"page": true,
|
|
24325
|
+
"font-face": true,
|
|
24326
|
+
"keyframes": true,
|
|
24261
24327
|
// also in CONDITIONAL_GROUP_RULE below
|
|
24262
|
-
"
|
|
24263
|
-
"
|
|
24264
|
-
"
|
|
24328
|
+
"media": true,
|
|
24329
|
+
"supports": true,
|
|
24330
|
+
"document": true
|
|
24265
24331
|
};
|
|
24266
24332
|
this.CONDITIONAL_GROUP_RULE = {
|
|
24267
|
-
"
|
|
24268
|
-
"
|
|
24269
|
-
"
|
|
24333
|
+
"media": true,
|
|
24334
|
+
"supports": true,
|
|
24335
|
+
"document": true
|
|
24270
24336
|
};
|
|
24271
24337
|
this.NON_SEMICOLON_NEWLINE_PROPERTY = [
|
|
24338
|
+
"grid-template-areas",
|
|
24272
24339
|
"grid-template"
|
|
24273
24340
|
];
|
|
24274
24341
|
}
|
|
@@ -24363,8 +24430,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24363
24430
|
var insideRule = false;
|
|
24364
24431
|
var insidePropertyValue = false;
|
|
24365
24432
|
var enteringConditionalGroup = false;
|
|
24366
|
-
var
|
|
24367
|
-
var insideAtImport = false;
|
|
24433
|
+
var insideNonNestedAtRule = false;
|
|
24368
24434
|
var insideScssMap = false;
|
|
24369
24435
|
var topCharacter = this._ch;
|
|
24370
24436
|
var insideNonSemiColonValues = false;
|
|
@@ -24398,7 +24464,20 @@ var require_beautifier2 = __commonJS({
|
|
|
24398
24464
|
this._input.back();
|
|
24399
24465
|
this.print_string(this._input.read(comment_pattern));
|
|
24400
24466
|
this.eatWhitespace(true);
|
|
24401
|
-
} else if (this._ch === "
|
|
24467
|
+
} else if (this._ch === "$") {
|
|
24468
|
+
this.preserveSingleSpace(isAfterSpace);
|
|
24469
|
+
this.print_string(this._ch);
|
|
24470
|
+
var variable = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);
|
|
24471
|
+
if (variable.match(/[ :]$/)) {
|
|
24472
|
+
variable = this.eatString(": ").replace(/\s+$/, "");
|
|
24473
|
+
this.print_string(variable);
|
|
24474
|
+
this._output.space_before_token = true;
|
|
24475
|
+
}
|
|
24476
|
+
if (parenLevel === 0 && variable.indexOf(":") !== -1) {
|
|
24477
|
+
insidePropertyValue = true;
|
|
24478
|
+
this.indent();
|
|
24479
|
+
}
|
|
24480
|
+
} else if (this._ch === "@") {
|
|
24402
24481
|
this.preserveSingleSpace(isAfterSpace);
|
|
24403
24482
|
if (this._input.peek() === "{") {
|
|
24404
24483
|
this.print_string(this._ch + this.eatString("}"));
|
|
@@ -24406,24 +24485,20 @@ var require_beautifier2 = __commonJS({
|
|
|
24406
24485
|
this.print_string(this._ch);
|
|
24407
24486
|
var variableOrRule = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);
|
|
24408
24487
|
if (variableOrRule.match(/[ :]$/)) {
|
|
24409
|
-
variableOrRule = this.eatString(": ").replace(/\s
|
|
24488
|
+
variableOrRule = this.eatString(": ").replace(/\s+$/, "");
|
|
24410
24489
|
this.print_string(variableOrRule);
|
|
24411
24490
|
this._output.space_before_token = true;
|
|
24412
24491
|
}
|
|
24413
|
-
|
|
24414
|
-
|
|
24415
|
-
|
|
24416
|
-
} else if (variableOrRule
|
|
24417
|
-
insideAtImport = true;
|
|
24418
|
-
}
|
|
24419
|
-
if (variableOrRule in this.NESTED_AT_RULE) {
|
|
24492
|
+
if (parenLevel === 0 && variableOrRule.indexOf(":") !== -1) {
|
|
24493
|
+
insidePropertyValue = true;
|
|
24494
|
+
this.indent();
|
|
24495
|
+
} else if (variableOrRule in this.NESTED_AT_RULE) {
|
|
24420
24496
|
this._nestedLevel += 1;
|
|
24421
24497
|
if (variableOrRule in this.CONDITIONAL_GROUP_RULE) {
|
|
24422
24498
|
enteringConditionalGroup = true;
|
|
24423
24499
|
}
|
|
24424
|
-
} else if (
|
|
24425
|
-
|
|
24426
|
-
this.indent();
|
|
24500
|
+
} else if (parenLevel === 0 && !insidePropertyValue) {
|
|
24501
|
+
insideNonNestedAtRule = true;
|
|
24427
24502
|
}
|
|
24428
24503
|
}
|
|
24429
24504
|
} else if (this._ch === "#" && this._input.peek() === "{") {
|
|
@@ -24434,6 +24509,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24434
24509
|
insidePropertyValue = false;
|
|
24435
24510
|
this.outdent();
|
|
24436
24511
|
}
|
|
24512
|
+
insideNonNestedAtRule = false;
|
|
24437
24513
|
if (enteringConditionalGroup) {
|
|
24438
24514
|
enteringConditionalGroup = false;
|
|
24439
24515
|
insideRule = this._indentLevel >= this._nestedLevel;
|
|
@@ -24467,8 +24543,6 @@ var require_beautifier2 = __commonJS({
|
|
|
24467
24543
|
if (previous_ch === "{") {
|
|
24468
24544
|
this._output.trim(true);
|
|
24469
24545
|
}
|
|
24470
|
-
insideAtImport = false;
|
|
24471
|
-
insideAtExtend = false;
|
|
24472
24546
|
if (insidePropertyValue) {
|
|
24473
24547
|
this.outdent();
|
|
24474
24548
|
insidePropertyValue = false;
|
|
@@ -24498,7 +24572,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24498
24572
|
break;
|
|
24499
24573
|
}
|
|
24500
24574
|
}
|
|
24501
|
-
if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !
|
|
24575
|
+
if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideNonNestedAtRule && parenLevel === 0) {
|
|
24502
24576
|
this.print_string(":");
|
|
24503
24577
|
if (!insidePropertyValue) {
|
|
24504
24578
|
insidePropertyValue = true;
|
|
@@ -24518,7 +24592,8 @@ var require_beautifier2 = __commonJS({
|
|
|
24518
24592
|
}
|
|
24519
24593
|
}
|
|
24520
24594
|
} else if (this._ch === '"' || this._ch === "'") {
|
|
24521
|
-
|
|
24595
|
+
var preserveQuoteSpace = previous_ch === '"' || previous_ch === "'";
|
|
24596
|
+
this.preserveSingleSpace(preserveQuoteSpace || isAfterSpace);
|
|
24522
24597
|
this.print_string(this._ch + this.eatString(this._ch));
|
|
24523
24598
|
this.eatWhitespace(true);
|
|
24524
24599
|
} else if (this._ch === ";") {
|
|
@@ -24528,8 +24603,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24528
24603
|
this.outdent();
|
|
24529
24604
|
insidePropertyValue = false;
|
|
24530
24605
|
}
|
|
24531
|
-
|
|
24532
|
-
insideAtImport = false;
|
|
24606
|
+
insideNonNestedAtRule = false;
|
|
24533
24607
|
this.print_string(this._ch);
|
|
24534
24608
|
this.eatWhitespace(true);
|
|
24535
24609
|
if (this._input.peek() !== "/") {
|
|
@@ -24557,7 +24631,11 @@ var require_beautifier2 = __commonJS({
|
|
|
24557
24631
|
}
|
|
24558
24632
|
}
|
|
24559
24633
|
} else {
|
|
24560
|
-
|
|
24634
|
+
var space_needed = false;
|
|
24635
|
+
if (this._input.lookBack("with")) {
|
|
24636
|
+
space_needed = true;
|
|
24637
|
+
}
|
|
24638
|
+
this.preserveSingleSpace(isAfterSpace || space_needed);
|
|
24561
24639
|
this.print_string(this._ch);
|
|
24562
24640
|
if (insidePropertyValue && previous_ch === "$" && this._options.selector_separator_newline) {
|
|
24563
24641
|
this._output.add_new_line();
|
|
@@ -24582,7 +24660,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24582
24660
|
} else if (this._ch === ",") {
|
|
24583
24661
|
this.print_string(this._ch);
|
|
24584
24662
|
this.eatWhitespace(true);
|
|
24585
|
-
if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !
|
|
24663
|
+
if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideNonNestedAtRule) {
|
|
24586
24664
|
this._output.add_new_line();
|
|
24587
24665
|
} else {
|
|
24588
24666
|
this._output.space_before_token = true;
|
|
@@ -24611,7 +24689,7 @@ var require_beautifier2 = __commonJS({
|
|
|
24611
24689
|
this._ch = "";
|
|
24612
24690
|
}
|
|
24613
24691
|
} else if (this._ch === "!" && !this._input.lookBack("\\")) {
|
|
24614
|
-
this.
|
|
24692
|
+
this._output.space_before_token = true;
|
|
24615
24693
|
this.print_string(this._ch);
|
|
24616
24694
|
} else {
|
|
24617
24695
|
var preserveAfterSpace = previous_ch === '"' || previous_ch === "'";
|
|
@@ -24629,9 +24707,9 @@ var require_beautifier2 = __commonJS({
|
|
|
24629
24707
|
}
|
|
24630
24708
|
});
|
|
24631
24709
|
|
|
24632
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24710
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/index.js
|
|
24633
24711
|
var require_css = __commonJS({
|
|
24634
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24712
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/css/index.js"(exports2, module2) {
|
|
24635
24713
|
"use strict";
|
|
24636
24714
|
var Beautifier = require_beautifier2().Beautifier;
|
|
24637
24715
|
var Options = require_options3().Options;
|
|
@@ -24646,9 +24724,9 @@ var require_css = __commonJS({
|
|
|
24646
24724
|
}
|
|
24647
24725
|
});
|
|
24648
24726
|
|
|
24649
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24727
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/options.js
|
|
24650
24728
|
var require_options4 = __commonJS({
|
|
24651
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24729
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/options.js"(exports2, module2) {
|
|
24652
24730
|
"use strict";
|
|
24653
24731
|
var BaseOptions = require_options().Options;
|
|
24654
24732
|
function Options(options) {
|
|
@@ -24664,6 +24742,7 @@ var require_options4 = __commonJS({
|
|
|
24664
24742
|
"wrap_attributes",
|
|
24665
24743
|
["auto", "force", "force-aligned", "force-expand-multiline", "aligned-multiple", "preserve", "preserve-aligned"]
|
|
24666
24744
|
);
|
|
24745
|
+
this.wrap_attributes_min_attrs = this._get_number("wrap_attributes_min_attrs", 2);
|
|
24667
24746
|
this.wrap_attributes_indent_size = this._get_number("wrap_attributes_indent_size", this.indent_size);
|
|
24668
24747
|
this.extra_liners = this._get_array("extra_liners", ["head", "body", "/html"]);
|
|
24669
24748
|
this.inline = this._get_array("inline", [
|
|
@@ -24727,6 +24806,7 @@ var require_options4 = __commonJS({
|
|
|
24727
24806
|
"strike",
|
|
24728
24807
|
"tt"
|
|
24729
24808
|
]);
|
|
24809
|
+
this.inline_custom_elements = this._get_boolean("inline_custom_elements", true);
|
|
24730
24810
|
this.void_elements = this._get_array("void_elements", [
|
|
24731
24811
|
// HTLM void elements - aka self-closing tags - aka singletons
|
|
24732
24812
|
// https://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements
|
|
@@ -24770,9 +24850,9 @@ var require_options4 = __commonJS({
|
|
|
24770
24850
|
}
|
|
24771
24851
|
});
|
|
24772
24852
|
|
|
24773
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
24853
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/tokenizer.js
|
|
24774
24854
|
var require_tokenizer3 = __commonJS({
|
|
24775
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
24855
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/tokenizer.js"(exports2, module2) {
|
|
24776
24856
|
"use strict";
|
|
24777
24857
|
var BaseTokenizer = require_tokenizer().Tokenizer;
|
|
24778
24858
|
var BASETOKEN = require_tokenizer().TOKEN;
|
|
@@ -24782,6 +24862,8 @@ var require_tokenizer3 = __commonJS({
|
|
|
24782
24862
|
var TOKEN = {
|
|
24783
24863
|
TAG_OPEN: "TK_TAG_OPEN",
|
|
24784
24864
|
TAG_CLOSE: "TK_TAG_CLOSE",
|
|
24865
|
+
CONTROL_FLOW_OPEN: "TK_CONTROL_FLOW_OPEN",
|
|
24866
|
+
CONTROL_FLOW_CLOSE: "TK_CONTROL_FLOW_CLOSE",
|
|
24785
24867
|
ATTRIBUTE: "TK_ATTRIBUTE",
|
|
24786
24868
|
EQUALS: "TK_EQUALS",
|
|
24787
24869
|
VALUE: "TK_VALUE",
|
|
@@ -24800,10 +24882,12 @@ var require_tokenizer3 = __commonJS({
|
|
|
24800
24882
|
var pattern_reader = new Pattern(this._input);
|
|
24801
24883
|
this.__patterns = {
|
|
24802
24884
|
word: templatable_reader.until(/[\n\r\t <]/),
|
|
24885
|
+
word_control_flow_close_excluded: templatable_reader.until(/[\n\r\t <}]/),
|
|
24803
24886
|
single_quote: templatable_reader.until_after(/'/),
|
|
24804
24887
|
double_quote: templatable_reader.until_after(/"/),
|
|
24805
24888
|
attribute: templatable_reader.until(/[\n\r\t =>]|\/>/),
|
|
24806
24889
|
element_name: templatable_reader.until(/[\n\r\t >\/]/),
|
|
24890
|
+
angular_control_flow_start: pattern_reader.matching(/\@[a-zA-Z]+[^({]*[({]/),
|
|
24807
24891
|
handlebars_comment: pattern_reader.starting_with(/{{!--/).until_after(/--}}/),
|
|
24808
24892
|
handlebars: pattern_reader.starting_with(/{{/).until_after(/}}/),
|
|
24809
24893
|
handlebars_open: pattern_reader.until(/[\n\r\t }]/),
|
|
@@ -24816,6 +24900,7 @@ var require_tokenizer3 = __commonJS({
|
|
|
24816
24900
|
};
|
|
24817
24901
|
if (this._options.indent_handlebars) {
|
|
24818
24902
|
this.__patterns.word = this.__patterns.word.exclude("handlebars");
|
|
24903
|
+
this.__patterns.word_control_flow_close_excluded = this.__patterns.word_control_flow_close_excluded.exclude("handlebars");
|
|
24819
24904
|
}
|
|
24820
24905
|
this._unformatted_content_delimiter = null;
|
|
24821
24906
|
if (this._options.unformatted_content_delimiter) {
|
|
@@ -24828,10 +24913,10 @@ var require_tokenizer3 = __commonJS({
|
|
|
24828
24913
|
return false;
|
|
24829
24914
|
};
|
|
24830
24915
|
Tokenizer.prototype._is_opening = function(current_token) {
|
|
24831
|
-
return current_token.type === TOKEN.TAG_OPEN;
|
|
24916
|
+
return current_token.type === TOKEN.TAG_OPEN || current_token.type === TOKEN.CONTROL_FLOW_OPEN;
|
|
24832
24917
|
};
|
|
24833
24918
|
Tokenizer.prototype._is_closing = function(current_token, open_token) {
|
|
24834
|
-
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] === "{"));
|
|
24919
|
+
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("{"));
|
|
24835
24920
|
};
|
|
24836
24921
|
Tokenizer.prototype._reset = function() {
|
|
24837
24922
|
this._current_tag_name = "";
|
|
@@ -24846,8 +24931,9 @@ var require_tokenizer3 = __commonJS({
|
|
|
24846
24931
|
token = token || this._read_open_handlebars(c, open_token);
|
|
24847
24932
|
token = token || this._read_attribute(c, previous_token, open_token);
|
|
24848
24933
|
token = token || this._read_close(c, open_token);
|
|
24934
|
+
token = token || this._read_control_flows(c, open_token);
|
|
24849
24935
|
token = token || this._read_raw_content(c, previous_token, open_token);
|
|
24850
|
-
token = token || this._read_content_word(c);
|
|
24936
|
+
token = token || this._read_content_word(c, open_token);
|
|
24851
24937
|
token = token || this._read_comment_or_cdata(c);
|
|
24852
24938
|
token = token || this._read_processing(c);
|
|
24853
24939
|
token = token || this._read_open(c, open_token);
|
|
@@ -24898,7 +24984,7 @@ var require_tokenizer3 = __commonJS({
|
|
|
24898
24984
|
Tokenizer.prototype._read_open = function(c, open_token) {
|
|
24899
24985
|
var resulting_string = null;
|
|
24900
24986
|
var token = null;
|
|
24901
|
-
if (!open_token) {
|
|
24987
|
+
if (!open_token || open_token.type === TOKEN.CONTROL_FLOW_OPEN) {
|
|
24902
24988
|
if (c === "<") {
|
|
24903
24989
|
resulting_string = this._input.next();
|
|
24904
24990
|
if (this._input.peek() === "/") {
|
|
@@ -24913,7 +24999,7 @@ var require_tokenizer3 = __commonJS({
|
|
|
24913
24999
|
Tokenizer.prototype._read_open_handlebars = function(c, open_token) {
|
|
24914
25000
|
var resulting_string = null;
|
|
24915
25001
|
var token = null;
|
|
24916
|
-
if (!open_token) {
|
|
25002
|
+
if (!open_token || open_token.type === TOKEN.CONTROL_FLOW_OPEN) {
|
|
24917
25003
|
if (this._options.indent_handlebars && c === "{" && this._input.peek(1) === "{") {
|
|
24918
25004
|
if (this._input.peek(2) === "!") {
|
|
24919
25005
|
resulting_string = this.__patterns.handlebars_comment.read();
|
|
@@ -24927,10 +25013,41 @@ var require_tokenizer3 = __commonJS({
|
|
|
24927
25013
|
}
|
|
24928
25014
|
return token;
|
|
24929
25015
|
};
|
|
25016
|
+
Tokenizer.prototype._read_control_flows = function(c, open_token) {
|
|
25017
|
+
var resulting_string = "";
|
|
25018
|
+
var token = null;
|
|
25019
|
+
if (!this._options.templating.includes("angular") || !this._options.indent_handlebars) {
|
|
25020
|
+
return token;
|
|
25021
|
+
}
|
|
25022
|
+
if (c === "@") {
|
|
25023
|
+
resulting_string = this.__patterns.angular_control_flow_start.read();
|
|
25024
|
+
if (resulting_string === "") {
|
|
25025
|
+
return token;
|
|
25026
|
+
}
|
|
25027
|
+
var opening_parentheses_count = resulting_string.endsWith("(") ? 1 : 0;
|
|
25028
|
+
var closing_parentheses_count = 0;
|
|
25029
|
+
while (!(resulting_string.endsWith("{") && opening_parentheses_count === closing_parentheses_count)) {
|
|
25030
|
+
var next_char = this._input.next();
|
|
25031
|
+
if (next_char === null) {
|
|
25032
|
+
break;
|
|
25033
|
+
} else if (next_char === "(") {
|
|
25034
|
+
opening_parentheses_count++;
|
|
25035
|
+
} else if (next_char === ")") {
|
|
25036
|
+
closing_parentheses_count++;
|
|
25037
|
+
}
|
|
25038
|
+
resulting_string += next_char;
|
|
25039
|
+
}
|
|
25040
|
+
token = this._create_token(TOKEN.CONTROL_FLOW_OPEN, resulting_string);
|
|
25041
|
+
} else if (c === "}" && open_token && open_token.type === TOKEN.CONTROL_FLOW_OPEN) {
|
|
25042
|
+
resulting_string = this._input.next();
|
|
25043
|
+
token = this._create_token(TOKEN.CONTROL_FLOW_CLOSE, resulting_string);
|
|
25044
|
+
}
|
|
25045
|
+
return token;
|
|
25046
|
+
};
|
|
24930
25047
|
Tokenizer.prototype._read_close = function(c, open_token) {
|
|
24931
25048
|
var resulting_string = null;
|
|
24932
25049
|
var token = null;
|
|
24933
|
-
if (open_token) {
|
|
25050
|
+
if (open_token && open_token.type === TOKEN.TAG_OPEN) {
|
|
24934
25051
|
if (open_token.text[0] === "<" && (c === ">" || c === "/" && this._input.peek(1) === ">")) {
|
|
24935
25052
|
resulting_string = this._input.next();
|
|
24936
25053
|
if (c === "/") {
|
|
@@ -24997,7 +25114,7 @@ var require_tokenizer3 = __commonJS({
|
|
|
24997
25114
|
}
|
|
24998
25115
|
return null;
|
|
24999
25116
|
};
|
|
25000
|
-
Tokenizer.prototype._read_content_word = function(c) {
|
|
25117
|
+
Tokenizer.prototype._read_content_word = function(c, open_token) {
|
|
25001
25118
|
var resulting_string = "";
|
|
25002
25119
|
if (this._options.unformatted_content_delimiter) {
|
|
25003
25120
|
if (c === this._options.unformatted_content_delimiter[0]) {
|
|
@@ -25005,7 +25122,7 @@ var require_tokenizer3 = __commonJS({
|
|
|
25005
25122
|
}
|
|
25006
25123
|
}
|
|
25007
25124
|
if (!resulting_string) {
|
|
25008
|
-
resulting_string = this.__patterns.word.read();
|
|
25125
|
+
resulting_string = open_token && open_token.type === TOKEN.CONTROL_FLOW_OPEN ? this.__patterns.word_control_flow_close_excluded.read() : this.__patterns.word.read();
|
|
25009
25126
|
}
|
|
25010
25127
|
if (resulting_string) {
|
|
25011
25128
|
return this._create_token(TOKEN.TEXT, resulting_string);
|
|
@@ -25016,9 +25133,9 @@ var require_tokenizer3 = __commonJS({
|
|
|
25016
25133
|
}
|
|
25017
25134
|
});
|
|
25018
25135
|
|
|
25019
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
25136
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/beautifier.js
|
|
25020
25137
|
var require_beautifier3 = __commonJS({
|
|
25021
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
25138
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/beautifier.js"(exports2, module2) {
|
|
25022
25139
|
"use strict";
|
|
25023
25140
|
var Options = require_options4().Options;
|
|
25024
25141
|
var Output = require_output().Output;
|
|
@@ -25084,6 +25201,12 @@ var require_beautifier3 = __commonJS({
|
|
|
25084
25201
|
Printer3.prototype.indent = function() {
|
|
25085
25202
|
this.indent_level++;
|
|
25086
25203
|
};
|
|
25204
|
+
Printer3.prototype.deindent = function() {
|
|
25205
|
+
if (this.indent_level > 0) {
|
|
25206
|
+
this.indent_level--;
|
|
25207
|
+
this._output.set_indent(this.indent_level, this.alignment_size);
|
|
25208
|
+
}
|
|
25209
|
+
};
|
|
25087
25210
|
Printer3.prototype.get_full_indent = function(level) {
|
|
25088
25211
|
level = this.indent_level + (level || 0);
|
|
25089
25212
|
if (level < 1) {
|
|
@@ -25221,14 +25344,18 @@ var require_beautifier3 = __commonJS({
|
|
|
25221
25344
|
var raw_token = tokens.next();
|
|
25222
25345
|
while (raw_token.type !== TOKEN.EOF) {
|
|
25223
25346
|
if (raw_token.type === TOKEN.TAG_OPEN || raw_token.type === TOKEN.COMMENT) {
|
|
25224
|
-
parser_token = this._handle_tag_open(printer, raw_token, last_tag_token, last_token);
|
|
25347
|
+
parser_token = this._handle_tag_open(printer, raw_token, last_tag_token, last_token, tokens);
|
|
25225
25348
|
last_tag_token = parser_token;
|
|
25226
25349
|
} 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) {
|
|
25227
|
-
parser_token = this._handle_inside_tag(printer, raw_token, last_tag_token,
|
|
25350
|
+
parser_token = this._handle_inside_tag(printer, raw_token, last_tag_token, last_token);
|
|
25228
25351
|
} else if (raw_token.type === TOKEN.TAG_CLOSE) {
|
|
25229
25352
|
parser_token = this._handle_tag_close(printer, raw_token, last_tag_token);
|
|
25230
25353
|
} else if (raw_token.type === TOKEN.TEXT) {
|
|
25231
25354
|
parser_token = this._handle_text(printer, raw_token, last_tag_token);
|
|
25355
|
+
} else if (raw_token.type === TOKEN.CONTROL_FLOW_OPEN) {
|
|
25356
|
+
parser_token = this._handle_control_flow_open(printer, raw_token);
|
|
25357
|
+
} else if (raw_token.type === TOKEN.CONTROL_FLOW_CLOSE) {
|
|
25358
|
+
parser_token = this._handle_control_flow_close(printer, raw_token);
|
|
25232
25359
|
} else {
|
|
25233
25360
|
printer.add_raw_token(raw_token);
|
|
25234
25361
|
}
|
|
@@ -25238,6 +25365,35 @@ var require_beautifier3 = __commonJS({
|
|
|
25238
25365
|
var sweet_code = printer._output.get_code(eol);
|
|
25239
25366
|
return sweet_code;
|
|
25240
25367
|
};
|
|
25368
|
+
Beautifier.prototype._handle_control_flow_open = function(printer, raw_token) {
|
|
25369
|
+
var parser_token = {
|
|
25370
|
+
text: raw_token.text,
|
|
25371
|
+
type: raw_token.type
|
|
25372
|
+
};
|
|
25373
|
+
printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== "", true);
|
|
25374
|
+
if (raw_token.newlines) {
|
|
25375
|
+
printer.print_preserved_newlines(raw_token);
|
|
25376
|
+
} else {
|
|
25377
|
+
printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== "", true);
|
|
25378
|
+
}
|
|
25379
|
+
printer.print_token(raw_token);
|
|
25380
|
+
printer.indent();
|
|
25381
|
+
return parser_token;
|
|
25382
|
+
};
|
|
25383
|
+
Beautifier.prototype._handle_control_flow_close = function(printer, raw_token) {
|
|
25384
|
+
var parser_token = {
|
|
25385
|
+
text: raw_token.text,
|
|
25386
|
+
type: raw_token.type
|
|
25387
|
+
};
|
|
25388
|
+
printer.deindent();
|
|
25389
|
+
if (raw_token.newlines) {
|
|
25390
|
+
printer.print_preserved_newlines(raw_token);
|
|
25391
|
+
} else {
|
|
25392
|
+
printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== "", true);
|
|
25393
|
+
}
|
|
25394
|
+
printer.print_token(raw_token);
|
|
25395
|
+
return parser_token;
|
|
25396
|
+
};
|
|
25241
25397
|
Beautifier.prototype._handle_tag_close = function(printer, raw_token, last_tag_token) {
|
|
25242
25398
|
var parser_token = {
|
|
25243
25399
|
text: raw_token.text,
|
|
@@ -25266,7 +25422,7 @@ var require_beautifier3 = __commonJS({
|
|
|
25266
25422
|
}
|
|
25267
25423
|
return parser_token;
|
|
25268
25424
|
};
|
|
25269
|
-
Beautifier.prototype._handle_inside_tag = function(printer, raw_token, last_tag_token,
|
|
25425
|
+
Beautifier.prototype._handle_inside_tag = function(printer, raw_token, last_tag_token, last_token) {
|
|
25270
25426
|
var wrapped = last_tag_token.has_wrapped_attrs;
|
|
25271
25427
|
var parser_token = {
|
|
25272
25428
|
text: raw_token.text,
|
|
@@ -25285,7 +25441,6 @@ var require_beautifier3 = __commonJS({
|
|
|
25285
25441
|
} else {
|
|
25286
25442
|
if (raw_token.type === TOKEN.ATTRIBUTE) {
|
|
25287
25443
|
printer.set_space_before_token(true);
|
|
25288
|
-
last_tag_token.attr_count += 1;
|
|
25289
25444
|
} else if (raw_token.type === TOKEN.EQUALS) {
|
|
25290
25445
|
printer.set_space_before_token(false);
|
|
25291
25446
|
} else if (raw_token.type === TOKEN.VALUE && raw_token.previous.type === TOKEN.EQUALS) {
|
|
@@ -25296,26 +25451,10 @@ var require_beautifier3 = __commonJS({
|
|
|
25296
25451
|
printer.traverse_whitespace(raw_token);
|
|
25297
25452
|
wrapped = wrapped || raw_token.newlines !== 0;
|
|
25298
25453
|
}
|
|
25299
|
-
if (this._is_wrap_attributes_force
|
|
25300
|
-
|
|
25301
|
-
|
|
25302
|
-
|
|
25303
|
-
var peek_index = 0;
|
|
25304
|
-
var peek_token;
|
|
25305
|
-
do {
|
|
25306
|
-
peek_token = tokens.peek(peek_index);
|
|
25307
|
-
if (peek_token.type === TOKEN.ATTRIBUTE) {
|
|
25308
|
-
is_only_attribute = false;
|
|
25309
|
-
break;
|
|
25310
|
-
}
|
|
25311
|
-
peek_index += 1;
|
|
25312
|
-
} while (peek_index < 4 && peek_token.type !== TOKEN.EOF && peek_token.type !== TOKEN.TAG_CLOSE);
|
|
25313
|
-
force_attr_wrap = !is_only_attribute;
|
|
25314
|
-
}
|
|
25315
|
-
if (force_attr_wrap) {
|
|
25316
|
-
printer.print_newline(false);
|
|
25317
|
-
wrapped = true;
|
|
25318
|
-
}
|
|
25454
|
+
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
|
|
25455
|
+
this._is_wrap_attributes_force_expand_multiline)) {
|
|
25456
|
+
printer.print_newline(false);
|
|
25457
|
+
wrapped = true;
|
|
25319
25458
|
}
|
|
25320
25459
|
}
|
|
25321
25460
|
printer.print_token(raw_token);
|
|
@@ -25412,9 +25551,9 @@ var require_beautifier3 = __commonJS({
|
|
|
25412
25551
|
}
|
|
25413
25552
|
}
|
|
25414
25553
|
};
|
|
25415
|
-
Beautifier.prototype._handle_tag_open = function(printer, raw_token, last_tag_token, last_token) {
|
|
25554
|
+
Beautifier.prototype._handle_tag_open = function(printer, raw_token, last_tag_token, last_token, tokens) {
|
|
25416
25555
|
var parser_token = this._get_tag_open_token(raw_token);
|
|
25417
|
-
if ((last_tag_token.is_unformatted || last_tag_token.is_content_unformatted) && !last_tag_token.is_empty_element && raw_token.type === TOKEN.TAG_OPEN &&
|
|
25556
|
+
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) {
|
|
25418
25557
|
printer.add_raw_token(raw_token);
|
|
25419
25558
|
parser_token.start_tag_token = this._tag_stack.try_pop(parser_token.tag_name);
|
|
25420
25559
|
} else {
|
|
@@ -25425,6 +25564,17 @@ var require_beautifier3 = __commonJS({
|
|
|
25425
25564
|
}
|
|
25426
25565
|
printer.print_token(raw_token);
|
|
25427
25566
|
}
|
|
25567
|
+
if (parser_token.is_start_tag && this._is_wrap_attributes_force) {
|
|
25568
|
+
var peek_index = 0;
|
|
25569
|
+
var peek_token;
|
|
25570
|
+
do {
|
|
25571
|
+
peek_token = tokens.peek(peek_index);
|
|
25572
|
+
if (peek_token.type === TOKEN.ATTRIBUTE) {
|
|
25573
|
+
parser_token.attr_count += 1;
|
|
25574
|
+
}
|
|
25575
|
+
peek_index += 1;
|
|
25576
|
+
} while (peek_token.type !== TOKEN.EOF && peek_token.type !== TOKEN.TAG_CLOSE);
|
|
25577
|
+
}
|
|
25428
25578
|
if (this._is_wrap_attributes_force_aligned || this._is_wrap_attributes_aligned_multiple || this._is_wrap_attributes_preserve_aligned) {
|
|
25429
25579
|
parser_token.alignment_size = raw_token.text.length + 1;
|
|
25430
25580
|
}
|
|
@@ -25464,10 +25614,14 @@ var require_beautifier3 = __commonJS({
|
|
|
25464
25614
|
tag_check_match = raw_token.text.match(/^<([^\s>]*)/);
|
|
25465
25615
|
this.tag_check = tag_check_match ? tag_check_match[1] : "";
|
|
25466
25616
|
} else {
|
|
25467
|
-
tag_check_match = raw_token.text.match(/^{{(?:[\^]|#\*?)?([^\s}]+)/);
|
|
25617
|
+
tag_check_match = raw_token.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/);
|
|
25468
25618
|
this.tag_check = tag_check_match ? tag_check_match[1] : "";
|
|
25469
|
-
if (raw_token.text
|
|
25470
|
-
this.tag_check
|
|
25619
|
+
if ((raw_token.text.startsWith("{{#>") || raw_token.text.startsWith("{{~#>")) && this.tag_check[0] === ">") {
|
|
25620
|
+
if (this.tag_check === ">" && raw_token.next !== null) {
|
|
25621
|
+
this.tag_check = raw_token.next.text.split(" ")[0];
|
|
25622
|
+
} else {
|
|
25623
|
+
this.tag_check = raw_token.text.split(">")[1];
|
|
25624
|
+
}
|
|
25471
25625
|
}
|
|
25472
25626
|
}
|
|
25473
25627
|
this.tag_check = this.tag_check.toLowerCase();
|
|
@@ -25477,7 +25631,13 @@ var require_beautifier3 = __commonJS({
|
|
|
25477
25631
|
this.is_start_tag = this.tag_check.charAt(0) !== "/";
|
|
25478
25632
|
this.tag_name = !this.is_start_tag ? this.tag_check.substr(1) : this.tag_check;
|
|
25479
25633
|
this.is_end_tag = !this.is_start_tag || raw_token.closed && raw_token.closed.text === "/>";
|
|
25480
|
-
|
|
25634
|
+
var handlebar_starts = 2;
|
|
25635
|
+
if (this.tag_start_char === "{" && this.text.length >= 3) {
|
|
25636
|
+
if (this.text.charAt(2) === "~") {
|
|
25637
|
+
handlebar_starts = 3;
|
|
25638
|
+
}
|
|
25639
|
+
}
|
|
25640
|
+
this.is_end_tag = this.is_end_tag || this.tag_start_char === "{" && (this.text.length < 3 || /[^#\^]/.test(this.text.charAt(handlebar_starts)));
|
|
25481
25641
|
}
|
|
25482
25642
|
};
|
|
25483
25643
|
Beautifier.prototype._get_tag_open_token = function(raw_token) {
|
|
@@ -25487,7 +25647,7 @@ var require_beautifier3 = __commonJS({
|
|
|
25487
25647
|
parser_token.is_empty_element = parser_token.tag_complete || parser_token.is_start_tag && parser_token.is_end_tag;
|
|
25488
25648
|
parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted);
|
|
25489
25649
|
parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted);
|
|
25490
|
-
parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_start_char === "{";
|
|
25650
|
+
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 === "{";
|
|
25491
25651
|
return parser_token;
|
|
25492
25652
|
};
|
|
25493
25653
|
Beautifier.prototype._set_tag_position = function(printer, raw_token, parser_token, last_tag_token, last_token) {
|
|
@@ -25560,7 +25720,7 @@ var require_beautifier3 = __commonJS({
|
|
|
25560
25720
|
parser_token.parent.multiline_content = true;
|
|
25561
25721
|
}
|
|
25562
25722
|
};
|
|
25563
|
-
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"];
|
|
25723
|
+
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"];
|
|
25564
25724
|
var p_parent_excludes = ["a", "audio", "del", "ins", "map", "noscript", "video"];
|
|
25565
25725
|
Beautifier.prototype._do_optional_end_element = function(parser_token) {
|
|
25566
25726
|
var result = null;
|
|
@@ -25570,7 +25730,7 @@ var require_beautifier3 = __commonJS({
|
|
|
25570
25730
|
if (parser_token.tag_name === "body") {
|
|
25571
25731
|
result = result || this._tag_stack.try_pop("head");
|
|
25572
25732
|
} else if (parser_token.tag_name === "li") {
|
|
25573
|
-
result = result || this._tag_stack.try_pop("li", ["ol", "ul"]);
|
|
25733
|
+
result = result || this._tag_stack.try_pop("li", ["ol", "ul", "menu"]);
|
|
25574
25734
|
} else if (parser_token.tag_name === "dd" || parser_token.tag_name === "dt") {
|
|
25575
25735
|
result = result || this._tag_stack.try_pop("dt", ["dl"]);
|
|
25576
25736
|
result = result || this._tag_stack.try_pop("dd", ["dl"]);
|
|
@@ -25611,9 +25771,9 @@ var require_beautifier3 = __commonJS({
|
|
|
25611
25771
|
}
|
|
25612
25772
|
});
|
|
25613
25773
|
|
|
25614
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
25774
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/index.js
|
|
25615
25775
|
var require_html = __commonJS({
|
|
25616
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
25776
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/html/index.js"(exports2, module2) {
|
|
25617
25777
|
"use strict";
|
|
25618
25778
|
var Beautifier = require_beautifier3().Beautifier;
|
|
25619
25779
|
var Options = require_options4().Options;
|
|
@@ -25628,9 +25788,9 @@ var require_html = __commonJS({
|
|
|
25628
25788
|
}
|
|
25629
25789
|
});
|
|
25630
25790
|
|
|
25631
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
25791
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/index.js
|
|
25632
25792
|
var require_src = __commonJS({
|
|
25633
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
25793
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/src/index.js"(exports2, module2) {
|
|
25634
25794
|
"use strict";
|
|
25635
25795
|
var js_beautify2 = require_javascript();
|
|
25636
25796
|
var css_beautify = require_css();
|
|
@@ -25647,9 +25807,9 @@ var require_src = __commonJS({
|
|
|
25647
25807
|
}
|
|
25648
25808
|
});
|
|
25649
25809
|
|
|
25650
|
-
// node_modules/.pnpm/js-beautify@1.
|
|
25810
|
+
// node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/index.js
|
|
25651
25811
|
var require_js = __commonJS({
|
|
25652
|
-
"node_modules/.pnpm/js-beautify@1.
|
|
25812
|
+
"node_modules/.pnpm/js-beautify@1.15.1/node_modules/js-beautify/js/index.js"(exports2, module2) {
|
|
25653
25813
|
"use strict";
|
|
25654
25814
|
function get_beautify(js_beautify2, css_beautify, html_beautify) {
|
|
25655
25815
|
var beautify = function(src, config) {
|
|
@@ -26428,18 +26588,18 @@ function pathPlugin(fork2) {
|
|
|
26428
26588
|
this.__childCache = null;
|
|
26429
26589
|
};
|
|
26430
26590
|
var Pp2 = Path2.prototype;
|
|
26431
|
-
function getChildCache(
|
|
26432
|
-
return
|
|
26591
|
+
function getChildCache(path3) {
|
|
26592
|
+
return path3.__childCache || (path3.__childCache = /* @__PURE__ */ Object.create(null));
|
|
26433
26593
|
}
|
|
26434
|
-
function getChildPath(
|
|
26435
|
-
var cache = getChildCache(
|
|
26436
|
-
var actualChildValue =
|
|
26594
|
+
function getChildPath(path3, name) {
|
|
26595
|
+
var cache = getChildCache(path3);
|
|
26596
|
+
var actualChildValue = path3.getValueProperty(name);
|
|
26437
26597
|
var childPath = cache[name];
|
|
26438
26598
|
if (!hasOwn$5.call(cache, name) || // Ensure consistency between cache and reality.
|
|
26439
26599
|
childPath.value !== actualChildValue) {
|
|
26440
|
-
childPath = cache[name] = new
|
|
26600
|
+
childPath = cache[name] = new path3.constructor(
|
|
26441
26601
|
actualChildValue,
|
|
26442
|
-
|
|
26602
|
+
path3,
|
|
26443
26603
|
name
|
|
26444
26604
|
);
|
|
26445
26605
|
}
|
|
@@ -26449,12 +26609,12 @@ function pathPlugin(fork2) {
|
|
|
26449
26609
|
return this.value[name];
|
|
26450
26610
|
};
|
|
26451
26611
|
Pp2.get = function get(...names) {
|
|
26452
|
-
var
|
|
26612
|
+
var path3 = this;
|
|
26453
26613
|
var count = names.length;
|
|
26454
26614
|
for (var i = 0; i < count; ++i) {
|
|
26455
|
-
|
|
26615
|
+
path3 = getChildPath(path3, names[i]);
|
|
26456
26616
|
}
|
|
26457
|
-
return
|
|
26617
|
+
return path3;
|
|
26458
26618
|
};
|
|
26459
26619
|
Pp2.each = function each2(callback, context) {
|
|
26460
26620
|
var childPaths = [];
|
|
@@ -26490,12 +26650,12 @@ function pathPlugin(fork2) {
|
|
|
26490
26650
|
};
|
|
26491
26651
|
function emptyMoves() {
|
|
26492
26652
|
}
|
|
26493
|
-
function getMoves(
|
|
26494
|
-
isArray2.assert(
|
|
26653
|
+
function getMoves(path3, offset, start, end) {
|
|
26654
|
+
isArray2.assert(path3.value);
|
|
26495
26655
|
if (offset === 0) {
|
|
26496
26656
|
return emptyMoves;
|
|
26497
26657
|
}
|
|
26498
|
-
var length =
|
|
26658
|
+
var length = path3.value.length;
|
|
26499
26659
|
if (length < 1) {
|
|
26500
26660
|
return emptyMoves;
|
|
26501
26661
|
}
|
|
@@ -26513,10 +26673,10 @@ function pathPlugin(fork2) {
|
|
|
26513
26673
|
isNumber2.assert(start);
|
|
26514
26674
|
isNumber2.assert(end);
|
|
26515
26675
|
var moves = /* @__PURE__ */ Object.create(null);
|
|
26516
|
-
var cache = getChildCache(
|
|
26676
|
+
var cache = getChildCache(path3);
|
|
26517
26677
|
for (var i = start; i < end; ++i) {
|
|
26518
|
-
if (hasOwn$5.call(
|
|
26519
|
-
var childPath =
|
|
26678
|
+
if (hasOwn$5.call(path3.value, i)) {
|
|
26679
|
+
var childPath = path3.get(i);
|
|
26520
26680
|
if (childPath.name !== i) {
|
|
26521
26681
|
throw new Error("");
|
|
26522
26682
|
}
|
|
@@ -26534,7 +26694,7 @@ function pathPlugin(fork2) {
|
|
|
26534
26694
|
throw new Error("");
|
|
26535
26695
|
}
|
|
26536
26696
|
cache[newIndex2] = childPath2;
|
|
26537
|
-
|
|
26697
|
+
path3.value[newIndex2] = childPath2.value;
|
|
26538
26698
|
}
|
|
26539
26699
|
};
|
|
26540
26700
|
}
|
|
@@ -26593,34 +26753,34 @@ function pathPlugin(fork2) {
|
|
|
26593
26753
|
}
|
|
26594
26754
|
return pp.insertAt.apply(pp, insertAtArgs);
|
|
26595
26755
|
};
|
|
26596
|
-
function repairRelationshipWithParent(
|
|
26597
|
-
if (!(
|
|
26756
|
+
function repairRelationshipWithParent(path3) {
|
|
26757
|
+
if (!(path3 instanceof Path2)) {
|
|
26598
26758
|
throw new Error("");
|
|
26599
26759
|
}
|
|
26600
|
-
var pp =
|
|
26760
|
+
var pp = path3.parentPath;
|
|
26601
26761
|
if (!pp) {
|
|
26602
|
-
return
|
|
26762
|
+
return path3;
|
|
26603
26763
|
}
|
|
26604
26764
|
var parentValue = pp.value;
|
|
26605
26765
|
var parentCache = getChildCache(pp);
|
|
26606
|
-
if (parentValue[
|
|
26607
|
-
parentCache[
|
|
26766
|
+
if (parentValue[path3.name] === path3.value) {
|
|
26767
|
+
parentCache[path3.name] = path3;
|
|
26608
26768
|
} else if (isArray2.check(parentValue)) {
|
|
26609
|
-
var i = parentValue.indexOf(
|
|
26769
|
+
var i = parentValue.indexOf(path3.value);
|
|
26610
26770
|
if (i >= 0) {
|
|
26611
|
-
parentCache[
|
|
26771
|
+
parentCache[path3.name = i] = path3;
|
|
26612
26772
|
}
|
|
26613
26773
|
} else {
|
|
26614
|
-
parentValue[
|
|
26615
|
-
parentCache[
|
|
26774
|
+
parentValue[path3.name] = path3.value;
|
|
26775
|
+
parentCache[path3.name] = path3;
|
|
26616
26776
|
}
|
|
26617
|
-
if (parentValue[
|
|
26777
|
+
if (parentValue[path3.name] !== path3.value) {
|
|
26618
26778
|
throw new Error("");
|
|
26619
26779
|
}
|
|
26620
|
-
if (
|
|
26780
|
+
if (path3.parentPath.get(path3.name) !== path3) {
|
|
26621
26781
|
throw new Error("");
|
|
26622
26782
|
}
|
|
26623
|
-
return
|
|
26783
|
+
return path3;
|
|
26624
26784
|
}
|
|
26625
26785
|
Pp2.replace = function replace(replacement) {
|
|
26626
26786
|
var results = [];
|
|
@@ -26689,12 +26849,12 @@ function scopePlugin(fork2) {
|
|
|
26689
26849
|
var Expression2 = namedTypes2.Expression;
|
|
26690
26850
|
var isArray2 = types.builtInTypes.array;
|
|
26691
26851
|
var b = types.builders;
|
|
26692
|
-
const Scope = function Scope2(
|
|
26852
|
+
const Scope = function Scope2(path3, parentScope) {
|
|
26693
26853
|
if (!(this instanceof Scope2)) {
|
|
26694
26854
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
26695
26855
|
}
|
|
26696
|
-
if (!TypeParameterScopeType.check(
|
|
26697
|
-
ScopeType.assert(
|
|
26856
|
+
if (!TypeParameterScopeType.check(path3.value)) {
|
|
26857
|
+
ScopeType.assert(path3.value);
|
|
26698
26858
|
}
|
|
26699
26859
|
var depth;
|
|
26700
26860
|
if (parentScope) {
|
|
@@ -26707,8 +26867,8 @@ function scopePlugin(fork2) {
|
|
|
26707
26867
|
depth = 0;
|
|
26708
26868
|
}
|
|
26709
26869
|
Object.defineProperties(this, {
|
|
26710
|
-
path: { value:
|
|
26711
|
-
node: { value:
|
|
26870
|
+
path: { value: path3 },
|
|
26871
|
+
node: { value: path3.value },
|
|
26712
26872
|
isGlobal: { value: !parentScope, enumerable: true },
|
|
26713
26873
|
depth: { value: depth },
|
|
26714
26874
|
parent: { value: parentScope },
|
|
@@ -26803,10 +26963,10 @@ function scopePlugin(fork2) {
|
|
|
26803
26963
|
this.scan();
|
|
26804
26964
|
return this.types;
|
|
26805
26965
|
};
|
|
26806
|
-
function scanScope(
|
|
26807
|
-
var node =
|
|
26966
|
+
function scanScope(path3, bindings, scopeTypes) {
|
|
26967
|
+
var node = path3.value;
|
|
26808
26968
|
if (TypeParameterScopeType.check(node)) {
|
|
26809
|
-
const params =
|
|
26969
|
+
const params = path3.get("typeParameters", "params");
|
|
26810
26970
|
if (isArray2.check(params.value)) {
|
|
26811
26971
|
params.each((childPath) => {
|
|
26812
26972
|
addTypeParameter(childPath, scopeTypes);
|
|
@@ -26815,46 +26975,46 @@ function scopePlugin(fork2) {
|
|
|
26815
26975
|
}
|
|
26816
26976
|
if (ScopeType.check(node)) {
|
|
26817
26977
|
if (namedTypes2.CatchClause.check(node)) {
|
|
26818
|
-
addPattern(
|
|
26978
|
+
addPattern(path3.get("param"), bindings);
|
|
26819
26979
|
} else {
|
|
26820
|
-
recursiveScanScope(
|
|
26980
|
+
recursiveScanScope(path3, bindings, scopeTypes);
|
|
26821
26981
|
}
|
|
26822
26982
|
}
|
|
26823
26983
|
}
|
|
26824
|
-
function recursiveScanScope(
|
|
26825
|
-
var node =
|
|
26826
|
-
if (
|
|
26827
|
-
addPattern(
|
|
26984
|
+
function recursiveScanScope(path3, bindings, scopeTypes) {
|
|
26985
|
+
var node = path3.value;
|
|
26986
|
+
if (path3.parent && namedTypes2.FunctionExpression.check(path3.parent.node) && path3.parent.node.id) {
|
|
26987
|
+
addPattern(path3.parent.get("id"), bindings);
|
|
26828
26988
|
}
|
|
26829
26989
|
if (!node)
|
|
26830
26990
|
;
|
|
26831
26991
|
else if (isArray2.check(node)) {
|
|
26832
|
-
|
|
26992
|
+
path3.each((childPath) => {
|
|
26833
26993
|
recursiveScanChild(childPath, bindings, scopeTypes);
|
|
26834
26994
|
});
|
|
26835
26995
|
} else if (namedTypes2.Function.check(node)) {
|
|
26836
|
-
|
|
26996
|
+
path3.get("params").each((paramPath) => {
|
|
26837
26997
|
addPattern(paramPath, bindings);
|
|
26838
26998
|
});
|
|
26839
|
-
recursiveScanChild(
|
|
26840
|
-
recursiveScanScope(
|
|
26999
|
+
recursiveScanChild(path3.get("body"), bindings, scopeTypes);
|
|
27000
|
+
recursiveScanScope(path3.get("typeParameters"), bindings, scopeTypes);
|
|
26841
27001
|
} 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)) {
|
|
26842
|
-
addTypePattern(
|
|
27002
|
+
addTypePattern(path3.get("id"), scopeTypes);
|
|
26843
27003
|
} else if (namedTypes2.VariableDeclarator.check(node)) {
|
|
26844
|
-
addPattern(
|
|
26845
|
-
recursiveScanChild(
|
|
27004
|
+
addPattern(path3.get("id"), bindings);
|
|
27005
|
+
recursiveScanChild(path3.get("init"), bindings, scopeTypes);
|
|
26846
27006
|
} else if (node.type === "ImportSpecifier" || node.type === "ImportNamespaceSpecifier" || node.type === "ImportDefaultSpecifier") {
|
|
26847
27007
|
addPattern(
|
|
26848
27008
|
// Esprima used to use the .name field to refer to the local
|
|
26849
27009
|
// binding identifier for ImportSpecifier nodes, but .id for
|
|
26850
27010
|
// ImportNamespaceSpecifier and ImportDefaultSpecifier nodes.
|
|
26851
27011
|
// ESTree/Acorn/ESpree use .local for all three node types.
|
|
26852
|
-
|
|
27012
|
+
path3.get(node.local ? "local" : node.name ? "name" : "id"),
|
|
26853
27013
|
bindings
|
|
26854
27014
|
);
|
|
26855
27015
|
} else if (Node.check(node) && !Expression2.check(node)) {
|
|
26856
27016
|
types.eachField(node, function(name, child) {
|
|
26857
|
-
var childPath =
|
|
27017
|
+
var childPath = path3.get(name);
|
|
26858
27018
|
if (!pathHasValue(childPath, child)) {
|
|
26859
27019
|
throw new Error("");
|
|
26860
27020
|
}
|
|
@@ -26862,38 +27022,38 @@ function scopePlugin(fork2) {
|
|
|
26862
27022
|
});
|
|
26863
27023
|
}
|
|
26864
27024
|
}
|
|
26865
|
-
function pathHasValue(
|
|
26866
|
-
if (
|
|
27025
|
+
function pathHasValue(path3, value) {
|
|
27026
|
+
if (path3.value === value) {
|
|
26867
27027
|
return true;
|
|
26868
27028
|
}
|
|
26869
|
-
if (Array.isArray(
|
|
27029
|
+
if (Array.isArray(path3.value) && path3.value.length === 0 && Array.isArray(value) && value.length === 0) {
|
|
26870
27030
|
return true;
|
|
26871
27031
|
}
|
|
26872
27032
|
return false;
|
|
26873
27033
|
}
|
|
26874
|
-
function recursiveScanChild(
|
|
26875
|
-
var node =
|
|
27034
|
+
function recursiveScanChild(path3, bindings, scopeTypes) {
|
|
27035
|
+
var node = path3.value;
|
|
26876
27036
|
if (!node || Expression2.check(node))
|
|
26877
27037
|
;
|
|
26878
27038
|
else if (namedTypes2.FunctionDeclaration.check(node) && node.id !== null) {
|
|
26879
|
-
addPattern(
|
|
27039
|
+
addPattern(path3.get("id"), bindings);
|
|
26880
27040
|
} else if (namedTypes2.ClassDeclaration && namedTypes2.ClassDeclaration.check(node) && node.id !== null) {
|
|
26881
|
-
addPattern(
|
|
26882
|
-
recursiveScanScope(
|
|
27041
|
+
addPattern(path3.get("id"), bindings);
|
|
27042
|
+
recursiveScanScope(path3.get("typeParameters"), bindings, scopeTypes);
|
|
26883
27043
|
} else if (namedTypes2.InterfaceDeclaration && namedTypes2.InterfaceDeclaration.check(node) || namedTypes2.TSInterfaceDeclaration && namedTypes2.TSInterfaceDeclaration.check(node)) {
|
|
26884
|
-
addTypePattern(
|
|
27044
|
+
addTypePattern(path3.get("id"), scopeTypes);
|
|
26885
27045
|
} else if (ScopeType.check(node)) {
|
|
26886
27046
|
if (namedTypes2.CatchClause.check(node) && // TODO Broaden this to accept any pattern.
|
|
26887
27047
|
namedTypes2.Identifier.check(node.param)) {
|
|
26888
27048
|
var catchParamName = node.param.name;
|
|
26889
27049
|
var hadBinding = hasOwn$4.call(bindings, catchParamName);
|
|
26890
|
-
recursiveScanScope(
|
|
27050
|
+
recursiveScanScope(path3.get("body"), bindings, scopeTypes);
|
|
26891
27051
|
if (!hadBinding) {
|
|
26892
27052
|
delete bindings[catchParamName];
|
|
26893
27053
|
}
|
|
26894
27054
|
}
|
|
26895
27055
|
} else {
|
|
26896
|
-
recursiveScanScope(
|
|
27056
|
+
recursiveScanScope(path3, bindings, scopeTypes);
|
|
26897
27057
|
}
|
|
26898
27058
|
}
|
|
26899
27059
|
function addPattern(patternPath, bindings) {
|
|
@@ -27225,53 +27385,53 @@ function nodePathPlugin(fork2) {
|
|
|
27225
27385
|
NPp.firstInStatement = function() {
|
|
27226
27386
|
return firstInStatement(this);
|
|
27227
27387
|
};
|
|
27228
|
-
function firstInStatement(
|
|
27229
|
-
for (var node, parent;
|
|
27230
|
-
node =
|
|
27231
|
-
parent =
|
|
27232
|
-
if (n2.BlockStatement.check(parent) &&
|
|
27388
|
+
function firstInStatement(path3) {
|
|
27389
|
+
for (var node, parent; path3.parent; path3 = path3.parent) {
|
|
27390
|
+
node = path3.node;
|
|
27391
|
+
parent = path3.parent.node;
|
|
27392
|
+
if (n2.BlockStatement.check(parent) && path3.parent.name === "body" && path3.name === 0) {
|
|
27233
27393
|
if (parent.body[0] !== node) {
|
|
27234
27394
|
throw new Error("Nodes must be equal");
|
|
27235
27395
|
}
|
|
27236
27396
|
return true;
|
|
27237
27397
|
}
|
|
27238
|
-
if (n2.ExpressionStatement.check(parent) &&
|
|
27398
|
+
if (n2.ExpressionStatement.check(parent) && path3.name === "expression") {
|
|
27239
27399
|
if (parent.expression !== node) {
|
|
27240
27400
|
throw new Error("Nodes must be equal");
|
|
27241
27401
|
}
|
|
27242
27402
|
return true;
|
|
27243
27403
|
}
|
|
27244
|
-
if (n2.SequenceExpression.check(parent) &&
|
|
27404
|
+
if (n2.SequenceExpression.check(parent) && path3.parent.name === "expressions" && path3.name === 0) {
|
|
27245
27405
|
if (parent.expressions[0] !== node) {
|
|
27246
27406
|
throw new Error("Nodes must be equal");
|
|
27247
27407
|
}
|
|
27248
27408
|
continue;
|
|
27249
27409
|
}
|
|
27250
|
-
if (n2.CallExpression.check(parent) &&
|
|
27410
|
+
if (n2.CallExpression.check(parent) && path3.name === "callee") {
|
|
27251
27411
|
if (parent.callee !== node) {
|
|
27252
27412
|
throw new Error("Nodes must be equal");
|
|
27253
27413
|
}
|
|
27254
27414
|
continue;
|
|
27255
27415
|
}
|
|
27256
|
-
if (n2.MemberExpression.check(parent) &&
|
|
27416
|
+
if (n2.MemberExpression.check(parent) && path3.name === "object") {
|
|
27257
27417
|
if (parent.object !== node) {
|
|
27258
27418
|
throw new Error("Nodes must be equal");
|
|
27259
27419
|
}
|
|
27260
27420
|
continue;
|
|
27261
27421
|
}
|
|
27262
|
-
if (n2.ConditionalExpression.check(parent) &&
|
|
27422
|
+
if (n2.ConditionalExpression.check(parent) && path3.name === "test") {
|
|
27263
27423
|
if (parent.test !== node) {
|
|
27264
27424
|
throw new Error("Nodes must be equal");
|
|
27265
27425
|
}
|
|
27266
27426
|
continue;
|
|
27267
27427
|
}
|
|
27268
|
-
if (isBinary2(parent) &&
|
|
27428
|
+
if (isBinary2(parent) && path3.name === "left") {
|
|
27269
27429
|
if (parent.left !== node) {
|
|
27270
27430
|
throw new Error("Nodes must be equal");
|
|
27271
27431
|
}
|
|
27272
27432
|
continue;
|
|
27273
27433
|
}
|
|
27274
|
-
if (n2.UnaryExpression.check(parent) && !parent.prefix &&
|
|
27434
|
+
if (n2.UnaryExpression.check(parent) && !parent.prefix && path3.name === "argument") {
|
|
27275
27435
|
if (parent.argument !== node) {
|
|
27276
27436
|
throw new Error("Nodes must be equal");
|
|
27277
27437
|
}
|
|
@@ -27435,36 +27595,36 @@ function pathVisitorPlugin(fork2) {
|
|
|
27435
27595
|
};
|
|
27436
27596
|
PVp.reset = function(_path) {
|
|
27437
27597
|
};
|
|
27438
|
-
PVp.visitWithoutReset = function(
|
|
27598
|
+
PVp.visitWithoutReset = function(path3) {
|
|
27439
27599
|
if (this instanceof this.Context) {
|
|
27440
|
-
return this.visitor.visitWithoutReset(
|
|
27600
|
+
return this.visitor.visitWithoutReset(path3);
|
|
27441
27601
|
}
|
|
27442
|
-
if (!(
|
|
27602
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27443
27603
|
throw new Error("");
|
|
27444
27604
|
}
|
|
27445
|
-
var value =
|
|
27605
|
+
var value = path3.value;
|
|
27446
27606
|
var methodName = value && typeof value === "object" && typeof value.type === "string" && this._methodNameTable[value.type];
|
|
27447
27607
|
if (methodName) {
|
|
27448
|
-
var context = this.acquireContext(
|
|
27608
|
+
var context = this.acquireContext(path3);
|
|
27449
27609
|
try {
|
|
27450
27610
|
return context.invokeVisitorMethod(methodName);
|
|
27451
27611
|
} finally {
|
|
27452
27612
|
this.releaseContext(context);
|
|
27453
27613
|
}
|
|
27454
27614
|
} else {
|
|
27455
|
-
return visitChildren(
|
|
27615
|
+
return visitChildren(path3, this);
|
|
27456
27616
|
}
|
|
27457
27617
|
};
|
|
27458
|
-
function visitChildren(
|
|
27459
|
-
if (!(
|
|
27618
|
+
function visitChildren(path3, visitor) {
|
|
27619
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27460
27620
|
throw new Error("");
|
|
27461
27621
|
}
|
|
27462
27622
|
if (!(visitor instanceof PathVisitor2)) {
|
|
27463
27623
|
throw new Error("");
|
|
27464
27624
|
}
|
|
27465
|
-
var value =
|
|
27625
|
+
var value = path3.value;
|
|
27466
27626
|
if (isArray2.check(value)) {
|
|
27467
|
-
|
|
27627
|
+
path3.each(visitor.visitWithoutReset, visitor);
|
|
27468
27628
|
} else if (!isObject2.check(value))
|
|
27469
27629
|
;
|
|
27470
27630
|
else {
|
|
@@ -27479,19 +27639,19 @@ function pathVisitorPlugin(fork2) {
|
|
|
27479
27639
|
if (!hasOwn$3.call(value, childName)) {
|
|
27480
27640
|
value[childName] = types.getFieldValue(value, childName);
|
|
27481
27641
|
}
|
|
27482
|
-
childPaths.push(
|
|
27642
|
+
childPaths.push(path3.get(childName));
|
|
27483
27643
|
}
|
|
27484
27644
|
for (var i = 0; i < childCount; ++i) {
|
|
27485
27645
|
visitor.visitWithoutReset(childPaths[i]);
|
|
27486
27646
|
}
|
|
27487
27647
|
}
|
|
27488
|
-
return
|
|
27648
|
+
return path3.value;
|
|
27489
27649
|
}
|
|
27490
|
-
PVp.acquireContext = function(
|
|
27650
|
+
PVp.acquireContext = function(path3) {
|
|
27491
27651
|
if (this._reusableContextStack.length === 0) {
|
|
27492
|
-
return new this.Context(
|
|
27652
|
+
return new this.Context(path3);
|
|
27493
27653
|
}
|
|
27494
|
-
return this._reusableContextStack.pop().reset(
|
|
27654
|
+
return this._reusableContextStack.pop().reset(path3);
|
|
27495
27655
|
};
|
|
27496
27656
|
PVp.releaseContext = function(context) {
|
|
27497
27657
|
if (!(context instanceof this.Context)) {
|
|
@@ -27507,14 +27667,14 @@ function pathVisitorPlugin(fork2) {
|
|
|
27507
27667
|
return this._changeReported;
|
|
27508
27668
|
};
|
|
27509
27669
|
function makeContextConstructor(visitor) {
|
|
27510
|
-
function Context(
|
|
27670
|
+
function Context(path3) {
|
|
27511
27671
|
if (!(this instanceof Context)) {
|
|
27512
27672
|
throw new Error("");
|
|
27513
27673
|
}
|
|
27514
27674
|
if (!(this instanceof PathVisitor2)) {
|
|
27515
27675
|
throw new Error("");
|
|
27516
27676
|
}
|
|
27517
|
-
if (!(
|
|
27677
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27518
27678
|
throw new Error("");
|
|
27519
27679
|
}
|
|
27520
27680
|
Object.defineProperty(this, "visitor", {
|
|
@@ -27523,7 +27683,7 @@ function pathVisitorPlugin(fork2) {
|
|
|
27523
27683
|
enumerable: true,
|
|
27524
27684
|
configurable: false
|
|
27525
27685
|
});
|
|
27526
|
-
this.currentPath =
|
|
27686
|
+
this.currentPath = path3;
|
|
27527
27687
|
this.needToCallTraverse = true;
|
|
27528
27688
|
Object.seal(this);
|
|
27529
27689
|
}
|
|
@@ -27536,14 +27696,14 @@ function pathVisitorPlugin(fork2) {
|
|
|
27536
27696
|
return Context;
|
|
27537
27697
|
}
|
|
27538
27698
|
var sharedContextProtoMethods = /* @__PURE__ */ Object.create(null);
|
|
27539
|
-
sharedContextProtoMethods.reset = function reset(
|
|
27699
|
+
sharedContextProtoMethods.reset = function reset(path3) {
|
|
27540
27700
|
if (!(this instanceof this.Context)) {
|
|
27541
27701
|
throw new Error("");
|
|
27542
27702
|
}
|
|
27543
|
-
if (!(
|
|
27703
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27544
27704
|
throw new Error("");
|
|
27545
27705
|
}
|
|
27546
|
-
this.currentPath =
|
|
27706
|
+
this.currentPath = path3;
|
|
27547
27707
|
this.needToCallTraverse = true;
|
|
27548
27708
|
return this;
|
|
27549
27709
|
};
|
|
@@ -27568,29 +27728,29 @@ function pathVisitorPlugin(fork2) {
|
|
|
27568
27728
|
"Must either call this.traverse or return false in " + methodName
|
|
27569
27729
|
);
|
|
27570
27730
|
}
|
|
27571
|
-
var
|
|
27572
|
-
return
|
|
27731
|
+
var path3 = this.currentPath;
|
|
27732
|
+
return path3 && path3.value;
|
|
27573
27733
|
};
|
|
27574
|
-
sharedContextProtoMethods.traverse = function traverse(
|
|
27734
|
+
sharedContextProtoMethods.traverse = function traverse(path3, newVisitor) {
|
|
27575
27735
|
if (!(this instanceof this.Context)) {
|
|
27576
27736
|
throw new Error("");
|
|
27577
27737
|
}
|
|
27578
|
-
if (!(
|
|
27738
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27579
27739
|
throw new Error("");
|
|
27580
27740
|
}
|
|
27581
27741
|
if (!(this.currentPath instanceof NodePath2)) {
|
|
27582
27742
|
throw new Error("");
|
|
27583
27743
|
}
|
|
27584
27744
|
this.needToCallTraverse = false;
|
|
27585
|
-
return visitChildren(
|
|
27745
|
+
return visitChildren(path3, PathVisitor2.fromMethodsObject(
|
|
27586
27746
|
newVisitor || this.visitor
|
|
27587
27747
|
));
|
|
27588
27748
|
};
|
|
27589
|
-
sharedContextProtoMethods.visit = function visit2(
|
|
27749
|
+
sharedContextProtoMethods.visit = function visit2(path3, newVisitor) {
|
|
27590
27750
|
if (!(this instanceof this.Context)) {
|
|
27591
27751
|
throw new Error("");
|
|
27592
27752
|
}
|
|
27593
|
-
if (!(
|
|
27753
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27594
27754
|
throw new Error("");
|
|
27595
27755
|
}
|
|
27596
27756
|
if (!(this.currentPath instanceof NodePath2)) {
|
|
@@ -27599,7 +27759,7 @@ function pathVisitorPlugin(fork2) {
|
|
|
27599
27759
|
this.needToCallTraverse = false;
|
|
27600
27760
|
return PathVisitor2.fromMethodsObject(
|
|
27601
27761
|
newVisitor || this.visitor
|
|
27602
|
-
).visitWithoutReset(
|
|
27762
|
+
).visitWithoutReset(path3);
|
|
27603
27763
|
};
|
|
27604
27764
|
sharedContextProtoMethods.reportChanged = function reportChanged() {
|
|
27605
27765
|
this.visitor.reportChanged();
|
|
@@ -29207,9 +29367,9 @@ function isExportDeclaration(node) {
|
|
|
29207
29367
|
}
|
|
29208
29368
|
return false;
|
|
29209
29369
|
}
|
|
29210
|
-
function getParentExportDeclaration(
|
|
29211
|
-
const parentNode =
|
|
29212
|
-
if (
|
|
29370
|
+
function getParentExportDeclaration(path3) {
|
|
29371
|
+
const parentNode = path3.getParentNode();
|
|
29372
|
+
if (path3.getName() === "declaration" && isExportDeclaration(parentNode)) {
|
|
29213
29373
|
return parentNode;
|
|
29214
29374
|
}
|
|
29215
29375
|
return null;
|
|
@@ -30218,16 +30378,16 @@ function printTrailingComment(commentPath, print2) {
|
|
|
30218
30378
|
parts.push(print2(commentPath));
|
|
30219
30379
|
return concat(parts);
|
|
30220
30380
|
}
|
|
30221
|
-
function printComments(
|
|
30222
|
-
const value =
|
|
30223
|
-
const innerLines = print2(
|
|
30381
|
+
function printComments(path3, print2) {
|
|
30382
|
+
const value = path3.getValue();
|
|
30383
|
+
const innerLines = print2(path3);
|
|
30224
30384
|
const comments = n$1.Node.check(value) && getFieldValue(value, "comments");
|
|
30225
30385
|
if (!comments || comments.length === 0) {
|
|
30226
30386
|
return innerLines;
|
|
30227
30387
|
}
|
|
30228
30388
|
const leadingParts = [];
|
|
30229
30389
|
const trailingParts = [innerLines];
|
|
30230
|
-
|
|
30390
|
+
path3.each(function(commentPath) {
|
|
30231
30391
|
const comment = commentPath.getValue();
|
|
30232
30392
|
const leading = getFieldValue(comment, "leading");
|
|
30233
30393
|
const trailing = getFieldValue(comment, "trailing");
|
|
@@ -30476,8 +30636,8 @@ FPp.valueIsDuplicate = function() {
|
|
|
30476
30636
|
const valueIndex = s.length - 1;
|
|
30477
30637
|
return s.lastIndexOf(s[valueIndex], valueIndex - 1) >= 0;
|
|
30478
30638
|
};
|
|
30479
|
-
function getNodeHelper(
|
|
30480
|
-
const s =
|
|
30639
|
+
function getNodeHelper(path3, count) {
|
|
30640
|
+
const s = path3.stack;
|
|
30481
30641
|
for (let i = s.length - 1; i >= 0; i -= 2) {
|
|
30482
30642
|
const value = s[i];
|
|
30483
30643
|
if (n.Node.check(value) && --count < 0) {
|
|
@@ -30921,15 +31081,15 @@ Pp.deleteComments = function(node) {
|
|
|
30921
31081
|
}
|
|
30922
31082
|
});
|
|
30923
31083
|
};
|
|
30924
|
-
function getReprinter(
|
|
30925
|
-
const node =
|
|
31084
|
+
function getReprinter(path3) {
|
|
31085
|
+
const node = path3.getValue();
|
|
30926
31086
|
if (!Printable.check(node))
|
|
30927
31087
|
return;
|
|
30928
31088
|
const orig = node.original;
|
|
30929
31089
|
const origLoc = orig && orig.loc;
|
|
30930
31090
|
const lines = origLoc && origLoc.lines;
|
|
30931
31091
|
const reprints = [];
|
|
30932
|
-
if (!lines || !findReprints(
|
|
31092
|
+
if (!lines || !findReprints(path3, reprints))
|
|
30933
31093
|
return;
|
|
30934
31094
|
return function(print2) {
|
|
30935
31095
|
const patcher = new Patcher(lines);
|
|
@@ -30966,7 +31126,7 @@ function getReprinter(path2) {
|
|
|
30966
31126
|
patcher.replace(oldNode.loc, newLines);
|
|
30967
31127
|
});
|
|
30968
31128
|
const patchedLines = patcher.get(origLoc).indentTail(-orig.loc.indent);
|
|
30969
|
-
if (
|
|
31129
|
+
if (path3.needsParens()) {
|
|
30970
31130
|
return concat(["(", patchedLines, ")"]);
|
|
30971
31131
|
}
|
|
30972
31132
|
return patchedLines;
|
|
@@ -31148,13 +31308,13 @@ var Printer = function Printer2(config) {
|
|
|
31148
31308
|
config.sourceFileName = null;
|
|
31149
31309
|
function makePrintFunctionWith(options, overrides) {
|
|
31150
31310
|
options = Object.assign({}, options, overrides);
|
|
31151
|
-
return (
|
|
31311
|
+
return (path3) => print2(path3, options);
|
|
31152
31312
|
}
|
|
31153
|
-
function print2(
|
|
31313
|
+
function print2(path3, options) {
|
|
31154
31314
|
options = options || {};
|
|
31155
31315
|
if (options.includeComments) {
|
|
31156
31316
|
return printComments(
|
|
31157
|
-
|
|
31317
|
+
path3,
|
|
31158
31318
|
makePrintFunctionWith(options, {
|
|
31159
31319
|
includeComments: false
|
|
31160
31320
|
})
|
|
@@ -31162,12 +31322,12 @@ var Printer = function Printer2(config) {
|
|
|
31162
31322
|
}
|
|
31163
31323
|
const oldTabWidth = config.tabWidth;
|
|
31164
31324
|
if (!explicitTabWidth) {
|
|
31165
|
-
const loc =
|
|
31325
|
+
const loc = path3.getNode().loc;
|
|
31166
31326
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
31167
31327
|
config.tabWidth = loc.lines.guessTabWidth();
|
|
31168
31328
|
}
|
|
31169
31329
|
}
|
|
31170
|
-
const reprinter = getReprinter(
|
|
31330
|
+
const reprinter = getReprinter(path3);
|
|
31171
31331
|
const lines = reprinter ? (
|
|
31172
31332
|
// Since the print function that we pass to the reprinter will
|
|
31173
31333
|
// be used to print "new" nodes, it's tempting to think we
|
|
@@ -31179,7 +31339,7 @@ var Printer = function Printer2(config) {
|
|
|
31179
31339
|
// such nodes using their original source.
|
|
31180
31340
|
reprinter(print2)
|
|
31181
31341
|
) : genericPrint(
|
|
31182
|
-
|
|
31342
|
+
path3,
|
|
31183
31343
|
config,
|
|
31184
31344
|
options,
|
|
31185
31345
|
makePrintFunctionWith(options, {
|
|
@@ -31213,8 +31373,8 @@ var Printer = function Printer2(config) {
|
|
|
31213
31373
|
function printGenerically(path22) {
|
|
31214
31374
|
return printComments(
|
|
31215
31375
|
path22,
|
|
31216
|
-
(
|
|
31217
|
-
|
|
31376
|
+
(path32) => genericPrint(
|
|
31377
|
+
path32,
|
|
31218
31378
|
config,
|
|
31219
31379
|
{
|
|
31220
31380
|
includeComments: true,
|
|
@@ -31224,26 +31384,26 @@ var Printer = function Printer2(config) {
|
|
|
31224
31384
|
)
|
|
31225
31385
|
);
|
|
31226
31386
|
}
|
|
31227
|
-
const
|
|
31387
|
+
const path3 = FastPath.from(ast);
|
|
31228
31388
|
const oldReuseWhitespace = config.reuseWhitespace;
|
|
31229
31389
|
config.reuseWhitespace = false;
|
|
31230
|
-
const pr = new PrintResult(printGenerically(
|
|
31390
|
+
const pr = new PrintResult(printGenerically(path3).toString(config));
|
|
31231
31391
|
config.reuseWhitespace = oldReuseWhitespace;
|
|
31232
31392
|
return pr;
|
|
31233
31393
|
};
|
|
31234
31394
|
};
|
|
31235
|
-
function genericPrint(
|
|
31236
|
-
const node =
|
|
31395
|
+
function genericPrint(path3, config, options, printPath) {
|
|
31396
|
+
const node = path3.getValue();
|
|
31237
31397
|
const parts = [];
|
|
31238
|
-
const linesWithoutParens = genericPrintNoParens(
|
|
31398
|
+
const linesWithoutParens = genericPrintNoParens(path3, config, printPath);
|
|
31239
31399
|
if (!node || linesWithoutParens.isEmpty()) {
|
|
31240
31400
|
return linesWithoutParens;
|
|
31241
31401
|
}
|
|
31242
31402
|
let shouldAddParens = false;
|
|
31243
|
-
const decoratorsLines = printDecorators(
|
|
31403
|
+
const decoratorsLines = printDecorators(path3, printPath);
|
|
31244
31404
|
if (decoratorsLines.isEmpty()) {
|
|
31245
31405
|
if (!options.avoidRootParens) {
|
|
31246
|
-
shouldAddParens =
|
|
31406
|
+
shouldAddParens = path3.needsParens();
|
|
31247
31407
|
}
|
|
31248
31408
|
} else {
|
|
31249
31409
|
parts.push(decoratorsLines);
|
|
@@ -31257,8 +31417,8 @@ function genericPrint(path2, config, options, printPath) {
|
|
|
31257
31417
|
}
|
|
31258
31418
|
return concat(parts);
|
|
31259
31419
|
}
|
|
31260
|
-
function genericPrintNoParens(
|
|
31261
|
-
const n2 =
|
|
31420
|
+
function genericPrintNoParens(path3, options, print2) {
|
|
31421
|
+
const n2 = path3.getValue();
|
|
31262
31422
|
if (!n2) {
|
|
31263
31423
|
return fromString("");
|
|
31264
31424
|
}
|
|
@@ -31269,18 +31429,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31269
31429
|
const parts = [];
|
|
31270
31430
|
switch (n2.type) {
|
|
31271
31431
|
case "File":
|
|
31272
|
-
return
|
|
31432
|
+
return path3.call(print2, "program");
|
|
31273
31433
|
case "Program":
|
|
31274
31434
|
if (n2.directives) {
|
|
31275
|
-
|
|
31435
|
+
path3.each(function(childPath) {
|
|
31276
31436
|
parts.push(print2(childPath), ";\n");
|
|
31277
31437
|
}, "directives");
|
|
31278
31438
|
}
|
|
31279
31439
|
if (n2.interpreter) {
|
|
31280
|
-
parts.push(
|
|
31440
|
+
parts.push(path3.call(print2, "interpreter"));
|
|
31281
31441
|
}
|
|
31282
31442
|
parts.push(
|
|
31283
|
-
|
|
31443
|
+
path3.call(
|
|
31284
31444
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
31285
31445
|
"body"
|
|
31286
31446
|
)
|
|
@@ -31290,27 +31450,27 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31290
31450
|
case "EmptyStatement":
|
|
31291
31451
|
return fromString("");
|
|
31292
31452
|
case "ExpressionStatement":
|
|
31293
|
-
return concat([
|
|
31453
|
+
return concat([path3.call(print2, "expression"), ";"]);
|
|
31294
31454
|
case "ParenthesizedExpression":
|
|
31295
|
-
return concat(["(",
|
|
31455
|
+
return concat(["(", path3.call(print2, "expression"), ")"]);
|
|
31296
31456
|
case "BinaryExpression":
|
|
31297
31457
|
case "LogicalExpression":
|
|
31298
31458
|
case "AssignmentExpression":
|
|
31299
31459
|
return fromString(" ").join([
|
|
31300
|
-
|
|
31460
|
+
path3.call(print2, "left"),
|
|
31301
31461
|
n2.operator,
|
|
31302
|
-
|
|
31462
|
+
path3.call(print2, "right")
|
|
31303
31463
|
]);
|
|
31304
31464
|
case "AssignmentPattern":
|
|
31305
31465
|
return concat([
|
|
31306
|
-
|
|
31466
|
+
path3.call(print2, "left"),
|
|
31307
31467
|
" = ",
|
|
31308
|
-
|
|
31468
|
+
path3.call(print2, "right")
|
|
31309
31469
|
]);
|
|
31310
31470
|
case "MemberExpression":
|
|
31311
31471
|
case "OptionalMemberExpression": {
|
|
31312
|
-
parts.push(
|
|
31313
|
-
const property =
|
|
31472
|
+
parts.push(path3.call(print2, "object"));
|
|
31473
|
+
const property = path3.call(print2, "property");
|
|
31314
31474
|
const optional = getFieldValue(n2, "optional");
|
|
31315
31475
|
if (n2.computed) {
|
|
31316
31476
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
@@ -31320,18 +31480,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31320
31480
|
return concat(parts);
|
|
31321
31481
|
}
|
|
31322
31482
|
case "ChainExpression":
|
|
31323
|
-
return
|
|
31483
|
+
return path3.call(print2, "expression");
|
|
31324
31484
|
case "MetaProperty":
|
|
31325
31485
|
return concat([
|
|
31326
|
-
|
|
31486
|
+
path3.call(print2, "meta"),
|
|
31327
31487
|
".",
|
|
31328
|
-
|
|
31488
|
+
path3.call(print2, "property")
|
|
31329
31489
|
]);
|
|
31330
31490
|
case "BindExpression":
|
|
31331
31491
|
if (n2.object) {
|
|
31332
|
-
parts.push(
|
|
31492
|
+
parts.push(path3.call(print2, "object"));
|
|
31333
31493
|
}
|
|
31334
|
-
parts.push("::",
|
|
31494
|
+
parts.push("::", path3.call(print2, "callee"));
|
|
31335
31495
|
return concat(parts);
|
|
31336
31496
|
case "Path":
|
|
31337
31497
|
return fromString(".").join(n2.body);
|
|
@@ -31339,7 +31499,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31339
31499
|
return concat([
|
|
31340
31500
|
fromString(n2.name, options),
|
|
31341
31501
|
n2.optional ? "?" : "",
|
|
31342
|
-
|
|
31502
|
+
path3.call(print2, "typeAnnotation")
|
|
31343
31503
|
]);
|
|
31344
31504
|
case "SpreadElement":
|
|
31345
31505
|
case "SpreadElementPattern":
|
|
@@ -31350,8 +31510,8 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31350
31510
|
case "RestElement":
|
|
31351
31511
|
return concat([
|
|
31352
31512
|
"...",
|
|
31353
|
-
|
|
31354
|
-
|
|
31513
|
+
path3.call(print2, "argument"),
|
|
31514
|
+
path3.call(print2, "typeAnnotation")
|
|
31355
31515
|
]);
|
|
31356
31516
|
case "FunctionDeclaration":
|
|
31357
31517
|
case "FunctionExpression":
|
|
@@ -31368,22 +31528,22 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31368
31528
|
if (n2.id) {
|
|
31369
31529
|
parts.push(
|
|
31370
31530
|
" ",
|
|
31371
|
-
|
|
31372
|
-
|
|
31531
|
+
path3.call(print2, "id"),
|
|
31532
|
+
path3.call(print2, "typeParameters")
|
|
31373
31533
|
);
|
|
31374
31534
|
} else {
|
|
31375
31535
|
if (n2.typeParameters) {
|
|
31376
|
-
parts.push(
|
|
31536
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31377
31537
|
}
|
|
31378
31538
|
}
|
|
31379
31539
|
parts.push(
|
|
31380
31540
|
"(",
|
|
31381
|
-
printFunctionParams(
|
|
31541
|
+
printFunctionParams(path3, options, print2),
|
|
31382
31542
|
")",
|
|
31383
|
-
|
|
31543
|
+
path3.call(print2, "returnType")
|
|
31384
31544
|
);
|
|
31385
31545
|
if (n2.body) {
|
|
31386
|
-
parts.push(" ",
|
|
31546
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
31387
31547
|
}
|
|
31388
31548
|
return concat(parts);
|
|
31389
31549
|
case "ArrowFunctionExpression":
|
|
@@ -31391,48 +31551,48 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31391
31551
|
parts.push("async ");
|
|
31392
31552
|
}
|
|
31393
31553
|
if (n2.typeParameters) {
|
|
31394
|
-
parts.push(
|
|
31554
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31395
31555
|
}
|
|
31396
31556
|
if (!options.arrowParensAlways && n2.params.length === 1 && !n2.rest && n2.params[0].type === "Identifier" && !n2.params[0].typeAnnotation && !n2.returnType) {
|
|
31397
|
-
parts.push(
|
|
31557
|
+
parts.push(path3.call(print2, "params", 0));
|
|
31398
31558
|
} else {
|
|
31399
31559
|
parts.push(
|
|
31400
31560
|
"(",
|
|
31401
|
-
printFunctionParams(
|
|
31561
|
+
printFunctionParams(path3, options, print2),
|
|
31402
31562
|
")",
|
|
31403
|
-
|
|
31563
|
+
path3.call(print2, "returnType")
|
|
31404
31564
|
);
|
|
31405
31565
|
}
|
|
31406
|
-
parts.push(" => ",
|
|
31566
|
+
parts.push(" => ", path3.call(print2, "body"));
|
|
31407
31567
|
return concat(parts);
|
|
31408
31568
|
case "MethodDefinition":
|
|
31409
|
-
return printMethod(
|
|
31569
|
+
return printMethod(path3, options, print2);
|
|
31410
31570
|
case "YieldExpression":
|
|
31411
31571
|
parts.push("yield");
|
|
31412
31572
|
if (n2.delegate)
|
|
31413
31573
|
parts.push("*");
|
|
31414
31574
|
if (n2.argument)
|
|
31415
|
-
parts.push(" ",
|
|
31575
|
+
parts.push(" ", path3.call(print2, "argument"));
|
|
31416
31576
|
return concat(parts);
|
|
31417
31577
|
case "AwaitExpression":
|
|
31418
31578
|
parts.push("await");
|
|
31419
31579
|
if (n2.all)
|
|
31420
31580
|
parts.push("*");
|
|
31421
31581
|
if (n2.argument)
|
|
31422
|
-
parts.push(" ",
|
|
31582
|
+
parts.push(" ", path3.call(print2, "argument"));
|
|
31423
31583
|
return concat(parts);
|
|
31424
31584
|
case "ModuleExpression":
|
|
31425
31585
|
return concat([
|
|
31426
31586
|
"module {\n",
|
|
31427
|
-
|
|
31587
|
+
path3.call(print2, "body").indent(options.tabWidth),
|
|
31428
31588
|
"\n}"
|
|
31429
31589
|
]);
|
|
31430
31590
|
case "ModuleDeclaration":
|
|
31431
|
-
parts.push("module",
|
|
31591
|
+
parts.push("module", path3.call(print2, "id"));
|
|
31432
31592
|
if (n2.source) {
|
|
31433
|
-
parts.push("from",
|
|
31593
|
+
parts.push("from", path3.call(print2, "source"));
|
|
31434
31594
|
} else {
|
|
31435
|
-
parts.push(
|
|
31595
|
+
parts.push(path3.call(print2, "body"));
|
|
31436
31596
|
}
|
|
31437
31597
|
return fromString(" ").join(parts);
|
|
31438
31598
|
case "ImportSpecifier":
|
|
@@ -31440,14 +31600,14 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31440
31600
|
parts.push(n2.importKind + " ");
|
|
31441
31601
|
}
|
|
31442
31602
|
if (n2.imported) {
|
|
31443
|
-
parts.push(
|
|
31603
|
+
parts.push(path3.call(print2, "imported"));
|
|
31444
31604
|
if (n2.local && n2.local.name !== n2.imported.name) {
|
|
31445
|
-
parts.push(" as ",
|
|
31605
|
+
parts.push(" as ", path3.call(print2, "local"));
|
|
31446
31606
|
}
|
|
31447
31607
|
} else if (n2.id) {
|
|
31448
|
-
parts.push(
|
|
31608
|
+
parts.push(path3.call(print2, "id"));
|
|
31449
31609
|
if (n2.name) {
|
|
31450
|
-
parts.push(" as ",
|
|
31610
|
+
parts.push(" as ", path3.call(print2, "name"));
|
|
31451
31611
|
}
|
|
31452
31612
|
}
|
|
31453
31613
|
return concat(parts);
|
|
@@ -31456,14 +31616,14 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31456
31616
|
parts.push(n2.exportKind + " ");
|
|
31457
31617
|
}
|
|
31458
31618
|
if (n2.local) {
|
|
31459
|
-
parts.push(
|
|
31619
|
+
parts.push(path3.call(print2, "local"));
|
|
31460
31620
|
if (n2.exported && n2.exported.name !== n2.local.name) {
|
|
31461
|
-
parts.push(" as ",
|
|
31621
|
+
parts.push(" as ", path3.call(print2, "exported"));
|
|
31462
31622
|
}
|
|
31463
31623
|
} else if (n2.id) {
|
|
31464
|
-
parts.push(
|
|
31624
|
+
parts.push(path3.call(print2, "id"));
|
|
31465
31625
|
if (n2.name) {
|
|
31466
|
-
parts.push(" as ",
|
|
31626
|
+
parts.push(" as ", path3.call(print2, "name"));
|
|
31467
31627
|
}
|
|
31468
31628
|
}
|
|
31469
31629
|
return concat(parts);
|
|
@@ -31472,40 +31632,40 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31472
31632
|
case "ImportNamespaceSpecifier":
|
|
31473
31633
|
parts.push("* as ");
|
|
31474
31634
|
if (n2.local) {
|
|
31475
|
-
parts.push(
|
|
31635
|
+
parts.push(path3.call(print2, "local"));
|
|
31476
31636
|
} else if (n2.id) {
|
|
31477
|
-
parts.push(
|
|
31637
|
+
parts.push(path3.call(print2, "id"));
|
|
31478
31638
|
}
|
|
31479
31639
|
return concat(parts);
|
|
31480
31640
|
case "ImportDefaultSpecifier":
|
|
31481
31641
|
if (n2.local) {
|
|
31482
|
-
return
|
|
31642
|
+
return path3.call(print2, "local");
|
|
31483
31643
|
}
|
|
31484
|
-
return
|
|
31644
|
+
return path3.call(print2, "id");
|
|
31485
31645
|
case "TSExportAssignment":
|
|
31486
|
-
return concat(["export = ",
|
|
31646
|
+
return concat(["export = ", path3.call(print2, "expression")]);
|
|
31487
31647
|
case "ExportDeclaration":
|
|
31488
31648
|
case "ExportDefaultDeclaration":
|
|
31489
31649
|
case "ExportNamedDeclaration":
|
|
31490
|
-
return printExportDeclaration(
|
|
31650
|
+
return printExportDeclaration(path3, options, print2);
|
|
31491
31651
|
case "ExportAllDeclaration":
|
|
31492
31652
|
parts.push("export *");
|
|
31493
31653
|
if (n2.exported) {
|
|
31494
|
-
parts.push(" as ",
|
|
31654
|
+
parts.push(" as ", path3.call(print2, "exported"));
|
|
31495
31655
|
}
|
|
31496
|
-
parts.push(" from ",
|
|
31656
|
+
parts.push(" from ", path3.call(print2, "source"), ";");
|
|
31497
31657
|
return concat(parts);
|
|
31498
31658
|
case "TSNamespaceExportDeclaration":
|
|
31499
|
-
parts.push("export as namespace ",
|
|
31659
|
+
parts.push("export as namespace ", path3.call(print2, "id"));
|
|
31500
31660
|
return maybeAddSemicolon(concat(parts));
|
|
31501
31661
|
case "ExportNamespaceSpecifier":
|
|
31502
|
-
return concat(["* as ",
|
|
31662
|
+
return concat(["* as ", path3.call(print2, "exported")]);
|
|
31503
31663
|
case "ExportDefaultSpecifier":
|
|
31504
|
-
return
|
|
31664
|
+
return path3.call(print2, "exported");
|
|
31505
31665
|
case "Import":
|
|
31506
31666
|
return fromString("import", options);
|
|
31507
31667
|
case "ImportExpression":
|
|
31508
|
-
return concat(["import(",
|
|
31668
|
+
return concat(["import(", path3.call(print2, "source"), ")"]);
|
|
31509
31669
|
case "ImportDeclaration": {
|
|
31510
31670
|
parts.push("import ");
|
|
31511
31671
|
if (n2.importKind && n2.importKind !== "value") {
|
|
@@ -31514,7 +31674,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31514
31674
|
if (n2.specifiers && n2.specifiers.length > 0) {
|
|
31515
31675
|
const unbracedSpecifiers = [];
|
|
31516
31676
|
const bracedSpecifiers = [];
|
|
31517
|
-
|
|
31677
|
+
path3.each(function(specifierPath) {
|
|
31518
31678
|
const spec = specifierPath.getValue();
|
|
31519
31679
|
if (spec.type === "ImportSpecifier") {
|
|
31520
31680
|
bracedSpecifiers.push(print2(specifierPath));
|
|
@@ -31550,18 +31710,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31550
31710
|
parts.push(" from ");
|
|
31551
31711
|
}
|
|
31552
31712
|
parts.push(
|
|
31553
|
-
|
|
31554
|
-
maybePrintImportAssertions(
|
|
31713
|
+
path3.call(print2, "source"),
|
|
31714
|
+
maybePrintImportAssertions(path3, options, print2),
|
|
31555
31715
|
";"
|
|
31556
31716
|
);
|
|
31557
31717
|
return concat(parts);
|
|
31558
31718
|
}
|
|
31559
31719
|
case "ImportAttribute":
|
|
31560
|
-
return concat([
|
|
31720
|
+
return concat([path3.call(print2, "key"), ": ", path3.call(print2, "value")]);
|
|
31561
31721
|
case "StaticBlock":
|
|
31562
31722
|
parts.push("static ");
|
|
31563
31723
|
case "BlockStatement": {
|
|
31564
|
-
const naked =
|
|
31724
|
+
const naked = path3.call(
|
|
31565
31725
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
31566
31726
|
"body"
|
|
31567
31727
|
);
|
|
@@ -31573,7 +31733,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31573
31733
|
}
|
|
31574
31734
|
parts.push("{\n");
|
|
31575
31735
|
if (n2.directives) {
|
|
31576
|
-
|
|
31736
|
+
path3.each(function(childPath) {
|
|
31577
31737
|
parts.push(
|
|
31578
31738
|
maybeAddSemicolon(print2(childPath).indent(options.tabWidth)),
|
|
31579
31739
|
n2.directives.length > 1 || !naked.isEmpty() ? "\n" : ""
|
|
@@ -31587,7 +31747,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31587
31747
|
case "ReturnStatement": {
|
|
31588
31748
|
parts.push("return");
|
|
31589
31749
|
if (n2.argument) {
|
|
31590
|
-
const argLines =
|
|
31750
|
+
const argLines = path3.call(print2, "argument");
|
|
31591
31751
|
if (argLines.startsWithComment() || argLines.length > 1 && namedTypes.JSXElement && namedTypes.JSXElement.check(n2.argument)) {
|
|
31592
31752
|
parts.push(" (\n", argLines.indent(options.tabWidth), "\n)");
|
|
31593
31753
|
} else {
|
|
@@ -31599,17 +31759,17 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31599
31759
|
}
|
|
31600
31760
|
case "CallExpression":
|
|
31601
31761
|
case "OptionalCallExpression":
|
|
31602
|
-
parts.push(
|
|
31762
|
+
parts.push(path3.call(print2, "callee"));
|
|
31603
31763
|
if (n2.typeParameters) {
|
|
31604
|
-
parts.push(
|
|
31764
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31605
31765
|
}
|
|
31606
31766
|
if (n2.typeArguments) {
|
|
31607
|
-
parts.push(
|
|
31767
|
+
parts.push(path3.call(print2, "typeArguments"));
|
|
31608
31768
|
}
|
|
31609
31769
|
if (getFieldValue(n2, "optional")) {
|
|
31610
31770
|
parts.push("?.");
|
|
31611
31771
|
}
|
|
31612
|
-
parts.push(printArgumentsList(
|
|
31772
|
+
parts.push(printArgumentsList(path3, options, print2));
|
|
31613
31773
|
return concat(parts);
|
|
31614
31774
|
case "RecordExpression":
|
|
31615
31775
|
parts.push("#");
|
|
@@ -31638,7 +31798,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31638
31798
|
const leftBraceIndex = parts.length - 1;
|
|
31639
31799
|
let i = 0;
|
|
31640
31800
|
fields.forEach(function(field) {
|
|
31641
|
-
|
|
31801
|
+
path3.each(function(childPath) {
|
|
31642
31802
|
let lines = print2(childPath);
|
|
31643
31803
|
if (!oneLine) {
|
|
31644
31804
|
lines = lines.indent(options.tabWidth);
|
|
@@ -31676,32 +31836,32 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31676
31836
|
parts[parts.length - 1] = " " + rightBrace;
|
|
31677
31837
|
}
|
|
31678
31838
|
if (n2.typeAnnotation) {
|
|
31679
|
-
parts.push(
|
|
31839
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
31680
31840
|
}
|
|
31681
31841
|
return concat(parts);
|
|
31682
31842
|
}
|
|
31683
31843
|
case "PropertyPattern":
|
|
31684
31844
|
return concat([
|
|
31685
|
-
|
|
31845
|
+
path3.call(print2, "key"),
|
|
31686
31846
|
": ",
|
|
31687
|
-
|
|
31847
|
+
path3.call(print2, "pattern")
|
|
31688
31848
|
]);
|
|
31689
31849
|
case "ObjectProperty":
|
|
31690
31850
|
case "Property": {
|
|
31691
31851
|
if (n2.method || n2.kind === "get" || n2.kind === "set") {
|
|
31692
|
-
return printMethod(
|
|
31852
|
+
return printMethod(path3, options, print2);
|
|
31693
31853
|
}
|
|
31694
31854
|
if (n2.shorthand && n2.value.type === "AssignmentPattern") {
|
|
31695
|
-
return
|
|
31855
|
+
return path3.call(print2, "value");
|
|
31696
31856
|
}
|
|
31697
|
-
const key =
|
|
31857
|
+
const key = path3.call(print2, "key");
|
|
31698
31858
|
if (n2.computed) {
|
|
31699
31859
|
parts.push("[", key, "]");
|
|
31700
31860
|
} else {
|
|
31701
31861
|
parts.push(key);
|
|
31702
31862
|
}
|
|
31703
31863
|
if (!n2.shorthand || n2.key.name !== n2.value.name) {
|
|
31704
|
-
parts.push(": ",
|
|
31864
|
+
parts.push(": ", path3.call(print2, "value"));
|
|
31705
31865
|
}
|
|
31706
31866
|
return concat(parts);
|
|
31707
31867
|
}
|
|
@@ -31709,18 +31869,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31709
31869
|
case "ObjectMethod":
|
|
31710
31870
|
case "ClassPrivateMethod":
|
|
31711
31871
|
case "TSDeclareMethod":
|
|
31712
|
-
return printMethod(
|
|
31872
|
+
return printMethod(path3, options, print2);
|
|
31713
31873
|
case "PrivateName":
|
|
31714
|
-
return concat(["#",
|
|
31874
|
+
return concat(["#", path3.call(print2, "id")]);
|
|
31715
31875
|
case "Decorator":
|
|
31716
|
-
return concat(["@",
|
|
31876
|
+
return concat(["@", path3.call(print2, "expression")]);
|
|
31717
31877
|
case "TupleExpression":
|
|
31718
31878
|
parts.push("#");
|
|
31719
31879
|
case "ArrayExpression":
|
|
31720
31880
|
case "ArrayPattern": {
|
|
31721
31881
|
const elems = n2.elements;
|
|
31722
31882
|
const len = elems.length;
|
|
31723
|
-
const printed =
|
|
31883
|
+
const printed = path3.map(print2, "elements");
|
|
31724
31884
|
const joined = fromString(", ").join(printed);
|
|
31725
31885
|
const oneLine = joined.getLineLength(1) <= options.wrapColumn;
|
|
31726
31886
|
if (oneLine) {
|
|
@@ -31732,7 +31892,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31732
31892
|
} else {
|
|
31733
31893
|
parts.push("[\n");
|
|
31734
31894
|
}
|
|
31735
|
-
|
|
31895
|
+
path3.each(function(elemPath) {
|
|
31736
31896
|
const i = elemPath.getName();
|
|
31737
31897
|
const elem = elemPath.getValue();
|
|
31738
31898
|
if (!elem) {
|
|
@@ -31758,12 +31918,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31758
31918
|
parts.push("]");
|
|
31759
31919
|
}
|
|
31760
31920
|
if (n2.typeAnnotation) {
|
|
31761
|
-
parts.push(
|
|
31921
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
31762
31922
|
}
|
|
31763
31923
|
return concat(parts);
|
|
31764
31924
|
}
|
|
31765
31925
|
case "SequenceExpression":
|
|
31766
|
-
return fromString(", ").join(
|
|
31926
|
+
return fromString(", ").join(path3.map(print2, "expressions"));
|
|
31767
31927
|
case "ThisExpression":
|
|
31768
31928
|
return fromString("this");
|
|
31769
31929
|
case "Super":
|
|
@@ -31790,7 +31950,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31790
31950
|
options
|
|
31791
31951
|
);
|
|
31792
31952
|
case "Directive":
|
|
31793
|
-
return
|
|
31953
|
+
return path3.call(print2, "value");
|
|
31794
31954
|
case "DirectiveLiteral":
|
|
31795
31955
|
return fromString(
|
|
31796
31956
|
getPossibleRaw(n2) || nodeStr(n2.value, options),
|
|
@@ -31808,32 +31968,32 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31808
31968
|
parts.push(n2.operator);
|
|
31809
31969
|
if (/[a-z]$/.test(n2.operator))
|
|
31810
31970
|
parts.push(" ");
|
|
31811
|
-
parts.push(
|
|
31971
|
+
parts.push(path3.call(print2, "argument"));
|
|
31812
31972
|
return concat(parts);
|
|
31813
31973
|
case "UpdateExpression":
|
|
31814
|
-
parts.push(
|
|
31974
|
+
parts.push(path3.call(print2, "argument"), n2.operator);
|
|
31815
31975
|
if (n2.prefix)
|
|
31816
31976
|
parts.reverse();
|
|
31817
31977
|
return concat(parts);
|
|
31818
31978
|
case "ConditionalExpression":
|
|
31819
31979
|
return concat([
|
|
31820
|
-
|
|
31980
|
+
path3.call(print2, "test"),
|
|
31821
31981
|
" ? ",
|
|
31822
|
-
|
|
31982
|
+
path3.call(print2, "consequent"),
|
|
31823
31983
|
" : ",
|
|
31824
|
-
|
|
31984
|
+
path3.call(print2, "alternate")
|
|
31825
31985
|
]);
|
|
31826
31986
|
case "NewExpression": {
|
|
31827
|
-
parts.push("new ",
|
|
31987
|
+
parts.push("new ", path3.call(print2, "callee"));
|
|
31828
31988
|
if (n2.typeParameters) {
|
|
31829
|
-
parts.push(
|
|
31989
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31830
31990
|
}
|
|
31831
31991
|
if (n2.typeArguments) {
|
|
31832
|
-
parts.push(
|
|
31992
|
+
parts.push(path3.call(print2, "typeArguments"));
|
|
31833
31993
|
}
|
|
31834
31994
|
const args = n2.arguments;
|
|
31835
31995
|
if (args) {
|
|
31836
|
-
parts.push(printArgumentsList(
|
|
31996
|
+
parts.push(printArgumentsList(path3, options, print2));
|
|
31837
31997
|
}
|
|
31838
31998
|
return concat(parts);
|
|
31839
31999
|
}
|
|
@@ -31843,7 +32003,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31843
32003
|
}
|
|
31844
32004
|
parts.push(n2.kind, " ");
|
|
31845
32005
|
let maxLen = 0;
|
|
31846
|
-
const printed =
|
|
32006
|
+
const printed = path3.map(function(childPath) {
|
|
31847
32007
|
const lines = print2(childPath);
|
|
31848
32008
|
maxLen = Math.max(lines.length, maxLen);
|
|
31849
32009
|
return lines;
|
|
@@ -31857,7 +32017,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31857
32017
|
} else {
|
|
31858
32018
|
parts.push(printed[0]);
|
|
31859
32019
|
}
|
|
31860
|
-
const parentNode =
|
|
32020
|
+
const parentNode = path3.getParentNode();
|
|
31861
32021
|
if (!namedTypes.ForStatement.check(parentNode) && !namedTypes.ForInStatement.check(parentNode) && !(namedTypes.ForOfStatement && namedTypes.ForOfStatement.check(parentNode)) && !(namedTypes.ForAwaitStatement && namedTypes.ForAwaitStatement.check(parentNode))) {
|
|
31862
32022
|
parts.push(";");
|
|
31863
32023
|
}
|
|
@@ -31865,33 +32025,33 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31865
32025
|
}
|
|
31866
32026
|
case "VariableDeclarator":
|
|
31867
32027
|
return n2.init ? fromString(" = ").join([
|
|
31868
|
-
|
|
31869
|
-
|
|
31870
|
-
]) :
|
|
32028
|
+
path3.call(print2, "id"),
|
|
32029
|
+
path3.call(print2, "init")
|
|
32030
|
+
]) : path3.call(print2, "id");
|
|
31871
32031
|
case "WithStatement":
|
|
31872
32032
|
return concat([
|
|
31873
32033
|
"with (",
|
|
31874
|
-
|
|
32034
|
+
path3.call(print2, "object"),
|
|
31875
32035
|
") ",
|
|
31876
|
-
|
|
32036
|
+
path3.call(print2, "body")
|
|
31877
32037
|
]);
|
|
31878
32038
|
case "IfStatement": {
|
|
31879
|
-
const con = adjustClause(
|
|
31880
|
-
parts.push("if (",
|
|
32039
|
+
const con = adjustClause(path3.call(print2, "consequent"), options);
|
|
32040
|
+
parts.push("if (", path3.call(print2, "test"), ")", con);
|
|
31881
32041
|
if (n2.alternate)
|
|
31882
32042
|
parts.push(
|
|
31883
32043
|
endsWithBrace(con) ? " else" : "\nelse",
|
|
31884
|
-
adjustClause(
|
|
32044
|
+
adjustClause(path3.call(print2, "alternate"), options)
|
|
31885
32045
|
);
|
|
31886
32046
|
return concat(parts);
|
|
31887
32047
|
}
|
|
31888
32048
|
case "ForStatement": {
|
|
31889
|
-
const init =
|
|
32049
|
+
const init = path3.call(print2, "init");
|
|
31890
32050
|
const sep = init.length > 1 ? ";\n" : "; ";
|
|
31891
32051
|
const forParen = "for (";
|
|
31892
|
-
const indented = fromString(sep).join([init,
|
|
32052
|
+
const indented = fromString(sep).join([init, path3.call(print2, "test"), path3.call(print2, "update")]).indentTail(forParen.length);
|
|
31893
32053
|
const head = concat([forParen, indented, ")"]);
|
|
31894
|
-
let clause = adjustClause(
|
|
32054
|
+
let clause = adjustClause(path3.call(print2, "body"), options);
|
|
31895
32055
|
parts.push(head);
|
|
31896
32056
|
if (head.length > 1) {
|
|
31897
32057
|
parts.push("\n");
|
|
@@ -31903,18 +32063,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31903
32063
|
case "WhileStatement":
|
|
31904
32064
|
return concat([
|
|
31905
32065
|
"while (",
|
|
31906
|
-
|
|
32066
|
+
path3.call(print2, "test"),
|
|
31907
32067
|
")",
|
|
31908
|
-
adjustClause(
|
|
32068
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31909
32069
|
]);
|
|
31910
32070
|
case "ForInStatement":
|
|
31911
32071
|
return concat([
|
|
31912
32072
|
n2.each ? "for each (" : "for (",
|
|
31913
|
-
|
|
32073
|
+
path3.call(print2, "left"),
|
|
31914
32074
|
" in ",
|
|
31915
|
-
|
|
32075
|
+
path3.call(print2, "right"),
|
|
31916
32076
|
")",
|
|
31917
|
-
adjustClause(
|
|
32077
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31918
32078
|
]);
|
|
31919
32079
|
case "ForOfStatement":
|
|
31920
32080
|
case "ForAwaitStatement":
|
|
@@ -31924,28 +32084,28 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31924
32084
|
}
|
|
31925
32085
|
parts.push(
|
|
31926
32086
|
"(",
|
|
31927
|
-
|
|
32087
|
+
path3.call(print2, "left"),
|
|
31928
32088
|
" of ",
|
|
31929
|
-
|
|
32089
|
+
path3.call(print2, "right"),
|
|
31930
32090
|
")",
|
|
31931
|
-
adjustClause(
|
|
32091
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31932
32092
|
);
|
|
31933
32093
|
return concat(parts);
|
|
31934
32094
|
case "DoWhileStatement": {
|
|
31935
32095
|
const doBody = concat([
|
|
31936
32096
|
"do",
|
|
31937
|
-
adjustClause(
|
|
32097
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31938
32098
|
]);
|
|
31939
32099
|
parts.push(doBody);
|
|
31940
32100
|
if (endsWithBrace(doBody))
|
|
31941
32101
|
parts.push(" while");
|
|
31942
32102
|
else
|
|
31943
32103
|
parts.push("\nwhile");
|
|
31944
|
-
parts.push(" (",
|
|
32104
|
+
parts.push(" (", path3.call(print2, "test"), ");");
|
|
31945
32105
|
return concat(parts);
|
|
31946
32106
|
}
|
|
31947
32107
|
case "DoExpression": {
|
|
31948
|
-
const statements =
|
|
32108
|
+
const statements = path3.call(
|
|
31949
32109
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
31950
32110
|
"body"
|
|
31951
32111
|
);
|
|
@@ -31954,66 +32114,66 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31954
32114
|
case "BreakStatement":
|
|
31955
32115
|
parts.push("break");
|
|
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 "ContinueStatement":
|
|
31961
32121
|
parts.push("continue");
|
|
31962
32122
|
if (n2.label)
|
|
31963
|
-
parts.push(" ",
|
|
32123
|
+
parts.push(" ", path3.call(print2, "label"));
|
|
31964
32124
|
parts.push(";");
|
|
31965
32125
|
return concat(parts);
|
|
31966
32126
|
case "LabeledStatement":
|
|
31967
32127
|
return concat([
|
|
31968
|
-
|
|
32128
|
+
path3.call(print2, "label"),
|
|
31969
32129
|
":\n",
|
|
31970
|
-
|
|
32130
|
+
path3.call(print2, "body")
|
|
31971
32131
|
]);
|
|
31972
32132
|
case "TryStatement":
|
|
31973
|
-
parts.push("try ",
|
|
32133
|
+
parts.push("try ", path3.call(print2, "block"));
|
|
31974
32134
|
if (n2.handler) {
|
|
31975
|
-
parts.push(" ",
|
|
32135
|
+
parts.push(" ", path3.call(print2, "handler"));
|
|
31976
32136
|
} else if (n2.handlers) {
|
|
31977
|
-
|
|
32137
|
+
path3.each(function(handlerPath) {
|
|
31978
32138
|
parts.push(" ", print2(handlerPath));
|
|
31979
32139
|
}, "handlers");
|
|
31980
32140
|
}
|
|
31981
32141
|
if (n2.finalizer) {
|
|
31982
|
-
parts.push(" finally ",
|
|
32142
|
+
parts.push(" finally ", path3.call(print2, "finalizer"));
|
|
31983
32143
|
}
|
|
31984
32144
|
return concat(parts);
|
|
31985
32145
|
case "CatchClause":
|
|
31986
32146
|
parts.push("catch ");
|
|
31987
32147
|
if (n2.param) {
|
|
31988
|
-
parts.push("(",
|
|
32148
|
+
parts.push("(", path3.call(print2, "param"));
|
|
31989
32149
|
}
|
|
31990
32150
|
if (n2.guard) {
|
|
31991
|
-
parts.push(" if ",
|
|
32151
|
+
parts.push(" if ", path3.call(print2, "guard"));
|
|
31992
32152
|
}
|
|
31993
32153
|
if (n2.param) {
|
|
31994
32154
|
parts.push(") ");
|
|
31995
32155
|
}
|
|
31996
|
-
parts.push(
|
|
32156
|
+
parts.push(path3.call(print2, "body"));
|
|
31997
32157
|
return concat(parts);
|
|
31998
32158
|
case "ThrowStatement":
|
|
31999
|
-
return concat(["throw ",
|
|
32159
|
+
return concat(["throw ", path3.call(print2, "argument"), ";"]);
|
|
32000
32160
|
case "SwitchStatement":
|
|
32001
32161
|
return concat([
|
|
32002
32162
|
"switch (",
|
|
32003
|
-
|
|
32163
|
+
path3.call(print2, "discriminant"),
|
|
32004
32164
|
") {\n",
|
|
32005
|
-
fromString("\n").join(
|
|
32165
|
+
fromString("\n").join(path3.map(print2, "cases")),
|
|
32006
32166
|
"\n}"
|
|
32007
32167
|
]);
|
|
32008
32168
|
case "SwitchCase":
|
|
32009
32169
|
if (n2.test)
|
|
32010
|
-
parts.push("case ",
|
|
32170
|
+
parts.push("case ", path3.call(print2, "test"), ":");
|
|
32011
32171
|
else
|
|
32012
32172
|
parts.push("default:");
|
|
32013
32173
|
if (n2.consequent.length > 0) {
|
|
32014
32174
|
parts.push(
|
|
32015
32175
|
"\n",
|
|
32016
|
-
|
|
32176
|
+
path3.call(
|
|
32017
32177
|
(consequentPath) => printStatementSequence(consequentPath, options, print2),
|
|
32018
32178
|
"consequent"
|
|
32019
32179
|
).indent(options.tabWidth)
|
|
@@ -32023,38 +32183,38 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32023
32183
|
case "DebuggerStatement":
|
|
32024
32184
|
return fromString("debugger;");
|
|
32025
32185
|
case "JSXAttribute":
|
|
32026
|
-
parts.push(
|
|
32186
|
+
parts.push(path3.call(print2, "name"));
|
|
32027
32187
|
if (n2.value)
|
|
32028
|
-
parts.push("=",
|
|
32188
|
+
parts.push("=", path3.call(print2, "value"));
|
|
32029
32189
|
return concat(parts);
|
|
32030
32190
|
case "JSXIdentifier":
|
|
32031
32191
|
return fromString(n2.name, options);
|
|
32032
32192
|
case "JSXNamespacedName":
|
|
32033
32193
|
return fromString(":").join([
|
|
32034
|
-
|
|
32035
|
-
|
|
32194
|
+
path3.call(print2, "namespace"),
|
|
32195
|
+
path3.call(print2, "name")
|
|
32036
32196
|
]);
|
|
32037
32197
|
case "JSXMemberExpression":
|
|
32038
32198
|
return fromString(".").join([
|
|
32039
|
-
|
|
32040
|
-
|
|
32199
|
+
path3.call(print2, "object"),
|
|
32200
|
+
path3.call(print2, "property")
|
|
32041
32201
|
]);
|
|
32042
32202
|
case "JSXSpreadAttribute":
|
|
32043
|
-
return concat(["{...",
|
|
32203
|
+
return concat(["{...", path3.call(print2, "argument"), "}"]);
|
|
32044
32204
|
case "JSXSpreadChild":
|
|
32045
|
-
return concat(["{...",
|
|
32205
|
+
return concat(["{...", path3.call(print2, "expression"), "}"]);
|
|
32046
32206
|
case "JSXExpressionContainer":
|
|
32047
|
-
return concat(["{",
|
|
32207
|
+
return concat(["{", path3.call(print2, "expression"), "}"]);
|
|
32048
32208
|
case "JSXElement":
|
|
32049
32209
|
case "JSXFragment": {
|
|
32050
32210
|
const openingPropName = "opening" + (n2.type === "JSXElement" ? "Element" : "Fragment");
|
|
32051
32211
|
const closingPropName = "closing" + (n2.type === "JSXElement" ? "Element" : "Fragment");
|
|
32052
|
-
const openingLines =
|
|
32212
|
+
const openingLines = path3.call(print2, openingPropName);
|
|
32053
32213
|
if (n2[openingPropName].selfClosing) {
|
|
32054
32214
|
return openingLines;
|
|
32055
32215
|
}
|
|
32056
32216
|
const childLines = concat(
|
|
32057
|
-
|
|
32217
|
+
path3.map(function(childPath) {
|
|
32058
32218
|
const child = childPath.getValue();
|
|
32059
32219
|
if (namedTypes.Literal.check(child) && typeof child.value === "string") {
|
|
32060
32220
|
if (/\S/.test(child.value)) {
|
|
@@ -32066,13 +32226,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32066
32226
|
return print2(childPath);
|
|
32067
32227
|
}, "children")
|
|
32068
32228
|
).indentTail(options.tabWidth);
|
|
32069
|
-
const closingLines =
|
|
32229
|
+
const closingLines = path3.call(print2, closingPropName);
|
|
32070
32230
|
return concat([openingLines, childLines, closingLines]);
|
|
32071
32231
|
}
|
|
32072
32232
|
case "JSXOpeningElement": {
|
|
32073
|
-
parts.push("<",
|
|
32233
|
+
parts.push("<", path3.call(print2, "name"));
|
|
32074
32234
|
const attrParts = [];
|
|
32075
|
-
|
|
32235
|
+
path3.each(function(attrPath) {
|
|
32076
32236
|
attrParts.push(" ", print2(attrPath));
|
|
32077
32237
|
}, "attributes");
|
|
32078
32238
|
let attrLines = concat(attrParts);
|
|
@@ -32089,7 +32249,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32089
32249
|
return concat(parts);
|
|
32090
32250
|
}
|
|
32091
32251
|
case "JSXClosingElement":
|
|
32092
|
-
return concat(["</",
|
|
32252
|
+
return concat(["</", path3.call(print2, "name"), ">"]);
|
|
32093
32253
|
case "JSXOpeningFragment":
|
|
32094
32254
|
return fromString("<>");
|
|
32095
32255
|
case "JSXClosingFragment":
|
|
@@ -32100,9 +32260,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32100
32260
|
return fromString("");
|
|
32101
32261
|
case "TypeAnnotatedIdentifier":
|
|
32102
32262
|
return concat([
|
|
32103
|
-
|
|
32263
|
+
path3.call(print2, "annotation"),
|
|
32104
32264
|
" ",
|
|
32105
|
-
|
|
32265
|
+
path3.call(print2, "identifier")
|
|
32106
32266
|
]);
|
|
32107
32267
|
case "ClassBody":
|
|
32108
32268
|
if (n2.body.length === 0) {
|
|
@@ -32110,14 +32270,14 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32110
32270
|
}
|
|
32111
32271
|
return concat([
|
|
32112
32272
|
"{\n",
|
|
32113
|
-
|
|
32273
|
+
path3.call(
|
|
32114
32274
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
32115
32275
|
"body"
|
|
32116
32276
|
).indent(options.tabWidth),
|
|
32117
32277
|
"\n}"
|
|
32118
32278
|
]);
|
|
32119
32279
|
case "ClassPropertyDefinition":
|
|
32120
|
-
parts.push("static ",
|
|
32280
|
+
parts.push("static ", path3.call(print2, "definition"));
|
|
32121
32281
|
if (!namedTypes.MethodDefinition.check(n2.definition))
|
|
32122
32282
|
parts.push(";");
|
|
32123
32283
|
return concat(parts);
|
|
@@ -32138,12 +32298,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32138
32298
|
if (n2.readonly) {
|
|
32139
32299
|
parts.push("readonly ");
|
|
32140
32300
|
}
|
|
32141
|
-
let key =
|
|
32301
|
+
let key = path3.call(print2, "key");
|
|
32142
32302
|
if (n2.computed) {
|
|
32143
32303
|
key = concat(["[", key, "]"]);
|
|
32144
32304
|
}
|
|
32145
32305
|
if (n2.variance) {
|
|
32146
|
-
key = concat([printVariance(
|
|
32306
|
+
key = concat([printVariance(path3, print2), key]);
|
|
32147
32307
|
}
|
|
32148
32308
|
parts.push(key);
|
|
32149
32309
|
if (n2.optional) {
|
|
@@ -32153,10 +32313,10 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32153
32313
|
parts.push("!");
|
|
32154
32314
|
}
|
|
32155
32315
|
if (n2.typeAnnotation) {
|
|
32156
|
-
parts.push(
|
|
32316
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32157
32317
|
}
|
|
32158
32318
|
if (n2.value) {
|
|
32159
|
-
parts.push(" = ",
|
|
32319
|
+
parts.push(" = ", path3.call(print2, "value"));
|
|
32160
32320
|
}
|
|
32161
32321
|
parts.push(";");
|
|
32162
32322
|
return concat(parts);
|
|
@@ -32165,12 +32325,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32165
32325
|
if (n2.static) {
|
|
32166
32326
|
parts.push("static ");
|
|
32167
32327
|
}
|
|
32168
|
-
parts.push(
|
|
32328
|
+
parts.push(path3.call(print2, "key"));
|
|
32169
32329
|
if (n2.typeAnnotation) {
|
|
32170
|
-
parts.push(
|
|
32330
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32171
32331
|
}
|
|
32172
32332
|
if (n2.value) {
|
|
32173
|
-
parts.push(" = ",
|
|
32333
|
+
parts.push(" = ", path3.call(print2, "value"));
|
|
32174
32334
|
}
|
|
32175
32335
|
parts.push(";");
|
|
32176
32336
|
return concat(parts);
|
|
@@ -32180,9 +32340,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32180
32340
|
"accessor "
|
|
32181
32341
|
);
|
|
32182
32342
|
if (n2.computed) {
|
|
32183
|
-
parts.push("[",
|
|
32343
|
+
parts.push("[", path3.call(print2, "key"), "]");
|
|
32184
32344
|
} else {
|
|
32185
|
-
parts.push(
|
|
32345
|
+
parts.push(path3.call(print2, "key"));
|
|
32186
32346
|
}
|
|
32187
32347
|
if (n2.optional) {
|
|
32188
32348
|
parts.push("?");
|
|
@@ -32191,10 +32351,10 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32191
32351
|
parts.push("!");
|
|
32192
32352
|
}
|
|
32193
32353
|
if (n2.typeAnnotation) {
|
|
32194
|
-
parts.push(
|
|
32354
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32195
32355
|
}
|
|
32196
32356
|
if (n2.value) {
|
|
32197
|
-
parts.push(" = ",
|
|
32357
|
+
parts.push(" = ", path3.call(print2, "value"));
|
|
32198
32358
|
}
|
|
32199
32359
|
parts.push(";");
|
|
32200
32360
|
return concat(parts);
|
|
@@ -32210,42 +32370,42 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32210
32370
|
}
|
|
32211
32371
|
parts.push("class");
|
|
32212
32372
|
if (n2.id) {
|
|
32213
|
-
parts.push(" ",
|
|
32373
|
+
parts.push(" ", path3.call(print2, "id"));
|
|
32214
32374
|
}
|
|
32215
32375
|
if (n2.typeParameters) {
|
|
32216
|
-
parts.push(
|
|
32376
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
32217
32377
|
}
|
|
32218
32378
|
if (n2.superClass) {
|
|
32219
32379
|
parts.push(
|
|
32220
32380
|
" extends ",
|
|
32221
|
-
|
|
32222
|
-
|
|
32381
|
+
path3.call(print2, "superClass"),
|
|
32382
|
+
path3.call(print2, "superTypeParameters")
|
|
32223
32383
|
);
|
|
32224
32384
|
}
|
|
32225
32385
|
if (n2.extends && n2.extends.length > 0) {
|
|
32226
32386
|
parts.push(
|
|
32227
32387
|
" extends ",
|
|
32228
|
-
fromString(", ").join(
|
|
32388
|
+
fromString(", ").join(path3.map(print2, "extends"))
|
|
32229
32389
|
);
|
|
32230
32390
|
}
|
|
32231
32391
|
if (n2["implements"] && n2["implements"].length > 0) {
|
|
32232
32392
|
parts.push(
|
|
32233
32393
|
" implements ",
|
|
32234
|
-
fromString(", ").join(
|
|
32394
|
+
fromString(", ").join(path3.map(print2, "implements"))
|
|
32235
32395
|
);
|
|
32236
32396
|
}
|
|
32237
|
-
parts.push(" ",
|
|
32397
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
32238
32398
|
if (n2.type === "DeclareClass") {
|
|
32239
|
-
return printFlowDeclaration(
|
|
32399
|
+
return printFlowDeclaration(path3, parts);
|
|
32240
32400
|
} else {
|
|
32241
32401
|
return concat(parts);
|
|
32242
32402
|
}
|
|
32243
32403
|
case "TemplateElement":
|
|
32244
32404
|
return fromString(n2.value.raw, options).lockIndentTail();
|
|
32245
32405
|
case "TemplateLiteral": {
|
|
32246
|
-
const expressions =
|
|
32406
|
+
const expressions = path3.map(print2, "expressions");
|
|
32247
32407
|
parts.push("`");
|
|
32248
|
-
|
|
32408
|
+
path3.each(function(childPath) {
|
|
32249
32409
|
const i = childPath.getName();
|
|
32250
32410
|
parts.push(print2(childPath));
|
|
32251
32411
|
if (i < expressions.length) {
|
|
@@ -32256,7 +32416,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32256
32416
|
return concat(parts).lockIndentTail();
|
|
32257
32417
|
}
|
|
32258
32418
|
case "TaggedTemplateExpression":
|
|
32259
|
-
return concat([
|
|
32419
|
+
return concat([path3.call(print2, "tag"), path3.call(print2, "quasi")]);
|
|
32260
32420
|
case "Node":
|
|
32261
32421
|
case "Printable":
|
|
32262
32422
|
case "SourceLocation":
|
|
@@ -32290,7 +32450,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32290
32450
|
if (n2.typeAnnotation.type !== "FunctionTypeAnnotation") {
|
|
32291
32451
|
parts.push(": ");
|
|
32292
32452
|
}
|
|
32293
|
-
parts.push(
|
|
32453
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32294
32454
|
return concat(parts);
|
|
32295
32455
|
}
|
|
32296
32456
|
return fromString("");
|
|
@@ -32304,9 +32464,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32304
32464
|
case "MixedTypeAnnotation":
|
|
32305
32465
|
return fromString("mixed", options);
|
|
32306
32466
|
case "ArrayTypeAnnotation":
|
|
32307
|
-
return concat([
|
|
32467
|
+
return concat([path3.call(print2, "elementType"), "[]"]);
|
|
32308
32468
|
case "TupleTypeAnnotation": {
|
|
32309
|
-
const printed =
|
|
32469
|
+
const printed = path3.map(print2, "types");
|
|
32310
32470
|
const joined = fromString(", ").join(printed);
|
|
32311
32471
|
const oneLine = joined.getLineLength(1) <= options.wrapColumn;
|
|
32312
32472
|
if (oneLine) {
|
|
@@ -32318,7 +32478,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32318
32478
|
} else {
|
|
32319
32479
|
parts.push("[\n");
|
|
32320
32480
|
}
|
|
32321
|
-
|
|
32481
|
+
path3.each(function(elemPath) {
|
|
32322
32482
|
const i = elemPath.getName();
|
|
32323
32483
|
const elem = elemPath.getValue();
|
|
32324
32484
|
if (!elem) {
|
|
@@ -32354,39 +32514,39 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32354
32514
|
if (n2.extends && n2.extends.length > 0) {
|
|
32355
32515
|
parts.push(
|
|
32356
32516
|
" extends ",
|
|
32357
|
-
fromString(", ").join(
|
|
32517
|
+
fromString(", ").join(path3.map(print2, "extends"))
|
|
32358
32518
|
);
|
|
32359
32519
|
}
|
|
32360
|
-
parts.push(" ",
|
|
32520
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
32361
32521
|
return concat(parts);
|
|
32362
32522
|
case "DeclareFunction":
|
|
32363
|
-
return printFlowDeclaration(
|
|
32523
|
+
return printFlowDeclaration(path3, [
|
|
32364
32524
|
"function ",
|
|
32365
|
-
|
|
32525
|
+
path3.call(print2, "id"),
|
|
32366
32526
|
";"
|
|
32367
32527
|
]);
|
|
32368
32528
|
case "DeclareModule":
|
|
32369
|
-
return printFlowDeclaration(
|
|
32529
|
+
return printFlowDeclaration(path3, [
|
|
32370
32530
|
"module ",
|
|
32371
|
-
|
|
32531
|
+
path3.call(print2, "id"),
|
|
32372
32532
|
" ",
|
|
32373
|
-
|
|
32533
|
+
path3.call(print2, "body")
|
|
32374
32534
|
]);
|
|
32375
32535
|
case "DeclareModuleExports":
|
|
32376
|
-
return printFlowDeclaration(
|
|
32536
|
+
return printFlowDeclaration(path3, [
|
|
32377
32537
|
"module.exports",
|
|
32378
|
-
|
|
32538
|
+
path3.call(print2, "typeAnnotation")
|
|
32379
32539
|
]);
|
|
32380
32540
|
case "DeclareVariable":
|
|
32381
|
-
return printFlowDeclaration(
|
|
32541
|
+
return printFlowDeclaration(path3, ["var ", path3.call(print2, "id"), ";"]);
|
|
32382
32542
|
case "DeclareExportDeclaration":
|
|
32383
32543
|
case "DeclareExportAllDeclaration":
|
|
32384
|
-
return concat(["declare ", printExportDeclaration(
|
|
32544
|
+
return concat(["declare ", printExportDeclaration(path3, options, print2)]);
|
|
32385
32545
|
case "EnumDeclaration":
|
|
32386
32546
|
return concat([
|
|
32387
32547
|
"enum ",
|
|
32388
|
-
|
|
32389
|
-
|
|
32548
|
+
path3.call(print2, "id"),
|
|
32549
|
+
path3.call(print2, "body")
|
|
32390
32550
|
]);
|
|
32391
32551
|
case "EnumBooleanBody":
|
|
32392
32552
|
case "EnumNumberBody":
|
|
@@ -32401,29 +32561,29 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32401
32561
|
}
|
|
32402
32562
|
parts.push(
|
|
32403
32563
|
" {\n",
|
|
32404
|
-
fromString("\n").join(
|
|
32564
|
+
fromString("\n").join(path3.map(print2, "members")).indent(options.tabWidth),
|
|
32405
32565
|
"\n}"
|
|
32406
32566
|
);
|
|
32407
32567
|
return concat(parts);
|
|
32408
32568
|
}
|
|
32409
32569
|
case "EnumDefaultedMember":
|
|
32410
|
-
return concat([
|
|
32570
|
+
return concat([path3.call(print2, "id"), ","]);
|
|
32411
32571
|
case "EnumBooleanMember":
|
|
32412
32572
|
case "EnumNumberMember":
|
|
32413
32573
|
case "EnumStringMember":
|
|
32414
32574
|
return concat([
|
|
32415
|
-
|
|
32575
|
+
path3.call(print2, "id"),
|
|
32416
32576
|
" = ",
|
|
32417
|
-
|
|
32577
|
+
path3.call(print2, "init"),
|
|
32418
32578
|
","
|
|
32419
32579
|
]);
|
|
32420
32580
|
case "InferredPredicate":
|
|
32421
32581
|
return fromString("%checks", options);
|
|
32422
32582
|
case "DeclaredPredicate":
|
|
32423
|
-
return concat(["%checks(",
|
|
32583
|
+
return concat(["%checks(", path3.call(print2, "value"), ")"]);
|
|
32424
32584
|
case "FunctionTypeAnnotation": {
|
|
32425
|
-
const parent =
|
|
32426
|
-
const isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) || namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method || namedTypes.DeclareFunction.check(
|
|
32585
|
+
const parent = path3.getParentNode(0);
|
|
32586
|
+
const isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) || namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method || namedTypes.DeclareFunction.check(path3.getParentNode(2)));
|
|
32427
32587
|
const needsColon = isArrowFunctionTypeAnnotation && !namedTypes.FunctionTypeParam.check(parent) && !namedTypes.TypeAlias.check(parent);
|
|
32428
32588
|
if (needsColon) {
|
|
32429
32589
|
parts.push(": ");
|
|
@@ -32431,21 +32591,21 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32431
32591
|
const hasTypeParameters = !!n2.typeParameters;
|
|
32432
32592
|
const needsParens = hasTypeParameters || n2.params.length !== 1 || n2.params[0].name;
|
|
32433
32593
|
parts.push(
|
|
32434
|
-
hasTypeParameters ?
|
|
32594
|
+
hasTypeParameters ? path3.call(print2, "typeParameters") : "",
|
|
32435
32595
|
needsParens ? "(" : "",
|
|
32436
|
-
printFunctionParams(
|
|
32596
|
+
printFunctionParams(path3, options, print2),
|
|
32437
32597
|
needsParens ? ")" : ""
|
|
32438
32598
|
);
|
|
32439
32599
|
if (n2.returnType) {
|
|
32440
32600
|
parts.push(
|
|
32441
32601
|
isArrowFunctionTypeAnnotation ? " => " : ": ",
|
|
32442
|
-
|
|
32602
|
+
path3.call(print2, "returnType")
|
|
32443
32603
|
);
|
|
32444
32604
|
}
|
|
32445
32605
|
return concat(parts);
|
|
32446
32606
|
}
|
|
32447
32607
|
case "FunctionTypeParam": {
|
|
32448
|
-
const name =
|
|
32608
|
+
const name = path3.call(print2, "name");
|
|
32449
32609
|
parts.push(name);
|
|
32450
32610
|
if (n2.optional) {
|
|
32451
32611
|
parts.push("?");
|
|
@@ -32453,13 +32613,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32453
32613
|
if (name.infos[0].line) {
|
|
32454
32614
|
parts.push(": ");
|
|
32455
32615
|
}
|
|
32456
|
-
parts.push(
|
|
32616
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32457
32617
|
return concat(parts);
|
|
32458
32618
|
}
|
|
32459
32619
|
case "GenericTypeAnnotation":
|
|
32460
32620
|
return concat([
|
|
32461
|
-
|
|
32462
|
-
|
|
32621
|
+
path3.call(print2, "id"),
|
|
32622
|
+
path3.call(print2, "typeParameters")
|
|
32463
32623
|
]);
|
|
32464
32624
|
case "DeclareInterface":
|
|
32465
32625
|
parts.push("declare ");
|
|
@@ -32470,31 +32630,31 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32470
32630
|
}
|
|
32471
32631
|
parts.push(
|
|
32472
32632
|
"interface ",
|
|
32473
|
-
|
|
32474
|
-
|
|
32633
|
+
path3.call(print2, "id"),
|
|
32634
|
+
path3.call(print2, "typeParameters"),
|
|
32475
32635
|
" "
|
|
32476
32636
|
);
|
|
32477
32637
|
if (n2["extends"] && n2["extends"].length > 0) {
|
|
32478
32638
|
parts.push(
|
|
32479
32639
|
"extends ",
|
|
32480
|
-
fromString(", ").join(
|
|
32640
|
+
fromString(", ").join(path3.map(print2, "extends")),
|
|
32481
32641
|
" "
|
|
32482
32642
|
);
|
|
32483
32643
|
}
|
|
32484
32644
|
if (n2.body) {
|
|
32485
|
-
parts.push(
|
|
32645
|
+
parts.push(path3.call(print2, "body"));
|
|
32486
32646
|
}
|
|
32487
32647
|
return concat(parts);
|
|
32488
32648
|
case "ClassImplements":
|
|
32489
32649
|
case "InterfaceExtends":
|
|
32490
32650
|
return concat([
|
|
32491
|
-
|
|
32492
|
-
|
|
32651
|
+
path3.call(print2, "id"),
|
|
32652
|
+
path3.call(print2, "typeParameters")
|
|
32493
32653
|
]);
|
|
32494
32654
|
case "IntersectionTypeAnnotation":
|
|
32495
|
-
return fromString(" & ").join(
|
|
32655
|
+
return fromString(" & ").join(path3.map(print2, "types"));
|
|
32496
32656
|
case "NullableTypeAnnotation":
|
|
32497
|
-
return concat(["?",
|
|
32657
|
+
return concat(["?", path3.call(print2, "typeAnnotation")]);
|
|
32498
32658
|
case "NullLiteralTypeAnnotation":
|
|
32499
32659
|
return fromString("null", options);
|
|
32500
32660
|
case "ThisTypeAnnotation":
|
|
@@ -32502,40 +32662,40 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32502
32662
|
case "NumberTypeAnnotation":
|
|
32503
32663
|
return fromString("number", options);
|
|
32504
32664
|
case "ObjectTypeCallProperty":
|
|
32505
|
-
return
|
|
32665
|
+
return path3.call(print2, "value");
|
|
32506
32666
|
case "ObjectTypeIndexer":
|
|
32507
32667
|
if (n2.static) {
|
|
32508
32668
|
parts.push("static ");
|
|
32509
32669
|
}
|
|
32510
|
-
parts.push(printVariance(
|
|
32670
|
+
parts.push(printVariance(path3, print2), "[");
|
|
32511
32671
|
if (n2.id) {
|
|
32512
|
-
parts.push(
|
|
32672
|
+
parts.push(path3.call(print2, "id"), ": ");
|
|
32513
32673
|
}
|
|
32514
|
-
parts.push(
|
|
32674
|
+
parts.push(path3.call(print2, "key"), "]: ", path3.call(print2, "value"));
|
|
32515
32675
|
return concat(parts);
|
|
32516
32676
|
case "ObjectTypeProperty":
|
|
32517
32677
|
return concat([
|
|
32518
|
-
printVariance(
|
|
32519
|
-
|
|
32678
|
+
printVariance(path3, print2),
|
|
32679
|
+
path3.call(print2, "key"),
|
|
32520
32680
|
n2.optional ? "?" : "",
|
|
32521
32681
|
": ",
|
|
32522
|
-
|
|
32682
|
+
path3.call(print2, "value")
|
|
32523
32683
|
]);
|
|
32524
32684
|
case "ObjectTypeInternalSlot":
|
|
32525
32685
|
return concat([
|
|
32526
32686
|
n2.static ? "static " : "",
|
|
32527
32687
|
"[[",
|
|
32528
|
-
|
|
32688
|
+
path3.call(print2, "id"),
|
|
32529
32689
|
"]]",
|
|
32530
32690
|
n2.optional ? "?" : "",
|
|
32531
32691
|
n2.value.type !== "FunctionTypeAnnotation" ? ": " : "",
|
|
32532
|
-
|
|
32692
|
+
path3.call(print2, "value")
|
|
32533
32693
|
]);
|
|
32534
32694
|
case "QualifiedTypeIdentifier":
|
|
32535
32695
|
return concat([
|
|
32536
|
-
|
|
32696
|
+
path3.call(print2, "qualification"),
|
|
32537
32697
|
".",
|
|
32538
|
-
|
|
32698
|
+
path3.call(print2, "id")
|
|
32539
32699
|
]);
|
|
32540
32700
|
case "StringLiteralTypeAnnotation":
|
|
32541
32701
|
return fromString(nodeStr(n2.value, options), options);
|
|
@@ -32551,10 +32711,10 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32551
32711
|
case "TypeAlias":
|
|
32552
32712
|
return concat([
|
|
32553
32713
|
"type ",
|
|
32554
|
-
|
|
32555
|
-
|
|
32714
|
+
path3.call(print2, "id"),
|
|
32715
|
+
path3.call(print2, "typeParameters"),
|
|
32556
32716
|
" = ",
|
|
32557
|
-
|
|
32717
|
+
path3.call(print2, "right"),
|
|
32558
32718
|
";"
|
|
32559
32719
|
]);
|
|
32560
32720
|
case "DeclareOpaqueType":
|
|
@@ -32562,29 +32722,29 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32562
32722
|
case "OpaqueType":
|
|
32563
32723
|
parts.push(
|
|
32564
32724
|
"opaque type ",
|
|
32565
|
-
|
|
32566
|
-
|
|
32725
|
+
path3.call(print2, "id"),
|
|
32726
|
+
path3.call(print2, "typeParameters")
|
|
32567
32727
|
);
|
|
32568
32728
|
if (n2["supertype"]) {
|
|
32569
|
-
parts.push(": ",
|
|
32729
|
+
parts.push(": ", path3.call(print2, "supertype"));
|
|
32570
32730
|
}
|
|
32571
32731
|
if (n2["impltype"]) {
|
|
32572
|
-
parts.push(" = ",
|
|
32732
|
+
parts.push(" = ", path3.call(print2, "impltype"));
|
|
32573
32733
|
}
|
|
32574
32734
|
parts.push(";");
|
|
32575
32735
|
return concat(parts);
|
|
32576
32736
|
case "TypeCastExpression":
|
|
32577
32737
|
return concat([
|
|
32578
32738
|
"(",
|
|
32579
|
-
|
|
32580
|
-
|
|
32739
|
+
path3.call(print2, "expression"),
|
|
32740
|
+
path3.call(print2, "typeAnnotation"),
|
|
32581
32741
|
")"
|
|
32582
32742
|
]);
|
|
32583
32743
|
case "TypeParameterDeclaration":
|
|
32584
32744
|
case "TypeParameterInstantiation":
|
|
32585
32745
|
return concat([
|
|
32586
32746
|
"<",
|
|
32587
|
-
fromString(", ").join(
|
|
32747
|
+
fromString(", ").join(path3.map(print2, "params")),
|
|
32588
32748
|
">"
|
|
32589
32749
|
]);
|
|
32590
32750
|
case "Variance":
|
|
@@ -32597,32 +32757,32 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32597
32757
|
return fromString("");
|
|
32598
32758
|
case "TypeParameter":
|
|
32599
32759
|
if (n2.variance) {
|
|
32600
|
-
parts.push(printVariance(
|
|
32760
|
+
parts.push(printVariance(path3, print2));
|
|
32601
32761
|
}
|
|
32602
|
-
parts.push(
|
|
32762
|
+
parts.push(path3.call(print2, "name"));
|
|
32603
32763
|
if (n2.bound) {
|
|
32604
|
-
parts.push(
|
|
32764
|
+
parts.push(path3.call(print2, "bound"));
|
|
32605
32765
|
}
|
|
32606
32766
|
if (n2["default"]) {
|
|
32607
|
-
parts.push("=",
|
|
32767
|
+
parts.push("=", path3.call(print2, "default"));
|
|
32608
32768
|
}
|
|
32609
32769
|
return concat(parts);
|
|
32610
32770
|
case "TypeofTypeAnnotation":
|
|
32611
32771
|
return concat([
|
|
32612
32772
|
fromString("typeof ", options),
|
|
32613
|
-
|
|
32773
|
+
path3.call(print2, "argument")
|
|
32614
32774
|
]);
|
|
32615
32775
|
case "IndexedAccessType":
|
|
32616
32776
|
case "OptionalIndexedAccessType":
|
|
32617
32777
|
return concat([
|
|
32618
|
-
|
|
32778
|
+
path3.call(print2, "objectType"),
|
|
32619
32779
|
n2.optional ? "?." : "",
|
|
32620
32780
|
"[",
|
|
32621
|
-
|
|
32781
|
+
path3.call(print2, "indexType"),
|
|
32622
32782
|
"]"
|
|
32623
32783
|
]);
|
|
32624
32784
|
case "UnionTypeAnnotation":
|
|
32625
|
-
return fromString(" | ").join(
|
|
32785
|
+
return fromString(" | ").join(path3.map(print2, "types"));
|
|
32626
32786
|
case "VoidTypeAnnotation":
|
|
32627
32787
|
return fromString("void", options);
|
|
32628
32788
|
case "NullTypeAnnotation":
|
|
@@ -32662,92 +32822,92 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32662
32822
|
case "TSNeverKeyword":
|
|
32663
32823
|
return fromString("never", options);
|
|
32664
32824
|
case "TSArrayType":
|
|
32665
|
-
return concat([
|
|
32825
|
+
return concat([path3.call(print2, "elementType"), "[]"]);
|
|
32666
32826
|
case "TSLiteralType":
|
|
32667
|
-
return
|
|
32827
|
+
return path3.call(print2, "literal");
|
|
32668
32828
|
case "TSUnionType":
|
|
32669
|
-
return fromString(" | ").join(
|
|
32829
|
+
return fromString(" | ").join(path3.map(print2, "types"));
|
|
32670
32830
|
case "TSIntersectionType":
|
|
32671
|
-
return fromString(" & ").join(
|
|
32831
|
+
return fromString(" & ").join(path3.map(print2, "types"));
|
|
32672
32832
|
case "TSConditionalType":
|
|
32673
32833
|
parts.push(
|
|
32674
|
-
|
|
32834
|
+
path3.call(print2, "checkType"),
|
|
32675
32835
|
" extends ",
|
|
32676
|
-
|
|
32836
|
+
path3.call(print2, "extendsType"),
|
|
32677
32837
|
" ? ",
|
|
32678
|
-
|
|
32838
|
+
path3.call(print2, "trueType"),
|
|
32679
32839
|
" : ",
|
|
32680
|
-
|
|
32840
|
+
path3.call(print2, "falseType")
|
|
32681
32841
|
);
|
|
32682
32842
|
return concat(parts);
|
|
32683
32843
|
case "TSInferType":
|
|
32684
|
-
parts.push("infer ",
|
|
32844
|
+
parts.push("infer ", path3.call(print2, "typeParameter"));
|
|
32685
32845
|
return concat(parts);
|
|
32686
32846
|
case "TSParenthesizedType":
|
|
32687
|
-
return concat(["(",
|
|
32847
|
+
return concat(["(", path3.call(print2, "typeAnnotation"), ")"]);
|
|
32688
32848
|
case "TSFunctionType":
|
|
32689
32849
|
return concat([
|
|
32690
|
-
|
|
32850
|
+
path3.call(print2, "typeParameters"),
|
|
32691
32851
|
"(",
|
|
32692
|
-
printFunctionParams(
|
|
32852
|
+
printFunctionParams(path3, options, print2),
|
|
32693
32853
|
") => ",
|
|
32694
|
-
|
|
32854
|
+
path3.call(print2, "typeAnnotation", "typeAnnotation")
|
|
32695
32855
|
]);
|
|
32696
32856
|
case "TSConstructorType":
|
|
32697
32857
|
return concat([
|
|
32698
32858
|
"new ",
|
|
32699
|
-
|
|
32859
|
+
path3.call(print2, "typeParameters"),
|
|
32700
32860
|
"(",
|
|
32701
|
-
printFunctionParams(
|
|
32861
|
+
printFunctionParams(path3, options, print2),
|
|
32702
32862
|
") => ",
|
|
32703
|
-
|
|
32863
|
+
path3.call(print2, "typeAnnotation", "typeAnnotation")
|
|
32704
32864
|
]);
|
|
32705
32865
|
case "TSMappedType": {
|
|
32706
32866
|
parts.push(
|
|
32707
32867
|
n2.readonly ? "readonly " : "",
|
|
32708
32868
|
"[",
|
|
32709
|
-
|
|
32869
|
+
path3.call(print2, "typeParameter"),
|
|
32710
32870
|
"]",
|
|
32711
32871
|
n2.optional ? "?" : ""
|
|
32712
32872
|
);
|
|
32713
32873
|
if (n2.typeAnnotation) {
|
|
32714
|
-
parts.push(": ",
|
|
32874
|
+
parts.push(": ", path3.call(print2, "typeAnnotation"), ";");
|
|
32715
32875
|
}
|
|
32716
32876
|
return concat(["{\n", concat(parts).indent(options.tabWidth), "\n}"]);
|
|
32717
32877
|
}
|
|
32718
32878
|
case "TSTupleType":
|
|
32719
32879
|
return concat([
|
|
32720
32880
|
"[",
|
|
32721
|
-
fromString(", ").join(
|
|
32881
|
+
fromString(", ").join(path3.map(print2, "elementTypes")),
|
|
32722
32882
|
"]"
|
|
32723
32883
|
]);
|
|
32724
32884
|
case "TSNamedTupleMember":
|
|
32725
|
-
parts.push(
|
|
32885
|
+
parts.push(path3.call(print2, "label"));
|
|
32726
32886
|
if (n2.optional) {
|
|
32727
32887
|
parts.push("?");
|
|
32728
32888
|
}
|
|
32729
|
-
parts.push(": ",
|
|
32889
|
+
parts.push(": ", path3.call(print2, "elementType"));
|
|
32730
32890
|
return concat(parts);
|
|
32731
32891
|
case "TSRestType":
|
|
32732
|
-
return concat(["...",
|
|
32892
|
+
return concat(["...", path3.call(print2, "typeAnnotation")]);
|
|
32733
32893
|
case "TSOptionalType":
|
|
32734
|
-
return concat([
|
|
32894
|
+
return concat([path3.call(print2, "typeAnnotation"), "?"]);
|
|
32735
32895
|
case "TSIndexedAccessType":
|
|
32736
32896
|
return concat([
|
|
32737
|
-
|
|
32897
|
+
path3.call(print2, "objectType"),
|
|
32738
32898
|
"[",
|
|
32739
|
-
|
|
32899
|
+
path3.call(print2, "indexType"),
|
|
32740
32900
|
"]"
|
|
32741
32901
|
]);
|
|
32742
32902
|
case "TSTypeOperator":
|
|
32743
32903
|
return concat([
|
|
32744
|
-
|
|
32904
|
+
path3.call(print2, "operator"),
|
|
32745
32905
|
" ",
|
|
32746
|
-
|
|
32906
|
+
path3.call(print2, "typeAnnotation")
|
|
32747
32907
|
]);
|
|
32748
32908
|
case "TSTypeLiteral": {
|
|
32749
32909
|
const members = fromString("\n").join(
|
|
32750
|
-
|
|
32910
|
+
path3.map(print2, "members").map((member) => {
|
|
32751
32911
|
if (lastNonSpaceCharacter(member) !== ";") {
|
|
32752
32912
|
return member.concat(";");
|
|
32753
32913
|
}
|
|
@@ -32761,13 +32921,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32761
32921
|
return concat(parts);
|
|
32762
32922
|
}
|
|
32763
32923
|
case "TSEnumMember":
|
|
32764
|
-
parts.push(
|
|
32924
|
+
parts.push(path3.call(print2, "id"));
|
|
32765
32925
|
if (n2.initializer) {
|
|
32766
|
-
parts.push(" = ",
|
|
32926
|
+
parts.push(" = ", path3.call(print2, "initializer"));
|
|
32767
32927
|
}
|
|
32768
32928
|
return concat(parts);
|
|
32769
32929
|
case "TSTypeQuery":
|
|
32770
|
-
return concat(["typeof ",
|
|
32930
|
+
return concat(["typeof ", path3.call(print2, "exprName")]);
|
|
32771
32931
|
case "TSParameterProperty":
|
|
32772
32932
|
if (n2.accessibility) {
|
|
32773
32933
|
parts.push(n2.accessibility, " ");
|
|
@@ -32781,132 +32941,132 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32781
32941
|
if (n2.readonly) {
|
|
32782
32942
|
parts.push("readonly ");
|
|
32783
32943
|
}
|
|
32784
|
-
parts.push(
|
|
32944
|
+
parts.push(path3.call(print2, "parameter"));
|
|
32785
32945
|
return concat(parts);
|
|
32786
32946
|
case "TSTypeReference":
|
|
32787
32947
|
return concat([
|
|
32788
|
-
|
|
32789
|
-
|
|
32948
|
+
path3.call(print2, "typeName"),
|
|
32949
|
+
path3.call(print2, "typeParameters")
|
|
32790
32950
|
]);
|
|
32791
32951
|
case "TSQualifiedName":
|
|
32792
|
-
return concat([
|
|
32952
|
+
return concat([path3.call(print2, "left"), ".", path3.call(print2, "right")]);
|
|
32793
32953
|
case "TSAsExpression":
|
|
32794
32954
|
case "TSSatisfiesExpression": {
|
|
32795
|
-
const expression =
|
|
32955
|
+
const expression = path3.call(print2, "expression");
|
|
32796
32956
|
parts.push(
|
|
32797
32957
|
expression,
|
|
32798
32958
|
n2.type === "TSSatisfiesExpression" ? " satisfies " : " as ",
|
|
32799
|
-
|
|
32959
|
+
path3.call(print2, "typeAnnotation")
|
|
32800
32960
|
);
|
|
32801
32961
|
return concat(parts);
|
|
32802
32962
|
}
|
|
32803
32963
|
case "TSTypeCastExpression":
|
|
32804
32964
|
return concat([
|
|
32805
|
-
|
|
32806
|
-
|
|
32965
|
+
path3.call(print2, "expression"),
|
|
32966
|
+
path3.call(print2, "typeAnnotation")
|
|
32807
32967
|
]);
|
|
32808
32968
|
case "TSNonNullExpression":
|
|
32809
|
-
return concat([
|
|
32969
|
+
return concat([path3.call(print2, "expression"), "!"]);
|
|
32810
32970
|
case "TSTypeAnnotation":
|
|
32811
|
-
return concat([": ",
|
|
32971
|
+
return concat([": ", path3.call(print2, "typeAnnotation")]);
|
|
32812
32972
|
case "TSIndexSignature":
|
|
32813
32973
|
return concat([
|
|
32814
32974
|
n2.readonly ? "readonly " : "",
|
|
32815
32975
|
"[",
|
|
32816
|
-
|
|
32976
|
+
path3.map(print2, "parameters"),
|
|
32817
32977
|
"]",
|
|
32818
|
-
|
|
32978
|
+
path3.call(print2, "typeAnnotation")
|
|
32819
32979
|
]);
|
|
32820
32980
|
case "TSPropertySignature":
|
|
32821
|
-
parts.push(printVariance(
|
|
32981
|
+
parts.push(printVariance(path3, print2), n2.readonly ? "readonly " : "");
|
|
32822
32982
|
if (n2.computed) {
|
|
32823
|
-
parts.push("[",
|
|
32983
|
+
parts.push("[", path3.call(print2, "key"), "]");
|
|
32824
32984
|
} else {
|
|
32825
|
-
parts.push(
|
|
32985
|
+
parts.push(path3.call(print2, "key"));
|
|
32826
32986
|
}
|
|
32827
|
-
parts.push(n2.optional ? "?" : "",
|
|
32987
|
+
parts.push(n2.optional ? "?" : "", path3.call(print2, "typeAnnotation"));
|
|
32828
32988
|
return concat(parts);
|
|
32829
32989
|
case "TSMethodSignature":
|
|
32830
32990
|
if (n2.computed) {
|
|
32831
|
-
parts.push("[",
|
|
32991
|
+
parts.push("[", path3.call(print2, "key"), "]");
|
|
32832
32992
|
} else {
|
|
32833
|
-
parts.push(
|
|
32993
|
+
parts.push(path3.call(print2, "key"));
|
|
32834
32994
|
}
|
|
32835
32995
|
if (n2.optional) {
|
|
32836
32996
|
parts.push("?");
|
|
32837
32997
|
}
|
|
32838
32998
|
parts.push(
|
|
32839
|
-
|
|
32999
|
+
path3.call(print2, "typeParameters"),
|
|
32840
33000
|
"(",
|
|
32841
|
-
printFunctionParams(
|
|
33001
|
+
printFunctionParams(path3, options, print2),
|
|
32842
33002
|
")",
|
|
32843
|
-
|
|
33003
|
+
path3.call(print2, "typeAnnotation")
|
|
32844
33004
|
);
|
|
32845
33005
|
return concat(parts);
|
|
32846
33006
|
case "TSTypePredicate":
|
|
32847
33007
|
if (n2.asserts) {
|
|
32848
33008
|
parts.push("asserts ");
|
|
32849
33009
|
}
|
|
32850
|
-
parts.push(
|
|
33010
|
+
parts.push(path3.call(print2, "parameterName"));
|
|
32851
33011
|
if (n2.typeAnnotation) {
|
|
32852
33012
|
parts.push(
|
|
32853
33013
|
" is ",
|
|
32854
|
-
|
|
33014
|
+
path3.call(print2, "typeAnnotation", "typeAnnotation")
|
|
32855
33015
|
);
|
|
32856
33016
|
}
|
|
32857
33017
|
return concat(parts);
|
|
32858
33018
|
case "TSCallSignatureDeclaration":
|
|
32859
33019
|
return concat([
|
|
32860
|
-
|
|
33020
|
+
path3.call(print2, "typeParameters"),
|
|
32861
33021
|
"(",
|
|
32862
|
-
printFunctionParams(
|
|
33022
|
+
printFunctionParams(path3, options, print2),
|
|
32863
33023
|
")",
|
|
32864
|
-
|
|
33024
|
+
path3.call(print2, "typeAnnotation")
|
|
32865
33025
|
]);
|
|
32866
33026
|
case "TSConstructSignatureDeclaration":
|
|
32867
33027
|
if (n2.typeParameters) {
|
|
32868
|
-
parts.push("new",
|
|
33028
|
+
parts.push("new", path3.call(print2, "typeParameters"));
|
|
32869
33029
|
} else {
|
|
32870
33030
|
parts.push("new ");
|
|
32871
33031
|
}
|
|
32872
33032
|
parts.push(
|
|
32873
33033
|
"(",
|
|
32874
|
-
printFunctionParams(
|
|
33034
|
+
printFunctionParams(path3, options, print2),
|
|
32875
33035
|
")",
|
|
32876
|
-
|
|
33036
|
+
path3.call(print2, "typeAnnotation")
|
|
32877
33037
|
);
|
|
32878
33038
|
return concat(parts);
|
|
32879
33039
|
case "TSTypeAliasDeclaration":
|
|
32880
33040
|
return concat([
|
|
32881
33041
|
n2.declare ? "declare " : "",
|
|
32882
33042
|
"type ",
|
|
32883
|
-
|
|
32884
|
-
|
|
33043
|
+
path3.call(print2, "id"),
|
|
33044
|
+
path3.call(print2, "typeParameters"),
|
|
32885
33045
|
" = ",
|
|
32886
|
-
|
|
33046
|
+
path3.call(print2, "typeAnnotation"),
|
|
32887
33047
|
";"
|
|
32888
33048
|
]);
|
|
32889
33049
|
case "TSTypeParameter": {
|
|
32890
|
-
parts.push(
|
|
32891
|
-
const parent =
|
|
33050
|
+
parts.push(path3.call(print2, "name"));
|
|
33051
|
+
const parent = path3.getParentNode(0);
|
|
32892
33052
|
const isInMappedType = namedTypes.TSMappedType.check(parent);
|
|
32893
33053
|
if (n2.constraint) {
|
|
32894
33054
|
parts.push(
|
|
32895
33055
|
isInMappedType ? " in " : " extends ",
|
|
32896
|
-
|
|
33056
|
+
path3.call(print2, "constraint")
|
|
32897
33057
|
);
|
|
32898
33058
|
}
|
|
32899
33059
|
if (n2["default"]) {
|
|
32900
|
-
parts.push(" = ",
|
|
33060
|
+
parts.push(" = ", path3.call(print2, "default"));
|
|
32901
33061
|
}
|
|
32902
33062
|
return concat(parts);
|
|
32903
33063
|
}
|
|
32904
33064
|
case "TSTypeAssertion": {
|
|
32905
33065
|
parts.push(
|
|
32906
33066
|
"<",
|
|
32907
|
-
|
|
33067
|
+
path3.call(print2, "typeAnnotation"),
|
|
32908
33068
|
"> ",
|
|
32909
|
-
|
|
33069
|
+
path3.call(print2, "expression")
|
|
32910
33070
|
);
|
|
32911
33071
|
return concat(parts);
|
|
32912
33072
|
}
|
|
@@ -32914,7 +33074,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32914
33074
|
case "TSTypeParameterInstantiation":
|
|
32915
33075
|
return concat([
|
|
32916
33076
|
"<",
|
|
32917
|
-
fromString(", ").join(
|
|
33077
|
+
fromString(", ").join(path3.map(print2, "params")),
|
|
32918
33078
|
">"
|
|
32919
33079
|
]);
|
|
32920
33080
|
case "TSEnumDeclaration": {
|
|
@@ -32922,9 +33082,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32922
33082
|
n2.declare ? "declare " : "",
|
|
32923
33083
|
n2.const ? "const " : "",
|
|
32924
33084
|
"enum ",
|
|
32925
|
-
|
|
33085
|
+
path3.call(print2, "id")
|
|
32926
33086
|
);
|
|
32927
|
-
const memberLines = fromString(",\n").join(
|
|
33087
|
+
const memberLines = fromString(",\n").join(path3.map(print2, "members"));
|
|
32928
33088
|
if (memberLines.isEmpty()) {
|
|
32929
33089
|
parts.push(" {}");
|
|
32930
33090
|
} else {
|
|
@@ -32934,12 +33094,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32934
33094
|
}
|
|
32935
33095
|
case "TSExpressionWithTypeArguments":
|
|
32936
33096
|
return concat([
|
|
32937
|
-
|
|
32938
|
-
|
|
33097
|
+
path3.call(print2, "expression"),
|
|
33098
|
+
path3.call(print2, "typeParameters")
|
|
32939
33099
|
]);
|
|
32940
33100
|
case "TSInterfaceBody": {
|
|
32941
33101
|
const lines = fromString("\n").join(
|
|
32942
|
-
|
|
33102
|
+
path3.map(print2, "body").map((element) => {
|
|
32943
33103
|
if (lastNonSpaceCharacter(element) !== ";") {
|
|
32944
33104
|
return element.concat(";");
|
|
32945
33105
|
}
|
|
@@ -32952,12 +33112,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32952
33112
|
return concat(["{\n", lines.indent(options.tabWidth), "\n}"]);
|
|
32953
33113
|
}
|
|
32954
33114
|
case "TSImportType":
|
|
32955
|
-
parts.push("import(",
|
|
33115
|
+
parts.push("import(", path3.call(print2, "argument"), ")");
|
|
32956
33116
|
if (n2.qualifier) {
|
|
32957
|
-
parts.push(".",
|
|
33117
|
+
parts.push(".", path3.call(print2, "qualifier"));
|
|
32958
33118
|
}
|
|
32959
33119
|
if (n2.typeParameters) {
|
|
32960
|
-
parts.push(
|
|
33120
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
32961
33121
|
}
|
|
32962
33122
|
return concat(parts);
|
|
32963
33123
|
case "TSImportEqualsDeclaration":
|
|
@@ -32966,15 +33126,15 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32966
33126
|
}
|
|
32967
33127
|
parts.push(
|
|
32968
33128
|
"import ",
|
|
32969
|
-
|
|
33129
|
+
path3.call(print2, "id"),
|
|
32970
33130
|
" = ",
|
|
32971
|
-
|
|
33131
|
+
path3.call(print2, "moduleReference")
|
|
32972
33132
|
);
|
|
32973
33133
|
return maybeAddSemicolon(concat(parts));
|
|
32974
33134
|
case "TSExternalModuleReference":
|
|
32975
|
-
return concat(["require(",
|
|
33135
|
+
return concat(["require(", path3.call(print2, "expression"), ")"]);
|
|
32976
33136
|
case "TSModuleDeclaration": {
|
|
32977
|
-
const parent =
|
|
33137
|
+
const parent = path3.getParentNode();
|
|
32978
33138
|
if (parent.type === "TSModuleDeclaration") {
|
|
32979
33139
|
parts.push(".");
|
|
32980
33140
|
} else {
|
|
@@ -32997,15 +33157,15 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32997
33157
|
}
|
|
32998
33158
|
}
|
|
32999
33159
|
}
|
|
33000
|
-
parts.push(
|
|
33160
|
+
parts.push(path3.call(print2, "id"));
|
|
33001
33161
|
if (n2.body) {
|
|
33002
33162
|
parts.push(" ");
|
|
33003
|
-
parts.push(
|
|
33163
|
+
parts.push(path3.call(print2, "body"));
|
|
33004
33164
|
}
|
|
33005
33165
|
return concat(parts);
|
|
33006
33166
|
}
|
|
33007
33167
|
case "TSModuleBlock": {
|
|
33008
|
-
const naked =
|
|
33168
|
+
const naked = path3.call(
|
|
33009
33169
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
33010
33170
|
"body"
|
|
33011
33171
|
);
|
|
@@ -33018,13 +33178,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
33018
33178
|
}
|
|
33019
33179
|
case "TSInstantiationExpression": {
|
|
33020
33180
|
parts.push(
|
|
33021
|
-
|
|
33022
|
-
|
|
33181
|
+
path3.call(print2, "expression"),
|
|
33182
|
+
path3.call(print2, "typeParameters")
|
|
33023
33183
|
);
|
|
33024
33184
|
return concat(parts);
|
|
33025
33185
|
}
|
|
33026
33186
|
case "V8IntrinsicIdentifier":
|
|
33027
|
-
return concat(["%",
|
|
33187
|
+
return concat(["%", path3.call(print2, "name")]);
|
|
33028
33188
|
case "TopicReference":
|
|
33029
33189
|
return fromString("#");
|
|
33030
33190
|
case "ClassHeritage":
|
|
@@ -33060,17 +33220,17 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
33060
33220
|
throw new Error("unknown type: " + JSON.stringify(n2.type));
|
|
33061
33221
|
}
|
|
33062
33222
|
}
|
|
33063
|
-
function printDecorators(
|
|
33223
|
+
function printDecorators(path3, printPath) {
|
|
33064
33224
|
const parts = [];
|
|
33065
|
-
const node =
|
|
33225
|
+
const node = path3.getValue();
|
|
33066
33226
|
if (node.decorators && node.decorators.length > 0 && // If the parent node is an export declaration, it will be
|
|
33067
33227
|
// responsible for printing node.decorators.
|
|
33068
|
-
!getParentExportDeclaration(
|
|
33069
|
-
|
|
33228
|
+
!getParentExportDeclaration(path3)) {
|
|
33229
|
+
path3.each(function(decoratorPath) {
|
|
33070
33230
|
parts.push(printPath(decoratorPath), "\n");
|
|
33071
33231
|
}, "decorators");
|
|
33072
33232
|
} else if (isExportDeclaration(node) && node.declaration && node.declaration.decorators) {
|
|
33073
|
-
|
|
33233
|
+
path3.each(
|
|
33074
33234
|
function(decoratorPath) {
|
|
33075
33235
|
parts.push(printPath(decoratorPath), "\n");
|
|
33076
33236
|
},
|
|
@@ -33080,9 +33240,9 @@ function printDecorators(path2, printPath) {
|
|
|
33080
33240
|
}
|
|
33081
33241
|
return concat(parts);
|
|
33082
33242
|
}
|
|
33083
|
-
function printStatementSequence(
|
|
33243
|
+
function printStatementSequence(path3, options, print2) {
|
|
33084
33244
|
const filtered = [];
|
|
33085
|
-
|
|
33245
|
+
path3.each(function(stmtPath) {
|
|
33086
33246
|
const stmt = stmtPath.getValue();
|
|
33087
33247
|
if (!stmt) {
|
|
33088
33248
|
return;
|
|
@@ -33188,8 +33348,8 @@ function printClassMemberModifiers(node) {
|
|
|
33188
33348
|
}
|
|
33189
33349
|
return parts;
|
|
33190
33350
|
}
|
|
33191
|
-
function printMethod(
|
|
33192
|
-
const node =
|
|
33351
|
+
function printMethod(path3, options, print2) {
|
|
33352
|
+
const node = path3.getNode();
|
|
33193
33353
|
const kind = node.kind;
|
|
33194
33354
|
const parts = [];
|
|
33195
33355
|
let nodeValue = node.value;
|
|
@@ -33206,7 +33366,7 @@ function printMethod(path2, options, print2) {
|
|
|
33206
33366
|
if (kind === "get" || kind === "set") {
|
|
33207
33367
|
parts.push(kind, " ");
|
|
33208
33368
|
}
|
|
33209
|
-
let key =
|
|
33369
|
+
let key = path3.call(print2, "key");
|
|
33210
33370
|
if (node.computed) {
|
|
33211
33371
|
key = concat(["[", key, "]"]);
|
|
33212
33372
|
}
|
|
@@ -33216,38 +33376,38 @@ function printMethod(path2, options, print2) {
|
|
|
33216
33376
|
}
|
|
33217
33377
|
if (node === nodeValue) {
|
|
33218
33378
|
parts.push(
|
|
33219
|
-
|
|
33379
|
+
path3.call(print2, "typeParameters"),
|
|
33220
33380
|
"(",
|
|
33221
|
-
printFunctionParams(
|
|
33381
|
+
printFunctionParams(path3, options, print2),
|
|
33222
33382
|
")",
|
|
33223
|
-
|
|
33383
|
+
path3.call(print2, "returnType")
|
|
33224
33384
|
);
|
|
33225
33385
|
if (node.body) {
|
|
33226
|
-
parts.push(" ",
|
|
33386
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
33227
33387
|
} else {
|
|
33228
33388
|
parts.push(";");
|
|
33229
33389
|
}
|
|
33230
33390
|
} else {
|
|
33231
33391
|
parts.push(
|
|
33232
|
-
|
|
33392
|
+
path3.call(print2, "value", "typeParameters"),
|
|
33233
33393
|
"(",
|
|
33234
|
-
|
|
33394
|
+
path3.call(
|
|
33235
33395
|
(valuePath) => printFunctionParams(valuePath, options, print2),
|
|
33236
33396
|
"value"
|
|
33237
33397
|
),
|
|
33238
33398
|
")",
|
|
33239
|
-
|
|
33399
|
+
path3.call(print2, "value", "returnType")
|
|
33240
33400
|
);
|
|
33241
33401
|
if (nodeValue.body) {
|
|
33242
|
-
parts.push(" ",
|
|
33402
|
+
parts.push(" ", path3.call(print2, "value", "body"));
|
|
33243
33403
|
} else {
|
|
33244
33404
|
parts.push(";");
|
|
33245
33405
|
}
|
|
33246
33406
|
}
|
|
33247
33407
|
return concat(parts);
|
|
33248
33408
|
}
|
|
33249
|
-
function printArgumentsList(
|
|
33250
|
-
const printed =
|
|
33409
|
+
function printArgumentsList(path3, options, print2) {
|
|
33410
|
+
const printed = path3.map(print2, "arguments");
|
|
33251
33411
|
const trailingComma = isTrailingCommaEnabled(options, "parameters");
|
|
33252
33412
|
let joined = fromString(", ").join(printed);
|
|
33253
33413
|
if (joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -33260,19 +33420,19 @@ function printArgumentsList(path2, options, print2) {
|
|
|
33260
33420
|
}
|
|
33261
33421
|
return concat(["(", joined, ")"]);
|
|
33262
33422
|
}
|
|
33263
|
-
function printFunctionParams(
|
|
33264
|
-
const fun =
|
|
33423
|
+
function printFunctionParams(path3, options, print2) {
|
|
33424
|
+
const fun = path3.getValue();
|
|
33265
33425
|
let params;
|
|
33266
33426
|
let printed = [];
|
|
33267
33427
|
if (fun.params) {
|
|
33268
33428
|
params = fun.params;
|
|
33269
|
-
printed =
|
|
33429
|
+
printed = path3.map(print2, "params");
|
|
33270
33430
|
} else if (fun.parameters) {
|
|
33271
33431
|
params = fun.parameters;
|
|
33272
|
-
printed =
|
|
33432
|
+
printed = path3.map(print2, "parameters");
|
|
33273
33433
|
}
|
|
33274
33434
|
if (fun.defaults) {
|
|
33275
|
-
|
|
33435
|
+
path3.each(function(defExprPath) {
|
|
33276
33436
|
const i = defExprPath.getName();
|
|
33277
33437
|
const p = printed[i];
|
|
33278
33438
|
if (p && defExprPath.getValue()) {
|
|
@@ -33281,7 +33441,7 @@ function printFunctionParams(path2, options, print2) {
|
|
|
33281
33441
|
}, "defaults");
|
|
33282
33442
|
}
|
|
33283
33443
|
if (fun.rest) {
|
|
33284
|
-
printed.push(concat(["...",
|
|
33444
|
+
printed.push(concat(["...", path3.call(print2, "rest")]));
|
|
33285
33445
|
}
|
|
33286
33446
|
let joined = fromString(", ").join(printed);
|
|
33287
33447
|
if (joined.length > 1 || joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -33295,11 +33455,11 @@ function printFunctionParams(path2, options, print2) {
|
|
|
33295
33455
|
}
|
|
33296
33456
|
return joined;
|
|
33297
33457
|
}
|
|
33298
|
-
function maybePrintImportAssertions(
|
|
33299
|
-
const n2 =
|
|
33458
|
+
function maybePrintImportAssertions(path3, options, print2) {
|
|
33459
|
+
const n2 = path3.getValue();
|
|
33300
33460
|
if (n2.assertions && n2.assertions.length > 0) {
|
|
33301
33461
|
const parts = [" assert {"];
|
|
33302
|
-
const printed =
|
|
33462
|
+
const printed = path3.map(print2, "assertions");
|
|
33303
33463
|
const flat = fromString(", ").join(printed);
|
|
33304
33464
|
if (flat.length > 1 || flat.getLineLength(1) > options.wrapColumn) {
|
|
33305
33465
|
parts.push(
|
|
@@ -33314,8 +33474,8 @@ function maybePrintImportAssertions(path2, options, print2) {
|
|
|
33314
33474
|
}
|
|
33315
33475
|
return fromString("");
|
|
33316
33476
|
}
|
|
33317
|
-
function printExportDeclaration(
|
|
33318
|
-
const decl =
|
|
33477
|
+
function printExportDeclaration(path3, options, print2) {
|
|
33478
|
+
const decl = path3.getValue();
|
|
33319
33479
|
const parts = ["export "];
|
|
33320
33480
|
if (decl.exportKind && decl.exportKind === "type") {
|
|
33321
33481
|
if (!decl.declaration) {
|
|
@@ -33328,7 +33488,7 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33328
33488
|
parts.push("default ");
|
|
33329
33489
|
}
|
|
33330
33490
|
if (decl.declaration) {
|
|
33331
|
-
parts.push(
|
|
33491
|
+
parts.push(path3.call(print2, "declaration"));
|
|
33332
33492
|
} else if (decl.specifiers) {
|
|
33333
33493
|
if (decl.specifiers.length === 1 && decl.specifiers[0].type === "ExportBatchSpecifier") {
|
|
33334
33494
|
parts.push("*");
|
|
@@ -33337,7 +33497,7 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33337
33497
|
} else if (decl.specifiers[0].type === "ExportDefaultSpecifier") {
|
|
33338
33498
|
const unbracedSpecifiers = [];
|
|
33339
33499
|
const bracedSpecifiers = [];
|
|
33340
|
-
|
|
33500
|
+
path3.each(function(specifierPath) {
|
|
33341
33501
|
const spec = specifierPath.getValue();
|
|
33342
33502
|
if (spec.type === "ExportDefaultSpecifier") {
|
|
33343
33503
|
unbracedSpecifiers.push(print2(specifierPath));
|
|
@@ -33373,15 +33533,15 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33373
33533
|
} else {
|
|
33374
33534
|
parts.push(
|
|
33375
33535
|
shouldPrintSpaces ? "{ " : "{",
|
|
33376
|
-
fromString(", ").join(
|
|
33536
|
+
fromString(", ").join(path3.map(print2, "specifiers")),
|
|
33377
33537
|
shouldPrintSpaces ? " }" : "}"
|
|
33378
33538
|
);
|
|
33379
33539
|
}
|
|
33380
33540
|
if (decl.source) {
|
|
33381
33541
|
parts.push(
|
|
33382
33542
|
" from ",
|
|
33383
|
-
|
|
33384
|
-
maybePrintImportAssertions(
|
|
33543
|
+
path3.call(print2, "source"),
|
|
33544
|
+
maybePrintImportAssertions(path3, options, print2)
|
|
33385
33545
|
);
|
|
33386
33546
|
}
|
|
33387
33547
|
}
|
|
@@ -33391,8 +33551,8 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33391
33551
|
}
|
|
33392
33552
|
return lines;
|
|
33393
33553
|
}
|
|
33394
|
-
function printFlowDeclaration(
|
|
33395
|
-
const parentExportDecl = getParentExportDeclaration(
|
|
33554
|
+
function printFlowDeclaration(path3, parts) {
|
|
33555
|
+
const parentExportDecl = getParentExportDeclaration(path3);
|
|
33396
33556
|
if (parentExportDecl)
|
|
33397
33557
|
;
|
|
33398
33558
|
else {
|
|
@@ -33400,8 +33560,8 @@ function printFlowDeclaration(path2, parts) {
|
|
|
33400
33560
|
}
|
|
33401
33561
|
return concat(parts);
|
|
33402
33562
|
}
|
|
33403
|
-
function printVariance(
|
|
33404
|
-
return
|
|
33563
|
+
function printVariance(path3, print2) {
|
|
33564
|
+
return path3.call(function(variancePath) {
|
|
33405
33565
|
const value = variancePath.getValue();
|
|
33406
33566
|
if (value) {
|
|
33407
33567
|
if (value === "plus") {
|
|
@@ -34573,6 +34733,7 @@ function resolveOptions(options) {
|
|
|
34573
34733
|
|
|
34574
34734
|
// src/core/compress.ts
|
|
34575
34735
|
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
34736
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
34576
34737
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
34577
34738
|
var import_archiver = __toESM(require("archiver"), 1);
|
|
34578
34739
|
|
|
@@ -35082,23 +35243,35 @@ var Log = class {
|
|
|
35082
35243
|
// src/core/compress.ts
|
|
35083
35244
|
async function createCompress(options) {
|
|
35084
35245
|
const { outDir, ignoreBase } = options;
|
|
35085
|
-
const zipFilePath = `${outDir}.zip
|
|
35246
|
+
const zipFilePath = import_node_path2.default.resolve(import_node_process3.default.cwd(), `${import_node_path2.default.basename(outDir)}.zip`);
|
|
35086
35247
|
Log.log("Compressing the directory", outDir);
|
|
35087
|
-
|
|
35088
|
-
|
|
35089
|
-
|
|
35090
|
-
|
|
35091
|
-
|
|
35092
|
-
|
|
35093
|
-
|
|
35094
|
-
|
|
35095
|
-
|
|
35096
|
-
|
|
35097
|
-
|
|
35098
|
-
|
|
35099
|
-
|
|
35100
|
-
|
|
35101
|
-
|
|
35248
|
+
return new Promise((resolve2, reject) => {
|
|
35249
|
+
try {
|
|
35250
|
+
const output = import_node_fs3.default.createWriteStream(zipFilePath);
|
|
35251
|
+
const archive = (0, import_archiver.default)("zip");
|
|
35252
|
+
output.on("close", () => {
|
|
35253
|
+
Log.success("Successfully compressed to", `${zipFilePath} (${archive.pointer()} bytes)`);
|
|
35254
|
+
resolve2(null);
|
|
35255
|
+
});
|
|
35256
|
+
archive.on("warning", (err) => {
|
|
35257
|
+
if (err.code === "ENOENT")
|
|
35258
|
+
Log.log("File not found during compression:", err.message);
|
|
35259
|
+
else
|
|
35260
|
+
Log.log("Compression warning:", err.message);
|
|
35261
|
+
});
|
|
35262
|
+
archive.on("error", (err) => {
|
|
35263
|
+
Log.error("Compression error:", err);
|
|
35264
|
+
reject(err);
|
|
35265
|
+
});
|
|
35266
|
+
archive.pipe(output);
|
|
35267
|
+
const absoluteOutDir = import_node_path2.default.resolve(outDir);
|
|
35268
|
+
archive.directory(absoluteOutDir, ignoreBase ? false : import_node_path2.default.basename(outDir));
|
|
35269
|
+
archive.finalize();
|
|
35270
|
+
} catch (error) {
|
|
35271
|
+
Log.error("Error compressing the directory", error);
|
|
35272
|
+
throw error;
|
|
35273
|
+
}
|
|
35274
|
+
});
|
|
35102
35275
|
}
|
|
35103
35276
|
|
|
35104
35277
|
// src/index.ts
|
|
@@ -35150,6 +35323,7 @@ var unpluginFactory = (options = {}) => {
|
|
|
35150
35323
|
import_node_process4.default.on("beforeExit", async () => {
|
|
35151
35324
|
const { compress } = resolved;
|
|
35152
35325
|
await createCompress(compress);
|
|
35326
|
+
import_node_process4.default.exit(0);
|
|
35153
35327
|
});
|
|
35154
35328
|
}
|
|
35155
35329
|
}];
|