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
|
@@ -68,6 +68,7 @@ const pluginsSchema = z.object({
|
|
|
68
68
|
angular: pluginSchema,
|
|
69
69
|
ava: pluginSchema,
|
|
70
70
|
babel: pluginSchema,
|
|
71
|
+
c8: pluginSchema,
|
|
71
72
|
capacitor: pluginSchema,
|
|
72
73
|
changesets: pluginSchema,
|
|
73
74
|
commitizen: pluginSchema,
|
|
@@ -75,6 +76,7 @@ const pluginsSchema = z.object({
|
|
|
75
76
|
cspell: pluginSchema,
|
|
76
77
|
cucumber: pluginSchema,
|
|
77
78
|
cypress: pluginSchema,
|
|
79
|
+
dotenv: pluginSchema,
|
|
78
80
|
eleventy: pluginSchema,
|
|
79
81
|
eslint: pluginSchema,
|
|
80
82
|
gatsby: pluginSchema,
|
|
@@ -95,6 +97,8 @@ const pluginsSchema = z.object({
|
|
|
95
97
|
nest: pluginSchema,
|
|
96
98
|
netlify: pluginSchema,
|
|
97
99
|
next: pluginSchema,
|
|
100
|
+
node: pluginSchema,
|
|
101
|
+
nodemon: pluginSchema,
|
|
98
102
|
'node-test-runner': pluginSchema,
|
|
99
103
|
'npm-package-json-lint': pluginSchema,
|
|
100
104
|
nuxt: pluginSchema,
|
|
@@ -103,6 +107,7 @@ const pluginsSchema = z.object({
|
|
|
103
107
|
oclif: pluginSchema,
|
|
104
108
|
playwright: pluginSchema,
|
|
105
109
|
'playwright-ct': pluginSchema,
|
|
110
|
+
'playwright-test': pluginSchema,
|
|
106
111
|
postcss: pluginSchema,
|
|
107
112
|
preconstruct: pluginSchema,
|
|
108
113
|
prettier: pluginSchema,
|
|
@@ -124,7 +129,9 @@ const pluginsSchema = z.object({
|
|
|
124
129
|
syncpack: pluginSchema,
|
|
125
130
|
tailwind: pluginSchema,
|
|
126
131
|
travis: pluginSchema,
|
|
132
|
+
'ts-node': pluginSchema,
|
|
127
133
|
tsup: pluginSchema,
|
|
134
|
+
tsx: pluginSchema,
|
|
128
135
|
typedoc: pluginSchema,
|
|
129
136
|
typescript: pluginSchema,
|
|
130
137
|
unbuild: pluginSchema,
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -127,8 +127,10 @@ export class DependencyDeputy {
|
|
|
127
127
|
const typesPackageName = !isDefinitelyTyped(packageName) && getDefinitelyTypedFor(packageName);
|
|
128
128
|
const closestWorkspaceNameForTypes = typesPackageName && workspaceNames.find(name => this.isInDependencies(name, typesPackageName));
|
|
129
129
|
if (closestWorkspaceName || closestWorkspaceNameForTypes) {
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
if (closestWorkspaceName)
|
|
131
|
+
this.addReferencedDependency(closestWorkspaceName, packageName);
|
|
132
|
+
if (closestWorkspaceNameForTypes)
|
|
133
|
+
this.addReferencedDependency(closestWorkspaceNameForTypes, typesPackageName);
|
|
132
134
|
return true;
|
|
133
135
|
}
|
|
134
136
|
this.addReferencedDependency(workspace.name, packageName);
|
|
@@ -287,6 +289,7 @@ export class DependencyDeputy {
|
|
|
287
289
|
this.handleIgnoredDependencies(issues, counters, 'devDependencies');
|
|
288
290
|
this.handleIgnoredDependencies(issues, counters, 'optionalPeerDependencies');
|
|
289
291
|
this.handleIgnoredDependencies(issues, counters, 'unlisted');
|
|
292
|
+
this.handleIgnoredDependencies(issues, counters, 'unresolved');
|
|
290
293
|
this.handleIgnoredBinaries(issues, counters, 'binaries');
|
|
291
294
|
}
|
|
292
295
|
getConfigurationHints() {
|
|
@@ -1,32 +1,15 @@
|
|
|
1
|
-
import ts from 'typescript';
|
|
2
1
|
import { ProjectPrincipal } from './ProjectPrincipal.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type { ToSourceFilePath } from './util/to-source-path.js';
|
|
5
|
-
type Paths = ts.CompilerOptions['paths'];
|
|
2
|
+
import type { PrincipalOptions } from './types/project.js';
|
|
6
3
|
type Principal = {
|
|
7
4
|
principal: ProjectPrincipal;
|
|
8
|
-
|
|
5
|
+
wsDirs: Set<string>;
|
|
9
6
|
pathKeys: Set<string>;
|
|
10
7
|
pkgNames: Set<string>;
|
|
11
8
|
};
|
|
12
9
|
type Principals = Set<Principal>;
|
|
13
|
-
export type PrincipalOptions = {
|
|
14
|
-
cwd: string;
|
|
15
|
-
isFile: boolean;
|
|
16
|
-
compilerOptions: ts.CompilerOptions;
|
|
17
|
-
paths: Paths;
|
|
18
|
-
compilers: [SyncCompilers, AsyncCompilers];
|
|
19
|
-
pkgName: string;
|
|
20
|
-
isIsolateWorkspaces: boolean;
|
|
21
|
-
isSkipLibs: boolean;
|
|
22
|
-
isWatch: boolean;
|
|
23
|
-
toSourceFilePath: ToSourceFilePath;
|
|
24
|
-
isCache: boolean;
|
|
25
|
-
cacheLocation: string;
|
|
26
|
-
};
|
|
27
10
|
export declare class PrincipalFactory {
|
|
28
11
|
principals: Principals;
|
|
29
|
-
|
|
12
|
+
createPrincipal(options: PrincipalOptions): ProjectPrincipal;
|
|
30
13
|
private findReusablePrincipal;
|
|
31
14
|
private linkPrincipal;
|
|
32
15
|
private addNewPrincipal;
|
package/dist/PrincipalFactory.js
CHANGED
|
@@ -17,7 +17,7 @@ const mergePaths = (cwd, compilerOptions, paths = {}) => {
|
|
|
17
17
|
};
|
|
18
18
|
export class PrincipalFactory {
|
|
19
19
|
principals = new Set();
|
|
20
|
-
|
|
20
|
+
createPrincipal(options) {
|
|
21
21
|
const { cwd, compilerOptions, isFile, paths, pkgName, isIsolateWorkspaces, compilers } = options;
|
|
22
22
|
options.compilerOptions = mergePaths(cwd, compilerOptions, paths);
|
|
23
23
|
if (isFile && compilerOptions.module !== ts.ModuleKind.CommonJS)
|
|
@@ -50,14 +50,14 @@ export class PrincipalFactory {
|
|
|
50
50
|
principal.pathKeys.add(p);
|
|
51
51
|
principal.principal.addPaths(paths);
|
|
52
52
|
principal.principal.addCompilers(compilers);
|
|
53
|
-
principal.
|
|
53
|
+
principal.wsDirs.add(cwd);
|
|
54
54
|
principal.pkgNames.add(pkgName);
|
|
55
55
|
}
|
|
56
56
|
addNewPrincipal(options) {
|
|
57
57
|
const { cwd, compilerOptions, pkgName } = options;
|
|
58
58
|
const pathKeys = new Set(Object.keys(compilerOptions?.paths ?? {}));
|
|
59
59
|
const principal = new ProjectPrincipal(options);
|
|
60
|
-
this.principals.add({ principal,
|
|
60
|
+
this.principals.add({ principal, wsDirs: new Set([cwd]), pathKeys, pkgNames: new Set([pkgName]) });
|
|
61
61
|
return principal;
|
|
62
62
|
}
|
|
63
63
|
getPrincipals() {
|
|
@@ -69,7 +69,7 @@ export class PrincipalFactory {
|
|
|
69
69
|
deletePrincipal(principal) {
|
|
70
70
|
const p = Array.from(this.principals).find(p => p.principal === principal);
|
|
71
71
|
if (p) {
|
|
72
|
-
debugLog('*', `Deleting principal at ${[...p.
|
|
72
|
+
debugLog('*', `Deleting principal at ${[...p.wsDirs].map(cwd => toRelative(cwd) || '.')} (${[...p.pkgNames]})`);
|
|
73
73
|
this.principals.delete(p);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import { CacheConsultant } from './CacheConsultant.js';
|
|
3
|
-
import type { PrincipalOptions } from './PrincipalFactory.js';
|
|
4
|
-
import type { ReferencedDependencies } from './WorkspaceWorker.js';
|
|
5
3
|
import type { AsyncCompilers, SyncCompilers } from './compilers/types.js';
|
|
4
|
+
import type { GetImportsAndExportsOptions } from './types/config.js';
|
|
6
5
|
import type { DependencyGraph, Export, ExportMember, FileNode } from './types/dependency-graph.js';
|
|
6
|
+
import type { PrincipalOptions } from './types/project.js';
|
|
7
7
|
import type { SourceFileManager } from './typescript/SourceFileManager.js';
|
|
8
|
-
import { type GetImportsAndExportsOptions } from './typescript/get-imports-and-exports.js';
|
|
9
8
|
import type { ResolveModuleNames } from './typescript/resolve-module-names.js';
|
|
10
9
|
import type { ToSourceFilePath } from './util/to-source-path.js';
|
|
11
10
|
export declare class ProjectPrincipal {
|
|
12
11
|
entryPaths: Set<string>;
|
|
13
12
|
projectPaths: Set<string>;
|
|
14
13
|
nonEntryPaths: Set<string>;
|
|
15
|
-
referencedDependencies: Set<[string, string, string]>;
|
|
16
14
|
skipExportsAnalysis: Set<string>;
|
|
17
15
|
cwd: string;
|
|
18
16
|
compilerOptions: ts.CompilerOptions;
|
|
@@ -48,7 +46,6 @@ export declare class ProjectPrincipal {
|
|
|
48
46
|
addProjectPath(filePath: string): void;
|
|
49
47
|
deletedFiles: Set<unknown>;
|
|
50
48
|
removeProjectPath(filePath: string): void;
|
|
51
|
-
addReferencedDependencies(workspaceName: string, referencedDependencies: ReferencedDependencies): void;
|
|
52
49
|
runAsyncCompilers(): Promise<void>;
|
|
53
50
|
getUsedResolvedFiles(): string[];
|
|
54
51
|
private getProgramSourceFiles;
|
package/dist/ProjectPrincipal.js
CHANGED
|
@@ -30,7 +30,6 @@ export class ProjectPrincipal {
|
|
|
30
30
|
entryPaths = new Set();
|
|
31
31
|
projectPaths = new Set();
|
|
32
32
|
nonEntryPaths = new Set();
|
|
33
|
-
referencedDependencies = new Set();
|
|
34
33
|
skipExportsAnalysis = new Set();
|
|
35
34
|
cwd;
|
|
36
35
|
compilerOptions;
|
|
@@ -123,10 +122,6 @@ export class ProjectPrincipal {
|
|
|
123
122
|
this.invalidateFile(filePath);
|
|
124
123
|
this.deletedFiles.add(filePath);
|
|
125
124
|
}
|
|
126
|
-
addReferencedDependencies(workspaceName, referencedDependencies) {
|
|
127
|
-
for (const referencedDependency of referencedDependencies)
|
|
128
|
-
this.referencedDependencies.add([...referencedDependency, workspaceName]);
|
|
129
|
-
}
|
|
130
125
|
async runAsyncCompilers() {
|
|
131
126
|
const add = timerify(this.backend.fileManager.compileAndAddSourceFile.bind(this.backend.fileManager));
|
|
132
127
|
const extensions = Array.from(this.asyncCompilers.keys());
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { CacheConsultant } from './CacheConsultant.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PluginName } from './types/PluginNames.js';
|
|
3
|
+
import type { Configuration, WorkspaceConfiguration } from './types/config.js';
|
|
3
4
|
import type { PackageJson } from './types/package-json.js';
|
|
4
5
|
import type { DependencySet } from './types/workspace.js';
|
|
6
|
+
import { type Input } from './util/input.js';
|
|
5
7
|
type WorkspaceManagerOptions = {
|
|
6
8
|
name: string;
|
|
7
9
|
dir: string;
|
|
@@ -9,18 +11,20 @@ type WorkspaceManagerOptions = {
|
|
|
9
11
|
config: WorkspaceConfiguration;
|
|
10
12
|
manifest: PackageJson;
|
|
11
13
|
dependencies: DependencySet;
|
|
14
|
+
getReferencedInternalFilePath: (input: Input) => string | undefined;
|
|
12
15
|
rootIgnore: Configuration['ignore'];
|
|
13
16
|
negatedWorkspacePatterns: string[];
|
|
17
|
+
ignoredWorkspacePatterns: string[];
|
|
14
18
|
enabledPluginsInAncestors: string[];
|
|
15
19
|
isProduction: boolean;
|
|
16
20
|
isStrict: boolean;
|
|
17
21
|
isCache: boolean;
|
|
18
22
|
cacheLocation: string;
|
|
23
|
+
allConfigFilePaths: Set<string>;
|
|
19
24
|
};
|
|
20
|
-
export type ReferencedDependencies = Set<[string, string]>;
|
|
21
25
|
type CacheItem = {
|
|
22
|
-
resolveEntryPaths?:
|
|
23
|
-
resolveConfig?:
|
|
26
|
+
resolveEntryPaths?: Input[];
|
|
27
|
+
resolveConfig?: Input[];
|
|
24
28
|
};
|
|
25
29
|
export declare class WorkspaceWorker {
|
|
26
30
|
name: string;
|
|
@@ -28,17 +32,19 @@ export declare class WorkspaceWorker {
|
|
|
28
32
|
cwd: string;
|
|
29
33
|
config: WorkspaceConfiguration;
|
|
30
34
|
manifest: PackageJson;
|
|
31
|
-
manifestScriptNames: Set<string>;
|
|
32
35
|
dependencies: DependencySet;
|
|
36
|
+
getReferencedInternalFilePath: (input: Input) => string | undefined;
|
|
33
37
|
isProduction: boolean;
|
|
34
38
|
isStrict: boolean;
|
|
35
39
|
rootIgnore: Configuration['ignore'];
|
|
36
40
|
negatedWorkspacePatterns: string[];
|
|
37
|
-
|
|
41
|
+
ignoredWorkspacePatterns: string[];
|
|
42
|
+
enabledPluginsMap: Record<PluginName, boolean>;
|
|
38
43
|
enabledPlugins: PluginName[];
|
|
39
44
|
enabledPluginsInAncestors: string[];
|
|
40
45
|
cache: CacheConsultant<CacheItem>;
|
|
41
|
-
|
|
46
|
+
allConfigFilePaths: Set<string>;
|
|
47
|
+
constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, ignoredWorkspacePatterns, enabledPluginsInAncestors, getReferencedInternalFilePath, isCache, cacheLocation, allConfigFilePaths, }: WorkspaceManagerOptions);
|
|
42
48
|
init(): Promise<void>;
|
|
43
49
|
private determineEnabledPlugins;
|
|
44
50
|
private getConfigForPlugin;
|
|
@@ -46,16 +52,12 @@ export declare class WorkspaceWorker {
|
|
|
46
52
|
getProjectFilePatterns(projectFilePatterns: string[]): string[];
|
|
47
53
|
getPluginProjectFilePatterns(): string[];
|
|
48
54
|
getPluginConfigPatterns(): string[];
|
|
55
|
+
getPluginEntryFilePatterns(patterns: string[]): string[];
|
|
49
56
|
getProductionEntryFilePatterns(negatedTestFilePatterns: string[]): string[];
|
|
50
57
|
getProductionProjectFilePatterns(negatedTestFilePatterns: string[]): string[];
|
|
51
58
|
private getConfigurationFilePatterns;
|
|
52
59
|
getIgnorePatterns(): string[];
|
|
53
|
-
findDependenciesByPlugins(): Promise<
|
|
54
|
-
entryFilePatterns: Set<string>;
|
|
55
|
-
productionEntryFilePatterns: Set<string>;
|
|
56
|
-
referencedDependencies: ReferencedDependencies;
|
|
57
|
-
enabledPlugins: ("astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "ladle" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "nest" | "netlify" | "next" | "nuxt" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "preconstruct" | "prettier" | "remark" | "remix" | "rollup" | "rsbuild" | "rspack" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "travis" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vike" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "reactCosmos" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo")[];
|
|
58
|
-
}>;
|
|
60
|
+
findDependenciesByPlugins(): Promise<Input[]>;
|
|
59
61
|
onDispose(): void;
|
|
60
62
|
}
|
|
61
63
|
export {};
|
package/dist/WorkspaceWorker.js
CHANGED
|
@@ -1,42 +1,49 @@
|
|
|
1
1
|
import { CacheConsultant } from './CacheConsultant.js';
|
|
2
|
-
import {
|
|
2
|
+
import { _getInputsFromScripts } from './binaries/index.js';
|
|
3
|
+
import { getFilteredScripts } from './manifest/helpers.js';
|
|
4
|
+
import { PluginEntries, Plugins } from './plugins.js';
|
|
5
|
+
import { compact } from './util/array.js';
|
|
3
6
|
import { debugLogArray, debugLogObject } from './util/debug.js';
|
|
4
7
|
import { _glob, hasNoProductionSuffix, hasProductionSuffix, negate, prependDirToPattern } from './util/glob.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
8
|
+
import { isConfigPattern, toDebugString, toEntry } from './util/input.js';
|
|
9
|
+
import { getKeysByValue } from './util/object.js';
|
|
10
|
+
import { basename, dirname, join } from './util/path.js';
|
|
7
11
|
import { getFinalEntryPaths, loadConfigForPlugin } from './util/plugin.js';
|
|
8
|
-
import { fromEntryPattern, fromProductionEntryPattern, isEntryPattern, isProductionEntryPattern, } from './util/protocols.js';
|
|
9
12
|
const nullConfig = { config: null, entry: null, project: null };
|
|
10
|
-
const initEnabledPluginsMap = () => Object.keys(
|
|
13
|
+
const initEnabledPluginsMap = () => Object.keys(Plugins).reduce((enabled, pluginName) => ({ ...enabled, [pluginName]: false }), {});
|
|
11
14
|
export class WorkspaceWorker {
|
|
12
15
|
name;
|
|
13
16
|
dir;
|
|
14
17
|
cwd;
|
|
15
18
|
config;
|
|
16
19
|
manifest;
|
|
17
|
-
manifestScriptNames;
|
|
18
20
|
dependencies;
|
|
21
|
+
getReferencedInternalFilePath;
|
|
19
22
|
isProduction;
|
|
20
23
|
isStrict;
|
|
21
24
|
rootIgnore;
|
|
22
25
|
negatedWorkspacePatterns = [];
|
|
26
|
+
ignoredWorkspacePatterns = [];
|
|
23
27
|
enabledPluginsMap = initEnabledPluginsMap();
|
|
24
28
|
enabledPlugins = [];
|
|
25
29
|
enabledPluginsInAncestors;
|
|
26
30
|
cache;
|
|
27
|
-
|
|
31
|
+
allConfigFilePaths;
|
|
32
|
+
constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, ignoredWorkspacePatterns, enabledPluginsInAncestors, getReferencedInternalFilePath, isCache, cacheLocation, allConfigFilePaths, }) {
|
|
28
33
|
this.name = name;
|
|
29
34
|
this.dir = dir;
|
|
30
35
|
this.cwd = cwd;
|
|
31
36
|
this.config = config;
|
|
32
37
|
this.manifest = manifest;
|
|
33
|
-
this.manifestScriptNames = new Set(Object.keys(manifest.scripts ?? {}));
|
|
34
38
|
this.dependencies = dependencies;
|
|
35
39
|
this.isProduction = isProduction;
|
|
36
40
|
this.isStrict = isStrict;
|
|
37
41
|
this.rootIgnore = rootIgnore;
|
|
38
42
|
this.negatedWorkspacePatterns = negatedWorkspacePatterns;
|
|
43
|
+
this.ignoredWorkspacePatterns = ignoredWorkspacePatterns;
|
|
39
44
|
this.enabledPluginsInAncestors = enabledPluginsInAncestors;
|
|
45
|
+
this.allConfigFilePaths = allConfigFilePaths;
|
|
46
|
+
this.getReferencedInternalFilePath = getReferencedInternalFilePath;
|
|
40
47
|
this.cache = new CacheConsultant({ name: `plugins-${name}`, isEnabled: isCache, cacheLocation });
|
|
41
48
|
}
|
|
42
49
|
async init() {
|
|
@@ -44,8 +51,7 @@ export class WorkspaceWorker {
|
|
|
44
51
|
}
|
|
45
52
|
async determineEnabledPlugins() {
|
|
46
53
|
const manifest = this.manifest;
|
|
47
|
-
const
|
|
48
|
-
for (const [pluginName, plugin] of pluginEntries) {
|
|
54
|
+
for (const [pluginName, plugin] of PluginEntries) {
|
|
49
55
|
if (this.config[pluginName] === false)
|
|
50
56
|
continue;
|
|
51
57
|
if (this.config[pluginName]) {
|
|
@@ -54,12 +60,13 @@ export class WorkspaceWorker {
|
|
|
54
60
|
}
|
|
55
61
|
const isEnabledInAncestor = this.enabledPluginsInAncestors.includes(pluginName);
|
|
56
62
|
if (isEnabledInAncestor ||
|
|
57
|
-
(
|
|
63
|
+
(typeof plugin.isEnabled === 'function' &&
|
|
64
|
+
(await plugin.isEnabled({ cwd: this.dir, manifest, dependencies: this.dependencies, config: this.config })))) {
|
|
58
65
|
this.enabledPluginsMap[pluginName] = true;
|
|
59
66
|
}
|
|
60
67
|
}
|
|
61
68
|
const enabledPlugins = getKeysByValue(this.enabledPluginsMap, true);
|
|
62
|
-
const enabledPluginTitles = enabledPlugins.map(name =>
|
|
69
|
+
const enabledPluginTitles = enabledPlugins.map(name => Plugins[name].title);
|
|
63
70
|
debugLogObject(this.name, 'Enabled plugins', enabledPluginTitles);
|
|
64
71
|
return enabledPlugins;
|
|
65
72
|
}
|
|
@@ -91,7 +98,7 @@ export class WorkspaceWorker {
|
|
|
91
98
|
}
|
|
92
99
|
getPluginProjectFilePatterns() {
|
|
93
100
|
const patterns = [];
|
|
94
|
-
for (const [pluginName, plugin] of
|
|
101
|
+
for (const [pluginName, plugin] of PluginEntries) {
|
|
95
102
|
const pluginConfig = this.getConfigForPlugin(pluginName);
|
|
96
103
|
if (this.enabledPluginsMap[pluginName]) {
|
|
97
104
|
const { entry, project } = pluginConfig;
|
|
@@ -102,7 +109,7 @@ export class WorkspaceWorker {
|
|
|
102
109
|
}
|
|
103
110
|
getPluginConfigPatterns() {
|
|
104
111
|
const patterns = [];
|
|
105
|
-
for (const [pluginName, plugin] of
|
|
112
|
+
for (const [pluginName, plugin] of PluginEntries) {
|
|
106
113
|
const pluginConfig = this.getConfigForPlugin(pluginName);
|
|
107
114
|
if (this.enabledPluginsMap[pluginName] && pluginConfig) {
|
|
108
115
|
const { config } = pluginConfig;
|
|
@@ -111,6 +118,9 @@ export class WorkspaceWorker {
|
|
|
111
118
|
}
|
|
112
119
|
return patterns;
|
|
113
120
|
}
|
|
121
|
+
getPluginEntryFilePatterns(patterns) {
|
|
122
|
+
return [patterns, this.ignoredWorkspacePatterns.map(negate)].flat();
|
|
123
|
+
}
|
|
114
124
|
getProductionEntryFilePatterns(negatedTestFilePatterns) {
|
|
115
125
|
const entry = this.config.entry.filter(hasProductionSuffix);
|
|
116
126
|
if (entry.length === 0)
|
|
@@ -140,115 +150,144 @@ export class WorkspaceWorker {
|
|
|
140
150
|
].flat();
|
|
141
151
|
}
|
|
142
152
|
getConfigurationFilePatterns(pluginName) {
|
|
143
|
-
const plugin =
|
|
153
|
+
const plugin = Plugins[pluginName];
|
|
144
154
|
const pluginConfig = this.getConfigForPlugin(pluginName);
|
|
145
|
-
|
|
146
|
-
return pluginConfig.config ?? plugin.config ?? [];
|
|
147
|
-
}
|
|
148
|
-
return [];
|
|
155
|
+
return pluginConfig.config ?? plugin.config ?? [];
|
|
149
156
|
}
|
|
150
157
|
getIgnorePatterns() {
|
|
151
158
|
return [...this.rootIgnore, ...this.config.ignore.map(pattern => prependDirToPattern(this.name, pattern))];
|
|
152
159
|
}
|
|
153
160
|
async findDependenciesByPlugins() {
|
|
154
|
-
const entryFilePatterns = new Set();
|
|
155
|
-
const productionEntryFilePatterns = new Set();
|
|
156
|
-
const referencedDependencies = new Set();
|
|
157
161
|
const name = this.name;
|
|
158
162
|
const cwd = this.dir;
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
const rootCwd = this.cwd;
|
|
164
|
+
const manifest = this.manifest;
|
|
165
|
+
const containingFilePath = join(cwd, 'package.json');
|
|
166
|
+
const isProduction = this.isProduction;
|
|
167
|
+
const knownBinsOnly = false;
|
|
168
|
+
const manifestScriptNames = new Set(Object.keys(manifest.scripts ?? {}));
|
|
169
|
+
const baseOptions = { manifestScriptNames, cwd, rootCwd, containingFilePath, knownBinsOnly };
|
|
170
|
+
const baseScriptOptions = { ...baseOptions, manifest, isProduction, enabledPlugins: this.enabledPlugins };
|
|
171
|
+
const [productionScripts, developmentScripts] = getFilteredScripts(manifest.scripts ?? {});
|
|
172
|
+
const inputsFromManifest = _getInputsFromScripts(Object.values(developmentScripts), baseOptions);
|
|
173
|
+
const productionInputsFromManifest = _getInputsFromScripts(Object.values(productionScripts), baseOptions);
|
|
174
|
+
const hasProductionInput = (input) => productionInputsFromManifest.find(d => d.specifier === input.specifier && d.type === input.type);
|
|
175
|
+
const getInputsFromScripts = (scripts, options) => _getInputsFromScripts(scripts, { ...baseScriptOptions, ...options });
|
|
176
|
+
const inputs = [];
|
|
177
|
+
const configFiles = new Map();
|
|
178
|
+
const remainingPlugins = new Set(this.enabledPlugins);
|
|
179
|
+
const addInput = (input, containingFilePath = input.containingFilePath) => inputs.push({ ...input, containingFilePath });
|
|
180
|
+
const handleConfigInput = (pluginName, dependency) => {
|
|
181
|
+
const configFilePath = this.getReferencedInternalFilePath(dependency);
|
|
182
|
+
if (configFilePath) {
|
|
183
|
+
if (!configFiles.has(pluginName))
|
|
184
|
+
configFiles.set(pluginName, new Set());
|
|
185
|
+
configFiles.get(pluginName)?.add(configFilePath);
|
|
186
|
+
addInput(toEntry(dependency.specifier), dependency.containingFilePath);
|
|
187
|
+
}
|
|
167
188
|
};
|
|
168
|
-
for (const [
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
189
|
+
for (const input of [...inputsFromManifest, ...productionInputsFromManifest]) {
|
|
190
|
+
if (isConfigPattern(input)) {
|
|
191
|
+
handleConfigInput(input.pluginName, { ...input, containingFilePath });
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
if (!isProduction)
|
|
195
|
+
addInput(input, containingFilePath);
|
|
196
|
+
else if (isProduction && (input.production || hasProductionInput(input)))
|
|
197
|
+
addInput(input, containingFilePath);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const runPlugin = async (pluginName, patterns) => {
|
|
201
|
+
const plugin = Plugins[pluginName];
|
|
202
|
+
const hasResolveEntryPaths = typeof plugin.resolveEntryPaths === 'function';
|
|
203
|
+
const hasResolveConfig = typeof plugin.resolveConfig === 'function';
|
|
204
|
+
const shouldRunConfigResolver = hasResolveConfig && (!isProduction || (isProduction && 'production' in plugin));
|
|
205
|
+
const hasResolve = typeof plugin.resolve === 'function';
|
|
206
|
+
const config = this.getConfigForPlugin(pluginName);
|
|
207
|
+
if (!config)
|
|
208
|
+
return;
|
|
209
|
+
const configFilePaths = await _glob({ patterns, cwd: baseScriptOptions.rootCwd, dir: cwd, gitignore: false });
|
|
210
|
+
const remainingConfigFilePaths = configFilePaths.filter(filePath => !this.allConfigFilePaths.has(filePath));
|
|
211
|
+
for (const f of remainingConfigFilePaths)
|
|
212
|
+
if (basename(f) !== 'package.json')
|
|
213
|
+
this.allConfigFilePaths.add(f);
|
|
214
|
+
if (configFilePaths.length > 0)
|
|
184
215
|
debugLogArray([name, plugin.title], 'config file paths', configFilePaths);
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
216
|
+
const options = {
|
|
217
|
+
...baseScriptOptions,
|
|
218
|
+
config,
|
|
219
|
+
configFilePath: containingFilePath,
|
|
220
|
+
configFileDir: cwd,
|
|
221
|
+
configFileName: '',
|
|
222
|
+
getInputsFromScripts,
|
|
223
|
+
};
|
|
224
|
+
const configEntryPaths = [];
|
|
225
|
+
for (const configFilePath of remainingConfigFilePaths) {
|
|
226
|
+
const opts = {
|
|
227
|
+
...options,
|
|
228
|
+
configFilePath,
|
|
229
|
+
configFileDir: dirname(configFilePath),
|
|
230
|
+
configFileName: basename(configFilePath),
|
|
197
231
|
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (fd
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
for (const id of dependencies)
|
|
226
|
-
addDependency(id, configFilePath);
|
|
227
|
-
data.resolveConfig = dependencies;
|
|
232
|
+
if (hasResolveEntryPaths || shouldRunConfigResolver) {
|
|
233
|
+
const isManifest = basename(configFilePath) === 'package.json';
|
|
234
|
+
const fd = isManifest ? undefined : this.cache.getFileDescriptor(configFilePath);
|
|
235
|
+
if (fd?.meta?.data && !fd.changed) {
|
|
236
|
+
if (fd.meta.data.resolveEntryPaths)
|
|
237
|
+
for (const id of fd.meta.data.resolveEntryPaths)
|
|
238
|
+
configEntryPaths.push(id);
|
|
239
|
+
if (fd.meta.data.resolveConfig)
|
|
240
|
+
for (const id of fd.meta.data.resolveConfig)
|
|
241
|
+
addInput(id, configFilePath);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
const config = await loadConfigForPlugin(configFilePath, plugin, opts, pluginName);
|
|
245
|
+
const data = {};
|
|
246
|
+
if (config) {
|
|
247
|
+
if (hasResolveEntryPaths) {
|
|
248
|
+
const entryPaths = (await plugin.resolveEntryPaths?.(config, opts)) ?? [];
|
|
249
|
+
for (const entryPath of entryPaths)
|
|
250
|
+
configEntryPaths.push(entryPath);
|
|
251
|
+
data.resolveEntryPaths = entryPaths;
|
|
252
|
+
}
|
|
253
|
+
if (shouldRunConfigResolver) {
|
|
254
|
+
const inputs = (await plugin.resolveConfig?.(config, opts)) ?? [];
|
|
255
|
+
for (const input of inputs) {
|
|
256
|
+
if (isConfigPattern(input))
|
|
257
|
+
handleConfigInput(input.pluginName, { ...input, containingFilePath: configFilePath });
|
|
258
|
+
addInput(input, configFilePath);
|
|
228
259
|
}
|
|
229
|
-
|
|
230
|
-
fd.meta.data = data;
|
|
260
|
+
data.resolveConfig = inputs;
|
|
231
261
|
}
|
|
262
|
+
if (!isManifest && fd?.changed && fd.meta)
|
|
263
|
+
fd.meta.data = data;
|
|
232
264
|
}
|
|
233
265
|
}
|
|
234
266
|
}
|
|
235
|
-
const finalEntryPaths = getFinalEntryPaths(plugin, options, configEntryPaths);
|
|
236
|
-
for (const id of finalEntryPaths)
|
|
237
|
-
addDependency(id);
|
|
238
|
-
if (hasResolve) {
|
|
239
|
-
const dependencies = (await plugin.resolve?.(options)) ?? [];
|
|
240
|
-
for (const id of dependencies)
|
|
241
|
-
addDependency(id, join(cwd, 'package.json'));
|
|
242
|
-
}
|
|
243
|
-
debugLogArray([name, plugin.title], 'dependencies', pluginDependencies);
|
|
244
267
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
268
|
+
const finalEntryPaths = getFinalEntryPaths(plugin, options, configEntryPaths);
|
|
269
|
+
for (const id of finalEntryPaths)
|
|
270
|
+
addInput(id, id.containingFilePath ?? containingFilePath);
|
|
271
|
+
if (hasResolve) {
|
|
272
|
+
const dependencies = (await plugin.resolve?.(options)) ?? [];
|
|
273
|
+
for (const id of dependencies)
|
|
274
|
+
addInput(id, containingFilePath);
|
|
275
|
+
}
|
|
251
276
|
};
|
|
277
|
+
for (const pluginName of this.enabledPlugins) {
|
|
278
|
+
const patterns = [...this.getConfigurationFilePatterns(pluginName), ...(configFiles.get(pluginName) ?? [])];
|
|
279
|
+
configFiles.delete(pluginName);
|
|
280
|
+
await runPlugin(pluginName, compact(patterns));
|
|
281
|
+
remainingPlugins.delete(pluginName);
|
|
282
|
+
}
|
|
283
|
+
do {
|
|
284
|
+
for (const [pluginName, dependencies] of configFiles.entries()) {
|
|
285
|
+
configFiles.delete(pluginName);
|
|
286
|
+
await runPlugin(pluginName, Array.from(dependencies));
|
|
287
|
+
}
|
|
288
|
+
} while (remainingPlugins.size > 0 && configFiles.size > 0);
|
|
289
|
+
debugLogArray(name, 'Plugin dependencies', () => compact(inputs.map(toDebugString)));
|
|
290
|
+
return inputs;
|
|
252
291
|
}
|
|
253
292
|
onDispose() {
|
|
254
293
|
this.cache.reconcile();
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { GetInputsFromScriptsOptions } from '../types/config.js';
|
|
2
|
+
import { type Input } from '../util/input.js';
|
|
3
|
+
export declare const getDependenciesFromScript: (script: string, options: GetInputsFromScriptsOptions) => Input[];
|