-
Notifications
You must be signed in to change notification settings - Fork 282
Expand file tree
/
Copy pathknip.ts
More file actions
135 lines (133 loc) · 5.88 KB
/
Copy pathknip.ts
File metadata and controls
135 lines (133 loc) · 5.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import type { KnipConfig } from "knip";
const config: KnipConfig = {
ignoreBinaries: [
"printf", // Used in mongodb-mcp-server check:api failure message script
"semver", // Used in .github/workflows/prepare-release.yml, not imported in TS
"gh", // Used by packages/scripts/src/generate-release-notes.ts to fetch release notes
],
// Root vitest.config.ts ui project sets setupFiles: ["./src/test-setup.ts"] relative to packages/ui
ignoreUnresolved: ["./src/test-setup.ts"],
workspaces: {
".": {
entry: [
"eslint-rules/*.js", // Root-local ESLint custom rules
],
ignoreDependencies: [
// Listed in root vitest.config ui project environment; package lives in packages/ui
"happy-dom",
// Provides the mongodb-sbom-tools bin used by update-third-party-notices / create-dependency-sbom-lists scripts
"@mongodb-js/sbom-tools",
],
},
"packages/eval-tests": {
entry: ["src/mongodb.eval.ts", "src/scripts/**/*.ts"],
ignore: [
// Fixture scripts run externally, not part of the TS graph
"src/scripts/bundleEval/osDnsNativeStub.cjs",
"src/scripts/bundleEval/stub.mjs",
],
},
"packages/mongodb-mcp-server": {
entry: [
"src/index.ts!",
"src/lib.ts!",
"src/allTools.ts!",
"src/web.ts!",
"src/tools/index.ts!",
"src/test-helpers/index.ts!",
"e2e-tests/**/*.ts",
"scripts/**/*.ts",
"packaging/mcpb/server/index.js", // MCP bundle entry shim (dynamic import of dist)
],
ignoreDependencies: [
// Public API surface re-exports NodeDriverServiceProvider from tools; knip cannot trace the chain
"@mongosh/service-provider-node-driver",
// Re-exported as `export type { Secret }`; knip --strict ignores type-only usage (knip hints to remove)
"mongodb-redact",
// Referenced only in tsconfig.cjs.json paths, not imported in source
"openapi-typescript-helpers",
// Referenced only in tsconfig.cjs.json paths; runtime usage is in @mongodb-js/mcp-cli
"ts-levenshtein",
// Provides the mcpb CLI binary; not imported as a module
"@anthropic-ai/mcpb",
],
},
"packages/mongodb-atlas-mcp-remote": {
entry: ["src/cli.ts!", "scripts/**/*.ts", "src/**/*.test.ts", "src/testHelpers/**/*.ts"],
},
"packages/test-utils": {
entry: ["src/index.ts", "src/setup.ts"],
},
"packages/scripts": {
entry: ["src/*.ts"],
ignoreDependencies: [
"vite", // Invoked via execSync in generateUI.ts, not imported
"@redocly/cli", // Used as CLI in generate.sh
"openapi-typescript", // Used as CLI in generate.sh
],
},
"packages/accuracy-tests": {
entry: ["src/**/*.ts"],
},
"packages/integration-tests": {
entry: ["src/index.ts", "src/**/*.ts"],
ignore: [
"src/fixtures/curl.mjs", // Fixture script run externally, not part of the TS graph
],
},
"packages/atlas-api-client": {
entry: ["src/**/*.test.ts"],
ignore: [
"openapi.d.ts", // Generated by packages/scripts; too many exports for knip to analyze usefully
],
},
"packages/core": {
entry: ["src/index.ts!", "src/**/*.test.ts"],
},
"packages/http-runners": {
entry: ["src/**/*.test.ts"],
},
"packages/tools-atlas-local": {
entry: ["src/**/*.test.ts"],
},
"packages/ui": {
// Required for knip --strict; normal knip reports as redundant (vitest plugin overlap)
entry: ["src/test-setup.ts"],
ignore: [
"src/build/mount.tsx", // Build-only UI mount script, not part of the published package graph
"src/components/**", // React components built via vite.ui.config.ts, excluded from tsc build
"vite.ui.config.ts", // Vite config for bundling UI assets; imports are not traced when ignored
],
ignoreDependencies: [
"@vitejs/plugin-react", // Used in vite.ui.config.ts (see ignore)
"vite-plugin-node-polyfills", // Used in vite.ui.config.ts (see ignore)
"vite-plugin-singlefile", // Used in vite.ui.config.ts (see ignore)
],
},
"packages/cli": {
entry: ["src/**/*.test.ts"],
ignoreDependencies: [
// Not imported directly; required so ESLint/tsc resolve YargsOptions in @mongosh/arg-parser .d.ts
"yargs-parser",
"@types/yargs-parser",
],
},
"packages/tools-mongodb": {
entry: ["src/**/*.test.ts"],
},
"packages/browser-tests": {
entry: ["src/**/*.test.ts", "polyfills/**/*.ts", "utils/**/*.ts", "setup.ts"],
ignoreDependencies: [
"buffer", // Vite resolve.alias in browser vitest.config, not a direct import
"evp_bytestokey", // Vite resolve.alias for crypto polyfill chain
"util", // Vite resolve.alias for Node util polyfill
"@vitest/browser", // Browser test runner peer; resolved via @vitest/browser-playwright
],
ignore: [
"polyfills/events/index.ts", // Intentionally exports both named and default EventEmitter shims
],
},
},
ignoreExportsUsedInFile: true,
};
export default config;