@adamhl8/configs 0.17.3 → 0.17.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"knip-preprocessor.d.ts","names":[],"sources":["../../src/configs/knip-preprocessor.ts"],"sourcesContent":[],"mappings":";;;cA4BM,YAAY"}
1
+ {"version":3,"file":"knip-preprocessor.d.ts","names":[],"sources":["../../src/configs/knip-preprocessor.ts"],"sourcesContent":[],"mappings":";;;cAyFM,YAAY"}
@@ -1,25 +1,24 @@
1
1
  import { knipConfig } from "./knip.js";
2
- const entries = knipConfig().entry;
3
- function filterIssues(options, issueType, filter) {
4
- const issuesObject = options.issues[issueType];
5
- const filteredIssues = Object.fromEntries(Object.entries(issuesObject).filter(filter));
6
- const issueCount = Object.keys(issuesObject).length;
7
- const filteredIssueCount = Object.keys(filteredIssues).length;
8
- const issuesRemovedCount = issueCount - filteredIssueCount;
9
- options.counters[issueType] = issueCount - issuesRemovedCount;
10
- options.issues[issueType] = filteredIssues;
2
+ function modifyIssues(options, issueType, mapFn) {
3
+ const originalIssues = options.issues[issueType];
4
+ const modifiedIssueEntries = Object.entries(originalIssues).map(([key, issueRecord]) => [key, Object.entries(issueRecord)]).map(([key, issueRecordEntries]) => [key, Object.fromEntries(mapFn([key, issueRecordEntries]))]);
5
+ const modifiedIssues = Object.fromEntries(modifiedIssueEntries);
6
+ const countIssues = (issueRecords) => Object.values(issueRecords).map((issueRecord) => Object.keys(issueRecord).length).reduce((acc, curr) => acc + curr, 0);
7
+ const originalIssueCount = countIssues(originalIssues);
8
+ const modifiedIssueCount = countIssues(modifiedIssues);
9
+ const issuesRemovedCount = originalIssueCount - modifiedIssueCount;
10
+ options.counters[issueType] = originalIssueCount - issuesRemovedCount;
11
+ options.issues[issueType] = modifiedIssues;
11
12
  }
13
+ const entries = knipConfig().entry;
12
14
  const preprocess = (options) => {
13
15
  const filteredConfigurationHints = [...options.configurationHints].filter((hint) => !(entries.some((entry) => typeof hint.identifier === "string" && hint.identifier.includes(entry)) && (hint.type === "entry-empty" || hint.type === "entry-redundant")));
14
16
  options.configurationHints = new Set(filteredConfigurationHints);
15
- filterIssues(options, "unlisted", ([key]) => !key.includes("prettier"));
16
- filterIssues(options, "unlisted", ([, issueObj]) => Object.keys(issueObj).length > 0);
17
- filterIssues(options, "types", ([key, issueObj]) => {
18
- if (key !== "src/configs/utils.ts") return true;
19
- const typeNames = Object.keys(issueObj);
17
+ modifyIssues(options, "unlisted", ([, issueRecordEntries]) => issueRecordEntries.filter(([key]) => !key.includes("prettier")));
18
+ modifyIssues(options, "types", ([filePath, issueRecordEntries]) => {
19
+ if (filePath !== "src/configs/utils.ts") return issueRecordEntries;
20
20
  const expectedTypeNames = ["MergeConfigFn", "OptionalMergeConfigFn"];
21
- if (typeNames.length !== expectedTypeNames.length) return true;
22
- return !expectedTypeNames.every((expectedTypeName) => typeNames.includes(expectedTypeName));
21
+ return issueRecordEntries.filter(([key]) => !expectedTypeNames.includes(key));
23
22
  });
24
23
  return options;
25
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"knip-preprocessor.js","names":["preprocess: Preprocessor"],"sources":["../../src/configs/knip-preprocessor.ts"],"sourcesContent":["import type { Preprocessor, ReporterOptions } from \"knip\"\nimport type { Issue, SymbolIssueType } from \"knip/dist/types/issues\"\n\nimport { knipConfig } from \"./knip.ts\"\n\nconst entries = knipConfig().entry as string[]\n\n/**\n * Filters issues based on the provided filter function.\n *\n * This is needed because we also need to update `options.counters` after filtering issues.\n */\nfunction filterIssues(\n options: ReporterOptions,\n issueType: SymbolIssueType,\n filter: (issueEntry: [string, Record<string, Issue>]) => boolean,\n) {\n const issuesObject = options.issues[issueType]\n const filteredIssues = Object.fromEntries(Object.entries(issuesObject).filter(filter))\n\n const issueCount = Object.keys(issuesObject).length\n const filteredIssueCount = Object.keys(filteredIssues).length\n const issuesRemovedCount = issueCount - filteredIssueCount\n\n options.counters[issueType] = issueCount - issuesRemovedCount\n options.issues[issueType] = filteredIssues\n}\n\nconst preprocess: Preprocessor = (options) => {\n // ignore the \"Refine entry pattern (no matches)\" configuration hints for entries in the base config\n const filteredConfigurationHints = [...options.configurationHints].filter(\n (hint) =>\n !(\n entries.some((entry) => typeof hint.identifier === \"string\" && hint.identifier.includes(entry)) &&\n (hint.type === \"entry-empty\" || hint.type === \"entry-redundant\")\n ),\n )\n options.configurationHints = new Set(filteredConfigurationHints)\n\n filterIssues(options, \"unlisted\", ([key]) => !key.includes(\"prettier\"))\n filterIssues(options, \"unlisted\", ([, issueObj]) => Object.keys(issueObj).length > 0)\n\n filterIssues(options, \"types\", ([key, issueObj]) => {\n if (key !== \"src/configs/utils.ts\") return true\n const typeNames = Object.keys(issueObj)\n // We need to bring these types into scope of each merge config module: https://github.com/microsoft/TypeScript/issues/5711\n const expectedTypeNames = [\"MergeConfigFn\", \"OptionalMergeConfigFn\"]\n if (typeNames.length !== expectedTypeNames.length) return true // don't filter out the issue if there are other types\n const foundAllExpectedTypeNames = expectedTypeNames.every((expectedTypeName) =>\n typeNames.includes(expectedTypeName),\n )\n const shouldFilterIssue = !foundAllExpectedTypeNames // if all the expected type names are found, we need to return false to filter out the issue\n return shouldFilterIssue\n })\n\n return options\n}\n\nexport default preprocess\n"],"mappings":";AAKA,MAAM,UAAU,YAAY,CAAC;AAO7B,SAAS,aACP,SACA,WACA,QACA;CACA,MAAM,eAAe,QAAQ,OAAO;CACpC,MAAM,iBAAiB,OAAO,YAAY,OAAO,QAAQ,aAAa,CAAC,OAAO,OAAO,CAAC;CAEtF,MAAM,aAAa,OAAO,KAAK,aAAa,CAAC;CAC7C,MAAM,qBAAqB,OAAO,KAAK,eAAe,CAAC;CACvD,MAAM,qBAAqB,aAAa;AAExC,SAAQ,SAAS,aAAa,aAAa;AAC3C,SAAQ,OAAO,aAAa;;AAG9B,MAAMA,cAA4B,YAAY;CAE5C,MAAM,6BAA6B,CAAC,GAAG,QAAQ,mBAAmB,CAAC,QAChE,SACC,EACE,QAAQ,MAAM,UAAU,OAAO,KAAK,eAAe,YAAY,KAAK,WAAW,SAAS,MAAM,CAAC,KAC9F,KAAK,SAAS,iBAAiB,KAAK,SAAS,oBAEnD;AACD,SAAQ,qBAAqB,IAAI,IAAI,2BAA2B;AAEhE,cAAa,SAAS,aAAa,CAAC,SAAS,CAAC,IAAI,SAAS,WAAW,CAAC;AACvE,cAAa,SAAS,aAAa,GAAG,cAAc,OAAO,KAAK,SAAS,CAAC,SAAS,EAAE;AAErF,cAAa,SAAS,UAAU,CAAC,KAAK,cAAc;AAClD,MAAI,QAAQ,uBAAwB,QAAO;EAC3C,MAAM,YAAY,OAAO,KAAK,SAAS;EAEvC,MAAM,oBAAoB,CAAC,iBAAiB,wBAAwB;AACpE,MAAI,UAAU,WAAW,kBAAkB,OAAQ,QAAO;AAK1D,SAD0B,CAHQ,kBAAkB,OAAO,qBACzD,UAAU,SAAS,iBAAiB,CACrC;GAGD;AAEF,QAAO;;AAGT,IAAA,4BAAe"}
1
+ {"version":3,"file":"knip-preprocessor.js","names":["originalIssues: IssueRecords","modifiedIssues: IssueRecords","preprocess: Preprocessor"],"sources":["../../src/configs/knip-preprocessor.ts"],"sourcesContent":["import type { Preprocessor, ReporterOptions } from \"knip\"\nimport type { IssueRecords, SymbolIssueType } from \"knip/dist/types/issues\"\n\nimport { knipConfig } from \"./knip.ts\"\n\n/*\n * The `IssueRecords` type represents an object where each key is the file path and the value is an object containing each issue object.\n *\n * For example:\n *\n * ```ts\n * {\n * \"path/to/file/with/issues.ts\": {\n * \"issue1\": { ... },\n * \"issue2\": { ... },\n * },\n * // ...\n * }\n * ```\n */\n\n/** The object containing all the issues for the given file path. */\ntype IssueRecord = IssueRecords[keyof IssueRecords]\ntype IssueRecordEntry = [keyof IssueRecord, IssueRecord[keyof IssueRecord]]\n\n/**\n * We transform `IssueRecords` into object entries where where the _value_ is an array of the object entries from each `IssueRecord`.\n *\n * For example, we're going from this:\n *\n * ```ts\n * {\n * \"path/to/file/with/issues.ts\": {\n * \"issue1\": { ... },\n * \"issue2\": { ... },\n * },\n * // ...\n * }\n * ```\n *\n * to this:\n *\n * ```ts\n * [\n * [\"path/to/file/with/issues.ts\", [[\"issue1\", { ... }], [\"issue2\", { ... }]]],\n * // ...\n * ]\n * ```\n */\ntype IssueRecordsEntry = [keyof IssueRecords, IssueRecordEntry[]]\n\n/**\n * Modifies issues based on the provided map function.\n *\n * This is needed because we also need to update `options.counters` after modifying issues.\n */\nfunction modifyIssues(\n options: ReporterOptions,\n issueType: SymbolIssueType,\n mapFn: (issueRecordsEntry: IssueRecordsEntry) => IssueRecordEntry[], // The mapFn should return the entries for the individual issues. We want to make the key (which is the file path) available, but we don't want to allow modification of the key.\n) {\n const originalIssues: IssueRecords = options.issues[issueType]\n const originalIssueEntries: IssueRecordsEntry[] = Object.entries(originalIssues).map(([key, issueRecord]) => [\n key,\n Object.entries(issueRecord),\n ])\n\n const modifiedIssueEntries = originalIssueEntries.map(\n // The map function receives something like `[\"path/to/file.ts\", [[\"issue1\", { ... }], [\"issue2\", { ... }]]]`\n // It then returns *only* the entries for the individual issues: `[[\"issue1\", { ... }], [\"issue2\", { ... }]]`\n ([key, issueRecordEntries]) => [key, Object.fromEntries(mapFn([key, issueRecordEntries]))] as const,\n )\n const modifiedIssues: IssueRecords = Object.fromEntries(modifiedIssueEntries)\n\n const countIssues = (issueRecords: IssueRecords) =>\n Object.values(issueRecords)\n .map((issueRecord) => Object.keys(issueRecord).length) // count the number of issues in each issue record\n .reduce((acc, curr) => acc + curr, 0)\n\n const originalIssueCount = countIssues(originalIssues)\n const modifiedIssueCount = countIssues(modifiedIssues)\n const issuesRemovedCount = originalIssueCount - modifiedIssueCount\n\n options.counters[issueType] = originalIssueCount - issuesRemovedCount\n options.issues[issueType] = modifiedIssues\n}\n\nconst entries = knipConfig().entry as string[]\n\nconst preprocess: Preprocessor = (options) => {\n // ignore the \"Refine entry pattern (no matches)\" configuration hints for entries in the base config\n const filteredConfigurationHints = [...options.configurationHints].filter(\n (hint) =>\n !(\n entries.some((entry) => typeof hint.identifier === \"string\" && hint.identifier.includes(entry)) &&\n (hint.type === \"entry-empty\" || hint.type === \"entry-redundant\")\n ),\n )\n options.configurationHints = new Set(filteredConfigurationHints)\n\n modifyIssues(options, \"unlisted\", ([, issueRecordEntries]) =>\n issueRecordEntries.filter(([key]) => !key.includes(\"prettier\")),\n )\n\n modifyIssues(options, \"types\", ([filePath, issueRecordEntries]) => {\n if (filePath !== \"src/configs/utils.ts\") return issueRecordEntries\n // We need to bring these types into scope of each merge config module: https://github.com/microsoft/TypeScript/issues/5711\n const expectedTypeNames = [\"MergeConfigFn\", \"OptionalMergeConfigFn\"]\n return issueRecordEntries.filter(([key]) => !expectedTypeNames.includes(key))\n })\n\n return options\n}\n\nexport default preprocess\n"],"mappings":";AAwDA,SAAS,aACP,SACA,WACA,OACA;CACA,MAAMA,iBAA+B,QAAQ,OAAO;CAMpD,MAAM,uBAL4C,OAAO,QAAQ,eAAe,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAC3G,KACA,OAAO,QAAQ,YAAY,CAC5B,CAAC,CAEgD,KAG/C,CAAC,KAAK,wBAAwB,CAAC,KAAK,OAAO,YAAY,MAAM,CAAC,KAAK,mBAAmB,CAAC,CAAC,CAAC,CAC3F;CACD,MAAMC,iBAA+B,OAAO,YAAY,qBAAqB;CAE7E,MAAM,eAAe,iBACnB,OAAO,OAAO,aAAa,CACxB,KAAK,gBAAgB,OAAO,KAAK,YAAY,CAAC,OAAO,CACrD,QAAQ,KAAK,SAAS,MAAM,MAAM,EAAE;CAEzC,MAAM,qBAAqB,YAAY,eAAe;CACtD,MAAM,qBAAqB,YAAY,eAAe;CACtD,MAAM,qBAAqB,qBAAqB;AAEhD,SAAQ,SAAS,aAAa,qBAAqB;AACnD,SAAQ,OAAO,aAAa;;AAG9B,MAAM,UAAU,YAAY,CAAC;AAE7B,MAAMC,cAA4B,YAAY;CAE5C,MAAM,6BAA6B,CAAC,GAAG,QAAQ,mBAAmB,CAAC,QAChE,SACC,EACE,QAAQ,MAAM,UAAU,OAAO,KAAK,eAAe,YAAY,KAAK,WAAW,SAAS,MAAM,CAAC,KAC9F,KAAK,SAAS,iBAAiB,KAAK,SAAS,oBAEnD;AACD,SAAQ,qBAAqB,IAAI,IAAI,2BAA2B;AAEhE,cAAa,SAAS,aAAa,GAAG,wBACpC,mBAAmB,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,WAAW,CAAC,CAChE;AAED,cAAa,SAAS,UAAU,CAAC,UAAU,wBAAwB;AACjE,MAAI,aAAa,uBAAwB,QAAO;EAEhD,MAAM,oBAAoB,CAAC,iBAAiB,wBAAwB;AACpE,SAAO,mBAAmB,QAAQ,CAAC,SAAS,CAAC,kBAAkB,SAAS,IAAI,CAAC;GAC7E;AAEF,QAAO;;AAGT,IAAA,4BAAe"}
@@ -2,13 +2,6 @@ import { OptionalMergeConfigFn } from "./utils.js";
2
2
 
3
3
  //#region src/configs/knip.d.ts
4
4
  declare const knipConfig: OptionalMergeConfigFn<{
5
- node?: string | boolean | string[] | {
6
- config?: string | string[] | undefined;
7
- entry?: string | string[] | undefined;
8
- project?: string | string[] | undefined;
9
- } | undefined;
10
- entry?: string | string[] | undefined;
11
- project?: string | string[] | undefined;
12
5
  angular?: string | boolean | string[] | {
13
6
  config?: string | string[] | undefined;
14
7
  entry?: string | string[] | undefined;
@@ -264,6 +257,11 @@ declare const knipConfig: OptionalMergeConfigFn<{
264
257
  entry?: string | string[] | undefined;
265
258
  project?: string | string[] | undefined;
266
259
  } | undefined;
260
+ node?: string | boolean | string[] | {
261
+ config?: string | string[] | undefined;
262
+ entry?: string | string[] | undefined;
263
+ project?: string | string[] | undefined;
264
+ } | undefined;
267
265
  'node-modules-inspector'?: string | boolean | string[] | {
268
266
  config?: string | string[] | undefined;
269
267
  entry?: string | string[] | undefined;
@@ -574,32 +572,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
574
572
  entry?: string | string[] | undefined;
575
573
  project?: string | string[] | undefined;
576
574
  } | undefined;
577
- exclude?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
578
- $schema?: string | undefined;
579
- rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
580
- paths?: Record<string, string[]> | undefined;
581
- ignore?: string | string[] | undefined;
582
- ignoreBinaries?: (string | RegExp)[] | undefined;
583
- ignoreDependencies?: (string | RegExp)[] | undefined;
584
- ignoreMembers?: (string | RegExp)[] | undefined;
585
- ignoreUnresolved?: (string | RegExp)[] | undefined;
586
- ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "enum" | "class" | "interface" | "member", boolean>> | undefined;
587
- ignoreWorkspaces?: string[] | undefined;
588
- includeEntryExports?: boolean | undefined;
589
- compilers?: Record<string, true | ((args_0: string, args_1: string, ...args: unknown[]) => string) | ((args_0: string, args_1: string, ...args: unknown[]) => Promise<string>)> | undefined;
590
- syncCompilers?: Record<string, true | ((args_0: string, args_1: string, ...args: unknown[]) => string)> | undefined;
591
- asyncCompilers?: Record<string, (args_0: string, args_1: string, ...args: unknown[]) => Promise<string>> | undefined;
592
- tags?: string[] | undefined;
593
- treatConfigHintsAsErrors?: boolean | undefined;
594
- include?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
595
575
  workspaces?: Record<string, {
596
- node?: string | boolean | string[] | {
597
- config?: string | string[] | undefined;
598
- entry?: string | string[] | undefined;
599
- project?: string | string[] | undefined;
600
- } | undefined;
601
- entry?: string | string[] | undefined;
602
- project?: string | string[] | undefined;
603
576
  angular?: string | boolean | string[] | {
604
577
  config?: string | string[] | undefined;
605
578
  entry?: string | string[] | undefined;
@@ -675,7 +648,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
675
648
  entry?: string | string[] | undefined;
676
649
  project?: string | string[] | undefined;
677
650
  } | undefined;
678
- "create-typescript-app"?: string | boolean | string[] | {
651
+ 'create-typescript-app'?: string | boolean | string[] | {
679
652
  config?: string | string[] | undefined;
680
653
  entry?: string | string[] | undefined;
681
654
  project?: string | string[] | undefined;
@@ -695,7 +668,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
695
668
  entry?: string | string[] | undefined;
696
669
  project?: string | string[] | undefined;
697
670
  } | undefined;
698
- "dependency-cruiser"?: string | boolean | string[] | {
671
+ 'dependency-cruiser'?: string | boolean | string[] | {
699
672
  config?: string | string[] | undefined;
700
673
  entry?: string | string[] | undefined;
701
674
  project?: string | string[] | undefined;
@@ -735,12 +708,12 @@ declare const knipConfig: OptionalMergeConfigFn<{
735
708
  entry?: string | string[] | undefined;
736
709
  project?: string | string[] | undefined;
737
710
  } | undefined;
738
- "github-action"?: string | boolean | string[] | {
711
+ 'github-action'?: string | boolean | string[] | {
739
712
  config?: string | string[] | undefined;
740
713
  entry?: string | string[] | undefined;
741
714
  project?: string | string[] | undefined;
742
715
  } | undefined;
743
- "github-actions"?: string | boolean | string[] | {
716
+ 'github-actions'?: string | boolean | string[] | {
744
717
  config?: string | string[] | undefined;
745
718
  entry?: string | string[] | undefined;
746
719
  project?: string | string[] | undefined;
@@ -750,7 +723,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
750
723
  entry?: string | string[] | undefined;
751
724
  project?: string | string[] | undefined;
752
725
  } | undefined;
753
- "graphql-codegen"?: string | boolean | string[] | {
726
+ 'graphql-codegen'?: string | boolean | string[] | {
754
727
  config?: string | string[] | undefined;
755
728
  entry?: string | string[] | undefined;
756
729
  project?: string | string[] | undefined;
@@ -765,7 +738,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
765
738
  entry?: string | string[] | undefined;
766
739
  project?: string | string[] | undefined;
767
740
  } | undefined;
768
- "i18next-parser"?: string | boolean | string[] | {
741
+ 'i18next-parser'?: string | boolean | string[] | {
769
742
  config?: string | string[] | undefined;
770
743
  entry?: string | string[] | undefined;
771
744
  project?: string | string[] | undefined;
@@ -790,7 +763,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
790
763
  entry?: string | string[] | undefined;
791
764
  project?: string | string[] | undefined;
792
765
  } | undefined;
793
- "lint-staged"?: string | boolean | string[] | {
766
+ 'lint-staged'?: string | boolean | string[] | {
794
767
  config?: string | string[] | undefined;
795
768
  entry?: string | string[] | undefined;
796
769
  project?: string | string[] | undefined;
@@ -800,12 +773,12 @@ declare const knipConfig: OptionalMergeConfigFn<{
800
773
  entry?: string | string[] | undefined;
801
774
  project?: string | string[] | undefined;
802
775
  } | undefined;
803
- "lockfile-lint"?: string | boolean | string[] | {
776
+ 'lockfile-lint'?: string | boolean | string[] | {
804
777
  config?: string | string[] | undefined;
805
778
  entry?: string | string[] | undefined;
806
779
  project?: string | string[] | undefined;
807
780
  } | undefined;
808
- "lost-pixel"?: string | boolean | string[] | {
781
+ 'lost-pixel'?: string | boolean | string[] | {
809
782
  config?: string | string[] | undefined;
810
783
  entry?: string | string[] | undefined;
811
784
  project?: string | string[] | undefined;
@@ -835,7 +808,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
835
808
  entry?: string | string[] | undefined;
836
809
  project?: string | string[] | undefined;
837
810
  } | undefined;
838
- "nano-staged"?: string | boolean | string[] | {
811
+ 'nano-staged'?: string | boolean | string[] | {
839
812
  config?: string | string[] | undefined;
840
813
  entry?: string | string[] | undefined;
841
814
  project?: string | string[] | undefined;
@@ -855,7 +828,12 @@ declare const knipConfig: OptionalMergeConfigFn<{
855
828
  entry?: string | string[] | undefined;
856
829
  project?: string | string[] | undefined;
857
830
  } | undefined;
858
- "node-modules-inspector"?: string | boolean | string[] | {
831
+ node?: string | boolean | string[] | {
832
+ config?: string | string[] | undefined;
833
+ entry?: string | string[] | undefined;
834
+ project?: string | string[] | undefined;
835
+ } | undefined;
836
+ 'node-modules-inspector'?: string | boolean | string[] | {
859
837
  config?: string | string[] | undefined;
860
838
  entry?: string | string[] | undefined;
861
839
  project?: string | string[] | undefined;
@@ -865,7 +843,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
865
843
  entry?: string | string[] | undefined;
866
844
  project?: string | string[] | undefined;
867
845
  } | undefined;
868
- "npm-package-json-lint"?: string | boolean | string[] | {
846
+ 'npm-package-json-lint'?: string | boolean | string[] | {
869
847
  config?: string | string[] | undefined;
870
848
  entry?: string | string[] | undefined;
871
849
  project?: string | string[] | undefined;
@@ -900,12 +878,12 @@ declare const knipConfig: OptionalMergeConfigFn<{
900
878
  entry?: string | string[] | undefined;
901
879
  project?: string | string[] | undefined;
902
880
  } | undefined;
903
- "playwright-ct"?: string | boolean | string[] | {
881
+ 'playwright-ct'?: string | boolean | string[] | {
904
882
  config?: string | string[] | undefined;
905
883
  entry?: string | string[] | undefined;
906
884
  project?: string | string[] | undefined;
907
885
  } | undefined;
908
- "playwright-test"?: string | boolean | string[] | {
886
+ 'playwright-test'?: string | boolean | string[] | {
909
887
  config?: string | string[] | undefined;
910
888
  entry?: string | string[] | undefined;
911
889
  project?: string | string[] | undefined;
@@ -940,12 +918,12 @@ declare const knipConfig: OptionalMergeConfigFn<{
940
918
  entry?: string | string[] | undefined;
941
919
  project?: string | string[] | undefined;
942
920
  } | undefined;
943
- "react-cosmos"?: string | boolean | string[] | {
921
+ 'react-cosmos'?: string | boolean | string[] | {
944
922
  config?: string | string[] | undefined;
945
923
  entry?: string | string[] | undefined;
946
924
  project?: string | string[] | undefined;
947
925
  } | undefined;
948
- "react-router"?: string | boolean | string[] | {
926
+ 'react-router'?: string | boolean | string[] | {
949
927
  config?: string | string[] | undefined;
950
928
  entry?: string | string[] | undefined;
951
929
  project?: string | string[] | undefined;
@@ -955,7 +933,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
955
933
  entry?: string | string[] | undefined;
956
934
  project?: string | string[] | undefined;
957
935
  } | undefined;
958
- "release-it"?: string | boolean | string[] | {
936
+ 'release-it'?: string | boolean | string[] | {
959
937
  config?: string | string[] | undefined;
960
938
  entry?: string | string[] | undefined;
961
939
  project?: string | string[] | undefined;
@@ -995,7 +973,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
995
973
  entry?: string | string[] | undefined;
996
974
  project?: string | string[] | undefined;
997
975
  } | undefined;
998
- "semantic-release"?: string | boolean | string[] | {
976
+ 'semantic-release'?: string | boolean | string[] | {
999
977
  config?: string | string[] | undefined;
1000
978
  entry?: string | string[] | undefined;
1001
979
  project?: string | string[] | undefined;
@@ -1005,12 +983,12 @@ declare const knipConfig: OptionalMergeConfigFn<{
1005
983
  entry?: string | string[] | undefined;
1006
984
  project?: string | string[] | undefined;
1007
985
  } | undefined;
1008
- "simple-git-hooks"?: string | boolean | string[] | {
986
+ 'simple-git-hooks'?: string | boolean | string[] | {
1009
987
  config?: string | string[] | undefined;
1010
988
  entry?: string | string[] | undefined;
1011
989
  project?: string | string[] | undefined;
1012
990
  } | undefined;
1013
- "size-limit"?: string | boolean | string[] | {
991
+ 'size-limit'?: string | boolean | string[] | {
1014
992
  config?: string | string[] | undefined;
1015
993
  entry?: string | string[] | undefined;
1016
994
  project?: string | string[] | undefined;
@@ -1065,7 +1043,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
1065
1043
  entry?: string | string[] | undefined;
1066
1044
  project?: string | string[] | undefined;
1067
1045
  } | undefined;
1068
- "ts-node"?: string | boolean | string[] | {
1046
+ 'ts-node'?: string | boolean | string[] | {
1069
1047
  config?: string | string[] | undefined;
1070
1048
  entry?: string | string[] | undefined;
1071
1049
  project?: string | string[] | undefined;
@@ -1105,7 +1083,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
1105
1083
  entry?: string | string[] | undefined;
1106
1084
  project?: string | string[] | undefined;
1107
1085
  } | undefined;
1108
- "vercel-og"?: string | boolean | string[] | {
1086
+ 'vercel-og'?: string | boolean | string[] | {
1109
1087
  config?: string | string[] | undefined;
1110
1088
  entry?: string | string[] | undefined;
1111
1089
  project?: string | string[] | undefined;
@@ -1130,7 +1108,7 @@ declare const knipConfig: OptionalMergeConfigFn<{
1130
1108
  entry?: string | string[] | undefined;
1131
1109
  project?: string | string[] | undefined;
1132
1110
  } | undefined;
1133
- "webdriver-io"?: string | boolean | string[] | {
1111
+ 'webdriver-io'?: string | boolean | string[] | {
1134
1112
  config?: string | string[] | undefined;
1135
1113
  entry?: string | string[] | undefined;
1136
1114
  project?: string | string[] | undefined;
@@ -1165,6 +1143,8 @@ declare const knipConfig: OptionalMergeConfigFn<{
1165
1143
  entry?: string | string[] | undefined;
1166
1144
  project?: string | string[] | undefined;
1167
1145
  } | undefined;
1146
+ entry?: string | string[] | undefined;
1147
+ project?: string | string[] | undefined;
1168
1148
  paths?: Record<string, string[]> | undefined;
1169
1149
  ignore?: string | string[] | undefined;
1170
1150
  ignoreBinaries?: (string | RegExp)[] | undefined;
@@ -1173,6 +1153,33 @@ declare const knipConfig: OptionalMergeConfigFn<{
1173
1153
  ignoreUnresolved?: (string | RegExp)[] | undefined;
1174
1154
  includeEntryExports?: boolean | undefined;
1175
1155
  }> | undefined;
1156
+ include?: ("exports" | "files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
1157
+ exclude?: ("exports" | "files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
1158
+ $schema?: string | undefined;
1159
+ rules?: Partial<Record<"exports" | "files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
1160
+ entry?: string | string[] | undefined;
1161
+ project?: string | string[] | undefined;
1162
+ paths?: Record<string, string[]> | undefined;
1163
+ ignore?: string | string[] | undefined;
1164
+ ignoreBinaries?: (string | RegExp)[] | undefined;
1165
+ ignoreDependencies?: (string | RegExp)[] | undefined;
1166
+ ignoreMembers?: (string | RegExp)[] | undefined;
1167
+ ignoreUnresolved?: (string | RegExp)[] | undefined;
1168
+ ignoreExportsUsedInFile?: boolean | {
1169
+ class?: boolean | undefined;
1170
+ enum?: boolean | undefined;
1171
+ function?: boolean | undefined;
1172
+ interface?: boolean | undefined;
1173
+ member?: boolean | undefined;
1174
+ type?: boolean | undefined;
1175
+ } | undefined;
1176
+ ignoreWorkspaces?: string[] | undefined;
1177
+ includeEntryExports?: boolean | undefined;
1178
+ compilers?: Record<string, true | ((filename: string, contents: string) => string) | ((filename: string, contents: string) => Promise<string>)> | undefined;
1179
+ syncCompilers?: Record<string, true | ((filename: string, contents: string) => string)> | undefined;
1180
+ asyncCompilers?: Record<string, (filename: string, contents: string) => Promise<string>> | undefined;
1181
+ tags?: string[] | undefined;
1182
+ treatConfigHintsAsErrors?: boolean | undefined;
1176
1183
  }, {
1177
1184
  readonly entry: ["./src/index.ts", "**/*.test.ts", "./tsdown.config.ts"];
1178
1185
  readonly project: ["**"];
@@ -1 +1 @@
1
- {"version":3,"file":"knip.d.ts","names":[],"sources":["../../src/configs/knip.ts"],"sourcesContent":[],"mappings":";;;cAca;;;IAAA,KAAA,CAAA,EAAA,MAA2E,GAAA,MAAA,EAAA,GAAA,SAAA;IAAA,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;;;;;;;;;IAC442P,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;;MAAoP,SAAA;;IAAio0B,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;IAA+G,KAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;IAA8D,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;MAAyD,SAAA;OAA4D,CAAA,EAAA,MAAA,GAAA,OAAA,GAAA,MAAA,EAAA,GAAA;;;IADpmsR,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gKAC682P;;0FAAoP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAAio0B;;+BAA+G;mCAA8D;8BAAyD;iCAA4D"}
1
+ {"version":3,"file":"knip.d.ts","names":[],"sources":["../../src/configs/knip.ts"],"sourcesContent":[],"mappings":";;;cAca;;;IAAA,KAAA,CAAA,EAAA,MAA2E,GAAA,MAAA,EAAA,GAAA,SAAA;IAAA,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;;;;;;;;;;;;;;;;;;;IAAjE,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA"}
@@ -9,7 +9,8 @@ import * as hookable0 from "hookable";
9
9
  declare const tsdownConfig: MergeConfigFn<{
10
10
  entry?: rolldown0.InputOption;
11
11
  external?: rolldown0.ExternalOption;
12
- noExternal?: (string | RegExp | (string | RegExp)[]) | ((id: string, importer: string | undefined) => boolean | null | undefined | void);
12
+ noExternal?: (string | RegExp | (string | RegExp)[]) | tsdown0.NoExternalFn;
13
+ inlineOnly?: string | RegExp | (string | RegExp)[];
13
14
  skipNodeModulesBundle?: boolean;
14
15
  alias?: Record<string, string>;
15
16
  tsconfig?: string | boolean;
@@ -18,7 +19,7 @@ declare const tsdownConfig: MergeConfigFn<{
18
19
  define?: Record<string, string>;
19
20
  shims?: boolean;
20
21
  treeshake?: boolean;
21
- loader?: tsdown0.ModuleTypes;
22
+ loader?: rolldown0.ModuleTypes;
22
23
  removeNodeProtocol?: boolean;
23
24
  nodeProtocol?: "strip" | boolean;
24
25
  plugins?: rolldown0.RolldownPluginOption<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"tsdown.d.ts","names":[],"sources":["../../src/configs/tsdown.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAyCa;UAAyF,SAAA,CAAA;;;;;;;EAAzF,GAAA,CAAA,QAAA,CAAA,MAAyF,EAAA,GAAA,CAAA;EAAA,MAAA,CAAA,QAAA,CAAA,MAAA,EAAA,MAAA,CAAA;OAAA,CAAA,EAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA7E,SAAA,MAAA,EAAA,KAAA;EACZ,SAAA,QAAA,EAAwF,SAAA;EAAA,SAAA,MAAA,EAAA,UAAA;WAAA,SAAzE,EAAA,IAAA;WAAA,IAAA,EAAA,KAAA;WAAA,GAAA,EAAA;IAAA,SAAA,UAAA,EAAA,IAAA;;;;;;;;;;cAAf,iBAAe,sBAAA,KAAyE,OAAA,CAAzE,OAAA"}
1
+ {"version":3,"file":"tsdown.d.ts","names":[],"sources":["../../src/configs/tsdown.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAyCa;UAAyF,SAAA,CAAA;;;;;;;EAAzF,MAAA,CAAA,EAAA,MAAyF,GAAA,MAAA,EAAA,GAAA,KAAA;EAAA,GAAA,CAAA,QAAA,CAAA,MAAA,EAAA,GAAA,CAAA;QAAA,CAAA,QAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA7E,SAAA,MAAA,EAAA,UAAA;EACZ,SAAA,SAAwF,EAAA,IAAA;EAAA,SAAA,IAAA,EAAA,KAAA;WAAA,GAAzE,EAAA;IAAA,SAAA,UAAA,EAAA,IAAA;IAAA,SAAA,SAAA,EAAA,IAAA;EAAA,CAAA;;;;;;;;cAAf,iBAAe,sBAAA,KAAyE,OAAA,CAAzE,OAAA"}
@@ -53,8 +53,8 @@ function getPathsMap() {
53
53
  for (let [alias, [aliasDir]] of Object.entries(tsconfig.config.compilerOptions?.paths ?? {})) {
54
54
  if (!alias.endsWith("/*")) continue;
55
55
  if (!aliasDir?.endsWith("/*")) continue;
56
- alias = alias.slice(0, -2);
57
- aliasDir = aliasDir.slice(0, -2);
56
+ alias = alias.slice(0, -1);
57
+ aliasDir = aliasDir.slice(0, -1);
58
58
  pathsMap[alias] = aliasDir;
59
59
  }
60
60
  return pathsMap;
@@ -66,7 +66,7 @@ function resolveImportPath(importPath, filePath, pathsMap) {
66
66
  if (!importPath.startsWith(alias)) continue;
67
67
  const aliasDir = pathsMap[alias];
68
68
  if (!aliasDir) continue;
69
- const relativePath = importPath.slice(alias.length + 1);
69
+ const relativePath = importPath.slice(alias.length);
70
70
  return path.resolve(aliasDir, relativePath);
71
71
  }
72
72
  return path.resolve(fileDir, importPath);
@@ -109,7 +109,7 @@ function getAliasPathParts(importParts, pathsMap) {
109
109
  for (const [alias, aliasDir] of Object.entries(pathsMap)) {
110
110
  const relativeToAliasDir = path.relative(aliasDir, importPath);
111
111
  if (relativeToAliasDir.startsWith("..")) continue;
112
- return { dir: path.parse(`${alias}/${relativeToAliasDir}`).dir };
112
+ return { dir: path.parse(`${alias}${relativeToAliasDir}`).dir };
113
113
  }
114
114
  }
115
115
  async function fixImports(filePaths, { write, importIgnoreStrings, skipAlias }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamhl8/configs",
3
- "version": "0.17.3",
3
+ "version": "0.17.5",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,8 +39,8 @@
39
39
  "typescript": "^5.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "@optique/core": "^0.5.0",
43
- "@optique/run": "^0.5.0",
42
+ "@optique/core": "^0.5.1",
43
+ "@optique/run": "^0.5.1",
44
44
  "@prettier/plugin-xml": "^3.4.2",
45
45
  "es-toolkit": "^1.39.10",
46
46
  "get-tsconfig": "^4.10.1",
@@ -51,14 +51,14 @@
51
51
  "prettier-plugin-toml": "^2.0.6",
52
52
  "remeda": "^2.32.0",
53
53
  "ts-explicit-errors": "^4.0.1",
54
- "tsdown": "^0.15.4",
54
+ "tsdown": "^0.15.5",
55
55
  "type-fest": "^5.0.1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@arethetypeswrong/core": "^0.18.2",
59
59
  "@biomejs/biome": "^2.2.4",
60
- "@types/bun": "^1.2.22",
61
- "knip": "^5.64.0",
60
+ "@types/bun": "^1.2.23",
61
+ "knip": "^5.64.1",
62
62
  "markdown-toc": "^1.2.0",
63
63
  "prettier": "^3.6.2",
64
64
  "publint": "^0.3.13",