knip 5.68.0 → 5.69.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.
- package/dist/CatalogCounselor.d.ts +18 -0
- package/dist/CatalogCounselor.js +50 -0
- package/dist/ConfigurationChief.d.ts +6 -0
- package/dist/ConfigurationChief.js +3 -1
- package/dist/DependencyDeputy.js +10 -3
- package/dist/IssueFixer.d.ts +1 -6
- package/dist/IssueFixer.js +75 -46
- package/dist/JsonCatalogPeeker.d.ts +12 -0
- package/dist/JsonCatalogPeeker.js +68 -0
- package/dist/PackagePeeker.js +1 -0
- package/dist/YamlCatalogPeeker.d.ts +12 -0
- package/dist/YamlCatalogPeeker.js +66 -0
- package/dist/binaries/bash-parser.js +1 -1
- package/dist/compilers/index.d.ts +14 -4
- package/dist/constants.d.ts +9 -1
- package/dist/constants.js +9 -0
- package/dist/graph/analyze.d.ts +3 -1
- package/dist/graph/analyze.js +22 -16
- package/dist/graph/build.d.ts +3 -1
- package/dist/graph/build.js +2 -1
- package/dist/index.js +5 -2
- package/dist/plugins/_template/index.d.ts +3 -12
- package/dist/plugins/_template/index.js +2 -1
- package/dist/plugins/angular/index.d.ts +3 -10
- package/dist/plugins/angular/index.js +2 -1
- package/dist/plugins/astro/index.d.ts +3 -13
- package/dist/plugins/astro/index.js +2 -1
- package/dist/plugins/astro-db/index.d.ts +3 -8
- package/dist/plugins/astro-db/index.js +2 -1
- package/dist/plugins/ava/index.d.ts +3 -11
- package/dist/plugins/ava/index.js +2 -1
- package/dist/plugins/babel/index.d.ts +4 -10
- package/dist/plugins/babel/index.js +2 -1
- package/dist/plugins/biome/index.d.ts +3 -10
- package/dist/plugins/biome/index.js +2 -1
- package/dist/plugins/bumpp/index.d.ts +3 -8
- package/dist/plugins/bumpp/index.js +2 -1
- package/dist/plugins/bun/index.d.ts +3 -11
- package/dist/plugins/bun/index.js +2 -1
- package/dist/plugins/c8/index.d.ts +3 -10
- package/dist/plugins/c8/index.js +2 -1
- package/dist/plugins/capacitor/index.d.ts +3 -10
- package/dist/plugins/capacitor/index.js +2 -1
- package/dist/plugins/changelogen/index.d.ts +3 -9
- package/dist/plugins/changelogen/index.js +2 -1
- package/dist/plugins/changelogithub/index.d.ts +3 -9
- package/dist/plugins/changelogithub/index.js +2 -1
- package/dist/plugins/changesets/index.d.ts +3 -11
- package/dist/plugins/changesets/index.js +2 -1
- package/dist/plugins/commitizen/index.d.ts +3 -12
- package/dist/plugins/commitizen/index.js +2 -1
- package/dist/plugins/commitlint/index.d.ts +3 -10
- package/dist/plugins/commitlint/index.js +2 -1
- package/dist/plugins/convex/index.d.ts +3 -8
- package/dist/plugins/convex/index.js +2 -1
- package/dist/plugins/create-typescript-app/index.d.ts +3 -8
- package/dist/plugins/create-typescript-app/index.js +2 -1
- package/dist/plugins/cspell/index.d.ts +3 -10
- package/dist/plugins/cspell/index.js +2 -1
- package/dist/plugins/cucumber/index.d.ts +3 -11
- package/dist/plugins/cucumber/index.js +2 -1
- package/dist/plugins/cypress/index.d.ts +3 -11
- package/dist/plugins/cypress/index.js +2 -1
- package/dist/plugins/danger/index.d.ts +3 -8
- package/dist/plugins/danger/index.js +2 -1
- package/dist/plugins/dependency-cruiser/index.d.ts +3 -12
- package/dist/plugins/dependency-cruiser/index.js +2 -1
- package/dist/plugins/docusaurus/index.d.ts +3 -12
- package/dist/plugins/docusaurus/index.js +2 -1
- package/dist/plugins/dotenv/index.d.ts +3 -8
- package/dist/plugins/dotenv/index.js +2 -1
- package/dist/plugins/drizzle/index.d.ts +3 -10
- package/dist/plugins/drizzle/index.js +2 -1
- package/dist/plugins/eleventy/index.d.ts +3 -11
- package/dist/plugins/eleventy/index.js +2 -1
- package/dist/plugins/eslint/helpers.d.ts +1 -0
- package/dist/plugins/eslint/helpers.js +14 -1
- package/dist/plugins/eslint/index.d.ts +3 -19
- package/dist/plugins/eslint/index.js +7 -2
- package/dist/plugins/expo/index.d.ts +3 -11
- package/dist/plugins/expo/index.js +2 -1
- package/dist/plugins/gatsby/index.d.ts +3 -11
- package/dist/plugins/gatsby/index.js +2 -1
- package/dist/plugins/github-action/index.d.ts +3 -9
- package/dist/plugins/github-action/index.js +2 -1
- package/dist/plugins/github-actions/index.d.ts +3 -10
- package/dist/plugins/github-actions/index.js +2 -1
- package/dist/plugins/glob/index.d.ts +3 -11
- package/dist/plugins/glob/index.js +2 -1
- package/dist/plugins/graphql-codegen/index.d.ts +3 -11
- package/dist/plugins/graphql-codegen/index.js +2 -1
- package/dist/plugins/hardhat/index.d.ts +3 -9
- package/dist/plugins/hardhat/index.js +2 -1
- package/dist/plugins/husky/index.d.ts +3 -10
- package/dist/plugins/husky/index.js +2 -1
- package/dist/plugins/i18next-parser/index.d.ts +3 -12
- package/dist/plugins/i18next-parser/index.js +2 -1
- package/dist/plugins/index.d.ts +118 -942
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/jest/index.d.ts +3 -14
- package/dist/plugins/jest/index.js +2 -1
- package/dist/plugins/karma/index.d.ts +3 -10
- package/dist/plugins/karma/index.js +2 -1
- package/dist/plugins/ladle/index.d.ts +3 -12
- package/dist/plugins/ladle/index.js +2 -1
- package/dist/plugins/lefthook/index.d.ts +3 -9
- package/dist/plugins/lefthook/index.js +2 -1
- package/dist/plugins/lint-staged/index.d.ts +3 -10
- package/dist/plugins/lint-staged/index.js +2 -1
- package/dist/plugins/linthtml/index.d.ts +3 -11
- package/dist/plugins/linthtml/index.js +2 -1
- package/dist/plugins/lockfile-lint/index.d.ts +3 -8
- package/dist/plugins/lockfile-lint/index.js +2 -1
- package/dist/plugins/lost-pixel/index.d.ts +3 -8
- package/dist/plugins/lost-pixel/index.js +2 -1
- package/dist/plugins/markdownlint/index.d.ts +3 -10
- package/dist/plugins/markdownlint/index.js +2 -1
- package/dist/plugins/mdx/index.d.ts +3 -0
- package/dist/plugins/mdx/index.js +32 -0
- package/dist/plugins/mdx/types.d.ts +3 -0
- package/dist/plugins/mdx/types.js +1 -0
- package/dist/plugins/mdxlint/index.d.ts +3 -10
- package/dist/plugins/mdxlint/index.js +7 -2
- package/dist/plugins/metro/index.d.ts +3 -11
- package/dist/plugins/metro/index.js +2 -1
- package/dist/plugins/mocha/index.d.ts +3 -14
- package/dist/plugins/mocha/index.js +2 -1
- package/dist/plugins/moonrepo/index.d.ts +3 -11
- package/dist/plugins/moonrepo/index.js +2 -1
- package/dist/plugins/msw/index.d.ts +3 -11
- package/dist/plugins/msw/index.js +2 -1
- package/dist/plugins/nano-staged/index.d.ts +3 -10
- package/dist/plugins/nano-staged/index.js +2 -1
- package/dist/plugins/nest/index.d.ts +3 -10
- package/dist/plugins/nest/index.js +2 -1
- package/dist/plugins/netlify/index.d.ts +3 -11
- package/dist/plugins/netlify/index.js +2 -1
- package/dist/plugins/next/index.d.ts +3 -10
- package/dist/plugins/next/index.js +6 -6
- package/dist/plugins/node/index.d.ts +3 -17
- package/dist/plugins/node/index.js +2 -1
- package/dist/plugins/node-modules-inspector/index.d.ts +3 -11
- package/dist/plugins/node-modules-inspector/index.js +2 -1
- package/dist/plugins/nodemon/index.d.ts +3 -10
- package/dist/plugins/nodemon/index.js +2 -1
- package/dist/plugins/npm-package-json-lint/index.d.ts +3 -11
- package/dist/plugins/npm-package-json-lint/index.js +2 -1
- package/dist/plugins/nuxt/index.d.ts +3 -12
- package/dist/plugins/nuxt/index.js +2 -1
- package/dist/plugins/nx/index.d.ts +3 -14
- package/dist/plugins/nx/index.js +2 -1
- package/dist/plugins/nyc/index.d.ts +3 -10
- package/dist/plugins/nyc/index.js +2 -1
- package/dist/plugins/oclif/index.d.ts +3 -10
- package/dist/plugins/oclif/index.js +2 -1
- package/dist/plugins/oxlint/index.d.ts +3 -11
- package/dist/plugins/oxlint/index.js +2 -1
- package/dist/plugins/playwright/index.d.ts +3 -15
- package/dist/plugins/playwright/index.js +2 -1
- package/dist/plugins/playwright-ct/index.d.ts +3 -10
- package/dist/plugins/playwright-ct/index.js +2 -1
- package/dist/plugins/playwright-test/index.d.ts +3 -12
- package/dist/plugins/playwright-test/index.js +2 -1
- package/dist/plugins/plop/index.d.ts +3 -8
- package/dist/plugins/plop/index.js +2 -1
- package/dist/plugins/pnpm/index.d.ts +3 -8
- package/dist/plugins/pnpm/index.js +2 -1
- package/dist/plugins/postcss/index.d.ts +3 -10
- package/dist/plugins/postcss/index.js +2 -1
- package/dist/plugins/preconstruct/index.d.ts +3 -10
- package/dist/plugins/preconstruct/index.js +2 -1
- package/dist/plugins/prettier/index.d.ts +3 -10
- package/dist/plugins/prettier/index.js +2 -1
- package/dist/plugins/prisma/index.d.ts +3 -13
- package/dist/plugins/prisma/index.js +10 -2
- package/dist/plugins/prisma/types.d.ts +3 -0
- package/dist/plugins/react-cosmos/index.d.ts +3 -11
- package/dist/plugins/react-cosmos/index.js +2 -1
- package/dist/plugins/react-router/index.d.ts +3 -10
- package/dist/plugins/react-router/index.js +3 -2
- package/dist/plugins/relay/index.d.ts +3 -15
- package/dist/plugins/relay/index.js +2 -1
- package/dist/plugins/release-it/index.d.ts +3 -10
- package/dist/plugins/release-it/index.js +2 -1
- package/dist/plugins/remark/index.d.ts +3 -11
- package/dist/plugins/remark/index.js +2 -1
- package/dist/plugins/remix/index.d.ts +3 -9
- package/dist/plugins/remix/index.js +2 -1
- package/dist/plugins/rollup/index.d.ts +3 -10
- package/dist/plugins/rollup/index.js +2 -1
- package/dist/plugins/rsbuild/index.d.ts +3 -10
- package/dist/plugins/rsbuild/index.js +2 -1
- package/dist/plugins/rslib/index.d.ts +3 -10
- package/dist/plugins/rslib/index.js +2 -1
- package/dist/plugins/rspack/index.d.ts +3 -10
- package/dist/plugins/rspack/index.js +2 -1
- package/dist/plugins/rstest/index.d.ts +3 -10
- package/dist/plugins/rstest/index.js +2 -1
- package/dist/plugins/semantic-release/index.d.ts +3 -12
- package/dist/plugins/semantic-release/index.js +2 -1
- package/dist/plugins/sentry/index.d.ts +3 -8
- package/dist/plugins/sentry/index.js +2 -1
- package/dist/plugins/simple-git-hooks/index.d.ts +3 -10
- package/dist/plugins/simple-git-hooks/index.js +2 -1
- package/dist/plugins/size-limit/index.d.ts +3 -9
- package/dist/plugins/size-limit/index.js +2 -1
- package/dist/plugins/sst/index.d.ts +3 -9
- package/dist/plugins/sst/index.js +2 -1
- package/dist/plugins/starlight/index.d.ts +3 -9
- package/dist/plugins/starlight/index.js +2 -1
- package/dist/plugins/storybook/index.d.ts +3 -12
- package/dist/plugins/storybook/index.js +2 -1
- package/dist/plugins/stryker/index.d.ts +3 -10
- package/dist/plugins/stryker/index.js +2 -1
- package/dist/plugins/stylelint/index.d.ts +3 -10
- package/dist/plugins/stylelint/index.js +2 -1
- package/dist/plugins/svelte/index.d.ts +3 -10
- package/dist/plugins/svelte/index.js +2 -1
- package/dist/plugins/svgo/index.d.ts +3 -8
- package/dist/plugins/svgo/index.js +2 -1
- package/dist/plugins/syncpack/index.d.ts +3 -8
- package/dist/plugins/syncpack/index.js +2 -1
- package/dist/plugins/tailwind/index.d.ts +3 -8
- package/dist/plugins/tailwind/index.js +2 -1
- package/dist/plugins/travis/index.d.ts +3 -10
- package/dist/plugins/travis/index.js +2 -1
- package/dist/plugins/ts-node/index.d.ts +3 -14
- package/dist/plugins/ts-node/index.js +2 -1
- package/dist/plugins/tsdown/index.d.ts +3 -13
- package/dist/plugins/tsdown/index.js +2 -1
- package/dist/plugins/tsup/index.d.ts +3 -13
- package/dist/plugins/tsup/index.js +2 -1
- package/dist/plugins/tsx/index.d.ts +3 -15
- package/dist/plugins/tsx/index.js +2 -1
- package/dist/plugins/typedoc/index.d.ts +3 -16
- package/dist/plugins/typedoc/index.js +2 -1
- package/dist/plugins/typescript/index.d.ts +3 -18
- package/dist/plugins/typescript/index.js +2 -1
- package/dist/plugins/unbuild/index.d.ts +3 -10
- package/dist/plugins/unbuild/index.js +2 -1
- package/dist/plugins/unocss/index.d.ts +3 -8
- package/dist/plugins/unocss/index.js +2 -1
- package/dist/plugins/vercel-og/index.d.ts +3 -8
- package/dist/plugins/vercel-og/index.js +2 -1
- package/dist/plugins/vike/index.d.ts +3 -8
- package/dist/plugins/vike/index.js +2 -1
- package/dist/plugins/vite/index.d.ts +3 -10
- package/dist/plugins/vite/index.js +2 -1
- package/dist/plugins/vitest/index.d.ts +3 -16
- package/dist/plugins/vitest/index.js +2 -1
- package/dist/plugins/vue/index.d.ts +3 -10
- package/dist/plugins/vue/index.js +2 -1
- package/dist/plugins/webdriver-io/index.d.ts +3 -10
- package/dist/plugins/webdriver-io/index.js +2 -1
- package/dist/plugins/webpack/index.d.ts +3 -13
- package/dist/plugins/webpack/index.js +2 -1
- package/dist/plugins/wireit/index.d.ts +3 -10
- package/dist/plugins/wireit/index.js +2 -1
- package/dist/plugins/wrangler/index.d.ts +3 -10
- package/dist/plugins/wrangler/index.js +2 -1
- package/dist/plugins/xo/index.d.ts +3 -11
- package/dist/plugins/xo/index.js +2 -1
- package/dist/plugins/yarn/index.d.ts +3 -9
- package/dist/plugins/yarn/index.js +2 -1
- package/dist/plugins/yorkie/index.d.ts +3 -11
- package/dist/plugins/yorkie/index.js +2 -1
- package/dist/reporters/json.js +1 -0
- package/dist/reporters/util/util.d.ts +1 -1
- package/dist/schema/configuration.d.ts +14 -4
- package/dist/schema/configuration.js +1 -0
- package/dist/schema/plugins.d.ts +5 -0
- package/dist/schema/plugins.js +1 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +1 -0
- package/dist/types/config.d.ts +2 -0
- package/dist/types/exports.d.ts +1 -1
- package/dist/types/imports.d.ts +1 -3
- package/dist/types/issues.d.ts +3 -0
- package/dist/types/package-json.d.ts +12 -1
- package/dist/types.d.ts +1 -1
- package/dist/typescript/ast-helpers.d.ts +1 -1
- package/dist/typescript/get-imports-and-exports.js +18 -17
- package/dist/typescript/visitors/dynamic-imports/importCall.js +23 -15
- package/dist/typescript/visitors/dynamic-imports/importType.js +7 -1
- package/dist/typescript/visitors/dynamic-imports/index.js +2 -1
- package/dist/typescript/visitors/dynamic-imports/jsDocType.js +13 -2
- package/dist/typescript/visitors/dynamic-imports/requireCall.js +13 -9
- package/dist/typescript/visitors/dynamic-imports/resolveCall.js +7 -1
- package/dist/typescript/visitors/dynamic-imports/urlConstructor.d.ts +3 -0
- package/dist/typescript/visitors/dynamic-imports/urlConstructor.js +24 -0
- package/dist/typescript/visitors/exports/exportDeclaration.js +1 -1
- package/dist/typescript/visitors/helpers.js +13 -2
- package/dist/typescript/visitors/imports/importDeclaration.js +9 -8
- package/dist/typescript/visitors/imports/importEqualsDeclaration.js +9 -1
- package/dist/typescript/visitors/imports/reExportDeclaration.js +10 -5
- package/dist/util/catalog.d.ts +6 -0
- package/dist/util/catalog.js +62 -0
- package/dist/util/cli-arguments.d.ts +1 -1
- package/dist/util/cli-arguments.js +3 -3
- package/dist/util/create-options.d.ts +17 -4
- package/dist/util/create-options.js +8 -5
- package/dist/util/errors.js +11 -1
- package/dist/util/get-included-issue-types.d.ts +1 -1
- package/dist/util/get-included-issue-types.js +3 -2
- package/dist/util/get-referenced-inputs.js +4 -0
- package/dist/util/trace.js +4 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +4 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Issue } from './types/issues.js';
|
|
2
|
+
import type { Catalog, Catalogs, PackageJson } from './types/package-json.js';
|
|
3
|
+
import type { MainOptions } from './util/create-options.js';
|
|
4
|
+
export type CatalogContainer = {
|
|
5
|
+
filePath: string;
|
|
6
|
+
catalog?: Catalog;
|
|
7
|
+
catalogs?: Catalogs;
|
|
8
|
+
};
|
|
9
|
+
export declare class CatalogCounselor {
|
|
10
|
+
private filePath;
|
|
11
|
+
private entries;
|
|
12
|
+
private referencedEntries;
|
|
13
|
+
private fileContent?;
|
|
14
|
+
constructor(options: MainOptions);
|
|
15
|
+
private addReferencedCatalogEntry;
|
|
16
|
+
addWorkspace(manifest: PackageJson): void;
|
|
17
|
+
settleCatalogIssues(options: MainOptions): Promise<Issue[]>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { ROOT_WORKSPACE_NAME } from './constants.js';
|
|
3
|
+
import { JsonCatalogPeeker } from './JsonCatalogPeeker.js';
|
|
4
|
+
import { extractCatalogReferences, parseCatalog } from './util/catalog.js';
|
|
5
|
+
import { extname } from './util/path.js';
|
|
6
|
+
import { YamlCatalogPeeker } from './YamlCatalogPeeker.js';
|
|
7
|
+
export class CatalogCounselor {
|
|
8
|
+
filePath;
|
|
9
|
+
entries = new Set();
|
|
10
|
+
referencedEntries = new Set();
|
|
11
|
+
fileContent;
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.filePath = options.catalog.filePath;
|
|
14
|
+
this.entries = parseCatalog(options.catalog);
|
|
15
|
+
}
|
|
16
|
+
addReferencedCatalogEntry(entryName) {
|
|
17
|
+
this.referencedEntries.add(entryName);
|
|
18
|
+
}
|
|
19
|
+
addWorkspace(manifest) {
|
|
20
|
+
if (this.entries.size === 0)
|
|
21
|
+
return;
|
|
22
|
+
const catalogReferences = extractCatalogReferences(manifest);
|
|
23
|
+
for (const catalogEntryName of catalogReferences)
|
|
24
|
+
this.addReferencedCatalogEntry(catalogEntryName);
|
|
25
|
+
}
|
|
26
|
+
async settleCatalogIssues(options) {
|
|
27
|
+
if (this.entries.size === 0)
|
|
28
|
+
return [];
|
|
29
|
+
const filePath = this.filePath;
|
|
30
|
+
const workspace = ROOT_WORKSPACE_NAME;
|
|
31
|
+
const catalogIssues = [];
|
|
32
|
+
if (this.entries.size > this.referencedEntries.size) {
|
|
33
|
+
this.fileContent = await readFile(filePath, 'utf-8');
|
|
34
|
+
const isYaml = ['.yml', '.yaml'].includes(extname(filePath));
|
|
35
|
+
const Peeker = isYaml ? YamlCatalogPeeker : JsonCatalogPeeker;
|
|
36
|
+
const peeker = new Peeker(this.fileContent);
|
|
37
|
+
for (const entry of this.entries.keys()) {
|
|
38
|
+
if (!this.referencedEntries.has(entry)) {
|
|
39
|
+
const [parentSymbol, symbol] = entry.split(':');
|
|
40
|
+
const pos = peeker.getLocation(parentSymbol, symbol);
|
|
41
|
+
const fixes = [];
|
|
42
|
+
if (options.isFix && isYaml && pos)
|
|
43
|
+
fixes.push([pos.line, 0, 0]);
|
|
44
|
+
catalogIssues.push({ type: 'catalog', filePath, workspace, symbol, parentSymbol, fixes, ...pos });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return catalogIssues;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -277,6 +277,11 @@ export declare class ConfigurationChief {
|
|
|
277
277
|
entry?: string | string[] | undefined;
|
|
278
278
|
project?: string | string[] | undefined;
|
|
279
279
|
} | undefined;
|
|
280
|
+
mdx?: string | boolean | string[] | {
|
|
281
|
+
config?: string | string[] | undefined;
|
|
282
|
+
entry?: string | string[] | undefined;
|
|
283
|
+
project?: string | string[] | undefined;
|
|
284
|
+
} | undefined;
|
|
280
285
|
mdxlint?: string | boolean | string[] | {
|
|
281
286
|
config?: string | string[] | undefined;
|
|
282
287
|
entry?: string | string[] | undefined;
|
|
@@ -703,6 +708,7 @@ export declare class ConfigurationChief {
|
|
|
703
708
|
"lockfile-lint"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
704
709
|
"lost-pixel"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
705
710
|
markdownlint?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
711
|
+
mdx?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
706
712
|
mdxlint?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
707
713
|
metro?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
708
714
|
mocha?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
@@ -179,9 +179,11 @@ export class ConfigurationChief {
|
|
|
179
179
|
}
|
|
180
180
|
getAvailableWorkspaceNames(names) {
|
|
181
181
|
const availableWorkspaceNames = [];
|
|
182
|
+
const [ignore, patterns] = partition(this.ignoredWorkspacePatterns, pattern => pattern.startsWith('!'));
|
|
182
183
|
for (const name of names) {
|
|
183
|
-
if (!picomatch.isMatch(name,
|
|
184
|
+
if (!picomatch.isMatch(name, patterns, { ignore: ignore.map(pattern => pattern.slice(1)) })) {
|
|
184
185
|
availableWorkspaceNames.push(name);
|
|
186
|
+
}
|
|
185
187
|
}
|
|
186
188
|
return availableWorkspaceNames;
|
|
187
189
|
}
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -213,15 +213,22 @@ export class DependencyDeputy {
|
|
|
213
213
|
const isNotReferencedDependency = (dependency) => !isReferencedDependency(dependency, false);
|
|
214
214
|
for (const symbol of this.getProductionDependencies(workspace).filter(isNotReferencedDependency)) {
|
|
215
215
|
const position = peeker.getLocation('dependencies', symbol);
|
|
216
|
-
dependencyIssues.push({ type: 'dependencies', workspace, filePath, symbol, ...position });
|
|
216
|
+
dependencyIssues.push({ type: 'dependencies', workspace, filePath, symbol, fixes: [], ...position });
|
|
217
217
|
}
|
|
218
218
|
for (const symbol of this.getDevDependencies(workspace).filter(isNotReferencedDependency)) {
|
|
219
219
|
const position = peeker.getLocation('devDependencies', symbol);
|
|
220
|
-
devDependencyIssues.push({ type: 'devDependencies', filePath, workspace, symbol, ...position });
|
|
220
|
+
devDependencyIssues.push({ type: 'devDependencies', filePath, workspace, symbol, fixes: [], ...position });
|
|
221
221
|
}
|
|
222
222
|
for (const symbol of this.getOptionalPeerDependencies(workspace).filter(d => isReferencedDependency(d))) {
|
|
223
223
|
const pos = peeker.getLocation('optionalPeerDependencies', symbol);
|
|
224
|
-
optionalPeerDependencyIssues.push({
|
|
224
|
+
optionalPeerDependencyIssues.push({
|
|
225
|
+
type: 'optionalPeerDependencies',
|
|
226
|
+
filePath,
|
|
227
|
+
workspace,
|
|
228
|
+
symbol,
|
|
229
|
+
fixes: [],
|
|
230
|
+
...pos,
|
|
231
|
+
});
|
|
225
232
|
}
|
|
226
233
|
}
|
|
227
234
|
return { dependencyIssues, devDependencyIssues, optionalPeerDependencyIssues };
|
package/dist/IssueFixer.d.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import type { Fix, Fixes } from './types/exports.js';
|
|
2
1
|
import type { Issues } from './types/issues.js';
|
|
3
2
|
import type { MainOptions } from './util/create-options.js';
|
|
4
3
|
export declare class IssueFixer {
|
|
5
4
|
options: MainOptions;
|
|
6
|
-
unusedTypeNodes: Map<string, Set<Fix>>;
|
|
7
|
-
unusedExportNodes: Map<string, Set<Fix>>;
|
|
8
5
|
constructor(options: MainOptions);
|
|
9
|
-
addUnusedTypeNode(filePath: string, fixes: Fixes | undefined): void;
|
|
10
|
-
addUnusedExportNode(filePath: string, fixes: Fixes | undefined): void;
|
|
11
6
|
fixIssues(issues: Issues): Promise<Set<string>>;
|
|
12
|
-
private markExportFixed;
|
|
13
7
|
private removeUnusedFiles;
|
|
14
8
|
private removeUnusedExports;
|
|
15
9
|
private removeUnusedDependencies;
|
|
10
|
+
private removeUnusedCatalogEntries;
|
|
16
11
|
}
|
package/dist/IssueFixer.js
CHANGED
|
@@ -1,32 +1,13 @@
|
|
|
1
1
|
import { readFile, rm, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { DEFAULT_CATALOG } from './util/catalog.js';
|
|
2
3
|
import { load, save } from './util/package-json.js';
|
|
3
|
-
import {
|
|
4
|
+
import { extname, join } from './util/path.js';
|
|
4
5
|
import { removeExport } from './util/remove-export.js';
|
|
5
6
|
export class IssueFixer {
|
|
6
7
|
options;
|
|
7
|
-
unusedTypeNodes = new Map();
|
|
8
|
-
unusedExportNodes = new Map();
|
|
9
8
|
constructor(options) {
|
|
10
9
|
this.options = options;
|
|
11
10
|
}
|
|
12
|
-
addUnusedTypeNode(filePath, fixes) {
|
|
13
|
-
if (!fixes || fixes.length === 0)
|
|
14
|
-
return;
|
|
15
|
-
if (this.unusedTypeNodes.has(filePath))
|
|
16
|
-
for (const fix of fixes)
|
|
17
|
-
this.unusedTypeNodes.get(filePath)?.add(fix);
|
|
18
|
-
else
|
|
19
|
-
this.unusedTypeNodes.set(filePath, new Set(fixes));
|
|
20
|
-
}
|
|
21
|
-
addUnusedExportNode(filePath, fixes) {
|
|
22
|
-
if (!fixes || fixes.length === 0)
|
|
23
|
-
return;
|
|
24
|
-
if (this.unusedExportNodes.has(filePath))
|
|
25
|
-
for (const fix of fixes)
|
|
26
|
-
this.unusedExportNodes.get(filePath)?.add(fix);
|
|
27
|
-
else
|
|
28
|
-
this.unusedExportNodes.set(filePath, new Set(fixes));
|
|
29
|
-
}
|
|
30
11
|
async fixIssues(issues) {
|
|
31
12
|
const touchedFiles = new Set();
|
|
32
13
|
await this.removeUnusedFiles(issues);
|
|
@@ -34,20 +15,10 @@ export class IssueFixer {
|
|
|
34
15
|
touchedFiles.add(filePath);
|
|
35
16
|
for (const filePath of await this.removeUnusedDependencies(issues))
|
|
36
17
|
touchedFiles.add(filePath);
|
|
18
|
+
for (const filePath of await this.removeUnusedCatalogEntries(issues))
|
|
19
|
+
touchedFiles.add(filePath);
|
|
37
20
|
return touchedFiles;
|
|
38
21
|
}
|
|
39
|
-
markExportFixed(issues, filePath) {
|
|
40
|
-
const relPath = relative(this.options.cwd, filePath);
|
|
41
|
-
const types = [
|
|
42
|
-
...(this.options.isFixUnusedTypes ? ['types', 'nsTypes', 'classMembers', 'enumMembers'] : []),
|
|
43
|
-
...(this.options.isFixUnusedExports ? ['exports', 'nsExports'] : []),
|
|
44
|
-
];
|
|
45
|
-
for (const type of types) {
|
|
46
|
-
for (const id in issues[type][relPath]) {
|
|
47
|
-
issues[type][relPath][id].isFixed = true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
22
|
async removeUnusedFiles(issues) {
|
|
52
23
|
if (!this.options.isFixFiles)
|
|
53
24
|
return;
|
|
@@ -58,18 +29,33 @@ export class IssueFixer {
|
|
|
58
29
|
}
|
|
59
30
|
async removeUnusedExports(issues) {
|
|
60
31
|
const touchedFiles = new Set();
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
32
|
+
const types = [
|
|
33
|
+
...(this.options.isFixUnusedTypes ? ['types', 'nsTypes', 'classMembers', 'enumMembers'] : []),
|
|
34
|
+
...(this.options.isFixUnusedExports ? ['exports', 'nsExports'] : []),
|
|
35
|
+
];
|
|
36
|
+
if (types.length === 0)
|
|
37
|
+
return touchedFiles;
|
|
38
|
+
const allFixes = new Map();
|
|
39
|
+
for (const type of types) {
|
|
40
|
+
for (const [filePath, issueMap] of Object.entries(issues[type])) {
|
|
41
|
+
const fixes = allFixes.get(filePath) ?? [];
|
|
42
|
+
for (const issue of Object.values(issueMap))
|
|
43
|
+
fixes.push(...issue.fixes);
|
|
44
|
+
allFixes.set(filePath, fixes);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
for (const [filePath, fixes] of allFixes) {
|
|
48
|
+
const absFilePath = join(this.options.cwd, filePath);
|
|
49
|
+
const sourceFileText = fixes
|
|
50
|
+
.sort((a, b) => b[0] - a[0])
|
|
51
|
+
.reduce((text, [start, end, flags]) => removeExport({ text, start, end, flags }), await readFile(absFilePath, 'utf-8'));
|
|
52
|
+
await writeFile(absFilePath, sourceFileText);
|
|
53
|
+
touchedFiles.add(absFilePath);
|
|
54
|
+
for (const type of types) {
|
|
55
|
+
const issueMap = issues[type]?.[filePath];
|
|
56
|
+
if (issueMap)
|
|
57
|
+
for (const issue of Object.values(issueMap))
|
|
58
|
+
issue.isFixed = true;
|
|
73
59
|
}
|
|
74
60
|
}
|
|
75
61
|
return touchedFiles;
|
|
@@ -99,7 +85,50 @@ export class IssueFixer {
|
|
|
99
85
|
}
|
|
100
86
|
}
|
|
101
87
|
await save(absFilePath, pkg);
|
|
102
|
-
touchedFiles.add(
|
|
88
|
+
touchedFiles.add(absFilePath);
|
|
89
|
+
}
|
|
90
|
+
return touchedFiles;
|
|
91
|
+
}
|
|
92
|
+
async removeUnusedCatalogEntries(issues) {
|
|
93
|
+
const touchedFiles = new Set();
|
|
94
|
+
if (!this.options.isFixCatalog)
|
|
95
|
+
return touchedFiles;
|
|
96
|
+
const filePaths = new Set(Object.keys(issues.catalog));
|
|
97
|
+
for (const filePath of filePaths) {
|
|
98
|
+
if (['.yml', '.yaml'].includes(extname(filePath))) {
|
|
99
|
+
const absFilePath = join(this.options.cwd, filePath);
|
|
100
|
+
const fileContent = await readFile(absFilePath, 'utf-8');
|
|
101
|
+
const issuesForFile = Object.values(issues.catalog[filePath]);
|
|
102
|
+
const takeLine = (issue) => issue.fixes.map(fix => fix[0]);
|
|
103
|
+
const remove = new Set(issuesForFile.flatMap(takeLine));
|
|
104
|
+
const keep = (_, i) => !remove.has(i + 1);
|
|
105
|
+
await writeFile(absFilePath, fileContent.split('\n').filter(keep).join('\n'));
|
|
106
|
+
for (const issue of issuesForFile)
|
|
107
|
+
issue.isFixed = true;
|
|
108
|
+
touchedFiles.add(filePath);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
const absFilePath = join(this.options.cwd, filePath);
|
|
112
|
+
const pkg = await load(absFilePath);
|
|
113
|
+
const catalog = pkg.catalog || (!Array.isArray(pkg.workspaces) && pkg.workspaces?.catalog);
|
|
114
|
+
const catalogs = pkg.catalogs || (!Array.isArray(pkg.workspaces) && pkg.workspaces?.catalogs);
|
|
115
|
+
for (const [key, issue] of Object.entries(issues.catalog[filePath])) {
|
|
116
|
+
if (issue.parentSymbol === DEFAULT_CATALOG) {
|
|
117
|
+
if (catalog) {
|
|
118
|
+
delete catalog[issue.symbol];
|
|
119
|
+
issues.catalog[filePath][key].isFixed = true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
if (catalogs && issue.parentSymbol) {
|
|
124
|
+
delete catalogs[issue.parentSymbol][issue.symbol];
|
|
125
|
+
issues.catalog[filePath][key].isFixed = true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
await save(absFilePath, pkg);
|
|
130
|
+
touchedFiles.add(absFilePath);
|
|
131
|
+
}
|
|
103
132
|
}
|
|
104
133
|
return touchedFiles;
|
|
105
134
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class JsonCatalogPeeker {
|
|
2
|
+
private fileContent;
|
|
3
|
+
private lines;
|
|
4
|
+
private sections;
|
|
5
|
+
private ready;
|
|
6
|
+
constructor(fileContent: string);
|
|
7
|
+
private init;
|
|
8
|
+
getLocation(parentSymbol: string, symbol: string): {
|
|
9
|
+
line: number;
|
|
10
|
+
col: number;
|
|
11
|
+
} | undefined;
|
|
12
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { DEFAULT_CATALOG } from './util/catalog.js';
|
|
2
|
+
export class JsonCatalogPeeker {
|
|
3
|
+
fileContent;
|
|
4
|
+
lines = [];
|
|
5
|
+
sections = {};
|
|
6
|
+
ready = false;
|
|
7
|
+
constructor(fileContent) {
|
|
8
|
+
this.fileContent = fileContent;
|
|
9
|
+
}
|
|
10
|
+
init() {
|
|
11
|
+
this.lines = this.fileContent.split('\n');
|
|
12
|
+
let inCatalogs = false;
|
|
13
|
+
let catalogName;
|
|
14
|
+
let braceLevel = 0;
|
|
15
|
+
for (let i = 0; i < this.lines.length; i++) {
|
|
16
|
+
const line = this.lines[i];
|
|
17
|
+
const trimmedLine = line.trim();
|
|
18
|
+
if (catalogName) {
|
|
19
|
+
if (line.includes('{'))
|
|
20
|
+
braceLevel++;
|
|
21
|
+
if (line.includes('}'))
|
|
22
|
+
braceLevel--;
|
|
23
|
+
if (braceLevel === 0) {
|
|
24
|
+
this.sections[catalogName].end = i;
|
|
25
|
+
catalogName = undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else if (trimmedLine.startsWith('"catalog":')) {
|
|
29
|
+
catalogName = DEFAULT_CATALOG;
|
|
30
|
+
this.sections[catalogName] = { start: i, end: 0 };
|
|
31
|
+
braceLevel = (line.match(/{/g) ?? []).length - (line.match(/}/g) ?? []).length;
|
|
32
|
+
if (braceLevel === 0) {
|
|
33
|
+
this.sections[catalogName].end = i;
|
|
34
|
+
catalogName = undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else if (trimmedLine.startsWith('"catalogs":')) {
|
|
38
|
+
inCatalogs = true;
|
|
39
|
+
}
|
|
40
|
+
else if (inCatalogs) {
|
|
41
|
+
if (trimmedLine.startsWith('}')) {
|
|
42
|
+
inCatalogs = false;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const match = trimmedLine.match(/"(.*?)"/);
|
|
46
|
+
if (match) {
|
|
47
|
+
catalogName = match[1];
|
|
48
|
+
this.sections[catalogName] = { start: i, end: 0 };
|
|
49
|
+
braceLevel = (line.match(/{/g) ?? []).length - (line.match(/}/g) ?? []).length;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
this.ready = true;
|
|
54
|
+
}
|
|
55
|
+
getLocation(parentSymbol, symbol) {
|
|
56
|
+
if (!this.ready)
|
|
57
|
+
this.init();
|
|
58
|
+
const section = this.sections[parentSymbol];
|
|
59
|
+
if (!section)
|
|
60
|
+
return;
|
|
61
|
+
for (let i = section.start + 1; i < section.end; i++) {
|
|
62
|
+
const line = this.lines[i];
|
|
63
|
+
if (line.trim().startsWith(`"${symbol}":`)) {
|
|
64
|
+
return { line: i + 1, col: line.indexOf(`"${symbol}"`) + 1 };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
package/dist/PackagePeeker.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class YamlCatalogPeeker {
|
|
2
|
+
private fileContent;
|
|
3
|
+
private lines;
|
|
4
|
+
private sections;
|
|
5
|
+
private ready;
|
|
6
|
+
constructor(fileContent: string);
|
|
7
|
+
private init;
|
|
8
|
+
getLocation(parentSymbol: string, symbol: string): {
|
|
9
|
+
line: number;
|
|
10
|
+
col: number;
|
|
11
|
+
} | undefined;
|
|
12
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DEFAULT_CATALOG } from './util/catalog.js';
|
|
2
|
+
function matchesKey(line, indent, key) {
|
|
3
|
+
return (line.startsWith(`${indent}${key}:`) ||
|
|
4
|
+
line.startsWith(`${indent}"${key}":`) ||
|
|
5
|
+
line.startsWith(`${indent}'${key}':`));
|
|
6
|
+
}
|
|
7
|
+
export class YamlCatalogPeeker {
|
|
8
|
+
fileContent;
|
|
9
|
+
lines = [];
|
|
10
|
+
sections = {};
|
|
11
|
+
ready = false;
|
|
12
|
+
constructor(fileContent) {
|
|
13
|
+
this.fileContent = fileContent;
|
|
14
|
+
}
|
|
15
|
+
init() {
|
|
16
|
+
this.lines = this.fileContent.split('\n');
|
|
17
|
+
for (let i = 0; i < this.lines.length; i++) {
|
|
18
|
+
const line = this.lines[i];
|
|
19
|
+
if (line.startsWith('catalog:')) {
|
|
20
|
+
this.sections.catalog = i;
|
|
21
|
+
}
|
|
22
|
+
else if (line.startsWith('catalogs:')) {
|
|
23
|
+
this.sections.catalogs = i;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
this.ready = true;
|
|
27
|
+
}
|
|
28
|
+
getLocation(parentSymbol, symbol) {
|
|
29
|
+
if (!this.ready)
|
|
30
|
+
this.init();
|
|
31
|
+
const isDefault = parentSymbol === DEFAULT_CATALOG;
|
|
32
|
+
const startLine = this.sections[isDefault ? 'catalog' : 'catalogs'];
|
|
33
|
+
if (typeof startLine === 'undefined')
|
|
34
|
+
return;
|
|
35
|
+
if (isDefault) {
|
|
36
|
+
for (let i = startLine + 1; i < this.lines.length; i++) {
|
|
37
|
+
const line = this.lines[i];
|
|
38
|
+
if (!line.startsWith(' '))
|
|
39
|
+
break;
|
|
40
|
+
if (matchesKey(line, ' ', symbol)) {
|
|
41
|
+
return { line: i + 1, col: line.indexOf(symbol) + 1 };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
let inTargetCatalog = false;
|
|
47
|
+
for (let i = startLine + 1; i < this.lines.length; i++) {
|
|
48
|
+
const line = this.lines[i];
|
|
49
|
+
if (!line.startsWith(' '))
|
|
50
|
+
break;
|
|
51
|
+
if (matchesKey(line, ' ', parentSymbol)) {
|
|
52
|
+
inTargetCatalog = true;
|
|
53
|
+
}
|
|
54
|
+
else if (inTargetCatalog) {
|
|
55
|
+
if (!line.startsWith(' ')) {
|
|
56
|
+
inTargetCatalog = false;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (matchesKey(line, ' ', symbol)) {
|
|
60
|
+
return { line: i + 1, col: line.indexOf(symbol) + 1 };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -17,7 +17,7 @@ export const getDependenciesFromScript = (script, options) => {
|
|
|
17
17
|
if (!script)
|
|
18
18
|
return [];
|
|
19
19
|
const fromArgs = (args, opts) => {
|
|
20
|
-
if (args.length === 0 || !isValidBinary(args[0]))
|
|
20
|
+
if (args.length === 0 || !isValidBinary(args[0].split(' ')[0]))
|
|
21
21
|
return [];
|
|
22
22
|
return getDependenciesFromScript(args.filter(arg => arg !== '--').join(' '), {
|
|
23
23
|
...options,
|
|
@@ -229,6 +229,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
229
229
|
entry?: string | string[] | undefined;
|
|
230
230
|
project?: string | string[] | undefined;
|
|
231
231
|
} | undefined;
|
|
232
|
+
mdx?: string | boolean | string[] | {
|
|
233
|
+
config?: string | string[] | undefined;
|
|
234
|
+
entry?: string | string[] | undefined;
|
|
235
|
+
project?: string | string[] | undefined;
|
|
236
|
+
} | undefined;
|
|
232
237
|
mdxlint?: string | boolean | string[] | {
|
|
233
238
|
config?: string | string[] | undefined;
|
|
234
239
|
entry?: string | string[] | undefined;
|
|
@@ -815,6 +820,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
815
820
|
entry?: string | string[] | undefined;
|
|
816
821
|
project?: string | string[] | undefined;
|
|
817
822
|
} | undefined;
|
|
823
|
+
mdx?: string | boolean | string[] | {
|
|
824
|
+
config?: string | string[] | undefined;
|
|
825
|
+
entry?: string | string[] | undefined;
|
|
826
|
+
project?: string | string[] | undefined;
|
|
827
|
+
} | undefined;
|
|
818
828
|
mdxlint?: string | boolean | string[] | {
|
|
819
829
|
config?: string | string[] | undefined;
|
|
820
830
|
entry?: string | string[] | undefined;
|
|
@@ -1186,10 +1196,10 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1186
1196
|
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
1187
1197
|
includeEntryExports?: boolean | undefined;
|
|
1188
1198
|
}> | undefined;
|
|
1189
|
-
include?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates")[] | undefined;
|
|
1190
|
-
exclude?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates")[] | undefined;
|
|
1199
|
+
include?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates" | "catalog")[] | undefined;
|
|
1200
|
+
exclude?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates" | "catalog")[] | undefined;
|
|
1191
1201
|
$schema?: string | undefined;
|
|
1192
|
-
rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates", "error" | "warn" | "off">> | undefined;
|
|
1202
|
+
rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates" | "catalog", "error" | "warn" | "off">> | undefined;
|
|
1193
1203
|
entry?: string | string[] | undefined;
|
|
1194
1204
|
project?: string | string[] | undefined;
|
|
1195
1205
|
paths?: Record<string, string[]> | undefined;
|
|
@@ -1200,7 +1210,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1200
1210
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
1201
1211
|
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
1202
1212
|
ignoreExportsUsedInFile?: boolean | Record<string, boolean | undefined> | undefined;
|
|
1203
|
-
ignoreIssues?: Record<string, ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates")[]> | undefined;
|
|
1213
|
+
ignoreIssues?: Record<string, ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates" | "catalog")[]> | undefined;
|
|
1204
1214
|
ignoreWorkspaces?: string[] | undefined;
|
|
1205
1215
|
includeEntryExports?: boolean | undefined;
|
|
1206
1216
|
compilers?: Record<string, true | ((filename: string, contents: string) => string) | ((filename: string, contents: string) => Promise<string>)> | undefined;
|
package/dist/constants.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const IGNORED_DEPENDENCIES: Set<string>;
|
|
|
15
15
|
export declare const IGNORED_RUNTIME_DEPENDENCIES: Set<string>;
|
|
16
16
|
export declare const FOREIGN_FILE_EXTENSIONS: Set<string>;
|
|
17
17
|
export declare const IGNORE_DEFINITELY_TYPED: Set<string>;
|
|
18
|
-
export declare const ISSUE_TYPES: readonly ["files", "dependencies", "devDependencies", "optionalPeerDependencies", "unlisted", "binaries", "unresolved", "exports", "nsExports", "types", "nsTypes", "enumMembers", "classMembers", "duplicates"];
|
|
18
|
+
export declare const ISSUE_TYPES: readonly ["files", "dependencies", "devDependencies", "optionalPeerDependencies", "unlisted", "binaries", "unresolved", "exports", "nsExports", "types", "nsTypes", "enumMembers", "classMembers", "duplicates", "catalog"];
|
|
19
19
|
export declare const ISSUE_TYPE_TITLE: {
|
|
20
20
|
readonly files: "Unused files";
|
|
21
21
|
readonly _files: "Unused files";
|
|
@@ -32,6 +32,7 @@ export declare const ISSUE_TYPE_TITLE: {
|
|
|
32
32
|
readonly enumMembers: "Unused exported enum members";
|
|
33
33
|
readonly classMembers: "Unused exported class members";
|
|
34
34
|
readonly duplicates: "Duplicate exports";
|
|
35
|
+
readonly catalog: "Unused catalog entries";
|
|
35
36
|
};
|
|
36
37
|
export declare const SYMBOL_TYPE: {
|
|
37
38
|
readonly CLASS: "class";
|
|
@@ -49,3 +50,10 @@ export declare const FIX_FLAGS: {
|
|
|
49
50
|
readonly EMPTY_DECLARATION: number;
|
|
50
51
|
readonly WITH_NEWLINE: number;
|
|
51
52
|
};
|
|
53
|
+
export declare const IMPORT_MODIFIERS: {
|
|
54
|
+
readonly NONE: 0;
|
|
55
|
+
readonly RE_EXPORT: number;
|
|
56
|
+
readonly TYPE_ONLY: number;
|
|
57
|
+
readonly ENTRY: number;
|
|
58
|
+
readonly OPTIONAL: number;
|
|
59
|
+
};
|
package/dist/constants.js
CHANGED
|
@@ -172,6 +172,7 @@ export const ISSUE_TYPES = [
|
|
|
172
172
|
'enumMembers',
|
|
173
173
|
'classMembers',
|
|
174
174
|
'duplicates',
|
|
175
|
+
'catalog',
|
|
175
176
|
];
|
|
176
177
|
export const ISSUE_TYPE_TITLE = {
|
|
177
178
|
files: 'Unused files',
|
|
@@ -189,6 +190,7 @@ export const ISSUE_TYPE_TITLE = {
|
|
|
189
190
|
enumMembers: 'Unused exported enum members',
|
|
190
191
|
classMembers: 'Unused exported class members',
|
|
191
192
|
duplicates: 'Duplicate exports',
|
|
193
|
+
catalog: 'Unused catalog entries',
|
|
192
194
|
};
|
|
193
195
|
export const SYMBOL_TYPE = {
|
|
194
196
|
CLASS: 'class',
|
|
@@ -206,3 +208,10 @@ export const FIX_FLAGS = {
|
|
|
206
208
|
EMPTY_DECLARATION: 1 << 1,
|
|
207
209
|
WITH_NEWLINE: 1 << 2,
|
|
208
210
|
};
|
|
211
|
+
export const IMPORT_MODIFIERS = {
|
|
212
|
+
NONE: 0,
|
|
213
|
+
RE_EXPORT: 1 << 0,
|
|
214
|
+
TYPE_ONLY: 1 << 1,
|
|
215
|
+
ENTRY: 1 << 2,
|
|
216
|
+
OPTIONAL: 1 << 3,
|
|
217
|
+
};
|
package/dist/graph/analyze.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CatalogCounselor } from '../CatalogCounselor.js';
|
|
1
2
|
import type { ConfigurationChief } from '../ConfigurationChief.js';
|
|
2
3
|
import type { ConsoleStreamer } from '../ConsoleStreamer.js';
|
|
3
4
|
import type { DependencyDeputy } from '../DependencyDeputy.js';
|
|
@@ -8,6 +9,7 @@ import type { ModuleGraph } from '../types/module-graph.js';
|
|
|
8
9
|
import type { MainOptions } from '../util/create-options.js';
|
|
9
10
|
interface AnalyzeOptions {
|
|
10
11
|
analyzedFiles: Set<string>;
|
|
12
|
+
counselor: CatalogCounselor;
|
|
11
13
|
chief: ConfigurationChief;
|
|
12
14
|
collector: IssueCollector;
|
|
13
15
|
deputy: DependencyDeputy;
|
|
@@ -19,5 +21,5 @@ interface AnalyzeOptions {
|
|
|
19
21
|
unreferencedFiles: Set<string>;
|
|
20
22
|
options: MainOptions;
|
|
21
23
|
}
|
|
22
|
-
export declare const analyze: ({ analyzedFiles, chief, collector, deputy, entryPaths, factory,
|
|
24
|
+
export declare const analyze: ({ analyzedFiles, counselor, chief, collector, deputy, entryPaths, factory, graph, streamer, unreferencedFiles, options, }: AnalyzeOptions) => Promise<() => Promise<void>>;
|
|
23
25
|
export {};
|