knip 6.29.0 → 6.31.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/CatalogCounselor.d.ts +5 -2
- package/dist/CatalogCounselor.js +26 -8
- package/dist/ConfigurationChief.d.ts +7 -1
- package/dist/ConfigurationChief.js +29 -36
- package/dist/DependencyDeputy.d.ts +8 -1
- package/dist/DependencyDeputy.js +5 -5
- package/dist/PackagePeeker.d.ts +5 -0
- package/dist/PackagePeeker.js +31 -3
- package/dist/WorkspaceWorker.d.ts +1 -1
- package/dist/WorkspaceWorker.js +11 -7
- package/dist/binaries/bash-parser.js +3 -3
- package/dist/binaries/create-script-parser-context.d.ts +7 -0
- package/dist/binaries/create-script-parser-context.js +17 -0
- package/dist/binaries/resolvers/pnpx.js +10 -5
- package/dist/compilers/index.d.ts +15 -5
- package/dist/compilers/scss.js +32 -5
- package/dist/compilers/shared.d.ts +1 -0
- package/dist/compilers/shared.js +1 -1
- package/dist/compilers/svelte.d.ts +2 -0
- package/dist/compilers/svelte.js +22 -0
- package/dist/constants.d.ts +4 -1
- package/dist/constants.js +4 -0
- package/dist/graph/analyze.js +5 -2
- package/dist/graph/build.d.ts +3 -1
- package/dist/graph/build.js +38 -19
- package/dist/graph-explorer/operations/build-exports-tree.js +2 -1
- package/dist/graph-explorer/operations/is-referenced.js +7 -4
- package/dist/graph-explorer/utils.js +2 -2
- package/dist/plugins/_template/index.js +1 -1
- package/dist/plugins/astro-markdoc/index.js +3 -2
- package/dist/plugins/eleventy/index.js +1 -1
- package/dist/plugins/esbuild/index.js +1 -1
- package/dist/plugins/eslint/helpers.js +2 -1
- package/dist/plugins/gatsby/index.js +2 -2
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/jest/helpers.js +1 -1
- package/dist/plugins/marko/compiler.d.ts +2 -0
- package/dist/plugins/marko/compiler.js +85 -0
- package/dist/plugins/marko/index.d.ts +3 -0
- package/dist/plugins/marko/index.js +63 -0
- package/dist/plugins/marko/taglibs.d.ts +4 -0
- package/dist/plugins/marko/taglibs.js +111 -0
- package/dist/plugins/marko/types.d.ts +9 -0
- package/dist/plugins/marko/types.js +1 -0
- package/dist/plugins/metro/index.js +1 -1
- package/dist/plugins/nest/index.js +1 -1
- package/dist/plugins/node/index.js +11 -2
- package/dist/plugins/nx/index.js +4 -3
- package/dist/plugins/openclaw/index.js +1 -1
- package/dist/plugins/oxlint/index.js +9 -2
- package/dist/plugins/remark/helpers.d.ts +3 -0
- package/dist/plugins/remark/helpers.js +42 -0
- package/dist/plugins/remark/index.js +4 -5
- package/dist/plugins/rolldown/index.js +1 -1
- package/dist/plugins/rollup/index.js +1 -1
- package/dist/plugins/rslib/index.js +1 -1
- package/dist/plugins/stryker/index.js +6 -1
- package/dist/plugins/svelte/compiler.js +7 -5
- package/dist/plugins/tsdown/index.js +2 -2
- package/dist/plugins/tsup/index.js +1 -1
- package/dist/plugins/vitest/index.js +1 -1
- package/dist/plugins/vitest/types.d.ts +1 -1
- package/dist/reporters/codeclimate.js +1 -5
- package/dist/reporters/github-actions.js +5 -3
- package/dist/reporters/index.d.ts +1 -0
- package/dist/reporters/index.js +2 -0
- package/dist/reporters/json.d.ts +1 -0
- package/dist/reporters/json.js +1 -0
- package/dist/reporters/sarif.d.ts +3 -0
- package/dist/reporters/sarif.js +79 -0
- package/dist/reporters/trace.js +3 -2
- package/dist/reporters/util/util.d.ts +2 -1
- package/dist/reporters/util/util.js +6 -1
- package/dist/run.d.ts +1 -1
- package/dist/run.js +30 -0
- package/dist/schema/configuration.d.ts +21 -6
- package/dist/schema/configuration.js +1 -0
- package/dist/schema/plugins.d.ts +5 -0
- package/dist/schema/plugins.js +1 -0
- package/dist/session/build-maps.js +2 -1
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +1 -0
- package/dist/types/issues.d.ts +1 -0
- package/dist/types/package-json.d.ts +10 -0
- package/dist/typescript/get-imports-and-exports.js +3 -2
- package/dist/typescript/get-published-type-dependencies.d.ts +13 -0
- package/dist/typescript/get-published-type-dependencies.js +155 -0
- package/dist/typescript/visitors/calls.js +8 -0
- package/dist/util/catalog.d.ts +6 -1
- package/dist/util/catalog.js +16 -2
- package/dist/util/cli-arguments.d.ts +1 -1
- package/dist/util/cli-arguments.js +3 -3
- package/dist/util/codeowners.js +1 -1
- package/dist/util/create-input-handler.js +8 -2
- package/dist/util/create-options.d.ts +16 -5
- package/dist/util/disk-cache.js +1 -1
- package/dist/util/errors.js +3 -2
- package/dist/util/file-entry-cache.js +5 -1
- package/dist/util/fs.js +2 -2
- package/dist/util/get-included-issue-types.js +2 -1
- package/dist/util/gitignore-cache.js +4 -1
- package/dist/util/glob-cache.js +2 -2
- package/dist/util/glob-core.js +3 -1
- package/dist/util/input.d.ts +7 -1
- package/dist/util/input.js +6 -0
- package/dist/util/package-json.d.ts +347 -0
- package/dist/util/package-json.js +123 -0
- package/dist/util/path.d.ts +8 -7
- package/dist/util/resolve.d.ts +6 -0
- package/dist/util/resolve.js +24 -0
- package/dist/util/string.d.ts +2 -0
- package/dist/util/string.js +6 -0
- package/dist/util/table.js +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 +5 -5
- package/schema.json +8 -0
|
@@ -3,7 +3,7 @@ import type { Issue, IssueRecords, IssueSeverity, IssueSymbol, IssueType } from
|
|
|
3
3
|
import { Table } from '../../util/table.ts';
|
|
4
4
|
export declare const dim: (text: string | number | null | undefined) => string;
|
|
5
5
|
export declare const bright: (text: string | number | null | undefined) => string;
|
|
6
|
-
export declare const getIssueTypeTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => "Circular dependencies" | "Duplicate exports" | "Exported types in used namespace" | "Exports in used namespace" | "Referenced optional peerDependencies" | "Unlisted binaries" | "Unlisted dependencies" | "Unresolved imports" | "Unused catalog entries" | "Unused dependencies" | "Unused devDependencies" | "Unused exported enum members" | "Unused exported namespace members" | "Unused exported types" | "Unused exports" | "Unused files";
|
|
6
|
+
export declare const getIssueTypeTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => "Circular dependencies" | "Duplicate exports" | "Exported types in used namespace" | "Exports in used namespace" | "Referenced optional peerDependencies" | "Unlisted binaries" | "Unlisted dependencies" | "Unresolved catalog references" | "Unresolved imports" | "Unused catalog entries" | "Unused dependencies" | "Unused devDependencies" | "Unused exported enum members" | "Unused exported namespace members" | "Unused exported types" | "Unused exports" | "Unused files";
|
|
7
7
|
export declare const getColoredTitle: (title: string, count: number) => string;
|
|
8
8
|
export declare const getDimmedTitle: (title: string, count: number) => string;
|
|
9
9
|
type LogIssueLine = {
|
|
@@ -28,4 +28,5 @@ export declare const getTableForType: (issues: Issue[], cwd: string, options?: {
|
|
|
28
28
|
}) => Table;
|
|
29
29
|
export declare const flattenIssues: (issues: IssueRecords) => Issue[];
|
|
30
30
|
export declare const getIssuePrefix: (type: IssueType) => string;
|
|
31
|
+
export declare const getIssueDescription: ({ type, symbol, symbols, parentSymbol }: Issue) => string;
|
|
31
32
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ISSUE_TYPE_TITLE, SYMBOL_TYPE } from '../../constants.js';
|
|
2
2
|
import st from '../../util/colors.js';
|
|
3
3
|
import { relative } from '../../util/path.js';
|
|
4
|
+
import { compareStrings } from '../../util/string.js';
|
|
4
5
|
import { Table } from '../../util/table.js';
|
|
5
6
|
const plain = (text) => text;
|
|
6
7
|
export const dim = st.gray;
|
|
@@ -25,7 +26,7 @@ export const convert = (issue) => ({
|
|
|
25
26
|
});
|
|
26
27
|
const sortByPos = (a, b) => {
|
|
27
28
|
if (a.filePath !== b.filePath)
|
|
28
|
-
return a.filePath
|
|
29
|
+
return compareStrings(a.filePath, b.filePath);
|
|
29
30
|
if (a.line !== b.line)
|
|
30
31
|
return (a.line ?? 0) - (b.line ?? 0);
|
|
31
32
|
return (a.col ?? 0) - (b.col ?? 0);
|
|
@@ -63,3 +64,7 @@ export const getTableForType = (issues, cwd, options = { isUseColors: true }) =>
|
|
|
63
64
|
};
|
|
64
65
|
export const flattenIssues = (issues) => Object.values(issues).flatMap(Object.values);
|
|
65
66
|
export const getIssuePrefix = (type) => ISSUE_TYPE_TITLE[type].replace(/ies$/, 'y').replace(/s$/, '');
|
|
67
|
+
export const getIssueDescription = ({ type, symbol, symbols, parentSymbol }) => {
|
|
68
|
+
const description = symbols ? symbols.map(item => item.symbol).join(', ') : symbol;
|
|
69
|
+
return `${getIssuePrefix(type)}: ${description}${parentSymbol ? ` (${parentSymbol})` : ''}`;
|
|
70
|
+
};
|
package/dist/run.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const run: (options: MainOptions) => Promise<{
|
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
session: {
|
|
17
|
-
listener: import("fs").WatchListener<string | Buffer<ArrayBufferLike>>;
|
|
17
|
+
listener: import("node:fs").WatchListener<string | Buffer<ArrayBufferLike>>;
|
|
18
18
|
handleFileChanges: (changes: import("./util/watch.ts").WatchChange[]) => Promise<{
|
|
19
19
|
duration: number;
|
|
20
20
|
mem: number;
|
package/dist/run.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { watch } from 'node:fs';
|
|
2
|
+
import { createScriptParserContext } from './binaries/create-script-parser-context.js';
|
|
3
|
+
import { _getInputsFromScripts } from './binaries/index.js';
|
|
2
4
|
import { CatalogCounselor } from './CatalogCounselor.js';
|
|
3
5
|
import { ConfigurationChief } from './ConfigurationChief.js';
|
|
4
6
|
import { ConsoleStreamer } from './ConsoleStreamer.js';
|
|
@@ -12,6 +14,8 @@ import { debugLogObject } from './util/debug.js';
|
|
|
12
14
|
import { flushGitignoreCache, initGitignoreCache } from './util/gitignore-cache.js';
|
|
13
15
|
import { flushGlobCache, initGlobCache } from './util/glob-cache.js';
|
|
14
16
|
import { getGitIgnoredHandler } from './util/glob-core.js';
|
|
17
|
+
import { isCatalog } from './util/input.js';
|
|
18
|
+
import { createManifest } from './util/package-json.js';
|
|
15
19
|
import { getModuleSourcePathHandler, getWorkspacePackageTargetHandler } from './util/to-source-path.js';
|
|
16
20
|
import { getSessionHandler } from './util/watch.js';
|
|
17
21
|
export const run = async (options) => {
|
|
@@ -28,6 +32,31 @@ export const run = async (options) => {
|
|
|
28
32
|
const counselor = new CatalogCounselor(options);
|
|
29
33
|
streamer.cast('Reading workspace configuration');
|
|
30
34
|
const workspaces = await chief.getWorkspaces();
|
|
35
|
+
const includedWorkspaceNames = new Set(workspaces.map(workspace => workspace.name));
|
|
36
|
+
const scriptParserContext = createScriptParserContext(chief);
|
|
37
|
+
const { rootManifest, getManifest } = scriptParserContext;
|
|
38
|
+
for (const name of chief.availableWorkspaceNames) {
|
|
39
|
+
const workspace = chief.workspacePackages.get(name);
|
|
40
|
+
if (!workspace)
|
|
41
|
+
continue;
|
|
42
|
+
counselor.addWorkspace(workspace);
|
|
43
|
+
if (includedWorkspaceNames.has(name))
|
|
44
|
+
continue;
|
|
45
|
+
const manifest = createManifest(workspace.manifest);
|
|
46
|
+
const inputs = _getInputsFromScripts(Object.values(manifest.scripts ?? {}), {
|
|
47
|
+
cwd: workspace.dir,
|
|
48
|
+
rootCwd: options.cwd,
|
|
49
|
+
containingFilePath: workspace.manifestPath,
|
|
50
|
+
manifest,
|
|
51
|
+
rootManifest,
|
|
52
|
+
getManifest,
|
|
53
|
+
});
|
|
54
|
+
for (const input of inputs) {
|
|
55
|
+
if (isCatalog(input)) {
|
|
56
|
+
counselor.addReference({ catalogName: input.catalogName, packageName: input.specifier });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
31
60
|
const isGitIgnored = await getGitIgnoredHandler(options, new Set(workspaces.map(w => w.dir)));
|
|
32
61
|
const toSourceFilePath = getModuleSourcePathHandler(chief);
|
|
33
62
|
const findWorkspacePackageTarget = getWorkspacePackageTargetHandler(chief);
|
|
@@ -44,6 +73,7 @@ export const run = async (options) => {
|
|
|
44
73
|
deputy,
|
|
45
74
|
principal,
|
|
46
75
|
isGitIgnored,
|
|
76
|
+
scriptParserContext,
|
|
47
77
|
streamer,
|
|
48
78
|
workspaces,
|
|
49
79
|
options,
|
|
@@ -296,6 +296,11 @@ export declare const workspaceConfigurationSchema: z.ZodMiniObject<{
|
|
|
296
296
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
297
297
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
298
298
|
}, z.core.$strip>]>>;
|
|
299
|
+
marko: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
300
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
301
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
302
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
303
|
+
}, z.core.$strip>]>>;
|
|
299
304
|
mdx: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
300
305
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
301
306
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -903,7 +908,7 @@ export declare const workspaceConfigurationSchema: z.ZodMiniObject<{
|
|
|
903
908
|
ignoreExportsUsedInFile: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniObject<{
|
|
904
909
|
[x: string]: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
905
910
|
}, z.core.$strict>]>>;
|
|
906
|
-
ignoreIssues: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"cycles">]>>>>;
|
|
911
|
+
ignoreIssues: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"catalogReferences">, z.ZodMiniLiteral<"cycles">]>>>>;
|
|
907
912
|
includeEntryExports: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
908
913
|
}, z.core.$strict>;
|
|
909
914
|
export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
@@ -1202,6 +1207,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1202
1207
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1203
1208
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1204
1209
|
}, z.core.$strip>]>>;
|
|
1210
|
+
marko: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1211
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1212
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1213
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1214
|
+
}, z.core.$strip>]>>;
|
|
1205
1215
|
mdx: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1206
1216
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1207
1217
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1798,7 +1808,7 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1798
1808
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1799
1809
|
}, z.core.$strip>]>>;
|
|
1800
1810
|
$schema: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1801
|
-
rules: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"cycles">]> & z.core.$partial, z.ZodMiniEnum<{
|
|
1811
|
+
rules: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"catalogReferences">, z.ZodMiniLiteral<"cycles">]> & z.core.$partial, z.ZodMiniEnum<{
|
|
1802
1812
|
error: "error";
|
|
1803
1813
|
off: "off";
|
|
1804
1814
|
warn: "warn";
|
|
@@ -1815,7 +1825,7 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1815
1825
|
ignoreExportsUsedInFile: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniObject<{
|
|
1816
1826
|
[x: string]: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
1817
1827
|
}, z.core.$strict>]>>;
|
|
1818
|
-
ignoreIssues: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"cycles">]>>>>;
|
|
1828
|
+
ignoreIssues: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"catalogReferences">, z.ZodMiniLiteral<"cycles">]>>>>;
|
|
1819
1829
|
cycles: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
1820
1830
|
allow: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniArray<z.ZodMiniString<string>>>>;
|
|
1821
1831
|
dynamicImports: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
@@ -1828,8 +1838,8 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1828
1838
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
1829
1839
|
treatConfigHintsAsErrors: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
1830
1840
|
treatTagHintsAsErrors: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
1831
|
-
include: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"cycles">]>>>;
|
|
1832
|
-
exclude: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"cycles">]>>>;
|
|
1841
|
+
include: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"catalogReferences">, z.ZodMiniLiteral<"cycles">]>>>;
|
|
1842
|
+
exclude: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"catalogReferences">, z.ZodMiniLiteral<"cycles">]>>>;
|
|
1833
1843
|
workspaces: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
1834
1844
|
angular: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1835
1845
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -2126,6 +2136,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
2126
2136
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2127
2137
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2128
2138
|
}, z.core.$strip>]>>;
|
|
2139
|
+
marko: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
2140
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2141
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2142
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2143
|
+
}, z.core.$strip>]>>;
|
|
2129
2144
|
mdx: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
2130
2145
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
2131
2146
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -2733,7 +2748,7 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
2733
2748
|
ignoreExportsUsedInFile: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniObject<{
|
|
2734
2749
|
[x: string]: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
2735
2750
|
}, z.core.$strict>]>>;
|
|
2736
|
-
ignoreIssues: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"cycles">]>>>>;
|
|
2751
|
+
ignoreIssues: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"namespaceMembers">, z.ZodMiniLiteral<"catalog">, z.ZodMiniLiteral<"catalogReferences">, z.ZodMiniLiteral<"cycles">]>>>>;
|
|
2737
2752
|
includeEntryExports: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
2738
2753
|
}, z.core.$strict>>>;
|
|
2739
2754
|
}, z.core.$strict>;
|
|
@@ -23,6 +23,7 @@ const issueTypeSchema = z.union([
|
|
|
23
23
|
z.literal('enumMembers'),
|
|
24
24
|
z.literal('namespaceMembers'),
|
|
25
25
|
z.literal('catalog'),
|
|
26
|
+
z.literal('catalogReferences'),
|
|
26
27
|
z.literal('cycles'),
|
|
27
28
|
]);
|
|
28
29
|
const rulesSchema = z.partialRecord(issueTypeSchema, z.enum(['error', 'warn', 'off']));
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -301,6 +301,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
|
|
|
301
301
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
302
302
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
303
303
|
}, z.core.$strip>]>;
|
|
304
|
+
marko: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
305
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
306
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
307
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
308
|
+
}, z.core.$strip>]>;
|
|
304
309
|
mdx: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
305
310
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
306
311
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IMPORT_STAR } from '../constants.js';
|
|
2
2
|
import { getExportedIdentifiers } from '../graph-explorer/utils.js';
|
|
3
3
|
import { forEachAliasReExport, forEachNamespaceReExport, forEachPassThroughReExport, getStarReExportSources, } from '../graph-explorer/visitors.js';
|
|
4
|
+
import { compareStrings } from '../util/string.js';
|
|
4
5
|
const FALLBACK_LOCATION = { identifier: undefined, pos: 0, line: 0, col: 0 };
|
|
5
6
|
export const buildImportLookup = (fileNode) => {
|
|
6
7
|
const imports = new Map();
|
|
@@ -43,7 +44,7 @@ export const buildExportsMap = (fileNode, filePath, graph, entryPaths, explorer,
|
|
|
43
44
|
col,
|
|
44
45
|
importLocations: usage.locations
|
|
45
46
|
.filter(excludeReExports)
|
|
46
|
-
.sort((a, b) => a.filePath
|
|
47
|
+
.sort((a, b) => compareStrings(a.filePath, b.filePath) || a.line - b.line || a.col - b.col),
|
|
47
48
|
entryPaths: usageEntryPaths,
|
|
48
49
|
exports: childExports,
|
|
49
50
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-markdoc' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'electron-vite' | 'eleventy' | 'esbuild' | 'eslint' | 'eve' | 'execa' | 'expo' | 'expressive-code' | 'fast' | 'fumadocs' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'laravel-vite-plugin' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nuxtjs-i18n' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'openclaw' | 'orval' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'quasar' | 'qwik' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'tauri' | 'temporal' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'unplugin-auto-import' | 'unplugin-icons' | 'unplugin-vue-components' | 'unplugin-vue-i18n' | 'unplugin-vue-markdown' | 'unplugin-vue-router' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vite-plugin-pages' | 'vite-plugin-pwa' | 'vite-plugin-vue-layouts-next' | 'vite-plus' | 'vite-pwa-assets-generator' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
|
|
2
|
-
export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-markdoc', 'astro-og-canvas', 'ava', 'babel', 'biome', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'electron-vite', 'eleventy', 'esbuild', 'eslint', 'eve', 'execa', 'expo', 'expressive-code', 'fast', 'fumadocs', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'laravel-vite-plugin', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'mdx', 'mdxlint', 'metro', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nuxtjs-i18n', 'nx', 'nyc', 'oclif', 'openapi-ts', 'openclaw', 'orval', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'preconstruct', 'prettier', 'prisma', 'quasar', 'qwik', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'tauri', 'temporal', 'travis', 'ts-node', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'unplugin-auto-import', 'unplugin-icons', 'unplugin-vue-components', 'unplugin-vue-i18n', 'unplugin-vue-markdown', 'unplugin-vue-router', 'vercel', 'vercel-og', 'vike', 'vite', 'vite-plugin-pages', 'vite-plugin-pwa', 'vite-plugin-vue-layouts-next', 'vite-plus', 'vite-pwa-assets-generator', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
|
|
1
|
+
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-markdoc' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'electron-vite' | 'eleventy' | 'esbuild' | 'eslint' | 'eve' | 'execa' | 'expo' | 'expressive-code' | 'fast' | 'fumadocs' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'laravel-vite-plugin' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'marko' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nuxtjs-i18n' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'openclaw' | 'orval' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'quasar' | 'qwik' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'tauri' | 'temporal' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'unplugin-auto-import' | 'unplugin-icons' | 'unplugin-vue-components' | 'unplugin-vue-i18n' | 'unplugin-vue-markdown' | 'unplugin-vue-router' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vite-plugin-pages' | 'vite-plugin-pwa' | 'vite-plugin-vue-layouts-next' | 'vite-plus' | 'vite-pwa-assets-generator' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
|
|
2
|
+
export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-markdoc', 'astro-og-canvas', 'ava', 'babel', 'biome', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'electron-vite', 'eleventy', 'esbuild', 'eslint', 'eve', 'execa', 'expo', 'expressive-code', 'fast', 'fumadocs', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'laravel-vite-plugin', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'marko', 'mdx', 'mdxlint', 'metro', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nuxtjs-i18n', 'nx', 'nyc', 'oclif', 'openapi-ts', 'openclaw', 'orval', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'preconstruct', 'prettier', 'prisma', 'quasar', 'qwik', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'tauri', 'temporal', 'travis', 'ts-node', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'unplugin-auto-import', 'unplugin-icons', 'unplugin-vue-components', 'unplugin-vue-i18n', 'unplugin-vue-markdown', 'unplugin-vue-router', 'vercel', 'vercel-og', 'vike', 'vite', 'vite-plugin-pages', 'vite-plugin-pwa', 'vite-plugin-vue-layouts-next', 'vite-plus', 'vite-pwa-assets-generator', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
|
package/dist/types/issues.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export type Scripts = Record<string, string>;
|
|
|
25
25
|
export type Catalog = Record<string, string>;
|
|
26
26
|
export type Catalogs = Record<string, Catalog>;
|
|
27
27
|
type Dependencies = Record<string, string>;
|
|
28
|
+
type TypesVersions = Record<string, Record<string, string[]>>;
|
|
28
29
|
export type PackageExtensions = Record<string, {
|
|
29
30
|
peerDependencies?: Dependencies;
|
|
30
31
|
peerDependenciesMeta?: Record<string, {
|
|
@@ -57,6 +58,15 @@ export type PackageJson = {
|
|
|
57
58
|
browser?: string;
|
|
58
59
|
types?: string;
|
|
59
60
|
typings?: string;
|
|
61
|
+
typesVersions?: TypesVersions;
|
|
62
|
+
publishConfig?: {
|
|
63
|
+
directory?: string;
|
|
64
|
+
main?: string;
|
|
65
|
+
exports?: Exports;
|
|
66
|
+
types?: string;
|
|
67
|
+
typings?: string;
|
|
68
|
+
typesVersions?: TypesVersions;
|
|
69
|
+
};
|
|
60
70
|
catalog?: Catalog;
|
|
61
71
|
catalogs?: Catalogs;
|
|
62
72
|
packageManager?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isBuiltin } from 'node:module';
|
|
2
|
-
import { IMPORT_FLAGS, IMPORT_STAR, OPAQUE, PROTOCOL_VIRTUAL, SIDE_EFFECTS } from '../constants.js';
|
|
2
|
+
import { IMPORT_FLAGS, IMPORT_STAR, LOADER_DEFAULT, OPAQUE, PROTOCOL_VIRTUAL, SIDE_EFFECTS } from '../constants.js';
|
|
3
3
|
import { addNsValue, addValue, createImports } from '../util/module-graph.js';
|
|
4
4
|
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier, isStartsLikePackageName, sanitizeSpecifier, } from '../util/modules.js';
|
|
5
5
|
import { timerify } from '../util/Performance.js';
|
|
@@ -49,7 +49,8 @@ const getImportsAndExports = (filePath, sourceText, resolveModule, options, igno
|
|
|
49
49
|
};
|
|
50
50
|
const addInternalImport = (opts) => {
|
|
51
51
|
const { filePath: importFilePath, namespace, specifier, modifiers } = opts;
|
|
52
|
-
const identifier = opts.identifier ??
|
|
52
|
+
const identifier = opts.identifier ??
|
|
53
|
+
(modifiers & IMPORT_FLAGS.OPAQUE ? OPAQUE : modifiers & IMPORT_FLAGS.LOADER ? LOADER_DEFAULT : SIDE_EFFECTS);
|
|
53
54
|
const isStar = identifier === IMPORT_STAR;
|
|
54
55
|
imports.add({
|
|
55
56
|
filePath: importFilePath,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Workspace } from '../ConfigurationChief.ts';
|
|
2
|
+
import type { PackageJson } from '../types/package-json.ts';
|
|
3
|
+
interface PublishedTypeDependency {
|
|
4
|
+
containingFilePath: string;
|
|
5
|
+
packageName: string;
|
|
6
|
+
specifier: string;
|
|
7
|
+
pos: number;
|
|
8
|
+
line: number;
|
|
9
|
+
col: number;
|
|
10
|
+
isResolved: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const createPublishedTypeDependencyAnalyzer: () => (workspace: Workspace, manifest: PackageJson) => PublishedTypeDependency[];
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { IS_DTS } from '../constants.js';
|
|
3
|
+
import { isFile } from '../util/fs.js';
|
|
4
|
+
import { _syncGlob } from '../util/glob.js';
|
|
5
|
+
import { getDefinitelyTypedFor, getPackageNameFromModuleSpecifier, isDefinitelyTyped, isStartsLikePackageName, sanitizeSpecifier, } from '../util/modules.js';
|
|
6
|
+
import { getPublishedTypeManifest, getPublishedTypeEntrySpecifiers, getPublishedTypeExportSpecifiers, isPublishedTypeExportTarget, toDeclarationSpecifier, } from '../util/package-json.js';
|
|
7
|
+
import { dirname, join, relative } from '../util/path.js';
|
|
8
|
+
import { _resolveDeclarationSync } from '../util/resolve.js';
|
|
9
|
+
import { _getImportsAndExports } from './get-imports-and-exports.js';
|
|
10
|
+
import { buildVisitor } from './visitors/walk.js';
|
|
11
|
+
const options = {
|
|
12
|
+
skipTypeOnly: false,
|
|
13
|
+
isFixExports: false,
|
|
14
|
+
isFixTypes: false,
|
|
15
|
+
isReportExports: false,
|
|
16
|
+
tags: [[], []],
|
|
17
|
+
};
|
|
18
|
+
const resolveNothing = () => undefined;
|
|
19
|
+
const toGlobPattern = (specifier) => {
|
|
20
|
+
const index = specifier.indexOf('*');
|
|
21
|
+
return `${specifier.slice(0, index)}**/*${specifier.slice(index + 1).replaceAll('*', '**')}`;
|
|
22
|
+
};
|
|
23
|
+
const isInWorkspace = (filePath, workspaceDir) => filePath === workspaceDir || filePath.startsWith(`${workspaceDir}/`);
|
|
24
|
+
const toDeclarationPath = (filePath) => {
|
|
25
|
+
if (IS_DTS.test(filePath))
|
|
26
|
+
return filePath;
|
|
27
|
+
const candidate = toDeclarationSpecifier(filePath);
|
|
28
|
+
if (candidate && isFile(candidate))
|
|
29
|
+
return candidate;
|
|
30
|
+
};
|
|
31
|
+
const getDeclarationPaths = (specifiers, workspaceDir) => {
|
|
32
|
+
const paths = new Set();
|
|
33
|
+
const patterns = [];
|
|
34
|
+
for (const specifier of specifiers) {
|
|
35
|
+
if (specifier.includes('*')) {
|
|
36
|
+
patterns.push(toGlobPattern(specifier));
|
|
37
|
+
}
|
|
38
|
+
else if (IS_DTS.test(specifier)) {
|
|
39
|
+
const filePath = join(workspaceDir, specifier);
|
|
40
|
+
if (isFile(filePath))
|
|
41
|
+
paths.add(filePath);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (patterns.length > 0) {
|
|
45
|
+
for (const filePath of _syncGlob({ cwd: workspaceDir, patterns })) {
|
|
46
|
+
if (IS_DTS.test(filePath))
|
|
47
|
+
paths.add(filePath);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return paths;
|
|
51
|
+
};
|
|
52
|
+
const getPublishedTypeEntryPaths = (manifest, workspaceDir) => {
|
|
53
|
+
const { candidates, versioned } = getPublishedTypeEntrySpecifiers(manifest);
|
|
54
|
+
const paths = getDeclarationPaths(versioned, workspaceDir);
|
|
55
|
+
for (const specifier of candidates) {
|
|
56
|
+
const filePath = join(workspaceDir, specifier);
|
|
57
|
+
if (!isFile(filePath))
|
|
58
|
+
continue;
|
|
59
|
+
paths.add(filePath);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
for (const filePath of getDeclarationPaths(getPublishedTypeExportSpecifiers(manifest.exports), workspaceDir)) {
|
|
63
|
+
if (isPublishedTypeExportTarget(manifest.exports, `./${relative(workspaceDir, filePath)}`))
|
|
64
|
+
paths.add(filePath);
|
|
65
|
+
}
|
|
66
|
+
return paths;
|
|
67
|
+
};
|
|
68
|
+
export const createPublishedTypeDependencyAnalyzer = () => {
|
|
69
|
+
const visitor = buildVisitor([]);
|
|
70
|
+
const packageJsonCache = new Map();
|
|
71
|
+
const packageTypesCache = new Map();
|
|
72
|
+
const loadPackageJson = (filePath) => {
|
|
73
|
+
if (packageJsonCache.has(filePath))
|
|
74
|
+
return packageJsonCache.get(filePath);
|
|
75
|
+
let manifest;
|
|
76
|
+
try {
|
|
77
|
+
manifest = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
78
|
+
}
|
|
79
|
+
catch { }
|
|
80
|
+
packageJsonCache.set(filePath, manifest);
|
|
81
|
+
return manifest;
|
|
82
|
+
};
|
|
83
|
+
const packageProvidesTypes = (packageJsonPath, resolvedPath) => {
|
|
84
|
+
const cached = packageTypesCache.get(packageJsonPath);
|
|
85
|
+
if (cached !== undefined)
|
|
86
|
+
return cached;
|
|
87
|
+
const manifest = loadPackageJson(packageJsonPath);
|
|
88
|
+
const hasTypes = toDeclarationPath(resolvedPath) !== undefined ||
|
|
89
|
+
Boolean(manifest && (manifest.types || manifest.typings || manifest.typesVersions)) ||
|
|
90
|
+
isFile(join(dirname(packageJsonPath), 'index.d.ts'));
|
|
91
|
+
packageTypesCache.set(packageJsonPath, hasTypes);
|
|
92
|
+
return hasTypes;
|
|
93
|
+
};
|
|
94
|
+
const getExternalDependency = (packageName, containingFile, declaredDependencies) => {
|
|
95
|
+
const resolved = _resolveDeclarationSync(packageName, containingFile);
|
|
96
|
+
if (isDefinitelyTyped(packageName))
|
|
97
|
+
return { packageName, isResolved: resolved !== undefined };
|
|
98
|
+
if (resolved?.packageJsonPath) {
|
|
99
|
+
const installedName = loadPackageJson(resolved.packageJsonPath)?.name;
|
|
100
|
+
if (installedName && isDefinitelyTyped(installedName))
|
|
101
|
+
return { packageName: installedName, isResolved: true };
|
|
102
|
+
if (packageProvidesTypes(resolved.packageJsonPath, resolved.path))
|
|
103
|
+
return { packageName, isResolved: true };
|
|
104
|
+
}
|
|
105
|
+
const typesPackageName = getDefinitelyTypedFor(packageName);
|
|
106
|
+
if (_resolveDeclarationSync(typesPackageName, containingFile) || declaredDependencies.has(typesPackageName))
|
|
107
|
+
return { packageName: typesPackageName, isResolved: true };
|
|
108
|
+
return { packageName, isResolved: resolved !== undefined };
|
|
109
|
+
};
|
|
110
|
+
return (workspace, manifest) => {
|
|
111
|
+
const dependencies = [];
|
|
112
|
+
const declaredDependencies = new Set([
|
|
113
|
+
...Object.keys(manifest.dependencies ?? {}),
|
|
114
|
+
...Object.keys(manifest.devDependencies ?? {}),
|
|
115
|
+
...Object.keys(manifest.peerDependencies ?? {}),
|
|
116
|
+
...Object.keys(manifest.optionalDependencies ?? {}),
|
|
117
|
+
]);
|
|
118
|
+
const files = getPublishedTypeEntryPaths(getPublishedTypeManifest(manifest), workspace.dir);
|
|
119
|
+
for (const filePath of files) {
|
|
120
|
+
let file;
|
|
121
|
+
try {
|
|
122
|
+
file = _getImportsAndExports(filePath, readFileSync(filePath, 'utf8'), resolveNothing, options, false, true, visitor, undefined);
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
for (const _import of file.imports.unresolved) {
|
|
128
|
+
const specifier = sanitizeSpecifier(_import.specifier);
|
|
129
|
+
const packageName = isStartsLikePackageName(specifier)
|
|
130
|
+
? getPackageNameFromModuleSpecifier(specifier)
|
|
131
|
+
: undefined;
|
|
132
|
+
if (!packageName || packageName === workspace.pkgName) {
|
|
133
|
+
if (!packageName && !specifier.startsWith('.'))
|
|
134
|
+
continue;
|
|
135
|
+
const resolved = _resolveDeclarationSync(specifier, filePath);
|
|
136
|
+
const declarationPath = resolved && toDeclarationPath(resolved.path);
|
|
137
|
+
if (declarationPath && isInWorkspace(declarationPath, workspace.dir))
|
|
138
|
+
files.add(declarationPath);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const external = getExternalDependency(packageName, filePath, declaredDependencies);
|
|
142
|
+
dependencies.push({
|
|
143
|
+
containingFilePath: filePath,
|
|
144
|
+
packageName: external.packageName,
|
|
145
|
+
specifier,
|
|
146
|
+
pos: _import.pos,
|
|
147
|
+
line: _import.line,
|
|
148
|
+
col: _import.col,
|
|
149
|
+
isResolved: external.isResolved,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return dependencies;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
@@ -221,6 +221,14 @@ export function handleCallExpression(node, s) {
|
|
|
221
221
|
for (const arg of node.arguments) {
|
|
222
222
|
if (arg.type === 'Identifier')
|
|
223
223
|
markRefIfNs(arg.name);
|
|
224
|
+
else if (arg.type === 'ArrowFunctionExpression' && arg.expression) {
|
|
225
|
+
const body = arg.body.type === 'AwaitExpression' ? arg.body.argument : arg.body;
|
|
226
|
+
if (body.type === 'ImportExpression' && isStringLiteral(body.source)) {
|
|
227
|
+
s.handledImportExpressions.add(body.start);
|
|
228
|
+
const specifier = getStringValue(body.source);
|
|
229
|
+
s.addImport(specifier, undefined, undefined, undefined, body.source.start, IMPORT_FLAGS.DYNAMIC | IMPORT_FLAGS.LOADER);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
224
232
|
else if (arg.type === 'ArrayExpression') {
|
|
225
233
|
for (const el of arg.elements ?? []) {
|
|
226
234
|
if (el?.type === 'Identifier')
|
package/dist/util/catalog.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { CatalogContainer } from '../CatalogCounselor.ts';
|
|
2
2
|
import type { PackageJson } from '../types/package-json.ts';
|
|
3
3
|
export declare const DEFAULT_CATALOG = "default";
|
|
4
|
+
export type CatalogReference = {
|
|
5
|
+
catalogName: string;
|
|
6
|
+
packageName: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const getCatalogReference: (specifier: string) => CatalogReference | undefined;
|
|
4
9
|
export declare const getCatalogContainer: (cwd: string, manifest: PackageJson, manifestPath: string, pnpmWorkspacePath?: string, pnpmWorkspace?: any) => Promise<CatalogContainer>;
|
|
5
10
|
export declare const parseCatalog: (container: CatalogContainer) => Set<string>;
|
|
6
|
-
export declare const extractCatalogReferences: (manifest: PackageJson) =>
|
|
11
|
+
export declare const extractCatalogReferences: (manifest: PackageJson) => CatalogReference[];
|
package/dist/util/catalog.js
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { isFile } from './fs.js';
|
|
2
2
|
import { _load } from './loader.js';
|
|
3
|
+
import { getPackageNameFromModuleSpecifier } from './modules.js';
|
|
3
4
|
import { basename, join } from './path.js';
|
|
4
5
|
export const DEFAULT_CATALOG = 'default';
|
|
6
|
+
const CATALOG_PROTOCOL = '@catalog:';
|
|
7
|
+
export const getCatalogReference = (specifier) => {
|
|
8
|
+
const protocolIndex = specifier.lastIndexOf(CATALOG_PROTOCOL);
|
|
9
|
+
if (protocolIndex <= 0)
|
|
10
|
+
return;
|
|
11
|
+
const packageName = specifier.slice(0, protocolIndex);
|
|
12
|
+
if (getPackageNameFromModuleSpecifier(packageName) !== packageName)
|
|
13
|
+
return;
|
|
14
|
+
return {
|
|
15
|
+
catalogName: specifier.slice(protocolIndex + CATALOG_PROTOCOL.length) || DEFAULT_CATALOG,
|
|
16
|
+
packageName,
|
|
17
|
+
};
|
|
18
|
+
};
|
|
5
19
|
export const getCatalogContainer = async (cwd, manifest, manifestPath, pnpmWorkspacePath, pnpmWorkspace) => {
|
|
6
20
|
const filePath = pnpmWorkspacePath ?? (isFile(cwd, '.yarnrc.yml') ? join(cwd, '.yarnrc.yml') : manifestPath);
|
|
7
21
|
const yarnWorkspace = basename(filePath) === '.yarnrc.yml' ? await _load(filePath) : undefined;
|
|
@@ -43,14 +57,14 @@ export const parseCatalog = (container) => {
|
|
|
43
57
|
return entries;
|
|
44
58
|
};
|
|
45
59
|
export const extractCatalogReferences = (manifest) => {
|
|
46
|
-
const catalogReferences =
|
|
60
|
+
const catalogReferences = [];
|
|
47
61
|
const checkDependencies = (dependencies) => {
|
|
48
62
|
if (!dependencies)
|
|
49
63
|
return;
|
|
50
64
|
for (const [name, version] of Object.entries(dependencies)) {
|
|
51
65
|
if (typeof version === 'string' && version.startsWith('catalog:')) {
|
|
52
66
|
const catalogName = version.slice('catalog:'.length) || DEFAULT_CATALOG;
|
|
53
|
-
catalogReferences.
|
|
67
|
+
catalogReferences.push({ catalogName, packageName: name });
|
|
54
68
|
}
|
|
55
69
|
}
|
|
56
70
|
};
|