@tinacms/app 0.0.28 → 1.0.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/appFiles/node_modules/.package-lock.json +10 -10
- package/appFiles/node_modules/@babel/generator/lib/generators/base.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/classes.js +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/classes.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js +9 -15
- package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/methods.js +9 -24
- package/appFiles/node_modules/@babel/generator/lib/generators/methods.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/modules.js +6 -14
- package/appFiles/node_modules/@babel/generator/lib/generators/modules.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/statements.js +1 -16
- package/appFiles/node_modules/@babel/generator/lib/generators/statements.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/printer.js +89 -80
- package/appFiles/node_modules/@babel/generator/lib/printer.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/package.json +3 -3
- package/appFiles/node_modules/@babel/parser/lib/index.js +1 -1
- package/appFiles/node_modules/@babel/parser/lib/index.js.map +1 -1
- package/appFiles/node_modules/@babel/parser/package.json +1 -1
- package/appFiles/node_modules/@babel/parser/typings/babel-parser.d.ts +92 -80
- package/appFiles/node_modules/@babel/parser/typings/babel-parser.source.d.ts +151 -0
- package/appFiles/node_modules/@babel/types/lib/asserts/assertNode.js +0 -3
- package/appFiles/node_modules/@babel/types/lib/asserts/assertNode.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/asserts/generated/index.js +0 -303
- package/appFiles/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js +0 -4
- package/appFiles/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +0 -11
- package/appFiles/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/builders/generated/index.js +0 -253
- package/appFiles/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/builders/generated/uppercase.js +0 -1
- package/appFiles/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/builders/react/buildChildren.js +0 -7
- package/appFiles/node_modules/@babel/types/lib/builders/react/buildChildren.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +0 -5
- package/appFiles/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/builders/validateNode.js +0 -5
- package/appFiles/node_modules/@babel/types/lib/builders/validateNode.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/clone/clone.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/clone/clone.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/clone/cloneDeep.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/clone/cloneDeep.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/clone/cloneNode.js +4 -22
- package/appFiles/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/comments/addComment.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/comments/addComment.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/comments/addComments.js +0 -3
- package/appFiles/node_modules/@babel/types/lib/comments/addComments.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/comments/inheritInnerComments.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/comments/inheritsComments.js +0 -4
- package/appFiles/node_modules/@babel/types/lib/comments/inheritsComments.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/comments/removeComments.js +0 -3
- package/appFiles/node_modules/@babel/types/lib/comments/removeComments.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/constants/generated/index.js +0 -1
- package/appFiles/node_modules/@babel/types/lib/constants/generated/index.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/constants/index.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/converters/ensureBlock.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/converters/ensureBlock.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +2 -12
- package/appFiles/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/converters/toBlock.js +0 -7
- package/appFiles/node_modules/@babel/types/lib/converters/toBlock.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/converters/toComputedKey.js +2 -4
- package/appFiles/node_modules/@babel/types/lib/converters/toComputedKey.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/converters/toExpression.js +0 -4
- package/appFiles/node_modules/@babel/types/lib/converters/toExpression.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/converters/toIdentifier.js +2 -6
- package/appFiles/node_modules/@babel/types/lib/converters/toIdentifier.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/converters/toKeyAlias.js +0 -7
- package/appFiles/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/converters/toSequenceExpression.js +0 -3
- package/appFiles/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/converters/toStatement.js +1 -7
- package/appFiles/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/converters/valueToNode.js +2 -18
- package/appFiles/node_modules/@babel/types/lib/converters/valueToNode.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/definitions/core.js +33 -61
- package/appFiles/node_modules/@babel/types/lib/definitions/core.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/definitions/experimental.js +3 -1
- package/appFiles/node_modules/@babel/types/lib/definitions/experimental.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/definitions/flow.js +1 -3
- package/appFiles/node_modules/@babel/types/lib/definitions/flow.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/definitions/index.js +0 -18
- package/appFiles/node_modules/@babel/types/lib/definitions/index.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/definitions/jsx.js +0 -1
- package/appFiles/node_modules/@babel/types/lib/definitions/jsx.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/definitions/misc.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/definitions/misc.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/definitions/placeholders.js +0 -5
- package/appFiles/node_modules/@babel/types/lib/definitions/placeholders.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/definitions/typescript.js +4 -15
- package/appFiles/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/definitions/utils.js +1 -65
- package/appFiles/node_modules/@babel/types/lib/definitions/utils.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/index.d.ts +0 -1
- package/appFiles/node_modules/@babel/types/lib/index.js +1 -75
- package/appFiles/node_modules/@babel/types/lib/index.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +3 -12
- package/appFiles/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/modifications/inherits.js +0 -4
- package/appFiles/node_modules/@babel/types/lib/modifications/inherits.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +0 -4
- package/appFiles/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/modifications/removeProperties.js +3 -8
- package/appFiles/node_modules/@babel/types/lib/modifications/removeProperties.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +0 -3
- package/appFiles/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +1 -10
- package/appFiles/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +4 -14
- package/appFiles/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +0 -3
- package/appFiles/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/traverse/traverse.js +0 -7
- package/appFiles/node_modules/@babel/types/lib/traverse/traverse.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/traverse/traverseFast.js +2 -5
- package/appFiles/node_modules/@babel/types/lib/traverse/traverseFast.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/utils/inherit.js +0 -1
- package/appFiles/node_modules/@babel/types/lib/utils/inherit.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +1 -8
- package/appFiles/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/utils/shallowEqual.js +2 -4
- package/appFiles/node_modules/@babel/types/lib/utils/shallowEqual.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/generated/index.js +0 -906
- package/appFiles/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/is.js +0 -8
- package/appFiles/node_modules/@babel/types/lib/validators/is.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isBinding.js +4 -8
- package/appFiles/node_modules/@babel/types/lib/validators/isBinding.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isBlockScoped.js +0 -3
- package/appFiles/node_modules/@babel/types/lib/validators/isBlockScoped.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isImmutable.js +0 -5
- package/appFiles/node_modules/@babel/types/lib/validators/isImmutable.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isLet.js +2 -4
- package/appFiles/node_modules/@babel/types/lib/validators/isLet.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isNode.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/validators/isNode.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +2 -16
- package/appFiles/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isPlaceholderType.js +0 -4
- package/appFiles/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isReferenced.js +0 -13
- package/appFiles/node_modules/@babel/types/lib/validators/isReferenced.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isScope.js +0 -3
- package/appFiles/node_modules/@babel/types/lib/validators/isScope.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +2 -3
- package/appFiles/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isType.js +1 -5
- package/appFiles/node_modules/@babel/types/lib/validators/isType.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isValidIdentifier.js +0 -4
- package/appFiles/node_modules/@babel/types/lib/validators/isValidIdentifier.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/isVar.js +2 -4
- package/appFiles/node_modules/@babel/types/lib/validators/isVar.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/matchesPattern.js +0 -8
- package/appFiles/node_modules/@babel/types/lib/validators/matchesPattern.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/react/isCompatTag.js +0 -1
- package/appFiles/node_modules/@babel/types/lib/validators/react/isCompatTag.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/react/isReactComponent.js +0 -2
- package/appFiles/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map +1 -1
- package/appFiles/node_modules/@babel/types/lib/validators/validate.js +0 -4
- package/appFiles/node_modules/@babel/types/lib/validators/validate.js.map +1 -1
- package/appFiles/node_modules/@babel/types/package.json +3 -3
- package/package.json +4 -4
- package/appFiles/node_modules/@babel/types/lib/index.d.ts.map +0 -1
package/appFiles/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = removeTypeDuplicates;
|
|
7
|
-
|
|
8
7
|
var _generated = require("../../validators/generated");
|
|
9
|
-
|
|
10
8
|
function getQualifiedName(node) {
|
|
11
9
|
return (0, _generated.isIdentifier)(node) ? node.name : `${node.right.name}.${getQualifiedName(node.left)}`;
|
|
12
10
|
}
|
|
@@ -14,9 +12,9 @@ function getQualifiedName(node) {
|
|
|
14
12
|
function removeTypeDuplicates(nodes) {
|
|
15
13
|
const generics = new Map();
|
|
16
14
|
const bases = new Map();
|
|
15
|
+
|
|
17
16
|
const typeGroups = new Set();
|
|
18
17
|
const types = [];
|
|
19
|
-
|
|
20
18
|
for (let i = 0; i < nodes.length; i++) {
|
|
21
19
|
const node = nodes[i];
|
|
22
20
|
if (!node) continue;
|
|
@@ -33,22 +31,18 @@ function removeTypeDuplicates(nodes) {
|
|
|
33
31
|
bases.set(node.type, node);
|
|
34
32
|
continue;
|
|
35
33
|
}
|
|
36
|
-
|
|
37
34
|
if ((0, _generated.isTSUnionType)(node)) {
|
|
38
35
|
if (!typeGroups.has(node.types)) {
|
|
39
36
|
nodes.push(...node.types);
|
|
40
37
|
typeGroups.add(node.types);
|
|
41
38
|
}
|
|
42
|
-
|
|
43
39
|
continue;
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
if ((0, _generated.isTSTypeReference)(node) && node.typeParameters) {
|
|
47
43
|
const name = getQualifiedName(node.typeName);
|
|
48
|
-
|
|
49
44
|
if (generics.has(name)) {
|
|
50
45
|
let existing = generics.get(name);
|
|
51
|
-
|
|
52
46
|
if (existing.typeParameters) {
|
|
53
47
|
if (node.typeParameters) {
|
|
54
48
|
existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params));
|
|
@@ -59,10 +53,8 @@ function removeTypeDuplicates(nodes) {
|
|
|
59
53
|
} else {
|
|
60
54
|
generics.set(name, node);
|
|
61
55
|
}
|
|
62
|
-
|
|
63
56
|
continue;
|
|
64
57
|
}
|
|
65
|
-
|
|
66
58
|
types.push(node);
|
|
67
59
|
}
|
|
68
60
|
|
|
@@ -73,7 +65,6 @@ function removeTypeDuplicates(nodes) {
|
|
|
73
65
|
for (const [, genericName] of generics) {
|
|
74
66
|
types.push(genericName);
|
|
75
67
|
}
|
|
76
|
-
|
|
77
68
|
return types;
|
|
78
69
|
}
|
|
79
70
|
|
package/appFiles/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getQualifiedName","node","isIdentifier","name","right","left","removeTypeDuplicates","nodes","generics","Map","bases","typeGroups","Set","types","i","length","indexOf","isTSAnyKeyword","isTSBaseType","set","type","isTSUnionType","has","push","add","isTSTypeReference","typeParameters","typeName","existing","get","params","concat","baseType","genericName"],"sources":["../../../src/modifications/typescript/removeTypeDuplicates.ts"],"sourcesContent":["import {\n isIdentifier,\n isTSAnyKeyword,\n isTSTypeReference,\n isTSUnionType,\n isTSBaseType,\n} from \"../../validators/generated\";\nimport type * as t from \"../..\";\n\nfunction getQualifiedName(node: t.TSTypeReference[\"typeName\"]): string {\n return isIdentifier(node)\n ? node.name\n : `${node.right.name}.${getQualifiedName(node.left)}`;\n}\n\n/**\n * Dedupe type annotations.\n */\nexport default function removeTypeDuplicates(\n nodes: Array<t.TSType>,\n): Array<t.TSType> {\n const generics = new Map<string, t.TSTypeReference>();\n const bases = new Map<t.TSBaseType[\"type\"], t.TSBaseType>();\n\n // store union type groups to circular references\n const typeGroups = new Set<t.TSType[]>();\n\n const types: t.TSType[] = [];\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (!node) continue;\n\n // detect duplicates\n if (types.indexOf(node) >= 0) {\n continue;\n }\n\n // this type matches anything\n if (isTSAnyKeyword(node)) {\n return [node];\n }\n\n // Analogue of FlowBaseAnnotation\n if (isTSBaseType(node)) {\n bases.set(node.type, node);\n continue;\n }\n\n if (isTSUnionType(node)) {\n if (!typeGroups.has(node.types)) {\n nodes.push(...node.types);\n typeGroups.add(node.types);\n }\n continue;\n }\n\n // todo: support merging tuples: number[]\n if (isTSTypeReference(node) && node.typeParameters) {\n const name = getQualifiedName(node.typeName);\n\n if (generics.has(name)) {\n let existing: t.TypeScript = generics.get(name);\n if (existing.typeParameters) {\n if (node.typeParameters) {\n existing.typeParameters.params = removeTypeDuplicates(\n existing.typeParameters.params.concat(node.typeParameters.params),\n );\n }\n } else {\n existing = node.typeParameters;\n }\n } else {\n generics.set(name, node);\n }\n\n continue;\n }\n\n types.push(node);\n }\n\n // add back in bases\n for (const [, baseType] of bases) {\n types.push(baseType);\n }\n\n // add back in generics\n for (const [, genericName] of generics) {\n types.push(genericName);\n }\n\n return types;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["getQualifiedName","node","isIdentifier","name","right","left","removeTypeDuplicates","nodes","generics","Map","bases","typeGroups","Set","types","i","length","indexOf","isTSAnyKeyword","isTSBaseType","set","type","isTSUnionType","has","push","add","isTSTypeReference","typeParameters","typeName","existing","get","params","concat","baseType","genericName"],"sources":["../../../src/modifications/typescript/removeTypeDuplicates.ts"],"sourcesContent":["import {\n isIdentifier,\n isTSAnyKeyword,\n isTSTypeReference,\n isTSUnionType,\n isTSBaseType,\n} from \"../../validators/generated\";\nimport type * as t from \"../..\";\n\nfunction getQualifiedName(node: t.TSTypeReference[\"typeName\"]): string {\n return isIdentifier(node)\n ? node.name\n : `${node.right.name}.${getQualifiedName(node.left)}`;\n}\n\n/**\n * Dedupe type annotations.\n */\nexport default function removeTypeDuplicates(\n nodes: Array<t.TSType>,\n): Array<t.TSType> {\n const generics = new Map<string, t.TSTypeReference>();\n const bases = new Map<t.TSBaseType[\"type\"], t.TSBaseType>();\n\n // store union type groups to circular references\n const typeGroups = new Set<t.TSType[]>();\n\n const types: t.TSType[] = [];\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (!node) continue;\n\n // detect duplicates\n if (types.indexOf(node) >= 0) {\n continue;\n }\n\n // this type matches anything\n if (isTSAnyKeyword(node)) {\n return [node];\n }\n\n // Analogue of FlowBaseAnnotation\n if (isTSBaseType(node)) {\n bases.set(node.type, node);\n continue;\n }\n\n if (isTSUnionType(node)) {\n if (!typeGroups.has(node.types)) {\n nodes.push(...node.types);\n typeGroups.add(node.types);\n }\n continue;\n }\n\n // todo: support merging tuples: number[]\n if (isTSTypeReference(node) && node.typeParameters) {\n const name = getQualifiedName(node.typeName);\n\n if (generics.has(name)) {\n let existing: t.TypeScript = generics.get(name);\n if (existing.typeParameters) {\n if (node.typeParameters) {\n existing.typeParameters.params = removeTypeDuplicates(\n existing.typeParameters.params.concat(node.typeParameters.params),\n );\n }\n } else {\n existing = node.typeParameters;\n }\n } else {\n generics.set(name, node);\n }\n\n continue;\n }\n\n types.push(node);\n }\n\n // add back in bases\n for (const [, baseType] of bases) {\n types.push(baseType);\n }\n\n // add back in generics\n for (const [, genericName] of generics) {\n types.push(genericName);\n }\n\n return types;\n}\n"],"mappings":";;;;;;AAAA;AASA,SAASA,gBAAgB,CAACC,IAAmC,EAAU;EACrE,OAAO,IAAAC,uBAAY,EAACD,IAAI,CAAC,GACrBA,IAAI,CAACE,IAAI,GACR,GAAEF,IAAI,CAACG,KAAK,CAACD,IAAK,IAAGH,gBAAgB,CAACC,IAAI,CAACI,IAAI,CAAE,EAAC;AACzD;;AAKe,SAASC,oBAAoB,CAC1CC,KAAsB,EACL;EACjB,MAAMC,QAAQ,GAAG,IAAIC,GAAG,EAA6B;EACrD,MAAMC,KAAK,GAAG,IAAID,GAAG,EAAsC;;EAG3D,MAAME,UAAU,GAAG,IAAIC,GAAG,EAAc;EAExC,MAAMC,KAAiB,GAAG,EAAE;EAE5B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGP,KAAK,CAACQ,MAAM,EAAED,CAAC,EAAE,EAAE;IACrC,MAAMb,IAAI,GAAGM,KAAK,CAACO,CAAC,CAAC;IACrB,IAAI,CAACb,IAAI,EAAE;;IAGX,IAAIY,KAAK,CAACG,OAAO,CAACf,IAAI,CAAC,IAAI,CAAC,EAAE;MAC5B;IACF;;IAGA,IAAI,IAAAgB,yBAAc,EAAChB,IAAI,CAAC,EAAE;MACxB,OAAO,CAACA,IAAI,CAAC;IACf;;IAGA,IAAI,IAAAiB,uBAAY,EAACjB,IAAI,CAAC,EAAE;MACtBS,KAAK,CAACS,GAAG,CAAClB,IAAI,CAACmB,IAAI,EAAEnB,IAAI,CAAC;MAC1B;IACF;IAEA,IAAI,IAAAoB,wBAAa,EAACpB,IAAI,CAAC,EAAE;MACvB,IAAI,CAACU,UAAU,CAACW,GAAG,CAACrB,IAAI,CAACY,KAAK,CAAC,EAAE;QAC/BN,KAAK,CAACgB,IAAI,CAAC,GAAGtB,IAAI,CAACY,KAAK,CAAC;QACzBF,UAAU,CAACa,GAAG,CAACvB,IAAI,CAACY,KAAK,CAAC;MAC5B;MACA;IACF;;IAGA,IAAI,IAAAY,4BAAiB,EAACxB,IAAI,CAAC,IAAIA,IAAI,CAACyB,cAAc,EAAE;MAClD,MAAMvB,IAAI,GAAGH,gBAAgB,CAACC,IAAI,CAAC0B,QAAQ,CAAC;MAE5C,IAAInB,QAAQ,CAACc,GAAG,CAACnB,IAAI,CAAC,EAAE;QACtB,IAAIyB,QAAsB,GAAGpB,QAAQ,CAACqB,GAAG,CAAC1B,IAAI,CAAC;QAC/C,IAAIyB,QAAQ,CAACF,cAAc,EAAE;UAC3B,IAAIzB,IAAI,CAACyB,cAAc,EAAE;YACvBE,QAAQ,CAACF,cAAc,CAACI,MAAM,GAAGxB,oBAAoB,CACnDsB,QAAQ,CAACF,cAAc,CAACI,MAAM,CAACC,MAAM,CAAC9B,IAAI,CAACyB,cAAc,CAACI,MAAM,CAAC,CAClE;UACH;QACF,CAAC,MAAM;UACLF,QAAQ,GAAG3B,IAAI,CAACyB,cAAc;QAChC;MACF,CAAC,MAAM;QACLlB,QAAQ,CAACW,GAAG,CAAChB,IAAI,EAAEF,IAAI,CAAC;MAC1B;MAEA;IACF;IAEAY,KAAK,CAACU,IAAI,CAACtB,IAAI,CAAC;EAClB;;EAGA,KAAK,MAAM,GAAG+B,QAAQ,CAAC,IAAItB,KAAK,EAAE;IAChCG,KAAK,CAACU,IAAI,CAACS,QAAQ,CAAC;EACtB;;EAGA,KAAK,MAAM,GAAGC,WAAW,CAAC,IAAIzB,QAAQ,EAAE;IACtCK,KAAK,CAACU,IAAI,CAACU,WAAW,CAAC;EACzB;EAEA,OAAOpB,KAAK;AACd"}
|
|
@@ -4,54 +4,44 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = getBindingIdentifiers;
|
|
7
|
-
|
|
8
7
|
var _generated = require("../validators/generated");
|
|
9
|
-
|
|
10
8
|
function getBindingIdentifiers(node, duplicates, outerOnly) {
|
|
11
9
|
const search = [].concat(node);
|
|
12
10
|
const ids = Object.create(null);
|
|
13
|
-
|
|
14
11
|
while (search.length) {
|
|
15
12
|
const id = search.shift();
|
|
16
13
|
if (!id) continue;
|
|
17
|
-
const keys =
|
|
18
|
-
|
|
14
|
+
const keys =
|
|
15
|
+
getBindingIdentifiers.keys[id.type];
|
|
19
16
|
if ((0, _generated.isIdentifier)(id)) {
|
|
20
17
|
if (duplicates) {
|
|
21
18
|
const _ids = ids[id.name] = ids[id.name] || [];
|
|
22
|
-
|
|
23
19
|
_ids.push(id);
|
|
24
20
|
} else {
|
|
25
21
|
ids[id.name] = id;
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
continue;
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
if ((0, _generated.isExportDeclaration)(id) && !(0, _generated.isExportAllDeclaration)(id)) {
|
|
32
26
|
if ((0, _generated.isDeclaration)(id.declaration)) {
|
|
33
27
|
search.push(id.declaration);
|
|
34
28
|
}
|
|
35
|
-
|
|
36
29
|
continue;
|
|
37
30
|
}
|
|
38
|
-
|
|
39
31
|
if (outerOnly) {
|
|
40
32
|
if ((0, _generated.isFunctionDeclaration)(id)) {
|
|
41
33
|
search.push(id.id);
|
|
42
34
|
continue;
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
if ((0, _generated.isFunctionExpression)(id)) {
|
|
46
37
|
continue;
|
|
47
38
|
}
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
if (keys) {
|
|
51
41
|
for (let i = 0; i < keys.length; i++) {
|
|
52
42
|
const key = keys[i];
|
|
53
|
-
const nodes =
|
|
54
|
-
|
|
43
|
+
const nodes =
|
|
44
|
+
id[key];
|
|
55
45
|
if (nodes) {
|
|
56
46
|
Array.isArray(nodes) ? search.push(...nodes) : search.push(nodes);
|
|
57
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getBindingIdentifiers","node","duplicates","outerOnly","search","concat","ids","Object","create","length","id","shift","keys","type","isIdentifier","_ids","name","push","isExportDeclaration","isExportAllDeclaration","isDeclaration","declaration","isFunctionDeclaration","isFunctionExpression","i","key","nodes","Array","isArray","DeclareClass","DeclareFunction","DeclareModule","DeclareVariable","DeclareInterface","DeclareTypeAlias","DeclareOpaqueType","InterfaceDeclaration","TypeAlias","OpaqueType","CatchClause","LabeledStatement","UnaryExpression","AssignmentExpression","ImportSpecifier","ImportNamespaceSpecifier","ImportDefaultSpecifier","ImportDeclaration","ExportSpecifier","ExportNamespaceSpecifier","ExportDefaultSpecifier","FunctionDeclaration","FunctionExpression","ArrowFunctionExpression","ObjectMethod","ClassMethod","ClassPrivateMethod","ForInStatement","ForOfStatement","ClassDeclaration","ClassExpression","RestElement","UpdateExpression","ObjectProperty","AssignmentPattern","ArrayPattern","ObjectPattern","VariableDeclaration","VariableDeclarator"],"sources":["../../src/retrievers/getBindingIdentifiers.ts"],"sourcesContent":["import {\n isExportDeclaration,\n isIdentifier,\n isDeclaration,\n isFunctionDeclaration,\n isFunctionExpression,\n isExportAllDeclaration,\n} from \"../validators/generated\";\nimport type * as t from \"..\";\n\nexport { getBindingIdentifiers as default };\n\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates: true,\n outerOnly?: boolean,\n): Record<string, Array<t.Identifier>>;\n\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates?: false,\n outerOnly?: boolean,\n): Record<string, t.Identifier>;\n\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates?: boolean,\n outerOnly?: boolean,\n): Record<string, t.Identifier> | Record<string, Array<t.Identifier>>;\n\n/**\n * Return a list of binding identifiers associated with the input `node`.\n */\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates?: boolean,\n outerOnly?: boolean,\n): Record<string, t.Identifier> | Record<string, Array<t.Identifier>> {\n const search: t.Node[] = [].concat(node);\n const ids = Object.create(null);\n\n while (search.length) {\n const id = search.shift();\n if (!id) continue;\n\n const keys =\n // @ts-expect-error getBindingIdentifiers.keys do not cover all AST types\n getBindingIdentifiers.keys[id.type];\n\n if (isIdentifier(id)) {\n if (duplicates) {\n const _ids = (ids[id.name] = ids[id.name] || []);\n _ids.push(id);\n } else {\n ids[id.name] = id;\n }\n continue;\n }\n\n if (isExportDeclaration(id) && !isExportAllDeclaration(id)) {\n if (isDeclaration(id.declaration)) {\n search.push(id.declaration);\n }\n continue;\n }\n\n if (outerOnly) {\n if (isFunctionDeclaration(id)) {\n search.push(id.id);\n continue;\n }\n\n if (isFunctionExpression(id)) {\n continue;\n }\n }\n\n if (keys) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const nodes =\n // @ts-expect-error key must present in id\n id[key] as t.Node[] | t.Node | undefined | null;\n if (nodes) {\n Array.isArray(nodes) ? search.push(...nodes) : search.push(nodes);\n }\n }\n }\n }\n\n // $FlowIssue Object.create() seems broken\n return ids;\n}\n\n/**\n * Mapping of types to their identifier keys.\n */\ngetBindingIdentifiers.keys = {\n DeclareClass: [\"id\"],\n DeclareFunction: [\"id\"],\n DeclareModule: [\"id\"],\n DeclareVariable: [\"id\"],\n DeclareInterface: [\"id\"],\n DeclareTypeAlias: [\"id\"],\n DeclareOpaqueType: [\"id\"],\n InterfaceDeclaration: [\"id\"],\n TypeAlias: [\"id\"],\n OpaqueType: [\"id\"],\n\n CatchClause: [\"param\"],\n LabeledStatement: [\"label\"],\n UnaryExpression: [\"argument\"],\n AssignmentExpression: [\"left\"],\n\n ImportSpecifier: [\"local\"],\n ImportNamespaceSpecifier: [\"local\"],\n ImportDefaultSpecifier: [\"local\"],\n ImportDeclaration: [\"specifiers\"],\n\n ExportSpecifier: [\"exported\"],\n ExportNamespaceSpecifier: [\"exported\"],\n ExportDefaultSpecifier: [\"exported\"],\n\n FunctionDeclaration: [\"id\", \"params\"],\n FunctionExpression: [\"id\", \"params\"],\n ArrowFunctionExpression: [\"params\"],\n ObjectMethod: [\"params\"],\n ClassMethod: [\"params\"],\n ClassPrivateMethod: [\"params\"],\n\n ForInStatement: [\"left\"],\n ForOfStatement: [\"left\"],\n\n ClassDeclaration: [\"id\"],\n ClassExpression: [\"id\"],\n\n RestElement: [\"argument\"],\n UpdateExpression: [\"argument\"],\n\n ObjectProperty: [\"value\"],\n\n AssignmentPattern: [\"left\"],\n ArrayPattern: [\"elements\"],\n ObjectPattern: [\"properties\"],\n\n VariableDeclaration: [\"declarations\"],\n VariableDeclarator: [\"id\"],\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["getBindingIdentifiers","node","duplicates","outerOnly","search","concat","ids","Object","create","length","id","shift","keys","type","isIdentifier","_ids","name","push","isExportDeclaration","isExportAllDeclaration","isDeclaration","declaration","isFunctionDeclaration","isFunctionExpression","i","key","nodes","Array","isArray","DeclareClass","DeclareFunction","DeclareModule","DeclareVariable","DeclareInterface","DeclareTypeAlias","DeclareOpaqueType","InterfaceDeclaration","TypeAlias","OpaqueType","CatchClause","LabeledStatement","UnaryExpression","AssignmentExpression","ImportSpecifier","ImportNamespaceSpecifier","ImportDefaultSpecifier","ImportDeclaration","ExportSpecifier","ExportNamespaceSpecifier","ExportDefaultSpecifier","FunctionDeclaration","FunctionExpression","ArrowFunctionExpression","ObjectMethod","ClassMethod","ClassPrivateMethod","ForInStatement","ForOfStatement","ClassDeclaration","ClassExpression","RestElement","UpdateExpression","ObjectProperty","AssignmentPattern","ArrayPattern","ObjectPattern","VariableDeclaration","VariableDeclarator"],"sources":["../../src/retrievers/getBindingIdentifiers.ts"],"sourcesContent":["import {\n isExportDeclaration,\n isIdentifier,\n isDeclaration,\n isFunctionDeclaration,\n isFunctionExpression,\n isExportAllDeclaration,\n} from \"../validators/generated\";\nimport type * as t from \"..\";\n\nexport { getBindingIdentifiers as default };\n\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates: true,\n outerOnly?: boolean,\n): Record<string, Array<t.Identifier>>;\n\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates?: false,\n outerOnly?: boolean,\n): Record<string, t.Identifier>;\n\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates?: boolean,\n outerOnly?: boolean,\n): Record<string, t.Identifier> | Record<string, Array<t.Identifier>>;\n\n/**\n * Return a list of binding identifiers associated with the input `node`.\n */\nfunction getBindingIdentifiers(\n node: t.Node,\n duplicates?: boolean,\n outerOnly?: boolean,\n): Record<string, t.Identifier> | Record<string, Array<t.Identifier>> {\n const search: t.Node[] = [].concat(node);\n const ids = Object.create(null);\n\n while (search.length) {\n const id = search.shift();\n if (!id) continue;\n\n const keys =\n // @ts-expect-error getBindingIdentifiers.keys do not cover all AST types\n getBindingIdentifiers.keys[id.type];\n\n if (isIdentifier(id)) {\n if (duplicates) {\n const _ids = (ids[id.name] = ids[id.name] || []);\n _ids.push(id);\n } else {\n ids[id.name] = id;\n }\n continue;\n }\n\n if (isExportDeclaration(id) && !isExportAllDeclaration(id)) {\n if (isDeclaration(id.declaration)) {\n search.push(id.declaration);\n }\n continue;\n }\n\n if (outerOnly) {\n if (isFunctionDeclaration(id)) {\n search.push(id.id);\n continue;\n }\n\n if (isFunctionExpression(id)) {\n continue;\n }\n }\n\n if (keys) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const nodes =\n // @ts-expect-error key must present in id\n id[key] as t.Node[] | t.Node | undefined | null;\n if (nodes) {\n Array.isArray(nodes) ? search.push(...nodes) : search.push(nodes);\n }\n }\n }\n }\n\n // $FlowIssue Object.create() seems broken\n return ids;\n}\n\n/**\n * Mapping of types to their identifier keys.\n */\ngetBindingIdentifiers.keys = {\n DeclareClass: [\"id\"],\n DeclareFunction: [\"id\"],\n DeclareModule: [\"id\"],\n DeclareVariable: [\"id\"],\n DeclareInterface: [\"id\"],\n DeclareTypeAlias: [\"id\"],\n DeclareOpaqueType: [\"id\"],\n InterfaceDeclaration: [\"id\"],\n TypeAlias: [\"id\"],\n OpaqueType: [\"id\"],\n\n CatchClause: [\"param\"],\n LabeledStatement: [\"label\"],\n UnaryExpression: [\"argument\"],\n AssignmentExpression: [\"left\"],\n\n ImportSpecifier: [\"local\"],\n ImportNamespaceSpecifier: [\"local\"],\n ImportDefaultSpecifier: [\"local\"],\n ImportDeclaration: [\"specifiers\"],\n\n ExportSpecifier: [\"exported\"],\n ExportNamespaceSpecifier: [\"exported\"],\n ExportDefaultSpecifier: [\"exported\"],\n\n FunctionDeclaration: [\"id\", \"params\"],\n FunctionExpression: [\"id\", \"params\"],\n ArrowFunctionExpression: [\"params\"],\n ObjectMethod: [\"params\"],\n ClassMethod: [\"params\"],\n ClassPrivateMethod: [\"params\"],\n\n ForInStatement: [\"left\"],\n ForOfStatement: [\"left\"],\n\n ClassDeclaration: [\"id\"],\n ClassExpression: [\"id\"],\n\n RestElement: [\"argument\"],\n UpdateExpression: [\"argument\"],\n\n ObjectProperty: [\"value\"],\n\n AssignmentPattern: [\"left\"],\n ArrayPattern: [\"elements\"],\n ObjectPattern: [\"properties\"],\n\n VariableDeclaration: [\"declarations\"],\n VariableDeclarator: [\"id\"],\n};\n"],"mappings":"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"}
|
|
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _getBindingIdentifiers = require("./getBindingIdentifiers");
|
|
9
|
-
|
|
10
8
|
var _default = getOuterBindingIdentifiers;
|
|
11
9
|
exports.default = _default;
|
|
12
|
-
|
|
13
10
|
function getOuterBindingIdentifiers(node, duplicates) {
|
|
14
11
|
return (0, _getBindingIdentifiers.default)(node, duplicates, true);
|
|
15
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getOuterBindingIdentifiers","node","duplicates","getBindingIdentifiers"],"sources":["../../src/retrievers/getOuterBindingIdentifiers.ts"],"sourcesContent":["import getBindingIdentifiers from \"./getBindingIdentifiers\";\nimport type * as t from \"..\";\n\nexport default getOuterBindingIdentifiers as {\n (node: t.Node, duplicates: true): Record<string, Array<t.Identifier>>;\n (node: t.Node, duplicates?: false): Record<string, t.Identifier>;\n (node: t.Node, duplicates?: boolean):\n | Record<string, t.Identifier>\n | Record<string, Array<t.Identifier>>;\n};\n\nfunction getOuterBindingIdentifiers(\n node: t.Node,\n duplicates: boolean,\n): Record<string, t.Identifier> | Record<string, Array<t.Identifier>> {\n return getBindingIdentifiers(node, duplicates, true);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["getOuterBindingIdentifiers","node","duplicates","getBindingIdentifiers"],"sources":["../../src/retrievers/getOuterBindingIdentifiers.ts"],"sourcesContent":["import getBindingIdentifiers from \"./getBindingIdentifiers\";\nimport type * as t from \"..\";\n\nexport default getOuterBindingIdentifiers as {\n (node: t.Node, duplicates: true): Record<string, Array<t.Identifier>>;\n (node: t.Node, duplicates?: false): Record<string, t.Identifier>;\n (node: t.Node, duplicates?: boolean):\n | Record<string, t.Identifier>\n | Record<string, Array<t.Identifier>>;\n};\n\nfunction getOuterBindingIdentifiers(\n node: t.Node,\n duplicates: boolean,\n): Record<string, t.Identifier> | Record<string, Array<t.Identifier>> {\n return getBindingIdentifiers(node, duplicates, true);\n}\n"],"mappings":";;;;;;AAAA;AAA4D,eAG7CA,0BAA0B;AAAA;AAQzC,SAASA,0BAA0B,CACjCC,IAAY,EACZC,UAAmB,EACiD;EACpE,OAAO,IAAAC,8BAAqB,EAACF,IAAI,EAAEC,UAAU,EAAE,IAAI,CAAC;AACtD"}
|
|
@@ -4,31 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = traverse;
|
|
7
|
-
|
|
8
7
|
var _definitions = require("../definitions");
|
|
9
|
-
|
|
10
8
|
function traverse(node, handlers, state) {
|
|
11
9
|
if (typeof handlers === "function") {
|
|
12
10
|
handlers = {
|
|
13
11
|
enter: handlers
|
|
14
12
|
};
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
const {
|
|
18
15
|
enter,
|
|
19
16
|
exit
|
|
20
17
|
} = handlers;
|
|
21
18
|
traverseSimpleImpl(node, enter, exit, state, []);
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
function traverseSimpleImpl(node, enter, exit, state, ancestors) {
|
|
25
21
|
const keys = _definitions.VISITOR_KEYS[node.type];
|
|
26
22
|
if (!keys) return;
|
|
27
23
|
if (enter) enter(node, ancestors, state);
|
|
28
|
-
|
|
29
24
|
for (const key of keys) {
|
|
30
25
|
const subNode = node[key];
|
|
31
|
-
|
|
32
26
|
if (Array.isArray(subNode)) {
|
|
33
27
|
for (let i = 0; i < subNode.length; i++) {
|
|
34
28
|
const child = subNode[i];
|
|
@@ -50,7 +44,6 @@ function traverseSimpleImpl(node, enter, exit, state, ancestors) {
|
|
|
50
44
|
ancestors.pop();
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
|
-
|
|
54
47
|
if (exit) exit(node, ancestors, state);
|
|
55
48
|
}
|
|
56
49
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["traverse","node","handlers","state","enter","exit","traverseSimpleImpl","ancestors","keys","VISITOR_KEYS","type","key","subNode","Array","isArray","i","length","child","push","index","pop"],"sources":["../../src/traverse/traverse.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\nexport type TraversalAncestors = Array<{\n node: t.Node;\n key: string;\n index?: number;\n}>;\n\nexport type TraversalHandler<T> = (\n this: undefined,\n node: t.Node,\n parent: TraversalAncestors,\n state: T,\n) => void;\n\nexport type TraversalHandlers<T> = {\n enter?: TraversalHandler<T>;\n exit?: TraversalHandler<T>;\n};\n\n/**\n * A general AST traversal with both prefix and postfix handlers, and a\n * state object. Exposes ancestry data to each handler so that more complex\n * AST data can be taken into account.\n */\nexport default function traverse<T>(\n node: t.Node,\n handlers: TraversalHandler<T> | TraversalHandlers<T>,\n state?: T,\n): void {\n if (typeof handlers === \"function\") {\n handlers = { enter: handlers };\n }\n\n const { enter, exit } = handlers as TraversalHandlers<T>;\n\n traverseSimpleImpl(node, enter, exit, state, []);\n}\n\nfunction traverseSimpleImpl<T>(\n node: any,\n enter: Function | undefined,\n exit: Function | undefined,\n state: T | undefined,\n ancestors: TraversalAncestors,\n) {\n const keys = VISITOR_KEYS[node.type];\n if (!keys) return;\n\n if (enter) enter(node, ancestors, state);\n\n for (const key of keys) {\n const subNode = node[key];\n\n if (Array.isArray(subNode)) {\n for (let i = 0; i < subNode.length; i++) {\n const child = subNode[i];\n if (!child) continue;\n\n ancestors.push({\n node,\n key,\n index: i,\n });\n\n traverseSimpleImpl(child, enter, exit, state, ancestors);\n\n ancestors.pop();\n }\n } else if (subNode) {\n ancestors.push({\n node,\n key,\n });\n\n traverseSimpleImpl(subNode, enter, exit, state, ancestors);\n\n ancestors.pop();\n }\n }\n\n if (exit) exit(node, ancestors, state);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["traverse","node","handlers","state","enter","exit","traverseSimpleImpl","ancestors","keys","VISITOR_KEYS","type","key","subNode","Array","isArray","i","length","child","push","index","pop"],"sources":["../../src/traverse/traverse.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\nexport type TraversalAncestors = Array<{\n node: t.Node;\n key: string;\n index?: number;\n}>;\n\nexport type TraversalHandler<T> = (\n this: undefined,\n node: t.Node,\n parent: TraversalAncestors,\n state: T,\n) => void;\n\nexport type TraversalHandlers<T> = {\n enter?: TraversalHandler<T>;\n exit?: TraversalHandler<T>;\n};\n\n/**\n * A general AST traversal with both prefix and postfix handlers, and a\n * state object. Exposes ancestry data to each handler so that more complex\n * AST data can be taken into account.\n */\nexport default function traverse<T>(\n node: t.Node,\n handlers: TraversalHandler<T> | TraversalHandlers<T>,\n state?: T,\n): void {\n if (typeof handlers === \"function\") {\n handlers = { enter: handlers };\n }\n\n const { enter, exit } = handlers as TraversalHandlers<T>;\n\n traverseSimpleImpl(node, enter, exit, state, []);\n}\n\nfunction traverseSimpleImpl<T>(\n node: any,\n enter: Function | undefined,\n exit: Function | undefined,\n state: T | undefined,\n ancestors: TraversalAncestors,\n) {\n const keys = VISITOR_KEYS[node.type];\n if (!keys) return;\n\n if (enter) enter(node, ancestors, state);\n\n for (const key of keys) {\n const subNode = node[key];\n\n if (Array.isArray(subNode)) {\n for (let i = 0; i < subNode.length; i++) {\n const child = subNode[i];\n if (!child) continue;\n\n ancestors.push({\n node,\n key,\n index: i,\n });\n\n traverseSimpleImpl(child, enter, exit, state, ancestors);\n\n ancestors.pop();\n }\n } else if (subNode) {\n ancestors.push({\n node,\n key,\n });\n\n traverseSimpleImpl(subNode, enter, exit, state, ancestors);\n\n ancestors.pop();\n }\n }\n\n if (exit) exit(node, ancestors, state);\n}\n"],"mappings":";;;;;;AAAA;AA0Be,SAASA,QAAQ,CAC9BC,IAAY,EACZC,QAAoD,EACpDC,KAAS,EACH;EACN,IAAI,OAAOD,QAAQ,KAAK,UAAU,EAAE;IAClCA,QAAQ,GAAG;MAAEE,KAAK,EAAEF;IAAS,CAAC;EAChC;EAEA,MAAM;IAAEE,KAAK;IAAEC;EAAK,CAAC,GAAGH,QAAgC;EAExDI,kBAAkB,CAACL,IAAI,EAAEG,KAAK,EAAEC,IAAI,EAAEF,KAAK,EAAE,EAAE,CAAC;AAClD;AAEA,SAASG,kBAAkB,CACzBL,IAAS,EACTG,KAA2B,EAC3BC,IAA0B,EAC1BF,KAAoB,EACpBI,SAA6B,EAC7B;EACA,MAAMC,IAAI,GAAGC,yBAAY,CAACR,IAAI,CAACS,IAAI,CAAC;EACpC,IAAI,CAACF,IAAI,EAAE;EAEX,IAAIJ,KAAK,EAAEA,KAAK,CAACH,IAAI,EAAEM,SAAS,EAAEJ,KAAK,CAAC;EAExC,KAAK,MAAMQ,GAAG,IAAIH,IAAI,EAAE;IACtB,MAAMI,OAAO,GAAGX,IAAI,CAACU,GAAG,CAAC;IAEzB,IAAIE,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,EAAE;MAC1B,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,OAAO,CAACI,MAAM,EAAED,CAAC,EAAE,EAAE;QACvC,MAAME,KAAK,GAAGL,OAAO,CAACG,CAAC,CAAC;QACxB,IAAI,CAACE,KAAK,EAAE;QAEZV,SAAS,CAACW,IAAI,CAAC;UACbjB,IAAI;UACJU,GAAG;UACHQ,KAAK,EAAEJ;QACT,CAAC,CAAC;QAEFT,kBAAkB,CAACW,KAAK,EAAEb,KAAK,EAAEC,IAAI,EAAEF,KAAK,EAAEI,SAAS,CAAC;QAExDA,SAAS,CAACa,GAAG,EAAE;MACjB;IACF,CAAC,MAAM,IAAIR,OAAO,EAAE;MAClBL,SAAS,CAACW,IAAI,CAAC;QACbjB,IAAI;QACJU;MACF,CAAC,CAAC;MAEFL,kBAAkB,CAACM,OAAO,EAAER,KAAK,EAAEC,IAAI,EAAEF,KAAK,EAAEI,SAAS,CAAC;MAE1DA,SAAS,CAACa,GAAG,EAAE;IACjB;EACF;EAEA,IAAIf,IAAI,EAAEA,IAAI,CAACJ,IAAI,EAAEM,SAAS,EAAEJ,KAAK,CAAC;AACxC"}
|
|
@@ -4,19 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = traverseFast;
|
|
7
|
-
|
|
8
7
|
var _definitions = require("../definitions");
|
|
9
|
-
|
|
10
8
|
function traverseFast(node, enter, opts) {
|
|
11
9
|
if (!node) return;
|
|
12
10
|
const keys = _definitions.VISITOR_KEYS[node.type];
|
|
13
11
|
if (!keys) return;
|
|
14
12
|
opts = opts || {};
|
|
15
13
|
enter(node, opts);
|
|
16
|
-
|
|
17
14
|
for (const key of keys) {
|
|
18
|
-
const subNode =
|
|
19
|
-
|
|
15
|
+
const subNode =
|
|
16
|
+
node[key];
|
|
20
17
|
if (Array.isArray(subNode)) {
|
|
21
18
|
for (const node of subNode) {
|
|
22
19
|
traverseFast(node, enter, opts);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["traverseFast","node","enter","opts","keys","VISITOR_KEYS","type","key","subNode","Array","isArray"],"sources":["../../src/traverse/traverseFast.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\n/**\n * A prefix AST traversal implementation meant for simple searching\n * and processing.\n */\nexport default function traverseFast<Options = {}>(\n node: t.Node | null | undefined,\n enter: (node: t.Node, opts?: Options) => void,\n opts?: Options,\n): void {\n if (!node) return;\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys) return;\n\n opts = opts || ({} as Options);\n enter(node, opts);\n\n for (const key of keys) {\n const subNode: t.Node | undefined | null =\n // @ts-expect-error key must present in node\n node[key];\n\n if (Array.isArray(subNode)) {\n for (const node of subNode) {\n traverseFast(node, enter, opts);\n }\n } else {\n traverseFast(subNode, enter, opts);\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["traverseFast","node","enter","opts","keys","VISITOR_KEYS","type","key","subNode","Array","isArray"],"sources":["../../src/traverse/traverseFast.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\n/**\n * A prefix AST traversal implementation meant for simple searching\n * and processing.\n */\nexport default function traverseFast<Options = {}>(\n node: t.Node | null | undefined,\n enter: (node: t.Node, opts?: Options) => void,\n opts?: Options,\n): void {\n if (!node) return;\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys) return;\n\n opts = opts || ({} as Options);\n enter(node, opts);\n\n for (const key of keys) {\n const subNode: t.Node | undefined | null =\n // @ts-expect-error key must present in node\n node[key];\n\n if (Array.isArray(subNode)) {\n for (const node of subNode) {\n traverseFast(node, enter, opts);\n }\n } else {\n traverseFast(subNode, enter, opts);\n }\n }\n}\n"],"mappings":";;;;;;AAAA;AAOe,SAASA,YAAY,CAClCC,IAA+B,EAC/BC,KAA6C,EAC7CC,IAAc,EACR;EACN,IAAI,CAACF,IAAI,EAAE;EAEX,MAAMG,IAAI,GAAGC,yBAAY,CAACJ,IAAI,CAACK,IAAI,CAAC;EACpC,IAAI,CAACF,IAAI,EAAE;EAEXD,IAAI,GAAGA,IAAI,IAAK,CAAC,CAAa;EAC9BD,KAAK,CAACD,IAAI,EAAEE,IAAI,CAAC;EAEjB,KAAK,MAAMI,GAAG,IAAIH,IAAI,EAAE;IACtB,MAAMI,OAAkC;IAEtCP,IAAI,CAACM,GAAG,CAAC;IAEX,IAAIE,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,EAAE;MAC1B,KAAK,MAAMP,IAAI,IAAIO,OAAO,EAAE;QAC1BR,YAAY,CAACC,IAAI,EAAEC,KAAK,EAAEC,IAAI,CAAC;MACjC;IACF,CAAC,MAAM;MACLH,YAAY,CAACQ,OAAO,EAAEN,KAAK,EAAEC,IAAI,CAAC;IACpC;EACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["inherit","key","child","parent","Array","from","Set","concat","filter","Boolean"],"sources":["../../src/utils/inherit.ts"],"sourcesContent":["import type * as t from \"..\";\n\nexport default function inherit<\n C extends t.Node | undefined,\n P extends t.Node | undefined,\n>(key: keyof C & keyof P, child: C, parent: P): void {\n if (child && parent) {\n // @ts-expect-error Could further refine key definitions\n child[key] = Array.from(\n new Set([].concat(child[key], parent[key]).filter(Boolean)),\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["inherit","key","child","parent","Array","from","Set","concat","filter","Boolean"],"sources":["../../src/utils/inherit.ts"],"sourcesContent":["import type * as t from \"..\";\n\nexport default function inherit<\n C extends t.Node | undefined,\n P extends t.Node | undefined,\n>(key: keyof C & keyof P, child: C, parent: P): void {\n if (child && parent) {\n // @ts-expect-error Could further refine key definitions\n child[key] = Array.from(\n new Set([].concat(child[key], parent[key]).filter(Boolean)),\n );\n }\n}\n"],"mappings":";;;;;;AAEe,SAASA,OAAO,CAG7BC,GAAsB,EAAEC,KAAQ,EAAEC,MAAS,EAAQ;EACnD,IAAID,KAAK,IAAIC,MAAM,EAAE;IAEnBD,KAAK,CAACD,GAAG,CAAC,GAAGG,KAAK,CAACC,IAAI,CACrB,IAAIC,GAAG,CAAC,EAAE,CAACC,MAAM,CAACL,KAAK,CAACD,GAAG,CAAC,EAAEE,MAAM,CAACF,GAAG,CAAC,CAAC,CAACO,MAAM,CAACC,OAAO,CAAC,CAAC,CAC5D;EACH;AACF"}
|
|
@@ -4,26 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = cleanJSXElementLiteralChild;
|
|
7
|
-
|
|
8
7
|
var _generated = require("../../builders/generated");
|
|
9
|
-
|
|
10
8
|
function cleanJSXElementLiteralChild(child, args) {
|
|
11
9
|
const lines = child.value.split(/\r\n|\n|\r/);
|
|
12
10
|
let lastNonEmptyLine = 0;
|
|
13
|
-
|
|
14
11
|
for (let i = 0; i < lines.length; i++) {
|
|
15
12
|
if (lines[i].match(/[^ \t]/)) {
|
|
16
13
|
lastNonEmptyLine = i;
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
|
|
20
16
|
let str = "";
|
|
21
|
-
|
|
22
17
|
for (let i = 0; i < lines.length; i++) {
|
|
23
18
|
const line = lines[i];
|
|
24
19
|
const isFirstLine = i === 0;
|
|
25
20
|
const isLastLine = i === lines.length - 1;
|
|
26
21
|
const isLastNonEmptyLine = i === lastNonEmptyLine;
|
|
22
|
+
|
|
27
23
|
let trimmedLine = line.replace(/\t/g, " ");
|
|
28
24
|
|
|
29
25
|
if (!isFirstLine) {
|
|
@@ -33,16 +29,13 @@ function cleanJSXElementLiteralChild(child, args) {
|
|
|
33
29
|
if (!isLastLine) {
|
|
34
30
|
trimmedLine = trimmedLine.replace(/[ ]+$/, "");
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
if (trimmedLine) {
|
|
38
33
|
if (!isLastNonEmptyLine) {
|
|
39
34
|
trimmedLine += " ";
|
|
40
35
|
}
|
|
41
|
-
|
|
42
36
|
str += trimmedLine;
|
|
43
37
|
}
|
|
44
38
|
}
|
|
45
|
-
|
|
46
39
|
if (str) args.push((0, _generated.stringLiteral)(str));
|
|
47
40
|
}
|
|
48
41
|
|
package/appFiles/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["cleanJSXElementLiteralChild","child","args","lines","value","split","lastNonEmptyLine","i","length","match","str","line","isFirstLine","isLastLine","isLastNonEmptyLine","trimmedLine","replace","push","stringLiteral"],"sources":["../../../src/utils/react/cleanJSXElementLiteralChild.ts"],"sourcesContent":["import { stringLiteral } from \"../../builders/generated\";\nimport type * as t from \"../..\";\n\nexport default function cleanJSXElementLiteralChild(\n child: {\n value: string;\n },\n args: Array<t.Node>,\n) {\n const lines = child.value.split(/\\r\\n|\\n|\\r/);\n\n let lastNonEmptyLine = 0;\n\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].match(/[^ \\t]/)) {\n lastNonEmptyLine = i;\n }\n }\n\n let str = \"\";\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n\n const isFirstLine = i === 0;\n const isLastLine = i === lines.length - 1;\n const isLastNonEmptyLine = i === lastNonEmptyLine;\n\n // replace rendered whitespace tabs with spaces\n let trimmedLine = line.replace(/\\t/g, \" \");\n\n // trim whitespace touching a newline\n if (!isFirstLine) {\n trimmedLine = trimmedLine.replace(/^[ ]+/, \"\");\n }\n\n // trim whitespace touching an endline\n if (!isLastLine) {\n trimmedLine = trimmedLine.replace(/[ ]+$/, \"\");\n }\n\n if (trimmedLine) {\n if (!isLastNonEmptyLine) {\n trimmedLine += \" \";\n }\n\n str += trimmedLine;\n }\n }\n\n if (str) args.push(stringLiteral(str));\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["cleanJSXElementLiteralChild","child","args","lines","value","split","lastNonEmptyLine","i","length","match","str","line","isFirstLine","isLastLine","isLastNonEmptyLine","trimmedLine","replace","push","stringLiteral"],"sources":["../../../src/utils/react/cleanJSXElementLiteralChild.ts"],"sourcesContent":["import { stringLiteral } from \"../../builders/generated\";\nimport type * as t from \"../..\";\n\nexport default function cleanJSXElementLiteralChild(\n child: {\n value: string;\n },\n args: Array<t.Node>,\n) {\n const lines = child.value.split(/\\r\\n|\\n|\\r/);\n\n let lastNonEmptyLine = 0;\n\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].match(/[^ \\t]/)) {\n lastNonEmptyLine = i;\n }\n }\n\n let str = \"\";\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n\n const isFirstLine = i === 0;\n const isLastLine = i === lines.length - 1;\n const isLastNonEmptyLine = i === lastNonEmptyLine;\n\n // replace rendered whitespace tabs with spaces\n let trimmedLine = line.replace(/\\t/g, \" \");\n\n // trim whitespace touching a newline\n if (!isFirstLine) {\n trimmedLine = trimmedLine.replace(/^[ ]+/, \"\");\n }\n\n // trim whitespace touching an endline\n if (!isLastLine) {\n trimmedLine = trimmedLine.replace(/[ ]+$/, \"\");\n }\n\n if (trimmedLine) {\n if (!isLastNonEmptyLine) {\n trimmedLine += \" \";\n }\n\n str += trimmedLine;\n }\n }\n\n if (str) args.push(stringLiteral(str));\n}\n"],"mappings":";;;;;;AAAA;AAGe,SAASA,2BAA2B,CACjDC,KAEC,EACDC,IAAmB,EACnB;EACA,MAAMC,KAAK,GAAGF,KAAK,CAACG,KAAK,CAACC,KAAK,CAAC,YAAY,CAAC;EAE7C,IAAIC,gBAAgB,GAAG,CAAC;EAExB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,KAAK,CAACK,MAAM,EAAED,CAAC,EAAE,EAAE;IACrC,IAAIJ,KAAK,CAACI,CAAC,CAAC,CAACE,KAAK,CAAC,QAAQ,CAAC,EAAE;MAC5BH,gBAAgB,GAAGC,CAAC;IACtB;EACF;EAEA,IAAIG,GAAG,GAAG,EAAE;EAEZ,KAAK,IAAIH,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,KAAK,CAACK,MAAM,EAAED,CAAC,EAAE,EAAE;IACrC,MAAMI,IAAI,GAAGR,KAAK,CAACI,CAAC,CAAC;IAErB,MAAMK,WAAW,GAAGL,CAAC,KAAK,CAAC;IAC3B,MAAMM,UAAU,GAAGN,CAAC,KAAKJ,KAAK,CAACK,MAAM,GAAG,CAAC;IACzC,MAAMM,kBAAkB,GAAGP,CAAC,KAAKD,gBAAgB;;IAGjD,IAAIS,WAAW,GAAGJ,IAAI,CAACK,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;;IAG1C,IAAI,CAACJ,WAAW,EAAE;MAChBG,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;IAChD;;IAGA,IAAI,CAACH,UAAU,EAAE;MACfE,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;IAChD;IAEA,IAAID,WAAW,EAAE;MACf,IAAI,CAACD,kBAAkB,EAAE;QACvBC,WAAW,IAAI,GAAG;MACpB;MAEAL,GAAG,IAAIK,WAAW;IACpB;EACF;EAEA,IAAIL,GAAG,EAAER,IAAI,CAACe,IAAI,CAAC,IAAAC,wBAAa,EAACR,GAAG,CAAC,CAAC;AACxC"}
|
|
@@ -4,16 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = shallowEqual;
|
|
7
|
-
|
|
8
7
|
function shallowEqual(actual, expected) {
|
|
9
8
|
const keys = Object.keys(expected);
|
|
10
|
-
|
|
11
9
|
for (const key of keys) {
|
|
12
|
-
if (
|
|
10
|
+
if (
|
|
11
|
+
actual[key] !== expected[key]) {
|
|
13
12
|
return false;
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
return true;
|
|
18
16
|
}
|
|
19
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["shallowEqual","actual","expected","keys","Object","key"],"sources":["../../src/utils/shallowEqual.ts"],"sourcesContent":["export default function shallowEqual<T extends object>(\n actual: object,\n expected: T,\n): actual is T {\n const keys = Object.keys(expected) as (keyof T)[];\n\n for (const key of keys) {\n if (\n // @ts-expect-error maybe we should check whether key exists first\n actual[key] !== expected[key]\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["shallowEqual","actual","expected","keys","Object","key"],"sources":["../../src/utils/shallowEqual.ts"],"sourcesContent":["export default function shallowEqual<T extends object>(\n actual: object,\n expected: T,\n): actual is T {\n const keys = Object.keys(expected) as (keyof T)[];\n\n for (const key of keys) {\n if (\n // @ts-expect-error maybe we should check whether key exists first\n actual[key] !== expected[key]\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"mappings":";;;;;;AAAe,SAASA,YAAY,CAClCC,MAAc,EACdC,QAAW,EACE;EACb,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACD,QAAQ,CAAgB;EAEjD,KAAK,MAAMG,GAAG,IAAIF,IAAI,EAAE;IACtB;IAEEF,MAAM,CAACI,GAAG,CAAC,KAAKH,QAAQ,CAACG,GAAG,CAAC,EAC7B;MACA,OAAO,KAAK;IACd;EACF;EAEA,OAAO,IAAI;AACb"}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = buildMatchMemberExpression;
|
|
7
|
-
|
|
8
7
|
var _matchesPattern = require("./matchesPattern");
|
|
9
|
-
|
|
10
8
|
function buildMatchMemberExpression(match, allowPartial) {
|
|
11
9
|
const parts = match.split(".");
|
|
12
10
|
return member => (0, _matchesPattern.default)(member, parts, allowPartial);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["buildMatchMemberExpression","match","allowPartial","parts","split","member","matchesPattern"],"sources":["../../src/validators/buildMatchMemberExpression.ts"],"sourcesContent":["import matchesPattern from \"./matchesPattern\";\nimport type * as t from \"..\";\n\n/**\n * Build a function that when called will return whether or not the\n * input `node` `MemberExpression` matches the input `match`.\n *\n * For example, given the match `React.createClass` it would match the\n * parsed nodes of `React.createClass` and `React[\"createClass\"]`.\n */\nexport default function buildMatchMemberExpression(\n match: string,\n allowPartial?: boolean,\n) {\n const parts = match.split(\".\");\n\n return (member: t.Node) => matchesPattern(member, parts, allowPartial);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["buildMatchMemberExpression","match","allowPartial","parts","split","member","matchesPattern"],"sources":["../../src/validators/buildMatchMemberExpression.ts"],"sourcesContent":["import matchesPattern from \"./matchesPattern\";\nimport type * as t from \"..\";\n\n/**\n * Build a function that when called will return whether or not the\n * input `node` `MemberExpression` matches the input `match`.\n *\n * For example, given the match `React.createClass` it would match the\n * parsed nodes of `React.createClass` and `React[\"createClass\"]`.\n */\nexport default function buildMatchMemberExpression(\n match: string,\n allowPartial?: boolean,\n) {\n const parts = match.split(\".\");\n\n return (member: t.Node) => matchesPattern(member, parts, allowPartial);\n}\n"],"mappings":";;;;;;AAAA;AAUe,SAASA,0BAA0B,CAChDC,KAAa,EACbC,YAAsB,EACtB;EACA,MAAMC,KAAK,GAAGF,KAAK,CAACG,KAAK,CAAC,GAAG,CAAC;EAE9B,OAAQC,MAAc,IAAK,IAAAC,uBAAc,EAACD,MAAM,EAAEF,KAAK,EAAED,YAAY,CAAC;AACxE"}
|