knip 6.45.1 → 6.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -18
- package/dist/ConfigurationChief.d.ts +6 -0
- package/dist/ConfigurationChief.js +2 -2
- package/dist/DependencyDeputy.d.ts +12 -14
- package/dist/DependencyDeputy.js +33 -21
- package/dist/IssueCollector.d.ts +1 -0
- package/dist/IssueCollector.js +4 -1
- package/dist/PackagePeeker.d.ts +0 -9
- package/dist/PackagePeeker.js +0 -38
- package/dist/ProjectPrincipal.d.ts +1 -1
- package/dist/ProjectPrincipal.js +3 -1
- package/dist/WorkspaceWorker.js +7 -7
- package/dist/binaries/bash-parser.js +5 -8
- package/dist/binaries/command.js +2 -2
- package/dist/binaries/fallback.d.ts +5 -1
- package/dist/binaries/fallback.js +41 -10
- package/dist/binaries/plugins.d.ts +1 -0
- package/dist/binaries/plugins.js +75 -39
- package/dist/binaries/resolvers/bun.js +2 -2
- package/dist/binaries/resolvers/npm.js +2 -2
- package/dist/binaries/resolvers/npx.js +2 -2
- package/dist/binaries/resolvers/nub.js +2 -2
- package/dist/binaries/resolvers/pnpm.js +29 -21
- package/dist/binaries/resolvers/pnpx.js +20 -8
- package/dist/binaries/resolvers/vp.js +1 -1
- package/dist/binaries/resolvers/yarn.js +1 -1
- package/dist/binaries/util.d.ts +4 -1
- package/dist/binaries/util.js +10 -13
- package/dist/constants.js +18 -0
- package/dist/graph/SubpathReferences.d.ts +1 -1
- package/dist/graph/SubpathReferences.js +4 -3
- package/dist/graph/build.js +11 -12
- package/dist/plugins/_template/index.js +2 -2
- package/dist/plugins/angular/index.js +3 -8
- package/dist/plugins/astro/resolveFromAST.js +2 -2
- package/dist/plugins/astro-markdoc/index.js +2 -2
- package/dist/plugins/astro-og-canvas/index.js +1 -1
- package/dist/plugins/aws-cdk/index.js +3 -3
- package/dist/plugins/babel/index.js +5 -3
- package/dist/plugins/borp/index.js +2 -2
- package/dist/plugins/bun/index.js +3 -3
- package/dist/plugins/capacitor/index.js +33 -6
- package/dist/plugins/capacitor/types.d.ts +10 -0
- package/dist/plugins/changesets/index.js +2 -2
- package/dist/plugins/commitizen/index.js +2 -2
- package/dist/plugins/commitlint/index.js +2 -2
- package/dist/plugins/convex/index.js +2 -2
- package/dist/plugins/cspell/index.js +2 -2
- package/dist/plugins/cucumber/index.js +2 -2
- package/dist/plugins/cypress/index.js +3 -3
- package/dist/plugins/docusaurus/helpers.js +6 -6
- package/dist/plugins/docusaurus/index.js +3 -3
- package/dist/plugins/dotenv/index.js +6 -2
- package/dist/plugins/drizzle/index.js +2 -2
- package/dist/plugins/electron-builder/index.d.ts +3 -0
- package/dist/plugins/electron-builder/index.js +61 -0
- package/dist/plugins/electron-forge/index.js +2 -2
- package/dist/plugins/electron-vite/index.js +4 -3
- package/dist/plugins/electron-vite/types.d.ts +3 -0
- package/dist/plugins/eleventy/index.js +2 -2
- package/dist/plugins/ember/compiler.d.ts +2 -0
- package/dist/plugins/ember/compiler.js +14 -0
- package/dist/plugins/ember/index.d.ts +6 -0
- package/dist/plugins/ember/index.js +160 -0
- package/dist/plugins/ember/types.d.ts +13 -0
- package/dist/plugins/ember/types.js +1 -0
- package/dist/plugins/ember/visitors/importSync.d.ts +2 -0
- package/dist/plugins/ember/visitors/importSync.js +32 -0
- package/dist/plugins/ember-template-lint/index.d.ts +3 -0
- package/dist/plugins/ember-template-lint/index.js +20 -0
- package/dist/plugins/env-cmd/index.d.ts +3 -0
- package/dist/plugins/env-cmd/index.js +16 -0
- package/dist/plugins/esbuild/index.js +2 -2
- package/dist/plugins/eslint/helpers.js +6 -6
- package/dist/plugins/eslint/index.js +0 -1
- package/dist/plugins/eslint/resolveFromAST.js +11 -3
- package/dist/plugins/evalite/index.js +2 -2
- package/dist/plugins/expo/helpers.js +10 -10
- package/dist/plugins/expo-router/index.js +3 -3
- package/dist/plugins/filesystem-routing/index.js +4 -4
- package/dist/plugins/flue/index.js +4 -4
- package/dist/plugins/gatsby/index.js +3 -3
- 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 +8 -6
- package/dist/plugins/index.d.ts +6 -0
- package/dist/plugins/index.js +12 -0
- package/dist/plugins/jasmine/index.js +3 -4
- package/dist/plugins/jest/index.js +3 -3
- package/dist/plugins/karma/helpers.js +2 -2
- package/dist/plugins/karma/index.js +5 -1
- package/dist/plugins/knex/index.js +13 -7
- package/dist/plugins/laravel-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/linthtml/index.js +2 -2
- package/dist/plugins/lunaria/index.js +3 -3
- package/dist/plugins/maestro/index.d.ts +3 -0
- package/dist/plugins/maestro/index.js +54 -0
- package/dist/plugins/maestro/types.d.ts +21 -0
- package/dist/plugins/maestro/types.js +1 -0
- package/dist/plugins/markdownlint/index.js +3 -3
- package/dist/plugins/marko/index.js +4 -4
- package/dist/plugins/mastra/index.js +3 -3
- package/dist/plugins/mdx/index.js +3 -3
- package/dist/plugins/mdxlint/index.js +2 -2
- package/dist/plugins/metro/index.js +5 -5
- package/dist/plugins/mikro-orm/index.js +3 -4
- package/dist/plugins/mise/scripts.js +2 -3
- package/dist/plugins/mocha/index.js +8 -7
- package/dist/plugins/netlify/index.js +4 -4
- package/dist/plugins/next/index.js +5 -5
- package/dist/plugins/next-mdx/resolveFromAST.js +2 -2
- package/dist/plugins/nitro/index.js +4 -4
- package/dist/plugins/node/index.d.ts +16 -0
- package/dist/plugins/node/index.js +89 -23
- package/dist/plugins/nodemon/index.js +1 -1
- package/dist/plugins/npm-package-json-lint/index.js +2 -2
- package/dist/plugins/nuxt/index.js +16 -14
- package/dist/plugins/nx/index.js +3 -3
- package/dist/plugins/nyc/index.js +39 -2
- package/dist/plugins/oclif/index.js +5 -3
- package/dist/plugins/openclaw/index.js +5 -5
- package/dist/plugins/oxlint/index.js +2 -2
- package/dist/plugins/panda-css/index.js +2 -2
- package/dist/plugins/parcel/index.js +2 -2
- package/dist/plugins/payload/index.js +3 -3
- package/dist/plugins/playwright/index.js +4 -4
- package/dist/plugins/pm2/index.js +2 -2
- package/dist/plugins/pnpm/index.js +1 -1
- package/dist/plugins/postcss/index.js +2 -2
- package/dist/plugins/preconstruct/index.js +2 -2
- package/dist/plugins/prettier/index.js +4 -3
- package/dist/plugins/prisma/index.js +5 -5
- package/dist/plugins/quasar/resolveFromAST.js +8 -8
- package/dist/plugins/qwik/resolveFromAST.js +3 -3
- package/dist/plugins/raycast/index.js +2 -2
- package/dist/plugins/react-cosmos/index.js +2 -2
- package/dist/plugins/react-native/index.js +1 -1
- package/dist/plugins/react-router/index.js +6 -6
- package/dist/plugins/relay/index.js +3 -3
- package/dist/plugins/release-it/index.js +2 -5
- package/dist/plugins/remark/helpers.js +2 -2
- package/dist/plugins/retry-cli/index.js +0 -1
- package/dist/plugins/rolldown/index.js +2 -2
- package/dist/plugins/rollup/index.js +2 -2
- package/dist/plugins/rsbuild/index.js +3 -3
- package/dist/plugins/rslib/index.js +2 -2
- package/dist/plugins/rslint/index.d.ts +3 -0
- package/dist/plugins/rslint/index.js +16 -0
- package/dist/plugins/rspack/index.js +4 -0
- package/dist/plugins/rstest/index.js +4 -4
- package/dist/plugins/semantic-release/index.js +2 -2
- package/dist/plugins/serverless-framework/index.js +4 -4
- package/dist/plugins/solidjs-vite-plugin/resolveFromAST.js +3 -3
- package/dist/plugins/sst/resolveFromAST.js +2 -2
- package/dist/plugins/starlight/resolveFromAST.js +3 -3
- package/dist/plugins/stencil/resolveFromAST.js +5 -5
- package/dist/plugins/storybook/index.js +2 -2
- package/dist/plugins/stryker/index.js +2 -2
- package/dist/plugins/stylelint/index.js +4 -4
- package/dist/plugins/sveltekit/resolveFromAST.js +7 -5
- package/dist/plugins/swc/index.js +8 -5
- package/dist/plugins/tailwind/index.js +3 -2
- package/dist/plugins/tanstack-router/index.js +5 -2
- package/dist/plugins/textlint/helpers.js +2 -2
- package/dist/plugins/ts-node/index.js +23 -6
- package/dist/plugins/tsd/index.js +1 -1
- package/dist/plugins/tsdown/index.js +4 -4
- package/dist/plugins/tsup/index.js +3 -3
- package/dist/plugins/tsx/index.js +4 -3
- package/dist/plugins/turbo/index.js +2 -2
- package/dist/plugins/typedoc/index.js +4 -3
- package/dist/plugins/typescript/index.js +4 -4
- package/dist/plugins/varlock/scan.js +6 -3
- package/dist/plugins/vite/helpers.js +2 -2
- package/dist/plugins/vite-plugin-pages/index.js +2 -2
- package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +2 -2
- package/dist/plugins/vite-plugin-vue-layouts-next/index.js +2 -2
- package/dist/plugins/vitest/index.js +14 -18
- package/dist/plugins/webdriver-io/index.js +13 -1
- package/dist/plugins/webpack/index.js +7 -12
- package/dist/plugins/wrangler/index.js +3 -3
- package/dist/plugins/wxt/index.js +2 -2
- package/dist/plugins/yarn/index.js +5 -5
- package/dist/session/incremental.d.ts +1 -1
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +6 -0
- package/dist/types/args.d.ts +4 -3
- package/dist/types/config.d.ts +2 -0
- package/dist/types/module-graph.d.ts +1 -1
- package/dist/types/package-json.d.ts +1 -0
- package/dist/types/workspace.d.ts +10 -8
- package/dist/typescript/ast-nodes.js +4 -5
- package/dist/typescript/get-imports-and-exports.js +5 -2
- package/dist/typescript/visitors/exports.js +6 -32
- package/dist/typescript/visitors/imports.d.ts +1 -1
- package/dist/typescript/visitors/imports.js +15 -24
- package/dist/typescript/visitors/walk.d.ts +5 -0
- package/dist/typescript/visitors/walk.js +75 -30
- package/dist/util/codeowners.js +4 -1
- package/dist/util/input.d.ts +3 -6
- package/dist/util/input.js +6 -20
- package/dist/util/parse-and-convert-gitignores.js +5 -4
- package/dist/util/parse-args.d.ts +2 -1
- package/dist/util/parse-args.js +13 -3
- package/dist/util/plugin.js +6 -4
- package/dist/util/watch.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +36 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isDirectory } from '../../util/fs.js';
|
|
2
|
-
import {
|
|
3
|
-
import { join } from '../../util/path.js';
|
|
2
|
+
import { toEntryPath, toEntry } from '../../util/input.js';
|
|
3
|
+
import { join, toAbsolute } from '../../util/path.js';
|
|
4
4
|
import { hasDependency } from '../../util/plugin.js';
|
|
5
5
|
import compiler from './compiler.js';
|
|
6
6
|
const title = 'Prisma';
|
|
@@ -14,9 +14,9 @@ const config = [
|
|
|
14
14
|
];
|
|
15
15
|
const resolveSchema = (path, cwd) => {
|
|
16
16
|
if (!isDirectory(cwd, path)) {
|
|
17
|
-
return
|
|
17
|
+
return toEntryPath(path, { dir: cwd });
|
|
18
18
|
}
|
|
19
|
-
return toEntry(join(path, '**/*.prisma'));
|
|
19
|
+
return toEntry(join(toAbsolute(path, cwd), '**/*.prisma'));
|
|
20
20
|
};
|
|
21
21
|
const resolveConfig = async (config, options) => {
|
|
22
22
|
const inputs = [];
|
|
@@ -27,7 +27,7 @@ const resolveConfig = async (config, options) => {
|
|
|
27
27
|
inputs.push(...options.getInputsFromScripts(config.migrations.seed));
|
|
28
28
|
}
|
|
29
29
|
if (config.schema) {
|
|
30
|
-
inputs.push(resolveSchema(config.schema, options.
|
|
30
|
+
inputs.push(resolveSchema(config.schema, options.configFileDir));
|
|
31
31
|
}
|
|
32
32
|
return inputs;
|
|
33
33
|
};
|
|
@@ -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 { toDependency,
|
|
3
|
+
import { toDependency, toEntryPath, toEntry } from '../../util/input.js';
|
|
4
4
|
import { join } from '../../util/path.js';
|
|
5
5
|
const sourceFilesEntries = [
|
|
6
6
|
['rootComponent', ['src/App.vue']],
|
|
@@ -39,13 +39,13 @@ export const resolveFromAST = (program, options) => {
|
|
|
39
39
|
for (const [key, defaults] of sourceFilesEntries) {
|
|
40
40
|
const override = getFirstPropertyValue(sourceFiles, key);
|
|
41
41
|
if (override)
|
|
42
|
-
inputs.push(
|
|
42
|
+
inputs.push(toEntryPath(join(configFileDir, override), { production: true }));
|
|
43
43
|
else
|
|
44
44
|
for (const id of defaults)
|
|
45
|
-
inputs.push(
|
|
45
|
+
inputs.push(toEntry(join(configFileDir, id), { production: true }));
|
|
46
46
|
}
|
|
47
47
|
for (const id of staticEntries)
|
|
48
|
-
inputs.push(
|
|
48
|
+
inputs.push(toEntry(join(configFileDir, id), { production: true }));
|
|
49
49
|
const boot = findProperty(config, 'boot');
|
|
50
50
|
if (boot?.type === 'ArrayExpression') {
|
|
51
51
|
for (const element of boot.elements ?? []) {
|
|
@@ -53,16 +53,16 @@ export const resolveFromAST = (program, options) => {
|
|
|
53
53
|
if (!id)
|
|
54
54
|
continue;
|
|
55
55
|
if (id.startsWith('~'))
|
|
56
|
-
inputs.push(toDependency(id.slice(1)));
|
|
56
|
+
inputs.push(toDependency(id.slice(1), { production: true }));
|
|
57
57
|
else
|
|
58
|
-
inputs.push(
|
|
58
|
+
inputs.push(toEntryPath(join(configFileDir, 'src/boot', id), { production: true }));
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
for (const id of getStringValues(findProperty(config, 'css'))) {
|
|
62
62
|
if (id.startsWith('~'))
|
|
63
|
-
inputs.push(toDependency(id.slice(1)));
|
|
63
|
+
inputs.push(toDependency(id.slice(1), { production: true }));
|
|
64
64
|
else
|
|
65
|
-
inputs.push(
|
|
65
|
+
inputs.push(toEntryPath(join(configFileDir, 'src/css', id), { production: true }));
|
|
66
66
|
}
|
|
67
67
|
return inputs;
|
|
68
68
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findCallArg, getFirstPropertyValue, getPropertyValues } from '../../typescript/ast-helpers.js';
|
|
2
|
-
import { toEntry, toIgnore
|
|
2
|
+
import { toEntry, toIgnore } from '../../util/input.js';
|
|
3
3
|
export const entry = ['src/entry.dev.tsx'];
|
|
4
4
|
export const production = ['src/root.tsx', 'src/entry.*.tsx'];
|
|
5
5
|
export const routeProduction = ['src/routes/**/*.{tsx,ts,md,mdx}'];
|
|
@@ -24,12 +24,12 @@ export const resolveFromAST = program => {
|
|
|
24
24
|
const routeEntries = [];
|
|
25
25
|
for (const routesDir of routesDirs) {
|
|
26
26
|
for (const pattern of routeProduction) {
|
|
27
|
-
routeEntries.push(
|
|
27
|
+
routeEntries.push(toEntry(setRoutesDir(pattern, routesDir), { production: true }));
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
return [
|
|
31
31
|
...entry.map(setSrcDir).map(path => toEntry(path)),
|
|
32
|
-
...production.map(setSrcDir).map(path =>
|
|
32
|
+
...production.map(setSrcDir).map(path => toEntry(path, { production: true })),
|
|
33
33
|
...routeEntries,
|
|
34
34
|
toIgnore('@qwik-city-plan', 'unlisted'),
|
|
35
35
|
toIgnore('@qwik-city-sw-register', 'unlisted'),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compact } from '../../util/array.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toEntry } from '../../util/input.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'Raycast';
|
|
5
5
|
const enablers = ['@raycast/api'];
|
|
@@ -8,7 +8,7 @@ const config = ['package.json'];
|
|
|
8
8
|
const packageJsonPath = (manifest) => manifest;
|
|
9
9
|
const mapEntries = (items, directory) => {
|
|
10
10
|
const names = compact((items ?? []).map(item => (typeof item.name === 'string' ? item.name : undefined)));
|
|
11
|
-
return names.map(name =>
|
|
11
|
+
return names.map(name => toEntry(`${directory}${name}.{js,jsx,ts,tsx}`, { production: true }));
|
|
12
12
|
};
|
|
13
13
|
const resolveConfig = async (manifest) => [
|
|
14
14
|
...mapEntries(manifest.commands, 'src/'),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toModule, toEntry } from '../../util/input.js';
|
|
2
2
|
import { join } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'React Cosmos';
|
|
@@ -18,7 +18,7 @@ const resolveConfig = async (localConfig) => {
|
|
|
18
18
|
];
|
|
19
19
|
return [...entries, ...decoratorEntry]
|
|
20
20
|
.map(id => toEntry(id))
|
|
21
|
-
.concat((localConfig?.plugins ?? []).map(id =>
|
|
21
|
+
.concat((localConfig?.plugins ?? []).map(id => toModule(id)));
|
|
22
22
|
};
|
|
23
23
|
const plugin = {
|
|
24
24
|
title,
|
|
@@ -19,7 +19,7 @@ const resolveConfig = async (config) => {
|
|
|
19
19
|
if (config.platforms) {
|
|
20
20
|
for (const platform of Object.values(config.platforms)) {
|
|
21
21
|
if (platform.npmPackageName)
|
|
22
|
-
inputs.push(toDependency(platform.npmPackageName));
|
|
22
|
+
inputs.push(toDependency(platform.npmPackageName, { production: true }));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
return inputs;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { _glob } from '../../util/glob.js';
|
|
3
|
-
import {
|
|
3
|
+
import { toEntryPath, toEntry, toDependency } 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';
|
|
@@ -26,17 +26,17 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
26
26
|
const routes = routeConfig.flatMap(mapRoute);
|
|
27
27
|
const resolved = [
|
|
28
28
|
toEntry(join(appDir, `routes.${entryExtsGlob}`)),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
...routes.map(id =>
|
|
29
|
+
toEntry(join(appDir, `root.${entryExtsGlob}`), { production: true }),
|
|
30
|
+
toEntry(join(appDir, `entry.{client,server}.${entryExtsGlob}`), { production: true }),
|
|
31
|
+
...routes.map(id => toEntryPath(id, { production: true })),
|
|
32
32
|
];
|
|
33
33
|
const serverEntries = await _glob({
|
|
34
34
|
cwd: appDir,
|
|
35
35
|
patterns: [`entry.server.${entryExtsGlob}`],
|
|
36
36
|
});
|
|
37
37
|
if (serverEntries.length === 0) {
|
|
38
|
-
resolved.push(
|
|
39
|
-
resolved.push(
|
|
38
|
+
resolved.push(toDependency('@react-router/node', { production: true }));
|
|
39
|
+
resolved.push(toDependency('isbot', { production: true }));
|
|
40
40
|
}
|
|
41
41
|
return resolved;
|
|
42
42
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import parseArgs from '../../util/parse-args.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toEntry } from '../../util/input.js';
|
|
3
3
|
import { join } from '../../util/path.js';
|
|
4
4
|
import { hasDependency } from '../../util/plugin.js';
|
|
5
5
|
const title = 'Relay';
|
|
@@ -11,9 +11,9 @@ const resolveConfig = async (config) => {
|
|
|
11
11
|
return projects.map(project => {
|
|
12
12
|
const artifactDirectory = project.artifactDirectory;
|
|
13
13
|
if (artifactDirectory == null) {
|
|
14
|
-
return
|
|
14
|
+
return toEntry('**/__generated__/*', { production: true });
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return toEntry(join(artifactDirectory, '**'), { production: true });
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
const args = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toModule, toDependency } from '../../util/input.js';
|
|
2
2
|
import { isInternal } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'Release It!';
|
|
@@ -15,10 +15,7 @@ const resolveConfig = (config, options) => {
|
|
|
15
15
|
scripts.push(config.gitlab.releaseNotes);
|
|
16
16
|
}
|
|
17
17
|
const inputs = options.getInputsFromScripts(scripts);
|
|
18
|
-
return [
|
|
19
|
-
...plugins.map(id => (isInternal(id) ? toDeferResolve(id, { dir: options.cwd }) : toDependency(id))),
|
|
20
|
-
...inputs,
|
|
21
|
-
];
|
|
18
|
+
return [...plugins.map(id => (isInternal(id) ? toModule(id, { dir: options.cwd }) : toDependency(id))), ...inputs];
|
|
22
19
|
};
|
|
23
20
|
const plugin = {
|
|
24
21
|
title,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toModule, toDependency } from '../../util/input.js';
|
|
2
2
|
import { isInternal } from '../../util/path.js';
|
|
3
3
|
const getCandidates = (prefix, identifier) => {
|
|
4
4
|
if (isInternal(identifier))
|
|
@@ -38,5 +38,5 @@ const pickCandidate = (prefix, identifier, manifest) => {
|
|
|
38
38
|
export const resolveLoadPluginStylePluginName = (prefix, identifier, manifest) => {
|
|
39
39
|
prefix = prefix + (prefix.at(-1) === '-' ? '' : '-');
|
|
40
40
|
const candidate = pickCandidate(prefix, identifier, manifest);
|
|
41
|
-
return isInternal(candidate) ?
|
|
41
|
+
return isInternal(candidate) ? toModule(candidate) : toDependency(candidate);
|
|
42
42
|
};
|
|
@@ -2,7 +2,6 @@ import { spawningArgs } from '../../binaries/util.js';
|
|
|
2
2
|
const title = 'retry-cli';
|
|
3
3
|
const args = {
|
|
4
4
|
binaries: ['retry', 'retry-cli'],
|
|
5
|
-
string: ['factor', 'max-timeout', 'min-timeout', 'retries'],
|
|
6
5
|
boolean: ['help', 'randomize'],
|
|
7
6
|
alias: { factor: ['f'], help: ['h'], 'min-timeout': ['t'], retries: ['n'] },
|
|
8
7
|
fromArgs: spawningArgs,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { collectPropertyValues } from '../../typescript/ast-helpers.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toEntry } from '../../util/input.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'Rolldown';
|
|
5
5
|
const enablers = ['rolldown'];
|
|
6
6
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
7
|
const config = ['rolldown.config.{js,cjs,mjs,ts,cts,mts}'];
|
|
8
|
-
const resolveFromAST = program => Array.from(collectPropertyValues(program, 'input'), id =>
|
|
8
|
+
const resolveFromAST = program => Array.from(collectPropertyValues(program, 'input'), id => toEntry(id, { production: true }));
|
|
9
9
|
const plugin = {
|
|
10
10
|
title,
|
|
11
11
|
enablers,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { collectPropertyValues } from '../../typescript/ast-helpers.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toEntry } from '../../util/input.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'Rollup';
|
|
5
5
|
const enablers = ['rollup'];
|
|
@@ -12,7 +12,7 @@ const args = {
|
|
|
12
12
|
fromArgs: ['_exec'],
|
|
13
13
|
resolve: ['plugin', 'configPlugin'],
|
|
14
14
|
};
|
|
15
|
-
const resolveFromAST = program => Array.from(collectPropertyValues(program, 'input'), id =>
|
|
15
|
+
const resolveFromAST = program => Array.from(collectPropertyValues(program, 'input'), id => toEntry(id, { production: true }));
|
|
16
16
|
const plugin = {
|
|
17
17
|
title,
|
|
18
18
|
enablers,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toModule, toEntry } from '../../util/input.js';
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
3
|
import { resolveConfig as resolveRspackConfig } from '../rspack/index.js';
|
|
4
4
|
import { getSwcPluginSpecifiers } from '../webpack/index.js';
|
|
@@ -74,7 +74,7 @@ const resolveConfig = async (configOrFn, options) => {
|
|
|
74
74
|
const swc = localConfig.tools?.swc;
|
|
75
75
|
if (swc && typeof swc === 'object') {
|
|
76
76
|
for (const specifier of getSwcPluginSpecifiers(swc))
|
|
77
|
-
inputs.push(
|
|
77
|
+
inputs.push(toModule(specifier));
|
|
78
78
|
}
|
|
79
79
|
if (!localConfig.tools?.rspack)
|
|
80
80
|
return;
|
|
@@ -117,7 +117,7 @@ const resolveConfig = async (configOrFn, options) => {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
for (const entry of entries)
|
|
120
|
-
inputs.push(
|
|
120
|
+
inputs.push(toEntry(entry, { production: true }));
|
|
121
121
|
return inputs;
|
|
122
122
|
};
|
|
123
123
|
const plugin = {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { collectPropertyValues } from '../../typescript/ast-helpers.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toEntry } from '../../util/input.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'Rslib';
|
|
5
5
|
const enablers = ['@rslib/core'];
|
|
6
6
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
7
|
const config = ['rslib*.config.{mjs,ts,js,cjs,mts,cts}'];
|
|
8
|
-
const resolveFromAST = program => Array.from(collectPropertyValues(program, 'entry'), id =>
|
|
8
|
+
const resolveFromAST = program => Array.from(collectPropertyValues(program, 'entry'), id => toEntry(id, { production: true, allowIncludeExports: true }));
|
|
9
9
|
const plugin = {
|
|
10
10
|
title,
|
|
11
11
|
enablers,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
const title = 'Rslint';
|
|
3
|
+
const enablers = ['@rslint/core'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const entry = ['rslint.config.{js,mjs,ts,mts}'];
|
|
6
|
+
const args = {
|
|
7
|
+
config: true,
|
|
8
|
+
};
|
|
9
|
+
const plugin = {
|
|
10
|
+
title,
|
|
11
|
+
enablers,
|
|
12
|
+
isEnabled,
|
|
13
|
+
entry,
|
|
14
|
+
args,
|
|
15
|
+
};
|
|
16
|
+
export default plugin;
|
|
@@ -12,6 +12,9 @@ export const resolveConfig = async (localConfig, options) => {
|
|
|
12
12
|
const registerVisitors = ({ ctx, registerVisitor }) => {
|
|
13
13
|
registerVisitor(createRequireContextVisitor(ctx));
|
|
14
14
|
};
|
|
15
|
+
const args = {
|
|
16
|
+
config: true,
|
|
17
|
+
};
|
|
15
18
|
const plugin = {
|
|
16
19
|
title,
|
|
17
20
|
enablers,
|
|
@@ -19,5 +22,6 @@ const plugin = {
|
|
|
19
22
|
config,
|
|
20
23
|
resolveConfig,
|
|
21
24
|
registerVisitors,
|
|
25
|
+
args,
|
|
22
26
|
};
|
|
23
27
|
export default plugin;
|
|
@@ -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,
|
|
4
|
+
import { toAlias, toConfig, toModule, toEntryPath, 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,12 +39,12 @@ 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(exclude.length === 0 ? toEntry(entry) :
|
|
42
|
+
inputs.push(exclude.length === 0 ? toEntry(entry) : toEntryPath(entry));
|
|
43
43
|
}
|
|
44
44
|
const env = project.testEnvironment;
|
|
45
45
|
inputs.push(...getEnvironmentDependency(typeof env === 'string' ? env : env?.name));
|
|
46
46
|
for (const specifier of [project.setupFiles ?? [], project.globalSetup ?? []].flat()) {
|
|
47
|
-
inputs.push(
|
|
47
|
+
inputs.push(toModule(replaceRootDir(specifier, projectRoot), { dir: projectRoot }));
|
|
48
48
|
}
|
|
49
49
|
if (project.browser?.enabled) {
|
|
50
50
|
inputs.push(toDependency('@rstest/browser'), toDependency('playwright'));
|
|
@@ -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(toEntryPath(filePath));
|
|
98
98
|
if (project.projects)
|
|
99
99
|
await addProjects(project.projects, dirname(filePath));
|
|
100
100
|
else
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toConfig,
|
|
1
|
+
import { toConfig, toModule, 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';
|
|
@@ -24,7 +24,7 @@ const resolveConfig = (config, options) => {
|
|
|
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)))
|
|
27
|
-
inputs.push(
|
|
27
|
+
inputs.push(toModule(id));
|
|
28
28
|
return inputs;
|
|
29
29
|
};
|
|
30
30
|
const args = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { arrayify } from '../../util/array.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toEntryPath, 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';
|
|
@@ -25,9 +25,9 @@ const resolveFileVariable = async (value, dir) => {
|
|
|
25
25
|
const handlerToEntry = (handler, dir) => {
|
|
26
26
|
const dot = handler.lastIndexOf('.');
|
|
27
27
|
const file = handler.slice(0, dot);
|
|
28
|
-
return
|
|
28
|
+
return toEntryPath(file, { production: true, dir });
|
|
29
29
|
};
|
|
30
|
-
const pluginToInput = (plugin, dir) => isInternal(plugin) ?
|
|
30
|
+
const pluginToInput = (plugin, dir) => isInternal(plugin) ? toEntryPath(toAbsolute(plugin, dir), { production: true }) : toDependency(plugin);
|
|
31
31
|
const getFunctionEntries = async (functions, dir, cwd) => {
|
|
32
32
|
const entries = [];
|
|
33
33
|
const resolved = await resolveFileVariable(functions, dir);
|
|
@@ -44,7 +44,7 @@ const getFunctionEntries = async (functions, dir, cwd) => {
|
|
|
44
44
|
return entries;
|
|
45
45
|
};
|
|
46
46
|
const getInjectEntries = (esbuild, dir) => esbuild && typeof esbuild === 'object'
|
|
47
|
-
? arrayify(esbuild.inject).map(id =>
|
|
47
|
+
? arrayify(esbuild.inject).map(id => toEntryPath(join(dir, id), { production: true }))
|
|
48
48
|
: [];
|
|
49
49
|
export const resolveConfig = async (config, options) => {
|
|
50
50
|
const functions = await getFunctionEntries(config.functions, options.configFileDir, options.cwd);
|
|
@@ -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 {
|
|
4
|
+
import { toEntryPath, toEntry } 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'];
|
|
@@ -69,8 +69,8 @@ export const resolveFromAST = (program, options) => {
|
|
|
69
69
|
}
|
|
70
70
|
const inputs = [];
|
|
71
71
|
for (const pattern of patterns)
|
|
72
|
-
inputs.push(
|
|
72
|
+
inputs.push(toEntry(join(root, pattern), { production: true }));
|
|
73
73
|
for (const id of paths)
|
|
74
|
-
inputs.push(
|
|
74
|
+
inputs.push(toEntryPath(toAbsolute(id, root), { production: true }));
|
|
75
75
|
return inputs;
|
|
76
76
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Visitor } from 'oxc-parser';
|
|
2
2
|
import { collectPropertyValues, getImportMap } from '../../typescript/ast-helpers.js';
|
|
3
3
|
import { _parseFile } from '../../typescript/ast-nodes.js';
|
|
4
|
-
import {
|
|
4
|
+
import { toEntryPath } from '../../util/input.js';
|
|
5
5
|
import { dirname } from '../../util/path.js';
|
|
6
6
|
import { _resolveSync } from '../../util/resolve.js';
|
|
7
7
|
export const resolveFromAST = (program, options) => {
|
|
@@ -44,5 +44,5 @@ export const resolveFromAST = (program, options) => {
|
|
|
44
44
|
visitor.visit(program);
|
|
45
45
|
}
|
|
46
46
|
catch { }
|
|
47
|
-
return Array.from(entries).map(specifier =>
|
|
47
|
+
return Array.from(entries).map(specifier => toEntryPath(specifier, { production: true }));
|
|
48
48
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { findImportedCallArg, getPropertyValues } from '../../typescript/ast-helpers.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toEntry } from '../../util/input.js';
|
|
3
3
|
export const resolveFromAST = program => {
|
|
4
4
|
const starlightConfig = findImportedCallArg(program, '@astrojs/starlight');
|
|
5
5
|
if (!starlightConfig)
|
|
6
6
|
return [];
|
|
7
7
|
const inputs = [];
|
|
8
8
|
for (const id of getPropertyValues(starlightConfig, 'components'))
|
|
9
|
-
inputs.push(
|
|
9
|
+
inputs.push(toEntry(id, { production: true }));
|
|
10
10
|
for (const id of getPropertyValues(starlightConfig, 'customCss'))
|
|
11
|
-
inputs.push(
|
|
11
|
+
inputs.push(toEntry(id, { production: true }));
|
|
12
12
|
return inputs;
|
|
13
13
|
};
|
|
@@ -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,
|
|
3
|
+
import { toConfig, toEntryPath, toEntry } from '../../util/input.js';
|
|
4
4
|
export const entry = ['**/*.spec.{ts,tsx}', '**/*.e2e.{ts,tsx}'];
|
|
5
5
|
export const resolveFromAST = (program, { cwd }) => {
|
|
6
6
|
const inputs = [];
|
|
7
7
|
const srcDir = collectFirstPropertyValue(program, 'srcDir') ?? 'src';
|
|
8
|
-
inputs.push(
|
|
8
|
+
inputs.push(toEntry(`${srcDir}/**/*.tsx`, { production: true }));
|
|
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(toEntryPath(script, { production: true, dir: cwd }));
|
|
13
13
|
}
|
|
14
14
|
for (const style of collectPropertyValues(program, 'globalStyle')) {
|
|
15
|
-
inputs.push(
|
|
15
|
+
inputs.push(toEntryPath(style, { production: true, dir: cwd }));
|
|
16
16
|
}
|
|
17
17
|
new Visitor({
|
|
18
18
|
ObjectExpression(node) {
|
|
@@ -20,7 +20,7 @@ export const resolveFromAST = (program, { cwd }) => {
|
|
|
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(toEntryPath(input, { production: true, dir: cwd }));
|
|
24
24
|
},
|
|
25
25
|
}).visit(program);
|
|
26
26
|
for (const tsconfig of collectPropertyValues(program, 'tsconfig')) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MDX from '../../compilers/mdx.js';
|
|
2
|
-
import { toConfig,
|
|
2
|
+
import { toConfig, toModule, toDependency, toEntry } from '../../util/input.js';
|
|
3
3
|
import { join, toAbsolute } from '../../util/path.js';
|
|
4
4
|
import { hasDependency } from '../../util/plugin.js';
|
|
5
5
|
import { getBabelInputs } from '../vite/helpers.js';
|
|
@@ -53,7 +53,7 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
53
53
|
: [];
|
|
54
54
|
return [
|
|
55
55
|
...patterns.map(id => toEntry(id)),
|
|
56
|
-
...addons.map(id =>
|
|
56
|
+
...addons.map(id => toModule(id)),
|
|
57
57
|
...builderPackages.map(id => toDependency(id)),
|
|
58
58
|
...frameworks.map(id => toDependency(id)),
|
|
59
59
|
...coverageDeps,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toConfig,
|
|
1
|
+
import { toConfig, toModule, 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].map(id => toDependency(id)).concat(plugins.map(id =>
|
|
13
|
+
return [...runners, ...checkers].map(id => toDependency(id)).concat(plugins.map(id => toModule(id)));
|
|
14
14
|
};
|
|
15
15
|
const args = {
|
|
16
16
|
boolean: ['allowEmpty', 'disableBail', 'dryRunOnly', 'force', 'ignoreStatic', 'incremental', 'inPlace'],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toConfig,
|
|
1
|
+
import { toConfig, toModule } from '../../util/input.js';
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
3
|
import { toCosmiconfig } from '../../util/plugin-config.js';
|
|
4
4
|
const title = 'Stylelint';
|
|
@@ -10,16 +10,16 @@ const resolveConfig = async (config, options) => {
|
|
|
10
10
|
const extend = Array.isArray(config.extends) ? config.extends : config.extends ? [config.extends] : [];
|
|
11
11
|
for (const id of extend) {
|
|
12
12
|
if (typeof id === 'string')
|
|
13
|
-
inputs.push(
|
|
13
|
+
inputs.push(toModule(id), toConfig('stylelint', id));
|
|
14
14
|
else
|
|
15
15
|
for (const x of await resolveConfig(id, options))
|
|
16
16
|
inputs.push(x);
|
|
17
17
|
}
|
|
18
18
|
for (const plugin of config.plugins ?? [])
|
|
19
19
|
if (typeof plugin === 'string')
|
|
20
|
-
inputs.push(
|
|
20
|
+
inputs.push(toModule(plugin));
|
|
21
21
|
if (typeof config.customSyntax === 'string')
|
|
22
|
-
inputs.push(
|
|
22
|
+
inputs.push(toModule(config.customSyntax));
|
|
23
23
|
for (const override of config.overrides ?? []) {
|
|
24
24
|
for (const input of await resolveConfig(override, options))
|
|
25
25
|
inputs.push(input);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { collectFirstPropertyValue, findCallArg, findProperty, getFirstPropertyValue, hasImportSpecifier, } from '../../typescript/ast-helpers.js';
|
|
2
2
|
import { _parseFile } from '../../typescript/ast-nodes.js';
|
|
3
3
|
import { _syncGlob } from '../../util/glob.js';
|
|
4
|
-
import { toAlias, toIgnore,
|
|
4
|
+
import { toAlias, toIgnore, toEntry } from '../../util/input.js';
|
|
5
5
|
import { config as viteConfig } from '../vite/index.js';
|
|
6
6
|
const production = [
|
|
7
7
|
'src/routes/**/+{page,server,page.server,error,layout,layout.server}{,@*}.{js,ts,svelte}',
|
|
@@ -11,22 +11,23 @@ const production = [
|
|
|
11
11
|
'src/service-worker/index.{js,ts}',
|
|
12
12
|
'src/instrumentation.server.{js,ts}',
|
|
13
13
|
];
|
|
14
|
+
const findKitOptions = (program) => findCallArg(program, 'sveltekit') ?? findCallArg(program, 'withPwa');
|
|
14
15
|
const isConfigInViteConfig = (dir, readFile) => {
|
|
15
16
|
for (const filePath of _syncGlob({ cwd: dir, patterns: viteConfig })) {
|
|
16
17
|
const text = readFile(filePath);
|
|
17
|
-
if (text &&
|
|
18
|
+
if (text && findKitOptions(_parseFile(filePath, text).program))
|
|
18
19
|
return true;
|
|
19
20
|
}
|
|
20
21
|
return false;
|
|
21
22
|
};
|
|
22
23
|
const getLibFromViteConfig = (program) => {
|
|
23
|
-
const call =
|
|
24
|
+
const call = findKitOptions(program);
|
|
24
25
|
const files = call ? findProperty(call, 'files') : undefined;
|
|
25
26
|
return (files && getFirstPropertyValue(files, 'lib')) ?? 'src/lib';
|
|
26
27
|
};
|
|
27
28
|
const getLibFromSvelteConfig = (program) => collectFirstPropertyValue(program, 'lib') ?? 'src/lib';
|
|
28
29
|
const toInputs = (lib) => [
|
|
29
|
-
...production.map(pattern =>
|
|
30
|
+
...production.map(pattern => toEntry(pattern, { production: true })),
|
|
30
31
|
toAlias('$lib', [`./${lib}`]),
|
|
31
32
|
toAlias('$lib/*', [`./${lib}/*`]),
|
|
32
33
|
toIgnore('\\$app/.+', 'unresolved'),
|
|
@@ -35,7 +36,8 @@ const toInputs = (lib) => [
|
|
|
35
36
|
];
|
|
36
37
|
export const resolveFromAST = (program, options) => {
|
|
37
38
|
if (options.configFileName.startsWith('vite.config')) {
|
|
38
|
-
|
|
39
|
+
const isKit = hasImportSpecifier(program, '@sveltejs/kit/vite', 'sveltekit');
|
|
40
|
+
if (!isKit && !hasImportSpecifier(program, '@vite-pwa/sveltekit', 'withPwa'))
|
|
39
41
|
return [];
|
|
40
42
|
return toInputs(getLibFromViteConfig(program));
|
|
41
43
|
}
|