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/nuxt.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) {
|
|
@@ -26432,18 +26592,18 @@ function pathPlugin(fork2) {
|
|
|
26432
26592
|
this.__childCache = null;
|
|
26433
26593
|
};
|
|
26434
26594
|
var Pp2 = Path2.prototype;
|
|
26435
|
-
function getChildCache(
|
|
26436
|
-
return
|
|
26595
|
+
function getChildCache(path3) {
|
|
26596
|
+
return path3.__childCache || (path3.__childCache = /* @__PURE__ */ Object.create(null));
|
|
26437
26597
|
}
|
|
26438
|
-
function getChildPath(
|
|
26439
|
-
var cache = getChildCache(
|
|
26440
|
-
var actualChildValue =
|
|
26598
|
+
function getChildPath(path3, name) {
|
|
26599
|
+
var cache = getChildCache(path3);
|
|
26600
|
+
var actualChildValue = path3.getValueProperty(name);
|
|
26441
26601
|
var childPath = cache[name];
|
|
26442
26602
|
if (!hasOwn$5.call(cache, name) || // Ensure consistency between cache and reality.
|
|
26443
26603
|
childPath.value !== actualChildValue) {
|
|
26444
|
-
childPath = cache[name] = new
|
|
26604
|
+
childPath = cache[name] = new path3.constructor(
|
|
26445
26605
|
actualChildValue,
|
|
26446
|
-
|
|
26606
|
+
path3,
|
|
26447
26607
|
name
|
|
26448
26608
|
);
|
|
26449
26609
|
}
|
|
@@ -26453,12 +26613,12 @@ function pathPlugin(fork2) {
|
|
|
26453
26613
|
return this.value[name];
|
|
26454
26614
|
};
|
|
26455
26615
|
Pp2.get = function get(...names) {
|
|
26456
|
-
var
|
|
26616
|
+
var path3 = this;
|
|
26457
26617
|
var count = names.length;
|
|
26458
26618
|
for (var i = 0; i < count; ++i) {
|
|
26459
|
-
|
|
26619
|
+
path3 = getChildPath(path3, names[i]);
|
|
26460
26620
|
}
|
|
26461
|
-
return
|
|
26621
|
+
return path3;
|
|
26462
26622
|
};
|
|
26463
26623
|
Pp2.each = function each2(callback, context) {
|
|
26464
26624
|
var childPaths = [];
|
|
@@ -26494,12 +26654,12 @@ function pathPlugin(fork2) {
|
|
|
26494
26654
|
};
|
|
26495
26655
|
function emptyMoves() {
|
|
26496
26656
|
}
|
|
26497
|
-
function getMoves(
|
|
26498
|
-
isArray2.assert(
|
|
26657
|
+
function getMoves(path3, offset, start, end) {
|
|
26658
|
+
isArray2.assert(path3.value);
|
|
26499
26659
|
if (offset === 0) {
|
|
26500
26660
|
return emptyMoves;
|
|
26501
26661
|
}
|
|
26502
|
-
var length =
|
|
26662
|
+
var length = path3.value.length;
|
|
26503
26663
|
if (length < 1) {
|
|
26504
26664
|
return emptyMoves;
|
|
26505
26665
|
}
|
|
@@ -26517,10 +26677,10 @@ function pathPlugin(fork2) {
|
|
|
26517
26677
|
isNumber2.assert(start);
|
|
26518
26678
|
isNumber2.assert(end);
|
|
26519
26679
|
var moves = /* @__PURE__ */ Object.create(null);
|
|
26520
|
-
var cache = getChildCache(
|
|
26680
|
+
var cache = getChildCache(path3);
|
|
26521
26681
|
for (var i = start; i < end; ++i) {
|
|
26522
|
-
if (hasOwn$5.call(
|
|
26523
|
-
var childPath =
|
|
26682
|
+
if (hasOwn$5.call(path3.value, i)) {
|
|
26683
|
+
var childPath = path3.get(i);
|
|
26524
26684
|
if (childPath.name !== i) {
|
|
26525
26685
|
throw new Error("");
|
|
26526
26686
|
}
|
|
@@ -26538,7 +26698,7 @@ function pathPlugin(fork2) {
|
|
|
26538
26698
|
throw new Error("");
|
|
26539
26699
|
}
|
|
26540
26700
|
cache[newIndex2] = childPath2;
|
|
26541
|
-
|
|
26701
|
+
path3.value[newIndex2] = childPath2.value;
|
|
26542
26702
|
}
|
|
26543
26703
|
};
|
|
26544
26704
|
}
|
|
@@ -26597,34 +26757,34 @@ function pathPlugin(fork2) {
|
|
|
26597
26757
|
}
|
|
26598
26758
|
return pp.insertAt.apply(pp, insertAtArgs);
|
|
26599
26759
|
};
|
|
26600
|
-
function repairRelationshipWithParent(
|
|
26601
|
-
if (!(
|
|
26760
|
+
function repairRelationshipWithParent(path3) {
|
|
26761
|
+
if (!(path3 instanceof Path2)) {
|
|
26602
26762
|
throw new Error("");
|
|
26603
26763
|
}
|
|
26604
|
-
var pp =
|
|
26764
|
+
var pp = path3.parentPath;
|
|
26605
26765
|
if (!pp) {
|
|
26606
|
-
return
|
|
26766
|
+
return path3;
|
|
26607
26767
|
}
|
|
26608
26768
|
var parentValue = pp.value;
|
|
26609
26769
|
var parentCache = getChildCache(pp);
|
|
26610
|
-
if (parentValue[
|
|
26611
|
-
parentCache[
|
|
26770
|
+
if (parentValue[path3.name] === path3.value) {
|
|
26771
|
+
parentCache[path3.name] = path3;
|
|
26612
26772
|
} else if (isArray2.check(parentValue)) {
|
|
26613
|
-
var i = parentValue.indexOf(
|
|
26773
|
+
var i = parentValue.indexOf(path3.value);
|
|
26614
26774
|
if (i >= 0) {
|
|
26615
|
-
parentCache[
|
|
26775
|
+
parentCache[path3.name = i] = path3;
|
|
26616
26776
|
}
|
|
26617
26777
|
} else {
|
|
26618
|
-
parentValue[
|
|
26619
|
-
parentCache[
|
|
26778
|
+
parentValue[path3.name] = path3.value;
|
|
26779
|
+
parentCache[path3.name] = path3;
|
|
26620
26780
|
}
|
|
26621
|
-
if (parentValue[
|
|
26781
|
+
if (parentValue[path3.name] !== path3.value) {
|
|
26622
26782
|
throw new Error("");
|
|
26623
26783
|
}
|
|
26624
|
-
if (
|
|
26784
|
+
if (path3.parentPath.get(path3.name) !== path3) {
|
|
26625
26785
|
throw new Error("");
|
|
26626
26786
|
}
|
|
26627
|
-
return
|
|
26787
|
+
return path3;
|
|
26628
26788
|
}
|
|
26629
26789
|
Pp2.replace = function replace(replacement) {
|
|
26630
26790
|
var results = [];
|
|
@@ -26693,12 +26853,12 @@ function scopePlugin(fork2) {
|
|
|
26693
26853
|
var Expression2 = namedTypes2.Expression;
|
|
26694
26854
|
var isArray2 = types.builtInTypes.array;
|
|
26695
26855
|
var b = types.builders;
|
|
26696
|
-
const Scope = function Scope2(
|
|
26856
|
+
const Scope = function Scope2(path3, parentScope) {
|
|
26697
26857
|
if (!(this instanceof Scope2)) {
|
|
26698
26858
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
26699
26859
|
}
|
|
26700
|
-
if (!TypeParameterScopeType.check(
|
|
26701
|
-
ScopeType.assert(
|
|
26860
|
+
if (!TypeParameterScopeType.check(path3.value)) {
|
|
26861
|
+
ScopeType.assert(path3.value);
|
|
26702
26862
|
}
|
|
26703
26863
|
var depth;
|
|
26704
26864
|
if (parentScope) {
|
|
@@ -26711,8 +26871,8 @@ function scopePlugin(fork2) {
|
|
|
26711
26871
|
depth = 0;
|
|
26712
26872
|
}
|
|
26713
26873
|
Object.defineProperties(this, {
|
|
26714
|
-
path: { value:
|
|
26715
|
-
node: { value:
|
|
26874
|
+
path: { value: path3 },
|
|
26875
|
+
node: { value: path3.value },
|
|
26716
26876
|
isGlobal: { value: !parentScope, enumerable: true },
|
|
26717
26877
|
depth: { value: depth },
|
|
26718
26878
|
parent: { value: parentScope },
|
|
@@ -26807,10 +26967,10 @@ function scopePlugin(fork2) {
|
|
|
26807
26967
|
this.scan();
|
|
26808
26968
|
return this.types;
|
|
26809
26969
|
};
|
|
26810
|
-
function scanScope(
|
|
26811
|
-
var node =
|
|
26970
|
+
function scanScope(path3, bindings, scopeTypes) {
|
|
26971
|
+
var node = path3.value;
|
|
26812
26972
|
if (TypeParameterScopeType.check(node)) {
|
|
26813
|
-
const params =
|
|
26973
|
+
const params = path3.get("typeParameters", "params");
|
|
26814
26974
|
if (isArray2.check(params.value)) {
|
|
26815
26975
|
params.each((childPath) => {
|
|
26816
26976
|
addTypeParameter(childPath, scopeTypes);
|
|
@@ -26819,46 +26979,46 @@ function scopePlugin(fork2) {
|
|
|
26819
26979
|
}
|
|
26820
26980
|
if (ScopeType.check(node)) {
|
|
26821
26981
|
if (namedTypes2.CatchClause.check(node)) {
|
|
26822
|
-
addPattern(
|
|
26982
|
+
addPattern(path3.get("param"), bindings);
|
|
26823
26983
|
} else {
|
|
26824
|
-
recursiveScanScope(
|
|
26984
|
+
recursiveScanScope(path3, bindings, scopeTypes);
|
|
26825
26985
|
}
|
|
26826
26986
|
}
|
|
26827
26987
|
}
|
|
26828
|
-
function recursiveScanScope(
|
|
26829
|
-
var node =
|
|
26830
|
-
if (
|
|
26831
|
-
addPattern(
|
|
26988
|
+
function recursiveScanScope(path3, bindings, scopeTypes) {
|
|
26989
|
+
var node = path3.value;
|
|
26990
|
+
if (path3.parent && namedTypes2.FunctionExpression.check(path3.parent.node) && path3.parent.node.id) {
|
|
26991
|
+
addPattern(path3.parent.get("id"), bindings);
|
|
26832
26992
|
}
|
|
26833
26993
|
if (!node)
|
|
26834
26994
|
;
|
|
26835
26995
|
else if (isArray2.check(node)) {
|
|
26836
|
-
|
|
26996
|
+
path3.each((childPath) => {
|
|
26837
26997
|
recursiveScanChild(childPath, bindings, scopeTypes);
|
|
26838
26998
|
});
|
|
26839
26999
|
} else if (namedTypes2.Function.check(node)) {
|
|
26840
|
-
|
|
27000
|
+
path3.get("params").each((paramPath) => {
|
|
26841
27001
|
addPattern(paramPath, bindings);
|
|
26842
27002
|
});
|
|
26843
|
-
recursiveScanChild(
|
|
26844
|
-
recursiveScanScope(
|
|
27003
|
+
recursiveScanChild(path3.get("body"), bindings, scopeTypes);
|
|
27004
|
+
recursiveScanScope(path3.get("typeParameters"), bindings, scopeTypes);
|
|
26845
27005
|
} 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)) {
|
|
26846
|
-
addTypePattern(
|
|
27006
|
+
addTypePattern(path3.get("id"), scopeTypes);
|
|
26847
27007
|
} else if (namedTypes2.VariableDeclarator.check(node)) {
|
|
26848
|
-
addPattern(
|
|
26849
|
-
recursiveScanChild(
|
|
27008
|
+
addPattern(path3.get("id"), bindings);
|
|
27009
|
+
recursiveScanChild(path3.get("init"), bindings, scopeTypes);
|
|
26850
27010
|
} else if (node.type === "ImportSpecifier" || node.type === "ImportNamespaceSpecifier" || node.type === "ImportDefaultSpecifier") {
|
|
26851
27011
|
addPattern(
|
|
26852
27012
|
// Esprima used to use the .name field to refer to the local
|
|
26853
27013
|
// binding identifier for ImportSpecifier nodes, but .id for
|
|
26854
27014
|
// ImportNamespaceSpecifier and ImportDefaultSpecifier nodes.
|
|
26855
27015
|
// ESTree/Acorn/ESpree use .local for all three node types.
|
|
26856
|
-
|
|
27016
|
+
path3.get(node.local ? "local" : node.name ? "name" : "id"),
|
|
26857
27017
|
bindings
|
|
26858
27018
|
);
|
|
26859
27019
|
} else if (Node.check(node) && !Expression2.check(node)) {
|
|
26860
27020
|
types.eachField(node, function(name, child) {
|
|
26861
|
-
var childPath =
|
|
27021
|
+
var childPath = path3.get(name);
|
|
26862
27022
|
if (!pathHasValue(childPath, child)) {
|
|
26863
27023
|
throw new Error("");
|
|
26864
27024
|
}
|
|
@@ -26866,38 +27026,38 @@ function scopePlugin(fork2) {
|
|
|
26866
27026
|
});
|
|
26867
27027
|
}
|
|
26868
27028
|
}
|
|
26869
|
-
function pathHasValue(
|
|
26870
|
-
if (
|
|
27029
|
+
function pathHasValue(path3, value) {
|
|
27030
|
+
if (path3.value === value) {
|
|
26871
27031
|
return true;
|
|
26872
27032
|
}
|
|
26873
|
-
if (Array.isArray(
|
|
27033
|
+
if (Array.isArray(path3.value) && path3.value.length === 0 && Array.isArray(value) && value.length === 0) {
|
|
26874
27034
|
return true;
|
|
26875
27035
|
}
|
|
26876
27036
|
return false;
|
|
26877
27037
|
}
|
|
26878
|
-
function recursiveScanChild(
|
|
26879
|
-
var node =
|
|
27038
|
+
function recursiveScanChild(path3, bindings, scopeTypes) {
|
|
27039
|
+
var node = path3.value;
|
|
26880
27040
|
if (!node || Expression2.check(node))
|
|
26881
27041
|
;
|
|
26882
27042
|
else if (namedTypes2.FunctionDeclaration.check(node) && node.id !== null) {
|
|
26883
|
-
addPattern(
|
|
27043
|
+
addPattern(path3.get("id"), bindings);
|
|
26884
27044
|
} else if (namedTypes2.ClassDeclaration && namedTypes2.ClassDeclaration.check(node) && node.id !== null) {
|
|
26885
|
-
addPattern(
|
|
26886
|
-
recursiveScanScope(
|
|
27045
|
+
addPattern(path3.get("id"), bindings);
|
|
27046
|
+
recursiveScanScope(path3.get("typeParameters"), bindings, scopeTypes);
|
|
26887
27047
|
} else if (namedTypes2.InterfaceDeclaration && namedTypes2.InterfaceDeclaration.check(node) || namedTypes2.TSInterfaceDeclaration && namedTypes2.TSInterfaceDeclaration.check(node)) {
|
|
26888
|
-
addTypePattern(
|
|
27048
|
+
addTypePattern(path3.get("id"), scopeTypes);
|
|
26889
27049
|
} else if (ScopeType.check(node)) {
|
|
26890
27050
|
if (namedTypes2.CatchClause.check(node) && // TODO Broaden this to accept any pattern.
|
|
26891
27051
|
namedTypes2.Identifier.check(node.param)) {
|
|
26892
27052
|
var catchParamName = node.param.name;
|
|
26893
27053
|
var hadBinding = hasOwn$4.call(bindings, catchParamName);
|
|
26894
|
-
recursiveScanScope(
|
|
27054
|
+
recursiveScanScope(path3.get("body"), bindings, scopeTypes);
|
|
26895
27055
|
if (!hadBinding) {
|
|
26896
27056
|
delete bindings[catchParamName];
|
|
26897
27057
|
}
|
|
26898
27058
|
}
|
|
26899
27059
|
} else {
|
|
26900
|
-
recursiveScanScope(
|
|
27060
|
+
recursiveScanScope(path3, bindings, scopeTypes);
|
|
26901
27061
|
}
|
|
26902
27062
|
}
|
|
26903
27063
|
function addPattern(patternPath, bindings) {
|
|
@@ -27229,53 +27389,53 @@ function nodePathPlugin(fork2) {
|
|
|
27229
27389
|
NPp.firstInStatement = function() {
|
|
27230
27390
|
return firstInStatement(this);
|
|
27231
27391
|
};
|
|
27232
|
-
function firstInStatement(
|
|
27233
|
-
for (var node, parent;
|
|
27234
|
-
node =
|
|
27235
|
-
parent =
|
|
27236
|
-
if (n2.BlockStatement.check(parent) &&
|
|
27392
|
+
function firstInStatement(path3) {
|
|
27393
|
+
for (var node, parent; path3.parent; path3 = path3.parent) {
|
|
27394
|
+
node = path3.node;
|
|
27395
|
+
parent = path3.parent.node;
|
|
27396
|
+
if (n2.BlockStatement.check(parent) && path3.parent.name === "body" && path3.name === 0) {
|
|
27237
27397
|
if (parent.body[0] !== node) {
|
|
27238
27398
|
throw new Error("Nodes must be equal");
|
|
27239
27399
|
}
|
|
27240
27400
|
return true;
|
|
27241
27401
|
}
|
|
27242
|
-
if (n2.ExpressionStatement.check(parent) &&
|
|
27402
|
+
if (n2.ExpressionStatement.check(parent) && path3.name === "expression") {
|
|
27243
27403
|
if (parent.expression !== node) {
|
|
27244
27404
|
throw new Error("Nodes must be equal");
|
|
27245
27405
|
}
|
|
27246
27406
|
return true;
|
|
27247
27407
|
}
|
|
27248
|
-
if (n2.SequenceExpression.check(parent) &&
|
|
27408
|
+
if (n2.SequenceExpression.check(parent) && path3.parent.name === "expressions" && path3.name === 0) {
|
|
27249
27409
|
if (parent.expressions[0] !== node) {
|
|
27250
27410
|
throw new Error("Nodes must be equal");
|
|
27251
27411
|
}
|
|
27252
27412
|
continue;
|
|
27253
27413
|
}
|
|
27254
|
-
if (n2.CallExpression.check(parent) &&
|
|
27414
|
+
if (n2.CallExpression.check(parent) && path3.name === "callee") {
|
|
27255
27415
|
if (parent.callee !== node) {
|
|
27256
27416
|
throw new Error("Nodes must be equal");
|
|
27257
27417
|
}
|
|
27258
27418
|
continue;
|
|
27259
27419
|
}
|
|
27260
|
-
if (n2.MemberExpression.check(parent) &&
|
|
27420
|
+
if (n2.MemberExpression.check(parent) && path3.name === "object") {
|
|
27261
27421
|
if (parent.object !== node) {
|
|
27262
27422
|
throw new Error("Nodes must be equal");
|
|
27263
27423
|
}
|
|
27264
27424
|
continue;
|
|
27265
27425
|
}
|
|
27266
|
-
if (n2.ConditionalExpression.check(parent) &&
|
|
27426
|
+
if (n2.ConditionalExpression.check(parent) && path3.name === "test") {
|
|
27267
27427
|
if (parent.test !== node) {
|
|
27268
27428
|
throw new Error("Nodes must be equal");
|
|
27269
27429
|
}
|
|
27270
27430
|
continue;
|
|
27271
27431
|
}
|
|
27272
|
-
if (isBinary2(parent) &&
|
|
27432
|
+
if (isBinary2(parent) && path3.name === "left") {
|
|
27273
27433
|
if (parent.left !== node) {
|
|
27274
27434
|
throw new Error("Nodes must be equal");
|
|
27275
27435
|
}
|
|
27276
27436
|
continue;
|
|
27277
27437
|
}
|
|
27278
|
-
if (n2.UnaryExpression.check(parent) && !parent.prefix &&
|
|
27438
|
+
if (n2.UnaryExpression.check(parent) && !parent.prefix && path3.name === "argument") {
|
|
27279
27439
|
if (parent.argument !== node) {
|
|
27280
27440
|
throw new Error("Nodes must be equal");
|
|
27281
27441
|
}
|
|
@@ -27439,36 +27599,36 @@ function pathVisitorPlugin(fork2) {
|
|
|
27439
27599
|
};
|
|
27440
27600
|
PVp.reset = function(_path) {
|
|
27441
27601
|
};
|
|
27442
|
-
PVp.visitWithoutReset = function(
|
|
27602
|
+
PVp.visitWithoutReset = function(path3) {
|
|
27443
27603
|
if (this instanceof this.Context) {
|
|
27444
|
-
return this.visitor.visitWithoutReset(
|
|
27604
|
+
return this.visitor.visitWithoutReset(path3);
|
|
27445
27605
|
}
|
|
27446
|
-
if (!(
|
|
27606
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27447
27607
|
throw new Error("");
|
|
27448
27608
|
}
|
|
27449
|
-
var value =
|
|
27609
|
+
var value = path3.value;
|
|
27450
27610
|
var methodName = value && typeof value === "object" && typeof value.type === "string" && this._methodNameTable[value.type];
|
|
27451
27611
|
if (methodName) {
|
|
27452
|
-
var context = this.acquireContext(
|
|
27612
|
+
var context = this.acquireContext(path3);
|
|
27453
27613
|
try {
|
|
27454
27614
|
return context.invokeVisitorMethod(methodName);
|
|
27455
27615
|
} finally {
|
|
27456
27616
|
this.releaseContext(context);
|
|
27457
27617
|
}
|
|
27458
27618
|
} else {
|
|
27459
|
-
return visitChildren(
|
|
27619
|
+
return visitChildren(path3, this);
|
|
27460
27620
|
}
|
|
27461
27621
|
};
|
|
27462
|
-
function visitChildren(
|
|
27463
|
-
if (!(
|
|
27622
|
+
function visitChildren(path3, visitor) {
|
|
27623
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27464
27624
|
throw new Error("");
|
|
27465
27625
|
}
|
|
27466
27626
|
if (!(visitor instanceof PathVisitor2)) {
|
|
27467
27627
|
throw new Error("");
|
|
27468
27628
|
}
|
|
27469
|
-
var value =
|
|
27629
|
+
var value = path3.value;
|
|
27470
27630
|
if (isArray2.check(value)) {
|
|
27471
|
-
|
|
27631
|
+
path3.each(visitor.visitWithoutReset, visitor);
|
|
27472
27632
|
} else if (!isObject2.check(value))
|
|
27473
27633
|
;
|
|
27474
27634
|
else {
|
|
@@ -27483,19 +27643,19 @@ function pathVisitorPlugin(fork2) {
|
|
|
27483
27643
|
if (!hasOwn$3.call(value, childName)) {
|
|
27484
27644
|
value[childName] = types.getFieldValue(value, childName);
|
|
27485
27645
|
}
|
|
27486
|
-
childPaths.push(
|
|
27646
|
+
childPaths.push(path3.get(childName));
|
|
27487
27647
|
}
|
|
27488
27648
|
for (var i = 0; i < childCount; ++i) {
|
|
27489
27649
|
visitor.visitWithoutReset(childPaths[i]);
|
|
27490
27650
|
}
|
|
27491
27651
|
}
|
|
27492
|
-
return
|
|
27652
|
+
return path3.value;
|
|
27493
27653
|
}
|
|
27494
|
-
PVp.acquireContext = function(
|
|
27654
|
+
PVp.acquireContext = function(path3) {
|
|
27495
27655
|
if (this._reusableContextStack.length === 0) {
|
|
27496
|
-
return new this.Context(
|
|
27656
|
+
return new this.Context(path3);
|
|
27497
27657
|
}
|
|
27498
|
-
return this._reusableContextStack.pop().reset(
|
|
27658
|
+
return this._reusableContextStack.pop().reset(path3);
|
|
27499
27659
|
};
|
|
27500
27660
|
PVp.releaseContext = function(context) {
|
|
27501
27661
|
if (!(context instanceof this.Context)) {
|
|
@@ -27511,14 +27671,14 @@ function pathVisitorPlugin(fork2) {
|
|
|
27511
27671
|
return this._changeReported;
|
|
27512
27672
|
};
|
|
27513
27673
|
function makeContextConstructor(visitor) {
|
|
27514
|
-
function Context(
|
|
27674
|
+
function Context(path3) {
|
|
27515
27675
|
if (!(this instanceof Context)) {
|
|
27516
27676
|
throw new Error("");
|
|
27517
27677
|
}
|
|
27518
27678
|
if (!(this instanceof PathVisitor2)) {
|
|
27519
27679
|
throw new Error("");
|
|
27520
27680
|
}
|
|
27521
|
-
if (!(
|
|
27681
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27522
27682
|
throw new Error("");
|
|
27523
27683
|
}
|
|
27524
27684
|
Object.defineProperty(this, "visitor", {
|
|
@@ -27527,7 +27687,7 @@ function pathVisitorPlugin(fork2) {
|
|
|
27527
27687
|
enumerable: true,
|
|
27528
27688
|
configurable: false
|
|
27529
27689
|
});
|
|
27530
|
-
this.currentPath =
|
|
27690
|
+
this.currentPath = path3;
|
|
27531
27691
|
this.needToCallTraverse = true;
|
|
27532
27692
|
Object.seal(this);
|
|
27533
27693
|
}
|
|
@@ -27540,14 +27700,14 @@ function pathVisitorPlugin(fork2) {
|
|
|
27540
27700
|
return Context;
|
|
27541
27701
|
}
|
|
27542
27702
|
var sharedContextProtoMethods = /* @__PURE__ */ Object.create(null);
|
|
27543
|
-
sharedContextProtoMethods.reset = function reset(
|
|
27703
|
+
sharedContextProtoMethods.reset = function reset(path3) {
|
|
27544
27704
|
if (!(this instanceof this.Context)) {
|
|
27545
27705
|
throw new Error("");
|
|
27546
27706
|
}
|
|
27547
|
-
if (!(
|
|
27707
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27548
27708
|
throw new Error("");
|
|
27549
27709
|
}
|
|
27550
|
-
this.currentPath =
|
|
27710
|
+
this.currentPath = path3;
|
|
27551
27711
|
this.needToCallTraverse = true;
|
|
27552
27712
|
return this;
|
|
27553
27713
|
};
|
|
@@ -27572,29 +27732,29 @@ function pathVisitorPlugin(fork2) {
|
|
|
27572
27732
|
"Must either call this.traverse or return false in " + methodName
|
|
27573
27733
|
);
|
|
27574
27734
|
}
|
|
27575
|
-
var
|
|
27576
|
-
return
|
|
27735
|
+
var path3 = this.currentPath;
|
|
27736
|
+
return path3 && path3.value;
|
|
27577
27737
|
};
|
|
27578
|
-
sharedContextProtoMethods.traverse = function traverse(
|
|
27738
|
+
sharedContextProtoMethods.traverse = function traverse(path3, newVisitor) {
|
|
27579
27739
|
if (!(this instanceof this.Context)) {
|
|
27580
27740
|
throw new Error("");
|
|
27581
27741
|
}
|
|
27582
|
-
if (!(
|
|
27742
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27583
27743
|
throw new Error("");
|
|
27584
27744
|
}
|
|
27585
27745
|
if (!(this.currentPath instanceof NodePath2)) {
|
|
27586
27746
|
throw new Error("");
|
|
27587
27747
|
}
|
|
27588
27748
|
this.needToCallTraverse = false;
|
|
27589
|
-
return visitChildren(
|
|
27749
|
+
return visitChildren(path3, PathVisitor2.fromMethodsObject(
|
|
27590
27750
|
newVisitor || this.visitor
|
|
27591
27751
|
));
|
|
27592
27752
|
};
|
|
27593
|
-
sharedContextProtoMethods.visit = function visit2(
|
|
27753
|
+
sharedContextProtoMethods.visit = function visit2(path3, newVisitor) {
|
|
27594
27754
|
if (!(this instanceof this.Context)) {
|
|
27595
27755
|
throw new Error("");
|
|
27596
27756
|
}
|
|
27597
|
-
if (!(
|
|
27757
|
+
if (!(path3 instanceof NodePath2)) {
|
|
27598
27758
|
throw new Error("");
|
|
27599
27759
|
}
|
|
27600
27760
|
if (!(this.currentPath instanceof NodePath2)) {
|
|
@@ -27603,7 +27763,7 @@ function pathVisitorPlugin(fork2) {
|
|
|
27603
27763
|
this.needToCallTraverse = false;
|
|
27604
27764
|
return PathVisitor2.fromMethodsObject(
|
|
27605
27765
|
newVisitor || this.visitor
|
|
27606
|
-
).visitWithoutReset(
|
|
27766
|
+
).visitWithoutReset(path3);
|
|
27607
27767
|
};
|
|
27608
27768
|
sharedContextProtoMethods.reportChanged = function reportChanged() {
|
|
27609
27769
|
this.visitor.reportChanged();
|
|
@@ -29211,9 +29371,9 @@ function isExportDeclaration(node) {
|
|
|
29211
29371
|
}
|
|
29212
29372
|
return false;
|
|
29213
29373
|
}
|
|
29214
|
-
function getParentExportDeclaration(
|
|
29215
|
-
const parentNode =
|
|
29216
|
-
if (
|
|
29374
|
+
function getParentExportDeclaration(path3) {
|
|
29375
|
+
const parentNode = path3.getParentNode();
|
|
29376
|
+
if (path3.getName() === "declaration" && isExportDeclaration(parentNode)) {
|
|
29217
29377
|
return parentNode;
|
|
29218
29378
|
}
|
|
29219
29379
|
return null;
|
|
@@ -30222,16 +30382,16 @@ function printTrailingComment(commentPath, print2) {
|
|
|
30222
30382
|
parts.push(print2(commentPath));
|
|
30223
30383
|
return concat(parts);
|
|
30224
30384
|
}
|
|
30225
|
-
function printComments(
|
|
30226
|
-
const value =
|
|
30227
|
-
const innerLines = print2(
|
|
30385
|
+
function printComments(path3, print2) {
|
|
30386
|
+
const value = path3.getValue();
|
|
30387
|
+
const innerLines = print2(path3);
|
|
30228
30388
|
const comments = n$1.Node.check(value) && getFieldValue(value, "comments");
|
|
30229
30389
|
if (!comments || comments.length === 0) {
|
|
30230
30390
|
return innerLines;
|
|
30231
30391
|
}
|
|
30232
30392
|
const leadingParts = [];
|
|
30233
30393
|
const trailingParts = [innerLines];
|
|
30234
|
-
|
|
30394
|
+
path3.each(function(commentPath) {
|
|
30235
30395
|
const comment = commentPath.getValue();
|
|
30236
30396
|
const leading = getFieldValue(comment, "leading");
|
|
30237
30397
|
const trailing = getFieldValue(comment, "trailing");
|
|
@@ -30480,8 +30640,8 @@ FPp.valueIsDuplicate = function() {
|
|
|
30480
30640
|
const valueIndex = s.length - 1;
|
|
30481
30641
|
return s.lastIndexOf(s[valueIndex], valueIndex - 1) >= 0;
|
|
30482
30642
|
};
|
|
30483
|
-
function getNodeHelper(
|
|
30484
|
-
const s =
|
|
30643
|
+
function getNodeHelper(path3, count) {
|
|
30644
|
+
const s = path3.stack;
|
|
30485
30645
|
for (let i = s.length - 1; i >= 0; i -= 2) {
|
|
30486
30646
|
const value = s[i];
|
|
30487
30647
|
if (n.Node.check(value) && --count < 0) {
|
|
@@ -30925,15 +31085,15 @@ Pp.deleteComments = function(node) {
|
|
|
30925
31085
|
}
|
|
30926
31086
|
});
|
|
30927
31087
|
};
|
|
30928
|
-
function getReprinter(
|
|
30929
|
-
const node =
|
|
31088
|
+
function getReprinter(path3) {
|
|
31089
|
+
const node = path3.getValue();
|
|
30930
31090
|
if (!Printable.check(node))
|
|
30931
31091
|
return;
|
|
30932
31092
|
const orig = node.original;
|
|
30933
31093
|
const origLoc = orig && orig.loc;
|
|
30934
31094
|
const lines = origLoc && origLoc.lines;
|
|
30935
31095
|
const reprints = [];
|
|
30936
|
-
if (!lines || !findReprints(
|
|
31096
|
+
if (!lines || !findReprints(path3, reprints))
|
|
30937
31097
|
return;
|
|
30938
31098
|
return function(print2) {
|
|
30939
31099
|
const patcher = new Patcher(lines);
|
|
@@ -30970,7 +31130,7 @@ function getReprinter(path2) {
|
|
|
30970
31130
|
patcher.replace(oldNode.loc, newLines);
|
|
30971
31131
|
});
|
|
30972
31132
|
const patchedLines = patcher.get(origLoc).indentTail(-orig.loc.indent);
|
|
30973
|
-
if (
|
|
31133
|
+
if (path3.needsParens()) {
|
|
30974
31134
|
return concat(["(", patchedLines, ")"]);
|
|
30975
31135
|
}
|
|
30976
31136
|
return patchedLines;
|
|
@@ -31152,13 +31312,13 @@ var Printer = function Printer2(config) {
|
|
|
31152
31312
|
config.sourceFileName = null;
|
|
31153
31313
|
function makePrintFunctionWith(options, overrides) {
|
|
31154
31314
|
options = Object.assign({}, options, overrides);
|
|
31155
|
-
return (
|
|
31315
|
+
return (path3) => print2(path3, options);
|
|
31156
31316
|
}
|
|
31157
|
-
function print2(
|
|
31317
|
+
function print2(path3, options) {
|
|
31158
31318
|
options = options || {};
|
|
31159
31319
|
if (options.includeComments) {
|
|
31160
31320
|
return printComments(
|
|
31161
|
-
|
|
31321
|
+
path3,
|
|
31162
31322
|
makePrintFunctionWith(options, {
|
|
31163
31323
|
includeComments: false
|
|
31164
31324
|
})
|
|
@@ -31166,12 +31326,12 @@ var Printer = function Printer2(config) {
|
|
|
31166
31326
|
}
|
|
31167
31327
|
const oldTabWidth = config.tabWidth;
|
|
31168
31328
|
if (!explicitTabWidth) {
|
|
31169
|
-
const loc =
|
|
31329
|
+
const loc = path3.getNode().loc;
|
|
31170
31330
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
31171
31331
|
config.tabWidth = loc.lines.guessTabWidth();
|
|
31172
31332
|
}
|
|
31173
31333
|
}
|
|
31174
|
-
const reprinter = getReprinter(
|
|
31334
|
+
const reprinter = getReprinter(path3);
|
|
31175
31335
|
const lines = reprinter ? (
|
|
31176
31336
|
// Since the print function that we pass to the reprinter will
|
|
31177
31337
|
// be used to print "new" nodes, it's tempting to think we
|
|
@@ -31183,7 +31343,7 @@ var Printer = function Printer2(config) {
|
|
|
31183
31343
|
// such nodes using their original source.
|
|
31184
31344
|
reprinter(print2)
|
|
31185
31345
|
) : genericPrint(
|
|
31186
|
-
|
|
31346
|
+
path3,
|
|
31187
31347
|
config,
|
|
31188
31348
|
options,
|
|
31189
31349
|
makePrintFunctionWith(options, {
|
|
@@ -31217,8 +31377,8 @@ var Printer = function Printer2(config) {
|
|
|
31217
31377
|
function printGenerically(path22) {
|
|
31218
31378
|
return printComments(
|
|
31219
31379
|
path22,
|
|
31220
|
-
(
|
|
31221
|
-
|
|
31380
|
+
(path32) => genericPrint(
|
|
31381
|
+
path32,
|
|
31222
31382
|
config,
|
|
31223
31383
|
{
|
|
31224
31384
|
includeComments: true,
|
|
@@ -31228,26 +31388,26 @@ var Printer = function Printer2(config) {
|
|
|
31228
31388
|
)
|
|
31229
31389
|
);
|
|
31230
31390
|
}
|
|
31231
|
-
const
|
|
31391
|
+
const path3 = FastPath.from(ast);
|
|
31232
31392
|
const oldReuseWhitespace = config.reuseWhitespace;
|
|
31233
31393
|
config.reuseWhitespace = false;
|
|
31234
|
-
const pr = new PrintResult(printGenerically(
|
|
31394
|
+
const pr = new PrintResult(printGenerically(path3).toString(config));
|
|
31235
31395
|
config.reuseWhitespace = oldReuseWhitespace;
|
|
31236
31396
|
return pr;
|
|
31237
31397
|
};
|
|
31238
31398
|
};
|
|
31239
|
-
function genericPrint(
|
|
31240
|
-
const node =
|
|
31399
|
+
function genericPrint(path3, config, options, printPath) {
|
|
31400
|
+
const node = path3.getValue();
|
|
31241
31401
|
const parts = [];
|
|
31242
|
-
const linesWithoutParens = genericPrintNoParens(
|
|
31402
|
+
const linesWithoutParens = genericPrintNoParens(path3, config, printPath);
|
|
31243
31403
|
if (!node || linesWithoutParens.isEmpty()) {
|
|
31244
31404
|
return linesWithoutParens;
|
|
31245
31405
|
}
|
|
31246
31406
|
let shouldAddParens = false;
|
|
31247
|
-
const decoratorsLines = printDecorators(
|
|
31407
|
+
const decoratorsLines = printDecorators(path3, printPath);
|
|
31248
31408
|
if (decoratorsLines.isEmpty()) {
|
|
31249
31409
|
if (!options.avoidRootParens) {
|
|
31250
|
-
shouldAddParens =
|
|
31410
|
+
shouldAddParens = path3.needsParens();
|
|
31251
31411
|
}
|
|
31252
31412
|
} else {
|
|
31253
31413
|
parts.push(decoratorsLines);
|
|
@@ -31261,8 +31421,8 @@ function genericPrint(path2, config, options, printPath) {
|
|
|
31261
31421
|
}
|
|
31262
31422
|
return concat(parts);
|
|
31263
31423
|
}
|
|
31264
|
-
function genericPrintNoParens(
|
|
31265
|
-
const n2 =
|
|
31424
|
+
function genericPrintNoParens(path3, options, print2) {
|
|
31425
|
+
const n2 = path3.getValue();
|
|
31266
31426
|
if (!n2) {
|
|
31267
31427
|
return fromString("");
|
|
31268
31428
|
}
|
|
@@ -31273,18 +31433,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31273
31433
|
const parts = [];
|
|
31274
31434
|
switch (n2.type) {
|
|
31275
31435
|
case "File":
|
|
31276
|
-
return
|
|
31436
|
+
return path3.call(print2, "program");
|
|
31277
31437
|
case "Program":
|
|
31278
31438
|
if (n2.directives) {
|
|
31279
|
-
|
|
31439
|
+
path3.each(function(childPath) {
|
|
31280
31440
|
parts.push(print2(childPath), ";\n");
|
|
31281
31441
|
}, "directives");
|
|
31282
31442
|
}
|
|
31283
31443
|
if (n2.interpreter) {
|
|
31284
|
-
parts.push(
|
|
31444
|
+
parts.push(path3.call(print2, "interpreter"));
|
|
31285
31445
|
}
|
|
31286
31446
|
parts.push(
|
|
31287
|
-
|
|
31447
|
+
path3.call(
|
|
31288
31448
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
31289
31449
|
"body"
|
|
31290
31450
|
)
|
|
@@ -31294,27 +31454,27 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31294
31454
|
case "EmptyStatement":
|
|
31295
31455
|
return fromString("");
|
|
31296
31456
|
case "ExpressionStatement":
|
|
31297
|
-
return concat([
|
|
31457
|
+
return concat([path3.call(print2, "expression"), ";"]);
|
|
31298
31458
|
case "ParenthesizedExpression":
|
|
31299
|
-
return concat(["(",
|
|
31459
|
+
return concat(["(", path3.call(print2, "expression"), ")"]);
|
|
31300
31460
|
case "BinaryExpression":
|
|
31301
31461
|
case "LogicalExpression":
|
|
31302
31462
|
case "AssignmentExpression":
|
|
31303
31463
|
return fromString(" ").join([
|
|
31304
|
-
|
|
31464
|
+
path3.call(print2, "left"),
|
|
31305
31465
|
n2.operator,
|
|
31306
|
-
|
|
31466
|
+
path3.call(print2, "right")
|
|
31307
31467
|
]);
|
|
31308
31468
|
case "AssignmentPattern":
|
|
31309
31469
|
return concat([
|
|
31310
|
-
|
|
31470
|
+
path3.call(print2, "left"),
|
|
31311
31471
|
" = ",
|
|
31312
|
-
|
|
31472
|
+
path3.call(print2, "right")
|
|
31313
31473
|
]);
|
|
31314
31474
|
case "MemberExpression":
|
|
31315
31475
|
case "OptionalMemberExpression": {
|
|
31316
|
-
parts.push(
|
|
31317
|
-
const property =
|
|
31476
|
+
parts.push(path3.call(print2, "object"));
|
|
31477
|
+
const property = path3.call(print2, "property");
|
|
31318
31478
|
const optional = getFieldValue(n2, "optional");
|
|
31319
31479
|
if (n2.computed) {
|
|
31320
31480
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
@@ -31324,18 +31484,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31324
31484
|
return concat(parts);
|
|
31325
31485
|
}
|
|
31326
31486
|
case "ChainExpression":
|
|
31327
|
-
return
|
|
31487
|
+
return path3.call(print2, "expression");
|
|
31328
31488
|
case "MetaProperty":
|
|
31329
31489
|
return concat([
|
|
31330
|
-
|
|
31490
|
+
path3.call(print2, "meta"),
|
|
31331
31491
|
".",
|
|
31332
|
-
|
|
31492
|
+
path3.call(print2, "property")
|
|
31333
31493
|
]);
|
|
31334
31494
|
case "BindExpression":
|
|
31335
31495
|
if (n2.object) {
|
|
31336
|
-
parts.push(
|
|
31496
|
+
parts.push(path3.call(print2, "object"));
|
|
31337
31497
|
}
|
|
31338
|
-
parts.push("::",
|
|
31498
|
+
parts.push("::", path3.call(print2, "callee"));
|
|
31339
31499
|
return concat(parts);
|
|
31340
31500
|
case "Path":
|
|
31341
31501
|
return fromString(".").join(n2.body);
|
|
@@ -31343,7 +31503,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31343
31503
|
return concat([
|
|
31344
31504
|
fromString(n2.name, options),
|
|
31345
31505
|
n2.optional ? "?" : "",
|
|
31346
|
-
|
|
31506
|
+
path3.call(print2, "typeAnnotation")
|
|
31347
31507
|
]);
|
|
31348
31508
|
case "SpreadElement":
|
|
31349
31509
|
case "SpreadElementPattern":
|
|
@@ -31354,8 +31514,8 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31354
31514
|
case "RestElement":
|
|
31355
31515
|
return concat([
|
|
31356
31516
|
"...",
|
|
31357
|
-
|
|
31358
|
-
|
|
31517
|
+
path3.call(print2, "argument"),
|
|
31518
|
+
path3.call(print2, "typeAnnotation")
|
|
31359
31519
|
]);
|
|
31360
31520
|
case "FunctionDeclaration":
|
|
31361
31521
|
case "FunctionExpression":
|
|
@@ -31372,22 +31532,22 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31372
31532
|
if (n2.id) {
|
|
31373
31533
|
parts.push(
|
|
31374
31534
|
" ",
|
|
31375
|
-
|
|
31376
|
-
|
|
31535
|
+
path3.call(print2, "id"),
|
|
31536
|
+
path3.call(print2, "typeParameters")
|
|
31377
31537
|
);
|
|
31378
31538
|
} else {
|
|
31379
31539
|
if (n2.typeParameters) {
|
|
31380
|
-
parts.push(
|
|
31540
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31381
31541
|
}
|
|
31382
31542
|
}
|
|
31383
31543
|
parts.push(
|
|
31384
31544
|
"(",
|
|
31385
|
-
printFunctionParams(
|
|
31545
|
+
printFunctionParams(path3, options, print2),
|
|
31386
31546
|
")",
|
|
31387
|
-
|
|
31547
|
+
path3.call(print2, "returnType")
|
|
31388
31548
|
);
|
|
31389
31549
|
if (n2.body) {
|
|
31390
|
-
parts.push(" ",
|
|
31550
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
31391
31551
|
}
|
|
31392
31552
|
return concat(parts);
|
|
31393
31553
|
case "ArrowFunctionExpression":
|
|
@@ -31395,48 +31555,48 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31395
31555
|
parts.push("async ");
|
|
31396
31556
|
}
|
|
31397
31557
|
if (n2.typeParameters) {
|
|
31398
|
-
parts.push(
|
|
31558
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31399
31559
|
}
|
|
31400
31560
|
if (!options.arrowParensAlways && n2.params.length === 1 && !n2.rest && n2.params[0].type === "Identifier" && !n2.params[0].typeAnnotation && !n2.returnType) {
|
|
31401
|
-
parts.push(
|
|
31561
|
+
parts.push(path3.call(print2, "params", 0));
|
|
31402
31562
|
} else {
|
|
31403
31563
|
parts.push(
|
|
31404
31564
|
"(",
|
|
31405
|
-
printFunctionParams(
|
|
31565
|
+
printFunctionParams(path3, options, print2),
|
|
31406
31566
|
")",
|
|
31407
|
-
|
|
31567
|
+
path3.call(print2, "returnType")
|
|
31408
31568
|
);
|
|
31409
31569
|
}
|
|
31410
|
-
parts.push(" => ",
|
|
31570
|
+
parts.push(" => ", path3.call(print2, "body"));
|
|
31411
31571
|
return concat(parts);
|
|
31412
31572
|
case "MethodDefinition":
|
|
31413
|
-
return printMethod(
|
|
31573
|
+
return printMethod(path3, options, print2);
|
|
31414
31574
|
case "YieldExpression":
|
|
31415
31575
|
parts.push("yield");
|
|
31416
31576
|
if (n2.delegate)
|
|
31417
31577
|
parts.push("*");
|
|
31418
31578
|
if (n2.argument)
|
|
31419
|
-
parts.push(" ",
|
|
31579
|
+
parts.push(" ", path3.call(print2, "argument"));
|
|
31420
31580
|
return concat(parts);
|
|
31421
31581
|
case "AwaitExpression":
|
|
31422
31582
|
parts.push("await");
|
|
31423
31583
|
if (n2.all)
|
|
31424
31584
|
parts.push("*");
|
|
31425
31585
|
if (n2.argument)
|
|
31426
|
-
parts.push(" ",
|
|
31586
|
+
parts.push(" ", path3.call(print2, "argument"));
|
|
31427
31587
|
return concat(parts);
|
|
31428
31588
|
case "ModuleExpression":
|
|
31429
31589
|
return concat([
|
|
31430
31590
|
"module {\n",
|
|
31431
|
-
|
|
31591
|
+
path3.call(print2, "body").indent(options.tabWidth),
|
|
31432
31592
|
"\n}"
|
|
31433
31593
|
]);
|
|
31434
31594
|
case "ModuleDeclaration":
|
|
31435
|
-
parts.push("module",
|
|
31595
|
+
parts.push("module", path3.call(print2, "id"));
|
|
31436
31596
|
if (n2.source) {
|
|
31437
|
-
parts.push("from",
|
|
31597
|
+
parts.push("from", path3.call(print2, "source"));
|
|
31438
31598
|
} else {
|
|
31439
|
-
parts.push(
|
|
31599
|
+
parts.push(path3.call(print2, "body"));
|
|
31440
31600
|
}
|
|
31441
31601
|
return fromString(" ").join(parts);
|
|
31442
31602
|
case "ImportSpecifier":
|
|
@@ -31444,14 +31604,14 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31444
31604
|
parts.push(n2.importKind + " ");
|
|
31445
31605
|
}
|
|
31446
31606
|
if (n2.imported) {
|
|
31447
|
-
parts.push(
|
|
31607
|
+
parts.push(path3.call(print2, "imported"));
|
|
31448
31608
|
if (n2.local && n2.local.name !== n2.imported.name) {
|
|
31449
|
-
parts.push(" as ",
|
|
31609
|
+
parts.push(" as ", path3.call(print2, "local"));
|
|
31450
31610
|
}
|
|
31451
31611
|
} else if (n2.id) {
|
|
31452
|
-
parts.push(
|
|
31612
|
+
parts.push(path3.call(print2, "id"));
|
|
31453
31613
|
if (n2.name) {
|
|
31454
|
-
parts.push(" as ",
|
|
31614
|
+
parts.push(" as ", path3.call(print2, "name"));
|
|
31455
31615
|
}
|
|
31456
31616
|
}
|
|
31457
31617
|
return concat(parts);
|
|
@@ -31460,14 +31620,14 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31460
31620
|
parts.push(n2.exportKind + " ");
|
|
31461
31621
|
}
|
|
31462
31622
|
if (n2.local) {
|
|
31463
|
-
parts.push(
|
|
31623
|
+
parts.push(path3.call(print2, "local"));
|
|
31464
31624
|
if (n2.exported && n2.exported.name !== n2.local.name) {
|
|
31465
|
-
parts.push(" as ",
|
|
31625
|
+
parts.push(" as ", path3.call(print2, "exported"));
|
|
31466
31626
|
}
|
|
31467
31627
|
} else if (n2.id) {
|
|
31468
|
-
parts.push(
|
|
31628
|
+
parts.push(path3.call(print2, "id"));
|
|
31469
31629
|
if (n2.name) {
|
|
31470
|
-
parts.push(" as ",
|
|
31630
|
+
parts.push(" as ", path3.call(print2, "name"));
|
|
31471
31631
|
}
|
|
31472
31632
|
}
|
|
31473
31633
|
return concat(parts);
|
|
@@ -31476,40 +31636,40 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31476
31636
|
case "ImportNamespaceSpecifier":
|
|
31477
31637
|
parts.push("* as ");
|
|
31478
31638
|
if (n2.local) {
|
|
31479
|
-
parts.push(
|
|
31639
|
+
parts.push(path3.call(print2, "local"));
|
|
31480
31640
|
} else if (n2.id) {
|
|
31481
|
-
parts.push(
|
|
31641
|
+
parts.push(path3.call(print2, "id"));
|
|
31482
31642
|
}
|
|
31483
31643
|
return concat(parts);
|
|
31484
31644
|
case "ImportDefaultSpecifier":
|
|
31485
31645
|
if (n2.local) {
|
|
31486
|
-
return
|
|
31646
|
+
return path3.call(print2, "local");
|
|
31487
31647
|
}
|
|
31488
|
-
return
|
|
31648
|
+
return path3.call(print2, "id");
|
|
31489
31649
|
case "TSExportAssignment":
|
|
31490
|
-
return concat(["export = ",
|
|
31650
|
+
return concat(["export = ", path3.call(print2, "expression")]);
|
|
31491
31651
|
case "ExportDeclaration":
|
|
31492
31652
|
case "ExportDefaultDeclaration":
|
|
31493
31653
|
case "ExportNamedDeclaration":
|
|
31494
|
-
return printExportDeclaration(
|
|
31654
|
+
return printExportDeclaration(path3, options, print2);
|
|
31495
31655
|
case "ExportAllDeclaration":
|
|
31496
31656
|
parts.push("export *");
|
|
31497
31657
|
if (n2.exported) {
|
|
31498
|
-
parts.push(" as ",
|
|
31658
|
+
parts.push(" as ", path3.call(print2, "exported"));
|
|
31499
31659
|
}
|
|
31500
|
-
parts.push(" from ",
|
|
31660
|
+
parts.push(" from ", path3.call(print2, "source"), ";");
|
|
31501
31661
|
return concat(parts);
|
|
31502
31662
|
case "TSNamespaceExportDeclaration":
|
|
31503
|
-
parts.push("export as namespace ",
|
|
31663
|
+
parts.push("export as namespace ", path3.call(print2, "id"));
|
|
31504
31664
|
return maybeAddSemicolon(concat(parts));
|
|
31505
31665
|
case "ExportNamespaceSpecifier":
|
|
31506
|
-
return concat(["* as ",
|
|
31666
|
+
return concat(["* as ", path3.call(print2, "exported")]);
|
|
31507
31667
|
case "ExportDefaultSpecifier":
|
|
31508
|
-
return
|
|
31668
|
+
return path3.call(print2, "exported");
|
|
31509
31669
|
case "Import":
|
|
31510
31670
|
return fromString("import", options);
|
|
31511
31671
|
case "ImportExpression":
|
|
31512
|
-
return concat(["import(",
|
|
31672
|
+
return concat(["import(", path3.call(print2, "source"), ")"]);
|
|
31513
31673
|
case "ImportDeclaration": {
|
|
31514
31674
|
parts.push("import ");
|
|
31515
31675
|
if (n2.importKind && n2.importKind !== "value") {
|
|
@@ -31518,7 +31678,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31518
31678
|
if (n2.specifiers && n2.specifiers.length > 0) {
|
|
31519
31679
|
const unbracedSpecifiers = [];
|
|
31520
31680
|
const bracedSpecifiers = [];
|
|
31521
|
-
|
|
31681
|
+
path3.each(function(specifierPath) {
|
|
31522
31682
|
const spec = specifierPath.getValue();
|
|
31523
31683
|
if (spec.type === "ImportSpecifier") {
|
|
31524
31684
|
bracedSpecifiers.push(print2(specifierPath));
|
|
@@ -31554,18 +31714,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31554
31714
|
parts.push(" from ");
|
|
31555
31715
|
}
|
|
31556
31716
|
parts.push(
|
|
31557
|
-
|
|
31558
|
-
maybePrintImportAssertions(
|
|
31717
|
+
path3.call(print2, "source"),
|
|
31718
|
+
maybePrintImportAssertions(path3, options, print2),
|
|
31559
31719
|
";"
|
|
31560
31720
|
);
|
|
31561
31721
|
return concat(parts);
|
|
31562
31722
|
}
|
|
31563
31723
|
case "ImportAttribute":
|
|
31564
|
-
return concat([
|
|
31724
|
+
return concat([path3.call(print2, "key"), ": ", path3.call(print2, "value")]);
|
|
31565
31725
|
case "StaticBlock":
|
|
31566
31726
|
parts.push("static ");
|
|
31567
31727
|
case "BlockStatement": {
|
|
31568
|
-
const naked =
|
|
31728
|
+
const naked = path3.call(
|
|
31569
31729
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
31570
31730
|
"body"
|
|
31571
31731
|
);
|
|
@@ -31577,7 +31737,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31577
31737
|
}
|
|
31578
31738
|
parts.push("{\n");
|
|
31579
31739
|
if (n2.directives) {
|
|
31580
|
-
|
|
31740
|
+
path3.each(function(childPath) {
|
|
31581
31741
|
parts.push(
|
|
31582
31742
|
maybeAddSemicolon(print2(childPath).indent(options.tabWidth)),
|
|
31583
31743
|
n2.directives.length > 1 || !naked.isEmpty() ? "\n" : ""
|
|
@@ -31591,7 +31751,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31591
31751
|
case "ReturnStatement": {
|
|
31592
31752
|
parts.push("return");
|
|
31593
31753
|
if (n2.argument) {
|
|
31594
|
-
const argLines =
|
|
31754
|
+
const argLines = path3.call(print2, "argument");
|
|
31595
31755
|
if (argLines.startsWithComment() || argLines.length > 1 && namedTypes.JSXElement && namedTypes.JSXElement.check(n2.argument)) {
|
|
31596
31756
|
parts.push(" (\n", argLines.indent(options.tabWidth), "\n)");
|
|
31597
31757
|
} else {
|
|
@@ -31603,17 +31763,17 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31603
31763
|
}
|
|
31604
31764
|
case "CallExpression":
|
|
31605
31765
|
case "OptionalCallExpression":
|
|
31606
|
-
parts.push(
|
|
31766
|
+
parts.push(path3.call(print2, "callee"));
|
|
31607
31767
|
if (n2.typeParameters) {
|
|
31608
|
-
parts.push(
|
|
31768
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31609
31769
|
}
|
|
31610
31770
|
if (n2.typeArguments) {
|
|
31611
|
-
parts.push(
|
|
31771
|
+
parts.push(path3.call(print2, "typeArguments"));
|
|
31612
31772
|
}
|
|
31613
31773
|
if (getFieldValue(n2, "optional")) {
|
|
31614
31774
|
parts.push("?.");
|
|
31615
31775
|
}
|
|
31616
|
-
parts.push(printArgumentsList(
|
|
31776
|
+
parts.push(printArgumentsList(path3, options, print2));
|
|
31617
31777
|
return concat(parts);
|
|
31618
31778
|
case "RecordExpression":
|
|
31619
31779
|
parts.push("#");
|
|
@@ -31642,7 +31802,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31642
31802
|
const leftBraceIndex = parts.length - 1;
|
|
31643
31803
|
let i = 0;
|
|
31644
31804
|
fields.forEach(function(field) {
|
|
31645
|
-
|
|
31805
|
+
path3.each(function(childPath) {
|
|
31646
31806
|
let lines = print2(childPath);
|
|
31647
31807
|
if (!oneLine) {
|
|
31648
31808
|
lines = lines.indent(options.tabWidth);
|
|
@@ -31680,32 +31840,32 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31680
31840
|
parts[parts.length - 1] = " " + rightBrace;
|
|
31681
31841
|
}
|
|
31682
31842
|
if (n2.typeAnnotation) {
|
|
31683
|
-
parts.push(
|
|
31843
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
31684
31844
|
}
|
|
31685
31845
|
return concat(parts);
|
|
31686
31846
|
}
|
|
31687
31847
|
case "PropertyPattern":
|
|
31688
31848
|
return concat([
|
|
31689
|
-
|
|
31849
|
+
path3.call(print2, "key"),
|
|
31690
31850
|
": ",
|
|
31691
|
-
|
|
31851
|
+
path3.call(print2, "pattern")
|
|
31692
31852
|
]);
|
|
31693
31853
|
case "ObjectProperty":
|
|
31694
31854
|
case "Property": {
|
|
31695
31855
|
if (n2.method || n2.kind === "get" || n2.kind === "set") {
|
|
31696
|
-
return printMethod(
|
|
31856
|
+
return printMethod(path3, options, print2);
|
|
31697
31857
|
}
|
|
31698
31858
|
if (n2.shorthand && n2.value.type === "AssignmentPattern") {
|
|
31699
|
-
return
|
|
31859
|
+
return path3.call(print2, "value");
|
|
31700
31860
|
}
|
|
31701
|
-
const key =
|
|
31861
|
+
const key = path3.call(print2, "key");
|
|
31702
31862
|
if (n2.computed) {
|
|
31703
31863
|
parts.push("[", key, "]");
|
|
31704
31864
|
} else {
|
|
31705
31865
|
parts.push(key);
|
|
31706
31866
|
}
|
|
31707
31867
|
if (!n2.shorthand || n2.key.name !== n2.value.name) {
|
|
31708
|
-
parts.push(": ",
|
|
31868
|
+
parts.push(": ", path3.call(print2, "value"));
|
|
31709
31869
|
}
|
|
31710
31870
|
return concat(parts);
|
|
31711
31871
|
}
|
|
@@ -31713,18 +31873,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31713
31873
|
case "ObjectMethod":
|
|
31714
31874
|
case "ClassPrivateMethod":
|
|
31715
31875
|
case "TSDeclareMethod":
|
|
31716
|
-
return printMethod(
|
|
31876
|
+
return printMethod(path3, options, print2);
|
|
31717
31877
|
case "PrivateName":
|
|
31718
|
-
return concat(["#",
|
|
31878
|
+
return concat(["#", path3.call(print2, "id")]);
|
|
31719
31879
|
case "Decorator":
|
|
31720
|
-
return concat(["@",
|
|
31880
|
+
return concat(["@", path3.call(print2, "expression")]);
|
|
31721
31881
|
case "TupleExpression":
|
|
31722
31882
|
parts.push("#");
|
|
31723
31883
|
case "ArrayExpression":
|
|
31724
31884
|
case "ArrayPattern": {
|
|
31725
31885
|
const elems = n2.elements;
|
|
31726
31886
|
const len = elems.length;
|
|
31727
|
-
const printed =
|
|
31887
|
+
const printed = path3.map(print2, "elements");
|
|
31728
31888
|
const joined = fromString(", ").join(printed);
|
|
31729
31889
|
const oneLine = joined.getLineLength(1) <= options.wrapColumn;
|
|
31730
31890
|
if (oneLine) {
|
|
@@ -31736,7 +31896,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31736
31896
|
} else {
|
|
31737
31897
|
parts.push("[\n");
|
|
31738
31898
|
}
|
|
31739
|
-
|
|
31899
|
+
path3.each(function(elemPath) {
|
|
31740
31900
|
const i = elemPath.getName();
|
|
31741
31901
|
const elem = elemPath.getValue();
|
|
31742
31902
|
if (!elem) {
|
|
@@ -31762,12 +31922,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31762
31922
|
parts.push("]");
|
|
31763
31923
|
}
|
|
31764
31924
|
if (n2.typeAnnotation) {
|
|
31765
|
-
parts.push(
|
|
31925
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
31766
31926
|
}
|
|
31767
31927
|
return concat(parts);
|
|
31768
31928
|
}
|
|
31769
31929
|
case "SequenceExpression":
|
|
31770
|
-
return fromString(", ").join(
|
|
31930
|
+
return fromString(", ").join(path3.map(print2, "expressions"));
|
|
31771
31931
|
case "ThisExpression":
|
|
31772
31932
|
return fromString("this");
|
|
31773
31933
|
case "Super":
|
|
@@ -31794,7 +31954,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31794
31954
|
options
|
|
31795
31955
|
);
|
|
31796
31956
|
case "Directive":
|
|
31797
|
-
return
|
|
31957
|
+
return path3.call(print2, "value");
|
|
31798
31958
|
case "DirectiveLiteral":
|
|
31799
31959
|
return fromString(
|
|
31800
31960
|
getPossibleRaw(n2) || nodeStr(n2.value, options),
|
|
@@ -31812,32 +31972,32 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31812
31972
|
parts.push(n2.operator);
|
|
31813
31973
|
if (/[a-z]$/.test(n2.operator))
|
|
31814
31974
|
parts.push(" ");
|
|
31815
|
-
parts.push(
|
|
31975
|
+
parts.push(path3.call(print2, "argument"));
|
|
31816
31976
|
return concat(parts);
|
|
31817
31977
|
case "UpdateExpression":
|
|
31818
|
-
parts.push(
|
|
31978
|
+
parts.push(path3.call(print2, "argument"), n2.operator);
|
|
31819
31979
|
if (n2.prefix)
|
|
31820
31980
|
parts.reverse();
|
|
31821
31981
|
return concat(parts);
|
|
31822
31982
|
case "ConditionalExpression":
|
|
31823
31983
|
return concat([
|
|
31824
|
-
|
|
31984
|
+
path3.call(print2, "test"),
|
|
31825
31985
|
" ? ",
|
|
31826
|
-
|
|
31986
|
+
path3.call(print2, "consequent"),
|
|
31827
31987
|
" : ",
|
|
31828
|
-
|
|
31988
|
+
path3.call(print2, "alternate")
|
|
31829
31989
|
]);
|
|
31830
31990
|
case "NewExpression": {
|
|
31831
|
-
parts.push("new ",
|
|
31991
|
+
parts.push("new ", path3.call(print2, "callee"));
|
|
31832
31992
|
if (n2.typeParameters) {
|
|
31833
|
-
parts.push(
|
|
31993
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
31834
31994
|
}
|
|
31835
31995
|
if (n2.typeArguments) {
|
|
31836
|
-
parts.push(
|
|
31996
|
+
parts.push(path3.call(print2, "typeArguments"));
|
|
31837
31997
|
}
|
|
31838
31998
|
const args = n2.arguments;
|
|
31839
31999
|
if (args) {
|
|
31840
|
-
parts.push(printArgumentsList(
|
|
32000
|
+
parts.push(printArgumentsList(path3, options, print2));
|
|
31841
32001
|
}
|
|
31842
32002
|
return concat(parts);
|
|
31843
32003
|
}
|
|
@@ -31847,7 +32007,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31847
32007
|
}
|
|
31848
32008
|
parts.push(n2.kind, " ");
|
|
31849
32009
|
let maxLen = 0;
|
|
31850
|
-
const printed =
|
|
32010
|
+
const printed = path3.map(function(childPath) {
|
|
31851
32011
|
const lines = print2(childPath);
|
|
31852
32012
|
maxLen = Math.max(lines.length, maxLen);
|
|
31853
32013
|
return lines;
|
|
@@ -31861,7 +32021,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31861
32021
|
} else {
|
|
31862
32022
|
parts.push(printed[0]);
|
|
31863
32023
|
}
|
|
31864
|
-
const parentNode =
|
|
32024
|
+
const parentNode = path3.getParentNode();
|
|
31865
32025
|
if (!namedTypes.ForStatement.check(parentNode) && !namedTypes.ForInStatement.check(parentNode) && !(namedTypes.ForOfStatement && namedTypes.ForOfStatement.check(parentNode)) && !(namedTypes.ForAwaitStatement && namedTypes.ForAwaitStatement.check(parentNode))) {
|
|
31866
32026
|
parts.push(";");
|
|
31867
32027
|
}
|
|
@@ -31869,33 +32029,33 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31869
32029
|
}
|
|
31870
32030
|
case "VariableDeclarator":
|
|
31871
32031
|
return n2.init ? fromString(" = ").join([
|
|
31872
|
-
|
|
31873
|
-
|
|
31874
|
-
]) :
|
|
32032
|
+
path3.call(print2, "id"),
|
|
32033
|
+
path3.call(print2, "init")
|
|
32034
|
+
]) : path3.call(print2, "id");
|
|
31875
32035
|
case "WithStatement":
|
|
31876
32036
|
return concat([
|
|
31877
32037
|
"with (",
|
|
31878
|
-
|
|
32038
|
+
path3.call(print2, "object"),
|
|
31879
32039
|
") ",
|
|
31880
|
-
|
|
32040
|
+
path3.call(print2, "body")
|
|
31881
32041
|
]);
|
|
31882
32042
|
case "IfStatement": {
|
|
31883
|
-
const con = adjustClause(
|
|
31884
|
-
parts.push("if (",
|
|
32043
|
+
const con = adjustClause(path3.call(print2, "consequent"), options);
|
|
32044
|
+
parts.push("if (", path3.call(print2, "test"), ")", con);
|
|
31885
32045
|
if (n2.alternate)
|
|
31886
32046
|
parts.push(
|
|
31887
32047
|
endsWithBrace(con) ? " else" : "\nelse",
|
|
31888
|
-
adjustClause(
|
|
32048
|
+
adjustClause(path3.call(print2, "alternate"), options)
|
|
31889
32049
|
);
|
|
31890
32050
|
return concat(parts);
|
|
31891
32051
|
}
|
|
31892
32052
|
case "ForStatement": {
|
|
31893
|
-
const init =
|
|
32053
|
+
const init = path3.call(print2, "init");
|
|
31894
32054
|
const sep = init.length > 1 ? ";\n" : "; ";
|
|
31895
32055
|
const forParen = "for (";
|
|
31896
|
-
const indented = fromString(sep).join([init,
|
|
32056
|
+
const indented = fromString(sep).join([init, path3.call(print2, "test"), path3.call(print2, "update")]).indentTail(forParen.length);
|
|
31897
32057
|
const head = concat([forParen, indented, ")"]);
|
|
31898
|
-
let clause = adjustClause(
|
|
32058
|
+
let clause = adjustClause(path3.call(print2, "body"), options);
|
|
31899
32059
|
parts.push(head);
|
|
31900
32060
|
if (head.length > 1) {
|
|
31901
32061
|
parts.push("\n");
|
|
@@ -31907,18 +32067,18 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31907
32067
|
case "WhileStatement":
|
|
31908
32068
|
return concat([
|
|
31909
32069
|
"while (",
|
|
31910
|
-
|
|
32070
|
+
path3.call(print2, "test"),
|
|
31911
32071
|
")",
|
|
31912
|
-
adjustClause(
|
|
32072
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31913
32073
|
]);
|
|
31914
32074
|
case "ForInStatement":
|
|
31915
32075
|
return concat([
|
|
31916
32076
|
n2.each ? "for each (" : "for (",
|
|
31917
|
-
|
|
32077
|
+
path3.call(print2, "left"),
|
|
31918
32078
|
" in ",
|
|
31919
|
-
|
|
32079
|
+
path3.call(print2, "right"),
|
|
31920
32080
|
")",
|
|
31921
|
-
adjustClause(
|
|
32081
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31922
32082
|
]);
|
|
31923
32083
|
case "ForOfStatement":
|
|
31924
32084
|
case "ForAwaitStatement":
|
|
@@ -31928,28 +32088,28 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31928
32088
|
}
|
|
31929
32089
|
parts.push(
|
|
31930
32090
|
"(",
|
|
31931
|
-
|
|
32091
|
+
path3.call(print2, "left"),
|
|
31932
32092
|
" of ",
|
|
31933
|
-
|
|
32093
|
+
path3.call(print2, "right"),
|
|
31934
32094
|
")",
|
|
31935
|
-
adjustClause(
|
|
32095
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31936
32096
|
);
|
|
31937
32097
|
return concat(parts);
|
|
31938
32098
|
case "DoWhileStatement": {
|
|
31939
32099
|
const doBody = concat([
|
|
31940
32100
|
"do",
|
|
31941
|
-
adjustClause(
|
|
32101
|
+
adjustClause(path3.call(print2, "body"), options)
|
|
31942
32102
|
]);
|
|
31943
32103
|
parts.push(doBody);
|
|
31944
32104
|
if (endsWithBrace(doBody))
|
|
31945
32105
|
parts.push(" while");
|
|
31946
32106
|
else
|
|
31947
32107
|
parts.push("\nwhile");
|
|
31948
|
-
parts.push(" (",
|
|
32108
|
+
parts.push(" (", path3.call(print2, "test"), ");");
|
|
31949
32109
|
return concat(parts);
|
|
31950
32110
|
}
|
|
31951
32111
|
case "DoExpression": {
|
|
31952
|
-
const statements =
|
|
32112
|
+
const statements = path3.call(
|
|
31953
32113
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
31954
32114
|
"body"
|
|
31955
32115
|
);
|
|
@@ -31958,66 +32118,66 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
31958
32118
|
case "BreakStatement":
|
|
31959
32119
|
parts.push("break");
|
|
31960
32120
|
if (n2.label)
|
|
31961
|
-
parts.push(" ",
|
|
32121
|
+
parts.push(" ", path3.call(print2, "label"));
|
|
31962
32122
|
parts.push(";");
|
|
31963
32123
|
return concat(parts);
|
|
31964
32124
|
case "ContinueStatement":
|
|
31965
32125
|
parts.push("continue");
|
|
31966
32126
|
if (n2.label)
|
|
31967
|
-
parts.push(" ",
|
|
32127
|
+
parts.push(" ", path3.call(print2, "label"));
|
|
31968
32128
|
parts.push(";");
|
|
31969
32129
|
return concat(parts);
|
|
31970
32130
|
case "LabeledStatement":
|
|
31971
32131
|
return concat([
|
|
31972
|
-
|
|
32132
|
+
path3.call(print2, "label"),
|
|
31973
32133
|
":\n",
|
|
31974
|
-
|
|
32134
|
+
path3.call(print2, "body")
|
|
31975
32135
|
]);
|
|
31976
32136
|
case "TryStatement":
|
|
31977
|
-
parts.push("try ",
|
|
32137
|
+
parts.push("try ", path3.call(print2, "block"));
|
|
31978
32138
|
if (n2.handler) {
|
|
31979
|
-
parts.push(" ",
|
|
32139
|
+
parts.push(" ", path3.call(print2, "handler"));
|
|
31980
32140
|
} else if (n2.handlers) {
|
|
31981
|
-
|
|
32141
|
+
path3.each(function(handlerPath) {
|
|
31982
32142
|
parts.push(" ", print2(handlerPath));
|
|
31983
32143
|
}, "handlers");
|
|
31984
32144
|
}
|
|
31985
32145
|
if (n2.finalizer) {
|
|
31986
|
-
parts.push(" finally ",
|
|
32146
|
+
parts.push(" finally ", path3.call(print2, "finalizer"));
|
|
31987
32147
|
}
|
|
31988
32148
|
return concat(parts);
|
|
31989
32149
|
case "CatchClause":
|
|
31990
32150
|
parts.push("catch ");
|
|
31991
32151
|
if (n2.param) {
|
|
31992
|
-
parts.push("(",
|
|
32152
|
+
parts.push("(", path3.call(print2, "param"));
|
|
31993
32153
|
}
|
|
31994
32154
|
if (n2.guard) {
|
|
31995
|
-
parts.push(" if ",
|
|
32155
|
+
parts.push(" if ", path3.call(print2, "guard"));
|
|
31996
32156
|
}
|
|
31997
32157
|
if (n2.param) {
|
|
31998
32158
|
parts.push(") ");
|
|
31999
32159
|
}
|
|
32000
|
-
parts.push(
|
|
32160
|
+
parts.push(path3.call(print2, "body"));
|
|
32001
32161
|
return concat(parts);
|
|
32002
32162
|
case "ThrowStatement":
|
|
32003
|
-
return concat(["throw ",
|
|
32163
|
+
return concat(["throw ", path3.call(print2, "argument"), ";"]);
|
|
32004
32164
|
case "SwitchStatement":
|
|
32005
32165
|
return concat([
|
|
32006
32166
|
"switch (",
|
|
32007
|
-
|
|
32167
|
+
path3.call(print2, "discriminant"),
|
|
32008
32168
|
") {\n",
|
|
32009
|
-
fromString("\n").join(
|
|
32169
|
+
fromString("\n").join(path3.map(print2, "cases")),
|
|
32010
32170
|
"\n}"
|
|
32011
32171
|
]);
|
|
32012
32172
|
case "SwitchCase":
|
|
32013
32173
|
if (n2.test)
|
|
32014
|
-
parts.push("case ",
|
|
32174
|
+
parts.push("case ", path3.call(print2, "test"), ":");
|
|
32015
32175
|
else
|
|
32016
32176
|
parts.push("default:");
|
|
32017
32177
|
if (n2.consequent.length > 0) {
|
|
32018
32178
|
parts.push(
|
|
32019
32179
|
"\n",
|
|
32020
|
-
|
|
32180
|
+
path3.call(
|
|
32021
32181
|
(consequentPath) => printStatementSequence(consequentPath, options, print2),
|
|
32022
32182
|
"consequent"
|
|
32023
32183
|
).indent(options.tabWidth)
|
|
@@ -32027,38 +32187,38 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32027
32187
|
case "DebuggerStatement":
|
|
32028
32188
|
return fromString("debugger;");
|
|
32029
32189
|
case "JSXAttribute":
|
|
32030
|
-
parts.push(
|
|
32190
|
+
parts.push(path3.call(print2, "name"));
|
|
32031
32191
|
if (n2.value)
|
|
32032
|
-
parts.push("=",
|
|
32192
|
+
parts.push("=", path3.call(print2, "value"));
|
|
32033
32193
|
return concat(parts);
|
|
32034
32194
|
case "JSXIdentifier":
|
|
32035
32195
|
return fromString(n2.name, options);
|
|
32036
32196
|
case "JSXNamespacedName":
|
|
32037
32197
|
return fromString(":").join([
|
|
32038
|
-
|
|
32039
|
-
|
|
32198
|
+
path3.call(print2, "namespace"),
|
|
32199
|
+
path3.call(print2, "name")
|
|
32040
32200
|
]);
|
|
32041
32201
|
case "JSXMemberExpression":
|
|
32042
32202
|
return fromString(".").join([
|
|
32043
|
-
|
|
32044
|
-
|
|
32203
|
+
path3.call(print2, "object"),
|
|
32204
|
+
path3.call(print2, "property")
|
|
32045
32205
|
]);
|
|
32046
32206
|
case "JSXSpreadAttribute":
|
|
32047
|
-
return concat(["{...",
|
|
32207
|
+
return concat(["{...", path3.call(print2, "argument"), "}"]);
|
|
32048
32208
|
case "JSXSpreadChild":
|
|
32049
|
-
return concat(["{...",
|
|
32209
|
+
return concat(["{...", path3.call(print2, "expression"), "}"]);
|
|
32050
32210
|
case "JSXExpressionContainer":
|
|
32051
|
-
return concat(["{",
|
|
32211
|
+
return concat(["{", path3.call(print2, "expression"), "}"]);
|
|
32052
32212
|
case "JSXElement":
|
|
32053
32213
|
case "JSXFragment": {
|
|
32054
32214
|
const openingPropName = "opening" + (n2.type === "JSXElement" ? "Element" : "Fragment");
|
|
32055
32215
|
const closingPropName = "closing" + (n2.type === "JSXElement" ? "Element" : "Fragment");
|
|
32056
|
-
const openingLines =
|
|
32216
|
+
const openingLines = path3.call(print2, openingPropName);
|
|
32057
32217
|
if (n2[openingPropName].selfClosing) {
|
|
32058
32218
|
return openingLines;
|
|
32059
32219
|
}
|
|
32060
32220
|
const childLines = concat(
|
|
32061
|
-
|
|
32221
|
+
path3.map(function(childPath) {
|
|
32062
32222
|
const child = childPath.getValue();
|
|
32063
32223
|
if (namedTypes.Literal.check(child) && typeof child.value === "string") {
|
|
32064
32224
|
if (/\S/.test(child.value)) {
|
|
@@ -32070,13 +32230,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32070
32230
|
return print2(childPath);
|
|
32071
32231
|
}, "children")
|
|
32072
32232
|
).indentTail(options.tabWidth);
|
|
32073
|
-
const closingLines =
|
|
32233
|
+
const closingLines = path3.call(print2, closingPropName);
|
|
32074
32234
|
return concat([openingLines, childLines, closingLines]);
|
|
32075
32235
|
}
|
|
32076
32236
|
case "JSXOpeningElement": {
|
|
32077
|
-
parts.push("<",
|
|
32237
|
+
parts.push("<", path3.call(print2, "name"));
|
|
32078
32238
|
const attrParts = [];
|
|
32079
|
-
|
|
32239
|
+
path3.each(function(attrPath) {
|
|
32080
32240
|
attrParts.push(" ", print2(attrPath));
|
|
32081
32241
|
}, "attributes");
|
|
32082
32242
|
let attrLines = concat(attrParts);
|
|
@@ -32093,7 +32253,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32093
32253
|
return concat(parts);
|
|
32094
32254
|
}
|
|
32095
32255
|
case "JSXClosingElement":
|
|
32096
|
-
return concat(["</",
|
|
32256
|
+
return concat(["</", path3.call(print2, "name"), ">"]);
|
|
32097
32257
|
case "JSXOpeningFragment":
|
|
32098
32258
|
return fromString("<>");
|
|
32099
32259
|
case "JSXClosingFragment":
|
|
@@ -32104,9 +32264,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32104
32264
|
return fromString("");
|
|
32105
32265
|
case "TypeAnnotatedIdentifier":
|
|
32106
32266
|
return concat([
|
|
32107
|
-
|
|
32267
|
+
path3.call(print2, "annotation"),
|
|
32108
32268
|
" ",
|
|
32109
|
-
|
|
32269
|
+
path3.call(print2, "identifier")
|
|
32110
32270
|
]);
|
|
32111
32271
|
case "ClassBody":
|
|
32112
32272
|
if (n2.body.length === 0) {
|
|
@@ -32114,14 +32274,14 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32114
32274
|
}
|
|
32115
32275
|
return concat([
|
|
32116
32276
|
"{\n",
|
|
32117
|
-
|
|
32277
|
+
path3.call(
|
|
32118
32278
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
32119
32279
|
"body"
|
|
32120
32280
|
).indent(options.tabWidth),
|
|
32121
32281
|
"\n}"
|
|
32122
32282
|
]);
|
|
32123
32283
|
case "ClassPropertyDefinition":
|
|
32124
|
-
parts.push("static ",
|
|
32284
|
+
parts.push("static ", path3.call(print2, "definition"));
|
|
32125
32285
|
if (!namedTypes.MethodDefinition.check(n2.definition))
|
|
32126
32286
|
parts.push(";");
|
|
32127
32287
|
return concat(parts);
|
|
@@ -32142,12 +32302,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32142
32302
|
if (n2.readonly) {
|
|
32143
32303
|
parts.push("readonly ");
|
|
32144
32304
|
}
|
|
32145
|
-
let key =
|
|
32305
|
+
let key = path3.call(print2, "key");
|
|
32146
32306
|
if (n2.computed) {
|
|
32147
32307
|
key = concat(["[", key, "]"]);
|
|
32148
32308
|
}
|
|
32149
32309
|
if (n2.variance) {
|
|
32150
|
-
key = concat([printVariance(
|
|
32310
|
+
key = concat([printVariance(path3, print2), key]);
|
|
32151
32311
|
}
|
|
32152
32312
|
parts.push(key);
|
|
32153
32313
|
if (n2.optional) {
|
|
@@ -32157,10 +32317,10 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32157
32317
|
parts.push("!");
|
|
32158
32318
|
}
|
|
32159
32319
|
if (n2.typeAnnotation) {
|
|
32160
|
-
parts.push(
|
|
32320
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32161
32321
|
}
|
|
32162
32322
|
if (n2.value) {
|
|
32163
|
-
parts.push(" = ",
|
|
32323
|
+
parts.push(" = ", path3.call(print2, "value"));
|
|
32164
32324
|
}
|
|
32165
32325
|
parts.push(";");
|
|
32166
32326
|
return concat(parts);
|
|
@@ -32169,12 +32329,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32169
32329
|
if (n2.static) {
|
|
32170
32330
|
parts.push("static ");
|
|
32171
32331
|
}
|
|
32172
|
-
parts.push(
|
|
32332
|
+
parts.push(path3.call(print2, "key"));
|
|
32173
32333
|
if (n2.typeAnnotation) {
|
|
32174
|
-
parts.push(
|
|
32334
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32175
32335
|
}
|
|
32176
32336
|
if (n2.value) {
|
|
32177
|
-
parts.push(" = ",
|
|
32337
|
+
parts.push(" = ", path3.call(print2, "value"));
|
|
32178
32338
|
}
|
|
32179
32339
|
parts.push(";");
|
|
32180
32340
|
return concat(parts);
|
|
@@ -32184,9 +32344,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32184
32344
|
"accessor "
|
|
32185
32345
|
);
|
|
32186
32346
|
if (n2.computed) {
|
|
32187
|
-
parts.push("[",
|
|
32347
|
+
parts.push("[", path3.call(print2, "key"), "]");
|
|
32188
32348
|
} else {
|
|
32189
|
-
parts.push(
|
|
32349
|
+
parts.push(path3.call(print2, "key"));
|
|
32190
32350
|
}
|
|
32191
32351
|
if (n2.optional) {
|
|
32192
32352
|
parts.push("?");
|
|
@@ -32195,10 +32355,10 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32195
32355
|
parts.push("!");
|
|
32196
32356
|
}
|
|
32197
32357
|
if (n2.typeAnnotation) {
|
|
32198
|
-
parts.push(
|
|
32358
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32199
32359
|
}
|
|
32200
32360
|
if (n2.value) {
|
|
32201
|
-
parts.push(" = ",
|
|
32361
|
+
parts.push(" = ", path3.call(print2, "value"));
|
|
32202
32362
|
}
|
|
32203
32363
|
parts.push(";");
|
|
32204
32364
|
return concat(parts);
|
|
@@ -32214,42 +32374,42 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32214
32374
|
}
|
|
32215
32375
|
parts.push("class");
|
|
32216
32376
|
if (n2.id) {
|
|
32217
|
-
parts.push(" ",
|
|
32377
|
+
parts.push(" ", path3.call(print2, "id"));
|
|
32218
32378
|
}
|
|
32219
32379
|
if (n2.typeParameters) {
|
|
32220
|
-
parts.push(
|
|
32380
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
32221
32381
|
}
|
|
32222
32382
|
if (n2.superClass) {
|
|
32223
32383
|
parts.push(
|
|
32224
32384
|
" extends ",
|
|
32225
|
-
|
|
32226
|
-
|
|
32385
|
+
path3.call(print2, "superClass"),
|
|
32386
|
+
path3.call(print2, "superTypeParameters")
|
|
32227
32387
|
);
|
|
32228
32388
|
}
|
|
32229
32389
|
if (n2.extends && n2.extends.length > 0) {
|
|
32230
32390
|
parts.push(
|
|
32231
32391
|
" extends ",
|
|
32232
|
-
fromString(", ").join(
|
|
32392
|
+
fromString(", ").join(path3.map(print2, "extends"))
|
|
32233
32393
|
);
|
|
32234
32394
|
}
|
|
32235
32395
|
if (n2["implements"] && n2["implements"].length > 0) {
|
|
32236
32396
|
parts.push(
|
|
32237
32397
|
" implements ",
|
|
32238
|
-
fromString(", ").join(
|
|
32398
|
+
fromString(", ").join(path3.map(print2, "implements"))
|
|
32239
32399
|
);
|
|
32240
32400
|
}
|
|
32241
|
-
parts.push(" ",
|
|
32401
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
32242
32402
|
if (n2.type === "DeclareClass") {
|
|
32243
|
-
return printFlowDeclaration(
|
|
32403
|
+
return printFlowDeclaration(path3, parts);
|
|
32244
32404
|
} else {
|
|
32245
32405
|
return concat(parts);
|
|
32246
32406
|
}
|
|
32247
32407
|
case "TemplateElement":
|
|
32248
32408
|
return fromString(n2.value.raw, options).lockIndentTail();
|
|
32249
32409
|
case "TemplateLiteral": {
|
|
32250
|
-
const expressions =
|
|
32410
|
+
const expressions = path3.map(print2, "expressions");
|
|
32251
32411
|
parts.push("`");
|
|
32252
|
-
|
|
32412
|
+
path3.each(function(childPath) {
|
|
32253
32413
|
const i = childPath.getName();
|
|
32254
32414
|
parts.push(print2(childPath));
|
|
32255
32415
|
if (i < expressions.length) {
|
|
@@ -32260,7 +32420,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32260
32420
|
return concat(parts).lockIndentTail();
|
|
32261
32421
|
}
|
|
32262
32422
|
case "TaggedTemplateExpression":
|
|
32263
|
-
return concat([
|
|
32423
|
+
return concat([path3.call(print2, "tag"), path3.call(print2, "quasi")]);
|
|
32264
32424
|
case "Node":
|
|
32265
32425
|
case "Printable":
|
|
32266
32426
|
case "SourceLocation":
|
|
@@ -32294,7 +32454,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32294
32454
|
if (n2.typeAnnotation.type !== "FunctionTypeAnnotation") {
|
|
32295
32455
|
parts.push(": ");
|
|
32296
32456
|
}
|
|
32297
|
-
parts.push(
|
|
32457
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32298
32458
|
return concat(parts);
|
|
32299
32459
|
}
|
|
32300
32460
|
return fromString("");
|
|
@@ -32308,9 +32468,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32308
32468
|
case "MixedTypeAnnotation":
|
|
32309
32469
|
return fromString("mixed", options);
|
|
32310
32470
|
case "ArrayTypeAnnotation":
|
|
32311
|
-
return concat([
|
|
32471
|
+
return concat([path3.call(print2, "elementType"), "[]"]);
|
|
32312
32472
|
case "TupleTypeAnnotation": {
|
|
32313
|
-
const printed =
|
|
32473
|
+
const printed = path3.map(print2, "types");
|
|
32314
32474
|
const joined = fromString(", ").join(printed);
|
|
32315
32475
|
const oneLine = joined.getLineLength(1) <= options.wrapColumn;
|
|
32316
32476
|
if (oneLine) {
|
|
@@ -32322,7 +32482,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32322
32482
|
} else {
|
|
32323
32483
|
parts.push("[\n");
|
|
32324
32484
|
}
|
|
32325
|
-
|
|
32485
|
+
path3.each(function(elemPath) {
|
|
32326
32486
|
const i = elemPath.getName();
|
|
32327
32487
|
const elem = elemPath.getValue();
|
|
32328
32488
|
if (!elem) {
|
|
@@ -32358,39 +32518,39 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32358
32518
|
if (n2.extends && n2.extends.length > 0) {
|
|
32359
32519
|
parts.push(
|
|
32360
32520
|
" extends ",
|
|
32361
|
-
fromString(", ").join(
|
|
32521
|
+
fromString(", ").join(path3.map(print2, "extends"))
|
|
32362
32522
|
);
|
|
32363
32523
|
}
|
|
32364
|
-
parts.push(" ",
|
|
32524
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
32365
32525
|
return concat(parts);
|
|
32366
32526
|
case "DeclareFunction":
|
|
32367
|
-
return printFlowDeclaration(
|
|
32527
|
+
return printFlowDeclaration(path3, [
|
|
32368
32528
|
"function ",
|
|
32369
|
-
|
|
32529
|
+
path3.call(print2, "id"),
|
|
32370
32530
|
";"
|
|
32371
32531
|
]);
|
|
32372
32532
|
case "DeclareModule":
|
|
32373
|
-
return printFlowDeclaration(
|
|
32533
|
+
return printFlowDeclaration(path3, [
|
|
32374
32534
|
"module ",
|
|
32375
|
-
|
|
32535
|
+
path3.call(print2, "id"),
|
|
32376
32536
|
" ",
|
|
32377
|
-
|
|
32537
|
+
path3.call(print2, "body")
|
|
32378
32538
|
]);
|
|
32379
32539
|
case "DeclareModuleExports":
|
|
32380
|
-
return printFlowDeclaration(
|
|
32540
|
+
return printFlowDeclaration(path3, [
|
|
32381
32541
|
"module.exports",
|
|
32382
|
-
|
|
32542
|
+
path3.call(print2, "typeAnnotation")
|
|
32383
32543
|
]);
|
|
32384
32544
|
case "DeclareVariable":
|
|
32385
|
-
return printFlowDeclaration(
|
|
32545
|
+
return printFlowDeclaration(path3, ["var ", path3.call(print2, "id"), ";"]);
|
|
32386
32546
|
case "DeclareExportDeclaration":
|
|
32387
32547
|
case "DeclareExportAllDeclaration":
|
|
32388
|
-
return concat(["declare ", printExportDeclaration(
|
|
32548
|
+
return concat(["declare ", printExportDeclaration(path3, options, print2)]);
|
|
32389
32549
|
case "EnumDeclaration":
|
|
32390
32550
|
return concat([
|
|
32391
32551
|
"enum ",
|
|
32392
|
-
|
|
32393
|
-
|
|
32552
|
+
path3.call(print2, "id"),
|
|
32553
|
+
path3.call(print2, "body")
|
|
32394
32554
|
]);
|
|
32395
32555
|
case "EnumBooleanBody":
|
|
32396
32556
|
case "EnumNumberBody":
|
|
@@ -32405,29 +32565,29 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32405
32565
|
}
|
|
32406
32566
|
parts.push(
|
|
32407
32567
|
" {\n",
|
|
32408
|
-
fromString("\n").join(
|
|
32568
|
+
fromString("\n").join(path3.map(print2, "members")).indent(options.tabWidth),
|
|
32409
32569
|
"\n}"
|
|
32410
32570
|
);
|
|
32411
32571
|
return concat(parts);
|
|
32412
32572
|
}
|
|
32413
32573
|
case "EnumDefaultedMember":
|
|
32414
|
-
return concat([
|
|
32574
|
+
return concat([path3.call(print2, "id"), ","]);
|
|
32415
32575
|
case "EnumBooleanMember":
|
|
32416
32576
|
case "EnumNumberMember":
|
|
32417
32577
|
case "EnumStringMember":
|
|
32418
32578
|
return concat([
|
|
32419
|
-
|
|
32579
|
+
path3.call(print2, "id"),
|
|
32420
32580
|
" = ",
|
|
32421
|
-
|
|
32581
|
+
path3.call(print2, "init"),
|
|
32422
32582
|
","
|
|
32423
32583
|
]);
|
|
32424
32584
|
case "InferredPredicate":
|
|
32425
32585
|
return fromString("%checks", options);
|
|
32426
32586
|
case "DeclaredPredicate":
|
|
32427
|
-
return concat(["%checks(",
|
|
32587
|
+
return concat(["%checks(", path3.call(print2, "value"), ")"]);
|
|
32428
32588
|
case "FunctionTypeAnnotation": {
|
|
32429
|
-
const parent =
|
|
32430
|
-
const isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) || namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method || namedTypes.DeclareFunction.check(
|
|
32589
|
+
const parent = path3.getParentNode(0);
|
|
32590
|
+
const isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) || namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method || namedTypes.DeclareFunction.check(path3.getParentNode(2)));
|
|
32431
32591
|
const needsColon = isArrowFunctionTypeAnnotation && !namedTypes.FunctionTypeParam.check(parent) && !namedTypes.TypeAlias.check(parent);
|
|
32432
32592
|
if (needsColon) {
|
|
32433
32593
|
parts.push(": ");
|
|
@@ -32435,21 +32595,21 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32435
32595
|
const hasTypeParameters = !!n2.typeParameters;
|
|
32436
32596
|
const needsParens = hasTypeParameters || n2.params.length !== 1 || n2.params[0].name;
|
|
32437
32597
|
parts.push(
|
|
32438
|
-
hasTypeParameters ?
|
|
32598
|
+
hasTypeParameters ? path3.call(print2, "typeParameters") : "",
|
|
32439
32599
|
needsParens ? "(" : "",
|
|
32440
|
-
printFunctionParams(
|
|
32600
|
+
printFunctionParams(path3, options, print2),
|
|
32441
32601
|
needsParens ? ")" : ""
|
|
32442
32602
|
);
|
|
32443
32603
|
if (n2.returnType) {
|
|
32444
32604
|
parts.push(
|
|
32445
32605
|
isArrowFunctionTypeAnnotation ? " => " : ": ",
|
|
32446
|
-
|
|
32606
|
+
path3.call(print2, "returnType")
|
|
32447
32607
|
);
|
|
32448
32608
|
}
|
|
32449
32609
|
return concat(parts);
|
|
32450
32610
|
}
|
|
32451
32611
|
case "FunctionTypeParam": {
|
|
32452
|
-
const name =
|
|
32612
|
+
const name = path3.call(print2, "name");
|
|
32453
32613
|
parts.push(name);
|
|
32454
32614
|
if (n2.optional) {
|
|
32455
32615
|
parts.push("?");
|
|
@@ -32457,13 +32617,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32457
32617
|
if (name.infos[0].line) {
|
|
32458
32618
|
parts.push(": ");
|
|
32459
32619
|
}
|
|
32460
|
-
parts.push(
|
|
32620
|
+
parts.push(path3.call(print2, "typeAnnotation"));
|
|
32461
32621
|
return concat(parts);
|
|
32462
32622
|
}
|
|
32463
32623
|
case "GenericTypeAnnotation":
|
|
32464
32624
|
return concat([
|
|
32465
|
-
|
|
32466
|
-
|
|
32625
|
+
path3.call(print2, "id"),
|
|
32626
|
+
path3.call(print2, "typeParameters")
|
|
32467
32627
|
]);
|
|
32468
32628
|
case "DeclareInterface":
|
|
32469
32629
|
parts.push("declare ");
|
|
@@ -32474,31 +32634,31 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32474
32634
|
}
|
|
32475
32635
|
parts.push(
|
|
32476
32636
|
"interface ",
|
|
32477
|
-
|
|
32478
|
-
|
|
32637
|
+
path3.call(print2, "id"),
|
|
32638
|
+
path3.call(print2, "typeParameters"),
|
|
32479
32639
|
" "
|
|
32480
32640
|
);
|
|
32481
32641
|
if (n2["extends"] && n2["extends"].length > 0) {
|
|
32482
32642
|
parts.push(
|
|
32483
32643
|
"extends ",
|
|
32484
|
-
fromString(", ").join(
|
|
32644
|
+
fromString(", ").join(path3.map(print2, "extends")),
|
|
32485
32645
|
" "
|
|
32486
32646
|
);
|
|
32487
32647
|
}
|
|
32488
32648
|
if (n2.body) {
|
|
32489
|
-
parts.push(
|
|
32649
|
+
parts.push(path3.call(print2, "body"));
|
|
32490
32650
|
}
|
|
32491
32651
|
return concat(parts);
|
|
32492
32652
|
case "ClassImplements":
|
|
32493
32653
|
case "InterfaceExtends":
|
|
32494
32654
|
return concat([
|
|
32495
|
-
|
|
32496
|
-
|
|
32655
|
+
path3.call(print2, "id"),
|
|
32656
|
+
path3.call(print2, "typeParameters")
|
|
32497
32657
|
]);
|
|
32498
32658
|
case "IntersectionTypeAnnotation":
|
|
32499
|
-
return fromString(" & ").join(
|
|
32659
|
+
return fromString(" & ").join(path3.map(print2, "types"));
|
|
32500
32660
|
case "NullableTypeAnnotation":
|
|
32501
|
-
return concat(["?",
|
|
32661
|
+
return concat(["?", path3.call(print2, "typeAnnotation")]);
|
|
32502
32662
|
case "NullLiteralTypeAnnotation":
|
|
32503
32663
|
return fromString("null", options);
|
|
32504
32664
|
case "ThisTypeAnnotation":
|
|
@@ -32506,40 +32666,40 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32506
32666
|
case "NumberTypeAnnotation":
|
|
32507
32667
|
return fromString("number", options);
|
|
32508
32668
|
case "ObjectTypeCallProperty":
|
|
32509
|
-
return
|
|
32669
|
+
return path3.call(print2, "value");
|
|
32510
32670
|
case "ObjectTypeIndexer":
|
|
32511
32671
|
if (n2.static) {
|
|
32512
32672
|
parts.push("static ");
|
|
32513
32673
|
}
|
|
32514
|
-
parts.push(printVariance(
|
|
32674
|
+
parts.push(printVariance(path3, print2), "[");
|
|
32515
32675
|
if (n2.id) {
|
|
32516
|
-
parts.push(
|
|
32676
|
+
parts.push(path3.call(print2, "id"), ": ");
|
|
32517
32677
|
}
|
|
32518
|
-
parts.push(
|
|
32678
|
+
parts.push(path3.call(print2, "key"), "]: ", path3.call(print2, "value"));
|
|
32519
32679
|
return concat(parts);
|
|
32520
32680
|
case "ObjectTypeProperty":
|
|
32521
32681
|
return concat([
|
|
32522
|
-
printVariance(
|
|
32523
|
-
|
|
32682
|
+
printVariance(path3, print2),
|
|
32683
|
+
path3.call(print2, "key"),
|
|
32524
32684
|
n2.optional ? "?" : "",
|
|
32525
32685
|
": ",
|
|
32526
|
-
|
|
32686
|
+
path3.call(print2, "value")
|
|
32527
32687
|
]);
|
|
32528
32688
|
case "ObjectTypeInternalSlot":
|
|
32529
32689
|
return concat([
|
|
32530
32690
|
n2.static ? "static " : "",
|
|
32531
32691
|
"[[",
|
|
32532
|
-
|
|
32692
|
+
path3.call(print2, "id"),
|
|
32533
32693
|
"]]",
|
|
32534
32694
|
n2.optional ? "?" : "",
|
|
32535
32695
|
n2.value.type !== "FunctionTypeAnnotation" ? ": " : "",
|
|
32536
|
-
|
|
32696
|
+
path3.call(print2, "value")
|
|
32537
32697
|
]);
|
|
32538
32698
|
case "QualifiedTypeIdentifier":
|
|
32539
32699
|
return concat([
|
|
32540
|
-
|
|
32700
|
+
path3.call(print2, "qualification"),
|
|
32541
32701
|
".",
|
|
32542
|
-
|
|
32702
|
+
path3.call(print2, "id")
|
|
32543
32703
|
]);
|
|
32544
32704
|
case "StringLiteralTypeAnnotation":
|
|
32545
32705
|
return fromString(nodeStr(n2.value, options), options);
|
|
@@ -32555,10 +32715,10 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32555
32715
|
case "TypeAlias":
|
|
32556
32716
|
return concat([
|
|
32557
32717
|
"type ",
|
|
32558
|
-
|
|
32559
|
-
|
|
32718
|
+
path3.call(print2, "id"),
|
|
32719
|
+
path3.call(print2, "typeParameters"),
|
|
32560
32720
|
" = ",
|
|
32561
|
-
|
|
32721
|
+
path3.call(print2, "right"),
|
|
32562
32722
|
";"
|
|
32563
32723
|
]);
|
|
32564
32724
|
case "DeclareOpaqueType":
|
|
@@ -32566,29 +32726,29 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32566
32726
|
case "OpaqueType":
|
|
32567
32727
|
parts.push(
|
|
32568
32728
|
"opaque type ",
|
|
32569
|
-
|
|
32570
|
-
|
|
32729
|
+
path3.call(print2, "id"),
|
|
32730
|
+
path3.call(print2, "typeParameters")
|
|
32571
32731
|
);
|
|
32572
32732
|
if (n2["supertype"]) {
|
|
32573
|
-
parts.push(": ",
|
|
32733
|
+
parts.push(": ", path3.call(print2, "supertype"));
|
|
32574
32734
|
}
|
|
32575
32735
|
if (n2["impltype"]) {
|
|
32576
|
-
parts.push(" = ",
|
|
32736
|
+
parts.push(" = ", path3.call(print2, "impltype"));
|
|
32577
32737
|
}
|
|
32578
32738
|
parts.push(";");
|
|
32579
32739
|
return concat(parts);
|
|
32580
32740
|
case "TypeCastExpression":
|
|
32581
32741
|
return concat([
|
|
32582
32742
|
"(",
|
|
32583
|
-
|
|
32584
|
-
|
|
32743
|
+
path3.call(print2, "expression"),
|
|
32744
|
+
path3.call(print2, "typeAnnotation"),
|
|
32585
32745
|
")"
|
|
32586
32746
|
]);
|
|
32587
32747
|
case "TypeParameterDeclaration":
|
|
32588
32748
|
case "TypeParameterInstantiation":
|
|
32589
32749
|
return concat([
|
|
32590
32750
|
"<",
|
|
32591
|
-
fromString(", ").join(
|
|
32751
|
+
fromString(", ").join(path3.map(print2, "params")),
|
|
32592
32752
|
">"
|
|
32593
32753
|
]);
|
|
32594
32754
|
case "Variance":
|
|
@@ -32601,32 +32761,32 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32601
32761
|
return fromString("");
|
|
32602
32762
|
case "TypeParameter":
|
|
32603
32763
|
if (n2.variance) {
|
|
32604
|
-
parts.push(printVariance(
|
|
32764
|
+
parts.push(printVariance(path3, print2));
|
|
32605
32765
|
}
|
|
32606
|
-
parts.push(
|
|
32766
|
+
parts.push(path3.call(print2, "name"));
|
|
32607
32767
|
if (n2.bound) {
|
|
32608
|
-
parts.push(
|
|
32768
|
+
parts.push(path3.call(print2, "bound"));
|
|
32609
32769
|
}
|
|
32610
32770
|
if (n2["default"]) {
|
|
32611
|
-
parts.push("=",
|
|
32771
|
+
parts.push("=", path3.call(print2, "default"));
|
|
32612
32772
|
}
|
|
32613
32773
|
return concat(parts);
|
|
32614
32774
|
case "TypeofTypeAnnotation":
|
|
32615
32775
|
return concat([
|
|
32616
32776
|
fromString("typeof ", options),
|
|
32617
|
-
|
|
32777
|
+
path3.call(print2, "argument")
|
|
32618
32778
|
]);
|
|
32619
32779
|
case "IndexedAccessType":
|
|
32620
32780
|
case "OptionalIndexedAccessType":
|
|
32621
32781
|
return concat([
|
|
32622
|
-
|
|
32782
|
+
path3.call(print2, "objectType"),
|
|
32623
32783
|
n2.optional ? "?." : "",
|
|
32624
32784
|
"[",
|
|
32625
|
-
|
|
32785
|
+
path3.call(print2, "indexType"),
|
|
32626
32786
|
"]"
|
|
32627
32787
|
]);
|
|
32628
32788
|
case "UnionTypeAnnotation":
|
|
32629
|
-
return fromString(" | ").join(
|
|
32789
|
+
return fromString(" | ").join(path3.map(print2, "types"));
|
|
32630
32790
|
case "VoidTypeAnnotation":
|
|
32631
32791
|
return fromString("void", options);
|
|
32632
32792
|
case "NullTypeAnnotation":
|
|
@@ -32666,92 +32826,92 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32666
32826
|
case "TSNeverKeyword":
|
|
32667
32827
|
return fromString("never", options);
|
|
32668
32828
|
case "TSArrayType":
|
|
32669
|
-
return concat([
|
|
32829
|
+
return concat([path3.call(print2, "elementType"), "[]"]);
|
|
32670
32830
|
case "TSLiteralType":
|
|
32671
|
-
return
|
|
32831
|
+
return path3.call(print2, "literal");
|
|
32672
32832
|
case "TSUnionType":
|
|
32673
|
-
return fromString(" | ").join(
|
|
32833
|
+
return fromString(" | ").join(path3.map(print2, "types"));
|
|
32674
32834
|
case "TSIntersectionType":
|
|
32675
|
-
return fromString(" & ").join(
|
|
32835
|
+
return fromString(" & ").join(path3.map(print2, "types"));
|
|
32676
32836
|
case "TSConditionalType":
|
|
32677
32837
|
parts.push(
|
|
32678
|
-
|
|
32838
|
+
path3.call(print2, "checkType"),
|
|
32679
32839
|
" extends ",
|
|
32680
|
-
|
|
32840
|
+
path3.call(print2, "extendsType"),
|
|
32681
32841
|
" ? ",
|
|
32682
|
-
|
|
32842
|
+
path3.call(print2, "trueType"),
|
|
32683
32843
|
" : ",
|
|
32684
|
-
|
|
32844
|
+
path3.call(print2, "falseType")
|
|
32685
32845
|
);
|
|
32686
32846
|
return concat(parts);
|
|
32687
32847
|
case "TSInferType":
|
|
32688
|
-
parts.push("infer ",
|
|
32848
|
+
parts.push("infer ", path3.call(print2, "typeParameter"));
|
|
32689
32849
|
return concat(parts);
|
|
32690
32850
|
case "TSParenthesizedType":
|
|
32691
|
-
return concat(["(",
|
|
32851
|
+
return concat(["(", path3.call(print2, "typeAnnotation"), ")"]);
|
|
32692
32852
|
case "TSFunctionType":
|
|
32693
32853
|
return concat([
|
|
32694
|
-
|
|
32854
|
+
path3.call(print2, "typeParameters"),
|
|
32695
32855
|
"(",
|
|
32696
|
-
printFunctionParams(
|
|
32856
|
+
printFunctionParams(path3, options, print2),
|
|
32697
32857
|
") => ",
|
|
32698
|
-
|
|
32858
|
+
path3.call(print2, "typeAnnotation", "typeAnnotation")
|
|
32699
32859
|
]);
|
|
32700
32860
|
case "TSConstructorType":
|
|
32701
32861
|
return concat([
|
|
32702
32862
|
"new ",
|
|
32703
|
-
|
|
32863
|
+
path3.call(print2, "typeParameters"),
|
|
32704
32864
|
"(",
|
|
32705
|
-
printFunctionParams(
|
|
32865
|
+
printFunctionParams(path3, options, print2),
|
|
32706
32866
|
") => ",
|
|
32707
|
-
|
|
32867
|
+
path3.call(print2, "typeAnnotation", "typeAnnotation")
|
|
32708
32868
|
]);
|
|
32709
32869
|
case "TSMappedType": {
|
|
32710
32870
|
parts.push(
|
|
32711
32871
|
n2.readonly ? "readonly " : "",
|
|
32712
32872
|
"[",
|
|
32713
|
-
|
|
32873
|
+
path3.call(print2, "typeParameter"),
|
|
32714
32874
|
"]",
|
|
32715
32875
|
n2.optional ? "?" : ""
|
|
32716
32876
|
);
|
|
32717
32877
|
if (n2.typeAnnotation) {
|
|
32718
|
-
parts.push(": ",
|
|
32878
|
+
parts.push(": ", path3.call(print2, "typeAnnotation"), ";");
|
|
32719
32879
|
}
|
|
32720
32880
|
return concat(["{\n", concat(parts).indent(options.tabWidth), "\n}"]);
|
|
32721
32881
|
}
|
|
32722
32882
|
case "TSTupleType":
|
|
32723
32883
|
return concat([
|
|
32724
32884
|
"[",
|
|
32725
|
-
fromString(", ").join(
|
|
32885
|
+
fromString(", ").join(path3.map(print2, "elementTypes")),
|
|
32726
32886
|
"]"
|
|
32727
32887
|
]);
|
|
32728
32888
|
case "TSNamedTupleMember":
|
|
32729
|
-
parts.push(
|
|
32889
|
+
parts.push(path3.call(print2, "label"));
|
|
32730
32890
|
if (n2.optional) {
|
|
32731
32891
|
parts.push("?");
|
|
32732
32892
|
}
|
|
32733
|
-
parts.push(": ",
|
|
32893
|
+
parts.push(": ", path3.call(print2, "elementType"));
|
|
32734
32894
|
return concat(parts);
|
|
32735
32895
|
case "TSRestType":
|
|
32736
|
-
return concat(["...",
|
|
32896
|
+
return concat(["...", path3.call(print2, "typeAnnotation")]);
|
|
32737
32897
|
case "TSOptionalType":
|
|
32738
|
-
return concat([
|
|
32898
|
+
return concat([path3.call(print2, "typeAnnotation"), "?"]);
|
|
32739
32899
|
case "TSIndexedAccessType":
|
|
32740
32900
|
return concat([
|
|
32741
|
-
|
|
32901
|
+
path3.call(print2, "objectType"),
|
|
32742
32902
|
"[",
|
|
32743
|
-
|
|
32903
|
+
path3.call(print2, "indexType"),
|
|
32744
32904
|
"]"
|
|
32745
32905
|
]);
|
|
32746
32906
|
case "TSTypeOperator":
|
|
32747
32907
|
return concat([
|
|
32748
|
-
|
|
32908
|
+
path3.call(print2, "operator"),
|
|
32749
32909
|
" ",
|
|
32750
|
-
|
|
32910
|
+
path3.call(print2, "typeAnnotation")
|
|
32751
32911
|
]);
|
|
32752
32912
|
case "TSTypeLiteral": {
|
|
32753
32913
|
const members = fromString("\n").join(
|
|
32754
|
-
|
|
32914
|
+
path3.map(print2, "members").map((member) => {
|
|
32755
32915
|
if (lastNonSpaceCharacter(member) !== ";") {
|
|
32756
32916
|
return member.concat(";");
|
|
32757
32917
|
}
|
|
@@ -32765,13 +32925,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32765
32925
|
return concat(parts);
|
|
32766
32926
|
}
|
|
32767
32927
|
case "TSEnumMember":
|
|
32768
|
-
parts.push(
|
|
32928
|
+
parts.push(path3.call(print2, "id"));
|
|
32769
32929
|
if (n2.initializer) {
|
|
32770
|
-
parts.push(" = ",
|
|
32930
|
+
parts.push(" = ", path3.call(print2, "initializer"));
|
|
32771
32931
|
}
|
|
32772
32932
|
return concat(parts);
|
|
32773
32933
|
case "TSTypeQuery":
|
|
32774
|
-
return concat(["typeof ",
|
|
32934
|
+
return concat(["typeof ", path3.call(print2, "exprName")]);
|
|
32775
32935
|
case "TSParameterProperty":
|
|
32776
32936
|
if (n2.accessibility) {
|
|
32777
32937
|
parts.push(n2.accessibility, " ");
|
|
@@ -32785,132 +32945,132 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32785
32945
|
if (n2.readonly) {
|
|
32786
32946
|
parts.push("readonly ");
|
|
32787
32947
|
}
|
|
32788
|
-
parts.push(
|
|
32948
|
+
parts.push(path3.call(print2, "parameter"));
|
|
32789
32949
|
return concat(parts);
|
|
32790
32950
|
case "TSTypeReference":
|
|
32791
32951
|
return concat([
|
|
32792
|
-
|
|
32793
|
-
|
|
32952
|
+
path3.call(print2, "typeName"),
|
|
32953
|
+
path3.call(print2, "typeParameters")
|
|
32794
32954
|
]);
|
|
32795
32955
|
case "TSQualifiedName":
|
|
32796
|
-
return concat([
|
|
32956
|
+
return concat([path3.call(print2, "left"), ".", path3.call(print2, "right")]);
|
|
32797
32957
|
case "TSAsExpression":
|
|
32798
32958
|
case "TSSatisfiesExpression": {
|
|
32799
|
-
const expression =
|
|
32959
|
+
const expression = path3.call(print2, "expression");
|
|
32800
32960
|
parts.push(
|
|
32801
32961
|
expression,
|
|
32802
32962
|
n2.type === "TSSatisfiesExpression" ? " satisfies " : " as ",
|
|
32803
|
-
|
|
32963
|
+
path3.call(print2, "typeAnnotation")
|
|
32804
32964
|
);
|
|
32805
32965
|
return concat(parts);
|
|
32806
32966
|
}
|
|
32807
32967
|
case "TSTypeCastExpression":
|
|
32808
32968
|
return concat([
|
|
32809
|
-
|
|
32810
|
-
|
|
32969
|
+
path3.call(print2, "expression"),
|
|
32970
|
+
path3.call(print2, "typeAnnotation")
|
|
32811
32971
|
]);
|
|
32812
32972
|
case "TSNonNullExpression":
|
|
32813
|
-
return concat([
|
|
32973
|
+
return concat([path3.call(print2, "expression"), "!"]);
|
|
32814
32974
|
case "TSTypeAnnotation":
|
|
32815
|
-
return concat([": ",
|
|
32975
|
+
return concat([": ", path3.call(print2, "typeAnnotation")]);
|
|
32816
32976
|
case "TSIndexSignature":
|
|
32817
32977
|
return concat([
|
|
32818
32978
|
n2.readonly ? "readonly " : "",
|
|
32819
32979
|
"[",
|
|
32820
|
-
|
|
32980
|
+
path3.map(print2, "parameters"),
|
|
32821
32981
|
"]",
|
|
32822
|
-
|
|
32982
|
+
path3.call(print2, "typeAnnotation")
|
|
32823
32983
|
]);
|
|
32824
32984
|
case "TSPropertySignature":
|
|
32825
|
-
parts.push(printVariance(
|
|
32985
|
+
parts.push(printVariance(path3, print2), n2.readonly ? "readonly " : "");
|
|
32826
32986
|
if (n2.computed) {
|
|
32827
|
-
parts.push("[",
|
|
32987
|
+
parts.push("[", path3.call(print2, "key"), "]");
|
|
32828
32988
|
} else {
|
|
32829
|
-
parts.push(
|
|
32989
|
+
parts.push(path3.call(print2, "key"));
|
|
32830
32990
|
}
|
|
32831
|
-
parts.push(n2.optional ? "?" : "",
|
|
32991
|
+
parts.push(n2.optional ? "?" : "", path3.call(print2, "typeAnnotation"));
|
|
32832
32992
|
return concat(parts);
|
|
32833
32993
|
case "TSMethodSignature":
|
|
32834
32994
|
if (n2.computed) {
|
|
32835
|
-
parts.push("[",
|
|
32995
|
+
parts.push("[", path3.call(print2, "key"), "]");
|
|
32836
32996
|
} else {
|
|
32837
|
-
parts.push(
|
|
32997
|
+
parts.push(path3.call(print2, "key"));
|
|
32838
32998
|
}
|
|
32839
32999
|
if (n2.optional) {
|
|
32840
33000
|
parts.push("?");
|
|
32841
33001
|
}
|
|
32842
33002
|
parts.push(
|
|
32843
|
-
|
|
33003
|
+
path3.call(print2, "typeParameters"),
|
|
32844
33004
|
"(",
|
|
32845
|
-
printFunctionParams(
|
|
33005
|
+
printFunctionParams(path3, options, print2),
|
|
32846
33006
|
")",
|
|
32847
|
-
|
|
33007
|
+
path3.call(print2, "typeAnnotation")
|
|
32848
33008
|
);
|
|
32849
33009
|
return concat(parts);
|
|
32850
33010
|
case "TSTypePredicate":
|
|
32851
33011
|
if (n2.asserts) {
|
|
32852
33012
|
parts.push("asserts ");
|
|
32853
33013
|
}
|
|
32854
|
-
parts.push(
|
|
33014
|
+
parts.push(path3.call(print2, "parameterName"));
|
|
32855
33015
|
if (n2.typeAnnotation) {
|
|
32856
33016
|
parts.push(
|
|
32857
33017
|
" is ",
|
|
32858
|
-
|
|
33018
|
+
path3.call(print2, "typeAnnotation", "typeAnnotation")
|
|
32859
33019
|
);
|
|
32860
33020
|
}
|
|
32861
33021
|
return concat(parts);
|
|
32862
33022
|
case "TSCallSignatureDeclaration":
|
|
32863
33023
|
return concat([
|
|
32864
|
-
|
|
33024
|
+
path3.call(print2, "typeParameters"),
|
|
32865
33025
|
"(",
|
|
32866
|
-
printFunctionParams(
|
|
33026
|
+
printFunctionParams(path3, options, print2),
|
|
32867
33027
|
")",
|
|
32868
|
-
|
|
33028
|
+
path3.call(print2, "typeAnnotation")
|
|
32869
33029
|
]);
|
|
32870
33030
|
case "TSConstructSignatureDeclaration":
|
|
32871
33031
|
if (n2.typeParameters) {
|
|
32872
|
-
parts.push("new",
|
|
33032
|
+
parts.push("new", path3.call(print2, "typeParameters"));
|
|
32873
33033
|
} else {
|
|
32874
33034
|
parts.push("new ");
|
|
32875
33035
|
}
|
|
32876
33036
|
parts.push(
|
|
32877
33037
|
"(",
|
|
32878
|
-
printFunctionParams(
|
|
33038
|
+
printFunctionParams(path3, options, print2),
|
|
32879
33039
|
")",
|
|
32880
|
-
|
|
33040
|
+
path3.call(print2, "typeAnnotation")
|
|
32881
33041
|
);
|
|
32882
33042
|
return concat(parts);
|
|
32883
33043
|
case "TSTypeAliasDeclaration":
|
|
32884
33044
|
return concat([
|
|
32885
33045
|
n2.declare ? "declare " : "",
|
|
32886
33046
|
"type ",
|
|
32887
|
-
|
|
32888
|
-
|
|
33047
|
+
path3.call(print2, "id"),
|
|
33048
|
+
path3.call(print2, "typeParameters"),
|
|
32889
33049
|
" = ",
|
|
32890
|
-
|
|
33050
|
+
path3.call(print2, "typeAnnotation"),
|
|
32891
33051
|
";"
|
|
32892
33052
|
]);
|
|
32893
33053
|
case "TSTypeParameter": {
|
|
32894
|
-
parts.push(
|
|
32895
|
-
const parent =
|
|
33054
|
+
parts.push(path3.call(print2, "name"));
|
|
33055
|
+
const parent = path3.getParentNode(0);
|
|
32896
33056
|
const isInMappedType = namedTypes.TSMappedType.check(parent);
|
|
32897
33057
|
if (n2.constraint) {
|
|
32898
33058
|
parts.push(
|
|
32899
33059
|
isInMappedType ? " in " : " extends ",
|
|
32900
|
-
|
|
33060
|
+
path3.call(print2, "constraint")
|
|
32901
33061
|
);
|
|
32902
33062
|
}
|
|
32903
33063
|
if (n2["default"]) {
|
|
32904
|
-
parts.push(" = ",
|
|
33064
|
+
parts.push(" = ", path3.call(print2, "default"));
|
|
32905
33065
|
}
|
|
32906
33066
|
return concat(parts);
|
|
32907
33067
|
}
|
|
32908
33068
|
case "TSTypeAssertion": {
|
|
32909
33069
|
parts.push(
|
|
32910
33070
|
"<",
|
|
32911
|
-
|
|
33071
|
+
path3.call(print2, "typeAnnotation"),
|
|
32912
33072
|
"> ",
|
|
32913
|
-
|
|
33073
|
+
path3.call(print2, "expression")
|
|
32914
33074
|
);
|
|
32915
33075
|
return concat(parts);
|
|
32916
33076
|
}
|
|
@@ -32918,7 +33078,7 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32918
33078
|
case "TSTypeParameterInstantiation":
|
|
32919
33079
|
return concat([
|
|
32920
33080
|
"<",
|
|
32921
|
-
fromString(", ").join(
|
|
33081
|
+
fromString(", ").join(path3.map(print2, "params")),
|
|
32922
33082
|
">"
|
|
32923
33083
|
]);
|
|
32924
33084
|
case "TSEnumDeclaration": {
|
|
@@ -32926,9 +33086,9 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32926
33086
|
n2.declare ? "declare " : "",
|
|
32927
33087
|
n2.const ? "const " : "",
|
|
32928
33088
|
"enum ",
|
|
32929
|
-
|
|
33089
|
+
path3.call(print2, "id")
|
|
32930
33090
|
);
|
|
32931
|
-
const memberLines = fromString(",\n").join(
|
|
33091
|
+
const memberLines = fromString(",\n").join(path3.map(print2, "members"));
|
|
32932
33092
|
if (memberLines.isEmpty()) {
|
|
32933
33093
|
parts.push(" {}");
|
|
32934
33094
|
} else {
|
|
@@ -32938,12 +33098,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32938
33098
|
}
|
|
32939
33099
|
case "TSExpressionWithTypeArguments":
|
|
32940
33100
|
return concat([
|
|
32941
|
-
|
|
32942
|
-
|
|
33101
|
+
path3.call(print2, "expression"),
|
|
33102
|
+
path3.call(print2, "typeParameters")
|
|
32943
33103
|
]);
|
|
32944
33104
|
case "TSInterfaceBody": {
|
|
32945
33105
|
const lines = fromString("\n").join(
|
|
32946
|
-
|
|
33106
|
+
path3.map(print2, "body").map((element) => {
|
|
32947
33107
|
if (lastNonSpaceCharacter(element) !== ";") {
|
|
32948
33108
|
return element.concat(";");
|
|
32949
33109
|
}
|
|
@@ -32956,12 +33116,12 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32956
33116
|
return concat(["{\n", lines.indent(options.tabWidth), "\n}"]);
|
|
32957
33117
|
}
|
|
32958
33118
|
case "TSImportType":
|
|
32959
|
-
parts.push("import(",
|
|
33119
|
+
parts.push("import(", path3.call(print2, "argument"), ")");
|
|
32960
33120
|
if (n2.qualifier) {
|
|
32961
|
-
parts.push(".",
|
|
33121
|
+
parts.push(".", path3.call(print2, "qualifier"));
|
|
32962
33122
|
}
|
|
32963
33123
|
if (n2.typeParameters) {
|
|
32964
|
-
parts.push(
|
|
33124
|
+
parts.push(path3.call(print2, "typeParameters"));
|
|
32965
33125
|
}
|
|
32966
33126
|
return concat(parts);
|
|
32967
33127
|
case "TSImportEqualsDeclaration":
|
|
@@ -32970,15 +33130,15 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
32970
33130
|
}
|
|
32971
33131
|
parts.push(
|
|
32972
33132
|
"import ",
|
|
32973
|
-
|
|
33133
|
+
path3.call(print2, "id"),
|
|
32974
33134
|
" = ",
|
|
32975
|
-
|
|
33135
|
+
path3.call(print2, "moduleReference")
|
|
32976
33136
|
);
|
|
32977
33137
|
return maybeAddSemicolon(concat(parts));
|
|
32978
33138
|
case "TSExternalModuleReference":
|
|
32979
|
-
return concat(["require(",
|
|
33139
|
+
return concat(["require(", path3.call(print2, "expression"), ")"]);
|
|
32980
33140
|
case "TSModuleDeclaration": {
|
|
32981
|
-
const parent =
|
|
33141
|
+
const parent = path3.getParentNode();
|
|
32982
33142
|
if (parent.type === "TSModuleDeclaration") {
|
|
32983
33143
|
parts.push(".");
|
|
32984
33144
|
} else {
|
|
@@ -33001,15 +33161,15 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
33001
33161
|
}
|
|
33002
33162
|
}
|
|
33003
33163
|
}
|
|
33004
|
-
parts.push(
|
|
33164
|
+
parts.push(path3.call(print2, "id"));
|
|
33005
33165
|
if (n2.body) {
|
|
33006
33166
|
parts.push(" ");
|
|
33007
|
-
parts.push(
|
|
33167
|
+
parts.push(path3.call(print2, "body"));
|
|
33008
33168
|
}
|
|
33009
33169
|
return concat(parts);
|
|
33010
33170
|
}
|
|
33011
33171
|
case "TSModuleBlock": {
|
|
33012
|
-
const naked =
|
|
33172
|
+
const naked = path3.call(
|
|
33013
33173
|
(bodyPath) => printStatementSequence(bodyPath, options, print2),
|
|
33014
33174
|
"body"
|
|
33015
33175
|
);
|
|
@@ -33022,13 +33182,13 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
33022
33182
|
}
|
|
33023
33183
|
case "TSInstantiationExpression": {
|
|
33024
33184
|
parts.push(
|
|
33025
|
-
|
|
33026
|
-
|
|
33185
|
+
path3.call(print2, "expression"),
|
|
33186
|
+
path3.call(print2, "typeParameters")
|
|
33027
33187
|
);
|
|
33028
33188
|
return concat(parts);
|
|
33029
33189
|
}
|
|
33030
33190
|
case "V8IntrinsicIdentifier":
|
|
33031
|
-
return concat(["%",
|
|
33191
|
+
return concat(["%", path3.call(print2, "name")]);
|
|
33032
33192
|
case "TopicReference":
|
|
33033
33193
|
return fromString("#");
|
|
33034
33194
|
case "ClassHeritage":
|
|
@@ -33064,17 +33224,17 @@ function genericPrintNoParens(path2, options, print2) {
|
|
|
33064
33224
|
throw new Error("unknown type: " + JSON.stringify(n2.type));
|
|
33065
33225
|
}
|
|
33066
33226
|
}
|
|
33067
|
-
function printDecorators(
|
|
33227
|
+
function printDecorators(path3, printPath) {
|
|
33068
33228
|
const parts = [];
|
|
33069
|
-
const node =
|
|
33229
|
+
const node = path3.getValue();
|
|
33070
33230
|
if (node.decorators && node.decorators.length > 0 && // If the parent node is an export declaration, it will be
|
|
33071
33231
|
// responsible for printing node.decorators.
|
|
33072
|
-
!getParentExportDeclaration(
|
|
33073
|
-
|
|
33232
|
+
!getParentExportDeclaration(path3)) {
|
|
33233
|
+
path3.each(function(decoratorPath) {
|
|
33074
33234
|
parts.push(printPath(decoratorPath), "\n");
|
|
33075
33235
|
}, "decorators");
|
|
33076
33236
|
} else if (isExportDeclaration(node) && node.declaration && node.declaration.decorators) {
|
|
33077
|
-
|
|
33237
|
+
path3.each(
|
|
33078
33238
|
function(decoratorPath) {
|
|
33079
33239
|
parts.push(printPath(decoratorPath), "\n");
|
|
33080
33240
|
},
|
|
@@ -33084,9 +33244,9 @@ function printDecorators(path2, printPath) {
|
|
|
33084
33244
|
}
|
|
33085
33245
|
return concat(parts);
|
|
33086
33246
|
}
|
|
33087
|
-
function printStatementSequence(
|
|
33247
|
+
function printStatementSequence(path3, options, print2) {
|
|
33088
33248
|
const filtered = [];
|
|
33089
|
-
|
|
33249
|
+
path3.each(function(stmtPath) {
|
|
33090
33250
|
const stmt = stmtPath.getValue();
|
|
33091
33251
|
if (!stmt) {
|
|
33092
33252
|
return;
|
|
@@ -33192,8 +33352,8 @@ function printClassMemberModifiers(node) {
|
|
|
33192
33352
|
}
|
|
33193
33353
|
return parts;
|
|
33194
33354
|
}
|
|
33195
|
-
function printMethod(
|
|
33196
|
-
const node =
|
|
33355
|
+
function printMethod(path3, options, print2) {
|
|
33356
|
+
const node = path3.getNode();
|
|
33197
33357
|
const kind = node.kind;
|
|
33198
33358
|
const parts = [];
|
|
33199
33359
|
let nodeValue = node.value;
|
|
@@ -33210,7 +33370,7 @@ function printMethod(path2, options, print2) {
|
|
|
33210
33370
|
if (kind === "get" || kind === "set") {
|
|
33211
33371
|
parts.push(kind, " ");
|
|
33212
33372
|
}
|
|
33213
|
-
let key =
|
|
33373
|
+
let key = path3.call(print2, "key");
|
|
33214
33374
|
if (node.computed) {
|
|
33215
33375
|
key = concat(["[", key, "]"]);
|
|
33216
33376
|
}
|
|
@@ -33220,38 +33380,38 @@ function printMethod(path2, options, print2) {
|
|
|
33220
33380
|
}
|
|
33221
33381
|
if (node === nodeValue) {
|
|
33222
33382
|
parts.push(
|
|
33223
|
-
|
|
33383
|
+
path3.call(print2, "typeParameters"),
|
|
33224
33384
|
"(",
|
|
33225
|
-
printFunctionParams(
|
|
33385
|
+
printFunctionParams(path3, options, print2),
|
|
33226
33386
|
")",
|
|
33227
|
-
|
|
33387
|
+
path3.call(print2, "returnType")
|
|
33228
33388
|
);
|
|
33229
33389
|
if (node.body) {
|
|
33230
|
-
parts.push(" ",
|
|
33390
|
+
parts.push(" ", path3.call(print2, "body"));
|
|
33231
33391
|
} else {
|
|
33232
33392
|
parts.push(";");
|
|
33233
33393
|
}
|
|
33234
33394
|
} else {
|
|
33235
33395
|
parts.push(
|
|
33236
|
-
|
|
33396
|
+
path3.call(print2, "value", "typeParameters"),
|
|
33237
33397
|
"(",
|
|
33238
|
-
|
|
33398
|
+
path3.call(
|
|
33239
33399
|
(valuePath) => printFunctionParams(valuePath, options, print2),
|
|
33240
33400
|
"value"
|
|
33241
33401
|
),
|
|
33242
33402
|
")",
|
|
33243
|
-
|
|
33403
|
+
path3.call(print2, "value", "returnType")
|
|
33244
33404
|
);
|
|
33245
33405
|
if (nodeValue.body) {
|
|
33246
|
-
parts.push(" ",
|
|
33406
|
+
parts.push(" ", path3.call(print2, "value", "body"));
|
|
33247
33407
|
} else {
|
|
33248
33408
|
parts.push(";");
|
|
33249
33409
|
}
|
|
33250
33410
|
}
|
|
33251
33411
|
return concat(parts);
|
|
33252
33412
|
}
|
|
33253
|
-
function printArgumentsList(
|
|
33254
|
-
const printed =
|
|
33413
|
+
function printArgumentsList(path3, options, print2) {
|
|
33414
|
+
const printed = path3.map(print2, "arguments");
|
|
33255
33415
|
const trailingComma = isTrailingCommaEnabled(options, "parameters");
|
|
33256
33416
|
let joined = fromString(", ").join(printed);
|
|
33257
33417
|
if (joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -33264,19 +33424,19 @@ function printArgumentsList(path2, options, print2) {
|
|
|
33264
33424
|
}
|
|
33265
33425
|
return concat(["(", joined, ")"]);
|
|
33266
33426
|
}
|
|
33267
|
-
function printFunctionParams(
|
|
33268
|
-
const fun =
|
|
33427
|
+
function printFunctionParams(path3, options, print2) {
|
|
33428
|
+
const fun = path3.getValue();
|
|
33269
33429
|
let params;
|
|
33270
33430
|
let printed = [];
|
|
33271
33431
|
if (fun.params) {
|
|
33272
33432
|
params = fun.params;
|
|
33273
|
-
printed =
|
|
33433
|
+
printed = path3.map(print2, "params");
|
|
33274
33434
|
} else if (fun.parameters) {
|
|
33275
33435
|
params = fun.parameters;
|
|
33276
|
-
printed =
|
|
33436
|
+
printed = path3.map(print2, "parameters");
|
|
33277
33437
|
}
|
|
33278
33438
|
if (fun.defaults) {
|
|
33279
|
-
|
|
33439
|
+
path3.each(function(defExprPath) {
|
|
33280
33440
|
const i = defExprPath.getName();
|
|
33281
33441
|
const p = printed[i];
|
|
33282
33442
|
if (p && defExprPath.getValue()) {
|
|
@@ -33285,7 +33445,7 @@ function printFunctionParams(path2, options, print2) {
|
|
|
33285
33445
|
}, "defaults");
|
|
33286
33446
|
}
|
|
33287
33447
|
if (fun.rest) {
|
|
33288
|
-
printed.push(concat(["...",
|
|
33448
|
+
printed.push(concat(["...", path3.call(print2, "rest")]));
|
|
33289
33449
|
}
|
|
33290
33450
|
let joined = fromString(", ").join(printed);
|
|
33291
33451
|
if (joined.length > 1 || joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -33299,11 +33459,11 @@ function printFunctionParams(path2, options, print2) {
|
|
|
33299
33459
|
}
|
|
33300
33460
|
return joined;
|
|
33301
33461
|
}
|
|
33302
|
-
function maybePrintImportAssertions(
|
|
33303
|
-
const n2 =
|
|
33462
|
+
function maybePrintImportAssertions(path3, options, print2) {
|
|
33463
|
+
const n2 = path3.getValue();
|
|
33304
33464
|
if (n2.assertions && n2.assertions.length > 0) {
|
|
33305
33465
|
const parts = [" assert {"];
|
|
33306
|
-
const printed =
|
|
33466
|
+
const printed = path3.map(print2, "assertions");
|
|
33307
33467
|
const flat = fromString(", ").join(printed);
|
|
33308
33468
|
if (flat.length > 1 || flat.getLineLength(1) > options.wrapColumn) {
|
|
33309
33469
|
parts.push(
|
|
@@ -33318,8 +33478,8 @@ function maybePrintImportAssertions(path2, options, print2) {
|
|
|
33318
33478
|
}
|
|
33319
33479
|
return fromString("");
|
|
33320
33480
|
}
|
|
33321
|
-
function printExportDeclaration(
|
|
33322
|
-
const decl =
|
|
33481
|
+
function printExportDeclaration(path3, options, print2) {
|
|
33482
|
+
const decl = path3.getValue();
|
|
33323
33483
|
const parts = ["export "];
|
|
33324
33484
|
if (decl.exportKind && decl.exportKind === "type") {
|
|
33325
33485
|
if (!decl.declaration) {
|
|
@@ -33332,7 +33492,7 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33332
33492
|
parts.push("default ");
|
|
33333
33493
|
}
|
|
33334
33494
|
if (decl.declaration) {
|
|
33335
|
-
parts.push(
|
|
33495
|
+
parts.push(path3.call(print2, "declaration"));
|
|
33336
33496
|
} else if (decl.specifiers) {
|
|
33337
33497
|
if (decl.specifiers.length === 1 && decl.specifiers[0].type === "ExportBatchSpecifier") {
|
|
33338
33498
|
parts.push("*");
|
|
@@ -33341,7 +33501,7 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33341
33501
|
} else if (decl.specifiers[0].type === "ExportDefaultSpecifier") {
|
|
33342
33502
|
const unbracedSpecifiers = [];
|
|
33343
33503
|
const bracedSpecifiers = [];
|
|
33344
|
-
|
|
33504
|
+
path3.each(function(specifierPath) {
|
|
33345
33505
|
const spec = specifierPath.getValue();
|
|
33346
33506
|
if (spec.type === "ExportDefaultSpecifier") {
|
|
33347
33507
|
unbracedSpecifiers.push(print2(specifierPath));
|
|
@@ -33377,15 +33537,15 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33377
33537
|
} else {
|
|
33378
33538
|
parts.push(
|
|
33379
33539
|
shouldPrintSpaces ? "{ " : "{",
|
|
33380
|
-
fromString(", ").join(
|
|
33540
|
+
fromString(", ").join(path3.map(print2, "specifiers")),
|
|
33381
33541
|
shouldPrintSpaces ? " }" : "}"
|
|
33382
33542
|
);
|
|
33383
33543
|
}
|
|
33384
33544
|
if (decl.source) {
|
|
33385
33545
|
parts.push(
|
|
33386
33546
|
" from ",
|
|
33387
|
-
|
|
33388
|
-
maybePrintImportAssertions(
|
|
33547
|
+
path3.call(print2, "source"),
|
|
33548
|
+
maybePrintImportAssertions(path3, options, print2)
|
|
33389
33549
|
);
|
|
33390
33550
|
}
|
|
33391
33551
|
}
|
|
@@ -33395,8 +33555,8 @@ function printExportDeclaration(path2, options, print2) {
|
|
|
33395
33555
|
}
|
|
33396
33556
|
return lines;
|
|
33397
33557
|
}
|
|
33398
|
-
function printFlowDeclaration(
|
|
33399
|
-
const parentExportDecl = getParentExportDeclaration(
|
|
33558
|
+
function printFlowDeclaration(path3, parts) {
|
|
33559
|
+
const parentExportDecl = getParentExportDeclaration(path3);
|
|
33400
33560
|
if (parentExportDecl)
|
|
33401
33561
|
;
|
|
33402
33562
|
else {
|
|
@@ -33404,8 +33564,8 @@ function printFlowDeclaration(path2, parts) {
|
|
|
33404
33564
|
}
|
|
33405
33565
|
return concat(parts);
|
|
33406
33566
|
}
|
|
33407
|
-
function printVariance(
|
|
33408
|
-
return
|
|
33567
|
+
function printVariance(path3, print2) {
|
|
33568
|
+
return path3.call(function(variancePath) {
|
|
33409
33569
|
const value = variancePath.getValue();
|
|
33410
33570
|
if (value) {
|
|
33411
33571
|
if (value === "plus") {
|
|
@@ -34577,6 +34737,7 @@ function resolveOptions(options) {
|
|
|
34577
34737
|
|
|
34578
34738
|
// src/core/compress.ts
|
|
34579
34739
|
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
34740
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
34580
34741
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
34581
34742
|
var import_archiver = __toESM(require("archiver"), 1);
|
|
34582
34743
|
|
|
@@ -35086,23 +35247,35 @@ var Log = class {
|
|
|
35086
35247
|
// src/core/compress.ts
|
|
35087
35248
|
async function createCompress(options) {
|
|
35088
35249
|
const { outDir, ignoreBase } = options;
|
|
35089
|
-
const zipFilePath = `${outDir}.zip
|
|
35250
|
+
const zipFilePath = import_node_path2.default.resolve(import_node_process3.default.cwd(), `${import_node_path2.default.basename(outDir)}.zip`);
|
|
35090
35251
|
Log.log("Compressing the directory", outDir);
|
|
35091
|
-
|
|
35092
|
-
|
|
35093
|
-
|
|
35094
|
-
|
|
35095
|
-
|
|
35096
|
-
|
|
35097
|
-
|
|
35098
|
-
|
|
35099
|
-
|
|
35100
|
-
|
|
35101
|
-
|
|
35102
|
-
|
|
35103
|
-
|
|
35104
|
-
|
|
35105
|
-
|
|
35252
|
+
return new Promise((resolve2, reject) => {
|
|
35253
|
+
try {
|
|
35254
|
+
const output = import_node_fs3.default.createWriteStream(zipFilePath);
|
|
35255
|
+
const archive = (0, import_archiver.default)("zip");
|
|
35256
|
+
output.on("close", () => {
|
|
35257
|
+
Log.success("Successfully compressed to", `${zipFilePath} (${archive.pointer()} bytes)`);
|
|
35258
|
+
resolve2(null);
|
|
35259
|
+
});
|
|
35260
|
+
archive.on("warning", (err) => {
|
|
35261
|
+
if (err.code === "ENOENT")
|
|
35262
|
+
Log.log("File not found during compression:", err.message);
|
|
35263
|
+
else
|
|
35264
|
+
Log.log("Compression warning:", err.message);
|
|
35265
|
+
});
|
|
35266
|
+
archive.on("error", (err) => {
|
|
35267
|
+
Log.error("Compression error:", err);
|
|
35268
|
+
reject(err);
|
|
35269
|
+
});
|
|
35270
|
+
archive.pipe(output);
|
|
35271
|
+
const absoluteOutDir = import_node_path2.default.resolve(outDir);
|
|
35272
|
+
archive.directory(absoluteOutDir, ignoreBase ? false : import_node_path2.default.basename(outDir));
|
|
35273
|
+
archive.finalize();
|
|
35274
|
+
} catch (error) {
|
|
35275
|
+
Log.error("Error compressing the directory", error);
|
|
35276
|
+
throw error;
|
|
35277
|
+
}
|
|
35278
|
+
});
|
|
35106
35279
|
}
|
|
35107
35280
|
|
|
35108
35281
|
// src/index.ts
|
|
@@ -35154,6 +35327,7 @@ var unpluginFactory = (options = {}) => {
|
|
|
35154
35327
|
import_node_process4.default.on("beforeExit", async () => {
|
|
35155
35328
|
const { compress } = resolved;
|
|
35156
35329
|
await createCompress(compress);
|
|
35330
|
+
import_node_process4.default.exit(0);
|
|
35157
35331
|
});
|
|
35158
35332
|
}
|
|
35159
35333
|
}];
|