knip 6.43.0 → 6.44.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.
Files changed (155) hide show
  1. package/dist/CacheConsultant.d.ts +1 -0
  2. package/dist/CacheConsultant.js +2 -0
  3. package/dist/CatalogCounselor.d.ts +1 -3
  4. package/dist/CatalogCounselor.js +18 -15
  5. package/dist/ConfigurationChief.d.ts +24 -0
  6. package/dist/DependencyDeputy.d.ts +2 -1
  7. package/dist/DependencyDeputy.js +9 -4
  8. package/dist/IssueCollector.js +1 -0
  9. package/dist/ProjectPrincipal.d.ts +3 -2
  10. package/dist/ProjectPrincipal.js +32 -10
  11. package/dist/WorkspaceWorker.d.ts +5 -2
  12. package/dist/WorkspaceWorker.js +20 -7
  13. package/dist/binaries/util.js +2 -1
  14. package/dist/cli.js +6 -1
  15. package/dist/compilers/index.d.ts +5 -0
  16. package/dist/compilers/index.js +1 -1
  17. package/dist/constants.d.ts +1 -0
  18. package/dist/constants.js +1 -0
  19. package/dist/graph/analyze.js +3 -2
  20. package/dist/graph/build.d.ts +2 -0
  21. package/dist/graph/build.js +37 -22
  22. package/dist/graph-explorer/cache.d.ts +2 -1
  23. package/dist/graph-explorer/cache.js +5 -1
  24. package/dist/graph-explorer/explorer.d.ts +3 -5
  25. package/dist/graph-explorer/explorer.js +24 -3
  26. package/dist/plugins/biome/index.js +1 -1
  27. package/dist/plugins/cspell/index.js +1 -0
  28. package/dist/plugins/dependency-cruiser/index.js +2 -2
  29. package/dist/plugins/docusaurus/helpers.js +4 -4
  30. package/dist/plugins/electron-vite/index.js +2 -2
  31. package/dist/plugins/expressive-code/index.d.ts +1 -1
  32. package/dist/plugins/expressive-code/index.js +2 -2
  33. package/dist/plugins/gatsby/index.js +6 -6
  34. package/dist/plugins/gatsby/types.d.ts +1 -1
  35. package/dist/plugins/github-actions/index.js +1 -1
  36. package/dist/plugins/i18next-parser/index.js +2 -2
  37. package/dist/plugins/index.d.ts +5 -1
  38. package/dist/plugins/index.js +8 -0
  39. package/dist/plugins/jasmine/index.js +2 -2
  40. package/dist/plugins/karma/index.js +4 -4
  41. package/dist/plugins/kysely-codegen/index.d.ts +3 -0
  42. package/dist/plugins/kysely-codegen/index.js +20 -0
  43. package/dist/plugins/lefthook/index.js +2 -2
  44. package/dist/plugins/lingui/index.d.ts +3 -0
  45. package/dist/plugins/lingui/index.js +16 -0
  46. package/dist/plugins/lockfile-lint/index.js +2 -2
  47. package/dist/plugins/lost-pixel/index.js +2 -2
  48. package/dist/plugins/lunaria/index.js +2 -2
  49. package/dist/plugins/marko/index.js +5 -6
  50. package/dist/plugins/mastra/index.d.ts +3 -0
  51. package/dist/plugins/mastra/index.js +57 -0
  52. package/dist/plugins/mcp/index.js +1 -1
  53. package/dist/plugins/mise/index.js +0 -3
  54. package/dist/plugins/mocha/index.js +42 -3
  55. package/dist/plugins/mocha/types.d.ts +1 -0
  56. package/dist/plugins/nx/index.js +3 -8
  57. package/dist/plugins/nyc/index.js +1 -1
  58. package/dist/plugins/openapi-ts/index.js +2 -2
  59. package/dist/plugins/oxfmt/index.js +2 -2
  60. package/dist/plugins/playwright/index.js +6 -11
  61. package/dist/plugins/pnpm/index.js +2 -4
  62. package/dist/plugins/purgecss/index.d.ts +3 -0
  63. package/dist/plugins/purgecss/index.js +16 -0
  64. package/dist/plugins/railway/index.js +1 -4
  65. package/dist/plugins/remix/index.js +1 -1
  66. package/dist/plugins/rstest/index.js +2 -2
  67. package/dist/plugins/serverless-framework/index.js +1 -1
  68. package/dist/plugins/storybook/index.js +5 -5
  69. package/dist/plugins/sveltekit/resolveFromAST.js +1 -1
  70. package/dist/plugins/syncpack/index.js +2 -2
  71. package/dist/plugins/tanstack-router/index.js +3 -2
  72. package/dist/plugins/taskfile/index.js +4 -7
  73. package/dist/plugins/textlint/helpers.js +2 -2
  74. package/dist/plugins/typescript/index.js +7 -3
  75. package/dist/plugins/unocss/index.js +2 -2
  76. package/dist/plugins/vite-plugin-pwa/index.js +1 -4
  77. package/dist/plugins/vite-plugin-pwa/resolveFromAST.d.ts +0 -2
  78. package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +2 -2
  79. package/dist/plugins/vite-pwa-assets-generator/index.js +2 -2
  80. package/dist/plugins/vitest/helpers.js +4 -7
  81. package/dist/plugins/vitest/index.js +1 -1
  82. package/dist/plugins/webpack/index.js +4 -2
  83. package/dist/plugins/yarn/index.js +2 -4
  84. package/dist/reporters/codeclimate.d.ts +2 -2
  85. package/dist/reporters/codeclimate.js +2 -4
  86. package/dist/reporters/codeowners.d.ts +2 -2
  87. package/dist/reporters/codeowners.js +9 -9
  88. package/dist/reporters/compact.d.ts +2 -2
  89. package/dist/reporters/compact.js +8 -7
  90. package/dist/reporters/cycles.d.ts +2 -2
  91. package/dist/reporters/cycles.js +7 -6
  92. package/dist/reporters/disclosure.d.ts +2 -2
  93. package/dist/reporters/disclosure.js +6 -4
  94. package/dist/reporters/github-actions.d.ts +2 -2
  95. package/dist/reporters/github-actions.js +7 -5
  96. package/dist/reporters/index.d.ts +10 -10
  97. package/dist/reporters/json.d.ts +2 -2
  98. package/dist/reporters/json.js +2 -4
  99. package/dist/reporters/markdown.d.ts +2 -2
  100. package/dist/reporters/markdown.js +11 -9
  101. package/dist/reporters/sarif.d.ts +2 -2
  102. package/dist/reporters/sarif.js +2 -3
  103. package/dist/reporters/symbols.d.ts +2 -2
  104. package/dist/reporters/symbols.js +6 -4
  105. package/dist/run.d.ts +1 -1
  106. package/dist/run.js +3 -10
  107. package/dist/schema/configuration.d.ts +60 -0
  108. package/dist/schema/plugins.d.ts +20 -0
  109. package/dist/schema/plugins.js +4 -0
  110. package/dist/session/configuration.d.ts +12 -0
  111. package/dist/session/configuration.js +43 -0
  112. package/dist/session/incremental.d.ts +54 -0
  113. package/dist/session/incremental.js +49 -0
  114. package/dist/session/session.d.ts +1 -1
  115. package/dist/session/session.js +62 -27
  116. package/dist/session/watch.d.ts +2 -0
  117. package/dist/session/watch.js +41 -0
  118. package/dist/types/PluginNames.d.ts +2 -2
  119. package/dist/types/PluginNames.js +4 -0
  120. package/dist/types/config.d.ts +1 -0
  121. package/dist/types/issues.d.ts +4 -0
  122. package/dist/types/package-json.d.ts +0 -3
  123. package/dist/typescript/get-imports-and-exports.js +2 -0
  124. package/dist/typescript/visitors/calls.js +15 -11
  125. package/dist/typescript/visitors/imports.d.ts +2 -1
  126. package/dist/typescript/visitors/imports.js +25 -19
  127. package/dist/typescript/visitors/members.js +23 -26
  128. package/dist/typescript/visitors/walk.d.ts +3 -0
  129. package/dist/typescript/visitors/walk.js +42 -2
  130. package/dist/util/cli-arguments.d.ts +2 -1
  131. package/dist/util/cli-arguments.js +3 -0
  132. package/dist/util/create-input-handler.js +1 -1
  133. package/dist/util/create-options.d.ts +42 -1
  134. package/dist/util/create-options.js +13 -2
  135. package/dist/util/file-entry-cache.d.ts +2 -0
  136. package/dist/util/file-entry-cache.js +19 -1
  137. package/dist/util/gitignore-cache.d.ts +1 -0
  138. package/dist/util/gitignore-cache.js +1 -0
  139. package/dist/util/glob-core.js +4 -2
  140. package/dist/util/glob.d.ts +1 -0
  141. package/dist/util/glob.js +6 -0
  142. package/dist/util/input.d.ts +2 -0
  143. package/dist/util/loader.d.ts +1 -0
  144. package/dist/util/loader.js +38 -2
  145. package/dist/util/modules.js +3 -1
  146. package/dist/util/path.d.ts +1 -0
  147. package/dist/util/path.js +1 -0
  148. package/dist/util/reporter.d.ts +1 -1
  149. package/dist/util/reporter.js +53 -9
  150. package/dist/util/watch.d.ts +5 -11
  151. package/dist/util/watch.js +84 -68
  152. package/dist/version.d.ts +1 -1
  153. package/dist/version.js +1 -1
  154. package/package.json +1 -1
  155. package/schema.json +16 -0
@@ -0,0 +1,16 @@
1
+ import { hasDependency } from '../../util/plugin.js';
2
+ const title = 'Lingui';
3
+ const enablers = ['@lingui/cli'];
4
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
+ const entry = ['lingui.config.{js,cjs,ts,mjs}', '.linguirc.{js,ts}'];
6
+ const args = {
7
+ config: ['config'],
8
+ };
9
+ const plugin = {
10
+ title,
11
+ enablers,
12
+ isEnabled,
13
+ entry,
14
+ args,
15
+ };
16
+ export default plugin;
@@ -3,11 +3,11 @@ import { toCosmiconfig } from '../../util/plugin-config.js';
3
3
  const title = 'lockfile-lint';
4
4
  const enablers = ['lockfile-lint'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
- const config = ['package.json', ...toCosmiconfig('lockfile-lint', { additionalExtensions: ['toml'] })];
6
+ const entry = ['package.json', ...toCosmiconfig('lockfile-lint', { additionalExtensions: ['toml'] })];
7
7
  const plugin = {
8
8
  title,
9
9
  enablers,
10
10
  isEnabled,
11
- config,
11
+ entry,
12
12
  };
13
13
  export default plugin;
@@ -2,11 +2,11 @@ import { hasDependency } from '../../util/plugin.js';
2
2
  const title = 'Lost Pixel';
3
3
  const enablers = ['lost-pixel'];
4
4
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
- const config = ['lostpixel.config.{js,ts}'];
5
+ const entry = ['lostpixel.config.{js,ts}'];
6
6
  const plugin = {
7
7
  title,
8
8
  enablers,
9
9
  isEnabled,
10
- config,
10
+ entry,
11
11
  };
12
12
  export default plugin;
@@ -1,4 +1,4 @@
1
- import { isAbsolute, join } from '../../util/path.js';
1
+ import { toAbsolute } from '../../util/path.js';
2
2
  import { toProductionEntry } from '../../util/input.js';
3
3
  import { hasDependency } from '../../util/plugin.js';
4
4
  const title = 'Lunaria';
@@ -13,7 +13,7 @@ const resolveConfig = async (localConfig, options) => {
13
13
  const customCss = localConfig.dashboard?.customCss ?? [];
14
14
  const favicon = localConfig.dashboard?.favicon?.inline ? [localConfig.dashboard.favicon.inline] : [];
15
15
  const baseDir = options.configFileDir;
16
- return [...files, ...renderer, ...customCss, ...favicon].map(id => toProductionEntry(isAbsolute(id) ? id : join(baseDir, id)));
16
+ return [...files, ...renderer, ...customCss, ...favicon].map(id => toProductionEntry(toAbsolute(id, baseDir)));
17
17
  };
18
18
  const args = {
19
19
  binaries: ['lunaria'],
@@ -1,5 +1,5 @@
1
1
  import { toDeferResolve, toProductionEntry } from '../../util/input.js';
2
- import { join, relative } from '../../util/path.js';
2
+ import { join } from '../../util/path.js';
3
3
  import { hasDependency } from '../../util/plugin.js';
4
4
  import { createCompiler } from './compiler.js';
5
5
  import { getTaglibDependencies } from './taglibs.js';
@@ -29,18 +29,17 @@ const tagDefFields = [
29
29
  'translate',
30
30
  ];
31
31
  const resolveConfig = (localConfig, options) => {
32
- const { configFileName, configFileDir, cwd } = options;
33
- const inputs = [];
32
+ const { configFileName, configFileDir } = options;
33
+ const inputs = production.map(pattern => toProductionEntry(pattern));
34
34
  if (!localConfig)
35
35
  return inputs;
36
36
  if (configFileName === 'marko.json') {
37
- const dir = relative(cwd, configFileDir);
38
- return tagProduction.map(pattern => toProductionEntry(join(dir, pattern)));
37
+ return tagProduction.map(pattern => toProductionEntry(join(configFileDir, pattern)));
39
38
  }
40
39
  for (const field of tagDefFields) {
41
40
  for (const id of [localConfig[field]].flat()) {
42
41
  if (typeof id === 'string')
43
- inputs.push(toDeferResolve(join(configFileDir, id)));
42
+ inputs.push(toDeferResolve(id));
44
43
  }
45
44
  }
46
45
  return inputs;
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '../../types/config.ts';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -0,0 +1,57 @@
1
+ import { join } from '../../util/path.js';
2
+ import { isDirectory } from '../../util/fs.js';
3
+ import { toProductionEntry } from '../../util/input.js';
4
+ import { hasDependency } from '../../util/plugin.js';
5
+ const title = 'Mastra';
6
+ const enablers = ['mastra'];
7
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
8
+ const extensions = '{js,ts}';
9
+ const defaultDir = 'src/mastra';
10
+ const discoveryCommands = new Set(['dev', 'build']);
11
+ const getProductionPatterns = (dir) => {
12
+ const agentRoots = `${dir}/agents/*/*(subagents/*/)`;
13
+ return [
14
+ `${dir}/index.${extensions}`,
15
+ `${dir}/{storage,observability,logger,server,studio}.{js,ts,mjs,mts}`,
16
+ `${dir}/workflows/*.${extensions}`,
17
+ `${dir}/{,agents/*/}tools/**/*.${extensions}`,
18
+ `${agentRoots}{config,instructions,memory,workspace}.${extensions}`,
19
+ `${agentRoots}{tools,scorers,skills,processors/input,processors/output}/*.${extensions}`,
20
+ `${agentRoots}schedules/**/*.${extensions}`,
21
+ `!${dir}/**/*.{test,spec}.${extensions}`,
22
+ `!${dir}/**/__tests__/**`,
23
+ ];
24
+ };
25
+ const production = getProductionPatterns(defaultDir);
26
+ const args = {
27
+ binaries: ['mastra'],
28
+ string: ['dir', 'tools'],
29
+ alias: { dir: ['d'], tools: ['t'] },
30
+ resolveInputs: (parsed, { cwd }) => {
31
+ if (!discoveryCommands.has(parsed._[0]))
32
+ return [];
33
+ const inputs = [];
34
+ if (parsed.dir) {
35
+ for (const pattern of getProductionPatterns(parsed.dir))
36
+ inputs.push(toProductionEntry(pattern));
37
+ }
38
+ if (parsed.tools) {
39
+ for (const tool of String(parsed.tools).split(',')) {
40
+ const specifier = tool.trim();
41
+ if (!specifier)
42
+ continue;
43
+ const pattern = isDirectory(join(cwd, specifier)) ? `${specifier}/index.${extensions}` : specifier;
44
+ inputs.push(toProductionEntry(pattern));
45
+ }
46
+ }
47
+ return inputs;
48
+ },
49
+ };
50
+ const plugin = {
51
+ title,
52
+ enablers,
53
+ isEnabled,
54
+ production,
55
+ args,
56
+ };
57
+ export default plugin;
@@ -15,7 +15,7 @@ const resolveConfig = async (localConfig, options) => {
15
15
  continue;
16
16
  const script = [server.command, ...(server.args ?? [])].join(' ').replace(PROJECT_DIR_VAR, '.');
17
17
  const dir = server.cwd ? toAbsolute(server.cwd.replace(PROJECT_DIR_VAR, '.'), cwd) : cwd;
18
- for (const input of getInputsFromScripts(script, { optionalBinaries: true })) {
18
+ for (const input of getInputsFromScripts(script, { optionalBinaries: true, cwd: dir })) {
19
19
  input.dir = dir;
20
20
  inputs.push(input);
21
21
  }
@@ -1,5 +1,4 @@
1
1
  import { isFile } from '../../util/fs.js';
2
- import { isEntry } from '../../util/input.js';
3
2
  import { basename, dirname, join, toAbsolute } from '../../util/path.js';
4
3
  const title = 'mise';
5
4
  const enablers = 'This plugin is enabled when `mise.toml` or `.mise.toml` is found.';
@@ -64,8 +63,6 @@ const resolveConfig = async (localConfig, options) => {
64
63
  if (isProduction)
65
64
  input.optional = true;
66
65
  input.dir ??= dir;
67
- if (isEntry(input))
68
- input.specifier = toAbsolute(input.specifier, input.dir);
69
66
  inputs.push(input);
70
67
  }
71
68
  }
@@ -7,14 +7,51 @@ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
7
  const config = ['.mocharc.{js,cjs,json,jsonc,yml,yaml}', 'package.json'];
8
8
  const entry = ['**/test/*.{js,cjs,mjs}'];
9
9
  const defaultExtensions = ['js', 'cjs', 'mjs'];
10
- const resolveConfig = localConfig => {
10
+ const builtInReporters = new Set([
11
+ 'Base',
12
+ 'base',
13
+ 'Dot',
14
+ 'dot',
15
+ 'Doc',
16
+ 'doc',
17
+ 'TAP',
18
+ 'tap',
19
+ 'JSON',
20
+ 'json',
21
+ 'HTML',
22
+ 'html',
23
+ 'List',
24
+ 'list',
25
+ 'Min',
26
+ 'min',
27
+ 'Spec',
28
+ 'spec',
29
+ 'Nyan',
30
+ 'nyan',
31
+ 'XUnit',
32
+ 'xunit',
33
+ 'Markdown',
34
+ 'markdown',
35
+ 'Progress',
36
+ 'progress',
37
+ 'Landing',
38
+ 'landing',
39
+ 'JSONStream',
40
+ 'json-stream',
41
+ 'GithubActions',
42
+ 'github-actions',
43
+ ]);
44
+ const isExternalReporter = (reporter) => typeof reporter === 'string' && !builtInReporters.has(reporter);
45
+ const resolveConfig = (localConfig, options) => {
11
46
  const entryPatterns = localConfig.spec ? [localConfig.spec].flat() : entry;
12
47
  const files = localConfig.file ? [localConfig.file].flat() : [];
13
48
  const require = localConfig.require ? [localConfig.require].flat() : [];
14
49
  const inputs = [];
15
50
  inputs.push(...entryPatterns.map(id => toEntry(id)));
16
- inputs.push(...files.map(id => toDeferResolveEntry(id)));
17
- inputs.push(...require.map(id => toDeferResolve(id)));
51
+ inputs.push(...files.map(id => toDeferResolveEntry(id, { dir: options.cwd })));
52
+ inputs.push(...require.map(id => toDeferResolve(id, { dir: options.cwd })));
53
+ if (isExternalReporter(localConfig.reporter))
54
+ inputs.push(toDeferResolve(localConfig.reporter, { dir: options.cwd }));
18
55
  return inputs;
19
56
  };
20
57
  const args = {
@@ -74,6 +111,8 @@ const args = {
74
111
  }
75
112
  for (const value of [parsed.ignore ?? []].flat())
76
113
  inputs.push(toEntry(`!${String(value)}`));
114
+ if (isExternalReporter(parsed.reporter))
115
+ inputs.push(toDeferResolve(parsed.reporter));
77
116
  return inputs;
78
117
  },
79
118
  };
@@ -1,5 +1,6 @@
1
1
  export interface MochaConfig {
2
2
  file?: string | string[];
3
+ reporter?: string;
3
4
  require?: string | string[];
4
5
  spec?: string | string[];
5
6
  }
@@ -2,7 +2,7 @@ import { compact } from '../../util/array.js';
2
2
  import { isFile, loadJSON } from '../../util/fs.js';
3
3
  import { toConfig, toDeferResolveEntry, toDependency } from '../../util/input.js';
4
4
  import { get } from '../../util/object.js';
5
- import { dirname, join, relative } from '../../util/path.js';
5
+ import { dirname, join, relative, toAbsolute } from '../../util/path.js';
6
6
  import { hasDependency } from '../../util/plugin.js';
7
7
  import { substringBefore } from '../../util/string.js';
8
8
  const title = 'Nx';
@@ -39,12 +39,7 @@ const resolveConfig = async (localConfig, options) => {
39
39
  .filter(executor => executor && !executor.startsWith('.'))
40
40
  .map(executor => executor && substringBefore(executor, ':'));
41
41
  const expand = (value) => value.replaceAll('{projectRoot}', options.configFileDir).replaceAll('{workspaceRoot}', options.rootCwd);
42
- const resolveTargetCwd = (targetCwd) => {
43
- if (!targetCwd)
44
- return options.cwd;
45
- const expanded = expand(targetCwd);
46
- return expanded === targetCwd ? join(options.cwd, targetCwd) : expanded;
47
- };
42
+ const resolveTargetCwd = (targetCwd) => targetCwd ? toAbsolute(expand(targetCwd), options.rootCwd) : options.cwd;
48
43
  const inputs = targets
49
44
  .filter(target => target.executor === 'nx:run-commands' || target.command)
50
45
  .flatMap(target => {
@@ -112,7 +107,7 @@ const resolve = async (options) => {
112
107
  continue;
113
108
  for (const id of [entry.implementation || entry.factory, entry.batchImplementation]) {
114
109
  if (typeof id === 'string' && id.length > 0) {
115
- inputs.push(toDeferResolveEntry(join(dirname(filePath), substringBefore(id, '#'))));
110
+ inputs.push(toDeferResolveEntry(substringBefore(id, '#'), { dir: dirname(filePath) }));
116
111
  }
117
112
  }
118
113
  }
@@ -3,7 +3,7 @@ import { hasDependency } from '../../util/plugin.js';
3
3
  const title = 'nyc';
4
4
  const enablers = ['nyc'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
- const config = ['.nycrc', '.nycrc.{json,yml,yaml}', 'nyc.config.js', 'package.json'];
6
+ const config = ['.nycrc', '.nycrc.{json,yml,yaml}', 'nyc.config.{js,cjs,mjs}', 'package.json'];
7
7
  const resolveConfig = config => {
8
8
  const extend = config?.extends ?? [];
9
9
  const requires = config?.require ?? [];
@@ -3,11 +3,11 @@ import { toC12config } from '../../util/plugin-config.js';
3
3
  const title = 'openapi-ts';
4
4
  const enablers = ['@hey-api/openapi-ts'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
- const config = ['package.json', ...toC12config('openapi-ts')];
6
+ const entry = ['package.json', ...toC12config('openapi-ts')];
7
7
  const plugin = {
8
8
  title,
9
9
  enablers,
10
10
  isEnabled,
11
- config,
11
+ entry,
12
12
  };
13
13
  export default plugin;
@@ -2,7 +2,7 @@ import { hasDependency } from '../../util/plugin.js';
2
2
  const title = 'Oxfmt';
3
3
  const enablers = ['oxfmt'];
4
4
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
- const config = ['.oxfmtrc.json', '.oxfmtrc.jsonc', 'oxfmt.config.{ts,mts}'];
5
+ const entry = ['.oxfmtrc.json', '.oxfmtrc.jsonc', 'oxfmt.config.{ts,mts}'];
6
6
  const args = {
7
7
  config: true,
8
8
  };
@@ -10,7 +10,7 @@ const plugin = {
10
10
  title,
11
11
  enablers,
12
12
  isEnabled,
13
- config,
13
+ entry,
14
14
  args,
15
15
  };
16
16
  export default plugin;
@@ -1,21 +1,21 @@
1
1
  import { arrayify } from '../../util/array.js';
2
2
  import { toDeferResolve, toEntry } from '../../util/input.js';
3
- import { join, relative, toAbsolute } from '../../util/path.js';
3
+ import { join, toAbsolute } from '../../util/path.js';
4
4
  import { hasDependency } from '../../util/plugin.js';
5
5
  const title = 'Playwright';
6
6
  const enablers = ['@playwright/test'];
7
7
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
8
8
  const config = ['playwright.config.{js,cjs,mjs,ts,cts,mts}'];
9
9
  export const entry = ['**/*.@(spec|test).?(c|m)[jt]s?(x)'];
10
- const toEntryPatterns = (testMatch, cwd, configDir, localConfig, rootConfig) => {
10
+ const toEntryPatterns = (testMatch, configDir, localConfig, rootConfig) => {
11
11
  const testDir = localConfig.testDir ?? rootConfig.testDir;
12
- const dir = relative(cwd, testDir ? join(configDir, testDir) : configDir);
12
+ const dir = testDir ? toAbsolute(testDir, configDir) : configDir;
13
13
  const patterns = [testMatch].flat().filter((p) => typeof p === 'string');
14
14
  return patterns.map(pattern => toEntry(join(dir, pattern)));
15
15
  };
16
16
  const builtinReporters = ['dot', 'line', 'list', 'junit', 'html', 'blob', 'json', 'github', 'null'];
17
17
  export const resolveConfig = async (localConfig, options) => {
18
- const { cwd, configFileDir } = options;
18
+ const { configFileDir } = options;
19
19
  const inputs = [];
20
20
  for (const id of arrayify(localConfig.globalSetup))
21
21
  inputs.push(toEntry(toAbsolute(id, configFileDir)));
@@ -30,12 +30,7 @@ export const resolveConfig = async (localConfig, options) => {
30
30
  cwd: dir,
31
31
  manifest: options.getManifest(dir) ?? options.manifest,
32
32
  })) {
33
- const inputDir = input.dir ?? dir;
34
- inputs.push({
35
- ...input,
36
- ...(input.type === 'entry' ? { specifier: toAbsolute(input.specifier, inputDir) } : {}),
37
- dir: inputDir,
38
- });
33
+ inputs.push({ ...input, dir: input.dir ?? dir });
39
34
  }
40
35
  }
41
36
  const projects = localConfig.projects ? [localConfig, ...localConfig.projects] : [localConfig];
@@ -46,7 +41,7 @@ export const resolveConfig = async (localConfig, options) => {
46
41
  return [name];
47
42
  });
48
43
  return projects
49
- .flatMap(config => toEntryPatterns(config.testMatch ?? entry, cwd, configFileDir, config, localConfig))
44
+ .flatMap(config => toEntryPatterns(config.testMatch ?? entry, configFileDir, config, localConfig))
50
45
  .concat(reporters.map(id => toDeferResolve(id)))
51
46
  .concat(inputs);
52
47
  };
@@ -12,10 +12,8 @@ const resolveConfig = config => {
12
12
  if (packageExtensions) {
13
13
  for (const extension of Object.values(packageExtensions)) {
14
14
  if (extension.peerDependencies) {
15
- for (const dep of Object.keys(extension.peerDependencies)) {
16
- const optional = extension.peerDependenciesMeta?.[dep]?.optional === true;
17
- inputs.push(optional ? toDependency(dep, { optional: true }) : toDependency(dep));
18
- }
15
+ for (const dep of Object.keys(extension.peerDependencies))
16
+ inputs.push(toDependency(dep, { optional: true }));
19
17
  }
20
18
  }
21
19
  }
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '../../types/config.ts';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -0,0 +1,16 @@
1
+ import { hasDependency } from '../../util/plugin.js';
2
+ const title = 'PurgeCSS';
3
+ const enablers = ['purgecss', '@fullhuman/postcss-purgecss'];
4
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
+ const entry = ['purgecss.config.js'];
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;
@@ -2,8 +2,7 @@ import { Visitor } from 'oxc-parser';
2
2
  import { findProperty, getFirstPropertyValue, getStringValues } from '../../typescript/ast-helpers.js';
3
3
  import { getStringValue } from '../../typescript/ast-nodes.js';
4
4
  import { getGitRemoteUrls } from '../../util/git.js';
5
- import { isEntry } from '../../util/input.js';
6
- import { join, toAbsolute } from '../../util/path.js';
5
+ import { join } from '../../util/path.js';
7
6
  import { hasDependency } from '../../util/plugin.js';
8
7
  const title = 'Railway';
9
8
  const enablers = ['railway'];
@@ -109,8 +108,6 @@ const resolveFromAST = (program, options) => {
109
108
  ...getCommands(findProperty(findProperty(serviceConfig, 'deploy'), 'preDeployCommand')),
110
109
  ];
111
110
  for (const input of options.getInputsFromScripts(commands, { optionalBinaries: true, cwd, manifest })) {
112
- if (isEntry(input))
113
- input.specifier = toAbsolute(input.specifier, cwd);
114
111
  inputs.push({ ...input, dir: cwd });
115
112
  }
116
113
  },
@@ -1,6 +1,6 @@
1
1
  import { hasDependency } from '../../util/plugin.js';
2
2
  const title = 'Remix';
3
- const enablers = [/^@remix-run\//];
3
+ const enablers = ['@remix-run/dev'];
4
4
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
5
  const entry = ['remix.config.js', 'remix.init/index.js'];
6
6
  const production = [
@@ -2,7 +2,7 @@ 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
4
  import { toAlias, toConfig, toDeferResolve, toDependency, toEntry } from '../../util/input.js';
5
- import { dirname, join, relative, toAbsolute } from '../../util/path.js';
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';
8
8
  const title = 'Rstest';
@@ -25,7 +25,7 @@ const resolveConfig = async (localConfig, options) => {
25
25
  const seen = new Set([configFilePath]);
26
26
  const inputs = [];
27
27
  const addProject = async (project, projectRoot) => {
28
- const toPattern = (pattern) => relative(cwd, toAbsolute(replaceRootDir(pattern, projectRoot), projectRoot));
28
+ const toPattern = (pattern) => toAbsolute(replaceRootDir(pattern, projectRoot), projectRoot);
29
29
  if (!options.config.entry) {
30
30
  const include = [];
31
31
  const exclude = [...(Array.isArray(project.exclude) ? project.exclude : (project.exclude?.patterns ?? []))];
@@ -27,7 +27,7 @@ const handlerToEntry = (handler) => {
27
27
  const file = handler.slice(0, dot);
28
28
  return toProductionEntry(/\.(?:[cm]?[jt]s|[jt]sx)$/.test(file) ? file : `${file}.{js,ts}`);
29
29
  };
30
- const pluginToInput = (plugin, dir) => isInternal(plugin) ? toProductionEntry(join(dir, plugin)) : toDependency(plugin);
30
+ const pluginToInput = (plugin, dir) => isInternal(plugin) ? toProductionEntry(toAbsolute(plugin, dir)) : toDependency(plugin);
31
31
  const getFunctionEntries = async (functions, dir) => {
32
32
  const entries = [];
33
33
  const resolved = await resolveFileVariable(functions, dir);
@@ -1,6 +1,6 @@
1
1
  import MDX from '../../compilers/mdx.js';
2
2
  import { toConfig, toDeferResolve, toDependency, toEntry } from '../../util/input.js';
3
- import { join, relative } from '../../util/path.js';
3
+ import { join, toAbsolute } from '../../util/path.js';
4
4
  import { hasDependency } from '../../util/plugin.js';
5
5
  import { getBabelInputs } from '../vite/helpers.js';
6
6
  const title = 'Storybook';
@@ -14,14 +14,14 @@ const project = ['.{storybook,rnstorybook}/**/*.{js,jsx,ts,tsx,mts}'];
14
14
  const resolveConfig = async (localConfig, options) => {
15
15
  const { cwd, configFileDir } = options;
16
16
  const strs = typeof localConfig?.stories === 'function' ? await localConfig.stories(stories) : localConfig?.stories;
17
- const relativePatterns = strs?.map(pattern => {
17
+ const storyPatterns = strs?.map(pattern => {
18
18
  if (typeof pattern === 'string')
19
- return relative(cwd, join(configFileDir, pattern));
20
- return relative(cwd, join(configFileDir, pattern.directory, pattern.files ?? stories[0]));
19
+ return toAbsolute(pattern, configFileDir);
20
+ return join(toAbsolute(pattern.directory, configFileDir), pattern.files ?? stories[0]);
21
21
  });
22
22
  const patterns = [
23
23
  ...(options.config.entry ?? restEntry),
24
- ...(relativePatterns && relativePatterns.length > 0 ? relativePatterns : stories),
24
+ ...(storyPatterns && storyPatterns.length > 0 ? storyPatterns : stories),
25
25
  ];
26
26
  const addons = localConfig.addons?.map(addon => (typeof addon === 'string' ? addon : addon.name)) ?? [];
27
27
  const builder = localConfig?.core?.builder &&
@@ -5,7 +5,7 @@ import { toAlias, toIgnore, toProductionEntry } 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}',
8
- 'src/hooks.{server,client}.{js,ts}',
8
+ 'src/hooks{,.server,.client}.{js,ts}',
9
9
  'src/params/*.{js,ts}',
10
10
  'src/service-worker.{js,ts}',
11
11
  'src/service-worker/index.{js,ts}',
@@ -3,11 +3,11 @@ import { toCosmiconfig } from '../../util/plugin-config.js';
3
3
  const title = 'Syncpack';
4
4
  const enablers = ['syncpack'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
- const config = ['package.json', ...toCosmiconfig('syncpack')];
6
+ const entry = ['package.json', ...toCosmiconfig('syncpack')];
7
7
  const plugin = {
8
8
  title,
9
9
  enablers,
10
10
  isEnabled,
11
- config,
11
+ entry,
12
12
  };
13
13
  export default plugin;
@@ -14,12 +14,13 @@ const enablers = [
14
14
  ];
15
15
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
16
16
  const config = ['tsr.config.json'];
17
- const production = ['src/routeTree.gen.{ts,js}', 'src/{router,start,client,server}.{js,jsx,ts,tsx}'];
17
+ const routerEntries = ['src/{router,start,client,server}.{js,jsx,ts,tsx}'];
18
+ const production = ['src/routeTree.gen.{ts,js}', ...routerEntries];
18
19
  const resolveConfig = async (localConfig, options) => {
19
20
  const { configFileDir } = options;
20
21
  const generatedRouteTree = localConfig.generatedRouteTree ?? './src/routeTree.gen.ts';
21
22
  const routeTreePath = toAbsolute(generatedRouteTree, configFileDir);
22
- return [toProductionEntry(routeTreePath)];
23
+ return [toProductionEntry(routeTreePath), ...routerEntries.map(id => toProductionEntry(id))];
23
24
  };
24
25
  const plugin = {
25
26
  title,
@@ -1,6 +1,5 @@
1
1
  import { isFile } from '../../util/fs.js';
2
2
  import { toConfig } from '../../util/input.js';
3
- import { join, relative } from '../../util/path.js';
4
3
  const title = 'Taskfile';
5
4
  const enablers = 'This plugin is enabled when a Taskfile is found (Taskfile.yml, taskfile.yml, Taskfile.yaml, taskfile.yaml, etc.).';
6
5
  const isRootOnly = true;
@@ -78,7 +77,7 @@ const extractScriptsFromTask = (task) => {
78
77
  const resolveConfig = async (localConfig, options) => {
79
78
  if (!localConfig || !options.configFilePath)
80
79
  return [];
81
- const { getInputsFromScripts, isProduction, configFileDir } = options;
80
+ const { getInputsFromScripts, isProduction, configFileDir, cwd } = options;
82
81
  const inputs = [];
83
82
  if (localConfig.includes && typeof localConfig.includes === 'object') {
84
83
  for (const includeValue of Object.values(localConfig.includes)) {
@@ -87,10 +86,8 @@ const resolveConfig = async (localConfig, options) => {
87
86
  : includeValue && typeof includeValue === 'object' && 'taskfile' in includeValue
88
87
  ? includeValue.taskfile
89
88
  : undefined;
90
- if (includePath) {
91
- const resolvedPath = join(configFileDir, includePath);
92
- inputs.push(toConfig('taskfile', relative(configFileDir, resolvedPath)));
93
- }
89
+ if (includePath)
90
+ inputs.push(toConfig('taskfile', includePath));
94
91
  }
95
92
  }
96
93
  if (localConfig.tasks && typeof localConfig.tasks === 'object') {
@@ -99,7 +96,7 @@ const resolveConfig = async (localConfig, options) => {
99
96
  for (const input of getInputsFromScripts([script], { optionalBinaries: true })) {
100
97
  if (isProduction)
101
98
  Object.assign(input, { optional: true });
102
- inputs.push({ ...input, dir: configFileDir });
99
+ inputs.push({ ...input, dir: input.type === 'entry' ? cwd : configFileDir });
103
100
  }
104
101
  }
105
102
  }
@@ -1,5 +1,5 @@
1
1
  import { toDependency, toDeferResolveEntry } from '../../util/input.js';
2
- import { isInternal, toAbsolute } from '../../util/path.js';
2
+ import { isInternal } from '../../util/path.js';
3
3
  const RULE_PREFIX = 'textlint-rule-';
4
4
  const PRESET_PREFIX = 'textlint-rule-preset-';
5
5
  const FILTER_RULE_PREFIX = 'textlint-filter-rule-';
@@ -29,7 +29,7 @@ const toPresetDependency = (key, manifest) => {
29
29
  return toPackageDependency(PRESET_PREFIX, name, candidates, manifest);
30
30
  };
31
31
  const toModuleDependency = (prefix, key, manifest) => toPackageDependency(prefix, key, [createFullPackageName(prefix, key), key], manifest);
32
- const toLocalEntry = (key, cwd) => toDeferResolveEntry(toAbsolute(key, cwd));
32
+ const toLocalEntry = (key, cwd) => toDeferResolveEntry(key, { dir: cwd });
33
33
  export const toRuleDependency = (key, manifest, cwd) => {
34
34
  if (isInternal(key))
35
35
  return toLocalEntry(key, cwd);
@@ -26,7 +26,11 @@ export const resolveConfig = (localConfig, options) => {
26
26
  const contentMappers = resolveContentMappers(localConfig);
27
27
  if (!(compilerOptions && localConfig))
28
28
  return compact([...contentMappers, ...extend, ...references]);
29
- const jsx = (compilerOptions?.jsxImportSource ? [compilerOptions.jsxImportSource] : []).map(toProductionDependency);
29
+ const jsx = (compilerOptions?.jsxImportSource ? [compilerOptions.jsxImportSource] : []).map(id => ({
30
+ ...toProductionDependency(id),
31
+ dir: options.cwd,
32
+ alsoReferenceOwner: true,
33
+ }));
30
34
  const types = compilerOptions.types ?? [];
31
35
  const plugins = Array.isArray(compilerOptions?.plugins)
32
36
  ? compilerOptions.plugins.map(plugin => (typeof plugin === 'object' && 'name' in plugin ? plugin.name : ''))
@@ -36,8 +40,8 @@ export const resolveConfig = (localConfig, options) => {
36
40
  ...contentMappers,
37
41
  ...extend,
38
42
  ...references,
39
- ...types.map(id => toDeferResolve(id, { isTypeOnly: true, dir: options.cwd })),
40
- ...[...plugins, ...importHelpers].map(id => toDeferResolve(id)),
43
+ ...types.map(id => toDeferResolve(id, { isTypeOnly: true, dir: options.cwd, alsoReferenceOwner: true })),
44
+ ...[...plugins, ...importHelpers].map(id => toDeferResolve(id, { dir: options.cwd, alsoReferenceOwner: true })),
41
45
  ...jsx,
42
46
  ]);
43
47
  };
@@ -3,11 +3,11 @@ import { toUnconfig } from '../../util/plugin-config.js';
3
3
  const title = 'UnoCSS';
4
4
  const enablers = ['unocss'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
- const config = [...toUnconfig('uno.config'), ...toUnconfig('unocss.config')];
6
+ const entry = [...toUnconfig('uno.config'), ...toUnconfig('unocss.config')];
7
7
  const plugin = {
8
8
  title,
9
9
  enablers,
10
10
  isEnabled,
11
- config,
11
+ entry,
12
12
  };
13
13
  export default plugin;