knip 6.39.0 → 6.41.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 (86) hide show
  1. package/dist/ConfigurationChief.d.ts +24 -0
  2. package/dist/DependencyDeputy.d.ts +1 -0
  3. package/dist/DependencyDeputy.js +28 -2
  4. package/dist/IssueCollector.js +13 -15
  5. package/dist/IssueFixer.js +1 -1
  6. package/dist/WorkspaceWorker.d.ts +3 -4
  7. package/dist/WorkspaceWorker.js +25 -45
  8. package/dist/binaries/bash-parser.js +10 -4
  9. package/dist/binaries/command.d.ts +1 -1
  10. package/dist/binaries/command.js +14 -8
  11. package/dist/compilers/compilers.js +1 -1
  12. package/dist/graph/build.js +33 -17
  13. package/dist/manifest/index.d.ts +1 -0
  14. package/dist/manifest/index.js +5 -0
  15. package/dist/plugins/capacitor/index.js +1 -1
  16. package/dist/plugins/commitlint/index.js +34 -9
  17. package/dist/plugins/eslint/resolveFromAST.d.ts +0 -1
  18. package/dist/plugins/eslint/resolveFromAST.js +1 -1
  19. package/dist/plugins/expo/helpers.js +1 -1
  20. package/dist/plugins/expo/index.js +4 -24
  21. package/dist/plugins/expo-router/index.d.ts +3 -0
  22. package/dist/plugins/expo-router/index.js +32 -0
  23. package/dist/plugins/flue/index.d.ts +3 -0
  24. package/dist/plugins/flue/index.js +42 -0
  25. package/dist/plugins/index.d.ts +4 -0
  26. package/dist/plugins/index.js +8 -0
  27. package/dist/plugins/jasmine/index.d.ts +3 -0
  28. package/dist/plugins/jasmine/index.js +55 -0
  29. package/dist/plugins/jasmine/types.d.ts +7 -0
  30. package/dist/plugins/jasmine/types.js +1 -0
  31. package/dist/plugins/jest/helpers.d.ts +1 -0
  32. package/dist/plugins/jest/helpers.js +2 -0
  33. package/dist/plugins/jest/index.js +20 -11
  34. package/dist/plugins/mise/scripts.js +32 -10
  35. package/dist/plugins/moonrepo/index.js +2 -1
  36. package/dist/plugins/nx/index.js +6 -2
  37. package/dist/plugins/osls/index.d.ts +3 -0
  38. package/dist/plugins/osls/index.js +13 -0
  39. package/dist/plugins/oxlint/index.d.ts +3 -0
  40. package/dist/plugins/oxlint/index.js +4 -31
  41. package/dist/plugins/oxlint/types.d.ts +1 -0
  42. package/dist/plugins/playwright/index.js +17 -0
  43. package/dist/plugins/playwright/types.d.ts +5 -0
  44. package/dist/plugins/postcss/index.js +5 -1
  45. package/dist/plugins/react-native/index.js +1 -1
  46. package/dist/plugins/rsbuild/index.js +58 -6
  47. package/dist/plugins/rsbuild/types.d.ts +24 -1
  48. package/dist/plugins/rspack/index.d.ts +3 -1
  49. package/dist/plugins/rspack/index.js +1 -1
  50. package/dist/plugins/rstest/types.d.ts +1 -5
  51. package/dist/plugins/serverless-framework/index.d.ts +4 -1
  52. package/dist/plugins/serverless-framework/index.js +40 -7
  53. package/dist/plugins/serverless-framework/types.d.ts +4 -2
  54. package/dist/plugins/simple-git-hooks/index.js +1 -1
  55. package/dist/plugins/sveltejs-package/helpers.js +7 -44
  56. package/dist/plugins/vitest/index.js +16 -2
  57. package/dist/plugins/vitest/types.d.ts +2 -0
  58. package/dist/run.js +2 -0
  59. package/dist/schema/configuration.d.ts +60 -0
  60. package/dist/schema/plugins.d.ts +20 -0
  61. package/dist/schema/plugins.js +4 -0
  62. package/dist/types/PluginNames.d.ts +2 -2
  63. package/dist/types/PluginNames.js +4 -0
  64. package/dist/types/workspace.d.ts +1 -0
  65. package/dist/typescript/ast-nodes.js +291 -0
  66. package/dist/typescript/resolve-module-names.js +15 -4
  67. package/dist/typescript/visitors/walk.js +12 -0
  68. package/dist/util/create-options.d.ts +40 -0
  69. package/dist/util/filter-transitive-dependencies.d.ts +2 -0
  70. package/dist/util/filter-transitive-dependencies.js +38 -0
  71. package/dist/util/glob-cache.d.ts +2 -2
  72. package/dist/util/glob-core.js +70 -47
  73. package/dist/util/glob.js +15 -10
  74. package/dist/util/load-tsconfig.d.ts +1 -1
  75. package/dist/util/load-tsconfig.js +21 -11
  76. package/dist/util/module-graph.js +9 -4
  77. package/dist/util/package-json.d.ts +1 -354
  78. package/dist/util/package-json.js +56 -10
  79. package/dist/util/scripts.d.ts +3 -2
  80. package/dist/util/scripts.js +9 -3
  81. package/dist/util/to-source-path.d.ts +1 -1
  82. package/dist/util/to-source-path.js +7 -5
  83. package/dist/version.d.ts +1 -1
  84. package/dist/version.js +1 -1
  85. package/package.json +9 -10
  86. package/schema.json +16 -0
@@ -5,6 +5,7 @@ const getMetaDataFromPackageJson = ({ dir, packageNames }) => {
5
5
  const hostDependencies = new Map();
6
6
  const installedBinaries = new Map();
7
7
  const hasTypesIncluded = new Set();
8
+ const uninstalledDependencies = new Set();
8
9
  const addBinary = (key, value) => {
9
10
  const set = installedBinaries.get(key);
10
11
  if (set)
@@ -35,11 +36,15 @@ const getMetaDataFromPackageJson = ({ dir, packageNames }) => {
35
36
  if (!isDefinitelyTyped(packageName) && (manifest.types || manifest.typings))
36
37
  hasTypesIncluded.add(packageName);
37
38
  }
39
+ else {
40
+ uninstalledDependencies.add(packageName);
41
+ }
38
42
  }
39
43
  return {
40
44
  hostDependencies,
41
45
  installedBinaries,
42
46
  hasTypesIncluded,
47
+ uninstalledDependencies,
43
48
  };
44
49
  };
45
50
  export const getDependencyMetaData = timerify(getMetaDataFromPackageJson);
@@ -4,7 +4,7 @@ import { hasDependency } from '../../util/plugin.js';
4
4
  const title = 'Capacitor';
5
5
  const enablers = [/^@capacitor\//];
6
6
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
- const config = ['capacitor.config.{json,ts}'];
7
+ const config = ['capacitor.config.{json,js,ts}'];
8
8
  const resolveConfig = async (config, { configFileDir }) => {
9
9
  const plugins = config.includePlugins ?? [];
10
10
  const android = isFile(configFileDir, 'android/capacitor.settings.gradle') ? ['@capacitor/android'] : [];
@@ -1,4 +1,5 @@
1
- import { toDependency } from '../../util/input.js';
1
+ import { toConfig, toDependency } from '../../util/input.js';
2
+ import { isInternal } from '../../util/path.js';
2
3
  import { hasDependency } from '../../util/plugin.js';
3
4
  import { toCosmiconfig } from '../../util/plugin-config.js';
4
5
  const title = 'commitlint';
@@ -9,13 +10,35 @@ const config = [
9
10
  'package.yaml',
10
11
  ...toCosmiconfig('commitlint', { additionalExtensions: ['cts', 'mts'] }),
11
12
  ];
12
- const resolveConfig = async (config) => {
13
- const extendsConfigs = config.extends
14
- ? [config.extends]
15
- .flat()
16
- .map(id => (id.startsWith('@') || id.startsWith('commitlint-config-') ? id : `commitlint-config-${id}`))
17
- : [];
18
- const plugins = config.plugins ? [config.plugins].flat().filter(s => typeof s === 'string') : [];
13
+ const toExtendsSpecifier = (id) => {
14
+ if (id.startsWith('@'))
15
+ return id.includes('/') ? id : `${id}/commitlint-config`;
16
+ return id.startsWith('commitlint-config-') ? id : `commitlint-config-${id}`;
17
+ };
18
+ const toPluginSpecifier = (id) => {
19
+ if (!id.startsWith('@'))
20
+ return id.startsWith('commitlint-plugin-') ? id : `commitlint-plugin-${id}`;
21
+ const [scope, name] = id.split('/');
22
+ if (!name)
23
+ return `${scope}/commitlint-plugin`;
24
+ if (name === 'commitlint-plugin' || name.startsWith('commitlint-plugin-'))
25
+ return id;
26
+ return id.replace('/', '/commitlint-plugin-');
27
+ };
28
+ const resolveConfig = async (config, options) => {
29
+ const inputs = [];
30
+ const extendsConfigs = [];
31
+ for (const id of config.extends ? [config.extends].flat() : []) {
32
+ if (isInternal(id))
33
+ inputs.push(toConfig('commitlint', id, { containingFilePath: options.configFilePath }));
34
+ else
35
+ extendsConfigs.push(toExtendsSpecifier(id));
36
+ }
37
+ const plugins = [];
38
+ for (const id of config.plugins ? [config.plugins].flat() : []) {
39
+ if (typeof id === 'string')
40
+ plugins.push(toPluginSpecifier(id));
41
+ }
19
42
  const formatter = config.formatter ? [config.formatter] : [];
20
43
  const parserPreset = await config.parserPreset;
21
44
  const parserPresetPaths = parserPreset
@@ -25,7 +48,9 @@ const resolveConfig = async (config) => {
25
48
  ? [parserPreset.path ?? parserPreset]
26
49
  : []
27
50
  : [];
28
- return [...extendsConfigs, ...plugins, ...formatter, ...parserPresetPaths].map(id => toDependency(id));
51
+ for (const id of [...extendsConfigs, ...plugins, ...formatter, ...parserPresetPaths])
52
+ inputs.push(toDependency(id));
53
+ return inputs;
29
54
  };
30
55
  const plugin = {
31
56
  title,
@@ -1,4 +1,3 @@
1
1
  import type { Program } from 'oxc-parser';
2
2
  import { type Input } from '../../util/input.ts';
3
- export declare const getInputsFromSettingsAST: (program: Program) => Input[];
4
3
  export declare const getInputsFromFlatConfigAST: (program: Program) => Input[];
@@ -4,7 +4,7 @@ import { findProperty, getPropertyKey } from '../../typescript/ast-helpers.js';
4
4
  import { getStringValue } from '../../typescript/ast-nodes.js';
5
5
  import { isInternal } from '../../util/path.js';
6
6
  import { importSettingKinds } from './helpers.js';
7
- export const getInputsFromSettingsAST = (program) => {
7
+ const getInputsFromSettingsAST = (program) => {
8
8
  const inputs = [];
9
9
  const addResolver = (kind, resolver) => {
10
10
  if (!resolver || resolver === 'node' || isInternal(resolver))
@@ -50,7 +50,7 @@ export const getDependencies = async (localConfig, options) => {
50
50
  if (platforms.includes('web')) {
51
51
  inputs.add(toProductionDependency('react-native-web'));
52
52
  inputs.add(toProductionDependency('react-dom'));
53
- if (!isExpoRouter) {
53
+ if (!isExpoRouter && !options.enabledPlugins.includes('expo-router')) {
54
54
  inputs.add(toDependency('@expo/metro-runtime'));
55
55
  }
56
56
  }
@@ -1,37 +1,17 @@
1
- import { toConfig, toIgnore, toProductionEntry } from '../../util/input.js';
2
- import { join } from '../../util/path.js';
1
+ import { toConfig, toIgnore } from '../../util/input.js';
3
2
  import { hasDependency } from '../../util/plugin.js';
4
- import { getConfig, getDependencies } from './helpers.js';
3
+ import { getDependencies } from './helpers.js';
5
4
  const title = 'Expo';
6
5
  const enablers = ['expo'];
7
6
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
8
- const config = ['app.json', 'app.config.{ts,js}'];
9
- const production = ['app/**/*.{js,jsx,ts,tsx}', 'src/app/**/*.{js,jsx,ts,tsx}'];
7
+ const config = ['app.json', 'app.config.{json,ts,js,mts,cts,mjs,cjs}'];
10
8
  const resolve = () => [toConfig('babel', 'babel.config'), toIgnore('babel-preset-expo', 'unresolved')];
11
- const resolveConfig = async (localConfig, options) => {
12
- const { manifest } = options;
13
- const config = getConfig(localConfig, options);
14
- if (manifest.main === 'expo-router/entry') {
15
- let patterns = [...production];
16
- const normalizedPlugins = config.plugins?.map(plugin => (Array.isArray(plugin) ? plugin : [plugin])) ?? [];
17
- const expoRouterPlugin = normalizedPlugins.find(([plugin]) => plugin === 'expo-router');
18
- if (expoRouterPlugin) {
19
- const [, options] = expoRouterPlugin;
20
- if (typeof options?.root === 'string') {
21
- patterns = [join(options.root, '**/*.{js,jsx,ts,tsx}')];
22
- }
23
- }
24
- return patterns.map(entry => toProductionEntry(entry)).concat(await getDependencies(localConfig, options));
25
- }
26
- return production.map(entry => toProductionEntry(entry)).concat(await getDependencies(localConfig, options));
27
- };
28
9
  const plugin = {
29
10
  title,
30
11
  enablers,
31
12
  isEnabled,
32
13
  config,
33
- production,
34
14
  resolve,
35
- resolveConfig,
15
+ resolveConfig: getDependencies,
36
16
  };
37
17
  export default plugin;
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '../../types/config.ts';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -0,0 +1,32 @@
1
+ import { toProductionEntry } from '../../util/input.js';
2
+ import { join } from '../../util/path.js';
3
+ import { hasDependency } from '../../util/plugin.js';
4
+ import expo from '../expo/index.js';
5
+ import { getConfig } from '../expo/helpers.js';
6
+ const title = 'Expo Router';
7
+ const enablers = ['expo-router'];
8
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
9
+ const config = expo.config;
10
+ const production = ['app/**/*.{js,jsx,ts,tsx}', 'src/app/**/*.{js,jsx,ts,tsx}'];
11
+ const resolveConfig = async (localConfig, options) => {
12
+ const config = getConfig(localConfig, options);
13
+ for (const plugin of config.plugins ?? []) {
14
+ if (!Array.isArray(plugin))
15
+ continue;
16
+ const [name, pluginOptions] = plugin;
17
+ const root = pluginOptions?.root;
18
+ if (name === 'expo-router' && typeof root === 'string') {
19
+ return [toProductionEntry(join(root, '**/*.{js,jsx,ts,tsx}'))];
20
+ }
21
+ }
22
+ return production.map(id => toProductionEntry(id));
23
+ };
24
+ const plugin = {
25
+ title,
26
+ enablers,
27
+ isEnabled,
28
+ config,
29
+ production,
30
+ resolveConfig,
31
+ };
32
+ export default plugin;
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '../../types/config.ts';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -0,0 +1,42 @@
1
+ import { collectFirstPropertyValue } from '../../typescript/ast-helpers.js';
2
+ import { isDirectory } from '../../util/fs.js';
3
+ import { toProductionEntry } from '../../util/input.js';
4
+ import { join } from '../../util/path.js';
5
+ import { hasDependency } from '../../util/plugin.js';
6
+ const title = 'Flue';
7
+ const enablers = ['@flue/runtime'];
8
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
9
+ const config = ['flue.config.{ts,mts,mjs,js,cjs,cts}'];
10
+ const extensions = '{ts,mts,js,mjs}';
11
+ const entryNames = ['app', 'db', 'cloudflare'];
12
+ const agentsPattern = `{agent,agents/*,agents/*/agent}.${extensions}`;
13
+ const production = [`{.flue/,src/,}{app,db,cloudflare}.${extensions}`, `{.flue/,src/,}${agentsPattern}`];
14
+ const getSourceRoot = (dir) => {
15
+ for (const name of ['.flue', 'src'])
16
+ if (isDirectory(dir, name))
17
+ return join(dir, name);
18
+ return dir;
19
+ };
20
+ const resolveFromAST = (program, { configFileDir }) => {
21
+ const sourceRoot = getSourceRoot(configFileDir);
22
+ const inputs = [];
23
+ for (const name of entryNames) {
24
+ const filePath = collectFirstPropertyValue(program, name);
25
+ if (filePath)
26
+ inputs.push(toProductionEntry(join(configFileDir, filePath)));
27
+ else
28
+ inputs.push(toProductionEntry(join(sourceRoot, `${name}.${extensions}`)));
29
+ }
30
+ const agents = collectFirstPropertyValue(program, 'agents') ?? agentsPattern;
31
+ inputs.push(toProductionEntry(join(sourceRoot, agents)));
32
+ return inputs;
33
+ };
34
+ const plugin = {
35
+ title,
36
+ enablers,
37
+ isEnabled,
38
+ config,
39
+ production,
40
+ resolveFromAST,
41
+ };
42
+ export default plugin;
@@ -35,6 +35,7 @@ export declare const Plugins: {
35
35
  eve: import("../types/config.ts").Plugin;
36
36
  execa: import("../types/config.ts").Plugin;
37
37
  expo: import("../types/config.ts").Plugin;
38
+ 'expo-router': import("../types/config.ts").Plugin;
38
39
  'expressive-code': {
39
40
  title: string;
40
41
  enablers: string[];
@@ -42,6 +43,7 @@ export declare const Plugins: {
42
43
  config: string[];
43
44
  };
44
45
  fast: import("../types/config.ts").Plugin;
46
+ flue: import("../types/config.ts").Plugin;
45
47
  fumadocs: import("../types/config.ts").Plugin;
46
48
  gatsby: import("../types/config.ts").Plugin;
47
49
  'github-action': import("../types/config.ts").Plugin;
@@ -51,6 +53,7 @@ export declare const Plugins: {
51
53
  hardhat: import("../types/config.ts").Plugin;
52
54
  husky: import("../types/config.ts").Plugin;
53
55
  'i18next-parser': import("../types/config.ts").Plugin;
56
+ jasmine: import("../types/config.ts").Plugin;
54
57
  jest: import("../types/config.ts").Plugin;
55
58
  karma: import("../types/config.ts").Plugin;
56
59
  knex: import("../types/config.ts").Plugin;
@@ -92,6 +95,7 @@ export declare const Plugins: {
92
95
  'openapi-ts': import("../types/config.ts").Plugin;
93
96
  openclaw: import("../types/config.ts").Plugin;
94
97
  orval: import("../types/config.ts").Plugin;
98
+ osls: import("../types/config.ts").Plugin;
95
99
  oxfmt: import("../types/config.ts").Plugin;
96
100
  oxlint: import("../types/config.ts").Plugin;
97
101
  'panda-css': import("../types/config.ts").Plugin;
@@ -34,8 +34,10 @@ import { default as eslint } from './eslint/index.js';
34
34
  import { default as eve } from './eve/index.js';
35
35
  import { default as execa } from './execa/index.js';
36
36
  import { default as expo } from './expo/index.js';
37
+ import { default as expoRouter } from './expo-router/index.js';
37
38
  import { default as expressiveCode } from './expressive-code/index.js';
38
39
  import { default as fast } from './fast/index.js';
40
+ import { default as flue } from './flue/index.js';
39
41
  import { default as fumadocs } from './fumadocs/index.js';
40
42
  import { default as gatsby } from './gatsby/index.js';
41
43
  import { default as githubAction } from './github-action/index.js';
@@ -45,6 +47,7 @@ import { default as graphqlCodegen } from './graphql-codegen/index.js';
45
47
  import { default as hardhat } from './hardhat/index.js';
46
48
  import { default as husky } from './husky/index.js';
47
49
  import { default as i18nextParser } from './i18next-parser/index.js';
50
+ import { default as jasmine } from './jasmine/index.js';
48
51
  import { default as jest } from './jest/index.js';
49
52
  import { default as karma } from './karma/index.js';
50
53
  import { default as knex } from './knex/index.js';
@@ -86,6 +89,7 @@ import { default as oclif } from './oclif/index.js';
86
89
  import { default as openapiTs } from './openapi-ts/index.js';
87
90
  import { default as openclaw } from './openclaw/index.js';
88
91
  import { default as orval } from './orval/index.js';
92
+ import { default as osls } from './osls/index.js';
89
93
  import { default as oxfmt } from './oxfmt/index.js';
90
94
  import { default as oxlint } from './oxlint/index.js';
91
95
  import { default as pandaCss } from './panda-css/index.js';
@@ -223,8 +227,10 @@ export const Plugins = {
223
227
  eve,
224
228
  execa,
225
229
  expo,
230
+ 'expo-router': expoRouter,
226
231
  'expressive-code': expressiveCode,
227
232
  fast,
233
+ flue,
228
234
  fumadocs,
229
235
  gatsby,
230
236
  'github-action': githubAction,
@@ -234,6 +240,7 @@ export const Plugins = {
234
240
  hardhat,
235
241
  husky,
236
242
  'i18next-parser': i18nextParser,
243
+ jasmine,
237
244
  jest,
238
245
  karma,
239
246
  knex,
@@ -275,6 +282,7 @@ export const Plugins = {
275
282
  'openapi-ts': openapiTs,
276
283
  openclaw,
277
284
  orval,
285
+ osls,
278
286
  oxfmt,
279
287
  oxlint,
280
288
  'panda-css': pandaCss,
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '../../types/config.ts';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -0,0 +1,55 @@
1
+ import { toDeferResolve, toEntry } from '../../util/input.js';
2
+ import { isAbsolute, join } from '../../util/path.js';
3
+ import { hasDependency } from '../../util/plugin.js';
4
+ const title = 'Jasmine';
5
+ const enablers = ['jasmine'];
6
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
+ const config = ['spec/support/jasmine.{json,jsonc,js,cjs,mjs}'];
8
+ const defaultSpecFiles = 'spec/**/*[sS]pec.{js,mjs}';
9
+ const entry = [defaultSpecFiles, 'spec/helpers/**/*.{js,mjs}'];
10
+ const toSpecDirPattern = (specDir, pattern) => {
11
+ const isNegated = pattern.startsWith('!');
12
+ const id = isNegated ? pattern.slice(1) : pattern;
13
+ const resolved = isAbsolute(id) ? id : join(specDir, id);
14
+ return isNegated ? `!${resolved}` : resolved;
15
+ };
16
+ const resolveConfig = (localConfig, options) => {
17
+ const specDir = localConfig.spec_dir ?? '';
18
+ const specFiles = localConfig.spec_files?.map(pattern => toSpecDirPattern(specDir, pattern)) ?? [defaultSpecFiles];
19
+ const helpers = localConfig.helpers?.map(pattern => toSpecDirPattern(specDir, pattern)) ?? [];
20
+ const requires = localConfig.requires ?? [];
21
+ const inputs = [];
22
+ for (const id of [...specFiles, ...helpers])
23
+ inputs.push(toEntry(id));
24
+ for (const id of requires)
25
+ inputs.push(toDeferResolve(id, { dir: options.cwd }));
26
+ if (localConfig.loader)
27
+ inputs.push(toDeferResolve(localConfig.loader, { dir: options.cwd }));
28
+ return inputs;
29
+ };
30
+ const commands = new Set(['init', 'examples', 'help', 'version']);
31
+ const args = {
32
+ boolean: ['color', 'fail-fast', 'list-not-applicable', 'no-color'],
33
+ string: ['config', 'reporter', 'require'],
34
+ config: ['config'],
35
+ resolve: ['require', 'reporter'],
36
+ resolveInputs: (parsed) => {
37
+ const inputs = [];
38
+ for (const value of parsed._) {
39
+ if (commands.has(value) || /^\w+=/.test(value))
40
+ continue;
41
+ inputs.push(toEntry(value));
42
+ }
43
+ return inputs;
44
+ },
45
+ };
46
+ const plugin = {
47
+ title,
48
+ enablers,
49
+ isEnabled,
50
+ config,
51
+ entry,
52
+ resolveConfig,
53
+ args,
54
+ };
55
+ export default plugin;
@@ -0,0 +1,7 @@
1
+ export type JasmineConfig = {
2
+ spec_dir?: string;
3
+ spec_files?: string[];
4
+ helpers?: string[];
5
+ requires?: string[];
6
+ loader?: string;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  import type { PluginOptions } from '../../types/config.ts';
2
2
  import type { JestInitialOptions } from './types.ts';
3
3
  export declare const resolveExtensibleConfig: (configFilePath: string) => Promise<any>;
4
+ export declare const resolveWithPrefix: (prefix: string, id: string, rootDir: string) => string;
4
5
  export declare const getReportersDependencies: (config: JestInitialOptions, options: PluginOptions) => string[];
@@ -1,5 +1,6 @@
1
1
  import { dirname, isInternal, join, toAbsolute } from '../../util/path.js';
2
2
  import { load } from '../../util/plugin.js';
3
+ import { _resolveSync } from '../../util/resolve.js';
3
4
  export const resolveExtensibleConfig = async (configFilePath) => {
4
5
  let config = await load(configFilePath);
5
6
  if (config?.preset) {
@@ -12,6 +13,7 @@ export const resolveExtensibleConfig = async (configFilePath) => {
12
13
  }
13
14
  return config;
14
15
  };
16
+ export const resolveWithPrefix = (prefix, id, rootDir) => _resolveSync(prefix + id, rootDir) ? prefix + id : id;
15
17
  const getStringPropOrFallback = (prop, fallback) => {
16
18
  return typeof prop === 'string' ? prop : fallback;
17
19
  };
@@ -1,10 +1,10 @@
1
1
  import { arrayify } from '../../util/array.js';
2
2
  import { _glob, _dirGlob } from '../../util/glob.js';
3
- import { toConfig, toDeferResolve, toEntry } from '../../util/input.js';
3
+ import { toConfig, toDeferResolve, toDependency, toEntry } from '../../util/input.js';
4
4
  import { isInternal, join, normalize, toAbsolute } from '../../util/path.js';
5
5
  import { hasDependency } from '../../util/plugin.js';
6
6
  import { getDependenciesFromConfig } from '../babel/index.js';
7
- import { getReportersDependencies, resolveExtensibleConfig } from './helpers.js';
7
+ import { getReportersDependencies, resolveExtensibleConfig, resolveWithPrefix } from './helpers.js';
8
8
  const title = 'Jest';
9
9
  const enablers = ['jest'];
10
10
  const isEnabled = ({ dependencies, manifest }) => hasDependency(dependencies, enablers) || Boolean(manifest.name?.startsWith('jest-presets'));
@@ -38,16 +38,23 @@ const resolveDependencies = async (config, rootDir, options) => {
38
38
  projects.push(dependency);
39
39
  }
40
40
  }
41
- const runner = config.runner ? [typeof config.runner === 'string' ? config.runner : config.runner[0]] : [];
41
+ const runner = config.runner
42
+ ? [resolveWithPrefix('jest-runner-', typeof config.runner === 'string' ? config.runner : config.runner[0], rootDir)]
43
+ : [];
42
44
  const runtime = config.runtime && config.runtime !== 'jest-circus' ? [config.runtime] : [];
43
- const environments = config.testEnvironment === 'jsdom'
44
- ? ['jest-environment-jsdom']
45
- : config.testEnvironment
46
- ? [config.testEnvironment]
47
- : [];
45
+ const environments = [];
46
+ if (config.testEnvironment === 'node') {
47
+ environments.push(toDependency('jest-environment-node', { optional: true }));
48
+ }
49
+ else if (config.testEnvironment) {
50
+ const environment = config.testEnvironment === 'jsdom'
51
+ ? 'jest-environment-jsdom'
52
+ : resolveWithPrefix('jest-environment-', config.testEnvironment, rootDir);
53
+ environments.push(toDeferResolve(environment));
54
+ }
48
55
  const resolvers = config.resolver ? [config.resolver] : [];
49
56
  const reporters = getReportersDependencies(config, options);
50
- const watchPlugins = config.watchPlugins?.map(watchPlugin => (typeof watchPlugin === 'string' ? watchPlugin : watchPlugin[0])) ?? [];
57
+ const watchPlugins = config.watchPlugins?.map(watchPlugin => resolveWithPrefix('jest-watch-', typeof watchPlugin === 'string' ? watchPlugin : watchPlugin[0], rootDir)) ?? [];
51
58
  const transform = [];
52
59
  for (const transformer of config.transform ? Object.values(config.transform) : []) {
53
60
  if (typeof transformer === 'string') {
@@ -69,7 +76,9 @@ const resolveDependencies = async (config, rootDir, options) => {
69
76
  const testResultsProcessor = config.testResultsProcessor ? [config.testResultsProcessor] : [];
70
77
  const snapshotResolver = config.snapshotResolver ? [config.snapshotResolver] : [];
71
78
  const snapshotSerializers = config.snapshotSerializers ?? [];
72
- const testSequencer = config.testSequencer ? [config.testSequencer] : [];
79
+ const testSequencer = config.testSequencer
80
+ ? [resolveWithPrefix('jest-sequencer-', config.testSequencer, rootDir)]
81
+ : [];
73
82
  const setupFiles = config.setupFiles ?? [];
74
83
  const setupFilesAfterEnv = config.setupFilesAfterEnv ?? [];
75
84
  const globalSetup = config.globalSetup ? [config.globalSetup] : [];
@@ -99,7 +108,7 @@ const resolveConfig = async (localConfig, options) => {
99
108
  const { configFileDir } = options;
100
109
  if (typeof localConfig === 'function')
101
110
  localConfig = await localConfig();
102
- const rootDir = localConfig.rootDir ?? configFileDir;
111
+ const rootDir = toAbsolute(localConfig.rootDir ?? configFileDir, configFileDir);
103
112
  const replaceRootDir = (name) => name.replace(rootDirRe, rootDir);
104
113
  const inputs = await resolveDependencies(localConfig, rootDir, options);
105
114
  const entries = localConfig.testMatch
@@ -41,7 +41,26 @@ export const getInputsFromMiseScript = (script, options, hasLocalBinPath) => {
41
41
  if (!word.parts)
42
42
  return word;
43
43
  const { text, value, hasExpansion } = readParts(word.parts);
44
- return hasExpansion ? { ...word, text, value } : word;
44
+ return hasExpansion ? { type: 'Word', pos: word.pos, end: word.end, text, value } : word;
45
+ };
46
+ const readAssignment = (assignment) => {
47
+ const original = assignment.value;
48
+ const value = original.type === 'Word'
49
+ ? readWord(original)
50
+ : { type: 'ArrayValue', pos: original.pos, end: original.end, elements: original.elements.map(readWord) };
51
+ if (value === original)
52
+ return assignment;
53
+ const text = value.type === 'Word' ? value.text : `(${value.elements.map(word => word.text).join(' ')})`;
54
+ return {
55
+ type: 'Assignment',
56
+ pos: assignment.pos,
57
+ end: assignment.end,
58
+ name: assignment.name,
59
+ index: assignment.index,
60
+ append: assignment.append,
61
+ value,
62
+ text: assignment.text.slice(0, original.pos - assignment.pos) + text,
63
+ };
45
64
  };
46
65
  const readScript = (parsed) => {
47
66
  for (const statement of parsed.commands) {
@@ -52,19 +71,22 @@ export const getInputsFromMiseScript = (script, options, hasLocalBinPath) => {
52
71
  for (const command of walkCommands(statement.command)) {
53
72
  const name = command.name?.value;
54
73
  const word = command.name && readWord(command.name);
55
- const prefix = command.prefix.map(assignment => {
56
- const value = assignment.value && readWord(assignment.value);
57
- return value && value !== assignment.value
58
- ? { ...assignment, value, text: `${assignment.name}=${value.text}` }
59
- : assignment;
60
- });
61
- const words = command.suffix.map(readWord);
74
+ const prefix = command.prefix
75
+ .filter((item) => item.type === 'Assignment')
76
+ .map(readAssignment);
77
+ const words = [];
78
+ for (const arg of command.args) {
79
+ if (arg.type === 'Word')
80
+ words.push(readWord(arg));
81
+ else
82
+ readAssignment(arg);
83
+ }
62
84
  if (!name || !word || definedFunctions.has(name))
63
85
  continue;
64
86
  const binary = extractBinary(name);
65
87
  const isPackageCommand = isPackageManager(binary);
66
88
  const isExplicit = isPackageCommand || name.startsWith('./') || isRelativeNodeModulesBin(name);
67
- const isLocal = hasLocalBinPath && !command.prefix.some(assignment => assignment.name === 'PATH');
89
+ const isLocal = hasLocalBinPath && !prefix.some(assignment => assignment.name === 'PATH');
68
90
  const isWrapperCommand = !isPackageCommand && isWrapper(binary);
69
91
  if (!isExplicit && !isLocal && !isWrapperCommand && binary !== 'node' && binary !== 'find')
70
92
  continue;
@@ -75,7 +97,7 @@ export const getInputsFromMiseScript = (script, options, hasLocalBinPath) => {
75
97
  return [];
76
98
  };
77
99
  const fromArgs = args => fromScript(toScript(args));
78
- commandInputs = getDependenciesFromCommand({ ...command, name: word, prefix, suffix: words }, { ...options, fromArgs });
100
+ commandInputs = getDependenciesFromCommand({ name: word, prefix, args: words }, { ...options, fromArgs });
79
101
  }
80
102
  else {
81
103
  commandInputs = options.getInputsFromScripts([...prefix.map(assignment => assignment.text), word.text, ...words.map(word => word.text)].join(' '), { cwd: options.cwd, manifest: options.manifest });
@@ -1,3 +1,4 @@
1
+ import { relative } from '../../util/path.js';
1
2
  import { hasDependency } from '../../util/plugin.js';
2
3
  import { toShellCommand } from '../../util/scripts.js';
3
4
  const title = 'moonrepo';
@@ -7,7 +8,7 @@ const isRootOnly = true;
7
8
  const config = ['moon.yml', '.moon/tasks.yml', '.moon/tasks/*.yml'];
8
9
  const resolveConfig = async (config, options) => {
9
10
  const tasks = config.tasks ? Object.values(config.tasks) : [];
10
- const expand = (value) => value.replace('$workspaceRoot', options.rootCwd).replace('$projectRoot', options.cwd);
11
+ const expand = (value) => value.replace('$workspaceRoot', relative(options.cwd, options.rootCwd)).replace('$projectRoot', '.');
11
12
  const inputs = tasks
12
13
  .map(task => task.command)
13
14
  .filter(command => command)
@@ -1,6 +1,6 @@
1
1
  import { compact } from '../../util/array.js';
2
2
  import { toConfig, toDependency } from '../../util/input.js';
3
- import { join } from '../../util/path.js';
3
+ import { join, relative } from '../../util/path.js';
4
4
  import { hasDependency } from '../../util/plugin.js';
5
5
  import { substringBefore } from '../../util/string.js';
6
6
  const title = 'Nx';
@@ -53,7 +53,11 @@ const resolveConfig = async (localConfig, options) => {
53
53
  commands = [target.options.command];
54
54
  else if (target.options?.commands)
55
55
  commands = target.options.commands.map(commandConfig => typeof commandConfig === 'string' ? commandConfig : commandConfig.command);
56
- return options.getInputsFromScripts(commands.map(expand), { cwd: resolveTargetCwd(target.options?.cwd) });
56
+ const cwd = resolveTargetCwd(target.options?.cwd);
57
+ const expandRelative = (command) => command
58
+ .replaceAll('{projectRoot}', relative(cwd, options.configFileDir))
59
+ .replaceAll('{workspaceRoot}', relative(cwd, options.rootCwd));
60
+ return options.getInputsFromScripts(commands.map(expandRelative), { cwd });
57
61
  });
58
62
  const configInputs = targets.flatMap(target => {
59
63
  const opts = target.options;
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '../../types/config.ts';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -0,0 +1,13 @@
1
+ import { hasDependency } from '../../util/plugin.js';
2
+ import { config, resolveConfig } from '../serverless-framework/index.js';
3
+ const title = 'osls';
4
+ const enablers = ['osls'];
5
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
+ const plugin = {
7
+ title,
8
+ enablers,
9
+ isEnabled,
10
+ config,
11
+ resolveConfig,
12
+ };
13
+ export default plugin;
@@ -1,3 +1,6 @@
1
1
  import type { Plugin } from '../../types/config.ts';
2
+ import { type Input } from '../../util/input.ts';
3
+ import type { OxlintConfig } from './types.ts';
4
+ export declare const resolveExtendedConfig: (config: OxlintConfig, configFilePath: string) => Input[];
2
5
  declare const plugin: Plugin;
3
6
  export default plugin;