knip 6.44.2 → 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/npm.js +7 -5
- package/dist/binaries/resolvers/npx.js +8 -40
- package/dist/binaries/util.d.ts +13 -1
- package/dist/binaries/util.js +35 -1
- package/dist/cli.js +10 -84
- 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 +2 -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 +19 -5
- 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/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 +2 -2
- 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/stryker/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/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 +14 -16
- 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 +4 -2
- 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 +10 -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 +6 -7
- 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,5 +1,5 @@
|
|
|
1
1
|
import { arrayify } from '../../util/array.js';
|
|
2
|
-
import { toDeferResolve, toEntry } from '../../util/input.js';
|
|
2
|
+
import { toDeferResolve, toDeferResolveEntry, toEntry } from '../../util/input.js';
|
|
3
3
|
import { join, toAbsolute } from '../../util/path.js';
|
|
4
4
|
import { hasDependency } from '../../util/plugin.js';
|
|
5
5
|
const title = 'Playwright';
|
|
@@ -18,9 +18,9 @@ export const resolveConfig = async (localConfig, options) => {
|
|
|
18
18
|
const { configFileDir } = options;
|
|
19
19
|
const inputs = [];
|
|
20
20
|
for (const id of arrayify(localConfig.globalSetup))
|
|
21
|
-
inputs.push(
|
|
21
|
+
inputs.push(toDeferResolveEntry(toAbsolute(id, configFileDir)));
|
|
22
22
|
for (const id of arrayify(localConfig.globalTeardown))
|
|
23
|
-
inputs.push(
|
|
23
|
+
inputs.push(toDeferResolveEntry(toAbsolute(id, configFileDir)));
|
|
24
24
|
for (const server of [localConfig.webServer].flat()) {
|
|
25
25
|
if (!server?.command)
|
|
26
26
|
continue;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toDeferResolveEntry } from '../../util/input.js';
|
|
2
2
|
import { isInternal } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'pm2';
|
|
5
5
|
const enablers = ['pm2'];
|
|
6
6
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
7
|
const config = ['pm2.config.{json,js,cjs,mjs}', 'ecosystem.config.{json,js,cjs,mjs}'];
|
|
8
|
-
const addApplicationEntry = (application, entries) => {
|
|
8
|
+
const addApplicationEntry = (application, entries, cwd) => {
|
|
9
9
|
if (application.script && isInternal(application.script))
|
|
10
|
-
entries.push(
|
|
10
|
+
entries.push(toDeferResolveEntry(application.script, { dir: cwd }));
|
|
11
11
|
};
|
|
12
|
-
const resolveConfig = config => {
|
|
12
|
+
const resolveConfig = (config, { cwd }) => {
|
|
13
13
|
const entries = [];
|
|
14
14
|
if (Array.isArray(config)) {
|
|
15
15
|
for (const application of config)
|
|
16
|
-
addApplicationEntry(application, entries);
|
|
16
|
+
addApplicationEntry(application, entries, cwd);
|
|
17
17
|
return entries;
|
|
18
18
|
}
|
|
19
|
-
addApplicationEntry(config, entries);
|
|
19
|
+
addApplicationEntry(config, entries, cwd);
|
|
20
20
|
if (!config.apps)
|
|
21
21
|
return entries;
|
|
22
22
|
const applications = Array.isArray(config.apps) ? config.apps : [config.apps];
|
|
23
23
|
for (const application of applications)
|
|
24
|
-
addApplicationEntry(application, entries);
|
|
24
|
+
addApplicationEntry(application, entries, cwd);
|
|
25
25
|
return entries;
|
|
26
26
|
};
|
|
27
27
|
const plugin = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { toDeferResolve, toDependency } from '../../util/input.js';
|
|
2
|
+
import { isInternal } from '../../util/path.js';
|
|
2
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
4
|
const title = 'Prettier';
|
|
4
5
|
const enablers = ['prettier'];
|
|
@@ -17,7 +18,7 @@ const resolveConfig = config => {
|
|
|
17
18
|
if (Array.isArray(options.plugins)) {
|
|
18
19
|
for (const plugin of options.plugins) {
|
|
19
20
|
if (typeof plugin === 'string') {
|
|
20
|
-
result.add(toDependency(plugin));
|
|
21
|
+
result.add(isInternal(plugin) ? toDeferResolve(plugin) : toDependency(plugin));
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isDirectory } from '../../util/fs.js';
|
|
2
|
-
import { toEntry } from '../../util/input.js';
|
|
2
|
+
import { toDeferResolveEntry, toEntry } from '../../util/input.js';
|
|
3
3
|
import { join } from '../../util/path.js';
|
|
4
4
|
import { hasDependency } from '../../util/plugin.js';
|
|
5
5
|
import compiler from './compiler.js';
|
|
@@ -14,7 +14,7 @@ const config = [
|
|
|
14
14
|
];
|
|
15
15
|
const resolveSchema = (path, cwd) => {
|
|
16
16
|
if (!isDirectory(cwd, path)) {
|
|
17
|
-
return
|
|
17
|
+
return toDeferResolveEntry(path, { dir: cwd });
|
|
18
18
|
}
|
|
19
19
|
return toEntry(join(path, '**/*.prisma'));
|
|
20
20
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { findProperty, getFirstPropertyValue, getStringValues, resolveObjectArg, } from '../../typescript/ast-helpers.js';
|
|
2
2
|
import { getStringValue } from '../../typescript/ast-nodes.js';
|
|
3
|
-
import {
|
|
3
|
+
import { toDependency, toDeferResolveProductionEntry, toProductionEntry } from '../../util/input.js';
|
|
4
4
|
import { join } from '../../util/path.js';
|
|
5
5
|
const sourceFilesEntries = [
|
|
6
6
|
['rootComponent', ['src/App.vue']],
|
|
@@ -31,7 +31,6 @@ const getConfigObject = (program) => {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
const withExtensions = (id) => (id.includes('.') ? id : `${id}.{js,ts}`);
|
|
35
34
|
export const resolveFromAST = (program, options) => {
|
|
36
35
|
const { configFileDir } = options;
|
|
37
36
|
const inputs = [];
|
|
@@ -39,9 +38,11 @@ export const resolveFromAST = (program, options) => {
|
|
|
39
38
|
const sourceFiles = findProperty(config, 'sourceFiles');
|
|
40
39
|
for (const [key, defaults] of sourceFilesEntries) {
|
|
41
40
|
const override = getFirstPropertyValue(sourceFiles, key);
|
|
42
|
-
|
|
43
|
-
inputs.push(
|
|
44
|
-
|
|
41
|
+
if (override)
|
|
42
|
+
inputs.push(toDeferResolveProductionEntry(join(configFileDir, override)));
|
|
43
|
+
else
|
|
44
|
+
for (const id of defaults)
|
|
45
|
+
inputs.push(toProductionEntry(join(configFileDir, id)));
|
|
45
46
|
}
|
|
46
47
|
for (const id of staticEntries)
|
|
47
48
|
inputs.push(toProductionEntry(join(configFileDir, id)));
|
|
@@ -49,15 +50,19 @@ export const resolveFromAST = (program, options) => {
|
|
|
49
50
|
if (boot?.type === 'ArrayExpression') {
|
|
50
51
|
for (const element of boot.elements ?? []) {
|
|
51
52
|
const id = getStringValue(element) ?? getFirstPropertyValue(element, 'path');
|
|
52
|
-
if (id)
|
|
53
|
-
|
|
53
|
+
if (!id)
|
|
54
|
+
continue;
|
|
55
|
+
if (id.startsWith('~'))
|
|
56
|
+
inputs.push(toDependency(id.slice(1)));
|
|
57
|
+
else
|
|
58
|
+
inputs.push(toDeferResolveProductionEntry(join(configFileDir, 'src/boot', id)));
|
|
54
59
|
}
|
|
55
60
|
}
|
|
56
61
|
for (const id of getStringValues(findProperty(config, 'css'))) {
|
|
57
62
|
if (id.startsWith('~'))
|
|
58
|
-
inputs.push(
|
|
63
|
+
inputs.push(toDependency(id.slice(1)));
|
|
59
64
|
else
|
|
60
|
-
inputs.push(
|
|
65
|
+
inputs.push(toDeferResolveProductionEntry(join(configFileDir, 'src/css', id)));
|
|
61
66
|
}
|
|
62
67
|
return inputs;
|
|
63
68
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { _glob } from '../../util/glob.js';
|
|
3
|
-
import { toEntry, toProductionDependency, toProductionEntry } from '../../util/input.js';
|
|
3
|
+
import { toDeferResolveProductionEntry, toEntry, toProductionDependency, toProductionEntry } from '../../util/input.js';
|
|
4
4
|
import { join, toAbsolute } from '../../util/path.js';
|
|
5
5
|
import { hasDependency, load } from '../../util/plugin.js';
|
|
6
6
|
import vite from '../vite/index.js';
|
|
@@ -28,7 +28,7 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
28
28
|
toEntry(join(appDir, `routes.${entryExtsGlob}`)),
|
|
29
29
|
toProductionEntry(join(appDir, `root.${entryExtsGlob}`)),
|
|
30
30
|
toProductionEntry(join(appDir, `entry.{client,server}.${entryExtsGlob}`)),
|
|
31
|
-
...routes.map(id =>
|
|
31
|
+
...routes.map(id => toDeferResolveProductionEntry(id)),
|
|
32
32
|
];
|
|
33
33
|
const serverEntries = await _glob({
|
|
34
34
|
cwd: appDir,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { toDependency } from '../../util/input.js';
|
|
1
|
+
import { toDeferResolve, toDependency } from '../../util/input.js';
|
|
2
|
+
import { isInternal } from '../../util/path.js';
|
|
2
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
4
|
const title = 'Release It!';
|
|
4
5
|
const enablers = ['release-it'];
|
|
@@ -14,7 +15,10 @@ const resolveConfig = (config, options) => {
|
|
|
14
15
|
scripts.push(config.gitlab.releaseNotes);
|
|
15
16
|
}
|
|
16
17
|
const inputs = options.getInputsFromScripts(scripts);
|
|
17
|
-
return [
|
|
18
|
+
return [
|
|
19
|
+
...plugins.map(id => (isInternal(id) ? toDeferResolve(id, { dir: options.cwd }) : toDependency(id))),
|
|
20
|
+
...inputs,
|
|
21
|
+
];
|
|
18
22
|
};
|
|
19
23
|
const plugin = {
|
|
20
24
|
title,
|
|
@@ -2,11 +2,11 @@ import { hasDependency } from '../../util/plugin.js';
|
|
|
2
2
|
const title = 'Remix';
|
|
3
3
|
const enablers = ['@remix-run/dev'];
|
|
4
4
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
-
const entry = ['remix.config.js', 'remix.init/index.js'];
|
|
5
|
+
const entry = ['remix.config.{js,cjs,mjs}', 'remix.init/index.js'];
|
|
6
6
|
const production = [
|
|
7
|
-
'app/root.tsx',
|
|
7
|
+
'app/root.{js,jsx,ts,tsx}',
|
|
8
8
|
'app/entry.{client,server}.{js,jsx,ts,tsx}',
|
|
9
|
-
'app/routes/**/*.{js,ts,tsx}',
|
|
9
|
+
'app/routes/**/*.{js,jsx,ts,tsx}',
|
|
10
10
|
'server.{js,ts}',
|
|
11
11
|
];
|
|
12
12
|
const plugin = {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { spawningArgs } from '../../binaries/util.js';
|
|
2
|
+
const title = 'retry-cli';
|
|
3
|
+
const args = {
|
|
4
|
+
binaries: ['retry', 'retry-cli'],
|
|
5
|
+
string: ['factor', 'max-timeout', 'min-timeout', 'retries'],
|
|
6
|
+
boolean: ['help', 'randomize'],
|
|
7
|
+
alias: { factor: ['f'], help: ['h'], 'min-timeout': ['t'], retries: ['n'] },
|
|
8
|
+
fromArgs: spawningArgs,
|
|
9
|
+
};
|
|
10
|
+
const plugin = {
|
|
11
|
+
title,
|
|
12
|
+
args,
|
|
13
|
+
};
|
|
14
|
+
export default plugin;
|
|
@@ -7,11 +7,8 @@ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
|
7
7
|
const config = ['rollup.config.{js,cjs,mjs,ts}'];
|
|
8
8
|
const args = {
|
|
9
9
|
alias: { plugin: ['p'] },
|
|
10
|
-
string: ['config'],
|
|
11
10
|
config: ['config'],
|
|
12
|
-
args: (args) => args
|
|
13
|
-
.filter((arg, index) => !(arg === '--config' && (args[index + 1] === undefined || args[index + 1].startsWith('-'))))
|
|
14
|
-
.map(arg => (arg.startsWith('--watch.onEnd') ? `--_exec${arg.slice(13)}` : arg)),
|
|
11
|
+
args: (args) => args.map(arg => (arg.startsWith('--watch.onEnd') ? `--_exec${arg.slice(13)}` : arg)),
|
|
15
12
|
fromArgs: ['_exec'],
|
|
16
13
|
resolve: ['plugin', 'configPlugin'],
|
|
17
14
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { arrayify } from '../../util/array.js';
|
|
2
2
|
import { findFileWithExtensions } from '../../util/fs.js';
|
|
3
3
|
import { _dirGlob, _glob, negate } from '../../util/glob.js';
|
|
4
|
-
import { toAlias, toConfig, toDeferResolve, toDependency, toEntry } from '../../util/input.js';
|
|
4
|
+
import { toAlias, toConfig, toDeferResolve, toDeferResolveEntry, toDependency, toEntry, } from '../../util/input.js';
|
|
5
5
|
import { dirname, join, toAbsolute } from '../../util/path.js';
|
|
6
6
|
import { hasDependency, load } from '../../util/plugin.js';
|
|
7
7
|
import { createRstestMockVisitor } from './visitors/mock.js';
|
|
@@ -39,7 +39,7 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
39
39
|
? include
|
|
40
40
|
: await _glob({ cwd, patterns: [...include, ...exclude.map(pattern => negate(toPattern(pattern)))] });
|
|
41
41
|
for (const entry of entries)
|
|
42
|
-
inputs.push(toEntry(entry));
|
|
42
|
+
inputs.push(exclude.length === 0 ? toEntry(entry) : toDeferResolveEntry(entry));
|
|
43
43
|
}
|
|
44
44
|
const env = project.testEnvironment;
|
|
45
45
|
inputs.push(...getEnvironmentDependency(typeof env === 'string' ? env : env?.name));
|
|
@@ -94,7 +94,7 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
94
94
|
inputs.push(toConfig('rstest', filePath));
|
|
95
95
|
continue;
|
|
96
96
|
}
|
|
97
|
-
inputs.push(
|
|
97
|
+
inputs.push(toDeferResolveEntry(filePath));
|
|
98
98
|
if (project.projects)
|
|
99
99
|
await addProjects(project.projects, dirname(filePath));
|
|
100
100
|
else
|
|
@@ -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')) {
|
|
@@ -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,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
|
};
|
|
@@ -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
|
};
|