knip 5.22.1 → 5.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/plugins/babel/helpers.d.ts +1 -1
- package/dist/plugins/graphql-codegen/index.js +5 -0
- package/dist/plugins/typescript/index.js +6 -2
- package/dist/plugins/vitest/helpers.d.ts +1 -1
- package/dist/plugins/webdriver-io/types.d.ts +0 -1
- package/dist/plugins.d.ts +2 -1
- package/dist/typescript/ast-helpers.d.ts +1 -1
- package/dist/typescript/createHosts.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/importCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/importType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/index.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/jsDocType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/propertyAccessCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/requireCall.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportAssignment.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportKeyword.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportsAccessExpression.d.ts +1 -1
- package/dist/typescript/visitors/exports/index.d.ts +1 -1
- package/dist/typescript/visitors/exports/moduleExportsAccessExpression.d.ts +1 -1
- package/dist/typescript/visitors/imports/importDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/importEqualsDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/index.d.ts +1 -1
- package/dist/typescript/visitors/imports/reExportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/scripts/bun.d.ts +1 -1
- package/dist/typescript/visitors/scripts/execa.d.ts +1 -1
- package/dist/typescript/visitors/scripts/index.d.ts +1 -1
- package/dist/typescript/visitors/scripts/zx.d.ts +1 -1
- package/dist/util/Performance.d.ts +0 -2
- package/dist/util/errors.d.ts +3 -2
- package/dist/util/file-entry-cache.d.ts +0 -1
- package/dist/util/glob.d.ts +0 -1
- package/dist/util/{type.d.ts → has-strictly-ns-references.d.ts} +1 -1
- package/dist/util/has-strictly-ns-references.js +95 -0
- package/dist/util/path.d.ts +1 -1
- package/dist/util/reporter.d.ts +1 -1
- package/dist/util/require.d.ts +0 -1
- package/dist/util/serialize.d.ts +0 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/util/type.js +0 -55
|
@@ -32,7 +32,7 @@ export declare class WorkspaceWorker {
|
|
|
32
32
|
isStrict: boolean;
|
|
33
33
|
rootIgnore: Configuration['ignore'];
|
|
34
34
|
negatedWorkspacePatterns: string[];
|
|
35
|
-
enabledPluginsMap: Record<"
|
|
35
|
+
enabledPluginsMap: Record<"angular" | "astro" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "drizzle" | "eleventy" | "eslint" | "gatsby" | "githubActions" | "graphqlCodegen" | "husky" | "jest" | "lefthook" | "linthtml" | "lintStaged" | "lockfileLint" | "lostPixel" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nodeTestRunner" | "npmPackageJsonLint" | "nx" | "nyc" | "oclif" | "playwright" | "playwrightCt" | "postcss" | "prettier" | "releaseIt" | "remark" | "remix" | "rollup" | "semanticRelease" | "sentry" | "simpleGitHooks" | "sizeLimit" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vercelOg" | "vite" | "vitest" | "vue" | "webdriverIo" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie", boolean>;
|
|
36
36
|
enabledPlugins: PluginName[];
|
|
37
37
|
enabledPluginsInAncestors: string[];
|
|
38
38
|
cache: CacheConsultant<CacheItem>;
|
|
@@ -52,7 +52,7 @@ export declare class WorkspaceWorker {
|
|
|
52
52
|
entryFilePatterns: Set<string>;
|
|
53
53
|
productionEntryFilePatterns: Set<string>;
|
|
54
54
|
referencedDependencies: ReferencedDependencies;
|
|
55
|
-
enabledPlugins: ("
|
|
55
|
+
enabledPlugins: ("angular" | "astro" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "drizzle" | "eleventy" | "eslint" | "gatsby" | "githubActions" | "graphqlCodegen" | "husky" | "jest" | "lefthook" | "linthtml" | "lintStaged" | "lockfileLint" | "lostPixel" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nodeTestRunner" | "npmPackageJsonLint" | "nx" | "nyc" | "oclif" | "playwright" | "playwrightCt" | "postcss" | "prettier" | "releaseIt" | "remark" | "remix" | "rollup" | "semanticRelease" | "sentry" | "simpleGitHooks" | "sizeLimit" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vercelOg" | "vite" | "vitest" | "vue" | "webdriverIo" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie")[];
|
|
56
56
|
}>;
|
|
57
57
|
onDispose(): void;
|
|
58
58
|
}
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { isFile } from './util/fs.js';
|
|
|
17
17
|
import { _glob, negate } from './util/glob.js';
|
|
18
18
|
import { getGitIgnoredFn } from './util/globby.js';
|
|
19
19
|
import { getHandler } from './util/handle-dependency.js';
|
|
20
|
+
import { getHasStrictlyNsReferences, getType } from './util/has-strictly-ns-references.js';
|
|
20
21
|
import { getIsIdentifierReferencedHandler } from './util/is-identifier-referenced.js';
|
|
21
22
|
import { getEntryPathFromManifest, getPackageNameFromModuleSpecifier } from './util/modules.js';
|
|
22
23
|
import { dirname, join, toPosix } from './util/path.js';
|
|
@@ -25,7 +26,6 @@ import { getShouldIgnoreHandler } from './util/tag.js';
|
|
|
25
26
|
import { augmentWorkspace, getToSourcePathHandler } from './util/to-source-path.js';
|
|
26
27
|
import { createAndPrintTrace, printTrace } from './util/trace.js';
|
|
27
28
|
import { loadTSConfig } from './util/tsconfig-loader.js';
|
|
28
|
-
import { getHasStrictlyNsReferences, getType } from './util/type.js';
|
|
29
29
|
export const main = async (unresolvedConfiguration) => {
|
|
30
30
|
const { cwd, tsConfigFile, gitignore, isStrict, isProduction, isShowProgress, isIncludeEntryExports, isIncludeLibs, isIsolateWorkspaces, isDebug, isWatch, tags, isFix, fixTypes, isRemoveFiles, } = unresolvedConfiguration;
|
|
31
31
|
debugLogObject('*', 'Unresolved configuration (from CLI arguments)', unresolvedConfiguration);
|
|
@@ -369,14 +369,14 @@ export const main = async (unresolvedConfiguration) => {
|
|
|
369
369
|
continue;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
const [
|
|
372
|
+
const [hasStrictlyNsRefs, namespace] = getHasStrictlyNsReferences(graph, importsForExport, identifier);
|
|
373
373
|
const isType = ['enum', 'type', 'interface'].includes(exportedItem.type);
|
|
374
|
-
if (
|
|
374
|
+
if (hasStrictlyNsRefs && ((!report.nsTypes && isType) || !(report.nsExports || isType)))
|
|
375
375
|
continue;
|
|
376
376
|
if (!isExportedItemReferenced(exportedItem)) {
|
|
377
377
|
if (!isSkipLibs && principal?.hasExternalReferences(filePath, exportedItem))
|
|
378
378
|
continue;
|
|
379
|
-
const type = getType(
|
|
379
|
+
const type = getType(hasStrictlyNsRefs, isType);
|
|
380
380
|
const isIssueAdded = collector.addIssue({
|
|
381
381
|
type,
|
|
382
382
|
filePath,
|
|
@@ -36,6 +36,11 @@ const resolveConfig = config => {
|
|
|
36
36
|
.map(plugin => `@graphql-codegen/${plugin}`);
|
|
37
37
|
const nestedPlugins = configurationOutput
|
|
38
38
|
.flatMap(configOutput => (configOutput.plugins ? configOutput.plugins : []))
|
|
39
|
+
.flatMap(plugin => {
|
|
40
|
+
if (typeof plugin === 'object')
|
|
41
|
+
return Object.keys(plugin);
|
|
42
|
+
return [plugin];
|
|
43
|
+
})
|
|
39
44
|
.flatMap(plugin => {
|
|
40
45
|
if (typeof plugin !== 'string')
|
|
41
46
|
return [];
|
|
@@ -19,8 +19,12 @@ const getExtends = async (configFilePath, internalExtends = new Set()) => {
|
|
|
19
19
|
await getExtends(presetConfigPath, internalExtends);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
for (const extend of extends_)
|
|
23
|
-
|
|
22
|
+
for (const extend of extends_) {
|
|
23
|
+
if (isInternal(extend))
|
|
24
|
+
internalExtends.add(toAbsolute(extend, dirname(configFilePath)));
|
|
25
|
+
else
|
|
26
|
+
internalExtends.add(extend);
|
|
27
|
+
}
|
|
24
28
|
return internalExtends;
|
|
25
29
|
};
|
|
26
30
|
const resolveConfig = async (localConfig, options) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ViteConfig } from './types.js';
|
|
2
2
|
export declare const getEnvPackageName: (env: string) => string;
|
|
3
|
-
export declare const getExternalReporters: (reporters?: ViteConfig[
|
|
3
|
+
export declare const getExternalReporters: (reporters?: ViteConfig["test"]["reporters"]) => string[];
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PluginName } from './types/config.js';
|
|
1
2
|
import type { Plugin } from './types/plugins.js';
|
|
2
|
-
declare const plugins: Record<
|
|
3
|
+
declare const plugins: Record<PluginName, Plugin>;
|
|
3
4
|
export { plugins };
|
|
@@ -9,7 +9,7 @@ export declare function isPropertyAccessCall(node: ts.Node, identifier: string):
|
|
|
9
9
|
export declare function stripQuotes(name: string): string;
|
|
10
10
|
export declare function findAncestor<T>(node: ts.Node | undefined, callback: (element: ts.Node) => boolean | 'STOP'): T | undefined;
|
|
11
11
|
export declare function findDescendants<T>(node: ts.Node | undefined, callback: (element: ts.Node) => boolean | 'STOP'): T[];
|
|
12
|
-
export declare const isDeclarationFileExtension: (extension: string) =>
|
|
12
|
+
export declare const isDeclarationFileExtension: (extension: string) => extension is ".d.ts" | ".d.mts" | ".d.cts";
|
|
13
13
|
export declare const getJSDocTags: (node: ts.Node) => Set<string>;
|
|
14
14
|
export declare const getLineAndCharacterOfPosition: (node: ts.Node, pos: number) => {
|
|
15
15
|
line: number;
|
|
@@ -14,7 +14,7 @@ type CreateHostsOptions = {
|
|
|
14
14
|
export declare const createHosts: ({ cwd, compilerOptions, entryPaths, compilers, isSkipLibs, toSourceFilePath, useResolverCache, }: CreateHostsOptions) => {
|
|
15
15
|
fileManager: SourceFileManager;
|
|
16
16
|
compilerHost: ts.CompilerHost;
|
|
17
|
-
resolveModuleNames: (moduleNames: string[], containingFile: string) =>
|
|
17
|
+
resolveModuleNames: (moduleNames: string[], containingFile: string) => Array<ts.ResolvedModuleFull | undefined>;
|
|
18
18
|
languageServiceHost: ts.LanguageServiceHost;
|
|
19
19
|
};
|
|
20
20
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[])[];
|
|
3
3
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import type { ImportNode } from '../../../types/imports.js';
|
|
3
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => ImportNode | ImportNode[]
|
|
3
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | ImportNode | ImportNode[];
|
|
4
4
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[])[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[])[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => string | string[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | string | string[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => string | string[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | string | string[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => string | string[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | string | string[])[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => string | string[]
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | string | string[];
|
|
3
3
|
export default _default;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { type PerformanceEntry, PerformanceObserver } from 'node:perf_hooks';
|
|
4
2
|
import { memoryUsage } from 'node:process';
|
|
5
3
|
export declare const timerify: <T extends (...params: any[]) => any>(fn: T, name?: string) => T;
|
package/dist/util/errors.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ZodError } from 'zod';
|
|
1
2
|
interface ErrorWithCause extends Error {
|
|
2
3
|
cause: Error;
|
|
3
4
|
}
|
|
@@ -5,8 +6,8 @@ export declare class ConfigurationError extends Error {
|
|
|
5
6
|
}
|
|
6
7
|
export declare class LoaderError extends Error {
|
|
7
8
|
}
|
|
8
|
-
export declare const isKnownError: (error: Error) =>
|
|
9
|
+
export declare const isKnownError: (error: Error) => error is ConfigurationError | LoaderError | ZodError<any>;
|
|
9
10
|
export declare const hasCause: (error: Error) => error is ErrorWithCause;
|
|
10
|
-
export declare const isConfigurationError: (error: Error) =>
|
|
11
|
+
export declare const isConfigurationError: (error: Error) => error is ConfigurationError;
|
|
11
12
|
export declare const getKnownError: (error: Error) => Error;
|
|
12
13
|
export {};
|
package/dist/util/glob.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
1
|
export declare const prependDirToPattern: (workingDir: string, pattern: string) => string;
|
|
3
2
|
export declare const negate: (pattern: string) => string;
|
|
4
3
|
export declare const hasProductionSuffix: (pattern: string) => boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DependencyGraph, ImportDetails } from '../types/dependency-graph.js';
|
|
2
|
-
export declare const getHasStrictlyNsReferences: (graph: DependencyGraph, importsForExport: ImportDetails | undefined) => [boolean, string?];
|
|
2
|
+
export declare const getHasStrictlyNsReferences: (graph: DependencyGraph, importsForExport: ImportDetails | undefined, id: string) => [boolean, string?];
|
|
3
3
|
export declare const getType: (hasOnlyNsReference: boolean, isType: boolean) => "exports" | "types" | "nsExports" | "nsTypes";
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { IMPORT_STAR } from '../constants.js';
|
|
2
|
+
export const getHasStrictlyNsReferences = (graph, importsForExport, id) => {
|
|
3
|
+
if (!importsForExport)
|
|
4
|
+
return [false];
|
|
5
|
+
let namespace;
|
|
6
|
+
for (const ns of importsForExport.importedNs.keys()) {
|
|
7
|
+
const hasNs = importsForExport.refs.has(ns);
|
|
8
|
+
if (!hasNs)
|
|
9
|
+
return [false, ns];
|
|
10
|
+
for (const id of importsForExport.refs)
|
|
11
|
+
if (id.startsWith(`${ns}.`))
|
|
12
|
+
return [false, ns];
|
|
13
|
+
const byFilePaths = importsForExport.reExportedNs.get(ns);
|
|
14
|
+
if (byFilePaths) {
|
|
15
|
+
for (const filePath of byFilePaths) {
|
|
16
|
+
const file = graph.get(filePath);
|
|
17
|
+
if (file?.imported) {
|
|
18
|
+
const hasStrictlyNsReferences = getHasStrictlyNsReferences(graph, file.imported, id);
|
|
19
|
+
if (hasStrictlyNsReferences[0] === false)
|
|
20
|
+
return hasStrictlyNsReferences;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const reExportedAs = importsForExport.reExportedAs.get(ns);
|
|
25
|
+
if (reExportedAs) {
|
|
26
|
+
for (const byFilePaths of reExportedAs.values()) {
|
|
27
|
+
for (const filePath of byFilePaths) {
|
|
28
|
+
const file = graph.get(filePath);
|
|
29
|
+
if (file?.imported) {
|
|
30
|
+
const hasStrictlyNsReferences = getHasStrictlyNsReferences(graph, file.imported, id);
|
|
31
|
+
if (hasStrictlyNsReferences[0] === false)
|
|
32
|
+
return hasStrictlyNsReferences;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
namespace = ns;
|
|
38
|
+
}
|
|
39
|
+
const byFilePaths = importsForExport.reExported.get(id);
|
|
40
|
+
if (byFilePaths) {
|
|
41
|
+
for (const filePath of byFilePaths) {
|
|
42
|
+
const file = graph.get(filePath);
|
|
43
|
+
if (file?.imported) {
|
|
44
|
+
const hasStrictlyNsReferences = getHasStrictlyNsReferences(graph, file.imported, id);
|
|
45
|
+
if (hasStrictlyNsReferences[0] === false)
|
|
46
|
+
return hasStrictlyNsReferences;
|
|
47
|
+
namespace = hasStrictlyNsReferences[1];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
{
|
|
52
|
+
const byFilePaths = importsForExport.reExported.get(IMPORT_STAR);
|
|
53
|
+
if (byFilePaths) {
|
|
54
|
+
for (const filePath of byFilePaths) {
|
|
55
|
+
const file = graph.get(filePath);
|
|
56
|
+
if (file?.imported) {
|
|
57
|
+
const hasStrictlyNsReferences = getHasStrictlyNsReferences(graph, file.imported, id);
|
|
58
|
+
if (hasStrictlyNsReferences[0] === false)
|
|
59
|
+
return hasStrictlyNsReferences;
|
|
60
|
+
namespace = hasStrictlyNsReferences[1];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const [identifier, ...rest] = id.split('.');
|
|
66
|
+
const reExportedAs = importsForExport.reExportedAs.get(identifier);
|
|
67
|
+
if (reExportedAs) {
|
|
68
|
+
for (const [alias, filePaths] of reExportedAs.entries()) {
|
|
69
|
+
for (const filePath of filePaths) {
|
|
70
|
+
const file = graph.get(filePath);
|
|
71
|
+
if (file?.imported) {
|
|
72
|
+
const hasStrictlyNsReferences = getHasStrictlyNsReferences(graph, file.imported, [alias, ...rest].join('.'));
|
|
73
|
+
if (hasStrictlyNsReferences[0] === false)
|
|
74
|
+
return hasStrictlyNsReferences;
|
|
75
|
+
namespace = hasStrictlyNsReferences[1];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
for (const [ns, filePaths] of importsForExport.reExportedNs.entries()) {
|
|
81
|
+
for (const filePath of filePaths) {
|
|
82
|
+
const file = graph.get(filePath);
|
|
83
|
+
if (file?.imported) {
|
|
84
|
+
const hasStrictlyNsReferences = getHasStrictlyNsReferences(graph, file.imported, `${ns}.${id}`);
|
|
85
|
+
if (hasStrictlyNsReferences[0] === false)
|
|
86
|
+
return hasStrictlyNsReferences;
|
|
87
|
+
namespace = hasStrictlyNsReferences[1];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (namespace)
|
|
92
|
+
return [true, namespace];
|
|
93
|
+
return [false];
|
|
94
|
+
};
|
|
95
|
+
export const getType = (hasOnlyNsReference, isType) => hasOnlyNsReference ? (isType ? 'nsTypes' : 'nsExports') : isType ? 'types' : 'exports';
|
package/dist/util/path.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const isAbsolute: (path: string) => boolean;
|
|
2
2
|
export declare const dirname: (path: string) => string;
|
|
3
3
|
export declare const extname: (path: string) => string;
|
|
4
|
-
export declare const basename: (path: string, suffix?: string
|
|
4
|
+
export declare const basename: (path: string, suffix?: string) => string;
|
|
5
5
|
export declare const join: (...paths: string[]) => string;
|
|
6
6
|
export declare const toPosix: (value: string) => string;
|
|
7
7
|
export declare const cwd: string;
|
package/dist/util/reporter.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ReporterOptions } from '../types/issues.js';
|
|
2
|
-
export declare const runPreprocessors: (data: ReporterOptions, processors?: any
|
|
2
|
+
export declare const runPreprocessors: (data: ReporterOptions, processors?: any) => Promise<ReporterOptions>;
|
|
3
3
|
export declare const runReporters: (options: ReporterOptions) => Promise<void>;
|
package/dist/util/require.d.ts
CHANGED
package/dist/util/serialize.d.ts
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.22.
|
|
1
|
+
export declare const version = "5.22.3";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.22.
|
|
1
|
+
export const version = '5.22.3';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.22.
|
|
3
|
+
"version": "5.22.3",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@wdio/types": "^8.38.2",
|
|
92
92
|
"glob": "^10.3.12",
|
|
93
93
|
"playwright": "^1.44.1",
|
|
94
|
-
"release-it": "^17.
|
|
94
|
+
"release-it": "^17.4.0",
|
|
95
95
|
"type-fest": "^4.20.0",
|
|
96
96
|
"typescript": "^5.5.2"
|
|
97
97
|
},
|
package/dist/util/type.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { IMPORT_STAR } from '../constants.js';
|
|
2
|
-
export const getHasStrictlyNsReferences = (graph, importsForExport) => {
|
|
3
|
-
if (!importsForExport)
|
|
4
|
-
return [false];
|
|
5
|
-
if (importsForExport.importedNs.size === 0 && !importsForExport.reExported.has(IMPORT_STAR)) {
|
|
6
|
-
return [false];
|
|
7
|
-
}
|
|
8
|
-
let namespace;
|
|
9
|
-
for (const ns of importsForExport.importedNs.keys()) {
|
|
10
|
-
const hasNs = importsForExport.refs.has(ns);
|
|
11
|
-
if (!hasNs)
|
|
12
|
-
return [false, ns];
|
|
13
|
-
for (const id of importsForExport.refs)
|
|
14
|
-
if (id.startsWith(`${ns}.`))
|
|
15
|
-
return [false, ns];
|
|
16
|
-
const byFilePaths = importsForExport.reExportedNs.get(ns);
|
|
17
|
-
if (byFilePaths) {
|
|
18
|
-
for (const filePath of byFilePaths) {
|
|
19
|
-
const file = graph.get(filePath);
|
|
20
|
-
if (file?.imported) {
|
|
21
|
-
const hasStrictlyNsReferences = getHasStrictlyNsReferences(graph, file.imported);
|
|
22
|
-
if (hasStrictlyNsReferences[0] === false)
|
|
23
|
-
return hasStrictlyNsReferences;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
const reExportedAs = importsForExport.reExportedAs.get(ns);
|
|
28
|
-
if (reExportedAs) {
|
|
29
|
-
for (const byFilePaths of reExportedAs.values()) {
|
|
30
|
-
for (const filePath of byFilePaths) {
|
|
31
|
-
const file = graph.get(filePath);
|
|
32
|
-
if (file?.imported) {
|
|
33
|
-
const hasStrictlyNsReferences = getHasStrictlyNsReferences(graph, file.imported);
|
|
34
|
-
if (hasStrictlyNsReferences[0] === false)
|
|
35
|
-
return hasStrictlyNsReferences;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
namespace = ns;
|
|
41
|
-
}
|
|
42
|
-
const byFilePaths = importsForExport.reExported.get(IMPORT_STAR);
|
|
43
|
-
if (byFilePaths) {
|
|
44
|
-
for (const filePath of byFilePaths) {
|
|
45
|
-
const file = graph.get(filePath);
|
|
46
|
-
if (file?.imported) {
|
|
47
|
-
const hasStrictlyNsReferences = getHasStrictlyNsReferences(graph, file.imported);
|
|
48
|
-
if (hasStrictlyNsReferences[0] === false)
|
|
49
|
-
return hasStrictlyNsReferences;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return [true, namespace];
|
|
54
|
-
};
|
|
55
|
-
export const getType = (hasOnlyNsReference, isType) => hasOnlyNsReference ? (isType ? 'nsTypes' : 'nsExports') : isType ? 'types' : 'exports';
|