knip 6.44.1 → 6.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConfigurationChief.d.ts +23 -1033
- package/dist/ConfigurationChief.js +71 -15
- package/dist/DependencyDeputy.d.ts +10 -6
- package/dist/DependencyDeputy.js +51 -27
- package/dist/IssueCollector.d.ts +14 -11
- package/dist/IssueCollector.js +25 -20
- package/dist/IssueFixer.js +1 -1
- package/dist/PackagePeeker.d.ts +6 -0
- package/dist/PackagePeeker.js +43 -14
- package/dist/ProjectPrincipal.d.ts +6 -3
- package/dist/ProjectPrincipal.js +83 -32
- package/dist/WorkspaceWorker.d.ts +5 -1
- package/dist/WorkspaceWorker.js +39 -22
- package/dist/binaries/bash-parser.js +1 -7
- package/dist/binaries/command.d.ts +3 -3
- package/dist/binaries/command.js +6 -2
- package/dist/binaries/fallback.js +1 -1
- package/dist/binaries/plugins.d.ts +4 -1
- package/dist/binaries/plugins.js +66 -18
- package/dist/binaries/resolvers/bun.js +2 -2
- package/dist/binaries/resolvers/index.d.ts +1 -0
- package/dist/binaries/resolvers/index.js +2 -0
- package/dist/binaries/resolvers/npm.js +7 -5
- package/dist/binaries/resolvers/npx.js +15 -12
- package/dist/binaries/resolvers/nub.js +2 -2
- package/dist/binaries/resolvers/vp.d.ts +2 -0
- package/dist/binaries/resolvers/vp.js +52 -0
- package/dist/binaries/util.d.ts +13 -1
- package/dist/binaries/util.js +35 -1
- package/dist/cli.js +10 -84
- package/dist/compilers/scss.js +2 -1
- package/dist/configuration-hints.d.ts +16 -0
- package/dist/configuration-hints.js +64 -0
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +37 -0
- package/dist/graph/SubpathReferences.d.ts +33 -0
- package/dist/graph/SubpathReferences.js +114 -0
- package/dist/graph/analyze.d.ts +4 -1
- package/dist/graph/analyze.js +16 -5
- package/dist/graph/build.d.ts +3 -1
- package/dist/graph/build.js +47 -23
- package/dist/graph-explorer/operations/resolve-export-origins.js +1 -1
- package/dist/plugins/angular/index.js +10 -17
- package/dist/plugins/aws-cdk/index.d.ts +3 -0
- package/dist/plugins/aws-cdk/index.js +32 -0
- package/dist/plugins/aws-cdk/types.d.ts +5 -0
- package/dist/plugins/aws-cdk/types.js +1 -0
- package/dist/plugins/babel/index.d.ts +1 -1
- package/dist/plugins/babel/index.js +25 -6
- package/dist/plugins/babel/types.d.ts +1 -0
- package/dist/plugins/bun/index.js +8 -7
- package/dist/plugins/c8/index.js +17 -4
- package/dist/plugins/changesets/index.js +3 -2
- package/dist/plugins/commitizen/index.js +6 -3
- package/dist/plugins/commitlint/index.js +10 -11
- package/dist/plugins/cypress/index.js +4 -2
- package/dist/plugins/danger/index.js +1 -1
- package/dist/plugins/docusaurus/helpers.js +6 -6
- package/dist/plugins/docusaurus/index.js +2 -2
- package/dist/plugins/electron-forge/index.js +2 -2
- package/dist/plugins/electron-vite/index.js +2 -2
- package/dist/plugins/eleventy/index.js +3 -2
- package/dist/plugins/eslint/helpers.js +4 -3
- package/dist/plugins/eslint/resolveFromAST.js +2 -2
- package/dist/plugins/evalite/index.d.ts +3 -0
- package/dist/plugins/evalite/index.js +26 -0
- package/dist/plugins/flue/index.js +2 -2
- package/dist/plugins/gatsby/index.js +1 -1
- package/dist/plugins/github-action/index.js +2 -2
- package/dist/plugins/github-actions/index.js +2 -2
- package/dist/plugins/graphql-codegen/index.js +13 -9
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +10 -0
- package/dist/plugins/jest/index.js +5 -5
- package/dist/plugins/knex/index.js +2 -2
- package/dist/plugins/laravel-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/lunaria/index.js +5 -2
- package/dist/plugins/markdownlint/index.js +8 -2
- package/dist/plugins/marko/index.js +2 -2
- package/dist/plugins/marko/taglibs.d.ts +1 -1
- package/dist/plugins/marko/taglibs.js +4 -28
- package/dist/plugins/mdx/index.d.ts +2 -1
- package/dist/plugins/mdx/index.js +7 -4
- package/dist/plugins/mdxlint/index.js +18 -15
- package/dist/plugins/mikro-orm/index.d.ts +3 -0
- package/dist/plugins/mikro-orm/index.js +77 -0
- package/dist/plugins/mikro-orm/types.d.ts +21 -0
- package/dist/plugins/mikro-orm/types.js +1 -0
- package/dist/plugins/msw/index.js +6 -3
- package/dist/plugins/msw/types.d.ts +1 -1
- package/dist/plugins/netlify/index.js +7 -3
- package/dist/plugins/next/index.js +63 -9
- package/dist/plugins/next/types.d.ts +5 -0
- package/dist/plugins/next-mdx/resolveFromAST.js +15 -10
- package/dist/plugins/nitro/index.js +5 -6
- package/dist/plugins/node/index.js +4 -4
- package/dist/plugins/npm-package-json-lint/index.js +10 -3
- package/dist/plugins/nuxt/index.js +18 -10
- package/dist/plugins/nuxt/types.d.ts +4 -0
- package/dist/plugins/nx/index.js +6 -3
- package/dist/plugins/openclaw/index.js +11 -11
- package/dist/plugins/oxlint/index.js +2 -2
- package/dist/plugins/payload/index.js +1 -1
- package/dist/plugins/playwright/index.js +3 -3
- package/dist/plugins/pm2/index.js +7 -7
- package/dist/plugins/prettier/index.js +2 -1
- package/dist/plugins/prisma/index.js +2 -2
- package/dist/plugins/quasar/resolveFromAST.js +14 -9
- package/dist/plugins/react-router/index.js +12 -15
- package/dist/plugins/release-it/index.js +6 -2
- package/dist/plugins/remix/index.js +3 -3
- package/dist/plugins/retry-cli/index.d.ts +3 -0
- package/dist/plugins/retry-cli/index.js +14 -0
- package/dist/plugins/rollup/index.js +1 -4
- package/dist/plugins/rstest/index.js +3 -3
- package/dist/plugins/semantic-release/index.js +3 -3
- package/dist/plugins/serverless-framework/index.js +10 -8
- package/dist/plugins/solidjs-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/stencil/resolveFromAST.js +5 -5
- package/dist/plugins/storybook/index.js +9 -3
- package/dist/plugins/stryker/index.js +2 -2
- package/dist/plugins/stylelint/index.js +2 -2
- package/dist/plugins/swc/index.js +4 -3
- package/dist/plugins/tailwind/index.js +2 -2
- package/dist/plugins/tanstack-router/index.js +2 -2
- package/dist/plugins/ts-node/index.js +6 -1
- package/dist/plugins/turbo/index.js +3 -3
- package/dist/plugins/typedoc/index.js +2 -2
- package/dist/plugins/typescript/content-mappers.d.ts +1 -1
- package/dist/plugins/typescript/index.js +6 -9
- package/dist/plugins/unocss/index.js +3 -0
- package/dist/plugins/varlock/scan.js +1 -1
- package/dist/plugins/vite/helpers.d.ts +1 -0
- package/dist/plugins/vite/helpers.js +13 -3
- package/dist/plugins/vite/index.js +5 -2
- package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +2 -2
- package/dist/plugins/vitest/index.js +26 -18
- package/dist/plugins/vitest/types.d.ts +1 -0
- package/dist/plugins/vue/index.js +1 -1
- package/dist/plugins/web-test-runner/index.d.ts +3 -0
- package/dist/plugins/web-test-runner/index.js +86 -0
- package/dist/plugins/wrangler/index.js +3 -3
- package/dist/plugins/yarn/index.js +5 -5
- package/dist/plugins.js +2 -5
- package/dist/reporters/github-actions.js +3 -7
- package/dist/reporters/json.d.ts +1 -0
- package/dist/reporters/json.js +1 -0
- package/dist/reporters/util/configuration-hints.d.ts +3 -1
- package/dist/reporters/util/configuration-hints.js +40 -21
- package/dist/reporters/util/util.d.ts +1 -1
- package/dist/run-cli.d.ts +2 -0
- package/dist/run-cli.js +82 -0
- package/dist/run.js +12 -0
- package/dist/session/incremental.d.ts +1 -0
- package/dist/session/incremental.js +1 -0
- package/dist/session/watch.js +2 -1
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +5 -0
- package/dist/types/args.d.ts +3 -1
- package/dist/types/config.d.ts +17 -10
- package/dist/types/configuration.d.ts +45 -0
- package/dist/types/configuration.js +1 -0
- package/dist/types/issues.d.ts +4 -0
- package/dist/types/module-graph.d.ts +1 -0
- package/dist/types/options.d.ts +1 -0
- package/dist/types/package-json.d.ts +3 -8
- package/dist/types/workspace.d.ts +1 -0
- package/dist/typescript/get-imports-and-exports.js +18 -6
- package/dist/typescript/resolve-module-names.js +7 -45
- package/dist/typescript/visitors/calls.d.ts +1 -1
- package/dist/typescript/visitors/calls.js +14 -10
- package/dist/typescript/visitors/exports.js +16 -26
- package/dist/typescript/visitors/imports.d.ts +2 -1
- package/dist/typescript/visitors/imports.js +41 -24
- package/dist/typescript/visitors/members.d.ts +1 -1
- package/dist/typescript/visitors/members.js +38 -24
- package/dist/typescript/visitors/shadow.d.ts +2 -0
- package/dist/typescript/visitors/shadow.js +25 -0
- package/dist/typescript/visitors/walk.d.ts +20 -12
- package/dist/typescript/visitors/walk.js +78 -48
- package/dist/util/Performance.d.ts +25 -3
- package/dist/util/Performance.js +51 -27
- package/dist/util/cli-arguments.d.ts +2 -1
- package/dist/util/cli-arguments.js +5 -3
- package/dist/util/create-input-handler.js +138 -119
- package/dist/util/create-options.d.ts +4 -2071
- package/dist/util/create-options.js +6 -4
- package/dist/util/create-workspace-graph.js +2 -1
- package/dist/util/errors.d.ts +5 -2
- package/dist/util/errors.js +11 -18
- package/dist/util/fs.js +4 -2
- package/dist/util/input.d.ts +2 -2
- package/dist/util/input.js +2 -2
- package/dist/util/is-plugin-name.d.ts +2 -0
- package/dist/util/is-plugin-name.js +3 -0
- package/dist/util/jiti.d.ts +2 -1
- package/dist/util/jiti.js +11 -3
- package/dist/util/load-config.d.ts +1 -1
- package/dist/util/load-config.js +3 -2
- package/dist/util/loader.js +3 -2
- package/dist/util/map-workspaces.js +23 -1
- package/dist/util/module-graph.js +1 -0
- package/dist/util/modules.d.ts +2 -0
- package/dist/util/modules.js +78 -0
- package/dist/util/package-json.d.ts +12 -5
- package/dist/util/package-json.js +54 -26
- package/dist/util/parse-and-convert-gitignores.d.ts +2 -2
- package/dist/util/parse-and-convert-gitignores.js +5 -5
- package/dist/util/parse-configuration.d.ts +2 -0
- package/dist/util/parse-configuration.js +66 -0
- package/dist/util/plugin.js +8 -12
- package/dist/util/resolve.d.ts +1 -0
- package/dist/util/resolve.js +3 -2
- package/dist/util/scripts.d.ts +0 -5
- package/dist/util/scripts.js +1 -32
- package/dist/util/to-source-path.d.ts +4 -1
- package/dist/util/to-source-path.js +2 -2
- package/dist/util/unhandled-rejection.d.ts +8 -0
- package/dist/util/unhandled-rejection.js +29 -0
- package/dist/util/validation.d.ts +11 -0
- package/dist/util/validation.js +68 -0
- package/dist/util/watch.d.ts +3 -1
- package/dist/util/watch.js +5 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +9 -10
- package/schema.json +34 -0
- package/dist/schema/configuration.d.ts +0 -3103
- package/dist/schema/configuration.js +0 -94
- package/dist/schema/plugins.d.ts +0 -1019
- package/dist/schema/plugins.js +0 -215
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toConfig, toDeferResolve } from '../../util/input.js';
|
|
1
|
+
import { toConfig, toDeferResolve, toDependency } from '../../util/input.js';
|
|
2
2
|
import { isInternal } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
import { toCosmiconfig } from '../../util/plugin-config.js';
|
|
@@ -20,7 +20,7 @@ const resolveConfig = (config, options) => {
|
|
|
20
20
|
if (isInternal(id))
|
|
21
21
|
inputs.push(toConfig('semantic-release', id, { containingFilePath: options.configFilePath }));
|
|
22
22
|
else
|
|
23
|
-
inputs.push(
|
|
23
|
+
inputs.push(toDependency(id));
|
|
24
24
|
}
|
|
25
25
|
const plugins = (config?.plugins ?? []).map(plugin => (Array.isArray(plugin) ? plugin[0] : plugin));
|
|
26
26
|
for (const id of plugins.filter(plugin => !excludePackages.includes(plugin)))
|
|
@@ -39,7 +39,7 @@ const args = {
|
|
|
39
39
|
if (isInternal(id))
|
|
40
40
|
inputs.push(toConfig('semantic-release', id, { dir: cwd }));
|
|
41
41
|
else
|
|
42
|
-
inputs.push(
|
|
42
|
+
inputs.push(toDependency(id));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
return inputs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { arrayify } from '../../util/array.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toDeferResolveProductionEntry, toDependency } from '../../util/input.js';
|
|
3
3
|
import { _load } from '../../util/loader.js';
|
|
4
4
|
import { get } from '../../util/object.js';
|
|
5
5
|
import { isInternal, join, toAbsolute } from '../../util/path.js';
|
|
@@ -22,13 +22,13 @@ const resolveFileVariable = async (value, dir) => {
|
|
|
22
22
|
return undefined;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const handlerToEntry = (handler) => {
|
|
25
|
+
const handlerToEntry = (handler, dir) => {
|
|
26
26
|
const dot = handler.lastIndexOf('.');
|
|
27
27
|
const file = handler.slice(0, dot);
|
|
28
|
-
return
|
|
28
|
+
return toDeferResolveProductionEntry(file, { dir });
|
|
29
29
|
};
|
|
30
|
-
const pluginToInput = (plugin, dir) => isInternal(plugin) ?
|
|
31
|
-
const getFunctionEntries = async (functions, dir) => {
|
|
30
|
+
const pluginToInput = (plugin, dir) => isInternal(plugin) ? toDeferResolveProductionEntry(toAbsolute(plugin, dir)) : toDependency(plugin);
|
|
31
|
+
const getFunctionEntries = async (functions, dir, cwd) => {
|
|
32
32
|
const entries = [];
|
|
33
33
|
const resolved = await resolveFileVariable(functions, dir);
|
|
34
34
|
for (const group of Array.isArray(resolved) ? resolved : [resolved]) {
|
|
@@ -38,14 +38,16 @@ const getFunctionEntries = async (functions, dir) => {
|
|
|
38
38
|
for (const name in fns) {
|
|
39
39
|
const fn = await resolveFileVariable(fns[name], dir);
|
|
40
40
|
if (isRecord(fn) && typeof fn.handler === 'string')
|
|
41
|
-
entries.push(handlerToEntry(fn.handler));
|
|
41
|
+
entries.push(handlerToEntry(fn.handler, cwd));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
return entries;
|
|
45
45
|
};
|
|
46
|
-
const getInjectEntries = (esbuild, dir) => esbuild && typeof esbuild === 'object'
|
|
46
|
+
const getInjectEntries = (esbuild, dir) => esbuild && typeof esbuild === 'object'
|
|
47
|
+
? arrayify(esbuild.inject).map(id => toDeferResolveProductionEntry(join(dir, id)))
|
|
48
|
+
: [];
|
|
47
49
|
export const resolveConfig = async (config, options) => {
|
|
48
|
-
const functions = await getFunctionEntries(config.functions, options.configFileDir);
|
|
50
|
+
const functions = await getFunctionEntries(config.functions, options.configFileDir, options.cwd);
|
|
49
51
|
const resolvedPlugins = await resolveFileVariable(config.plugins, options.configFileDir);
|
|
50
52
|
const plugins = Array.isArray(resolvedPlugins)
|
|
51
53
|
? resolvedPlugins.filter((plugin) => typeof plugin === 'string')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { findImportedCalls, findProperty } from '../../typescript/ast-helpers.js';
|
|
2
2
|
import { getStringValue } from '../../typescript/ast-nodes.js';
|
|
3
3
|
import { isFile } from '../../util/fs.js';
|
|
4
|
-
import { toProductionEntry } from '../../util/input.js';
|
|
4
|
+
import { toDeferResolveProductionEntry, toProductionEntry } from '../../util/input.js';
|
|
5
5
|
import { join, toAbsolute } from '../../util/path.js';
|
|
6
6
|
import { getViteRoot } from '../vite/helpers.js';
|
|
7
7
|
const entryExtensions = ['tsx', 'jsx', 'ts', 'js', 'mjs', 'tsrx'];
|
|
@@ -71,6 +71,6 @@ export const resolveFromAST = (program, options) => {
|
|
|
71
71
|
for (const pattern of patterns)
|
|
72
72
|
inputs.push(toProductionEntry(join(root, pattern)));
|
|
73
73
|
for (const id of paths)
|
|
74
|
-
inputs.push(
|
|
74
|
+
inputs.push(toDeferResolveProductionEntry(toAbsolute(id, root)));
|
|
75
75
|
return inputs;
|
|
76
76
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Visitor } from 'oxc-parser';
|
|
2
2
|
import { collectFirstPropertyValue, collectPropertyValues, getPropertyValues } from '../../typescript/ast-helpers.js';
|
|
3
|
-
import { toConfig, toEntry, toProductionEntry } from '../../util/input.js';
|
|
3
|
+
import { toConfig, toDeferResolveProductionEntry, toEntry, toProductionEntry } from '../../util/input.js';
|
|
4
4
|
export const entry = ['**/*.spec.{ts,tsx}', '**/*.e2e.{ts,tsx}'];
|
|
5
|
-
export const resolveFromAST = program => {
|
|
5
|
+
export const resolveFromAST = (program, { cwd }) => {
|
|
6
6
|
const inputs = [];
|
|
7
7
|
const srcDir = collectFirstPropertyValue(program, 'srcDir') ?? 'src';
|
|
8
8
|
inputs.push(toProductionEntry(`${srcDir}/**/*.tsx`));
|
|
9
9
|
for (const pattern of entry)
|
|
10
10
|
inputs.push(toEntry(pattern));
|
|
11
11
|
for (const script of collectPropertyValues(program, 'globalScript')) {
|
|
12
|
-
inputs.push(
|
|
12
|
+
inputs.push(toDeferResolveProductionEntry(script, { dir: cwd }));
|
|
13
13
|
}
|
|
14
14
|
for (const style of collectPropertyValues(program, 'globalStyle')) {
|
|
15
|
-
inputs.push(
|
|
15
|
+
inputs.push(toDeferResolveProductionEntry(style, { dir: cwd }));
|
|
16
16
|
}
|
|
17
17
|
new Visitor({
|
|
18
18
|
ObjectExpression(node) {
|
|
@@ -20,7 +20,7 @@ export const resolveFromAST = program => {
|
|
|
20
20
|
if (!typeValues.has('global-style'))
|
|
21
21
|
return;
|
|
22
22
|
for (const input of getPropertyValues(node, 'input'))
|
|
23
|
-
inputs.push(
|
|
23
|
+
inputs.push(toDeferResolveProductionEntry(input, { dir: cwd }));
|
|
24
24
|
},
|
|
25
25
|
}).visit(program);
|
|
26
26
|
for (const tsconfig of collectPropertyValues(program, 'tsconfig')) {
|
|
@@ -6,11 +6,17 @@ import { getBabelInputs } from '../vite/helpers.js';
|
|
|
6
6
|
const title = 'Storybook';
|
|
7
7
|
const enablers = [/^@storybook\//, '@nrwl/storybook'];
|
|
8
8
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
9
|
-
const config = [
|
|
9
|
+
const config = [
|
|
10
|
+
'.{storybook,rnstorybook}/main.{js,jsx,ts,tsx,mjs,mts,cjs,cts}',
|
|
11
|
+
'.{storybook,rnstorybook}/test-runner.{js,ts,mts}',
|
|
12
|
+
];
|
|
10
13
|
const stories = ['**/*.@(mdx|stories.@(mdx|js|jsx|mjs|ts|tsx))'];
|
|
11
|
-
const restEntry = [
|
|
14
|
+
const restEntry = [
|
|
15
|
+
'.{storybook,rnstorybook}/{manager,preview}.{js,jsx,ts,tsx,mjs,mts,cjs,cts}',
|
|
16
|
+
'.{storybook,rnstorybook}/{index,vitest.setup}.{js,jsx,ts,tsx}',
|
|
17
|
+
];
|
|
12
18
|
const entry = [...restEntry, ...stories];
|
|
13
|
-
const project = ['.{storybook,rnstorybook}/**/*.{js,jsx,ts,tsx,mts}'];
|
|
19
|
+
const project = ['.{storybook,rnstorybook}/**/*.{js,jsx,ts,tsx,mjs,mts,cjs,cts}'];
|
|
14
20
|
const resolveConfig = async (localConfig, options) => {
|
|
15
21
|
const { cwd, configFileDir } = options;
|
|
16
22
|
const strs = typeof localConfig?.stories === 'function' ? await localConfig.stories(stories) : localConfig?.stories;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toConfig, toDeferResolve } from '../../util/input.js';
|
|
1
|
+
import { toConfig, toDeferResolve, toDependency } from '../../util/input.js';
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
3
|
const title = 'Stryker';
|
|
4
4
|
const enablers = ['@stryker-mutator/core'];
|
|
@@ -10,7 +10,7 @@ const resolveConfig = localConfig => {
|
|
|
10
10
|
? localConfig.checkers.map(checker => `@stryker-mutator/${checker}-checker`)
|
|
11
11
|
: [];
|
|
12
12
|
const plugins = localConfig.plugins ?? [];
|
|
13
|
-
return [...runners, ...checkers
|
|
13
|
+
return [...runners, ...checkers].map(id => toDependency(id)).concat(plugins.map(id => toDeferResolve(id)));
|
|
14
14
|
};
|
|
15
15
|
const args = {
|
|
16
16
|
boolean: ['allowEmpty', 'disableBail', 'dryRunOnly', 'force', 'ignoreStatic', 'incremental', 'inPlace'],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toDeferResolve } from '../../util/input.js';
|
|
1
|
+
import { toConfig, toDeferResolve } from '../../util/input.js';
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
3
|
import { toCosmiconfig } from '../../util/plugin-config.js';
|
|
4
4
|
const title = 'Stylelint';
|
|
@@ -10,7 +10,7 @@ const resolveConfig = async (config, options) => {
|
|
|
10
10
|
const extend = Array.isArray(config.extends) ? config.extends : config.extends ? [config.extends] : [];
|
|
11
11
|
for (const id of extend) {
|
|
12
12
|
if (typeof id === 'string')
|
|
13
|
-
inputs.push(toDeferResolve(id));
|
|
13
|
+
inputs.push(toDeferResolve(id), toConfig('stylelint', id));
|
|
14
14
|
else
|
|
15
15
|
for (const x of await resolveConfig(id, options))
|
|
16
16
|
inputs.push(x);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { compact } from '../../util/array.js';
|
|
2
|
-
import { toDependency } from '../../util/input.js';
|
|
2
|
+
import { toDeferResolve, toDependency } from '../../util/input.js';
|
|
3
|
+
import { isInternal } from '../../util/path.js';
|
|
3
4
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
5
|
const title = 'SWC';
|
|
5
6
|
const enablers = ['@swc/core'];
|
|
6
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
8
|
const config = ['.swcrc'];
|
|
8
|
-
const resolveConfig = async (config) => {
|
|
9
|
+
const resolveConfig = async (config, options) => {
|
|
9
10
|
const dependencies = [];
|
|
10
11
|
for (const item of [config].flat()) {
|
|
11
12
|
for (const [id] of item?.jsc?.experimental?.plugins ?? [])
|
|
@@ -13,7 +14,7 @@ const resolveConfig = async (config) => {
|
|
|
13
14
|
if (item?.jsc?.externalHelpers)
|
|
14
15
|
dependencies.push('@swc/helpers');
|
|
15
16
|
}
|
|
16
|
-
return compact(dependencies).map(id => toDependency(id));
|
|
17
|
+
return compact(dependencies).map(id => isInternal(id) ? toDeferResolve(id, { dir: options.cwd }) : toDependency(id));
|
|
17
18
|
};
|
|
18
19
|
const plugin = {
|
|
19
20
|
title,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toDeferResolveProductionEntry } from '../../util/input.js';
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
3
|
import compiler from './compiler.js';
|
|
4
4
|
const title = 'Tailwind';
|
|
@@ -23,7 +23,7 @@ const args = {
|
|
|
23
23
|
binaries: ['tailwindcss'],
|
|
24
24
|
string: ['input'],
|
|
25
25
|
alias: { input: ['i'] },
|
|
26
|
-
resolveInputs: parsed => (parsed.input ? [
|
|
26
|
+
resolveInputs: (parsed, { cwd }) => (parsed.input ? [toDeferResolveProductionEntry(parsed.input, { dir: cwd })] : []),
|
|
27
27
|
};
|
|
28
28
|
const plugin = {
|
|
29
29
|
title,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toProductionEntry } from '../../util/input.js';
|
|
1
|
+
import { toDeferResolveProductionEntry, toProductionEntry } from '../../util/input.js';
|
|
2
2
|
import { toAbsolute } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'TanStack Router';
|
|
@@ -20,7 +20,7 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
20
20
|
const { configFileDir } = options;
|
|
21
21
|
const generatedRouteTree = localConfig.generatedRouteTree ?? './src/routeTree.gen.ts';
|
|
22
22
|
const routeTreePath = toAbsolute(generatedRouteTree, configFileDir);
|
|
23
|
-
return [
|
|
23
|
+
return [toDeferResolveProductionEntry(routeTreePath), ...routerEntries.map(id => toProductionEntry(id))];
|
|
24
24
|
};
|
|
25
25
|
const plugin = {
|
|
26
26
|
title,
|
|
@@ -3,7 +3,12 @@ const args = {
|
|
|
3
3
|
positional: true,
|
|
4
4
|
nodeImportArgs: true,
|
|
5
5
|
boolean: ['transpileOnly', 'compilerHost', 'ignoreDiagnostics', 'swc', 'preferTsExts'],
|
|
6
|
-
alias: {
|
|
6
|
+
alias: {
|
|
7
|
+
transpileOnly: ['T', 'transpile-only'],
|
|
8
|
+
compilerHost: ['H', 'compiler-host'],
|
|
9
|
+
ignoreDiagnostics: ['D'],
|
|
10
|
+
preferTsExts: ['prefer-ts-exts'],
|
|
11
|
+
},
|
|
7
12
|
};
|
|
8
13
|
const plugin = {
|
|
9
14
|
title,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toEntry } from '../../util/input.js';
|
|
1
|
+
import { toDeferResolveEntry, toEntry } from '../../util/input.js';
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
3
|
const title = 'Turborepo';
|
|
4
4
|
const enablers = ['turbo', '@turbo/gen'];
|
|
@@ -8,8 +8,8 @@ const entry = [`turbo/generators/config.${extensions}`];
|
|
|
8
8
|
const resolve = ({ cwd, rootCwd }) => (cwd === rootCwd ? [toEntry(`plopfile.${extensions}`)] : []);
|
|
9
9
|
const args = {
|
|
10
10
|
string: ['config'],
|
|
11
|
-
resolveInputs: parsed => (parsed._[0] === 'gen' || parsed._[0] === 'generate') && typeof parsed.config === 'string'
|
|
12
|
-
? [
|
|
11
|
+
resolveInputs: (parsed, { cwd }) => (parsed._[0] === 'gen' || parsed._[0] === 'generate') && typeof parsed.config === 'string'
|
|
12
|
+
? [toDeferResolveEntry(parsed.config, { dir: cwd })]
|
|
13
13
|
: [],
|
|
14
14
|
};
|
|
15
15
|
const plugin = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { arrayify } from '../../util/array.js';
|
|
2
|
-
import { toDeferResolve,
|
|
2
|
+
import { toDeferResolve, toDeferResolveEntry } from '../../util/input.js';
|
|
3
3
|
import { join } from '../../util/path.js';
|
|
4
4
|
import { hasDependency } from '../../util/plugin.js';
|
|
5
5
|
const title = 'TypeDoc';
|
|
@@ -21,7 +21,7 @@ const resolveConfig = (config, options) => {
|
|
|
21
21
|
const inputs = [...plugins, ...themes].map(id => toDeferResolve(id));
|
|
22
22
|
for (const file of [cfg?.customCss, cfg?.customJs]) {
|
|
23
23
|
if (file)
|
|
24
|
-
inputs.push(
|
|
24
|
+
inputs.push(toDeferResolveEntry(join(options.configFileDir, file)));
|
|
25
25
|
}
|
|
26
26
|
return inputs;
|
|
27
27
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Input } from '../../util/input.ts';
|
|
2
|
-
type ResolveContentMapperOptions = (options: Record<string, unknown
|
|
2
|
+
type ResolveContentMapperOptions = (options: Record<string, unknown>, dir: string) => Input[];
|
|
3
3
|
export declare const contentMapperResolvers: Map<string, ResolveContentMapperOptions>;
|
|
4
4
|
export {};
|
|
@@ -7,13 +7,13 @@ const title = 'TypeScript';
|
|
|
7
7
|
const enablers = ['typescript', '@typescript/native', '@typescript/native-preview'];
|
|
8
8
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
9
9
|
export const config = ['tsconfig.json'];
|
|
10
|
-
const resolveContentMappers = (localConfig) => {
|
|
10
|
+
const resolveContentMappers = (localConfig, dir) => {
|
|
11
11
|
const inputs = [];
|
|
12
12
|
for (const { package: name, options } of localConfig.contentMappers ?? []) {
|
|
13
13
|
inputs.push(toDependency(name));
|
|
14
14
|
const resolveOptions = contentMapperResolvers.get(name);
|
|
15
15
|
if (resolveOptions && options)
|
|
16
|
-
inputs.push(...resolveOptions(options));
|
|
16
|
+
inputs.push(...resolveOptions(options, dir));
|
|
17
17
|
}
|
|
18
18
|
return inputs;
|
|
19
19
|
};
|
|
@@ -23,14 +23,10 @@ export const resolveConfig = (localConfig, options) => {
|
|
|
23
23
|
? [localConfig.extends].flat().map(specifier => toConfig(options.pluginName, specifier))
|
|
24
24
|
: [];
|
|
25
25
|
const references = localConfig.references?.map(({ path }) => toConfig(options.pluginName, path.endsWith('.json') ? path : toAbsolute(join(path, 'tsconfig.json'), options.configFileDir))) ?? [];
|
|
26
|
-
const contentMappers = resolveContentMappers(localConfig);
|
|
26
|
+
const contentMappers = resolveContentMappers(localConfig, options.configFileDir);
|
|
27
27
|
if (!(compilerOptions && localConfig))
|
|
28
28
|
return compact([...contentMappers, ...extend, ...references]);
|
|
29
|
-
const jsx = (compilerOptions?.jsxImportSource ? [compilerOptions.jsxImportSource] : []).map(id => ({
|
|
30
|
-
...toProductionDependency(id),
|
|
31
|
-
dir: options.cwd,
|
|
32
|
-
alsoReferenceOwner: true,
|
|
33
|
-
}));
|
|
29
|
+
const jsx = (compilerOptions?.jsxImportSource ? [compilerOptions.jsxImportSource] : []).map(id => toProductionDependency(id, { dir: options.cwd, alsoReferenceOwner: true }));
|
|
34
30
|
const types = compilerOptions.types ?? [];
|
|
35
31
|
const plugins = Array.isArray(compilerOptions?.plugins)
|
|
36
32
|
? compilerOptions.plugins.map(plugin => (typeof plugin === 'object' && 'name' in plugin ? plugin.name : ''))
|
|
@@ -41,7 +37,8 @@ export const resolveConfig = (localConfig, options) => {
|
|
|
41
37
|
...extend,
|
|
42
38
|
...references,
|
|
43
39
|
...types.map(id => toDeferResolve(id, { isTypeOnly: true, dir: options.cwd, alsoReferenceOwner: true })),
|
|
44
|
-
...
|
|
40
|
+
...plugins.map(id => toDependency(id, { dir: options.cwd, alsoReferenceOwner: true })),
|
|
41
|
+
...importHelpers.map(id => toProductionDependency(id, { dir: options.cwd, alsoReferenceOwner: true })),
|
|
45
42
|
...jsx,
|
|
46
43
|
]);
|
|
47
44
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { toIgnore } from '../../util/input.js';
|
|
1
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
2
3
|
import { toUnconfig } from '../../util/plugin-config.js';
|
|
3
4
|
const title = 'UnoCSS';
|
|
4
5
|
const enablers = ['unocss'];
|
|
5
6
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
7
|
const entry = [...toUnconfig('uno.config'), ...toUnconfig('unocss.config')];
|
|
8
|
+
const resolve = () => [toIgnore('uno.css', 'dependencies')];
|
|
7
9
|
const plugin = {
|
|
8
10
|
title,
|
|
9
11
|
enablers,
|
|
10
12
|
isEnabled,
|
|
11
13
|
entry,
|
|
14
|
+
resolve,
|
|
12
15
|
};
|
|
13
16
|
export default plugin;
|
|
@@ -59,7 +59,7 @@ export const scanVarlockFiles = (paths, cwd) => {
|
|
|
59
59
|
else {
|
|
60
60
|
const packageName = getPackageNameFromModuleSpecifier(descriptor);
|
|
61
61
|
if (packageName) {
|
|
62
|
-
inputs.push(
|
|
62
|
+
inputs.push(toDependency(packageName, { containingFilePath: realPath, production: true }));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
continue;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Program } from 'oxc-parser';
|
|
2
2
|
import { type Input } from '../../util/input.ts';
|
|
3
3
|
export declare const getBabelInputs: (program: Program) => Input[];
|
|
4
|
+
export declare const getMdxInputs: (program: Program, dir: string) => Input[];
|
|
4
5
|
export declare const getHtmlScriptEntries: (htmlPath: string, rootDir?: string, publicDir?: string) => Promise<Input[]>;
|
|
5
6
|
export declare const getIndexHtmlEntries: (rootDir: string, publicDir?: string) => Promise<Input[]>;
|
|
6
7
|
export declare const getVitePluginDirs: (program: Program, specifiers: string[], key: string) => string[] | undefined;
|
|
@@ -2,9 +2,10 @@ import { blockCommentMatcher, lineCommentMatcher, scriptExtractor } from '../../
|
|
|
2
2
|
import { findImportedCalls, findProperty, getStringValues, resolveObjectArg } from '../../typescript/ast-helpers.js';
|
|
3
3
|
import { getStringValue } from '../../typescript/ast-nodes.js';
|
|
4
4
|
import { isFile, loadFile } from '../../util/fs.js';
|
|
5
|
-
import {
|
|
6
|
-
import { dirname, join, toAbsolute } from '../../util/path.js';
|
|
5
|
+
import { toDeferResolveProductionEntry } from '../../util/input.js';
|
|
6
|
+
import { dirname, isInternal, join, toAbsolute } from '../../util/path.js';
|
|
7
7
|
import { getDependenciesFromConfig } from '../babel/index.js';
|
|
8
|
+
import { toProviderInput } from '../mdx/index.js';
|
|
8
9
|
const babelPluginSources = ['@rolldown/plugin-babel', '@vitejs/plugin-react', 'vite-plugin-babel'];
|
|
9
10
|
const isBabelWrappingPlugin = (path) => babelPluginSources.some(source => path === source || path.startsWith(`${source}/`));
|
|
10
11
|
export const getBabelInputs = (program) => {
|
|
@@ -21,6 +22,15 @@ export const getBabelInputs = (program) => {
|
|
|
21
22
|
}
|
|
22
23
|
return inputs;
|
|
23
24
|
};
|
|
25
|
+
export const getMdxInputs = (program, dir) => {
|
|
26
|
+
const inputs = [];
|
|
27
|
+
for (const call of findImportedCalls(program, '@mdx-js/rollup')) {
|
|
28
|
+
const provider = getStringValue(findProperty(call.arguments?.[0], 'providerImportSource'));
|
|
29
|
+
if (provider && !isInternal(provider))
|
|
30
|
+
inputs.push(toProviderInput(provider, dir));
|
|
31
|
+
}
|
|
32
|
+
return inputs;
|
|
33
|
+
};
|
|
24
34
|
const moduleTypePattern = /\btype\s*=\s*["']?module["']?/i;
|
|
25
35
|
const srcAttrPattern = /\bsrc\s*=\s*["']([^"']+)["']/i;
|
|
26
36
|
const importSpecPattern = /\bimport\b(?:\s*\(\s*|(?:[\w$*,{}\s]*\bfrom\b)?\s*)(['"])([^'"]+)\1/g;
|
|
@@ -60,7 +70,7 @@ export const getHtmlScriptEntries = async (htmlPath, rootDir = dirname(htmlPath)
|
|
|
60
70
|
if (!isFile(htmlPath))
|
|
61
71
|
return [];
|
|
62
72
|
const html = await loadFile(htmlPath);
|
|
63
|
-
return getScriptSources(html, dirname(htmlPath), rootDir, publicDir).map(src =>
|
|
73
|
+
return getScriptSources(html, dirname(htmlPath), rootDir, publicDir).map(src => toDeferResolveProductionEntry(src));
|
|
64
74
|
};
|
|
65
75
|
export const getIndexHtmlEntries = (rootDir, publicDir) => getHtmlScriptEntries(join(rootDir, 'index.html'), rootDir, publicDir);
|
|
66
76
|
export const getVitePluginDirs = (program, specifiers, key) => {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { hasDependency } from '../../util/plugin.js';
|
|
2
2
|
import { resolveConfig } from '../vitest/index.js';
|
|
3
|
-
import { getBabelInputs, getIndexHtmlEntries } from './helpers.js';
|
|
3
|
+
import { getBabelInputs, getIndexHtmlEntries, getMdxInputs } from './helpers.js';
|
|
4
4
|
import { createImportMetaGlobVisitor } from './visitors/importMetaGlob.js';
|
|
5
5
|
const title = 'Vite';
|
|
6
6
|
const enablers = ['vite', 'vitest', 'vite-plus'];
|
|
7
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
8
|
export const config = ['vite.config.{js,mjs,ts,cjs,mts,cts}'];
|
|
9
|
-
const resolveFromAST =
|
|
9
|
+
const resolveFromAST = (program, options) => [
|
|
10
|
+
...getBabelInputs(program),
|
|
11
|
+
...getMdxInputs(program, options.configFileDir),
|
|
12
|
+
];
|
|
10
13
|
const registerVisitors = ({ ctx, registerVisitor }) => {
|
|
11
14
|
registerVisitor(createImportMetaGlobVisitor(ctx));
|
|
12
15
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Visitor } from 'oxc-parser';
|
|
2
2
|
import { findImportedCalls, findProperty, getFirstPropertyValue, getPropertyValues, } from '../../typescript/ast-helpers.js';
|
|
3
|
-
import {
|
|
3
|
+
import { toDeferResolveProductionEntry } from '../../util/input.js';
|
|
4
4
|
import { join } from '../../util/path.js';
|
|
5
5
|
const defaultSrcDir = 'public';
|
|
6
6
|
const defaultFilename = 'sw.js';
|
|
@@ -10,7 +10,7 @@ const getInjectManifestEntry = (options, configFileDir) => {
|
|
|
10
10
|
return;
|
|
11
11
|
const srcDir = getFirstPropertyValue(options, 'srcDir') ?? defaultSrcDir;
|
|
12
12
|
const filename = getFirstPropertyValue(options, 'filename') ?? defaultFilename;
|
|
13
|
-
return
|
|
13
|
+
return toDeferResolveProductionEntry(join(configFileDir, srcDir, filename));
|
|
14
14
|
};
|
|
15
15
|
export const resolveFromAST = (program, options) => {
|
|
16
16
|
const inputs = [];
|
|
@@ -2,7 +2,7 @@ import { DEFAULT_EXTENSIONS } from '../../constants.js';
|
|
|
2
2
|
import { filterTransitiveDependencies } from '../../util/filter-transitive-dependencies.js';
|
|
3
3
|
import { findFileWithExtensions } from '../../util/fs.js';
|
|
4
4
|
import { _dirGlob, _glob } from '../../util/glob.js';
|
|
5
|
-
import { toConfig, toDeferResolve, toDependency, toEntry,
|
|
5
|
+
import { toConfig, toDeferResolve, toDeferResolveProductionEntry, toDependency, toEntry, } from '../../util/input.js';
|
|
6
6
|
import { getPackageNameFromModuleSpecifier } from '../../util/modules.js';
|
|
7
7
|
import { basename, isAbsolute, isInternal, join, toAbsolute, toPosix } from '../../util/path.js';
|
|
8
8
|
import { hasDependency } from '../../util/plugin.js';
|
|
@@ -20,6 +20,12 @@ const mocks = ['**/__mocks__/**/*.?(c|m)[jt]s?(x)'];
|
|
|
20
20
|
const testEntry = ['**/*.{bench,test,test-d,spec,spec-d}.?(c|m)[jt]s?(x)'];
|
|
21
21
|
const entry = [...testEntry, ...mocks];
|
|
22
22
|
const benchmark = ['**/*.bench.?(c|m)[jt]s?(x)'];
|
|
23
|
+
const builtInCoverageProviders = new Set(['v8', 'istanbul', 'c8']);
|
|
24
|
+
const getCoverageInputs = (provider, customProviderModule, dir) => builtInCoverageProviders.has(provider)
|
|
25
|
+
? [toDependency(`@vitest/coverage-${provider}`)]
|
|
26
|
+
: customProviderModule
|
|
27
|
+
? [toDeferResolve(customProviderModule, { dir })]
|
|
28
|
+
: [];
|
|
23
29
|
const isProjectConfig = (project) => typeof project === 'object' && !(project instanceof Promise);
|
|
24
30
|
const findConfigDependencies = (localConfig, options, vitestRoot) => {
|
|
25
31
|
const testConfig = localConfig.test;
|
|
@@ -28,20 +34,19 @@ const findConfigDependencies = (localConfig, options, vitestRoot) => {
|
|
|
28
34
|
const env = testConfig.environment;
|
|
29
35
|
const environments = env && env !== 'node' ? (isInternal(env) || isAbsolute(env) ? [toDeferResolve(env)] : [toEnvDependency(env)]) : [];
|
|
30
36
|
const reporters = getExternalReporters(testConfig.reporters).map(specifier => isInternal(specifier) || isAbsolute(specifier)
|
|
31
|
-
?
|
|
37
|
+
? toDeferResolve(specifier, { dir: vitestRoot })
|
|
32
38
|
: toDependency(specifier));
|
|
33
39
|
const hasCoverage = testConfig.coverage && (testConfig.coverage.enabled !== false || testConfig.coverage.provider);
|
|
34
|
-
const coverage = hasCoverage
|
|
40
|
+
const coverage = hasCoverage
|
|
41
|
+
? getCoverageInputs(testConfig.coverage?.provider ?? 'v8', testConfig.coverage?.customProviderModule, vitestRoot)
|
|
42
|
+
: [];
|
|
35
43
|
const setupFiles = [testConfig.setupFiles ?? []]
|
|
36
44
|
.flat()
|
|
37
|
-
.map(specifier =>
|
|
38
|
-
const snapshotSerializers = (testConfig.snapshotSerializers ?? []).map(specifier => ({
|
|
39
|
-
...toDeferResolve(specifier),
|
|
40
|
-
dir: vitestRoot,
|
|
41
|
-
}));
|
|
45
|
+
.map(specifier => toDeferResolve(specifier, { dir: vitestRoot }));
|
|
46
|
+
const snapshotSerializers = (testConfig.snapshotSerializers ?? []).map(specifier => toDeferResolve(specifier, { dir: vitestRoot }));
|
|
42
47
|
const globalSetup = [testConfig.globalSetup ?? []]
|
|
43
48
|
.flat()
|
|
44
|
-
.map(specifier =>
|
|
49
|
+
.map(specifier => toDeferResolve(specifier, { dir: vitestRoot }));
|
|
45
50
|
const workspaceDependencies = [];
|
|
46
51
|
if (testConfig.workspace !== undefined) {
|
|
47
52
|
for (const workspaceConfig of testConfig.workspace) {
|
|
@@ -59,7 +64,7 @@ const findConfigDependencies = (localConfig, options, vitestRoot) => {
|
|
|
59
64
|
return [
|
|
60
65
|
...environments,
|
|
61
66
|
...reporters,
|
|
62
|
-
...coverage
|
|
67
|
+
...coverage,
|
|
63
68
|
...setupFiles,
|
|
64
69
|
...snapshotSerializers,
|
|
65
70
|
...globalSetup,
|
|
@@ -210,7 +215,7 @@ export const resolveConfig = async (localConfig, options) => {
|
|
|
210
215
|
const inputSpecifiers = typeof _input === 'string' ? [_input] : Array.isArray(_input) ? _input : Object.values(_input).flat();
|
|
211
216
|
for (const specifier of inputSpecifiers) {
|
|
212
217
|
const resolved = toAbsolute(specifier, viteRoot);
|
|
213
|
-
inputs.add(
|
|
218
|
+
inputs.add(toDeferResolveProductionEntry(resolved));
|
|
214
219
|
if (resolved.endsWith('.html')) {
|
|
215
220
|
for (const input of await getHtmlScriptEntries(resolved, viteRoot, publicDir))
|
|
216
221
|
inputs.add(input);
|
|
@@ -218,7 +223,7 @@ export const resolveConfig = async (localConfig, options) => {
|
|
|
218
223
|
}
|
|
219
224
|
const _entry = cfg.build?.lib?.entry ?? [];
|
|
220
225
|
const entries = typeof _entry === 'string' ? [_entry] : Array.isArray(_entry) ? _entry : Object.values(_entry).flat();
|
|
221
|
-
const deps = entries.map(specifier => toAbsolute(specifier, viteRoot)).map(id =>
|
|
226
|
+
const deps = entries.map(specifier => toAbsolute(specifier, viteRoot)).map(id => toDeferResolveProductionEntry(id));
|
|
222
227
|
for (const dependency of deps)
|
|
223
228
|
inputs.add(dependency);
|
|
224
229
|
}
|
|
@@ -231,24 +236,27 @@ export const resolveConfig = async (localConfig, options) => {
|
|
|
231
236
|
};
|
|
232
237
|
const args = {
|
|
233
238
|
config: true,
|
|
234
|
-
|
|
239
|
+
alias: { root: ['r'] },
|
|
240
|
+
resolveInputs: (parsed, { cwd }) => {
|
|
235
241
|
const inputs = [];
|
|
242
|
+
const root = toAbsolute(parsed['root'] ?? '.', cwd);
|
|
236
243
|
if (parsed['ui'])
|
|
237
244
|
inputs.push(toDependency('@vitest/ui', { optional: true }));
|
|
238
245
|
if (typeof parsed['coverage'] === 'object' && parsed['coverage'].provider) {
|
|
239
|
-
|
|
246
|
+
const { provider, customProviderModule } = parsed['coverage'];
|
|
247
|
+
inputs.push(...getCoverageInputs(provider, customProviderModule, root));
|
|
240
248
|
}
|
|
241
249
|
else if (parsed['coverage']) {
|
|
242
250
|
inputs.push(toDependency('@vitest/coverage-v8', { optional: true }));
|
|
243
251
|
}
|
|
244
252
|
if (parsed['reporter']) {
|
|
245
253
|
for (const reporter of getExternalReporters([parsed['reporter']].flat())) {
|
|
246
|
-
inputs.push(toDependency(reporter));
|
|
254
|
+
inputs.push(isInternal(reporter) ? toDeferResolve(reporter, { dir: root }) : toDependency(reporter));
|
|
247
255
|
}
|
|
248
256
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
257
|
+
const env = parsed['environment'];
|
|
258
|
+
if (env && env !== 'node')
|
|
259
|
+
inputs.push(isInternal(env) ? toDeferResolve(env, { dir: root }) : toEnvDependency(env));
|
|
252
260
|
if (typeof parsed['typecheck'] === 'object' && parsed['typecheck'].checker) {
|
|
253
261
|
inputs.push(toDependency(parsed['typecheck'].checker === 'tsc' ? 'typescript' : parsed['typecheck'].checker));
|
|
254
262
|
}
|
|
@@ -5,7 +5,7 @@ import { findWebpackDependenciesFromConfig } from '../webpack/index.js';
|
|
|
5
5
|
const title = 'Vue';
|
|
6
6
|
const enablers = ['vue'];
|
|
7
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
|
-
const config = ['vue.config.{js,
|
|
8
|
+
const config = ['vue.config.{js,cjs,mjs,ts}'];
|
|
9
9
|
const resolveConfig = async (config, options) => {
|
|
10
10
|
const { manifest } = options;
|
|
11
11
|
const inputs = [];
|