knip 5.1.2 → 5.1.3
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 +3 -3
- package/dist/ConfigurationValidator.d.ts +21 -21
- package/dist/ProjectPrincipal.d.ts +1 -1
- package/dist/ProjectPrincipal.js +3 -5
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/WorkspaceWorker.js +61 -44
- package/dist/binaries/index.js +2 -2
- package/dist/binaries/resolvers/index.d.ts +12 -12
- package/dist/compilers/index.d.ts +6 -7
- package/dist/compilers/index.js +0 -3
- package/dist/constants.d.ts +1 -2
- package/dist/constants.js +8 -4
- package/dist/plugins/_template/index.d.ts +10 -9
- package/dist/plugins/_template/index.js +16 -30
- package/dist/plugins/angular/index.d.ts +8 -6
- package/dist/plugins/angular/index.js +17 -22
- package/dist/plugins/astro/index.d.ts +7 -7
- package/dist/plugins/astro/index.js +14 -17
- package/dist/plugins/ava/index.d.ts +9 -7
- package/dist/plugins/ava/index.js +19 -21
- package/dist/plugins/babel/helpers.js +1 -1
- package/dist/plugins/babel/index.d.ts +7 -7
- package/dist/plugins/babel/index.js +15 -26
- package/dist/plugins/capacitor/index.d.ts +7 -6
- package/dist/plugins/capacitor/index.js +11 -18
- package/dist/plugins/changesets/index.d.ts +7 -6
- package/dist/plugins/changesets/index.js +14 -21
- package/dist/plugins/changesets/types.d.ts +3 -0
- package/dist/plugins/changesets/types.js +1 -0
- package/dist/plugins/commitizen/index.d.ts +8 -7
- package/dist/plugins/commitizen/index.js +13 -21
- package/dist/plugins/commitlint/index.d.ts +9 -6
- package/dist/plugins/commitlint/index.js +11 -19
- package/dist/plugins/cspell/index.d.ts +7 -6
- package/dist/plugins/cspell/index.js +12 -20
- package/dist/plugins/cypress/index.d.ts +7 -7
- package/dist/plugins/cypress/index.js +13 -21
- package/dist/plugins/drizzle/index.d.ts +7 -6
- package/dist/plugins/drizzle/index.js +13 -16
- package/dist/plugins/eleventy/index.d.ts +11 -9
- package/dist/plugins/eleventy/index.js +35 -41
- package/dist/plugins/eslint/helpers.d.ts +3 -5
- package/dist/plugins/eslint/helpers.js +10 -15
- package/dist/plugins/eslint/index.d.ts +10 -8
- package/dist/plugins/eslint/index.js +15 -29
- package/dist/plugins/gatsby/index.d.ts +8 -7
- package/dist/plugins/gatsby/index.js +15 -22
- package/dist/plugins/github-actions/index.d.ts +6 -6
- package/dist/plugins/github-actions/index.js +15 -25
- package/dist/plugins/graphql-codegen/index.d.ts +8 -7
- package/dist/plugins/graphql-codegen/index.js +15 -23
- package/dist/plugins/husky/index.d.ts +6 -6
- package/dist/plugins/husky/index.js +10 -16
- package/dist/plugins/jest/index.d.ts +9 -7
- package/dist/plugins/jest/index.js +50 -31
- package/dist/plugins/lefthook/index.d.ts +6 -6
- package/dist/plugins/lefthook/index.js +19 -24
- package/dist/plugins/lint-staged/index.d.ts +8 -7
- package/dist/plugins/lint-staged/index.js +16 -23
- package/dist/plugins/linthtml/index.d.ts +8 -7
- package/dist/plugins/linthtml/index.js +16 -24
- package/dist/plugins/markdownlint/index.d.ts +7 -6
- package/dist/plugins/markdownlint/index.js +12 -17
- package/dist/plugins/mocha/index.d.ts +9 -7
- package/dist/plugins/mocha/index.js +19 -22
- package/dist/plugins/msw/index.d.ts +8 -7
- package/dist/plugins/msw/index.js +12 -15
- package/dist/plugins/netlify/index.d.ts +9 -7
- package/dist/plugins/netlify/index.js +23 -27
- package/dist/plugins/next/index.d.ts +6 -7
- package/dist/plugins/next/index.js +10 -18
- package/dist/plugins/node-test-runner/index.d.ts +5 -6
- package/dist/plugins/node-test-runner/index.js +6 -18
- package/dist/plugins/npm-package-json-lint/index.d.ts +8 -7
- package/dist/plugins/npm-package-json-lint/index.js +12 -19
- package/dist/plugins/nx/index.d.ts +7 -6
- package/dist/plugins/nx/index.js +18 -27
- package/dist/plugins/nyc/index.d.ts +7 -6
- package/dist/plugins/nyc/index.js +11 -17
- package/dist/plugins/playwright/index.d.ts +11 -13
- package/dist/plugins/playwright/index.js +23 -30
- package/dist/plugins/playwright-ct/index.d.ts +8 -7
- package/dist/plugins/playwright-ct/index.js +12 -24
- package/dist/plugins/postcss/index.d.ts +7 -6
- package/dist/plugins/postcss/index.js +12 -21
- package/dist/plugins/prettier/index.d.ts +7 -6
- package/dist/plugins/prettier/index.js +14 -20
- package/dist/plugins/release-it/index.d.ts +8 -7
- package/dist/plugins/release-it/index.js +18 -27
- package/dist/plugins/remark/index.d.ts +8 -7
- package/dist/plugins/remark/index.js +13 -28
- package/dist/plugins/remix/index.d.ts +6 -7
- package/dist/plugins/remix/index.js +10 -20
- package/dist/plugins/rollup/index.d.ts +5 -6
- package/dist/plugins/rollup/index.js +8 -16
- package/dist/plugins/semantic-release/index.d.ts +8 -7
- package/dist/plugins/semantic-release/index.js +13 -25
- package/dist/plugins/sentry/index.d.ts +5 -6
- package/dist/plugins/sentry/index.js +8 -16
- package/dist/plugins/storybook/index.d.ts +10 -8
- package/dist/plugins/storybook/index.js +28 -35
- package/dist/plugins/stryker/index.d.ts +7 -6
- package/dist/plugins/stryker/index.js +10 -18
- package/dist/plugins/stylelint/index.d.ts +7 -6
- package/dist/plugins/stylelint/index.js +13 -23
- package/dist/plugins/svelte/index.d.ts +7 -8
- package/dist/plugins/svelte/index.js +13 -23
- package/dist/plugins/tailwind/index.d.ts +5 -6
- package/dist/plugins/tailwind/index.js +8 -14
- package/dist/plugins/tsup/index.d.ts +7 -6
- package/dist/plugins/tsup/index.js +14 -21
- package/dist/plugins/typedoc/index.d.ts +10 -7
- package/dist/plugins/typedoc/index.js +14 -24
- package/dist/plugins/typescript/index.d.ts +8 -7
- package/dist/plugins/typescript/index.js +31 -25
- package/dist/plugins/unbuild/index.d.ts +7 -6
- package/dist/plugins/unbuild/index.js +12 -17
- package/dist/plugins/vercel-og/index.d.ts +5 -6
- package/dist/plugins/vercel-og/index.js +8 -16
- package/dist/plugins/vite/index.d.ts +9 -7
- package/dist/plugins/vite/index.js +13 -18
- package/dist/plugins/vitest/index.d.ts +11 -9
- package/dist/plugins/vitest/index.js +62 -49
- package/dist/plugins/vue/index.d.ts +7 -6
- package/dist/plugins/vue/index.js +14 -26
- package/dist/plugins/webpack/index.d.ts +7 -6
- package/dist/plugins/webpack/index.js +17 -20
- package/dist/plugins/wireit/index.d.ts +8 -7
- package/dist/plugins/wireit/index.js +12 -20
- package/dist/plugins/yorkie/index.d.ts +8 -7
- package/dist/plugins/yorkie/index.js +13 -21
- package/dist/plugins.d.ts +3 -0
- package/dist/plugins.js +14 -0
- package/dist/reporters/index.d.ts +5 -5
- package/dist/types/config.d.ts +1 -1
- package/dist/types/package-json.d.ts +12 -13
- package/dist/types/plugins.d.ts +20 -14
- package/dist/types/util.d.ts +0 -13
- package/dist/typescript/SourceFileManager.js +3 -0
- package/dist/typescript/createHosts.js +4 -3
- package/dist/typescript/resolveModuleNames.js +26 -41
- 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/propertyAccessCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/requireCall.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/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/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/Performance.d.ts +1 -4
- package/dist/util/Performance.js +5 -1
- package/dist/util/fs.js +0 -3
- package/dist/util/loader.d.ts +0 -2
- package/dist/util/loader.js +8 -16
- package/dist/util/object.d.ts +1 -1
- package/dist/util/path.d.ts +0 -3
- package/dist/util/path.js +0 -1
- package/dist/util/plugin.d.ts +4 -1
- package/dist/util/plugin.js +28 -1
- package/dist/util/require.d.ts +1 -0
- package/dist/util/require.js +13 -0
- package/dist/util/tsconfig-loader.js +1 -2
- package/dist/util/type.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -1
- package/dist/plugins/eslint/fallback.d.ts +0 -1
- package/dist/plugins/eslint/fallback.js +0 -18
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IsPluginEnabled } from '#p/types/plugins.js';
|
|
2
2
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
findDependencies: GenericPluginCallback;
|
|
3
|
+
title: string;
|
|
4
|
+
enablers: string[];
|
|
5
|
+
isEnabled: IsPluginEnabled;
|
|
6
|
+
entry: string[];
|
|
8
7
|
};
|
|
9
8
|
export default _default;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { hasDependency } from '
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const ENTRY_FILE_PATTERNS = ['tailwind.config.{js,cjs,mjs,ts}'];
|
|
7
|
-
const findDependencies = async (configFilePath, options) => {
|
|
8
|
-
const { config } = options;
|
|
9
|
-
return config.entry ? config.entry.map(toEntryPattern) : ENTRY_FILE_PATTERNS.map(toEntryPattern);
|
|
10
|
-
};
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
2
|
+
const title = 'Tailwind';
|
|
3
|
+
const enablers = ['tailwindcss'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const entry = ['tailwind.config.{js,cjs,mjs,ts}'];
|
|
11
6
|
export default {
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
title,
|
|
8
|
+
enablers,
|
|
14
9
|
isEnabled,
|
|
15
|
-
|
|
16
|
-
findDependencies,
|
|
10
|
+
entry,
|
|
17
11
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolveConfig, IsPluginEnabled } from '#p/types/plugins.js';
|
|
2
|
+
import type { TsupConfig } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
readonly title: "tsup";
|
|
5
|
+
readonly enablers: string[];
|
|
6
|
+
readonly isEnabled: IsPluginEnabled;
|
|
7
|
+
readonly config: string[];
|
|
8
|
+
readonly resolveConfig: ResolveConfig<TsupConfig>;
|
|
8
9
|
};
|
|
9
10
|
export default _default;
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
let localConfig = basename(configFilePath) === 'package.json' ? manifest.tsup : await load(configFilePath);
|
|
12
|
-
if (typeof localConfig === 'function')
|
|
13
|
-
localConfig = await localConfig({});
|
|
14
|
-
if (!localConfig)
|
|
15
|
-
return [];
|
|
16
|
-
const entryPatterns = [localConfig]
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
2
|
+
import { toEntryPattern } from '#p/util/protocols.js';
|
|
3
|
+
const title = 'tsup';
|
|
4
|
+
const enablers = ['tsup'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const config = ['tsup.config.{js,ts,cjs,json}', 'package.json'];
|
|
7
|
+
const resolveConfig = async (config) => {
|
|
8
|
+
if (typeof config === 'function')
|
|
9
|
+
config = await config({});
|
|
10
|
+
const entryPatterns = [config]
|
|
17
11
|
.flat()
|
|
18
12
|
.flatMap(config => {
|
|
19
13
|
if (!config.entry)
|
|
@@ -26,11 +20,10 @@ const findTsupDependencies = async (configFilePath, options) => {
|
|
|
26
20
|
.map(toEntryPattern);
|
|
27
21
|
return entryPatterns;
|
|
28
22
|
};
|
|
29
|
-
const findDependencies = timerify(findTsupDependencies);
|
|
30
23
|
export default {
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
title,
|
|
25
|
+
enablers,
|
|
33
26
|
isEnabled,
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
config,
|
|
28
|
+
resolveConfig,
|
|
36
29
|
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
|
|
2
|
+
import type { TypeDocConfig } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
readonly title: "TypeDoc";
|
|
5
|
+
readonly enablers: string[];
|
|
6
|
+
readonly isEnabled: IsPluginEnabled;
|
|
7
|
+
readonly packageJsonPath: "typedocOptions";
|
|
8
|
+
readonly config: string[];
|
|
9
|
+
readonly resolveConfig: ResolveConfig<TypeDocConfig | {
|
|
10
|
+
typedocOptions: TypeDocConfig;
|
|
11
|
+
}>;
|
|
9
12
|
};
|
|
10
13
|
export default _default;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const PACKAGE_JSON_PATH = 'typedocOptions';
|
|
8
|
-
const CONFIG_FILE_PATTERNS = [
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
2
|
+
const title = 'TypeDoc';
|
|
3
|
+
const enablers = ['typedoc'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const packageJsonPath = 'typedocOptions';
|
|
6
|
+
const config = [
|
|
9
7
|
'typedoc.{js,cjs,json,jsonc}',
|
|
10
8
|
'typedoc.config.{js,cjs}',
|
|
11
9
|
'.config/typedoc.{js,cjs,json,jsonc}',
|
|
@@ -13,23 +11,15 @@ const CONFIG_FILE_PATTERNS = [
|
|
|
13
11
|
'package.json',
|
|
14
12
|
'tsconfig.json',
|
|
15
13
|
];
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return [];
|
|
20
|
-
const localConfig = basename(configFilePath) === 'package.json'
|
|
21
|
-
? manifest[PACKAGE_JSON_PATH]
|
|
22
|
-
: basename(configFilePath) === 'tsconfig.json'
|
|
23
|
-
? (await load(configFilePath)).typedocOptions
|
|
24
|
-
: await load(configFilePath);
|
|
25
|
-
return localConfig?.plugin ?? [];
|
|
14
|
+
const resolveConfig = config => {
|
|
15
|
+
config = 'typedocOptions' in config ? config.typedocOptions : config;
|
|
16
|
+
return config?.plugin ?? [];
|
|
26
17
|
};
|
|
27
|
-
const findDependencies = timerify(findTypeDocDependencies);
|
|
28
18
|
export default {
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
title,
|
|
20
|
+
enablers,
|
|
31
21
|
isEnabled,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
packageJsonPath,
|
|
23
|
+
config,
|
|
24
|
+
resolveConfig,
|
|
35
25
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
|
|
2
|
+
export declare const resolveConfig: ResolveConfig;
|
|
3
3
|
declare const _default: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
isEnabled:
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
title: string;
|
|
5
|
+
enablers: string[];
|
|
6
|
+
isEnabled: IsPluginEnabled;
|
|
7
|
+
config: string[];
|
|
8
|
+
production: string[];
|
|
9
|
+
resolveConfig: ResolveConfig;
|
|
9
10
|
};
|
|
10
11
|
export default _default;
|
|
@@ -1,33 +1,39 @@
|
|
|
1
|
-
import { compact } from '
|
|
2
|
-
import { dirname, isInternal, toAbsolute } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
1
|
+
import { compact } from '#p/util/array.js';
|
|
2
|
+
import { dirname, isInternal, join, toAbsolute } from '#p/util/path.js';
|
|
3
|
+
import { hasDependency, loadJSON } from '#p/util/plugin.js';
|
|
4
|
+
import { loadTSConfig } from '#p/util/tsconfig-loader.js';
|
|
5
|
+
const title = 'TypeScript';
|
|
6
|
+
const enablers = ['typescript'];
|
|
7
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
|
+
const config = ['tsconfig.json', 'tsconfig.*.json'];
|
|
9
|
+
const production = [];
|
|
10
10
|
const resolveExtensibleConfig = async (configFilePath) => {
|
|
11
11
|
const filePath = configFilePath.replace(/(\.json)?$/, '.json');
|
|
12
12
|
const localConfig = await loadJSON(filePath);
|
|
13
13
|
if (!localConfig)
|
|
14
14
|
return;
|
|
15
|
-
localConfig.extends = localConfig.extends ? [localConfig.extends].flat() : [];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
localConfig.extends.push(...(presetConfig?.extends ? [presetConfig.extends].flat() : []));
|
|
22
|
-
}
|
|
15
|
+
const extends_ = (localConfig.extends = localConfig.extends ? [localConfig.extends].flat() : []);
|
|
16
|
+
for (const extend of extends_) {
|
|
17
|
+
if (isInternal(extend)) {
|
|
18
|
+
const presetConfigPath = toAbsolute(extend, dirname(configFilePath));
|
|
19
|
+
const presetConfig = await resolveExtensibleConfig(presetConfigPath);
|
|
20
|
+
localConfig.extends.push(...(presetConfig?.extends ? [presetConfig.extends].flat() : []));
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
23
|
return localConfig;
|
|
26
24
|
};
|
|
27
|
-
export const
|
|
28
|
-
const { isProduction } = options;
|
|
25
|
+
export const resolveConfig = async (localConfig, options) => {
|
|
26
|
+
const { isProduction, configFileDir, configFileName } = options;
|
|
27
|
+
const configFilePath = join(configFileDir, configFileName);
|
|
29
28
|
const { compilerOptions } = await loadTSConfig(configFilePath);
|
|
30
|
-
const localConfig =
|
|
29
|
+
const extends_ = (localConfig.extends = localConfig.extends ? [localConfig.extends].flat() : []);
|
|
30
|
+
for (const extend of extends_) {
|
|
31
|
+
if (isInternal(extend)) {
|
|
32
|
+
const presetConfigPath = toAbsolute(extend, dirname(configFilePath));
|
|
33
|
+
const presetConfig = await resolveExtensibleConfig(presetConfigPath);
|
|
34
|
+
localConfig.extends.push(...(presetConfig?.extends ? [presetConfig.extends].flat() : []));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
31
37
|
if (!compilerOptions || !localConfig)
|
|
32
38
|
return [];
|
|
33
39
|
const jsx = compilerOptions?.jsxImportSource ? [compilerOptions.jsxImportSource] : [];
|
|
@@ -41,11 +47,11 @@ export const findTypeScriptDependencies = async (configFilePath, options) => {
|
|
|
41
47
|
const importHelpers = compilerOptions?.importHelpers ? ['tslib'] : [];
|
|
42
48
|
return compact([...extend, ...types, ...plugins, ...importHelpers, ...jsx]);
|
|
43
49
|
};
|
|
44
|
-
const findDependencies = timerify(findTypeScriptDependencies);
|
|
45
50
|
export default {
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
title,
|
|
52
|
+
enablers,
|
|
48
53
|
isEnabled,
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
config,
|
|
55
|
+
production,
|
|
56
|
+
resolveConfig,
|
|
51
57
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolveConfig, IsPluginEnabled } from '#p/types/plugins.js';
|
|
2
|
+
import type { UnbuildConfig } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
readonly title: "unbuild";
|
|
5
|
+
readonly enablers: string[];
|
|
6
|
+
readonly isEnabled: IsPluginEnabled;
|
|
7
|
+
readonly config: string[];
|
|
8
|
+
readonly resolveConfig: ResolveConfig<UnbuildConfig>;
|
|
8
9
|
};
|
|
9
10
|
export default _default;
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const localConfig = await load(configFilePath);
|
|
10
|
-
if (!localConfig)
|
|
11
|
-
return [];
|
|
12
|
-
return [localConfig]
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
2
|
+
import { toEntryPattern } from '#p/util/protocols.js';
|
|
3
|
+
const title = 'unbuild';
|
|
4
|
+
const enablers = ['unbuild'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
const config = ['build.config.{js,cjs,mjs,ts,mts,cts,json}'];
|
|
7
|
+
const resolveConfig = config => {
|
|
8
|
+
return [config]
|
|
13
9
|
.flat()
|
|
14
10
|
.map(obj => obj.entries)
|
|
15
11
|
.flatMap(entries => entries?.map(entry => (typeof entry === 'string' ? entry : entry.input)) ?? [])
|
|
16
12
|
.map(toEntryPattern);
|
|
17
13
|
};
|
|
18
|
-
const findDependencies = timerify(findUnbuildDependencies);
|
|
19
14
|
export default {
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
title,
|
|
16
|
+
enablers,
|
|
22
17
|
isEnabled,
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
config,
|
|
19
|
+
resolveConfig,
|
|
25
20
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IsPluginEnabled } from '#p/types/plugins.js';
|
|
2
2
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
findDependencies: GenericPluginCallback;
|
|
3
|
+
title: string;
|
|
4
|
+
enablers: string[];
|
|
5
|
+
isEnabled: IsPluginEnabled;
|
|
6
|
+
production: string[];
|
|
8
7
|
};
|
|
9
8
|
export default _default;
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import { hasDependency } from '
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const PRODUCTION_ENTRY_FILE_PATTERNS = [
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
2
|
+
const title = 'Vercel OG';
|
|
3
|
+
const enablers = ['next', '@vercel/og'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const production = [
|
|
7
6
|
'{src/,}pages/api/og.{jsx,tsx}',
|
|
8
7
|
'{src/,}app/api/og/route.{jsx,tsx}',
|
|
9
8
|
];
|
|
10
|
-
const findDependencies = async (configFilePath, options) => {
|
|
11
|
-
const { config } = options;
|
|
12
|
-
return config.entry
|
|
13
|
-
? config.entry.map(toProductionEntryPattern)
|
|
14
|
-
: PRODUCTION_ENTRY_FILE_PATTERNS.map(toProductionEntryPattern);
|
|
15
|
-
};
|
|
16
9
|
export default {
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
title,
|
|
11
|
+
enablers,
|
|
19
12
|
isEnabled,
|
|
20
|
-
|
|
21
|
-
findDependencies,
|
|
13
|
+
production,
|
|
22
14
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const
|
|
1
|
+
import type { IsPluginEnabled } from '#p/types/plugins.js';
|
|
2
|
+
export declare const config: string[];
|
|
3
3
|
declare const _default: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
isEnabled:
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
title: string;
|
|
5
|
+
enablers: string[];
|
|
6
|
+
isEnabled: IsPluginEnabled;
|
|
7
|
+
config: string[];
|
|
8
|
+
production: string[];
|
|
9
|
+
resolveEntryPaths: import("#p/types/plugins.js").ResolveEntryPaths<import("#p/plugins/vitest/types.ts").ViteConfigOrFn | import("#p/plugins/vitest/types.ts").VitestWorkspaceConfig>;
|
|
10
|
+
resolveConfig: import("#p/types/plugins.js").ResolveConfig<import("#p/plugins/vitest/types.ts").ViteConfigOrFn | import("#p/plugins/vitest/types.ts").VitestWorkspaceConfig>;
|
|
9
11
|
};
|
|
10
12
|
export default _default;
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const findViteDependencies = async (configFilePath, options) => {
|
|
9
|
-
const localConfig = await load(configFilePath);
|
|
10
|
-
if (!localConfig)
|
|
11
|
-
return [];
|
|
12
|
-
return findVitestDependencies(configFilePath, localConfig, options);
|
|
13
|
-
};
|
|
14
|
-
const findDependencies = timerify(findViteDependencies);
|
|
1
|
+
import { hasDependency } from '#p/util/plugin.js';
|
|
2
|
+
import { resolveEntryPaths, resolveConfig } from '../vitest/index.js';
|
|
3
|
+
const title = 'Vite';
|
|
4
|
+
const enablers = ['vite'];
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
+
export const config = ['vite*.config.{js,mjs,ts,cjs,mts,cts}'];
|
|
7
|
+
const production = [];
|
|
15
8
|
export default {
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
title,
|
|
10
|
+
enablers,
|
|
18
11
|
isEnabled,
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
config,
|
|
13
|
+
production,
|
|
14
|
+
resolveEntryPaths,
|
|
15
|
+
resolveConfig,
|
|
21
16
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export declare const
|
|
1
|
+
import type { IsPluginEnabled, ResolveEntryPaths, ResolveConfig } from '#p/types/plugins.js';
|
|
2
|
+
import type { ViteConfigOrFn, VitestWorkspaceConfig } from './types.js';
|
|
3
|
+
export declare const resolveEntryPaths: ResolveEntryPaths<ViteConfigOrFn | VitestWorkspaceConfig>;
|
|
4
|
+
export declare const resolveConfig: ResolveConfig<ViteConfigOrFn | VitestWorkspaceConfig>;
|
|
4
5
|
declare const _default: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
isEnabled:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
title: string;
|
|
7
|
+
enablers: string[];
|
|
8
|
+
isEnabled: IsPluginEnabled;
|
|
9
|
+
config: string[];
|
|
10
|
+
entry: string[];
|
|
11
|
+
resolveEntryPaths: ResolveEntryPaths<ViteConfigOrFn | VitestWorkspaceConfig>;
|
|
12
|
+
resolveConfig: ResolveConfig<ViteConfigOrFn | VitestWorkspaceConfig>;
|
|
11
13
|
};
|
|
12
14
|
export default _default;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { hasDependency, load, tryResolve } from '../../util/plugin.js';
|
|
5
|
-
import { toEntryPattern } from '../../util/protocols.js';
|
|
1
|
+
import { isAbsolute, join, relative } from '#p/util/path.js';
|
|
2
|
+
import { hasDependency, tryResolve } from '#p/util/plugin.js';
|
|
3
|
+
import { toEntryPattern } from '#p/util/protocols.js';
|
|
6
4
|
import { getEnvPackageName, getExternalReporters } from './helpers.js';
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const isEnabled = ({ dependencies }) => hasDependency(dependencies,
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const resolveEntry = (
|
|
13
|
-
const
|
|
14
|
-
const resolvedPath = isAbsolute(specifier)
|
|
5
|
+
const title = 'Vitest';
|
|
6
|
+
const enablers = ['vitest'];
|
|
7
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
|
+
const config = ['vitest*.config.{js,mjs,ts,cjs,mts,cts}', 'vitest.{workspace,projects}.{ts,js,json}'];
|
|
9
|
+
const entry = ['**/*.{test,test-d,spec}.?(c|m)[jt]s?(x)'];
|
|
10
|
+
const resolveEntry = (options, specifier) => {
|
|
11
|
+
const { configFileDir, configFileName } = options;
|
|
12
|
+
const resolvedPath = isAbsolute(specifier)
|
|
13
|
+
? specifier
|
|
14
|
+
: tryResolve(join(configFileDir, specifier), join(configFileDir, configFileName));
|
|
15
15
|
if (resolvedPath)
|
|
16
|
-
return toEntryPattern(relative(
|
|
16
|
+
return toEntryPattern(relative(configFileDir, resolvedPath));
|
|
17
17
|
return specifier;
|
|
18
18
|
};
|
|
19
19
|
const isVitestCoverageCommand = /vitest(.+)--coverage(?:\.enabled(?:=true)?)?/;
|
|
@@ -22,55 +22,68 @@ const hasScriptWithCoverage = (scripts) => scripts
|
|
|
22
22
|
return isVitestCoverageCommand.test(script);
|
|
23
23
|
})
|
|
24
24
|
: false;
|
|
25
|
-
const findConfigDependencies = (
|
|
26
|
-
const {
|
|
25
|
+
const findConfigDependencies = (localConfig, options) => {
|
|
26
|
+
const { manifest } = options;
|
|
27
27
|
const testConfig = localConfig.test;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return entryPatterns;
|
|
28
|
+
if (!testConfig)
|
|
29
|
+
return [];
|
|
31
30
|
const environments = testConfig.environment ? [getEnvPackageName(testConfig.environment)] : [];
|
|
32
31
|
const reporters = getExternalReporters(testConfig.reporters);
|
|
33
32
|
const hasCoverageEnabled = (testConfig.coverage && testConfig.coverage.enabled !== false) || hasScriptWithCoverage(manifest.scripts);
|
|
34
33
|
const coverage = hasCoverageEnabled ? [`@vitest/coverage-${testConfig.coverage?.provider ?? 'v8'}`] : [];
|
|
35
|
-
const setupFiles = [testConfig.setupFiles ?? []].flat().map(v => resolveEntry(
|
|
36
|
-
const globalSetup = [testConfig.globalSetup ?? []].flat().map(v => resolveEntry(
|
|
37
|
-
return [...
|
|
34
|
+
const setupFiles = [testConfig.setupFiles ?? []].flat().map(v => resolveEntry(options, v));
|
|
35
|
+
const globalSetup = [testConfig.globalSetup ?? []].flat().map(v => resolveEntry(options, v));
|
|
36
|
+
return [...environments, ...reporters, ...coverage, ...setupFiles, ...globalSetup];
|
|
38
37
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
const getConfigs = async (localConfig) => {
|
|
39
|
+
const configs = [];
|
|
40
|
+
for (const config of [localConfig].flat()) {
|
|
41
|
+
if (config && typeof config !== 'string') {
|
|
42
|
+
if (typeof config === 'function') {
|
|
43
|
+
for (const command of ['dev', 'serve', 'build']) {
|
|
44
|
+
for (const mode of ['development', 'production']) {
|
|
45
|
+
const cfg = await config({ command, mode, ssrBuild: undefined });
|
|
46
|
+
configs.push(cfg);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
configs.push(config);
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
|
-
return Array.from(dependencies);
|
|
51
54
|
}
|
|
52
|
-
|
|
53
|
-
const dependencies = (typeof entry === 'string' ? [entry] : Object.values(entry)).map(specifier => resolveEntry(configFilePath, specifier));
|
|
54
|
-
if (!options.enabledPlugins.includes('vitest'))
|
|
55
|
-
return dependencies;
|
|
56
|
-
return compact([...dependencies, ...findConfigDependencies(configFilePath, localConfig, options)]);
|
|
55
|
+
return configs;
|
|
57
56
|
};
|
|
58
|
-
const
|
|
59
|
-
const localConfig = await load(configFilePath);
|
|
57
|
+
export const resolveEntryPaths = async (localConfig, options) => {
|
|
60
58
|
const dependencies = new Set();
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
const configs = await getConfigs(localConfig);
|
|
60
|
+
for (const cfg of configs) {
|
|
61
|
+
if (cfg.test?.include) {
|
|
62
|
+
cfg.test.include.forEach(dependency => dependencies.add(dependency));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
(options.config.entry ?? entry).forEach(dependency => dependencies.add(dependency));
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
|
-
return
|
|
68
|
+
return Array.from(dependencies).map(toEntryPattern);
|
|
69
|
+
};
|
|
70
|
+
export const resolveConfig = async (localConfig, options) => {
|
|
71
|
+
const dependencies = new Set();
|
|
72
|
+
const configs = await getConfigs(localConfig);
|
|
73
|
+
for (const cfg of configs) {
|
|
74
|
+
findConfigDependencies(cfg, options).forEach(dependency => dependencies.add(dependency));
|
|
75
|
+
const entry = cfg.build?.lib?.entry ?? [];
|
|
76
|
+
const deps = (typeof entry === 'string' ? [entry] : Object.values(entry)).map(specifier => resolveEntry(options, specifier));
|
|
77
|
+
deps.forEach(dependency => dependencies.add(dependency));
|
|
78
|
+
}
|
|
79
|
+
return Array.from(dependencies);
|
|
67
80
|
};
|
|
68
|
-
const findDependencies = timerify(findVitestWorkspaceDependencies);
|
|
69
81
|
export default {
|
|
70
|
-
|
|
71
|
-
|
|
82
|
+
title,
|
|
83
|
+
enablers,
|
|
72
84
|
isEnabled,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
config,
|
|
86
|
+
entry,
|
|
87
|
+
resolveEntryPaths,
|
|
88
|
+
resolveConfig,
|
|
76
89
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolveConfig, IsPluginEnabled } from '#p/types/plugins.js';
|
|
2
|
+
import type { VueConfig } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isEnabled:
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
readonly title: "Vue";
|
|
5
|
+
readonly enablers: string[];
|
|
6
|
+
readonly isEnabled: IsPluginEnabled;
|
|
7
|
+
readonly config: string[];
|
|
8
|
+
readonly resolveConfig: ResolveConfig<VueConfig>;
|
|
8
9
|
};
|
|
9
10
|
export default _default;
|