knip 5.65.0 → 5.66.1
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 +12 -6
- package/dist/ConfigurationChief.js +2 -0
- package/dist/ConsoleStreamer.d.ts +2 -1
- package/dist/ConsoleStreamer.js +10 -5
- package/dist/IssueCollector.d.ts +8 -1
- package/dist/IssueCollector.js +40 -5
- package/dist/compilers/index.d.ts +15 -11
- package/dist/constants.d.ts +28 -3
- package/dist/constants.js +10 -0
- package/dist/graph/build.js +2 -1
- package/dist/index.js +6 -1
- package/dist/plugins/danger/index.d.ts +8 -0
- package/dist/plugins/danger/index.js +11 -0
- package/dist/plugins/eleventy/helpers.d.ts +1 -0
- package/dist/plugins/eleventy/helpers.js +1 -0
- package/dist/plugins/index.d.ts +6 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/nuxt/index.js +5 -1
- package/dist/reporters/util/util.d.ts +2 -2
- package/dist/reporters/util/util.js +2 -3
- package/dist/reporters/watch.d.ts +2 -2
- package/dist/reporters/watch.js +3 -3
- package/dist/schema/configuration.d.ts +12 -6
- package/dist/schema/configuration.js +5 -8
- 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/config.d.ts +4 -2
- package/dist/types/issues.d.ts +2 -10
- package/dist/types/issues.js +1 -11
- package/dist/typescript/ast-helpers.d.ts +3 -3
- package/dist/typescript/ast-helpers.js +11 -12
- package/dist/typescript/visitors/exports/exportDeclaration.js +4 -5
- package/dist/typescript/visitors/exports/exportKeyword.js +9 -10
- package/dist/typescript/visitors/exports/exportsAccessExpression.js +2 -3
- package/dist/typescript/visitors/exports/moduleExportsAccessExpression.js +5 -6
- package/dist/util/Performance.d.ts +1 -1
- package/dist/util/Performance.js +2 -2
- package/dist/util/create-options.d.ts +17 -13
- package/dist/util/create-options.js +1 -1
- package/dist/util/fs.d.ts +2 -1
- package/dist/util/fs.js +14 -4
- package/dist/util/get-included-issue-types.js +1 -4
- package/dist/util/get-referenced-inputs.d.ts +2 -2
- package/dist/util/get-referenced-inputs.js +5 -5
- package/dist/util/has-strictly-ns-references.d.ts +1 -1
- package/dist/util/loader.js +6 -3
- package/dist/util/string.js +5 -1
- package/dist/util/watch.d.ts +7 -3
- package/dist/util/watch.js +106 -67
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +20 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod/mini';
|
|
2
|
+
import { SYMBOL_TYPE } from '../constants.js';
|
|
2
3
|
import { globSchema, pluginsSchema } from './plugins.js';
|
|
3
4
|
const pathsSchema = z.record(z.string(), z.array(z.string()));
|
|
4
5
|
const syncCompilerSchema = z.union([z.literal(true), z.custom()]);
|
|
@@ -23,15 +24,10 @@ const issueTypeSchema = z.union([
|
|
|
23
24
|
z.literal('classMembers'),
|
|
24
25
|
]);
|
|
25
26
|
const rulesSchema = z.partialRecord(issueTypeSchema, z.enum(['error', 'warn', 'off']));
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
enum: z.optional(z.boolean()),
|
|
29
|
-
function: z.optional(z.boolean()),
|
|
30
|
-
interface: z.optional(z.boolean()),
|
|
31
|
-
member: z.optional(z.boolean()),
|
|
32
|
-
type: z.optional(z.boolean()),
|
|
33
|
-
});
|
|
27
|
+
const ignorableSymbolTypes = Object.values(SYMBOL_TYPE).filter(type => type !== 'unknown');
|
|
28
|
+
const ignoreExportsUsedInFileObjectSchema = z.strictObject(Object.fromEntries(ignorableSymbolTypes.map(type => [type, z.optional(z.boolean())])));
|
|
34
29
|
const ignoreExportsUsedInFileSchema = z.union([z.boolean(), ignoreExportsUsedInFileObjectSchema]);
|
|
30
|
+
const ignoreIssuesSchema = z.record(z.string(), z.array(issueTypeSchema));
|
|
35
31
|
const rootConfigurationSchema = z.object({
|
|
36
32
|
$schema: z.optional(z.string()),
|
|
37
33
|
rules: z.optional(rulesSchema),
|
|
@@ -45,6 +41,7 @@ const rootConfigurationSchema = z.object({
|
|
|
45
41
|
ignoreMembers: z.optional(stringOrRegexSchema),
|
|
46
42
|
ignoreUnresolved: z.optional(stringOrRegexSchema),
|
|
47
43
|
ignoreExportsUsedInFile: z.optional(ignoreExportsUsedInFileSchema),
|
|
44
|
+
ignoreIssues: z.optional(ignoreIssuesSchema),
|
|
48
45
|
ignoreWorkspaces: z.optional(z.array(z.string())),
|
|
49
46
|
includeEntryExports: z.optional(z.boolean()),
|
|
50
47
|
compilers: z.optional(compilersSchema),
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -101,6 +101,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
|
|
|
101
101
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
102
102
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
103
103
|
}, z.core.$strip>]>;
|
|
104
|
+
danger: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
105
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
106
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
107
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
108
|
+
}, z.core.$strip>]>;
|
|
104
109
|
'dependency-cruiser': z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
105
110
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
106
111
|
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' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | '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' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | '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' | 'syncpack' | 'tailwind' | '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", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "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", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "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", "syncpack", "tailwind", "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' | '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' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | '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' | 'syncpack' | 'tailwind' | '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", "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", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "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", "syncpack", "tailwind", "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/config.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { knipConfigurationSchema } from '../schema/configuration.js';
|
|
|
5
5
|
import type { pluginSchema } from '../schema/plugins.js';
|
|
6
6
|
import type { Input } from '../util/input.js';
|
|
7
7
|
import type { Args } from './args.js';
|
|
8
|
-
import type { SymbolType } from './issues.js';
|
|
8
|
+
import type { IssueType, SymbolType } from './issues.js';
|
|
9
9
|
import type { Tags } from './options.js';
|
|
10
10
|
import type { PluginName } from './PluginNames.js';
|
|
11
11
|
import type { PackageJson } from './package-json.js';
|
|
@@ -23,8 +23,9 @@ export type BinaryResolver = (binary: string, args: string[], options: BinaryRes
|
|
|
23
23
|
export type RawConfiguration = z.infer<typeof knipConfigurationSchema>;
|
|
24
24
|
export type RawPluginConfiguration = z.infer<typeof pluginSchema>;
|
|
25
25
|
export type IgnorePatterns = (string | RegExp)[];
|
|
26
|
-
type IgnorableExport = Exclude<SymbolType,
|
|
26
|
+
type IgnorableExport = Exclude<SymbolType, 'unknown'>;
|
|
27
27
|
export type IgnoreExportsUsedInFile = boolean | Partial<Record<IgnorableExport, boolean>>;
|
|
28
|
+
export type IgnoreIssues = Record<string, IssueType[]>;
|
|
28
29
|
export type GetImportsAndExportsOptions = {
|
|
29
30
|
skipTypeOnly: boolean;
|
|
30
31
|
isFixExports: boolean;
|
|
@@ -38,6 +39,7 @@ export interface Configuration {
|
|
|
38
39
|
ignoreBinaries: IgnorePatterns;
|
|
39
40
|
ignoreDependencies: IgnorePatterns;
|
|
40
41
|
ignoreExportsUsedInFile: IgnoreExportsUsedInFile;
|
|
42
|
+
ignoreIssues?: IgnoreIssues;
|
|
41
43
|
ignoreMembers: IgnorePatterns;
|
|
42
44
|
ignoreUnresolved: IgnorePatterns;
|
|
43
45
|
ignoreWorkspaces: string[];
|
package/dist/types/issues.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
TYPE = "type",
|
|
4
|
-
INTERFACE = "interface",
|
|
5
|
-
ENUM = "enum",
|
|
6
|
-
FUNCTION = "function",
|
|
7
|
-
CLASS = "class",
|
|
8
|
-
MEMBER = "member",
|
|
9
|
-
UNKNOWN = "unknown"
|
|
10
|
-
}
|
|
1
|
+
import type { SYMBOL_TYPE } from '../constants.js';
|
|
2
|
+
export type SymbolType = (typeof SYMBOL_TYPE)[keyof typeof SYMBOL_TYPE];
|
|
11
3
|
export type IssueSymbol = {
|
|
12
4
|
symbol: string;
|
|
13
5
|
pos?: number;
|
package/dist/types/issues.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
(function (SymbolType) {
|
|
3
|
-
SymbolType["VARIABLE"] = "variable";
|
|
4
|
-
SymbolType["TYPE"] = "type";
|
|
5
|
-
SymbolType["INTERFACE"] = "interface";
|
|
6
|
-
SymbolType["ENUM"] = "enum";
|
|
7
|
-
SymbolType["FUNCTION"] = "function";
|
|
8
|
-
SymbolType["CLASS"] = "class";
|
|
9
|
-
SymbolType["MEMBER"] = "member";
|
|
10
|
-
SymbolType["UNKNOWN"] = "unknown";
|
|
11
|
-
})(SymbolType || (SymbolType = {}));
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import type { Fix } from '../types/exports.js';
|
|
3
|
-
import { SymbolType } from '../types/issues.js';
|
|
3
|
+
import type { SymbolType } from '../types/issues.js';
|
|
4
4
|
export declare function isDefaultImport(node: ts.ImportDeclaration | ts.ImportEqualsDeclaration | ts.ExportDeclaration): boolean;
|
|
5
5
|
export declare function isAccessExpression(node: ts.Node): node is ts.AccessExpression;
|
|
6
6
|
export declare function isImportCall(node: ts.Node): node is ts.ImportCall;
|
|
@@ -12,14 +12,14 @@ export declare const getClassMember: (member: ts.MethodDeclaration | ts.Property
|
|
|
12
12
|
node: ts.MethodDeclaration | ts.PropertyDeclaration;
|
|
13
13
|
identifier: string;
|
|
14
14
|
pos: number;
|
|
15
|
-
type:
|
|
15
|
+
type: "member";
|
|
16
16
|
fix: Fix;
|
|
17
17
|
};
|
|
18
18
|
export declare const getEnumMember: (member: ts.EnumMember, isFixTypes: boolean) => {
|
|
19
19
|
node: ts.EnumMember;
|
|
20
20
|
identifier: string;
|
|
21
21
|
pos: number;
|
|
22
|
-
type:
|
|
22
|
+
type: "member";
|
|
23
23
|
fix: Fix;
|
|
24
24
|
};
|
|
25
25
|
export declare function stripQuotes(name: string): string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { FIX_FLAGS } from '../constants.js';
|
|
3
|
-
import { SymbolType } from '../types/issues.js';
|
|
2
|
+
import { FIX_FLAGS, SYMBOL_TYPE } from '../constants.js';
|
|
4
3
|
function isGetOrSetAccessorDeclaration(node) {
|
|
5
4
|
return node.kind === ts.SyntaxKind.SetAccessor || node.kind === ts.SyntaxKind.GetAccessor;
|
|
6
5
|
}
|
|
@@ -34,20 +33,20 @@ export function isPropertyAccessCall(node, identifier) {
|
|
|
34
33
|
}
|
|
35
34
|
export const getNodeType = (node) => {
|
|
36
35
|
if (!node)
|
|
37
|
-
return
|
|
36
|
+
return SYMBOL_TYPE.UNKNOWN;
|
|
38
37
|
if (ts.isFunctionDeclaration(node))
|
|
39
|
-
return
|
|
38
|
+
return SYMBOL_TYPE.FUNCTION;
|
|
40
39
|
if (ts.isClassDeclaration(node))
|
|
41
|
-
return
|
|
40
|
+
return SYMBOL_TYPE.CLASS;
|
|
42
41
|
if (ts.isInterfaceDeclaration(node))
|
|
43
|
-
return
|
|
42
|
+
return SYMBOL_TYPE.INTERFACE;
|
|
44
43
|
if (ts.isTypeAliasDeclaration(node))
|
|
45
|
-
return
|
|
44
|
+
return SYMBOL_TYPE.TYPE;
|
|
46
45
|
if (ts.isEnumDeclaration(node))
|
|
47
|
-
return
|
|
46
|
+
return SYMBOL_TYPE.ENUM;
|
|
48
47
|
if (ts.isVariableDeclaration(node))
|
|
49
|
-
return
|
|
50
|
-
return
|
|
48
|
+
return SYMBOL_TYPE.VARIABLE;
|
|
49
|
+
return SYMBOL_TYPE.UNKNOWN;
|
|
51
50
|
};
|
|
52
51
|
export const isNonPrivatePropertyOrMethodDeclaration = (member) => (ts.isPropertyDeclaration(member) || ts.isMethodDeclaration(member) || isGetOrSetAccessorDeclaration(member)) &&
|
|
53
52
|
!isPrivateMember(member);
|
|
@@ -55,14 +54,14 @@ export const getClassMember = (member, isFixTypes) => ({
|
|
|
55
54
|
node: member,
|
|
56
55
|
identifier: member.name.getText(),
|
|
57
56
|
pos: member.name.getStart() + (ts.isComputedPropertyName(member.name) ? 1 : 0),
|
|
58
|
-
type:
|
|
57
|
+
type: SYMBOL_TYPE.MEMBER,
|
|
59
58
|
fix: isFixTypes ? [member.getStart(), member.getEnd(), FIX_FLAGS.NONE] : undefined,
|
|
60
59
|
});
|
|
61
60
|
export const getEnumMember = (member, isFixTypes) => ({
|
|
62
61
|
node: member,
|
|
63
62
|
identifier: stripQuotes(member.name.getText()),
|
|
64
63
|
pos: member.name.getStart(),
|
|
65
|
-
type:
|
|
64
|
+
type: SYMBOL_TYPE.MEMBER,
|
|
66
65
|
fix: isFixTypes
|
|
67
66
|
? [member.getStart(), member.getEnd(), FIX_FLAGS.OBJECT_BINDING | FIX_FLAGS.WITH_NEWLINE]
|
|
68
67
|
: undefined,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { FIX_FLAGS } from '../../../constants.js';
|
|
3
|
-
import { SymbolType } from '../../../types/issues.js';
|
|
2
|
+
import { FIX_FLAGS, SYMBOL_TYPE } from '../../../constants.js';
|
|
4
3
|
import { isModule } from '../helpers.js';
|
|
5
4
|
import { exportVisitor as visit } from '../index.js';
|
|
6
5
|
export default visit(isModule, (node, { isFixExports, isFixTypes }) => {
|
|
7
6
|
if (ts.isExportDeclaration(node)) {
|
|
8
7
|
if (node.exportClause && ts.isNamedExports(node.exportClause)) {
|
|
9
|
-
const nodeType = node.isTypeOnly ?
|
|
8
|
+
const nodeType = node.isTypeOnly ? SYMBOL_TYPE.TYPE : SYMBOL_TYPE.UNKNOWN;
|
|
10
9
|
const sourceFile = node.getSourceFile();
|
|
11
10
|
const declarations = sourceFile.getNamedDeclarations?.();
|
|
12
11
|
return node.exportClause.elements.map(element => {
|
|
@@ -14,8 +13,8 @@ export default visit(isModule, (node, { isFixExports, isFixTypes }) => {
|
|
|
14
13
|
const propName = element.propertyName?.text;
|
|
15
14
|
const symbol = declarations?.get(propName ?? identifier)?.[0]?.symbol;
|
|
16
15
|
const pos = element.name.pos;
|
|
17
|
-
const type = element.isTypeOnly ?
|
|
18
|
-
const fix = (isFixExports && type !==
|
|
16
|
+
const type = element.isTypeOnly ? SYMBOL_TYPE.TYPE : nodeType;
|
|
17
|
+
const fix = (isFixExports && type !== SYMBOL_TYPE.TYPE) || (isFixTypes && type === SYMBOL_TYPE.TYPE)
|
|
19
18
|
? [element.getStart(), element.getEnd(), FIX_FLAGS.OBJECT_BINDING | FIX_FLAGS.EMPTY_DECLARATION]
|
|
20
19
|
: undefined;
|
|
21
20
|
return { node: element, symbol, identifier, type, pos, fix };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { FIX_FLAGS } from '../../../constants.js';
|
|
3
|
-
import { SymbolType } from '../../../types/issues.js';
|
|
2
|
+
import { FIX_FLAGS, SYMBOL_TYPE } from '../../../constants.js';
|
|
4
3
|
import { compact } from '../../../util/array.js';
|
|
5
4
|
import { getClassMember, getDefaultKeywordNode, getEnumMember, getExportKeywordNode, isNonPrivatePropertyOrMethodDeclaration, } from '../../ast-helpers.js';
|
|
6
5
|
import { isModule } from '../helpers.js';
|
|
@@ -20,7 +19,7 @@ export default visit(isModule, (node, { isFixExports, isFixTypes, isReportClassM
|
|
|
20
19
|
node: element,
|
|
21
20
|
symbol: element.symbol,
|
|
22
21
|
identifier: element.name.escapedText.toString(),
|
|
23
|
-
type:
|
|
22
|
+
type: SYMBOL_TYPE.UNKNOWN,
|
|
24
23
|
pos: element.name.getStart(),
|
|
25
24
|
fix,
|
|
26
25
|
};
|
|
@@ -35,7 +34,7 @@ export default visit(isModule, (node, { isFixExports, isFixTypes, isReportClassM
|
|
|
35
34
|
node: element,
|
|
36
35
|
symbol: element.symbol,
|
|
37
36
|
identifier: element.getText(),
|
|
38
|
-
type:
|
|
37
|
+
type: SYMBOL_TYPE.UNKNOWN,
|
|
39
38
|
pos: element.getStart(),
|
|
40
39
|
fix,
|
|
41
40
|
};
|
|
@@ -45,7 +44,7 @@ export default visit(isModule, (node, { isFixExports, isFixTypes, isReportClassM
|
|
|
45
44
|
const identifier = declaration.name.getText();
|
|
46
45
|
const pos = declaration.name.getStart();
|
|
47
46
|
const fix = getFix(exportKeyword);
|
|
48
|
-
return { node: declaration, identifier, type:
|
|
47
|
+
return { node: declaration, identifier, type: SYMBOL_TYPE.UNKNOWN, pos, fix };
|
|
49
48
|
});
|
|
50
49
|
}
|
|
51
50
|
const defaultKeyword = getDefaultKeywordNode(node);
|
|
@@ -53,7 +52,7 @@ export default visit(isModule, (node, { isFixExports, isFixTypes, isReportClassM
|
|
|
53
52
|
const identifier = defaultKeyword ? 'default' : node.name.getText();
|
|
54
53
|
const pos = (node.name ?? node.body ?? node).getStart();
|
|
55
54
|
const fix = getFix(exportKeyword, defaultKeyword);
|
|
56
|
-
return { node, identifier, pos, type:
|
|
55
|
+
return { node, identifier, pos, type: SYMBOL_TYPE.FUNCTION, fix };
|
|
57
56
|
}
|
|
58
57
|
if (ts.isClassDeclaration(node) && node.name) {
|
|
59
58
|
const identifier = defaultKeyword ? 'default' : node.name.getText();
|
|
@@ -62,26 +61,26 @@ export default visit(isModule, (node, { isFixExports, isFixTypes, isReportClassM
|
|
|
62
61
|
const members = isReportClassMembers
|
|
63
62
|
? node.members.filter(isNonPrivatePropertyOrMethodDeclaration).map(member => getClassMember(member, isFixTypes))
|
|
64
63
|
: [];
|
|
65
|
-
return { node, identifier, type:
|
|
64
|
+
return { node, identifier, type: SYMBOL_TYPE.CLASS, pos, members, fix };
|
|
66
65
|
}
|
|
67
66
|
if (ts.isTypeAliasDeclaration(node)) {
|
|
68
67
|
const identifier = node.name.getText();
|
|
69
68
|
const pos = node.name.getStart();
|
|
70
69
|
const fix = getTypeFix(exportKeyword);
|
|
71
|
-
return { node, identifier, type:
|
|
70
|
+
return { node, identifier, type: SYMBOL_TYPE.TYPE, pos, fix };
|
|
72
71
|
}
|
|
73
72
|
if (ts.isInterfaceDeclaration(node)) {
|
|
74
73
|
const identifier = defaultKeyword ? 'default' : node.name.getText();
|
|
75
74
|
const pos = node.name.getStart();
|
|
76
75
|
const fix = getTypeFix(exportKeyword);
|
|
77
|
-
return { node, identifier, type:
|
|
76
|
+
return { node, identifier, type: SYMBOL_TYPE.INTERFACE, pos, fix };
|
|
78
77
|
}
|
|
79
78
|
if (ts.isEnumDeclaration(node)) {
|
|
80
79
|
const identifier = node.name.getText();
|
|
81
80
|
const pos = node.name.getStart();
|
|
82
81
|
const fix = getTypeFix(exportKeyword);
|
|
83
82
|
const members = node.members.map(member => getEnumMember(member, isFixExports));
|
|
84
|
-
return { node, identifier, type:
|
|
83
|
+
return { node, identifier, type: SYMBOL_TYPE.ENUM, pos, members, fix };
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { FIX_FLAGS } from '../../../constants.js';
|
|
3
|
-
import { SymbolType } from '../../../types/issues.js';
|
|
2
|
+
import { FIX_FLAGS, SYMBOL_TYPE } from '../../../constants.js';
|
|
4
3
|
import { isJS } from '../helpers.js';
|
|
5
4
|
import { exportVisitor as visit } from '../index.js';
|
|
6
5
|
export default visit(isJS, (node, { isFixExports }) => {
|
|
@@ -12,7 +11,7 @@ export default visit(isJS, (node, { isFixExports }) => {
|
|
|
12
11
|
return {
|
|
13
12
|
node: node.left.name,
|
|
14
13
|
identifier,
|
|
15
|
-
type:
|
|
14
|
+
type: SYMBOL_TYPE.UNKNOWN,
|
|
16
15
|
pos,
|
|
17
16
|
fix,
|
|
18
17
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { FIX_FLAGS } from '../../../constants.js';
|
|
3
|
-
import { SymbolType } from '../../../types/issues.js';
|
|
2
|
+
import { FIX_FLAGS, SYMBOL_TYPE } from '../../../constants.js';
|
|
4
3
|
import { hasRequireCall, isModuleExportsAccess, stripQuotes } from '../../ast-helpers.js';
|
|
5
4
|
import { isJS } from '../helpers.js';
|
|
6
5
|
import { exportVisitor as visit } from '../index.js';
|
|
@@ -16,7 +15,7 @@ export default visit(isJS, (node, { isFixExports }) => {
|
|
|
16
15
|
return {
|
|
17
16
|
node: node.expression.left.name,
|
|
18
17
|
identifier,
|
|
19
|
-
type:
|
|
18
|
+
type: SYMBOL_TYPE.UNKNOWN,
|
|
20
19
|
pos,
|
|
21
20
|
fix,
|
|
22
21
|
};
|
|
@@ -26,13 +25,13 @@ export default visit(isJS, (node, { isFixExports }) => {
|
|
|
26
25
|
if (ts.isObjectLiteralExpression(expr) && expr.properties.every(ts.isShorthandPropertyAssignment)) {
|
|
27
26
|
return expr.properties.map(node => {
|
|
28
27
|
const fix = isFixExports ? [node.getStart(), node.getEnd(), FIX_FLAGS.NONE] : undefined;
|
|
29
|
-
return { node, identifier: node.getText(), type:
|
|
28
|
+
return { node, identifier: node.getText(), type: SYMBOL_TYPE.UNKNOWN, pos: node.getStart(), fix };
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
if (ts.isCallExpression(node.expression.right) && hasRequireCall(node.expression.right)) {
|
|
33
32
|
return;
|
|
34
33
|
}
|
|
35
|
-
return { node, identifier: 'default', type:
|
|
34
|
+
return { node, identifier: 'default', type: SYMBOL_TYPE.UNKNOWN, pos: expr.pos + 1, fix: undefined };
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
else if (ts.isElementAccessExpression(node.expression.left) &&
|
|
@@ -45,7 +44,7 @@ export default visit(isJS, (node, { isFixExports }) => {
|
|
|
45
44
|
return {
|
|
46
45
|
node: node.expression.left.argumentExpression,
|
|
47
46
|
identifier,
|
|
48
|
-
type:
|
|
47
|
+
type: SYMBOL_TYPE.UNKNOWN,
|
|
49
48
|
pos,
|
|
50
49
|
fix,
|
|
51
50
|
};
|
|
@@ -34,7 +34,7 @@ declare class Performance {
|
|
|
34
34
|
getTimerifiedFunctionsTable(): string;
|
|
35
35
|
addMemoryMark(index: number): void;
|
|
36
36
|
getMemoryUsageTable(): string;
|
|
37
|
-
getCurrentDurationInMs(
|
|
37
|
+
getCurrentDurationInMs(): number;
|
|
38
38
|
getMemHeapUsage(): number;
|
|
39
39
|
getCurrentMemUsageInMb(): any;
|
|
40
40
|
finalize(): Promise<void>;
|
package/dist/util/Performance.js
CHANGED
|
@@ -133,8 +133,8 @@ class Performance {
|
|
|
133
133
|
}
|
|
134
134
|
return table.toString();
|
|
135
135
|
}
|
|
136
|
-
getCurrentDurationInMs(
|
|
137
|
-
return performance.now() -
|
|
136
|
+
getCurrentDurationInMs() {
|
|
137
|
+
return performance.now() - this.startTime;
|
|
138
138
|
}
|
|
139
139
|
getMemHeapUsage() {
|
|
140
140
|
return (memoryUsage().heapUsed ?? 0) - (this.memoryUsageStart?.heapUsed ?? 0);
|
|
@@ -133,6 +133,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
133
133
|
entry?: string | string[] | undefined;
|
|
134
134
|
project?: string | string[] | undefined;
|
|
135
135
|
} | undefined;
|
|
136
|
+
danger?: string | boolean | string[] | {
|
|
137
|
+
config?: string | string[] | undefined;
|
|
138
|
+
entry?: string | string[] | undefined;
|
|
139
|
+
project?: string | string[] | undefined;
|
|
140
|
+
} | undefined;
|
|
136
141
|
'dependency-cruiser'?: string | boolean | string[] | {
|
|
137
142
|
config?: string | string[] | undefined;
|
|
138
143
|
entry?: string | string[] | undefined;
|
|
@@ -704,6 +709,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
704
709
|
entry?: string | string[] | undefined;
|
|
705
710
|
project?: string | string[] | undefined;
|
|
706
711
|
} | undefined;
|
|
712
|
+
danger?: string | boolean | string[] | {
|
|
713
|
+
config?: string | string[] | undefined;
|
|
714
|
+
entry?: string | string[] | undefined;
|
|
715
|
+
project?: string | string[] | undefined;
|
|
716
|
+
} | undefined;
|
|
707
717
|
'dependency-cruiser'?: string | boolean | string[] | {
|
|
708
718
|
config?: string | string[] | undefined;
|
|
709
719
|
entry?: string | string[] | undefined;
|
|
@@ -1190,10 +1200,10 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1190
1200
|
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
1191
1201
|
includeEntryExports?: boolean | undefined;
|
|
1192
1202
|
}> | undefined;
|
|
1193
|
-
include?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "
|
|
1194
|
-
exclude?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "
|
|
1203
|
+
include?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates")[] | undefined;
|
|
1204
|
+
exclude?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates")[] | undefined;
|
|
1195
1205
|
$schema?: string | undefined;
|
|
1196
|
-
rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "
|
|
1206
|
+
rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates", "error" | "warn" | "off">> | undefined;
|
|
1197
1207
|
entry?: string | string[] | undefined;
|
|
1198
1208
|
project?: string | string[] | undefined;
|
|
1199
1209
|
paths?: Record<string, string[]> | undefined;
|
|
@@ -1203,14 +1213,8 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1203
1213
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
1204
1214
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
1205
1215
|
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
1206
|
-
ignoreExportsUsedInFile?: boolean |
|
|
1207
|
-
|
|
1208
|
-
enum?: boolean | undefined;
|
|
1209
|
-
function?: boolean | undefined;
|
|
1210
|
-
interface?: boolean | undefined;
|
|
1211
|
-
member?: boolean | undefined;
|
|
1212
|
-
type?: boolean | undefined;
|
|
1213
|
-
} | undefined;
|
|
1216
|
+
ignoreExportsUsedInFile?: boolean | Record<string, boolean | undefined> | undefined;
|
|
1217
|
+
ignoreIssues?: Record<string, ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates")[]> | undefined;
|
|
1214
1218
|
ignoreWorkspaces?: string[] | undefined;
|
|
1215
1219
|
includeEntryExports?: boolean | undefined;
|
|
1216
1220
|
compilers?: Record<string, true | ((filename: string, contents: string) => string) | ((filename: string, contents: string) => Promise<string>)> | undefined;
|
|
@@ -1228,12 +1232,12 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1228
1232
|
binaries: import("../types/issues.js").IssueSeverity;
|
|
1229
1233
|
unresolved: import("../types/issues.js").IssueSeverity;
|
|
1230
1234
|
exports: import("../types/issues.js").IssueSeverity;
|
|
1231
|
-
types: import("../types/issues.js").IssueSeverity;
|
|
1232
1235
|
nsExports: import("../types/issues.js").IssueSeverity;
|
|
1236
|
+
types: import("../types/issues.js").IssueSeverity;
|
|
1233
1237
|
nsTypes: import("../types/issues.js").IssueSeverity;
|
|
1234
|
-
duplicates: import("../types/issues.js").IssueSeverity;
|
|
1235
1238
|
enumMembers: import("../types/issues.js").IssueSeverity;
|
|
1236
1239
|
classMembers: import("../types/issues.js").IssueSeverity;
|
|
1240
|
+
duplicates: import("../types/issues.js").IssueSeverity;
|
|
1237
1241
|
_files: import("../types/issues.js").IssueSeverity;
|
|
1238
1242
|
};
|
|
1239
1243
|
tags: import("../types/options.js").Tags;
|
|
@@ -94,7 +94,7 @@ export const createOptions = async (options) => {
|
|
|
94
94
|
includedIssueTypes.binaries,
|
|
95
95
|
isReportTypes: includedIssueTypes.types || includedIssueTypes.nsTypes || includedIssueTypes.enumMembers,
|
|
96
96
|
isReportValues: includedIssueTypes.exports || includedIssueTypes.nsExports || isReportClassMembers,
|
|
97
|
-
isShowProgress: parsedCLIArgs['no-progress']
|
|
97
|
+
isShowProgress: parsedCLIArgs['no-progress'] !== true && process.stdout.isTTY && typeof process.stdout.cursorTo === 'function',
|
|
98
98
|
isSkipLibs: !(isIncludeLibs || includedIssueTypes.classMembers),
|
|
99
99
|
isStrict,
|
|
100
100
|
isTrace: Boolean(parsedCLIArgs.trace ?? parsedCLIArgs['trace-file'] ?? parsedCLIArgs['trace-export']),
|
package/dist/util/fs.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export declare const isFile: (filePath: string) => boolean;
|
|
|
3
3
|
export declare const findFile: (workingDir: string, fileName: string) => string | undefined;
|
|
4
4
|
export declare const loadFile: (filePath: string) => Promise<string>;
|
|
5
5
|
export declare const loadJSON: (filePath: string) => Promise<any>;
|
|
6
|
+
export declare const loadJSONC: (filePath: string) => Promise<any>;
|
|
6
7
|
export declare const loadYAML: (filePath: string) => Promise<unknown>;
|
|
7
8
|
export declare const loadTOML: (filePath: string) => Promise<import("smol-toml").TomlTable>;
|
|
8
|
-
export declare const
|
|
9
|
+
export declare const parseJSONC: (filePath: string, contents: string) => Promise<any>;
|
|
9
10
|
export declare const parseYAML: (contents: string) => unknown;
|
package/dist/util/fs.js
CHANGED
|
@@ -4,7 +4,7 @@ import yaml from 'js-yaml';
|
|
|
4
4
|
import { parse as parseTOML } from 'smol-toml';
|
|
5
5
|
import stripJsonComments from 'strip-json-comments';
|
|
6
6
|
import { LoaderError } from './errors.js';
|
|
7
|
-
import { join } from './path.js';
|
|
7
|
+
import { extname, join } from './path.js';
|
|
8
8
|
export const isDirectory = (filePath) => {
|
|
9
9
|
try {
|
|
10
10
|
return statSync(filePath).isDirectory();
|
|
@@ -36,7 +36,16 @@ export const loadFile = async (filePath) => {
|
|
|
36
36
|
};
|
|
37
37
|
export const loadJSON = async (filePath) => {
|
|
38
38
|
const contents = await loadFile(filePath);
|
|
39
|
-
|
|
39
|
+
try {
|
|
40
|
+
return JSON.parse(contents);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return parseJSONC(filePath, contents);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export const loadJSONC = async (filePath) => {
|
|
47
|
+
const contents = await loadFile(filePath);
|
|
48
|
+
return parseJSONC(filePath, contents);
|
|
40
49
|
};
|
|
41
50
|
export const loadYAML = async (filePath) => {
|
|
42
51
|
const contents = await loadFile(filePath);
|
|
@@ -46,12 +55,13 @@ export const loadTOML = async (filePath) => {
|
|
|
46
55
|
const contents = await loadFile(filePath);
|
|
47
56
|
return parseTOML(contents);
|
|
48
57
|
};
|
|
49
|
-
export const
|
|
58
|
+
export const parseJSONC = async (filePath, contents) => {
|
|
50
59
|
try {
|
|
51
60
|
return JSON.parse(stripJsonComments(contents, { trailingCommas: true, whitespace: false }));
|
|
52
61
|
}
|
|
53
62
|
catch (error) {
|
|
54
|
-
|
|
63
|
+
const message = `Error parsing ${filePath} ${extname(filePath) === '.json5' ? 'JSON5 features beyond comments and trailing commas are not fully supported. Consider converting to .jsonc format.' : ''}`;
|
|
64
|
+
throw new LoaderError(message, { cause: error });
|
|
55
65
|
}
|
|
56
66
|
};
|
|
57
67
|
export const parseYAML = (contents) => {
|
|
@@ -31,8 +31,5 @@ export const getIncludedIssueTypes = (options) => {
|
|
|
31
31
|
? _include
|
|
32
32
|
: [..._include, ...defaultIssueTypes]
|
|
33
33
|
: defaultIssueTypes).filter(group => !_exclude.includes(group));
|
|
34
|
-
return ISSUE_TYPES.
|
|
35
|
-
types[group] = included.includes(group);
|
|
36
|
-
return types;
|
|
37
|
-
}, {});
|
|
34
|
+
return Object.fromEntries(ISSUE_TYPES.map(group => [group, included.includes(group)]));
|
|
38
35
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConfigurationChief, Workspace } from '../ConfigurationChief.js';
|
|
2
2
|
import type { DependencyDeputy } from '../DependencyDeputy.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Issue } from '../types/issues.js';
|
|
4
4
|
import { type Input } from './input.js';
|
|
5
|
-
export declare const getReferencedInputsHandler: (
|
|
5
|
+
export declare const getReferencedInputsHandler: (deputy: DependencyDeputy, chief: ConfigurationChief, isGitIgnored: (s: string) => boolean, addIssue: (issue: Issue) => void) => (input: Input, workspace: Workspace) => string | undefined;
|
|
@@ -7,7 +7,7 @@ import { _resolveSync } from './resolve.js';
|
|
|
7
7
|
const getWorkspaceFor = (input, chief, workspace) => (input.dir && chief.findWorkspaceByFilePath(`${input.dir}/`)) ||
|
|
8
8
|
(input.containingFilePath && chief.findWorkspaceByFilePath(input.containingFilePath)) ||
|
|
9
9
|
workspace;
|
|
10
|
-
export const getReferencedInputsHandler = (
|
|
10
|
+
export const getReferencedInputsHandler = (deputy, chief, isGitIgnored, addIssue) => (input, workspace) => {
|
|
11
11
|
const { specifier, containingFilePath } = input;
|
|
12
12
|
if (!containingFilePath || IGNORED_RUNTIME_DEPENDENCIES.has(specifier))
|
|
13
13
|
return;
|
|
@@ -17,7 +17,7 @@ export const getReferencedInputsHandler = (collector, deputy, chief, isGitIgnore
|
|
|
17
17
|
const isHandled = deputy.maybeAddReferencedBinary(inputWorkspace, binaryName);
|
|
18
18
|
if (isHandled || input.optional)
|
|
19
19
|
return;
|
|
20
|
-
|
|
20
|
+
addIssue({
|
|
21
21
|
type: 'binaries',
|
|
22
22
|
filePath: containingFilePath,
|
|
23
23
|
workspace: workspace.name,
|
|
@@ -35,7 +35,7 @@ export const getReferencedInputsHandler = (collector, deputy, chief, isGitIgnore
|
|
|
35
35
|
if (isWorkspace || isDependency(input)) {
|
|
36
36
|
if (!isHandled) {
|
|
37
37
|
if (!input.optional && ((deputy.isProduction && input.production) || !deputy.isProduction)) {
|
|
38
|
-
|
|
38
|
+
addIssue({
|
|
39
39
|
type: 'unlisted',
|
|
40
40
|
filePath: containingFilePath,
|
|
41
41
|
workspace: inputWorkspace.name,
|
|
@@ -65,7 +65,7 @@ export const getReferencedInputsHandler = (collector, deputy, chief, isGitIgnore
|
|
|
65
65
|
if (input.optional)
|
|
66
66
|
return;
|
|
67
67
|
if (!isInternal(filePath)) {
|
|
68
|
-
|
|
68
|
+
addIssue({
|
|
69
69
|
type: 'unlisted',
|
|
70
70
|
filePath: containingFilePath,
|
|
71
71
|
workspace: workspace.name,
|
|
@@ -75,7 +75,7 @@ export const getReferencedInputsHandler = (collector, deputy, chief, isGitIgnore
|
|
|
75
75
|
}
|
|
76
76
|
else if (!isGitIgnored(filePath)) {
|
|
77
77
|
if (!isDeferResolveEntry(input) && !isConfig(input)) {
|
|
78
|
-
|
|
78
|
+
addIssue({
|
|
79
79
|
type: 'unresolved',
|
|
80
80
|
filePath: containingFilePath,
|
|
81
81
|
workspace: workspace.name,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ImportDetails, ModuleGraph } from '../types/module-graph.js';
|
|
2
2
|
export declare const hasStrictlyEnumReferences: (importsForExport: ImportDetails | undefined, id: string) => boolean;
|
|
3
3
|
export declare const hasStrictlyNsReferences: (graph: ModuleGraph, importsForExport: ImportDetails | undefined, id: string) => [boolean, string?];
|
|
4
|
-
export declare const getType: (hasOnlyNsReference: boolean, isType: boolean) => "exports" | "
|
|
4
|
+
export declare const getType: (hasOnlyNsReference: boolean, isType: boolean) => "exports" | "nsExports" | "types" | "nsTypes";
|