@ohos-ports/teambit-node-deps-detectors-parser-helper 0.0.0-stage → 0.0.6-beta.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/.bit-capsule-ready +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/parser-helper.d.ts +15 -0
- package/dist/parser-helper.docs.mdx +18 -0
- package/dist/parser-helper.js +66 -0
- package/dist/parser-helper.js.map +1 -0
- package/index.ts +5 -0
- package/package.json +16 -4
- package/parser-helper.docs.mdx +18 -0
- package/parser-helper.ts +85 -0
- package/schema.json +490 -0
- package/teambit_node_deps_detectors_parser_helper-preview.js +1 -0
- package/README.md +0 -3
|
File without changes
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getDependenciesFromMemberExpression, getDependenciesFromCallExpression, getSpecifierValueForImportDeclaration } from './parser-helper';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSpecifierValueForImportDeclaration = exports.getDependenciesFromCallExpression = exports.getDependenciesFromMemberExpression = void 0;
|
|
4
|
+
var parser_helper_1 = require("./parser-helper");
|
|
5
|
+
Object.defineProperty(exports, "getDependenciesFromMemberExpression", { enumerable: true, get: function () { return parser_helper_1.getDependenciesFromMemberExpression; } });
|
|
6
|
+
Object.defineProperty(exports, "getDependenciesFromCallExpression", { enumerable: true, get: function () { return parser_helper_1.getDependenciesFromCallExpression; } });
|
|
7
|
+
Object.defineProperty(exports, "getSpecifierValueForImportDeclaration", { enumerable: true, get: function () { return parser_helper_1.getSpecifierValueForImportDeclaration; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,iDAIyB;AAHvB,oIAAA,mCAAmC,OAAA;AACnC,kIAAA,iCAAiC,OAAA;AACjC,sIAAA,qCAAqC,OAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import Specifier data.
|
|
3
|
+
* For example, `import foo from './bar' `, "foo" is the import-specifier and is default.
|
|
4
|
+
* Conversely, `import { foo } from './bar' `, here, "foo" is non-default.
|
|
5
|
+
*/
|
|
6
|
+
export type Specifier = {
|
|
7
|
+
isDefault: boolean;
|
|
8
|
+
name: string;
|
|
9
|
+
exported?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type Node = any;
|
|
12
|
+
export declare function getDependenciesFromMemberExpression(node: Node): any;
|
|
13
|
+
export declare function getDependenciesFromCallExpression(node: Node): any;
|
|
14
|
+
export declare function getSpecifierValueForImportDeclaration(specifier: any): Specifier;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
labels: ['module', 'parser']
|
|
3
|
+
description: 'A group of helper functions for parsing'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
API:
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import {
|
|
10
|
+
getDependenciesFromMemberExpression,
|
|
11
|
+
getDependenciesFromCallExpression,
|
|
12
|
+
getSpecifierValueForImportDeclaration
|
|
13
|
+
} from '@teambit/node.deps-detection.parser-helper';
|
|
14
|
+
|
|
15
|
+
getDependenciesFromMemberExpression(node)
|
|
16
|
+
getDependenciesFromCallExpression(node)
|
|
17
|
+
getSpecifierValueForImportDeclaration(specifier)
|
|
18
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDependenciesFromMemberExpression = getDependenciesFromMemberExpression;
|
|
4
|
+
exports.getDependenciesFromCallExpression = getDependenciesFromCallExpression;
|
|
5
|
+
exports.getSpecifierValueForImportDeclaration = getSpecifierValueForImportDeclaration;
|
|
6
|
+
function getStringValue(node) {
|
|
7
|
+
// using single or double quotes (', ")
|
|
8
|
+
if (node.type === 'Literal' || node.type === 'StringLiteral') {
|
|
9
|
+
return node.value;
|
|
10
|
+
}
|
|
11
|
+
// using apostrophe (`)
|
|
12
|
+
if (node.type === 'TemplateLiteral' &&
|
|
13
|
+
node.quasis &&
|
|
14
|
+
node.quasis.length === 1 && // if there is only one quasi, it means that the string is not interpolated (no variables in it)
|
|
15
|
+
node.quasis[0].type === 'TemplateElement') {
|
|
16
|
+
return node.quasis[0].value.raw;
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function getDependenciesFromMemberExpression(node) {
|
|
21
|
+
if (node.object.type === 'CallExpression' &&
|
|
22
|
+
node.object.callee.type === 'Identifier' &&
|
|
23
|
+
node.object.callee.name === 'require' &&
|
|
24
|
+
node.object.arguments &&
|
|
25
|
+
node.object.arguments.length) {
|
|
26
|
+
return getStringValue(node.object.arguments[0]);
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
function getDependenciesFromCallExpression(node) {
|
|
31
|
+
if (node.callee.type === 'Import' && node.arguments.length && node.arguments[0].value) {
|
|
32
|
+
return node.arguments[0].value;
|
|
33
|
+
}
|
|
34
|
+
if (node.callee.type === 'Identifier' && // taken from detective-cjs
|
|
35
|
+
node.callee.name === 'require' &&
|
|
36
|
+
node.arguments &&
|
|
37
|
+
node.arguments.length) {
|
|
38
|
+
return getStringValue(node.arguments[0]);
|
|
39
|
+
}
|
|
40
|
+
// support require.resolve()
|
|
41
|
+
if (node.callee.type === 'MemberExpression' &&
|
|
42
|
+
node.callee.object?.name === 'require' &&
|
|
43
|
+
node.callee.property?.name === 'resolve' &&
|
|
44
|
+
node.arguments?.length) {
|
|
45
|
+
return getStringValue(node.arguments[0]);
|
|
46
|
+
}
|
|
47
|
+
// support import.meta.resolve()
|
|
48
|
+
if (node.callee.type === 'MemberExpression' &&
|
|
49
|
+
node.callee.object?.type === 'MetaProperty' &&
|
|
50
|
+
node.callee.object?.meta?.name === 'import' &&
|
|
51
|
+
node.callee.property?.name === 'resolve' &&
|
|
52
|
+
node.arguments?.length) {
|
|
53
|
+
return getStringValue(node.arguments[0]);
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
function getSpecifierValueForImportDeclaration(specifier) {
|
|
58
|
+
return {
|
|
59
|
+
isDefault: specifier.type === 'ImportDefaultSpecifier',
|
|
60
|
+
// syntax of `import x from 'file'` doesn't have specifier.imported, only specifier.local
|
|
61
|
+
// syntax of `import { x as y } from 'file'`, has `x` as specifier.imported and `y` as
|
|
62
|
+
// specifier.local. we interested in `x` in this case.
|
|
63
|
+
name: specifier.imported ? specifier.imported.name : specifier.local.name,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=parser-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser-helper.js","sourceRoot":"","sources":["../parser-helper.ts"],"names":[],"mappings":"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"}
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohos-ports/teambit-node-deps-detectors-parser-helper",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.6-beta.0",
|
|
4
|
+
"homepage": "https://bit.cloud/teambit/node/deps-detectors/parser-helper",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"componentId": {
|
|
7
|
+
"scope": "teambit.node",
|
|
8
|
+
"name": "deps-detectors/parser-helper",
|
|
9
|
+
"version": "0.0.6"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {},
|
|
12
|
+
"peerDependencies": {},
|
|
13
|
+
"license": "SEE LICENSE IN UNLICENSED",
|
|
14
|
+
"optionalDependencies": {},
|
|
15
|
+
"peerDependenciesMeta": {},
|
|
16
|
+
"private": false,
|
|
17
|
+
"description": "HarmonyOS port of @teambit/node.deps-detectors.parser-helper@0.0.6; republished because the original exists only on the bit.cloud registry and is missing from public npm; dist artifacts untouched."
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
labels: ['module', 'parser']
|
|
3
|
+
description: 'A group of helper functions for parsing'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
API:
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import {
|
|
10
|
+
getDependenciesFromMemberExpression,
|
|
11
|
+
getDependenciesFromCallExpression,
|
|
12
|
+
getSpecifierValueForImportDeclaration
|
|
13
|
+
} from '@teambit/node.deps-detection.parser-helper';
|
|
14
|
+
|
|
15
|
+
getDependenciesFromMemberExpression(node)
|
|
16
|
+
getDependenciesFromCallExpression(node)
|
|
17
|
+
getSpecifierValueForImportDeclaration(specifier)
|
|
18
|
+
```
|
package/parser-helper.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import Specifier data.
|
|
3
|
+
* For example, `import foo from './bar' `, "foo" is the import-specifier and is default.
|
|
4
|
+
* Conversely, `import { foo } from './bar' `, here, "foo" is non-default.
|
|
5
|
+
*/
|
|
6
|
+
export type Specifier = {
|
|
7
|
+
isDefault: boolean;
|
|
8
|
+
name: string;
|
|
9
|
+
exported?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type Node = any;
|
|
13
|
+
|
|
14
|
+
function getStringValue(node: Node) {
|
|
15
|
+
// using single or double quotes (', ")
|
|
16
|
+
if (node.type === 'Literal' || node.type === 'StringLiteral') {
|
|
17
|
+
return node.value;
|
|
18
|
+
}
|
|
19
|
+
// using apostrophe (`)
|
|
20
|
+
if (
|
|
21
|
+
node.type === 'TemplateLiteral' &&
|
|
22
|
+
node.quasis &&
|
|
23
|
+
node.quasis.length === 1 && // if there is only one quasi, it means that the string is not interpolated (no variables in it)
|
|
24
|
+
node.quasis[0].type === 'TemplateElement'
|
|
25
|
+
) {
|
|
26
|
+
return node.quasis[0].value.raw;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getDependenciesFromMemberExpression(node: Node) {
|
|
32
|
+
if (
|
|
33
|
+
node.object.type === 'CallExpression' &&
|
|
34
|
+
node.object.callee.type === 'Identifier' &&
|
|
35
|
+
node.object.callee.name === 'require' &&
|
|
36
|
+
node.object.arguments &&
|
|
37
|
+
node.object.arguments.length
|
|
38
|
+
) {
|
|
39
|
+
return getStringValue(node.object.arguments[0]);
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function getDependenciesFromCallExpression(node: Node) {
|
|
45
|
+
if (node.callee.type === 'Import' && node.arguments.length && node.arguments[0].value) {
|
|
46
|
+
return node.arguments[0].value;
|
|
47
|
+
}
|
|
48
|
+
if (
|
|
49
|
+
node.callee.type === 'Identifier' && // taken from detective-cjs
|
|
50
|
+
node.callee.name === 'require' &&
|
|
51
|
+
node.arguments &&
|
|
52
|
+
node.arguments.length
|
|
53
|
+
) {
|
|
54
|
+
return getStringValue(node.arguments[0]);
|
|
55
|
+
}
|
|
56
|
+
// support require.resolve()
|
|
57
|
+
if (
|
|
58
|
+
node.callee.type === 'MemberExpression' &&
|
|
59
|
+
node.callee.object?.name === 'require' &&
|
|
60
|
+
node.callee.property?.name === 'resolve' &&
|
|
61
|
+
node.arguments?.length
|
|
62
|
+
) {
|
|
63
|
+
return getStringValue(node.arguments[0]);
|
|
64
|
+
}
|
|
65
|
+
// support import.meta.resolve()
|
|
66
|
+
if (node.callee.type === 'MemberExpression' &&
|
|
67
|
+
node.callee.object?.type === 'MetaProperty' &&
|
|
68
|
+
node.callee.object?.meta?.name === 'import' &&
|
|
69
|
+
node.callee.property?.name === 'resolve' &&
|
|
70
|
+
node.arguments?.length
|
|
71
|
+
) {
|
|
72
|
+
return getStringValue(node.arguments[0]);
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function getSpecifierValueForImportDeclaration(specifier: any): Specifier {
|
|
78
|
+
return {
|
|
79
|
+
isDefault: specifier.type === 'ImportDefaultSpecifier',
|
|
80
|
+
// syntax of `import x from 'file'` doesn't have specifier.imported, only specifier.local
|
|
81
|
+
// syntax of `import { x as y } from 'file'`, has `x` as specifier.imported and `y` as
|
|
82
|
+
// specifier.local. we interested in `x` in this case.
|
|
83
|
+
name: specifier.imported ? specifier.imported.name : specifier.local.name,
|
|
84
|
+
};
|
|
85
|
+
}
|
package/schema.json
ADDED
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
{
|
|
2
|
+
"__schema": "APISchema",
|
|
3
|
+
"location": {
|
|
4
|
+
"filePath": "index.ts",
|
|
5
|
+
"line": 1,
|
|
6
|
+
"character": 1
|
|
7
|
+
},
|
|
8
|
+
"module": {
|
|
9
|
+
"__schema": "ModuleSchema",
|
|
10
|
+
"location": {
|
|
11
|
+
"filePath": "index.ts",
|
|
12
|
+
"line": 1,
|
|
13
|
+
"character": 1
|
|
14
|
+
},
|
|
15
|
+
"exports": [
|
|
16
|
+
{
|
|
17
|
+
"__schema": "ExportSchema",
|
|
18
|
+
"location": {
|
|
19
|
+
"filePath": "index.ts",
|
|
20
|
+
"line": 2,
|
|
21
|
+
"character": 3
|
|
22
|
+
},
|
|
23
|
+
"name": "getDependenciesFromMemberExpression",
|
|
24
|
+
"exportNode": {
|
|
25
|
+
"__schema": "FunctionLikeSchema",
|
|
26
|
+
"location": {
|
|
27
|
+
"filePath": "parser-helper.ts",
|
|
28
|
+
"line": 31,
|
|
29
|
+
"character": 1
|
|
30
|
+
},
|
|
31
|
+
"signature": "function getDependenciesFromMemberExpression(node: Node): any",
|
|
32
|
+
"name": "getDependenciesFromMemberExpression",
|
|
33
|
+
"params": [
|
|
34
|
+
{
|
|
35
|
+
"__schema": "ParameterSchema",
|
|
36
|
+
"location": {
|
|
37
|
+
"filePath": "parser-helper.ts",
|
|
38
|
+
"line": 31,
|
|
39
|
+
"character": 53
|
|
40
|
+
},
|
|
41
|
+
"name": "node",
|
|
42
|
+
"type": {
|
|
43
|
+
"__schema": "TypeRefSchema",
|
|
44
|
+
"location": {
|
|
45
|
+
"filePath": "parser-helper.ts",
|
|
46
|
+
"line": 31,
|
|
47
|
+
"character": 59
|
|
48
|
+
},
|
|
49
|
+
"name": "Node",
|
|
50
|
+
"internalFilePath": "parser-helper.ts"
|
|
51
|
+
},
|
|
52
|
+
"isOptional": false,
|
|
53
|
+
"isSpread": false
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"returnType": {
|
|
57
|
+
"__schema": "InferenceTypeSchema",
|
|
58
|
+
"location": {
|
|
59
|
+
"filePath": "parser-helper.ts",
|
|
60
|
+
"line": 31,
|
|
61
|
+
"character": 1
|
|
62
|
+
},
|
|
63
|
+
"type": "any"
|
|
64
|
+
},
|
|
65
|
+
"modifiers": [
|
|
66
|
+
"export"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"__schema": "ExportSchema",
|
|
72
|
+
"location": {
|
|
73
|
+
"filePath": "index.ts",
|
|
74
|
+
"line": 3,
|
|
75
|
+
"character": 3
|
|
76
|
+
},
|
|
77
|
+
"name": "getDependenciesFromCallExpression",
|
|
78
|
+
"exportNode": {
|
|
79
|
+
"__schema": "FunctionLikeSchema",
|
|
80
|
+
"location": {
|
|
81
|
+
"filePath": "parser-helper.ts",
|
|
82
|
+
"line": 44,
|
|
83
|
+
"character": 1
|
|
84
|
+
},
|
|
85
|
+
"signature": "function getDependenciesFromCallExpression(node: Node): any",
|
|
86
|
+
"name": "getDependenciesFromCallExpression",
|
|
87
|
+
"params": [
|
|
88
|
+
{
|
|
89
|
+
"__schema": "ParameterSchema",
|
|
90
|
+
"location": {
|
|
91
|
+
"filePath": "parser-helper.ts",
|
|
92
|
+
"line": 44,
|
|
93
|
+
"character": 51
|
|
94
|
+
},
|
|
95
|
+
"name": "node",
|
|
96
|
+
"type": {
|
|
97
|
+
"__schema": "TypeRefSchema",
|
|
98
|
+
"location": {
|
|
99
|
+
"filePath": "parser-helper.ts",
|
|
100
|
+
"line": 44,
|
|
101
|
+
"character": 57
|
|
102
|
+
},
|
|
103
|
+
"name": "Node",
|
|
104
|
+
"internalFilePath": "parser-helper.ts"
|
|
105
|
+
},
|
|
106
|
+
"isOptional": false,
|
|
107
|
+
"isSpread": false
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"returnType": {
|
|
111
|
+
"__schema": "InferenceTypeSchema",
|
|
112
|
+
"location": {
|
|
113
|
+
"filePath": "parser-helper.ts",
|
|
114
|
+
"line": 44,
|
|
115
|
+
"character": 1
|
|
116
|
+
},
|
|
117
|
+
"type": "any"
|
|
118
|
+
},
|
|
119
|
+
"modifiers": [
|
|
120
|
+
"export"
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"__schema": "ExportSchema",
|
|
126
|
+
"location": {
|
|
127
|
+
"filePath": "index.ts",
|
|
128
|
+
"line": 4,
|
|
129
|
+
"character": 3
|
|
130
|
+
},
|
|
131
|
+
"name": "getSpecifierValueForImportDeclaration",
|
|
132
|
+
"exportNode": {
|
|
133
|
+
"__schema": "FunctionLikeSchema",
|
|
134
|
+
"location": {
|
|
135
|
+
"filePath": "parser-helper.ts",
|
|
136
|
+
"line": 77,
|
|
137
|
+
"character": 1
|
|
138
|
+
},
|
|
139
|
+
"signature": "function getSpecifierValueForImportDeclaration(specifier: any): Specifier",
|
|
140
|
+
"name": "getSpecifierValueForImportDeclaration",
|
|
141
|
+
"params": [
|
|
142
|
+
{
|
|
143
|
+
"__schema": "ParameterSchema",
|
|
144
|
+
"location": {
|
|
145
|
+
"filePath": "parser-helper.ts",
|
|
146
|
+
"line": 77,
|
|
147
|
+
"character": 55
|
|
148
|
+
},
|
|
149
|
+
"name": "specifier",
|
|
150
|
+
"type": {
|
|
151
|
+
"__schema": "KeywordTypeSchema",
|
|
152
|
+
"location": {
|
|
153
|
+
"filePath": "parser-helper.ts",
|
|
154
|
+
"line": 77,
|
|
155
|
+
"character": 66
|
|
156
|
+
},
|
|
157
|
+
"name": "any"
|
|
158
|
+
},
|
|
159
|
+
"isOptional": false,
|
|
160
|
+
"isSpread": false
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"returnType": {
|
|
164
|
+
"__schema": "TypeRefSchema",
|
|
165
|
+
"location": {
|
|
166
|
+
"filePath": "parser-helper.ts",
|
|
167
|
+
"line": 77,
|
|
168
|
+
"character": 1
|
|
169
|
+
},
|
|
170
|
+
"name": "Specifier",
|
|
171
|
+
"internalFilePath": "parser-helper.ts"
|
|
172
|
+
},
|
|
173
|
+
"modifiers": [
|
|
174
|
+
"export"
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
"internals": []
|
|
180
|
+
},
|
|
181
|
+
"internals": [
|
|
182
|
+
{
|
|
183
|
+
"__schema": "ModuleSchema",
|
|
184
|
+
"location": {
|
|
185
|
+
"filePath": "parser-helper.ts",
|
|
186
|
+
"line": 6,
|
|
187
|
+
"character": 1
|
|
188
|
+
},
|
|
189
|
+
"exports": [
|
|
190
|
+
{
|
|
191
|
+
"__schema": "TypeSchema",
|
|
192
|
+
"location": {
|
|
193
|
+
"filePath": "parser-helper.ts",
|
|
194
|
+
"line": 6,
|
|
195
|
+
"character": 1
|
|
196
|
+
},
|
|
197
|
+
"doc": {
|
|
198
|
+
"__schema": "DocSchema",
|
|
199
|
+
"location": {
|
|
200
|
+
"filePath": "parser-helper.ts",
|
|
201
|
+
"line": 1,
|
|
202
|
+
"character": 1
|
|
203
|
+
},
|
|
204
|
+
"raw": "/**\n * Import Specifier data.\n * For example, `import foo from './bar' `, \"foo\" is the import-specifier and is default.\n * Conversely, `import { foo } from './bar' `, here, \"foo\" is non-default.\n */",
|
|
205
|
+
"comment": "Import Specifier data.\nFor example, `import foo from './bar' `, \"foo\" is the import-specifier and is default.\nConversely, `import { foo } from './bar' `, here, \"foo\" is non-default.",
|
|
206
|
+
"tags": []
|
|
207
|
+
},
|
|
208
|
+
"signature": "type Specifier = {\n isDefault: boolean;\n name: string;\n exported?: boolean | undefined;\n}",
|
|
209
|
+
"name": "Specifier",
|
|
210
|
+
"type": {
|
|
211
|
+
"__schema": "TypeLiteralSchema",
|
|
212
|
+
"location": {
|
|
213
|
+
"filePath": "parser-helper.ts",
|
|
214
|
+
"line": 6,
|
|
215
|
+
"character": 25
|
|
216
|
+
},
|
|
217
|
+
"members": [
|
|
218
|
+
{
|
|
219
|
+
"__schema": "VariableLikeSchema",
|
|
220
|
+
"location": {
|
|
221
|
+
"filePath": "parser-helper.ts",
|
|
222
|
+
"line": 7,
|
|
223
|
+
"character": 3
|
|
224
|
+
},
|
|
225
|
+
"signature": "(property) isDefault: boolean",
|
|
226
|
+
"name": "isDefault",
|
|
227
|
+
"type": {
|
|
228
|
+
"__schema": "KeywordTypeSchema",
|
|
229
|
+
"location": {
|
|
230
|
+
"filePath": "parser-helper.ts",
|
|
231
|
+
"line": 7,
|
|
232
|
+
"character": 14
|
|
233
|
+
},
|
|
234
|
+
"name": "boolean"
|
|
235
|
+
},
|
|
236
|
+
"isOptional": false
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"__schema": "VariableLikeSchema",
|
|
240
|
+
"location": {
|
|
241
|
+
"filePath": "parser-helper.ts",
|
|
242
|
+
"line": 8,
|
|
243
|
+
"character": 3
|
|
244
|
+
},
|
|
245
|
+
"signature": "(property) name: string",
|
|
246
|
+
"name": "name",
|
|
247
|
+
"type": {
|
|
248
|
+
"__schema": "KeywordTypeSchema",
|
|
249
|
+
"location": {
|
|
250
|
+
"filePath": "parser-helper.ts",
|
|
251
|
+
"line": 8,
|
|
252
|
+
"character": 9
|
|
253
|
+
},
|
|
254
|
+
"name": "string"
|
|
255
|
+
},
|
|
256
|
+
"isOptional": false
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"__schema": "VariableLikeSchema",
|
|
260
|
+
"location": {
|
|
261
|
+
"filePath": "parser-helper.ts",
|
|
262
|
+
"line": 9,
|
|
263
|
+
"character": 3
|
|
264
|
+
},
|
|
265
|
+
"signature": "(property) exported?: boolean | undefined",
|
|
266
|
+
"name": "exported",
|
|
267
|
+
"type": {
|
|
268
|
+
"__schema": "KeywordTypeSchema",
|
|
269
|
+
"location": {
|
|
270
|
+
"filePath": "parser-helper.ts",
|
|
271
|
+
"line": 9,
|
|
272
|
+
"character": 14
|
|
273
|
+
},
|
|
274
|
+
"name": "boolean"
|
|
275
|
+
},
|
|
276
|
+
"isOptional": true
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"__schema": "FunctionLikeSchema",
|
|
283
|
+
"location": {
|
|
284
|
+
"filePath": "parser-helper.ts",
|
|
285
|
+
"line": 31,
|
|
286
|
+
"character": 1
|
|
287
|
+
},
|
|
288
|
+
"signature": "function getDependenciesFromMemberExpression(node: Node): any",
|
|
289
|
+
"name": "getDependenciesFromMemberExpression",
|
|
290
|
+
"params": [
|
|
291
|
+
{
|
|
292
|
+
"__schema": "ParameterSchema",
|
|
293
|
+
"location": {
|
|
294
|
+
"filePath": "parser-helper.ts",
|
|
295
|
+
"line": 31,
|
|
296
|
+
"character": 53
|
|
297
|
+
},
|
|
298
|
+
"name": "node",
|
|
299
|
+
"type": {
|
|
300
|
+
"__schema": "TypeRefSchema",
|
|
301
|
+
"location": {
|
|
302
|
+
"filePath": "parser-helper.ts",
|
|
303
|
+
"line": 31,
|
|
304
|
+
"character": 59
|
|
305
|
+
},
|
|
306
|
+
"name": "Node",
|
|
307
|
+
"internalFilePath": "parser-helper.ts"
|
|
308
|
+
},
|
|
309
|
+
"isOptional": false,
|
|
310
|
+
"isSpread": false
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
"returnType": {
|
|
314
|
+
"__schema": "InferenceTypeSchema",
|
|
315
|
+
"location": {
|
|
316
|
+
"filePath": "parser-helper.ts",
|
|
317
|
+
"line": 31,
|
|
318
|
+
"character": 1
|
|
319
|
+
},
|
|
320
|
+
"type": "any"
|
|
321
|
+
},
|
|
322
|
+
"modifiers": [
|
|
323
|
+
"export"
|
|
324
|
+
]
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"__schema": "FunctionLikeSchema",
|
|
328
|
+
"location": {
|
|
329
|
+
"filePath": "parser-helper.ts",
|
|
330
|
+
"line": 44,
|
|
331
|
+
"character": 1
|
|
332
|
+
},
|
|
333
|
+
"signature": "function getDependenciesFromCallExpression(node: Node): any",
|
|
334
|
+
"name": "getDependenciesFromCallExpression",
|
|
335
|
+
"params": [
|
|
336
|
+
{
|
|
337
|
+
"__schema": "ParameterSchema",
|
|
338
|
+
"location": {
|
|
339
|
+
"filePath": "parser-helper.ts",
|
|
340
|
+
"line": 44,
|
|
341
|
+
"character": 51
|
|
342
|
+
},
|
|
343
|
+
"name": "node",
|
|
344
|
+
"type": {
|
|
345
|
+
"__schema": "TypeRefSchema",
|
|
346
|
+
"location": {
|
|
347
|
+
"filePath": "parser-helper.ts",
|
|
348
|
+
"line": 44,
|
|
349
|
+
"character": 57
|
|
350
|
+
},
|
|
351
|
+
"name": "Node",
|
|
352
|
+
"internalFilePath": "parser-helper.ts"
|
|
353
|
+
},
|
|
354
|
+
"isOptional": false,
|
|
355
|
+
"isSpread": false
|
|
356
|
+
}
|
|
357
|
+
],
|
|
358
|
+
"returnType": {
|
|
359
|
+
"__schema": "InferenceTypeSchema",
|
|
360
|
+
"location": {
|
|
361
|
+
"filePath": "parser-helper.ts",
|
|
362
|
+
"line": 44,
|
|
363
|
+
"character": 1
|
|
364
|
+
},
|
|
365
|
+
"type": "any"
|
|
366
|
+
},
|
|
367
|
+
"modifiers": [
|
|
368
|
+
"export"
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"__schema": "FunctionLikeSchema",
|
|
373
|
+
"location": {
|
|
374
|
+
"filePath": "parser-helper.ts",
|
|
375
|
+
"line": 77,
|
|
376
|
+
"character": 1
|
|
377
|
+
},
|
|
378
|
+
"signature": "function getSpecifierValueForImportDeclaration(specifier: any): Specifier",
|
|
379
|
+
"name": "getSpecifierValueForImportDeclaration",
|
|
380
|
+
"params": [
|
|
381
|
+
{
|
|
382
|
+
"__schema": "ParameterSchema",
|
|
383
|
+
"location": {
|
|
384
|
+
"filePath": "parser-helper.ts",
|
|
385
|
+
"line": 77,
|
|
386
|
+
"character": 55
|
|
387
|
+
},
|
|
388
|
+
"name": "specifier",
|
|
389
|
+
"type": {
|
|
390
|
+
"__schema": "KeywordTypeSchema",
|
|
391
|
+
"location": {
|
|
392
|
+
"filePath": "parser-helper.ts",
|
|
393
|
+
"line": 77,
|
|
394
|
+
"character": 66
|
|
395
|
+
},
|
|
396
|
+
"name": "any"
|
|
397
|
+
},
|
|
398
|
+
"isOptional": false,
|
|
399
|
+
"isSpread": false
|
|
400
|
+
}
|
|
401
|
+
],
|
|
402
|
+
"returnType": {
|
|
403
|
+
"__schema": "TypeRefSchema",
|
|
404
|
+
"location": {
|
|
405
|
+
"filePath": "parser-helper.ts",
|
|
406
|
+
"line": 77,
|
|
407
|
+
"character": 1
|
|
408
|
+
},
|
|
409
|
+
"name": "Specifier",
|
|
410
|
+
"internalFilePath": "parser-helper.ts"
|
|
411
|
+
},
|
|
412
|
+
"modifiers": [
|
|
413
|
+
"export"
|
|
414
|
+
]
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
"internals": [
|
|
418
|
+
{
|
|
419
|
+
"__schema": "TypeSchema",
|
|
420
|
+
"location": {
|
|
421
|
+
"filePath": "parser-helper.ts",
|
|
422
|
+
"line": 12,
|
|
423
|
+
"character": 1
|
|
424
|
+
},
|
|
425
|
+
"signature": "type Node = any",
|
|
426
|
+
"name": "Node",
|
|
427
|
+
"type": {
|
|
428
|
+
"__schema": "KeywordTypeSchema",
|
|
429
|
+
"location": {
|
|
430
|
+
"filePath": "parser-helper.ts",
|
|
431
|
+
"line": 12,
|
|
432
|
+
"character": 13
|
|
433
|
+
},
|
|
434
|
+
"name": "any"
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"__schema": "FunctionLikeSchema",
|
|
439
|
+
"location": {
|
|
440
|
+
"filePath": "parser-helper.ts",
|
|
441
|
+
"line": 14,
|
|
442
|
+
"character": 1
|
|
443
|
+
},
|
|
444
|
+
"signature": "function getStringValue(node: Node): any",
|
|
445
|
+
"name": "getStringValue",
|
|
446
|
+
"params": [
|
|
447
|
+
{
|
|
448
|
+
"__schema": "ParameterSchema",
|
|
449
|
+
"location": {
|
|
450
|
+
"filePath": "parser-helper.ts",
|
|
451
|
+
"line": 14,
|
|
452
|
+
"character": 25
|
|
453
|
+
},
|
|
454
|
+
"name": "node",
|
|
455
|
+
"type": {
|
|
456
|
+
"__schema": "TypeRefSchema",
|
|
457
|
+
"location": {
|
|
458
|
+
"filePath": "parser-helper.ts",
|
|
459
|
+
"line": 14,
|
|
460
|
+
"character": 31
|
|
461
|
+
},
|
|
462
|
+
"name": "Node",
|
|
463
|
+
"internalFilePath": "parser-helper.ts"
|
|
464
|
+
},
|
|
465
|
+
"isOptional": false,
|
|
466
|
+
"isSpread": false
|
|
467
|
+
}
|
|
468
|
+
],
|
|
469
|
+
"returnType": {
|
|
470
|
+
"__schema": "TypeRefSchema",
|
|
471
|
+
"location": {
|
|
472
|
+
"filePath": "parser-helper.ts",
|
|
473
|
+
"line": 14,
|
|
474
|
+
"character": 1
|
|
475
|
+
},
|
|
476
|
+
"name": "getStringValue",
|
|
477
|
+
"internalFilePath": "parser-helper.ts"
|
|
478
|
+
},
|
|
479
|
+
"modifiers": []
|
|
480
|
+
}
|
|
481
|
+
]
|
|
482
|
+
}
|
|
483
|
+
],
|
|
484
|
+
"componentId": {
|
|
485
|
+
"scope": "teambit.node",
|
|
486
|
+
"name": "deps-detectors/parser-helper",
|
|
487
|
+
"version": "1a92d8952a785d0b376833dda2a1d359e3e1af58"
|
|
488
|
+
},
|
|
489
|
+
"taggedModuleExports": []
|
|
490
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["teambit.node/deps-detectors/parser-helper-preview"]=r():e["teambit.node/deps-detectors/parser-helper-preview"]=r()}(self,(()=>(()=>{"use strict";var e={d:(r,o)=>{for(var n in o)e.o(o,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:o[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{compositions:()=>l,compositions_metadata:()=>m,overview:()=>d});var o={};e.r(o),e.d(o,{default:()=>c}),React;const n=MdxJsReact,t=TeambitMdxUiMdxScopeContext;var p=["components"];function i(){return i=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var n in o)({}).hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},i.apply(null,arguments)}var a={},s="wrapper";function c(e){var r=e.components,o=function(e,r){if(null==e)return{};var o,n,t=function(e,r){if(null==e)return{};var o={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(r.includes(n))continue;o[n]=e[n]}return o}(e,r);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)o=p[n],r.includes(o)||{}.propertyIsEnumerable.call(e,o)&&(t[o]=e[o])}return t}(e,p);return(0,n.mdx)(s,i({},a,o,{components:r,mdxType:"MDXLayout"}),(0,n.mdx)(t.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,n.mdx)("p",null,"API:"),(0,n.mdx)("pre",null,(0,n.mdx)("code",{parentName:"pre",className:"language-ts"},"import {\n getDependenciesFromMemberExpression,\n getDependenciesFromCallExpression,\n getSpecifierValueForImportDeclaration\n} from '@teambit/node.deps-detection.parser-helper';\n\ngetDependenciesFromMemberExpression(node)\ngetDependenciesFromCallExpression(node)\ngetSpecifierValueForImportDeclaration(specifier)\n"))))}c.isMDXComponent=!0;const l=[],d=[o],m={compositions:[]};return r})()));
|
package/README.md
DELETED