knip 5.33.3 → 5.34.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 +27 -27
- package/dist/ConfigurationChief.js +20 -36
- package/dist/ConfigurationValidator.d.ts +392 -0
- package/dist/ConfigurationValidator.js +7 -0
- package/dist/DependencyDeputy.js +5 -2
- package/dist/PrincipalFactory.d.ts +3 -20
- package/dist/PrincipalFactory.js +4 -4
- package/dist/ProjectPrincipal.d.ts +2 -5
- package/dist/ProjectPrincipal.js +0 -5
- package/dist/WorkspaceWorker.d.ts +15 -13
- package/dist/WorkspaceWorker.js +144 -105
- package/dist/binaries/bash-parser.d.ts +3 -2
- package/dist/binaries/bash-parser.js +33 -23
- package/dist/binaries/fallback.d.ts +2 -0
- package/dist/binaries/fallback.js +12 -0
- package/dist/binaries/index.d.ts +2 -2
- package/dist/binaries/index.js +17 -26
- package/dist/binaries/package-manager/bun.d.ts +2 -0
- package/dist/binaries/{resolvers → package-manager}/bun.js +6 -4
- package/dist/binaries/package-manager/index.d.ts +8 -0
- package/dist/binaries/package-manager/index.js +12 -0
- package/dist/binaries/package-manager/npm.d.ts +2 -0
- package/dist/binaries/package-manager/npm.js +8 -0
- package/dist/binaries/package-manager/npx.d.ts +2 -0
- package/dist/binaries/{resolvers → package-manager}/npx.js +6 -6
- package/dist/binaries/package-manager/pnpm.d.ts +2 -0
- package/dist/binaries/{resolvers → package-manager}/pnpm.js +6 -3
- package/dist/binaries/package-manager/yarn.d.ts +2 -0
- package/dist/binaries/{resolvers → package-manager}/yarn.js +9 -7
- package/dist/binaries/plugins.d.ts +2 -0
- package/dist/binaries/plugins.js +61 -0
- package/dist/binaries/util.d.ts +2 -2
- package/dist/binaries/util.js +5 -25
- package/dist/compilers/index.d.ts +70 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -1
- package/dist/index.js +74 -46
- package/dist/manifest/helpers.d.ts +1 -5
- package/dist/manifest/helpers.js +8 -7
- package/dist/plugins/_template/index.d.ts +2 -2
- package/dist/plugins/_template/index.js +4 -3
- package/dist/plugins/angular/index.d.ts +1 -1
- package/dist/plugins/angular/index.js +13 -10
- package/dist/plugins/astro/index.d.ts +1 -1
- package/dist/plugins/astro/index.js +6 -5
- package/dist/plugins/ava/index.d.ts +1 -1
- package/dist/plugins/ava/index.js +4 -5
- package/dist/plugins/babel/helpers.js +1 -1
- package/dist/plugins/babel/index.d.ts +3 -2
- package/dist/plugins/babel/index.js +4 -3
- package/dist/plugins/c8/index.d.ts +10 -0
- package/dist/plugins/c8/index.js +11 -0
- package/dist/plugins/capacitor/index.d.ts +1 -1
- package/dist/plugins/capacitor/index.js +5 -4
- package/dist/plugins/changesets/index.d.ts +1 -1
- package/dist/plugins/changesets/index.js +4 -3
- package/dist/plugins/commitizen/index.d.ts +1 -1
- package/dist/plugins/commitizen/index.js +3 -2
- package/dist/plugins/commitlint/index.d.ts +1 -1
- package/dist/plugins/commitlint/index.js +4 -2
- package/dist/plugins/cspell/index.d.ts +1 -1
- package/dist/plugins/cspell/index.js +3 -2
- package/dist/plugins/cucumber/index.d.ts +2 -2
- package/dist/plugins/cucumber/index.js +4 -4
- package/dist/plugins/cypress/helpers.d.ts +1 -1
- package/dist/plugins/cypress/helpers.js +3 -4
- package/dist/plugins/cypress/index.d.ts +1 -1
- package/dist/plugins/cypress/index.js +6 -5
- package/dist/plugins/dotenv/index.d.ts +8 -0
- package/dist/plugins/dotenv/index.js +9 -0
- package/dist/plugins/drizzle/index.d.ts +1 -1
- package/dist/plugins/drizzle/index.js +3 -3
- package/dist/plugins/eleventy/index.d.ts +1 -1
- package/dist/plugins/eleventy/index.js +6 -6
- package/dist/plugins/eslint/helpers.d.ts +4 -5
- package/dist/plugins/eslint/helpers.js +10 -32
- package/dist/plugins/eslint/index.d.ts +1 -1
- package/dist/plugins/eslint/index.js +3 -6
- package/dist/plugins/gatsby/index.d.ts +1 -1
- package/dist/plugins/gatsby/index.js +6 -3
- package/dist/plugins/github-actions/index.d.ts +1 -1
- package/dist/plugins/github-actions/index.js +23 -7
- package/dist/plugins/graphql-codegen/index.d.ts +1 -1
- package/dist/plugins/graphql-codegen/index.js +7 -7
- package/dist/plugins/husky/index.d.ts +1 -1
- package/dist/plugins/husky/index.js +4 -3
- package/dist/plugins/index.d.ts +685 -77
- package/dist/plugins/index.js +170 -77
- package/dist/plugins/jest/index.d.ts +1 -1
- package/dist/plugins/jest/index.js +22 -24
- package/dist/plugins/ladle/index.d.ts +2 -2
- package/dist/plugins/ladle/index.js +4 -4
- package/dist/plugins/lefthook/index.d.ts +1 -1
- package/dist/plugins/lefthook/index.js +18 -14
- package/dist/plugins/lint-staged/index.d.ts +1 -1
- package/dist/plugins/lint-staged/index.js +6 -5
- package/dist/plugins/linthtml/index.d.ts +1 -1
- package/dist/plugins/linthtml/index.js +6 -8
- package/dist/plugins/lockfile-lint/index.d.ts +2 -2
- package/dist/plugins/lockfile-lint/index.js +2 -1
- package/dist/plugins/lost-pixel/index.d.ts +2 -2
- package/dist/plugins/lost-pixel/index.js +1 -1
- package/dist/plugins/markdownlint/index.d.ts +1 -1
- package/dist/plugins/markdownlint/index.js +3 -2
- package/dist/plugins/mocha/index.d.ts +4 -1
- package/dist/plugins/mocha/index.js +8 -4
- package/dist/plugins/moonrepo/index.d.ts +2 -2
- package/dist/plugins/moonrepo/index.js +4 -4
- package/dist/plugins/msw/index.d.ts +1 -1
- package/dist/plugins/msw/index.js +4 -4
- package/dist/plugins/nest/index.d.ts +2 -2
- package/dist/plugins/nest/index.js +4 -3
- package/dist/plugins/netlify/index.d.ts +1 -1
- package/dist/plugins/netlify/index.js +6 -6
- package/dist/plugins/next/index.d.ts +1 -1
- package/dist/plugins/next/index.js +1 -1
- package/dist/plugins/node/index.d.ts +8 -0
- package/dist/plugins/node/index.js +9 -0
- package/dist/plugins/node-test-runner/index.d.ts +1 -1
- package/dist/plugins/nodemon/index.d.ts +10 -0
- package/dist/plugins/nodemon/index.js +11 -0
- package/dist/plugins/npm-package-json-lint/index.d.ts +1 -1
- package/dist/plugins/npm-package-json-lint/index.js +4 -2
- package/dist/plugins/nuxt/index.d.ts +1 -1
- package/dist/plugins/nuxt/index.js +4 -4
- package/dist/plugins/nx/index.d.ts +5 -1
- package/dist/plugins/nx/index.js +10 -8
- package/dist/plugins/nyc/index.d.ts +1 -1
- package/dist/plugins/nyc/index.js +3 -2
- package/dist/plugins/oclif/index.d.ts +2 -2
- package/dist/plugins/oclif/index.js +3 -2
- package/dist/plugins/playwright/index.d.ts +13 -1
- package/dist/plugins/playwright/index.js +13 -6
- package/dist/plugins/playwright-ct/index.d.ts +9 -3
- package/dist/plugins/playwright-ct/index.js +3 -2
- package/dist/plugins/playwright-test/index.d.ts +13 -0
- package/dist/plugins/playwright-test/index.js +16 -0
- package/dist/plugins/postcss/index.d.ts +1 -1
- package/dist/plugins/postcss/index.js +5 -2
- package/dist/plugins/preconstruct/index.d.ts +1 -1
- package/dist/plugins/preconstruct/index.js +3 -3
- package/dist/plugins/prettier/index.d.ts +1 -1
- package/dist/plugins/prettier/index.js +5 -5
- package/dist/plugins/react-cosmos/index.d.ts +2 -2
- package/dist/plugins/react-cosmos/index.js +5 -6
- package/dist/plugins/release-it/index.d.ts +1 -1
- package/dist/plugins/release-it/index.js +4 -3
- package/dist/plugins/remark/index.d.ts +1 -1
- package/dist/plugins/remark/index.js +3 -2
- package/dist/plugins/remix/index.d.ts +1 -1
- package/dist/plugins/remix/index.js +1 -1
- package/dist/plugins/rollup/index.d.ts +3 -1
- package/dist/plugins/rollup/index.js +8 -1
- package/dist/plugins/rsbuild/index.d.ts +2 -2
- package/dist/plugins/rsbuild/index.js +1 -1
- package/dist/plugins/rspack/index.d.ts +2 -2
- package/dist/plugins/rspack/index.js +4 -8
- package/dist/plugins/semantic-release/index.d.ts +1 -1
- package/dist/plugins/semantic-release/index.js +4 -2
- package/dist/plugins/sentry/index.d.ts +1 -1
- package/dist/plugins/sentry/index.js +1 -1
- package/dist/plugins/simple-git-hooks/index.d.ts +2 -2
- package/dist/plugins/simple-git-hooks/index.js +5 -5
- package/dist/plugins/size-limit/index.d.ts +2 -2
- package/dist/plugins/size-limit/index.js +2 -1
- package/dist/plugins/storybook/index.d.ts +1 -1
- package/dist/plugins/storybook/index.js +5 -5
- package/dist/plugins/stryker/index.d.ts +1 -1
- package/dist/plugins/stryker/index.js +3 -2
- package/dist/plugins/stylelint/index.d.ts +1 -1
- package/dist/plugins/stylelint/index.js +4 -3
- package/dist/plugins/svelte/index.d.ts +1 -1
- package/dist/plugins/svelte/index.js +1 -1
- package/dist/plugins/syncpack/index.d.ts +2 -3
- package/dist/plugins/syncpack/index.js +2 -4
- package/dist/plugins/tailwind/index.d.ts +1 -1
- package/dist/plugins/tailwind/index.js +1 -1
- package/dist/plugins/travis/index.d.ts +1 -1
- package/dist/plugins/travis/index.js +2 -3
- package/dist/plugins/ts-node/index.d.ts +15 -0
- package/dist/plugins/ts-node/index.js +12 -0
- package/dist/plugins/tsup/index.d.ts +4 -1
- package/dist/plugins/tsup/index.js +7 -3
- package/dist/plugins/tsx/index.d.ts +9 -0
- package/dist/plugins/tsx/index.js +10 -0
- package/dist/plugins/typedoc/index.d.ts +4 -1
- package/dist/plugins/typedoc/index.js +10 -3
- package/dist/plugins/typedoc/types.d.ts +1 -0
- package/dist/plugins/typescript/index.d.ts +11 -2
- package/dist/plugins/typescript/index.js +19 -34
- package/dist/plugins/unbuild/index.d.ts +1 -1
- package/dist/plugins/unbuild/index.js +3 -3
- package/dist/plugins/unocss/index.d.ts +2 -2
- package/dist/plugins/unocss/index.js +2 -1
- package/dist/plugins/vercel-og/index.d.ts +1 -1
- package/dist/plugins/vercel-og/index.js +1 -1
- package/dist/plugins/vike/index.d.ts +2 -2
- package/dist/plugins/vike/index.js +1 -1
- package/dist/plugins/vite/index.d.ts +3 -3
- package/dist/plugins/vite/index.js +2 -2
- package/dist/plugins/vitest/index.d.ts +4 -1
- package/dist/plugins/vitest/index.js +31 -20
- package/dist/plugins/vue/index.d.ts +1 -1
- package/dist/plugins/vue/index.js +10 -10
- package/dist/plugins/webdriver-io/index.d.ts +1 -1
- package/dist/plugins/webdriver-io/index.js +3 -2
- package/dist/plugins/webpack/index.d.ts +3 -5
- package/dist/plugins/webpack/index.js +18 -19
- package/dist/plugins/wireit/index.d.ts +1 -1
- package/dist/plugins/wireit/index.js +2 -2
- package/dist/plugins/wrangler/index.d.ts +1 -1
- package/dist/plugins/wrangler/index.js +3 -2
- package/dist/plugins/xo/index.d.ts +2 -2
- package/dist/plugins/xo/index.js +4 -4
- package/dist/plugins/yorkie/index.d.ts +1 -1
- package/dist/plugins/yorkie/index.js +6 -5
- package/dist/plugins.d.ts +7 -4
- package/dist/plugins.js +17 -10
- package/dist/reporters/symbols.js +1 -1
- package/dist/types/PluginNames.d.ts +2 -0
- package/dist/types/PluginNames.js +86 -0
- package/dist/types/args.d.ts +14 -0
- package/dist/types/config.d.ts +84 -21
- package/dist/types/package-json.d.ts +10 -0
- package/dist/types/project.d.ts +18 -0
- package/dist/typescript/get-imports-and-exports.d.ts +1 -11
- package/dist/typescript/get-imports-and-exports.js +3 -1
- package/dist/typescript/visitors/dynamic-imports/importCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/importType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/index.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/jsDocType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/requireCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/resolveCall.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportAssignment.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportKeyword.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportsAccessExpression.d.ts +1 -1
- package/dist/typescript/visitors/exports/index.d.ts +1 -1
- package/dist/typescript/visitors/exports/moduleExportsAccessExpression.d.ts +1 -1
- package/dist/typescript/visitors/imports/importDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/importEqualsDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/index.d.ts +1 -1
- package/dist/typescript/visitors/imports/reExportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/index.d.ts +1 -1
- package/dist/typescript/visitors/scripts/bun.d.ts +1 -1
- package/dist/typescript/visitors/scripts/execa.d.ts +1 -1
- package/dist/typescript/visitors/scripts/index.d.ts +1 -1
- package/dist/typescript/visitors/scripts/zx.d.ts +1 -1
- package/dist/util/create-workspace-graph.d.ts +1 -1
- package/dist/util/create-workspace-graph.js +7 -7
- package/dist/util/debug.d.ts +2 -2
- package/dist/util/debug.js +1 -1
- package/dist/util/glob.js +2 -2
- package/dist/util/handle-referenced-inputs.d.ts +5 -0
- package/dist/util/handle-referenced-inputs.js +86 -0
- package/dist/util/input.d.ts +37 -0
- package/dist/util/input.js +36 -0
- package/dist/util/map-workspaces.d.ts +5 -2
- package/dist/util/map-workspaces.js +6 -6
- package/dist/util/modules.d.ts +1 -0
- package/dist/util/modules.js +4 -3
- package/dist/util/object.d.ts +1 -0
- package/dist/util/object.js +19 -0
- package/dist/util/plugin-config.d.ts +24 -0
- package/dist/util/plugin-config.js +32 -0
- package/dist/util/plugin.d.ts +3 -31
- package/dist/util/plugin.js +9 -54
- package/dist/util/regex.js +3 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -10
- package/schema.json +28 -0
- package/dist/binaries/resolvers/bun.d.ts +0 -2
- package/dist/binaries/resolvers/c8.d.ts +0 -2
- package/dist/binaries/resolvers/c8.js +0 -11
- package/dist/binaries/resolvers/dotenv.d.ts +0 -2
- package/dist/binaries/resolvers/dotenv.js +0 -7
- package/dist/binaries/resolvers/fallback.d.ts +0 -2
- package/dist/binaries/resolvers/fallback.js +0 -26
- package/dist/binaries/resolvers/index.d.ts +0 -15
- package/dist/binaries/resolvers/index.js +0 -26
- package/dist/binaries/resolvers/node.d.ts +0 -4
- package/dist/binaries/resolvers/node.js +0 -11
- package/dist/binaries/resolvers/nodemon.d.ts +0 -2
- package/dist/binaries/resolvers/nodemon.js +0 -16
- package/dist/binaries/resolvers/npx.d.ts +0 -2
- package/dist/binaries/resolvers/nx.d.ts +0 -2
- package/dist/binaries/resolvers/nx.js +0 -9
- package/dist/binaries/resolvers/pnpm.d.ts +0 -2
- package/dist/binaries/resolvers/rollup.d.ts +0 -2
- package/dist/binaries/resolvers/rollup.js +0 -12
- package/dist/binaries/resolvers/ts-node.d.ts +0 -2
- package/dist/binaries/resolvers/ts-node.js +0 -16
- package/dist/binaries/resolvers/tsx.d.ts +0 -2
- package/dist/binaries/resolvers/tsx.js +0 -6
- package/dist/binaries/resolvers/yarn.d.ts +0 -2
- package/dist/binaries/types.d.ts +0 -11
- package/dist/types/plugins.d.ts +0 -42
- package/dist/util/handle-dependency.d.ts +0 -4
- package/dist/util/handle-dependency.js +0 -63
- package/dist/util/protocols.d.ts +0 -9
- package/dist/util/protocols.js +0 -9
- /package/dist/{binaries/types.js → types/args.js} +0 -0
- /package/dist/types/{plugins.js → project.js} +0 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export const pluginNames = [
|
|
2
|
+
'angular',
|
|
3
|
+
'astro',
|
|
4
|
+
'ava',
|
|
5
|
+
'babel',
|
|
6
|
+
'c8',
|
|
7
|
+
'capacitor',
|
|
8
|
+
'changesets',
|
|
9
|
+
'commitizen',
|
|
10
|
+
'commitlint',
|
|
11
|
+
'cspell',
|
|
12
|
+
'cucumber',
|
|
13
|
+
'cypress',
|
|
14
|
+
'dotenv',
|
|
15
|
+
'drizzle',
|
|
16
|
+
'eleventy',
|
|
17
|
+
'eslint',
|
|
18
|
+
'gatsby',
|
|
19
|
+
'github-actions',
|
|
20
|
+
'graphql-codegen',
|
|
21
|
+
'husky',
|
|
22
|
+
'jest',
|
|
23
|
+
'ladle',
|
|
24
|
+
'lefthook',
|
|
25
|
+
'lint-staged',
|
|
26
|
+
'linthtml',
|
|
27
|
+
'lockfile-lint',
|
|
28
|
+
'lost-pixel',
|
|
29
|
+
'markdownlint',
|
|
30
|
+
'mocha',
|
|
31
|
+
'moonrepo',
|
|
32
|
+
'msw',
|
|
33
|
+
'nest',
|
|
34
|
+
'netlify',
|
|
35
|
+
'next',
|
|
36
|
+
'node',
|
|
37
|
+
'node-test-runner',
|
|
38
|
+
'nodemon',
|
|
39
|
+
'npm-package-json-lint',
|
|
40
|
+
'nuxt',
|
|
41
|
+
'nx',
|
|
42
|
+
'nyc',
|
|
43
|
+
'oclif',
|
|
44
|
+
'playwright',
|
|
45
|
+
'playwright-ct',
|
|
46
|
+
'playwright-test',
|
|
47
|
+
'postcss',
|
|
48
|
+
'preconstruct',
|
|
49
|
+
'prettier',
|
|
50
|
+
'react-cosmos',
|
|
51
|
+
'release-it',
|
|
52
|
+
'remark',
|
|
53
|
+
'remix',
|
|
54
|
+
'rollup',
|
|
55
|
+
'rsbuild',
|
|
56
|
+
'rspack',
|
|
57
|
+
'semantic-release',
|
|
58
|
+
'sentry',
|
|
59
|
+
'simple-git-hooks',
|
|
60
|
+
'size-limit',
|
|
61
|
+
'storybook',
|
|
62
|
+
'stryker',
|
|
63
|
+
'stylelint',
|
|
64
|
+
'svelte',
|
|
65
|
+
'syncpack',
|
|
66
|
+
'tailwind',
|
|
67
|
+
'travis',
|
|
68
|
+
'ts-node',
|
|
69
|
+
'tsup',
|
|
70
|
+
'tsx',
|
|
71
|
+
'typedoc',
|
|
72
|
+
'typescript',
|
|
73
|
+
'unbuild',
|
|
74
|
+
'unocss',
|
|
75
|
+
'vercel-og',
|
|
76
|
+
'vike',
|
|
77
|
+
'vite',
|
|
78
|
+
'vitest',
|
|
79
|
+
'vue',
|
|
80
|
+
'webdriver-io',
|
|
81
|
+
'webpack',
|
|
82
|
+
'wireit',
|
|
83
|
+
'wrangler',
|
|
84
|
+
'xo',
|
|
85
|
+
'yorkie',
|
|
86
|
+
];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ParsedArgs } from 'minimist';
|
|
2
|
+
export type ConfigArg = boolean | (string | [string, (id: string) => string])[];
|
|
3
|
+
export type Args = {
|
|
4
|
+
binaries?: string[];
|
|
5
|
+
positional?: boolean;
|
|
6
|
+
string?: string[];
|
|
7
|
+
boolean?: string[];
|
|
8
|
+
alias?: Record<string, string[]>;
|
|
9
|
+
resolve?: string[];
|
|
10
|
+
nodeImportArgs?: boolean;
|
|
11
|
+
config?: ConfigArg;
|
|
12
|
+
args?: (args: string[]) => string[];
|
|
13
|
+
fromArgs?: string[] | ((parsed: ParsedArgs, args: string[]) => string[]);
|
|
14
|
+
};
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
2
|
import type { ConfigurationValidator, pluginSchema } from '../ConfigurationValidator.js';
|
|
3
3
|
import type { AsyncCompilers, SyncCompilers } from '../compilers/types.js';
|
|
4
|
-
import type
|
|
4
|
+
import type { Input } from '../util/input.js';
|
|
5
|
+
import type { PluginName } from './PluginNames.js';
|
|
6
|
+
import type { Args } from './args.js';
|
|
7
|
+
import type { Tags } from './cli.js';
|
|
5
8
|
import type { IssueType, Rules } from './issues.js';
|
|
9
|
+
import type { PackageJson } from './package-json.js';
|
|
10
|
+
export interface GetInputsFromScriptsOptions extends BaseOptions {
|
|
11
|
+
knownBinsOnly?: boolean;
|
|
12
|
+
containingFilePath: string;
|
|
13
|
+
}
|
|
14
|
+
export type GetInputsFromScripts<T = GetInputsFromScriptsOptions> = (npmScripts: string | string[] | Set<string>, options: T) => Input[];
|
|
15
|
+
export type GetInputsFromScriptsPartial = (npmScripts: string | string[] | Set<string>, options?: Partial<GetInputsFromScriptsOptions>) => Input[];
|
|
16
|
+
type FromArgs = (args: string[]) => Input[];
|
|
17
|
+
interface BinaryResolverOptions extends GetInputsFromScriptsOptions {
|
|
18
|
+
fromArgs: FromArgs;
|
|
19
|
+
}
|
|
20
|
+
export type BinaryResolver = (binary: string, args: string[], options: BinaryResolverOptions) => Input[];
|
|
6
21
|
export type RawConfiguration = z.infer<typeof ConfigurationValidator>;
|
|
7
22
|
export type RawPluginConfiguration = z.infer<typeof pluginSchema>;
|
|
8
|
-
type NormalizedGlob = string[];
|
|
9
23
|
export type IgnorePatterns = (string | RegExp)[];
|
|
10
|
-
export type EnablerPatterns = IgnorePatterns;
|
|
11
|
-
export type PluginName = keyof typeof Plugins;
|
|
12
|
-
export type PluginMap = typeof Plugins;
|
|
13
|
-
export type EnsuredPluginConfiguration = {
|
|
14
|
-
config: NormalizedGlob | null;
|
|
15
|
-
entry: NormalizedGlob | null;
|
|
16
|
-
project: NormalizedGlob | null;
|
|
17
|
-
};
|
|
18
|
-
type PluginConfiguration = EnsuredPluginConfiguration | boolean;
|
|
19
|
-
export type PluginsConfiguration = Record<PluginName, PluginConfiguration>;
|
|
20
|
-
interface BaseWorkspaceConfiguration {
|
|
21
|
-
entry: NormalizedGlob;
|
|
22
|
-
project: NormalizedGlob;
|
|
23
|
-
paths: Record<string, string[]>;
|
|
24
|
-
ignore: NormalizedGlob;
|
|
25
|
-
isIncludeEntryExports: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface WorkspaceConfiguration extends BaseWorkspaceConfiguration, Partial<PluginsConfiguration> {
|
|
28
|
-
}
|
|
29
24
|
type IgnorableExport = 'class' | 'enum' | 'function' | 'interface' | 'member' | 'type';
|
|
30
25
|
export type IgnoreExportsUsedInFile = boolean | Partial<Record<IgnorableExport, boolean>>;
|
|
26
|
+
export type GetImportsAndExportsOptions = {
|
|
27
|
+
skipTypeOnly: boolean;
|
|
28
|
+
skipExports: boolean;
|
|
29
|
+
isFixExports: boolean;
|
|
30
|
+
isFixTypes: boolean;
|
|
31
|
+
isReportClassMembers: boolean;
|
|
32
|
+
ignoreExportsUsedInFile: IgnoreExportsUsedInFile;
|
|
33
|
+
tags: Tags;
|
|
34
|
+
};
|
|
31
35
|
export interface Configuration {
|
|
32
36
|
rules: Rules;
|
|
33
37
|
include: IssueType[];
|
|
@@ -43,4 +47,63 @@ export interface Configuration {
|
|
|
43
47
|
asyncCompilers: AsyncCompilers;
|
|
44
48
|
rootPluginConfigs: Partial<PluginsConfiguration>;
|
|
45
49
|
}
|
|
50
|
+
export type NormalizedGlob = string[];
|
|
51
|
+
export type EnsuredPluginConfiguration = {
|
|
52
|
+
config: NormalizedGlob | null;
|
|
53
|
+
entry: NormalizedGlob | null;
|
|
54
|
+
project: NormalizedGlob | null;
|
|
55
|
+
};
|
|
56
|
+
interface BaseWorkspaceConfiguration {
|
|
57
|
+
entry: NormalizedGlob;
|
|
58
|
+
project: NormalizedGlob;
|
|
59
|
+
paths: Record<string, string[]>;
|
|
60
|
+
ignore: NormalizedGlob;
|
|
61
|
+
isIncludeEntryExports: boolean;
|
|
62
|
+
}
|
|
63
|
+
type PluginConfiguration = EnsuredPluginConfiguration | boolean;
|
|
64
|
+
export type PluginsConfiguration = Record<PluginName, PluginConfiguration>;
|
|
65
|
+
export interface WorkspaceConfiguration extends BaseWorkspaceConfiguration, Partial<PluginsConfiguration> {
|
|
66
|
+
}
|
|
67
|
+
interface BaseOptions {
|
|
68
|
+
rootCwd: string;
|
|
69
|
+
cwd: string;
|
|
70
|
+
manifestScriptNames: Set<string>;
|
|
71
|
+
}
|
|
72
|
+
type IsPluginEnabledOptions = {
|
|
73
|
+
cwd: string;
|
|
74
|
+
manifest: PackageJson;
|
|
75
|
+
dependencies: Set<string>;
|
|
76
|
+
config: WorkspaceConfiguration;
|
|
77
|
+
};
|
|
78
|
+
export type IsPluginEnabled = (options: IsPluginEnabledOptions) => boolean | Promise<boolean>;
|
|
79
|
+
export interface PluginOptions extends BaseOptions {
|
|
80
|
+
manifest: PackageJson;
|
|
81
|
+
config: EnsuredPluginConfiguration;
|
|
82
|
+
configFileDir: string;
|
|
83
|
+
configFileName: string;
|
|
84
|
+
configFilePath: string;
|
|
85
|
+
isProduction: boolean;
|
|
86
|
+
enabledPlugins: string[];
|
|
87
|
+
getInputsFromScripts: GetInputsFromScriptsPartial;
|
|
88
|
+
}
|
|
89
|
+
export type ResolveEntryPaths<T = any> = (config: T, options: PluginOptions) => Promise<Input[]> | Input[];
|
|
90
|
+
export type ResolveConfig<T = any> = (config: T, options: PluginOptions) => Promise<Input[]> | Input[];
|
|
91
|
+
export type Resolve = (options: PluginOptions) => Promise<Input[]> | Input[];
|
|
92
|
+
export interface Plugin {
|
|
93
|
+
title: string;
|
|
94
|
+
note?: string;
|
|
95
|
+
args?: Args;
|
|
96
|
+
packageJsonPath?: string | ((manifest: PackageJson) => string);
|
|
97
|
+
enablers?: IgnorePatterns | string;
|
|
98
|
+
isEnabled?: IsPluginEnabled;
|
|
99
|
+
config?: string[];
|
|
100
|
+
entry?: string[];
|
|
101
|
+
production?: string[];
|
|
102
|
+
project?: string[];
|
|
103
|
+
resolveEntryPaths?: ResolveEntryPaths;
|
|
104
|
+
resolveConfig?: ResolveConfig;
|
|
105
|
+
resolve?: Resolve;
|
|
106
|
+
}
|
|
107
|
+
export type PluginMap = Record<PluginName, Plugin>;
|
|
108
|
+
export type Entries = [PluginName, Plugin][];
|
|
46
109
|
export {};
|
|
@@ -37,5 +37,15 @@ export type PackageJson = {
|
|
|
37
37
|
peerDependenciesMeta?: Record<string, {
|
|
38
38
|
optional: true;
|
|
39
39
|
}>;
|
|
40
|
+
module?: string;
|
|
41
|
+
browser?: string;
|
|
42
|
+
types?: string;
|
|
43
|
+
typings?: string;
|
|
40
44
|
} & Plugins;
|
|
45
|
+
export type Package = {
|
|
46
|
+
dir: string;
|
|
47
|
+
name: string;
|
|
48
|
+
pkgName: string | undefined;
|
|
49
|
+
manifest: PackageJson;
|
|
50
|
+
};
|
|
41
51
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type ts from 'typescript';
|
|
2
|
+
import type { AsyncCompilers, SyncCompilers } from '../compilers/types.js';
|
|
3
|
+
import type { ToSourceFilePath } from '../util/to-source-path.js';
|
|
4
|
+
export type Paths = ts.CompilerOptions['paths'];
|
|
5
|
+
export type PrincipalOptions = {
|
|
6
|
+
cwd: string;
|
|
7
|
+
isFile: boolean;
|
|
8
|
+
compilerOptions: ts.CompilerOptions;
|
|
9
|
+
paths: Paths;
|
|
10
|
+
compilers: [SyncCompilers, AsyncCompilers];
|
|
11
|
+
pkgName: string;
|
|
12
|
+
isIsolateWorkspaces: boolean;
|
|
13
|
+
isSkipLibs: boolean;
|
|
14
|
+
isWatch: boolean;
|
|
15
|
+
toSourceFilePath: ToSourceFilePath;
|
|
16
|
+
isCache: boolean;
|
|
17
|
+
cacheLocation: string;
|
|
18
|
+
};
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import type {
|
|
3
|
-
import type { IgnoreExportsUsedInFile } from '../types/config.js';
|
|
2
|
+
import type { GetImportsAndExportsOptions } from '../types/config.js';
|
|
4
3
|
import type { ExportMap, ImportMap, UnresolvedImport } from '../types/dependency-graph.js';
|
|
5
4
|
import type { IssueSymbol } from '../types/issues.js';
|
|
6
5
|
import type { BoundSourceFile } from './SourceFile.js';
|
|
7
|
-
export type GetImportsAndExportsOptions = {
|
|
8
|
-
skipTypeOnly: boolean;
|
|
9
|
-
skipExports: boolean;
|
|
10
|
-
isFixExports: boolean;
|
|
11
|
-
isFixTypes: boolean;
|
|
12
|
-
isReportClassMembers: boolean;
|
|
13
|
-
ignoreExportsUsedInFile: IgnoreExportsUsedInFile;
|
|
14
|
-
tags: Tags;
|
|
15
|
-
};
|
|
16
6
|
export declare const _getImportsAndExports: (sourceFile: BoundSourceFile, resolveModule: (specifier: string) => ts.ResolvedModuleFull | undefined, typeChecker: ts.TypeChecker, options: GetImportsAndExportsOptions) => {
|
|
17
7
|
imports: {
|
|
18
8
|
internal: ImportMap;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isBuiltin } from 'node:module';
|
|
2
2
|
import ts from 'typescript';
|
|
3
|
-
import { ALIAS_TAG, ANONYMOUS, DEFAULT_EXTENSIONS, IMPORT_STAR } from '../constants.js';
|
|
3
|
+
import { ALIAS_TAG, ANONYMOUS, DEFAULT_EXTENSIONS, IMPORT_STAR, PROTOCOL_VIRTUAL } from '../constants.js';
|
|
4
4
|
import { timerify } from '../util/Performance.js';
|
|
5
5
|
import { addNsValue, addValue, createImports } from '../util/dependency-graph.js';
|
|
6
6
|
import { getPackageNameFromFilePath, isStartsLikePackageName, sanitizeSpecifier } from '../util/modules.js';
|
|
@@ -144,6 +144,8 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options) =
|
|
|
144
144
|
return;
|
|
145
145
|
if (shouldIgnore(getJSDocTags(node), tags))
|
|
146
146
|
return;
|
|
147
|
+
if (specifier.startsWith(PROTOCOL_VIRTUAL))
|
|
148
|
+
return;
|
|
147
149
|
if (typeof pos === 'number') {
|
|
148
150
|
const { line, character } = sourceFile.getLineAndCharacterOfPosition(pos);
|
|
149
151
|
unresolvedImports.add({ specifier, pos, line: line + 1, col: character + 1 });
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import type { ImportNode } from '../../../types/imports.js';
|
|
3
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
3
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => ImportNode | ImportNode[] | undefined;
|
|
4
4
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
+
import type { GetImportsAndExportsOptions } from '../../types/config.js';
|
|
2
3
|
import type { ExportNode } from '../../types/exports.js';
|
|
3
4
|
import type { ImportNode } from '../../types/imports.js';
|
|
4
|
-
import type { GetImportsAndExportsOptions } from '../get-imports-and-exports.js';
|
|
5
5
|
type FileCondition = (sourceFile: ts.SourceFile) => boolean;
|
|
6
6
|
type VisitorFactory<T> = (fileCondition: FileCondition, fn: Visitor<T>) => VisitorCondition<T>;
|
|
7
7
|
type VisitorCondition<T> = (sourceFile: ts.SourceFile) => Visitor<T>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => string | string[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => string | string[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => string | string[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => string | string[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -4,5 +4,5 @@ interface Package {
|
|
|
4
4
|
dir: string;
|
|
5
5
|
}
|
|
6
6
|
export type WorkspaceGraph = Record<string, Set<string>>;
|
|
7
|
-
export declare function createWorkspaceGraph(cwd: string, wsNames: string[], wsPkgNames: Set<string>,
|
|
7
|
+
export declare function createWorkspaceGraph(cwd: string, wsNames: string[], wsPkgNames: Set<string>, wsPackages: Map<string, Package>): WorkspaceGraph;
|
|
8
8
|
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { join } from './path.js';
|
|
2
2
|
const types = ['peerDependencies', 'devDependencies', 'optionalDependencies', 'dependencies'];
|
|
3
|
-
export function createWorkspaceGraph(cwd, wsNames, wsPkgNames,
|
|
3
|
+
export function createWorkspaceGraph(cwd, wsNames, wsPkgNames, wsPackages) {
|
|
4
4
|
const graph = {};
|
|
5
|
-
const getWorkspaceDirs = (pkg) => {
|
|
5
|
+
const getWorkspaceDirs = (pkg, name) => {
|
|
6
6
|
const dirs = new Set();
|
|
7
7
|
for (const type of types) {
|
|
8
8
|
if (pkg.manifest[type]) {
|
|
9
9
|
for (const pkgName in pkg.manifest[type]) {
|
|
10
10
|
if (wsPkgNames.has(pkgName)) {
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
dirs.add(
|
|
11
|
+
const wsPackage = wsPackages.get(name);
|
|
12
|
+
if (wsPackage)
|
|
13
|
+
dirs.add(wsPackage.dir);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -18,9 +18,9 @@ export function createWorkspaceGraph(cwd, wsNames, wsPkgNames, byPkgName, byName
|
|
|
18
18
|
return dirs;
|
|
19
19
|
};
|
|
20
20
|
for (const name of wsNames) {
|
|
21
|
-
const pkg =
|
|
21
|
+
const pkg = wsPackages.get(name);
|
|
22
22
|
if (pkg)
|
|
23
|
-
graph[join(cwd, name)] = getWorkspaceDirs(pkg);
|
|
23
|
+
graph[join(cwd, name)] = getWorkspaceDirs(pkg, name);
|
|
24
24
|
}
|
|
25
25
|
return graph;
|
|
26
26
|
}
|
package/dist/util/debug.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const inspect: (obj: unknown) => void;
|
|
2
2
|
export declare const debugLog: (context: string, message: string) => void;
|
|
3
|
-
export declare const debugLogObject: (context: string, name: string, obj: unknown | (() => unknown)) => void;
|
|
4
|
-
export declare const debugLogArray: (context: string | [string, string], message: string, elements: string[] | Set<string>) => void;
|
|
3
|
+
export declare const debugLogObject: (context: string | [string, string], name: string, obj: unknown | (() => unknown)) => void;
|
|
4
|
+
export declare const debugLogArray: (context: string | [string, string], message: string, elements: string[] | Set<string> | (() => string[] | Set<string>)) => void;
|
package/dist/util/debug.js
CHANGED
|
@@ -23,7 +23,7 @@ export const debugLogObject = IS_DEBUG_ENABLED
|
|
|
23
23
|
: noop;
|
|
24
24
|
export const debugLogArray = IS_DEBUG_ENABLED
|
|
25
25
|
? (context, message, elements) => {
|
|
26
|
-
const collection = Array.from(elements);
|
|
26
|
+
const collection = Array.from(typeof elements === 'function' ? elements() : elements);
|
|
27
27
|
console.debug(`${ctx(context)} ${message} (${collection.length})`);
|
|
28
28
|
logArray(collection);
|
|
29
29
|
}
|
package/dist/util/glob.js
CHANGED
|
@@ -3,10 +3,10 @@ import { GLOBAL_IGNORE_PATTERNS } from '../constants.js';
|
|
|
3
3
|
import { timerify } from './Performance.js';
|
|
4
4
|
import { compact } from './array.js';
|
|
5
5
|
import { globby } from './glob-core.js';
|
|
6
|
-
import { join, relative } from './path.js';
|
|
6
|
+
import { isAbsolute, join, relative } from './path.js';
|
|
7
7
|
const prependDirToPatterns = (cwd, dir, patterns) => {
|
|
8
8
|
const relativePath = relative(cwd, dir);
|
|
9
|
-
const prepend = (pattern) => prependDirToPattern(relativePath, pattern);
|
|
9
|
+
const prepend = (pattern) => isAbsolute(pattern.replace(/^!/, '')) ? pattern : prependDirToPattern(relativePath, pattern);
|
|
10
10
|
return compact([patterns].flat().map(prepend).map(removeProductionSuffix)).sort(negatedLast);
|
|
11
11
|
};
|
|
12
12
|
const removeProductionSuffix = (pattern) => pattern.replace(/!$/, '');
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ConfigurationChief, Workspace } from '../ConfigurationChief.js';
|
|
2
|
+
import type { DependencyDeputy } from '../DependencyDeputy.js';
|
|
3
|
+
import type { IssueCollector } from '../IssueCollector.js';
|
|
4
|
+
import { type Input } from './input.js';
|
|
5
|
+
export declare const getReferencedInputsHandler: (collector: IssueCollector, deputy: DependencyDeputy, chief: ConfigurationChief, isGitIgnored: (s: string) => boolean) => (input: Input, workspace: Workspace) => string | undefined;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { trimBinary } from '../binaries/util.js';
|
|
2
|
+
import { IGNORED_RUNTIME_DEPENDENCIES } from '../constants.js';
|
|
3
|
+
import { debugLog } from './debug.js';
|
|
4
|
+
import { toBinary, toDebugString } from './input.js';
|
|
5
|
+
import { fromBinary, isBinary, isConfigPattern, isDeferResolveEntry, isDependency } from './input.js';
|
|
6
|
+
import { getPackageNameFromSpecifier } from './modules.js';
|
|
7
|
+
import { dirname, isAbsolute, isInternal, join } from './path.js';
|
|
8
|
+
import { _resolveSync } from './resolve.js';
|
|
9
|
+
export const getReferencedInputsHandler = (collector, deputy, chief, isGitIgnored) => (input, workspace) => {
|
|
10
|
+
const { specifier, containingFilePath } = input;
|
|
11
|
+
if (!containingFilePath || IGNORED_RUNTIME_DEPENDENCIES.has(specifier))
|
|
12
|
+
return;
|
|
13
|
+
if (isDeferResolveEntry(input) && specifier.includes('node_modules/.bin')) {
|
|
14
|
+
Object.assign(input, toBinary(trimBinary(input.specifier)));
|
|
15
|
+
}
|
|
16
|
+
if (isBinary(input)) {
|
|
17
|
+
const binaryName = fromBinary(input);
|
|
18
|
+
const ws = (input.dir && chief.findWorkspaceByFilePath(`${input.dir}/`)) || workspace;
|
|
19
|
+
const isHandled = deputy.maybeAddReferencedBinary(ws, binaryName);
|
|
20
|
+
if (isHandled)
|
|
21
|
+
return;
|
|
22
|
+
collector.addIssue({
|
|
23
|
+
type: 'binaries',
|
|
24
|
+
filePath: containingFilePath,
|
|
25
|
+
workspace: workspace.name,
|
|
26
|
+
symbol: binaryName,
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const packageName = getPackageNameFromSpecifier(specifier);
|
|
31
|
+
if (packageName) {
|
|
32
|
+
const isWorkspace = chief.workspacesByPkgName.has(packageName);
|
|
33
|
+
const specifierWorkspace = chief.findWorkspaceByFilePath(containingFilePath) ?? workspace;
|
|
34
|
+
if (specifierWorkspace) {
|
|
35
|
+
const isHandled = deputy.maybeAddReferencedExternalDependency(specifierWorkspace, packageName);
|
|
36
|
+
if (isWorkspace || isDependency(input)) {
|
|
37
|
+
if (!isHandled) {
|
|
38
|
+
if ((deputy.isProduction && input.production) || !deputy.isProduction) {
|
|
39
|
+
collector.addIssue({
|
|
40
|
+
type: 'unlisted',
|
|
41
|
+
filePath: containingFilePath,
|
|
42
|
+
workspace: specifierWorkspace.name,
|
|
43
|
+
symbol: specifier,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const ref = _resolveSync(specifier, dirname(containingFilePath));
|
|
49
|
+
if (ref && !isGitIgnored(ref))
|
|
50
|
+
return ref;
|
|
51
|
+
}
|
|
52
|
+
if (isHandled)
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (!isConfigPattern(input) && deputy.isProduction && !input.production) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const baseDir = input.dir ?? dirname(containingFilePath);
|
|
60
|
+
const filePath = isAbsolute(specifier) ? specifier : join(baseDir, specifier);
|
|
61
|
+
const resolvedFilePath = _resolveSync(filePath, baseDir);
|
|
62
|
+
if (resolvedFilePath && isInternal(resolvedFilePath)) {
|
|
63
|
+
return isGitIgnored(resolvedFilePath) ? undefined : resolvedFilePath;
|
|
64
|
+
}
|
|
65
|
+
if (!isInternal(filePath)) {
|
|
66
|
+
collector.addIssue({
|
|
67
|
+
type: 'unlisted',
|
|
68
|
+
filePath: containingFilePath,
|
|
69
|
+
workspace: workspace.name,
|
|
70
|
+
symbol: packageName ?? specifier,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
else if (!isGitIgnored(filePath)) {
|
|
74
|
+
if (!isDeferResolveEntry(input) && !isConfigPattern(input)) {
|
|
75
|
+
collector.addIssue({
|
|
76
|
+
type: 'unresolved',
|
|
77
|
+
filePath: containingFilePath,
|
|
78
|
+
workspace: workspace.name,
|
|
79
|
+
symbol: specifier,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
debugLog(workspace.name, `Unable to resolve ${toDebugString(input)}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|