knip 5.67.0 → 5.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -277,6 +277,11 @@ export declare class ConfigurationChief {
277
277
  entry?: string | string[] | undefined;
278
278
  project?: string | string[] | undefined;
279
279
  } | undefined;
280
+ mdxlint?: string | boolean | string[] | {
281
+ config?: string | string[] | undefined;
282
+ entry?: string | string[] | undefined;
283
+ project?: string | string[] | undefined;
284
+ } | undefined;
280
285
  metro?: string | boolean | string[] | {
281
286
  config?: string | string[] | undefined;
282
287
  entry?: string | string[] | undefined;
@@ -698,6 +703,7 @@ export declare class ConfigurationChief {
698
703
  "lockfile-lint"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
699
704
  "lost-pixel"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
700
705
  markdownlint?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
706
+ mdxlint?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
701
707
  metro?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
702
708
  mocha?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
703
709
  moonrepo?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
@@ -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
+ mdxlint?: string | boolean | string[] | {
233
+ config?: string | string[] | undefined;
234
+ entry?: string | string[] | undefined;
235
+ project?: string | string[] | undefined;
236
+ } | undefined;
232
237
  metro?: string | boolean | string[] | {
233
238
  config?: string | string[] | undefined;
234
239
  entry?: string | string[] | undefined;
@@ -810,6 +815,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
810
815
  entry?: string | string[] | undefined;
811
816
  project?: string | string[] | undefined;
812
817
  } | undefined;
818
+ mdxlint?: string | boolean | string[] | {
819
+ config?: string | string[] | undefined;
820
+ entry?: string | string[] | undefined;
821
+ project?: string | string[] | undefined;
822
+ } | undefined;
813
823
  metro?: string | boolean | string[] | {
814
824
  config?: string | string[] | undefined;
815
825
  entry?: string | string[] | undefined;
@@ -3,9 +3,10 @@ const directiveMatcher = /@(?:import|config|source|plugin)\s+['"]([^'"]+)['"][^;
3
3
  const compiler = (text) => {
4
4
  const imports = [];
5
5
  let match;
6
+ let index = 0;
6
7
  while ((match = directiveMatcher.exec(text)))
7
8
  if (match[1])
8
- imports.push(`import '${match[1]}';`);
9
+ imports.push(`import _$${index++} from '${match[1]}';`);
9
10
  return imports.join('\n');
10
11
  };
11
12
  export default { condition, compiler };
@@ -4,7 +4,7 @@ const title = 'CSpell';
4
4
  const enablers = ['cspell'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
6
  const config = [
7
- 'cspell.config.{js,cjs,json,yaml,yml}',
7
+ 'cspell.config.{js,cjs,mjs,ts,mts,json,yaml,yml}',
8
8
  'cspell.{json,yaml,yml}',
9
9
  '.c{s,S}pell.json',
10
10
  'c{s,S}pell.json',
@@ -349,6 +349,13 @@ export declare const Plugins: {
349
349
  config: string[];
350
350
  resolveConfig: import("../types/config.js").ResolveConfig<import("./markdownlint/types.js").MarkdownlintConfig>;
351
351
  };
352
+ mdxlint: {
353
+ title: string;
354
+ enablers: string[];
355
+ isEnabled: import("../types/config.js").IsPluginEnabled;
356
+ config: string[];
357
+ resolveConfig: import("../types/config.js").ResolveConfig<import("./mdxlint/types.js").MdxlintConfig>;
358
+ };
352
359
  metro: {
353
360
  title: string;
354
361
  enablers: string[];
@@ -43,6 +43,7 @@ import { default as linthtml } from './linthtml/index.js';
43
43
  import { default as lockfileLint } from './lockfile-lint/index.js';
44
44
  import { default as lostPixel } from './lost-pixel/index.js';
45
45
  import { default as markdownlint } from './markdownlint/index.js';
46
+ import { default as mdxlint } from './mdxlint/index.js';
46
47
  import { default as metro } from './metro/index.js';
47
48
  import { default as mocha } from './mocha/index.js';
48
49
  import { default as moonrepo } from './moonrepo/index.js';
@@ -160,6 +161,7 @@ export const Plugins = {
160
161
  'lockfile-lint': lockfileLint,
161
162
  'lost-pixel': lostPixel,
162
163
  markdownlint,
164
+ mdxlint,
163
165
  metro,
164
166
  mocha,
165
167
  moonrepo,
@@ -0,0 +1,10 @@
1
+ import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
+ import type { MdxlintConfig } from './types.js';
3
+ declare const _default: {
4
+ title: string;
5
+ enablers: string[];
6
+ isEnabled: IsPluginEnabled;
7
+ config: string[];
8
+ resolveConfig: ResolveConfig<MdxlintConfig>;
9
+ };
10
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import { toDeferResolve } from '../../util/input.js';
2
+ import { isInternal } from '../../util/path.js';
3
+ import { hasDependency } from '../../util/plugin.js';
4
+ const title = 'mdxlint';
5
+ const enablers = ['mdxlint'];
6
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
+ const config = ['.mdxlintrc', '.mdxlintrc.{json,js,cjs,mjs,yml,yaml}', 'package.json'];
8
+ const resolveConfig = config => {
9
+ const plugins = config.plugins
10
+ ?.flatMap(plugin => {
11
+ if (typeof plugin === 'string')
12
+ return plugin;
13
+ if (Array.isArray(plugin) && typeof plugin[0] === 'string')
14
+ return plugin[0];
15
+ return [];
16
+ })
17
+ .map(plugin => (isInternal(plugin) ? plugin : plugin.startsWith('remark-') || plugin.startsWith('mdxlint-') ? plugin : `mdxlint-${plugin}`)) ?? [];
18
+ return plugins.map(id => toDeferResolve(id));
19
+ };
20
+ export default {
21
+ title,
22
+ enablers,
23
+ isEnabled,
24
+ config,
25
+ resolveConfig,
26
+ };
@@ -0,0 +1,3 @@
1
+ export type MdxlintConfig = {
2
+ plugins?: (string | [string, unknown] | unknown)[];
3
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { toDeferResolve } from '../../util/input.js';
2
+ import { isInternal } from '../../util/path.js';
2
3
  import { hasDependency } from '../../util/plugin.js';
3
4
  const title = 'Remark';
4
5
  const enablers = ['remark-cli'];
@@ -14,7 +15,7 @@ const resolveConfig = config => {
14
15
  return plugin[0];
15
16
  return [];
16
17
  })
17
- .map(plugin => (plugin.startsWith('remark-') ? plugin : `remark-${plugin}`)) ?? [];
18
+ .map(plugin => (isInternal(plugin) ? plugin : plugin.startsWith('remark-') ? plugin : `remark-${plugin}`)) ?? [];
18
19
  return plugins.map(id => toDeferResolve(id));
19
20
  };
20
21
  export default {
@@ -1,3 +1,3 @@
1
1
  export type RemarkConfig = {
2
- plugins?: (string | [string, boolean] | unknown)[];
2
+ plugins?: (string | [string, unknown] | unknown)[];
3
3
  };
@@ -227,6 +227,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
227
227
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
228
228
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
229
229
  }, z.core.$strip>]>>;
230
+ mdxlint: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
231
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
232
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
233
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
234
+ }, z.core.$strip>]>>;
230
235
  metro: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
231
236
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
232
237
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -808,6 +813,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
808
813
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
809
814
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
810
815
  }, z.core.$strip>]>>;
816
+ mdxlint: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
817
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
818
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
819
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
820
+ }, z.core.$strip>]>>;
811
821
  metro: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
812
822
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
813
823
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -231,6 +231,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
231
231
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
232
232
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
233
233
  }, z.core.$strip>]>;
234
+ mdxlint: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
235
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
236
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
237
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
238
+ }, z.core.$strip>]>;
234
239
  metro: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
235
240
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
236
241
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -55,6 +55,7 @@ export const pluginsSchema = z.object({
55
55
  'lockfile-lint': pluginSchema,
56
56
  'lost-pixel': pluginSchema,
57
57
  markdownlint: pluginSchema,
58
+ mdxlint: pluginSchema,
58
59
  metro: pluginSchema,
59
60
  mocha: pluginSchema,
60
61
  moonrepo: pluginSchema,
@@ -1,2 +1,2 @@
1
- export type PluginName = 'angular' | 'astro' | 'astro-db' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
2
- export declare const pluginNames: readonly ["angular", "astro", "astro-db", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rslib", "rspack", "rstest", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "syncpack", "tailwind", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
1
+ export type PluginName = 'angular' | 'astro' | 'astro-db' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
2
+ export declare const pluginNames: readonly ["angular", "astro", "astro-db", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "mdxlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rslib", "rspack", "rstest", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "syncpack", "tailwind", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
@@ -44,6 +44,7 @@ export const pluginNames = [
44
44
  'lockfile-lint',
45
45
  'lost-pixel',
46
46
  'markdownlint',
47
+ 'mdxlint',
47
48
  'metro',
48
49
  'mocha',
49
50
  'moonrepo',
@@ -264,6 +264,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
264
264
  entry?: string | string[] | undefined;
265
265
  project?: string | string[] | undefined;
266
266
  } | undefined;
267
+ mdxlint?: string | boolean | string[] | {
268
+ config?: string | string[] | undefined;
269
+ entry?: string | string[] | undefined;
270
+ project?: string | string[] | undefined;
271
+ } | undefined;
267
272
  metro?: string | boolean | string[] | {
268
273
  config?: string | string[] | undefined;
269
274
  entry?: string | string[] | undefined;
@@ -845,6 +850,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
845
850
  entry?: string | string[] | undefined;
846
851
  project?: string | string[] | undefined;
847
852
  } | undefined;
853
+ mdxlint?: string | boolean | string[] | {
854
+ config?: string | string[] | undefined;
855
+ entry?: string | string[] | undefined;
856
+ project?: string | string[] | undefined;
857
+ } | undefined;
848
858
  metro?: string | boolean | string[] | {
849
859
  config?: string | string[] | undefined;
850
860
  entry?: string | string[] | undefined;
@@ -38,24 +38,36 @@ export const getPackageFromDefinitelyTyped = (typedDependency) => {
38
38
  }
39
39
  return typedDependency;
40
40
  };
41
+ const CHAR_EXCLAMATION = 33;
42
+ const CHAR_DASH = 45;
43
+ const CHAR_SLASH = 47;
44
+ const CHAR_COLON = 58;
45
+ const CHAR_HASH = 35;
46
+ const CHAR_QUESTION = 63;
41
47
  export const sanitizeSpecifier = (specifier) => {
42
48
  if (isBuiltin(specifier) || isAbsolute(specifier) || specifier.startsWith(PROTOCOL_VIRTUAL))
43
49
  return specifier;
44
- let s = specifier;
45
- let end = s.length;
46
- let i = 0;
47
- while (i < s.length && (s[i] === '!' || s[i] === '-'))
48
- i++;
49
- s = s.substring(i);
50
- for (let j = 0; j < s.length; j++) {
51
- const char = s[j];
52
- if (char === '!' || char === '?' || (char === '#' && j > 0)) {
53
- end = j;
50
+ const len = specifier.length;
51
+ let start = 0;
52
+ let end = len;
53
+ let colon = -1;
54
+ let sawSlash = false;
55
+ for (let i = 0; i < len; i++) {
56
+ const ch = specifier.charCodeAt(i);
57
+ if (i === start && (ch === CHAR_EXCLAMATION || ch === CHAR_DASH)) {
58
+ start++;
59
+ continue;
60
+ }
61
+ if (ch === CHAR_SLASH && colon === -1) {
62
+ sawSlash = true;
63
+ }
64
+ if (colon === -1 && ch === CHAR_COLON && !sawSlash) {
65
+ colon = i;
66
+ }
67
+ if (ch === CHAR_EXCLAMATION || ch === CHAR_QUESTION || (ch === CHAR_HASH && i > start)) {
68
+ end = i;
54
69
  break;
55
70
  }
56
71
  }
57
- s = s.substring(0, end);
58
- if (s.includes(':') && !s.includes('/'))
59
- s = s.split(':')[0];
60
- return s;
72
+ return colon !== -1 && colon < end ? specifier.slice(start, colon) : specifier.slice(start, end);
61
73
  };
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.67.0";
1
+ export declare const version = "5.68.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.67.0';
1
+ export const version = '5.68.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.67.0",
3
+ "version": "5.68.0",
4
4
  "description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {
package/schema.json CHANGED
@@ -22,29 +22,19 @@
22
22
  ],
23
23
  "properties": {
24
24
  "ignoreBinaries": {
25
- "title": "Binaries to exclude from the report (regex allowed)",
26
- "examples": ["rm", "docker-compose", "curl"],
27
- "$ref": "#/definitions/list"
25
+ "$ref": "#/definitions/ignoreBinaries"
28
26
  },
29
27
  "ignoreDependencies": {
30
- "title": "Dependencies to exclude from the report (regex allowed)",
31
- "examples": ["husky", "lint-staged"],
32
- "$ref": "#/definitions/list"
28
+ "$ref": "#/definitions/ignoreDependencies"
33
29
  },
34
30
  "ignoreFiles": {
35
- "title": "Unused files to exclude from the report",
36
- "examples": ["husky", "lint-staged"],
37
- "$ref": "#/definitions/list"
31
+ "$ref": "#/definitions/ignoreFiles"
38
32
  },
39
33
  "ignoreMembers": {
40
- "title": "Class and enum members to exclude from the report (regex allowed)",
41
- "examples": ["render", "on.*"],
42
- "$ref": "#/definitions/list"
34
+ "$ref": "#/definitions/ignoreMembers"
43
35
  },
44
36
  "ignoreUnresolved": {
45
- "title": "Unresolved imports to exclude from the report (regex allowed)",
46
- "examples": ["#/virtual"],
47
- "$ref": "#/definitions/list"
37
+ "$ref": "#/definitions/ignoreUnresolved"
48
38
  },
49
39
  "ignoreWorkspaces": {
50
40
  "title": "Workspaces to exclude from the report",
@@ -120,8 +110,7 @@
120
110
  }
121
111
  },
122
112
  "includeEntryExports": {
123
- "title": "Include entry files when reporting unused exports",
124
- "type": "boolean"
113
+ "$ref": "#/definitions/includeEntryExports"
125
114
  },
126
115
  "tags": {
127
116
  "title": "Exclude (-) or include (+) exports with the specified JSDoc/TSDoc tags",
@@ -203,6 +192,36 @@
203
192
  "type": "string"
204
193
  }
205
194
  },
195
+ "ignoreBinaries": {
196
+ "title": "Binaries to exclude from the report (regex allowed)",
197
+ "examples": ["rm", "docker-compose", "curl"],
198
+ "$ref": "#/definitions/list"
199
+ },
200
+ "ignoreDependencies": {
201
+ "title": "Dependencies to exclude from the report (regex allowed)",
202
+ "examples": ["husky", "lint-staged"],
203
+ "$ref": "#/definitions/list"
204
+ },
205
+ "ignoreFiles": {
206
+ "title": "Unused files to exclude from the report",
207
+ "examples": ["husky", "lint-staged", "**/fixtures/**", "mocks/**"],
208
+ "default": [],
209
+ "$ref": "#/definitions/globPatterns"
210
+ },
211
+ "ignoreUnresolved": {
212
+ "title": "Unresolved imports to exclude from the report (regex allowed)",
213
+ "examples": ["#/virtual"],
214
+ "$ref": "#/definitions/list"
215
+ },
216
+ "includeEntryExports": {
217
+ "title": "Include entry files when reporting unused exports",
218
+ "type": "boolean"
219
+ },
220
+ "ignoreMembers": {
221
+ "title": "Class and enum members to exclude from the report (regex allowed)",
222
+ "examples": ["render", "on.*"],
223
+ "$ref": "#/definitions/list"
224
+ },
206
225
  "issueTypes": {
207
226
  "type": "array",
208
227
  "items": {
@@ -267,29 +286,22 @@
267
286
  "$ref": "#/definitions/globPatterns"
268
287
  },
269
288
  "ignoreFiles": {
270
- "title": "Unused files to exclude the report",
271
- "example": ["**/fixtures/**", "mocks/**"],
272
- "default": [],
273
- "$ref": "#/definitions/globPatterns"
289
+ "$ref": "#/definitions/ignoreFiles"
274
290
  },
275
291
  "ignoreBinaries": {
276
- "title": "Binaries to exclude from the report (regex allowed)",
277
- "examples": ["rm", "docker-compose", "curl"],
278
- "$ref": "#/definitions/list"
292
+ "$ref": "#/definitions/ignoreBinaries"
279
293
  },
280
294
  "ignoreDependencies": {
281
- "title": "Dependencies to exclude from the report (regex allowed)",
282
- "examples": ["husky", "lint-staged"],
283
- "$ref": "#/definitions/list"
295
+ "$ref": "#/definitions/ignoreDependencies"
296
+ },
297
+ "ignoreMembers": {
298
+ "$ref": "#/definitions/ignoreMembers"
284
299
  },
285
300
  "ignoreUnresolved": {
286
- "title": "Unresolved imports to exclude from the report (regex allowed)",
287
- "examples": ["#/virtual"],
288
- "$ref": "#/definitions/list"
301
+ "$ref": "#/definitions/ignoreUnresolved"
289
302
  },
290
303
  "includeEntryExports": {
291
- "title": "Include entry files when reporting unused exports",
292
- "type": "boolean"
304
+ "$ref": "#/definitions/includeEntryExports"
293
305
  }
294
306
  }
295
307
  },
@@ -502,6 +514,10 @@
502
514
  "title": "markdownlint plugin configuration (https://knip.dev/reference/plugins/markdownlint)",
503
515
  "$ref": "#/definitions/plugin"
504
516
  },
517
+ "mdxlint": {
518
+ "title": "mdxlint plugin configuration (https://knip.dev/reference/plugins/mdxlint)",
519
+ "$ref": "#/definitions/plugin"
520
+ },
505
521
  "metro": {
506
522
  "title": "metro plugin configuration (https://knip.dev/reference/plugins/metro)",
507
523
  "$ref": "#/definitions/plugin"