@next-core/brick-utils 2.37.24 → 2.38.0
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/CHANGELOG.md +14 -15
- package/dist/index.bundle.js +437 -242
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +433 -239
- package/dist/index.esm.js.map +1 -1
- package/dist/types/JsonStorage.d.ts +3 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/scanInstalledAppsInStoryboard.d.ts +2 -0
- package/dist/types/scanInstalledAppsInStoryboard.spec.d.ts +1 -0
- package/package.json +6 -6
package/dist/index.bundle.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('lodash'), require('@babel/runtime/helpers/defineProperty'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', 'lodash', '@babel/runtime/helpers/defineProperty', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickUtils = {}, global._asyncToGenerator, global.lodash, global._defineProperty, global._objectSpread, global.
|
|
5
|
-
})(this, (function (exports, _asyncToGenerator, lodash, _defineProperty, _objectSpread,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('lodash'), require('@babel/runtime/helpers/defineProperty'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@babel/runtime/helpers/taggedTemplateLiteral'), require('@next-core/pipes'), require('js-yaml')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', 'lodash', '@babel/runtime/helpers/defineProperty', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/objectWithoutProperties', '@babel/runtime/helpers/taggedTemplateLiteral', '@next-core/pipes', 'js-yaml'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickUtils = {}, global._asyncToGenerator, global.lodash, global._defineProperty, global._objectSpread, global._objectWithoutProperties, global._taggedTemplateLiteral, global.pipes, global.yaml));
|
|
5
|
+
})(this, (function (exports, _asyncToGenerator, lodash, _defineProperty, _objectSpread, _objectWithoutProperties, _taggedTemplateLiteral, pipes, yaml) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
9
|
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
10
10
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
11
11
|
var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
|
|
12
|
-
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
13
12
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
13
|
+
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
14
14
|
var yaml__default = /*#__PURE__*/_interopDefaultLegacy(yaml);
|
|
15
15
|
|
|
16
16
|
var cache$1 = new Map();
|
|
@@ -3277,6 +3277,7 @@
|
|
|
3277
3277
|
}),
|
|
3278
3278
|
ImportCallNotNewExpression: _("Cannot use new with import(...)."),
|
|
3279
3279
|
ImportCallSpreadArgument: _("`...` is not allowed in `import()`."),
|
|
3280
|
+
ImportJSONBindingNotDefault: _("A JSON module can only be imported with `default`."),
|
|
3280
3281
|
IncompatibleRegExpUVFlags: _("The 'u' and 'v' regular expression flags cannot be enabled at the same time."),
|
|
3281
3282
|
InvalidBigIntLiteral: _("Invalid BigIntLiteral."),
|
|
3282
3283
|
InvalidCodePoint: _("Code point out of bounds."),
|
|
@@ -3613,8 +3614,8 @@
|
|
|
3613
3614
|
});
|
|
3614
3615
|
|
|
3615
3616
|
function toESTreeLocation(node) {
|
|
3616
|
-
toUnenumerable(node.loc.start, "index");
|
|
3617
|
-
toUnenumerable(node.loc.end, "index");
|
|
3617
|
+
node.loc.start && toUnenumerable(node.loc.start, "index");
|
|
3618
|
+
node.loc.end && toUnenumerable(node.loc.end, "index");
|
|
3618
3619
|
return node;
|
|
3619
3620
|
}
|
|
3620
3621
|
|
|
@@ -3888,10 +3889,9 @@
|
|
|
3888
3889
|
}
|
|
3889
3890
|
|
|
3890
3891
|
this.toAssignable(value, isLHS);
|
|
3891
|
-
|
|
3892
|
+
} else {
|
|
3893
|
+
super.toAssignable(node, isLHS);
|
|
3892
3894
|
}
|
|
3893
|
-
|
|
3894
|
-
return super.toAssignable(node, isLHS);
|
|
3895
3895
|
}
|
|
3896
3896
|
|
|
3897
3897
|
toAssignableObjectExpressionProp(prop) {
|
|
@@ -3904,11 +3904,7 @@
|
|
|
3904
3904
|
at: prop.key
|
|
3905
3905
|
});
|
|
3906
3906
|
} else {
|
|
3907
|
-
|
|
3908
|
-
args[_key3 - 1] = arguments[_key3];
|
|
3909
|
-
}
|
|
3910
|
-
|
|
3911
|
-
super.toAssignableObjectExpressionProp(prop, ...args);
|
|
3907
|
+
super.toAssignableObjectExpressionProp(...arguments);
|
|
3912
3908
|
}
|
|
3913
3909
|
}
|
|
3914
3910
|
|
|
@@ -4005,6 +4001,11 @@
|
|
|
4005
4001
|
return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
|
|
4006
4002
|
}
|
|
4007
4003
|
|
|
4004
|
+
resetStartLocation(node, start, startLoc) {
|
|
4005
|
+
super.resetStartLocation(node, start, startLoc);
|
|
4006
|
+
toESTreeLocation(node);
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4008
4009
|
resetEndLocation(node) {
|
|
4009
4010
|
var endLoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state.lastTokEndLoc;
|
|
4010
4011
|
super.resetEndLocation(node, endLoc);
|
|
@@ -4152,9 +4153,7 @@
|
|
|
4152
4153
|
beforeExpr,
|
|
4153
4154
|
startsExpr
|
|
4154
4155
|
}),
|
|
4155
|
-
braceR: createToken("}",
|
|
4156
|
-
beforeExpr
|
|
4157
|
-
}),
|
|
4156
|
+
braceR: createToken("}"),
|
|
4158
4157
|
braceBarR: createToken("|}"),
|
|
4159
4158
|
parenL: createToken("(", {
|
|
4160
4159
|
beforeExpr,
|
|
@@ -5044,6 +5043,7 @@
|
|
|
5044
5043
|
this.hasFlowComment = false;
|
|
5045
5044
|
this.isAmbientContext = false;
|
|
5046
5045
|
this.inAbstractClass = false;
|
|
5046
|
+
this.inDisallowConditionalTypesContext = false;
|
|
5047
5047
|
this.topicContext = {
|
|
5048
5048
|
maxNumOfResolvableTopics: 0,
|
|
5049
5049
|
maxTopicIndex: null
|
|
@@ -7056,7 +7056,7 @@
|
|
|
7056
7056
|
this.parser.raise(toParseError, origin);
|
|
7057
7057
|
}
|
|
7058
7058
|
|
|
7059
|
-
|
|
7059
|
+
recordArrowParemeterBindingError(error, _ref45) {
|
|
7060
7060
|
var {
|
|
7061
7061
|
at: node
|
|
7062
7062
|
} = _ref45;
|
|
@@ -7069,9 +7069,9 @@
|
|
|
7069
7069
|
};
|
|
7070
7070
|
|
|
7071
7071
|
if (scope.isCertainlyParameterDeclaration()) {
|
|
7072
|
-
this.parser.raise(
|
|
7072
|
+
this.parser.raise(error, origin);
|
|
7073
7073
|
} else if (scope.canBeArrowParameterDeclaration()) {
|
|
7074
|
-
scope.recordDeclarationError(
|
|
7074
|
+
scope.recordDeclarationError(error, origin);
|
|
7075
7075
|
} else {
|
|
7076
7076
|
return;
|
|
7077
7077
|
}
|
|
@@ -9522,11 +9522,11 @@
|
|
|
9522
9522
|
toAssignable(node) {
|
|
9523
9523
|
var isLHS = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
9524
9524
|
|
|
9525
|
-
if (node.type === "TypeCastExpression") {
|
|
9526
|
-
|
|
9527
|
-
} else {
|
|
9528
|
-
return super.toAssignable(node, isLHS);
|
|
9525
|
+
if (!isLHS && node.type === "AssignmentExpression" && node.left.type === "TypeCastExpression") {
|
|
9526
|
+
node.left = this.typeCastToParameter(node.left);
|
|
9529
9527
|
}
|
|
9528
|
+
|
|
9529
|
+
super.toAssignable(...arguments);
|
|
9530
9530
|
}
|
|
9531
9531
|
|
|
9532
9532
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
@@ -9538,7 +9538,7 @@
|
|
|
9538
9538
|
}
|
|
9539
9539
|
}
|
|
9540
9540
|
|
|
9541
|
-
|
|
9541
|
+
super.toAssignableList(exprList, trailingCommaLoc, isLHS);
|
|
9542
9542
|
}
|
|
9543
9543
|
|
|
9544
9544
|
toReferencedList(exprList, isParenthesizedExpr) {
|
|
@@ -9568,8 +9568,8 @@
|
|
|
9568
9568
|
}
|
|
9569
9569
|
|
|
9570
9570
|
isValidLVal(type) {
|
|
9571
|
-
for (var
|
|
9572
|
-
rest[
|
|
9571
|
+
for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
9572
|
+
rest[_key3 - 1] = arguments[_key3];
|
|
9573
9573
|
}
|
|
9574
9574
|
|
|
9575
9575
|
return type === "TypeCastExpression" || super.isValidLVal(type, ...rest);
|
|
@@ -10118,7 +10118,8 @@
|
|
|
10118
10118
|
return super.parseSubscript(base, startPos, startLoc, noCalls, subscriptState);
|
|
10119
10119
|
}
|
|
10120
10120
|
|
|
10121
|
-
|
|
10121
|
+
parseNewCallee(node) {
|
|
10122
|
+
super.parseNewCallee(node);
|
|
10122
10123
|
var targs = null;
|
|
10123
10124
|
|
|
10124
10125
|
if (this.shouldParseTypes() && this.match(47)) {
|
|
@@ -10126,7 +10127,6 @@
|
|
|
10126
10127
|
}
|
|
10127
10128
|
|
|
10128
10129
|
node.typeArguments = targs;
|
|
10129
|
-
super.parseNewArguments(node);
|
|
10130
10130
|
}
|
|
10131
10131
|
|
|
10132
10132
|
parseAsyncArrowWithTypeParameters(startPos, startLoc) {
|
|
@@ -11199,6 +11199,7 @@
|
|
|
11199
11199
|
this.next();
|
|
11200
11200
|
node.expression = this.parseExpression();
|
|
11201
11201
|
this.setContext(types.j_oTag);
|
|
11202
|
+
this.state.canStartJSXElement = true;
|
|
11202
11203
|
this.expect(8);
|
|
11203
11204
|
return this.finishNode(node, "JSXSpreadChild");
|
|
11204
11205
|
}
|
|
@@ -11212,6 +11213,7 @@
|
|
|
11212
11213
|
}
|
|
11213
11214
|
|
|
11214
11215
|
this.setContext(previousContext);
|
|
11216
|
+
this.state.canStartJSXElement = true;
|
|
11215
11217
|
this.expect(8);
|
|
11216
11218
|
return this.finishNode(node, "JSXExpressionContainer");
|
|
11217
11219
|
}
|
|
@@ -11225,6 +11227,7 @@
|
|
|
11225
11227
|
this.expect(21);
|
|
11226
11228
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
11227
11229
|
this.setContext(types.j_oTag);
|
|
11230
|
+
this.state.canStartJSXElement = true;
|
|
11228
11231
|
this.expect(8);
|
|
11229
11232
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
11230
11233
|
}
|
|
@@ -11237,8 +11240,7 @@
|
|
|
11237
11240
|
jsxParseOpeningElementAt(startPos, startLoc) {
|
|
11238
11241
|
var node = this.startNodeAt(startPos, startLoc);
|
|
11239
11242
|
|
|
11240
|
-
if (this.
|
|
11241
|
-
this.expect(139);
|
|
11243
|
+
if (this.eat(139)) {
|
|
11242
11244
|
return this.finishNode(node, "JSXOpeningFragment");
|
|
11243
11245
|
}
|
|
11244
11246
|
|
|
@@ -11262,8 +11264,7 @@
|
|
|
11262
11264
|
jsxParseClosingElementAt(startPos, startLoc) {
|
|
11263
11265
|
var node = this.startNodeAt(startPos, startLoc);
|
|
11264
11266
|
|
|
11265
|
-
if (this.
|
|
11266
|
-
this.expect(139);
|
|
11267
|
+
if (this.eat(139)) {
|
|
11267
11268
|
return this.finishNode(node, "JSXClosingFragment");
|
|
11268
11269
|
}
|
|
11269
11270
|
|
|
@@ -11619,12 +11620,25 @@
|
|
|
11619
11620
|
} = _ref80;
|
|
11620
11621
|
return "'".concat(modifier, "' modifier cannot appear on a type member.");
|
|
11621
11622
|
}),
|
|
11622
|
-
|
|
11623
|
+
InvalidModifierOnTypeParameter: _(_ref81 => {
|
|
11623
11624
|
var {
|
|
11624
|
-
|
|
11625
|
+
modifier
|
|
11625
11626
|
} = _ref81;
|
|
11627
|
+
return "'".concat(modifier, "' modifier cannot appear on a type parameter.");
|
|
11628
|
+
}),
|
|
11629
|
+
InvalidModifierOnTypeParameterPositions: _(_ref82 => {
|
|
11630
|
+
var {
|
|
11631
|
+
modifier
|
|
11632
|
+
} = _ref82;
|
|
11633
|
+
return "'".concat(modifier, "' modifier can only appear on a type parameter of a class, interface or type alias.");
|
|
11634
|
+
}),
|
|
11635
|
+
InvalidModifiersOrder: _(_ref83 => {
|
|
11636
|
+
var {
|
|
11637
|
+
orderedModifiers
|
|
11638
|
+
} = _ref83;
|
|
11626
11639
|
return "'".concat(orderedModifiers[0], "' modifier must precede '").concat(orderedModifiers[1], "' modifier.");
|
|
11627
11640
|
}),
|
|
11641
|
+
InvalidPropertyAccessAfterInstantiationExpression: _("Invalid property access after an instantiation expression. " + "You can either wrap the instantiation expression in parentheses, or delete the type arguments."),
|
|
11628
11642
|
InvalidTupleMemberLabel: _("Tuple members must be labeled with a simple identifier."),
|
|
11629
11643
|
MissingInterfaceName: _("'interface' declarations must be followed by an identifier."),
|
|
11630
11644
|
MixedLabeledAndUnlabeledElements: _("Tuple members must all have names or all not have names."),
|
|
@@ -11634,10 +11648,10 @@
|
|
|
11634
11648
|
OverrideNotInSubClass: _("This member cannot have an 'override' modifier because its containing class does not extend another class."),
|
|
11635
11649
|
PatternIsOptional: _("A binding pattern parameter cannot be optional in an implementation signature."),
|
|
11636
11650
|
PrivateElementHasAbstract: _("Private elements cannot have the 'abstract' modifier."),
|
|
11637
|
-
PrivateElementHasAccessibility: _(
|
|
11651
|
+
PrivateElementHasAccessibility: _(_ref84 => {
|
|
11638
11652
|
var {
|
|
11639
11653
|
modifier
|
|
11640
|
-
} =
|
|
11654
|
+
} = _ref84;
|
|
11641
11655
|
return "Private elements cannot have an accessibility modifier ('".concat(modifier, "').");
|
|
11642
11656
|
}),
|
|
11643
11657
|
ReadonlyForMethodSignature: _("'readonly' modifier can only appear on a property declaration or index signature."),
|
|
@@ -11646,10 +11660,10 @@
|
|
|
11646
11660
|
SetAccesorCannotHaveOptionalParameter: _("A 'set' accessor cannot have an optional parameter."),
|
|
11647
11661
|
SetAccesorCannotHaveRestParameter: _("A 'set' accessor cannot have rest parameter."),
|
|
11648
11662
|
SetAccesorCannotHaveReturnType: _("A 'set' accessor cannot have a return type annotation."),
|
|
11649
|
-
SingleTypeParameterWithoutTrailingComma: _(
|
|
11663
|
+
SingleTypeParameterWithoutTrailingComma: _(_ref85 => {
|
|
11650
11664
|
var {
|
|
11651
11665
|
typeParameterName
|
|
11652
|
-
} =
|
|
11666
|
+
} = _ref85;
|
|
11653
11667
|
return "Single type parameter ".concat(typeParameterName, " should have a trailing comma. Example usage: <").concat(typeParameterName, ",>.");
|
|
11654
11668
|
}),
|
|
11655
11669
|
StaticBlockCannotHaveModifier: _("Static class blocks cannot have any modifier."),
|
|
@@ -11663,10 +11677,10 @@
|
|
|
11663
11677
|
UnexpectedTypeCastInParameter: _("Unexpected type cast in parameter position."),
|
|
11664
11678
|
UnsupportedImportTypeArgument: _("Argument in a type import must be a string literal."),
|
|
11665
11679
|
UnsupportedParameterPropertyKind: _("A parameter property may not be declared using a binding pattern."),
|
|
11666
|
-
UnsupportedSignatureParameterKind: _(
|
|
11680
|
+
UnsupportedSignatureParameterKind: _(_ref86 => {
|
|
11667
11681
|
var {
|
|
11668
11682
|
type
|
|
11669
|
-
} =
|
|
11683
|
+
} = _ref86;
|
|
11670
11684
|
return "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ".concat(type, ".");
|
|
11671
11685
|
})
|
|
11672
11686
|
}));
|
|
@@ -11712,6 +11726,10 @@
|
|
|
11712
11726
|
return modifier === "private" || modifier === "public" || modifier === "protected";
|
|
11713
11727
|
}
|
|
11714
11728
|
|
|
11729
|
+
function tsIsVarianceAnnotations(modifier) {
|
|
11730
|
+
return modifier === "in" || modifier === "out";
|
|
11731
|
+
}
|
|
11732
|
+
|
|
11715
11733
|
var typescript = superClass => class extends superClass {
|
|
11716
11734
|
getScopeHandler() {
|
|
11717
11735
|
return TypeScriptScopeHandler;
|
|
@@ -11731,7 +11749,7 @@
|
|
|
11731
11749
|
}
|
|
11732
11750
|
|
|
11733
11751
|
tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
|
|
11734
|
-
if (!tokenIsIdentifier(this.state.type)) {
|
|
11752
|
+
if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58) {
|
|
11735
11753
|
return undefined;
|
|
11736
11754
|
}
|
|
11737
11755
|
|
|
@@ -11750,13 +11768,14 @@
|
|
|
11750
11768
|
return undefined;
|
|
11751
11769
|
}
|
|
11752
11770
|
|
|
11753
|
-
tsParseModifiers(
|
|
11771
|
+
tsParseModifiers(_ref87) {
|
|
11754
11772
|
var {
|
|
11755
11773
|
modified,
|
|
11756
11774
|
allowedModifiers,
|
|
11757
11775
|
disallowedModifiers,
|
|
11758
|
-
stopOnStartOfClassStaticBlock
|
|
11759
|
-
|
|
11776
|
+
stopOnStartOfClassStaticBlock,
|
|
11777
|
+
errorTemplate = TSErrors.InvalidModifierOnTypeMember
|
|
11778
|
+
} = _ref87;
|
|
11760
11779
|
|
|
11761
11780
|
var enforceOrder = (loc, modifier, before, after) => {
|
|
11762
11781
|
if (modifier === before && modified[after]) {
|
|
@@ -11795,6 +11814,16 @@
|
|
|
11795
11814
|
enforceOrder(startLoc, modifier, modifier, "readonly");
|
|
11796
11815
|
modified.accessibility = modifier;
|
|
11797
11816
|
}
|
|
11817
|
+
} else if (tsIsVarianceAnnotations(modifier)) {
|
|
11818
|
+
if (modified[modifier]) {
|
|
11819
|
+
this.raise(TSErrors.DuplicateModifier, {
|
|
11820
|
+
at: startLoc,
|
|
11821
|
+
modifier
|
|
11822
|
+
});
|
|
11823
|
+
}
|
|
11824
|
+
|
|
11825
|
+
modified[modifier] = true;
|
|
11826
|
+
enforceOrder(startLoc, modifier, "in", "out");
|
|
11798
11827
|
} else {
|
|
11799
11828
|
if (Object.hasOwnProperty.call(modified, modifier)) {
|
|
11800
11829
|
this.raise(TSErrors.DuplicateModifier, {
|
|
@@ -11814,7 +11843,7 @@
|
|
|
11814
11843
|
}
|
|
11815
11844
|
|
|
11816
11845
|
if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
|
|
11817
|
-
this.raise(
|
|
11846
|
+
this.raise(errorTemplate, {
|
|
11818
11847
|
at: startLoc,
|
|
11819
11848
|
modifier
|
|
11820
11849
|
});
|
|
@@ -11991,24 +12020,48 @@
|
|
|
11991
12020
|
node.exprName = this.tsParseEntityName();
|
|
11992
12021
|
}
|
|
11993
12022
|
|
|
12023
|
+
if (!this.hasPrecedingLineBreak() && this.match(47)) {
|
|
12024
|
+
node.typeParameters = this.tsParseTypeArguments();
|
|
12025
|
+
}
|
|
12026
|
+
|
|
11994
12027
|
return this.finishNode(node, "TSTypeQuery");
|
|
11995
12028
|
}
|
|
11996
12029
|
|
|
12030
|
+
tsParseInOutModifiers(node) {
|
|
12031
|
+
this.tsParseModifiers({
|
|
12032
|
+
modified: node,
|
|
12033
|
+
allowedModifiers: ["in", "out"],
|
|
12034
|
+
disallowedModifiers: ["public", "private", "protected", "readonly", "declare", "abstract", "override"],
|
|
12035
|
+
errorTemplate: TSErrors.InvalidModifierOnTypeParameter
|
|
12036
|
+
});
|
|
12037
|
+
}
|
|
12038
|
+
|
|
12039
|
+
tsParseNoneModifiers(node) {
|
|
12040
|
+
this.tsParseModifiers({
|
|
12041
|
+
modified: node,
|
|
12042
|
+
allowedModifiers: [],
|
|
12043
|
+
disallowedModifiers: ["in", "out"],
|
|
12044
|
+
errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
|
|
12045
|
+
});
|
|
12046
|
+
}
|
|
12047
|
+
|
|
11997
12048
|
tsParseTypeParameter() {
|
|
12049
|
+
var parseModifiers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.tsParseNoneModifiers.bind(this);
|
|
11998
12050
|
var node = this.startNode();
|
|
12051
|
+
parseModifiers(node);
|
|
11999
12052
|
node.name = this.tsParseTypeParameterName();
|
|
12000
12053
|
node.constraint = this.tsEatThenParseType(81);
|
|
12001
12054
|
node.default = this.tsEatThenParseType(29);
|
|
12002
12055
|
return this.finishNode(node, "TSTypeParameter");
|
|
12003
12056
|
}
|
|
12004
12057
|
|
|
12005
|
-
tsTryParseTypeParameters() {
|
|
12058
|
+
tsTryParseTypeParameters(parseModifiers) {
|
|
12006
12059
|
if (this.match(47)) {
|
|
12007
|
-
return this.tsParseTypeParameters();
|
|
12060
|
+
return this.tsParseTypeParameters(parseModifiers);
|
|
12008
12061
|
}
|
|
12009
12062
|
}
|
|
12010
12063
|
|
|
12011
|
-
tsParseTypeParameters() {
|
|
12064
|
+
tsParseTypeParameters(parseModifiers) {
|
|
12012
12065
|
var node = this.startNode();
|
|
12013
12066
|
|
|
12014
12067
|
if (this.match(47) || this.match(138)) {
|
|
@@ -12020,7 +12073,7 @@
|
|
|
12020
12073
|
var refTrailingCommaPos = {
|
|
12021
12074
|
value: -1
|
|
12022
12075
|
};
|
|
12023
|
-
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this), false, true, refTrailingCommaPos);
|
|
12076
|
+
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
12024
12077
|
|
|
12025
12078
|
if (node.params.length === 0) {
|
|
12026
12079
|
this.raise(TSErrors.EmptyTypeParameters, {
|
|
@@ -12411,7 +12464,7 @@
|
|
|
12411
12464
|
this.next();
|
|
12412
12465
|
}
|
|
12413
12466
|
|
|
12414
|
-
this.tsFillSignature(19, node);
|
|
12467
|
+
this.tsInAllowConditionalTypesContext(() => this.tsFillSignature(19, node));
|
|
12415
12468
|
return this.finishNode(node, type);
|
|
12416
12469
|
}
|
|
12417
12470
|
|
|
@@ -12580,13 +12633,24 @@
|
|
|
12580
12633
|
this.expectContextual(112);
|
|
12581
12634
|
var typeParameter = this.startNode();
|
|
12582
12635
|
typeParameter.name = this.tsParseTypeParameterName();
|
|
12636
|
+
typeParameter.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType());
|
|
12583
12637
|
node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
|
|
12584
12638
|
return this.finishNode(node, "TSInferType");
|
|
12585
12639
|
}
|
|
12586
12640
|
|
|
12641
|
+
tsParseConstraintForInferType() {
|
|
12642
|
+
if (this.eat(81)) {
|
|
12643
|
+
var constraint = this.tsInDisallowConditionalTypesContext(() => this.tsParseType());
|
|
12644
|
+
|
|
12645
|
+
if (this.state.inDisallowConditionalTypesContext || !this.match(17)) {
|
|
12646
|
+
return constraint;
|
|
12647
|
+
}
|
|
12648
|
+
}
|
|
12649
|
+
}
|
|
12650
|
+
|
|
12587
12651
|
tsParseTypeOperatorOrHigher() {
|
|
12588
12652
|
var isTypeOperator = tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc;
|
|
12589
|
-
return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(112) ? this.tsParseInferType() : this.tsParseArrayTypeOrHigher();
|
|
12653
|
+
return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(112) ? this.tsParseInferType() : this.tsInAllowConditionalTypesContext(() => this.tsParseArrayTypeOrHigher());
|
|
12590
12654
|
}
|
|
12591
12655
|
|
|
12592
12656
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
@@ -12788,17 +12852,17 @@
|
|
|
12788
12852
|
assert(this.state.inType);
|
|
12789
12853
|
var type = this.tsParseNonConditionalType();
|
|
12790
12854
|
|
|
12791
|
-
if (this.hasPrecedingLineBreak() || !this.eat(81)) {
|
|
12855
|
+
if (this.state.inDisallowConditionalTypesContext || this.hasPrecedingLineBreak() || !this.eat(81)) {
|
|
12792
12856
|
return type;
|
|
12793
12857
|
}
|
|
12794
12858
|
|
|
12795
12859
|
var node = this.startNodeAtNode(type);
|
|
12796
12860
|
node.checkType = type;
|
|
12797
|
-
node.extendsType = this.tsParseNonConditionalType();
|
|
12861
|
+
node.extendsType = this.tsInDisallowConditionalTypesContext(() => this.tsParseNonConditionalType());
|
|
12798
12862
|
this.expect(17);
|
|
12799
|
-
node.trueType = this.tsParseType();
|
|
12863
|
+
node.trueType = this.tsInAllowConditionalTypesContext(() => this.tsParseType());
|
|
12800
12864
|
this.expect(14);
|
|
12801
|
-
node.falseType = this.tsParseType();
|
|
12865
|
+
node.falseType = this.tsInAllowConditionalTypesContext(() => this.tsParseType());
|
|
12802
12866
|
return this.finishNode(node, "TSConditionalType");
|
|
12803
12867
|
}
|
|
12804
12868
|
|
|
@@ -12839,7 +12903,16 @@
|
|
|
12839
12903
|
|
|
12840
12904
|
tsParseHeritageClause(token) {
|
|
12841
12905
|
var originalStartLoc = this.state.startLoc;
|
|
12842
|
-
var delimitedList = this.tsParseDelimitedList("HeritageClauseElement",
|
|
12906
|
+
var delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
|
|
12907
|
+
var node = this.startNode();
|
|
12908
|
+
node.expression = this.tsParseEntityName();
|
|
12909
|
+
|
|
12910
|
+
if (this.match(47)) {
|
|
12911
|
+
node.typeParameters = this.tsParseTypeArguments();
|
|
12912
|
+
}
|
|
12913
|
+
|
|
12914
|
+
return this.finishNode(node, "TSExpressionWithTypeArguments");
|
|
12915
|
+
});
|
|
12843
12916
|
|
|
12844
12917
|
if (!delimitedList.length) {
|
|
12845
12918
|
this.raise(TSErrors.EmptyHeritageClauseType, {
|
|
@@ -12851,17 +12924,6 @@
|
|
|
12851
12924
|
return delimitedList;
|
|
12852
12925
|
}
|
|
12853
12926
|
|
|
12854
|
-
tsParseExpressionWithTypeArguments() {
|
|
12855
|
-
var node = this.startNode();
|
|
12856
|
-
node.expression = this.tsParseEntityName();
|
|
12857
|
-
|
|
12858
|
-
if (this.match(47)) {
|
|
12859
|
-
node.typeParameters = this.tsParseTypeArguments();
|
|
12860
|
-
}
|
|
12861
|
-
|
|
12862
|
-
return this.finishNode(node, "TSExpressionWithTypeArguments");
|
|
12863
|
-
}
|
|
12864
|
-
|
|
12865
12927
|
tsParseInterfaceDeclaration(node) {
|
|
12866
12928
|
var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12867
12929
|
if (this.hasFollowingLineBreak()) return null;
|
|
@@ -12878,7 +12940,7 @@
|
|
|
12878
12940
|
});
|
|
12879
12941
|
}
|
|
12880
12942
|
|
|
12881
|
-
node.typeParameters = this.tsTryParseTypeParameters();
|
|
12943
|
+
node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this));
|
|
12882
12944
|
|
|
12883
12945
|
if (this.eat(81)) {
|
|
12884
12946
|
node.extends = this.tsParseHeritageClause("extends");
|
|
@@ -12894,7 +12956,7 @@
|
|
|
12894
12956
|
node.id = this.parseIdentifier();
|
|
12895
12957
|
this.checkIdentifier(node.id, BIND_TS_TYPE);
|
|
12896
12958
|
node.typeAnnotation = this.tsInType(() => {
|
|
12897
|
-
node.typeParameters = this.tsTryParseTypeParameters();
|
|
12959
|
+
node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this));
|
|
12898
12960
|
this.expect(29);
|
|
12899
12961
|
|
|
12900
12962
|
if (this.isContextual(111) && this.lookahead().type !== 16) {
|
|
@@ -12932,6 +12994,28 @@
|
|
|
12932
12994
|
}
|
|
12933
12995
|
}
|
|
12934
12996
|
|
|
12997
|
+
tsInDisallowConditionalTypesContext(cb) {
|
|
12998
|
+
var oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
|
|
12999
|
+
this.state.inDisallowConditionalTypesContext = true;
|
|
13000
|
+
|
|
13001
|
+
try {
|
|
13002
|
+
return cb();
|
|
13003
|
+
} finally {
|
|
13004
|
+
this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
|
|
13005
|
+
}
|
|
13006
|
+
}
|
|
13007
|
+
|
|
13008
|
+
tsInAllowConditionalTypesContext(cb) {
|
|
13009
|
+
var oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
|
|
13010
|
+
this.state.inDisallowConditionalTypesContext = false;
|
|
13011
|
+
|
|
13012
|
+
try {
|
|
13013
|
+
return cb();
|
|
13014
|
+
} finally {
|
|
13015
|
+
this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
|
|
13016
|
+
}
|
|
13017
|
+
}
|
|
13018
|
+
|
|
12935
13019
|
tsEatThenParseType(token) {
|
|
12936
13020
|
return !this.match(token) ? undefined : this.tsNextThenParseType();
|
|
12937
13021
|
}
|
|
@@ -13451,61 +13535,78 @@
|
|
|
13451
13535
|
}
|
|
13452
13536
|
}
|
|
13453
13537
|
|
|
13454
|
-
var node = this.startNodeAt(startPos, startLoc);
|
|
13455
|
-
node.callee = base;
|
|
13456
13538
|
var typeArguments = this.tsParseTypeArgumentsInExpression();
|
|
13539
|
+
if (!typeArguments) return;
|
|
13457
13540
|
|
|
13458
|
-
if (
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
}
|
|
13541
|
+
if (isOptionalCall && !this.match(10)) {
|
|
13542
|
+
missingParenErrorLoc = this.state.curPosition();
|
|
13543
|
+
return;
|
|
13544
|
+
}
|
|
13463
13545
|
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
this.tsCheckForInvalidTypeCasts(node.arguments);
|
|
13467
|
-
node.typeParameters = typeArguments;
|
|
13546
|
+
if (tokenIsTemplate(this.state.type)) {
|
|
13547
|
+
var _result = this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
|
|
13468
13548
|
|
|
13469
|
-
|
|
13470
|
-
|
|
13471
|
-
|
|
13549
|
+
_result.typeParameters = typeArguments;
|
|
13550
|
+
return _result;
|
|
13551
|
+
}
|
|
13552
|
+
|
|
13553
|
+
if (!noCalls && this.eat(10)) {
|
|
13554
|
+
var _node9 = this.startNodeAt(startPos, startLoc);
|
|
13472
13555
|
|
|
13473
|
-
|
|
13474
|
-
|
|
13475
|
-
|
|
13556
|
+
_node9.callee = base;
|
|
13557
|
+
_node9.arguments = this.parseCallExpressionArguments(11, false);
|
|
13558
|
+
this.tsCheckForInvalidTypeCasts(_node9.arguments);
|
|
13559
|
+
_node9.typeParameters = typeArguments;
|
|
13476
13560
|
|
|
13477
|
-
|
|
13478
|
-
|
|
13561
|
+
if (state.optionalChainMember) {
|
|
13562
|
+
_node9.optional = isOptionalCall;
|
|
13479
13563
|
}
|
|
13564
|
+
|
|
13565
|
+
return this.finishCallExpression(_node9, state.optionalChainMember);
|
|
13480
13566
|
}
|
|
13481
13567
|
|
|
13482
|
-
this.
|
|
13568
|
+
var tokenType = this.state.type;
|
|
13569
|
+
|
|
13570
|
+
if (tokenType === 48 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
|
|
13571
|
+
return;
|
|
13572
|
+
}
|
|
13573
|
+
|
|
13574
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
13575
|
+
node.expression = base;
|
|
13576
|
+
node.typeParameters = typeArguments;
|
|
13577
|
+
return this.finishNode(node, "TSInstantiationExpression");
|
|
13483
13578
|
});
|
|
13484
13579
|
|
|
13485
13580
|
if (missingParenErrorLoc) {
|
|
13486
13581
|
this.unexpected(missingParenErrorLoc, 10);
|
|
13487
13582
|
}
|
|
13488
13583
|
|
|
13489
|
-
if (result)
|
|
13584
|
+
if (result) {
|
|
13585
|
+
if (result.type === "TSInstantiationExpression" && (this.match(16) || this.match(18) && this.lookaheadCharCode() !== 40)) {
|
|
13586
|
+
this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, {
|
|
13587
|
+
at: this.state.startLoc
|
|
13588
|
+
});
|
|
13589
|
+
}
|
|
13590
|
+
|
|
13591
|
+
return result;
|
|
13592
|
+
}
|
|
13490
13593
|
}
|
|
13491
13594
|
|
|
13492
13595
|
return super.parseSubscript(base, startPos, startLoc, noCalls, state);
|
|
13493
13596
|
}
|
|
13494
13597
|
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
var typeParameters = this.tsTryParseAndCatch(() => {
|
|
13498
|
-
var args = this.tsParseTypeArgumentsInExpression();
|
|
13499
|
-
if (!this.match(10)) this.unexpected();
|
|
13500
|
-
return args;
|
|
13501
|
-
});
|
|
13598
|
+
parseNewCallee(node) {
|
|
13599
|
+
var _callee$extra;
|
|
13502
13600
|
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
}
|
|
13601
|
+
super.parseNewCallee(node);
|
|
13602
|
+
var {
|
|
13603
|
+
callee
|
|
13604
|
+
} = node;
|
|
13507
13605
|
|
|
13508
|
-
|
|
13606
|
+
if (callee.type === "TSInstantiationExpression" && !((_callee$extra = callee.extra) != null && _callee$extra.parenthesized)) {
|
|
13607
|
+
node.typeParameters = callee.typeParameters;
|
|
13608
|
+
node.callee = callee.expression;
|
|
13609
|
+
}
|
|
13509
13610
|
}
|
|
13510
13611
|
|
|
13511
13612
|
parseExprOp(left, leftStartPos, leftStartLoc, minPrec) {
|
|
@@ -13693,7 +13794,9 @@
|
|
|
13693
13794
|
this.tsParseModifiers({
|
|
13694
13795
|
modified: member,
|
|
13695
13796
|
allowedModifiers: modifiers,
|
|
13696
|
-
|
|
13797
|
+
disallowedModifiers: ["in", "out"],
|
|
13798
|
+
stopOnStartOfClassStaticBlock: true,
|
|
13799
|
+
errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
|
|
13697
13800
|
});
|
|
13698
13801
|
|
|
13699
13802
|
var callParseClassMemberWithIsStatic = () => {
|
|
@@ -13872,7 +13975,7 @@
|
|
|
13872
13975
|
}
|
|
13873
13976
|
|
|
13874
13977
|
super.parseClassId(node, isStatement, optionalId, node.declare ? BIND_TS_AMBIENT : BIND_CLASS);
|
|
13875
|
-
var typeParameters = this.tsTryParseTypeParameters();
|
|
13978
|
+
var typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this));
|
|
13876
13979
|
if (typeParameters) node.typeParameters = typeParameters;
|
|
13877
13980
|
}
|
|
13878
13981
|
|
|
@@ -13978,8 +14081,8 @@
|
|
|
13978
14081
|
var typeParameters = this.tsTryParseTypeParameters();
|
|
13979
14082
|
if (typeParameters) prop.typeParameters = typeParameters;
|
|
13980
14083
|
|
|
13981
|
-
for (var
|
|
13982
|
-
args[
|
|
14084
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
14085
|
+
args[_key4 - 1] = arguments[_key4];
|
|
13983
14086
|
}
|
|
13984
14087
|
|
|
13985
14088
|
super.parseObjPropValue(prop, ...args);
|
|
@@ -14015,8 +14118,8 @@
|
|
|
14015
14118
|
}
|
|
14016
14119
|
|
|
14017
14120
|
parseMaybeAssign() {
|
|
14018
|
-
for (var
|
|
14019
|
-
args[
|
|
14121
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
14122
|
+
args[_key5] = arguments[_key5];
|
|
14020
14123
|
}
|
|
14021
14124
|
|
|
14022
14125
|
var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2, _jsx4, _typeCast3;
|
|
@@ -14043,10 +14146,10 @@
|
|
|
14043
14146
|
return super.parseMaybeAssign(...args);
|
|
14044
14147
|
}
|
|
14045
14148
|
|
|
14149
|
+
if (!state || state === this.state) state = this.state.clone();
|
|
14046
14150
|
var typeParameters;
|
|
14047
|
-
state = state || this.state.clone();
|
|
14048
14151
|
var arrow = this.tryParse(abort => {
|
|
14049
|
-
var _expr$extra, _typeParameters
|
|
14152
|
+
var _expr$extra, _typeParameters;
|
|
14050
14153
|
|
|
14051
14154
|
typeParameters = this.tsParseTypeParameters();
|
|
14052
14155
|
var expr = super.parseMaybeAssign(...args);
|
|
@@ -14060,12 +14163,6 @@
|
|
|
14060
14163
|
}
|
|
14061
14164
|
|
|
14062
14165
|
expr.typeParameters = typeParameters;
|
|
14063
|
-
|
|
14064
|
-
if (this.hasPlugin("jsx") && expr.typeParameters.params.length === 1 && !((_expr$typeParameters$ = expr.typeParameters.extra) != null && _expr$typeParameters$.trailingComma)) {
|
|
14065
|
-
var parameter = expr.typeParameters.params[0];
|
|
14066
|
-
if (!parameter.constraint) ;
|
|
14067
|
-
}
|
|
14068
|
-
|
|
14069
14166
|
return expr;
|
|
14070
14167
|
}, state);
|
|
14071
14168
|
|
|
@@ -14172,23 +14269,33 @@
|
|
|
14172
14269
|
var isLHS = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
14173
14270
|
|
|
14174
14271
|
switch (node.type) {
|
|
14175
|
-
case "TSTypeCastExpression":
|
|
14176
|
-
return super.toAssignable(this.typeCastToParameter(node), isLHS);
|
|
14177
|
-
|
|
14178
|
-
case "TSParameterProperty":
|
|
14179
|
-
return super.toAssignable(node, isLHS);
|
|
14180
|
-
|
|
14181
14272
|
case "ParenthesizedExpression":
|
|
14182
|
-
|
|
14273
|
+
this.toAssignableParenthesizedExpression(node, isLHS);
|
|
14274
|
+
break;
|
|
14183
14275
|
|
|
14184
14276
|
case "TSAsExpression":
|
|
14185
14277
|
case "TSNonNullExpression":
|
|
14186
14278
|
case "TSTypeAssertion":
|
|
14187
|
-
|
|
14188
|
-
|
|
14279
|
+
if (isLHS) {
|
|
14280
|
+
this.expressionScope.recordArrowParemeterBindingError(TSErrors.UnexpectedTypeCastInParameter, {
|
|
14281
|
+
at: node
|
|
14282
|
+
});
|
|
14283
|
+
} else {
|
|
14284
|
+
this.raise(TSErrors.UnexpectedTypeCastInParameter, {
|
|
14285
|
+
at: node
|
|
14286
|
+
});
|
|
14287
|
+
}
|
|
14288
|
+
|
|
14289
|
+
this.toAssignable(node.expression, isLHS);
|
|
14290
|
+
break;
|
|
14291
|
+
|
|
14292
|
+
case "AssignmentExpression":
|
|
14293
|
+
if (!isLHS && node.left.type === "TSTypeCastExpression") {
|
|
14294
|
+
node.left = this.typeCastToParameter(node.left);
|
|
14295
|
+
}
|
|
14189
14296
|
|
|
14190
14297
|
default:
|
|
14191
|
-
|
|
14298
|
+
super.toAssignable(node, isLHS);
|
|
14192
14299
|
}
|
|
14193
14300
|
}
|
|
14194
14301
|
|
|
@@ -14198,22 +14305,35 @@
|
|
|
14198
14305
|
case "TSNonNullExpression":
|
|
14199
14306
|
case "TSTypeAssertion":
|
|
14200
14307
|
case "ParenthesizedExpression":
|
|
14201
|
-
|
|
14202
|
-
|
|
14308
|
+
this.toAssignable(node.expression, isLHS);
|
|
14309
|
+
break;
|
|
14203
14310
|
|
|
14204
14311
|
default:
|
|
14205
|
-
|
|
14312
|
+
super.toAssignable(node, isLHS);
|
|
14206
14313
|
}
|
|
14207
14314
|
}
|
|
14208
14315
|
|
|
14209
|
-
|
|
14316
|
+
checkToRestConversion(node, allowPattern) {
|
|
14317
|
+
switch (node.type) {
|
|
14318
|
+
case "TSAsExpression":
|
|
14319
|
+
case "TSTypeAssertion":
|
|
14320
|
+
case "TSNonNullExpression":
|
|
14321
|
+
this.checkToRestConversion(node.expression, false);
|
|
14322
|
+
break;
|
|
14323
|
+
|
|
14324
|
+
default:
|
|
14325
|
+
super.checkToRestConversion(node, allowPattern);
|
|
14326
|
+
}
|
|
14327
|
+
}
|
|
14328
|
+
|
|
14329
|
+
isValidLVal(type, isUnparenthesizedInAssign, binding) {
|
|
14210
14330
|
return getOwn$1({
|
|
14211
14331
|
TSTypeCastExpression: true,
|
|
14212
14332
|
TSParameterProperty: "parameter",
|
|
14213
14333
|
TSNonNullExpression: "expression",
|
|
14214
|
-
TSAsExpression: (binding !== BIND_NONE ||
|
|
14215
|
-
TSTypeAssertion: (binding !== BIND_NONE ||
|
|
14216
|
-
}, type) || super.isValidLVal(type,
|
|
14334
|
+
TSAsExpression: (binding !== BIND_NONE || !isUnparenthesizedInAssign) && ["expression", true],
|
|
14335
|
+
TSTypeAssertion: (binding !== BIND_NONE || !isUnparenthesizedInAssign) && ["expression", true]
|
|
14336
|
+
}, type) || super.isValidLVal(type, isUnparenthesizedInAssign, binding);
|
|
14217
14337
|
}
|
|
14218
14338
|
|
|
14219
14339
|
parseBindingAtom() {
|
|
@@ -14316,28 +14436,13 @@
|
|
|
14316
14436
|
toAssignableList(exprList) {
|
|
14317
14437
|
for (var i = 0; i < exprList.length; i++) {
|
|
14318
14438
|
var expr = exprList[i];
|
|
14319
|
-
if (!expr) continue;
|
|
14320
|
-
|
|
14321
|
-
switch (expr.type) {
|
|
14322
|
-
case "TSTypeCastExpression":
|
|
14323
|
-
exprList[i] = this.typeCastToParameter(expr);
|
|
14324
|
-
break;
|
|
14325
14439
|
|
|
14326
|
-
|
|
14327
|
-
|
|
14328
|
-
if (!this.state.maybeInArrowParameters) {
|
|
14329
|
-
exprList[i] = this.typeCastToParameter(expr);
|
|
14330
|
-
} else {
|
|
14331
|
-
this.raise(TSErrors.UnexpectedTypeCastInParameter, {
|
|
14332
|
-
at: expr
|
|
14333
|
-
});
|
|
14334
|
-
}
|
|
14335
|
-
|
|
14336
|
-
break;
|
|
14440
|
+
if ((expr == null ? void 0 : expr.type) === "TSTypeCastExpression") {
|
|
14441
|
+
exprList[i] = this.typeCastToParameter(expr);
|
|
14337
14442
|
}
|
|
14338
14443
|
}
|
|
14339
14444
|
|
|
14340
|
-
|
|
14445
|
+
super.toAssignableList(...arguments);
|
|
14341
14446
|
}
|
|
14342
14447
|
|
|
14343
14448
|
typeCastToParameter(node) {
|
|
@@ -14407,8 +14512,8 @@
|
|
|
14407
14512
|
this.state.inAbstractClass = !!node.abstract;
|
|
14408
14513
|
|
|
14409
14514
|
try {
|
|
14410
|
-
for (var
|
|
14411
|
-
args[
|
|
14515
|
+
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
14516
|
+
args[_key6 - 1] = arguments[_key6];
|
|
14412
14517
|
}
|
|
14413
14518
|
|
|
14414
14519
|
return super.parseClass(node, ...args);
|
|
@@ -14532,7 +14637,16 @@
|
|
|
14532
14637
|
}
|
|
14533
14638
|
} else if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
14534
14639
|
hasTypeSpecifier = true;
|
|
14535
|
-
|
|
14640
|
+
|
|
14641
|
+
if (isImport) {
|
|
14642
|
+
leftOfAs = this.parseIdentifier(true);
|
|
14643
|
+
|
|
14644
|
+
if (!this.isContextual(93)) {
|
|
14645
|
+
this.checkReservedWord(leftOfAs.name, leftOfAs.loc.start, true, true);
|
|
14646
|
+
}
|
|
14647
|
+
} else {
|
|
14648
|
+
leftOfAs = this.parseModuleExportName();
|
|
14649
|
+
}
|
|
14536
14650
|
}
|
|
14537
14651
|
|
|
14538
14652
|
if (hasTypeSpecifier && isInTypeOnlyImportExport) {
|
|
@@ -14631,8 +14745,8 @@
|
|
|
14631
14745
|
}
|
|
14632
14746
|
|
|
14633
14747
|
isValidLVal(type) {
|
|
14634
|
-
for (var
|
|
14635
|
-
rest[
|
|
14748
|
+
for (var _len7 = arguments.length, rest = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
|
|
14749
|
+
rest[_key7 - 1] = arguments[_key7];
|
|
14636
14750
|
}
|
|
14637
14751
|
|
|
14638
14752
|
return type === "Placeholder" || super.isValidLVal(type, ...rest);
|
|
@@ -14641,10 +14755,9 @@
|
|
|
14641
14755
|
toAssignable(node) {
|
|
14642
14756
|
if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
|
|
14643
14757
|
node.expectedNode = "Pattern";
|
|
14644
|
-
|
|
14758
|
+
} else {
|
|
14759
|
+
super.toAssignable(...arguments);
|
|
14645
14760
|
}
|
|
14646
|
-
|
|
14647
|
-
return super.toAssignable(...arguments);
|
|
14648
14761
|
}
|
|
14649
14762
|
|
|
14650
14763
|
isLet(context) {
|
|
@@ -14956,9 +15069,9 @@
|
|
|
14956
15069
|
throw new Error("Cannot combine importAssertions and moduleAttributes plugins.");
|
|
14957
15070
|
}
|
|
14958
15071
|
|
|
14959
|
-
var
|
|
15072
|
+
var moduleAttributesVersionPluginOption = getPluginOption(plugins, "moduleAttributes", "version");
|
|
14960
15073
|
|
|
14961
|
-
if (
|
|
15074
|
+
if (moduleAttributesVersionPluginOption !== "may-2020") {
|
|
14962
15075
|
throw new Error("The 'moduleAttributes' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is 'may-2020'.");
|
|
14963
15076
|
}
|
|
14964
15077
|
}
|
|
@@ -15032,7 +15145,7 @@
|
|
|
15032
15145
|
|
|
15033
15146
|
if (isLHS) {
|
|
15034
15147
|
if (parenthesized.type === "Identifier") {
|
|
15035
|
-
this.expressionScope.
|
|
15148
|
+
this.expressionScope.recordArrowParemeterBindingError(Errors.InvalidParenthesizedAssignment, {
|
|
15036
15149
|
at: node
|
|
15037
15150
|
});
|
|
15038
15151
|
} else if (parenthesized.type !== "MemberExpression") {
|
|
@@ -15091,11 +15204,7 @@
|
|
|
15091
15204
|
|
|
15092
15205
|
case "SpreadElement":
|
|
15093
15206
|
{
|
|
15094
|
-
this.
|
|
15095
|
-
node.type = "RestElement";
|
|
15096
|
-
var arg = node.argument;
|
|
15097
|
-
this.toAssignable(arg, isLHS);
|
|
15098
|
-
break;
|
|
15207
|
+
throw new Error("Internal @babel/parser error (this is a bug, please report it)." + " SpreadElement should be converted by .toAssignable's caller.");
|
|
15099
15208
|
}
|
|
15100
15209
|
|
|
15101
15210
|
case "ArrayExpression":
|
|
@@ -15119,8 +15228,6 @@
|
|
|
15119
15228
|
this.toAssignable(parenthesized, isLHS);
|
|
15120
15229
|
break;
|
|
15121
15230
|
}
|
|
15122
|
-
|
|
15123
|
-
return node;
|
|
15124
15231
|
}
|
|
15125
15232
|
|
|
15126
15233
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
@@ -15128,58 +15235,50 @@
|
|
|
15128
15235
|
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, {
|
|
15129
15236
|
at: prop.key
|
|
15130
15237
|
});
|
|
15131
|
-
} else if (prop.type === "SpreadElement"
|
|
15132
|
-
|
|
15133
|
-
|
|
15134
|
-
|
|
15238
|
+
} else if (prop.type === "SpreadElement") {
|
|
15239
|
+
prop.type = "RestElement";
|
|
15240
|
+
var arg = prop.argument;
|
|
15241
|
+
this.checkToRestConversion(arg, false);
|
|
15242
|
+
this.toAssignable(arg, isLHS);
|
|
15243
|
+
|
|
15244
|
+
if (!isLast) {
|
|
15245
|
+
this.raise(Errors.RestTrailingComma, {
|
|
15246
|
+
at: prop
|
|
15247
|
+
});
|
|
15248
|
+
}
|
|
15135
15249
|
} else {
|
|
15136
15250
|
this.toAssignable(prop, isLHS);
|
|
15137
15251
|
}
|
|
15138
15252
|
}
|
|
15139
15253
|
|
|
15140
15254
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
15141
|
-
var end = exprList.length;
|
|
15142
|
-
|
|
15143
|
-
if (end) {
|
|
15144
|
-
var last = exprList[end - 1];
|
|
15255
|
+
var end = exprList.length - 1;
|
|
15145
15256
|
|
|
15146
|
-
|
|
15147
|
-
--end;
|
|
15148
|
-
} else if ((last == null ? void 0 : last.type) === "SpreadElement") {
|
|
15149
|
-
last.type = "RestElement";
|
|
15150
|
-
var arg = last.argument;
|
|
15151
|
-
this.toAssignable(arg, isLHS);
|
|
15152
|
-
arg = unwrapParenthesizedExpression(arg);
|
|
15153
|
-
|
|
15154
|
-
if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern" && arg.type !== "ObjectPattern") {
|
|
15155
|
-
this.unexpected(arg.start);
|
|
15156
|
-
}
|
|
15157
|
-
|
|
15158
|
-
if (trailingCommaLoc) {
|
|
15159
|
-
this.raise(Errors.RestTrailingComma, {
|
|
15160
|
-
at: trailingCommaLoc
|
|
15161
|
-
});
|
|
15162
|
-
}
|
|
15163
|
-
|
|
15164
|
-
--end;
|
|
15165
|
-
}
|
|
15166
|
-
}
|
|
15167
|
-
|
|
15168
|
-
for (var i = 0; i < end; i++) {
|
|
15257
|
+
for (var i = 0; i <= end; i++) {
|
|
15169
15258
|
var elt = exprList[i];
|
|
15259
|
+
if (!elt) continue;
|
|
15170
15260
|
|
|
15171
|
-
if (elt) {
|
|
15261
|
+
if (elt.type === "SpreadElement") {
|
|
15262
|
+
elt.type = "RestElement";
|
|
15263
|
+
var arg = elt.argument;
|
|
15264
|
+
this.checkToRestConversion(arg, true);
|
|
15265
|
+
this.toAssignable(arg, isLHS);
|
|
15266
|
+
} else {
|
|
15172
15267
|
this.toAssignable(elt, isLHS);
|
|
15268
|
+
}
|
|
15173
15269
|
|
|
15174
|
-
|
|
15270
|
+
if (elt.type === "RestElement") {
|
|
15271
|
+
if (i < end) {
|
|
15175
15272
|
this.raise(Errors.RestTrailingComma, {
|
|
15176
15273
|
at: elt
|
|
15177
15274
|
});
|
|
15275
|
+
} else if (trailingCommaLoc) {
|
|
15276
|
+
this.raise(Errors.RestTrailingComma, {
|
|
15277
|
+
at: trailingCommaLoc
|
|
15278
|
+
});
|
|
15178
15279
|
}
|
|
15179
15280
|
}
|
|
15180
15281
|
}
|
|
15181
|
-
|
|
15182
|
-
return exprList;
|
|
15183
15282
|
}
|
|
15184
15283
|
|
|
15185
15284
|
isAssignable(node, isBinding) {
|
|
@@ -15369,7 +15468,7 @@
|
|
|
15369
15468
|
return this.finishNode(node, "AssignmentPattern");
|
|
15370
15469
|
}
|
|
15371
15470
|
|
|
15372
|
-
isValidLVal(type,
|
|
15471
|
+
isValidLVal(type, isUnparenthesizedInAssign, binding) {
|
|
15373
15472
|
return getOwn({
|
|
15374
15473
|
AssignmentPattern: "left",
|
|
15375
15474
|
RestElement: "argument",
|
|
@@ -15380,7 +15479,7 @@
|
|
|
15380
15479
|
}, type);
|
|
15381
15480
|
}
|
|
15382
15481
|
|
|
15383
|
-
checkLVal(expression,
|
|
15482
|
+
checkLVal(expression, _ref88) {
|
|
15384
15483
|
var {
|
|
15385
15484
|
in: ancestor,
|
|
15386
15485
|
binding = BIND_NONE,
|
|
@@ -15388,7 +15487,7 @@
|
|
|
15388
15487
|
strictModeChanged = false,
|
|
15389
15488
|
allowingSloppyLetBinding = !(binding & BIND_SCOPE_LEXICAL),
|
|
15390
15489
|
hasParenthesizedAncestor = false
|
|
15391
|
-
} =
|
|
15490
|
+
} = _ref88;
|
|
15392
15491
|
|
|
15393
15492
|
var _expression$extra;
|
|
15394
15493
|
|
|
@@ -15424,7 +15523,7 @@
|
|
|
15424
15523
|
return;
|
|
15425
15524
|
}
|
|
15426
15525
|
|
|
15427
|
-
var validity = this.isValidLVal(expression.type, hasParenthesizedAncestor || (
|
|
15526
|
+
var validity = this.isValidLVal(expression.type, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding);
|
|
15428
15527
|
if (validity === true) return;
|
|
15429
15528
|
|
|
15430
15529
|
if (validity === false) {
|
|
@@ -15491,11 +15590,24 @@
|
|
|
15491
15590
|
this.scope.declareName(identifier.name, binding, identifier.loc.start);
|
|
15492
15591
|
}
|
|
15493
15592
|
|
|
15494
|
-
checkToRestConversion(node) {
|
|
15495
|
-
|
|
15496
|
-
|
|
15497
|
-
|
|
15498
|
-
|
|
15593
|
+
checkToRestConversion(node, allowPattern) {
|
|
15594
|
+
switch (node.type) {
|
|
15595
|
+
case "ParenthesizedExpression":
|
|
15596
|
+
this.checkToRestConversion(node.expression, allowPattern);
|
|
15597
|
+
break;
|
|
15598
|
+
|
|
15599
|
+
case "Identifier":
|
|
15600
|
+
case "MemberExpression":
|
|
15601
|
+
break;
|
|
15602
|
+
|
|
15603
|
+
case "ArrayExpression":
|
|
15604
|
+
case "ObjectExpression":
|
|
15605
|
+
if (allowPattern) break;
|
|
15606
|
+
|
|
15607
|
+
default:
|
|
15608
|
+
this.raise(Errors.InvalidRestAssignmentPattern, {
|
|
15609
|
+
at: node
|
|
15610
|
+
});
|
|
15499
15611
|
}
|
|
15500
15612
|
}
|
|
15501
15613
|
|
|
@@ -15656,7 +15768,8 @@
|
|
|
15656
15768
|
node.operator = operator;
|
|
15657
15769
|
|
|
15658
15770
|
if (this.match(29)) {
|
|
15659
|
-
|
|
15771
|
+
this.toAssignable(left, true);
|
|
15772
|
+
node.left = left;
|
|
15660
15773
|
|
|
15661
15774
|
if (refExpressionErrors.doubleProtoLoc != null && refExpressionErrors.doubleProtoLoc.index >= startPos) {
|
|
15662
15775
|
refExpressionErrors.doubleProtoLoc = null;
|
|
@@ -15956,14 +16069,14 @@
|
|
|
15956
16069
|
if (this.checkExpressionErrors(refExpressionErrors, false)) return expr;
|
|
15957
16070
|
|
|
15958
16071
|
while (tokenIsPostfix(this.state.type) && !this.canInsertSemicolon()) {
|
|
15959
|
-
var
|
|
16072
|
+
var _node10 = this.startNodeAt(startPos, startLoc);
|
|
15960
16073
|
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
16074
|
+
_node10.operator = this.state.value;
|
|
16075
|
+
_node10.prefix = false;
|
|
16076
|
+
_node10.argument = expr;
|
|
15964
16077
|
this.next();
|
|
15965
16078
|
this.checkLVal(expr, {
|
|
15966
|
-
in: expr = this.finishNode(
|
|
16079
|
+
in: expr = this.finishNode(_node10, "UpdateExpression")
|
|
15967
16080
|
});
|
|
15968
16081
|
}
|
|
15969
16082
|
|
|
@@ -16823,6 +16936,20 @@
|
|
|
16823
16936
|
}
|
|
16824
16937
|
|
|
16825
16938
|
parseNew(node) {
|
|
16939
|
+
this.parseNewCallee(node);
|
|
16940
|
+
|
|
16941
|
+
if (this.eat(10)) {
|
|
16942
|
+
var args = this.parseExprList(11);
|
|
16943
|
+
this.toReferencedList(args);
|
|
16944
|
+
node.arguments = args;
|
|
16945
|
+
} else {
|
|
16946
|
+
node.arguments = [];
|
|
16947
|
+
}
|
|
16948
|
+
|
|
16949
|
+
return this.finishNode(node, "NewExpression");
|
|
16950
|
+
}
|
|
16951
|
+
|
|
16952
|
+
parseNewCallee(node) {
|
|
16826
16953
|
node.callee = this.parseNoCallExpr();
|
|
16827
16954
|
|
|
16828
16955
|
if (node.callee.type === "Import") {
|
|
@@ -16838,19 +16965,6 @@
|
|
|
16838
16965
|
at: this.state.startLoc
|
|
16839
16966
|
});
|
|
16840
16967
|
}
|
|
16841
|
-
|
|
16842
|
-
this.parseNewArguments(node);
|
|
16843
|
-
return this.finishNode(node, "NewExpression");
|
|
16844
|
-
}
|
|
16845
|
-
|
|
16846
|
-
parseNewArguments(node) {
|
|
16847
|
-
if (this.eat(10)) {
|
|
16848
|
-
var args = this.parseExprList(11);
|
|
16849
|
-
this.toReferencedList(args);
|
|
16850
|
-
node.arguments = args;
|
|
16851
|
-
} else {
|
|
16852
|
-
node.arguments = [];
|
|
16853
|
-
}
|
|
16854
16968
|
}
|
|
16855
16969
|
|
|
16856
16970
|
parseTemplateElement(isTagged) {
|
|
@@ -17257,7 +17371,8 @@
|
|
|
17257
17371
|
}
|
|
17258
17372
|
|
|
17259
17373
|
setArrowFunctionParameters(node, params, trailingCommaLoc) {
|
|
17260
|
-
|
|
17374
|
+
this.toAssignableList(params, trailingCommaLoc, false);
|
|
17375
|
+
node.params = params;
|
|
17261
17376
|
}
|
|
17262
17377
|
|
|
17263
17378
|
parseFunctionBodyAndFinish(node, type) {
|
|
@@ -18177,7 +18292,7 @@
|
|
|
18177
18292
|
}
|
|
18178
18293
|
|
|
18179
18294
|
parseDecorator() {
|
|
18180
|
-
this.expectOnePlugin(["decorators
|
|
18295
|
+
this.expectOnePlugin(["decorators", "decorators-legacy"]);
|
|
18181
18296
|
var node = this.startNode();
|
|
18182
18297
|
this.next();
|
|
18183
18298
|
|
|
@@ -18198,12 +18313,12 @@
|
|
|
18198
18313
|
expr = this.parseIdentifier(false);
|
|
18199
18314
|
|
|
18200
18315
|
while (this.eat(16)) {
|
|
18201
|
-
var
|
|
18316
|
+
var _node11 = this.startNodeAt(startPos, startLoc);
|
|
18202
18317
|
|
|
18203
|
-
|
|
18204
|
-
|
|
18205
|
-
|
|
18206
|
-
expr = this.finishNode(
|
|
18318
|
+
_node11.object = expr;
|
|
18319
|
+
_node11.property = this.parseIdentifier(true);
|
|
18320
|
+
_node11.computed = false;
|
|
18321
|
+
expr = this.finishNode(_node11, "MemberExpression");
|
|
18207
18322
|
}
|
|
18208
18323
|
}
|
|
18209
18324
|
|
|
@@ -19424,6 +19539,7 @@
|
|
|
19424
19539
|
|
|
19425
19540
|
if (assertions) {
|
|
19426
19541
|
node.assertions = assertions;
|
|
19542
|
+
this.checkJSONModuleImport(node);
|
|
19427
19543
|
}
|
|
19428
19544
|
} else if (expect) {
|
|
19429
19545
|
this.unexpected();
|
|
@@ -19609,6 +19725,50 @@
|
|
|
19609
19725
|
return this.parseIdentifier(true);
|
|
19610
19726
|
}
|
|
19611
19727
|
|
|
19728
|
+
isJSONModuleImport(node) {
|
|
19729
|
+
if (node.assertions != null) {
|
|
19730
|
+
return node.assertions.some(_ref89 => {
|
|
19731
|
+
var {
|
|
19732
|
+
key,
|
|
19733
|
+
value
|
|
19734
|
+
} = _ref89;
|
|
19735
|
+
return value.value === "json" && (key.type === "Identifier" ? key.name === "type" : key.value === "type");
|
|
19736
|
+
});
|
|
19737
|
+
}
|
|
19738
|
+
|
|
19739
|
+
return false;
|
|
19740
|
+
}
|
|
19741
|
+
|
|
19742
|
+
checkJSONModuleImport(node) {
|
|
19743
|
+
if (this.isJSONModuleImport(node) && node.type !== "ExportAllDeclaration") {
|
|
19744
|
+
var {
|
|
19745
|
+
specifiers
|
|
19746
|
+
} = node;
|
|
19747
|
+
|
|
19748
|
+
if (node.specifiers != null) {
|
|
19749
|
+
var nonDefaultNamedSpecifier = specifiers.find(specifier => {
|
|
19750
|
+
var imported;
|
|
19751
|
+
|
|
19752
|
+
if (specifier.type === "ExportSpecifier") {
|
|
19753
|
+
imported = specifier.local;
|
|
19754
|
+
} else if (specifier.type === "ImportSpecifier") {
|
|
19755
|
+
imported = specifier.imported;
|
|
19756
|
+
}
|
|
19757
|
+
|
|
19758
|
+
if (imported !== undefined) {
|
|
19759
|
+
return imported.type === "Identifier" ? imported.name !== "default" : imported.value !== "default";
|
|
19760
|
+
}
|
|
19761
|
+
});
|
|
19762
|
+
|
|
19763
|
+
if (nonDefaultNamedSpecifier !== undefined) {
|
|
19764
|
+
this.raise(Errors.ImportJSONBindingNotDefault, {
|
|
19765
|
+
at: nonDefaultNamedSpecifier.loc.start
|
|
19766
|
+
});
|
|
19767
|
+
}
|
|
19768
|
+
}
|
|
19769
|
+
}
|
|
19770
|
+
}
|
|
19771
|
+
|
|
19612
19772
|
parseImport(node) {
|
|
19613
19773
|
node.specifiers = [];
|
|
19614
19774
|
|
|
@@ -19633,6 +19793,7 @@
|
|
|
19633
19793
|
}
|
|
19634
19794
|
}
|
|
19635
19795
|
|
|
19796
|
+
this.checkJSONModuleImport(node);
|
|
19636
19797
|
this.semicolon();
|
|
19637
19798
|
return this.finishNode(node, "ImportDeclaration");
|
|
19638
19799
|
}
|
|
@@ -20641,7 +20802,7 @@
|
|
|
20641
20802
|
loc: {
|
|
20642
20803
|
start: node.loc.start,
|
|
20643
20804
|
end: {
|
|
20644
|
-
line: node.loc.
|
|
20805
|
+
line: node.loc.start.line,
|
|
20645
20806
|
// Only decorate the "var".
|
|
20646
20807
|
column: node.loc.start.column + 3
|
|
20647
20808
|
}
|
|
@@ -22874,6 +23035,39 @@
|
|
|
22874
23035
|
};
|
|
22875
23036
|
}
|
|
22876
23037
|
|
|
23038
|
+
var INSTALLED_APPS = "INSTALLED_APPS";
|
|
23039
|
+
var has = "has";
|
|
23040
|
+
function scanInstalledAppsInStoryboard(storyboard) {
|
|
23041
|
+
var _storyboard$meta;
|
|
23042
|
+
|
|
23043
|
+
var collection = new Set();
|
|
23044
|
+
var beforeVisitInstalledApps = beforeVisitInstalledAppsFactory(collection);
|
|
23045
|
+
var {
|
|
23046
|
+
customTemplates,
|
|
23047
|
+
functions
|
|
23048
|
+
} = (_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 ? _storyboard$meta : {};
|
|
23049
|
+
visitStoryboardExpressions([storyboard.routes, customTemplates], beforeVisitInstalledApps, INSTALLED_APPS);
|
|
23050
|
+
visitStoryboardFunctions(functions, beforeVisitInstalledApps);
|
|
23051
|
+
return Array.from(collection);
|
|
23052
|
+
}
|
|
23053
|
+
|
|
23054
|
+
function beforeVisitInstalledAppsFactory(collection) {
|
|
23055
|
+
return function beforeVisitPermissions(node, parent) {
|
|
23056
|
+
if (node.name === INSTALLED_APPS) {
|
|
23057
|
+
var memberParent = parent[parent.length - 1];
|
|
23058
|
+
var callParent = parent[parent.length - 2];
|
|
23059
|
+
|
|
23060
|
+
if ((callParent === null || callParent === void 0 ? void 0 : callParent.node.type) === "CallExpression" && (callParent === null || callParent === void 0 ? void 0 : callParent.key) === "callee" && (memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object" && !memberParent.node.computed && memberParent.node.property.type === "Identifier" && memberParent.node.property.name === has) {
|
|
23061
|
+
var args = callParent.node.arguments;
|
|
23062
|
+
|
|
23063
|
+
if (args.length > 0 && args[0].type === "Literal" && typeof args[0].value === "string") {
|
|
23064
|
+
collection.add(args[0].value);
|
|
23065
|
+
}
|
|
23066
|
+
}
|
|
23067
|
+
}
|
|
23068
|
+
};
|
|
23069
|
+
}
|
|
23070
|
+
|
|
22877
23071
|
Object.defineProperty(exports, 'pipes', {
|
|
22878
23072
|
enumerable: true,
|
|
22879
23073
|
get: function () { return pipes.pipes; }
|
|
@@ -22924,6 +23118,7 @@
|
|
|
22924
23118
|
exports.scanCustomApisInStoryboard = scanCustomApisInStoryboard;
|
|
22925
23119
|
exports.scanI18NInAny = scanI18NInAny;
|
|
22926
23120
|
exports.scanI18NInStoryboard = scanI18NInStoryboard;
|
|
23121
|
+
exports.scanInstalledAppsInStoryboard = scanInstalledAppsInStoryboard;
|
|
22927
23122
|
exports.scanPermissionActionsInAny = scanPermissionActionsInAny;
|
|
22928
23123
|
exports.scanPermissionActionsInStoryboard = scanPermissionActionsInStoryboard;
|
|
22929
23124
|
exports.scanProcessorsInAny = scanProcessorsInAny;
|