@kuafucloud/repo-kit 0.0.0-stage → 0.2.2-alpha.3
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/LICENSE.md +9 -0
- package/assets/git-hooks/check-push.cjs +21 -0
- package/assets/git-hooks/pre-push +7 -0
- package/assets/git-hooks/prepare-commit-msg +5 -0
- package/assets/verification/heavy-test-admission-core.d.mts +1 -0
- package/assets/verification/heavy-test-admission-core.mjs +10 -0
- package/assets/verification/host-process-lock.d.mts +24 -0
- package/assets/verification/host-process-lock.mjs +140 -0
- package/assets/verification/test-heavy-admission.d.mts +4 -0
- package/assets/verification/test-heavy-admission.mjs +34 -0
- package/bin/kuafu-guard.mjs +3 -0
- package/bin/kuafu-verify.mjs +3 -0
- package/dist/cli/guard.d.ts +1 -0
- package/dist/cli/guard.js +59 -0
- package/dist/cli/verify.d.ts +1 -0
- package/dist/cli/verify.js +58 -0
- package/dist/guard/core/config.d.ts +7 -0
- package/dist/guard/core/config.js +159 -0
- package/dist/guard/core/engine.d.ts +2 -0
- package/dist/guard/core/engine.js +151 -0
- package/dist/guard/core/formatters/sarif-rules.d.ts +2 -0
- package/dist/guard/core/formatters/sarif-rules.js +67 -0
- package/dist/guard/core/formatters/sarif.d.ts +2 -0
- package/dist/guard/core/formatters/sarif.js +3 -0
- package/dist/guard/core/formatters/text.d.ts +2 -0
- package/dist/guard/core/formatters/text.js +22 -0
- package/dist/guard/core/index.d.ts +5 -0
- package/dist/guard/core/index.js +5 -0
- package/dist/guard/core/types.d.ts +94 -0
- package/dist/guard/core/types.js +1 -0
- package/dist/guard/hooks/install-rules.d.ts +2 -0
- package/dist/guard/hooks/install-rules.js +5 -0
- package/dist/guard/hooks/install.d.ts +36 -0
- package/dist/guard/hooks/install.js +212 -0
- package/dist/guard/hooks/push.d.ts +1 -0
- package/dist/guard/hooks/push.js +5 -0
- package/dist/guard/index.d.ts +16 -0
- package/dist/guard/index.js +16 -0
- package/dist/guard/product-roots.d.ts +12 -0
- package/dist/guard/product-roots.js +37 -0
- package/dist/guard/repo-args.d.ts +8 -0
- package/dist/guard/repo-args.js +75 -0
- package/dist/guard/repo-output-rules.d.ts +12 -0
- package/dist/guard/repo-output-rules.js +44 -0
- package/dist/guard/repo.d.ts +21 -0
- package/dist/guard/repo.js +74 -0
- package/dist/guard/rules/external/api/collect-orphan-tests.d.ts +2 -0
- package/dist/guard/rules/external/api/collect-orphan-tests.js +34 -0
- package/dist/guard/rules/external/api/collect.d.ts +2 -0
- package/dist/guard/rules/external/api/collect.js +419 -0
- package/dist/guard/rules/external/api/validate-orphan-tests.d.ts +2 -0
- package/dist/guard/rules/external/api/validate-orphan-tests.js +10 -0
- package/dist/guard/rules/external/api/validate.d.ts +2 -0
- package/dist/guard/rules/external/api/validate.js +278 -0
- package/dist/guard/rules/external/app/native-source-rules.d.ts +6 -0
- package/dist/guard/rules/external/app/native-source-rules.js +164 -0
- package/dist/guard/rules/external/app/validate-native-source-boundary.d.ts +2 -0
- package/dist/guard/rules/external/app/validate-native-source-boundary.js +187 -0
- package/dist/guard/rules/external/boundary/check.d.ts +4 -0
- package/dist/guard/rules/external/boundary/check.js +198 -0
- package/dist/guard/rules/external/extension/collect.d.ts +1 -0
- package/dist/guard/rules/external/extension/collect.js +1 -0
- package/dist/guard/rules/external/extension/electron-boundary-rules.d.ts +6 -0
- package/dist/guard/rules/external/extension/electron-boundary-rules.js +10 -0
- package/dist/guard/rules/external/extension/index.d.ts +6 -0
- package/dist/guard/rules/external/extension/index.js +29 -0
- package/dist/guard/rules/external/extension/manual-cross-call-rules.d.ts +19 -0
- package/dist/guard/rules/external/extension/manual-cross-call-rules.js +19 -0
- package/dist/guard/rules/external/extension/resolve-import.d.ts +1 -0
- package/dist/guard/rules/external/extension/resolve-import.js +43 -0
- package/dist/guard/rules/external/extension/scan-relative-dependencies.d.ts +5 -0
- package/dist/guard/rules/external/extension/scan-relative-dependencies.js +53 -0
- package/dist/guard/rules/external/extension/scan-source.d.ts +11 -0
- package/dist/guard/rules/external/extension/scan-source.js +25 -0
- package/dist/guard/rules/external/extension/source-import-boundary-rules.d.ts +26 -0
- package/dist/guard/rules/external/extension/source-import-boundary-rules.js +40 -0
- package/dist/guard/rules/external/extension/test-layer-import-rules.d.ts +1 -0
- package/dist/guard/rules/external/extension/test-layer-import-rules.js +16 -0
- package/dist/guard/rules/external/extension/types.d.ts +51 -0
- package/dist/guard/rules/external/extension/types.js +1 -0
- package/dist/guard/rules/external/extension/unused-export-rules.d.ts +23 -0
- package/dist/guard/rules/external/extension/unused-export-rules.js +119 -0
- package/dist/guard/rules/external/extension/unused-module-rules.d.ts +6 -0
- package/dist/guard/rules/external/extension/unused-module-rules.js +90 -0
- package/dist/guard/rules/external/extension/validate-admin.d.ts +8 -0
- package/dist/guard/rules/external/extension/validate-admin.js +73 -0
- package/dist/guard/rules/external/extension/validate-database.d.ts +3 -0
- package/dist/guard/rules/external/extension/validate-database.js +4 -0
- package/dist/guard/rules/external/extension/validate-electron-boundary.d.ts +2 -0
- package/dist/guard/rules/external/extension/validate-electron-boundary.js +18 -0
- package/dist/guard/rules/external/extension/validate-empty-dirs.d.ts +9 -0
- package/dist/guard/rules/external/extension/validate-empty-dirs.js +44 -0
- package/dist/guard/rules/external/extension/validate-extension-kit-server-boundary.d.ts +2 -0
- package/dist/guard/rules/external/extension/validate-extension-kit-server-boundary.js +116 -0
- package/dist/guard/rules/external/extension/validate-features.d.ts +7 -0
- package/dist/guard/rules/external/extension/validate-features.js +27 -0
- package/dist/guard/rules/external/extension/validate-manual-cross-extension-call.d.ts +2 -0
- package/dist/guard/rules/external/extension/validate-manual-cross-extension-call.js +131 -0
- package/dist/guard/rules/external/extension/validate-peer-extension-import.d.ts +2 -0
- package/dist/guard/rules/external/extension/validate-peer-extension-import.js +41 -0
- package/dist/guard/rules/external/extension/validate-server-cross-domain-import.d.ts +2 -0
- package/dist/guard/rules/external/extension/validate-server-cross-domain-import.js +48 -0
- package/dist/guard/rules/external/extension/validate-server-index-api-entry-satisfies.d.ts +1 -0
- package/dist/guard/rules/external/extension/validate-server-index-api-entry-satisfies.js +1 -0
- package/dist/guard/rules/external/extension/validate-shared-import-boundary.d.ts +2 -0
- package/dist/guard/rules/external/extension/validate-shared-import-boundary.js +40 -0
- package/dist/guard/rules/external/extension/validate-shared.d.ts +1 -0
- package/dist/guard/rules/external/extension/validate-shared.js +1 -0
- package/dist/guard/rules/external/extension/validate-test-layer-boundary.d.ts +8 -0
- package/dist/guard/rules/external/extension/validate-test-layer-boundary.js +59 -0
- package/dist/guard/rules/external/extension/validate-test-mirror.d.ts +4 -0
- package/dist/guard/rules/external/extension/validate-test-mirror.js +32 -0
- package/dist/guard/rules/external/extension/validate-top-level.d.ts +7 -0
- package/dist/guard/rules/external/extension/validate-top-level.js +76 -0
- package/dist/guard/rules/external/extension/validate-unused-export.d.ts +2 -0
- package/dist/guard/rules/external/extension/validate-unused-export.js +187 -0
- package/dist/guard/rules/external/extension/validate-unused-module.d.ts +2 -0
- package/dist/guard/rules/external/extension/validate-unused-module.js +38 -0
- package/dist/guard/rules/external/index.d.ts +1 -0
- package/dist/guard/rules/external/index.js +1 -0
- package/dist/guard/rules/external/npm-dependency-policy.d.ts +22 -0
- package/dist/guard/rules/external/npm-dependency-policy.js +294 -0
- package/dist/guard/rules/external/rules.d.ts +2 -0
- package/dist/guard/rules/external/rules.js +231 -0
- package/dist/guard/rules/external/shared/config.d.ts +3 -0
- package/dist/guard/rules/external/shared/config.js +14 -0
- package/dist/guard/rules/external/shared/diagnostic.d.ts +4 -0
- package/dist/guard/rules/external/shared/diagnostic.js +12 -0
- package/dist/guard/rules/external/shared/records.d.ts +4 -0
- package/dist/guard/rules/external/shared/records.js +46 -0
- package/dist/guard/rules/external/shared/ts-ast.d.ts +8 -0
- package/dist/guard/rules/external/shared/ts-ast.js +103 -0
- package/dist/guard/rules/external/shared/types.d.ts +159 -0
- package/dist/guard/rules/external/shared/types.js +1 -0
- package/dist/guard/rules/external/shared/validate-layer-key.d.ts +2 -0
- package/dist/guard/rules/external/shared/validate-layer-key.js +35 -0
- package/dist/guard/rules/external/story-rules.d.ts +15 -0
- package/dist/guard/rules/external/story-rules.js +59 -0
- package/dist/guard/rules/shared/extension/api-entry-tuple-rules.d.ts +7 -0
- package/dist/guard/rules/shared/extension/api-entry-tuple-rules.js +6 -0
- package/dist/guard/rules/shared/extension/collect.d.ts +5 -0
- package/dist/guard/rules/shared/extension/collect.js +231 -0
- package/dist/guard/rules/shared/extension/database-reference-rules.d.ts +4 -0
- package/dist/guard/rules/shared/extension/database-reference-rules.js +5 -0
- package/dist/guard/rules/shared/extension/database-source-rules.d.ts +17 -0
- package/dist/guard/rules/shared/extension/database-source-rules.js +595 -0
- package/dist/guard/rules/shared/extension/database-structure-rules.d.ts +3 -0
- package/dist/guard/rules/shared/extension/database-structure-rules.js +63 -0
- package/dist/guard/rules/shared/extension/server-index-source-rules.d.ts +2 -0
- package/dist/guard/rules/shared/extension/server-index-source-rules.js +91 -0
- package/dist/guard/rules/shared/extension/shared-consumer-rules.d.ts +23 -0
- package/dist/guard/rules/shared/extension/shared-consumer-rules.js +158 -0
- package/dist/guard/rules/shared/extension/shared-structure-rules.d.ts +6 -0
- package/dist/guard/rules/shared/extension/shared-structure-rules.js +27 -0
- package/dist/guard/rules/shared/extension/validate-database.d.ts +4 -0
- package/dist/guard/rules/shared/extension/validate-database.js +15 -0
- package/dist/guard/rules/shared/extension/validate-server-index-api-entry-satisfies.d.ts +2 -0
- package/dist/guard/rules/shared/extension/validate-server-index-api-entry-satisfies.js +9 -0
- package/dist/guard/rules/shared/extension/validate-shared.d.ts +18 -0
- package/dist/guard/rules/shared/extension/validate-shared.js +149 -0
- package/dist/host-protocol.d.ts +2 -0
- package/dist/host-protocol.js +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/verify/artifact-recovery-rules.d.ts +39 -0
- package/dist/verify/artifact-recovery-rules.js +48 -0
- package/dist/verify/artifact-session.d.ts +91 -0
- package/dist/verify/artifact-session.js +443 -0
- package/dist/verify/checkout-environment-rules.d.ts +2 -0
- package/dist/verify/checkout-environment-rules.js +25 -0
- package/dist/verify/checkout-environment.d.ts +8 -0
- package/dist/verify/checkout-environment.js +24 -0
- package/dist/verify/commit-candidate-rules.d.ts +3 -0
- package/dist/verify/commit-candidate-rules.js +33 -0
- package/dist/verify/commit-gate.d.ts +64 -0
- package/dist/verify/commit-gate.js +207 -0
- package/dist/verify/delivery-verification.d.ts +3 -0
- package/dist/verify/delivery-verification.js +21 -0
- package/dist/verify/e2e-registry-rules.d.ts +21 -0
- package/dist/verify/e2e-registry-rules.js +33 -0
- package/dist/verify/e2e-registry.d.ts +2 -0
- package/dist/verify/e2e-registry.js +45 -0
- package/dist/verify/full-command.d.ts +35 -0
- package/dist/verify/full-command.js +138 -0
- package/dist/verify/impact-plan-rules.d.ts +61 -0
- package/dist/verify/impact-plan-rules.js +185 -0
- package/dist/verify/impact-plan.d.ts +10 -0
- package/dist/verify/impact-plan.js +151 -0
- package/dist/verify/index.d.ts +22 -0
- package/dist/verify/index.js +22 -0
- package/dist/verify/repository-recipe-rules.d.ts +31 -0
- package/dist/verify/repository-recipe-rules.js +60 -0
- package/dist/verify/repository-recipe.d.ts +3 -0
- package/dist/verify/repository-recipe.js +58 -0
- package/dist/verify/static-validation-rules.d.ts +7 -0
- package/dist/verify/static-validation-rules.js +36 -0
- package/dist/verify/story-selection-rules.d.ts +57 -0
- package/dist/verify/story-selection-rules.js +125 -0
- package/dist/verify/types.d.ts +63 -0
- package/dist/verify/types.js +18 -0
- package/dist/verify/verification-candidate.d.ts +1 -0
- package/dist/verify/verification-candidate.js +20 -0
- package/dist/verify/verification-identity.d.ts +6 -0
- package/dist/verify/verification-identity.js +26 -0
- package/dist/verify/verification-proof-rules.d.ts +35 -0
- package/dist/verify/verification-proof-rules.js +45 -0
- package/dist/verify/verify-full-command-rules.d.ts +18 -0
- package/dist/verify/verify-full-command-rules.js +77 -0
- package/dist/verify/verify-full-runner.d.ts +32 -0
- package/dist/verify/verify-full-runner.js +251 -0
- package/package.json +115 -4
- package/README.md +0 -3
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { toGuardDiagnostics } from "../shared/diagnostic.js";
|
|
2
|
+
import { promises as fs } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
const WORKSPACE_ROOTS = ["products", "packages", "docs"];
|
|
5
|
+
const IGNORED_DIRECTORY_NAMES = new Set([
|
|
6
|
+
"node_modules",
|
|
7
|
+
".git",
|
|
8
|
+
".nx",
|
|
9
|
+
".turbo",
|
|
10
|
+
"dist",
|
|
11
|
+
"coverage",
|
|
12
|
+
]);
|
|
13
|
+
const LAYER_ORDER = new Map([
|
|
14
|
+
["@kuafucloud/product-runtime-protocol", 0],
|
|
15
|
+
["@kuafucloud/app-runtime", 1],
|
|
16
|
+
["@kuafucloud/site-runtime", 1],
|
|
17
|
+
["@kuafucloud/mini-program-runtime", 1],
|
|
18
|
+
["@kuafucloud/extension-kit", 1],
|
|
19
|
+
["@kuafucloud/center", 3],
|
|
20
|
+
["@kuafucloud/system", 3],
|
|
21
|
+
["@kuafucloud/web", 4],
|
|
22
|
+
]);
|
|
23
|
+
const ALLOWED_REVERSE_EDGES = new Set();
|
|
24
|
+
export async function collectDependencyBoundaryIssues(workspaceRoot) {
|
|
25
|
+
const packages = await collectWorkspacePackages(workspaceRoot);
|
|
26
|
+
const packageByName = new Map(packages.map((item) => [item.name, item]));
|
|
27
|
+
const issues = [];
|
|
28
|
+
for (const pkg of packages) {
|
|
29
|
+
for (const dependency of pkg.dependencies) {
|
|
30
|
+
if (!packageByName.has(dependency)) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const edgeKey = `${pkg.name}->${dependency}`;
|
|
34
|
+
const fromLayer = LAYER_ORDER.get(pkg.name);
|
|
35
|
+
const toLayer = LAYER_ORDER.get(dependency);
|
|
36
|
+
if (fromLayer !== undefined &&
|
|
37
|
+
toLayer !== undefined &&
|
|
38
|
+
toLayer > fromLayer &&
|
|
39
|
+
!ALLOWED_REVERSE_EDGES.has(edgeKey)) {
|
|
40
|
+
issues.push({
|
|
41
|
+
rule: "dependency-boundary-layer-direction",
|
|
42
|
+
filePath: `${pkg.relativePackageDir}/package.json`,
|
|
43
|
+
lineNumber: 1,
|
|
44
|
+
message: [
|
|
45
|
+
`Workspace package "${pkg.name}" cannot depend on higher-layer package "${dependency}".`,
|
|
46
|
+
"请按依赖分层方向自底向上依赖。",
|
|
47
|
+
].join(" "),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (fromLayer !== undefined &&
|
|
51
|
+
toLayer !== undefined &&
|
|
52
|
+
fromLayer === toLayer &&
|
|
53
|
+
fromLayer === 4 &&
|
|
54
|
+
pkg.name !== dependency) {
|
|
55
|
+
issues.push({
|
|
56
|
+
rule: "dependency-boundary-extension-no-cross-import",
|
|
57
|
+
filePath: `${pkg.relativePackageDir}/package.json`,
|
|
58
|
+
lineNumber: 1,
|
|
59
|
+
message: `Extension package "${pkg.name}" cannot depend on same-layer extension "${dependency}".`,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
issues.push(...detectCycles(packages));
|
|
65
|
+
return issues;
|
|
66
|
+
}
|
|
67
|
+
function detectCycles(packages) {
|
|
68
|
+
const packageByName = new Map(packages.map((item) => [item.name, item]));
|
|
69
|
+
const adjacency = new Map(packages.map((item) => [
|
|
70
|
+
item.name,
|
|
71
|
+
item.dependencies.filter((dependency) => packageByName.has(dependency)),
|
|
72
|
+
]));
|
|
73
|
+
const issues = [];
|
|
74
|
+
const visiting = new Set();
|
|
75
|
+
const visited = new Set();
|
|
76
|
+
const stack = [];
|
|
77
|
+
const visit = (name) => {
|
|
78
|
+
if (visiting.has(name)) {
|
|
79
|
+
const start = stack.indexOf(name);
|
|
80
|
+
const cycle = [...stack.slice(start), name];
|
|
81
|
+
const owner = packageByName.get(name);
|
|
82
|
+
issues.push({
|
|
83
|
+
rule: "dependency-boundary-cycle",
|
|
84
|
+
filePath: owner
|
|
85
|
+
? `${owner.relativePackageDir}/package.json`
|
|
86
|
+
: "package.json",
|
|
87
|
+
lineNumber: 1,
|
|
88
|
+
message: `Dependency cycle detected: ${cycle.join(" -> ")}.`,
|
|
89
|
+
});
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (visited.has(name)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
visiting.add(name);
|
|
96
|
+
stack.push(name);
|
|
97
|
+
for (const next of adjacency.get(name) ?? []) {
|
|
98
|
+
visit(next);
|
|
99
|
+
}
|
|
100
|
+
stack.pop();
|
|
101
|
+
visiting.delete(name);
|
|
102
|
+
visited.add(name);
|
|
103
|
+
};
|
|
104
|
+
for (const pkg of packages) {
|
|
105
|
+
visit(pkg.name);
|
|
106
|
+
}
|
|
107
|
+
return dedupeIssueMessages(issues);
|
|
108
|
+
}
|
|
109
|
+
function dedupeIssueMessages(issues) {
|
|
110
|
+
const dedupe = new Set();
|
|
111
|
+
const results = [];
|
|
112
|
+
for (const issue of issues) {
|
|
113
|
+
const key = `${issue.rule}:${issue.message}`;
|
|
114
|
+
if (dedupe.has(key)) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
dedupe.add(key);
|
|
118
|
+
results.push(issue);
|
|
119
|
+
}
|
|
120
|
+
return results;
|
|
121
|
+
}
|
|
122
|
+
async function collectWorkspacePackages(workspaceRoot) {
|
|
123
|
+
const packages = [];
|
|
124
|
+
for (const root of WORKSPACE_ROOTS) {
|
|
125
|
+
const rootPath = path.join(workspaceRoot, root);
|
|
126
|
+
const discoveredPackageDirs = await collectPackageDirectories(rootPath);
|
|
127
|
+
for (const packageDir of discoveredPackageDirs) {
|
|
128
|
+
const packageJsonPath = path.join(packageDir, "package.json");
|
|
129
|
+
let packageJson;
|
|
130
|
+
try {
|
|
131
|
+
packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (!packageJson.name) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
const dependencies = collectWorkspaceDependencyNames(packageJson.dependencies ?? {});
|
|
140
|
+
packages.push({
|
|
141
|
+
name: packageJson.name,
|
|
142
|
+
packageDir,
|
|
143
|
+
relativePackageDir: toPosixPath(path.relative(workspaceRoot, packageDir)),
|
|
144
|
+
dependencies,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return packages.sort((left, right) => left.name.localeCompare(right.name));
|
|
149
|
+
}
|
|
150
|
+
async function collectPackageDirectories(rootPath) {
|
|
151
|
+
try {
|
|
152
|
+
await fs.access(rootPath);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return [];
|
|
156
|
+
}
|
|
157
|
+
const packageDirs = [];
|
|
158
|
+
const walk = async (directory) => {
|
|
159
|
+
const packageJsonPath = path.join(directory, "package.json");
|
|
160
|
+
try {
|
|
161
|
+
await fs.access(packageJsonPath);
|
|
162
|
+
packageDirs.push(directory);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// noop
|
|
166
|
+
}
|
|
167
|
+
const entries = await fs.readdir(directory, { withFileTypes: true });
|
|
168
|
+
for (const entry of entries) {
|
|
169
|
+
if (!entry.isDirectory()) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (IGNORED_DIRECTORY_NAMES.has(entry.name)) {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
await walk(path.join(directory, entry.name));
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
await walk(rootPath);
|
|
179
|
+
packageDirs.sort((left, right) => left.localeCompare(right));
|
|
180
|
+
return [...new Set(packageDirs)];
|
|
181
|
+
}
|
|
182
|
+
function collectWorkspaceDependencyNames(dependencies) {
|
|
183
|
+
return Object.entries(dependencies)
|
|
184
|
+
.filter(([, version]) => version.startsWith("workspace:"))
|
|
185
|
+
.map(([name]) => name)
|
|
186
|
+
.sort((left, right) => left.localeCompare(right));
|
|
187
|
+
}
|
|
188
|
+
function toPosixPath(value) {
|
|
189
|
+
return value.split(path.sep).join("/");
|
|
190
|
+
}
|
|
191
|
+
export const dependencyBoundaryRule = {
|
|
192
|
+
meta: {
|
|
193
|
+
id: "dependency-boundary",
|
|
194
|
+
title: "Workspace 依赖边界硬校验",
|
|
195
|
+
level: "L2",
|
|
196
|
+
},
|
|
197
|
+
run: async (context) => toGuardDiagnostics(await collectDependencyBoundaryIssues(context.workspaceRoot)),
|
|
198
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { collectExtensionRecords } from "../../shared/extension/collect.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { collectExtensionRecords } from "../../shared/extension/collect.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const FORBIDDEN_IMPORT = /\b(?:from\s*|import\s*\(|require\s*\()\s*["'](?:electron|node:[^"']+|fs(?:\/promises)?|child_process|worker_threads|net|tls|os|path)["']/u;
|
|
2
|
+
const FORBIDDEN_BRIDGE = /\b(?:ipcRenderer|window\s*\.\s*kuafuConsoleHost)\b/u;
|
|
3
|
+
export function inspectExtensionElectronSource(input) {
|
|
4
|
+
if (!input.relativeToSource.startsWith("admin/"))
|
|
5
|
+
return [];
|
|
6
|
+
return input.content.split(/\r?\n/u).flatMap((line, index) => FORBIDDEN_IMPORT.test(line) || FORBIDDEN_BRIDGE.test(line) ? [{
|
|
7
|
+
rule: "extension-admin-no-electron-boundary", filePath: input.filePath, lineNumber: index + 1,
|
|
8
|
+
message: "Extension UI 禁止直接依赖 Electron、Node builtin、原始 ipcRenderer 或 ConsoleHost 全局桥;请使用 Renderer-safe Extension API。",
|
|
9
|
+
}] : []);
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { collectExtensionRecords } from "./collect.js";
|
|
2
|
+
import { validateTopLevel } from "./validate-top-level.js";
|
|
3
|
+
import { validateAdmin } from "./validate-admin.js";
|
|
4
|
+
import { validateDatabase } from "./validate-database.js";
|
|
5
|
+
import { validateTestMirror } from "./validate-test-mirror.js";
|
|
6
|
+
import { validateShared } from "./validate-shared.js";
|
|
7
|
+
import { validateFeatures } from "./validate-features.js";
|
|
8
|
+
import { validateServerIndexApiEntrySatisfies } from "./validate-server-index-api-entry-satisfies.js";
|
|
9
|
+
import { cleanEmptyDirs } from "./validate-empty-dirs.js";
|
|
10
|
+
/**
|
|
11
|
+
* 验证扩展包目录结构的统一入口。
|
|
12
|
+
* 收集所有扩展包的结构信息,运行各项验证规则,并清理空目录。
|
|
13
|
+
*/
|
|
14
|
+
export async function validateExtensionStructure(workspaceRoot) {
|
|
15
|
+
const records = await collectExtensionRecords(workspaceRoot);
|
|
16
|
+
const issues = [];
|
|
17
|
+
for (const record of records) {
|
|
18
|
+
issues.push(...validateTopLevel(record, workspaceRoot));
|
|
19
|
+
issues.push(...validateAdmin(record, workspaceRoot));
|
|
20
|
+
issues.push(...validateFeatures(record, workspaceRoot));
|
|
21
|
+
issues.push(...validateDatabase(record, workspaceRoot));
|
|
22
|
+
issues.push(...validateTestMirror(record, workspaceRoot));
|
|
23
|
+
issues.push(...(await validateServerIndexApiEntrySatisfies(record, workspaceRoot)));
|
|
24
|
+
issues.push(...(await validateShared(record, workspaceRoot)));
|
|
25
|
+
}
|
|
26
|
+
// 清理空目录(副作用操作,放在验证之后)
|
|
27
|
+
const { cleanedDirs, warnings } = await cleanEmptyDirs(records, workspaceRoot);
|
|
28
|
+
return { issues, warnings, cleanedDirs };
|
|
29
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type CrossCallExpression = {
|
|
2
|
+
kind: "call";
|
|
3
|
+
callee?: string;
|
|
4
|
+
arguments: CrossCallExpression[];
|
|
5
|
+
} | {
|
|
6
|
+
kind: "identifier";
|
|
7
|
+
name: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: "children";
|
|
10
|
+
children: CrossCallExpression[];
|
|
11
|
+
} | {
|
|
12
|
+
kind: "other";
|
|
13
|
+
};
|
|
14
|
+
/** parser保留语法形状;此owner只决定表达式/变量链是否消费正式buildApiPath。 */
|
|
15
|
+
export declare function expressionContainsBuildApiPath(expression: CrossCallExpression, input: {
|
|
16
|
+
buildApiPathIdentifiers: Set<string>;
|
|
17
|
+
variableInitializerByName: Map<string, CrossCallExpression>;
|
|
18
|
+
visiting: Set<string>;
|
|
19
|
+
}): boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** parser保留语法形状;此owner只决定表达式/变量链是否消费正式buildApiPath。 */
|
|
2
|
+
export function expressionContainsBuildApiPath(expression, input) {
|
|
3
|
+
if (expression.kind === "call" && expression.callee && input.buildApiPathIdentifiers.has(expression.callee))
|
|
4
|
+
return true;
|
|
5
|
+
if (expression.kind === "identifier") {
|
|
6
|
+
const initializer = input.variableInitializerByName.get(expression.name);
|
|
7
|
+
if (!initializer || input.visiting.has(expression.name))
|
|
8
|
+
return false;
|
|
9
|
+
input.visiting.add(expression.name);
|
|
10
|
+
const matched = expressionContainsBuildApiPath(initializer, input);
|
|
11
|
+
input.visiting.delete(expression.name);
|
|
12
|
+
return matched;
|
|
13
|
+
}
|
|
14
|
+
if (expression.kind === "children")
|
|
15
|
+
return expression.children.some(child => expressionContainsBuildApiPath(child, input));
|
|
16
|
+
if (expression.kind === "call")
|
|
17
|
+
return expression.arguments.some(argument => expressionContainsBuildApiPath(argument, input));
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveRelativeImportFile(fromFile: string, specifier: string, candidateFiles: Set<string>): string | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
const SOURCE_FILE_SUFFIXES = [".ts", ".tsx"];
|
|
3
|
+
export function resolveRelativeImportFile(fromFile, specifier, candidateFiles) {
|
|
4
|
+
if (!specifier.startsWith(".")) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
const basePath = path.normalize(path.resolve(path.dirname(fromFile), specifier));
|
|
8
|
+
for (const candidateBasePath of expandBasePaths(basePath)) {
|
|
9
|
+
const direct = findPathBySuffix(candidateBasePath, candidateFiles);
|
|
10
|
+
if (direct) {
|
|
11
|
+
return direct;
|
|
12
|
+
}
|
|
13
|
+
const indexBase = path.join(candidateBasePath, "index");
|
|
14
|
+
const indexResolved = findPathBySuffix(indexBase, candidateFiles);
|
|
15
|
+
if (indexResolved) {
|
|
16
|
+
return indexResolved;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
function findPathBySuffix(basePath, candidateFiles) {
|
|
22
|
+
if (candidateFiles.has(basePath)) {
|
|
23
|
+
return basePath;
|
|
24
|
+
}
|
|
25
|
+
for (const suffix of SOURCE_FILE_SUFFIXES) {
|
|
26
|
+
const withSuffix = basePath.endsWith(suffix)
|
|
27
|
+
? basePath
|
|
28
|
+
: `${basePath}${suffix}`;
|
|
29
|
+
if (candidateFiles.has(withSuffix)) {
|
|
30
|
+
return withSuffix;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
function expandBasePaths(basePath) {
|
|
36
|
+
const results = new Set([basePath]);
|
|
37
|
+
for (const runtimeSuffix of [".js", ".mjs", ".cjs"]) {
|
|
38
|
+
if (basePath.endsWith(runtimeSuffix)) {
|
|
39
|
+
results.add(basePath.slice(0, -runtimeSuffix.length));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return [...results];
|
|
43
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { resolveRelativeImportFile } from "./resolve-import.js";
|
|
3
|
+
/**
|
|
4
|
+
* 收集文件中所有可静态解析的相对依赖(import/export-from/dynamic-import/require)。
|
|
5
|
+
*/
|
|
6
|
+
export function collectRelativeDependencies(sourceFile, fromFile, candidateFiles) {
|
|
7
|
+
const dependencies = new Set();
|
|
8
|
+
for (const statement of sourceFile.statements) {
|
|
9
|
+
if (ts.isImportDeclaration(statement) &&
|
|
10
|
+
ts.isStringLiteral(statement.moduleSpecifier)) {
|
|
11
|
+
const resolved = resolveRelativeImportFile(fromFile, statement.moduleSpecifier.text, candidateFiles);
|
|
12
|
+
if (resolved) {
|
|
13
|
+
dependencies.add(resolved);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (ts.isExportDeclaration(statement) &&
|
|
17
|
+
statement.moduleSpecifier &&
|
|
18
|
+
ts.isStringLiteral(statement.moduleSpecifier)) {
|
|
19
|
+
const resolved = resolveRelativeImportFile(fromFile, statement.moduleSpecifier.text, candidateFiles);
|
|
20
|
+
if (resolved) {
|
|
21
|
+
dependencies.add(resolved);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const visit = (node) => {
|
|
26
|
+
if (ts.isCallExpression(node)) {
|
|
27
|
+
const importTarget = resolveDynamicImportTarget(node);
|
|
28
|
+
if (importTarget) {
|
|
29
|
+
const resolved = resolveRelativeImportFile(fromFile, importTarget, candidateFiles);
|
|
30
|
+
if (resolved) {
|
|
31
|
+
dependencies.add(resolved);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
ts.forEachChild(node, visit);
|
|
36
|
+
};
|
|
37
|
+
ts.forEachChild(sourceFile, visit);
|
|
38
|
+
return dependencies;
|
|
39
|
+
}
|
|
40
|
+
function resolveDynamicImportTarget(node) {
|
|
41
|
+
if (node.expression.kind === ts.SyntaxKind.ImportKeyword &&
|
|
42
|
+
node.arguments.length >= 1 &&
|
|
43
|
+
ts.isStringLiteral(node.arguments[0])) {
|
|
44
|
+
return node.arguments[0].text;
|
|
45
|
+
}
|
|
46
|
+
if (ts.isIdentifier(node.expression) &&
|
|
47
|
+
node.expression.text === "require" &&
|
|
48
|
+
node.arguments.length >= 1 &&
|
|
49
|
+
ts.isStringLiteral(node.arguments[0])) {
|
|
50
|
+
return node.arguments[0].text;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ExtensionSourceRecord = {
|
|
2
|
+
extensionId: string;
|
|
3
|
+
extensionRoot: string;
|
|
4
|
+
srcRoot: string;
|
|
5
|
+
srcFiles: string[];
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* 收集 products/<extensionId>/src 下的源码文件。
|
|
9
|
+
*/
|
|
10
|
+
export declare function collectExtensionSourceRecords(workspaceRoot: string, predicate: (filePath: string) => boolean): Promise<ExtensionSourceRecord[]>;
|
|
11
|
+
export declare function toPosix(value: string): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { collectFiles } from "../shared/records.js";
|
|
3
|
+
import { collectGuardProductRoots } from "../../../product-roots.js";
|
|
4
|
+
/**
|
|
5
|
+
* 收集 products/<extensionId>/src 下的源码文件。
|
|
6
|
+
*/
|
|
7
|
+
export async function collectExtensionSourceRecords(workspaceRoot, predicate) {
|
|
8
|
+
const records = [];
|
|
9
|
+
for (const product of await collectGuardProductRoots(workspaceRoot, "extension")) {
|
|
10
|
+
const extensionId = product.id;
|
|
11
|
+
const extensionRoot = product.root;
|
|
12
|
+
const srcRoot = path.join(extensionRoot, "src");
|
|
13
|
+
const srcFiles = await collectFiles(srcRoot, predicate);
|
|
14
|
+
records.push({
|
|
15
|
+
extensionId,
|
|
16
|
+
extensionRoot,
|
|
17
|
+
srcRoot,
|
|
18
|
+
srcFiles,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return records;
|
|
22
|
+
}
|
|
23
|
+
export function toPosix(value) {
|
|
24
|
+
return value.split(path.sep).join("/");
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Issue } from "../shared/types.js";
|
|
2
|
+
export declare const SAME_LAYER_EXTENSIONS: Set<string>;
|
|
3
|
+
export declare function isPathInDirectory(filePath: string, directory: string): boolean;
|
|
4
|
+
export declare function getServerDomain(serverRoot: string, filePath: string): string;
|
|
5
|
+
export declare function inspectPeerExtensionImport(input: {
|
|
6
|
+
extensionId: string;
|
|
7
|
+
specifier: string;
|
|
8
|
+
filePath: string;
|
|
9
|
+
lineNumber: number;
|
|
10
|
+
}): Issue[];
|
|
11
|
+
export declare function inspectSharedImport(input: {
|
|
12
|
+
workspaceRoot: string;
|
|
13
|
+
srcRoot: string;
|
|
14
|
+
source: string;
|
|
15
|
+
specifier: string;
|
|
16
|
+
allFiles: Set<string>;
|
|
17
|
+
lineNumber: number;
|
|
18
|
+
}): Issue[];
|
|
19
|
+
export declare function inspectServerDomainImport(input: {
|
|
20
|
+
workspaceRoot: string;
|
|
21
|
+
serverRoot: string;
|
|
22
|
+
source: string;
|
|
23
|
+
specifier: string;
|
|
24
|
+
allFiles: Set<string>;
|
|
25
|
+
lineNumber: number;
|
|
26
|
+
}): Issue[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { resolveRelativeImportFile } from "./resolve-import.js";
|
|
3
|
+
export const SAME_LAYER_EXTENSIONS = new Set(["center", "system"]);
|
|
4
|
+
export function isPathInDirectory(filePath, directory) { return filePath.startsWith(directory.endsWith(path.sep) ? directory : `${directory}${path.sep}`); }
|
|
5
|
+
export function getServerDomain(serverRoot, filePath) {
|
|
6
|
+
const parts = path.relative(serverRoot, filePath).split(path.sep).filter(Boolean);
|
|
7
|
+
if (!parts.length)
|
|
8
|
+
return "";
|
|
9
|
+
if (parts.length === 1) {
|
|
10
|
+
const base = parts[0].replace(/\.[^.]+$/, "");
|
|
11
|
+
return base === "index" ? "" : base;
|
|
12
|
+
}
|
|
13
|
+
return parts[0];
|
|
14
|
+
}
|
|
15
|
+
export function inspectPeerExtensionImport(input) {
|
|
16
|
+
const peer = input.specifier.startsWith("@kuafucloud/") ? input.specifier.slice("@kuafucloud/".length).split("/", 1)[0] : "";
|
|
17
|
+
if (!SAME_LAYER_EXTENSIONS.has(input.extensionId) || !peer || peer === input.extensionId || !SAME_LAYER_EXTENSIONS.has(peer))
|
|
18
|
+
return [];
|
|
19
|
+
// 公开扩展包的 /server 是生成式 RPC 门面,不包含真实后端实现。
|
|
20
|
+
if (input.specifier === `@kuafucloud/${peer}/server`)
|
|
21
|
+
return [];
|
|
22
|
+
return [{ rule: "extension-no-peer-extension-import", filePath: input.filePath, lineNumber: input.lineNumber, message: `同层扩展不允许直接导入 "${input.specifier}"。跨扩展互调必须消费公开包 /server 门面或本仓生成式 facade。` }];
|
|
23
|
+
}
|
|
24
|
+
export function inspectSharedImport(input) {
|
|
25
|
+
const resolved = resolveRelativeImportFile(input.source, input.specifier, input.allFiles);
|
|
26
|
+
if (!resolved || !isPathInDirectory(resolved, path.join(input.srcRoot, "server")) && !isPathInDirectory(resolved, path.join(input.srcRoot, "admin")))
|
|
27
|
+
return [];
|
|
28
|
+
return [{ rule: "extension-shared-import-boundary", filePath: path.relative(input.workspaceRoot, input.source).split(path.sep).join("/"), lineNumber: input.lineNumber, message: "src/shared 不允许反向依赖 src/server 或 src/admin。请将通用逻辑下沉到 shared,或改为由 server/admin 调用 shared。" }];
|
|
29
|
+
}
|
|
30
|
+
export function inspectServerDomainImport(input) {
|
|
31
|
+
if (path.basename(input.source) === "index.ts")
|
|
32
|
+
return [];
|
|
33
|
+
const sourceDomain = getServerDomain(input.serverRoot, input.source), resolved = resolveRelativeImportFile(input.source, input.specifier, input.allFiles);
|
|
34
|
+
if (!sourceDomain || !resolved || !isPathInDirectory(resolved, input.serverRoot))
|
|
35
|
+
return [];
|
|
36
|
+
const targetDomain = getServerDomain(input.serverRoot, resolved);
|
|
37
|
+
if (!targetDomain || targetDomain === sourceDomain)
|
|
38
|
+
return [];
|
|
39
|
+
return [{ rule: "extension-no-cross-domain-server-import", filePath: path.relative(input.workspaceRoot, input.source).split(path.sep).join("/"), lineNumber: input.lineNumber, message: `server 域不允许跨域直接依赖:当前域 "${sourceDomain}" 直接引用了 "${targetDomain}"。请提取到 src/shared 后再复用。` }];
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function forbiddenTestImport(layer: string, specifier: string): "removed" | "browser-only" | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const REMOVED_TESTER_MODULES = [
|
|
2
|
+
"@kuafucloud/product-test/smoke-api",
|
|
3
|
+
"@kuafucloud/product-test/smoke-ui",
|
|
4
|
+
];
|
|
5
|
+
const E2E_ONLY_MODULES = [
|
|
6
|
+
"@kuafucloud/product-test/e2e",
|
|
7
|
+
"@playwright/test",
|
|
8
|
+
];
|
|
9
|
+
export function forbiddenTestImport(layer, specifier) {
|
|
10
|
+
const removed = REMOVED_TESTER_MODULES.some(pattern => specifier === pattern || specifier.startsWith(pattern + "/"));
|
|
11
|
+
if (removed)
|
|
12
|
+
return "removed";
|
|
13
|
+
if (layer === "e2e")
|
|
14
|
+
return null;
|
|
15
|
+
return E2E_ONLY_MODULES.some(pattern => specifier === pattern || specifier.startsWith(pattern + "/")) ? "browser-only" : null;
|
|
16
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Issue } from "../shared/types.js";
|
|
2
|
+
/** 扩展包目录结构记录 */
|
|
3
|
+
export type ExtensionStructureRecord = {
|
|
4
|
+
/** 扩展包 ID(即 products/ 下的目录名) */
|
|
5
|
+
extensionId: string;
|
|
6
|
+
/** 扩展包根目录绝对路径 */
|
|
7
|
+
extensionRoot: string;
|
|
8
|
+
/** src/ 下所有文件(递归) */
|
|
9
|
+
srcFiles: string[];
|
|
10
|
+
/** src/ 下所有目录(递归) */
|
|
11
|
+
srcDirs: string[];
|
|
12
|
+
/** test/ 下所有文件(递归) */
|
|
13
|
+
testFiles: string[];
|
|
14
|
+
/** test/ 下所有目录(递归) */
|
|
15
|
+
testDirs: string[];
|
|
16
|
+
/** src/admin/ 直接子文件 */
|
|
17
|
+
adminFiles: string[];
|
|
18
|
+
/** src/admin/ 直接子目录 */
|
|
19
|
+
adminDirs: string[];
|
|
20
|
+
/** src/database/ 直接子文件 */
|
|
21
|
+
databaseFiles: string[];
|
|
22
|
+
/** src/database/ 直接子目录 */
|
|
23
|
+
databaseDirs: string[];
|
|
24
|
+
/** 设计名称 → 设计记录 */
|
|
25
|
+
designs: Map<string, DesignRecord>;
|
|
26
|
+
/** src/admin/features/ 直接子文件 */
|
|
27
|
+
featuresFiles: string[];
|
|
28
|
+
/** src/admin/features/ 直接子目录 */
|
|
29
|
+
featuresDirs: string[];
|
|
30
|
+
/** 所有 shared/ 目录(递归查找) */
|
|
31
|
+
sharedDirs: string[];
|
|
32
|
+
/** 所有空目录 */
|
|
33
|
+
emptyDirs: string[];
|
|
34
|
+
};
|
|
35
|
+
/** 设计(design)目录记录 */
|
|
36
|
+
export type DesignRecord = {
|
|
37
|
+
/** 设计名称 */
|
|
38
|
+
name: string;
|
|
39
|
+
/** 设计目录绝对路径 */
|
|
40
|
+
path: string;
|
|
41
|
+
/** 直接子文件 */
|
|
42
|
+
files: string[];
|
|
43
|
+
/** 直接子目录 */
|
|
44
|
+
dirs: string[];
|
|
45
|
+
};
|
|
46
|
+
/** 扩展结构验证结果 */
|
|
47
|
+
export type ExtensionValidationResult = {
|
|
48
|
+
issues: Issue[];
|
|
49
|
+
warnings: string[];
|
|
50
|
+
cleanedDirs: string[];
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Issue } from "../shared/types.js";
|
|
2
|
+
export type ExportSymbol = {
|
|
3
|
+
name: string;
|
|
4
|
+
line: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function addEdge(graph: Map<string, Set<string>>, from: string, to: string): void;
|
|
7
|
+
export declare function composeSymbolKey(filePath: string, symbolName: string): string;
|
|
8
|
+
export declare function parseSymbolKey(symbolKey: string): {
|
|
9
|
+
filePath: string;
|
|
10
|
+
symbolName: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function isConsumedSymbol(symbolKey: string, terminalSymbolKeys: Set<string>, terminalAllModules: Set<string>, namedReexportEdges: Map<string, Set<string>>, exportAllEdges: Map<string, Set<string>>): boolean;
|
|
13
|
+
export declare function isExportExemptFile(filePath: string, extensionRoot: string): boolean;
|
|
14
|
+
export declare function resolveBuildConsumedModules(extensionRoot: string, allFiles: Set<string>): string[];
|
|
15
|
+
export declare function inspectUnusedExportGraph(input: {
|
|
16
|
+
workspaceRoot: string;
|
|
17
|
+
extensionRoot: string;
|
|
18
|
+
exportedSymbolsByFile: Map<string, Map<string, ExportSymbol>>;
|
|
19
|
+
terminalSymbolKeys: Set<string>;
|
|
20
|
+
terminalAllModules: Set<string>;
|
|
21
|
+
namedReexportEdges: Map<string, Set<string>>;
|
|
22
|
+
exportAllEdges: Map<string, Set<string>>;
|
|
23
|
+
}): Issue[];
|