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