knip 0.0.0-angular.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/README.md +907 -0
- package/dist/ConfigurationChief.d.ts +53 -0
- package/dist/ConfigurationChief.js +297 -0
- package/dist/ConfigurationValidator.d.ts +2325 -0
- package/dist/ConfigurationValidator.js +119 -0
- package/dist/ConsoleStreamer.d.ts +12 -0
- package/dist/ConsoleStreamer.js +34 -0
- package/dist/DependencyDeputy.d.ts +64 -0
- package/dist/DependencyDeputy.js +254 -0
- package/dist/IssueCollector.d.ts +27 -0
- package/dist/IssueCollector.js +52 -0
- package/dist/PrincipalFactory.d.ts +25 -0
- package/dist/PrincipalFactory.js +56 -0
- package/dist/ProjectPrincipal.d.ts +64 -0
- package/dist/ProjectPrincipal.js +197 -0
- package/dist/WorkspaceWorker.d.ts +56 -0
- package/dist/WorkspaceWorker.js +244 -0
- package/dist/binaries/bash-parser.d.ts +6 -0
- package/dist/binaries/bash-parser.js +58 -0
- package/dist/binaries/index.d.ts +2 -0
- package/dist/binaries/index.js +18 -0
- package/dist/binaries/resolvers/c8.d.ts +2 -0
- package/dist/binaries/resolvers/c8.js +10 -0
- package/dist/binaries/resolvers/dotenv.d.ts +2 -0
- package/dist/binaries/resolvers/dotenv.js +6 -0
- package/dist/binaries/resolvers/fallback.d.ts +2 -0
- package/dist/binaries/resolvers/fallback.js +22 -0
- package/dist/binaries/resolvers/index.d.ts +8 -0
- package/dist/binaries/resolvers/index.js +8 -0
- package/dist/binaries/resolvers/node.d.ts +2 -0
- package/dist/binaries/resolvers/node.js +10 -0
- package/dist/binaries/resolvers/nodemon.d.ts +2 -0
- package/dist/binaries/resolvers/nodemon.js +15 -0
- package/dist/binaries/resolvers/npx.d.ts +2 -0
- package/dist/binaries/resolvers/npx.js +20 -0
- package/dist/binaries/resolvers/pnpm.d.ts +2 -0
- package/dist/binaries/resolvers/pnpm.js +63 -0
- package/dist/binaries/resolvers/rollup.d.ts +2 -0
- package/dist/binaries/resolvers/rollup.js +11 -0
- package/dist/binaries/resolvers/yarn.d.ts +2 -0
- package/dist/binaries/resolvers/yarn.js +48 -0
- package/dist/binaries/types.d.ts +15 -0
- package/dist/binaries/types.js +1 -0
- package/dist/binaries/util.d.ts +8 -0
- package/dist/binaries/util.js +33 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +72 -0
- package/dist/constants.d.ts +12 -0
- package/dist/constants.js +90 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +334 -0
- package/dist/issues/initializers.d.ts +4 -0
- package/dist/issues/initializers.js +11 -0
- package/dist/manifest/helpers.d.ts +7 -0
- package/dist/manifest/helpers.js +16 -0
- package/dist/manifest/index.d.ts +16 -0
- package/dist/manifest/index.js +56 -0
- package/dist/plugins/_template/index.d.ts +9 -0
- package/dist/plugins/_template/index.js +14 -0
- package/dist/plugins/_template/types.d.ts +3 -0
- package/dist/plugins/_template/types.js +1 -0
- package/dist/plugins/angular/index.d.ts +6 -0
- package/dist/plugins/angular/index.js +36 -0
- package/dist/plugins/angular/types.d.ts +745 -0
- package/dist/plugins/angular/types.js +1 -0
- package/dist/plugins/ava/index.d.ts +7 -0
- package/dist/plugins/ava/index.js +20 -0
- package/dist/plugins/ava/types.d.ts +4 -0
- package/dist/plugins/ava/types.js +1 -0
- package/dist/plugins/babel/helpers.d.ts +15 -0
- package/dist/plugins/babel/helpers.js +34 -0
- package/dist/plugins/babel/index.d.ts +8 -0
- package/dist/plugins/babel/index.js +30 -0
- package/dist/plugins/babel/types.d.ts +9 -0
- package/dist/plugins/babel/types.js +1 -0
- package/dist/plugins/capacitor/index.d.ts +6 -0
- package/dist/plugins/capacitor/index.js +11 -0
- package/dist/plugins/capacitor/types.d.ts +3 -0
- package/dist/plugins/capacitor/types.js +1 -0
- package/dist/plugins/changesets/index.d.ts +6 -0
- package/dist/plugins/changesets/index.js +15 -0
- package/dist/plugins/commitizen/index.d.ts +6 -0
- package/dist/plugins/commitizen/index.js +14 -0
- package/dist/plugins/commitizen/types.d.ts +3 -0
- package/dist/plugins/commitizen/types.js +1 -0
- package/dist/plugins/commitlint/index.d.ts +6 -0
- package/dist/plugins/commitlint/index.js +18 -0
- package/dist/plugins/cspell/index.d.ts +6 -0
- package/dist/plugins/cspell/index.js +17 -0
- package/dist/plugins/cspell/types.d.ts +3 -0
- package/dist/plugins/cspell/types.js +1 -0
- package/dist/plugins/cypress/index.d.ts +5 -0
- package/dist/plugins/cypress/index.js +10 -0
- package/dist/plugins/eslint/fallback.d.ts +1 -0
- package/dist/plugins/eslint/fallback.js +13 -0
- package/dist/plugins/eslint/helpers.d.ts +14 -0
- package/dist/plugins/eslint/helpers.js +83 -0
- package/dist/plugins/eslint/index.d.ts +7 -0
- package/dist/plugins/eslint/index.js +15 -0
- package/dist/plugins/eslint/types.d.ts +27 -0
- package/dist/plugins/eslint/types.js +1 -0
- package/dist/plugins/gatsby/index.d.ts +7 -0
- package/dist/plugins/gatsby/index.js +30 -0
- package/dist/plugins/gatsby/types.d.ts +15 -0
- package/dist/plugins/gatsby/types.js +1 -0
- package/dist/plugins/github-actions/index.d.ts +6 -0
- package/dist/plugins/github-actions/index.js +21 -0
- package/dist/plugins/husky/index.d.ts +6 -0
- package/dist/plugins/husky/index.js +19 -0
- package/dist/plugins/index.d.ts +41 -0
- package/dist/plugins/index.js +41 -0
- package/dist/plugins/jest/index.d.ts +7 -0
- package/dist/plugins/jest/index.js +68 -0
- package/dist/plugins/lefthook/index.d.ts +6 -0
- package/dist/plugins/lefthook/index.js +28 -0
- package/dist/plugins/lint-staged/index.d.ts +6 -0
- package/dist/plugins/lint-staged/index.js +32 -0
- package/dist/plugins/lint-staged/types.d.ts +5 -0
- package/dist/plugins/lint-staged/types.js +1 -0
- package/dist/plugins/markdownlint/helpers.d.ts +1 -0
- package/dist/plugins/markdownlint/helpers.js +6 -0
- package/dist/plugins/markdownlint/index.d.ts +6 -0
- package/dist/plugins/markdownlint/index.js +19 -0
- package/dist/plugins/markdownlint/types.d.ts +3 -0
- package/dist/plugins/markdownlint/types.js +1 -0
- package/dist/plugins/mocha/index.d.ts +6 -0
- package/dist/plugins/mocha/index.js +15 -0
- package/dist/plugins/next/index.d.ts +6 -0
- package/dist/plugins/next/index.js +11 -0
- package/dist/plugins/npm-package-json-lint/index.d.ts +6 -0
- package/dist/plugins/npm-package-json-lint/index.js +13 -0
- package/dist/plugins/npm-package-json-lint/types.d.ts +3 -0
- package/dist/plugins/npm-package-json-lint/types.js +1 -0
- package/dist/plugins/nx/index.d.ts +6 -0
- package/dist/plugins/nx/index.js +24 -0
- package/dist/plugins/nx/types.d.ts +11 -0
- package/dist/plugins/nx/types.js +1 -0
- package/dist/plugins/nyc/index.d.ts +6 -0
- package/dist/plugins/nyc/index.js +11 -0
- package/dist/plugins/playwright/index.d.ts +5 -0
- package/dist/plugins/playwright/index.js +5 -0
- package/dist/plugins/postcss/index.d.ts +6 -0
- package/dist/plugins/postcss/index.js +23 -0
- package/dist/plugins/postcss/types.d.ts +3 -0
- package/dist/plugins/postcss/types.js +1 -0
- package/dist/plugins/prettier/index.d.ts +6 -0
- package/dist/plugins/prettier/index.js +20 -0
- package/dist/plugins/release-it/index.d.ts +6 -0
- package/dist/plugins/release-it/index.js +30 -0
- package/dist/plugins/release-it/types.d.ts +10 -0
- package/dist/plugins/release-it/types.js +1 -0
- package/dist/plugins/remark/index.d.ts +6 -0
- package/dist/plugins/remark/index.js +18 -0
- package/dist/plugins/remix/index.d.ts +6 -0
- package/dist/plugins/remix/index.js +11 -0
- package/dist/plugins/rollup/index.d.ts +5 -0
- package/dist/plugins/rollup/index.js +5 -0
- package/dist/plugins/semantic-release/index.d.ts +6 -0
- package/dist/plugins/semantic-release/index.js +17 -0
- package/dist/plugins/semantic-release/types.d.ts +3 -0
- package/dist/plugins/semantic-release/types.js +1 -0
- package/dist/plugins/sentry/index.d.ts +5 -0
- package/dist/plugins/sentry/index.js +5 -0
- package/dist/plugins/storybook/index.d.ts +8 -0
- package/dist/plugins/storybook/index.js +19 -0
- package/dist/plugins/storybook/types.d.ts +11 -0
- package/dist/plugins/storybook/types.js +1 -0
- package/dist/plugins/stryker/index.d.ts +6 -0
- package/dist/plugins/stryker/index.js +17 -0
- package/dist/plugins/stryker/types.d.ts +5 -0
- package/dist/plugins/stryker/types.js +1 -0
- package/dist/plugins/stylelint/index.d.ts +6 -0
- package/dist/plugins/stylelint/index.js +22 -0
- package/dist/plugins/stylelint/types.d.ts +4 -0
- package/dist/plugins/stylelint/types.js +1 -0
- package/dist/plugins/svelte/index.d.ts +7 -0
- package/dist/plugins/svelte/index.js +9 -0
- package/dist/plugins/tailwind/index.d.ts +5 -0
- package/dist/plugins/tailwind/index.js +5 -0
- package/dist/plugins/typedoc/index.d.ts +6 -0
- package/dist/plugins/typedoc/index.js +22 -0
- package/dist/plugins/typedoc/types.d.ts +3 -0
- package/dist/plugins/typedoc/types.js +1 -0
- package/dist/plugins/typescript/index.d.ts +7 -0
- package/dist/plugins/typescript/index.js +42 -0
- package/dist/plugins/vite/index.d.ts +6 -0
- package/dist/plugins/vite/index.js +12 -0
- package/dist/plugins/vite/types.d.ts +4 -0
- package/dist/plugins/vite/types.js +1 -0
- package/dist/plugins/vitest/helpers.d.ts +6 -0
- package/dist/plugins/vitest/helpers.js +22 -0
- package/dist/plugins/vitest/index.d.ts +9 -0
- package/dist/plugins/vitest/index.js +25 -0
- package/dist/plugins/vitest/types.d.ts +11 -0
- package/dist/plugins/vitest/types.js +1 -0
- package/dist/plugins/webpack/index.d.ts +6 -0
- package/dist/plugins/webpack/index.js +82 -0
- package/dist/plugins/webpack/types.d.ts +10 -0
- package/dist/plugins/webpack/types.js +1 -0
- package/dist/reporters/codeowners.d.ts +3 -0
- package/dist/reporters/codeowners.js +62 -0
- package/dist/reporters/compact.d.ts +3 -0
- package/dist/reporters/compact.js +36 -0
- package/dist/reporters/index.d.ts +7 -0
- package/dist/reporters/index.js +10 -0
- package/dist/reporters/json.d.ts +3 -0
- package/dist/reporters/json.js +67 -0
- package/dist/reporters/symbols.d.ts +3 -0
- package/dist/reporters/symbols.js +54 -0
- package/dist/reporters/util.d.ts +15 -0
- package/dist/reporters/util.js +17 -0
- package/dist/types/cli.d.ts +10 -0
- package/dist/types/cli.js +1 -0
- package/dist/types/compilers.d.ts +6 -0
- package/dist/types/compilers.js +1 -0
- package/dist/types/config.d.ts +39 -0
- package/dist/types/config.js +3 -0
- package/dist/types/exports.d.ts +20 -0
- package/dist/types/exports.js +1 -0
- package/dist/types/imports.d.ts +13 -0
- package/dist/types/imports.js +1 -0
- package/dist/types/issues.d.ts +62 -0
- package/dist/types/issues.js +10 -0
- package/dist/types/plugins.d.ts +19 -0
- package/dist/types/plugins.js +1 -0
- package/dist/types/workspace.d.ts +17 -0
- package/dist/types/workspace.js +1 -0
- package/dist/typescript/SourceFile.d.ts +18 -0
- package/dist/typescript/SourceFile.js +1 -0
- package/dist/typescript/SourceFileManager.d.ts +13 -0
- package/dist/typescript/SourceFileManager.js +57 -0
- package/dist/typescript/ast-helpers.d.ts +27 -0
- package/dist/typescript/ast-helpers.js +101 -0
- package/dist/typescript/createHosts.d.ts +15 -0
- package/dist/typescript/createHosts.js +39 -0
- package/dist/typescript/getImportsAndExports.d.ts +29 -0
- package/dist/typescript/getImportsAndExports.js +159 -0
- package/dist/typescript/resolveModuleNames.d.ts +2 -0
- package/dist/typescript/resolveModuleNames.js +27 -0
- package/dist/typescript/sys.d.ts +35 -0
- package/dist/typescript/sys.js +16 -0
- package/dist/typescript/utils.d.ts +2 -0
- package/dist/typescript/utils.js +9 -0
- package/dist/typescript/visitors/exports/exportAssignment.d.ts +3 -0
- package/dist/typescript/visitors/exports/exportAssignment.js +9 -0
- package/dist/typescript/visitors/exports/exportDeclaration.d.ts +3 -0
- package/dist/typescript/visitors/exports/exportDeclaration.js +13 -0
- package/dist/typescript/visitors/exports/exportKeyword.d.ts +3 -0
- package/dist/typescript/visitors/exports/exportKeyword.js +77 -0
- package/dist/typescript/visitors/exports/index.d.ts +3 -0
- package/dist/typescript/visitors/exports/index.js +7 -0
- package/dist/typescript/visitors/exports/moduleExportsAccessExpression.d.ts +3 -0
- package/dist/typescript/visitors/exports/moduleExportsAccessExpression.js +31 -0
- package/dist/typescript/visitors/helpers.d.ts +4 -0
- package/dist/typescript/visitors/helpers.js +10 -0
- package/dist/typescript/visitors/imports/importCall.d.ts +3 -0
- package/dist/typescript/visitors/imports/importCall.js +11 -0
- package/dist/typescript/visitors/imports/importDeclaration.d.ts +3 -0
- package/dist/typescript/visitors/imports/importDeclaration.js +32 -0
- package/dist/typescript/visitors/imports/importEqualsDeclaration.d.ts +3 -0
- package/dist/typescript/visitors/imports/importEqualsDeclaration.js +11 -0
- package/dist/typescript/visitors/imports/index.d.ts +3 -0
- package/dist/typescript/visitors/imports/index.js +18 -0
- package/dist/typescript/visitors/imports/jsDocType.d.ts +3 -0
- package/dist/typescript/visitors/imports/jsDocType.js +11 -0
- package/dist/typescript/visitors/imports/reExportDeclaration.d.ts +3 -0
- package/dist/typescript/visitors/imports/reExportDeclaration.js +21 -0
- package/dist/typescript/visitors/imports/requireCall.d.ts +3 -0
- package/dist/typescript/visitors/imports/requireCall.js +45 -0
- package/dist/typescript/visitors/imports/requireResolveCall.d.ts +3 -0
- package/dist/typescript/visitors/imports/requireResolveCall.js +12 -0
- package/dist/typescript/visitors/index.d.ts +10 -0
- package/dist/typescript/visitors/index.js +16 -0
- package/dist/typescript/visitors/scripts/execa.d.ts +3 -0
- package/dist/typescript/visitors/scripts/execa.js +18 -0
- package/dist/typescript/visitors/scripts/index.d.ts +3 -0
- package/dist/typescript/visitors/scripts/index.js +5 -0
- package/dist/typescript/visitors/scripts/zx.d.ts +3 -0
- package/dist/typescript/visitors/scripts/zx.js +8 -0
- package/dist/util/Performance.d.ts +23 -0
- package/dist/util/Performance.js +80 -0
- package/dist/util/array.d.ts +2 -0
- package/dist/util/array.js +2 -0
- package/dist/util/cli-arguments.d.ts +28 -0
- package/dist/util/cli-arguments.js +83 -0
- package/dist/util/compilers.d.ts +426 -0
- package/dist/util/compilers.js +20 -0
- package/dist/util/debug.d.ts +3 -0
- package/dist/util/debug.js +34 -0
- package/dist/util/errors.d.ts +12 -0
- package/dist/util/errors.js +14 -0
- package/dist/util/fs.d.ts +7 -0
- package/dist/util/fs.js +42 -0
- package/dist/util/get-included-issue-types.d.ts +16 -0
- package/dist/util/get-included-issue-types.js +37 -0
- package/dist/util/git.d.ts +1 -0
- package/dist/util/git.js +20 -0
- package/dist/util/glob.d.ts +19 -0
- package/dist/util/glob.js +59 -0
- package/dist/util/loader.d.ts +1 -0
- package/dist/util/loader.js +31 -0
- package/dist/util/map.d.ts +1 -0
- package/dist/util/map.js +6 -0
- package/dist/util/modules.d.ts +8 -0
- package/dist/util/modules.js +52 -0
- package/dist/util/object.d.ts +3 -0
- package/dist/util/object.js +37 -0
- package/dist/util/path.d.ts +11 -0
- package/dist/util/path.js +13 -0
- package/dist/util/plugin.d.ts +3 -0
- package/dist/util/plugin.js +14 -0
- package/dist/util/register.d.ts +1 -0
- package/dist/util/register.js +14 -0
- package/dist/util/reporter.d.ts +3 -0
- package/dist/util/reporter.js +16 -0
- package/dist/util/require.d.ts +5 -0
- package/dist/util/require.js +34 -0
- package/dist/util/tsconfig-loader.d.ts +2 -0
- package/dist/util/tsconfig-loader.js +11 -0
- package/dist/util/workspace.d.ts +1 -0
- package/dist/util/workspace.js +11 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/license +12 -0
- package/package.json +150 -0
- package/schema.json +403 -0
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import type { AsyncCompilerFn, SyncCompilerFn } from '../types/compilers.js';
|
|
2
|
+
import type { RawConfiguration } from '../types/config.js';
|
|
3
|
+
export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
4
|
+
syncCompilers: Record<string, SyncCompilerFn>;
|
|
5
|
+
asyncCompilers: Record<string, AsyncCompilerFn>;
|
|
6
|
+
exclude?: string[] | undefined;
|
|
7
|
+
rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
|
|
8
|
+
entry?: string | string[] | undefined;
|
|
9
|
+
project?: string | string[] | undefined;
|
|
10
|
+
paths?: Record<string, string[]> | undefined;
|
|
11
|
+
ignore?: string | string[] | undefined;
|
|
12
|
+
ignoreBinaries?: string[] | undefined;
|
|
13
|
+
ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "enum" | "class" | "interface" | "member", boolean>> | undefined;
|
|
14
|
+
ignoreDependencies?: string[] | undefined;
|
|
15
|
+
ignoreWorkspaces?: string[] | undefined;
|
|
16
|
+
compilers?: Record<string, ((args_0: string, ...args_1: unknown[]) => string) | ((args_0: string, ...args_1: unknown[]) => Promise<string>)> | undefined;
|
|
17
|
+
include?: string[] | undefined;
|
|
18
|
+
workspaces?: Record<string, {
|
|
19
|
+
entry?: string | string[] | undefined;
|
|
20
|
+
project?: string | string[] | undefined;
|
|
21
|
+
paths?: Record<string, string[]> | undefined;
|
|
22
|
+
ignore?: string | string[] | undefined;
|
|
23
|
+
ignoreBinaries?: string[] | undefined;
|
|
24
|
+
ignoreDependencies?: string[] | undefined;
|
|
25
|
+
angular?: string | false | string[] | {
|
|
26
|
+
config?: string | string[] | undefined;
|
|
27
|
+
entry?: string | string[] | undefined;
|
|
28
|
+
project?: string | string[] | undefined;
|
|
29
|
+
} | undefined;
|
|
30
|
+
ava?: string | false | string[] | {
|
|
31
|
+
config?: string | string[] | undefined;
|
|
32
|
+
entry?: string | string[] | undefined;
|
|
33
|
+
project?: string | string[] | undefined;
|
|
34
|
+
} | undefined;
|
|
35
|
+
babel?: string | false | string[] | {
|
|
36
|
+
config?: string | string[] | undefined;
|
|
37
|
+
entry?: string | string[] | undefined;
|
|
38
|
+
project?: string | string[] | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
capacitor?: string | false | string[] | {
|
|
41
|
+
config?: string | string[] | undefined;
|
|
42
|
+
entry?: string | string[] | undefined;
|
|
43
|
+
project?: string | string[] | undefined;
|
|
44
|
+
} | undefined;
|
|
45
|
+
changesets?: string | false | string[] | {
|
|
46
|
+
config?: string | string[] | undefined;
|
|
47
|
+
entry?: string | string[] | undefined;
|
|
48
|
+
project?: string | string[] | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
commitizen?: string | false | string[] | {
|
|
51
|
+
config?: string | string[] | undefined;
|
|
52
|
+
entry?: string | string[] | undefined;
|
|
53
|
+
project?: string | string[] | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
commitlint?: string | false | string[] | {
|
|
56
|
+
config?: string | string[] | undefined;
|
|
57
|
+
entry?: string | string[] | undefined;
|
|
58
|
+
project?: string | string[] | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
cspell?: string | false | string[] | {
|
|
61
|
+
config?: string | string[] | undefined;
|
|
62
|
+
entry?: string | string[] | undefined;
|
|
63
|
+
project?: string | string[] | undefined;
|
|
64
|
+
} | undefined;
|
|
65
|
+
cypress?: string | false | string[] | {
|
|
66
|
+
config?: string | string[] | undefined;
|
|
67
|
+
entry?: string | string[] | undefined;
|
|
68
|
+
project?: string | string[] | undefined;
|
|
69
|
+
} | undefined;
|
|
70
|
+
eslint?: string | false | string[] | {
|
|
71
|
+
config?: string | string[] | undefined;
|
|
72
|
+
entry?: string | string[] | undefined;
|
|
73
|
+
project?: string | string[] | undefined;
|
|
74
|
+
} | undefined;
|
|
75
|
+
gatsby?: string | false | string[] | {
|
|
76
|
+
config?: string | string[] | undefined;
|
|
77
|
+
entry?: string | string[] | undefined;
|
|
78
|
+
project?: string | string[] | undefined;
|
|
79
|
+
} | undefined;
|
|
80
|
+
'github-actions'?: string | false | string[] | {
|
|
81
|
+
config?: string | string[] | undefined;
|
|
82
|
+
entry?: string | string[] | undefined;
|
|
83
|
+
project?: string | string[] | undefined;
|
|
84
|
+
} | undefined;
|
|
85
|
+
husky?: string | false | string[] | {
|
|
86
|
+
config?: string | string[] | undefined;
|
|
87
|
+
entry?: string | string[] | undefined;
|
|
88
|
+
project?: string | string[] | undefined;
|
|
89
|
+
} | undefined;
|
|
90
|
+
jest?: string | false | string[] | {
|
|
91
|
+
config?: string | string[] | undefined;
|
|
92
|
+
entry?: string | string[] | undefined;
|
|
93
|
+
project?: string | string[] | undefined;
|
|
94
|
+
} | undefined;
|
|
95
|
+
lefthook?: string | false | string[] | {
|
|
96
|
+
config?: string | string[] | undefined;
|
|
97
|
+
entry?: string | string[] | undefined;
|
|
98
|
+
project?: string | string[] | undefined;
|
|
99
|
+
} | undefined;
|
|
100
|
+
'lint-staged'?: string | false | string[] | {
|
|
101
|
+
config?: string | string[] | undefined;
|
|
102
|
+
entry?: string | string[] | undefined;
|
|
103
|
+
project?: string | string[] | undefined;
|
|
104
|
+
} | undefined;
|
|
105
|
+
markdownlint?: string | false | string[] | {
|
|
106
|
+
config?: string | string[] | undefined;
|
|
107
|
+
entry?: string | string[] | undefined;
|
|
108
|
+
project?: string | string[] | undefined;
|
|
109
|
+
} | undefined;
|
|
110
|
+
mocha?: string | false | string[] | {
|
|
111
|
+
config?: string | string[] | undefined;
|
|
112
|
+
entry?: string | string[] | undefined;
|
|
113
|
+
project?: string | string[] | undefined;
|
|
114
|
+
} | undefined;
|
|
115
|
+
next?: string | false | string[] | {
|
|
116
|
+
config?: string | string[] | undefined;
|
|
117
|
+
entry?: string | string[] | undefined;
|
|
118
|
+
project?: string | string[] | undefined;
|
|
119
|
+
} | undefined;
|
|
120
|
+
'npm-package-json-lint'?: string | false | string[] | {
|
|
121
|
+
config?: string | string[] | undefined;
|
|
122
|
+
entry?: string | string[] | undefined;
|
|
123
|
+
project?: string | string[] | undefined;
|
|
124
|
+
} | undefined;
|
|
125
|
+
nx?: string | false | string[] | {
|
|
126
|
+
config?: string | string[] | undefined;
|
|
127
|
+
entry?: string | string[] | undefined;
|
|
128
|
+
project?: string | string[] | undefined;
|
|
129
|
+
} | undefined;
|
|
130
|
+
nyc?: string | false | string[] | {
|
|
131
|
+
config?: string | string[] | undefined;
|
|
132
|
+
entry?: string | string[] | undefined;
|
|
133
|
+
project?: string | string[] | undefined;
|
|
134
|
+
} | undefined;
|
|
135
|
+
playwright?: string | false | string[] | {
|
|
136
|
+
config?: string | string[] | undefined;
|
|
137
|
+
entry?: string | string[] | undefined;
|
|
138
|
+
project?: string | string[] | undefined;
|
|
139
|
+
} | undefined;
|
|
140
|
+
postcss?: string | false | string[] | {
|
|
141
|
+
config?: string | string[] | undefined;
|
|
142
|
+
entry?: string | string[] | undefined;
|
|
143
|
+
project?: string | string[] | undefined;
|
|
144
|
+
} | undefined;
|
|
145
|
+
prettier?: string | false | string[] | {
|
|
146
|
+
config?: string | string[] | undefined;
|
|
147
|
+
entry?: string | string[] | undefined;
|
|
148
|
+
project?: string | string[] | undefined;
|
|
149
|
+
} | undefined;
|
|
150
|
+
'release-it'?: string | false | string[] | {
|
|
151
|
+
config?: string | string[] | undefined;
|
|
152
|
+
entry?: string | string[] | undefined;
|
|
153
|
+
project?: string | string[] | undefined;
|
|
154
|
+
} | undefined;
|
|
155
|
+
remark?: string | false | string[] | {
|
|
156
|
+
config?: string | string[] | undefined;
|
|
157
|
+
entry?: string | string[] | undefined;
|
|
158
|
+
project?: string | string[] | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
remix?: string | false | string[] | {
|
|
161
|
+
config?: string | string[] | undefined;
|
|
162
|
+
entry?: string | string[] | undefined;
|
|
163
|
+
project?: string | string[] | undefined;
|
|
164
|
+
} | undefined;
|
|
165
|
+
rollup?: string | false | string[] | {
|
|
166
|
+
config?: string | string[] | undefined;
|
|
167
|
+
entry?: string | string[] | undefined;
|
|
168
|
+
project?: string | string[] | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
'semantic-release'?: string | false | string[] | {
|
|
171
|
+
config?: string | string[] | undefined;
|
|
172
|
+
entry?: string | string[] | undefined;
|
|
173
|
+
project?: string | string[] | undefined;
|
|
174
|
+
} | undefined;
|
|
175
|
+
sentry?: string | false | string[] | {
|
|
176
|
+
config?: string | string[] | undefined;
|
|
177
|
+
entry?: string | string[] | undefined;
|
|
178
|
+
project?: string | string[] | undefined;
|
|
179
|
+
} | undefined;
|
|
180
|
+
storybook?: string | false | string[] | {
|
|
181
|
+
config?: string | string[] | undefined;
|
|
182
|
+
entry?: string | string[] | undefined;
|
|
183
|
+
project?: string | string[] | undefined;
|
|
184
|
+
} | undefined;
|
|
185
|
+
stryker?: string | false | string[] | {
|
|
186
|
+
config?: string | string[] | undefined;
|
|
187
|
+
entry?: string | string[] | undefined;
|
|
188
|
+
project?: string | string[] | undefined;
|
|
189
|
+
} | undefined;
|
|
190
|
+
stylelint?: string | false | string[] | {
|
|
191
|
+
config?: string | string[] | undefined;
|
|
192
|
+
entry?: string | string[] | undefined;
|
|
193
|
+
project?: string | string[] | undefined;
|
|
194
|
+
} | undefined;
|
|
195
|
+
tailwind?: string | false | string[] | {
|
|
196
|
+
config?: string | string[] | undefined;
|
|
197
|
+
entry?: string | string[] | undefined;
|
|
198
|
+
project?: string | string[] | undefined;
|
|
199
|
+
} | undefined;
|
|
200
|
+
typedoc?: string | false | string[] | {
|
|
201
|
+
config?: string | string[] | undefined;
|
|
202
|
+
entry?: string | string[] | undefined;
|
|
203
|
+
project?: string | string[] | undefined;
|
|
204
|
+
} | undefined;
|
|
205
|
+
typescript?: string | false | string[] | {
|
|
206
|
+
config?: string | string[] | undefined;
|
|
207
|
+
entry?: string | string[] | undefined;
|
|
208
|
+
project?: string | string[] | undefined;
|
|
209
|
+
} | undefined;
|
|
210
|
+
vite?: string | false | string[] | {
|
|
211
|
+
config?: string | string[] | undefined;
|
|
212
|
+
entry?: string | string[] | undefined;
|
|
213
|
+
project?: string | string[] | undefined;
|
|
214
|
+
} | undefined;
|
|
215
|
+
vitest?: string | false | string[] | {
|
|
216
|
+
config?: string | string[] | undefined;
|
|
217
|
+
entry?: string | string[] | undefined;
|
|
218
|
+
project?: string | string[] | undefined;
|
|
219
|
+
} | undefined;
|
|
220
|
+
webpack?: string | false | string[] | {
|
|
221
|
+
config?: string | string[] | undefined;
|
|
222
|
+
entry?: string | string[] | undefined;
|
|
223
|
+
project?: string | string[] | undefined;
|
|
224
|
+
} | undefined;
|
|
225
|
+
}> | undefined;
|
|
226
|
+
angular?: string | false | string[] | {
|
|
227
|
+
config?: string | string[] | undefined;
|
|
228
|
+
entry?: string | string[] | undefined;
|
|
229
|
+
project?: string | string[] | undefined;
|
|
230
|
+
} | undefined;
|
|
231
|
+
ava?: string | false | string[] | {
|
|
232
|
+
config?: string | string[] | undefined;
|
|
233
|
+
entry?: string | string[] | undefined;
|
|
234
|
+
project?: string | string[] | undefined;
|
|
235
|
+
} | undefined;
|
|
236
|
+
babel?: string | false | string[] | {
|
|
237
|
+
config?: string | string[] | undefined;
|
|
238
|
+
entry?: string | string[] | undefined;
|
|
239
|
+
project?: string | string[] | undefined;
|
|
240
|
+
} | undefined;
|
|
241
|
+
capacitor?: string | false | string[] | {
|
|
242
|
+
config?: string | string[] | undefined;
|
|
243
|
+
entry?: string | string[] | undefined;
|
|
244
|
+
project?: string | string[] | undefined;
|
|
245
|
+
} | undefined;
|
|
246
|
+
changesets?: string | false | string[] | {
|
|
247
|
+
config?: string | string[] | undefined;
|
|
248
|
+
entry?: string | string[] | undefined;
|
|
249
|
+
project?: string | string[] | undefined;
|
|
250
|
+
} | undefined;
|
|
251
|
+
commitizen?: string | false | string[] | {
|
|
252
|
+
config?: string | string[] | undefined;
|
|
253
|
+
entry?: string | string[] | undefined;
|
|
254
|
+
project?: string | string[] | undefined;
|
|
255
|
+
} | undefined;
|
|
256
|
+
commitlint?: string | false | string[] | {
|
|
257
|
+
config?: string | string[] | undefined;
|
|
258
|
+
entry?: string | string[] | undefined;
|
|
259
|
+
project?: string | string[] | undefined;
|
|
260
|
+
} | undefined;
|
|
261
|
+
cspell?: string | false | string[] | {
|
|
262
|
+
config?: string | string[] | undefined;
|
|
263
|
+
entry?: string | string[] | undefined;
|
|
264
|
+
project?: string | string[] | undefined;
|
|
265
|
+
} | undefined;
|
|
266
|
+
cypress?: string | false | string[] | {
|
|
267
|
+
config?: string | string[] | undefined;
|
|
268
|
+
entry?: string | string[] | undefined;
|
|
269
|
+
project?: string | string[] | undefined;
|
|
270
|
+
} | undefined;
|
|
271
|
+
eslint?: string | false | string[] | {
|
|
272
|
+
config?: string | string[] | undefined;
|
|
273
|
+
entry?: string | string[] | undefined;
|
|
274
|
+
project?: string | string[] | undefined;
|
|
275
|
+
} | undefined;
|
|
276
|
+
gatsby?: string | false | string[] | {
|
|
277
|
+
config?: string | string[] | undefined;
|
|
278
|
+
entry?: string | string[] | undefined;
|
|
279
|
+
project?: string | string[] | undefined;
|
|
280
|
+
} | undefined;
|
|
281
|
+
'github-actions'?: string | false | string[] | {
|
|
282
|
+
config?: string | string[] | undefined;
|
|
283
|
+
entry?: string | string[] | undefined;
|
|
284
|
+
project?: string | string[] | undefined;
|
|
285
|
+
} | undefined;
|
|
286
|
+
husky?: string | false | string[] | {
|
|
287
|
+
config?: string | string[] | undefined;
|
|
288
|
+
entry?: string | string[] | undefined;
|
|
289
|
+
project?: string | string[] | undefined;
|
|
290
|
+
} | undefined;
|
|
291
|
+
jest?: string | false | string[] | {
|
|
292
|
+
config?: string | string[] | undefined;
|
|
293
|
+
entry?: string | string[] | undefined;
|
|
294
|
+
project?: string | string[] | undefined;
|
|
295
|
+
} | undefined;
|
|
296
|
+
lefthook?: string | false | string[] | {
|
|
297
|
+
config?: string | string[] | undefined;
|
|
298
|
+
entry?: string | string[] | undefined;
|
|
299
|
+
project?: string | string[] | undefined;
|
|
300
|
+
} | undefined;
|
|
301
|
+
'lint-staged'?: string | false | string[] | {
|
|
302
|
+
config?: string | string[] | undefined;
|
|
303
|
+
entry?: string | string[] | undefined;
|
|
304
|
+
project?: string | string[] | undefined;
|
|
305
|
+
} | undefined;
|
|
306
|
+
markdownlint?: string | false | string[] | {
|
|
307
|
+
config?: string | string[] | undefined;
|
|
308
|
+
entry?: string | string[] | undefined;
|
|
309
|
+
project?: string | string[] | undefined;
|
|
310
|
+
} | undefined;
|
|
311
|
+
mocha?: string | false | string[] | {
|
|
312
|
+
config?: string | string[] | undefined;
|
|
313
|
+
entry?: string | string[] | undefined;
|
|
314
|
+
project?: string | string[] | undefined;
|
|
315
|
+
} | undefined;
|
|
316
|
+
next?: string | false | string[] | {
|
|
317
|
+
config?: string | string[] | undefined;
|
|
318
|
+
entry?: string | string[] | undefined;
|
|
319
|
+
project?: string | string[] | undefined;
|
|
320
|
+
} | undefined;
|
|
321
|
+
'npm-package-json-lint'?: string | false | string[] | {
|
|
322
|
+
config?: string | string[] | undefined;
|
|
323
|
+
entry?: string | string[] | undefined;
|
|
324
|
+
project?: string | string[] | undefined;
|
|
325
|
+
} | undefined;
|
|
326
|
+
nx?: string | false | string[] | {
|
|
327
|
+
config?: string | string[] | undefined;
|
|
328
|
+
entry?: string | string[] | undefined;
|
|
329
|
+
project?: string | string[] | undefined;
|
|
330
|
+
} | undefined;
|
|
331
|
+
nyc?: string | false | string[] | {
|
|
332
|
+
config?: string | string[] | undefined;
|
|
333
|
+
entry?: string | string[] | undefined;
|
|
334
|
+
project?: string | string[] | undefined;
|
|
335
|
+
} | undefined;
|
|
336
|
+
playwright?: string | false | string[] | {
|
|
337
|
+
config?: string | string[] | undefined;
|
|
338
|
+
entry?: string | string[] | undefined;
|
|
339
|
+
project?: string | string[] | undefined;
|
|
340
|
+
} | undefined;
|
|
341
|
+
postcss?: string | false | string[] | {
|
|
342
|
+
config?: string | string[] | undefined;
|
|
343
|
+
entry?: string | string[] | undefined;
|
|
344
|
+
project?: string | string[] | undefined;
|
|
345
|
+
} | undefined;
|
|
346
|
+
prettier?: string | false | string[] | {
|
|
347
|
+
config?: string | string[] | undefined;
|
|
348
|
+
entry?: string | string[] | undefined;
|
|
349
|
+
project?: string | string[] | undefined;
|
|
350
|
+
} | undefined;
|
|
351
|
+
'release-it'?: string | false | string[] | {
|
|
352
|
+
config?: string | string[] | undefined;
|
|
353
|
+
entry?: string | string[] | undefined;
|
|
354
|
+
project?: string | string[] | undefined;
|
|
355
|
+
} | undefined;
|
|
356
|
+
remark?: string | false | string[] | {
|
|
357
|
+
config?: string | string[] | undefined;
|
|
358
|
+
entry?: string | string[] | undefined;
|
|
359
|
+
project?: string | string[] | undefined;
|
|
360
|
+
} | undefined;
|
|
361
|
+
remix?: string | false | string[] | {
|
|
362
|
+
config?: string | string[] | undefined;
|
|
363
|
+
entry?: string | string[] | undefined;
|
|
364
|
+
project?: string | string[] | undefined;
|
|
365
|
+
} | undefined;
|
|
366
|
+
rollup?: string | false | string[] | {
|
|
367
|
+
config?: string | string[] | undefined;
|
|
368
|
+
entry?: string | string[] | undefined;
|
|
369
|
+
project?: string | string[] | undefined;
|
|
370
|
+
} | undefined;
|
|
371
|
+
'semantic-release'?: string | false | string[] | {
|
|
372
|
+
config?: string | string[] | undefined;
|
|
373
|
+
entry?: string | string[] | undefined;
|
|
374
|
+
project?: string | string[] | undefined;
|
|
375
|
+
} | undefined;
|
|
376
|
+
sentry?: string | false | string[] | {
|
|
377
|
+
config?: string | string[] | undefined;
|
|
378
|
+
entry?: string | string[] | undefined;
|
|
379
|
+
project?: string | string[] | undefined;
|
|
380
|
+
} | undefined;
|
|
381
|
+
storybook?: string | false | string[] | {
|
|
382
|
+
config?: string | string[] | undefined;
|
|
383
|
+
entry?: string | string[] | undefined;
|
|
384
|
+
project?: string | string[] | undefined;
|
|
385
|
+
} | undefined;
|
|
386
|
+
stryker?: string | false | string[] | {
|
|
387
|
+
config?: string | string[] | undefined;
|
|
388
|
+
entry?: string | string[] | undefined;
|
|
389
|
+
project?: string | string[] | undefined;
|
|
390
|
+
} | undefined;
|
|
391
|
+
stylelint?: string | false | string[] | {
|
|
392
|
+
config?: string | string[] | undefined;
|
|
393
|
+
entry?: string | string[] | undefined;
|
|
394
|
+
project?: string | string[] | undefined;
|
|
395
|
+
} | undefined;
|
|
396
|
+
tailwind?: string | false | string[] | {
|
|
397
|
+
config?: string | string[] | undefined;
|
|
398
|
+
entry?: string | string[] | undefined;
|
|
399
|
+
project?: string | string[] | undefined;
|
|
400
|
+
} | undefined;
|
|
401
|
+
typedoc?: string | false | string[] | {
|
|
402
|
+
config?: string | string[] | undefined;
|
|
403
|
+
entry?: string | string[] | undefined;
|
|
404
|
+
project?: string | string[] | undefined;
|
|
405
|
+
} | undefined;
|
|
406
|
+
typescript?: string | false | string[] | {
|
|
407
|
+
config?: string | string[] | undefined;
|
|
408
|
+
entry?: string | string[] | undefined;
|
|
409
|
+
project?: string | string[] | undefined;
|
|
410
|
+
} | undefined;
|
|
411
|
+
vite?: string | false | string[] | {
|
|
412
|
+
config?: string | string[] | undefined;
|
|
413
|
+
entry?: string | string[] | undefined;
|
|
414
|
+
project?: string | string[] | undefined;
|
|
415
|
+
} | undefined;
|
|
416
|
+
vitest?: string | false | string[] | {
|
|
417
|
+
config?: string | string[] | undefined;
|
|
418
|
+
entry?: string | string[] | undefined;
|
|
419
|
+
project?: string | string[] | undefined;
|
|
420
|
+
} | undefined;
|
|
421
|
+
webpack?: string | false | string[] | {
|
|
422
|
+
config?: string | string[] | undefined;
|
|
423
|
+
entry?: string | string[] | undefined;
|
|
424
|
+
project?: string | string[] | undefined;
|
|
425
|
+
} | undefined;
|
|
426
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const isAsync = (fn) => (fn ? fn.constructor.name === 'AsyncFunction' : false);
|
|
2
|
+
const normalizeExt = (ext) => ext.replace(/^\.*/, '.');
|
|
3
|
+
export const partitionCompilers = (rawLocalConfig) => {
|
|
4
|
+
const syncCompilers = {};
|
|
5
|
+
const asyncCompilers = {};
|
|
6
|
+
for (const extension in rawLocalConfig.compilers) {
|
|
7
|
+
const ext = normalizeExt(extension);
|
|
8
|
+
if (!rawLocalConfig.asyncCompilers?.[ext] && isAsync(rawLocalConfig.compilers[extension])) {
|
|
9
|
+
asyncCompilers[ext] = rawLocalConfig.compilers[extension];
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
syncCompilers[ext] = rawLocalConfig.compilers[extension];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
for (const extension in rawLocalConfig.asyncCompilers) {
|
|
16
|
+
const ext = normalizeExt(extension);
|
|
17
|
+
asyncCompilers[ext] = rawLocalConfig.asyncCompilers[extension];
|
|
18
|
+
}
|
|
19
|
+
return { ...rawLocalConfig, syncCompilers, asyncCompilers };
|
|
20
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import util from 'node:util';
|
|
2
|
+
import parsedArgValues from './cli-arguments.js';
|
|
3
|
+
const { debug, 'debug-file-filter': debugFileFilter } = parsedArgValues;
|
|
4
|
+
const IS_ENABLED = debug ?? false;
|
|
5
|
+
const FILE_FILTER = debugFileFilter;
|
|
6
|
+
const inspectOptions = { maxArrayLength: null, depth: null, colors: true };
|
|
7
|
+
const logArray = (collection) => {
|
|
8
|
+
if (FILE_FILTER) {
|
|
9
|
+
const fileFilter = new RegExp(FILE_FILTER);
|
|
10
|
+
const files = collection.filter(filePath => fileFilter.test(filePath));
|
|
11
|
+
console.log(util.inspect(files.sort(), inspectOptions));
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
console.log(util.inspect(collection.sort(), inspectOptions));
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export const debugLog = (message) => {
|
|
18
|
+
if (!IS_ENABLED)
|
|
19
|
+
return;
|
|
20
|
+
console.log(`[knip] ${message}`);
|
|
21
|
+
};
|
|
22
|
+
export const debugLogObject = (name, obj) => {
|
|
23
|
+
if (!IS_ENABLED)
|
|
24
|
+
return;
|
|
25
|
+
console.log(`[knip] ${name}`);
|
|
26
|
+
console.log(util.inspect(obj, inspectOptions));
|
|
27
|
+
};
|
|
28
|
+
export const debugLogArray = (name, sourceFiles) => {
|
|
29
|
+
if (!IS_ENABLED)
|
|
30
|
+
return;
|
|
31
|
+
const collection = Array.from(sourceFiles);
|
|
32
|
+
console.debug(`[knip] ${name} (${collection.length})`);
|
|
33
|
+
logArray(collection);
|
|
34
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface ErrorWithCause extends Error {
|
|
2
|
+
cause: Error;
|
|
3
|
+
}
|
|
4
|
+
export declare class ConfigurationError extends Error {
|
|
5
|
+
}
|
|
6
|
+
export declare class LoaderError extends Error {
|
|
7
|
+
}
|
|
8
|
+
export declare const isKnownError: (error: Error) => boolean;
|
|
9
|
+
export declare const hasCause: (error: Error) => error is ErrorWithCause;
|
|
10
|
+
export declare const isConfigurationError: (error: Error) => boolean;
|
|
11
|
+
export declare const getKnownError: (error: Error) => Error;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ZodError } from 'zod';
|
|
2
|
+
import { fromZodError } from 'zod-validation-error';
|
|
3
|
+
export class ConfigurationError extends Error {
|
|
4
|
+
}
|
|
5
|
+
export class LoaderError extends Error {
|
|
6
|
+
}
|
|
7
|
+
export const isKnownError = (error) => error instanceof ConfigurationError || error instanceof LoaderError || error instanceof ZodError;
|
|
8
|
+
export const hasCause = (error) => error.cause instanceof Error;
|
|
9
|
+
export const isConfigurationError = (error) => error instanceof ConfigurationError;
|
|
10
|
+
export const getKnownError = (error) => {
|
|
11
|
+
if (error instanceof ZodError)
|
|
12
|
+
return fromZodError(error);
|
|
13
|
+
return error;
|
|
14
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const isFile: (filePath: string) => boolean;
|
|
2
|
+
export declare const findFile: (workingDir: string, fileName: string) => string | undefined;
|
|
3
|
+
export declare const loadFile: (filePath: string) => Promise<string>;
|
|
4
|
+
export declare const loadJSON: (filePath: string) => Promise<any>;
|
|
5
|
+
export declare const loadYAML: (filePath: string) => Promise<unknown>;
|
|
6
|
+
export declare const parseJSON: (filePath: string, contents: string) => Promise<any>;
|
|
7
|
+
export declare const parseYAML: (contents: string) => Promise<unknown>;
|
package/dist/util/fs.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { statSync } from 'node:fs';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import yaml from 'js-yaml';
|
|
4
|
+
import stripJsonComments from 'strip-json-comments';
|
|
5
|
+
import { LoaderError } from './errors.js';
|
|
6
|
+
import { join } from './path.js';
|
|
7
|
+
export const isFile = (filePath) => {
|
|
8
|
+
const stat = statSync(filePath, { throwIfNoEntry: false });
|
|
9
|
+
return stat !== undefined && stat.isFile();
|
|
10
|
+
};
|
|
11
|
+
export const findFile = (workingDir, fileName) => {
|
|
12
|
+
const filePath = join(workingDir, fileName);
|
|
13
|
+
return isFile(filePath) ? filePath : undefined;
|
|
14
|
+
};
|
|
15
|
+
export const loadFile = async (filePath) => {
|
|
16
|
+
try {
|
|
17
|
+
const contents = await readFile(filePath);
|
|
18
|
+
return contents.toString();
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
throw new LoaderError(`Error loading ${filePath}`, { cause: error });
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export const loadJSON = async (filePath) => {
|
|
25
|
+
const contents = await loadFile(filePath);
|
|
26
|
+
return parseJSON(filePath, contents);
|
|
27
|
+
};
|
|
28
|
+
export const loadYAML = async (filePath) => {
|
|
29
|
+
const contents = await loadFile(filePath);
|
|
30
|
+
return parseYAML(contents);
|
|
31
|
+
};
|
|
32
|
+
export const parseJSON = async (filePath, contents) => {
|
|
33
|
+
try {
|
|
34
|
+
return JSON.parse(stripJsonComments(contents, { trailingCommas: true }));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw new LoaderError(`Error loading ${filePath}`, { cause: error });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export const parseYAML = async (contents) => {
|
|
41
|
+
return yaml.load(contents);
|
|
42
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Report } from '../types/issues.js';
|
|
2
|
+
type CLIArguments = {
|
|
3
|
+
include: string[];
|
|
4
|
+
exclude: string[];
|
|
5
|
+
dependencies: boolean;
|
|
6
|
+
exports: boolean;
|
|
7
|
+
};
|
|
8
|
+
type Options = {
|
|
9
|
+
isProduction?: boolean;
|
|
10
|
+
include?: string[];
|
|
11
|
+
exclude?: string[];
|
|
12
|
+
dependencies?: boolean;
|
|
13
|
+
exports?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const getIncludedIssueTypes: (cliArgs: CLIArguments, { include, exclude, isProduction }?: Options) => Report;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ISSUE_TYPES } from '../constants.js';
|
|
2
|
+
export const getIncludedIssueTypes = (cliArgs, { include = [], exclude = [], isProduction = false } = {}) => {
|
|
3
|
+
if (cliArgs.dependencies) {
|
|
4
|
+
cliArgs.include = [
|
|
5
|
+
...cliArgs.include,
|
|
6
|
+
'dependencies',
|
|
7
|
+
'optionalPeerDependencies',
|
|
8
|
+
'unlisted',
|
|
9
|
+
'binaries',
|
|
10
|
+
'unresolved',
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
if (cliArgs.exports) {
|
|
14
|
+
const exports = ['exports', 'nsExports', 'classMembers', 'types', 'nsTypes', 'enumMembers', 'duplicates'];
|
|
15
|
+
cliArgs.include = [...cliArgs.include, ...exports];
|
|
16
|
+
}
|
|
17
|
+
const normalizedIncludesArg = cliArgs.include.map(value => value.split(',')).flat();
|
|
18
|
+
const normalizedExcludesArg = cliArgs.exclude.map(value => value.split(',')).flat();
|
|
19
|
+
const excludes = exclude.filter(exclude => !normalizedIncludesArg.includes(exclude));
|
|
20
|
+
const includes = include.filter(include => !normalizedExcludesArg.includes(include));
|
|
21
|
+
const _include = [normalizedIncludesArg, includes].flat();
|
|
22
|
+
const _exclude = [normalizedExcludesArg, excludes].flat();
|
|
23
|
+
if (isProduction) {
|
|
24
|
+
_exclude.push('types');
|
|
25
|
+
_exclude.push('nsTypes');
|
|
26
|
+
_exclude.push('enumMembers');
|
|
27
|
+
_exclude.push('devDependencies');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
if (_include.includes('dependencies'))
|
|
31
|
+
_include.push('devDependencies', 'optionalPeerDependencies');
|
|
32
|
+
if (_exclude.includes('dependencies'))
|
|
33
|
+
_exclude.push('devDependencies', 'optionalPeerDependencies');
|
|
34
|
+
}
|
|
35
|
+
const included = (_include.length > 0 ? _include : ISSUE_TYPES).filter(group => !_exclude.includes(group));
|
|
36
|
+
return ISSUE_TYPES.reduce((types, group) => ((types[group] = included.includes(group)), types), {});
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getGitHookPaths: (defaultPath?: string) => string[];
|
package/dist/util/git.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { join } from './path.js';
|
|
3
|
+
const hookFileNames = [
|
|
4
|
+
`prepare-commit-msg`,
|
|
5
|
+
`commit-msg`,
|
|
6
|
+
`pre-{applypatch,commit,merge-commit,push,rebase,receive}`,
|
|
7
|
+
`post-{checkout,commit,merge,rewrite}`,
|
|
8
|
+
];
|
|
9
|
+
const getGitHooksPath = (defaultPath = '.git/hooks') => {
|
|
10
|
+
try {
|
|
11
|
+
return execSync('git config --get core.hooksPath', { encoding: 'utf8' }).trim();
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
return defaultPath;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export const getGitHookPaths = (defaultPath = '.git/hooks') => {
|
|
18
|
+
const gitHooksPath = getGitHooksPath(defaultPath);
|
|
19
|
+
return hookFileNames.map(fileName => join(gitHooksPath, fileName));
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
export declare const prependDirToPattern: (workingDir: string, pattern: string) => string;
|
|
3
|
+
export declare const negate: (pattern: string) => string;
|
|
4
|
+
export declare const hasProductionSuffix: (pattern: string) => boolean;
|
|
5
|
+
export declare const hasNoProductionSuffix: (pattern: string) => boolean;
|
|
6
|
+
interface BaseGlobOptions {
|
|
7
|
+
cwd: string;
|
|
8
|
+
patterns: string[];
|
|
9
|
+
ignore?: string[];
|
|
10
|
+
gitignore?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface GlobOptions extends BaseGlobOptions {
|
|
13
|
+
workingDir?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const _glob: ({ cwd, workingDir, patterns, ignore, gitignore }: GlobOptions) => Promise<string[]>;
|
|
16
|
+
export declare const _pureGlob: ({ cwd, patterns, ignore, gitignore }: BaseGlobOptions) => Promise<string[]>;
|
|
17
|
+
export declare const _firstGlob: ({ cwd, patterns }: BaseGlobOptions) => Promise<string | Buffer | undefined>;
|
|
18
|
+
export declare const _dirGlob: ({ cwd, patterns }: BaseGlobOptions) => Promise<string[]>;
|
|
19
|
+
export {};
|