knip 5.23.1 → 5.23.3

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 (104) hide show
  1. package/dist/ConfigurationChief.d.ts +89 -15
  2. package/dist/ConfigurationValidator.d.ts +2897 -1141
  3. package/dist/DependencyDeputy.d.ts +21 -6
  4. package/dist/IssueCollector.d.ts +4 -4
  5. package/dist/IssueFixer.d.ts +1 -1
  6. package/dist/PrincipalFactory.d.ts +3 -3
  7. package/dist/ProjectPrincipal.d.ts +9 -9
  8. package/dist/WorkspaceWorker.d.ts +14 -9
  9. package/dist/binaries/util.d.ts +5 -5
  10. package/dist/compilers/astro.d.ts +1 -1
  11. package/dist/compilers/compilers.d.ts +2 -2
  12. package/dist/compilers/index.d.ts +695 -83
  13. package/dist/compilers/mdx.d.ts +1 -1
  14. package/dist/constants.d.ts +4 -4
  15. package/dist/index.d.ts +8 -1
  16. package/dist/manifest/helpers.d.ts +1 -1
  17. package/dist/manifest/index.d.ts +4 -6
  18. package/dist/plugins/babel/helpers.d.ts +1 -1
  19. package/dist/plugins/babel/index.d.ts +1 -1
  20. package/dist/plugins/capacitor/index.d.ts +1 -1
  21. package/dist/plugins/commitlint/index.js +2 -7
  22. package/dist/plugins/cypress/index.d.ts +1 -1
  23. package/dist/plugins/eleventy/helpers.d.ts +5 -5
  24. package/dist/plugins/eleventy/index.d.ts +5 -2
  25. package/dist/plugins/graphql-codegen/index.d.ts +1 -1
  26. package/dist/plugins/graphql-codegen/index.js +1 -1
  27. package/dist/plugins/husky/index.d.ts +1 -1
  28. package/dist/plugins/jest/index.d.ts +3 -2
  29. package/dist/plugins/lefthook/index.d.ts +1 -1
  30. package/dist/plugins/lint-staged/index.d.ts +2 -1
  31. package/dist/plugins/lint-staged/index.js +5 -6
  32. package/dist/plugins/linthtml/index.js +2 -9
  33. package/dist/plugins/lockfile-lint/index.js +2 -2
  34. package/dist/plugins/markdownlint/helpers.d.ts +1 -1
  35. package/dist/plugins/netlify/helpers.d.ts +1 -1
  36. package/dist/plugins/netlify/index.d.ts +1 -1
  37. package/dist/plugins/next/index.d.ts +1 -1
  38. package/dist/plugins/npm-package-json-lint/index.js +2 -2
  39. package/dist/plugins/nx/index.d.ts +1 -1
  40. package/dist/plugins/playwright-ct/index.d.ts +1 -1
  41. package/dist/plugins/postcss/index.js +6 -2
  42. package/dist/plugins/prettier/index.js +2 -2
  43. package/dist/plugins/release-it/index.js +1 -1
  44. package/dist/plugins/remix/index.d.ts +1 -1
  45. package/dist/plugins/semantic-release/index.js +2 -2
  46. package/dist/plugins/sentry/index.d.ts +1 -1
  47. package/dist/plugins/simple-git-hooks/index.d.ts +2 -1
  48. package/dist/plugins/size-limit/index.js +5 -2
  49. package/dist/plugins/storybook/index.d.ts +2 -2
  50. package/dist/plugins/stylelint/index.js +2 -2
  51. package/dist/plugins/svelte/index.d.ts +1 -1
  52. package/dist/plugins/syncpack/index.d.ts +1 -0
  53. package/dist/plugins/syncpack/index.js +5 -2
  54. package/dist/plugins/tsup/index.js +1 -1
  55. package/dist/plugins/typedoc/index.js +4 -4
  56. package/dist/plugins/unbuild/index.d.ts +2 -1
  57. package/dist/plugins/unocss/index.js +2 -2
  58. package/dist/plugins/vitest/helpers.d.ts +2 -2
  59. package/dist/plugins/webpack/index.d.ts +4 -1
  60. package/dist/plugins/wireit/index.d.ts +2 -3
  61. package/dist/plugins/xo/index.js +2 -2
  62. package/dist/plugins/yorkie/index.d.ts +2 -1
  63. package/dist/reporters/index.d.ts +1 -1
  64. package/dist/reporters/json.d.ts +1 -1
  65. package/dist/reporters/util.d.ts +1 -1
  66. package/dist/typescript/SourceFileManager.d.ts +5 -5
  67. package/dist/typescript/ast-helpers.d.ts +7 -7
  68. package/dist/typescript/getImportsAndExports.d.ts +11 -10
  69. package/dist/typescript/visitors/dynamic-imports/index.d.ts +1 -1
  70. package/dist/typescript/visitors/exports/exportKeyword.js +1 -1
  71. package/dist/typescript/visitors/exports/index.d.ts +1 -1
  72. package/dist/typescript/visitors/imports/index.d.ts +1 -1
  73. package/dist/typescript/visitors/scripts/index.d.ts +1 -1
  74. package/dist/util/Performance.d.ts +2 -2
  75. package/dist/util/array.d.ts +2 -2
  76. package/dist/util/errors.d.ts +1 -1
  77. package/dist/util/file-entry-cache.d.ts +6 -3
  78. package/dist/util/fs.d.ts +6 -6
  79. package/dist/util/get-included-issue-types.d.ts +2 -1
  80. package/dist/util/get-included-issue-types.js +1 -1
  81. package/dist/util/git.d.ts +1 -1
  82. package/dist/util/glob.d.ts +6 -6
  83. package/dist/util/handle-dependency.d.ts +1 -1
  84. package/dist/util/is-identifier-referenced.d.ts +1 -1
  85. package/dist/util/loader.d.ts +1 -1
  86. package/dist/util/map-workspaces.d.ts +2 -1
  87. package/dist/util/modules.d.ts +7 -7
  88. package/dist/util/package-json.d.ts +6 -2
  89. package/dist/util/path.d.ts +6 -6
  90. package/dist/util/pkgs-graph.d.ts +1 -1
  91. package/dist/util/plugin.d.ts +33 -9
  92. package/dist/util/plugin.js +34 -2
  93. package/dist/util/protocols.d.ts +9 -9
  94. package/dist/util/regex.d.ts +3 -3
  95. package/dist/util/reporter.d.ts +1 -1
  96. package/dist/util/require.d.ts +3 -3
  97. package/dist/util/resolve.d.ts +1 -1
  98. package/dist/util/tag.d.ts +2 -2
  99. package/dist/util/trace.d.ts +2 -2
  100. package/dist/util/tsconfig-loader.d.ts +6 -1
  101. package/dist/util/unwrap-function.d.ts +1 -1
  102. package/dist/version.d.ts +1 -1
  103. package/dist/version.js +1 -1
  104. package/package.json +12 -8
@@ -1,10 +1,11 @@
1
1
  import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
+ import type { LintStagedConfig } from '../lint-staged/types.js';
2
3
  declare const _default: {
3
4
  title: string;
4
5
  enablers: string[];
5
6
  isEnabled: IsPluginEnabled;
6
7
  packageJsonPath: string;
7
8
  config: string[];
8
- resolveConfig: ResolveConfig<any>;
9
+ resolveConfig: ResolveConfig<LintStagedConfig>;
9
10
  };
10
11
  export default _default;
@@ -2,7 +2,7 @@ declare const _default: {
2
2
  symbols: ({ report, issues, tagHints, configurationHints, noConfigHints, isShowProgress }: import("../index.js").ReporterOptions) => void;
3
3
  compact: ({ report, issues, isShowProgress }: import("../index.js").ReporterOptions) => void;
4
4
  codeowners: ({ report, issues, isShowProgress, options }: import("../index.js").ReporterOptions) => void;
5
- json: ({ report, issues, options }: import("../index.js").ReporterOptions) => any;
5
+ json: ({ report, issues, options }: import("../index.js").ReporterOptions) => Promise<void>;
6
6
  markdown: ({ report, issues }: import("../index.js").ReporterOptions) => void;
7
7
  };
8
8
  export default _default;
@@ -1,3 +1,3 @@
1
1
  import type { ReporterOptions } from '../types/issues.js';
2
- declare const _default: ({ report, issues, options }: ReporterOptions) => any;
2
+ declare const _default: ({ report, issues, options }: ReporterOptions) => Promise<void>;
3
3
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import { ISSUE_TYPE_TITLE } from '../constants.js';
2
2
  import type { Issue, IssueSeverity, IssueSymbol } from '../types/issues.js';
3
3
  export declare const identity: (text: string) => string;
4
- export declare const getTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => Record<keyof import("../types/issues.js").Issues, string>;
4
+ export declare const getTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => string;
5
5
  export declare const logTitle: (title: string, count: number) => void;
6
6
  type LogIssueLine = {
7
7
  owner?: string;
@@ -6,14 +6,14 @@ interface SourceFileManagerOptions {
6
6
  }
7
7
  export declare class SourceFileManager {
8
8
  isSkipLibs: boolean;
9
- sourceFileCache: any;
10
- snapshotCache: any;
9
+ sourceFileCache: Map<string, ts.SourceFile | undefined>;
10
+ snapshotCache: Map<string, ts.IScriptSnapshot | undefined>;
11
11
  syncCompilers: SyncCompilers;
12
12
  asyncCompilers: AsyncCompilers;
13
13
  constructor({ compilers, isSkipLibs }: SourceFileManagerOptions);
14
14
  createSourceFile(filePath: string, contents: string): ts.SourceFile;
15
- getSourceFile(filePath: string): any;
16
- getSnapshot(filePath: string): any;
17
- compileAndAddSourceFile(filePath: string): any;
15
+ getSourceFile(filePath: string): ts.SourceFile | undefined;
16
+ getSnapshot(filePath: string): ts.IScriptSnapshot | undefined;
17
+ compileAndAddSourceFile(filePath: string): Promise<void>;
18
18
  }
19
19
  export {};
@@ -6,11 +6,11 @@ export declare function isAccessExpression(node: ts.Node): node is ts.AccessExpr
6
6
  export declare function isImportCall(node: ts.Node): node is ts.ImportCall;
7
7
  export declare function isRequireCall(callExpression: ts.Node): callExpression is ts.CallExpression;
8
8
  export declare function isPropertyAccessCall(node: ts.Node, identifier: string): node is ts.CallExpression;
9
- export declare function stripQuotes(name: string): any;
9
+ export declare function stripQuotes(name: string): string;
10
10
  export declare function findAncestor<T>(node: ts.Node | undefined, callback: (element: ts.Node) => boolean | 'STOP'): T | undefined;
11
11
  export declare function findDescendants<T>(node: ts.Node | undefined, callback: (element: ts.Node) => boolean | 'STOP'): T[];
12
12
  export declare const isDeclarationFileExtension: (extension: string) => extension is ".d.ts" | ".d.mts" | ".d.cts";
13
- export declare const getJSDocTags: (node: ts.Node) => any;
13
+ export declare const getJSDocTags: (node: ts.Node) => Set<string>;
14
14
  export declare const getLineAndCharacterOfPosition: (node: ts.Node, pos: number) => {
15
15
  line: number;
16
16
  col: number;
@@ -18,11 +18,11 @@ export declare const getLineAndCharacterOfPosition: (node: ts.Node, pos: number)
18
18
  };
19
19
  export declare const getAccessMembers: (typeChecker: ts.TypeChecker, node: ts.Identifier) => string[];
20
20
  export declare const isDestructuring: (node: ts.Node) => boolean;
21
- export declare const getDestructuredIds: (name: ts.ObjectBindingPattern) => any;
22
- export declare const isConsiderReferencedNS: (node: ts.Identifier) => any;
21
+ export declare const getDestructuredIds: (name: ts.ObjectBindingPattern) => string[];
22
+ export declare const isConsiderReferencedNS: (node: ts.Identifier) => boolean;
23
23
  export declare const isTopLevel: (node: ts.Node) => boolean;
24
24
  export declare const getTypeName: (node: ts.Identifier) => ts.QualifiedName | undefined;
25
25
  export declare const isImportSpecifier: (node: ts.Node) => boolean;
26
- export declare const isReferencedInExportedType: (node: ts.Node) => any;
27
- export declare const getExportKeywordNode: (node: ts.Node) => any;
28
- export declare const getDefaultKeywordNode: (node: ts.Node) => any;
26
+ export declare const isReferencedInExportedType: (node: ts.Node) => boolean;
27
+ export declare const getExportKeywordNode: (node: ts.Node) => ts.ExportKeyword | undefined;
28
+ export declare const getDefaultKeywordNode: (node: ts.Node) => ts.DefaultKeyword | undefined;
@@ -1,6 +1,7 @@
1
1
  import ts from 'typescript';
2
2
  import type { Tags } from '../types/cli.js';
3
- import type { Export } from '../types/dependency-graph.js';
3
+ import type { ExportMap, ImportMap, UnresolvedImport } from '../types/dependency-graph.js';
4
+ import type { IssueSymbol } from '../types/issues.js';
4
5
  import type { BoundSourceFile } from './SourceFile.js';
5
6
  export type GetImportsAndExportsOptions = {
6
7
  skipTypeOnly: boolean;
@@ -13,16 +14,16 @@ export type GetImportsAndExportsOptions = {
13
14
  };
14
15
  export declare const _getImportsAndExports: (sourceFile: BoundSourceFile, resolveModule: (specifier: string) => ts.ResolvedModuleFull | undefined, typeChecker: ts.TypeChecker, options: GetImportsAndExportsOptions) => {
15
16
  imports: {
16
- internal: Map<string, import("../types/dependency-graph.js").ImportDetails>;
17
- external: any;
18
- resolved: any;
19
- specifiers: any;
20
- unresolved: any;
17
+ internal: ImportMap;
18
+ external: Set<string>;
19
+ resolved: Set<string>;
20
+ specifiers: Set<[string, string]>;
21
+ unresolved: Set<UnresolvedImport>;
21
22
  };
22
23
  exports: {
23
- exported: Map<string, Export>;
24
- duplicate: any[];
24
+ exported: ExportMap;
25
+ duplicate: IssueSymbol[][];
25
26
  };
26
- scripts: any;
27
- traceRefs: any;
27
+ scripts: Set<string>;
28
+ traceRefs: Set<string>;
28
29
  };
@@ -1,3 +1,3 @@
1
1
  import type ts from 'typescript';
2
- declare const _default: (sourceFile: ts.SourceFile) => any;
2
+ declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[])[];
3
3
  export default _default;
@@ -79,7 +79,7 @@ export default visit(() => true, (node, { isFixExports, isFixTypes, isReportClas
79
79
  return { node, identifier, type: SymbolType.TYPE, pos, fix };
80
80
  }
81
81
  if (ts.isInterfaceDeclaration(node)) {
82
- const identifier = node.name.getText();
82
+ const identifier = defaultKeyword ? 'default' : node.name.getText();
83
83
  const pos = node.name.getStart();
84
84
  const fix = getTypeFix(exportKeyword);
85
85
  return { node, identifier, type: SymbolType.INTERFACE, pos, fix };
@@ -1,3 +1,3 @@
1
1
  import type ts from 'typescript';
2
- declare const _default: (sourceFile: ts.SourceFile) => any;
2
+ declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[])[];
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
1
  import type ts from 'typescript';
2
- declare const _default: (sourceFile: ts.SourceFile) => any;
2
+ declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[])[];
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
1
  import type ts from 'typescript';
2
- declare const _default: (sourceFile: ts.SourceFile) => any;
2
+ declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../getImportsAndExports.js").GetImportsAndExportsOptions) => undefined | string | string[])[];
3
3
  export default _default;
@@ -15,11 +15,11 @@ declare class Performance {
15
15
  private clearMark;
16
16
  private flush;
17
17
  private getEntriesByName;
18
- getTable(): any;
18
+ getTable(): string;
19
19
  getCurrentDurationInMs(startTime?: number): number;
20
20
  getMemHeapUsage(): number;
21
21
  getCurrentMemUsageInMb(): number;
22
- finalize(): any;
22
+ finalize(): Promise<void>;
23
23
  reset(): void;
24
24
  }
25
25
  export declare const perfObserver: Performance;
@@ -1,5 +1,5 @@
1
1
  type Collection<T> = Array<T> | Set<T>;
2
- export declare const compact: <T>(collection: Collection<T | undefined>) => any;
3
- export declare const arrayify: (value?: string[] | string) => string | string[] | undefined;
2
+ export declare const compact: <T>(collection: Collection<T | undefined>) => T[];
3
+ export declare const arrayify: (value?: string[] | string) => string[];
4
4
  export declare const partition: <T>(collection: T[], predicate: (item: T) => unknown) => [T[], T[]];
5
5
  export {};
@@ -9,5 +9,5 @@ export declare class LoaderError extends Error {
9
9
  export declare const isKnownError: (error: Error) => error is ConfigurationError | LoaderError | ZodError<any>;
10
10
  export declare const hasCause: (error: Error) => error is ErrorWithCause;
11
11
  export declare const isConfigurationError: (error: Error) => error is ConfigurationError;
12
- export declare const getKnownError: (error: Error) => any;
12
+ export declare const getKnownError: (error: Error) => Error;
13
13
  export {};
@@ -13,14 +13,17 @@ export type FileDescriptor<T> = {
13
13
  };
14
14
  export declare class FileEntryCache<T> {
15
15
  filePath: string;
16
- cache: any;
17
- normalizedEntries: any;
16
+ cache: Map<string, MetaData<T>>;
17
+ normalizedEntries: Map<string, FileDescriptor<T>>;
18
18
  constructor(cacheId: string, _path: string);
19
19
  removeNotFoundFiles(): void;
20
20
  getFileDescriptor(filePath: string): FileDescriptor<T>;
21
21
  _getFileDescriptorUsingMtimeAndSize(filePath: string, fstat: fs.Stats): FileDescriptor<T>;
22
22
  removeEntry(entryName: string): void;
23
- _getMetaForFileUsingMtimeAndSize(cacheEntry: FileDescriptor<T>): any;
23
+ _getMetaForFileUsingMtimeAndSize(cacheEntry: FileDescriptor<T>): {
24
+ size: number;
25
+ mtime: number;
26
+ };
24
27
  reconcile(): void;
25
28
  }
26
29
  export {};
package/dist/util/fs.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export declare const isDirectory: (filePath: string) => boolean;
2
2
  export declare const isFile: (filePath: string) => boolean;
3
3
  export declare const findFile: (workingDir: string, fileName: string) => string | undefined;
4
- export declare const loadFile: (filePath: string) => unknown;
5
- export declare const loadJSON: (filePath: string) => unknown;
6
- export declare const loadYAML: (filePath: string) => unknown;
7
- export declare const loadTOML: (filePath: string) => unknown;
8
- export declare const parseJSON: (filePath: string, contents: string) => unknown;
4
+ export declare const loadFile: (filePath: string) => Promise<string>;
5
+ export declare const loadJSON: (filePath: string) => Promise<any>;
6
+ export declare const loadYAML: (filePath: string) => Promise<unknown>;
7
+ export declare const loadTOML: (filePath: string) => Promise<Record<string, import("smol-toml").TomlPrimitive>>;
8
+ export declare const parseJSON: (filePath: string, contents: string) => Promise<any>;
9
9
  export declare const parseYAML: (contents: string) => unknown;
10
10
  export declare function isTypeModule(path: string): boolean;
11
- export declare const _loadJSON: (filePath: string) => unknown;
11
+ export declare const _loadJSON: (filePath: string) => Promise<any>;
@@ -1,3 +1,4 @@
1
+ import type { Report } from '../types/issues.js';
1
2
  type CLIArguments = {
2
3
  include: string[];
3
4
  exclude: string[];
@@ -13,5 +14,5 @@ type Options = {
13
14
  exports?: boolean;
14
15
  };
15
16
  export declare const defaultExcludedIssueTypes: string[];
16
- export declare const getIncludedIssueTypes: (cliArgs: CLIArguments, { include, exclude, isProduction }?: Options) => any;
17
+ export declare const getIncludedIssueTypes: (cliArgs: CLIArguments, { include, exclude, isProduction }?: Options) => Report;
17
18
  export {};
@@ -16,7 +16,7 @@ export const getIncludedIssueTypes = (cliArgs, { include = [], exclude = [], isP
16
16
  incl = [...incl, 'dependencies', 'optionalPeerDependencies', 'unlisted', 'binaries', 'unresolved'];
17
17
  }
18
18
  if (cliArgs.exports) {
19
- incl = [...incl, 'exports', 'nsExports', 'classMembers', 'types', 'nsTypes', 'enumMembers', 'duplicates'];
19
+ incl = [...incl, 'exports', 'types', 'enumMembers', 'duplicates'];
20
20
  }
21
21
  if (cliArgs.files) {
22
22
  incl = [...incl, 'files'];
@@ -1 +1 @@
1
- export declare const getGitHookPaths: (defaultPath?: string, followGitConfig?: boolean) => any;
1
+ export declare const getGitHookPaths: (defaultPath?: string, followGitConfig?: boolean) => string[];
@@ -1,6 +1,6 @@
1
1
  export declare const prependDirToPattern: (workingDir: string, pattern: string) => string;
2
- export declare const negate: (pattern: string) => any;
3
- export declare const hasProductionSuffix: (pattern: string) => any;
2
+ export declare const negate: (pattern: string) => string;
3
+ export declare const hasProductionSuffix: (pattern: string) => boolean;
4
4
  export declare const hasNoProductionSuffix: (pattern: string) => boolean;
5
5
  interface BaseGlobOptions {
6
6
  cwd: string;
@@ -10,8 +10,8 @@ interface BaseGlobOptions {
10
10
  interface GlobOptions extends BaseGlobOptions {
11
11
  workingDir?: string;
12
12
  }
13
- export declare const _glob: ({ cwd, workingDir, patterns, gitignore }: GlobOptions) => unknown;
14
- export declare const _pureGlob: ({ cwd, patterns, gitignore }: BaseGlobOptions) => unknown;
15
- export declare const _firstGlob: ({ cwd, patterns }: BaseGlobOptions) => unknown;
16
- export declare const _dirGlob: ({ cwd, patterns, gitignore }: BaseGlobOptions) => unknown;
13
+ export declare const _glob: ({ cwd, workingDir, patterns, gitignore }: GlobOptions) => Promise<string[]>;
14
+ export declare const _pureGlob: ({ cwd, patterns, gitignore }: BaseGlobOptions) => Promise<string[]>;
15
+ export declare const _firstGlob: ({ cwd, patterns }: BaseGlobOptions) => Promise<string | Buffer | undefined>;
16
+ export declare const _dirGlob: ({ cwd, patterns, gitignore }: BaseGlobOptions) => Promise<string[]>;
17
17
  export {};
@@ -1,4 +1,4 @@
1
1
  import type { ConfigurationChief, Workspace } from '../ConfigurationChief.js';
2
2
  import type { DependencyDeputy } from '../DependencyDeputy.js';
3
3
  import type { IssueCollector } from '../IssueCollector.js';
4
- export declare const getHandler: (collector: IssueCollector, deputy: DependencyDeputy, chief: ConfigurationChief) => (specifier: string, containingFilePath: string, workspace: Workspace) => any;
4
+ export declare const getHandler: (collector: IssueCollector, deputy: DependencyDeputy, chief: ConfigurationChief) => (specifier: string, containingFilePath: string, workspace: Workspace) => string | undefined;
@@ -5,5 +5,5 @@ type Result = {
5
5
  reExportingEntryFile: undefined | string;
6
6
  traceNode: TraceNode;
7
7
  };
8
- export declare const getIsIdentifierReferencedHandler: (graph: DependencyGraph, entryPaths: Set<string>) => (filePath: string, id: string, isIncludeEntryExports?: boolean, traceNode?: TraceNode, seen?: any) => Result;
8
+ export declare const getIsIdentifierReferencedHandler: (graph: DependencyGraph, entryPaths: Set<string>) => (filePath: string, id: string, isIncludeEntryExports?: boolean, traceNode?: TraceNode, seen?: Set<string>) => Result;
9
9
  export {};
@@ -1 +1 @@
1
- export declare const _load: (filePath: string) => unknown;
1
+ export declare const _load: (filePath: string) => Promise<any>;
@@ -1 +1,2 @@
1
- export default function mapWorkspaces(cwd: string, workspaces: string[]): unknown;
1
+ import type { Package } from '../ConfigurationChief.js';
2
+ export default function mapWorkspaces(cwd: string, workspaces: string[]): Promise<Map<string, Package>[]>;
@@ -1,9 +1,9 @@
1
1
  import type { PackageJson } from '../types/package-json.js';
2
- export declare const getPackageNameFromModuleSpecifier: (moduleSpecifier: string) => any;
3
- export declare const getPackageNameFromFilePath: (value: string) => any;
4
- export declare const normalizeSpecifierFromFilePath: (value: string) => any;
5
- export declare const isStartsLikePackageName: (specifier: string) => any;
6
- export declare const isDefinitelyTyped: (packageName: string) => any;
2
+ export declare const getPackageNameFromModuleSpecifier: (moduleSpecifier: string) => string | undefined;
3
+ export declare const getPackageNameFromFilePath: (value: string) => string;
4
+ export declare const normalizeSpecifierFromFilePath: (value: string) => string;
5
+ export declare const isStartsLikePackageName: (specifier: string) => boolean;
6
+ export declare const isDefinitelyTyped: (packageName: string) => boolean;
7
7
  export declare const getDefinitelyTypedFor: (packageName: string) => string;
8
8
  export declare const getPackageFromDefinitelyTyped: (typedDependency: string) => string;
9
9
  export declare const getEntryPathFromManifest: (manifest: PackageJson, sharedGlobOptions: {
@@ -11,5 +11,5 @@ export declare const getEntryPathFromManifest: (manifest: PackageJson, sharedGlo
11
11
  workingDir: string;
12
12
  gitignore: boolean;
13
13
  ignore: string[];
14
- }) => unknown;
15
- export declare const sanitizeSpecifier: (specifier: string) => any;
14
+ }) => Promise<string[]>;
15
+ export declare const sanitizeSpecifier: (specifier: string) => string;
@@ -1,6 +1,10 @@
1
1
  import type { PackageJson } from '../types/package-json.js';
2
+ declare const INDENT: unique symbol;
3
+ declare const NEWLINE: unique symbol;
2
4
  interface ExtendedPackageJson extends PackageJson {
5
+ [INDENT]?: string;
6
+ [NEWLINE]?: string;
3
7
  }
4
- export declare const load: (filePath: string) => unknown;
5
- export declare const save: (filePath: string, content: ExtendedPackageJson) => any;
8
+ export declare const load: (filePath: string) => Promise<ExtendedPackageJson>;
9
+ export declare const save: (filePath: string, content: ExtendedPackageJson) => Promise<void>;
6
10
  export {};
@@ -3,11 +3,11 @@ export declare const dirname: (path: string) => string;
3
3
  export declare const extname: (path: string) => string;
4
4
  export declare const basename: (path: string, suffix?: string) => string;
5
5
  export declare const join: (...paths: string[]) => string;
6
- export declare const toPosix: (value: string) => any;
7
- export declare const cwd: any;
6
+ export declare const toPosix: (value: string) => string;
7
+ export declare const cwd: string;
8
8
  export declare const resolve: (...paths: string[]) => string;
9
- export declare const relative: (from: string, to?: string) => any;
10
- export declare const isInNodeModules: (filePath: string) => any;
9
+ export declare const relative: (from: string, to?: string) => string;
10
+ export declare const isInNodeModules: (filePath: string) => boolean;
11
11
  export declare const toAbsolute: (id: string, base?: string) => string;
12
- export declare const toRelative: (id: string) => any;
13
- export declare const isInternal: (id: string) => any;
12
+ export declare const toRelative: (id: string) => string;
13
+ export declare const isInternal: (id: string) => boolean;
@@ -4,5 +4,5 @@ interface Package {
4
4
  dir: string;
5
5
  }
6
6
  export type Graph = Record<string, Set<string>>;
7
- export declare function createPkgGraph(cwd: string, wsNames: string[], wsPkgNames: Set<string>, byPkgName: Map<string, Package>, byName: Map<string, Package>): Record<string, Set<string>>;
7
+ export declare function createPkgGraph(cwd: string, wsNames: string[], wsPkgNames: Set<string>, byPkgName: Map<string, Package>, byName: Map<string, Package>): Graph;
8
8
  export {};
@@ -1,15 +1,39 @@
1
- export { _load as load } from './loader.js';
1
+ export { _getDependenciesFromScripts as getDependenciesFromScripts } from '../binaries/index.js';
2
2
  export { _loadJSON as loadJSON } from './fs.js';
3
+ export { _load as load } from './loader.js';
3
4
  export { _tryResolve as tryResolve } from './require.js';
4
- export { _getDependenciesFromScripts as getDependenciesFromScripts } from '../binaries/index.js';
5
5
  import type { RawPluginConfiguration } from '../types/config.js';
6
6
  import type { Plugin, PluginOptions } from '../types/plugins.js';
7
- export declare const toCamelCase: (name: string) => any;
8
- export declare const hasDependency: (dependencies: Set<string>, values: (string | RegExp)[]) => any;
7
+ export declare const toCamelCase: (name: string) => string;
8
+ export declare const hasDependency: (dependencies: Set<string>, values: (string | RegExp)[]) => boolean;
9
9
  export declare const normalizePluginConfig: (pluginConfig: RawPluginConfiguration) => boolean | {
10
- config: string | string[] | null | undefined;
11
- entry: string | string[] | null | undefined;
12
- project: string | string[] | null | undefined;
10
+ config: string[] | null;
11
+ entry: string[] | null;
12
+ project: string[] | null;
13
13
  };
14
- export declare const loadConfigForPlugin: (configFilePath: string, plugin: Plugin, options: PluginOptions, pluginName: string) => unknown;
15
- export declare const getFinalEntryPaths: (plugin: Plugin, options: PluginOptions, configEntryPaths: string[]) => any;
14
+ export declare const loadConfigForPlugin: (configFilePath: string, plugin: Plugin, options: PluginOptions, pluginName: string) => Promise<any>;
15
+ export declare const getFinalEntryPaths: (plugin: Plugin, options: PluginOptions, configEntryPaths: string[]) => string[];
16
+ export declare const toCosmiconfig: (moduleName: string, options?: {
17
+ rcPrefix?: string;
18
+ rcSuffix?: string;
19
+ configDir?: boolean;
20
+ configFiles?: boolean;
21
+ configFilesAllExtensions?: boolean;
22
+ additionalExtensions?: string[];
23
+ }) => string[];
24
+ export declare const toLilconfig: (moduleName: string, options?: {
25
+ rcPrefix?: string;
26
+ rcSuffix?: string;
27
+ configDir?: boolean;
28
+ configFiles?: boolean;
29
+ configFilesAllExtensions?: boolean;
30
+ additionalExtensions?: string[];
31
+ }) => string[];
32
+ export declare const toUnconfig: (moduleName: string, options?: {
33
+ rcPrefix?: string;
34
+ rcSuffix?: string;
35
+ configDir?: boolean;
36
+ configFiles?: boolean;
37
+ configFilesAllExtensions?: boolean;
38
+ additionalExtensions?: string[];
39
+ }) => string[];
@@ -1,7 +1,7 @@
1
- export { _load as load } from './loader.js';
1
+ export { _getDependenciesFromScripts as getDependenciesFromScripts } from '../binaries/index.js';
2
2
  export { _loadJSON as loadJSON } from './fs.js';
3
+ export { _load as load } from './loader.js';
3
4
  export { _tryResolve as tryResolve } from './require.js';
4
- export { _getDependenciesFromScripts as getDependenciesFromScripts } from '../binaries/index.js';
5
5
  import { arrayify } from './array.js';
6
6
  import { _load as load } from './loader.js';
7
7
  import { get } from './object.js';
@@ -61,3 +61,35 @@ export const getFinalEntryPaths = (plugin, options, configEntryPaths) => {
61
61
  ? configEntryPaths
62
62
  : [...(plugin.entry ?? []).map(toEntryPattern), ...(plugin.production ?? []).map(toProductionEntryPattern)];
63
63
  };
64
+ const toConfigMap = (defaultExtensions, builderConfig) => (moduleName, options) => {
65
+ const config = {
66
+ rcPrefix: '.',
67
+ rcSuffix: 'rc',
68
+ configDir: true,
69
+ configFiles: true,
70
+ configFilesAllExtensions: false,
71
+ additionalExtensions: [],
72
+ ...builderConfig,
73
+ ...options,
74
+ };
75
+ const { rcPrefix, rcSuffix } = config;
76
+ const jsTypeExtensions = ['js', 'ts', 'cjs', 'mjs', 'cts', 'mts'];
77
+ const extensions = [...defaultExtensions, ...config.additionalExtensions];
78
+ const baseFiles = [
79
+ `${rcPrefix}${moduleName}${rcSuffix}`,
80
+ ...(config.configDir ? [`.config/${moduleName}${rcSuffix}`] : []),
81
+ ];
82
+ const rcFiles = `${rcPrefix}${moduleName}${rcSuffix}.{${extensions.join(',')}}`;
83
+ const configExtensions = extensions.filter(ext => config.configFilesAllExtensions || jsTypeExtensions.includes(ext));
84
+ const configFiles = !!config.configFiles && `${moduleName}.config.{${configExtensions.join(',')}}`;
85
+ const configDirFiles = !!config.configDir && `.config/${moduleName}${rcSuffix}.{${extensions.join(',')}}`;
86
+ return [...baseFiles, rcFiles, configFiles, configDirFiles].filter(item => item !== false);
87
+ };
88
+ export const toCosmiconfig = toConfigMap(['json', 'yaml', 'yml', 'js', 'ts', 'cjs', 'mjs'], { configDir: true });
89
+ export const toLilconfig = toConfigMap(['json', 'js', 'cjs', 'mjs'], { configDir: true });
90
+ export const toUnconfig = toConfigMap(['json', 'ts', 'mts', 'cts', 'js', 'mjs', 'cjs'], {
91
+ configDir: false,
92
+ rcPrefix: '',
93
+ rcSuffix: '',
94
+ configFiles: false,
95
+ });
@@ -1,9 +1,9 @@
1
- export declare const toBinary: (specifier: string) => any;
2
- export declare const fromBinary: (specifier: string) => any;
3
- export declare const isBinary: (specifier: string) => any;
4
- export declare const toEntryPattern: (specifier: string) => any;
5
- export declare const fromEntryPattern: (specifier: string) => any;
6
- export declare const isEntryPattern: (specifier: string) => any;
7
- export declare const toProductionEntryPattern: (specifier: string) => any;
8
- export declare const fromProductionEntryPattern: (specifier: string) => any;
9
- export declare const isProductionEntryPattern: (specifier: string) => any;
1
+ export declare const toBinary: (specifier: string) => string;
2
+ export declare const fromBinary: (specifier: string) => string;
3
+ export declare const isBinary: (specifier: string) => boolean;
4
+ export declare const toEntryPattern: (specifier: string) => string;
5
+ export declare const fromEntryPattern: (specifier: string) => string;
6
+ export declare const isEntryPattern: (specifier: string) => boolean;
7
+ export declare const toProductionEntryPattern: (specifier: string) => string;
8
+ export declare const fromProductionEntryPattern: (specifier: string) => string;
9
+ export declare const isProductionEntryPattern: (specifier: string) => boolean;
@@ -1,3 +1,3 @@
1
- export declare const toRegexOrString: (value: string | RegExp) => any;
2
- export declare const findMatch: (haystack: undefined | (string | RegExp)[], needle: string) => any;
3
- export declare const isIdChar: (text: string) => any;
1
+ export declare const toRegexOrString: (value: string | RegExp) => string | RegExp;
2
+ export declare const findMatch: (haystack: undefined | (string | RegExp)[], needle: string) => string | RegExp | undefined;
3
+ export declare const isIdChar: (text: string) => boolean;
@@ -1,3 +1,3 @@
1
1
  import type { ReporterOptions } from '../types/issues.js';
2
2
  export declare const runPreprocessors: (data: ReporterOptions, processors?: any) => Promise<ReporterOptions>;
3
- export declare const runReporters: (options: ReporterOptions) => any;
3
+ export declare const runReporters: (options: ReporterOptions) => Promise<void>;
@@ -1,5 +1,5 @@
1
1
  export declare const _require: NodeRequire;
2
2
  export declare const _loadESLintConfig: (configFilePath: string) => any;
3
- export declare const _resolve: (specifier: string) => any;
4
- export declare const _tryResolve: (specifier: string, from: string) => any;
5
- export declare const _resolveSpecifier: (dir: string, specifier: string) => any;
3
+ export declare const _resolve: (specifier: string) => string;
4
+ export declare const _tryResolve: (specifier: string, from: string) => string | undefined;
5
+ export declare const _resolveSpecifier: (dir: string, specifier: string) => string | undefined;
@@ -1 +1 @@
1
- export declare const resolveSync: (specifier: string, containingFile: string, extensions?: string[]) => any;
1
+ export declare const resolveSync: (specifier: string, containingFile: string, extensions?: string[]) => string | undefined;
@@ -1,5 +1,5 @@
1
1
  import type { Tags } from '../types/cli.js';
2
- export declare const splitTags: (rawTags: string[]) => any;
2
+ export declare const splitTags: (rawTags: string[]) => Tags;
3
3
  export declare const shouldIgnore: (jsDocTags: Set<string>, tags: Tags) => boolean;
4
- export declare const getShouldIgnoreHandler: (isProduction: boolean) => (jsDocTags: Set<string>) => any;
4
+ export declare const getShouldIgnoreHandler: (isProduction: boolean) => (jsDocTags: Set<string>) => boolean;
5
5
  export declare const getShouldIgnoreTagHandler: (tags: Tags) => (jsDocTags: Set<string>) => boolean;
@@ -1,5 +1,5 @@
1
1
  import type { DependencyGraph } from '../types/dependency-graph.js';
2
- declare const isTrace: any;
2
+ declare const isTrace: boolean;
3
3
  type CreateNode = {
4
4
  identifier?: string;
5
5
  hasRef?: boolean;
@@ -16,5 +16,5 @@ export type TraceNode = {
16
16
  export { isTrace };
17
17
  export declare const printTrace: (node: TraceNode, filePath: string, identifier?: string) => void;
18
18
  export declare const createNode: Create;
19
- export declare const addNodes: (node: TraceNode, id: string, importedSymbols: DependencyGraph, filePaths?: any) => void;
19
+ export declare const addNodes: (node: TraceNode, id: string, importedSymbols: DependencyGraph, filePaths?: Set<string>) => void;
20
20
  export declare const createAndPrintTrace: (filePath: string, options?: CreateNode) => void;
@@ -1 +1,6 @@
1
- export declare const loadTSConfig: (tsConfigFilePath: string) => unknown;
1
+ import ts from 'typescript';
2
+ export declare const loadTSConfig: (tsConfigFilePath: string) => Promise<{
3
+ isFile: boolean;
4
+ compilerOptions: ts.CompilerOptions;
5
+ definitionPaths: string[];
6
+ }>;
@@ -1 +1 @@
1
- export declare const unwrapFunction: (maybeFunction: unknown) => unknown;
1
+ export declare const unwrapFunction: (maybeFunction: unknown) => Promise<any>;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.23.1";
1
+ export declare const version = "5.23.3";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.23.1';
1
+ export const version = '5.23.3';