knip 5.73.3 → 5.74.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/ProjectPrincipal.d.ts +0 -1
- package/dist/ProjectPrincipal.js +18 -13
- package/dist/binaries/package-manager/bun.js +10 -0
- package/dist/compilers/index.d.ts +10 -0
- package/dist/compilers/scss.js +1 -1
- package/dist/constants.d.ts +6 -1
- package/dist/constants.js +6 -1
- package/dist/graph/build.js +18 -9
- package/dist/graph-explorer/visitors.js +3 -3
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/swc/index.d.ts +3 -0
- package/dist/plugins/swc/index.js +18 -0
- package/dist/plugins/swc/types.d.ts +7 -0
- package/dist/plugins/swc/types.js +1 -0
- package/dist/schema/configuration.d.ts +10 -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/exports.d.ts +14 -13
- package/dist/types/imports.d.ts +7 -7
- package/dist/types/module-graph.d.ts +27 -26
- package/dist/typescript/ast-helpers.d.ts +5 -3
- package/dist/typescript/ast-helpers.js +5 -2
- package/dist/typescript/create-hosts.d.ts +1 -2
- package/dist/typescript/create-hosts.js +2 -2
- package/dist/typescript/get-imports-and-exports.js +18 -15
- package/dist/typescript/pragmas/custom.js +11 -3
- package/dist/typescript/pragmas/typescript.js +20 -4
- package/dist/typescript/resolve-module-names.d.ts +1 -1
- package/dist/typescript/resolve-module-names.js +5 -9
- package/dist/typescript/visitors/dynamic-imports/importCall.js +100 -14
- package/dist/typescript/visitors/dynamic-imports/importType.js +5 -2
- package/dist/typescript/visitors/dynamic-imports/jsDocType.js +13 -4
- package/dist/typescript/visitors/dynamic-imports/requireCall.js +52 -8
- package/dist/typescript/visitors/dynamic-imports/resolveCall.js +5 -2
- package/dist/typescript/visitors/dynamic-imports/urlConstructor.js +5 -2
- package/dist/typescript/visitors/exports/exportAssignment.js +7 -9
- package/dist/typescript/visitors/exports/exportDeclaration.js +2 -2
- package/dist/typescript/visitors/exports/exportKeyword.js +49 -10
- package/dist/typescript/visitors/exports/exportsAccessExpression.js +4 -1
- package/dist/typescript/visitors/exports/moduleExportsAccessExpression.js +27 -3
- package/dist/typescript/visitors/imports/importDeclaration.js +19 -3
- package/dist/typescript/visitors/imports/importEqualsDeclaration.js +3 -2
- package/dist/typescript/visitors/imports/reExportDeclaration.js +15 -5
- package/dist/util/create-options.d.ts +10 -0
- package/dist/util/errors.js +2 -0
- package/dist/util/get-referenced-inputs.js +3 -3
- package/dist/util/module-graph.d.ts +0 -1
- package/dist/util/module-graph.js +3 -2
- package/dist/util/modules.js +7 -1
- package/dist/util/resolve.js +3 -3
- package/dist/util/to-source-path.d.ts +2 -2
- package/dist/util/to-source-path.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/schema.json +4 -0
|
@@ -542,6 +542,11 @@ export declare class ConfigurationChief {
|
|
|
542
542
|
entry?: string | string[] | undefined;
|
|
543
543
|
project?: string | string[] | undefined;
|
|
544
544
|
} | undefined;
|
|
545
|
+
swc?: string | boolean | string[] | {
|
|
546
|
+
config?: string | string[] | undefined;
|
|
547
|
+
entry?: string | string[] | undefined;
|
|
548
|
+
project?: string | string[] | undefined;
|
|
549
|
+
} | undefined;
|
|
545
550
|
syncpack?: string | boolean | string[] | {
|
|
546
551
|
config?: string | string[] | undefined;
|
|
547
552
|
entry?: string | string[] | undefined;
|
|
@@ -779,6 +784,7 @@ export declare class ConfigurationChief {
|
|
|
779
784
|
svelte?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
780
785
|
svgo?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
781
786
|
svgr?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
787
|
+
swc?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
782
788
|
syncpack?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
783
789
|
tailwind?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
784
790
|
taskfile?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
package/dist/ProjectPrincipal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import { CacheConsultant } from './CacheConsultant.js';
|
|
3
3
|
import { getCompilerExtensions } from './compilers/index.js';
|
|
4
|
-
import { ANONYMOUS, DEFAULT_EXTENSIONS, PUBLIC_TAG } from './constants.js';
|
|
4
|
+
import { ANONYMOUS, DEFAULT_EXTENSIONS, MEMBER_FLAGS, PUBLIC_TAG } from './constants.js';
|
|
5
5
|
import { createHosts } from './typescript/create-hosts.js';
|
|
6
6
|
import { _getImportsAndExports } from './typescript/get-imports-and-exports.js';
|
|
7
7
|
import { SourceFileManager } from './typescript/SourceFileManager.js';
|
|
@@ -36,7 +36,6 @@ export class ProjectPrincipal {
|
|
|
36
36
|
extensions;
|
|
37
37
|
syncCompilers;
|
|
38
38
|
asyncCompilers;
|
|
39
|
-
isSkipLibs;
|
|
40
39
|
isWatch;
|
|
41
40
|
cache;
|
|
42
41
|
toSourceFilePath;
|
|
@@ -55,7 +54,6 @@ export class ProjectPrincipal {
|
|
|
55
54
|
this.syncCompilers = syncCompilers;
|
|
56
55
|
this.asyncCompilers = asyncCompilers;
|
|
57
56
|
this.cwd = options.cwd;
|
|
58
|
-
this.isSkipLibs = options.isSkipLibs;
|
|
59
57
|
this.isWatch = options.isWatch;
|
|
60
58
|
this.cache = new CacheConsultant(pkgName || ANONYMOUS, options);
|
|
61
59
|
this.toSourceFilePath = toSourceFilePath;
|
|
@@ -69,7 +67,6 @@ export class ProjectPrincipal {
|
|
|
69
67
|
compilerOptions: this.compilerOptions,
|
|
70
68
|
entryPaths: this.entryPaths,
|
|
71
69
|
compilers: [this.syncCompilers, this.asyncCompilers],
|
|
72
|
-
isSkipLibs: this.isSkipLibs,
|
|
73
70
|
toSourceFilePath: this.toSourceFilePath,
|
|
74
71
|
useResolverCache: !this.isWatch,
|
|
75
72
|
fileManager: this.backend.fileManager,
|
|
@@ -183,21 +180,30 @@ export class ProjectPrincipal {
|
|
|
183
180
|
return members.filter(member => {
|
|
184
181
|
if (member.jsDocTags.has(PUBLIC_TAG))
|
|
185
182
|
return false;
|
|
186
|
-
const implementations = this.getImplementationAtPosition
|
|
187
|
-
const referencedSymbols = this.findReferences
|
|
183
|
+
const implementations = this.getImplementationAtPosition(filePath, member.pos)?.filter(impl => impl.fileName !== filePath || impl.textSpan.start !== member.pos) ?? [];
|
|
184
|
+
const referencedSymbols = this.findReferences(filePath, member.pos) ?? [];
|
|
185
|
+
if (referencedSymbols.length > 1 && referencedSymbols.some(sym => isInNodeModules(sym.definition.fileName))) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
const refs = referencedSymbols
|
|
189
|
+
.filter(sym => !implementations.some(impl => impl.fileName === sym.definition.fileName &&
|
|
188
190
|
impl.textSpan.start === sym.definition.textSpan.start &&
|
|
189
|
-
impl.textSpan.length === sym.definition.textSpan.length))
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
impl.textSpan.length === sym.definition.textSpan.length))
|
|
192
|
+
.flatMap(refs => refs.references)
|
|
193
|
+
.filter(ref => !ref.isDefinition);
|
|
194
|
+
if (refs.length === 0)
|
|
195
|
+
return true;
|
|
196
|
+
if (member.flags & MEMBER_FLAGS.SETTER)
|
|
197
|
+
return false;
|
|
198
|
+
return !refs.some(ref => !ref.isWriteAccess);
|
|
192
199
|
});
|
|
193
200
|
}
|
|
194
201
|
hasExternalReferences(filePath, exportedItem) {
|
|
195
202
|
if (exportedItem.jsDocTags.has(PUBLIC_TAG))
|
|
196
203
|
return false;
|
|
197
|
-
if (!this.findReferences
|
|
204
|
+
if (!this.findReferences) {
|
|
198
205
|
const languageService = ts.createLanguageService(this.backend.languageServiceHost, ts.createDocumentRegistry());
|
|
199
206
|
this.findReferences = timerify(languageService.findReferences);
|
|
200
|
-
this.getImplementationAtPosition = timerify(languageService.getImplementationAtPosition);
|
|
201
207
|
}
|
|
202
208
|
const referencedSymbols = this.findReferences(filePath, exportedItem.pos);
|
|
203
209
|
if (!referencedSymbols?.length)
|
|
@@ -221,8 +227,7 @@ export class ProjectPrincipal {
|
|
|
221
227
|
const fd = this.cache.getFileDescriptor(filePath);
|
|
222
228
|
if (!fd?.meta)
|
|
223
229
|
continue;
|
|
224
|
-
|
|
225
|
-
fd.meta.data = clone;
|
|
230
|
+
fd.meta.data = { ...file, internalImportCache: undefined, imported: undefined };
|
|
226
231
|
}
|
|
227
232
|
this.cache.reconcile();
|
|
228
233
|
}
|
|
@@ -6,17 +6,27 @@ import { resolveX } from './bunx.js';
|
|
|
6
6
|
const commands = [
|
|
7
7
|
'add',
|
|
8
8
|
'audit',
|
|
9
|
+
'build',
|
|
9
10
|
'ci',
|
|
10
11
|
'create',
|
|
12
|
+
'exec',
|
|
13
|
+
'feedback',
|
|
14
|
+
'info',
|
|
11
15
|
'init',
|
|
12
16
|
'install',
|
|
13
17
|
'link',
|
|
18
|
+
'outdated',
|
|
19
|
+
'patch',
|
|
14
20
|
'pm',
|
|
21
|
+
'publish',
|
|
15
22
|
'remove',
|
|
23
|
+
'repl',
|
|
16
24
|
'run',
|
|
17
25
|
'test',
|
|
26
|
+
'unlink',
|
|
18
27
|
'update',
|
|
19
28
|
'upgrade',
|
|
29
|
+
'why',
|
|
20
30
|
'x',
|
|
21
31
|
];
|
|
22
32
|
export const resolve = (_binary, args, options) => {
|
|
@@ -494,6 +494,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
494
494
|
entry?: string | string[] | undefined;
|
|
495
495
|
project?: string | string[] | undefined;
|
|
496
496
|
} | undefined;
|
|
497
|
+
swc?: string | boolean | string[] | {
|
|
498
|
+
config?: string | string[] | undefined;
|
|
499
|
+
entry?: string | string[] | undefined;
|
|
500
|
+
project?: string | string[] | undefined;
|
|
501
|
+
} | undefined;
|
|
497
502
|
syncpack?: string | boolean | string[] | {
|
|
498
503
|
config?: string | string[] | undefined;
|
|
499
504
|
entry?: string | string[] | undefined;
|
|
@@ -1105,6 +1110,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1105
1110
|
entry?: string | string[] | undefined;
|
|
1106
1111
|
project?: string | string[] | undefined;
|
|
1107
1112
|
} | undefined;
|
|
1113
|
+
swc?: string | boolean | string[] | {
|
|
1114
|
+
config?: string | string[] | undefined;
|
|
1115
|
+
entry?: string | string[] | undefined;
|
|
1116
|
+
project?: string | string[] | undefined;
|
|
1117
|
+
} | undefined;
|
|
1108
1118
|
syncpack?: string | boolean | string[] | {
|
|
1109
1119
|
config?: string | string[] | undefined;
|
|
1110
1120
|
entry?: string | string[] | undefined;
|
package/dist/compilers/scss.js
CHANGED
|
@@ -6,7 +6,7 @@ const compiler = (text) => {
|
|
|
6
6
|
let match;
|
|
7
7
|
let index = 0;
|
|
8
8
|
while ((match = importMatcher.exec(text))) {
|
|
9
|
-
if (match[2])
|
|
9
|
+
if (match[2] && !match[2].startsWith('sass:'))
|
|
10
10
|
imports.push(`import _$${index++} from '${match[1] ? match[2] : toRelative(match[2])}';`);
|
|
11
11
|
}
|
|
12
12
|
return imports.join('\n');
|
package/dist/constants.d.ts
CHANGED
|
@@ -50,9 +50,13 @@ export declare const FIX_FLAGS: {
|
|
|
50
50
|
readonly EMPTY_DECLARATION: number;
|
|
51
51
|
readonly WITH_NEWLINE: number;
|
|
52
52
|
};
|
|
53
|
+
export declare const MEMBER_FLAGS: {
|
|
54
|
+
readonly NONE: 0;
|
|
55
|
+
readonly SETTER: number;
|
|
56
|
+
};
|
|
53
57
|
export declare const SIDE_EFFECTS = "__side-effects";
|
|
54
58
|
export declare const OPAQUE = "__opaque";
|
|
55
|
-
export declare const
|
|
59
|
+
export declare const IMPORT_FLAGS: {
|
|
56
60
|
readonly NONE: 0;
|
|
57
61
|
readonly RE_EXPORT: number;
|
|
58
62
|
readonly TYPE_ONLY: number;
|
|
@@ -62,3 +66,4 @@ export declare const IMPORT_MODIFIERS: {
|
|
|
62
66
|
readonly SIDE_EFFECTS: number;
|
|
63
67
|
readonly OPAQUE: number;
|
|
64
68
|
};
|
|
69
|
+
export declare const EMPTY_ARRAY: readonly never[];
|
package/dist/constants.js
CHANGED
|
@@ -210,9 +210,13 @@ export const FIX_FLAGS = {
|
|
|
210
210
|
EMPTY_DECLARATION: 1 << 1,
|
|
211
211
|
WITH_NEWLINE: 1 << 2,
|
|
212
212
|
};
|
|
213
|
+
export const MEMBER_FLAGS = {
|
|
214
|
+
NONE: 0,
|
|
215
|
+
SETTER: 1 << 0,
|
|
216
|
+
};
|
|
213
217
|
export const SIDE_EFFECTS = '__side-effects';
|
|
214
218
|
export const OPAQUE = '__opaque';
|
|
215
|
-
export const
|
|
219
|
+
export const IMPORT_FLAGS = {
|
|
216
220
|
NONE: 0,
|
|
217
221
|
RE_EXPORT: 1 << 0,
|
|
218
222
|
TYPE_ONLY: 1 << 1,
|
|
@@ -222,3 +226,4 @@ export const IMPORT_MODIFIERS = {
|
|
|
222
226
|
SIDE_EFFECTS: 1 << 5,
|
|
223
227
|
OPAQUE: 1 << 6,
|
|
224
228
|
};
|
|
229
|
+
export const EMPTY_ARRAY = [];
|
package/dist/graph/build.js
CHANGED
|
@@ -6,17 +6,17 @@ import { getReferencedInputsHandler } from '../util/get-referenced-inputs.js';
|
|
|
6
6
|
import { _glob, _syncGlob, negate, prependDirToPattern } from '../util/glob.js';
|
|
7
7
|
import { isAlias, isConfig, isDeferResolveEntry, isDeferResolveProductionEntry, isEntry, isIgnore, isProductionEntry, isProject, toProductionEntry, } from '../util/input.js';
|
|
8
8
|
import { loadTSConfig } from '../util/load-tsconfig.js';
|
|
9
|
-
import {
|
|
9
|
+
import { updateImportMap } from '../util/module-graph.js';
|
|
10
10
|
import { getPackageNameFromModuleSpecifier, isStartsLikePackageName, sanitizeSpecifier } from '../util/modules.js';
|
|
11
11
|
import { perfObserver } from '../util/Performance.js';
|
|
12
12
|
import { getEntrySpecifiersFromManifest, getManifestImportDependencies } from '../util/package-json.js';
|
|
13
13
|
import { dirname, extname, isAbsolute, join, relative, toRelative } from '../util/path.js';
|
|
14
|
-
import { augmentWorkspace,
|
|
14
|
+
import { augmentWorkspace, getModuleSourcePathHandler, getToSourcePathsHandler } from '../util/to-source-path.js';
|
|
15
15
|
import { WorkspaceWorker } from '../WorkspaceWorker.js';
|
|
16
16
|
export async function build({ chief, collector, counselor, deputy, factory, isGitIgnored, streamer, workspaces, options, }) {
|
|
17
17
|
const configFilesMap = new Map();
|
|
18
18
|
const enabledPluginsStore = new Map();
|
|
19
|
-
const
|
|
19
|
+
const toModuleSourceFilePath = getModuleSourcePathHandler(chief);
|
|
20
20
|
const toSourceFilePaths = getToSourcePathsHandler(chief);
|
|
21
21
|
const addIssue = (issue) => collector.addIssue(issue) && options.isWatch && collector.retainIssue(issue);
|
|
22
22
|
const getReferencedInternalFilePath = getReferencedInputsHandler(deputy, chief, isGitIgnored, addIssue);
|
|
@@ -99,7 +99,7 @@ export async function build({ chief, collector, counselor, deputy, factory, isGi
|
|
|
99
99
|
compilerOptions,
|
|
100
100
|
compilers,
|
|
101
101
|
pkgName,
|
|
102
|
-
toSourceFilePath,
|
|
102
|
+
toSourceFilePath: toModuleSourceFilePath,
|
|
103
103
|
});
|
|
104
104
|
principal.addPaths(config.paths, dir);
|
|
105
105
|
const inputsFromPlugins = await worker.runPlugins();
|
|
@@ -313,12 +313,21 @@ export async function build({ chief, collector, counselor, deputy, factory, isGi
|
|
|
313
313
|
principal.addEntryPath(specifierFilePath, { skipExportsAnalysis: true });
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
const node = getOrCreateFileNode(graph, filePath);
|
|
317
316
|
file.imports.unresolved = unresolvedImports;
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
317
|
+
const node = graph.get(filePath);
|
|
318
|
+
if (node) {
|
|
319
|
+
node.imports = file.imports;
|
|
320
|
+
node.exports = file.exports;
|
|
321
|
+
node.duplicates = file.duplicates;
|
|
322
|
+
node.scripts = file.scripts;
|
|
323
|
+
updateImportMap(node, file.imports.internal, graph);
|
|
324
|
+
node.internalImportCache = file.imports.internal;
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
updateImportMap(file, file.imports.internal, graph);
|
|
328
|
+
file.internalImportCache = file.imports.internal;
|
|
329
|
+
graph.set(filePath, file);
|
|
330
|
+
}
|
|
322
331
|
}
|
|
323
332
|
};
|
|
324
333
|
for (let i = 0; i < principals.length; ++i) {
|
|
@@ -3,7 +3,7 @@ export const forEachPassThroughReExport = (importMaps, callback) => {
|
|
|
3
3
|
for (const [identifier, sources] of importMaps.reExported) {
|
|
4
4
|
if (identifier === IMPORT_STAR)
|
|
5
5
|
continue;
|
|
6
|
-
if (callback(identifier, sources
|
|
6
|
+
if (callback(identifier, sources) === false)
|
|
7
7
|
return false;
|
|
8
8
|
}
|
|
9
9
|
return true;
|
|
@@ -11,7 +11,7 @@ export const forEachPassThroughReExport = (importMaps, callback) => {
|
|
|
11
11
|
export const forEachAliasReExport = (importMaps, callback) => {
|
|
12
12
|
for (const [identifier, aliasMap] of importMaps.reExportedAs) {
|
|
13
13
|
for (const [alias, sources] of aliasMap) {
|
|
14
|
-
if (callback(identifier, alias, sources
|
|
14
|
+
if (callback(identifier, alias, sources) === false)
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -19,7 +19,7 @@ export const forEachAliasReExport = (importMaps, callback) => {
|
|
|
19
19
|
};
|
|
20
20
|
export const forEachNamespaceReExport = (importMaps, callback) => {
|
|
21
21
|
for (const [namespace, sources] of importMaps.reExportedNs) {
|
|
22
|
-
if (callback(namespace, sources
|
|
22
|
+
if (callback(namespace, sources) === false)
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
25
25
|
return true;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -97,6 +97,7 @@ export declare const Plugins: {
|
|
|
97
97
|
svelte: import("../types/config.js").Plugin;
|
|
98
98
|
svgo: import("../types/config.js").Plugin;
|
|
99
99
|
svgr: import("../types/config.js").Plugin;
|
|
100
|
+
swc: import("../types/config.js").Plugin;
|
|
100
101
|
syncpack: import("../types/config.js").Plugin;
|
|
101
102
|
tailwind: import("../types/config.js").Plugin;
|
|
102
103
|
taskfile: import("../types/config.js").Plugin;
|
package/dist/plugins/index.js
CHANGED
|
@@ -96,6 +96,7 @@ import { default as stylelint } from './stylelint/index.js';
|
|
|
96
96
|
import { default as svelte } from './svelte/index.js';
|
|
97
97
|
import { default as svgo } from './svgo/index.js';
|
|
98
98
|
import { default as svgr } from './svgr/index.js';
|
|
99
|
+
import { default as swc } from './swc/index.js';
|
|
99
100
|
import { default as syncpack } from './syncpack/index.js';
|
|
100
101
|
import { default as tailwind } from './tailwind/index.js';
|
|
101
102
|
import { default as taskfile } from './taskfile/index.js';
|
|
@@ -219,6 +220,7 @@ export const Plugins = {
|
|
|
219
220
|
svelte,
|
|
220
221
|
svgo,
|
|
221
222
|
svgr,
|
|
223
|
+
swc,
|
|
222
224
|
syncpack,
|
|
223
225
|
tailwind,
|
|
224
226
|
taskfile,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { toDependency } from '../../util/input.js';
|
|
2
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
3
|
+
const title = 'SWC';
|
|
4
|
+
const enablers = ['@swc/core'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const config = ['.swcrc'];
|
|
7
|
+
const resolveConfig = async (config) => {
|
|
8
|
+
const inputs = config?.jsc?.experimental?.plugins ?? [];
|
|
9
|
+
return inputs.map(([id]) => toDependency(id));
|
|
10
|
+
};
|
|
11
|
+
const plugin = {
|
|
12
|
+
title,
|
|
13
|
+
enablers,
|
|
14
|
+
isEnabled,
|
|
15
|
+
config,
|
|
16
|
+
resolveConfig,
|
|
17
|
+
};
|
|
18
|
+
export default plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -492,6 +492,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
492
492
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
493
493
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
494
494
|
}, z.core.$strip>]>>;
|
|
495
|
+
swc: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
496
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
497
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
498
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
499
|
+
}, z.core.$strip>]>>;
|
|
495
500
|
syncpack: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
496
501
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
497
502
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1103,6 +1108,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1103
1108
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1104
1109
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1105
1110
|
}, z.core.$strip>]>>;
|
|
1111
|
+
swc: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1112
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1113
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1114
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1115
|
+
}, z.core.$strip>]>>;
|
|
1106
1116
|
syncpack: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1107
1117
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1108
1118
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -496,6 +496,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
|
|
|
496
496
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
497
497
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
498
498
|
}, z.core.$strip>]>;
|
|
499
|
+
swc: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
500
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
501
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
502
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
503
|
+
}, z.core.$strip>]>;
|
|
499
504
|
syncpack: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
500
505
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
501
506
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'svgr' | 'syncpack' | 'tailwind' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
|
|
2
|
-
export declare const pluginNames: readonly ["angular", "astro", "astro-db", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "mdx", "mdxlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "next-intl", "next-mdx", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rslib", "rspack", "rstest", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "svgr", "syncpack", "tailwind", "taskfile", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
|
|
1
|
+
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
|
|
2
|
+
export declare const pluginNames: readonly ["angular", "astro", "astro-db", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "mdx", "mdxlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "next-intl", "next-mdx", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rslib", "rspack", "rstest", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "svgr", "swc", "syncpack", "tailwind", "taskfile", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
|
package/dist/types/exports.d.ts
CHANGED
|
@@ -5,20 +5,21 @@ type ExportPosTuple = [number, number, number];
|
|
|
5
5
|
export type Fix = ExportPosTuple | undefined;
|
|
6
6
|
export type Fixes = Array<ExportPosTuple>;
|
|
7
7
|
export type ExportNode = {
|
|
8
|
-
node: ts.Node;
|
|
9
|
-
symbol
|
|
10
|
-
identifier: Identifier;
|
|
11
|
-
pos: number;
|
|
12
|
-
type: SymbolType;
|
|
13
|
-
members
|
|
14
|
-
jsDocTags
|
|
15
|
-
fix: Fix;
|
|
8
|
+
readonly node: ts.Node;
|
|
9
|
+
readonly symbol: undefined | ts.Symbol;
|
|
10
|
+
readonly identifier: Identifier;
|
|
11
|
+
readonly pos: number;
|
|
12
|
+
readonly type: SymbolType;
|
|
13
|
+
readonly members: readonly ExportNodeMember[];
|
|
14
|
+
readonly jsDocTags: undefined | Set<string>;
|
|
15
|
+
readonly fix: Fix;
|
|
16
16
|
};
|
|
17
17
|
export type ExportNodeMember = {
|
|
18
|
-
node: ts.Node;
|
|
19
|
-
identifier: Identifier;
|
|
20
|
-
pos: number;
|
|
21
|
-
type: SymbolType;
|
|
22
|
-
fix: Fix;
|
|
18
|
+
readonly node: ts.Node;
|
|
19
|
+
readonly identifier: Identifier;
|
|
20
|
+
readonly pos: number;
|
|
21
|
+
readonly type: SymbolType;
|
|
22
|
+
readonly fix: Fix;
|
|
23
|
+
readonly flags: number;
|
|
23
24
|
};
|
|
24
25
|
export {};
|
package/dist/types/imports.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
2
|
export interface ImportNode {
|
|
3
|
-
specifier: string;
|
|
4
|
-
identifier: string | undefined;
|
|
5
|
-
alias
|
|
6
|
-
namespace
|
|
7
|
-
pos: number;
|
|
8
|
-
symbol
|
|
9
|
-
modifiers: number;
|
|
3
|
+
readonly specifier: string;
|
|
4
|
+
readonly identifier: string | undefined;
|
|
5
|
+
readonly alias: string | undefined;
|
|
6
|
+
readonly namespace: string | undefined;
|
|
7
|
+
readonly pos: number;
|
|
8
|
+
readonly symbol: ts.Symbol | undefined;
|
|
9
|
+
readonly modifiers: number;
|
|
10
10
|
}
|
|
@@ -25,48 +25,49 @@ export type ImportMaps = {
|
|
|
25
25
|
};
|
|
26
26
|
export type ImportMap = Map<FilePath, ImportMaps>;
|
|
27
27
|
export interface Import extends SourceLocation {
|
|
28
|
-
specifier: string;
|
|
29
|
-
filePath: string | undefined;
|
|
30
|
-
identifier: string | undefined;
|
|
31
|
-
isTypeOnly: boolean;
|
|
28
|
+
readonly specifier: string;
|
|
29
|
+
readonly filePath: string | undefined;
|
|
30
|
+
readonly identifier: string | undefined;
|
|
31
|
+
readonly isTypeOnly: boolean;
|
|
32
32
|
}
|
|
33
33
|
export interface Export extends SourceLocation {
|
|
34
|
-
identifier: Identifier;
|
|
35
|
-
type: SymbolType;
|
|
36
|
-
members: ExportMember[];
|
|
37
|
-
jsDocTags: Tags;
|
|
34
|
+
readonly identifier: Identifier;
|
|
35
|
+
readonly type: SymbolType;
|
|
36
|
+
readonly members: ExportMember[];
|
|
37
|
+
readonly jsDocTags: Tags;
|
|
38
38
|
self: [number, boolean];
|
|
39
|
-
fixes: Fixes;
|
|
40
|
-
symbol
|
|
41
|
-
isReExport
|
|
39
|
+
readonly fixes: Fixes;
|
|
40
|
+
symbol: undefined | ts.Symbol;
|
|
41
|
+
readonly isReExport: boolean;
|
|
42
42
|
}
|
|
43
43
|
export type ExportMember = {
|
|
44
|
-
identifier: Identifier;
|
|
45
|
-
pos: number;
|
|
46
|
-
line: number;
|
|
47
|
-
col: number;
|
|
48
|
-
type: SymbolType;
|
|
44
|
+
readonly identifier: Identifier;
|
|
45
|
+
readonly pos: number;
|
|
46
|
+
readonly line: number;
|
|
47
|
+
readonly col: number;
|
|
48
|
+
readonly type: SymbolType;
|
|
49
|
+
readonly fix: Fix;
|
|
50
|
+
readonly jsDocTags: Tags;
|
|
51
|
+
readonly flags: number;
|
|
49
52
|
self: [number, boolean];
|
|
50
|
-
|
|
51
|
-
symbol?: ts.Symbol;
|
|
52
|
-
jsDocTags: Tags;
|
|
53
|
+
symbol: undefined | ts.Symbol;
|
|
53
54
|
};
|
|
54
55
|
export type ExportMap = Map<Identifier, Export>;
|
|
55
56
|
export type Imports = Set<Import>;
|
|
56
57
|
export type FileNode = {
|
|
57
58
|
imports: {
|
|
58
|
-
internal: ImportMap;
|
|
59
|
-
external: Set<Import>;
|
|
59
|
+
readonly internal: ImportMap;
|
|
60
|
+
readonly external: Set<Import>;
|
|
60
61
|
unresolved: Set<Import>;
|
|
61
|
-
programFiles: Set<FilePath>;
|
|
62
|
-
entryFiles: Set<FilePath>;
|
|
63
|
-
imports: Imports;
|
|
62
|
+
readonly programFiles: Set<FilePath>;
|
|
63
|
+
readonly entryFiles: Set<FilePath>;
|
|
64
|
+
readonly imports: Imports;
|
|
64
65
|
};
|
|
65
66
|
exports: ExportMap;
|
|
66
67
|
duplicates: Iterable<Array<IssueSymbol>>;
|
|
67
68
|
scripts: Set<string>;
|
|
68
|
-
imported
|
|
69
|
-
internalImportCache
|
|
69
|
+
imported: undefined | ImportMaps;
|
|
70
|
+
internalImportCache: undefined | ImportMap;
|
|
70
71
|
};
|
|
71
72
|
export type ModuleGraph = Map<FilePath, FileNode>;
|
|
72
73
|
export {};
|
|
@@ -8,13 +8,14 @@ export declare function isImportCall(node: ts.Node): node is ts.ImportCall;
|
|
|
8
8
|
export declare function isRequireCall(callExpression: ts.Node): callExpression is ts.CallExpression;
|
|
9
9
|
export declare function isPropertyAccessCall(node: ts.Node, identifier: string): node is ts.CallExpression;
|
|
10
10
|
export declare const getNodeType: (node: ts.Node) => SymbolType;
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const getClassMember: (member: ts.MethodDeclaration | ts.PropertyDeclaration, isFixTypes: boolean) => {
|
|
13
|
-
node: ts.MethodDeclaration | ts.PropertyDeclaration;
|
|
11
|
+
export declare const isNonPrivateDeclaration: (member: ts.ClassElement) => member is ts.MethodDeclaration | ts.PropertyDeclaration | ts.AccessorDeclaration;
|
|
12
|
+
export declare const getClassMember: (member: ts.MethodDeclaration | ts.PropertyDeclaration | ts.AccessorDeclaration, isFixTypes: boolean) => {
|
|
13
|
+
node: ts.AccessorDeclaration | ts.MethodDeclaration | ts.PropertyDeclaration;
|
|
14
14
|
identifier: string;
|
|
15
15
|
pos: number;
|
|
16
16
|
type: "member";
|
|
17
17
|
fix: Fix;
|
|
18
|
+
flags: number;
|
|
18
19
|
};
|
|
19
20
|
export declare const getEnumMember: (member: ts.EnumMember, isFixTypes: boolean) => {
|
|
20
21
|
node: ts.EnumMember;
|
|
@@ -22,6 +23,7 @@ export declare const getEnumMember: (member: ts.EnumMember, isFixTypes: boolean)
|
|
|
22
23
|
pos: number;
|
|
23
24
|
type: "member";
|
|
24
25
|
fix: Fix;
|
|
26
|
+
flags: 0;
|
|
25
27
|
};
|
|
26
28
|
export declare function stripQuotes(name: string): string;
|
|
27
29
|
export declare function findAncestor<T>(node: ts.Node | undefined, callback: (element: ts.Node) => boolean | 'STOP'): T | undefined;
|