knip 5.53.0 → 5.54.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/IssueFixer.d.ts +1 -1
- package/dist/IssueFixer.js +13 -3
- package/dist/PrincipalFactory.js +3 -17
- package/dist/ProjectPrincipal.d.ts +2 -2
- package/dist/ProjectPrincipal.js +14 -3
- package/dist/WorkspaceWorker.d.ts +0 -1
- package/dist/WorkspaceWorker.js +4 -19
- package/dist/cli.js +2 -1
- package/dist/graph/build.js +8 -5
- package/dist/index.js +15 -4
- package/dist/plugins/ava/index.d.ts +1 -2
- package/dist/plugins/ava/index.js +2 -7
- package/dist/plugins/bun/index.d.ts +2 -2
- package/dist/plugins/bun/index.js +2 -2
- package/dist/plugins/cucumber/index.d.ts +1 -2
- package/dist/plugins/cucumber/index.js +2 -5
- package/dist/plugins/cypress/index.d.ts +1 -2
- package/dist/plugins/cypress/index.js +6 -9
- package/dist/plugins/cypress/types.d.ts +8 -0
- package/dist/plugins/eleventy/helpers.d.ts +10 -2
- package/dist/plugins/eleventy/index.d.ts +3 -6
- package/dist/plugins/eleventy/index.js +11 -16
- package/dist/plugins/eleventy/types.d.ts +9 -7
- package/dist/plugins/expo/index.d.ts +2 -5
- package/dist/plugins/expo/index.js +4 -6
- package/dist/plugins/github-action/index.d.ts +2 -2
- package/dist/plugins/github-action/index.js +2 -2
- package/dist/plugins/index.d.ts +14 -28
- package/dist/plugins/jest/index.d.ts +1 -2
- package/dist/plugins/jest/index.js +4 -12
- package/dist/plugins/karma/index.d.ts +1 -3
- package/dist/plugins/karma/index.js +0 -10
- package/dist/plugins/ladle/index.d.ts +1 -2
- package/dist/plugins/ladle/index.js +4 -7
- package/dist/plugins/metro/index.d.ts +2 -3
- package/dist/plugins/metro/index.js +17 -14
- package/dist/plugins/mocha/index.d.ts +1 -2
- package/dist/plugins/mocha/index.js +2 -6
- package/dist/plugins/msw/index.d.ts +2 -2
- package/dist/plugins/msw/index.js +2 -2
- package/dist/plugins/netlify/index.d.ts +1 -2
- package/dist/plugins/netlify/index.js +4 -7
- package/dist/plugins/node/index.d.ts +2 -2
- package/dist/plugins/node/index.js +2 -2
- package/dist/plugins/nuxt/index.d.ts +2 -2
- package/dist/plugins/nuxt/index.js +2 -2
- package/dist/plugins/playwright/index.d.ts +1 -3
- package/dist/plugins/playwright/index.js +5 -7
- package/dist/plugins/playwright-ct/index.d.ts +0 -1
- package/dist/plugins/playwright-ct/index.js +1 -2
- package/dist/plugins/postcss/index.js +3 -1
- package/dist/plugins/preconstruct/index.d.ts +1 -1
- package/dist/plugins/preconstruct/index.js +2 -2
- package/dist/plugins/react-cosmos/index.d.ts +1 -2
- package/dist/plugins/react-cosmos/index.js +4 -6
- package/dist/plugins/react-router/index.d.ts +2 -2
- package/dist/plugins/react-router/index.js +2 -2
- package/dist/plugins/relay/index.d.ts +2 -2
- package/dist/plugins/relay/index.js +2 -2
- package/dist/plugins/rspack/index.js +2 -3
- package/dist/plugins/size-limit/index.d.ts +2 -1
- package/dist/plugins/size-limit/index.js +10 -0
- package/dist/plugins/storybook/index.d.ts +1 -2
- package/dist/plugins/storybook/index.js +2 -5
- package/dist/plugins/svelte/index.d.ts +2 -1
- package/dist/plugins/svelte/index.js +7 -0
- package/dist/plugins/vite/index.d.ts +0 -1
- package/dist/plugins/vite/index.js +1 -2
- package/dist/plugins/vitest/index.d.ts +1 -3
- package/dist/plugins/vitest/index.js +35 -24
- package/dist/plugins/vitest/types.d.ts +12 -0
- package/dist/plugins/vue/index.js +2 -5
- package/dist/plugins/webpack/index.d.ts +1 -5
- package/dist/plugins/webpack/index.js +36 -17
- package/dist/plugins/wrangler/index.d.ts +2 -2
- package/dist/plugins/wrangler/index.js +2 -2
- package/dist/plugins.js +1 -1
- package/dist/types/cli.d.ts +1 -0
- package/dist/types/config.d.ts +0 -2
- package/dist/types/project.d.ts +0 -1
- package/dist/util/cli-arguments.d.ts +2 -1
- package/dist/util/cli-arguments.js +2 -0
- package/dist/util/glob-core.d.ts +5 -6
- package/dist/util/glob-core.js +30 -31
- package/dist/util/input.d.ts +7 -1
- package/dist/util/input.js +7 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -1
|
@@ -3,7 +3,7 @@ const title = 'Node.js';
|
|
|
3
3
|
const isEnabled = () => true;
|
|
4
4
|
const config = ['package.json'];
|
|
5
5
|
const packageJsonPath = (id) => id;
|
|
6
|
-
const
|
|
6
|
+
const resolveConfig = localConfig => {
|
|
7
7
|
const scripts = localConfig.scripts;
|
|
8
8
|
const entries = [toProductionEntry('server.js')];
|
|
9
9
|
if (scripts && Object.keys(scripts).some(script => /(?<=^|\s)node\s(.*)--test/.test(scripts[script]))) {
|
|
@@ -23,6 +23,6 @@ export default {
|
|
|
23
23
|
isEnabled,
|
|
24
24
|
packageJsonPath,
|
|
25
25
|
config,
|
|
26
|
-
|
|
26
|
+
resolveConfig,
|
|
27
27
|
args,
|
|
28
28
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IsPluginEnabled,
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
|
|
2
2
|
import type { NuxtConfig } from './types.js';
|
|
3
3
|
export declare const docs: {
|
|
4
4
|
note: string;
|
|
@@ -9,6 +9,6 @@ declare const _default: {
|
|
|
9
9
|
isEnabled: IsPluginEnabled;
|
|
10
10
|
config: string[];
|
|
11
11
|
production: string[];
|
|
12
|
-
|
|
12
|
+
resolveConfig: ResolveConfig<NuxtConfig>;
|
|
13
13
|
};
|
|
14
14
|
export default _default;
|
|
@@ -21,7 +21,7 @@ const production = [
|
|
|
21
21
|
'server/middleware/**/*.ts',
|
|
22
22
|
'server/plugins/**/*.ts',
|
|
23
23
|
];
|
|
24
|
-
const
|
|
24
|
+
const resolveConfig = async (localConfig) => {
|
|
25
25
|
const srcDir = localConfig.srcDir ?? '.';
|
|
26
26
|
const patterns = [
|
|
27
27
|
'app.{vue,jsx,tsx}',
|
|
@@ -45,5 +45,5 @@ export default {
|
|
|
45
45
|
isEnabled,
|
|
46
46
|
config,
|
|
47
47
|
production,
|
|
48
|
-
|
|
48
|
+
resolveConfig,
|
|
49
49
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { IsPluginEnabled, ResolveConfig
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
|
|
2
2
|
import type { PlaywrightTestConfig } from './types.js';
|
|
3
3
|
export declare const entry: string[];
|
|
4
|
-
export declare const resolveEntryPaths: ResolveEntryPaths<PlaywrightTestConfig>;
|
|
5
4
|
export declare const resolveConfig: ResolveConfig<PlaywrightTestConfig>;
|
|
6
5
|
declare const _default: {
|
|
7
6
|
title: string;
|
|
@@ -10,7 +9,6 @@ declare const _default: {
|
|
|
10
9
|
config: string[];
|
|
11
10
|
entry: string[];
|
|
12
11
|
resolveConfig: ResolveConfig<PlaywrightTestConfig>;
|
|
13
|
-
resolveEntryPaths: ResolveEntryPaths<PlaywrightTestConfig>;
|
|
14
12
|
args: {
|
|
15
13
|
binaries: string[];
|
|
16
14
|
positional: boolean;
|
|
@@ -13,19 +13,18 @@ const toEntryPatterns = (testMatch, cwd, configDir, localConfig, rootConfig) =>
|
|
|
13
13
|
return patterns.map(pattern => toEntry(join(dir, pattern)));
|
|
14
14
|
};
|
|
15
15
|
const builtinReporters = ['dot', 'line', 'list', 'junit', 'html', 'blob', 'json', 'github'];
|
|
16
|
-
export const
|
|
16
|
+
export const resolveConfig = async (localConfig, options) => {
|
|
17
17
|
const { cwd, configFileDir } = options;
|
|
18
18
|
const projects = localConfig.projects ? [localConfig, ...localConfig.projects] : [localConfig];
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
export const resolveConfig = async (config) => {
|
|
22
|
-
const reporters = [config.reporter].flat().flatMap(reporter => {
|
|
19
|
+
const reporters = [localConfig.reporter].flat().flatMap(reporter => {
|
|
23
20
|
const name = typeof reporter === 'string' ? reporter : reporter?.[0];
|
|
24
21
|
if (!name || builtinReporters.includes(name))
|
|
25
22
|
return [];
|
|
26
23
|
return [name];
|
|
27
24
|
});
|
|
28
|
-
return
|
|
25
|
+
return projects
|
|
26
|
+
.flatMap(config => toEntryPatterns(config.testMatch ?? entry, cwd, configFileDir, config, localConfig))
|
|
27
|
+
.concat(reporters.map(toDeferResolve));
|
|
29
28
|
};
|
|
30
29
|
const args = {
|
|
31
30
|
binaries: ['playwright'],
|
|
@@ -40,6 +39,5 @@ export default {
|
|
|
40
39
|
config,
|
|
41
40
|
entry,
|
|
42
41
|
resolveConfig,
|
|
43
|
-
resolveEntryPaths,
|
|
44
42
|
args,
|
|
45
43
|
};
|
|
@@ -5,7 +5,6 @@ declare const _default: {
|
|
|
5
5
|
isEnabled: IsPluginEnabled;
|
|
6
6
|
config: string[];
|
|
7
7
|
entry: string[];
|
|
8
|
-
resolveEntryPaths: import("../../types/config.js").ResolveEntryPaths<import("../playwright/types.js").PlaywrightTestConfig>;
|
|
9
8
|
resolveConfig: import("../../types/config.js").ResolveConfig<import("../playwright/types.js").PlaywrightTestConfig>;
|
|
10
9
|
};
|
|
11
10
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
-
import { entry, resolveConfig
|
|
2
|
+
import { entry, resolveConfig } from '../playwright/index.js';
|
|
3
3
|
const title = 'Playwright for components';
|
|
4
4
|
const enablers = [/^@playwright\/experimental-ct-/];
|
|
5
5
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
@@ -10,6 +10,5 @@ export default {
|
|
|
10
10
|
isEnabled,
|
|
11
11
|
config,
|
|
12
12
|
entry,
|
|
13
|
-
resolveEntryPaths,
|
|
14
13
|
resolveConfig,
|
|
15
14
|
};
|
|
@@ -20,7 +20,9 @@ const resolveConfig = config => {
|
|
|
20
20
|
})
|
|
21
21
|
: [];
|
|
22
22
|
const inputs = plugins.map(toDeferResolve);
|
|
23
|
-
return
|
|
23
|
+
return ['tailwindcss', '@tailwindcss/postcss'].some(tailwindPlugin => plugins.includes(tailwindPlugin))
|
|
24
|
+
? [...inputs, toDependency('postcss')]
|
|
25
|
+
: inputs;
|
|
24
26
|
};
|
|
25
27
|
export default {
|
|
26
28
|
title,
|
|
@@ -4,7 +4,7 @@ const title = 'Preconstruct';
|
|
|
4
4
|
const enablers = ['@preconstruct/cli'];
|
|
5
5
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
6
|
const config = ['package.json'];
|
|
7
|
-
const
|
|
7
|
+
const resolveConfig = async (config) => {
|
|
8
8
|
return (config.entrypoints ?? []).map(id => toProductionEntry(id, { allowIncludeExports: true }));
|
|
9
9
|
};
|
|
10
10
|
export default {
|
|
@@ -12,5 +12,5 @@ export default {
|
|
|
12
12
|
enablers,
|
|
13
13
|
isEnabled,
|
|
14
14
|
config,
|
|
15
|
-
|
|
15
|
+
resolveConfig,
|
|
16
16
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IsPluginEnabled, ResolveConfig
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
|
|
2
2
|
import type { ReactCosmosConfig } from './types.js';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
@@ -7,6 +7,5 @@ declare const _default: {
|
|
|
7
7
|
config: string[];
|
|
8
8
|
entry: string[];
|
|
9
9
|
resolveConfig: ResolveConfig<ReactCosmosConfig>;
|
|
10
|
-
resolveEntryPaths: ResolveEntryPaths<ReactCosmosConfig>;
|
|
11
10
|
};
|
|
12
11
|
export default _default;
|
|
@@ -9,17 +9,16 @@ const ext = '{js,jsx,ts,tsx,md,mdx}';
|
|
|
9
9
|
const fixtureEntry = [`**/*.fixture.${ext}`, `__fixtures__/**/*.${ext}`, `**/fixture.${ext}`];
|
|
10
10
|
const decoratorEntry = ['**/cosmos.decorator.{jsx,tsx}'];
|
|
11
11
|
const entry = [...fixtureEntry, ...decoratorEntry];
|
|
12
|
-
const
|
|
12
|
+
const resolveConfig = async (localConfig) => {
|
|
13
13
|
const { fixturesDir, fixtureFileSuffix } = localConfig;
|
|
14
14
|
const entries = [
|
|
15
15
|
join(fixturesDir ?? '__fixtures__', `**/*.${ext}`),
|
|
16
16
|
join(fixturesDir ?? '', `**/*.${fixtureFileSuffix ?? 'fixture'}.${ext}`),
|
|
17
17
|
join(fixturesDir ?? '', `**/${fixtureFileSuffix ?? 'fixture'}.${ext}`),
|
|
18
18
|
];
|
|
19
|
-
return [...entries, ...decoratorEntry]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return (localConfig?.plugins ?? []).map(toDeferResolve);
|
|
19
|
+
return [...entries, ...decoratorEntry]
|
|
20
|
+
.map(id => toEntry(id))
|
|
21
|
+
.concat((localConfig?.plugins ?? []).map(toDeferResolve));
|
|
23
22
|
};
|
|
24
23
|
export default {
|
|
25
24
|
title,
|
|
@@ -28,5 +27,4 @@ export default {
|
|
|
28
27
|
config,
|
|
29
28
|
entry,
|
|
30
29
|
resolveConfig,
|
|
31
|
-
resolveEntryPaths,
|
|
32
30
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { IsPluginEnabled,
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
|
|
2
2
|
import type { PluginConfig } from './types.js';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
5
|
enablers: string[];
|
|
6
6
|
isEnabled: IsPluginEnabled;
|
|
7
7
|
config: string[];
|
|
8
|
-
|
|
8
|
+
resolveConfig: ResolveConfig<PluginConfig>;
|
|
9
9
|
};
|
|
10
10
|
export default _default;
|
|
@@ -7,7 +7,7 @@ const title = 'React Router';
|
|
|
7
7
|
const enablers = ['@react-router/dev'];
|
|
8
8
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
9
9
|
const config = ['react-router.config.{js,ts}', ...vite.config];
|
|
10
|
-
const
|
|
10
|
+
const resolveConfig = async (localConfig, options) => {
|
|
11
11
|
const { configFileDir } = options;
|
|
12
12
|
const appDirectory = localConfig.appDirectory ?? 'app';
|
|
13
13
|
const appDir = join(configFileDir, appDirectory);
|
|
@@ -39,5 +39,5 @@ export default {
|
|
|
39
39
|
enablers,
|
|
40
40
|
isEnabled,
|
|
41
41
|
config,
|
|
42
|
-
|
|
42
|
+
resolveConfig,
|
|
43
43
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { IsPluginEnabled,
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
|
|
2
2
|
import type { RelayConfig } from './types.js';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
5
|
enablers: string[];
|
|
6
6
|
isEnabled: IsPluginEnabled;
|
|
7
7
|
config: string[];
|
|
8
|
-
|
|
8
|
+
resolveConfig: ResolveConfig<RelayConfig>;
|
|
9
9
|
args: {
|
|
10
10
|
binaries: string[];
|
|
11
11
|
args: (args: string[]) => string[];
|
|
@@ -6,7 +6,7 @@ const title = 'Relay';
|
|
|
6
6
|
const enablers = ['vite-plugin-relay', '@swc/plugin-relay', 'babel-plugin-relay'];
|
|
7
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
8
|
const config = ['relay.config.json', 'relay.config.js'];
|
|
9
|
-
const
|
|
9
|
+
const resolveConfig = async (config) => {
|
|
10
10
|
const projects = 'projects' in config ? Object.values(config.projects) : [config];
|
|
11
11
|
return projects.map(project => {
|
|
12
12
|
const artifactDirectory = project.artifactDirectory;
|
|
@@ -26,6 +26,6 @@ export default {
|
|
|
26
26
|
enablers,
|
|
27
27
|
isEnabled,
|
|
28
28
|
config,
|
|
29
|
-
|
|
29
|
+
resolveConfig,
|
|
30
30
|
args,
|
|
31
31
|
};
|
|
@@ -5,9 +5,8 @@ const enablers = ['@rspack/core'];
|
|
|
5
5
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
6
|
const config = ['rspack.config*.{js,ts,mjs,cjs}'];
|
|
7
7
|
const resolveConfig = async (localConfig, options) => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
return Array.from(inputs).filter(input => !input.specifier.startsWith('builtin:'));
|
|
8
|
+
const inputs = await findWebpackDependenciesFromConfig(localConfig, options);
|
|
9
|
+
return inputs.filter(input => !input.specifier.startsWith('builtin:'));
|
|
11
10
|
};
|
|
12
11
|
export default {
|
|
13
12
|
title,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { IsPluginEnabled } from '../../types/config.js';
|
|
1
|
+
import type { IsPluginEnabled, Resolve } from '../../types/config.js';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
4
|
enablers: string[];
|
|
5
5
|
isEnabled: IsPluginEnabled;
|
|
6
6
|
config: string[];
|
|
7
|
+
resolve: Resolve;
|
|
7
8
|
};
|
|
8
9
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { toDependency } from '../../util/input.js';
|
|
1
2
|
import { toLilconfig } from '../../util/plugin-config.js';
|
|
2
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
4
|
const title = 'size-limit';
|
|
@@ -7,9 +8,18 @@ const config = [
|
|
|
7
8
|
'package.json',
|
|
8
9
|
...toLilconfig('size-limit', { configDir: false, additionalExtensions: ['ts', 'mts', 'cts'], rcSuffix: '' }),
|
|
9
10
|
];
|
|
11
|
+
const resolve = options => {
|
|
12
|
+
const allDeps = [
|
|
13
|
+
...Object.keys(options.manifest.dependencies || {}),
|
|
14
|
+
...Object.keys(options.manifest.devDependencies || {}),
|
|
15
|
+
];
|
|
16
|
+
const sizeLimitDeps = allDeps.filter(dep => dep.startsWith('@size-limit/'));
|
|
17
|
+
return sizeLimitDeps.map(dep => toDependency(dep));
|
|
18
|
+
};
|
|
10
19
|
export default {
|
|
11
20
|
title,
|
|
12
21
|
enablers,
|
|
13
22
|
isEnabled,
|
|
14
23
|
config,
|
|
24
|
+
resolve,
|
|
15
25
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IsPluginEnabled, ResolveConfig
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
|
|
2
2
|
import type { StorybookConfig } from './types.js';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
@@ -7,7 +7,6 @@ declare const _default: {
|
|
|
7
7
|
config: string[];
|
|
8
8
|
entry: string[];
|
|
9
9
|
project: string[];
|
|
10
|
-
resolveEntryPaths: ResolveEntryPaths<StorybookConfig>;
|
|
11
10
|
resolveConfig: ResolveConfig<StorybookConfig>;
|
|
12
11
|
};
|
|
13
12
|
export default _default;
|
|
@@ -9,7 +9,7 @@ const stories = ['**/*.@(mdx|stories.@(mdx|js|jsx|mjs|ts|tsx))'];
|
|
|
9
9
|
const restEntry = ['.storybook/{manager,preview}.{js,jsx,ts,tsx}'];
|
|
10
10
|
const entry = [...restEntry, ...stories];
|
|
11
11
|
const project = ['.storybook/**/*.{js,jsx,ts,tsx,mts}'];
|
|
12
|
-
const
|
|
12
|
+
const resolveConfig = async (localConfig, options) => {
|
|
13
13
|
const { cwd, configFileDir } = options;
|
|
14
14
|
const strs = typeof localConfig?.stories === 'function' ? await localConfig.stories(stories) : localConfig?.stories;
|
|
15
15
|
const relativePatterns = strs?.map(pattern => {
|
|
@@ -21,9 +21,6 @@ const resolveEntryPaths = async (localConfig, options) => {
|
|
|
21
21
|
...(options.config.entry ?? restEntry),
|
|
22
22
|
...(relativePatterns && relativePatterns.length > 0 ? relativePatterns : stories),
|
|
23
23
|
];
|
|
24
|
-
return patterns.map(id => toEntry(id));
|
|
25
|
-
};
|
|
26
|
-
const resolveConfig = async (localConfig) => {
|
|
27
24
|
const addons = localConfig.addons?.map(addon => (typeof addon === 'string' ? addon : addon.name)) ?? [];
|
|
28
25
|
const builder = localConfig?.core?.builder &&
|
|
29
26
|
(typeof localConfig.core.builder === 'string' ? localConfig.core.builder : localConfig.core.builder.name);
|
|
@@ -35,6 +32,7 @@ const resolveConfig = async (localConfig) => {
|
|
|
35
32
|
const framework = typeof localConfig.framework === 'string' ? localConfig.framework : localConfig.framework?.name;
|
|
36
33
|
const frameworks = framework ? [framework] : [];
|
|
37
34
|
return [
|
|
35
|
+
...patterns.map(id => toEntry(id)),
|
|
38
36
|
...addons.map(toDeferResolve),
|
|
39
37
|
...builderPackages.map(id => toDependency(id)),
|
|
40
38
|
...frameworks.map(id => toDependency(id)),
|
|
@@ -47,6 +45,5 @@ export default {
|
|
|
47
45
|
config,
|
|
48
46
|
entry,
|
|
49
47
|
project,
|
|
50
|
-
resolveEntryPaths,
|
|
51
48
|
resolveConfig,
|
|
52
49
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { IsPluginEnabled } from '../../types/config.js';
|
|
1
|
+
import type { IsPluginEnabled, Resolve } from '../../types/config.js';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
4
|
enablers: string[];
|
|
5
5
|
isEnabled: IsPluginEnabled;
|
|
6
6
|
entry: string[];
|
|
7
7
|
production: string[];
|
|
8
|
+
resolve: Resolve;
|
|
8
9
|
};
|
|
9
10
|
export default _default;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { toAlias } from '../../util/input.js';
|
|
2
|
+
import { join } from '../../util/path.js';
|
|
1
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
2
4
|
import { config as viteConfig } from '../vite/index.js';
|
|
3
5
|
const title = 'Svelte';
|
|
@@ -9,10 +11,15 @@ const production = [
|
|
|
9
11
|
'src/hooks.{server,client}.{js,ts}',
|
|
10
12
|
'src/params/*.{js,ts}',
|
|
11
13
|
];
|
|
14
|
+
const resolve = options => {
|
|
15
|
+
const alias = toAlias('$app/*', [join(options.cwd, 'node_modules/@sveltejs/kit/src/runtime/app/*')]);
|
|
16
|
+
return [alias];
|
|
17
|
+
};
|
|
12
18
|
export default {
|
|
13
19
|
title,
|
|
14
20
|
enablers,
|
|
15
21
|
isEnabled,
|
|
16
22
|
entry,
|
|
17
23
|
production,
|
|
24
|
+
resolve,
|
|
18
25
|
};
|
|
@@ -5,7 +5,6 @@ declare const _default: {
|
|
|
5
5
|
enablers: string[];
|
|
6
6
|
isEnabled: IsPluginEnabled;
|
|
7
7
|
config: string[];
|
|
8
|
-
resolveEntryPaths: import("../../types/config.js").ResolveEntryPaths<import("../vitest/types.js").ViteConfigOrFn | import("../vitest/types.js").VitestWorkspaceConfig>;
|
|
9
8
|
resolveConfig: import("../../types/config.js").ResolveConfig<import("../vitest/types.js").ViteConfigOrFn | import("../vitest/types.js").VitestWorkspaceConfig>;
|
|
10
9
|
};
|
|
11
10
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
-
import { resolveConfig
|
|
2
|
+
import { resolveConfig } from '../vitest/index.js';
|
|
3
3
|
const title = 'Vite';
|
|
4
4
|
const enablers = ['vite', 'vitest'];
|
|
5
5
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
@@ -9,6 +9,5 @@ export default {
|
|
|
9
9
|
enablers,
|
|
10
10
|
isEnabled,
|
|
11
11
|
config,
|
|
12
|
-
resolveEntryPaths,
|
|
13
12
|
resolveConfig,
|
|
14
13
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { IsPluginEnabled, ResolveConfig
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
|
|
2
2
|
import type { ViteConfigOrFn, VitestWorkspaceConfig } from './types.js';
|
|
3
|
-
export declare const resolveEntryPaths: ResolveEntryPaths<ViteConfigOrFn | VitestWorkspaceConfig>;
|
|
4
3
|
export declare const resolveConfig: ResolveConfig<ViteConfigOrFn | VitestWorkspaceConfig>;
|
|
5
4
|
declare const _default: {
|
|
6
5
|
title: string;
|
|
@@ -8,7 +7,6 @@ declare const _default: {
|
|
|
8
7
|
isEnabled: IsPluginEnabled;
|
|
9
8
|
config: string[];
|
|
10
9
|
entry: string[];
|
|
11
|
-
resolveEntryPaths: ResolveEntryPaths<ViteConfigOrFn | VitestWorkspaceConfig>;
|
|
12
10
|
resolveConfig: ResolveConfig<ViteConfigOrFn | VitestWorkspaceConfig>;
|
|
13
11
|
args: {
|
|
14
12
|
config: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { toDeferResolve, toDependency, toEntry } from '../../util/input.js';
|
|
2
|
-
import { join } from '../../util/path.js';
|
|
1
|
+
import { toAlias, toDeferResolve, toDependency, toEntry } from '../../util/input.js';
|
|
2
|
+
import { join, toPosix } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
import { getEnvPackageName, getExternalReporters } from './helpers.js';
|
|
5
5
|
const title = 'Vitest';
|
|
@@ -14,7 +14,7 @@ const hasScriptWithCoverage = (scripts) => scripts
|
|
|
14
14
|
})
|
|
15
15
|
: false;
|
|
16
16
|
const findConfigDependencies = (localConfig, options) => {
|
|
17
|
-
const { manifest,
|
|
17
|
+
const { manifest, cwd: dir } = options;
|
|
18
18
|
const testConfig = localConfig.test;
|
|
19
19
|
if (!testConfig)
|
|
20
20
|
return [];
|
|
@@ -22,7 +22,6 @@ const findConfigDependencies = (localConfig, options) => {
|
|
|
22
22
|
const reporters = getExternalReporters(testConfig.reporters);
|
|
23
23
|
const hasCoverageEnabled = (testConfig.coverage && testConfig.coverage.enabled !== false) || hasScriptWithCoverage(manifest.scripts);
|
|
24
24
|
const coverage = hasCoverageEnabled ? [`@vitest/coverage-${testConfig.coverage?.provider ?? 'v8'}`] : [];
|
|
25
|
-
const dir = join(configFileDir, testConfig.root ?? '.');
|
|
26
25
|
const setupFiles = [testConfig.setupFiles ?? []].flat().map(specifier => ({ ...toDeferResolve(specifier), dir }));
|
|
27
26
|
const globalSetup = [testConfig.globalSetup ?? []].flat().map(specifier => ({ ...toDeferResolve(specifier), dir }));
|
|
28
27
|
const workspaceDependencies = [];
|
|
@@ -57,32 +56,45 @@ const getConfigs = async (localConfig) => {
|
|
|
57
56
|
}
|
|
58
57
|
return configs;
|
|
59
58
|
};
|
|
60
|
-
export const
|
|
59
|
+
export const resolveConfig = async (localConfig, options) => {
|
|
61
60
|
const inputs = new Set();
|
|
62
61
|
inputs.add(toEntry(join(options.cwd, 'src/vite-env.d.ts')));
|
|
63
62
|
const configs = await getConfigs(localConfig);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
const addStar = (value) => (value.endsWith('*') ? value : join(value, '*').replace(/\/\*\*$/, '/*'));
|
|
64
|
+
const addAliases = (aliasOptions) => {
|
|
65
|
+
for (const [alias, value] of Object.entries(aliasOptions)) {
|
|
66
|
+
if (!value)
|
|
67
|
+
continue;
|
|
68
|
+
const prefixes = [value].flat().map(prefix => {
|
|
69
|
+
if (toPosix(prefix).startsWith(options.cwd))
|
|
70
|
+
return prefix;
|
|
71
|
+
return join(options.cwd, prefix);
|
|
72
|
+
});
|
|
73
|
+
if (alias.length > 1)
|
|
74
|
+
inputs.add(toAlias(alias, prefixes));
|
|
75
|
+
inputs.add(toAlias(addStar(alias), prefixes.map(addStar)));
|
|
69
76
|
}
|
|
70
|
-
|
|
71
|
-
for (const dependency of options.config.entry ?? entry)
|
|
72
|
-
inputs.add(toEntry(join(dir, dependency)));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return Array.from(inputs);
|
|
76
|
-
};
|
|
77
|
-
export const resolveConfig = async (localConfig, options) => {
|
|
78
|
-
const inputs = new Set();
|
|
79
|
-
const configs = await getConfigs(localConfig);
|
|
77
|
+
};
|
|
80
78
|
for (const cfg of configs) {
|
|
79
|
+
const dir = join(options.cwd, cfg.test?.root ?? '.');
|
|
80
|
+
if (cfg.test) {
|
|
81
|
+
if (cfg.test?.include) {
|
|
82
|
+
for (const dependency of cfg.test.include)
|
|
83
|
+
dependency[0] !== '!' && inputs.add(toEntry(join(dir, dependency)));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
for (const dependency of options.config.entry ?? entry)
|
|
87
|
+
inputs.add(toEntry(join(dir, dependency)));
|
|
88
|
+
}
|
|
89
|
+
if (cfg.test.alias)
|
|
90
|
+
addAliases(cfg.test.alias);
|
|
91
|
+
}
|
|
92
|
+
if (cfg.resolve?.alias)
|
|
93
|
+
addAliases(cfg.resolve.alias);
|
|
81
94
|
for (const dependency of findConfigDependencies(cfg, options))
|
|
82
95
|
inputs.add(dependency);
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
const deps = (typeof entry === 'string' ? [entry] : Object.values(entry))
|
|
96
|
+
const _entry = cfg.build?.lib?.entry ?? [];
|
|
97
|
+
const deps = (typeof _entry === 'string' ? [_entry] : Object.values(_entry))
|
|
86
98
|
.map(specifier => join(dir, specifier))
|
|
87
99
|
.map(id => toEntry(id));
|
|
88
100
|
for (const dependency of deps)
|
|
@@ -99,7 +111,6 @@ export default {
|
|
|
99
111
|
isEnabled,
|
|
100
112
|
config,
|
|
101
113
|
entry,
|
|
102
|
-
resolveEntryPaths,
|
|
103
114
|
resolveConfig,
|
|
104
115
|
args,
|
|
105
116
|
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
interface Alias {
|
|
2
|
+
find: string | RegExp;
|
|
3
|
+
replacement: string;
|
|
4
|
+
customResolver?: any;
|
|
5
|
+
}
|
|
6
|
+
export type AliasOptions = readonly Alias[] | {
|
|
7
|
+
[find: string]: string;
|
|
8
|
+
};
|
|
1
9
|
interface VitestConfig {
|
|
2
10
|
test: {
|
|
3
11
|
include: string[];
|
|
@@ -15,6 +23,7 @@ interface VitestConfig {
|
|
|
15
23
|
workspace: never;
|
|
16
24
|
};
|
|
17
25
|
})[];
|
|
26
|
+
alias?: AliasOptions;
|
|
18
27
|
};
|
|
19
28
|
}
|
|
20
29
|
export interface ViteConfig extends VitestConfig {
|
|
@@ -26,6 +35,9 @@ export interface ViteConfig extends VitestConfig {
|
|
|
26
35
|
};
|
|
27
36
|
};
|
|
28
37
|
};
|
|
38
|
+
resolve?: {
|
|
39
|
+
alias?: AliasOptions;
|
|
40
|
+
};
|
|
29
41
|
}
|
|
30
42
|
export type COMMAND = 'dev' | 'serve' | 'build';
|
|
31
43
|
export type MODE = 'development' | 'production';
|
|
@@ -6,7 +6,7 @@ const enablers = ['vue'];
|
|
|
6
6
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
7
|
const config = ['vue.config.{js,ts}'];
|
|
8
8
|
const resolveConfig = async (config, options) => {
|
|
9
|
-
const {
|
|
9
|
+
const { manifest } = options;
|
|
10
10
|
const inputs = [];
|
|
11
11
|
if (config.configureWebpack) {
|
|
12
12
|
const baseConfig = {
|
|
@@ -17,10 +17,7 @@ const resolveConfig = async (config, options) => {
|
|
|
17
17
|
module: { rules: [] },
|
|
18
18
|
};
|
|
19
19
|
const modifiedConfig = typeof config.configureWebpack === 'function' ? config.configureWebpack(baseConfig) : config.configureWebpack;
|
|
20
|
-
const inputsFromConfig = await findWebpackDependenciesFromConfig(
|
|
21
|
-
config: modifiedConfig ?? baseConfig,
|
|
22
|
-
cwd,
|
|
23
|
-
});
|
|
20
|
+
const inputsFromConfig = await findWebpackDependenciesFromConfig(modifiedConfig ?? baseConfig, options);
|
|
24
21
|
for (const input of inputsFromConfig)
|
|
25
22
|
inputs.push(input);
|
|
26
23
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
|
|
2
|
-
import { type Input } from '../../util/input.js';
|
|
3
2
|
import type { WebpackConfig } from './types.js';
|
|
4
|
-
export declare const findWebpackDependenciesFromConfig:
|
|
5
|
-
config: WebpackConfig;
|
|
6
|
-
cwd: string;
|
|
7
|
-
}) => Promise<Set<Input>>;
|
|
3
|
+
export declare const findWebpackDependenciesFromConfig: ResolveConfig<WebpackConfig>;
|
|
8
4
|
declare const _default: {
|
|
9
5
|
title: string;
|
|
10
6
|
enablers: string[];
|