knip 6.27.0 → 6.29.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 +6 -0
- package/dist/DependencyDeputy.js +1 -1
- package/dist/WorkspaceWorker.js +9 -0
- package/dist/compilers/compilers.d.ts +1 -0
- package/dist/compilers/compilers.js +10 -0
- package/dist/compilers/index.d.ts +10 -0
- package/dist/compilers/index.js +2 -0
- package/dist/compilers/mdx.d.ts +2 -1
- package/dist/compilers/tsrx.d.ts +5 -0
- package/dist/compilers/tsrx.js +3 -0
- package/dist/constants.js +14 -0
- package/dist/graph/analyze.js +6 -4
- 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 +47 -33
- package/dist/manifest/index.d.ts +2 -1
- package/dist/plugins/angular/index.js +3 -0
- package/dist/plugins/babel/helpers.d.ts +9 -7
- package/dist/plugins/convex/index.js +11 -2
- package/dist/plugins/convex/types.d.ts +3 -0
- package/dist/plugins/convex/types.js +1 -0
- package/dist/plugins/github-actions/index.js +5 -2
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/markdownlint/index.js +26 -5
- package/dist/plugins/markdownlint/types.d.ts +6 -0
- package/dist/plugins/nitro/index.js +3 -1
- package/dist/plugins/nuxt/index.js +19 -8
- package/dist/plugins/openclaw/index.d.ts +3 -0
- package/dist/plugins/openclaw/index.js +52 -0
- package/dist/plugins/openclaw/types.d.ts +25 -0
- package/dist/plugins/openclaw/types.js +1 -0
- package/dist/plugins/prettier/index.js +1 -1
- package/dist/plugins/tailwind/index.js +8 -0
- package/dist/plugins/tsdown/index.js +43 -0
- package/dist/plugins/typescript/index.js +1 -1
- package/dist/reporters/util/configuration-hints.js +3 -1
- package/dist/schema/configuration.d.ts +15 -0
- package/dist/schema/plugins.d.ts +5 -0
- package/dist/schema/plugins.js +1 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +1 -0
- package/dist/types/issues.d.ts +1 -1
- package/dist/typescript/ast-nodes.d.ts +3 -1
- package/dist/typescript/comments.d.ts +1 -1
- package/dist/typescript/comments.js +71 -5
- package/dist/typescript/get-imports-and-exports.d.ts +3 -1
- package/dist/typescript/get-imports-and-exports.js +1 -1
- package/dist/typescript/visitors/walk.d.ts +1 -0
- package/dist/typescript/visitors/walk.js +14 -1
- package/dist/util/Performance.js +1 -1
- package/dist/util/codeowners.js +1 -1
- package/dist/util/create-options.d.ts +10 -0
- package/dist/util/glob-cache.d.ts +7 -1
- package/dist/util/glob-cache.js +52 -29
- package/dist/util/glob-core.d.ts +2 -0
- package/dist/util/glob-core.js +52 -7
- package/dist/util/glob.d.ts +6 -3
- package/dist/util/glob.js +23 -9
- package/dist/util/loader.d.ts +3 -1
- package/dist/util/parse-and-convert-gitignores.d.ts +2 -2
- package/dist/util/parse-and-convert-gitignores.js +4 -4
- package/dist/util/reporter.js +4 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +11 -11
- package/schema.json +4 -0
|
@@ -460,6 +460,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
460
460
|
entry?: string | string[] | undefined;
|
|
461
461
|
project?: string | string[] | undefined;
|
|
462
462
|
} | undefined;
|
|
463
|
+
openclaw?: string | boolean | string[] | {
|
|
464
|
+
config?: string | string[] | undefined;
|
|
465
|
+
entry?: string | string[] | undefined;
|
|
466
|
+
project?: string | string[] | undefined;
|
|
467
|
+
} | undefined;
|
|
463
468
|
orval?: string | boolean | string[] | {
|
|
464
469
|
config?: string | string[] | undefined;
|
|
465
470
|
entry?: string | string[] | undefined;
|
|
@@ -1373,6 +1378,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1373
1378
|
entry?: string | string[] | undefined;
|
|
1374
1379
|
project?: string | string[] | undefined;
|
|
1375
1380
|
} | undefined;
|
|
1381
|
+
openclaw?: string | boolean | string[] | {
|
|
1382
|
+
config?: string | string[] | undefined;
|
|
1383
|
+
entry?: string | string[] | undefined;
|
|
1384
|
+
project?: string | string[] | undefined;
|
|
1385
|
+
} | undefined;
|
|
1376
1386
|
orval?: string | boolean | string[] | {
|
|
1377
1387
|
config?: string | string[] | undefined;
|
|
1378
1388
|
entry?: string | string[] | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FSLike } from 'fdir';
|
|
1
2
|
export declare const initGlobCache: (cacheLocation: string) => void;
|
|
2
3
|
export declare const isGlobCacheEnabled: () => boolean;
|
|
3
4
|
export declare const flushGlobCache: () => void;
|
|
@@ -7,6 +8,11 @@ export declare const computeGlobCacheKey: (input: {
|
|
|
7
8
|
cwd: string;
|
|
8
9
|
dir: string;
|
|
9
10
|
gitignore: boolean;
|
|
11
|
+
gitignoreFingerprint: string;
|
|
10
12
|
}) => string;
|
|
11
13
|
export declare const getCachedGlob: (key: string) => string[] | undefined;
|
|
12
|
-
export declare const
|
|
14
|
+
export declare const createDirTracker: () => {
|
|
15
|
+
dirs: Set<string>;
|
|
16
|
+
fs: Partial<FSLike>;
|
|
17
|
+
};
|
|
18
|
+
export declare const setCachedGlob: (key: string, paths: string[], baseDir: string, dirs?: Iterable<string>) => void;
|
package/dist/util/glob-cache.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
|
-
import { createDiskCache
|
|
4
|
-
import { dirname } from './path.js';
|
|
3
|
+
import { createDiskCache } from './disk-cache.js';
|
|
5
4
|
const store = createDiskCache('glob');
|
|
6
|
-
|
|
5
|
+
const dirMtimeCache = new Map();
|
|
6
|
+
export const initGlobCache = (cacheLocation) => {
|
|
7
|
+
dirMtimeCache.clear();
|
|
8
|
+
store.init(cacheLocation);
|
|
9
|
+
};
|
|
7
10
|
export const isGlobCacheEnabled = store.isEnabled;
|
|
8
11
|
export const flushGlobCache = store.flush;
|
|
9
|
-
export const clearGlobCache =
|
|
12
|
+
export const clearGlobCache = () => {
|
|
13
|
+
dirMtimeCache.clear();
|
|
14
|
+
store.clear();
|
|
15
|
+
};
|
|
10
16
|
export const computeGlobCacheKey = (input) => {
|
|
11
17
|
const h = createHash('sha1');
|
|
12
18
|
h.update(input.cwd);
|
|
@@ -15,15 +21,31 @@ export const computeGlobCacheKey = (input) => {
|
|
|
15
21
|
h.update('\0');
|
|
16
22
|
h.update(input.gitignore ? '1' : '0');
|
|
17
23
|
h.update('\0');
|
|
24
|
+
h.update(input.gitignoreFingerprint);
|
|
25
|
+
h.update('\0');
|
|
18
26
|
for (const p of input.patterns) {
|
|
19
27
|
h.update(p);
|
|
20
28
|
h.update('\0');
|
|
21
29
|
}
|
|
22
30
|
return h.digest('base64url');
|
|
23
31
|
};
|
|
32
|
+
const statDirMtime = (dir) => {
|
|
33
|
+
let mtime = dirMtimeCache.get(dir);
|
|
34
|
+
if (mtime === undefined) {
|
|
35
|
+
try {
|
|
36
|
+
const stat = fs.statSync(dir);
|
|
37
|
+
mtime = stat.isDirectory() ? stat.mtimeMs : Number.NaN;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
mtime = Number.NaN;
|
|
41
|
+
}
|
|
42
|
+
dirMtimeCache.set(dir, mtime);
|
|
43
|
+
}
|
|
44
|
+
return mtime;
|
|
45
|
+
};
|
|
24
46
|
const validateEntry = (entry) => {
|
|
25
47
|
for (const dir in entry.dirMtimes) {
|
|
26
|
-
if (
|
|
48
|
+
if (statDirMtime(dir) !== entry.dirMtimes[dir])
|
|
27
49
|
return false;
|
|
28
50
|
}
|
|
29
51
|
return true;
|
|
@@ -38,33 +60,34 @@ export const getCachedGlob = (key) => {
|
|
|
38
60
|
}
|
|
39
61
|
return entry.paths;
|
|
40
62
|
};
|
|
41
|
-
const
|
|
63
|
+
const trackReads = (native, dirs) => {
|
|
64
|
+
const tracked = function (path, ...rest) {
|
|
65
|
+
if (typeof path === 'string')
|
|
66
|
+
dirs.add(path);
|
|
67
|
+
return native.call(this, path, ...rest);
|
|
68
|
+
};
|
|
69
|
+
return tracked;
|
|
70
|
+
};
|
|
71
|
+
export const createDirTracker = () => {
|
|
42
72
|
const dirs = new Set();
|
|
43
|
-
dirs.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (dirs.has(d))
|
|
48
|
-
break;
|
|
49
|
-
dirs.add(d);
|
|
50
|
-
const parent = dirname(d);
|
|
51
|
-
if (parent === d)
|
|
52
|
-
break;
|
|
53
|
-
d = parent;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
73
|
+
return { dirs, fs: { readdir: trackReads(fs.readdir, dirs), readdirSync: trackReads(fs.readdirSync, dirs) } };
|
|
74
|
+
};
|
|
75
|
+
const stripTrailingSlash = (dir) => (dir.length > 1 && dir.endsWith('/') ? dir.slice(0, -1) : dir);
|
|
76
|
+
const captureDirMtimes = (dirs, baseDir) => {
|
|
56
77
|
const result = {};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
78
|
+
const baseMtime = statDirMtime(baseDir);
|
|
79
|
+
if (!Number.isNaN(baseMtime))
|
|
80
|
+
result[baseDir] = baseMtime;
|
|
81
|
+
for (const dir of dirs) {
|
|
82
|
+
const d = stripTrailingSlash(dir);
|
|
83
|
+
if (d in result)
|
|
84
|
+
continue;
|
|
85
|
+
const mtime = statDirMtime(d);
|
|
86
|
+
if (!Number.isNaN(mtime))
|
|
87
|
+
result[d] = mtime;
|
|
65
88
|
}
|
|
66
89
|
return result;
|
|
67
90
|
};
|
|
68
|
-
export const setCachedGlob = (key, paths, baseDir) => {
|
|
69
|
-
store.set(key, { paths, dirMtimes: captureDirMtimes(
|
|
91
|
+
export const setCachedGlob = (key, paths, baseDir, dirs = []) => {
|
|
92
|
+
store.set(key, { paths, dirMtimes: captureDirMtimes(dirs, baseDir) });
|
|
70
93
|
};
|
package/dist/util/glob-core.d.ts
CHANGED
|
@@ -13,11 +13,13 @@ export type Gitignores = {
|
|
|
13
13
|
ignores: Set<string>;
|
|
14
14
|
unignores: Set<string>;
|
|
15
15
|
};
|
|
16
|
+
export declare const getGitignoreFingerprint: () => string;
|
|
16
17
|
export declare const findAndParseGitignores: (cwd: string, workspaceDirs?: Set<string>) => Promise<{
|
|
17
18
|
gitignoreFiles: string[];
|
|
18
19
|
ignores: Set<string>;
|
|
19
20
|
unignores: Set<string>;
|
|
20
21
|
}>;
|
|
21
22
|
export declare function glob(_patterns: string[], options: GlobOptions): Promise<string[]>;
|
|
23
|
+
export declare function reconcileGitignoredPaths(paths: string[], cwd: string): string[];
|
|
22
24
|
export declare function getGitIgnoredHandler(options: Options, workspaceDirs?: Set<string>): Promise<(path: string) => boolean>;
|
|
23
25
|
export {};
|
package/dist/util/glob-core.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
1
2
|
import { readFileSync } from 'node:fs';
|
|
2
3
|
import { basename } from 'node:path';
|
|
3
4
|
import { fdir } from 'fdir';
|
|
@@ -10,9 +11,25 @@ import { isDirectory, isFile } from './fs.js';
|
|
|
10
11
|
import { getCachedGitignore, isGitignoreCacheEnabled, setCachedGitignore } from './gitignore-cache.js';
|
|
11
12
|
import { timerify } from './Performance.js';
|
|
12
13
|
import { expandIgnorePatterns, parseAndConvertGitignorePatterns } from './parse-and-convert-gitignores.js';
|
|
13
|
-
import { dirname, join, relative, toPosix } from './path.js';
|
|
14
|
+
import { dirname, isAbsolute, join, relative, toPosix } from './path.js';
|
|
14
15
|
const cachedGitIgnores = new Map();
|
|
15
16
|
const cachedGlobIgnores = new Map();
|
|
17
|
+
let gitignoreReconciler;
|
|
18
|
+
let gitignoreFingerprint = '';
|
|
19
|
+
export const getGitignoreFingerprint = () => gitignoreFingerprint;
|
|
20
|
+
const hashIgnores = (ignores, unignores) => {
|
|
21
|
+
const h = createHash('sha1');
|
|
22
|
+
for (const p of [...ignores].sort()) {
|
|
23
|
+
h.update(p);
|
|
24
|
+
h.update('\0');
|
|
25
|
+
}
|
|
26
|
+
h.update('\u0001');
|
|
27
|
+
for (const p of [...unignores].sort()) {
|
|
28
|
+
h.update(p);
|
|
29
|
+
h.update('\0');
|
|
30
|
+
}
|
|
31
|
+
return h.digest('base64url');
|
|
32
|
+
};
|
|
16
33
|
const isGitRoot = (dir) => isDirectory(dir, '.git') || isFile(dir, '.git');
|
|
17
34
|
const getGitDir = (cwd) => {
|
|
18
35
|
const dotGit = join(cwd, '.git');
|
|
@@ -194,15 +211,23 @@ export const findAndParseGitignores = async (cwd, workspaceDirs) => {
|
|
|
194
211
|
p = parent;
|
|
195
212
|
}
|
|
196
213
|
}
|
|
214
|
+
const isShadowed = new Map();
|
|
197
215
|
for (const cacheForDir of cachedGitIgnores.values()) {
|
|
198
216
|
for (const pattern of cacheForDir.ignores) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
217
|
+
let shadowed = isShadowed.get(pattern);
|
|
218
|
+
if (shadowed === undefined) {
|
|
219
|
+
const match = picomatch(pattern);
|
|
220
|
+
shadowed = false;
|
|
221
|
+
for (const p of unignorePaths) {
|
|
222
|
+
if (match(p)) {
|
|
223
|
+
shadowed = true;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
204
226
|
}
|
|
227
|
+
isShadowed.set(pattern, shadowed);
|
|
205
228
|
}
|
|
229
|
+
if (shadowed)
|
|
230
|
+
cacheForDir.ignores.delete(pattern);
|
|
206
231
|
}
|
|
207
232
|
}
|
|
208
233
|
}
|
|
@@ -233,7 +258,12 @@ export async function glob(_patterns, options) {
|
|
|
233
258
|
cachedGlobIgnores.set(options.dir, compact(_ignore));
|
|
234
259
|
}
|
|
235
260
|
const ignorePatterns = (cachedIgnores ?? _ignore).concat(negatedPatterns.map(pattern => pattern.slice(1)));
|
|
236
|
-
const { dir, label, ...fgOptions } = {
|
|
261
|
+
const { dir, label, ...fgOptions } = {
|
|
262
|
+
...options,
|
|
263
|
+
ignore: ignorePatterns,
|
|
264
|
+
expandDirectories: false,
|
|
265
|
+
followSymbolicLinks: false,
|
|
266
|
+
};
|
|
237
267
|
const paths = await tinyGlob(patterns, fgOptions);
|
|
238
268
|
debugLogObject(relative(options.cwd, dir), label ? `Finding ${label}` : 'Finding paths', () => ({
|
|
239
269
|
patterns,
|
|
@@ -245,11 +275,24 @@ export async function glob(_patterns, options) {
|
|
|
245
275
|
}));
|
|
246
276
|
return paths;
|
|
247
277
|
}
|
|
278
|
+
export function reconcileGitignoredPaths(paths, cwd) {
|
|
279
|
+
if (!gitignoreReconciler || paths.length === 0)
|
|
280
|
+
return paths;
|
|
281
|
+
const isGitIgnored = gitignoreReconciler;
|
|
282
|
+
const result = [];
|
|
283
|
+
for (const path of paths)
|
|
284
|
+
if (!isGitIgnored(isAbsolute(path) ? path : join(cwd, path)))
|
|
285
|
+
result.push(path);
|
|
286
|
+
return result;
|
|
287
|
+
}
|
|
248
288
|
export async function getGitIgnoredHandler(options, workspaceDirs) {
|
|
249
289
|
cachedGitIgnores.clear();
|
|
290
|
+
gitignoreReconciler = undefined;
|
|
291
|
+
gitignoreFingerprint = '';
|
|
250
292
|
if (options.gitignore === false)
|
|
251
293
|
return () => false;
|
|
252
294
|
const { ignores, unignores } = await _parseFindGitignores(options.cwd, workspaceDirs);
|
|
295
|
+
gitignoreFingerprint = hashIgnores(ignores, unignores);
|
|
253
296
|
const matcher = picomatch(expandIgnorePatterns(ignores), { ignore: expandIgnorePatterns(unignores) });
|
|
254
297
|
const cache = new Map();
|
|
255
298
|
const isGitIgnored = (filePath) => {
|
|
@@ -260,5 +303,7 @@ export async function getGitIgnoredHandler(options, workspaceDirs) {
|
|
|
260
303
|
}
|
|
261
304
|
return result;
|
|
262
305
|
};
|
|
306
|
+
if (unignores.size > 0)
|
|
307
|
+
gitignoreReconciler = isGitIgnored;
|
|
263
308
|
return isGitIgnored;
|
|
264
309
|
}
|
package/dist/util/glob.d.ts
CHANGED
|
@@ -11,10 +11,13 @@ export declare const prependDirToPattern: (dir: string, pattern: string) => stri
|
|
|
11
11
|
export declare const negate: (pattern: string) => string;
|
|
12
12
|
export declare const hasProductionSuffix: (pattern: string) => boolean;
|
|
13
13
|
export declare const hasNoProductionSuffix: (pattern: string) => boolean;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
declare const defaultGlob: ({ cwd, dir, patterns, gitignore, label }: GlobOptions) => Promise<string[]>;
|
|
15
|
+
declare const syncGlob: ({ cwd, patterns }: {
|
|
16
16
|
cwd: string;
|
|
17
17
|
patterns: string | string[];
|
|
18
18
|
}) => string[];
|
|
19
|
-
|
|
19
|
+
declare const dirGlob: ({ cwd, patterns, gitignore }: GlobOptions) => Promise<string[]>;
|
|
20
|
+
export declare const _glob: typeof defaultGlob;
|
|
21
|
+
export declare const _syncGlob: typeof syncGlob;
|
|
22
|
+
export declare const _dirGlob: typeof dirGlob;
|
|
20
23
|
export {};
|
package/dist/util/glob.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { globSync } from 'tinyglobby';
|
|
2
2
|
import { compact } from './array.js';
|
|
3
|
-
import { computeGlobCacheKey, getCachedGlob, isGlobCacheEnabled, setCachedGlob } from './glob-cache.js';
|
|
4
|
-
import { glob } from './glob-core.js';
|
|
3
|
+
import { computeGlobCacheKey, createDirTracker, getCachedGlob, isGlobCacheEnabled, setCachedGlob, } from './glob-cache.js';
|
|
4
|
+
import { getGitignoreFingerprint, glob, reconcileGitignoredPaths } from './glob-core.js';
|
|
5
5
|
import { timerify } from './Performance.js';
|
|
6
6
|
import { isAbsolute, join, relative } from './path.js';
|
|
7
7
|
const prepend = (pattern, relativePath) => isAbsolute(pattern.replace(/^!/, '')) ? pattern : prependDirToPattern(relativePath, pattern);
|
|
@@ -23,12 +23,16 @@ const defaultGlob = async ({ cwd, dir = cwd, patterns, gitignore = true, label }
|
|
|
23
23
|
if (globPatterns[0].startsWith('!'))
|
|
24
24
|
return [];
|
|
25
25
|
const cacheEnabled = isGlobCacheEnabled();
|
|
26
|
-
const
|
|
26
|
+
const gitignoreFingerprint = gitignore ? getGitignoreFingerprint() : '';
|
|
27
|
+
const cacheKey = cacheEnabled
|
|
28
|
+
? computeGlobCacheKey({ patterns: globPatterns, cwd, dir, gitignore, gitignoreFingerprint })
|
|
29
|
+
: '';
|
|
27
30
|
if (cacheEnabled) {
|
|
28
31
|
const cached = getCachedGlob(cacheKey);
|
|
29
32
|
if (cached)
|
|
30
|
-
return cached;
|
|
33
|
+
return gitignore ? reconcileGitignoredPaths(cached, cwd) : cached;
|
|
31
34
|
}
|
|
35
|
+
const tracker = cacheEnabled ? createDirTracker() : undefined;
|
|
32
36
|
const paths = await glob(globPatterns, {
|
|
33
37
|
cwd,
|
|
34
38
|
dir,
|
|
@@ -36,23 +40,33 @@ const defaultGlob = async ({ cwd, dir = cwd, patterns, gitignore = true, label }
|
|
|
36
40
|
absolute: true,
|
|
37
41
|
dot: true,
|
|
38
42
|
label,
|
|
43
|
+
fs: tracker?.fs,
|
|
39
44
|
});
|
|
40
45
|
if (cacheEnabled && paths.length > 0)
|
|
41
|
-
setCachedGlob(cacheKey, paths, dir);
|
|
42
|
-
return paths;
|
|
46
|
+
setCachedGlob(cacheKey, paths, dir, tracker?.dirs);
|
|
47
|
+
return gitignore ? reconcileGitignoredPaths(paths, cwd) : paths;
|
|
43
48
|
};
|
|
44
49
|
const syncGlob = ({ cwd, patterns }) => {
|
|
45
50
|
const cacheEnabled = isGlobCacheEnabled();
|
|
46
51
|
const patternList = Array.isArray(patterns) ? patterns : [patterns];
|
|
47
|
-
const cacheKey = cacheEnabled
|
|
52
|
+
const cacheKey = cacheEnabled
|
|
53
|
+
? computeGlobCacheKey({ patterns: patternList, cwd, dir: cwd, gitignore: false, gitignoreFingerprint: '' })
|
|
54
|
+
: '';
|
|
48
55
|
if (cacheEnabled) {
|
|
49
56
|
const cached = getCachedGlob(cacheKey);
|
|
50
57
|
if (cached)
|
|
51
58
|
return cached;
|
|
52
59
|
}
|
|
53
|
-
const
|
|
60
|
+
const tracker = cacheEnabled ? createDirTracker() : undefined;
|
|
61
|
+
const paths = globSync(patterns, {
|
|
62
|
+
cwd,
|
|
63
|
+
absolute: true,
|
|
64
|
+
followSymbolicLinks: false,
|
|
65
|
+
expandDirectories: false,
|
|
66
|
+
fs: tracker?.fs,
|
|
67
|
+
});
|
|
54
68
|
if (cacheEnabled && paths.length > 0)
|
|
55
|
-
setCachedGlob(cacheKey, paths, cwd);
|
|
69
|
+
setCachedGlob(cacheKey, paths, cwd, tracker?.dirs);
|
|
56
70
|
return paths;
|
|
57
71
|
};
|
|
58
72
|
const dirGlob = async ({ cwd, patterns, gitignore = true }) => glob(patterns, {
|
package/dist/util/loader.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const toExtendedIgnorePattern: (pattern: string) => string;
|
|
2
|
-
export declare const expandIgnorePatterns: (patterns: Iterable<string
|
|
1
|
+
export declare const toExtendedIgnorePattern: (pattern: string, shallow?: boolean) => string;
|
|
2
|
+
export declare const expandIgnorePatterns: (patterns: Iterable<string>, shallow?: boolean) => string[];
|
|
3
3
|
export declare const convertGitignoreToPicomatchIgnorePatterns: (pattern: string) => {
|
|
4
4
|
negated: boolean;
|
|
5
5
|
pattern: string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export const toExtendedIgnorePattern = (pattern) => {
|
|
1
|
+
export const toExtendedIgnorePattern = (pattern, shallow = false) => {
|
|
2
2
|
if (pattern === '*' || pattern === '**')
|
|
3
3
|
return pattern;
|
|
4
|
-
if (pattern.endsWith('/*'))
|
|
4
|
+
if (shallow && pattern.endsWith('/*'))
|
|
5
5
|
return pattern;
|
|
6
6
|
return `${pattern}/**`;
|
|
7
7
|
};
|
|
8
|
-
export const expandIgnorePatterns = (patterns) => {
|
|
8
|
+
export const expandIgnorePatterns = (patterns, shallow = false) => {
|
|
9
9
|
const result = [];
|
|
10
10
|
for (const p of patterns) {
|
|
11
11
|
result.push(p);
|
|
12
|
-
const ext = toExtendedIgnorePattern(p);
|
|
12
|
+
const ext = toExtendedIgnorePattern(p, shallow);
|
|
13
13
|
if (ext !== p)
|
|
14
14
|
result.push(ext);
|
|
15
15
|
}
|
package/dist/util/reporter.js
CHANGED
|
@@ -3,9 +3,10 @@ import { _load } from './loader.js';
|
|
|
3
3
|
import { isAbsolute, isInternal, resolve } from './path.js';
|
|
4
4
|
export const runPreprocessors = async (processors, data) => {
|
|
5
5
|
const preprocessors = await Promise.all(processors.map(proc => _load(isInternal(proc) && !isAbsolute(proc) ? resolve(proc) : proc)));
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
let result = data;
|
|
7
|
+
for (const preprocessor of preprocessors)
|
|
8
|
+
result = await preprocessor(result);
|
|
9
|
+
return result;
|
|
9
10
|
};
|
|
10
11
|
export const runReporters = async (reporter, options) => {
|
|
11
12
|
const reporters = await Promise.all(reporter.map(async (reporter) => {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.
|
|
1
|
+
export declare const version = "6.29.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '6.
|
|
1
|
+
export const version = '6.29.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.29.0",
|
|
4
4
|
"description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analysis",
|
|
@@ -81,25 +81,25 @@
|
|
|
81
81
|
"formatly": "^0.3.0",
|
|
82
82
|
"get-tsconfig": "4.14.0",
|
|
83
83
|
"jiti": "^2.7.0",
|
|
84
|
-
"oxc-parser": "^0.
|
|
85
|
-
"oxc-resolver": "11.
|
|
86
|
-
"picomatch": "^4.0.
|
|
87
|
-
"smol-toml": "^1.
|
|
84
|
+
"oxc-parser": "^0.140.0",
|
|
85
|
+
"oxc-resolver": "11.24.2",
|
|
86
|
+
"picomatch": "^4.0.5",
|
|
87
|
+
"smol-toml": "^1.7.0",
|
|
88
88
|
"strip-json-comments": "5.0.3",
|
|
89
89
|
"tinyglobby": "^0.2.17",
|
|
90
|
-
"unbash": "^4.0.
|
|
90
|
+
"unbash": "^4.0.3",
|
|
91
91
|
"yaml": "^2.9.0",
|
|
92
|
-
"zod": "^4.
|
|
92
|
+
"zod": "^4.4.3"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@jest/types": "^30.4.1",
|
|
96
96
|
"@types/bun": "^1.3.14",
|
|
97
97
|
"@types/picomatch": "^4.0.3",
|
|
98
98
|
"@types/webpack": "^5.28.5",
|
|
99
|
-
"@typescript/native-preview": "7.0.0-dev.20260619.1",
|
|
100
99
|
"codeclimate-types": "^0.3.1",
|
|
101
|
-
"prettier": "^3.
|
|
102
|
-
"tsx": "^4.
|
|
100
|
+
"prettier": "^3.9.5",
|
|
101
|
+
"tsx": "^4.23.1",
|
|
102
|
+
"typescript": "7.0.2"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|
|
105
105
|
"node": "^20.19.0 || >=22.12.0"
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"fmt": "oxfmt -c ../../.oxfmtrc.json --ignore-path ../../.prettierignore",
|
|
113
113
|
"test": "node scripts/run-test.js",
|
|
114
114
|
"prebuild": "pnpm run generate-plugin-defs && node rmdir.js dist",
|
|
115
|
-
"build": "
|
|
115
|
+
"build": "tsc",
|
|
116
116
|
"qa": "pnpm lint && pnpm build && pnpm knip && pnpm knip:production && pnpm test",
|
|
117
117
|
"release": "NODE_OPTIONS=--no-deprecation release-it",
|
|
118
118
|
"create-plugin": "node ./scripts/create-new-plugin.ts",
|
package/schema.json
CHANGED
|
@@ -726,6 +726,10 @@
|
|
|
726
726
|
"title": "openapi-ts plugin configuration (https://knip.dev/reference/plugins/openapi-ts)",
|
|
727
727
|
"$ref": "#/definitions/plugin"
|
|
728
728
|
},
|
|
729
|
+
"openclaw": {
|
|
730
|
+
"title": "openclaw plugin configuration (https://knip.dev/reference/plugins/openclaw)",
|
|
731
|
+
"$ref": "#/definitions/plugin"
|
|
732
|
+
},
|
|
729
733
|
"orval": {
|
|
730
734
|
"title": "orval plugin configuration (https://knip.dev/reference/plugins/orval)",
|
|
731
735
|
"$ref": "#/definitions/plugin"
|