@cloudflare/autoconfig 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -13
- package/dist/index.js +770 -854
- package/dist/metafile-esm.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __export, __name, __esm, __commonJS, __toCommonJS, __require, __toESM } from './chunk-6EUZQHAF.js';
|
|
2
2
|
import assert3 from 'node:assert';
|
|
3
|
-
import { existsSync, writeFileSync, mkdirSync, readFileSync,
|
|
3
|
+
import { existsSync, writeFileSync, mkdirSync, readFileSync, promises as promises$1, statSync } from 'node:fs';
|
|
4
4
|
import { readFile, writeFile, readdir, stat } from 'node:fs/promises';
|
|
5
|
-
import
|
|
5
|
+
import path8, { join, resolve, relative as relative$1 } from 'node:path';
|
|
6
6
|
import { blue, brandColor, dim } from '@cloudflare/cli-shared-helpers/colors';
|
|
7
|
-
import { UserError, FatalError, getTodaysCompatDate, parseJSONC,
|
|
7
|
+
import { UserError, FatalError, getInstalledPackageVersion, getTodaysCompatDate, parseJSONC, isPackageInstalled, NpmPackageManager, BunPackageManager, YarnPackageManager, PnpmPackageManager, getWorkerName, parsePackageJSON, readFileSync as readFileSync$1, checkWorkerNameValidity } from '@cloudflare/workers-utils';
|
|
8
|
+
export { getInstalledPackageVersion } from '@cloudflare/workers-utils';
|
|
8
9
|
import { updateStatus, endSection } from '@cloudflare/cli-shared-helpers';
|
|
9
10
|
import { spinner } from '@cloudflare/cli-shared-helpers/interactive';
|
|
10
11
|
import { installPackages, installWrangler } from '@cloudflare/cli-shared-helpers/packages';
|
|
@@ -138,12 +139,12 @@ function __metadata(metadataKey, metadataValue) {
|
|
|
138
139
|
}
|
|
139
140
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
140
141
|
function adopt(value) {
|
|
141
|
-
return value instanceof P ? value : new P(function(
|
|
142
|
-
|
|
142
|
+
return value instanceof P ? value : new P(function(resolve6) {
|
|
143
|
+
resolve6(value);
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
146
|
__name(adopt, "adopt");
|
|
146
|
-
return new (P || (P = Promise))(function(
|
|
147
|
+
return new (P || (P = Promise))(function(resolve6, reject) {
|
|
147
148
|
function fulfilled(value) {
|
|
148
149
|
try {
|
|
149
150
|
step(generator.next(value));
|
|
@@ -161,7 +162,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
161
162
|
}
|
|
162
163
|
__name(rejected, "rejected");
|
|
163
164
|
function step(result) {
|
|
164
|
-
result.done ?
|
|
165
|
+
result.done ? resolve6(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
165
166
|
}
|
|
166
167
|
__name(step, "step");
|
|
167
168
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
@@ -353,14 +354,14 @@ function __asyncValues(o) {
|
|
|
353
354
|
}, i);
|
|
354
355
|
function verb(n) {
|
|
355
356
|
i[n] = o[n] && function(v) {
|
|
356
|
-
return new Promise(function(
|
|
357
|
-
v = o[n](v), settle(
|
|
357
|
+
return new Promise(function(resolve6, reject) {
|
|
358
|
+
v = o[n](v), settle(resolve6, reject, v.done, v.value);
|
|
358
359
|
});
|
|
359
360
|
};
|
|
360
361
|
}
|
|
361
|
-
function settle(
|
|
362
|
+
function settle(resolve6, reject, d, v) {
|
|
362
363
|
Promise.resolve(v).then(function(v2) {
|
|
363
|
-
|
|
364
|
+
resolve6({ value: v2, done: d });
|
|
364
365
|
}, reject);
|
|
365
366
|
}
|
|
366
367
|
}
|
|
@@ -454,13 +455,13 @@ function __disposeResources(env2) {
|
|
|
454
455
|
__name(next, "next");
|
|
455
456
|
return next();
|
|
456
457
|
}
|
|
457
|
-
function __rewriteRelativeImportExtension(
|
|
458
|
-
if (typeof
|
|
459
|
-
return
|
|
458
|
+
function __rewriteRelativeImportExtension(path9, preserveJsx) {
|
|
459
|
+
if (typeof path9 === "string" && /^\.\.?\//.test(path9)) {
|
|
460
|
+
return path9.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext2, cm) {
|
|
460
461
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext2 || !cm) ? m : d + ext2 + "." + cm.toLowerCase() + "js";
|
|
461
462
|
});
|
|
462
463
|
}
|
|
463
|
-
return
|
|
464
|
+
return path9;
|
|
464
465
|
}
|
|
465
466
|
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
|
|
466
467
|
var init_tslib_es6 = __esm({
|
|
@@ -1416,17 +1417,17 @@ var require_path = __commonJS({
|
|
|
1416
1417
|
this.__childCache = null;
|
|
1417
1418
|
}, "Path");
|
|
1418
1419
|
var Pp = Path.prototype;
|
|
1419
|
-
function getChildCache(
|
|
1420
|
-
return
|
|
1420
|
+
function getChildCache(path9) {
|
|
1421
|
+
return path9.__childCache || (path9.__childCache = /* @__PURE__ */ Object.create(null));
|
|
1421
1422
|
}
|
|
1422
1423
|
__name(getChildCache, "getChildCache");
|
|
1423
|
-
function getChildPath(
|
|
1424
|
-
var cache = getChildCache(
|
|
1425
|
-
var actualChildValue =
|
|
1424
|
+
function getChildPath(path9, name) {
|
|
1425
|
+
var cache = getChildCache(path9);
|
|
1426
|
+
var actualChildValue = path9.getValueProperty(name);
|
|
1426
1427
|
var childPath = cache[name];
|
|
1427
1428
|
if (!hasOwn.call(cache, name) || // Ensure consistency between cache and reality.
|
|
1428
1429
|
childPath.value !== actualChildValue) {
|
|
1429
|
-
childPath = cache[name] = new
|
|
1430
|
+
childPath = cache[name] = new path9.constructor(actualChildValue, path9, name);
|
|
1430
1431
|
}
|
|
1431
1432
|
return childPath;
|
|
1432
1433
|
}
|
|
@@ -1439,12 +1440,12 @@ var require_path = __commonJS({
|
|
|
1439
1440
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1440
1441
|
names[_i] = arguments[_i];
|
|
1441
1442
|
}
|
|
1442
|
-
var
|
|
1443
|
+
var path9 = this;
|
|
1443
1444
|
var count = names.length;
|
|
1444
1445
|
for (var i = 0; i < count; ++i) {
|
|
1445
|
-
|
|
1446
|
+
path9 = getChildPath(path9, names[i]);
|
|
1446
1447
|
}
|
|
1447
|
-
return
|
|
1448
|
+
return path9;
|
|
1448
1449
|
}, "get");
|
|
1449
1450
|
Pp.each = /* @__PURE__ */ __name(function each(callback, context) {
|
|
1450
1451
|
var childPaths = [];
|
|
@@ -1481,12 +1482,12 @@ var require_path = __commonJS({
|
|
|
1481
1482
|
function emptyMoves() {
|
|
1482
1483
|
}
|
|
1483
1484
|
__name(emptyMoves, "emptyMoves");
|
|
1484
|
-
function getMoves(
|
|
1485
|
-
isArray.assert(
|
|
1485
|
+
function getMoves(path9, offset, start, end) {
|
|
1486
|
+
isArray.assert(path9.value);
|
|
1486
1487
|
if (offset === 0) {
|
|
1487
1488
|
return emptyMoves;
|
|
1488
1489
|
}
|
|
1489
|
-
var length =
|
|
1490
|
+
var length = path9.value.length;
|
|
1490
1491
|
if (length < 1) {
|
|
1491
1492
|
return emptyMoves;
|
|
1492
1493
|
}
|
|
@@ -1504,10 +1505,10 @@ var require_path = __commonJS({
|
|
|
1504
1505
|
isNumber.assert(start);
|
|
1505
1506
|
isNumber.assert(end);
|
|
1506
1507
|
var moves = /* @__PURE__ */ Object.create(null);
|
|
1507
|
-
var cache = getChildCache(
|
|
1508
|
+
var cache = getChildCache(path9);
|
|
1508
1509
|
for (var i = start; i < end; ++i) {
|
|
1509
|
-
if (hasOwn.call(
|
|
1510
|
-
var childPath =
|
|
1510
|
+
if (hasOwn.call(path9.value, i)) {
|
|
1511
|
+
var childPath = path9.get(i);
|
|
1511
1512
|
if (childPath.name !== i) {
|
|
1512
1513
|
throw new Error("");
|
|
1513
1514
|
}
|
|
@@ -1525,7 +1526,7 @@ var require_path = __commonJS({
|
|
|
1525
1526
|
throw new Error("");
|
|
1526
1527
|
}
|
|
1527
1528
|
cache[newIndex2] = childPath2;
|
|
1528
|
-
|
|
1529
|
+
path9.value[newIndex2] = childPath2.value;
|
|
1529
1530
|
}
|
|
1530
1531
|
};
|
|
1531
1532
|
}
|
|
@@ -1601,34 +1602,34 @@ var require_path = __commonJS({
|
|
|
1601
1602
|
}
|
|
1602
1603
|
return pp.insertAt.apply(pp, insertAtArgs);
|
|
1603
1604
|
}, "insertAfter");
|
|
1604
|
-
function repairRelationshipWithParent(
|
|
1605
|
-
if (!(
|
|
1605
|
+
function repairRelationshipWithParent(path9) {
|
|
1606
|
+
if (!(path9 instanceof Path)) {
|
|
1606
1607
|
throw new Error("");
|
|
1607
1608
|
}
|
|
1608
|
-
var pp =
|
|
1609
|
+
var pp = path9.parentPath;
|
|
1609
1610
|
if (!pp) {
|
|
1610
|
-
return
|
|
1611
|
+
return path9;
|
|
1611
1612
|
}
|
|
1612
1613
|
var parentValue = pp.value;
|
|
1613
1614
|
var parentCache = getChildCache(pp);
|
|
1614
|
-
if (parentValue[
|
|
1615
|
-
parentCache[
|
|
1615
|
+
if (parentValue[path9.name] === path9.value) {
|
|
1616
|
+
parentCache[path9.name] = path9;
|
|
1616
1617
|
} else if (isArray.check(parentValue)) {
|
|
1617
|
-
var i = parentValue.indexOf(
|
|
1618
|
+
var i = parentValue.indexOf(path9.value);
|
|
1618
1619
|
if (i >= 0) {
|
|
1619
|
-
parentCache[
|
|
1620
|
+
parentCache[path9.name = i] = path9;
|
|
1620
1621
|
}
|
|
1621
1622
|
} else {
|
|
1622
|
-
parentValue[
|
|
1623
|
-
parentCache[
|
|
1623
|
+
parentValue[path9.name] = path9.value;
|
|
1624
|
+
parentCache[path9.name] = path9;
|
|
1624
1625
|
}
|
|
1625
|
-
if (parentValue[
|
|
1626
|
+
if (parentValue[path9.name] !== path9.value) {
|
|
1626
1627
|
throw new Error("");
|
|
1627
1628
|
}
|
|
1628
|
-
if (
|
|
1629
|
+
if (path9.parentPath.get(path9.name) !== path9) {
|
|
1629
1630
|
throw new Error("");
|
|
1630
1631
|
}
|
|
1631
|
-
return
|
|
1632
|
+
return path9;
|
|
1632
1633
|
}
|
|
1633
1634
|
__name(repairRelationshipWithParent, "repairRelationshipWithParent");
|
|
1634
1635
|
Pp.replace = /* @__PURE__ */ __name(function replace(replacement) {
|
|
@@ -1712,12 +1713,12 @@ var require_scope = __commonJS({
|
|
|
1712
1713
|
var Expression = namedTypes.Expression;
|
|
1713
1714
|
var isArray = types11.builtInTypes.array;
|
|
1714
1715
|
var b5 = types11.builders;
|
|
1715
|
-
var Scope = /* @__PURE__ */ __name(function Scope2(
|
|
1716
|
+
var Scope = /* @__PURE__ */ __name(function Scope2(path9, parentScope) {
|
|
1716
1717
|
if (!(this instanceof Scope2)) {
|
|
1717
1718
|
throw new Error("Scope constructor cannot be invoked without 'new'");
|
|
1718
1719
|
}
|
|
1719
|
-
if (!TypeParameterScopeType.check(
|
|
1720
|
-
ScopeType.assert(
|
|
1720
|
+
if (!TypeParameterScopeType.check(path9.value)) {
|
|
1721
|
+
ScopeType.assert(path9.value);
|
|
1721
1722
|
}
|
|
1722
1723
|
var depth;
|
|
1723
1724
|
if (parentScope) {
|
|
@@ -1730,8 +1731,8 @@ var require_scope = __commonJS({
|
|
|
1730
1731
|
depth = 0;
|
|
1731
1732
|
}
|
|
1732
1733
|
Object.defineProperties(this, {
|
|
1733
|
-
path: { value:
|
|
1734
|
-
node: { value:
|
|
1734
|
+
path: { value: path9 },
|
|
1735
|
+
node: { value: path9.value },
|
|
1735
1736
|
isGlobal: { value: !parentScope, enumerable: true },
|
|
1736
1737
|
depth: { value: depth },
|
|
1737
1738
|
parent: { value: parentScope },
|
|
@@ -1810,10 +1811,10 @@ var require_scope = __commonJS({
|
|
|
1810
1811
|
this.scan();
|
|
1811
1812
|
return this.types;
|
|
1812
1813
|
};
|
|
1813
|
-
function scanScope(
|
|
1814
|
-
var node =
|
|
1814
|
+
function scanScope(path9, bindings, scopeTypes) {
|
|
1815
|
+
var node = path9.value;
|
|
1815
1816
|
if (TypeParameterScopeType.check(node)) {
|
|
1816
|
-
var params =
|
|
1817
|
+
var params = path9.get("typeParameters", "params");
|
|
1817
1818
|
if (isArray.check(params.value)) {
|
|
1818
1819
|
params.each(function(childPath) {
|
|
1819
1820
|
addTypeParameter(childPath, scopeTypes);
|
|
@@ -1822,45 +1823,45 @@ var require_scope = __commonJS({
|
|
|
1822
1823
|
}
|
|
1823
1824
|
if (ScopeType.check(node)) {
|
|
1824
1825
|
if (namedTypes.CatchClause.check(node)) {
|
|
1825
|
-
addPattern(
|
|
1826
|
+
addPattern(path9.get("param"), bindings);
|
|
1826
1827
|
} else {
|
|
1827
|
-
recursiveScanScope(
|
|
1828
|
+
recursiveScanScope(path9, bindings, scopeTypes);
|
|
1828
1829
|
}
|
|
1829
1830
|
}
|
|
1830
1831
|
}
|
|
1831
1832
|
__name(scanScope, "scanScope");
|
|
1832
|
-
function recursiveScanScope(
|
|
1833
|
-
var node =
|
|
1834
|
-
if (
|
|
1835
|
-
addPattern(
|
|
1833
|
+
function recursiveScanScope(path9, bindings, scopeTypes) {
|
|
1834
|
+
var node = path9.value;
|
|
1835
|
+
if (path9.parent && namedTypes.FunctionExpression.check(path9.parent.node) && path9.parent.node.id) {
|
|
1836
|
+
addPattern(path9.parent.get("id"), bindings);
|
|
1836
1837
|
}
|
|
1837
1838
|
if (!node) ; else if (isArray.check(node)) {
|
|
1838
|
-
|
|
1839
|
+
path9.each(function(childPath) {
|
|
1839
1840
|
recursiveScanChild(childPath, bindings, scopeTypes);
|
|
1840
1841
|
});
|
|
1841
1842
|
} else if (namedTypes.Function.check(node)) {
|
|
1842
|
-
|
|
1843
|
+
path9.get("params").each(function(paramPath) {
|
|
1843
1844
|
addPattern(paramPath, bindings);
|
|
1844
1845
|
});
|
|
1845
|
-
recursiveScanChild(
|
|
1846
|
-
recursiveScanScope(
|
|
1846
|
+
recursiveScanChild(path9.get("body"), bindings, scopeTypes);
|
|
1847
|
+
recursiveScanScope(path9.get("typeParameters"), bindings, scopeTypes);
|
|
1847
1848
|
} else if (namedTypes.TypeAlias && namedTypes.TypeAlias.check(node) || namedTypes.InterfaceDeclaration && namedTypes.InterfaceDeclaration.check(node) || namedTypes.TSTypeAliasDeclaration && namedTypes.TSTypeAliasDeclaration.check(node) || namedTypes.TSInterfaceDeclaration && namedTypes.TSInterfaceDeclaration.check(node)) {
|
|
1848
|
-
addTypePattern(
|
|
1849
|
+
addTypePattern(path9.get("id"), scopeTypes);
|
|
1849
1850
|
} else if (namedTypes.VariableDeclarator.check(node)) {
|
|
1850
|
-
addPattern(
|
|
1851
|
-
recursiveScanChild(
|
|
1851
|
+
addPattern(path9.get("id"), bindings);
|
|
1852
|
+
recursiveScanChild(path9.get("init"), bindings, scopeTypes);
|
|
1852
1853
|
} else if (node.type === "ImportSpecifier" || node.type === "ImportNamespaceSpecifier" || node.type === "ImportDefaultSpecifier") {
|
|
1853
1854
|
addPattern(
|
|
1854
1855
|
// Esprima used to use the .name field to refer to the local
|
|
1855
1856
|
// binding identifier for ImportSpecifier nodes, but .id for
|
|
1856
1857
|
// ImportNamespaceSpecifier and ImportDefaultSpecifier nodes.
|
|
1857
1858
|
// ESTree/Acorn/ESpree use .local for all three node types.
|
|
1858
|
-
|
|
1859
|
+
path9.get(node.local ? "local" : node.name ? "name" : "id"),
|
|
1859
1860
|
bindings
|
|
1860
1861
|
);
|
|
1861
1862
|
} else if (Node3.check(node) && !Expression.check(node)) {
|
|
1862
1863
|
types11.eachField(node, function(name, child) {
|
|
1863
|
-
var childPath =
|
|
1864
|
+
var childPath = path9.get(name);
|
|
1864
1865
|
if (!pathHasValue(childPath, child)) {
|
|
1865
1866
|
throw new Error("");
|
|
1866
1867
|
}
|
|
@@ -1869,37 +1870,37 @@ var require_scope = __commonJS({
|
|
|
1869
1870
|
}
|
|
1870
1871
|
}
|
|
1871
1872
|
__name(recursiveScanScope, "recursiveScanScope");
|
|
1872
|
-
function pathHasValue(
|
|
1873
|
-
if (
|
|
1873
|
+
function pathHasValue(path9, value) {
|
|
1874
|
+
if (path9.value === value) {
|
|
1874
1875
|
return true;
|
|
1875
1876
|
}
|
|
1876
|
-
if (Array.isArray(
|
|
1877
|
+
if (Array.isArray(path9.value) && path9.value.length === 0 && Array.isArray(value) && value.length === 0) {
|
|
1877
1878
|
return true;
|
|
1878
1879
|
}
|
|
1879
1880
|
return false;
|
|
1880
1881
|
}
|
|
1881
1882
|
__name(pathHasValue, "pathHasValue");
|
|
1882
|
-
function recursiveScanChild(
|
|
1883
|
-
var node =
|
|
1883
|
+
function recursiveScanChild(path9, bindings, scopeTypes) {
|
|
1884
|
+
var node = path9.value;
|
|
1884
1885
|
if (!node || Expression.check(node)) ; else if (namedTypes.FunctionDeclaration.check(node) && node.id !== null) {
|
|
1885
|
-
addPattern(
|
|
1886
|
+
addPattern(path9.get("id"), bindings);
|
|
1886
1887
|
} else if (namedTypes.ClassDeclaration && namedTypes.ClassDeclaration.check(node) && node.id !== null) {
|
|
1887
|
-
addPattern(
|
|
1888
|
-
recursiveScanScope(
|
|
1888
|
+
addPattern(path9.get("id"), bindings);
|
|
1889
|
+
recursiveScanScope(path9.get("typeParameters"), bindings, scopeTypes);
|
|
1889
1890
|
} else if (namedTypes.InterfaceDeclaration && namedTypes.InterfaceDeclaration.check(node) || namedTypes.TSInterfaceDeclaration && namedTypes.TSInterfaceDeclaration.check(node)) {
|
|
1890
|
-
addTypePattern(
|
|
1891
|
+
addTypePattern(path9.get("id"), scopeTypes);
|
|
1891
1892
|
} else if (ScopeType.check(node)) {
|
|
1892
1893
|
if (namedTypes.CatchClause.check(node) && // TODO Broaden this to accept any pattern.
|
|
1893
1894
|
namedTypes.Identifier.check(node.param)) {
|
|
1894
1895
|
var catchParamName = node.param.name;
|
|
1895
1896
|
var hadBinding = hasOwn.call(bindings, catchParamName);
|
|
1896
|
-
recursiveScanScope(
|
|
1897
|
+
recursiveScanScope(path9.get("body"), bindings, scopeTypes);
|
|
1897
1898
|
if (!hadBinding) {
|
|
1898
1899
|
delete bindings[catchParamName];
|
|
1899
1900
|
}
|
|
1900
1901
|
}
|
|
1901
1902
|
} else {
|
|
1902
|
-
recursiveScanScope(
|
|
1903
|
+
recursiveScanScope(path9, bindings, scopeTypes);
|
|
1903
1904
|
}
|
|
1904
1905
|
}
|
|
1905
1906
|
__name(recursiveScanChild, "recursiveScanChild");
|
|
@@ -2254,53 +2255,53 @@ var require_node_path = __commonJS({
|
|
|
2254
2255
|
NPp.firstInStatement = function() {
|
|
2255
2256
|
return firstInStatement(this);
|
|
2256
2257
|
};
|
|
2257
|
-
function firstInStatement(
|
|
2258
|
-
for (var node, parent;
|
|
2259
|
-
node =
|
|
2260
|
-
parent =
|
|
2261
|
-
if (n.BlockStatement.check(parent) &&
|
|
2258
|
+
function firstInStatement(path9) {
|
|
2259
|
+
for (var node, parent; path9.parent; path9 = path9.parent) {
|
|
2260
|
+
node = path9.node;
|
|
2261
|
+
parent = path9.parent.node;
|
|
2262
|
+
if (n.BlockStatement.check(parent) && path9.parent.name === "body" && path9.name === 0) {
|
|
2262
2263
|
if (parent.body[0] !== node) {
|
|
2263
2264
|
throw new Error("Nodes must be equal");
|
|
2264
2265
|
}
|
|
2265
2266
|
return true;
|
|
2266
2267
|
}
|
|
2267
|
-
if (n.ExpressionStatement.check(parent) &&
|
|
2268
|
+
if (n.ExpressionStatement.check(parent) && path9.name === "expression") {
|
|
2268
2269
|
if (parent.expression !== node) {
|
|
2269
2270
|
throw new Error("Nodes must be equal");
|
|
2270
2271
|
}
|
|
2271
2272
|
return true;
|
|
2272
2273
|
}
|
|
2273
|
-
if (n.SequenceExpression.check(parent) &&
|
|
2274
|
+
if (n.SequenceExpression.check(parent) && path9.parent.name === "expressions" && path9.name === 0) {
|
|
2274
2275
|
if (parent.expressions[0] !== node) {
|
|
2275
2276
|
throw new Error("Nodes must be equal");
|
|
2276
2277
|
}
|
|
2277
2278
|
continue;
|
|
2278
2279
|
}
|
|
2279
|
-
if (n.CallExpression.check(parent) &&
|
|
2280
|
+
if (n.CallExpression.check(parent) && path9.name === "callee") {
|
|
2280
2281
|
if (parent.callee !== node) {
|
|
2281
2282
|
throw new Error("Nodes must be equal");
|
|
2282
2283
|
}
|
|
2283
2284
|
continue;
|
|
2284
2285
|
}
|
|
2285
|
-
if (n.MemberExpression.check(parent) &&
|
|
2286
|
+
if (n.MemberExpression.check(parent) && path9.name === "object") {
|
|
2286
2287
|
if (parent.object !== node) {
|
|
2287
2288
|
throw new Error("Nodes must be equal");
|
|
2288
2289
|
}
|
|
2289
2290
|
continue;
|
|
2290
2291
|
}
|
|
2291
|
-
if (n.ConditionalExpression.check(parent) &&
|
|
2292
|
+
if (n.ConditionalExpression.check(parent) && path9.name === "test") {
|
|
2292
2293
|
if (parent.test !== node) {
|
|
2293
2294
|
throw new Error("Nodes must be equal");
|
|
2294
2295
|
}
|
|
2295
2296
|
continue;
|
|
2296
2297
|
}
|
|
2297
|
-
if (isBinary(parent) &&
|
|
2298
|
+
if (isBinary(parent) && path9.name === "left") {
|
|
2298
2299
|
if (parent.left !== node) {
|
|
2299
2300
|
throw new Error("Nodes must be equal");
|
|
2300
2301
|
}
|
|
2301
2302
|
continue;
|
|
2302
2303
|
}
|
|
2303
|
-
if (n.UnaryExpression.check(parent) && !parent.prefix &&
|
|
2304
|
+
if (n.UnaryExpression.check(parent) && !parent.prefix && path9.name === "argument") {
|
|
2304
2305
|
if (parent.argument !== node) {
|
|
2305
2306
|
throw new Error("Nodes must be equal");
|
|
2306
2307
|
}
|
|
@@ -2478,36 +2479,36 @@ var require_path_visitor = __commonJS({
|
|
|
2478
2479
|
};
|
|
2479
2480
|
PVp.reset = function(_path) {
|
|
2480
2481
|
};
|
|
2481
|
-
PVp.visitWithoutReset = function(
|
|
2482
|
+
PVp.visitWithoutReset = function(path9) {
|
|
2482
2483
|
if (this instanceof this.Context) {
|
|
2483
|
-
return this.visitor.visitWithoutReset(
|
|
2484
|
+
return this.visitor.visitWithoutReset(path9);
|
|
2484
2485
|
}
|
|
2485
|
-
if (!(
|
|
2486
|
+
if (!(path9 instanceof NodePath)) {
|
|
2486
2487
|
throw new Error("");
|
|
2487
2488
|
}
|
|
2488
|
-
var value =
|
|
2489
|
+
var value = path9.value;
|
|
2489
2490
|
var methodName = value && typeof value === "object" && typeof value.type === "string" && this._methodNameTable[value.type];
|
|
2490
2491
|
if (methodName) {
|
|
2491
|
-
var context = this.acquireContext(
|
|
2492
|
+
var context = this.acquireContext(path9);
|
|
2492
2493
|
try {
|
|
2493
2494
|
return context.invokeVisitorMethod(methodName);
|
|
2494
2495
|
} finally {
|
|
2495
2496
|
this.releaseContext(context);
|
|
2496
2497
|
}
|
|
2497
2498
|
} else {
|
|
2498
|
-
return visitChildren(
|
|
2499
|
+
return visitChildren(path9, this);
|
|
2499
2500
|
}
|
|
2500
2501
|
};
|
|
2501
|
-
function visitChildren(
|
|
2502
|
-
if (!(
|
|
2502
|
+
function visitChildren(path9, visitor) {
|
|
2503
|
+
if (!(path9 instanceof NodePath)) {
|
|
2503
2504
|
throw new Error("");
|
|
2504
2505
|
}
|
|
2505
2506
|
if (!(visitor instanceof PathVisitor)) {
|
|
2506
2507
|
throw new Error("");
|
|
2507
2508
|
}
|
|
2508
|
-
var value =
|
|
2509
|
+
var value = path9.value;
|
|
2509
2510
|
if (isArray.check(value)) {
|
|
2510
|
-
|
|
2511
|
+
path9.each(visitor.visitWithoutReset, visitor);
|
|
2511
2512
|
} else if (!isObject.check(value)) ; else {
|
|
2512
2513
|
var childNames = types11.getFieldNames(value);
|
|
2513
2514
|
if (visitor._shouldVisitComments && value.comments && childNames.indexOf("comments") < 0) {
|
|
@@ -2520,20 +2521,20 @@ var require_path_visitor = __commonJS({
|
|
|
2520
2521
|
if (!hasOwn.call(value, childName)) {
|
|
2521
2522
|
value[childName] = types11.getFieldValue(value, childName);
|
|
2522
2523
|
}
|
|
2523
|
-
childPaths.push(
|
|
2524
|
+
childPaths.push(path9.get(childName));
|
|
2524
2525
|
}
|
|
2525
2526
|
for (var i = 0; i < childCount; ++i) {
|
|
2526
2527
|
visitor.visitWithoutReset(childPaths[i]);
|
|
2527
2528
|
}
|
|
2528
2529
|
}
|
|
2529
|
-
return
|
|
2530
|
+
return path9.value;
|
|
2530
2531
|
}
|
|
2531
2532
|
__name(visitChildren, "visitChildren");
|
|
2532
|
-
PVp.acquireContext = function(
|
|
2533
|
+
PVp.acquireContext = function(path9) {
|
|
2533
2534
|
if (this._reusableContextStack.length === 0) {
|
|
2534
|
-
return new this.Context(
|
|
2535
|
+
return new this.Context(path9);
|
|
2535
2536
|
}
|
|
2536
|
-
return this._reusableContextStack.pop().reset(
|
|
2537
|
+
return this._reusableContextStack.pop().reset(path9);
|
|
2537
2538
|
};
|
|
2538
2539
|
PVp.releaseContext = function(context) {
|
|
2539
2540
|
if (!(context instanceof this.Context)) {
|
|
@@ -2549,14 +2550,14 @@ var require_path_visitor = __commonJS({
|
|
|
2549
2550
|
return this._changeReported;
|
|
2550
2551
|
};
|
|
2551
2552
|
function makeContextConstructor(visitor) {
|
|
2552
|
-
function Context(
|
|
2553
|
+
function Context(path9) {
|
|
2553
2554
|
if (!(this instanceof Context)) {
|
|
2554
2555
|
throw new Error("");
|
|
2555
2556
|
}
|
|
2556
2557
|
if (!(this instanceof PathVisitor)) {
|
|
2557
2558
|
throw new Error("");
|
|
2558
2559
|
}
|
|
2559
|
-
if (!(
|
|
2560
|
+
if (!(path9 instanceof NodePath)) {
|
|
2560
2561
|
throw new Error("");
|
|
2561
2562
|
}
|
|
2562
2563
|
Object.defineProperty(this, "visitor", {
|
|
@@ -2565,7 +2566,7 @@ var require_path_visitor = __commonJS({
|
|
|
2565
2566
|
enumerable: true,
|
|
2566
2567
|
configurable: false
|
|
2567
2568
|
});
|
|
2568
|
-
this.currentPath =
|
|
2569
|
+
this.currentPath = path9;
|
|
2569
2570
|
this.needToCallTraverse = true;
|
|
2570
2571
|
Object.seal(this);
|
|
2571
2572
|
}
|
|
@@ -2580,14 +2581,14 @@ var require_path_visitor = __commonJS({
|
|
|
2580
2581
|
}
|
|
2581
2582
|
__name(makeContextConstructor, "makeContextConstructor");
|
|
2582
2583
|
var sharedContextProtoMethods = /* @__PURE__ */ Object.create(null);
|
|
2583
|
-
sharedContextProtoMethods.reset = /* @__PURE__ */ __name(function reset(
|
|
2584
|
+
sharedContextProtoMethods.reset = /* @__PURE__ */ __name(function reset(path9) {
|
|
2584
2585
|
if (!(this instanceof this.Context)) {
|
|
2585
2586
|
throw new Error("");
|
|
2586
2587
|
}
|
|
2587
|
-
if (!(
|
|
2588
|
+
if (!(path9 instanceof NodePath)) {
|
|
2588
2589
|
throw new Error("");
|
|
2589
2590
|
}
|
|
2590
|
-
this.currentPath =
|
|
2591
|
+
this.currentPath = path9;
|
|
2591
2592
|
this.needToCallTraverse = true;
|
|
2592
2593
|
return this;
|
|
2593
2594
|
}, "reset");
|
|
@@ -2610,34 +2611,34 @@ var require_path_visitor = __commonJS({
|
|
|
2610
2611
|
if (this.needToCallTraverse !== false) {
|
|
2611
2612
|
throw new Error("Must either call this.traverse or return false in " + methodName);
|
|
2612
2613
|
}
|
|
2613
|
-
var
|
|
2614
|
-
return
|
|
2614
|
+
var path9 = this.currentPath;
|
|
2615
|
+
return path9 && path9.value;
|
|
2615
2616
|
}, "invokeVisitorMethod");
|
|
2616
|
-
sharedContextProtoMethods.traverse = /* @__PURE__ */ __name(function traverse(
|
|
2617
|
+
sharedContextProtoMethods.traverse = /* @__PURE__ */ __name(function traverse(path9, newVisitor) {
|
|
2617
2618
|
if (!(this instanceof this.Context)) {
|
|
2618
2619
|
throw new Error("");
|
|
2619
2620
|
}
|
|
2620
|
-
if (!(
|
|
2621
|
+
if (!(path9 instanceof NodePath)) {
|
|
2621
2622
|
throw new Error("");
|
|
2622
2623
|
}
|
|
2623
2624
|
if (!(this.currentPath instanceof NodePath)) {
|
|
2624
2625
|
throw new Error("");
|
|
2625
2626
|
}
|
|
2626
2627
|
this.needToCallTraverse = false;
|
|
2627
|
-
return visitChildren(
|
|
2628
|
+
return visitChildren(path9, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
2628
2629
|
}, "traverse");
|
|
2629
|
-
sharedContextProtoMethods.visit = /* @__PURE__ */ __name(function visit3(
|
|
2630
|
+
sharedContextProtoMethods.visit = /* @__PURE__ */ __name(function visit3(path9, newVisitor) {
|
|
2630
2631
|
if (!(this instanceof this.Context)) {
|
|
2631
2632
|
throw new Error("");
|
|
2632
2633
|
}
|
|
2633
|
-
if (!(
|
|
2634
|
+
if (!(path9 instanceof NodePath)) {
|
|
2634
2635
|
throw new Error("");
|
|
2635
2636
|
}
|
|
2636
2637
|
if (!(this.currentPath instanceof NodePath)) {
|
|
2637
2638
|
throw new Error("");
|
|
2638
2639
|
}
|
|
2639
2640
|
this.needToCallTraverse = false;
|
|
2640
|
-
return PathVisitor.fromMethodsObject(newVisitor || this.visitor).visitWithoutReset(
|
|
2641
|
+
return PathVisitor.fromMethodsObject(newVisitor || this.visitor).visitWithoutReset(path9);
|
|
2641
2642
|
}, "visit");
|
|
2642
2643
|
sharedContextProtoMethods.reportChanged = /* @__PURE__ */ __name(function reportChanged() {
|
|
2643
2644
|
this.visitor.reportChanged();
|
|
@@ -4264,45 +4265,45 @@ var require_util = __commonJS({
|
|
|
4264
4265
|
__name(urlGenerate, "urlGenerate");
|
|
4265
4266
|
exports.urlGenerate = urlGenerate;
|
|
4266
4267
|
function normalize2(aPath) {
|
|
4267
|
-
var
|
|
4268
|
+
var path9 = aPath;
|
|
4268
4269
|
var url = urlParse(aPath);
|
|
4269
4270
|
if (url) {
|
|
4270
4271
|
if (!url.path) {
|
|
4271
4272
|
return aPath;
|
|
4272
4273
|
}
|
|
4273
|
-
|
|
4274
|
+
path9 = url.path;
|
|
4274
4275
|
}
|
|
4275
|
-
var
|
|
4276
|
-
var parts =
|
|
4277
|
-
for (var part,
|
|
4276
|
+
var isAbsolute2 = exports.isAbsolute(path9);
|
|
4277
|
+
var parts = path9.split(/\/+/);
|
|
4278
|
+
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
|
|
4278
4279
|
part = parts[i];
|
|
4279
4280
|
if (part === ".") {
|
|
4280
4281
|
parts.splice(i, 1);
|
|
4281
4282
|
} else if (part === "..") {
|
|
4282
|
-
|
|
4283
|
-
} else if (
|
|
4283
|
+
up++;
|
|
4284
|
+
} else if (up > 0) {
|
|
4284
4285
|
if (part === "") {
|
|
4285
|
-
parts.splice(i + 1,
|
|
4286
|
-
|
|
4286
|
+
parts.splice(i + 1, up);
|
|
4287
|
+
up = 0;
|
|
4287
4288
|
} else {
|
|
4288
4289
|
parts.splice(i, 2);
|
|
4289
|
-
|
|
4290
|
+
up--;
|
|
4290
4291
|
}
|
|
4291
4292
|
}
|
|
4292
4293
|
}
|
|
4293
|
-
|
|
4294
|
-
if (
|
|
4295
|
-
|
|
4294
|
+
path9 = parts.join("/");
|
|
4295
|
+
if (path9 === "") {
|
|
4296
|
+
path9 = isAbsolute2 ? "/" : ".";
|
|
4296
4297
|
}
|
|
4297
4298
|
if (url) {
|
|
4298
|
-
url.path =
|
|
4299
|
+
url.path = path9;
|
|
4299
4300
|
return urlGenerate(url);
|
|
4300
4301
|
}
|
|
4301
|
-
return
|
|
4302
|
+
return path9;
|
|
4302
4303
|
}
|
|
4303
4304
|
__name(normalize2, "normalize");
|
|
4304
4305
|
exports.normalize = normalize2;
|
|
4305
|
-
function
|
|
4306
|
+
function join10(aRoot, aPath) {
|
|
4306
4307
|
if (aRoot === "") {
|
|
4307
4308
|
aRoot = ".";
|
|
4308
4309
|
}
|
|
@@ -4334,8 +4335,8 @@ var require_util = __commonJS({
|
|
|
4334
4335
|
}
|
|
4335
4336
|
return joined;
|
|
4336
4337
|
}
|
|
4337
|
-
__name(
|
|
4338
|
-
exports.join =
|
|
4338
|
+
__name(join10, "join");
|
|
4339
|
+
exports.join = join10;
|
|
4339
4340
|
exports.isAbsolute = function(aPath) {
|
|
4340
4341
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
4341
4342
|
};
|
|
@@ -4518,7 +4519,7 @@ var require_util = __commonJS({
|
|
|
4518
4519
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
4519
4520
|
}
|
|
4520
4521
|
}
|
|
4521
|
-
sourceURL =
|
|
4522
|
+
sourceURL = join10(urlGenerate(parsed), sourceURL);
|
|
4522
4523
|
}
|
|
4523
4524
|
return normalize2(sourceURL);
|
|
4524
4525
|
}
|
|
@@ -5150,7 +5151,7 @@ var require_source_map_consumer = __commonJS({
|
|
|
5150
5151
|
var sourceRoot = util.getArg(sourceMap, "sourceRoot", null);
|
|
5151
5152
|
var sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
|
|
5152
5153
|
var mappings = util.getArg(sourceMap, "mappings");
|
|
5153
|
-
var
|
|
5154
|
+
var file = util.getArg(sourceMap, "file", null);
|
|
5154
5155
|
if (version != this._version) {
|
|
5155
5156
|
throw new Error("Unsupported version: " + version);
|
|
5156
5157
|
}
|
|
@@ -5169,7 +5170,7 @@ var require_source_map_consumer = __commonJS({
|
|
|
5169
5170
|
this.sourcesContent = sourcesContent;
|
|
5170
5171
|
this._mappings = mappings;
|
|
5171
5172
|
this._sourceMapURL = aSourceMapURL;
|
|
5172
|
-
this.file =
|
|
5173
|
+
this.file = file;
|
|
5173
5174
|
}
|
|
5174
5175
|
__name(BasicSourceMapConsumer, "BasicSourceMapConsumer");
|
|
5175
5176
|
BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
|
|
@@ -6166,9 +6167,9 @@ var require_util2 = __commonJS({
|
|
|
6166
6167
|
}
|
|
6167
6168
|
__name(isExportDeclaration, "isExportDeclaration");
|
|
6168
6169
|
exports.isExportDeclaration = isExportDeclaration;
|
|
6169
|
-
function getParentExportDeclaration(
|
|
6170
|
-
var parentNode =
|
|
6171
|
-
if (
|
|
6170
|
+
function getParentExportDeclaration(path9) {
|
|
6171
|
+
var parentNode = path9.getParentNode();
|
|
6172
|
+
if (path9.getName() === "declaration" && isExportDeclaration(parentNode)) {
|
|
6172
6173
|
return parentNode;
|
|
6173
6174
|
}
|
|
6174
6175
|
return null;
|
|
@@ -13634,16 +13635,16 @@ var require_comments = __commonJS({
|
|
|
13634
13635
|
return (0, lines_1.concat)(parts);
|
|
13635
13636
|
}
|
|
13636
13637
|
__name(printTrailingComment, "printTrailingComment");
|
|
13637
|
-
function printComments(
|
|
13638
|
-
var value =
|
|
13639
|
-
var innerLines = print2(
|
|
13638
|
+
function printComments(path9, print2) {
|
|
13639
|
+
var value = path9.getValue();
|
|
13640
|
+
var innerLines = print2(path9);
|
|
13640
13641
|
var comments = n.Node.check(value) && types11.getFieldValue(value, "comments");
|
|
13641
13642
|
if (!comments || comments.length === 0) {
|
|
13642
13643
|
return innerLines;
|
|
13643
13644
|
}
|
|
13644
13645
|
var leadingParts = [];
|
|
13645
13646
|
var trailingParts = [innerLines];
|
|
13646
|
-
|
|
13647
|
+
path9.each(function(commentPath) {
|
|
13647
13648
|
var comment = commentPath.getValue();
|
|
13648
13649
|
var leading = types11.getFieldValue(comment, "leading");
|
|
13649
13650
|
var trailing = types11.getFieldValue(comment, "trailing");
|
|
@@ -13719,23 +13720,23 @@ var require_parser = __commonJS({
|
|
|
13719
13720
|
}
|
|
13720
13721
|
ast.loc.lines = lines;
|
|
13721
13722
|
ast.loc.indent = 0;
|
|
13722
|
-
var
|
|
13723
|
+
var file;
|
|
13723
13724
|
var program;
|
|
13724
13725
|
if (ast.type === "Program") {
|
|
13725
13726
|
program = ast;
|
|
13726
|
-
|
|
13727
|
-
|
|
13727
|
+
file = b5.file(ast, options.sourceFileName || null);
|
|
13728
|
+
file.loc = {
|
|
13728
13729
|
start: lines.firstPos(),
|
|
13729
13730
|
end: lines.lastPos(),
|
|
13730
13731
|
lines,
|
|
13731
13732
|
indent: 0
|
|
13732
13733
|
};
|
|
13733
13734
|
} else if (ast.type === "File") {
|
|
13734
|
-
|
|
13735
|
-
program =
|
|
13735
|
+
file = ast;
|
|
13736
|
+
program = file.program;
|
|
13736
13737
|
}
|
|
13737
13738
|
if (options.tokens) {
|
|
13738
|
-
|
|
13739
|
+
file.tokens = tokens;
|
|
13739
13740
|
}
|
|
13740
13741
|
var trueProgramLoc = util.getTrueLoc({
|
|
13741
13742
|
type: program.type,
|
|
@@ -13745,8 +13746,8 @@ var require_parser = __commonJS({
|
|
|
13745
13746
|
}, lines);
|
|
13746
13747
|
program.loc.start = trueProgramLoc.start;
|
|
13747
13748
|
program.loc.end = trueProgramLoc.end;
|
|
13748
|
-
(0, comments_1.attach)(comments, program.body.length ?
|
|
13749
|
-
return new TreeCopier(lines, tokens).copy(
|
|
13749
|
+
(0, comments_1.attach)(comments, program.body.length ? file.program : file, lines);
|
|
13750
|
+
return new TreeCopier(lines, tokens).copy(file);
|
|
13750
13751
|
}
|
|
13751
13752
|
__name(parse7, "parse");
|
|
13752
13753
|
exports.parse = parse7;
|
|
@@ -13923,8 +13924,8 @@ var require_fast_path = __commonJS({
|
|
|
13923
13924
|
var valueIndex = s.length - 1;
|
|
13924
13925
|
return s.lastIndexOf(s[valueIndex], valueIndex - 1) >= 0;
|
|
13925
13926
|
};
|
|
13926
|
-
function getNodeHelper(
|
|
13927
|
-
var s =
|
|
13927
|
+
function getNodeHelper(path9, count) {
|
|
13928
|
+
var s = path9.stack;
|
|
13928
13929
|
for (var i = s.length - 1; i >= 0; i -= 2) {
|
|
13929
13930
|
var value = s[i];
|
|
13930
13931
|
if (n.Node.check(value) && --count < 0) {
|
|
@@ -14404,16 +14405,16 @@ var require_patcher = __commonJS({
|
|
|
14404
14405
|
}
|
|
14405
14406
|
});
|
|
14406
14407
|
};
|
|
14407
|
-
function getReprinter(
|
|
14408
|
-
(0, tiny_invariant_1.default)(
|
|
14409
|
-
var node =
|
|
14408
|
+
function getReprinter(path9) {
|
|
14409
|
+
(0, tiny_invariant_1.default)(path9 instanceof fast_path_1.default);
|
|
14410
|
+
var node = path9.getValue();
|
|
14410
14411
|
if (!Printable.check(node))
|
|
14411
14412
|
return;
|
|
14412
14413
|
var orig = node.original;
|
|
14413
14414
|
var origLoc = orig && orig.loc;
|
|
14414
14415
|
var lines = origLoc && origLoc.lines;
|
|
14415
14416
|
var reprints = [];
|
|
14416
|
-
if (!lines || !findReprints(
|
|
14417
|
+
if (!lines || !findReprints(path9, reprints))
|
|
14417
14418
|
return;
|
|
14418
14419
|
return function(print2) {
|
|
14419
14420
|
var patcher = new Patcher(lines);
|
|
@@ -14446,7 +14447,7 @@ var require_patcher = __commonJS({
|
|
|
14446
14447
|
patcher.replace(oldNode.loc, newLines);
|
|
14447
14448
|
});
|
|
14448
14449
|
var patchedLines = patcher.get(origLoc).indentTail(-orig.loc.indent);
|
|
14449
|
-
if (
|
|
14450
|
+
if (path9.needsParens()) {
|
|
14450
14451
|
return linesModule.concat(["(", patchedLines, ")"]);
|
|
14451
14452
|
}
|
|
14452
14453
|
return patchedLines;
|
|
@@ -14655,27 +14656,27 @@ var require_printer = __commonJS({
|
|
|
14655
14656
|
config.sourceFileName = null;
|
|
14656
14657
|
function makePrintFunctionWith(options, overrides) {
|
|
14657
14658
|
options = Object.assign({}, options, overrides);
|
|
14658
|
-
return function(
|
|
14659
|
-
return print2(
|
|
14659
|
+
return function(path9) {
|
|
14660
|
+
return print2(path9, options);
|
|
14660
14661
|
};
|
|
14661
14662
|
}
|
|
14662
14663
|
__name(makePrintFunctionWith, "makePrintFunctionWith");
|
|
14663
|
-
function print2(
|
|
14664
|
-
(0, tiny_invariant_1.default)(
|
|
14664
|
+
function print2(path9, options) {
|
|
14665
|
+
(0, tiny_invariant_1.default)(path9 instanceof fast_path_1.default);
|
|
14665
14666
|
options = options || {};
|
|
14666
14667
|
if (options.includeComments) {
|
|
14667
|
-
return (0, comments_1.printComments)(
|
|
14668
|
+
return (0, comments_1.printComments)(path9, makePrintFunctionWith(options, {
|
|
14668
14669
|
includeComments: false
|
|
14669
14670
|
}));
|
|
14670
14671
|
}
|
|
14671
14672
|
var oldTabWidth = config.tabWidth;
|
|
14672
14673
|
if (!explicitTabWidth) {
|
|
14673
|
-
var loc =
|
|
14674
|
+
var loc = path9.getNode().loc;
|
|
14674
14675
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
14675
14676
|
config.tabWidth = loc.lines.guessTabWidth();
|
|
14676
14677
|
}
|
|
14677
14678
|
}
|
|
14678
|
-
var reprinter = (0, patcher_1.getReprinter)(
|
|
14679
|
+
var reprinter = (0, patcher_1.getReprinter)(path9);
|
|
14679
14680
|
var lines = reprinter ? (
|
|
14680
14681
|
// Since the print function that we pass to the reprinter will
|
|
14681
14682
|
// be used to print "new" nodes, it's tempting to think we
|
|
@@ -14686,7 +14687,7 @@ var require_printer = __commonJS({
|
|
|
14686
14687
|
// right choice because it gives us the opportunity to reprint
|
|
14687
14688
|
// such nodes using their original source.
|
|
14688
14689
|
reprinter(print2)
|
|
14689
|
-
) : genericPrint(
|
|
14690
|
+
) : genericPrint(path9, config, options, makePrintFunctionWith(options, {
|
|
14690
14691
|
includeComments: true,
|
|
14691
14692
|
avoidRootParens: false
|
|
14692
14693
|
}));
|
|
@@ -14708,36 +14709,36 @@ var require_printer = __commonJS({
|
|
|
14708
14709
|
if (!ast) {
|
|
14709
14710
|
return emptyPrintResult;
|
|
14710
14711
|
}
|
|
14711
|
-
function printGenerically(
|
|
14712
|
-
return (0, comments_1.printComments)(
|
|
14713
|
-
return genericPrint(
|
|
14712
|
+
function printGenerically(path10) {
|
|
14713
|
+
return (0, comments_1.printComments)(path10, function(path11) {
|
|
14714
|
+
return genericPrint(path11, config, {
|
|
14714
14715
|
avoidRootParens: false
|
|
14715
14716
|
}, printGenerically);
|
|
14716
14717
|
});
|
|
14717
14718
|
}
|
|
14718
14719
|
__name(printGenerically, "printGenerically");
|
|
14719
|
-
var
|
|
14720
|
+
var path9 = fast_path_1.default.from(ast);
|
|
14720
14721
|
var oldReuseWhitespace = config.reuseWhitespace;
|
|
14721
14722
|
config.reuseWhitespace = false;
|
|
14722
|
-
var pr = new PrintResult(printGenerically(
|
|
14723
|
+
var pr = new PrintResult(printGenerically(path9).toString(config));
|
|
14723
14724
|
config.reuseWhitespace = oldReuseWhitespace;
|
|
14724
14725
|
return pr;
|
|
14725
14726
|
};
|
|
14726
14727
|
}, "Printer");
|
|
14727
14728
|
exports.Printer = Printer;
|
|
14728
|
-
function genericPrint(
|
|
14729
|
-
(0, tiny_invariant_1.default)(
|
|
14730
|
-
var node =
|
|
14729
|
+
function genericPrint(path9, config, options, printPath) {
|
|
14730
|
+
(0, tiny_invariant_1.default)(path9 instanceof fast_path_1.default);
|
|
14731
|
+
var node = path9.getValue();
|
|
14731
14732
|
var parts = [];
|
|
14732
|
-
var linesWithoutParens = genericPrintNoParens(
|
|
14733
|
+
var linesWithoutParens = genericPrintNoParens(path9, config, printPath);
|
|
14733
14734
|
if (!node || linesWithoutParens.isEmpty()) {
|
|
14734
14735
|
return linesWithoutParens;
|
|
14735
14736
|
}
|
|
14736
14737
|
var shouldAddParens = false;
|
|
14737
|
-
var decoratorsLines = printDecorators(
|
|
14738
|
+
var decoratorsLines = printDecorators(path9, printPath);
|
|
14738
14739
|
if (decoratorsLines.isEmpty()) {
|
|
14739
14740
|
if (!options.avoidRootParens) {
|
|
14740
|
-
shouldAddParens =
|
|
14741
|
+
shouldAddParens = path9.needsParens();
|
|
14741
14742
|
}
|
|
14742
14743
|
} else {
|
|
14743
14744
|
parts.push(decoratorsLines);
|
|
@@ -14752,9 +14753,9 @@ var require_printer = __commonJS({
|
|
|
14752
14753
|
return (0, lines_1.concat)(parts);
|
|
14753
14754
|
}
|
|
14754
14755
|
__name(genericPrint, "genericPrint");
|
|
14755
|
-
function genericPrintNoParens(
|
|
14756
|
+
function genericPrintNoParens(path9, options, print2) {
|
|
14756
14757
|
var _a2, _b, _c;
|
|
14757
|
-
var n =
|
|
14758
|
+
var n = path9.getValue();
|
|
14758
14759
|
if (!n) {
|
|
14759
14760
|
return (0, lines_1.fromString)("");
|
|
14760
14761
|
}
|
|
@@ -14765,17 +14766,17 @@ var require_printer = __commonJS({
|
|
|
14765
14766
|
var parts = [];
|
|
14766
14767
|
switch (n.type) {
|
|
14767
14768
|
case "File":
|
|
14768
|
-
return
|
|
14769
|
+
return path9.call(print2, "program");
|
|
14769
14770
|
case "Program":
|
|
14770
14771
|
if (n.directives) {
|
|
14771
|
-
|
|
14772
|
+
path9.each(function(childPath) {
|
|
14772
14773
|
parts.push(print2(childPath), ";\n");
|
|
14773
14774
|
}, "directives");
|
|
14774
14775
|
}
|
|
14775
14776
|
if (n.interpreter) {
|
|
14776
|
-
parts.push(
|
|
14777
|
+
parts.push(path9.call(print2, "interpreter"));
|
|
14777
14778
|
}
|
|
14778
|
-
parts.push(
|
|
14779
|
+
parts.push(path9.call(function(bodyPath) {
|
|
14779
14780
|
return printStatementSequence(bodyPath, options, print2);
|
|
14780
14781
|
}, "body"));
|
|
14781
14782
|
return (0, lines_1.concat)(parts);
|
|
@@ -14784,27 +14785,27 @@ var require_printer = __commonJS({
|
|
|
14784
14785
|
case "EmptyStatement":
|
|
14785
14786
|
return (0, lines_1.fromString)("");
|
|
14786
14787
|
case "ExpressionStatement":
|
|
14787
|
-
return (0, lines_1.concat)([
|
|
14788
|
+
return (0, lines_1.concat)([path9.call(print2, "expression"), ";"]);
|
|
14788
14789
|
case "ParenthesizedExpression":
|
|
14789
|
-
return (0, lines_1.concat)(["(",
|
|
14790
|
+
return (0, lines_1.concat)(["(", path9.call(print2, "expression"), ")"]);
|
|
14790
14791
|
case "BinaryExpression":
|
|
14791
14792
|
case "LogicalExpression":
|
|
14792
14793
|
case "AssignmentExpression":
|
|
14793
14794
|
return (0, lines_1.fromString)(" ").join([
|
|
14794
|
-
|
|
14795
|
+
path9.call(print2, "left"),
|
|
14795
14796
|
n.operator,
|
|
14796
|
-
|
|
14797
|
+
path9.call(print2, "right")
|
|
14797
14798
|
]);
|
|
14798
14799
|
case "AssignmentPattern":
|
|
14799
14800
|
return (0, lines_1.concat)([
|
|
14800
|
-
|
|
14801
|
+
path9.call(print2, "left"),
|
|
14801
14802
|
" = ",
|
|
14802
|
-
|
|
14803
|
+
path9.call(print2, "right")
|
|
14803
14804
|
]);
|
|
14804
14805
|
case "MemberExpression":
|
|
14805
14806
|
case "OptionalMemberExpression": {
|
|
14806
|
-
parts.push(
|
|
14807
|
-
var property =
|
|
14807
|
+
parts.push(path9.call(print2, "object"));
|
|
14808
|
+
var property = path9.call(print2, "property");
|
|
14808
14809
|
var optional = types11.getFieldValue(n, "optional");
|
|
14809
14810
|
if (n.computed) {
|
|
14810
14811
|
parts.push(optional ? "?.[" : "[", property, "]");
|
|
@@ -14814,18 +14815,18 @@ var require_printer = __commonJS({
|
|
|
14814
14815
|
return (0, lines_1.concat)(parts);
|
|
14815
14816
|
}
|
|
14816
14817
|
case "ChainExpression":
|
|
14817
|
-
return
|
|
14818
|
+
return path9.call(print2, "expression");
|
|
14818
14819
|
case "MetaProperty":
|
|
14819
14820
|
return (0, lines_1.concat)([
|
|
14820
|
-
|
|
14821
|
+
path9.call(print2, "meta"),
|
|
14821
14822
|
".",
|
|
14822
|
-
|
|
14823
|
+
path9.call(print2, "property")
|
|
14823
14824
|
]);
|
|
14824
14825
|
case "BindExpression":
|
|
14825
14826
|
if (n.object) {
|
|
14826
|
-
parts.push(
|
|
14827
|
+
parts.push(path9.call(print2, "object"));
|
|
14827
14828
|
}
|
|
14828
|
-
parts.push("::",
|
|
14829
|
+
parts.push("::", path9.call(print2, "callee"));
|
|
14829
14830
|
return (0, lines_1.concat)(parts);
|
|
14830
14831
|
case "Path":
|
|
14831
14832
|
return (0, lines_1.fromString)(".").join(n.body);
|
|
@@ -14833,7 +14834,7 @@ var require_printer = __commonJS({
|
|
|
14833
14834
|
return (0, lines_1.concat)([
|
|
14834
14835
|
(0, lines_1.fromString)(n.name, options),
|
|
14835
14836
|
n.optional ? "?" : "",
|
|
14836
|
-
|
|
14837
|
+
path9.call(print2, "typeAnnotation")
|
|
14837
14838
|
]);
|
|
14838
14839
|
case "SpreadElement":
|
|
14839
14840
|
case "SpreadElementPattern":
|
|
@@ -14845,8 +14846,8 @@ var require_printer = __commonJS({
|
|
|
14845
14846
|
case "RestElement":
|
|
14846
14847
|
return (0, lines_1.concat)([
|
|
14847
14848
|
"...",
|
|
14848
|
-
|
|
14849
|
-
|
|
14849
|
+
path9.call(print2, "argument"),
|
|
14850
|
+
path9.call(print2, "typeAnnotation")
|
|
14850
14851
|
]);
|
|
14851
14852
|
case "FunctionDeclaration":
|
|
14852
14853
|
case "FunctionExpression":
|
|
@@ -14861,15 +14862,15 @@ var require_printer = __commonJS({
|
|
|
14861
14862
|
if (n.generator)
|
|
14862
14863
|
parts.push("*");
|
|
14863
14864
|
if (n.id) {
|
|
14864
|
-
parts.push(" ",
|
|
14865
|
+
parts.push(" ", path9.call(print2, "id"), path9.call(print2, "typeParameters"));
|
|
14865
14866
|
} else {
|
|
14866
14867
|
if (n.typeParameters) {
|
|
14867
|
-
parts.push(
|
|
14868
|
+
parts.push(path9.call(print2, "typeParameters"));
|
|
14868
14869
|
}
|
|
14869
14870
|
}
|
|
14870
|
-
parts.push("(", printFunctionParams(
|
|
14871
|
+
parts.push("(", printFunctionParams(path9, options, print2), ")", path9.call(print2, "returnType"));
|
|
14871
14872
|
if (n.body) {
|
|
14872
|
-
parts.push(" ",
|
|
14873
|
+
parts.push(" ", path9.call(print2, "body"));
|
|
14873
14874
|
}
|
|
14874
14875
|
return (0, lines_1.concat)(parts);
|
|
14875
14876
|
case "ArrowFunctionExpression":
|
|
@@ -14877,44 +14878,44 @@ var require_printer = __commonJS({
|
|
|
14877
14878
|
parts.push("async ");
|
|
14878
14879
|
}
|
|
14879
14880
|
if (n.typeParameters) {
|
|
14880
|
-
parts.push(
|
|
14881
|
+
parts.push(path9.call(print2, "typeParameters"));
|
|
14881
14882
|
}
|
|
14882
14883
|
if (!options.arrowParensAlways && n.params.length === 1 && !n.rest && n.params[0].type === "Identifier" && !n.params[0].typeAnnotation && !n.returnType) {
|
|
14883
|
-
parts.push(
|
|
14884
|
+
parts.push(path9.call(print2, "params", 0));
|
|
14884
14885
|
} else {
|
|
14885
|
-
parts.push("(", printFunctionParams(
|
|
14886
|
+
parts.push("(", printFunctionParams(path9, options, print2), ")", path9.call(print2, "returnType"));
|
|
14886
14887
|
}
|
|
14887
|
-
parts.push(" => ",
|
|
14888
|
+
parts.push(" => ", path9.call(print2, "body"));
|
|
14888
14889
|
return (0, lines_1.concat)(parts);
|
|
14889
14890
|
case "MethodDefinition":
|
|
14890
|
-
return printMethod(
|
|
14891
|
+
return printMethod(path9, options, print2);
|
|
14891
14892
|
case "YieldExpression":
|
|
14892
14893
|
parts.push("yield");
|
|
14893
14894
|
if (n.delegate)
|
|
14894
14895
|
parts.push("*");
|
|
14895
14896
|
if (n.argument)
|
|
14896
|
-
parts.push(" ",
|
|
14897
|
+
parts.push(" ", path9.call(print2, "argument"));
|
|
14897
14898
|
return (0, lines_1.concat)(parts);
|
|
14898
14899
|
case "AwaitExpression":
|
|
14899
14900
|
parts.push("await");
|
|
14900
14901
|
if (n.all)
|
|
14901
14902
|
parts.push("*");
|
|
14902
14903
|
if (n.argument)
|
|
14903
|
-
parts.push(" ",
|
|
14904
|
+
parts.push(" ", path9.call(print2, "argument"));
|
|
14904
14905
|
return (0, lines_1.concat)(parts);
|
|
14905
14906
|
case "ModuleExpression":
|
|
14906
14907
|
return (0, lines_1.concat)([
|
|
14907
14908
|
"module {\n",
|
|
14908
|
-
|
|
14909
|
+
path9.call(print2, "body").indent(options.tabWidth),
|
|
14909
14910
|
"\n}"
|
|
14910
14911
|
]);
|
|
14911
14912
|
case "ModuleDeclaration":
|
|
14912
|
-
parts.push("module",
|
|
14913
|
+
parts.push("module", path9.call(print2, "id"));
|
|
14913
14914
|
if (n.source) {
|
|
14914
14915
|
(0, tiny_invariant_1.default)(!n.body);
|
|
14915
|
-
parts.push("from",
|
|
14916
|
+
parts.push("from", path9.call(print2, "source"));
|
|
14916
14917
|
} else {
|
|
14917
|
-
parts.push(
|
|
14918
|
+
parts.push(path9.call(print2, "body"));
|
|
14918
14919
|
}
|
|
14919
14920
|
return (0, lines_1.fromString)(" ").join(parts);
|
|
14920
14921
|
case "ImportSpecifier":
|
|
@@ -14922,14 +14923,14 @@ var require_printer = __commonJS({
|
|
|
14922
14923
|
parts.push(n.importKind + " ");
|
|
14923
14924
|
}
|
|
14924
14925
|
if (n.imported) {
|
|
14925
|
-
parts.push(
|
|
14926
|
+
parts.push(path9.call(print2, "imported"));
|
|
14926
14927
|
if (n.local && n.local.name !== n.imported.name) {
|
|
14927
|
-
parts.push(" as ",
|
|
14928
|
+
parts.push(" as ", path9.call(print2, "local"));
|
|
14928
14929
|
}
|
|
14929
14930
|
} else if (n.id) {
|
|
14930
|
-
parts.push(
|
|
14931
|
+
parts.push(path9.call(print2, "id"));
|
|
14931
14932
|
if (n.name) {
|
|
14932
|
-
parts.push(" as ",
|
|
14933
|
+
parts.push(" as ", path9.call(print2, "name"));
|
|
14933
14934
|
}
|
|
14934
14935
|
}
|
|
14935
14936
|
return (0, lines_1.concat)(parts);
|
|
@@ -14938,14 +14939,14 @@ var require_printer = __commonJS({
|
|
|
14938
14939
|
parts.push(n.exportKind + " ");
|
|
14939
14940
|
}
|
|
14940
14941
|
if (n.local) {
|
|
14941
|
-
parts.push(
|
|
14942
|
+
parts.push(path9.call(print2, "local"));
|
|
14942
14943
|
if (n.exported && n.exported.name !== n.local.name) {
|
|
14943
|
-
parts.push(" as ",
|
|
14944
|
+
parts.push(" as ", path9.call(print2, "exported"));
|
|
14944
14945
|
}
|
|
14945
14946
|
} else if (n.id) {
|
|
14946
|
-
parts.push(
|
|
14947
|
+
parts.push(path9.call(print2, "id"));
|
|
14947
14948
|
if (n.name) {
|
|
14948
|
-
parts.push(" as ",
|
|
14949
|
+
parts.push(" as ", path9.call(print2, "name"));
|
|
14949
14950
|
}
|
|
14950
14951
|
}
|
|
14951
14952
|
return (0, lines_1.concat)(parts);
|
|
@@ -14954,36 +14955,36 @@ var require_printer = __commonJS({
|
|
|
14954
14955
|
case "ImportNamespaceSpecifier":
|
|
14955
14956
|
parts.push("* as ");
|
|
14956
14957
|
if (n.local) {
|
|
14957
|
-
parts.push(
|
|
14958
|
+
parts.push(path9.call(print2, "local"));
|
|
14958
14959
|
} else if (n.id) {
|
|
14959
|
-
parts.push(
|
|
14960
|
+
parts.push(path9.call(print2, "id"));
|
|
14960
14961
|
}
|
|
14961
14962
|
return (0, lines_1.concat)(parts);
|
|
14962
14963
|
case "ImportDefaultSpecifier":
|
|
14963
14964
|
if (n.local) {
|
|
14964
|
-
return
|
|
14965
|
+
return path9.call(print2, "local");
|
|
14965
14966
|
}
|
|
14966
|
-
return
|
|
14967
|
+
return path9.call(print2, "id");
|
|
14967
14968
|
case "TSExportAssignment":
|
|
14968
|
-
return (0, lines_1.concat)(["export = ",
|
|
14969
|
+
return (0, lines_1.concat)(["export = ", path9.call(print2, "expression")]);
|
|
14969
14970
|
case "ExportDeclaration":
|
|
14970
14971
|
case "ExportDefaultDeclaration":
|
|
14971
14972
|
case "ExportNamedDeclaration":
|
|
14972
|
-
return printExportDeclaration(
|
|
14973
|
+
return printExportDeclaration(path9, options, print2);
|
|
14973
14974
|
case "ExportAllDeclaration":
|
|
14974
14975
|
parts.push("export *");
|
|
14975
14976
|
if (n.exported) {
|
|
14976
|
-
parts.push(" as ",
|
|
14977
|
+
parts.push(" as ", path9.call(print2, "exported"));
|
|
14977
14978
|
}
|
|
14978
|
-
parts.push(" from ",
|
|
14979
|
+
parts.push(" from ", path9.call(print2, "source"), ";");
|
|
14979
14980
|
return (0, lines_1.concat)(parts);
|
|
14980
14981
|
case "TSNamespaceExportDeclaration":
|
|
14981
|
-
parts.push("export as namespace ",
|
|
14982
|
+
parts.push("export as namespace ", path9.call(print2, "id"));
|
|
14982
14983
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
14983
14984
|
case "ExportNamespaceSpecifier":
|
|
14984
|
-
return (0, lines_1.concat)(["* as ",
|
|
14985
|
+
return (0, lines_1.concat)(["* as ", path9.call(print2, "exported")]);
|
|
14985
14986
|
case "ExportDefaultSpecifier":
|
|
14986
|
-
return
|
|
14987
|
+
return path9.call(print2, "exported");
|
|
14987
14988
|
case "Import":
|
|
14988
14989
|
return (0, lines_1.fromString)("import", options);
|
|
14989
14990
|
// Recast and ast-types currently support dynamic import(...) using
|
|
@@ -14991,7 +14992,7 @@ var require_printer = __commonJS({
|
|
|
14991
14992
|
// whose callee has type Import.
|
|
14992
14993
|
// https://github.com/benjamn/ast-types/pull/365#issuecomment-605214486
|
|
14993
14994
|
case "ImportExpression":
|
|
14994
|
-
return (0, lines_1.concat)(["import(",
|
|
14995
|
+
return (0, lines_1.concat)(["import(", path9.call(print2, "source"), ")"]);
|
|
14995
14996
|
case "ImportDeclaration": {
|
|
14996
14997
|
parts.push("import ");
|
|
14997
14998
|
if (n.importKind && n.importKind !== "value") {
|
|
@@ -15000,7 +15001,7 @@ var require_printer = __commonJS({
|
|
|
15000
15001
|
if (n.specifiers && n.specifiers.length > 0) {
|
|
15001
15002
|
var unbracedSpecifiers_1 = [];
|
|
15002
15003
|
var bracedSpecifiers_1 = [];
|
|
15003
|
-
|
|
15004
|
+
path9.each(function(specifierPath) {
|
|
15004
15005
|
var spec = specifierPath.getValue();
|
|
15005
15006
|
if (spec.type === "ImportSpecifier") {
|
|
15006
15007
|
bracedSpecifiers_1.push(print2(specifierPath));
|
|
@@ -15035,16 +15036,16 @@ var require_printer = __commonJS({
|
|
|
15035
15036
|
}
|
|
15036
15037
|
parts.push(" from ");
|
|
15037
15038
|
}
|
|
15038
|
-
parts.push(
|
|
15039
|
+
parts.push(path9.call(print2, "source"), maybePrintImportAssertions(path9, options, print2), ";");
|
|
15039
15040
|
return (0, lines_1.concat)(parts);
|
|
15040
15041
|
}
|
|
15041
15042
|
case "ImportAttribute":
|
|
15042
|
-
return (0, lines_1.concat)([
|
|
15043
|
+
return (0, lines_1.concat)([path9.call(print2, "key"), ": ", path9.call(print2, "value")]);
|
|
15043
15044
|
case "StaticBlock":
|
|
15044
15045
|
parts.push("static ");
|
|
15045
15046
|
// Intentionally fall through to BlockStatement below.
|
|
15046
15047
|
case "BlockStatement": {
|
|
15047
|
-
var naked_1 =
|
|
15048
|
+
var naked_1 = path9.call(function(bodyPath) {
|
|
15048
15049
|
return printStatementSequence(bodyPath, options, print2);
|
|
15049
15050
|
}, "body");
|
|
15050
15051
|
if (naked_1.isEmpty()) {
|
|
@@ -15055,7 +15056,7 @@ var require_printer = __commonJS({
|
|
|
15055
15056
|
}
|
|
15056
15057
|
parts.push("{\n");
|
|
15057
15058
|
if (n.directives) {
|
|
15058
|
-
|
|
15059
|
+
path9.each(function(childPath) {
|
|
15059
15060
|
parts.push(maybeAddSemicolon(print2(childPath).indent(options.tabWidth)), n.directives.length > 1 || !naked_1.isEmpty() ? "\n" : "");
|
|
15060
15061
|
}, "directives");
|
|
15061
15062
|
}
|
|
@@ -15067,11 +15068,11 @@ var require_printer = __commonJS({
|
|
|
15067
15068
|
parts.push("return");
|
|
15068
15069
|
if (n.argument) {
|
|
15069
15070
|
var argIsJsxElement = ((_a2 = namedTypes.JSXElement) === null || _a2 === void 0 ? void 0 : _a2.check(n.argument)) || ((_b = namedTypes.JSXFragment) === null || _b === void 0 ? void 0 : _b.check(n.argument));
|
|
15070
|
-
var argLines =
|
|
15071
|
+
var argLines = path9.call(print2, "argument");
|
|
15071
15072
|
if (argLines.startsWithComment() || argLines.length > 1 && argIsJsxElement) {
|
|
15072
15073
|
if (argIsJsxElement && ((_c = n.argument.extra) === null || _c === void 0 ? void 0 : _c.parenthesized)) {
|
|
15073
15074
|
n.argument.extra.parenthesized = false;
|
|
15074
|
-
argLines =
|
|
15075
|
+
argLines = path9.call(print2, "argument");
|
|
15075
15076
|
n.argument.extra.parenthesized = true;
|
|
15076
15077
|
}
|
|
15077
15078
|
parts.push(" ", (0, lines_1.concat)(["(\n", argLines]).indentTail(options.tabWidth), "\n)");
|
|
@@ -15084,17 +15085,17 @@ var require_printer = __commonJS({
|
|
|
15084
15085
|
}
|
|
15085
15086
|
case "CallExpression":
|
|
15086
15087
|
case "OptionalCallExpression":
|
|
15087
|
-
parts.push(
|
|
15088
|
+
parts.push(path9.call(print2, "callee"));
|
|
15088
15089
|
if (n.typeParameters) {
|
|
15089
|
-
parts.push(
|
|
15090
|
+
parts.push(path9.call(print2, "typeParameters"));
|
|
15090
15091
|
}
|
|
15091
15092
|
if (n.typeArguments) {
|
|
15092
|
-
parts.push(
|
|
15093
|
+
parts.push(path9.call(print2, "typeArguments"));
|
|
15093
15094
|
}
|
|
15094
15095
|
if (types11.getFieldValue(n, "optional")) {
|
|
15095
15096
|
parts.push("?.");
|
|
15096
15097
|
}
|
|
15097
|
-
parts.push(printArgumentsList(
|
|
15098
|
+
parts.push(printArgumentsList(path9, options, print2));
|
|
15098
15099
|
return (0, lines_1.concat)(parts);
|
|
15099
15100
|
case "RecordExpression":
|
|
15100
15101
|
parts.push("#");
|
|
@@ -15124,7 +15125,7 @@ var require_printer = __commonJS({
|
|
|
15124
15125
|
var leftBraceIndex = parts.length - 1;
|
|
15125
15126
|
var i_1 = 0;
|
|
15126
15127
|
fields.forEach(function(field) {
|
|
15127
|
-
|
|
15128
|
+
path9.each(function(childPath) {
|
|
15128
15129
|
var lines2 = print2(childPath);
|
|
15129
15130
|
if (!oneLine_1) {
|
|
15130
15131
|
lines2 = lines2.indent(options.tabWidth);
|
|
@@ -15162,33 +15163,33 @@ var require_printer = __commonJS({
|
|
|
15162
15163
|
parts[parts.length - 1] = " " + rightBrace;
|
|
15163
15164
|
}
|
|
15164
15165
|
if (n.typeAnnotation) {
|
|
15165
|
-
parts.push(
|
|
15166
|
+
parts.push(path9.call(print2, "typeAnnotation"));
|
|
15166
15167
|
}
|
|
15167
15168
|
return (0, lines_1.concat)(parts);
|
|
15168
15169
|
}
|
|
15169
15170
|
case "PropertyPattern":
|
|
15170
15171
|
return (0, lines_1.concat)([
|
|
15171
|
-
|
|
15172
|
+
path9.call(print2, "key"),
|
|
15172
15173
|
": ",
|
|
15173
|
-
|
|
15174
|
+
path9.call(print2, "pattern")
|
|
15174
15175
|
]);
|
|
15175
15176
|
case "ObjectProperty":
|
|
15176
15177
|
// Babel 6
|
|
15177
15178
|
case "Property": {
|
|
15178
15179
|
if (n.method || n.kind === "get" || n.kind === "set") {
|
|
15179
|
-
return printMethod(
|
|
15180
|
+
return printMethod(path9, options, print2);
|
|
15180
15181
|
}
|
|
15181
15182
|
if (n.shorthand && n.value.type === "AssignmentPattern") {
|
|
15182
|
-
return
|
|
15183
|
+
return path9.call(print2, "value");
|
|
15183
15184
|
}
|
|
15184
|
-
var key =
|
|
15185
|
+
var key = path9.call(print2, "key");
|
|
15185
15186
|
if (n.computed) {
|
|
15186
15187
|
parts.push("[", key, "]");
|
|
15187
15188
|
} else {
|
|
15188
15189
|
parts.push(key);
|
|
15189
15190
|
}
|
|
15190
15191
|
if (!n.shorthand || n.key.name !== n.value.name) {
|
|
15191
|
-
parts.push(": ",
|
|
15192
|
+
parts.push(": ", path9.call(print2, "value"));
|
|
15192
15193
|
}
|
|
15193
15194
|
return (0, lines_1.concat)(parts);
|
|
15194
15195
|
}
|
|
@@ -15198,11 +15199,11 @@ var require_printer = __commonJS({
|
|
|
15198
15199
|
// Babel 6
|
|
15199
15200
|
case "ClassPrivateMethod":
|
|
15200
15201
|
case "TSDeclareMethod":
|
|
15201
|
-
return printMethod(
|
|
15202
|
+
return printMethod(path9, options, print2);
|
|
15202
15203
|
case "PrivateName":
|
|
15203
|
-
return (0, lines_1.concat)(["#",
|
|
15204
|
+
return (0, lines_1.concat)(["#", path9.call(print2, "id")]);
|
|
15204
15205
|
case "Decorator":
|
|
15205
|
-
return (0, lines_1.concat)(["@",
|
|
15206
|
+
return (0, lines_1.concat)(["@", path9.call(print2, "expression")]);
|
|
15206
15207
|
case "TupleExpression":
|
|
15207
15208
|
parts.push("#");
|
|
15208
15209
|
// Intentionally fall through to printing the tuple elements...
|
|
@@ -15210,7 +15211,7 @@ var require_printer = __commonJS({
|
|
|
15210
15211
|
case "ArrayPattern": {
|
|
15211
15212
|
var elems = n.elements;
|
|
15212
15213
|
var len_2 = elems.length;
|
|
15213
|
-
var printed_1 =
|
|
15214
|
+
var printed_1 = path9.map(print2, "elements");
|
|
15214
15215
|
var joined = (0, lines_1.fromString)(", ").join(printed_1);
|
|
15215
15216
|
var oneLine_2 = joined.getLineLength(1) <= options.wrapColumn;
|
|
15216
15217
|
if (oneLine_2) {
|
|
@@ -15222,7 +15223,7 @@ var require_printer = __commonJS({
|
|
|
15222
15223
|
} else {
|
|
15223
15224
|
parts.push("[\n");
|
|
15224
15225
|
}
|
|
15225
|
-
|
|
15226
|
+
path9.each(function(elemPath) {
|
|
15226
15227
|
var i = elemPath.getName();
|
|
15227
15228
|
var elem = elemPath.getValue();
|
|
15228
15229
|
if (!elem) {
|
|
@@ -15248,12 +15249,12 @@ var require_printer = __commonJS({
|
|
|
15248
15249
|
parts.push("]");
|
|
15249
15250
|
}
|
|
15250
15251
|
if (n.typeAnnotation) {
|
|
15251
|
-
parts.push(
|
|
15252
|
+
parts.push(path9.call(print2, "typeAnnotation"));
|
|
15252
15253
|
}
|
|
15253
15254
|
return (0, lines_1.concat)(parts);
|
|
15254
15255
|
}
|
|
15255
15256
|
case "SequenceExpression":
|
|
15256
|
-
return (0, lines_1.fromString)(", ").join(
|
|
15257
|
+
return (0, lines_1.fromString)(", ").join(path9.map(print2, "expressions"));
|
|
15257
15258
|
case "ThisExpression":
|
|
15258
15259
|
return (0, lines_1.fromString)("this");
|
|
15259
15260
|
case "Super":
|
|
@@ -15275,7 +15276,7 @@ var require_printer = __commonJS({
|
|
|
15275
15276
|
case "Literal":
|
|
15276
15277
|
return (0, lines_1.fromString)(getPossibleRaw(n) || (typeof n.value === "string" ? nodeStr(n.value, options) : n.value), options);
|
|
15277
15278
|
case "Directive":
|
|
15278
|
-
return
|
|
15279
|
+
return path9.call(print2, "value");
|
|
15279
15280
|
case "DirectiveLiteral":
|
|
15280
15281
|
return (0, lines_1.fromString)(getPossibleRaw(n) || nodeStr(n.value, options), options);
|
|
15281
15282
|
case "InterpreterDirective":
|
|
@@ -15289,32 +15290,32 @@ var require_printer = __commonJS({
|
|
|
15289
15290
|
parts.push(n.operator);
|
|
15290
15291
|
if (/[a-z]$/.test(n.operator))
|
|
15291
15292
|
parts.push(" ");
|
|
15292
|
-
parts.push(
|
|
15293
|
+
parts.push(path9.call(print2, "argument"));
|
|
15293
15294
|
return (0, lines_1.concat)(parts);
|
|
15294
15295
|
case "UpdateExpression":
|
|
15295
|
-
parts.push(
|
|
15296
|
+
parts.push(path9.call(print2, "argument"), n.operator);
|
|
15296
15297
|
if (n.prefix)
|
|
15297
15298
|
parts.reverse();
|
|
15298
15299
|
return (0, lines_1.concat)(parts);
|
|
15299
15300
|
case "ConditionalExpression":
|
|
15300
15301
|
return (0, lines_1.concat)([
|
|
15301
|
-
|
|
15302
|
+
path9.call(print2, "test"),
|
|
15302
15303
|
" ? ",
|
|
15303
|
-
|
|
15304
|
+
path9.call(print2, "consequent"),
|
|
15304
15305
|
" : ",
|
|
15305
|
-
|
|
15306
|
+
path9.call(print2, "alternate")
|
|
15306
15307
|
]);
|
|
15307
15308
|
case "NewExpression": {
|
|
15308
|
-
parts.push("new ",
|
|
15309
|
+
parts.push("new ", path9.call(print2, "callee"));
|
|
15309
15310
|
if (n.typeParameters) {
|
|
15310
|
-
parts.push(
|
|
15311
|
+
parts.push(path9.call(print2, "typeParameters"));
|
|
15311
15312
|
}
|
|
15312
15313
|
if (n.typeArguments) {
|
|
15313
|
-
parts.push(
|
|
15314
|
+
parts.push(path9.call(print2, "typeArguments"));
|
|
15314
15315
|
}
|
|
15315
15316
|
var args = n.arguments;
|
|
15316
15317
|
if (args) {
|
|
15317
|
-
parts.push(printArgumentsList(
|
|
15318
|
+
parts.push(printArgumentsList(path9, options, print2));
|
|
15318
15319
|
}
|
|
15319
15320
|
return (0, lines_1.concat)(parts);
|
|
15320
15321
|
}
|
|
@@ -15324,7 +15325,7 @@ var require_printer = __commonJS({
|
|
|
15324
15325
|
}
|
|
15325
15326
|
parts.push(n.kind, " ");
|
|
15326
15327
|
var maxLen_1 = 0;
|
|
15327
|
-
var printed =
|
|
15328
|
+
var printed = path9.map(function(childPath) {
|
|
15328
15329
|
var lines2 = print2(childPath);
|
|
15329
15330
|
maxLen_1 = Math.max(lines2.length, maxLen_1);
|
|
15330
15331
|
return lines2;
|
|
@@ -15336,7 +15337,7 @@ var require_printer = __commonJS({
|
|
|
15336
15337
|
} else {
|
|
15337
15338
|
parts.push(printed[0]);
|
|
15338
15339
|
}
|
|
15339
|
-
var parentNode =
|
|
15340
|
+
var parentNode = path9.getParentNode();
|
|
15340
15341
|
if (!namedTypes.ForStatement.check(parentNode) && !namedTypes.ForInStatement.check(parentNode) && !(namedTypes.ForOfStatement && namedTypes.ForOfStatement.check(parentNode)) && !(namedTypes.ForAwaitStatement && namedTypes.ForAwaitStatement.check(parentNode))) {
|
|
15341
15342
|
parts.push(";");
|
|
15342
15343
|
}
|
|
@@ -15344,30 +15345,30 @@ var require_printer = __commonJS({
|
|
|
15344
15345
|
}
|
|
15345
15346
|
case "VariableDeclarator":
|
|
15346
15347
|
return n.init ? (0, lines_1.fromString)(" = ").join([
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
]) :
|
|
15348
|
+
path9.call(print2, "id"),
|
|
15349
|
+
path9.call(print2, "init")
|
|
15350
|
+
]) : path9.call(print2, "id");
|
|
15350
15351
|
case "WithStatement":
|
|
15351
15352
|
return (0, lines_1.concat)([
|
|
15352
15353
|
"with (",
|
|
15353
|
-
|
|
15354
|
+
path9.call(print2, "object"),
|
|
15354
15355
|
") ",
|
|
15355
|
-
|
|
15356
|
+
path9.call(print2, "body")
|
|
15356
15357
|
]);
|
|
15357
15358
|
case "IfStatement": {
|
|
15358
|
-
var con = adjustClause(
|
|
15359
|
-
parts.push("if (",
|
|
15359
|
+
var con = adjustClause(path9.call(print2, "consequent"), options);
|
|
15360
|
+
parts.push("if (", path9.call(print2, "test"), ")", con);
|
|
15360
15361
|
if (n.alternate)
|
|
15361
|
-
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(
|
|
15362
|
+
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path9.call(print2, "alternate"), options));
|
|
15362
15363
|
return (0, lines_1.concat)(parts);
|
|
15363
15364
|
}
|
|
15364
15365
|
case "ForStatement": {
|
|
15365
|
-
var init =
|
|
15366
|
+
var init = path9.call(print2, "init");
|
|
15366
15367
|
var sep2 = init.length > 1 ? ";\n" : "; ";
|
|
15367
15368
|
var forParen = "for (";
|
|
15368
|
-
var indented = (0, lines_1.fromString)(sep2).join([init,
|
|
15369
|
+
var indented = (0, lines_1.fromString)(sep2).join([init, path9.call(print2, "test"), path9.call(print2, "update")]).indentTail(forParen.length);
|
|
15369
15370
|
var head = (0, lines_1.concat)([forParen, indented, ")"]);
|
|
15370
|
-
var clause = adjustClause(
|
|
15371
|
+
var clause = adjustClause(path9.call(print2, "body"), options);
|
|
15371
15372
|
parts.push(head);
|
|
15372
15373
|
if (head.length > 1) {
|
|
15373
15374
|
parts.push("\n");
|
|
@@ -15379,18 +15380,18 @@ var require_printer = __commonJS({
|
|
|
15379
15380
|
case "WhileStatement":
|
|
15380
15381
|
return (0, lines_1.concat)([
|
|
15381
15382
|
"while (",
|
|
15382
|
-
|
|
15383
|
+
path9.call(print2, "test"),
|
|
15383
15384
|
")",
|
|
15384
|
-
adjustClause(
|
|
15385
|
+
adjustClause(path9.call(print2, "body"), options)
|
|
15385
15386
|
]);
|
|
15386
15387
|
case "ForInStatement":
|
|
15387
15388
|
return (0, lines_1.concat)([
|
|
15388
15389
|
n.each ? "for each (" : "for (",
|
|
15389
|
-
|
|
15390
|
+
path9.call(print2, "left"),
|
|
15390
15391
|
" in ",
|
|
15391
|
-
|
|
15392
|
+
path9.call(print2, "right"),
|
|
15392
15393
|
")",
|
|
15393
|
-
adjustClause(
|
|
15394
|
+
adjustClause(path9.call(print2, "body"), options)
|
|
15394
15395
|
]);
|
|
15395
15396
|
case "ForOfStatement":
|
|
15396
15397
|
case "ForAwaitStatement":
|
|
@@ -15398,23 +15399,23 @@ var require_printer = __commonJS({
|
|
|
15398
15399
|
if (n.await || n.type === "ForAwaitStatement") {
|
|
15399
15400
|
parts.push("await ");
|
|
15400
15401
|
}
|
|
15401
|
-
parts.push("(",
|
|
15402
|
+
parts.push("(", path9.call(print2, "left"), " of ", path9.call(print2, "right"), ")", adjustClause(path9.call(print2, "body"), options));
|
|
15402
15403
|
return (0, lines_1.concat)(parts);
|
|
15403
15404
|
case "DoWhileStatement": {
|
|
15404
15405
|
var doBody = (0, lines_1.concat)([
|
|
15405
15406
|
"do",
|
|
15406
|
-
adjustClause(
|
|
15407
|
+
adjustClause(path9.call(print2, "body"), options)
|
|
15407
15408
|
]);
|
|
15408
15409
|
parts.push(doBody);
|
|
15409
15410
|
if (endsWithBrace(doBody))
|
|
15410
15411
|
parts.push(" while");
|
|
15411
15412
|
else
|
|
15412
15413
|
parts.push("\nwhile");
|
|
15413
|
-
parts.push(" (",
|
|
15414
|
+
parts.push(" (", path9.call(print2, "test"), ");");
|
|
15414
15415
|
return (0, lines_1.concat)(parts);
|
|
15415
15416
|
}
|
|
15416
15417
|
case "DoExpression": {
|
|
15417
|
-
var statements =
|
|
15418
|
+
var statements = path9.call(function(bodyPath) {
|
|
15418
15419
|
return printStatementSequence(bodyPath, options, print2);
|
|
15419
15420
|
}, "body");
|
|
15420
15421
|
return (0, lines_1.concat)(["do {\n", statements.indent(options.tabWidth), "\n}"]);
|
|
@@ -15422,65 +15423,65 @@ var require_printer = __commonJS({
|
|
|
15422
15423
|
case "BreakStatement":
|
|
15423
15424
|
parts.push("break");
|
|
15424
15425
|
if (n.label)
|
|
15425
|
-
parts.push(" ",
|
|
15426
|
+
parts.push(" ", path9.call(print2, "label"));
|
|
15426
15427
|
parts.push(";");
|
|
15427
15428
|
return (0, lines_1.concat)(parts);
|
|
15428
15429
|
case "ContinueStatement":
|
|
15429
15430
|
parts.push("continue");
|
|
15430
15431
|
if (n.label)
|
|
15431
|
-
parts.push(" ",
|
|
15432
|
+
parts.push(" ", path9.call(print2, "label"));
|
|
15432
15433
|
parts.push(";");
|
|
15433
15434
|
return (0, lines_1.concat)(parts);
|
|
15434
15435
|
case "LabeledStatement":
|
|
15435
15436
|
return (0, lines_1.concat)([
|
|
15436
|
-
|
|
15437
|
+
path9.call(print2, "label"),
|
|
15437
15438
|
":\n",
|
|
15438
|
-
|
|
15439
|
+
path9.call(print2, "body")
|
|
15439
15440
|
]);
|
|
15440
15441
|
case "TryStatement":
|
|
15441
|
-
parts.push("try ",
|
|
15442
|
+
parts.push("try ", path9.call(print2, "block"));
|
|
15442
15443
|
if (n.handler) {
|
|
15443
|
-
parts.push(" ",
|
|
15444
|
+
parts.push(" ", path9.call(print2, "handler"));
|
|
15444
15445
|
} else if (n.handlers) {
|
|
15445
|
-
|
|
15446
|
+
path9.each(function(handlerPath) {
|
|
15446
15447
|
parts.push(" ", print2(handlerPath));
|
|
15447
15448
|
}, "handlers");
|
|
15448
15449
|
}
|
|
15449
15450
|
if (n.finalizer) {
|
|
15450
|
-
parts.push(" finally ",
|
|
15451
|
+
parts.push(" finally ", path9.call(print2, "finalizer"));
|
|
15451
15452
|
}
|
|
15452
15453
|
return (0, lines_1.concat)(parts);
|
|
15453
15454
|
case "CatchClause":
|
|
15454
15455
|
parts.push("catch ");
|
|
15455
15456
|
if (n.param) {
|
|
15456
|
-
parts.push("(",
|
|
15457
|
+
parts.push("(", path9.call(print2, "param"));
|
|
15457
15458
|
}
|
|
15458
15459
|
if (n.guard) {
|
|
15459
|
-
parts.push(" if ",
|
|
15460
|
+
parts.push(" if ", path9.call(print2, "guard"));
|
|
15460
15461
|
}
|
|
15461
15462
|
if (n.param) {
|
|
15462
15463
|
parts.push(") ");
|
|
15463
15464
|
}
|
|
15464
|
-
parts.push(
|
|
15465
|
+
parts.push(path9.call(print2, "body"));
|
|
15465
15466
|
return (0, lines_1.concat)(parts);
|
|
15466
15467
|
case "ThrowStatement":
|
|
15467
|
-
return (0, lines_1.concat)(["throw ",
|
|
15468
|
+
return (0, lines_1.concat)(["throw ", path9.call(print2, "argument"), ";"]);
|
|
15468
15469
|
case "SwitchStatement":
|
|
15469
15470
|
return (0, lines_1.concat)([
|
|
15470
15471
|
"switch (",
|
|
15471
|
-
|
|
15472
|
+
path9.call(print2, "discriminant"),
|
|
15472
15473
|
") {\n",
|
|
15473
|
-
(0, lines_1.fromString)("\n").join(
|
|
15474
|
+
(0, lines_1.fromString)("\n").join(path9.map(print2, "cases")),
|
|
15474
15475
|
"\n}"
|
|
15475
15476
|
]);
|
|
15476
15477
|
// Note: ignoring n.lexical because it has no printing consequences.
|
|
15477
15478
|
case "SwitchCase":
|
|
15478
15479
|
if (n.test)
|
|
15479
|
-
parts.push("case ",
|
|
15480
|
+
parts.push("case ", path9.call(print2, "test"), ":");
|
|
15480
15481
|
else
|
|
15481
15482
|
parts.push("default:");
|
|
15482
15483
|
if (n.consequent.length > 0) {
|
|
15483
|
-
parts.push("\n",
|
|
15484
|
+
parts.push("\n", path9.call(function(consequentPath) {
|
|
15484
15485
|
return printStatementSequence(consequentPath, options, print2);
|
|
15485
15486
|
}, "consequent").indent(options.tabWidth));
|
|
15486
15487
|
}
|
|
@@ -15489,38 +15490,38 @@ var require_printer = __commonJS({
|
|
|
15489
15490
|
return (0, lines_1.fromString)("debugger;");
|
|
15490
15491
|
// JSX extensions below.
|
|
15491
15492
|
case "JSXAttribute":
|
|
15492
|
-
parts.push(
|
|
15493
|
+
parts.push(path9.call(print2, "name"));
|
|
15493
15494
|
if (n.value)
|
|
15494
|
-
parts.push("=",
|
|
15495
|
+
parts.push("=", path9.call(print2, "value"));
|
|
15495
15496
|
return (0, lines_1.concat)(parts);
|
|
15496
15497
|
case "JSXIdentifier":
|
|
15497
15498
|
return (0, lines_1.fromString)(n.name, options);
|
|
15498
15499
|
case "JSXNamespacedName":
|
|
15499
15500
|
return (0, lines_1.fromString)(":").join([
|
|
15500
|
-
|
|
15501
|
-
|
|
15501
|
+
path9.call(print2, "namespace"),
|
|
15502
|
+
path9.call(print2, "name")
|
|
15502
15503
|
]);
|
|
15503
15504
|
case "JSXMemberExpression":
|
|
15504
15505
|
return (0, lines_1.fromString)(".").join([
|
|
15505
|
-
|
|
15506
|
-
|
|
15506
|
+
path9.call(print2, "object"),
|
|
15507
|
+
path9.call(print2, "property")
|
|
15507
15508
|
]);
|
|
15508
15509
|
case "JSXSpreadAttribute":
|
|
15509
|
-
return (0, lines_1.concat)(["{...",
|
|
15510
|
+
return (0, lines_1.concat)(["{...", path9.call(print2, "argument"), "}"]);
|
|
15510
15511
|
case "JSXSpreadChild":
|
|
15511
|
-
return (0, lines_1.concat)(["{...",
|
|
15512
|
+
return (0, lines_1.concat)(["{...", path9.call(print2, "expression"), "}"]);
|
|
15512
15513
|
case "JSXExpressionContainer":
|
|
15513
|
-
return (0, lines_1.concat)(["{",
|
|
15514
|
+
return (0, lines_1.concat)(["{", path9.call(print2, "expression"), "}"]);
|
|
15514
15515
|
case "JSXElement":
|
|
15515
15516
|
case "JSXFragment": {
|
|
15516
15517
|
var openingPropName = "opening" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
15517
15518
|
var closingPropName = "closing" + (n.type === "JSXElement" ? "Element" : "Fragment");
|
|
15518
|
-
var openingLines =
|
|
15519
|
+
var openingLines = path9.call(print2, openingPropName);
|
|
15519
15520
|
if (n[openingPropName].selfClosing) {
|
|
15520
15521
|
(0, tiny_invariant_1.default)(!n[closingPropName], "unexpected " + closingPropName + " element in self-closing " + n.type);
|
|
15521
15522
|
return openingLines;
|
|
15522
15523
|
}
|
|
15523
|
-
var childLines = (0, lines_1.concat)(
|
|
15524
|
+
var childLines = (0, lines_1.concat)(path9.map(function(childPath) {
|
|
15524
15525
|
var child = childPath.getValue();
|
|
15525
15526
|
if (namedTypes.Literal.check(child) && typeof child.value === "string") {
|
|
15526
15527
|
if (/\S/.test(child.value)) {
|
|
@@ -15531,16 +15532,16 @@ var require_printer = __commonJS({
|
|
|
15531
15532
|
}
|
|
15532
15533
|
return print2(childPath);
|
|
15533
15534
|
}, "children")).indentTail(options.tabWidth);
|
|
15534
|
-
var closingLines =
|
|
15535
|
+
var closingLines = path9.call(print2, closingPropName);
|
|
15535
15536
|
return (0, lines_1.concat)([openingLines, childLines, closingLines]);
|
|
15536
15537
|
}
|
|
15537
15538
|
case "JSXOpeningElement": {
|
|
15538
|
-
parts.push("<",
|
|
15539
|
-
var typeDefPart =
|
|
15539
|
+
parts.push("<", path9.call(print2, "name"));
|
|
15540
|
+
var typeDefPart = path9.call(print2, "typeParameters");
|
|
15540
15541
|
if (typeDefPart.length)
|
|
15541
15542
|
parts.push(typeDefPart);
|
|
15542
15543
|
var attrParts_1 = [];
|
|
15543
|
-
|
|
15544
|
+
path9.each(function(attrPath) {
|
|
15544
15545
|
attrParts_1.push(" ", print2(attrPath));
|
|
15545
15546
|
}, "attributes");
|
|
15546
15547
|
var attrLines = (0, lines_1.concat)(attrParts_1);
|
|
@@ -15558,7 +15559,7 @@ var require_printer = __commonJS({
|
|
|
15558
15559
|
return (0, lines_1.concat)(parts);
|
|
15559
15560
|
}
|
|
15560
15561
|
case "JSXClosingElement":
|
|
15561
|
-
return (0, lines_1.concat)(["</",
|
|
15562
|
+
return (0, lines_1.concat)(["</", path9.call(print2, "name"), ">"]);
|
|
15562
15563
|
case "JSXOpeningFragment":
|
|
15563
15564
|
return (0, lines_1.fromString)("<>");
|
|
15564
15565
|
case "JSXClosingFragment":
|
|
@@ -15569,9 +15570,9 @@ var require_printer = __commonJS({
|
|
|
15569
15570
|
return (0, lines_1.fromString)("");
|
|
15570
15571
|
case "TypeAnnotatedIdentifier":
|
|
15571
15572
|
return (0, lines_1.concat)([
|
|
15572
|
-
|
|
15573
|
+
path9.call(print2, "annotation"),
|
|
15573
15574
|
" ",
|
|
15574
|
-
|
|
15575
|
+
path9.call(print2, "identifier")
|
|
15575
15576
|
]);
|
|
15576
15577
|
case "ClassBody":
|
|
15577
15578
|
if (n.body.length === 0) {
|
|
@@ -15579,13 +15580,13 @@ var require_printer = __commonJS({
|
|
|
15579
15580
|
}
|
|
15580
15581
|
return (0, lines_1.concat)([
|
|
15581
15582
|
"{\n",
|
|
15582
|
-
|
|
15583
|
+
path9.call(function(bodyPath) {
|
|
15583
15584
|
return printStatementSequence(bodyPath, options, print2);
|
|
15584
15585
|
}, "body").indent(options.tabWidth),
|
|
15585
15586
|
"\n}"
|
|
15586
15587
|
]);
|
|
15587
15588
|
case "ClassPropertyDefinition":
|
|
15588
|
-
parts.push("static ",
|
|
15589
|
+
parts.push("static ", path9.call(print2, "definition"));
|
|
15589
15590
|
if (!namedTypes.MethodDefinition.check(n.definition))
|
|
15590
15591
|
parts.push(";");
|
|
15591
15592
|
return (0, lines_1.concat)(parts);
|
|
@@ -15606,12 +15607,12 @@ var require_printer = __commonJS({
|
|
|
15606
15607
|
if (n.readonly) {
|
|
15607
15608
|
parts.push("readonly ");
|
|
15608
15609
|
}
|
|
15609
|
-
var key =
|
|
15610
|
+
var key = path9.call(print2, "key");
|
|
15610
15611
|
if (n.computed) {
|
|
15611
15612
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
15612
15613
|
}
|
|
15613
15614
|
if (n.variance) {
|
|
15614
|
-
key = (0, lines_1.concat)([printVariance(
|
|
15615
|
+
key = (0, lines_1.concat)([printVariance(path9, print2), key]);
|
|
15615
15616
|
}
|
|
15616
15617
|
parts.push(key);
|
|
15617
15618
|
if (n.optional) {
|
|
@@ -15621,10 +15622,10 @@ var require_printer = __commonJS({
|
|
|
15621
15622
|
parts.push("!");
|
|
15622
15623
|
}
|
|
15623
15624
|
if (n.typeAnnotation) {
|
|
15624
|
-
parts.push(
|
|
15625
|
+
parts.push(path9.call(print2, "typeAnnotation"));
|
|
15625
15626
|
}
|
|
15626
15627
|
if (n.value) {
|
|
15627
|
-
parts.push(" = ",
|
|
15628
|
+
parts.push(" = ", path9.call(print2, "value"));
|
|
15628
15629
|
}
|
|
15629
15630
|
parts.push(";");
|
|
15630
15631
|
return (0, lines_1.concat)(parts);
|
|
@@ -15633,21 +15634,21 @@ var require_printer = __commonJS({
|
|
|
15633
15634
|
if (n.static) {
|
|
15634
15635
|
parts.push("static ");
|
|
15635
15636
|
}
|
|
15636
|
-
parts.push(
|
|
15637
|
+
parts.push(path9.call(print2, "key"));
|
|
15637
15638
|
if (n.typeAnnotation) {
|
|
15638
|
-
parts.push(
|
|
15639
|
+
parts.push(path9.call(print2, "typeAnnotation"));
|
|
15639
15640
|
}
|
|
15640
15641
|
if (n.value) {
|
|
15641
|
-
parts.push(" = ",
|
|
15642
|
+
parts.push(" = ", path9.call(print2, "value"));
|
|
15642
15643
|
}
|
|
15643
15644
|
parts.push(";");
|
|
15644
15645
|
return (0, lines_1.concat)(parts);
|
|
15645
15646
|
case "ClassAccessorProperty": {
|
|
15646
15647
|
parts.push.apply(parts, tslib_1.__spreadArray(tslib_1.__spreadArray([], printClassMemberModifiers(n), false), ["accessor "], false));
|
|
15647
15648
|
if (n.computed) {
|
|
15648
|
-
parts.push("[",
|
|
15649
|
+
parts.push("[", path9.call(print2, "key"), "]");
|
|
15649
15650
|
} else {
|
|
15650
|
-
parts.push(
|
|
15651
|
+
parts.push(path9.call(print2, "key"));
|
|
15651
15652
|
}
|
|
15652
15653
|
if (n.optional) {
|
|
15653
15654
|
parts.push("?");
|
|
@@ -15656,10 +15657,10 @@ var require_printer = __commonJS({
|
|
|
15656
15657
|
parts.push("!");
|
|
15657
15658
|
}
|
|
15658
15659
|
if (n.typeAnnotation) {
|
|
15659
|
-
parts.push(
|
|
15660
|
+
parts.push(path9.call(print2, "typeAnnotation"));
|
|
15660
15661
|
}
|
|
15661
15662
|
if (n.value) {
|
|
15662
|
-
parts.push(" = ",
|
|
15663
|
+
parts.push(" = ", path9.call(print2, "value"));
|
|
15663
15664
|
}
|
|
15664
15665
|
parts.push(";");
|
|
15665
15666
|
return (0, lines_1.concat)(parts);
|
|
@@ -15675,32 +15676,32 @@ var require_printer = __commonJS({
|
|
|
15675
15676
|
}
|
|
15676
15677
|
parts.push("class");
|
|
15677
15678
|
if (n.id) {
|
|
15678
|
-
parts.push(" ",
|
|
15679
|
+
parts.push(" ", path9.call(print2, "id"));
|
|
15679
15680
|
}
|
|
15680
15681
|
if (n.typeParameters) {
|
|
15681
|
-
parts.push(
|
|
15682
|
+
parts.push(path9.call(print2, "typeParameters"));
|
|
15682
15683
|
}
|
|
15683
15684
|
if (n.superClass) {
|
|
15684
|
-
parts.push(" extends ",
|
|
15685
|
+
parts.push(" extends ", path9.call(print2, "superClass"), path9.call(print2, "superTypeParameters"));
|
|
15685
15686
|
}
|
|
15686
15687
|
if (n.extends && n.extends.length > 0) {
|
|
15687
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(
|
|
15688
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path9.map(print2, "extends")));
|
|
15688
15689
|
}
|
|
15689
15690
|
if (n["implements"] && n["implements"].length > 0) {
|
|
15690
|
-
parts.push(" implements ", (0, lines_1.fromString)(", ").join(
|
|
15691
|
+
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path9.map(print2, "implements")));
|
|
15691
15692
|
}
|
|
15692
|
-
parts.push(" ",
|
|
15693
|
+
parts.push(" ", path9.call(print2, "body"));
|
|
15693
15694
|
if (n.type === "DeclareClass") {
|
|
15694
|
-
return printFlowDeclaration(
|
|
15695
|
+
return printFlowDeclaration(path9, parts);
|
|
15695
15696
|
} else {
|
|
15696
15697
|
return (0, lines_1.concat)(parts);
|
|
15697
15698
|
}
|
|
15698
15699
|
case "TemplateElement":
|
|
15699
15700
|
return (0, lines_1.fromString)(n.value.raw, options).lockIndentTail();
|
|
15700
15701
|
case "TemplateLiteral": {
|
|
15701
|
-
var expressions_1 =
|
|
15702
|
+
var expressions_1 = path9.map(print2, "expressions");
|
|
15702
15703
|
parts.push("`");
|
|
15703
|
-
|
|
15704
|
+
path9.each(function(childPath) {
|
|
15704
15705
|
var i = childPath.getName();
|
|
15705
15706
|
parts.push(print2(childPath));
|
|
15706
15707
|
if (i < expressions_1.length) {
|
|
@@ -15711,11 +15712,11 @@ var require_printer = __commonJS({
|
|
|
15711
15712
|
return (0, lines_1.concat)(parts).lockIndentTail();
|
|
15712
15713
|
}
|
|
15713
15714
|
case "TaggedTemplateExpression":
|
|
15714
|
-
parts.push(
|
|
15715
|
+
parts.push(path9.call(print2, "tag"));
|
|
15715
15716
|
if (n.typeParameters) {
|
|
15716
|
-
parts.push(
|
|
15717
|
+
parts.push(path9.call(print2, "typeParameters"));
|
|
15717
15718
|
}
|
|
15718
|
-
parts.push(
|
|
15719
|
+
parts.push(path9.call(print2, "quasi"));
|
|
15719
15720
|
return (0, lines_1.concat)(parts);
|
|
15720
15721
|
// These types are unprintable because they serve as abstract
|
|
15721
15722
|
// supertypes for other (printable) types.
|
|
@@ -15762,7 +15763,7 @@ var require_printer = __commonJS({
|
|
|
15762
15763
|
if (n.typeAnnotation.type !== "FunctionTypeAnnotation") {
|
|
15763
15764
|
parts.push(": ");
|
|
15764
15765
|
}
|
|
15765
|
-
parts.push(
|
|
15766
|
+
parts.push(path9.call(print2, "typeAnnotation"));
|
|
15766
15767
|
return (0, lines_1.concat)(parts);
|
|
15767
15768
|
}
|
|
15768
15769
|
return (0, lines_1.fromString)("");
|
|
@@ -15776,9 +15777,9 @@ var require_printer = __commonJS({
|
|
|
15776
15777
|
case "MixedTypeAnnotation":
|
|
15777
15778
|
return (0, lines_1.fromString)("mixed", options);
|
|
15778
15779
|
case "ArrayTypeAnnotation":
|
|
15779
|
-
return (0, lines_1.concat)([
|
|
15780
|
+
return (0, lines_1.concat)([path9.call(print2, "elementType"), "[]"]);
|
|
15780
15781
|
case "TupleTypeAnnotation": {
|
|
15781
|
-
var printed_2 =
|
|
15782
|
+
var printed_2 = path9.map(print2, "types");
|
|
15782
15783
|
var joined = (0, lines_1.fromString)(", ").join(printed_2);
|
|
15783
15784
|
var oneLine_3 = joined.getLineLength(1) <= options.wrapColumn;
|
|
15784
15785
|
if (oneLine_3) {
|
|
@@ -15790,7 +15791,7 @@ var require_printer = __commonJS({
|
|
|
15790
15791
|
} else {
|
|
15791
15792
|
parts.push("[\n");
|
|
15792
15793
|
}
|
|
15793
|
-
|
|
15794
|
+
path9.each(function(elemPath) {
|
|
15794
15795
|
var i = elemPath.getName();
|
|
15795
15796
|
var elem = elemPath.getValue();
|
|
15796
15797
|
if (!elem) {
|
|
@@ -15825,38 +15826,38 @@ var require_printer = __commonJS({
|
|
|
15825
15826
|
case "InterfaceTypeAnnotation":
|
|
15826
15827
|
parts.push("interface");
|
|
15827
15828
|
if (n.extends && n.extends.length > 0) {
|
|
15828
|
-
parts.push(" extends ", (0, lines_1.fromString)(", ").join(
|
|
15829
|
+
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path9.map(print2, "extends")));
|
|
15829
15830
|
}
|
|
15830
|
-
parts.push(" ",
|
|
15831
|
+
parts.push(" ", path9.call(print2, "body"));
|
|
15831
15832
|
return (0, lines_1.concat)(parts);
|
|
15832
15833
|
case "DeclareFunction":
|
|
15833
|
-
return printFlowDeclaration(
|
|
15834
|
+
return printFlowDeclaration(path9, [
|
|
15834
15835
|
"function ",
|
|
15835
|
-
|
|
15836
|
+
path9.call(print2, "id"),
|
|
15836
15837
|
";"
|
|
15837
15838
|
]);
|
|
15838
15839
|
case "DeclareModule":
|
|
15839
|
-
return printFlowDeclaration(
|
|
15840
|
+
return printFlowDeclaration(path9, [
|
|
15840
15841
|
"module ",
|
|
15841
|
-
|
|
15842
|
+
path9.call(print2, "id"),
|
|
15842
15843
|
" ",
|
|
15843
|
-
|
|
15844
|
+
path9.call(print2, "body")
|
|
15844
15845
|
]);
|
|
15845
15846
|
case "DeclareModuleExports":
|
|
15846
|
-
return printFlowDeclaration(
|
|
15847
|
+
return printFlowDeclaration(path9, [
|
|
15847
15848
|
"module.exports",
|
|
15848
|
-
|
|
15849
|
+
path9.call(print2, "typeAnnotation")
|
|
15849
15850
|
]);
|
|
15850
15851
|
case "DeclareVariable":
|
|
15851
|
-
return printFlowDeclaration(
|
|
15852
|
+
return printFlowDeclaration(path9, ["var ", path9.call(print2, "id"), ";"]);
|
|
15852
15853
|
case "DeclareExportDeclaration":
|
|
15853
15854
|
case "DeclareExportAllDeclaration":
|
|
15854
|
-
return (0, lines_1.concat)(["declare ", printExportDeclaration(
|
|
15855
|
+
return (0, lines_1.concat)(["declare ", printExportDeclaration(path9, options, print2)]);
|
|
15855
15856
|
case "EnumDeclaration":
|
|
15856
15857
|
return (0, lines_1.concat)([
|
|
15857
15858
|
"enum ",
|
|
15858
|
-
|
|
15859
|
-
|
|
15859
|
+
path9.call(print2, "id"),
|
|
15860
|
+
path9.call(print2, "body")
|
|
15860
15861
|
]);
|
|
15861
15862
|
case "EnumBooleanBody":
|
|
15862
15863
|
case "EnumNumberBody":
|
|
@@ -15869,41 +15870,41 @@ var require_printer = __commonJS({
|
|
|
15869
15870
|
n.type.slice(4, -4).toLowerCase()
|
|
15870
15871
|
);
|
|
15871
15872
|
}
|
|
15872
|
-
parts.push(" {\n", (0, lines_1.fromString)("\n").join(
|
|
15873
|
+
parts.push(" {\n", (0, lines_1.fromString)("\n").join(path9.map(print2, "members")).indent(options.tabWidth), "\n}");
|
|
15873
15874
|
return (0, lines_1.concat)(parts);
|
|
15874
15875
|
}
|
|
15875
15876
|
case "EnumDefaultedMember":
|
|
15876
|
-
return (0, lines_1.concat)([
|
|
15877
|
+
return (0, lines_1.concat)([path9.call(print2, "id"), ","]);
|
|
15877
15878
|
case "EnumBooleanMember":
|
|
15878
15879
|
case "EnumNumberMember":
|
|
15879
15880
|
case "EnumStringMember":
|
|
15880
15881
|
return (0, lines_1.concat)([
|
|
15881
|
-
|
|
15882
|
+
path9.call(print2, "id"),
|
|
15882
15883
|
" = ",
|
|
15883
|
-
|
|
15884
|
+
path9.call(print2, "init"),
|
|
15884
15885
|
","
|
|
15885
15886
|
]);
|
|
15886
15887
|
case "InferredPredicate":
|
|
15887
15888
|
return (0, lines_1.fromString)("%checks", options);
|
|
15888
15889
|
case "DeclaredPredicate":
|
|
15889
|
-
return (0, lines_1.concat)(["%checks(",
|
|
15890
|
+
return (0, lines_1.concat)(["%checks(", path9.call(print2, "value"), ")"]);
|
|
15890
15891
|
case "FunctionTypeAnnotation": {
|
|
15891
|
-
var parent =
|
|
15892
|
-
var isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) || namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method || namedTypes.DeclareFunction.check(
|
|
15892
|
+
var parent = path9.getParentNode(0);
|
|
15893
|
+
var isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) || namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method || namedTypes.DeclareFunction.check(path9.getParentNode(2)));
|
|
15893
15894
|
var needsColon = isArrowFunctionTypeAnnotation && !namedTypes.FunctionTypeParam.check(parent) && !namedTypes.TypeAlias.check(parent);
|
|
15894
15895
|
if (needsColon) {
|
|
15895
15896
|
parts.push(": ");
|
|
15896
15897
|
}
|
|
15897
15898
|
var hasTypeParameters = !!n.typeParameters;
|
|
15898
15899
|
var needsParens = hasTypeParameters || n.params.length !== 1 || n.params[0].name;
|
|
15899
|
-
parts.push(hasTypeParameters ?
|
|
15900
|
+
parts.push(hasTypeParameters ? path9.call(print2, "typeParameters") : "", needsParens ? "(" : "", printFunctionParams(path9, options, print2), needsParens ? ")" : "");
|
|
15900
15901
|
if (n.returnType) {
|
|
15901
|
-
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ",
|
|
15902
|
+
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path9.call(print2, "returnType"));
|
|
15902
15903
|
}
|
|
15903
15904
|
return (0, lines_1.concat)(parts);
|
|
15904
15905
|
}
|
|
15905
15906
|
case "FunctionTypeParam": {
|
|
15906
|
-
var name =
|
|
15907
|
+
var name = path9.call(print2, "name");
|
|
15907
15908
|
parts.push(name);
|
|
15908
15909
|
if (n.optional) {
|
|
15909
15910
|
parts.push("?");
|
|
@@ -15911,13 +15912,13 @@ var require_printer = __commonJS({
|
|
|
15911
15912
|
if (name.infos[0].line) {
|
|
15912
15913
|
parts.push(": ");
|
|
15913
15914
|
}
|
|
15914
|
-
parts.push(
|
|
15915
|
+
parts.push(path9.call(print2, "typeAnnotation"));
|
|
15915
15916
|
return (0, lines_1.concat)(parts);
|
|
15916
15917
|
}
|
|
15917
15918
|
case "GenericTypeAnnotation":
|
|
15918
15919
|
return (0, lines_1.concat)([
|
|
15919
|
-
|
|
15920
|
-
|
|
15920
|
+
path9.call(print2, "id"),
|
|
15921
|
+
path9.call(print2, "typeParameters")
|
|
15921
15922
|
]);
|
|
15922
15923
|
case "DeclareInterface":
|
|
15923
15924
|
parts.push("declare ");
|
|
@@ -15927,24 +15928,24 @@ var require_printer = __commonJS({
|
|
|
15927
15928
|
if (n.declare) {
|
|
15928
15929
|
parts.push("declare ");
|
|
15929
15930
|
}
|
|
15930
|
-
parts.push("interface ",
|
|
15931
|
+
parts.push("interface ", path9.call(print2, "id"), path9.call(print2, "typeParameters"), " ");
|
|
15931
15932
|
if (n["extends"] && n["extends"].length > 0) {
|
|
15932
|
-
parts.push("extends ", (0, lines_1.fromString)(", ").join(
|
|
15933
|
+
parts.push("extends ", (0, lines_1.fromString)(", ").join(path9.map(print2, "extends")), " ");
|
|
15933
15934
|
}
|
|
15934
15935
|
if (n.body) {
|
|
15935
|
-
parts.push(
|
|
15936
|
+
parts.push(path9.call(print2, "body"));
|
|
15936
15937
|
}
|
|
15937
15938
|
return (0, lines_1.concat)(parts);
|
|
15938
15939
|
case "ClassImplements":
|
|
15939
15940
|
case "InterfaceExtends":
|
|
15940
15941
|
return (0, lines_1.concat)([
|
|
15941
|
-
|
|
15942
|
-
|
|
15942
|
+
path9.call(print2, "id"),
|
|
15943
|
+
path9.call(print2, "typeParameters")
|
|
15943
15944
|
]);
|
|
15944
15945
|
case "IntersectionTypeAnnotation":
|
|
15945
|
-
return (0, lines_1.fromString)(" & ").join(
|
|
15946
|
+
return (0, lines_1.fromString)(" & ").join(path9.map(print2, "types"));
|
|
15946
15947
|
case "NullableTypeAnnotation":
|
|
15947
|
-
return (0, lines_1.concat)(["?",
|
|
15948
|
+
return (0, lines_1.concat)(["?", path9.call(print2, "typeAnnotation")]);
|
|
15948
15949
|
case "NullLiteralTypeAnnotation":
|
|
15949
15950
|
return (0, lines_1.fromString)("null", options);
|
|
15950
15951
|
case "ThisTypeAnnotation":
|
|
@@ -15952,40 +15953,40 @@ var require_printer = __commonJS({
|
|
|
15952
15953
|
case "NumberTypeAnnotation":
|
|
15953
15954
|
return (0, lines_1.fromString)("number", options);
|
|
15954
15955
|
case "ObjectTypeCallProperty":
|
|
15955
|
-
return
|
|
15956
|
+
return path9.call(print2, "value");
|
|
15956
15957
|
case "ObjectTypeIndexer":
|
|
15957
15958
|
if (n.static) {
|
|
15958
15959
|
parts.push("static ");
|
|
15959
15960
|
}
|
|
15960
|
-
parts.push(printVariance(
|
|
15961
|
+
parts.push(printVariance(path9, print2), "[");
|
|
15961
15962
|
if (n.id) {
|
|
15962
|
-
parts.push(
|
|
15963
|
+
parts.push(path9.call(print2, "id"), ": ");
|
|
15963
15964
|
}
|
|
15964
|
-
parts.push(
|
|
15965
|
+
parts.push(path9.call(print2, "key"), "]: ", path9.call(print2, "value"));
|
|
15965
15966
|
return (0, lines_1.concat)(parts);
|
|
15966
15967
|
case "ObjectTypeProperty":
|
|
15967
15968
|
return (0, lines_1.concat)([
|
|
15968
|
-
printVariance(
|
|
15969
|
-
|
|
15969
|
+
printVariance(path9, print2),
|
|
15970
|
+
path9.call(print2, "key"),
|
|
15970
15971
|
n.optional ? "?" : "",
|
|
15971
15972
|
": ",
|
|
15972
|
-
|
|
15973
|
+
path9.call(print2, "value")
|
|
15973
15974
|
]);
|
|
15974
15975
|
case "ObjectTypeInternalSlot":
|
|
15975
15976
|
return (0, lines_1.concat)([
|
|
15976
15977
|
n.static ? "static " : "",
|
|
15977
15978
|
"[[",
|
|
15978
|
-
|
|
15979
|
+
path9.call(print2, "id"),
|
|
15979
15980
|
"]]",
|
|
15980
15981
|
n.optional ? "?" : "",
|
|
15981
15982
|
n.value.type !== "FunctionTypeAnnotation" ? ": " : "",
|
|
15982
|
-
|
|
15983
|
+
path9.call(print2, "value")
|
|
15983
15984
|
]);
|
|
15984
15985
|
case "QualifiedTypeIdentifier":
|
|
15985
15986
|
return (0, lines_1.concat)([
|
|
15986
|
-
|
|
15987
|
+
path9.call(print2, "qualification"),
|
|
15987
15988
|
".",
|
|
15988
|
-
|
|
15989
|
+
path9.call(print2, "id")
|
|
15989
15990
|
]);
|
|
15990
15991
|
case "StringLiteralTypeAnnotation":
|
|
15991
15992
|
return (0, lines_1.fromString)(nodeStr(n.value, options), options);
|
|
@@ -16003,37 +16004,37 @@ var require_printer = __commonJS({
|
|
|
16003
16004
|
case "TypeAlias":
|
|
16004
16005
|
return (0, lines_1.concat)([
|
|
16005
16006
|
"type ",
|
|
16006
|
-
|
|
16007
|
-
|
|
16007
|
+
path9.call(print2, "id"),
|
|
16008
|
+
path9.call(print2, "typeParameters"),
|
|
16008
16009
|
" = ",
|
|
16009
|
-
|
|
16010
|
+
path9.call(print2, "right"),
|
|
16010
16011
|
";"
|
|
16011
16012
|
]);
|
|
16012
16013
|
case "DeclareOpaqueType":
|
|
16013
16014
|
parts.push("declare ");
|
|
16014
16015
|
// Fall through to OpaqueType...
|
|
16015
16016
|
case "OpaqueType":
|
|
16016
|
-
parts.push("opaque type ",
|
|
16017
|
+
parts.push("opaque type ", path9.call(print2, "id"), path9.call(print2, "typeParameters"));
|
|
16017
16018
|
if (n["supertype"]) {
|
|
16018
|
-
parts.push(": ",
|
|
16019
|
+
parts.push(": ", path9.call(print2, "supertype"));
|
|
16019
16020
|
}
|
|
16020
16021
|
if (n["impltype"]) {
|
|
16021
|
-
parts.push(" = ",
|
|
16022
|
+
parts.push(" = ", path9.call(print2, "impltype"));
|
|
16022
16023
|
}
|
|
16023
16024
|
parts.push(";");
|
|
16024
16025
|
return (0, lines_1.concat)(parts);
|
|
16025
16026
|
case "TypeCastExpression":
|
|
16026
16027
|
return (0, lines_1.concat)([
|
|
16027
16028
|
"(",
|
|
16028
|
-
|
|
16029
|
-
|
|
16029
|
+
path9.call(print2, "expression"),
|
|
16030
|
+
path9.call(print2, "typeAnnotation"),
|
|
16030
16031
|
")"
|
|
16031
16032
|
]);
|
|
16032
16033
|
case "TypeParameterDeclaration":
|
|
16033
16034
|
case "TypeParameterInstantiation":
|
|
16034
16035
|
return (0, lines_1.concat)([
|
|
16035
16036
|
"<",
|
|
16036
|
-
(0, lines_1.fromString)(", ").join(
|
|
16037
|
+
(0, lines_1.fromString)(", ").join(path9.map(print2, "params")),
|
|
16037
16038
|
">"
|
|
16038
16039
|
]);
|
|
16039
16040
|
case "Variance":
|
|
@@ -16046,32 +16047,32 @@ var require_printer = __commonJS({
|
|
|
16046
16047
|
return (0, lines_1.fromString)("");
|
|
16047
16048
|
case "TypeParameter":
|
|
16048
16049
|
if (n.variance) {
|
|
16049
|
-
parts.push(printVariance(
|
|
16050
|
+
parts.push(printVariance(path9, print2));
|
|
16050
16051
|
}
|
|
16051
|
-
parts.push(
|
|
16052
|
+
parts.push(path9.call(print2, "name"));
|
|
16052
16053
|
if (n.bound) {
|
|
16053
|
-
parts.push(
|
|
16054
|
+
parts.push(path9.call(print2, "bound"));
|
|
16054
16055
|
}
|
|
16055
16056
|
if (n["default"]) {
|
|
16056
|
-
parts.push("=",
|
|
16057
|
+
parts.push("=", path9.call(print2, "default"));
|
|
16057
16058
|
}
|
|
16058
16059
|
return (0, lines_1.concat)(parts);
|
|
16059
16060
|
case "TypeofTypeAnnotation":
|
|
16060
16061
|
return (0, lines_1.concat)([
|
|
16061
16062
|
(0, lines_1.fromString)("typeof ", options),
|
|
16062
|
-
|
|
16063
|
+
path9.call(print2, "argument")
|
|
16063
16064
|
]);
|
|
16064
16065
|
case "IndexedAccessType":
|
|
16065
16066
|
case "OptionalIndexedAccessType":
|
|
16066
16067
|
return (0, lines_1.concat)([
|
|
16067
|
-
|
|
16068
|
+
path9.call(print2, "objectType"),
|
|
16068
16069
|
n.optional ? "?." : "",
|
|
16069
16070
|
"[",
|
|
16070
|
-
|
|
16071
|
+
path9.call(print2, "indexType"),
|
|
16071
16072
|
"]"
|
|
16072
16073
|
]);
|
|
16073
16074
|
case "UnionTypeAnnotation":
|
|
16074
|
-
return (0, lines_1.fromString)(" | ").join(
|
|
16075
|
+
return (0, lines_1.fromString)(" | ").join(path9.map(print2, "types"));
|
|
16075
16076
|
case "VoidTypeAnnotation":
|
|
16076
16077
|
return (0, lines_1.fromString)("void", options);
|
|
16077
16078
|
case "NullTypeAnnotation":
|
|
@@ -16112,77 +16113,77 @@ var require_printer = __commonJS({
|
|
|
16112
16113
|
case "TSNeverKeyword":
|
|
16113
16114
|
return (0, lines_1.fromString)("never", options);
|
|
16114
16115
|
case "TSArrayType":
|
|
16115
|
-
return (0, lines_1.concat)([
|
|
16116
|
+
return (0, lines_1.concat)([path9.call(print2, "elementType"), "[]"]);
|
|
16116
16117
|
case "TSLiteralType":
|
|
16117
|
-
return
|
|
16118
|
+
return path9.call(print2, "literal");
|
|
16118
16119
|
case "TSUnionType":
|
|
16119
|
-
return (0, lines_1.fromString)(" | ").join(
|
|
16120
|
+
return (0, lines_1.fromString)(" | ").join(path9.map(print2, "types"));
|
|
16120
16121
|
case "TSIntersectionType":
|
|
16121
|
-
return (0, lines_1.fromString)(" & ").join(
|
|
16122
|
+
return (0, lines_1.fromString)(" & ").join(path9.map(print2, "types"));
|
|
16122
16123
|
case "TSConditionalType":
|
|
16123
|
-
parts.push(
|
|
16124
|
+
parts.push(path9.call(print2, "checkType"), " extends ", path9.call(print2, "extendsType"), " ? ", path9.call(print2, "trueType"), " : ", path9.call(print2, "falseType"));
|
|
16124
16125
|
return (0, lines_1.concat)(parts);
|
|
16125
16126
|
case "TSInferType":
|
|
16126
|
-
parts.push("infer ",
|
|
16127
|
+
parts.push("infer ", path9.call(print2, "typeParameter"));
|
|
16127
16128
|
return (0, lines_1.concat)(parts);
|
|
16128
16129
|
case "TSParenthesizedType":
|
|
16129
|
-
return (0, lines_1.concat)(["(",
|
|
16130
|
+
return (0, lines_1.concat)(["(", path9.call(print2, "typeAnnotation"), ")"]);
|
|
16130
16131
|
case "TSFunctionType":
|
|
16131
16132
|
return (0, lines_1.concat)([
|
|
16132
|
-
|
|
16133
|
+
path9.call(print2, "typeParameters"),
|
|
16133
16134
|
"(",
|
|
16134
|
-
printFunctionParams(
|
|
16135
|
+
printFunctionParams(path9, options, print2),
|
|
16135
16136
|
") => ",
|
|
16136
|
-
|
|
16137
|
+
path9.call(print2, "typeAnnotation", "typeAnnotation")
|
|
16137
16138
|
]);
|
|
16138
16139
|
case "TSConstructorType":
|
|
16139
16140
|
return (0, lines_1.concat)([
|
|
16140
16141
|
"new ",
|
|
16141
|
-
|
|
16142
|
+
path9.call(print2, "typeParameters"),
|
|
16142
16143
|
"(",
|
|
16143
|
-
printFunctionParams(
|
|
16144
|
+
printFunctionParams(path9, options, print2),
|
|
16144
16145
|
") => ",
|
|
16145
|
-
|
|
16146
|
+
path9.call(print2, "typeAnnotation", "typeAnnotation")
|
|
16146
16147
|
]);
|
|
16147
16148
|
case "TSMappedType": {
|
|
16148
|
-
parts.push(n.readonly ? "readonly " : "", "[",
|
|
16149
|
+
parts.push(n.readonly ? "readonly " : "", "[", path9.call(print2, "typeParameter"), "]", n.optional ? "?" : "");
|
|
16149
16150
|
if (n.typeAnnotation) {
|
|
16150
|
-
parts.push(": ",
|
|
16151
|
+
parts.push(": ", path9.call(print2, "typeAnnotation"), ";");
|
|
16151
16152
|
}
|
|
16152
16153
|
return (0, lines_1.concat)(["{\n", (0, lines_1.concat)(parts).indent(options.tabWidth), "\n}"]);
|
|
16153
16154
|
}
|
|
16154
16155
|
case "TSTupleType":
|
|
16155
16156
|
return (0, lines_1.concat)([
|
|
16156
16157
|
"[",
|
|
16157
|
-
(0, lines_1.fromString)(", ").join(
|
|
16158
|
+
(0, lines_1.fromString)(", ").join(path9.map(print2, "elementTypes")),
|
|
16158
16159
|
"]"
|
|
16159
16160
|
]);
|
|
16160
16161
|
case "TSNamedTupleMember":
|
|
16161
|
-
parts.push(
|
|
16162
|
+
parts.push(path9.call(print2, "label"));
|
|
16162
16163
|
if (n.optional) {
|
|
16163
16164
|
parts.push("?");
|
|
16164
16165
|
}
|
|
16165
|
-
parts.push(": ",
|
|
16166
|
+
parts.push(": ", path9.call(print2, "elementType"));
|
|
16166
16167
|
return (0, lines_1.concat)(parts);
|
|
16167
16168
|
case "TSRestType":
|
|
16168
|
-
return (0, lines_1.concat)(["...",
|
|
16169
|
+
return (0, lines_1.concat)(["...", path9.call(print2, "typeAnnotation")]);
|
|
16169
16170
|
case "TSOptionalType":
|
|
16170
|
-
return (0, lines_1.concat)([
|
|
16171
|
+
return (0, lines_1.concat)([path9.call(print2, "typeAnnotation"), "?"]);
|
|
16171
16172
|
case "TSIndexedAccessType":
|
|
16172
16173
|
return (0, lines_1.concat)([
|
|
16173
|
-
|
|
16174
|
+
path9.call(print2, "objectType"),
|
|
16174
16175
|
"[",
|
|
16175
|
-
|
|
16176
|
+
path9.call(print2, "indexType"),
|
|
16176
16177
|
"]"
|
|
16177
16178
|
]);
|
|
16178
16179
|
case "TSTypeOperator":
|
|
16179
16180
|
return (0, lines_1.concat)([
|
|
16180
|
-
|
|
16181
|
+
path9.call(print2, "operator"),
|
|
16181
16182
|
" ",
|
|
16182
|
-
|
|
16183
|
+
path9.call(print2, "typeAnnotation")
|
|
16183
16184
|
]);
|
|
16184
16185
|
case "TSTypeLiteral": {
|
|
16185
|
-
var members = (0, lines_1.fromString)("\n").join(
|
|
16186
|
+
var members = (0, lines_1.fromString)("\n").join(path9.map(print2, "members").map(function(member) {
|
|
16186
16187
|
if (lastNonSpaceCharacter(member) !== ";") {
|
|
16187
16188
|
return member.concat(";");
|
|
16188
16189
|
}
|
|
@@ -16195,13 +16196,13 @@ var require_printer = __commonJS({
|
|
|
16195
16196
|
return (0, lines_1.concat)(parts);
|
|
16196
16197
|
}
|
|
16197
16198
|
case "TSEnumMember":
|
|
16198
|
-
parts.push(
|
|
16199
|
+
parts.push(path9.call(print2, "id"));
|
|
16199
16200
|
if (n.initializer) {
|
|
16200
|
-
parts.push(" = ",
|
|
16201
|
+
parts.push(" = ", path9.call(print2, "initializer"));
|
|
16201
16202
|
}
|
|
16202
16203
|
return (0, lines_1.concat)(parts);
|
|
16203
16204
|
case "TSTypeQuery":
|
|
16204
|
-
return (0, lines_1.concat)(["typeof ",
|
|
16205
|
+
return (0, lines_1.concat)(["typeof ", path9.call(print2, "exprName")]);
|
|
16205
16206
|
case "TSParameterProperty":
|
|
16206
16207
|
if (n.accessibility) {
|
|
16207
16208
|
parts.push(n.accessibility, " ");
|
|
@@ -16215,46 +16216,46 @@ var require_printer = __commonJS({
|
|
|
16215
16216
|
if (n.readonly) {
|
|
16216
16217
|
parts.push("readonly ");
|
|
16217
16218
|
}
|
|
16218
|
-
parts.push(
|
|
16219
|
+
parts.push(path9.call(print2, "parameter"));
|
|
16219
16220
|
return (0, lines_1.concat)(parts);
|
|
16220
16221
|
case "TSTypeReference":
|
|
16221
16222
|
return (0, lines_1.concat)([
|
|
16222
|
-
|
|
16223
|
-
|
|
16223
|
+
path9.call(print2, "typeName"),
|
|
16224
|
+
path9.call(print2, "typeParameters")
|
|
16224
16225
|
]);
|
|
16225
16226
|
case "TSQualifiedName":
|
|
16226
|
-
return (0, lines_1.concat)([
|
|
16227
|
+
return (0, lines_1.concat)([path9.call(print2, "left"), ".", path9.call(print2, "right")]);
|
|
16227
16228
|
case "TSAsExpression":
|
|
16228
16229
|
case "TSSatisfiesExpression": {
|
|
16229
|
-
var expression =
|
|
16230
|
-
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ",
|
|
16230
|
+
var expression = path9.call(print2, "expression");
|
|
16231
|
+
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path9.call(print2, "typeAnnotation"));
|
|
16231
16232
|
return (0, lines_1.concat)(parts);
|
|
16232
16233
|
}
|
|
16233
16234
|
case "TSTypeCastExpression":
|
|
16234
16235
|
return (0, lines_1.concat)([
|
|
16235
|
-
|
|
16236
|
-
|
|
16236
|
+
path9.call(print2, "expression"),
|
|
16237
|
+
path9.call(print2, "typeAnnotation")
|
|
16237
16238
|
]);
|
|
16238
16239
|
case "TSNonNullExpression":
|
|
16239
|
-
return (0, lines_1.concat)([
|
|
16240
|
+
return (0, lines_1.concat)([path9.call(print2, "expression"), "!"]);
|
|
16240
16241
|
case "TSTypeAnnotation":
|
|
16241
|
-
return (0, lines_1.concat)([": ",
|
|
16242
|
+
return (0, lines_1.concat)([": ", path9.call(print2, "typeAnnotation")]);
|
|
16242
16243
|
case "TSIndexSignature":
|
|
16243
16244
|
return (0, lines_1.concat)([
|
|
16244
16245
|
n.readonly ? "readonly " : "",
|
|
16245
16246
|
"[",
|
|
16246
|
-
|
|
16247
|
+
path9.map(print2, "parameters"),
|
|
16247
16248
|
"]",
|
|
16248
|
-
|
|
16249
|
+
path9.call(print2, "typeAnnotation")
|
|
16249
16250
|
]);
|
|
16250
16251
|
case "TSPropertySignature":
|
|
16251
|
-
parts.push(printVariance(
|
|
16252
|
+
parts.push(printVariance(path9, print2), n.readonly ? "readonly " : "");
|
|
16252
16253
|
if (n.computed) {
|
|
16253
|
-
parts.push("[",
|
|
16254
|
+
parts.push("[", path9.call(print2, "key"), "]");
|
|
16254
16255
|
} else {
|
|
16255
|
-
parts.push(
|
|
16256
|
+
parts.push(path9.call(print2, "key"));
|
|
16256
16257
|
}
|
|
16257
|
-
parts.push(n.optional ? "?" : "",
|
|
16258
|
+
parts.push(n.optional ? "?" : "", path9.call(print2, "typeAnnotation"));
|
|
16258
16259
|
return (0, lines_1.concat)(parts);
|
|
16259
16260
|
case "TSMethodSignature":
|
|
16260
16261
|
if (n.kind === "get") {
|
|
@@ -16263,76 +16264,76 @@ var require_printer = __commonJS({
|
|
|
16263
16264
|
parts.push("set ");
|
|
16264
16265
|
}
|
|
16265
16266
|
if (n.computed) {
|
|
16266
|
-
parts.push("[",
|
|
16267
|
+
parts.push("[", path9.call(print2, "key"), "]");
|
|
16267
16268
|
} else {
|
|
16268
|
-
parts.push(
|
|
16269
|
+
parts.push(path9.call(print2, "key"));
|
|
16269
16270
|
}
|
|
16270
16271
|
if (n.optional) {
|
|
16271
16272
|
parts.push("?");
|
|
16272
16273
|
}
|
|
16273
|
-
parts.push(
|
|
16274
|
+
parts.push(path9.call(print2, "typeParameters"), "(", printFunctionParams(path9, options, print2), ")", path9.call(print2, "typeAnnotation"));
|
|
16274
16275
|
return (0, lines_1.concat)(parts);
|
|
16275
16276
|
case "TSTypePredicate":
|
|
16276
16277
|
if (n.asserts) {
|
|
16277
16278
|
parts.push("asserts ");
|
|
16278
16279
|
}
|
|
16279
|
-
parts.push(
|
|
16280
|
+
parts.push(path9.call(print2, "parameterName"));
|
|
16280
16281
|
if (n.typeAnnotation) {
|
|
16281
|
-
parts.push(" is ",
|
|
16282
|
+
parts.push(" is ", path9.call(print2, "typeAnnotation", "typeAnnotation"));
|
|
16282
16283
|
}
|
|
16283
16284
|
return (0, lines_1.concat)(parts);
|
|
16284
16285
|
case "TSCallSignatureDeclaration":
|
|
16285
16286
|
return (0, lines_1.concat)([
|
|
16286
|
-
|
|
16287
|
+
path9.call(print2, "typeParameters"),
|
|
16287
16288
|
"(",
|
|
16288
|
-
printFunctionParams(
|
|
16289
|
+
printFunctionParams(path9, options, print2),
|
|
16289
16290
|
")",
|
|
16290
|
-
|
|
16291
|
+
path9.call(print2, "typeAnnotation")
|
|
16291
16292
|
]);
|
|
16292
16293
|
case "TSConstructSignatureDeclaration":
|
|
16293
16294
|
if (n.typeParameters) {
|
|
16294
|
-
parts.push("new",
|
|
16295
|
+
parts.push("new", path9.call(print2, "typeParameters"));
|
|
16295
16296
|
} else {
|
|
16296
16297
|
parts.push("new ");
|
|
16297
16298
|
}
|
|
16298
|
-
parts.push("(", printFunctionParams(
|
|
16299
|
+
parts.push("(", printFunctionParams(path9, options, print2), ")", path9.call(print2, "typeAnnotation"));
|
|
16299
16300
|
return (0, lines_1.concat)(parts);
|
|
16300
16301
|
case "TSTypeAliasDeclaration":
|
|
16301
16302
|
return (0, lines_1.concat)([
|
|
16302
16303
|
n.declare ? "declare " : "",
|
|
16303
16304
|
"type ",
|
|
16304
|
-
|
|
16305
|
-
|
|
16305
|
+
path9.call(print2, "id"),
|
|
16306
|
+
path9.call(print2, "typeParameters"),
|
|
16306
16307
|
" = ",
|
|
16307
|
-
|
|
16308
|
+
path9.call(print2, "typeAnnotation"),
|
|
16308
16309
|
";"
|
|
16309
16310
|
]);
|
|
16310
16311
|
case "TSTypeParameter": {
|
|
16311
|
-
parts.push(
|
|
16312
|
-
var parent =
|
|
16312
|
+
parts.push(path9.call(print2, "name"));
|
|
16313
|
+
var parent = path9.getParentNode(0);
|
|
16313
16314
|
var isInMappedType = namedTypes.TSMappedType.check(parent);
|
|
16314
16315
|
if (n.constraint) {
|
|
16315
|
-
parts.push(isInMappedType ? " in " : " extends ",
|
|
16316
|
+
parts.push(isInMappedType ? " in " : " extends ", path9.call(print2, "constraint"));
|
|
16316
16317
|
}
|
|
16317
16318
|
if (n["default"]) {
|
|
16318
|
-
parts.push(" = ",
|
|
16319
|
+
parts.push(" = ", path9.call(print2, "default"));
|
|
16319
16320
|
}
|
|
16320
16321
|
return (0, lines_1.concat)(parts);
|
|
16321
16322
|
}
|
|
16322
16323
|
case "TSTypeAssertion": {
|
|
16323
|
-
parts.push("<",
|
|
16324
|
+
parts.push("<", path9.call(print2, "typeAnnotation"), "> ", path9.call(print2, "expression"));
|
|
16324
16325
|
return (0, lines_1.concat)(parts);
|
|
16325
16326
|
}
|
|
16326
16327
|
case "TSTypeParameterDeclaration":
|
|
16327
16328
|
case "TSTypeParameterInstantiation":
|
|
16328
16329
|
return (0, lines_1.concat)([
|
|
16329
16330
|
"<",
|
|
16330
|
-
(0, lines_1.fromString)(", ").join(
|
|
16331
|
+
(0, lines_1.fromString)(", ").join(path9.map(print2, "params")),
|
|
16331
16332
|
">"
|
|
16332
16333
|
]);
|
|
16333
16334
|
case "TSEnumDeclaration": {
|
|
16334
|
-
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ",
|
|
16335
|
-
var memberLines = (0, lines_1.fromString)(",\n").join(
|
|
16335
|
+
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path9.call(print2, "id"));
|
|
16336
|
+
var memberLines = (0, lines_1.fromString)(",\n").join(path9.map(print2, "members"));
|
|
16336
16337
|
if (memberLines.isEmpty()) {
|
|
16337
16338
|
parts.push(" {}");
|
|
16338
16339
|
} else {
|
|
@@ -16342,11 +16343,11 @@ var require_printer = __commonJS({
|
|
|
16342
16343
|
}
|
|
16343
16344
|
case "TSExpressionWithTypeArguments":
|
|
16344
16345
|
return (0, lines_1.concat)([
|
|
16345
|
-
|
|
16346
|
-
|
|
16346
|
+
path9.call(print2, "expression"),
|
|
16347
|
+
path9.call(print2, "typeParameters")
|
|
16347
16348
|
]);
|
|
16348
16349
|
case "TSInterfaceBody": {
|
|
16349
|
-
var lines = (0, lines_1.fromString)("\n").join(
|
|
16350
|
+
var lines = (0, lines_1.fromString)("\n").join(path9.map(print2, "body").map(function(element) {
|
|
16350
16351
|
if (lastNonSpaceCharacter(element) !== ";") {
|
|
16351
16352
|
return element.concat(";");
|
|
16352
16353
|
}
|
|
@@ -16358,24 +16359,24 @@ var require_printer = __commonJS({
|
|
|
16358
16359
|
return (0, lines_1.concat)(["{\n", lines.indent(options.tabWidth), "\n}"]);
|
|
16359
16360
|
}
|
|
16360
16361
|
case "TSImportType":
|
|
16361
|
-
parts.push("import(",
|
|
16362
|
+
parts.push("import(", path9.call(print2, "argument"), ")");
|
|
16362
16363
|
if (n.qualifier) {
|
|
16363
|
-
parts.push(".",
|
|
16364
|
+
parts.push(".", path9.call(print2, "qualifier"));
|
|
16364
16365
|
}
|
|
16365
16366
|
if (n.typeParameters) {
|
|
16366
|
-
parts.push(
|
|
16367
|
+
parts.push(path9.call(print2, "typeParameters"));
|
|
16367
16368
|
}
|
|
16368
16369
|
return (0, lines_1.concat)(parts);
|
|
16369
16370
|
case "TSImportEqualsDeclaration":
|
|
16370
16371
|
if (n.isExport) {
|
|
16371
16372
|
parts.push("export ");
|
|
16372
16373
|
}
|
|
16373
|
-
parts.push("import ",
|
|
16374
|
+
parts.push("import ", path9.call(print2, "id"), " = ", path9.call(print2, "moduleReference"));
|
|
16374
16375
|
return maybeAddSemicolon((0, lines_1.concat)(parts));
|
|
16375
16376
|
case "TSExternalModuleReference":
|
|
16376
|
-
return (0, lines_1.concat)(["require(",
|
|
16377
|
+
return (0, lines_1.concat)(["require(", path9.call(print2, "expression"), ")"]);
|
|
16377
16378
|
case "TSModuleDeclaration": {
|
|
16378
|
-
var parent =
|
|
16379
|
+
var parent = path9.getParentNode();
|
|
16379
16380
|
if (parent.type === "TSModuleDeclaration") {
|
|
16380
16381
|
parts.push(".");
|
|
16381
16382
|
} else {
|
|
@@ -16398,15 +16399,15 @@ var require_printer = __commonJS({
|
|
|
16398
16399
|
}
|
|
16399
16400
|
}
|
|
16400
16401
|
}
|
|
16401
|
-
parts.push(
|
|
16402
|
+
parts.push(path9.call(print2, "id"));
|
|
16402
16403
|
if (n.body) {
|
|
16403
16404
|
parts.push(" ");
|
|
16404
|
-
parts.push(
|
|
16405
|
+
parts.push(path9.call(print2, "body"));
|
|
16405
16406
|
}
|
|
16406
16407
|
return (0, lines_1.concat)(parts);
|
|
16407
16408
|
}
|
|
16408
16409
|
case "TSModuleBlock": {
|
|
16409
|
-
var naked =
|
|
16410
|
+
var naked = path9.call(function(bodyPath) {
|
|
16410
16411
|
return printStatementSequence(bodyPath, options, print2);
|
|
16411
16412
|
}, "body");
|
|
16412
16413
|
if (naked.isEmpty()) {
|
|
@@ -16417,12 +16418,12 @@ var require_printer = __commonJS({
|
|
|
16417
16418
|
return (0, lines_1.concat)(parts);
|
|
16418
16419
|
}
|
|
16419
16420
|
case "TSInstantiationExpression": {
|
|
16420
|
-
parts.push(
|
|
16421
|
+
parts.push(path9.call(print2, "expression"), path9.call(print2, "typeParameters"));
|
|
16421
16422
|
return (0, lines_1.concat)(parts);
|
|
16422
16423
|
}
|
|
16423
16424
|
// https://github.com/babel/babel/pull/10148
|
|
16424
16425
|
case "V8IntrinsicIdentifier":
|
|
16425
|
-
return (0, lines_1.concat)(["%",
|
|
16426
|
+
return (0, lines_1.concat)(["%", path9.call(print2, "name")]);
|
|
16426
16427
|
// https://github.com/babel/babel/pull/13191
|
|
16427
16428
|
case "TopicReference":
|
|
16428
16429
|
return (0, lines_1.fromString)("#");
|
|
@@ -16472,28 +16473,28 @@ var require_printer = __commonJS({
|
|
|
16472
16473
|
}
|
|
16473
16474
|
}
|
|
16474
16475
|
__name(genericPrintNoParens, "genericPrintNoParens");
|
|
16475
|
-
function printDecorators(
|
|
16476
|
+
function printDecorators(path9, printPath) {
|
|
16476
16477
|
var parts = [];
|
|
16477
|
-
var node =
|
|
16478
|
+
var node = path9.getValue();
|
|
16478
16479
|
if (node.decorators && node.decorators.length > 0 && // If the parent node is an export declaration, it will be
|
|
16479
16480
|
// responsible for printing node.decorators.
|
|
16480
|
-
!util.getParentExportDeclaration(
|
|
16481
|
-
|
|
16481
|
+
!util.getParentExportDeclaration(path9)) {
|
|
16482
|
+
path9.each(function(decoratorPath) {
|
|
16482
16483
|
parts.push(printPath(decoratorPath), "\n");
|
|
16483
16484
|
}, "decorators");
|
|
16484
16485
|
} else if (util.isExportDeclaration(node) && node.declaration && node.declaration.decorators) {
|
|
16485
|
-
|
|
16486
|
+
path9.each(function(decoratorPath) {
|
|
16486
16487
|
parts.push(printPath(decoratorPath), "\n");
|
|
16487
16488
|
}, "declaration", "decorators");
|
|
16488
16489
|
}
|
|
16489
16490
|
return (0, lines_1.concat)(parts);
|
|
16490
16491
|
}
|
|
16491
16492
|
__name(printDecorators, "printDecorators");
|
|
16492
|
-
function printStatementSequence(
|
|
16493
|
+
function printStatementSequence(path9, options, print2) {
|
|
16493
16494
|
var filtered = [];
|
|
16494
16495
|
var sawComment = false;
|
|
16495
16496
|
var sawStatement = false;
|
|
16496
|
-
|
|
16497
|
+
path9.each(function(stmtPath) {
|
|
16497
16498
|
var stmt = stmtPath.getValue();
|
|
16498
16499
|
if (!stmt) {
|
|
16499
16500
|
return;
|
|
@@ -16605,8 +16606,8 @@ var require_printer = __commonJS({
|
|
|
16605
16606
|
return parts;
|
|
16606
16607
|
}
|
|
16607
16608
|
__name(printClassMemberModifiers, "printClassMemberModifiers");
|
|
16608
|
-
function printMethod(
|
|
16609
|
-
var node =
|
|
16609
|
+
function printMethod(path9, options, print2) {
|
|
16610
|
+
var node = path9.getNode();
|
|
16610
16611
|
var kind = node.kind;
|
|
16611
16612
|
var parts = [];
|
|
16612
16613
|
var nodeValue = node.value;
|
|
@@ -16623,7 +16624,7 @@ var require_printer = __commonJS({
|
|
|
16623
16624
|
if (kind === "get" || kind === "set") {
|
|
16624
16625
|
parts.push(kind, " ");
|
|
16625
16626
|
}
|
|
16626
|
-
var key =
|
|
16627
|
+
var key = path9.call(print2, "key");
|
|
16627
16628
|
if (node.computed) {
|
|
16628
16629
|
key = (0, lines_1.concat)(["[", key, "]"]);
|
|
16629
16630
|
}
|
|
@@ -16632,18 +16633,18 @@ var require_printer = __commonJS({
|
|
|
16632
16633
|
parts.push("?");
|
|
16633
16634
|
}
|
|
16634
16635
|
if (node === nodeValue) {
|
|
16635
|
-
parts.push(
|
|
16636
|
+
parts.push(path9.call(print2, "typeParameters"), "(", printFunctionParams(path9, options, print2), ")", path9.call(print2, "returnType"));
|
|
16636
16637
|
if (node.body) {
|
|
16637
|
-
parts.push(" ",
|
|
16638
|
+
parts.push(" ", path9.call(print2, "body"));
|
|
16638
16639
|
} else {
|
|
16639
16640
|
parts.push(";");
|
|
16640
16641
|
}
|
|
16641
16642
|
} else {
|
|
16642
|
-
parts.push(
|
|
16643
|
+
parts.push(path9.call(print2, "value", "typeParameters"), "(", path9.call(function(valuePath) {
|
|
16643
16644
|
return printFunctionParams(valuePath, options, print2);
|
|
16644
|
-
}, "value"), ")",
|
|
16645
|
+
}, "value"), ")", path9.call(print2, "value", "returnType"));
|
|
16645
16646
|
if (nodeValue.body) {
|
|
16646
|
-
parts.push(" ",
|
|
16647
|
+
parts.push(" ", path9.call(print2, "value", "body"));
|
|
16647
16648
|
} else {
|
|
16648
16649
|
parts.push(";");
|
|
16649
16650
|
}
|
|
@@ -16651,8 +16652,8 @@ var require_printer = __commonJS({
|
|
|
16651
16652
|
return (0, lines_1.concat)(parts);
|
|
16652
16653
|
}
|
|
16653
16654
|
__name(printMethod, "printMethod");
|
|
16654
|
-
function printArgumentsList(
|
|
16655
|
-
var printed =
|
|
16655
|
+
function printArgumentsList(path9, options, print2) {
|
|
16656
|
+
var printed = path9.map(print2, "arguments");
|
|
16656
16657
|
var trailingComma = util.isTrailingCommaEnabled(options, "parameters");
|
|
16657
16658
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
16658
16659
|
if (joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -16666,19 +16667,19 @@ var require_printer = __commonJS({
|
|
|
16666
16667
|
return (0, lines_1.concat)(["(", joined, ")"]);
|
|
16667
16668
|
}
|
|
16668
16669
|
__name(printArgumentsList, "printArgumentsList");
|
|
16669
|
-
function printFunctionParams(
|
|
16670
|
-
var fun =
|
|
16670
|
+
function printFunctionParams(path9, options, print2) {
|
|
16671
|
+
var fun = path9.getValue();
|
|
16671
16672
|
var params;
|
|
16672
16673
|
var printed = [];
|
|
16673
16674
|
if (fun.params) {
|
|
16674
16675
|
params = fun.params;
|
|
16675
|
-
printed =
|
|
16676
|
+
printed = path9.map(print2, "params");
|
|
16676
16677
|
} else if (fun.parameters) {
|
|
16677
16678
|
params = fun.parameters;
|
|
16678
|
-
printed =
|
|
16679
|
+
printed = path9.map(print2, "parameters");
|
|
16679
16680
|
}
|
|
16680
16681
|
if (fun.defaults) {
|
|
16681
|
-
|
|
16682
|
+
path9.each(function(defExprPath) {
|
|
16682
16683
|
var i = defExprPath.getName();
|
|
16683
16684
|
var p = printed[i];
|
|
16684
16685
|
if (p && defExprPath.getValue()) {
|
|
@@ -16687,7 +16688,7 @@ var require_printer = __commonJS({
|
|
|
16687
16688
|
}, "defaults");
|
|
16688
16689
|
}
|
|
16689
16690
|
if (fun.rest) {
|
|
16690
|
-
printed.push((0, lines_1.concat)(["...",
|
|
16691
|
+
printed.push((0, lines_1.concat)(["...", path9.call(print2, "rest")]));
|
|
16691
16692
|
}
|
|
16692
16693
|
var joined = (0, lines_1.fromString)(", ").join(printed);
|
|
16693
16694
|
if (joined.length > 1 || joined.getLineLength(1) > options.wrapColumn) {
|
|
@@ -16702,11 +16703,11 @@ var require_printer = __commonJS({
|
|
|
16702
16703
|
return joined;
|
|
16703
16704
|
}
|
|
16704
16705
|
__name(printFunctionParams, "printFunctionParams");
|
|
16705
|
-
function maybePrintImportAssertions(
|
|
16706
|
-
var n =
|
|
16706
|
+
function maybePrintImportAssertions(path9, options, print2) {
|
|
16707
|
+
var n = path9.getValue();
|
|
16707
16708
|
if (n.assertions && n.assertions.length > 0) {
|
|
16708
16709
|
var parts = [" assert {"];
|
|
16709
|
-
var printed =
|
|
16710
|
+
var printed = path9.map(print2, "assertions");
|
|
16710
16711
|
var flat = (0, lines_1.fromString)(", ").join(printed);
|
|
16711
16712
|
if (flat.length > 1 || flat.getLineLength(1) > options.wrapColumn) {
|
|
16712
16713
|
parts.push("\n", (0, lines_1.fromString)(",\n").join(printed).indent(options.tabWidth), "\n}");
|
|
@@ -16718,8 +16719,8 @@ var require_printer = __commonJS({
|
|
|
16718
16719
|
return (0, lines_1.fromString)("");
|
|
16719
16720
|
}
|
|
16720
16721
|
__name(maybePrintImportAssertions, "maybePrintImportAssertions");
|
|
16721
|
-
function printExportDeclaration(
|
|
16722
|
-
var decl =
|
|
16722
|
+
function printExportDeclaration(path9, options, print2) {
|
|
16723
|
+
var decl = path9.getValue();
|
|
16723
16724
|
var parts = ["export "];
|
|
16724
16725
|
if (decl.exportKind && decl.exportKind === "type") {
|
|
16725
16726
|
if (!decl.declaration) {
|
|
@@ -16732,7 +16733,7 @@ var require_printer = __commonJS({
|
|
|
16732
16733
|
parts.push("default ");
|
|
16733
16734
|
}
|
|
16734
16735
|
if (decl.declaration) {
|
|
16735
|
-
parts.push(
|
|
16736
|
+
parts.push(path9.call(print2, "declaration"));
|
|
16736
16737
|
} else if (decl.specifiers) {
|
|
16737
16738
|
if (decl.specifiers.length === 1 && decl.specifiers[0].type === "ExportBatchSpecifier") {
|
|
16738
16739
|
parts.push("*");
|
|
@@ -16741,7 +16742,7 @@ var require_printer = __commonJS({
|
|
|
16741
16742
|
} else if (decl.specifiers[0].type === "ExportDefaultSpecifier" || decl.specifiers[0].type === "ExportNamespaceSpecifier") {
|
|
16742
16743
|
var unbracedSpecifiers_2 = [];
|
|
16743
16744
|
var bracedSpecifiers_2 = [];
|
|
16744
|
-
|
|
16745
|
+
path9.each(function(specifierPath) {
|
|
16745
16746
|
var spec = specifierPath.getValue();
|
|
16746
16747
|
if (spec.type === "ExportDefaultSpecifier" || spec.type === "ExportNamespaceSpecifier") {
|
|
16747
16748
|
unbracedSpecifiers_2.push(print2(specifierPath));
|
|
@@ -16775,10 +16776,10 @@ var require_printer = __commonJS({
|
|
|
16775
16776
|
}
|
|
16776
16777
|
}
|
|
16777
16778
|
} else {
|
|
16778
|
-
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(
|
|
16779
|
+
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path9.map(print2, "specifiers")), shouldPrintSpaces ? " }" : "}");
|
|
16779
16780
|
}
|
|
16780
16781
|
if (decl.source) {
|
|
16781
|
-
parts.push(" from ",
|
|
16782
|
+
parts.push(" from ", path9.call(print2, "source"), maybePrintImportAssertions(path9, options, print2));
|
|
16782
16783
|
}
|
|
16783
16784
|
}
|
|
16784
16785
|
var lines = (0, lines_1.concat)(parts);
|
|
@@ -16788,8 +16789,8 @@ var require_printer = __commonJS({
|
|
|
16788
16789
|
return lines;
|
|
16789
16790
|
}
|
|
16790
16791
|
__name(printExportDeclaration, "printExportDeclaration");
|
|
16791
|
-
function printFlowDeclaration(
|
|
16792
|
-
var parentExportDecl = util.getParentExportDeclaration(
|
|
16792
|
+
function printFlowDeclaration(path9, parts) {
|
|
16793
|
+
var parentExportDecl = util.getParentExportDeclaration(path9);
|
|
16793
16794
|
if (parentExportDecl) {
|
|
16794
16795
|
(0, tiny_invariant_1.default)(parentExportDecl.type === "DeclareExportDeclaration");
|
|
16795
16796
|
} else {
|
|
@@ -16798,8 +16799,8 @@ var require_printer = __commonJS({
|
|
|
16798
16799
|
return (0, lines_1.concat)(parts);
|
|
16799
16800
|
}
|
|
16800
16801
|
__name(printFlowDeclaration, "printFlowDeclaration");
|
|
16801
|
-
function printVariance(
|
|
16802
|
-
return
|
|
16802
|
+
function printVariance(path9, print2) {
|
|
16803
|
+
return path9.call(function(variancePath) {
|
|
16803
16804
|
var value = variancePath.getValue();
|
|
16804
16805
|
if (value) {
|
|
16805
16806
|
if (value === "plus") {
|
|
@@ -16918,8 +16919,8 @@ var require_main2 = __commonJS({
|
|
|
16918
16919
|
}
|
|
16919
16920
|
__name(run, "run");
|
|
16920
16921
|
exports.run = run;
|
|
16921
|
-
function runFile(
|
|
16922
|
-
fs_1.default.readFile(
|
|
16922
|
+
function runFile(path9, transformer, options) {
|
|
16923
|
+
fs_1.default.readFile(path9, "utf-8", function(err, code) {
|
|
16923
16924
|
if (err) {
|
|
16924
16925
|
console.error(err);
|
|
16925
16926
|
return;
|
|
@@ -17457,11 +17458,11 @@ var require_lib = __commonJS({
|
|
|
17457
17458
|
__name(this, "ESTreeParserMixin");
|
|
17458
17459
|
}
|
|
17459
17460
|
parse() {
|
|
17460
|
-
const
|
|
17461
|
+
const file = toESTreeLocation(super.parse());
|
|
17461
17462
|
if (this.options.tokens) {
|
|
17462
|
-
|
|
17463
|
+
file.tokens = file.tokens.map(toESTreeLocation);
|
|
17463
17464
|
}
|
|
17464
|
-
return
|
|
17465
|
+
return file;
|
|
17465
17466
|
}
|
|
17466
17467
|
parseRegExpLiteral({
|
|
17467
17468
|
pattern,
|
|
@@ -22969,8 +22970,8 @@ var require_lib = __commonJS({
|
|
|
22969
22970
|
}
|
|
22970
22971
|
super.readToken_pipe_amp(code2);
|
|
22971
22972
|
}
|
|
22972
|
-
parseTopLevel(
|
|
22973
|
-
const fileNode = super.parseTopLevel(
|
|
22973
|
+
parseTopLevel(file, program) {
|
|
22974
|
+
const fileNode = super.parseTopLevel(file, program);
|
|
22974
22975
|
if (this.state.hasFlowComment) {
|
|
22975
22976
|
this.raise(FlowErrors.UnterminatedFlowComment, this.state.curPosition());
|
|
22976
22977
|
}
|
|
@@ -29285,13 +29286,13 @@ var require_lib = __commonJS({
|
|
|
29285
29286
|
static {
|
|
29286
29287
|
__name(this, "StatementParser");
|
|
29287
29288
|
}
|
|
29288
|
-
parseTopLevel(
|
|
29289
|
-
|
|
29290
|
-
|
|
29289
|
+
parseTopLevel(file, program) {
|
|
29290
|
+
file.program = this.parseProgram(program);
|
|
29291
|
+
file.comments = this.comments;
|
|
29291
29292
|
if (this.options.tokens) {
|
|
29292
|
-
|
|
29293
|
+
file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex);
|
|
29293
29294
|
}
|
|
29294
|
-
return this.finishNode(
|
|
29295
|
+
return this.finishNode(file, "File");
|
|
29295
29296
|
}
|
|
29296
29297
|
parseProgram(program, end = 140, sourceType = this.options.sourceType) {
|
|
29297
29298
|
program.sourceType = sourceType;
|
|
@@ -31088,14 +31089,14 @@ var require_lib = __commonJS({
|
|
|
31088
31089
|
}
|
|
31089
31090
|
parse() {
|
|
31090
31091
|
this.enterInitialScopes();
|
|
31091
|
-
const
|
|
31092
|
+
const file = this.startNode();
|
|
31092
31093
|
const program = this.startNode();
|
|
31093
31094
|
this.nextToken();
|
|
31094
|
-
|
|
31095
|
-
this.parseTopLevel(
|
|
31096
|
-
|
|
31097
|
-
|
|
31098
|
-
return
|
|
31095
|
+
file.errors = null;
|
|
31096
|
+
this.parseTopLevel(file, program);
|
|
31097
|
+
file.errors = this.state.errors;
|
|
31098
|
+
file.comments.length = this.state.commentsLen;
|
|
31099
|
+
return file;
|
|
31099
31100
|
}
|
|
31100
31101
|
};
|
|
31101
31102
|
function parse7(input, options) {
|
|
@@ -33217,17 +33218,17 @@ var require_visit = __commonJS({
|
|
|
33217
33218
|
visit3.BREAK = BREAK;
|
|
33218
33219
|
visit3.SKIP = SKIP;
|
|
33219
33220
|
visit3.REMOVE = REMOVE;
|
|
33220
|
-
function visit_(key, node, visitor,
|
|
33221
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
33221
|
+
function visit_(key, node, visitor, path9) {
|
|
33222
|
+
const ctrl = callVisitor(key, node, visitor, path9);
|
|
33222
33223
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
33223
|
-
replaceNode(key,
|
|
33224
|
-
return visit_(key, ctrl, visitor,
|
|
33224
|
+
replaceNode(key, path9, ctrl);
|
|
33225
|
+
return visit_(key, ctrl, visitor, path9);
|
|
33225
33226
|
}
|
|
33226
33227
|
if (typeof ctrl !== "symbol") {
|
|
33227
33228
|
if (identity.isCollection(node)) {
|
|
33228
|
-
|
|
33229
|
+
path9 = Object.freeze(path9.concat(node));
|
|
33229
33230
|
for (let i = 0; i < node.items.length; ++i) {
|
|
33230
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
33231
|
+
const ci = visit_(i, node.items[i], visitor, path9);
|
|
33231
33232
|
if (typeof ci === "number")
|
|
33232
33233
|
i = ci - 1;
|
|
33233
33234
|
else if (ci === BREAK)
|
|
@@ -33238,13 +33239,13 @@ var require_visit = __commonJS({
|
|
|
33238
33239
|
}
|
|
33239
33240
|
}
|
|
33240
33241
|
} else if (identity.isPair(node)) {
|
|
33241
|
-
|
|
33242
|
-
const ck = visit_("key", node.key, visitor,
|
|
33242
|
+
path9 = Object.freeze(path9.concat(node));
|
|
33243
|
+
const ck = visit_("key", node.key, visitor, path9);
|
|
33243
33244
|
if (ck === BREAK)
|
|
33244
33245
|
return BREAK;
|
|
33245
33246
|
else if (ck === REMOVE)
|
|
33246
33247
|
node.key = null;
|
|
33247
|
-
const cv = visit_("value", node.value, visitor,
|
|
33248
|
+
const cv = visit_("value", node.value, visitor, path9);
|
|
33248
33249
|
if (cv === BREAK)
|
|
33249
33250
|
return BREAK;
|
|
33250
33251
|
else if (cv === REMOVE)
|
|
@@ -33267,17 +33268,17 @@ var require_visit = __commonJS({
|
|
|
33267
33268
|
visitAsync.BREAK = BREAK;
|
|
33268
33269
|
visitAsync.SKIP = SKIP;
|
|
33269
33270
|
visitAsync.REMOVE = REMOVE;
|
|
33270
|
-
async function visitAsync_(key, node, visitor,
|
|
33271
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
33271
|
+
async function visitAsync_(key, node, visitor, path9) {
|
|
33272
|
+
const ctrl = await callVisitor(key, node, visitor, path9);
|
|
33272
33273
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
33273
|
-
replaceNode(key,
|
|
33274
|
-
return visitAsync_(key, ctrl, visitor,
|
|
33274
|
+
replaceNode(key, path9, ctrl);
|
|
33275
|
+
return visitAsync_(key, ctrl, visitor, path9);
|
|
33275
33276
|
}
|
|
33276
33277
|
if (typeof ctrl !== "symbol") {
|
|
33277
33278
|
if (identity.isCollection(node)) {
|
|
33278
|
-
|
|
33279
|
+
path9 = Object.freeze(path9.concat(node));
|
|
33279
33280
|
for (let i = 0; i < node.items.length; ++i) {
|
|
33280
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
33281
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path9);
|
|
33281
33282
|
if (typeof ci === "number")
|
|
33282
33283
|
i = ci - 1;
|
|
33283
33284
|
else if (ci === BREAK)
|
|
@@ -33288,13 +33289,13 @@ var require_visit = __commonJS({
|
|
|
33288
33289
|
}
|
|
33289
33290
|
}
|
|
33290
33291
|
} else if (identity.isPair(node)) {
|
|
33291
|
-
|
|
33292
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
33292
|
+
path9 = Object.freeze(path9.concat(node));
|
|
33293
|
+
const ck = await visitAsync_("key", node.key, visitor, path9);
|
|
33293
33294
|
if (ck === BREAK)
|
|
33294
33295
|
return BREAK;
|
|
33295
33296
|
else if (ck === REMOVE)
|
|
33296
33297
|
node.key = null;
|
|
33297
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
33298
|
+
const cv = await visitAsync_("value", node.value, visitor, path9);
|
|
33298
33299
|
if (cv === BREAK)
|
|
33299
33300
|
return BREAK;
|
|
33300
33301
|
else if (cv === REMOVE)
|
|
@@ -33323,24 +33324,24 @@ var require_visit = __commonJS({
|
|
|
33323
33324
|
return visitor;
|
|
33324
33325
|
}
|
|
33325
33326
|
__name(initVisitor, "initVisitor");
|
|
33326
|
-
function callVisitor(key, node, visitor,
|
|
33327
|
+
function callVisitor(key, node, visitor, path9) {
|
|
33327
33328
|
if (typeof visitor === "function")
|
|
33328
|
-
return visitor(key, node,
|
|
33329
|
+
return visitor(key, node, path9);
|
|
33329
33330
|
if (identity.isMap(node))
|
|
33330
|
-
return visitor.Map?.(key, node,
|
|
33331
|
+
return visitor.Map?.(key, node, path9);
|
|
33331
33332
|
if (identity.isSeq(node))
|
|
33332
|
-
return visitor.Seq?.(key, node,
|
|
33333
|
+
return visitor.Seq?.(key, node, path9);
|
|
33333
33334
|
if (identity.isPair(node))
|
|
33334
|
-
return visitor.Pair?.(key, node,
|
|
33335
|
+
return visitor.Pair?.(key, node, path9);
|
|
33335
33336
|
if (identity.isScalar(node))
|
|
33336
|
-
return visitor.Scalar?.(key, node,
|
|
33337
|
+
return visitor.Scalar?.(key, node, path9);
|
|
33337
33338
|
if (identity.isAlias(node))
|
|
33338
|
-
return visitor.Alias?.(key, node,
|
|
33339
|
+
return visitor.Alias?.(key, node, path9);
|
|
33339
33340
|
return void 0;
|
|
33340
33341
|
}
|
|
33341
33342
|
__name(callVisitor, "callVisitor");
|
|
33342
|
-
function replaceNode(key,
|
|
33343
|
-
const parent =
|
|
33343
|
+
function replaceNode(key, path9, node) {
|
|
33344
|
+
const parent = path9[path9.length - 1];
|
|
33344
33345
|
if (identity.isCollection(parent)) {
|
|
33345
33346
|
parent.items[key] = node;
|
|
33346
33347
|
} else if (identity.isPair(parent)) {
|
|
@@ -33961,10 +33962,10 @@ var require_Collection = __commonJS({
|
|
|
33961
33962
|
var createNode = require_createNode();
|
|
33962
33963
|
var identity = require_identity();
|
|
33963
33964
|
var Node3 = require_Node();
|
|
33964
|
-
function collectionFromPath(schema,
|
|
33965
|
+
function collectionFromPath(schema, path9, value) {
|
|
33965
33966
|
let v = value;
|
|
33966
|
-
for (let i =
|
|
33967
|
-
const k =
|
|
33967
|
+
for (let i = path9.length - 1; i >= 0; --i) {
|
|
33968
|
+
const k = path9[i];
|
|
33968
33969
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
33969
33970
|
const a = [];
|
|
33970
33971
|
a[k] = v;
|
|
@@ -33984,7 +33985,7 @@ var require_Collection = __commonJS({
|
|
|
33984
33985
|
});
|
|
33985
33986
|
}
|
|
33986
33987
|
__name(collectionFromPath, "collectionFromPath");
|
|
33987
|
-
var isEmptyPath = /* @__PURE__ */ __name((
|
|
33988
|
+
var isEmptyPath = /* @__PURE__ */ __name((path9) => path9 == null || typeof path9 === "object" && !!path9[Symbol.iterator]().next().done, "isEmptyPath");
|
|
33988
33989
|
var Collection = class extends Node3.NodeBase {
|
|
33989
33990
|
static {
|
|
33990
33991
|
__name(this, "Collection");
|
|
@@ -34017,11 +34018,11 @@ var require_Collection = __commonJS({
|
|
|
34017
34018
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
34018
34019
|
* that already exists in the map.
|
|
34019
34020
|
*/
|
|
34020
|
-
addIn(
|
|
34021
|
-
if (isEmptyPath(
|
|
34021
|
+
addIn(path9, value) {
|
|
34022
|
+
if (isEmptyPath(path9))
|
|
34022
34023
|
this.add(value);
|
|
34023
34024
|
else {
|
|
34024
|
-
const [key, ...rest] =
|
|
34025
|
+
const [key, ...rest] = path9;
|
|
34025
34026
|
const node = this.get(key, true);
|
|
34026
34027
|
if (identity.isCollection(node))
|
|
34027
34028
|
node.addIn(rest, value);
|
|
@@ -34035,8 +34036,8 @@ var require_Collection = __commonJS({
|
|
|
34035
34036
|
* Removes a value from the collection.
|
|
34036
34037
|
* @returns `true` if the item was found and removed.
|
|
34037
34038
|
*/
|
|
34038
|
-
deleteIn(
|
|
34039
|
-
const [key, ...rest] =
|
|
34039
|
+
deleteIn(path9) {
|
|
34040
|
+
const [key, ...rest] = path9;
|
|
34040
34041
|
if (rest.length === 0)
|
|
34041
34042
|
return this.delete(key);
|
|
34042
34043
|
const node = this.get(key, true);
|
|
@@ -34050,8 +34051,8 @@ var require_Collection = __commonJS({
|
|
|
34050
34051
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
34051
34052
|
* `true` (collections are always returned intact).
|
|
34052
34053
|
*/
|
|
34053
|
-
getIn(
|
|
34054
|
-
const [key, ...rest] =
|
|
34054
|
+
getIn(path9, keepScalar) {
|
|
34055
|
+
const [key, ...rest] = path9;
|
|
34055
34056
|
const node = this.get(key, true);
|
|
34056
34057
|
if (rest.length === 0)
|
|
34057
34058
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -34069,8 +34070,8 @@ var require_Collection = __commonJS({
|
|
|
34069
34070
|
/**
|
|
34070
34071
|
* Checks if the collection includes a value with the key `key`.
|
|
34071
34072
|
*/
|
|
34072
|
-
hasIn(
|
|
34073
|
-
const [key, ...rest] =
|
|
34073
|
+
hasIn(path9) {
|
|
34074
|
+
const [key, ...rest] = path9;
|
|
34074
34075
|
if (rest.length === 0)
|
|
34075
34076
|
return this.has(key);
|
|
34076
34077
|
const node = this.get(key, true);
|
|
@@ -34080,8 +34081,8 @@ var require_Collection = __commonJS({
|
|
|
34080
34081
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
34081
34082
|
* boolean to add/remove the item from the set.
|
|
34082
34083
|
*/
|
|
34083
|
-
setIn(
|
|
34084
|
-
const [key, ...rest] =
|
|
34084
|
+
setIn(path9, value) {
|
|
34085
|
+
const [key, ...rest] = path9;
|
|
34085
34086
|
if (rest.length === 0) {
|
|
34086
34087
|
this.set(key, value);
|
|
34087
34088
|
} else {
|
|
@@ -36611,9 +36612,9 @@ var require_Document = __commonJS({
|
|
|
36611
36612
|
this.contents.add(value);
|
|
36612
36613
|
}
|
|
36613
36614
|
/** Adds a value to the document. */
|
|
36614
|
-
addIn(
|
|
36615
|
+
addIn(path9, value) {
|
|
36615
36616
|
if (assertCollection(this.contents))
|
|
36616
|
-
this.contents.addIn(
|
|
36617
|
+
this.contents.addIn(path9, value);
|
|
36617
36618
|
}
|
|
36618
36619
|
/**
|
|
36619
36620
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -36688,14 +36689,14 @@ var require_Document = __commonJS({
|
|
|
36688
36689
|
* Removes a value from the document.
|
|
36689
36690
|
* @returns `true` if the item was found and removed.
|
|
36690
36691
|
*/
|
|
36691
|
-
deleteIn(
|
|
36692
|
-
if (Collection.isEmptyPath(
|
|
36692
|
+
deleteIn(path9) {
|
|
36693
|
+
if (Collection.isEmptyPath(path9)) {
|
|
36693
36694
|
if (this.contents == null)
|
|
36694
36695
|
return false;
|
|
36695
36696
|
this.contents = null;
|
|
36696
36697
|
return true;
|
|
36697
36698
|
}
|
|
36698
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
36699
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path9) : false;
|
|
36699
36700
|
}
|
|
36700
36701
|
/**
|
|
36701
36702
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -36710,10 +36711,10 @@ var require_Document = __commonJS({
|
|
|
36710
36711
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
36711
36712
|
* `true` (collections are always returned intact).
|
|
36712
36713
|
*/
|
|
36713
|
-
getIn(
|
|
36714
|
-
if (Collection.isEmptyPath(
|
|
36714
|
+
getIn(path9, keepScalar) {
|
|
36715
|
+
if (Collection.isEmptyPath(path9))
|
|
36715
36716
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
36716
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
36717
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path9, keepScalar) : void 0;
|
|
36717
36718
|
}
|
|
36718
36719
|
/**
|
|
36719
36720
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -36724,10 +36725,10 @@ var require_Document = __commonJS({
|
|
|
36724
36725
|
/**
|
|
36725
36726
|
* Checks if the document includes a value at `path`.
|
|
36726
36727
|
*/
|
|
36727
|
-
hasIn(
|
|
36728
|
-
if (Collection.isEmptyPath(
|
|
36728
|
+
hasIn(path9) {
|
|
36729
|
+
if (Collection.isEmptyPath(path9))
|
|
36729
36730
|
return this.contents !== void 0;
|
|
36730
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
36731
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path9) : false;
|
|
36731
36732
|
}
|
|
36732
36733
|
/**
|
|
36733
36734
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -36744,13 +36745,13 @@ var require_Document = __commonJS({
|
|
|
36744
36745
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
36745
36746
|
* boolean to add/remove the item from the set.
|
|
36746
36747
|
*/
|
|
36747
|
-
setIn(
|
|
36748
|
-
if (Collection.isEmptyPath(
|
|
36748
|
+
setIn(path9, value) {
|
|
36749
|
+
if (Collection.isEmptyPath(path9)) {
|
|
36749
36750
|
this.contents = value;
|
|
36750
36751
|
} else if (this.contents == null) {
|
|
36751
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
36752
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path9), value);
|
|
36752
36753
|
} else if (assertCollection(this.contents)) {
|
|
36753
|
-
this.contents.setIn(
|
|
36754
|
+
this.contents.setIn(path9, value);
|
|
36754
36755
|
}
|
|
36755
36756
|
}
|
|
36756
36757
|
/**
|
|
@@ -38734,9 +38735,9 @@ var require_cst_visit = __commonJS({
|
|
|
38734
38735
|
visit3.BREAK = BREAK;
|
|
38735
38736
|
visit3.SKIP = SKIP;
|
|
38736
38737
|
visit3.REMOVE = REMOVE;
|
|
38737
|
-
visit3.itemAtPath = (cst,
|
|
38738
|
+
visit3.itemAtPath = (cst, path9) => {
|
|
38738
38739
|
let item = cst;
|
|
38739
|
-
for (const [field, index] of
|
|
38740
|
+
for (const [field, index] of path9) {
|
|
38740
38741
|
const tok = item?.[field];
|
|
38741
38742
|
if (tok && "items" in tok) {
|
|
38742
38743
|
item = tok.items[index];
|
|
@@ -38745,23 +38746,23 @@ var require_cst_visit = __commonJS({
|
|
|
38745
38746
|
}
|
|
38746
38747
|
return item;
|
|
38747
38748
|
};
|
|
38748
|
-
visit3.parentCollection = (cst,
|
|
38749
|
-
const parent = visit3.itemAtPath(cst,
|
|
38750
|
-
const field =
|
|
38749
|
+
visit3.parentCollection = (cst, path9) => {
|
|
38750
|
+
const parent = visit3.itemAtPath(cst, path9.slice(0, -1));
|
|
38751
|
+
const field = path9[path9.length - 1][0];
|
|
38751
38752
|
const coll = parent?.[field];
|
|
38752
38753
|
if (coll && "items" in coll)
|
|
38753
38754
|
return coll;
|
|
38754
38755
|
throw new Error("Parent collection not found");
|
|
38755
38756
|
};
|
|
38756
|
-
function _visit(
|
|
38757
|
-
let ctrl = visitor(item,
|
|
38757
|
+
function _visit(path9, item, visitor) {
|
|
38758
|
+
let ctrl = visitor(item, path9);
|
|
38758
38759
|
if (typeof ctrl === "symbol")
|
|
38759
38760
|
return ctrl;
|
|
38760
38761
|
for (const field of ["key", "value"]) {
|
|
38761
38762
|
const token = item[field];
|
|
38762
38763
|
if (token && "items" in token) {
|
|
38763
38764
|
for (let i = 0; i < token.items.length; ++i) {
|
|
38764
|
-
const ci = _visit(Object.freeze(
|
|
38765
|
+
const ci = _visit(Object.freeze(path9.concat([[field, i]])), token.items[i], visitor);
|
|
38765
38766
|
if (typeof ci === "number")
|
|
38766
38767
|
i = ci - 1;
|
|
38767
38768
|
else if (ci === BREAK)
|
|
@@ -38772,10 +38773,10 @@ var require_cst_visit = __commonJS({
|
|
|
38772
38773
|
}
|
|
38773
38774
|
}
|
|
38774
38775
|
if (typeof ctrl === "function" && field === "key")
|
|
38775
|
-
ctrl = ctrl(item,
|
|
38776
|
+
ctrl = ctrl(item, path9);
|
|
38776
38777
|
}
|
|
38777
38778
|
}
|
|
38778
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
38779
|
+
return typeof ctrl === "function" ? ctrl(item, path9) : ctrl;
|
|
38779
38780
|
}
|
|
38780
38781
|
__name(_visit, "_visit");
|
|
38781
38782
|
exports.visit = visit3;
|
|
@@ -41612,9 +41613,9 @@ var require_bugsnag = __commonJS({
|
|
|
41612
41613
|
return false;
|
|
41613
41614
|
}
|
|
41614
41615
|
__name(find, "find");
|
|
41615
|
-
function isDescendent(paths,
|
|
41616
|
+
function isDescendent(paths, path10) {
|
|
41616
41617
|
for (var i = 0, len = paths.length; i < len; i++) {
|
|
41617
|
-
if (
|
|
41618
|
+
if (path10.indexOf(paths[i]) === 0) return true;
|
|
41618
41619
|
}
|
|
41619
41620
|
return false;
|
|
41620
41621
|
}
|
|
@@ -41642,13 +41643,13 @@ var require_bugsnag = __commonJS({
|
|
|
41642
41643
|
function prepareObjForSerialization(obj, redactedKeys, redactedPaths) {
|
|
41643
41644
|
var seen = [];
|
|
41644
41645
|
var edges = 0;
|
|
41645
|
-
function visit3(obj2,
|
|
41646
|
+
function visit3(obj2, path10) {
|
|
41646
41647
|
function edgesExceeded() {
|
|
41647
|
-
return
|
|
41648
|
+
return path10.length > MIN_PRESERVED_DEPTH && edges > MAX_EDGES;
|
|
41648
41649
|
}
|
|
41649
41650
|
__name(edgesExceeded, "edgesExceeded");
|
|
41650
41651
|
edges++;
|
|
41651
|
-
if (
|
|
41652
|
+
if (path10.length > MAX_DEPTH) return REPLACEMENT_NODE;
|
|
41652
41653
|
if (edgesExceeded()) return REPLACEMENT_NODE;
|
|
41653
41654
|
if (obj2 === null || typeof obj2 !== "object") return obj2;
|
|
41654
41655
|
if (find(seen, obj2)) return "[Circular]";
|
|
@@ -41656,7 +41657,7 @@ var require_bugsnag = __commonJS({
|
|
|
41656
41657
|
if (typeof obj2.toJSON === "function") {
|
|
41657
41658
|
try {
|
|
41658
41659
|
edges--;
|
|
41659
|
-
var fResult = visit3(obj2.toJSON(),
|
|
41660
|
+
var fResult = visit3(obj2.toJSON(), path10);
|
|
41660
41661
|
seen.pop();
|
|
41661
41662
|
return fResult;
|
|
41662
41663
|
} catch (err) {
|
|
@@ -41669,7 +41670,7 @@ var require_bugsnag = __commonJS({
|
|
|
41669
41670
|
var eResult = visit3({
|
|
41670
41671
|
name: obj2.name,
|
|
41671
41672
|
message: obj2.message
|
|
41672
|
-
},
|
|
41673
|
+
}, path10);
|
|
41673
41674
|
seen.pop();
|
|
41674
41675
|
return eResult;
|
|
41675
41676
|
}
|
|
@@ -41680,7 +41681,7 @@ var require_bugsnag = __commonJS({
|
|
|
41680
41681
|
aResult.push(REPLACEMENT_NODE);
|
|
41681
41682
|
break;
|
|
41682
41683
|
}
|
|
41683
|
-
aResult.push(visit3(obj2[i],
|
|
41684
|
+
aResult.push(visit3(obj2[i], path10.concat("[]")));
|
|
41684
41685
|
}
|
|
41685
41686
|
seen.pop();
|
|
41686
41687
|
return aResult;
|
|
@@ -41689,7 +41690,7 @@ var require_bugsnag = __commonJS({
|
|
|
41689
41690
|
try {
|
|
41690
41691
|
for (var prop in obj2) {
|
|
41691
41692
|
if (!Object.prototype.hasOwnProperty.call(obj2, prop)) continue;
|
|
41692
|
-
if (isDescendent(redactedPaths,
|
|
41693
|
+
if (isDescendent(redactedPaths, path10.join(".")) && shouldRedact(redactedKeys, prop)) {
|
|
41693
41694
|
result[prop] = "[REDACTED]";
|
|
41694
41695
|
continue;
|
|
41695
41696
|
}
|
|
@@ -41697,7 +41698,7 @@ var require_bugsnag = __commonJS({
|
|
|
41697
41698
|
result[prop] = REPLACEMENT_NODE;
|
|
41698
41699
|
break;
|
|
41699
41700
|
}
|
|
41700
|
-
result[prop] = visit3(safelyGetProp(obj2, prop),
|
|
41701
|
+
result[prop] = visit3(safelyGetProp(obj2, prop), path10.concat(prop));
|
|
41701
41702
|
}
|
|
41702
41703
|
} catch (e) {
|
|
41703
41704
|
}
|
|
@@ -43003,9 +43004,9 @@ var require_bugsnag = __commonJS({
|
|
|
43003
43004
|
}, true);
|
|
43004
43005
|
}, "load")
|
|
43005
43006
|
};
|
|
43006
|
-
var ___require_29 = __require("path"),
|
|
43007
|
+
var ___require_29 = __require("path"), join10 = ___require_29.join, resolve6 = ___require_29.resolve;
|
|
43007
43008
|
var _$pathNormalizer_29 = /* @__PURE__ */ __name(function(p) {
|
|
43008
|
-
return
|
|
43009
|
+
return join10(resolve6(p), "/");
|
|
43009
43010
|
}, "_$pathNormalizer_29");
|
|
43010
43011
|
var _$inProject_44 = {
|
|
43011
43012
|
load: /* @__PURE__ */ __name(function(client) {
|
|
@@ -43047,32 +43048,32 @@ var require_bugsnag = __commonJS({
|
|
|
43047
43048
|
var ___require2_45 = __require("stream"), Writable = ___require2_45.Writable;
|
|
43048
43049
|
var pump = require_pump();
|
|
43049
43050
|
var byline = require_byline();
|
|
43050
|
-
var
|
|
43051
|
+
var path9 = __require("path");
|
|
43051
43052
|
var _$surroundingCode_45 = {
|
|
43052
43053
|
load: /* @__PURE__ */ __name(function(client) {
|
|
43053
43054
|
if (!client._config.sendCode) return;
|
|
43054
43055
|
var loadSurroundingCode = /* @__PURE__ */ __name(function(stackframe, cache) {
|
|
43055
|
-
return new Promise(function(
|
|
43056
|
+
return new Promise(function(resolve7, reject) {
|
|
43056
43057
|
try {
|
|
43057
|
-
if (!stackframe.lineNumber || !stackframe.file) return
|
|
43058
|
-
var
|
|
43059
|
-
var cacheKey =
|
|
43058
|
+
if (!stackframe.lineNumber || !stackframe.file) return resolve7(stackframe);
|
|
43059
|
+
var file = path9.resolve(client._config.projectRoot, stackframe.file);
|
|
43060
|
+
var cacheKey = file + "@" + stackframe.lineNumber;
|
|
43060
43061
|
if (cacheKey in cache) {
|
|
43061
43062
|
stackframe.code = cache[cacheKey];
|
|
43062
|
-
return
|
|
43063
|
+
return resolve7(stackframe);
|
|
43063
43064
|
}
|
|
43064
|
-
getSurroundingCode(
|
|
43065
|
-
if (err) return
|
|
43065
|
+
getSurroundingCode(file, stackframe.lineNumber, function(err, code) {
|
|
43066
|
+
if (err) return resolve7(stackframe);
|
|
43066
43067
|
stackframe.code = cache[cacheKey] = code;
|
|
43067
|
-
return
|
|
43068
|
+
return resolve7(stackframe);
|
|
43068
43069
|
});
|
|
43069
43070
|
} catch (e) {
|
|
43070
|
-
return
|
|
43071
|
+
return resolve7(stackframe);
|
|
43071
43072
|
}
|
|
43072
43073
|
});
|
|
43073
43074
|
}, "loadSurroundingCode");
|
|
43074
43075
|
client.addOnError(function(event) {
|
|
43075
|
-
return new Promise(function(
|
|
43076
|
+
return new Promise(function(resolve7, reject) {
|
|
43076
43077
|
var cache = /* @__PURE__ */ Object.create(null);
|
|
43077
43078
|
var allFrames = event.errors.reduce(function(accum, er) {
|
|
43078
43079
|
return accum.concat(er.stacktrace);
|
|
@@ -43081,7 +43082,7 @@ var require_bugsnag = __commonJS({
|
|
|
43081
43082
|
return function() {
|
|
43082
43083
|
return loadSurroundingCode(stackframe, cache);
|
|
43083
43084
|
};
|
|
43084
|
-
})).then(
|
|
43085
|
+
})).then(resolve7)["catch"](reject);
|
|
43085
43086
|
});
|
|
43086
43087
|
});
|
|
43087
43088
|
}, "load"),
|
|
@@ -43097,10 +43098,10 @@ var require_bugsnag = __commonJS({
|
|
|
43097
43098
|
}
|
|
43098
43099
|
}
|
|
43099
43100
|
};
|
|
43100
|
-
var getSurroundingCode = /* @__PURE__ */ __name(function(
|
|
43101
|
+
var getSurroundingCode = /* @__PURE__ */ __name(function(file, lineNumber, cb) {
|
|
43101
43102
|
var start = lineNumber - SURROUNDING_LINES;
|
|
43102
43103
|
var end = lineNumber + SURROUNDING_LINES;
|
|
43103
|
-
var reader = createReadStream(
|
|
43104
|
+
var reader = createReadStream(file, {
|
|
43104
43105
|
encoding: "utf8"
|
|
43105
43106
|
});
|
|
43106
43107
|
var splitter = new byline.LineStream({
|
|
@@ -43149,7 +43150,7 @@ var require_bugsnag = __commonJS({
|
|
|
43149
43150
|
return CodeRange2;
|
|
43150
43151
|
}(Writable);
|
|
43151
43152
|
var pMapSeries = /* @__PURE__ */ __name(function(ps) {
|
|
43152
|
-
return new Promise(function(
|
|
43153
|
+
return new Promise(function(resolve7, reject) {
|
|
43153
43154
|
var res = [];
|
|
43154
43155
|
ps.reduce(function(accum, p) {
|
|
43155
43156
|
return accum.then(function(r) {
|
|
@@ -43159,7 +43160,7 @@ var require_bugsnag = __commonJS({
|
|
|
43159
43160
|
}, Promise.resolve()).then(function(r) {
|
|
43160
43161
|
res.push(r);
|
|
43161
43162
|
}).then(function() {
|
|
43162
|
-
|
|
43163
|
+
resolve7(res.slice(1));
|
|
43163
43164
|
});
|
|
43164
43165
|
});
|
|
43165
43166
|
}, "pMapSeries");
|
|
@@ -43180,12 +43181,12 @@ var require_bugsnag = __commonJS({
|
|
|
43180
43181
|
type: "unhandledException"
|
|
43181
43182
|
}
|
|
43182
43183
|
}, "uncaughtException handler", 1);
|
|
43183
|
-
return new Promise(function(
|
|
43184
|
+
return new Promise(function(resolve7) {
|
|
43184
43185
|
c2._notify(event, function() {
|
|
43185
43186
|
}, function(e, event2) {
|
|
43186
43187
|
if (e) c2._logger.error("Failed to send event to Bugsnag");
|
|
43187
43188
|
c2._config.onUncaughtException(err, event2, c2._logger);
|
|
43188
|
-
|
|
43189
|
+
resolve7();
|
|
43189
43190
|
});
|
|
43190
43191
|
});
|
|
43191
43192
|
}, "_handler");
|
|
@@ -43210,12 +43211,12 @@ var require_bugsnag = __commonJS({
|
|
|
43210
43211
|
type: "unhandledPromiseRejection"
|
|
43211
43212
|
}
|
|
43212
43213
|
}, "unhandledRejection handler", 1);
|
|
43213
|
-
return new Promise(function(
|
|
43214
|
+
return new Promise(function(resolve7) {
|
|
43214
43215
|
c2._notify(event, function() {
|
|
43215
43216
|
}, function(e, event2) {
|
|
43216
43217
|
if (e) c2._logger.error("Failed to send event to Bugsnag");
|
|
43217
43218
|
c2._config.onUnhandledRejection(err, event2, c2._logger);
|
|
43218
|
-
|
|
43219
|
+
resolve7();
|
|
43219
43220
|
});
|
|
43220
43221
|
});
|
|
43221
43222
|
}, "___handler_47");
|
|
@@ -43578,10 +43579,10 @@ function parseTs(src) {
|
|
|
43578
43579
|
__name(parseTs, "parseTs");
|
|
43579
43580
|
__name2(parseTs, "parseTs");
|
|
43580
43581
|
function parseFile(filePath) {
|
|
43581
|
-
const lang =
|
|
43582
|
+
const lang = path8.extname(filePath).slice(1);
|
|
43582
43583
|
const parser = lang === "js" ? esprimaParser : typescriptParser;
|
|
43583
43584
|
try {
|
|
43584
|
-
const fileContents = readFileSync(
|
|
43585
|
+
const fileContents = readFileSync(path8.resolve(filePath), "utf-8");
|
|
43585
43586
|
if (fileContents) {
|
|
43586
43587
|
return recast.parse(fileContents, { parser }).program;
|
|
43587
43588
|
}
|
|
@@ -43644,91 +43645,6 @@ function semiver_default(a, b5, bool) {
|
|
|
43644
43645
|
return fn(a[0], b5[0]) || fn(a[1], b5[1]) || (b5[2] = b5.slice(2).join("."), bool = /[.-]/.test(a[2] = a.slice(2).join(".")), bool == /[.-]/.test(b5[2]) ? fn(a[2], b5[2]) : bool ? -1 : 1);
|
|
43645
43646
|
}
|
|
43646
43647
|
__name(semiver_default, "default");
|
|
43647
|
-
function absolute(input, root) {
|
|
43648
|
-
return isAbsolute$1(input) ? input : resolve(root || ".", input);
|
|
43649
|
-
}
|
|
43650
|
-
__name(absolute, "absolute");
|
|
43651
|
-
|
|
43652
|
-
// ../../node_modules/.pnpm/empathic@2.0.1/node_modules/empathic/walk.mjs
|
|
43653
|
-
function up(base, options) {
|
|
43654
|
-
let { last, cwd } = options || {};
|
|
43655
|
-
let tmp = absolute(base, cwd);
|
|
43656
|
-
let root = absolute(last || "/", cwd);
|
|
43657
|
-
let prev, arr = [];
|
|
43658
|
-
while (prev !== root) {
|
|
43659
|
-
arr.push(tmp);
|
|
43660
|
-
tmp = dirname$1(prev = tmp);
|
|
43661
|
-
if (tmp === prev) break;
|
|
43662
|
-
}
|
|
43663
|
-
return arr;
|
|
43664
|
-
}
|
|
43665
|
-
__name(up, "up");
|
|
43666
|
-
|
|
43667
|
-
// ../../node_modules/.pnpm/empathic@2.0.1/node_modules/empathic/find.mjs
|
|
43668
|
-
function file(name, options) {
|
|
43669
|
-
let dir, tmp;
|
|
43670
|
-
let start = options && options.cwd || "";
|
|
43671
|
-
for (dir of up(start, options)) {
|
|
43672
|
-
try {
|
|
43673
|
-
tmp = join(dir, name);
|
|
43674
|
-
if (statSync(tmp).isFile()) return tmp;
|
|
43675
|
-
} catch {
|
|
43676
|
-
}
|
|
43677
|
-
}
|
|
43678
|
-
}
|
|
43679
|
-
__name(file, "file");
|
|
43680
|
-
|
|
43681
|
-
// src/frameworks/utils/packages.ts
|
|
43682
|
-
function isPackageInstalled(packageName, projectPath) {
|
|
43683
|
-
return !!getPackagePath(packageName, projectPath);
|
|
43684
|
-
}
|
|
43685
|
-
__name(isPackageInstalled, "isPackageInstalled");
|
|
43686
|
-
function getInstalledPackageVersion(packageName, projectPath, opts = {}) {
|
|
43687
|
-
try {
|
|
43688
|
-
const packagePath = getPackagePath(packageName, projectPath);
|
|
43689
|
-
if (!packagePath) {
|
|
43690
|
-
return void 0;
|
|
43691
|
-
}
|
|
43692
|
-
const packageJsonPath = file("package.json", {
|
|
43693
|
-
cwd: packagePath,
|
|
43694
|
-
last: opts.stopAtProjectPath === true ? projectPath : void 0
|
|
43695
|
-
});
|
|
43696
|
-
if (!packageJsonPath) {
|
|
43697
|
-
return void 0;
|
|
43698
|
-
}
|
|
43699
|
-
const packageJson = parsePackageJSON(
|
|
43700
|
-
readFileSync$1(packageJsonPath),
|
|
43701
|
-
packageJsonPath
|
|
43702
|
-
);
|
|
43703
|
-
if (packageJson.name !== packageName) {
|
|
43704
|
-
const bundledVersion = packageJson.bundledVersions?.[packageName];
|
|
43705
|
-
if (bundledVersion !== void 0) {
|
|
43706
|
-
return bundledVersion;
|
|
43707
|
-
}
|
|
43708
|
-
}
|
|
43709
|
-
return packageJson.version;
|
|
43710
|
-
} catch {
|
|
43711
|
-
}
|
|
43712
|
-
}
|
|
43713
|
-
__name(getInstalledPackageVersion, "getInstalledPackageVersion");
|
|
43714
|
-
function getPackagePath(packageName, projectPath) {
|
|
43715
|
-
try {
|
|
43716
|
-
return path9.dirname(
|
|
43717
|
-
__require.resolve(`${packageName}/package.json`, {
|
|
43718
|
-
paths: [projectPath]
|
|
43719
|
-
})
|
|
43720
|
-
);
|
|
43721
|
-
} catch {
|
|
43722
|
-
}
|
|
43723
|
-
try {
|
|
43724
|
-
return __require.resolve(packageName, {
|
|
43725
|
-
paths: [projectPath]
|
|
43726
|
-
});
|
|
43727
|
-
} catch {
|
|
43728
|
-
}
|
|
43729
|
-
return void 0;
|
|
43730
|
-
}
|
|
43731
|
-
__name(getPackagePath, "getPackagePath");
|
|
43732
43648
|
|
|
43733
43649
|
// src/frameworks/framework-class.ts
|
|
43734
43650
|
var Framework = class {
|
|
@@ -44084,8 +44000,8 @@ function updateAstroConfig(projectPath, astroMajorVersion) {
|
|
|
44084
44000
|
let adapterIdentifier = "cloudflare";
|
|
44085
44001
|
transformFile(configPath, {
|
|
44086
44002
|
// First pass: check for existing cloudflare import and add if missing
|
|
44087
|
-
visitProgram(
|
|
44088
|
-
const body =
|
|
44003
|
+
visitProgram(path9) {
|
|
44004
|
+
const body = path9.node.body;
|
|
44089
44005
|
const b5 = recast3.types.builders;
|
|
44090
44006
|
let hasCloudflareImport = false;
|
|
44091
44007
|
for (const node of body) {
|
|
@@ -44118,13 +44034,13 @@ function updateAstroConfig(projectPath, astroMajorVersion) {
|
|
|
44118
44034
|
body.unshift(importDeclaration);
|
|
44119
44035
|
}
|
|
44120
44036
|
}
|
|
44121
|
-
this.traverse(
|
|
44037
|
+
this.traverse(path9);
|
|
44122
44038
|
},
|
|
44123
44039
|
// Second pass: add adapter (and output for Astro 4) to defineConfig
|
|
44124
|
-
visitCallExpression(
|
|
44125
|
-
const callee =
|
|
44040
|
+
visitCallExpression(path9) {
|
|
44041
|
+
const callee = path9.node.callee;
|
|
44126
44042
|
if (callee.type !== "Identifier" || callee.name !== "defineConfig") {
|
|
44127
|
-
return this.traverse(
|
|
44043
|
+
return this.traverse(path9);
|
|
44128
44044
|
}
|
|
44129
44045
|
const b5 = recast3.types.builders;
|
|
44130
44046
|
const adapterProp = b5.objectProperty(
|
|
@@ -44140,10 +44056,10 @@ function updateAstroConfig(projectPath, astroMajorVersion) {
|
|
|
44140
44056
|
propsToAdd.push(outputProp);
|
|
44141
44057
|
}
|
|
44142
44058
|
propsToAdd.push(adapterProp);
|
|
44143
|
-
if (
|
|
44144
|
-
|
|
44059
|
+
if (path9.node.arguments.length === 0) {
|
|
44060
|
+
path9.node.arguments.push(b5.objectExpression(propsToAdd));
|
|
44145
44061
|
} else {
|
|
44146
|
-
const configArg =
|
|
44062
|
+
const configArg = path9.node.arguments[0];
|
|
44147
44063
|
if (configArg.type === "ObjectExpression") {
|
|
44148
44064
|
mergeObjectProperties(configArg, propsToAdd);
|
|
44149
44065
|
}
|
|
@@ -44241,7 +44157,7 @@ var NextJs = class extends Framework {
|
|
|
44241
44157
|
};
|
|
44242
44158
|
var recast4 = __toESM(require_main2(), 1);
|
|
44243
44159
|
var updateNuxtConfig = /* @__PURE__ */ __name((projectPath) => {
|
|
44244
|
-
const configFile =
|
|
44160
|
+
const configFile = path8.join(projectPath, "nuxt.config.ts");
|
|
44245
44161
|
const b5 = recast4.types.builders;
|
|
44246
44162
|
const presetDef = b5.objectProperty(
|
|
44247
44163
|
b5.identifier("nitro"),
|
|
@@ -44492,12 +44408,12 @@ function checkIfViteConfigUsesCloudflarePlugin(projectPath, context) {
|
|
|
44492
44408
|
}
|
|
44493
44409
|
__name(checkIfViteConfigUsesCloudflarePlugin, "checkIfViteConfigUsesCloudflarePlugin");
|
|
44494
44410
|
function hasViteConfig(projectPath) {
|
|
44495
|
-
return existsSync(
|
|
44411
|
+
return existsSync(path8.join(projectPath, "vite.config.ts")) || existsSync(path8.join(projectPath, "vite.config.js"));
|
|
44496
44412
|
}
|
|
44497
44413
|
__name(hasViteConfig, "hasViteConfig");
|
|
44498
44414
|
function getViteConfigPath(projectPath) {
|
|
44499
|
-
const filePathTS =
|
|
44500
|
-
const filePathJS =
|
|
44415
|
+
const filePathTS = path8.join(projectPath, `vite.config.ts`);
|
|
44416
|
+
const filePathJS = path8.join(projectPath, `vite.config.js`);
|
|
44501
44417
|
let filePath;
|
|
44502
44418
|
if (existsSync(filePathTS)) {
|
|
44503
44419
|
filePath = filePathTS;
|
|
@@ -44643,8 +44559,8 @@ __name(installCloudflareVitePlugin, "installCloudflareVitePlugin");
|
|
|
44643
44559
|
// src/frameworks/react-router.ts
|
|
44644
44560
|
var b2 = recast7.types.builders;
|
|
44645
44561
|
function getReactRouterConfigPath(projectPath) {
|
|
44646
|
-
const filePathTS =
|
|
44647
|
-
const filePathJS =
|
|
44562
|
+
const filePathTS = path8.join(projectPath, "react-router.config.ts");
|
|
44563
|
+
const filePathJS = path8.join(projectPath, "react-router.config.js");
|
|
44648
44564
|
if (existsSync(filePathTS)) {
|
|
44649
44565
|
return filePathTS;
|
|
44650
44566
|
}
|
|
@@ -45339,8 +45255,8 @@ function addVikePhotonImportToConfigFile(n) {
|
|
|
45339
45255
|
}
|
|
45340
45256
|
__name(addVikePhotonImportToConfigFile, "addVikePhotonImportToConfigFile");
|
|
45341
45257
|
function getConfigPath(projectPath) {
|
|
45342
|
-
const filePathTS =
|
|
45343
|
-
const filePathJS =
|
|
45258
|
+
const filePathTS = path8.join(projectPath, "pages", "+config.ts");
|
|
45259
|
+
const filePathJS = path8.join(projectPath, "pages", "+config.js");
|
|
45344
45260
|
let filePath;
|
|
45345
45261
|
if (existsSync(filePathTS)) {
|
|
45346
45262
|
filePath = filePathTS;
|
|
@@ -45894,37 +45810,37 @@ function normalizePathSegments(parts, allowAboveRoot) {
|
|
|
45894
45810
|
return res;
|
|
45895
45811
|
}
|
|
45896
45812
|
__name(normalizePathSegments, "normalizePathSegments");
|
|
45897
|
-
function normalize(
|
|
45898
|
-
const
|
|
45899
|
-
const trailingSlash =
|
|
45900
|
-
|
|
45901
|
-
if (!
|
|
45902
|
-
|
|
45813
|
+
function normalize(path9) {
|
|
45814
|
+
const isAbsolute2 = path9.startsWith("/");
|
|
45815
|
+
const trailingSlash = path9 && path9[path9.length - 1] === "/";
|
|
45816
|
+
path9 = normalizePathSegments(path9.split("/"), !isAbsolute2).join("/");
|
|
45817
|
+
if (!path9 && !isAbsolute2) {
|
|
45818
|
+
path9 = ".";
|
|
45903
45819
|
}
|
|
45904
|
-
if (
|
|
45905
|
-
|
|
45820
|
+
if (path9 && trailingSlash) {
|
|
45821
|
+
path9 += "/";
|
|
45906
45822
|
}
|
|
45907
|
-
return `${
|
|
45823
|
+
return `${isAbsolute2 ? "/" : ""}${path9}`;
|
|
45908
45824
|
}
|
|
45909
45825
|
__name(normalize, "normalize");
|
|
45910
|
-
function
|
|
45911
|
-
let
|
|
45826
|
+
function join6(...segments) {
|
|
45827
|
+
let path9 = "";
|
|
45912
45828
|
for (let i = 0, max = segments.length; i < max; i++) {
|
|
45913
45829
|
if (typeof segments[i] !== "string") {
|
|
45914
45830
|
throw new TypeError("Arguments to join must be strings");
|
|
45915
45831
|
}
|
|
45916
45832
|
const segment = segments[i].replace(/\\/gm, "/");
|
|
45917
45833
|
if (segment) {
|
|
45918
|
-
if (!
|
|
45919
|
-
|
|
45834
|
+
if (!path9.length) {
|
|
45835
|
+
path9 += segment;
|
|
45920
45836
|
} else {
|
|
45921
|
-
|
|
45837
|
+
path9 += "/" + segment;
|
|
45922
45838
|
}
|
|
45923
45839
|
}
|
|
45924
45840
|
}
|
|
45925
|
-
return normalize(
|
|
45841
|
+
return normalize(path9);
|
|
45926
45842
|
}
|
|
45927
|
-
__name(
|
|
45843
|
+
__name(join6, "join");
|
|
45928
45844
|
var FileSystem = class {
|
|
45929
45845
|
static {
|
|
45930
45846
|
__name(this, "FileSystem");
|
|
@@ -45933,8 +45849,8 @@ var FileSystem = class {
|
|
|
45933
45849
|
/** The current working directory will be set by the project */
|
|
45934
45850
|
cwd = "/";
|
|
45935
45851
|
/** returns the last portion of a path */
|
|
45936
|
-
basename(
|
|
45937
|
-
return this.join(
|
|
45852
|
+
basename(path9) {
|
|
45853
|
+
return this.join(path9).split("/").pop() || "";
|
|
45938
45854
|
}
|
|
45939
45855
|
/** returns the relative path from to based on the current working directory */
|
|
45940
45856
|
relative(from, to) {
|
|
@@ -45958,16 +45874,16 @@ var FileSystem = class {
|
|
|
45958
45874
|
}
|
|
45959
45875
|
const toUp = toParts.length - matching.length;
|
|
45960
45876
|
const fromUp = fromParts.length - matching.length;
|
|
45961
|
-
const
|
|
45962
|
-
const result = fromUp > 0 ? Array(
|
|
45877
|
+
const up = Math.max(toUp, fromUp);
|
|
45878
|
+
const result = fromUp > 0 ? Array(up).fill("..") : [];
|
|
45963
45879
|
if (toUp > 0) {
|
|
45964
45880
|
result.push(...toParts.slice(-toUp));
|
|
45965
45881
|
}
|
|
45966
45882
|
return result.join("/");
|
|
45967
45883
|
}
|
|
45968
45884
|
/** returns the directory name of a path */
|
|
45969
|
-
dirname(
|
|
45970
|
-
const parts = this.join(
|
|
45885
|
+
dirname(path9) {
|
|
45886
|
+
const parts = this.join(path9).split("/");
|
|
45971
45887
|
parts.pop();
|
|
45972
45888
|
if (parts.length === 1 && parts[0] === "") {
|
|
45973
45889
|
return "/";
|
|
@@ -45976,25 +45892,25 @@ var FileSystem = class {
|
|
|
45976
45892
|
}
|
|
45977
45893
|
/** A platform independent version of path.join() */
|
|
45978
45894
|
join(...segments) {
|
|
45979
|
-
return
|
|
45895
|
+
return join6(...segments);
|
|
45980
45896
|
}
|
|
45981
45897
|
/** Gracefully reads the file and returns null if it does not exist */
|
|
45982
|
-
async gracefullyReadFile(
|
|
45898
|
+
async gracefullyReadFile(path9) {
|
|
45983
45899
|
try {
|
|
45984
|
-
return await this.readFile(
|
|
45900
|
+
return await this.readFile(path9);
|
|
45985
45901
|
} catch {
|
|
45986
45902
|
return null;
|
|
45987
45903
|
}
|
|
45988
45904
|
}
|
|
45989
45905
|
/** Gracefully reads a file as JSON and parses it */
|
|
45990
|
-
async readJSON(
|
|
45906
|
+
async readJSON(path9, options = {}) {
|
|
45991
45907
|
try {
|
|
45992
|
-
return JSON.parse(await this.readFile(
|
|
45908
|
+
return JSON.parse(await this.readFile(path9));
|
|
45993
45909
|
} catch (error) {
|
|
45994
45910
|
if (options.fail) {
|
|
45995
45911
|
throw error;
|
|
45996
45912
|
}
|
|
45997
|
-
let message = `Could not parse JSON file ${
|
|
45913
|
+
let message = `Could not parse JSON file ${path9}`;
|
|
45998
45914
|
if (error instanceof Error) {
|
|
45999
45915
|
message += `
|
|
46000
45916
|
${error.name}: ${error.message}
|
|
@@ -46169,9 +46085,9 @@ var BaseFramework = class {
|
|
|
46169
46085
|
directory: "dist"
|
|
46170
46086
|
};
|
|
46171
46087
|
logo;
|
|
46172
|
-
constructor(project,
|
|
46088
|
+
constructor(project, path9) {
|
|
46173
46089
|
this.project = project;
|
|
46174
|
-
this.path =
|
|
46090
|
+
this.path = path9;
|
|
46175
46091
|
if (project.packageManager?.runCommand) {
|
|
46176
46092
|
this.build.command = `${project.packageManager.runCommand} build`;
|
|
46177
46093
|
}
|
|
@@ -49299,11 +49215,11 @@ var qmarksTestNoExtDot = /* @__PURE__ */ __name(([$0]) => {
|
|
|
49299
49215
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
49300
49216
|
}, "qmarksTestNoExtDot");
|
|
49301
49217
|
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
49302
|
-
var
|
|
49218
|
+
var path6 = {
|
|
49303
49219
|
win32: { sep: "\\" },
|
|
49304
49220
|
posix: { sep: "/" }
|
|
49305
49221
|
};
|
|
49306
|
-
var sep = defaultPlatform === "win32" ?
|
|
49222
|
+
var sep = defaultPlatform === "win32" ? path6.win32.sep : path6.posix.sep;
|
|
49307
49223
|
minimatch.sep = sep;
|
|
49308
49224
|
var GLOBSTAR = Symbol("globstar **");
|
|
49309
49225
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -49740,19 +49656,19 @@ var Minimatch = class {
|
|
|
49740
49656
|
// Partial means, if you run out of file before you run
|
|
49741
49657
|
// out of pattern, then that's fine, as long as all
|
|
49742
49658
|
// the parts match.
|
|
49743
|
-
matchOne(
|
|
49659
|
+
matchOne(file, pattern, partial = false) {
|
|
49744
49660
|
let fileStartIndex = 0;
|
|
49745
49661
|
let patternStartIndex = 0;
|
|
49746
49662
|
if (this.isWindows) {
|
|
49747
|
-
const fileDrive = typeof
|
|
49748
|
-
const fileUNC = !fileDrive &&
|
|
49663
|
+
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
49664
|
+
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
49749
49665
|
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
49750
49666
|
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
49751
49667
|
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
49752
49668
|
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
49753
49669
|
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
49754
49670
|
const [fd, pd] = [
|
|
49755
|
-
|
|
49671
|
+
file[fdi],
|
|
49756
49672
|
pattern[pdi]
|
|
49757
49673
|
];
|
|
49758
49674
|
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
@@ -49764,14 +49680,14 @@ var Minimatch = class {
|
|
|
49764
49680
|
}
|
|
49765
49681
|
const { optimizationLevel = 1 } = this.options;
|
|
49766
49682
|
if (optimizationLevel >= 2) {
|
|
49767
|
-
|
|
49683
|
+
file = this.levelTwoFileOptimize(file);
|
|
49768
49684
|
}
|
|
49769
49685
|
if (pattern.includes(GLOBSTAR)) {
|
|
49770
|
-
return this.#matchGlobstar(
|
|
49686
|
+
return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
49771
49687
|
}
|
|
49772
|
-
return this.#matchOne(
|
|
49688
|
+
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
49773
49689
|
}
|
|
49774
|
-
#matchGlobstar(
|
|
49690
|
+
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
|
49775
49691
|
const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
|
|
49776
49692
|
const lastgs = pattern.lastIndexOf(GLOBSTAR);
|
|
49777
49693
|
const [head, body, tail] = partial ? [
|
|
@@ -49784,7 +49700,7 @@ var Minimatch = class {
|
|
|
49784
49700
|
pattern.slice(lastgs + 1)
|
|
49785
49701
|
];
|
|
49786
49702
|
if (head.length) {
|
|
49787
|
-
const fileHead =
|
|
49703
|
+
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
|
49788
49704
|
if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
|
|
49789
49705
|
return false;
|
|
49790
49706
|
}
|
|
@@ -49793,17 +49709,17 @@ var Minimatch = class {
|
|
|
49793
49709
|
}
|
|
49794
49710
|
let fileTailMatch = 0;
|
|
49795
49711
|
if (tail.length) {
|
|
49796
|
-
if (tail.length + fileIndex >
|
|
49712
|
+
if (tail.length + fileIndex > file.length)
|
|
49797
49713
|
return false;
|
|
49798
|
-
let tailStart =
|
|
49799
|
-
if (this.#matchOne(
|
|
49714
|
+
let tailStart = file.length - tail.length;
|
|
49715
|
+
if (this.#matchOne(file, tail, partial, tailStart, 0)) {
|
|
49800
49716
|
fileTailMatch = tail.length;
|
|
49801
49717
|
} else {
|
|
49802
|
-
if (
|
|
49718
|
+
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
|
|
49803
49719
|
return false;
|
|
49804
49720
|
}
|
|
49805
49721
|
tailStart--;
|
|
49806
|
-
if (!this.#matchOne(
|
|
49722
|
+
if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
|
|
49807
49723
|
return false;
|
|
49808
49724
|
}
|
|
49809
49725
|
fileTailMatch = tail.length + 1;
|
|
@@ -49811,8 +49727,8 @@ var Minimatch = class {
|
|
|
49811
49727
|
}
|
|
49812
49728
|
if (!body.length) {
|
|
49813
49729
|
let sawSome = !!fileTailMatch;
|
|
49814
|
-
for (let i2 = fileIndex; i2 <
|
|
49815
|
-
const f = String(
|
|
49730
|
+
for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
|
|
49731
|
+
const f = String(file[i2]);
|
|
49816
49732
|
sawSome = true;
|
|
49817
49733
|
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
|
|
49818
49734
|
return false;
|
|
@@ -49835,20 +49751,20 @@ var Minimatch = class {
|
|
|
49835
49751
|
}
|
|
49836
49752
|
}
|
|
49837
49753
|
let i = bodySegments.length - 1;
|
|
49838
|
-
const fileLength =
|
|
49754
|
+
const fileLength = file.length - fileTailMatch;
|
|
49839
49755
|
for (const b5 of bodySegments) {
|
|
49840
49756
|
b5[1] = fileLength - (nonGsPartsSums[i--] + b5[0].length);
|
|
49841
49757
|
}
|
|
49842
|
-
return !!this.#matchGlobStarBodySections(
|
|
49758
|
+
return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
|
|
49843
49759
|
}
|
|
49844
49760
|
// return false for "nope, not matching"
|
|
49845
49761
|
// return null for "not matching, cannot keep trying"
|
|
49846
|
-
#matchGlobStarBodySections(
|
|
49762
|
+
#matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
|
49847
49763
|
const bs = bodySegments[bodyIndex];
|
|
49848
49764
|
if (!bs) {
|
|
49849
|
-
for (let i = fileIndex; i <
|
|
49765
|
+
for (let i = fileIndex; i < file.length; i++) {
|
|
49850
49766
|
sawTail = true;
|
|
49851
|
-
const f =
|
|
49767
|
+
const f = file[i];
|
|
49852
49768
|
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
|
|
49853
49769
|
return false;
|
|
49854
49770
|
}
|
|
@@ -49857,14 +49773,14 @@ var Minimatch = class {
|
|
|
49857
49773
|
}
|
|
49858
49774
|
const [body, after] = bs;
|
|
49859
49775
|
while (fileIndex <= after) {
|
|
49860
|
-
const m = this.#matchOne(
|
|
49776
|
+
const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
|
|
49861
49777
|
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
|
49862
|
-
const sub = this.#matchGlobStarBodySections(
|
|
49778
|
+
const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
|
|
49863
49779
|
if (sub !== false) {
|
|
49864
49780
|
return sub;
|
|
49865
49781
|
}
|
|
49866
49782
|
}
|
|
49867
|
-
const f =
|
|
49783
|
+
const f = file[fileIndex];
|
|
49868
49784
|
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
|
|
49869
49785
|
return false;
|
|
49870
49786
|
}
|
|
@@ -49872,15 +49788,15 @@ var Minimatch = class {
|
|
|
49872
49788
|
}
|
|
49873
49789
|
return partial || null;
|
|
49874
49790
|
}
|
|
49875
|
-
#matchOne(
|
|
49791
|
+
#matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
|
49876
49792
|
let fi;
|
|
49877
49793
|
let pi;
|
|
49878
49794
|
let pl;
|
|
49879
49795
|
let fl;
|
|
49880
|
-
for (fi = fileIndex, pi = patternIndex, fl =
|
|
49796
|
+
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
49881
49797
|
this.debug("matchOne loop");
|
|
49882
49798
|
let p = pattern[pi];
|
|
49883
|
-
let f =
|
|
49799
|
+
let f = file[fi];
|
|
49884
49800
|
this.debug(pattern, p, f);
|
|
49885
49801
|
if (p === false || p === GLOBSTAR) {
|
|
49886
49802
|
return false;
|
|
@@ -49901,7 +49817,7 @@ var Minimatch = class {
|
|
|
49901
49817
|
} else if (fi === fl) {
|
|
49902
49818
|
return partial;
|
|
49903
49819
|
} else if (pi === pl) {
|
|
49904
|
-
return fi === fl - 1 &&
|
|
49820
|
+
return fi === fl - 1 && file[fi] === "";
|
|
49905
49821
|
} else {
|
|
49906
49822
|
throw new Error("wtf?");
|
|
49907
49823
|
}
|
|
@@ -50032,11 +49948,11 @@ var Minimatch = class {
|
|
|
50032
49948
|
}
|
|
50033
49949
|
}
|
|
50034
49950
|
for (const pattern of set) {
|
|
50035
|
-
let
|
|
49951
|
+
let file = ff;
|
|
50036
49952
|
if (options.matchBase && pattern.length === 1) {
|
|
50037
|
-
|
|
49953
|
+
file = [filename];
|
|
50038
49954
|
}
|
|
50039
|
-
const hit = this.matchOne(
|
|
49955
|
+
const hit = this.matchOne(file, pattern, partial);
|
|
50040
49956
|
if (hit) {
|
|
50041
49957
|
if (options.flipNegate) {
|
|
50042
49958
|
return true;
|
|
@@ -50147,10 +50063,10 @@ var WorkspaceInfo = class {
|
|
|
50147
50063
|
packages = [];
|
|
50148
50064
|
/** Detects if a workspace has a sub package */
|
|
50149
50065
|
hasPackage(relativePackagePath) {
|
|
50150
|
-
return this.packages.findIndex(({ path:
|
|
50066
|
+
return this.packages.findIndex(({ path: path9 }) => path9 === relativePackagePath) > -1;
|
|
50151
50067
|
}
|
|
50152
50068
|
getPackage(relativePackagePath) {
|
|
50153
|
-
return this.packages.find(({ path:
|
|
50069
|
+
return this.packages.find(({ path: path9 }) => path9 === relativePackagePath);
|
|
50154
50070
|
}
|
|
50155
50071
|
};
|
|
50156
50072
|
async function detectPnpmWorkspaceGlobs(project) {
|
|
@@ -51263,10 +51179,10 @@ var Project = class {
|
|
|
51263
51179
|
return null;
|
|
51264
51180
|
}
|
|
51265
51181
|
}
|
|
51266
|
-
async detectFrameworksInPath(
|
|
51267
|
-
this.logger.debug(`[project.ts]: detectFrameworksInPath - ${
|
|
51182
|
+
async detectFrameworksInPath(path9) {
|
|
51183
|
+
this.logger.debug(`[project.ts]: detectFrameworksInPath - ${path9}`);
|
|
51268
51184
|
try {
|
|
51269
|
-
const detected = (await Promise.all(frameworks.map((Framework2) => new Framework2(this,
|
|
51185
|
+
const detected = (await Promise.all(frameworks.map((Framework2) => new Framework2(this, path9).detect()))).filter(Boolean);
|
|
51270
51186
|
return filterByRelevance(detected);
|
|
51271
51187
|
} catch {
|
|
51272
51188
|
return [];
|
|
@@ -51360,18 +51276,18 @@ function pLimit(concurrency) {
|
|
|
51360
51276
|
queue.dequeue()();
|
|
51361
51277
|
}
|
|
51362
51278
|
}, "next");
|
|
51363
|
-
const run = /* @__PURE__ */ __name(async (fn2,
|
|
51279
|
+
const run = /* @__PURE__ */ __name(async (fn2, resolve6, args) => {
|
|
51364
51280
|
activeCount++;
|
|
51365
51281
|
const result = (async () => fn2(...args))();
|
|
51366
|
-
|
|
51282
|
+
resolve6(result);
|
|
51367
51283
|
try {
|
|
51368
51284
|
await result;
|
|
51369
51285
|
} catch {
|
|
51370
51286
|
}
|
|
51371
51287
|
next();
|
|
51372
51288
|
}, "run");
|
|
51373
|
-
const enqueue = /* @__PURE__ */ __name((fn2,
|
|
51374
|
-
queue.enqueue(run.bind(void 0, fn2,
|
|
51289
|
+
const enqueue = /* @__PURE__ */ __name((fn2, resolve6, args) => {
|
|
51290
|
+
queue.enqueue(run.bind(void 0, fn2, resolve6, args));
|
|
51375
51291
|
(async () => {
|
|
51376
51292
|
await Promise.resolve();
|
|
51377
51293
|
if (activeCount < concurrency && queue.size > 0) {
|
|
@@ -51379,8 +51295,8 @@ function pLimit(concurrency) {
|
|
|
51379
51295
|
}
|
|
51380
51296
|
})();
|
|
51381
51297
|
}, "enqueue");
|
|
51382
|
-
const generator = /* @__PURE__ */ __name((fn2, ...args) => new Promise((
|
|
51383
|
-
enqueue(fn2,
|
|
51298
|
+
const generator = /* @__PURE__ */ __name((fn2, ...args) => new Promise((resolve6) => {
|
|
51299
|
+
enqueue(fn2, resolve6, args);
|
|
51384
51300
|
}), "generator");
|
|
51385
51301
|
Object.defineProperties(generator, {
|
|
51386
51302
|
activeCount: {
|
|
@@ -51461,7 +51377,7 @@ async function locatePath(paths, {
|
|
|
51461
51377
|
const statFunction = allowSymlinks ? promises$1.stat : promises$1.lstat;
|
|
51462
51378
|
return pLocate(paths, async (path_) => {
|
|
51463
51379
|
try {
|
|
51464
|
-
const stat2 = await statFunction(
|
|
51380
|
+
const stat2 = await statFunction(path8.resolve(cwd, path_));
|
|
51465
51381
|
return matchType(type, stat2);
|
|
51466
51382
|
} catch {
|
|
51467
51383
|
return false;
|
|
@@ -51477,9 +51393,9 @@ __name(toPath2, "toPath");
|
|
|
51477
51393
|
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
51478
51394
|
var findUpStop = Symbol("findUpStop");
|
|
51479
51395
|
async function findUpMultiple(name, options = {}) {
|
|
51480
|
-
let directory =
|
|
51481
|
-
const { root } =
|
|
51482
|
-
const stopAt =
|
|
51396
|
+
let directory = path8.resolve(toPath2(options.cwd) ?? "");
|
|
51397
|
+
const { root } = path8.parse(directory);
|
|
51398
|
+
const stopAt = path8.resolve(directory, toPath2(options.stopAt ?? root));
|
|
51483
51399
|
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
51484
51400
|
const paths = [name].flat();
|
|
51485
51401
|
const runMatcher = /* @__PURE__ */ __name(async (locateOptions) => {
|
|
@@ -51499,12 +51415,12 @@ async function findUpMultiple(name, options = {}) {
|
|
|
51499
51415
|
break;
|
|
51500
51416
|
}
|
|
51501
51417
|
if (foundPath) {
|
|
51502
|
-
matches.push(
|
|
51418
|
+
matches.push(path8.resolve(directory, foundPath));
|
|
51503
51419
|
}
|
|
51504
51420
|
if (directory === stopAt || matches.length >= limit) {
|
|
51505
51421
|
break;
|
|
51506
51422
|
}
|
|
51507
|
-
directory =
|
|
51423
|
+
directory = path8.dirname(directory);
|
|
51508
51424
|
}
|
|
51509
51425
|
return matches;
|
|
51510
51426
|
}
|
|
@@ -51527,11 +51443,11 @@ var NodeFS = class extends FileSystem {
|
|
|
51527
51443
|
getEnvironment() {
|
|
51528
51444
|
return "node";
|
|
51529
51445
|
}
|
|
51530
|
-
isAbsolute(
|
|
51531
|
-
return isAbsolute(
|
|
51446
|
+
isAbsolute(path9) {
|
|
51447
|
+
return isAbsolute(path9);
|
|
51532
51448
|
}
|
|
51533
|
-
dirname(
|
|
51534
|
-
return dirname(
|
|
51449
|
+
dirname(path9) {
|
|
51450
|
+
return dirname(path9);
|
|
51535
51451
|
}
|
|
51536
51452
|
resolve(...paths) {
|
|
51537
51453
|
return resolve$1(...paths);
|
|
@@ -51539,33 +51455,33 @@ var NodeFS = class extends FileSystem {
|
|
|
51539
51455
|
relative(from, to) {
|
|
51540
51456
|
return relative(from, to);
|
|
51541
51457
|
}
|
|
51542
|
-
basename(
|
|
51543
|
-
return basename(
|
|
51458
|
+
basename(path9) {
|
|
51459
|
+
return basename(path9);
|
|
51544
51460
|
}
|
|
51545
51461
|
join(...segments) {
|
|
51546
51462
|
return join$1(...segments);
|
|
51547
51463
|
}
|
|
51548
|
-
async fileExists(
|
|
51464
|
+
async fileExists(path9) {
|
|
51549
51465
|
try {
|
|
51550
|
-
await promises.stat(resolve$1(
|
|
51466
|
+
await promises.stat(resolve$1(path9));
|
|
51551
51467
|
return true;
|
|
51552
51468
|
} catch {
|
|
51553
51469
|
return false;
|
|
51554
51470
|
}
|
|
51555
51471
|
}
|
|
51556
|
-
async readDir(
|
|
51472
|
+
async readDir(path9, withFileTypes) {
|
|
51557
51473
|
try {
|
|
51558
51474
|
if (!withFileTypes) {
|
|
51559
|
-
return promises.readdir(resolve$1(
|
|
51475
|
+
return promises.readdir(resolve$1(path9));
|
|
51560
51476
|
}
|
|
51561
|
-
const result = await promises.readdir(resolve$1(
|
|
51477
|
+
const result = await promises.readdir(resolve$1(path9), { withFileTypes: true });
|
|
51562
51478
|
return result.reduce((prev, cur) => ({ ...prev, [cur.name]: cur.isDirectory() ? "directory" : "file" }), {});
|
|
51563
51479
|
} catch {
|
|
51564
51480
|
return [];
|
|
51565
51481
|
}
|
|
51566
51482
|
}
|
|
51567
|
-
async readFile(
|
|
51568
|
-
return (await promises.readFile(resolve$1(
|
|
51483
|
+
async readFile(path9) {
|
|
51484
|
+
return (await promises.readFile(resolve$1(path9), "utf-8")).toString();
|
|
51569
51485
|
}
|
|
51570
51486
|
/** Node implementation of finding a file or directory by walking up parent directories. */
|
|
51571
51487
|
findUp(name, options = {}) {
|
|
@@ -52286,10 +52202,10 @@ async function findAssetsDir(from) {
|
|
|
52286
52202
|
}
|
|
52287
52203
|
const children = await readdir(from);
|
|
52288
52204
|
for (const child of children) {
|
|
52289
|
-
const
|
|
52290
|
-
const stats = await stat(
|
|
52291
|
-
if (stats.isDirectory() && await hasIndexHtml(
|
|
52292
|
-
return relative$1(from,
|
|
52205
|
+
const path9 = join(from, child);
|
|
52206
|
+
const stats = await stat(path9);
|
|
52207
|
+
if (stats.isDirectory() && await hasIndexHtml(path9)) {
|
|
52208
|
+
return relative$1(from, path9);
|
|
52293
52209
|
}
|
|
52294
52210
|
}
|
|
52295
52211
|
return void 0;
|
|
@@ -52735,4 +52651,4 @@ function getDirWranglerJsonConfigPath(dir) {
|
|
|
52735
52651
|
}
|
|
52736
52652
|
__name(getDirWranglerJsonConfigPath, "getDirWranglerJsonConfigPath");
|
|
52737
52653
|
|
|
52738
|
-
export { AutoConfigDetectionError, AutoConfigFrameworkConfigurationError, Framework, buildOperationsSummary, confirmAutoConfigDetails, displayAutoConfigDetails, getDetailsForAutoConfig,
|
|
52654
|
+
export { AutoConfigDetectionError, AutoConfigFrameworkConfigurationError, Framework, buildOperationsSummary, confirmAutoConfigDetails, displayAutoConfigDetails, getDetailsForAutoConfig, isFrameworkSupported, runAutoConfig };
|