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.
Files changed (210) hide show
  1. package/README.md +42 -18
  2. package/dist/ConfigurationChief.d.ts +6 -0
  3. package/dist/ConfigurationChief.js +2 -2
  4. package/dist/DependencyDeputy.d.ts +12 -14
  5. package/dist/DependencyDeputy.js +33 -21
  6. package/dist/IssueCollector.d.ts +1 -0
  7. package/dist/IssueCollector.js +4 -1
  8. package/dist/PackagePeeker.d.ts +0 -9
  9. package/dist/PackagePeeker.js +0 -38
  10. package/dist/ProjectPrincipal.d.ts +1 -1
  11. package/dist/ProjectPrincipal.js +3 -1
  12. package/dist/WorkspaceWorker.js +7 -7
  13. package/dist/binaries/bash-parser.js +5 -8
  14. package/dist/binaries/command.js +2 -2
  15. package/dist/binaries/fallback.d.ts +5 -1
  16. package/dist/binaries/fallback.js +41 -10
  17. package/dist/binaries/plugins.d.ts +1 -0
  18. package/dist/binaries/plugins.js +75 -39
  19. package/dist/binaries/resolvers/bun.js +2 -2
  20. package/dist/binaries/resolvers/npm.js +2 -2
  21. package/dist/binaries/resolvers/npx.js +2 -2
  22. package/dist/binaries/resolvers/nub.js +2 -2
  23. package/dist/binaries/resolvers/pnpm.js +29 -21
  24. package/dist/binaries/resolvers/pnpx.js +20 -8
  25. package/dist/binaries/resolvers/vp.js +1 -1
  26. package/dist/binaries/resolvers/yarn.js +1 -1
  27. package/dist/binaries/util.d.ts +4 -1
  28. package/dist/binaries/util.js +10 -13
  29. package/dist/constants.js +18 -0
  30. package/dist/graph/SubpathReferences.d.ts +1 -1
  31. package/dist/graph/SubpathReferences.js +4 -3
  32. package/dist/graph/build.js +11 -12
  33. package/dist/plugins/_template/index.js +2 -2
  34. package/dist/plugins/angular/index.js +3 -8
  35. package/dist/plugins/astro/resolveFromAST.js +2 -2
  36. package/dist/plugins/astro-markdoc/index.js +2 -2
  37. package/dist/plugins/astro-og-canvas/index.js +1 -1
  38. package/dist/plugins/aws-cdk/index.js +3 -3
  39. package/dist/plugins/babel/index.js +5 -3
  40. package/dist/plugins/borp/index.js +2 -2
  41. package/dist/plugins/bun/index.js +3 -3
  42. package/dist/plugins/capacitor/index.js +33 -6
  43. package/dist/plugins/capacitor/types.d.ts +10 -0
  44. package/dist/plugins/changesets/index.js +2 -2
  45. package/dist/plugins/commitizen/index.js +2 -2
  46. package/dist/plugins/commitlint/index.js +2 -2
  47. package/dist/plugins/convex/index.js +2 -2
  48. package/dist/plugins/cspell/index.js +2 -2
  49. package/dist/plugins/cucumber/index.js +2 -2
  50. package/dist/plugins/cypress/index.js +3 -3
  51. package/dist/plugins/docusaurus/helpers.js +6 -6
  52. package/dist/plugins/docusaurus/index.js +3 -3
  53. package/dist/plugins/dotenv/index.js +6 -2
  54. package/dist/plugins/drizzle/index.js +2 -2
  55. package/dist/plugins/electron-builder/index.d.ts +3 -0
  56. package/dist/plugins/electron-builder/index.js +61 -0
  57. package/dist/plugins/electron-forge/index.js +2 -2
  58. package/dist/plugins/electron-vite/index.js +4 -3
  59. package/dist/plugins/electron-vite/types.d.ts +3 -0
  60. package/dist/plugins/eleventy/index.js +2 -2
  61. package/dist/plugins/ember/compiler.d.ts +2 -0
  62. package/dist/plugins/ember/compiler.js +14 -0
  63. package/dist/plugins/ember/index.d.ts +6 -0
  64. package/dist/plugins/ember/index.js +160 -0
  65. package/dist/plugins/ember/types.d.ts +13 -0
  66. package/dist/plugins/ember/types.js +1 -0
  67. package/dist/plugins/ember/visitors/importSync.d.ts +2 -0
  68. package/dist/plugins/ember/visitors/importSync.js +32 -0
  69. package/dist/plugins/ember-template-lint/index.d.ts +3 -0
  70. package/dist/plugins/ember-template-lint/index.js +20 -0
  71. package/dist/plugins/env-cmd/index.d.ts +3 -0
  72. package/dist/plugins/env-cmd/index.js +16 -0
  73. package/dist/plugins/esbuild/index.js +2 -2
  74. package/dist/plugins/eslint/helpers.js +6 -6
  75. package/dist/plugins/eslint/index.js +0 -1
  76. package/dist/plugins/eslint/resolveFromAST.js +11 -3
  77. package/dist/plugins/evalite/index.js +2 -2
  78. package/dist/plugins/expo/helpers.js +10 -10
  79. package/dist/plugins/expo-router/index.js +3 -3
  80. package/dist/plugins/filesystem-routing/index.js +4 -4
  81. package/dist/plugins/flue/index.js +4 -4
  82. package/dist/plugins/gatsby/index.js +3 -3
  83. package/dist/plugins/github-action/index.js +2 -2
  84. package/dist/plugins/github-actions/index.js +2 -2
  85. package/dist/plugins/graphql-codegen/index.js +8 -6
  86. package/dist/plugins/index.d.ts +6 -0
  87. package/dist/plugins/index.js +12 -0
  88. package/dist/plugins/jasmine/index.js +3 -4
  89. package/dist/plugins/jest/index.js +3 -3
  90. package/dist/plugins/karma/helpers.js +2 -2
  91. package/dist/plugins/karma/index.js +5 -1
  92. package/dist/plugins/knex/index.js +13 -7
  93. package/dist/plugins/laravel-vite-plugin/resolveFromAST.js +2 -2
  94. package/dist/plugins/linthtml/index.js +2 -2
  95. package/dist/plugins/lunaria/index.js +3 -3
  96. package/dist/plugins/maestro/index.d.ts +3 -0
  97. package/dist/plugins/maestro/index.js +54 -0
  98. package/dist/plugins/maestro/types.d.ts +21 -0
  99. package/dist/plugins/maestro/types.js +1 -0
  100. package/dist/plugins/markdownlint/index.js +3 -3
  101. package/dist/plugins/marko/index.js +4 -4
  102. package/dist/plugins/mastra/index.js +3 -3
  103. package/dist/plugins/mdx/index.js +3 -3
  104. package/dist/plugins/mdxlint/index.js +2 -2
  105. package/dist/plugins/metro/index.js +5 -5
  106. package/dist/plugins/mikro-orm/index.js +3 -4
  107. package/dist/plugins/mise/scripts.js +2 -3
  108. package/dist/plugins/mocha/index.js +8 -7
  109. package/dist/plugins/netlify/index.js +4 -4
  110. package/dist/plugins/next/index.js +5 -5
  111. package/dist/plugins/next-mdx/resolveFromAST.js +2 -2
  112. package/dist/plugins/nitro/index.js +4 -4
  113. package/dist/plugins/node/index.d.ts +16 -0
  114. package/dist/plugins/node/index.js +89 -23
  115. package/dist/plugins/nodemon/index.js +1 -1
  116. package/dist/plugins/npm-package-json-lint/index.js +2 -2
  117. package/dist/plugins/nuxt/index.js +16 -14
  118. package/dist/plugins/nx/index.js +3 -3
  119. package/dist/plugins/nyc/index.js +39 -2
  120. package/dist/plugins/oclif/index.js +5 -3
  121. package/dist/plugins/openclaw/index.js +5 -5
  122. package/dist/plugins/oxlint/index.js +2 -2
  123. package/dist/plugins/panda-css/index.js +2 -2
  124. package/dist/plugins/parcel/index.js +2 -2
  125. package/dist/plugins/payload/index.js +3 -3
  126. package/dist/plugins/playwright/index.js +4 -4
  127. package/dist/plugins/pm2/index.js +2 -2
  128. package/dist/plugins/pnpm/index.js +1 -1
  129. package/dist/plugins/postcss/index.js +2 -2
  130. package/dist/plugins/preconstruct/index.js +2 -2
  131. package/dist/plugins/prettier/index.js +4 -3
  132. package/dist/plugins/prisma/index.js +5 -5
  133. package/dist/plugins/quasar/resolveFromAST.js +8 -8
  134. package/dist/plugins/qwik/resolveFromAST.js +3 -3
  135. package/dist/plugins/raycast/index.js +2 -2
  136. package/dist/plugins/react-cosmos/index.js +2 -2
  137. package/dist/plugins/react-native/index.js +1 -1
  138. package/dist/plugins/react-router/index.js +6 -6
  139. package/dist/plugins/relay/index.js +3 -3
  140. package/dist/plugins/release-it/index.js +2 -5
  141. package/dist/plugins/remark/helpers.js +2 -2
  142. package/dist/plugins/retry-cli/index.js +0 -1
  143. package/dist/plugins/rolldown/index.js +2 -2
  144. package/dist/plugins/rollup/index.js +2 -2
  145. package/dist/plugins/rsbuild/index.js +3 -3
  146. package/dist/plugins/rslib/index.js +2 -2
  147. package/dist/plugins/rslint/index.d.ts +3 -0
  148. package/dist/plugins/rslint/index.js +16 -0
  149. package/dist/plugins/rspack/index.js +4 -0
  150. package/dist/plugins/rstest/index.js +4 -4
  151. package/dist/plugins/semantic-release/index.js +2 -2
  152. package/dist/plugins/serverless-framework/index.js +4 -4
  153. package/dist/plugins/solidjs-vite-plugin/resolveFromAST.js +3 -3
  154. package/dist/plugins/sst/resolveFromAST.js +2 -2
  155. package/dist/plugins/starlight/resolveFromAST.js +3 -3
  156. package/dist/plugins/stencil/resolveFromAST.js +5 -5
  157. package/dist/plugins/storybook/index.js +2 -2
  158. package/dist/plugins/stryker/index.js +2 -2
  159. package/dist/plugins/stylelint/index.js +4 -4
  160. package/dist/plugins/sveltekit/resolveFromAST.js +7 -5
  161. package/dist/plugins/swc/index.js +8 -5
  162. package/dist/plugins/tailwind/index.js +3 -2
  163. package/dist/plugins/tanstack-router/index.js +5 -2
  164. package/dist/plugins/textlint/helpers.js +2 -2
  165. package/dist/plugins/ts-node/index.js +23 -6
  166. package/dist/plugins/tsd/index.js +1 -1
  167. package/dist/plugins/tsdown/index.js +4 -4
  168. package/dist/plugins/tsup/index.js +3 -3
  169. package/dist/plugins/tsx/index.js +4 -3
  170. package/dist/plugins/turbo/index.js +2 -2
  171. package/dist/plugins/typedoc/index.js +4 -3
  172. package/dist/plugins/typescript/index.js +4 -4
  173. package/dist/plugins/varlock/scan.js +6 -3
  174. package/dist/plugins/vite/helpers.js +2 -2
  175. package/dist/plugins/vite-plugin-pages/index.js +2 -2
  176. package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +2 -2
  177. package/dist/plugins/vite-plugin-vue-layouts-next/index.js +2 -2
  178. package/dist/plugins/vitest/index.js +14 -18
  179. package/dist/plugins/webdriver-io/index.js +13 -1
  180. package/dist/plugins/webpack/index.js +7 -12
  181. package/dist/plugins/wrangler/index.js +3 -3
  182. package/dist/plugins/wxt/index.js +2 -2
  183. package/dist/plugins/yarn/index.js +5 -5
  184. package/dist/session/incremental.d.ts +1 -1
  185. package/dist/types/PluginNames.d.ts +2 -2
  186. package/dist/types/PluginNames.js +6 -0
  187. package/dist/types/args.d.ts +4 -3
  188. package/dist/types/config.d.ts +2 -0
  189. package/dist/types/module-graph.d.ts +1 -1
  190. package/dist/types/package-json.d.ts +1 -0
  191. package/dist/types/workspace.d.ts +10 -8
  192. package/dist/typescript/ast-nodes.js +4 -5
  193. package/dist/typescript/get-imports-and-exports.js +5 -2
  194. package/dist/typescript/visitors/exports.js +6 -32
  195. package/dist/typescript/visitors/imports.d.ts +1 -1
  196. package/dist/typescript/visitors/imports.js +15 -24
  197. package/dist/typescript/visitors/walk.d.ts +5 -0
  198. package/dist/typescript/visitors/walk.js +75 -30
  199. package/dist/util/codeowners.js +4 -1
  200. package/dist/util/input.d.ts +3 -6
  201. package/dist/util/input.js +6 -20
  202. package/dist/util/parse-and-convert-gitignores.js +5 -4
  203. package/dist/util/parse-args.d.ts +2 -1
  204. package/dist/util/parse-args.js +13 -3
  205. package/dist/util/plugin.js +6 -4
  206. package/dist/util/watch.js +1 -1
  207. package/dist/version.d.ts +1 -1
  208. package/dist/version.js +1 -1
  209. package/package.json +1 -1
  210. package/schema.json +36 -5
@@ -1,4 +1,4 @@
1
- import { toDeferResolve } from '../../util/input.js';
1
+ import { toModule } from '../../util/input.js';
2
2
  import { hasDependency } from '../../util/plugin.js';
3
3
  const title = '__PLUGIN_NAME__';
4
4
  const enablers = ['__PLUGIN_NAME__'];
@@ -8,7 +8,7 @@ const entry = [];
8
8
  const production = [];
9
9
  const resolveConfig = async (config) => {
10
10
  const inputs = config?.plugins ?? [];
11
- return Array.from(inputs, id => toDeferResolve(id));
11
+ return Array.from(inputs, id => toModule(id));
12
12
  };
13
13
  const plugin = {
14
14
  title,
@@ -1,4 +1,4 @@
1
- import { toConfig, toDeferResolve, toDeferResolveEntry, toDeferResolveProductionEntry, toDependency, toEntry, } from '../../util/input.js';
1
+ import { toConfig, toModule, toEntryPath, toDependency, toEntry } from '../../util/input.js';
2
2
  import { hasDependency } from '../../util/plugin.js';
3
3
  import { createComponentStyleUrlsVisitor } from '../_component-style-urls/component-style-urls-visitor.js';
4
4
  import * as karma from '../karma/helpers.js';
@@ -28,13 +28,8 @@ const resolveConfig = async (config, options) => {
28
28
  const productionEntriesByOption = entriesByOptionByConfig.get(PRODUCTION_CONFIG_NAME) ?? new Map();
29
29
  const isBuildTarget = targetName === BUILD_TARGET_NAME;
30
30
  const toInput = (option, specifier, isProduction) => {
31
- const opts = { dir: options.cwd };
32
- if (option === 'polyfills') {
33
- return isProduction
34
- ? toDeferResolve(specifier, { ...opts, production: true })
35
- : toDeferResolve(specifier, opts);
36
- }
37
- return isProduction ? toDeferResolveProductionEntry(specifier, opts) : toDeferResolveEntry(specifier, opts);
31
+ const opts = { dir: options.cwd, production: isProduction };
32
+ return option === 'polyfills' ? toModule(specifier, opts) : toEntryPath(specifier, opts);
38
33
  };
39
34
  for (const [configName, entriesByOption] of entriesByOptionByConfig) {
40
35
  for (const [option, entries] of entriesByOption) {
@@ -1,6 +1,6 @@
1
1
  import { collectFirstPropertyValue, findImportedCallArg, findProperty, getPropertyKey, getPropertyValues, hasImportSpecifier, resolveObjectArg, } from '../../typescript/ast-helpers.js';
2
2
  import { getStringValue } from '../../typescript/ast-nodes.js';
3
- import { toConfig, toDependency, toEntry, toProductionEntry } from '../../util/input.js';
3
+ import { toConfig, toDependency, toEntry } from '../../util/input.js';
4
4
  import { getAliasInputs } from '../vitest/helpers.js';
5
5
  export const entry = ['src/content/config.ts', 'src/content.config.ts'];
6
6
  export const production = [
@@ -54,7 +54,7 @@ export const resolveFromAST = (program, options) => {
54
54
  const setSrcDir = (entry) => entry.replace(/^src\//, `${srcDir}/`);
55
55
  const inputs = [
56
56
  ...entry.map(setSrcDir).map(path => toEntry(path)),
57
- ...production.map(setSrcDir).map(path => toProductionEntry(path)),
57
+ ...production.map(setSrcDir).map(path => toEntry(path, { production: true })),
58
58
  ...getAliasInputs(getViteAliases(program), options.cwd),
59
59
  ];
60
60
  if (!usesPassthroughImageService(program))
@@ -1,4 +1,4 @@
1
- import { toProductionEntry } from '../../util/input.js';
1
+ import { toEntry } from '../../util/input.js';
2
2
  import { hasDependency } from '../../util/plugin.js';
3
3
  import { substringBefore } from '../../util/string.js';
4
4
  const title = 'Astro Markdoc';
@@ -23,7 +23,7 @@ const resolveConfig = async (localConfig) => {
23
23
  return [];
24
24
  const entries = [...Object.values(localConfig.nodes ?? {}), ...Object.values(localConfig.tags ?? {})];
25
25
  const specifiers = entries.flatMap(item => item && typeof item === 'object' && 'render' in item ? extractSpecifiers(item.render) : []);
26
- return specifiers.map(id => toProductionEntry(id));
26
+ return specifiers.map(id => toEntry(id, { production: true }));
27
27
  };
28
28
  const plugin = {
29
29
  title,
@@ -4,7 +4,7 @@ const title = 'astro-og-canvas';
4
4
  const enablers = ['astro-og-canvas'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
6
  const resolve = async () => {
7
- return [toDependency('canvaskit-wasm', { optional: true })];
7
+ return [toDependency('canvaskit-wasm', { production: true, optional: true })];
8
8
  };
9
9
  const plugin = {
10
10
  title,
@@ -1,5 +1,5 @@
1
1
  import { isDirectory } from '../../util/fs.js';
2
- import { toDeferResolve } from '../../util/input.js';
2
+ import { toModule } from '../../util/input.js';
3
3
  import { toAbsolute } from '../../util/path.js';
4
4
  import { hasDependency } from '../../util/plugin.js';
5
5
  const title = 'AWS CDK';
@@ -10,7 +10,7 @@ const resolveConfig = (localConfig, options) => {
10
10
  const scripts = [localConfig.build, localConfig.app].filter((script) => typeof script === 'string');
11
11
  const inputs = options.getInputsFromScripts(scripts, { optionalBinaries: true, cwd: options.configFileDir });
12
12
  for (const id of localConfig.plugin ?? [])
13
- inputs.push(toDeferResolve(id));
13
+ inputs.push(toModule(id));
14
14
  return inputs;
15
15
  };
16
16
  const args = {
@@ -18,7 +18,7 @@ const args = {
18
18
  string: ['app'],
19
19
  alias: { app: ['a'] },
20
20
  fromArgs: (parsed, _, { cwd }) => typeof parsed.app === 'string' && parsed.app.includes(' ') && !isDirectory(toAbsolute(parsed.app, cwd))
21
- ? parsed.app.split(' ')
21
+ ? parsed.app
22
22
  : [],
23
23
  };
24
24
  const plugin = {
@@ -1,6 +1,7 @@
1
1
  import { compact } from '../../util/array.js';
2
- import { toConfig, toDeferResolve, toDependency } from '../../util/input.js';
2
+ import { toConfig, toModule, toDependency } from '../../util/input.js';
3
3
  import { getPackageNameFromSpecifier } from '../../util/modules.js';
4
+ import { isInNodeModules } from '../../util/path.js';
4
5
  import { hasDependency } from '../../util/plugin.js';
5
6
  import { api, resolveName } from './helpers.js';
6
7
  const title = 'Babel';
@@ -22,6 +23,7 @@ const isRuntimeImportPlugin = (value) => {
22
23
  const runtime = value[1]?.runtime;
23
24
  return typeof runtime?.import === 'string';
24
25
  };
26
+ const toPluginModule = (id) => toModule(id, isInNodeModules(id) ? { optional: true } : undefined);
25
27
  export const getDependenciesFromConfig = (config, isProduction = true) => {
26
28
  const presets = config.presets?.flatMap(getName).map(name => resolveName(name, 'preset')) ?? [];
27
29
  const plugins = config.plugins?.flatMap(getName).map(name => resolveName(name, 'plugin')) ?? [];
@@ -29,8 +31,8 @@ export const getDependenciesFromConfig = (config, isProduction = true) => {
29
31
  const nested = config.env ? Object.values(config.env).flatMap(toInputs) : [];
30
32
  const overrides = config.overrides ? [config.overrides].flat().flatMap(toInputs) : [];
31
33
  return compact([
32
- ...presets.map(id => toDeferResolve(id)),
33
- ...plugins.map(id => toDeferResolve(id)),
34
+ ...presets.map(toPluginModule),
35
+ ...plugins.map(toPluginModule),
34
36
  ...(plugins.includes('@babel/plugin-transform-runtime')
35
37
  ? [toDependency('@babel/runtime', { optional: true, production: isProduction })]
36
38
  : []),
@@ -1,4 +1,4 @@
1
- import { toDeferResolve, toEntry } from '../../util/input.js';
1
+ import { toModule, toEntry } from '../../util/input.js';
2
2
  import { hasDependency } from '../../util/plugin.js';
3
3
  const title = 'Borp';
4
4
  const enablers = ['borp'];
@@ -11,7 +11,7 @@ const toReporterInput = (reporter) => {
11
11
  const name = separatorIndex === -1 ? reporter : reporter.slice(0, separatorIndex);
12
12
  if (builtinReporters.has(name))
13
13
  return;
14
- return toDeferResolve(name);
14
+ return toModule(name);
15
15
  };
16
16
  const resolveConfig = async (localConfig) => {
17
17
  const inputs = [];
@@ -1,5 +1,5 @@
1
1
  import { isFile } from '../../util/fs.js';
2
- import { toDeferResolve, toEntry, toIgnore } from '../../util/input.js';
2
+ import { toModule, toEntry, toIgnore } from '../../util/input.js';
3
3
  import parseArgs from '../../util/parse-args.js';
4
4
  const title = 'Bun';
5
5
  const enablers = 'This plugin is enabled when a `bun.lock` or `bun.lockb` file is found or a `bun test` script is configured.';
@@ -19,7 +19,7 @@ const isEnabled = ({ cwd, manifest, getScriptCommands }) => isFile(cwd, 'bun.loc
19
19
  const config = ['bunfig.toml'];
20
20
  const resolveConfig = localConfig => {
21
21
  const preload = localConfig.test?.preload ?? [];
22
- return preload.map(specifier => toDeferResolve(specifier));
22
+ return preload.map(specifier => toModule(specifier));
23
23
  };
24
24
  const isPath = (arg) => /^\.{0,2}\//.test(arg);
25
25
  const toFilterPatterns = (filter) => {
@@ -56,7 +56,7 @@ const resolve = options => {
56
56
  for (const pattern of targets.length === 0 ? patterns : targets.flatMap(toPatterns))
57
57
  inputs.push(toEntry(pattern));
58
58
  for (const specifier of [parsed.preload ?? []].flat())
59
- inputs.push(toDeferResolve(specifier));
59
+ inputs.push(toModule(specifier));
60
60
  }
61
61
  return inputs;
62
62
  };
@@ -1,16 +1,43 @@
1
- import { isFile } from '../../util/fs.js';
1
+ import { isFile, loadJSON } from '../../util/fs.js';
2
2
  import { toDependency } from '../../util/input.js';
3
3
  import { hasDependency } from '../../util/plugin.js';
4
+ import { resolvePackageManifestPath } from '../../util/resolve.js';
4
5
  const title = 'Capacitor';
5
6
  const enablers = [/^@capacitor\//];
6
7
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
8
  const config = ['capacitor.config.{json,js,ts}'];
8
- const resolveConfig = async (config, { configFileDir }) => {
9
- const plugins = config.includePlugins ?? [];
10
- const android = isFile(configFileDir, 'android/capacitor.settings.gradle') ? ['@capacitor/android'] : [];
9
+ const resolveConfig = async (config, { configFileDir, cwd, manifest }) => {
10
+ const platforms = [];
11
+ if (isFile(configFileDir, 'android/capacitor.settings.gradle'))
12
+ platforms.push('android');
11
13
  const hasIOS = isFile(configFileDir, 'ios/App/Podfile') || isFile(configFileDir, 'ios/App/CapApp-SPM/Package.swift');
12
- const ios = hasIOS ? ['@capacitor/ios'] : [];
13
- return [...plugins, ...android, ...ios].map(id => toDependency(id));
14
+ if (hasIOS)
15
+ platforms.push('ios');
16
+ const plugins = new Set(platforms.length ? [] : config.includePlugins);
17
+ const automatic = [];
18
+ for (const platform of platforms) {
19
+ const included = config[platform]?.includePlugins ?? config.includePlugins;
20
+ if (included) {
21
+ for (const name of included)
22
+ plugins.add(name);
23
+ }
24
+ else {
25
+ automatic.push(platform);
26
+ }
27
+ }
28
+ if (automatic.length) {
29
+ for (const dependencies of [manifest.dependencies, manifest.devDependencies]) {
30
+ for (const name in dependencies) {
31
+ const path = resolvePackageManifestPath(name, cwd);
32
+ if (!path)
33
+ continue;
34
+ const pkg = await loadJSON(path);
35
+ if (automatic.some(platform => pkg.capacitor?.[platform]))
36
+ plugins.add(name);
37
+ }
38
+ }
39
+ }
40
+ return [...plugins, ...platforms.map(platform => `@capacitor/${platform}`)].map(id => toDependency(id, { production: true }));
14
41
  };
15
42
  const plugin = {
16
43
  title,
@@ -1,3 +1,13 @@
1
+ export type CapacitorPlatform = 'android' | 'ios';
1
2
  export type CapacitorConfig = {
2
3
  includePlugins?: string[];
4
+ android?: {
5
+ includePlugins?: string[];
6
+ };
7
+ ios?: {
8
+ includePlugins?: string[];
9
+ };
10
+ };
11
+ export type CapacitorPluginPackage = {
12
+ capacitor?: Partial<Record<CapacitorPlatform, unknown>>;
3
13
  };
@@ -1,4 +1,4 @@
1
- import { toDeferResolve, toDependency } from '../../util/input.js';
1
+ import { toModule, toDependency } from '../../util/input.js';
2
2
  import { getPackageNameFromFilePath } from '../../util/modules.js';
3
3
  import { isInternal } from '../../util/path.js';
4
4
  import { hasDependency } from '../../util/plugin.js';
@@ -12,7 +12,7 @@ const resolveConfig = config => {
12
12
  ? [config.changelog[0]]
13
13
  : typeof config.changelog === 'string'
14
14
  ? [config.changelog]
15
- : []).map(id => (isInternal(id) ? toDeferResolve(id) : toDependency(id)));
15
+ : []).map(id => (isInternal(id) ? toModule(id) : toDependency(id)));
16
16
  if (config.$schema?.includes('node_modules/')) {
17
17
  const packageName = getPackageNameFromFilePath(config.$schema);
18
18
  if (packageName)
@@ -1,4 +1,4 @@
1
- import { toDeferResolve, toDependency } from '../../util/input.js';
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 = 'Commitizen';
@@ -10,7 +10,7 @@ const config = ['.czrc', '.cz.json', 'package.json'];
10
10
  const resolveConfig = (config, options) => {
11
11
  if (!config.path)
12
12
  return [];
13
- return [isInternal(config.path) ? toDeferResolve(config.path, { dir: options.cwd }) : toDependency(config.path)];
13
+ return [isInternal(config.path) ? toModule(config.path, { dir: options.cwd }) : toDependency(config.path)];
14
14
  };
15
15
  const plugin = {
16
16
  title,
@@ -1,4 +1,4 @@
1
- import { toConfig, toDeferResolve, toDependency } from '../../util/input.js';
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';
@@ -46,7 +46,7 @@ const resolveConfig = async (config) => {
46
46
  if (typeof parserPreset === 'string')
47
47
  modules.push(parserPreset);
48
48
  for (const id of modules)
49
- inputs.push(isInternal(id) ? toDeferResolve(id) : toDependency(id));
49
+ inputs.push(isInternal(id) ? toModule(id) : toDependency(id));
50
50
  if (typeof parserPreset === 'object' && parserPreset.path)
51
51
  inputs.push(toDependency(parserPreset.path));
52
52
  return inputs;
@@ -1,4 +1,4 @@
1
- import { toProductionEntry } from '../../util/input.js';
1
+ import { 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 = 'Convex';
@@ -8,7 +8,7 @@ const config = ['convex.json'];
8
8
  const production = ['convex/**/*.@(js|ts)'];
9
9
  const resolveConfig = localConfig => {
10
10
  const functionsDir = typeof localConfig.functions === 'string' ? localConfig.functions : 'convex';
11
- return [toProductionEntry(join(functionsDir, '**/*.@(js|ts)'))];
11
+ return [toEntry(join(functionsDir, '**/*.@(js|ts)'), { production: true })];
12
12
  };
13
13
  const plugin = {
14
14
  title,
@@ -1,4 +1,4 @@
1
- import { toDeferResolve } from '../../util/input.js';
1
+ import { toModule } from '../../util/input.js';
2
2
  import { hasDependency } from '../../util/plugin.js';
3
3
  const title = 'CSpell';
4
4
  const enablers = ['cspell'];
@@ -18,7 +18,7 @@ const config = [
18
18
  '.config/cspell.{yaml,yml}',
19
19
  ];
20
20
  const resolveConfig = config => {
21
- return [config?.import ?? []].flat().map(id => toDeferResolve(id));
21
+ return [config?.import ?? []].flat().map(id => toModule(id));
22
22
  };
23
23
  const plugin = {
24
24
  title,
@@ -1,4 +1,4 @@
1
- import { toDeferResolve, toEntry } from '../../util/input.js';
1
+ import { toModule, toEntry } from '../../util/input.js';
2
2
  import { hasDependency } from '../../util/plugin.js';
3
3
  const title = 'Cucumber';
4
4
  const enablers = ['@cucumber/cucumber'];
@@ -31,7 +31,7 @@ const resolveProfile = (config) => {
31
31
  const formatters = (config?.format ? config.format : [])
32
32
  .map(toFormatterName)
33
33
  .filter(name => !builtinFormatters.has(name))
34
- .map(id => toDeferResolve(id));
34
+ .map(id => toModule(id));
35
35
  return [...imports, ...requires, ...formatters];
36
36
  };
37
37
  const resolveConfig = (config, options) => {
@@ -1,4 +1,4 @@
1
- import { toDeferResolve, toDeferResolveEntry, toEntry } from '../../util/input.js';
1
+ import { toModule, toEntryPath, toEntry } from '../../util/input.js';
2
2
  import { hasDependency } from '../../util/plugin.js';
3
3
  import { resolveDependencies } from './helpers.js';
4
4
  const title = 'Cypress';
@@ -18,10 +18,10 @@ const resolveConfig = async (localConfig, options) => {
18
18
  const supportFiles = [localConfig.e2e?.supportFile || [], localConfig.component?.supportFile || []].flat();
19
19
  const inputs = await resolveDependencies(localConfig, options);
20
20
  return [
21
- ...inputs.map(id => toDeferResolve(id)),
21
+ ...inputs.map(id => toModule(id)),
22
22
  ...(specPatterns.length > 0 ? specPatterns : TEST_FILE_PATTERNS).map(id => toEntry(id)),
23
23
  ...(supportFiles.length > 0
24
- ? supportFiles.map(id => toDeferResolveEntry(id, { dir: options.cwd }))
24
+ ? supportFiles.map(id => toEntryPath(id, { dir: options.cwd }))
25
25
  : SUPPORT_FILE_PATTERNS.map(id => toEntry(id))),
26
26
  ];
27
27
  };
@@ -1,4 +1,4 @@
1
- import { toDependency, toDeferResolveProductionEntry } from '../../util/input.js';
1
+ import { toDependency, toEntryPath } from '../../util/input.js';
2
2
  import { isAbsolute, toAbsolute } from '../../util/path.js';
3
3
  import { findWebpackDependenciesFromConfig } from '../webpack/index.js';
4
4
  const isLocalPath = (name) => name.startsWith('.') || isAbsolute(name);
@@ -61,10 +61,10 @@ const resolveArrayConfig = ([name, config], type, cwd) => {
61
61
  if (typeof name !== 'string')
62
62
  return [];
63
63
  const sidebarPath = type !== 'theme' ? resolveSidebarPath(config) : undefined;
64
- const sidebar = sidebarPath ? [toDeferResolveProductionEntry(sidebarPath, { dir: cwd })] : [];
64
+ const sidebar = sidebarPath ? [toEntryPath(sidebarPath, { production: true, dir: cwd })] : [];
65
65
  if (isLocalPath(name))
66
- return [toDeferResolveProductionEntry(toAbsolute(name, cwd)), ...sidebar];
67
- return [toDependency(resolveModuleName(name, type)), ...sidebar];
66
+ return [toEntryPath(toAbsolute(name, cwd), { production: true }), ...sidebar];
67
+ return [toDependency(resolveModuleName(name, type), { production: type !== 'plugin' }), ...sidebar];
68
68
  };
69
69
  export const resolveConfigItems = async (items, type, options) => {
70
70
  const inputs = new Set();
@@ -75,9 +75,9 @@ export const resolveConfigItems = async (items, type, options) => {
75
75
  continue;
76
76
  if (typeof item === 'string') {
77
77
  if (isLocalPath(item))
78
- inputs.add(toDeferResolveProductionEntry(toAbsolute(item, options.cwd)));
78
+ inputs.add(toEntryPath(toAbsolute(item, options.cwd), { production: true }));
79
79
  else
80
- inputs.add(toDependency(resolveModuleName(item, type)));
80
+ inputs.add(toDependency(resolveModuleName(item, type), { production: type !== 'plugin' }));
81
81
  }
82
82
  else if (Array.isArray(item)) {
83
83
  for (const input of resolveArrayConfig(item, type, options.cwd))
@@ -1,4 +1,4 @@
1
- import { toAlias, toConfig, toDeferResolveProductionEntry, toDependency, toIgnore, toProductionEntry, } from '../../util/input.js';
1
+ import { toAlias, toConfig, toEntryPath, toDependency, toIgnore, toEntry } from '../../util/input.js';
2
2
  import { join } from '../../util/path.js';
3
3
  import { hasDependency } from '../../util/plugin.js';
4
4
  import { CORE_CLIENT_API, resolveConfigItems } from './helpers.js';
@@ -13,7 +13,7 @@ const resolveStaticAssets = (items, cwd) => {
13
13
  for (const item of items ?? []) {
14
14
  const value = typeof item === 'string' ? item : (item.src ?? item.href);
15
15
  if (typeof value === 'string' && !value.includes('://'))
16
- entries.push(toDeferResolveProductionEntry(join(cwd, 'static', value)));
16
+ entries.push(toEntryPath(join(cwd, 'static', value), { production: true }));
17
17
  }
18
18
  return entries;
19
19
  };
@@ -32,7 +32,7 @@ const resolveConfig = async (config, options) => {
32
32
  toIgnore(`@docusaurus/(${CORE_CLIENT_API.join('|')})`, 'dependencies'),
33
33
  toIgnore('@generated/.*', 'dependencies'),
34
34
  ...(config.future?.experimental_faster ? [toDependency('@docusaurus/faster')] : []),
35
- ...production.map(id => toProductionEntry(id)),
35
+ ...production.map(id => toEntry(id, { production: true })),
36
36
  ...themes,
37
37
  ...plugins,
38
38
  ...presets,
@@ -1,7 +1,11 @@
1
- import { argsFrom } from '../../binaries/util.js';
1
+ import { spawningArgs } from '../../binaries/util.js';
2
2
  const title = 'dotenv';
3
3
  const args = {
4
- fromArgs: (parsed, args) => (parsed._[0] ? argsFrom(args, parsed._[0]) : (parsed['--'] ?? [])),
4
+ binaries: ['dotenv', 'dotenv-cli'],
5
+ args: (args) => (args[0] === 'run' ? args.slice(1) : args),
6
+ boolean: ['debug', 'fast', 'override'],
7
+ alias: { quiet: ['q'] },
8
+ fromArgs: spawningArgs,
5
9
  };
6
10
  const plugin = {
7
11
  title,
@@ -1,4 +1,4 @@
1
- import { toProductionEntry } from '../../util/input.js';
1
+ import { toEntry } from '../../util/input.js';
2
2
  import { hasDependency } from '../../util/plugin.js';
3
3
  const title = 'Drizzle';
4
4
  const enablers = ['drizzle-kit'];
@@ -7,7 +7,7 @@ const config = ['drizzle.config.{ts,js,json}'];
7
7
  const resolveConfig = config => {
8
8
  if (!config.schema)
9
9
  return [];
10
- return [config.schema].flat().map(id => toProductionEntry(id));
10
+ return [config.schema].flat().map(id => toEntry(id, { production: true }));
11
11
  };
12
12
  const plugin = {
13
13
  title,
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '../../types/config.ts';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -0,0 +1,61 @@
1
+ import { toModule } from '../../util/input.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
+ import { isObject } from '../../util/validation.js';
4
+ const title = 'electron-builder';
5
+ const enablers = ['electron-builder'];
6
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
+ const packageJsonPath = 'build';
8
+ const config = ['package.json', 'electron-builder.{yml,yaml,json,json5,toml,js,cjs,ts}'];
9
+ const hooks = [
10
+ 'beforePack',
11
+ 'afterExtract',
12
+ 'afterPack',
13
+ 'afterSign',
14
+ 'artifactBuildStarted',
15
+ 'artifactBuildCompleted',
16
+ 'afterAllArtifactBuild',
17
+ 'msiProjectCreated',
18
+ 'appxManifestCreated',
19
+ 'onNodeModuleFile',
20
+ 'beforeBuild',
21
+ ];
22
+ const resolveConfig = async (config, options) => {
23
+ const request = {
24
+ packageKey: 'build',
25
+ configFilename: 'electron-builder',
26
+ projectDir: options.cwd,
27
+ packageMetadata: { value: Promise.resolve(options.manifest) },
28
+ };
29
+ const localConfig = typeof config === 'function' ? await config(request) : config;
30
+ if (!isObject(localConfig))
31
+ return [];
32
+ const ids = [];
33
+ for (const hook of hooks)
34
+ ids.push(localConfig[hook]);
35
+ for (const target of [localConfig.mac, localConfig.mas, localConfig.masDev]) {
36
+ if (isObject(target))
37
+ ids.push(target.sign);
38
+ }
39
+ const win = localConfig.win;
40
+ if (isObject(win) && isObject(win.signtoolOptions))
41
+ ids.push(win.signtoolOptions.sign);
42
+ const inputs = [];
43
+ for (const id of ids)
44
+ if (typeof id === 'string')
45
+ inputs.push(toModule(id, { dir: options.cwd }));
46
+ return inputs;
47
+ };
48
+ const args = {
49
+ config: true,
50
+ args: (args) => args.filter(arg => !/^--?c(onfig)?\./.test(arg)),
51
+ };
52
+ const plugin = {
53
+ title,
54
+ enablers,
55
+ isEnabled,
56
+ packageJsonPath,
57
+ config,
58
+ resolveConfig,
59
+ args,
60
+ };
61
+ export default plugin;
@@ -1,4 +1,4 @@
1
- import { toConfig, toDependency, toDeferResolveProductionEntry } from '../../util/input.js';
1
+ import { toConfig, toDependency, toEntryPath } from '../../util/input.js';
2
2
  import { toAbsolute } from '../../util/path.js';
3
3
  import { hasDependency } from '../../util/plugin.js';
4
4
  import { findWebpackDependenciesFromConfig } from '../webpack/index.js';
@@ -25,7 +25,7 @@ const getPluginInputs = async (name, opts, options) => {
25
25
  const inputs = [];
26
26
  const addEntry = (value) => {
27
27
  for (const id of toStrings(value))
28
- inputs.push(toDeferResolveProductionEntry(toAbsolute(id, cwd)));
28
+ inputs.push(toEntryPath(toAbsolute(id, cwd), { production: true }));
29
29
  };
30
30
  const addConfig = async (pluginName, value) => {
31
31
  if (typeof value === 'string') {
@@ -1,4 +1,4 @@
1
- import { toDeferResolveProductionEntry, toProductionEntry } from '../../util/input.js';
1
+ import { toEntryPath, toEntry } from '../../util/input.js';
2
2
  import { toAbsolute } from '../../util/path.js';
3
3
  import { hasDependency } from '../../util/plugin.js';
4
4
  import { getHtmlScriptEntries } from '../vite/helpers.js';
@@ -22,7 +22,8 @@ const resolveConfig = async (localConfig, options) => {
22
22
  if (typeof section === 'function')
23
23
  section = await section(buildEnv);
24
24
  const ids = [];
25
- for (const input of [section?.build?.rollupOptions?.input, section?.build?.lib?.entry]) {
25
+ const rolldownOptions = section?.build?.rolldownOptions ?? section?.build?.rollupOptions;
26
+ for (const input of [rolldownOptions?.input, section?.build?.lib?.entry]) {
26
27
  if (typeof input === 'string')
27
28
  ids.push(input);
28
29
  else if (input)
@@ -31,7 +32,7 @@ const resolveConfig = async (localConfig, options) => {
31
32
  const patterns = ids.length > 0 ? ids : [defaultEntry[name]];
32
33
  for (const id of patterns) {
33
34
  const resolved = toAbsolute(id, configFileDir);
34
- inputs.push(ids.length > 0 ? toDeferResolveProductionEntry(resolved) : toProductionEntry(resolved));
35
+ inputs.push(ids.length > 0 ? toEntryPath(resolved, { production: true }) : toEntry(resolved, { production: true }));
35
36
  if (name === 'renderer' && resolved.endsWith('.html')) {
36
37
  for (const input of await getHtmlScriptEntries(resolved))
37
38
  inputs.push(input);
@@ -1,6 +1,9 @@
1
1
  type EntryInput = string | string[] | Record<string, string>;
2
2
  interface ViteBuildConfig {
3
3
  build?: {
4
+ rolldownOptions?: {
5
+ input?: EntryInput;
6
+ };
4
7
  rollupOptions?: {
5
8
  input?: EntryInput;
6
9
  };
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_EXTENSIONS } from '../../constants.js';
2
2
  import { isDirectory } from '../../util/fs.js';
3
- import { toDependency, toProductionEntry } from '../../util/input.js';
3
+ import { toDependency, toEntry } from '../../util/input.js';
4
4
  import { getPackageNameFromFilePath } from '../../util/modules.js';
5
5
  import { isInNodeModules, join } from '../../util/path.js';
6
6
  import { hasDependency } from '../../util/plugin.js';
@@ -41,7 +41,7 @@ const resolveConfig = async (localConfig, options) => {
41
41
  join(inputDir, `**/*.{${typeof templateFormats === 'string' ? templateFormats : templateFormats.join(',')}}`),
42
42
  join(inputDir, '**/*.11tydata.{js,cjs,mjs}'),
43
43
  ...copiedEntries,
44
- ].map(id => toProductionEntry(id)));
44
+ ].map(id => toEntry(id, { production: true })));
45
45
  };
46
46
  const plugin = {
47
47
  title,
@@ -0,0 +1,2 @@
1
+ import type { CompilerSync } from '../../compilers/types.ts';
2
+ export declare const compiler: CompilerSync;
@@ -0,0 +1,14 @@
1
+ import { importMatcher } from '../../compilers/compilers.js';
2
+ const reExport = /\bexport\s+(?:type\s+)?(?:\*(?:\s+as\s+\w+)?|\{[^}]*\})\s+from\s*['"][^'"]+['"]/;
3
+ const importSync = /(?<![.\w$])importSync\s*\(\s*['"][^'"]+['"]\s*\)/;
4
+ const nonCode = /\/\/[^\r\n]*|\/\*[\s\S]*?\*\/|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|`(?:\\[\s\S]|[^`\\])*`|<template>[\s\S]*?<\/template>/;
5
+ const statements = new RegExp(`${importMatcher.source}|${reExport.source}|${importSync.source}|${nonCode.source}`, 'g');
6
+ export const compiler = text => {
7
+ const references = [];
8
+ for (const match of text.matchAll(statements)) {
9
+ const statement = match[0];
10
+ if (statement.startsWith('import') || statement.startsWith('export'))
11
+ references.push(statement);
12
+ }
13
+ return references.join(';\n');
14
+ };
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from '../../types/config.ts';
2
+ export declare const docs: {
3
+ note: string;
4
+ };
5
+ declare const plugin: Plugin;
6
+ export default plugin;