knip 6.38.0 → 6.40.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/dist/ConfigurationChief.d.ts +18 -0
- package/dist/WorkspaceWorker.d.ts +3 -4
- package/dist/WorkspaceWorker.js +12 -38
- package/dist/compilers/compilers.js +1 -1
- package/dist/constants.js +1 -0
- package/dist/graph/analyze.js +14 -5
- package/dist/graph/build.js +17 -10
- package/dist/graph-explorer/explorer.d.ts +1 -1
- package/dist/graph-explorer/operations/is-referenced.d.ts +1 -1
- package/dist/graph-explorer/operations/is-referenced.js +8 -4
- package/dist/plugins/_vue/auto-import.js +17 -10
- package/dist/plugins/angular/index.js +1 -1
- package/dist/plugins/capacitor/index.js +1 -1
- package/dist/plugins/commitlint/index.js +34 -9
- package/dist/plugins/cucumber/index.js +36 -4
- package/dist/plugins/cucumber/types.d.ts +2 -1
- package/dist/plugins/eslint/resolveFromAST.d.ts +0 -1
- package/dist/plugins/eslint/resolveFromAST.js +1 -1
- package/dist/plugins/index.d.ts +3 -0
- package/dist/plugins/index.js +6 -0
- package/dist/plugins/jasmine/index.d.ts +3 -0
- package/dist/plugins/jasmine/index.js +55 -0
- package/dist/plugins/jasmine/types.d.ts +7 -0
- package/dist/plugins/jasmine/types.js +1 -0
- package/dist/plugins/jest/helpers.d.ts +1 -0
- package/dist/plugins/jest/helpers.js +2 -0
- package/dist/plugins/jest/index.js +20 -11
- package/dist/plugins/osls/index.d.ts +3 -0
- package/dist/plugins/osls/index.js +13 -0
- package/dist/plugins/oxlint/index.d.ts +3 -0
- package/dist/plugins/oxlint/index.js +4 -31
- package/dist/plugins/oxlint/types.d.ts +1 -0
- package/dist/plugins/playwright/index.js +20 -3
- package/dist/plugins/playwright/types.d.ts +5 -0
- package/dist/plugins/postcss/index.js +5 -1
- package/dist/plugins/railway/index.d.ts +3 -0
- package/dist/plugins/railway/index.js +129 -0
- package/dist/plugins/rsbuild/index.js +42 -4
- package/dist/plugins/rsbuild/types.d.ts +18 -1
- package/dist/plugins/rspack/index.d.ts +3 -1
- package/dist/plugins/rspack/index.js +1 -1
- package/dist/plugins/rstest/index.js +116 -17
- package/dist/plugins/rstest/types.d.ts +29 -5
- package/dist/plugins/rstest/visitors/mock.d.ts +2 -0
- package/dist/plugins/rstest/visitors/mock.js +52 -0
- package/dist/plugins/serverless-framework/index.d.ts +4 -1
- package/dist/plugins/serverless-framework/index.js +40 -7
- package/dist/plugins/serverless-framework/types.d.ts +4 -2
- package/dist/plugins/simple-git-hooks/index.js +1 -1
- package/dist/plugins/vite/helpers.d.ts +1 -1
- package/dist/plugins/vite/helpers.js +7 -8
- package/dist/plugins/vitest/index.js +31 -7
- package/dist/plugins/vitest/types.d.ts +12 -0
- package/dist/schema/configuration.d.ts +45 -0
- package/dist/schema/plugins.d.ts +15 -0
- package/dist/schema/plugins.js +3 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +3 -0
- package/dist/types/package-json.d.ts +5 -0
- package/dist/typescript/ast-nodes.js +291 -0
- package/dist/typescript/resolve-module-names.js +15 -4
- package/dist/typescript/visitors/walk.js +12 -0
- package/dist/util/create-options.d.ts +30 -0
- package/dist/util/filter-transitive-dependencies.d.ts +2 -0
- package/dist/util/filter-transitive-dependencies.js +38 -0
- package/dist/util/git.d.ts +1 -0
- package/dist/util/git.js +23 -1
- package/dist/util/package-json.d.ts +1 -348
- package/dist/util/package-json.js +56 -10
- package/dist/util/tag.d.ts +1 -0
- package/dist/util/tag.js +1 -1
- package/dist/util/to-source-path.d.ts +1 -1
- package/dist/util/to-source-path.js +7 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +12 -0
|
@@ -6,354 +6,7 @@ interface ExtendedPackageJson extends PackageJson {
|
|
|
6
6
|
[NEWLINE]?: string;
|
|
7
7
|
}
|
|
8
8
|
export declare const toDeclarationSpecifier: (specifier: string) => string | undefined;
|
|
9
|
-
export declare const getPublishedTypeManifest: (manifest: PackageJson) =>
|
|
10
|
-
name?: string;
|
|
11
|
-
main?: string;
|
|
12
|
-
bin?: string | Record<string, string>;
|
|
13
|
-
version?: string;
|
|
14
|
-
private?: boolean;
|
|
15
|
-
workspaces?: string[] | {
|
|
16
|
-
packages?: string[];
|
|
17
|
-
catalog?: import("../types/package-json.ts").Catalog;
|
|
18
|
-
catalogs?: import("../types/package-json.ts").Catalogs;
|
|
19
|
-
};
|
|
20
|
-
exports?: string | string[] | {
|
|
21
|
-
[x: string & Record<never, never>]: string | string[] | any | {
|
|
22
|
-
[key: string]: string | string[] | any | any | null;
|
|
23
|
-
} | null;
|
|
24
|
-
browser: string | string[] | any | {
|
|
25
|
-
[key: string]: string | string[] | any | any | null;
|
|
26
|
-
} | null;
|
|
27
|
-
default: string | string[] | any | {
|
|
28
|
-
[key: string]: string | string[] | any | any | null;
|
|
29
|
-
} | null;
|
|
30
|
-
deno: string | string[] | any | {
|
|
31
|
-
[key: string]: string | string[] | any | any | null;
|
|
32
|
-
} | null;
|
|
33
|
-
electron: string | string[] | any | {
|
|
34
|
-
[key: string]: string | string[] | any | any | null;
|
|
35
|
-
} | null;
|
|
36
|
-
import: string | string[] | any | {
|
|
37
|
-
[key: string]: string | string[] | any | any | null;
|
|
38
|
-
} | null;
|
|
39
|
-
node: string | string[] | any | {
|
|
40
|
-
[key: string]: string | string[] | any | any | null;
|
|
41
|
-
} | null;
|
|
42
|
-
"node-addons": string | string[] | any | {
|
|
43
|
-
[key: string]: string | string[] | any | any | null;
|
|
44
|
-
} | null;
|
|
45
|
-
"react-native": string | string[] | any | {
|
|
46
|
-
[key: string]: string | string[] | any | any | null;
|
|
47
|
-
} | null;
|
|
48
|
-
require: string | string[] | any | {
|
|
49
|
-
[key: string]: string | string[] | any | any | null;
|
|
50
|
-
} | null;
|
|
51
|
-
} | {
|
|
52
|
-
[key: string]: string | string[] | any | any | null;
|
|
53
|
-
} | null;
|
|
54
|
-
imports?: {
|
|
55
|
-
[key: `#${string}`]: string | string[] | {
|
|
56
|
-
[x: string & Record<never, never>]: string | string[] | any | {
|
|
57
|
-
[key: string]: string | string[] | any | any | null;
|
|
58
|
-
} | null;
|
|
59
|
-
browser: string | string[] | any | {
|
|
60
|
-
[key: string]: string | string[] | any | any | null;
|
|
61
|
-
} | null;
|
|
62
|
-
default: string | string[] | any | {
|
|
63
|
-
[key: string]: string | string[] | any | any | null;
|
|
64
|
-
} | null;
|
|
65
|
-
deno: string | string[] | any | {
|
|
66
|
-
[key: string]: string | string[] | any | any | null;
|
|
67
|
-
} | null;
|
|
68
|
-
electron: string | string[] | any | {
|
|
69
|
-
[key: string]: string | string[] | any | any | null;
|
|
70
|
-
} | null;
|
|
71
|
-
import: string | string[] | any | {
|
|
72
|
-
[key: string]: string | string[] | any | any | null;
|
|
73
|
-
} | null;
|
|
74
|
-
node: string | string[] | any | {
|
|
75
|
-
[key: string]: string | string[] | any | any | null;
|
|
76
|
-
} | null;
|
|
77
|
-
"node-addons": string | string[] | any | {
|
|
78
|
-
[key: string]: string | string[] | any | any | null;
|
|
79
|
-
} | null;
|
|
80
|
-
"react-native": string | string[] | any | {
|
|
81
|
-
[key: string]: string | string[] | any | any | null;
|
|
82
|
-
} | null;
|
|
83
|
-
require: string | string[] | any | {
|
|
84
|
-
[key: string]: string | string[] | any | any | null;
|
|
85
|
-
} | null;
|
|
86
|
-
} | {
|
|
87
|
-
[key: string]: string | string[] | any | any | null;
|
|
88
|
-
} | null;
|
|
89
|
-
};
|
|
90
|
-
scripts?: import("../types/package-json.ts").Scripts;
|
|
91
|
-
dependencies?: {
|
|
92
|
-
[x: string]: string;
|
|
93
|
-
};
|
|
94
|
-
devDependencies?: {
|
|
95
|
-
[x: string]: string;
|
|
96
|
-
};
|
|
97
|
-
peerDependencies?: {
|
|
98
|
-
[x: string]: string;
|
|
99
|
-
};
|
|
100
|
-
optionalDependencies?: {
|
|
101
|
-
[x: string]: string;
|
|
102
|
-
};
|
|
103
|
-
peerDependenciesMeta?: Record<string, {
|
|
104
|
-
optional: true;
|
|
105
|
-
}>;
|
|
106
|
-
resolutions?: {
|
|
107
|
-
[x: string]: string;
|
|
108
|
-
};
|
|
109
|
-
module?: string;
|
|
110
|
-
browser?: string;
|
|
111
|
-
types?: string;
|
|
112
|
-
typings?: string;
|
|
113
|
-
typesVersions?: {
|
|
114
|
-
[x: string]: Record<string, string[]>;
|
|
115
|
-
};
|
|
116
|
-
publishConfig?: {
|
|
117
|
-
directory?: string;
|
|
118
|
-
main?: string;
|
|
119
|
-
exports?: string | string[] | {
|
|
120
|
-
[x: string & Record<never, never>]: string | string[] | any | {
|
|
121
|
-
[key: string]: string | string[] | any | any | null;
|
|
122
|
-
} | null;
|
|
123
|
-
browser: string | string[] | any | {
|
|
124
|
-
[key: string]: string | string[] | any | any | null;
|
|
125
|
-
} | null;
|
|
126
|
-
default: string | string[] | any | {
|
|
127
|
-
[key: string]: string | string[] | any | any | null;
|
|
128
|
-
} | null;
|
|
129
|
-
deno: string | string[] | any | {
|
|
130
|
-
[key: string]: string | string[] | any | any | null;
|
|
131
|
-
} | null;
|
|
132
|
-
electron: string | string[] | any | {
|
|
133
|
-
[key: string]: string | string[] | any | any | null;
|
|
134
|
-
} | null;
|
|
135
|
-
import: string | string[] | any | {
|
|
136
|
-
[key: string]: string | string[] | any | any | null;
|
|
137
|
-
} | null;
|
|
138
|
-
node: string | string[] | any | {
|
|
139
|
-
[key: string]: string | string[] | any | any | null;
|
|
140
|
-
} | null;
|
|
141
|
-
"node-addons": string | string[] | any | {
|
|
142
|
-
[key: string]: string | string[] | any | any | null;
|
|
143
|
-
} | null;
|
|
144
|
-
"react-native": string | string[] | any | {
|
|
145
|
-
[key: string]: string | string[] | any | any | null;
|
|
146
|
-
} | null;
|
|
147
|
-
require: string | string[] | any | {
|
|
148
|
-
[key: string]: string | string[] | any | any | null;
|
|
149
|
-
} | null;
|
|
150
|
-
} | {
|
|
151
|
-
[key: string]: string | string[] | any | any | null;
|
|
152
|
-
} | null;
|
|
153
|
-
types?: string;
|
|
154
|
-
typings?: string;
|
|
155
|
-
typesVersions?: {
|
|
156
|
-
[x: string]: Record<string, string[]>;
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
catalog?: import("../types/package-json.ts").Catalog;
|
|
160
|
-
catalogs?: import("../types/package-json.ts").Catalogs;
|
|
161
|
-
packageManager?: string;
|
|
162
|
-
engines?: Record<string, string>;
|
|
163
|
-
pnpm?: {
|
|
164
|
-
overrides?: {
|
|
165
|
-
[x: string]: string;
|
|
166
|
-
};
|
|
167
|
-
packageExtensions?: import("../types/package-json.ts").PackageExtensions;
|
|
168
|
-
};
|
|
169
|
-
knip?: import("../types/config.ts").WorkspaceConfiguration;
|
|
170
|
-
angular?: unknown;
|
|
171
|
-
astro?: unknown;
|
|
172
|
-
"astro-db"?: unknown;
|
|
173
|
-
"astro-markdoc"?: unknown;
|
|
174
|
-
"astro-og-canvas"?: unknown;
|
|
175
|
-
ava?: unknown;
|
|
176
|
-
babel?: unknown;
|
|
177
|
-
biome?: unknown;
|
|
178
|
-
borp?: unknown;
|
|
179
|
-
bumpp?: unknown;
|
|
180
|
-
bun?: unknown;
|
|
181
|
-
c8?: unknown;
|
|
182
|
-
capacitor?: unknown;
|
|
183
|
-
catalyst?: unknown;
|
|
184
|
-
changelogen?: unknown;
|
|
185
|
-
changelogithub?: unknown;
|
|
186
|
-
changesets?: unknown;
|
|
187
|
-
commitizen?: unknown;
|
|
188
|
-
commitlint?: unknown;
|
|
189
|
-
convex?: unknown;
|
|
190
|
-
"create-typescript-app"?: unknown;
|
|
191
|
-
cspell?: unknown;
|
|
192
|
-
cucumber?: unknown;
|
|
193
|
-
cypress?: unknown;
|
|
194
|
-
danger?: unknown;
|
|
195
|
-
"dependency-cruiser"?: unknown;
|
|
196
|
-
docusaurus?: unknown;
|
|
197
|
-
dotenv?: unknown;
|
|
198
|
-
drizzle?: unknown;
|
|
199
|
-
"electron-vite"?: unknown;
|
|
200
|
-
eleventy?: unknown;
|
|
201
|
-
esbuild?: unknown;
|
|
202
|
-
eslint?: unknown;
|
|
203
|
-
eve?: unknown;
|
|
204
|
-
execa?: unknown;
|
|
205
|
-
expo?: unknown;
|
|
206
|
-
"expressive-code"?: unknown;
|
|
207
|
-
fast?: unknown;
|
|
208
|
-
fumadocs?: unknown;
|
|
209
|
-
gatsby?: unknown;
|
|
210
|
-
"github-action"?: unknown;
|
|
211
|
-
"github-actions"?: unknown;
|
|
212
|
-
glob?: unknown;
|
|
213
|
-
"graphql-codegen"?: unknown;
|
|
214
|
-
hardhat?: unknown;
|
|
215
|
-
husky?: unknown;
|
|
216
|
-
"i18next-parser"?: unknown;
|
|
217
|
-
jest?: unknown;
|
|
218
|
-
karma?: unknown;
|
|
219
|
-
knex?: unknown;
|
|
220
|
-
ladle?: unknown;
|
|
221
|
-
"laravel-vite-plugin"?: unknown;
|
|
222
|
-
lefthook?: unknown;
|
|
223
|
-
"lint-staged"?: unknown;
|
|
224
|
-
linthtml?: unknown;
|
|
225
|
-
lit?: unknown;
|
|
226
|
-
"lockfile-lint"?: unknown;
|
|
227
|
-
"lost-pixel"?: unknown;
|
|
228
|
-
lunaria?: unknown;
|
|
229
|
-
markdownlint?: unknown;
|
|
230
|
-
marko?: unknown;
|
|
231
|
-
mdx?: unknown;
|
|
232
|
-
mdxlint?: unknown;
|
|
233
|
-
metro?: unknown;
|
|
234
|
-
mise?: unknown;
|
|
235
|
-
mocha?: unknown;
|
|
236
|
-
moonrepo?: unknown;
|
|
237
|
-
msw?: unknown;
|
|
238
|
-
"nano-spawn"?: unknown;
|
|
239
|
-
"nano-staged"?: unknown;
|
|
240
|
-
nest?: unknown;
|
|
241
|
-
netlify?: unknown;
|
|
242
|
-
next?: unknown;
|
|
243
|
-
"next-intl"?: unknown;
|
|
244
|
-
"next-mdx"?: unknown;
|
|
245
|
-
nitro?: unknown;
|
|
246
|
-
node?: unknown;
|
|
247
|
-
"node-modules-inspector"?: unknown;
|
|
248
|
-
nodemon?: unknown;
|
|
249
|
-
"npm-package-json-lint"?: unknown;
|
|
250
|
-
nuxt?: unknown;
|
|
251
|
-
"nuxtjs-i18n"?: unknown;
|
|
252
|
-
nx?: unknown;
|
|
253
|
-
nyc?: unknown;
|
|
254
|
-
oclif?: unknown;
|
|
255
|
-
"openapi-ts"?: unknown;
|
|
256
|
-
openclaw?: unknown;
|
|
257
|
-
orval?: unknown;
|
|
258
|
-
oxfmt?: unknown;
|
|
259
|
-
oxlint?: unknown;
|
|
260
|
-
"panda-css"?: unknown;
|
|
261
|
-
parcel?: unknown;
|
|
262
|
-
payload?: unknown;
|
|
263
|
-
pino?: unknown;
|
|
264
|
-
playwright?: unknown;
|
|
265
|
-
"playwright-ct"?: unknown;
|
|
266
|
-
"playwright-test"?: unknown;
|
|
267
|
-
plop?: unknown;
|
|
268
|
-
pm2?: unknown;
|
|
269
|
-
postcss?: unknown;
|
|
270
|
-
"pre-commit"?: unknown;
|
|
271
|
-
preconstruct?: unknown;
|
|
272
|
-
prettier?: unknown;
|
|
273
|
-
prisma?: unknown;
|
|
274
|
-
quasar?: unknown;
|
|
275
|
-
qwik?: unknown;
|
|
276
|
-
raycast?: unknown;
|
|
277
|
-
"react-cosmos"?: unknown;
|
|
278
|
-
"react-email"?: unknown;
|
|
279
|
-
"react-native"?: unknown;
|
|
280
|
-
"react-router"?: unknown;
|
|
281
|
-
relay?: unknown;
|
|
282
|
-
"release-it"?: unknown;
|
|
283
|
-
remark?: unknown;
|
|
284
|
-
remix?: unknown;
|
|
285
|
-
rolldown?: unknown;
|
|
286
|
-
rollup?: unknown;
|
|
287
|
-
rsbuild?: unknown;
|
|
288
|
-
rslib?: unknown;
|
|
289
|
-
rspack?: unknown;
|
|
290
|
-
rstest?: unknown;
|
|
291
|
-
sanity?: unknown;
|
|
292
|
-
"semantic-release"?: unknown;
|
|
293
|
-
sentry?: unknown;
|
|
294
|
-
"serverless-framework"?: unknown;
|
|
295
|
-
"simple-git-hooks"?: unknown;
|
|
296
|
-
"size-limit"?: unknown;
|
|
297
|
-
sst?: unknown;
|
|
298
|
-
starlight?: unknown;
|
|
299
|
-
stencil?: unknown;
|
|
300
|
-
storybook?: unknown;
|
|
301
|
-
stryker?: unknown;
|
|
302
|
-
stylelint?: unknown;
|
|
303
|
-
svelte?: unknown;
|
|
304
|
-
"sveltejs-package"?: unknown;
|
|
305
|
-
sveltekit?: unknown;
|
|
306
|
-
svgo?: unknown;
|
|
307
|
-
svgr?: unknown;
|
|
308
|
-
swc?: unknown;
|
|
309
|
-
syncpack?: unknown;
|
|
310
|
-
tailwind?: unknown;
|
|
311
|
-
"tanstack-router"?: unknown;
|
|
312
|
-
taskfile?: unknown;
|
|
313
|
-
tauri?: unknown;
|
|
314
|
-
temporal?: unknown;
|
|
315
|
-
textlint?: unknown;
|
|
316
|
-
travis?: unknown;
|
|
317
|
-
"ts-node"?: unknown;
|
|
318
|
-
tsd?: unknown;
|
|
319
|
-
tsdown?: unknown;
|
|
320
|
-
tsup?: unknown;
|
|
321
|
-
tsx?: unknown;
|
|
322
|
-
turbo?: unknown;
|
|
323
|
-
typedoc?: unknown;
|
|
324
|
-
typescript?: unknown;
|
|
325
|
-
"typescript-content-mapper"?: unknown;
|
|
326
|
-
unbuild?: unknown;
|
|
327
|
-
unocss?: unknown;
|
|
328
|
-
"unplugin-auto-import"?: unknown;
|
|
329
|
-
"unplugin-icons"?: unknown;
|
|
330
|
-
"unplugin-vue-components"?: unknown;
|
|
331
|
-
"unplugin-vue-i18n"?: unknown;
|
|
332
|
-
"unplugin-vue-markdown"?: unknown;
|
|
333
|
-
"unplugin-vue-router"?: unknown;
|
|
334
|
-
varlock?: unknown;
|
|
335
|
-
vercel?: unknown;
|
|
336
|
-
"vercel-og"?: unknown;
|
|
337
|
-
vike?: unknown;
|
|
338
|
-
vite?: unknown;
|
|
339
|
-
"vite-plugin-pages"?: unknown;
|
|
340
|
-
"vite-plugin-pwa"?: unknown;
|
|
341
|
-
"vite-plugin-vue-layouts-next"?: unknown;
|
|
342
|
-
"vite-plus"?: unknown;
|
|
343
|
-
"vite-pwa-assets-generator"?: unknown;
|
|
344
|
-
vitepress?: unknown;
|
|
345
|
-
vitest?: unknown;
|
|
346
|
-
vue?: unknown;
|
|
347
|
-
"webdriver-io"?: unknown;
|
|
348
|
-
webpack?: unknown;
|
|
349
|
-
wireit?: unknown;
|
|
350
|
-
wrangler?: unknown;
|
|
351
|
-
wxt?: unknown;
|
|
352
|
-
xo?: unknown;
|
|
353
|
-
yarn?: unknown;
|
|
354
|
-
yorkie?: unknown;
|
|
355
|
-
zx?: unknown;
|
|
356
|
-
};
|
|
9
|
+
export declare const getPublishedTypeManifest: (manifest: PackageJson) => PackageJson;
|
|
357
10
|
export declare const getPublishedTypeExportSpecifiers: (exports: PackageJson['exports']) => Set<string>;
|
|
358
11
|
export declare const getPublishedTypeEntrySpecifiers: (manifest: PackageJson) => {
|
|
359
12
|
candidates: string[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import picomatch from 'picomatch';
|
|
2
3
|
import { IS_DTS } from '../constants.js';
|
|
3
4
|
import { getPackageNameFromModuleSpecifier } from './modules.js';
|
|
4
5
|
const INDENT = Symbol.for('indent');
|
|
@@ -27,11 +28,7 @@ const getEntriesFromExports = (obj) => {
|
|
|
27
28
|
if (typeof obj[prop] === 'string') {
|
|
28
29
|
values.push(obj[prop]);
|
|
29
30
|
}
|
|
30
|
-
else if (obj[prop] ===
|
|
31
|
-
if (prop !== '.')
|
|
32
|
-
values.push(`!${prop}`);
|
|
33
|
-
}
|
|
34
|
-
else if (typeof obj[prop] === 'object') {
|
|
31
|
+
else if (obj[prop] && typeof obj[prop] === 'object') {
|
|
35
32
|
values = values.concat(getEntriesFromExports(obj[prop]));
|
|
36
33
|
}
|
|
37
34
|
}
|
|
@@ -207,6 +204,50 @@ export const save = async (filePath, content) => {
|
|
|
207
204
|
const fileContent = `${JSON.stringify(content, null, space)}\n`.replace(/\n/g, EOL);
|
|
208
205
|
await writeFile(filePath, fileContent);
|
|
209
206
|
};
|
|
207
|
+
const expandWildcards = (specifier) => specifier
|
|
208
|
+
.replace(/\/\*$/, '/**')
|
|
209
|
+
.replace(/\/\*\./, '/**/*.')
|
|
210
|
+
.replace(/\/\*\//, '/**/');
|
|
211
|
+
const withoutDotSlash = (specifier) => specifier.replace(/^\.\//, '');
|
|
212
|
+
const getHiddenPatternMatch = (nullSubpath, key) => {
|
|
213
|
+
const star = key.indexOf('*');
|
|
214
|
+
const prefix = key.slice(0, star);
|
|
215
|
+
const suffix = key.slice(star + 1);
|
|
216
|
+
const nullStar = nullSubpath.indexOf('*');
|
|
217
|
+
if (nullStar === -1) {
|
|
218
|
+
const isMatch = nullSubpath.startsWith(prefix) && nullSubpath.endsWith(suffix) && nullSubpath.length >= key.length;
|
|
219
|
+
return isMatch ? nullSubpath.slice(prefix.length, nullSubpath.length - suffix.length) : undefined;
|
|
220
|
+
}
|
|
221
|
+
const head = nullSubpath.slice(0, nullStar);
|
|
222
|
+
const tail = nullSubpath.slice(nullStar + 1);
|
|
223
|
+
const isMoreSpecific = head.startsWith(prefix) && (head.length > prefix.length || nullSubpath.length > key.length);
|
|
224
|
+
if (!isMoreSpecific)
|
|
225
|
+
return;
|
|
226
|
+
if (tail.endsWith(suffix))
|
|
227
|
+
return `${head.slice(prefix.length)}*${tail.slice(0, tail.length - suffix.length)}`;
|
|
228
|
+
if (suffix.endsWith(tail))
|
|
229
|
+
return `${head.slice(prefix.length)}*`;
|
|
230
|
+
};
|
|
231
|
+
const getHiddenExportTargets = (exports) => {
|
|
232
|
+
const entries = getExportEntries(exports);
|
|
233
|
+
const targets = [];
|
|
234
|
+
for (const [nullSubpath, value] of entries) {
|
|
235
|
+
if (value !== null || nullSubpath === '.')
|
|
236
|
+
continue;
|
|
237
|
+
for (const [key, target] of entries) {
|
|
238
|
+
if (target === null || !key.includes('*'))
|
|
239
|
+
continue;
|
|
240
|
+
const patternMatch = getHiddenPatternMatch(nullSubpath, key);
|
|
241
|
+
if (patternMatch === undefined)
|
|
242
|
+
continue;
|
|
243
|
+
for (const item of getEntriesFromExports(target)) {
|
|
244
|
+
if (item.includes('*'))
|
|
245
|
+
targets.push(item.replaceAll('*', patternMatch));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return targets;
|
|
250
|
+
};
|
|
210
251
|
export const getEntrySpecifiersFromManifest = (manifest) => {
|
|
211
252
|
const { main, module, browser, bin, exports, types, typings } = manifest;
|
|
212
253
|
const entryPaths = new Set();
|
|
@@ -230,11 +271,7 @@ export const getEntrySpecifiersFromManifest = (manifest) => {
|
|
|
230
271
|
for (const item of getEntriesFromExports(exports)) {
|
|
231
272
|
if (item === './*' || item.trim() === '')
|
|
232
273
|
continue;
|
|
233
|
-
|
|
234
|
-
.replace(/\/\*$/, '/**')
|
|
235
|
-
.replace(/\/\*\./, '/**/*.')
|
|
236
|
-
.replace(/\/\*\//, '/**/');
|
|
237
|
-
entryPaths.add(expanded);
|
|
274
|
+
entryPaths.add(expandWildcards(item));
|
|
238
275
|
}
|
|
239
276
|
}
|
|
240
277
|
if (manifest.imports) {
|
|
@@ -247,6 +284,15 @@ export const getEntrySpecifiersFromManifest = (manifest) => {
|
|
|
247
284
|
}
|
|
248
285
|
}
|
|
249
286
|
}
|
|
287
|
+
if (exports) {
|
|
288
|
+
const entries = Array.from(entryPaths, withoutDotSlash);
|
|
289
|
+
for (const target of getHiddenExportTargets(exports)) {
|
|
290
|
+
const hidden = expandWildcards(target);
|
|
291
|
+
const isHidden = picomatch(withoutDotSlash(hidden), { dot: true });
|
|
292
|
+
if (!entries.some(entry => isHidden(entry)))
|
|
293
|
+
entryPaths.add(`!${hidden}`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
250
296
|
return entryPaths;
|
|
251
297
|
};
|
|
252
298
|
export const createManifest = (raw) => Object.assign(raw, {
|
package/dist/util/tag.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Tags } from '../types/options.ts';
|
|
2
2
|
export declare const splitTags: (rawTags: string[]) => Tags;
|
|
3
|
+
export declare const hasTag: (tags: string[], jsDocTags: Set<string>) => boolean;
|
|
3
4
|
export declare const shouldIgnore: (jsDocTags: Set<string>, tags: Tags) => boolean;
|
|
4
5
|
export declare const isAlwaysIgnored: (jsDocTags: Set<string>) => boolean;
|
|
5
6
|
export declare const getShouldIgnoreHandler: (isProduction: boolean) => (jsDocTags: Set<string>) => boolean;
|
package/dist/util/tag.js
CHANGED
|
@@ -8,7 +8,7 @@ export const splitTags = (rawTags) => {
|
|
|
8
8
|
return [incl, excl];
|
|
9
9
|
}, [[], []]);
|
|
10
10
|
};
|
|
11
|
-
const hasTag = (tags, jsDocTags) => tags.some(tag => jsDocTags.has(tag));
|
|
11
|
+
export const hasTag = (tags, jsDocTags) => tags.some(tag => jsDocTags.has(tag));
|
|
12
12
|
export const shouldIgnore = (jsDocTags, tags) => {
|
|
13
13
|
const [includeJSDocTags, excludeJSDocTags] = tags;
|
|
14
14
|
if (includeJSDocTags.length > 0 && !hasTag(includeJSDocTags, jsDocTags))
|
|
@@ -8,7 +8,7 @@ export type WorkspacePackageTargetHandler = (specifier: string, filePath: string
|
|
|
8
8
|
patternMatch?: string;
|
|
9
9
|
} | undefined;
|
|
10
10
|
export declare const getWorkspacePackageTargetHandler: (chief: ConfigurationChief) => WorkspacePackageTargetHandler;
|
|
11
|
-
export declare const getModuleSourcePathHandler: (chief: ConfigurationChief) => (filePath: string) => string | undefined;
|
|
11
|
+
export declare const getModuleSourcePathHandler: (chief: ConfigurationChief) => (filePath: string, extensions?: string[]) => string | undefined;
|
|
12
12
|
export declare const getToSourcePathsHandler: (chief: ConfigurationChief) => (specifiers: Set<string>, dir: string, extensions: string | undefined, label: string) => Promise<string[]>;
|
|
13
13
|
export declare const toSourceMappedSpecifiers: (ws: Workspace | undefined, absSpecifier: string, extensions?: string) => string[];
|
|
14
14
|
export type ToSourceFilePath = ReturnType<typeof getModuleSourcePathHandler>;
|
|
@@ -7,7 +7,7 @@ import { getPackageMapTarget } from './package-json.js';
|
|
|
7
7
|
import { isAbsolute, isInternal, join, toRelative } from './path.js';
|
|
8
8
|
const defaultExtensions = `.{${Array.from(DEFAULT_EXTENSIONS, ext => ext.slice(1)).join(',')}}`;
|
|
9
9
|
const hasTSExt = /(?<!\.d)\.(m|c)?tsx?$/;
|
|
10
|
-
const matchExt = /(\.d)?\.(m|c)?(j|t)
|
|
10
|
+
const matchExt = /(\.d)?\.(m|c)?(j|t)sx?$/;
|
|
11
11
|
const sourceExtensions = [...DEFAULT_EXTENSIONS];
|
|
12
12
|
const tsconfigSourceMap = (dir, compilerOptions) => {
|
|
13
13
|
const srcDir = join(dir, 'src');
|
|
@@ -71,7 +71,7 @@ export const getWorkspacePackageTargetHandler = (chief) => {
|
|
|
71
71
|
};
|
|
72
72
|
export const getModuleSourcePathHandler = (chief) => {
|
|
73
73
|
const toSourceMapCache = new Map();
|
|
74
|
-
return (filePath) => {
|
|
74
|
+
return (filePath, extensions = sourceExtensions) => {
|
|
75
75
|
if (!isInternal(filePath) || hasTSExt.test(filePath))
|
|
76
76
|
return;
|
|
77
77
|
if (toSourceMapCache.has(filePath))
|
|
@@ -83,7 +83,7 @@ export const getModuleSourcePathHandler = (chief) => {
|
|
|
83
83
|
if (!(isUnderOutDir(filePath, outDir) || srcDir === outDir))
|
|
84
84
|
continue;
|
|
85
85
|
const basePath = (srcDir + filePath.slice(outDir.length)).replace(matchExt, '');
|
|
86
|
-
const srcFilePath = findFileWithExtensions(basePath,
|
|
86
|
+
const srcFilePath = findFileWithExtensions(basePath, extensions);
|
|
87
87
|
if (srcFilePath && srcFilePath !== filePath) {
|
|
88
88
|
debugLog('*', `Source mapping ${toRelative(filePath, chief.cwd)} → ${toRelative(srcFilePath, chief.cwd)}`);
|
|
89
89
|
result = srcFilePath;
|
|
@@ -99,10 +99,12 @@ export const getToSourcePathsHandler = (chief) => {
|
|
|
99
99
|
return async (specifiers, dir, extensions = defaultExtensions, label) => {
|
|
100
100
|
const patterns = new Set();
|
|
101
101
|
for (const specifier of specifiers) {
|
|
102
|
-
const
|
|
102
|
+
const negation = specifier.startsWith('!') ? '!' : '';
|
|
103
|
+
const id = specifier.slice(negation.length);
|
|
104
|
+
const absSpecifier = isAbsolute(id) ? id : prependDirToPattern(dir, id);
|
|
103
105
|
const ws = chief.findWorkspaceByFilePath(absSpecifier);
|
|
104
106
|
const mapped = ws?.sourceMaps && rewritePattern(ws.sourceMaps, absSpecifier, extensions);
|
|
105
|
-
patterns.add(mapped ?? absSpecifier);
|
|
107
|
+
patterns.add(negation + (mapped ?? absSpecifier));
|
|
106
108
|
}
|
|
107
109
|
const filePaths = await _glob({ patterns: Array.from(patterns), cwd: chief.cwd, dir, label });
|
|
108
110
|
debugLogArray(toRelative(dir, chief.cwd), 'Source mapping (package.json)', filePaths);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.
|
|
1
|
+
export declare const version = "6.40.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '6.
|
|
1
|
+
export const version = '6.40.0';
|
package/package.json
CHANGED
package/schema.json
CHANGED
|
@@ -602,6 +602,10 @@
|
|
|
602
602
|
"title": "i18next-parser plugin configuration (https://knip.dev/reference/plugins/i18next-parser)",
|
|
603
603
|
"$ref": "#/definitions/plugin"
|
|
604
604
|
},
|
|
605
|
+
"jasmine": {
|
|
606
|
+
"title": "jasmine plugin configuration (https://knip.dev/reference/plugins/jasmine)",
|
|
607
|
+
"$ref": "#/definitions/plugin"
|
|
608
|
+
},
|
|
605
609
|
"jest": {
|
|
606
610
|
"title": "Jest plugin configuration (https://knip.dev/reference/plugins/jest)",
|
|
607
611
|
"$ref": "#/definitions/plugin"
|
|
@@ -770,6 +774,10 @@
|
|
|
770
774
|
"title": "orval plugin configuration (https://knip.dev/reference/plugins/orval)",
|
|
771
775
|
"$ref": "#/definitions/plugin"
|
|
772
776
|
},
|
|
777
|
+
"osls": {
|
|
778
|
+
"title": "osls plugin configuration (https://knip.dev/reference/plugins/osls)",
|
|
779
|
+
"$ref": "#/definitions/plugin"
|
|
780
|
+
},
|
|
773
781
|
"oxfmt": {
|
|
774
782
|
"title": "oxfmt plugin configuration (https://knip.dev/reference/plugins/oxfmt)",
|
|
775
783
|
"$ref": "#/definitions/plugin"
|
|
@@ -838,6 +846,10 @@
|
|
|
838
846
|
"title": "qwik plugin configuration (https://knip.dev/reference/plugins/qwik)",
|
|
839
847
|
"$ref": "#/definitions/plugin"
|
|
840
848
|
},
|
|
849
|
+
"railway": {
|
|
850
|
+
"title": "railway plugin configuration (https://knip.dev/reference/plugins/railway)",
|
|
851
|
+
"$ref": "#/definitions/plugin"
|
|
852
|
+
},
|
|
841
853
|
"react-cosmos": {
|
|
842
854
|
"title": "react-cosmos plugin configuration (https://knip.dev/reference/plugins/react-cosmos)",
|
|
843
855
|
"$ref": "#/definitions/plugin"
|