knip 5.47.0 → 5.48.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 (65) hide show
  1. package/dist/ConfigurationChief.d.ts +3 -0
  2. package/dist/ProjectPrincipal.d.ts +2 -2
  3. package/dist/ProjectPrincipal.js +9 -7
  4. package/dist/WorkspaceWorker.d.ts +9 -8
  5. package/dist/WorkspaceWorker.js +100 -72
  6. package/dist/cli.js +2 -2
  7. package/dist/compilers/index.d.ts +31 -0
  8. package/dist/graph/analyze.js +0 -2
  9. package/dist/graph/build.js +7 -8
  10. package/dist/plugins/astro/index.d.ts +1 -0
  11. package/dist/plugins/astro/index.js +3 -1
  12. package/dist/plugins/ava/index.js +1 -1
  13. package/dist/plugins/index.d.ts +27 -2
  14. package/dist/plugins/index.js +6 -0
  15. package/dist/plugins/jest/index.js +3 -1
  16. package/dist/plugins/next/index.d.ts +3 -2
  17. package/dist/plugins/next/index.js +19 -8
  18. package/dist/plugins/next/resolveFromAST.d.ts +2 -0
  19. package/dist/plugins/next/resolveFromAST.js +15 -0
  20. package/dist/plugins/nodemon/index.js +1 -1
  21. package/dist/plugins/nuxt/index.d.ts +1 -1
  22. package/dist/plugins/nuxt/index.js +2 -2
  23. package/dist/plugins/playwright/index.js +1 -3
  24. package/dist/plugins/react-router/index.js +3 -1
  25. package/dist/plugins/sst/index.d.ts +9 -0
  26. package/dist/plugins/sst/index.js +17 -0
  27. package/dist/plugins/sst/resolveFromAST.d.ts +2 -0
  28. package/dist/plugins/sst/resolveFromAST.js +47 -0
  29. package/dist/plugins/starlight/index.d.ts +9 -0
  30. package/dist/plugins/starlight/index.js +18 -0
  31. package/dist/plugins/starlight/resolveFromAST.d.ts +2 -0
  32. package/dist/plugins/starlight/resolveFromAST.js +20 -0
  33. package/dist/plugins/storybook/index.js +4 -1
  34. package/dist/plugins/tanstack-router/index.d.ts +12 -0
  35. package/dist/plugins/tanstack-router/index.js +46 -0
  36. package/dist/plugins/tanstack-router/resolveFromAST.d.ts +2 -0
  37. package/dist/plugins/tanstack-router/resolveFromAST.js +28 -0
  38. package/dist/plugins/tanstack-router/types.d.ts +7 -0
  39. package/dist/plugins/tanstack-router/types.js +1 -0
  40. package/dist/reporters/codeowners.js +8 -6
  41. package/dist/reporters/json.js +3 -3
  42. package/dist/schema/configuration.d.ts +172 -1
  43. package/dist/schema/configuration.js +3 -1
  44. package/dist/schema/plugins.d.ts +69 -0
  45. package/dist/schema/plugins.js +3 -0
  46. package/dist/types/PluginNames.d.ts +2 -2
  47. package/dist/types/PluginNames.js +3 -0
  48. package/dist/types/config.d.ts +8 -0
  49. package/dist/typescript/ast-helpers.d.ts +4 -0
  50. package/dist/typescript/ast-helpers.js +62 -0
  51. package/dist/typescript/create-hosts.d.ts +3 -2
  52. package/dist/typescript/create-hosts.js +1 -3
  53. package/dist/util/Performance.js +7 -7
  54. package/dist/util/codeowners.d.ts +2 -0
  55. package/dist/util/codeowners.js +32 -0
  56. package/dist/util/errors.d.ts +1 -1
  57. package/dist/util/errors.js +2 -2
  58. package/dist/util/math.d.ts +6 -0
  59. package/dist/util/math.js +11 -0
  60. package/dist/util/plugin.d.ts +0 -2
  61. package/dist/util/plugin.js +1 -14
  62. package/dist/version.d.ts +1 -1
  63. package/dist/version.js +1 -1
  64. package/package.json +3 -5
  65. package/schema.json +12 -0
@@ -64,12 +64,15 @@ import { default as semanticRelease } from './semantic-release/index.js';
64
64
  import { default as sentry } from './sentry/index.js';
65
65
  import { default as simpleGitHooks } from './simple-git-hooks/index.js';
66
66
  import { default as sizeLimit } from './size-limit/index.js';
67
+ import { default as sst } from './sst/index.js';
68
+ import { default as starlight } from './starlight/index.js';
67
69
  import { default as storybook } from './storybook/index.js';
68
70
  import { default as stryker } from './stryker/index.js';
69
71
  import { default as stylelint } from './stylelint/index.js';
70
72
  import { default as svelte } from './svelte/index.js';
71
73
  import { default as syncpack } from './syncpack/index.js';
72
74
  import { default as tailwind } from './tailwind/index.js';
75
+ import { default as tanstackRouter } from './tanstack-router/index.js';
73
76
  import { default as travis } from './travis/index.js';
74
77
  import { default as tsNode } from './ts-node/index.js';
75
78
  import { default as tsup } from './tsup/index.js';
@@ -157,12 +160,15 @@ export const Plugins = {
157
160
  sentry,
158
161
  'simple-git-hooks': simpleGitHooks,
159
162
  'size-limit': sizeLimit,
163
+ sst,
164
+ starlight,
160
165
  storybook,
161
166
  stryker,
162
167
  stylelint,
163
168
  svelte,
164
169
  syncpack,
165
170
  tailwind,
171
+ 'tanstack-router': tanstackRouter,
166
172
  travis,
167
173
  'ts-node': tsNode,
168
174
  tsup,
@@ -80,7 +80,9 @@ const resolveEntryPaths = async (localConfig, options) => {
80
80
  localConfig = await localConfig();
81
81
  const rootDir = localConfig.rootDir ?? configFileDir;
82
82
  const replaceRootDir = (name) => name.replace(/<rootDir>/, rootDir);
83
- return (localConfig.testMatch ?? []).map(replaceRootDir).map(toEntry);
83
+ if (localConfig.testMatch)
84
+ return localConfig.testMatch.map(replaceRootDir).map(toEntry);
85
+ return entry.map(id => toEntry(id));
84
86
  };
85
87
  const resolveConfig = async (localConfig, options) => {
86
88
  const { configFileDir } = options;
@@ -1,9 +1,10 @@
1
- import type { IsPluginEnabled } from '../../types/config.js';
1
+ import type { IsPluginEnabled, ResolveFromAST } from '../../types/config.js';
2
2
  declare const _default: {
3
3
  title: string;
4
4
  enablers: string[];
5
5
  isEnabled: IsPluginEnabled;
6
- entry: string[];
6
+ config: string[];
7
7
  production: string[];
8
+ resolveFromAST: ResolveFromAST;
8
9
  };
9
10
  export default _default;
@@ -1,9 +1,12 @@
1
+ import { toProductionEntry } from '../../util/input.js';
1
2
  import { hasDependency } from '../../util/plugin.js';
3
+ import { getPageExtensions } from './resolveFromAST.js';
2
4
  const title = 'Next.js';
3
5
  const enablers = ['next'];
4
6
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
- const entry = ['next.config.{js,ts,cjs,mjs}'];
6
- const productionEntryFilePatternsWithoutSrc = [
7
+ const config = ['next.config.{js,ts,cjs,mjs}'];
8
+ const defaultPageExtensions = ['{js,jsx,ts,tsx}'];
9
+ const productionEntryFilePatterns = [
7
10
  '{instrumentation,middleware}.{js,ts}',
8
11
  'app/global-error.{js,jsx,ts,tsx}',
9
12
  'app/**/{error,layout,loading,not-found,page,template,default}.{js,jsx,ts,tsx}',
@@ -11,16 +14,24 @@ const productionEntryFilePatternsWithoutSrc = [
11
14
  'app/{manifest,sitemap,robots}.{js,ts}',
12
15
  'app/**/{icon,apple-icon}.{js,jsx,ts,tsx}',
13
16
  'app/**/{opengraph,twitter}-image.{js,jsx,ts,tsx}',
14
- 'pages/**/*.{js,jsx,ts,tsx}',
15
- ];
16
- const production = [
17
- ...productionEntryFilePatternsWithoutSrc,
18
- ...productionEntryFilePatternsWithoutSrc.map(pattern => `src/${pattern}`),
19
17
  ];
18
+ const getEntryFilePatterns = (pageExtensions = defaultPageExtensions) => {
19
+ const pages = pageExtensions.map(ext => `pages/**/*.${ext}`);
20
+ const patterns = [...productionEntryFilePatterns, ...pages];
21
+ return [...patterns, ...patterns.map(pattern => `src/${pattern}`)];
22
+ };
23
+ const production = getEntryFilePatterns();
24
+ const resolveFromAST = sourceFile => {
25
+ const pageExtensions = getPageExtensions(sourceFile);
26
+ const extensions = pageExtensions.length > 0 ? pageExtensions : defaultPageExtensions;
27
+ const patterns = getEntryFilePatterns(extensions);
28
+ return patterns.map(id => toProductionEntry(id));
29
+ };
20
30
  export default {
21
31
  title,
22
32
  enablers,
23
33
  isEnabled,
24
- entry,
34
+ config,
25
35
  production,
36
+ resolveFromAST,
26
37
  };
@@ -0,0 +1,2 @@
1
+ import ts from 'typescript';
2
+ export declare const getPageExtensions: (sourceFile: ts.SourceFile) => string[];
@@ -0,0 +1,15 @@
1
+ import ts from 'typescript';
2
+ import { getPropertyValues } from '../../typescript/ast-helpers.js';
3
+ export const getPageExtensions = (sourceFile) => {
4
+ const pageExtensions = new Set();
5
+ function visit(node) {
6
+ if (ts.isObjectLiteralExpression(node)) {
7
+ const values = getPropertyValues(node, 'pageExtensions');
8
+ for (const value of values)
9
+ pageExtensions.add(value);
10
+ }
11
+ ts.forEachChild(node, visit);
12
+ }
13
+ visit(sourceFile);
14
+ return Array.from(pageExtensions);
15
+ };
@@ -1,6 +1,6 @@
1
1
  const title = 'nodemon';
2
2
  const args = {
3
- positional: true,
3
+ positional: false,
4
4
  nodeImportArgs: true,
5
5
  string: ['exec'],
6
6
  fromArgs: ['exec'],
@@ -7,7 +7,7 @@ declare const _default: {
7
7
  title: string;
8
8
  enablers: string[];
9
9
  isEnabled: IsPluginEnabled;
10
- entry: string[];
10
+ config: string[];
11
11
  production: string[];
12
12
  resolveEntryPaths: ResolveEntryPaths<NuxtConfig>;
13
13
  };
@@ -9,7 +9,7 @@ const isEnabled = ({ dependencies }) => {
9
9
  globalThis.defineNuxtConfig = (c) => c;
10
10
  return isEnabled;
11
11
  };
12
- const entry = ['nuxt.config.{js,mjs,ts}'];
12
+ const config = ['nuxt.config.{js,mjs,ts}'];
13
13
  const production = [
14
14
  'app.{vue,jsx,tsx}',
15
15
  'error.{vue,jsx,tsx}',
@@ -43,7 +43,7 @@ export default {
43
43
  title,
44
44
  enablers,
45
45
  isEnabled,
46
- entry,
46
+ config,
47
47
  production,
48
48
  resolveEntryPaths,
49
49
  };
@@ -7,8 +7,6 @@ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
7
  const config = ['playwright.config.{js,ts,mjs}'];
8
8
  export const entry = ['**/*.@(spec|test).?(c|m)[jt]s?(x)'];
9
9
  const toEntryPatterns = (testMatch, cwd, configDir, localConfig, rootConfig) => {
10
- if (!testMatch)
11
- return [];
12
10
  const testDir = localConfig.testDir ?? rootConfig.testDir;
13
11
  const dir = relative(cwd, testDir ? join(configDir, testDir) : configDir);
14
12
  const patterns = [testMatch].flat().filter((p) => typeof p === 'string');
@@ -18,7 +16,7 @@ const builtinReporters = ['dot', 'line', 'list', 'junit', 'html', 'blob', 'json'
18
16
  export const resolveEntryPaths = async (localConfig, options) => {
19
17
  const { cwd, configFileDir } = options;
20
18
  const projects = localConfig.projects ? [localConfig, ...localConfig.projects] : [localConfig];
21
- return projects.flatMap(config => toEntryPatterns(config.testMatch, cwd, configFileDir, config, localConfig));
19
+ return projects.flatMap(config => toEntryPatterns(config.testMatch ?? entry, cwd, configFileDir, config, localConfig));
22
20
  };
23
21
  export const resolveConfig = async (config) => {
24
22
  const reporters = [config.reporter].flat().flatMap(reporter => {
@@ -24,7 +24,9 @@ const resolveEntryPaths = async (localConfig, options) => {
24
24
  const mapRoute = (route) => {
25
25
  return [join(appDir, route.file), ...(route.children ? route.children.flatMap(mapRoute) : [])];
26
26
  };
27
- const routes = routeConfig.flatMap(mapRoute);
27
+ const routes = routeConfig
28
+ .flatMap(mapRoute)
29
+ .map(route => route.replace(/[$^*+?()\[\]]/g, '\\$&'));
28
30
  return [
29
31
  join(appDir, 'routes.{js,ts}'),
30
32
  join(appDir, 'root.{jsx,tsx}'),
@@ -0,0 +1,9 @@
1
+ import type { IsPluginEnabled, ResolveFromAST } from '../../types/config.js';
2
+ declare const _default: {
3
+ title: string;
4
+ enablers: string[];
5
+ isEnabled: IsPluginEnabled;
6
+ config: string[];
7
+ resolveFromAST: ResolveFromAST;
8
+ };
9
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { hasDependency } from '../../util/plugin.js';
2
+ import { getInputsFromHandlers } from './resolveFromAST.js';
3
+ const title = 'SST';
4
+ const enablers = ['sst'];
5
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
+ const config = ['sst.config.ts'];
7
+ const resolveFromAST = (sourceFile, options) => {
8
+ const inputs = getInputsFromHandlers(sourceFile, options);
9
+ return inputs;
10
+ };
11
+ export default {
12
+ title,
13
+ enablers,
14
+ isEnabled,
15
+ config,
16
+ resolveFromAST,
17
+ };
@@ -0,0 +1,2 @@
1
+ import type { ResolveFromAST } from '../../types/config.js';
2
+ export declare const getInputsFromHandlers: ResolveFromAST;
@@ -0,0 +1,47 @@
1
+ import ts from 'typescript';
2
+ import { getImportMap, getPropertyValues } from '../../typescript/ast-helpers.js';
3
+ import { toDeferResolveProductionEntry } from '../../util/input.js';
4
+ export const getInputsFromHandlers = (sourceFile, options) => {
5
+ const { getSourceFile, getReferencedInternalFilePath } = options;
6
+ const entries = new Set();
7
+ const importMap = getImportMap(sourceFile);
8
+ function addHandlerSpecifiers(node) {
9
+ if (ts.isObjectLiteralExpression(node)) {
10
+ const specifiers = getPropertyValues(node, 'handler');
11
+ for (const specifier of specifiers)
12
+ entries.add(specifier.substring(0, specifier.lastIndexOf('.')));
13
+ }
14
+ ts.forEachChild(node, addHandlerSpecifiers);
15
+ }
16
+ function visit(node) {
17
+ if (ts.isCallExpression(node)) {
18
+ if (ts.isPropertyAccessExpression(node.expression)) {
19
+ if (node.expression.name.text === 'stack') {
20
+ const arg = node.arguments[0];
21
+ if (ts.isIdentifier(arg)) {
22
+ const importPath = importMap.get(arg.text);
23
+ if (importPath) {
24
+ const input = toDeferResolveProductionEntry(importPath, { containingFilePath: options.configFilePath });
25
+ const resolvedPath = getReferencedInternalFilePath(input);
26
+ if (resolvedPath) {
27
+ const stackFile = getSourceFile(resolvedPath);
28
+ if (stackFile)
29
+ ts.forEachChild(stackFile, addHandlerSpecifiers);
30
+ }
31
+ }
32
+ }
33
+ }
34
+ if (node.expression.name.text === 'route' && node.arguments.length >= 2) {
35
+ const handlerArg = node.arguments[1];
36
+ if (ts.isStringLiteral(handlerArg)) {
37
+ entries.add(handlerArg.text);
38
+ }
39
+ }
40
+ }
41
+ }
42
+ ts.forEachChild(node, visit);
43
+ }
44
+ ts.forEachChild(sourceFile, addHandlerSpecifiers);
45
+ ts.forEachChild(sourceFile, visit);
46
+ return Array.from(entries).map(specifier => toDeferResolveProductionEntry(specifier, { containingFilePath: options.configFilePath }));
47
+ };
@@ -0,0 +1,9 @@
1
+ import type { IsPluginEnabled, ResolveFromAST } from '../../types/config.js';
2
+ declare const _default: {
3
+ title: string;
4
+ enablers: string[];
5
+ isEnabled: IsPluginEnabled;
6
+ config: string[];
7
+ resolveFromAST: ResolveFromAST;
8
+ };
9
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import { toProductionEntry } from '../../util/input.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
+ import { getComponentPathsFromSourceFile } from './resolveFromAST.js';
4
+ const title = 'Starlight';
5
+ const enablers = ['@astrojs/starlight'];
6
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
+ const config = ['astro.config.{js,cjs,mjs,ts}'];
8
+ const resolveFromAST = (sourceFile) => {
9
+ const componentPaths = getComponentPathsFromSourceFile(sourceFile);
10
+ return Array.from(componentPaths).map(id => toProductionEntry(id));
11
+ };
12
+ export default {
13
+ title,
14
+ enablers,
15
+ isEnabled,
16
+ config,
17
+ resolveFromAST,
18
+ };
@@ -0,0 +1,2 @@
1
+ import ts from 'typescript';
2
+ export declare const getComponentPathsFromSourceFile: (sourceFile: ts.SourceFile) => Set<string>;
@@ -0,0 +1,20 @@
1
+ import ts from 'typescript';
2
+ import { getDefaultImportName, getImportMap, getPropertyValues } from '../../typescript/ast-helpers.js';
3
+ export const getComponentPathsFromSourceFile = (sourceFile) => {
4
+ const componentPaths = new Set();
5
+ const importMap = getImportMap(sourceFile);
6
+ const starlightImportName = getDefaultImportName(importMap, '@astrojs/starlight');
7
+ function visit(node) {
8
+ if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === starlightImportName) {
9
+ const starlightConfig = node.arguments[0];
10
+ if (ts.isObjectLiteralExpression(starlightConfig)) {
11
+ const values = getPropertyValues(starlightConfig, 'components');
12
+ for (const value of values)
13
+ componentPaths.add(value);
14
+ }
15
+ }
16
+ ts.forEachChild(node, visit);
17
+ }
18
+ visit(sourceFile);
19
+ return componentPaths;
20
+ };
@@ -17,7 +17,10 @@ const resolveEntryPaths = async (localConfig, options) => {
17
17
  return relative(cwd, join(configFileDir, pattern));
18
18
  return relative(cwd, join(configFileDir, pattern.directory, pattern.files ?? stories[0]));
19
19
  });
20
- const patterns = [...restEntry, ...(relativePatterns && relativePatterns.length > 0 ? relativePatterns : stories)];
20
+ const patterns = [
21
+ ...(options.config.entry ?? restEntry),
22
+ ...(relativePatterns && relativePatterns.length > 0 ? relativePatterns : stories),
23
+ ];
21
24
  return patterns.map(toEntry);
22
25
  };
23
26
  const resolveConfig = async (localConfig) => {
@@ -0,0 +1,12 @@
1
+ import type { IsPluginEnabled, ResolveEntryPaths, ResolveFromAST } from '../../types/config.js';
2
+ import type { TanstackRouterConfig } from './types.js';
3
+ declare const _default: {
4
+ title: string;
5
+ enablers: string[];
6
+ isEnabled: IsPluginEnabled;
7
+ config: string[];
8
+ production: string[];
9
+ resolveEntryPaths: ResolveEntryPaths<TanstackRouterConfig>;
10
+ resolveFromAST: ResolveFromAST;
11
+ };
12
+ export default _default;
@@ -0,0 +1,46 @@
1
+ import { toEntry } from '../../util/input.js';
2
+ import { extname, join } from '../../util/path.js';
3
+ import { hasDependency } from '../../util/plugin.js';
4
+ import { getCustomConfig } from './resolveFromAST.js';
5
+ const title = 'tanstack-router';
6
+ const enablers = ['@tanstack/react-router', '@tanstack/router-plugin', '@tanstack/router-cli'];
7
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
8
+ const config = [
9
+ 'tsr.config.json',
10
+ 'vite.config.{js,mjs,ts,cjs,mts,cts}',
11
+ 'rs{pack,build}.config.{js,mjs,ts,cjs,mts,cts}',
12
+ 'webpack.config.{js,mjs,ts,cjs,mts,cts}',
13
+ ];
14
+ const production = ['./src/routeTree.gen.ts', './src/routes/**/*.{ts,tsx}', '!src/routes/**/-*/**'];
15
+ const getEntryPatterns = (config) => {
16
+ const dir = config.routesDirectory ?? 'src/routes';
17
+ const entries = [
18
+ toEntry(join(config.generatedRouteTree ?? './src/routeTree.gen.ts')),
19
+ toEntry(join(dir, '**', `${config.routeFilePrefix ?? ''}*`)),
20
+ toEntry(join(`!${dir}`, '**', `${config.routeFileIgnorePrefix ?? '-'}*`)),
21
+ ];
22
+ if (config.routeFileIgnorePattern) {
23
+ entries.push(toEntry(join(`!${dir}`, '**', `*${config.routeFileIgnorePattern}*`)));
24
+ }
25
+ return entries;
26
+ };
27
+ const resolveEntryPaths = (localConfig, options) => {
28
+ if (extname(options.configFileName) !== '.json')
29
+ return [];
30
+ return getEntryPatterns(localConfig);
31
+ };
32
+ const resolveFromAST = (sourceFile, options) => {
33
+ if (extname(options.configFileName) === '.json')
34
+ return [];
35
+ const resolvedConfig = getCustomConfig(sourceFile);
36
+ return getEntryPatterns(resolvedConfig);
37
+ };
38
+ export default {
39
+ title,
40
+ enablers,
41
+ isEnabled,
42
+ config,
43
+ production,
44
+ resolveEntryPaths,
45
+ resolveFromAST,
46
+ };
@@ -0,0 +1,2 @@
1
+ import ts from 'typescript';
2
+ export declare const getCustomConfig: (sourceFile: ts.SourceFile) => Record<string, string>;
@@ -0,0 +1,28 @@
1
+ import ts from 'typescript';
2
+ import { getPropertyValueEntries } from '../../typescript/ast-helpers.js';
3
+ const CONFIG_KEYS = new Set([
4
+ 'routeFilePrefix',
5
+ 'routeFileIgnorePrefix',
6
+ 'routeFileIgnorePattern',
7
+ 'routesDirectory',
8
+ 'generatedRouteTree',
9
+ ]);
10
+ const FUNCTIONS = new Set(['TanStackRouterVite', 'TanStackRouterRspack', 'TanStackRouterWebpack']);
11
+ export const getCustomConfig = (sourceFile) => {
12
+ const config = {};
13
+ function visit(node) {
14
+ if (ts.isCallExpression(node)) {
15
+ const callee = node.expression;
16
+ if (ts.isIdentifier(callee) && FUNCTIONS.has(callee.text)) {
17
+ const firstArg = node.arguments[0];
18
+ if (ts.isObjectLiteralExpression(firstArg)) {
19
+ for (const [key, value] of getPropertyValueEntries(firstArg, CONFIG_KEYS))
20
+ config[key] = value;
21
+ }
22
+ }
23
+ }
24
+ ts.forEachChild(node, visit);
25
+ }
26
+ visit(sourceFile);
27
+ return config;
28
+ };
@@ -0,0 +1,7 @@
1
+ export type TanstackRouterConfig = {
2
+ routeFilePrefix?: string;
3
+ routeFileIgnorePrefix?: string;
4
+ routeFileIgnorePattern?: string;
5
+ routesDirectory?: string;
6
+ generatedRouteTree?: string;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
- import { OwnershipEngine } from '@snyk/github-codeowners/dist/lib/ownership/index.js';
2
1
  import picocolors from 'picocolors';
2
+ import { createOwnershipEngine } from '../util/codeowners.js';
3
3
  import { relative, resolve, toRelative } from '../util/path.js';
4
4
  import { getTitle, logIssueLine, logTitle } from './util.js';
5
5
  const logIssueSet = (issues) => {
@@ -22,13 +22,15 @@ export default ({ report, issues, isShowProgress, options }) => {
22
22
  console.error(error);
23
23
  }
24
24
  const codeownersFilePath = resolve(opts.path ?? '.github/CODEOWNERS');
25
- const codeownersEngine = OwnershipEngine.FromCodeownersFile(codeownersFilePath);
25
+ const findOwners = createOwnershipEngine(codeownersFilePath);
26
26
  const reportMultipleGroups = Object.values(report).filter(Boolean).length > 1;
27
- const [dependenciesOwner = '[no-owner]'] = codeownersEngine.calcFileOwnership('package.json');
28
- const fallbackOwner = dependenciesOwner;
27
+ const [dependenciesOwner = '[no-owner]'] = findOwners('package.json');
29
28
  let totalIssues = 0;
30
- const calcFileOwnership = (filePath) => codeownersEngine.calcFileOwnership(relative(filePath))[0] ?? fallbackOwner;
31
- const addOwner = (issue) => ({ ...issue, owner: calcFileOwnership(issue.filePath) });
29
+ const calcFileOwnership = (filePath) => findOwners(relative(filePath))[0] ?? dependenciesOwner;
30
+ const addOwner = (issue) => ({
31
+ ...issue,
32
+ owner: calcFileOwnership(issue.filePath),
33
+ });
32
34
  for (const [reportType, isReportType] of Object.entries(report)) {
33
35
  if (isReportType) {
34
36
  const title = reportMultipleGroups && getTitle(reportType);
@@ -1,4 +1,4 @@
1
- import { OwnershipEngine } from '@snyk/github-codeowners/dist/lib/ownership/index.js';
1
+ import { createOwnershipEngine } from '../util/codeowners.js';
2
2
  import { isFile } from '../util/fs.js';
3
3
  import { relative, resolve } from '../util/path.js';
4
4
  import { convert } from './util.js';
@@ -12,13 +12,13 @@ export default async ({ report, issues, options }) => {
12
12
  }
13
13
  const json = {};
14
14
  const codeownersFilePath = resolve(opts.codeowners ?? '.github/CODEOWNERS');
15
- const codeownersEngine = isFile(codeownersFilePath) && OwnershipEngine.FromCodeownersFile(codeownersFilePath);
15
+ const findOwners = isFile(codeownersFilePath) && createOwnershipEngine(codeownersFilePath);
16
16
  const flatten = (issues) => Object.values(issues).flatMap(Object.values);
17
17
  const initRow = (filePath) => {
18
18
  const file = relative(filePath);
19
19
  const row = {
20
20
  file,
21
- ...(codeownersEngine && { owners: codeownersEngine.calcFileOwnership(file) }),
21
+ ...(findOwners && { owners: findOwners(file).map(name => ({ name })) }),
22
22
  ...(report.dependencies && { dependencies: [] }),
23
23
  ...(report.devDependencies && { devDependencies: [] }),
24
24
  ...(report.optionalPeerDependencies && { optionalPeerDependencies: [] }),