knip 5.23.0 → 5.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/ConfigurationChief.d.ts +15 -89
  2. package/dist/ConfigurationValidator.d.ts +1141 -2897
  3. package/dist/DependencyDeputy.d.ts +6 -21
  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 +9 -14
  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 +83 -695
  13. package/dist/compilers/mdx.d.ts +1 -1
  14. package/dist/constants.d.ts +4 -4
  15. package/dist/index.d.ts +1 -8
  16. package/dist/index.js +12 -10
  17. package/dist/manifest/helpers.d.ts +1 -1
  18. package/dist/manifest/index.d.ts +6 -4
  19. package/dist/plugins/babel/helpers.d.ts +1 -1
  20. package/dist/plugins/babel/index.d.ts +1 -1
  21. package/dist/plugins/capacitor/index.d.ts +1 -1
  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 +2 -5
  25. package/dist/plugins/graphql-codegen/index.d.ts +1 -1
  26. package/dist/plugins/husky/index.d.ts +1 -1
  27. package/dist/plugins/jest/index.d.ts +2 -3
  28. package/dist/plugins/lefthook/index.d.ts +1 -1
  29. package/dist/plugins/lint-staged/index.d.ts +1 -2
  30. package/dist/plugins/markdownlint/helpers.d.ts +1 -1
  31. package/dist/plugins/netlify/helpers.d.ts +1 -1
  32. package/dist/plugins/netlify/index.d.ts +1 -1
  33. package/dist/plugins/next/index.d.ts +1 -1
  34. package/dist/plugins/nx/index.d.ts +1 -1
  35. package/dist/plugins/playwright-ct/index.d.ts +1 -1
  36. package/dist/plugins/remix/index.d.ts +1 -1
  37. package/dist/plugins/sentry/index.d.ts +1 -1
  38. package/dist/plugins/simple-git-hooks/index.d.ts +1 -2
  39. package/dist/plugins/storybook/index.d.ts +2 -2
  40. package/dist/plugins/svelte/index.d.ts +1 -1
  41. package/dist/plugins/unbuild/index.d.ts +1 -2
  42. package/dist/plugins/vitest/helpers.d.ts +2 -2
  43. package/dist/plugins/webpack/index.d.ts +1 -4
  44. package/dist/plugins/wireit/index.d.ts +3 -2
  45. package/dist/plugins/yorkie/index.d.ts +1 -2
  46. package/dist/reporters/index.d.ts +1 -1
  47. package/dist/reporters/json.d.ts +1 -1
  48. package/dist/reporters/util.d.ts +1 -1
  49. package/dist/typescript/SourceFileManager.d.ts +5 -5
  50. package/dist/typescript/ast-helpers.d.ts +7 -5
  51. package/dist/typescript/ast-helpers.js +15 -5
  52. package/dist/typescript/getImportsAndExports.d.ts +10 -11
  53. package/dist/typescript/getImportsAndExports.js +16 -7
  54. package/dist/typescript/visitors/dynamic-imports/index.d.ts +1 -1
  55. package/dist/typescript/visitors/exports/exportKeyword.js +26 -62
  56. package/dist/typescript/visitors/exports/index.d.ts +1 -1
  57. package/dist/typescript/visitors/imports/index.d.ts +1 -1
  58. package/dist/typescript/visitors/scripts/index.d.ts +1 -1
  59. package/dist/util/Performance.d.ts +2 -2
  60. package/dist/util/array.d.ts +2 -2
  61. package/dist/util/errors.d.ts +1 -1
  62. package/dist/util/file-entry-cache.d.ts +3 -6
  63. package/dist/util/fs.d.ts +6 -6
  64. package/dist/util/get-included-issue-types.d.ts +1 -2
  65. package/dist/util/git.d.ts +1 -1
  66. package/dist/util/glob.d.ts +6 -6
  67. package/dist/util/handle-dependency.d.ts +1 -1
  68. package/dist/util/is-identifier-referenced.d.ts +1 -1
  69. package/dist/util/loader.d.ts +1 -1
  70. package/dist/util/map-workspaces.d.ts +1 -2
  71. package/dist/util/modules.d.ts +7 -7
  72. package/dist/util/package-json.d.ts +2 -6
  73. package/dist/util/path.d.ts +6 -6
  74. package/dist/util/pkgs-graph.d.ts +1 -1
  75. package/dist/util/plugin.d.ts +7 -7
  76. package/dist/util/protocols.d.ts +9 -9
  77. package/dist/util/regex.d.ts +3 -3
  78. package/dist/util/reporter.d.ts +1 -1
  79. package/dist/util/require.d.ts +3 -3
  80. package/dist/util/resolve.d.ts +1 -1
  81. package/dist/util/tag.d.ts +2 -2
  82. package/dist/util/trace.d.ts +2 -2
  83. package/dist/util/tsconfig-loader.d.ts +1 -6
  84. package/dist/util/unwrap-function.d.ts +1 -1
  85. package/dist/version.d.ts +1 -1
  86. package/dist/version.js +1 -1
  87. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import type { HasDependency } from './types.js';
2
2
  declare const _default: {
3
3
  condition: (hasDependency: HasDependency) => boolean;
4
- compiler: (text: string) => string;
4
+ compiler: (text: string) => any;
5
5
  };
6
6
  export default _default;
@@ -5,10 +5,10 @@ export declare const ANONYMOUS = "__anonymous";
5
5
  export declare const KNIP_CONFIG_LOCATIONS: string[];
6
6
  export declare const DEFAULT_EXTENSIONS: string[];
7
7
  export declare const GLOBAL_IGNORE_PATTERNS: string[];
8
- export declare const IGNORED_GLOBAL_BINARIES: Set<string>;
9
- export declare const IGNORED_DEPENDENCIES: Set<string>;
10
- export declare const IGNORED_RUNTIME_DEPENDENCIES: Set<string>;
11
- export declare const FOREIGN_FILE_EXTENSIONS: Set<string>;
8
+ export declare const IGNORED_GLOBAL_BINARIES: any;
9
+ export declare const IGNORED_DEPENDENCIES: any;
10
+ export declare const IGNORED_RUNTIME_DEPENDENCIES: any;
11
+ export declare const FOREIGN_FILE_EXTENSIONS: any;
12
12
  export declare const IGNORE_DEFINITELY_TYPED: string[];
13
13
  export declare const ISSUE_TYPES: IssueType[];
14
14
  export declare const ISSUE_TYPE_TITLE: Record<IssueType, string>;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,4 @@
1
1
  import type { CommandLineOptions } from './types/cli.js';
2
2
  export type { RawConfiguration as KnipConfig } from './types/config.js';
3
3
  export type { Preprocessor, Reporter, ReporterOptions } from './types/issues.js';
4
- export declare const main: (unresolvedConfiguration: CommandLineOptions) => Promise<{
5
- report: import("./types/issues.js").Report;
6
- issues: import("./types/issues.js").Issues;
7
- counters: import("./types/issues.js").Counters;
8
- rules: import("./types/issues.js").Rules;
9
- tagHints: Set<import("./types/issues.js").TagHint>;
10
- configurationHints: Set<import("./types/issues.js").ConfigurationHint>;
11
- }>;
4
+ export declare const main: (unresolvedConfiguration: CommandLineOptions) => unknown;
package/dist/index.js CHANGED
@@ -317,8 +317,17 @@ export const main = async (unresolvedConfiguration) => {
317
317
  if (shouldIgnore(exportedItem.jsDocTags))
318
318
  continue;
319
319
  const isIgnored = shouldIgnoreTags(exportedItem.jsDocTags);
320
- if (!isIgnored && importsForExport) {
320
+ if (importsForExport) {
321
321
  const { isReferenced, reExportingEntryFile, traceNode } = isIdentifierReferenced(filePath, identifier, isIncludeEntryExports);
322
+ if ((isReferenced || exportedItem.refs[1]) && isIgnored) {
323
+ for (const tagName of exportedItem.jsDocTags) {
324
+ if (tags[1].includes(tagName.replace(/^\@/, ''))) {
325
+ collector.addTagHint({ type: 'tag', filePath, identifier, tagName });
326
+ }
327
+ }
328
+ }
329
+ if (isIgnored)
330
+ continue;
322
331
  if (reExportingEntryFile) {
323
332
  if (!isIncludeEntryExports) {
324
333
  createAndPrintTrace(filePath, { identifier, isEntry, hasRef: isReferenced });
@@ -339,7 +348,7 @@ export const main = async (unresolvedConfiguration) => {
339
348
  continue;
340
349
  if (member.refs[0] === 0) {
341
350
  const id = `${identifier}.${member.identifier}`;
342
- const { isReferenced } = isIdentifierReferenced(filePath, id);
351
+ const { isReferenced } = isIdentifierReferenced(filePath, id, true);
343
352
  const isIgnored = shouldIgnoreTags(member.jsDocTags);
344
353
  if (!isReferenced) {
345
354
  if (isIgnored)
@@ -413,20 +422,13 @@ export const main = async (unresolvedConfiguration) => {
413
422
  line: exportedItem.line,
414
423
  col: exportedItem.col,
415
424
  });
416
- if (isIssueAdded) {
425
+ if (isFix && isIssueAdded) {
417
426
  if (isType)
418
427
  fixer.addUnusedTypeNode(filePath, exportedItem.fixes);
419
428
  else
420
429
  fixer.addUnusedExportNode(filePath, exportedItem.fixes);
421
430
  }
422
431
  }
423
- else if (isIgnored) {
424
- for (const tagName of exportedItem.jsDocTags) {
425
- if (tags[1].includes(tagName.replace(/^\@/, ''))) {
426
- collector.addTagHint({ type: 'tag', filePath, identifier, tagName });
427
- }
428
- }
429
- }
430
432
  }
431
433
  }
432
434
  }
@@ -9,5 +9,5 @@ type GetFilteredScriptsOptions = {
9
9
  isProduction: boolean;
10
10
  scripts?: Scripts;
11
11
  };
12
- export declare const getFilteredScripts: ({ isProduction, scripts }: GetFilteredScriptsOptions) => Scripts;
12
+ export declare const getFilteredScripts: ({ isProduction, scripts }: GetFilteredScriptsOptions) => any;
13
13
  export {};
@@ -1,12 +1,14 @@
1
- import type { HostDependencies, InstalledBinaries } from '../types/workspace.js';
2
1
  type Options = {
3
2
  packageNames: string[];
4
3
  dir: string;
5
4
  cwd: string;
6
5
  };
7
6
  export declare const getDependencyMetaData: ({ cwd, dir, packageNames }: Options) => {
8
- hostDependencies: HostDependencies;
9
- installedBinaries: InstalledBinaries;
10
- hasTypesIncluded: Set<string>;
7
+ hostDependencies: Map<string, {
8
+ name: string;
9
+ isPeerOptional: boolean;
10
+ }[]>;
11
+ installedBinaries: Map<string, Set<string>>;
12
+ hasTypesIncluded: any;
11
13
  };
12
14
  export {};
@@ -1,4 +1,4 @@
1
- export declare const resolveName: (identifier: string, namespace: "preset" | "plugin") => string;
1
+ export declare const resolveName: (identifier: string, namespace: "preset" | "plugin") => any;
2
2
  export declare const api: {
3
3
  assertVersion: () => boolean;
4
4
  cache: {
@@ -3,7 +3,7 @@ import type { BabelConfig, BabelConfigObj } from './types.js';
3
3
  export declare const getDependenciesFromConfig: (config: BabelConfigObj) => string[];
4
4
  declare const _default: {
5
5
  title: string;
6
- enablers: RegExp[];
6
+ enablers: {}[];
7
7
  isEnabled: IsPluginEnabled;
8
8
  config: string[];
9
9
  resolveConfig: ResolveConfig<BabelConfig>;
@@ -2,7 +2,7 @@ import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
2
  import type { CapacitorConfig } from './types.js';
3
3
  declare const _default: {
4
4
  title: string;
5
- enablers: RegExp[];
5
+ enablers: {}[];
6
6
  isEnabled: IsPluginEnabled;
7
7
  config: string[];
8
8
  resolveConfig: ResolveConfig<CapacitorConfig>;
@@ -4,7 +4,7 @@ declare const _default: {
4
4
  enablers: string[];
5
5
  isEnabled: IsPluginEnabled;
6
6
  config: string[];
7
- entry: string[];
7
+ entry: any[];
8
8
  resolveEntryPaths: ResolveEntryPaths;
9
9
  };
10
10
  export default _default;
@@ -109,22 +109,22 @@ export declare class DummyEleventyConfig {
109
109
  DateTime: {};
110
110
  dynamicPermalinks: boolean;
111
111
  useGitIgnore: boolean;
112
- ignores: Set<unknown>;
113
- watchIgnores: Set<unknown>;
112
+ ignores: any;
113
+ watchIgnores: any;
114
114
  dataDeepMerge: boolean;
115
- extensionMap: Set<unknown>;
115
+ extensionMap: any;
116
116
  watchJavaScriptDependencies: boolean;
117
117
  additionalWatchTargets: never[];
118
118
  serverOptions: {};
119
119
  globalData: {};
120
120
  chokidarConfig: {};
121
121
  watchThrottleWaitTime: number;
122
- dataExtensions: Map<any, any>;
122
+ dataExtensions: any;
123
123
  quietMode: boolean;
124
124
  plugins: never[];
125
125
  _pluginExecution: boolean;
126
126
  useTemplateCache: boolean;
127
- dataFilterSelectors: Set<unknown>;
127
+ dataFilterSelectors: any;
128
128
  libraryAmendments: {};
129
129
  serverPassthroughCopyBehavior: string;
130
130
  urlTransforms: never[];
@@ -1,14 +1,11 @@
1
1
  import type { IsPluginEnabled, ResolveConfig, ResolveEntryPaths } from '#p/types/plugins.js';
2
- import { DummyEleventyConfig } from './helpers.js';
3
- import type { EleventyConfig } from './types.js';
4
- type T = Partial<EleventyConfig> | ((arg: DummyEleventyConfig) => Promise<Partial<EleventyConfig>>);
5
2
  declare const _default: {
6
3
  title: string;
7
4
  enablers: string[];
8
5
  isEnabled: IsPluginEnabled;
9
6
  config: string[];
10
7
  production: string[];
11
- resolveEntryPaths: ResolveEntryPaths<T>;
12
- resolveConfig: ResolveConfig<T>;
8
+ resolveEntryPaths: ResolveEntryPaths<any>;
9
+ resolveConfig: ResolveConfig<any>;
13
10
  };
14
11
  export default _default;
@@ -2,7 +2,7 @@ import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
2
  import type { GraphqlCodegenTypes, GraphqlConfigTypes, GraphqlProjectsConfigTypes } from './types.js';
3
3
  declare const _default: {
4
4
  title: string;
5
- enablers: (string | RegExp)[];
5
+ enablers: {}[];
6
6
  isEnabled: IsPluginEnabled;
7
7
  packageJsonPath: (manifest: import("../../types/package-json.js").PackageJson) => string;
8
8
  config: string[];
@@ -3,7 +3,7 @@ declare const _default: {
3
3
  title: string;
4
4
  enablers: string[];
5
5
  isEnabled: IsPluginEnabled;
6
- config: string[];
6
+ config: any[];
7
7
  resolveConfig: ResolveConfig<string>;
8
8
  };
9
9
  export default _default;
@@ -1,12 +1,11 @@
1
1
  import type { IsPluginEnabled, ResolveConfig, ResolveEntryPaths } from '#p/types/plugins.js';
2
- import type { JestConfig } from './types.js';
3
2
  declare const _default: {
4
3
  title: string;
5
4
  enablers: string[];
6
5
  isEnabled: IsPluginEnabled;
7
6
  config: string[];
8
7
  entry: string[];
9
- resolveEntryPaths: ResolveEntryPaths<JestConfig>;
10
- resolveConfig: ResolveConfig<JestConfig>;
8
+ resolveEntryPaths: ResolveEntryPaths<any>;
9
+ resolveConfig: ResolveConfig<any>;
11
10
  };
12
11
  export default _default;
@@ -3,7 +3,7 @@ declare const _default: {
3
3
  title: string;
4
4
  enablers: string[];
5
5
  isEnabled: IsPluginEnabled;
6
- config: string[];
6
+ config: any[];
7
7
  resolveConfig: ResolveConfig;
8
8
  };
9
9
  export default _default;
@@ -1,11 +1,10 @@
1
1
  import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
- import type { LintStagedConfig } from './types.js';
3
2
  declare const _default: {
4
3
  title: string;
5
4
  enablers: string[];
6
5
  isEnabled: IsPluginEnabled;
7
6
  packageJsonPath: string;
8
7
  config: string[];
9
- resolveConfig: ResolveConfig<LintStagedConfig>;
8
+ resolveConfig: ResolveConfig<any>;
10
9
  };
11
10
  export default _default;
@@ -1 +1 @@
1
- export declare const getArgumentValues: (value: string, matcher: RegExp) => string[];
1
+ export declare const getArgumentValues: (value: string, matcher: RegExp) => any;
@@ -1,2 +1,2 @@
1
1
  import type { FunctionsConfig } from './types.js';
2
- export declare const extractFunctionsConfigProperty: (config: FunctionsConfig, property: keyof FunctionsConfig) => string[];
2
+ export declare const extractFunctionsConfigProperty: (config: FunctionsConfig, property: keyof FunctionsConfig) => any[];
@@ -2,7 +2,7 @@ import type { IsPluginEnabled, ResolveConfig, ResolveEntryPaths } from '#p/types
2
2
  import type { NetlifyConfig } from './types.js';
3
3
  declare const _default: {
4
4
  title: string;
5
- enablers: (string | RegExp)[];
5
+ enablers: {}[];
6
6
  isEnabled: IsPluginEnabled;
7
7
  config: string[];
8
8
  production: string[];
@@ -4,6 +4,6 @@ declare const _default: {
4
4
  enablers: string[];
5
5
  isEnabled: IsPluginEnabled;
6
6
  entry: string[];
7
- production: string[];
7
+ production: any[];
8
8
  };
9
9
  export default _default;
@@ -2,7 +2,7 @@ import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
2
  import type { NxConfigRoot, NxProjectConfiguration } from './types.js';
3
3
  declare const _default: {
4
4
  title: string;
5
- enablers: (string | RegExp)[];
5
+ enablers: {}[];
6
6
  isEnabled: IsPluginEnabled;
7
7
  config: string[];
8
8
  resolveConfig: ResolveConfig<NxProjectConfiguration | NxConfigRoot>;
@@ -1,7 +1,7 @@
1
1
  import type { IsPluginEnabled } from '#p/types/plugins.js';
2
2
  declare const _default: {
3
3
  title: string;
4
- enablers: RegExp[];
4
+ enablers: {}[];
5
5
  isEnabled: IsPluginEnabled;
6
6
  config: string[];
7
7
  entry: string[];
@@ -1,7 +1,7 @@
1
1
  import type { IsPluginEnabled } from '#p/types/plugins.js';
2
2
  declare const _default: {
3
3
  title: string;
4
- enablers: RegExp[];
4
+ enablers: {}[];
5
5
  isEnabled: IsPluginEnabled;
6
6
  entry: string[];
7
7
  production: string[];
@@ -1,7 +1,7 @@
1
1
  import type { IsPluginEnabled } from '#p/types/plugins.js';
2
2
  declare const _default: {
3
3
  title: string;
4
- enablers: RegExp[];
4
+ enablers: {}[];
5
5
  isEnabled: IsPluginEnabled;
6
6
  entry: string[];
7
7
  };
@@ -1,11 +1,10 @@
1
1
  import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
- import type { PluginConfig } from './types.js';
3
2
  declare const _default: {
4
3
  title: string;
5
4
  enablers: import("#p/types/config.js").IgnorePatterns;
6
5
  isEnabled: IsPluginEnabled;
7
6
  packageJsonPath: string;
8
7
  config: string[];
9
- resolveConfig: ResolveConfig<PluginConfig>;
8
+ resolveConfig: ResolveConfig<any>;
10
9
  };
11
10
  export default _default;
@@ -2,10 +2,10 @@ import type { IsPluginEnabled, ResolveConfig, ResolveEntryPaths } from '#p/types
2
2
  import type { StorybookConfig } from './types.js';
3
3
  declare const _default: {
4
4
  title: string;
5
- enablers: (string | RegExp)[];
5
+ enablers: {}[];
6
6
  isEnabled: IsPluginEnabled;
7
7
  config: string[];
8
- entry: string[];
8
+ entry: any[];
9
9
  project: string[];
10
10
  resolveEntryPaths: ResolveEntryPaths<StorybookConfig>;
11
11
  resolveConfig: ResolveConfig<StorybookConfig>;
@@ -3,7 +3,7 @@ declare const _default: {
3
3
  title: string;
4
4
  enablers: string[];
5
5
  isEnabled: IsPluginEnabled;
6
- entry: string[];
6
+ entry: any[];
7
7
  production: string[];
8
8
  project: string[];
9
9
  };
@@ -1,10 +1,9 @@
1
1
  import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
- import type { UnbuildConfig } from './types.js';
3
2
  declare const _default: {
4
3
  title: string;
5
4
  enablers: string[];
6
5
  isEnabled: IsPluginEnabled;
7
6
  config: string[];
8
- resolveConfig: ResolveConfig<UnbuildConfig>;
7
+ resolveConfig: ResolveConfig<any>;
9
8
  };
10
9
  export default _default;
@@ -1,3 +1,3 @@
1
1
  import type { ViteConfig } from './types.js';
2
- export declare const getEnvPackageName: (env: string) => string;
3
- export declare const getExternalReporters: (reporters?: ViteConfig["test"]["reporters"]) => string[];
2
+ export declare const getEnvPackageName: (env: string) => any;
3
+ export declare const getExternalReporters: (reporters?: ViteConfig["test"]["reporters"]) => any;
@@ -3,10 +3,7 @@ import type { WebpackConfig } from './types.js';
3
3
  export declare const findWebpackDependenciesFromConfig: ({ config, cwd }: {
4
4
  config: WebpackConfig;
5
5
  cwd: string;
6
- }) => Promise<{
7
- dependencies: Set<string>;
8
- entryPatterns: Set<string>;
9
- }>;
6
+ }) => unknown;
10
7
  declare const _default: {
11
8
  title: string;
12
9
  enablers: string[];
@@ -1,11 +1,12 @@
1
1
  import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
- import type { WireitConfig } from './types.js';
3
2
  declare const _default: {
4
3
  title: string;
5
4
  enablers: string[];
6
5
  isEnabled: IsPluginEnabled;
7
6
  packageJsonPath: string;
8
7
  config: string[];
9
- resolveConfig: ResolveConfig<WireitConfig>;
8
+ resolveConfig: ResolveConfig<Record<string, {
9
+ command?: string;
10
+ }>>;
10
11
  };
11
12
  export default _default;
@@ -1,11 +1,10 @@
1
1
  import type { IsPluginEnabled, ResolveConfig } from '#p/types/plugins.js';
2
- import type { LintStagedConfig } from '../lint-staged/types.js';
3
2
  declare const _default: {
4
3
  title: string;
5
4
  enablers: string[];
6
5
  isEnabled: IsPluginEnabled;
7
6
  packageJsonPath: string;
8
7
  config: string[];
9
- resolveConfig: ResolveConfig<LintStagedConfig>;
8
+ resolveConfig: ResolveConfig<any>;
10
9
  };
11
10
  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) => Promise<void>;
5
+ json: ({ report, issues, options }: import("../index.js").ReporterOptions) => any;
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) => Promise<void>;
2
+ declare const _default: ({ report, issues, options }: ReporterOptions) => any;
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) => string;
4
+ export declare const getTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => Record<keyof import("../types/issues.js").Issues, 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: Map<string, ts.SourceFile | undefined>;
10
- snapshotCache: Map<string, ts.IScriptSnapshot | undefined>;
9
+ sourceFileCache: any;
10
+ snapshotCache: any;
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): ts.SourceFile | undefined;
16
- getSnapshot(filePath: string): ts.IScriptSnapshot | undefined;
17
- compileAndAddSourceFile(filePath: string): Promise<void>;
15
+ getSourceFile(filePath: string): any;
16
+ getSnapshot(filePath: string): any;
17
+ compileAndAddSourceFile(filePath: string): any;
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): string;
9
+ export declare function stripQuotes(name: string): any;
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) => Set<string>;
13
+ export declare const getJSDocTags: (node: ts.Node) => any;
14
14
  export declare const getLineAndCharacterOfPosition: (node: ts.Node, pos: number) => {
15
15
  line: number;
16
16
  col: number;
@@ -18,9 +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) => string[];
22
- export declare const isConsiderReferencedNS: (node: ts.Identifier) => boolean;
21
+ export declare const getDestructuredIds: (name: ts.ObjectBindingPattern) => any;
22
+ export declare const isConsiderReferencedNS: (node: ts.Identifier) => any;
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, symbol: ts.Symbol) => any;
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;
@@ -152,11 +152,21 @@ export const isImportSpecifier = (node) => ts.isImportSpecifier(node.parent) ||
152
152
  ts.isImportClause(node.parent) ||
153
153
  ts.isNamespaceImport(node.parent);
154
154
  const isExported = (node) => {
155
- if (node.modifiers?.find(mod => mod.kind === ts.SyntaxKind.ExportKeyword))
155
+ if (getExportKeywordNode(node))
156
156
  return true;
157
157
  return node.parent ? isExported(node.parent) : false;
158
158
  };
159
- export const isReferencedInExportedType = (node, symbol) => symbol.exportSymbol &&
160
- !(node.transformFlags & ts.TransformFlags.ContainsTypeScript) &&
161
- Boolean(node.parent.transformFlags & ts.TransformFlags.ContainsTypeScript) &&
162
- isExported(node.parent);
159
+ const isTypeDeclaration = (node) => ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node) || ts.isEnumDeclaration(node);
160
+ const getAncestorTypeDeclaration = (node) => {
161
+ while (node) {
162
+ if (isTypeDeclaration(node))
163
+ return node;
164
+ node = node.parent;
165
+ }
166
+ };
167
+ export const isReferencedInExportedType = (node) => {
168
+ const typeNode = getAncestorTypeDeclaration(node);
169
+ return Boolean(typeNode && isExported(typeNode));
170
+ };
171
+ export const getExportKeywordNode = (node) => node.modifiers?.find(mod => mod.kind === ts.SyntaxKind.ExportKeyword);
172
+ export const getDefaultKeywordNode = (node) => node.modifiers?.find(mod => mod.kind === ts.SyntaxKind.DefaultKeyword);
@@ -1,7 +1,6 @@
1
1
  import ts from 'typescript';
2
2
  import type { Tags } from '../types/cli.js';
3
- import type { ExportMap, ImportMap, UnresolvedImport } from '../types/dependency-graph.js';
4
- import type { IssueSymbol } from '../types/issues.js';
3
+ import type { Export } from '../types/dependency-graph.js';
5
4
  import type { BoundSourceFile } from './SourceFile.js';
6
5
  export type GetImportsAndExportsOptions = {
7
6
  skipTypeOnly: boolean;
@@ -14,16 +13,16 @@ export type GetImportsAndExportsOptions = {
14
13
  };
15
14
  export declare const _getImportsAndExports: (sourceFile: BoundSourceFile, resolveModule: (specifier: string) => ts.ResolvedModuleFull | undefined, typeChecker: ts.TypeChecker, options: GetImportsAndExportsOptions) => {
16
15
  imports: {
17
- internal: ImportMap;
18
- external: Set<string>;
19
- resolved: Set<string>;
20
- specifiers: Set<[string, string]>;
21
- unresolved: Set<UnresolvedImport>;
16
+ internal: Map<string, import("../types/dependency-graph.js").ImportDetails>;
17
+ external: any;
18
+ resolved: any;
19
+ specifiers: any;
20
+ unresolved: any;
22
21
  };
23
22
  exports: {
24
- exported: ExportMap;
25
- duplicate: IssueSymbol[][];
23
+ exported: Map<string, Export>;
24
+ duplicate: any[];
26
25
  };
27
- scripts: Set<string>;
28
- traceRefs: Set<string>;
26
+ scripts: any;
27
+ traceRefs: any;
29
28
  };