js-code-detector 0.0.52 → 0.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/services/DetectService.js +7 -1
- package/dist/cjs/services/projectServiceClass/ViteProjectService.d.ts +23 -0
- package/dist/cjs/services/projectServiceClass/ViteProjectService.js +142 -0
- package/dist/cjs/services/projectServiceClass/VueProjectService.js +1 -1
- package/dist/cjs/util/ast_util/AstKit.d.ts +5 -21
- package/dist/cjs/util/ast_util/AstKit.js +33 -524
- package/dist/cjs/util/ast_util/AstUtil.d.ts +2 -1
- package/dist/cjs/util/ast_util/AstUtil.js +14 -9
- package/dist/cjs/util/ast_util/getAstKitByFilePath.d.ts +1 -1
- package/dist/cjs/util/ast_util/getAstKitByFilePath.js +1 -1
- package/dist/cjs/util/ast_util/helper/collectDeclarationIdentifiers.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/collectDeclarationIdentifiers.js +31 -0
- package/dist/cjs/util/ast_util/helper/collectDependenceIds.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/collectDependenceIds.js +90 -0
- package/dist/cjs/util/ast_util/helper/collectDependenceIdsOfExportMembers.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/collectDependenceIdsOfExportMembers.js +44 -0
- package/dist/cjs/util/ast_util/helper/collectEffectId.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/collectEffectId.js +26 -0
- package/dist/cjs/util/ast_util/helper/collectExpressionIdentifiersShallow.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/collectExpressionIdentifiersShallow.js +39 -0
- package/dist/cjs/util/ast_util/helper/collectHoldingIds.d.ts +4 -0
- package/dist/cjs/util/ast_util/helper/collectHoldingIds.js +110 -0
- package/dist/cjs/util/ast_util/helper/collectImportDeclarationIdentifiers.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/collectImportDeclarationIdentifiers.js +38 -0
- package/dist/cjs/util/ast_util/helper/collectVariableDeclarationIdentifiers.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/collectVariableDeclarationIdentifiers.js +43 -0
- package/dist/cjs/util/ast_util/helper/createAstNodeExt.d.ts +40 -0
- package/dist/cjs/util/ast_util/helper/createAstNodeExt.js +54 -0
- package/dist/cjs/util/ast_util/helper/deepFirstTravel.d.ts +9 -0
- package/dist/cjs/util/ast_util/helper/deepFirstTravel.js +142 -0
- package/dist/cjs/util/ast_util/helper/deepSearchParamsIdentifier.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/deepSearchParamsIdentifier.js +55 -0
- package/dist/cjs/util/ast_util/helper/findOrCreateExportedMember.d.ts +9 -0
- package/dist/cjs/util/ast_util/helper/findOrCreateExportedMember.js +32 -0
- package/dist/cjs/util/ast_util/helper/findOrCreateImportedMember.d.ts +8 -0
- package/dist/cjs/util/ast_util/helper/findOrCreateImportedMember.js +32 -0
- package/dist/cjs/util/ast_util/helper/getExportedNameOfAncestor.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/getExportedNameOfAncestor.js +113 -0
- package/dist/cjs/util/ast_util/helper/getExportedNameOfDeclarationIdentifier.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/getExportedNameOfDeclarationIdentifier.js +40 -0
- package/dist/cjs/util/ast_util/helper/getImpactedNode.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/getImpactedNode.js +50 -0
- package/dist/cjs/util/ast_util/helper/getNearestImpactedNode.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/getNearestImpactedNode.js +43 -0
- package/dist/cjs/util/ast_util/helper/getNodePath.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/getNodePath.js +27 -0
- package/dist/cjs/util/ast_util/helper/getShortNodeMsg.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/getShortNodeMsg.js +38 -0
- package/dist/cjs/util/ast_util/helper/getTopScopeNodesByLineNumberRange.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/getTopScopeNodesByLineNumberRange.js +51 -0
- package/dist/cjs/util/ast_util/helper/isIdentifierUntracked.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/isIdentifierUntracked.js +39 -0
- package/dist/cjs/util/ast_util/helper/isValidArrayNodeCollect.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/isValidArrayNodeCollect.js +27 -0
- package/dist/cjs/util/ast_util/helper/isValidNodeCollect.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/isValidNodeCollect.js +27 -0
- package/dist/cjs/util/ast_util/helper/syncTravel.d.ts +11 -0
- package/dist/cjs/util/ast_util/helper/syncTravel.js +325 -0
- package/dist/cjs/util/ast_util/helper/updateImportedAndExportedMember.d.ts +2 -0
- package/dist/cjs/util/ast_util/helper/updateImportedAndExportedMember.js +135 -0
- package/dist/cjs/util/ast_util/helper/updateLoc.d.ts +6 -0
- package/dist/cjs/util/ast_util/helper/updateLoc.js +74 -0
- package/dist/cjs/util/project_umi_util/isVueEntryFile.d.ts +1 -0
- package/dist/cjs/util/project_umi_util/isVueEntryFile.js +57 -0
- package/dist/cjs/util/project_umi_util/tsConfigPathsToWebpackAlias.d.ts +10 -0
- package/dist/cjs/util/project_umi_util/tsConfigPathsToWebpackAlias.js +80 -0
- package/dist/cjs/util/report_util/filterEffectedCode.d.ts +1 -1
- package/dist/cjs/util/report_util/filterEffectedExportMember.d.ts +2 -0
- package/dist/cjs/util/report_util/filterEffectedExportMember.js +9 -1
- package/dist/cjs/util/report_util/generateGitDiffReport.d.ts +1 -1
- package/dist/cjs/util/report_util.d.ts +1 -1
- package/dist/cjs/util/shared/getMajorVersion.d.ts +1 -0
- package/dist/cjs/util/shared/getMajorVersion.js +37 -0
- package/dist/cjs/util/shared/getRepoSupportFlag.d.ts +1 -1
- package/dist/cjs/util/shared/getRepoSupportFlag.js +8 -3
- package/dist/cjs/util/shared/gitDiffTool.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/util/ast_util/helper/collectDeclarationIdentifiers.ts
|
|
20
|
+
var collectDeclarationIdentifiers_exports = {};
|
|
21
|
+
__export(collectDeclarationIdentifiers_exports, {
|
|
22
|
+
default: () => collectDeclarationIdentifiers
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(collectDeclarationIdentifiers_exports);
|
|
25
|
+
var import_SHARED_CONSTANTS = require("../SHARED_CONSTANTS");
|
|
26
|
+
function collectDeclarationIdentifiers(node, callback) {
|
|
27
|
+
if (!import_SHARED_CONSTANTS.EXPORT_DECLARATION_TYPES.includes(node.type))
|
|
28
|
+
return;
|
|
29
|
+
const id = node.id;
|
|
30
|
+
id && callback(id);
|
|
31
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/util/ast_util/helper/collectDependenceIds.ts
|
|
30
|
+
var collectDependenceIds_exports = {};
|
|
31
|
+
__export(collectDependenceIds_exports, {
|
|
32
|
+
default: () => collectDependenceIds
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(collectDependenceIds_exports);
|
|
35
|
+
var import_intrinsicElements = require("../intrinsicElements");
|
|
36
|
+
var import_windowProperties = require("../windowProperties");
|
|
37
|
+
var import_collectDependenceIdsOfExportMembers = __toESM(require("./collectDependenceIdsOfExportMembers"));
|
|
38
|
+
var import_collectExpressionIdentifiersShallow = __toESM(require("./collectExpressionIdentifiersShallow"));
|
|
39
|
+
function collectDependenceIds(node) {
|
|
40
|
+
const { _util } = node;
|
|
41
|
+
const { dependenceIds, holdingIdNameMap, children, dependenceIdsNoScope, holdingIds } = _util;
|
|
42
|
+
children.forEach((child) => {
|
|
43
|
+
if (child._util.dependenceIdsNoScope.size > 0) {
|
|
44
|
+
child._util.dependenceIdsNoScope.forEach((id) => dependenceIds.add(id));
|
|
45
|
+
}
|
|
46
|
+
(0, import_collectDependenceIdsOfExportMembers.default)(child, (id) => dependenceIds.add(id));
|
|
47
|
+
(0, import_collectExpressionIdentifiersShallow.default)(child, (exp) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
if (exp.type === "ThisExpression" || exp._util.holdingIdType || ["imported", "exported"].includes(exp._util.parentProperty))
|
|
50
|
+
return;
|
|
51
|
+
if (exp.type === "Identifier") {
|
|
52
|
+
if ((exp._util.parentProperty === "property" || exp._util.parentProperty === "key") && !((_a = exp._util.parent) == null ? void 0 : _a.computed))
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (exp.type === "JSXIdentifier" && ((_b = exp._util.parent) == null ? void 0 : _b.type) === "JSXAttribute")
|
|
56
|
+
return;
|
|
57
|
+
dependenceIds.add(exp);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
for (const dependenceId of [...dependenceIds]) {
|
|
61
|
+
if (!dependenceId._util) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (holdingIds.has(dependenceId)) {
|
|
65
|
+
dependenceIds.delete(dependenceId);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (dependenceId._util.variableScope.length === 0 && typeof dependenceId.name === "string" && holdingIdNameMap.has(dependenceId.name)) {
|
|
69
|
+
dependenceId._util.variableScope.push(...holdingIdNameMap.get(dependenceId.name));
|
|
70
|
+
const firstPick = dependenceId._util.variableScope[0];
|
|
71
|
+
if (firstPick && firstPick._util.uuid !== dependenceId._util.uuid) {
|
|
72
|
+
firstPick._util.occupation.add(dependenceId);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (dependenceId._util.variableScope.length === 0) {
|
|
76
|
+
dependenceIdsNoScope.add(dependenceId);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (node.type === "Program") {
|
|
80
|
+
for (const dependenceId of [...dependenceIdsNoScope]) {
|
|
81
|
+
if (dependenceId.type === "JSXIdentifier" && import_intrinsicElements.intrinsicElements.includes(dependenceId.name)) {
|
|
82
|
+
dependenceIdsNoScope.delete(dependenceId);
|
|
83
|
+
dependenceIds.delete(dependenceId);
|
|
84
|
+
} else if (dependenceId.type === "Identifier" && import_windowProperties.windowProperties.includes(dependenceId.name)) {
|
|
85
|
+
dependenceIdsNoScope.delete(dependenceId);
|
|
86
|
+
dependenceIds.delete(dependenceId);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/util/ast_util/helper/collectDependenceIdsOfExportMembers.ts
|
|
20
|
+
var collectDependenceIdsOfExportMembers_exports = {};
|
|
21
|
+
__export(collectDependenceIdsOfExportMembers_exports, {
|
|
22
|
+
default: () => collectDependenceIdsOfExportMembers
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(collectDependenceIdsOfExportMembers_exports);
|
|
25
|
+
function collectDependenceIdsOfExportMembers(node, callback) {
|
|
26
|
+
if (node.type === "ExportNamedDeclaration") {
|
|
27
|
+
const { declaration, specifiers } = node;
|
|
28
|
+
if ((declaration == null ? void 0 : declaration.type) === "Identifier") {
|
|
29
|
+
callback(declaration);
|
|
30
|
+
}
|
|
31
|
+
for (const specifier of specifiers) {
|
|
32
|
+
const { local } = specifier;
|
|
33
|
+
if ((local == null ? void 0 : local.type) === "Identifier") {
|
|
34
|
+
callback(local);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (node.type === "ExportDefaultDeclaration") {
|
|
39
|
+
const declaration = node.declaration;
|
|
40
|
+
if ((declaration == null ? void 0 : declaration.type) === "Identifier") {
|
|
41
|
+
callback(declaration);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/util/ast_util/helper/collectEffectId.ts
|
|
20
|
+
var collectEffectId_exports = {};
|
|
21
|
+
__export(collectEffectId_exports, {
|
|
22
|
+
default: () => collectEffectId
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(collectEffectId_exports);
|
|
25
|
+
function collectEffectId(child) {
|
|
26
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/util/ast_util/helper/collectExpressionIdentifiersShallow.ts
|
|
20
|
+
var collectExpressionIdentifiersShallow_exports = {};
|
|
21
|
+
__export(collectExpressionIdentifiersShallow_exports, {
|
|
22
|
+
default: () => collectExpressionIdentifiersShallow
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(collectExpressionIdentifiersShallow_exports);
|
|
25
|
+
function collectExpressionIdentifiersShallow(exp, callback) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
if (!exp || exp.type === "ThisExpression" || exp._util.holdingIdType)
|
|
28
|
+
return;
|
|
29
|
+
if (exp.type === "Identifier") {
|
|
30
|
+
if ((exp._util.parentProperty === "property" || exp._util.parentProperty === "key") && !((_a = exp._util.parent) == null ? void 0 : _a.computed))
|
|
31
|
+
return;
|
|
32
|
+
callback(exp);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (exp.type === "JSXIdentifier" && ((_b = exp._util.parent) == null ? void 0 : _b.type) !== "JSXAttribute") {
|
|
36
|
+
callback(exp);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/util/ast_util/helper/collectHoldingIds.ts
|
|
30
|
+
var collectHoldingIds_exports = {};
|
|
31
|
+
__export(collectHoldingIds_exports, {
|
|
32
|
+
default: () => collectHoldingIds
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(collectHoldingIds_exports);
|
|
35
|
+
var import_SHARED_CONSTANTS = require("../SHARED_CONSTANTS");
|
|
36
|
+
var import_collectDeclarationIdentifiers = __toESM(require("./collectDeclarationIdentifiers"));
|
|
37
|
+
var import_collectImportDeclarationIdentifiers = __toESM(require("./collectImportDeclarationIdentifiers"));
|
|
38
|
+
var import_collectVariableDeclarationIdentifiers = __toESM(require("./collectVariableDeclarationIdentifiers"));
|
|
39
|
+
var import_deepSearchParamsIdentifier = __toESM(require("./deepSearchParamsIdentifier"));
|
|
40
|
+
function collectHoldingIds(node) {
|
|
41
|
+
const { holdingIds, holdingIdNameMap } = node._util;
|
|
42
|
+
if (import_SHARED_CONSTANTS.FUNCTION_TYPES.includes(node.type)) {
|
|
43
|
+
const { params, id } = node;
|
|
44
|
+
if (Array.isArray(params) && params.length > 0) {
|
|
45
|
+
params.forEach((param) => (0, import_deepSearchParamsIdentifier.default)(param, (id2) => {
|
|
46
|
+
holdingIds.add(id2 || node);
|
|
47
|
+
id2._util.variableScope = [id2];
|
|
48
|
+
id2._util.holdingIdType = "Param";
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
if (node.body && node.body.type === "BlockStatement") {
|
|
52
|
+
node.body._util.holdingIds.forEach((id2) => {
|
|
53
|
+
holdingIds.add(id2);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
(0, import_collectImportDeclarationIdentifiers.default)(node, (id) => {
|
|
58
|
+
holdingIds.add(id);
|
|
59
|
+
id._util.variableScope = [id];
|
|
60
|
+
id._util.holdingIdType = "Import";
|
|
61
|
+
});
|
|
62
|
+
if (["BlockStatement", "Program"].includes(node.type)) {
|
|
63
|
+
const body = node.body;
|
|
64
|
+
Array.isArray(body) && body.forEach((bodyChild) => {
|
|
65
|
+
(0, import_collectVariableDeclarationIdentifiers.default)(bodyChild, (id) => {
|
|
66
|
+
holdingIds.add(id);
|
|
67
|
+
id._util.variableScope = [id];
|
|
68
|
+
id._util.holdingIdType = "Variable";
|
|
69
|
+
});
|
|
70
|
+
if (import_SHARED_CONSTANTS.EXPORT_DECLARATION_TYPES.includes(bodyChild.type)) {
|
|
71
|
+
(0, import_collectDeclarationIdentifiers.default)(bodyChild, (id) => {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
holdingIds.add(id);
|
|
74
|
+
(_b = (_a = id._util.parent) == null ? void 0 : _a._util.holdingIds) == null ? void 0 : _b.add(id);
|
|
75
|
+
id._util.variableScope = [id];
|
|
76
|
+
id._util.holdingIdType = node.type.replace("Declaration", "");
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (["ExportNamedDeclaration", "ExportDefaultDeclaration"].includes(bodyChild.type)) {
|
|
80
|
+
const declaration = bodyChild.declaration;
|
|
81
|
+
if (declaration) {
|
|
82
|
+
if (declaration.type === "VariableDeclaration") {
|
|
83
|
+
(0, import_collectVariableDeclarationIdentifiers.default)(declaration, (id) => {
|
|
84
|
+
holdingIds.add(id);
|
|
85
|
+
id._util.variableScope = [id];
|
|
86
|
+
id._util.holdingIdType = "Variable";
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
(0, import_collectDeclarationIdentifiers.default)(declaration, (id) => {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
holdingIds.add(id);
|
|
92
|
+
(_b = (_a = id._util.parent) == null ? void 0 : _a._util.holdingIds) == null ? void 0 : _b.add(id);
|
|
93
|
+
id._util.variableScope = [id];
|
|
94
|
+
id._util.holdingIdType = declaration.type.replace("Declaration", "");
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
;
|
|
102
|
+
holdingIds.forEach((holdingId) => {
|
|
103
|
+
const holdingIdName = holdingId.name;
|
|
104
|
+
if (typeof holdingIdName !== "string")
|
|
105
|
+
return;
|
|
106
|
+
const nodeSetOfIdName = holdingIdNameMap.get(holdingIdName) || /* @__PURE__ */ new Set();
|
|
107
|
+
nodeSetOfIdName.add(holdingId);
|
|
108
|
+
holdingIdNameMap.set(holdingIdName, nodeSetOfIdName);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/util/ast_util/helper/collectImportDeclarationIdentifiers.ts
|
|
20
|
+
var collectImportDeclarationIdentifiers_exports = {};
|
|
21
|
+
__export(collectImportDeclarationIdentifiers_exports, {
|
|
22
|
+
default: () => collectImportDeclarationIdentifiers
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(collectImportDeclarationIdentifiers_exports);
|
|
25
|
+
function collectImportDeclarationIdentifiers(node, callback) {
|
|
26
|
+
if (node.type !== "Program")
|
|
27
|
+
return;
|
|
28
|
+
const { body } = node;
|
|
29
|
+
Array.isArray(body) && body.forEach((node2) => {
|
|
30
|
+
if (node2.type === "ImportDeclaration") {
|
|
31
|
+
const specifiers = node2.specifiers;
|
|
32
|
+
for (const specifier of specifiers) {
|
|
33
|
+
const local = specifier.local;
|
|
34
|
+
callback(local);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/util/ast_util/helper/collectVariableDeclarationIdentifiers.ts
|
|
30
|
+
var collectVariableDeclarationIdentifiers_exports = {};
|
|
31
|
+
__export(collectVariableDeclarationIdentifiers_exports, {
|
|
32
|
+
default: () => collectVariableDeclarationIdentifiers
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(collectVariableDeclarationIdentifiers_exports);
|
|
35
|
+
var import_deepSearchParamsIdentifier = __toESM(require("./deepSearchParamsIdentifier"));
|
|
36
|
+
function collectVariableDeclarationIdentifiers(node, callback) {
|
|
37
|
+
if (node.type !== "VariableDeclaration")
|
|
38
|
+
return;
|
|
39
|
+
const declarations = node.declarations;
|
|
40
|
+
for (const declaration of declarations) {
|
|
41
|
+
(0, import_deepSearchParamsIdentifier.default)(declaration.id, callback);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AstNode } from "../AstUtil";
|
|
2
|
+
export default function createAstNodeExt(ext: Partial<AstNode['_util']>): {
|
|
3
|
+
startLine: number;
|
|
4
|
+
endLine: number;
|
|
5
|
+
startColumn: number;
|
|
6
|
+
endColumn: number;
|
|
7
|
+
filePath: string;
|
|
8
|
+
parent: AstNode | null;
|
|
9
|
+
parentProperty: string;
|
|
10
|
+
indexOfProperty: number | null;
|
|
11
|
+
ancestors: AstNode[];
|
|
12
|
+
nodeCollection: AstNode[];
|
|
13
|
+
children: AstNode[];
|
|
14
|
+
uuid: string;
|
|
15
|
+
variableScope: AstNode[];
|
|
16
|
+
dependenceIds: Set<AstNode>;
|
|
17
|
+
dependenceIdsNoScope: Set<AstNode>;
|
|
18
|
+
holdingIds: Set<AstNode>;
|
|
19
|
+
holdingIdNameMap: Map<string, Set<AstNode>>;
|
|
20
|
+
holdingIdType: "Import" | "Variable" | "Function" | "Class" | "Param" | "Enum" | "Interface" | "TypeAlias" | null;
|
|
21
|
+
inject: Set<AstNode>;
|
|
22
|
+
provide: Set<AstNode>;
|
|
23
|
+
effectIds: Set<AstNode>;
|
|
24
|
+
occupation: Set<AstNode>;
|
|
25
|
+
importedMember: {
|
|
26
|
+
sourcePath: string;
|
|
27
|
+
members: {
|
|
28
|
+
importedName: string;
|
|
29
|
+
localName: string;
|
|
30
|
+
}[];
|
|
31
|
+
}[];
|
|
32
|
+
exportedMember: {
|
|
33
|
+
sourcePath: string;
|
|
34
|
+
members: {
|
|
35
|
+
exportedName: string;
|
|
36
|
+
localName: string;
|
|
37
|
+
}[];
|
|
38
|
+
ExportAllDeclaration: boolean;
|
|
39
|
+
}[];
|
|
40
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/util/ast_util/helper/createAstNodeExt.ts
|
|
20
|
+
var createAstNodeExt_exports = {};
|
|
21
|
+
__export(createAstNodeExt_exports, {
|
|
22
|
+
default: () => createAstNodeExt
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(createAstNodeExt_exports);
|
|
25
|
+
function createAstNodeExt(ext) {
|
|
26
|
+
const _util = {
|
|
27
|
+
startLine: NaN,
|
|
28
|
+
endLine: NaN,
|
|
29
|
+
startColumn: NaN,
|
|
30
|
+
endColumn: NaN,
|
|
31
|
+
filePath: "",
|
|
32
|
+
parent: null,
|
|
33
|
+
parentProperty: "",
|
|
34
|
+
indexOfProperty: null,
|
|
35
|
+
ancestors: [],
|
|
36
|
+
nodeCollection: [],
|
|
37
|
+
children: [],
|
|
38
|
+
uuid: "",
|
|
39
|
+
variableScope: [],
|
|
40
|
+
dependenceIds: /* @__PURE__ */ new Set(),
|
|
41
|
+
dependenceIdsNoScope: /* @__PURE__ */ new Set(),
|
|
42
|
+
holdingIdType: null,
|
|
43
|
+
holdingIds: /* @__PURE__ */ new Set(),
|
|
44
|
+
holdingIdNameMap: /* @__PURE__ */ new Map(),
|
|
45
|
+
inject: /* @__PURE__ */ new Set(),
|
|
46
|
+
provide: /* @__PURE__ */ new Set(),
|
|
47
|
+
effectIds: /* @__PURE__ */ new Set(),
|
|
48
|
+
occupation: /* @__PURE__ */ new Set(),
|
|
49
|
+
importedMember: [],
|
|
50
|
+
exportedMember: []
|
|
51
|
+
};
|
|
52
|
+
Object.assign(_util, ext);
|
|
53
|
+
return _util;
|
|
54
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AstNode } from "../AstUtil";
|
|
2
|
+
export default function deepFirstTravel(node: AstNode, visitedNodeSet: Set<typeof node>, extra: {
|
|
3
|
+
filePath: string;
|
|
4
|
+
depth: number;
|
|
5
|
+
mapUuidToNode: Map<string, AstNode>;
|
|
6
|
+
mapFileLineToNodeSet: Map<number, Set<AstNode>>;
|
|
7
|
+
mapPathToNodeSet: Map<string, Set<AstNode>>;
|
|
8
|
+
stopTravelCallback?: (node: AstNode) => boolean | void;
|
|
9
|
+
}): AstNode;
|