@adamhl8/configs 0.16.3 → 0.17.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.
Files changed (38) hide show
  1. package/dist/adamhl8-knip/index +17 -0
  2. package/dist/{knip-preprocessor.d.ts → configs/knip-preprocessor.d.ts} +1 -1
  3. package/dist/configs/knip-preprocessor.d.ts.map +1 -0
  4. package/dist/{knip-preprocessor.js → configs/knip-preprocessor.js} +1 -2
  5. package/dist/configs/knip-preprocessor.js.map +1 -0
  6. package/dist/{knip.d.ts → configs/knip.d.ts} +1 -1
  7. package/dist/{knip.d.ts.map → configs/knip.d.ts.map} +1 -1
  8. package/dist/configs/knip.js.map +1 -0
  9. package/dist/{prettier.d.ts → configs/prettier.d.ts} +1 -1
  10. package/dist/configs/prettier.d.ts.map +1 -0
  11. package/dist/configs/prettier.js.map +1 -0
  12. package/dist/{tsdown.d.ts → configs/tsdown.d.ts} +1 -1
  13. package/dist/configs/tsdown.d.ts.map +1 -0
  14. package/dist/configs/tsdown.js.map +1 -0
  15. package/dist/{utils.d.ts → configs/utils.d.ts} +1 -1
  16. package/dist/configs/utils.d.ts.map +1 -0
  17. package/dist/configs/utils.js.map +1 -0
  18. package/dist/index.d.ts +3 -3
  19. package/dist/index.js +3 -3
  20. package/dist/ts-import-fix/index +154 -0
  21. package/package.json +15 -12
  22. package/dist/adamhl8-knip +0 -17
  23. package/dist/knip-preprocessor.d.ts.map +0 -1
  24. package/dist/knip-preprocessor.js.map +0 -1
  25. package/dist/knip.js.map +0 -1
  26. package/dist/prettier.d.ts.map +0 -1
  27. package/dist/prettier.js.map +0 -1
  28. package/dist/ts-import-fix +0 -2787
  29. package/dist/tsdown.d.ts.map +0 -1
  30. package/dist/tsdown.js.map +0 -1
  31. package/dist/utils.d.ts.map +0 -1
  32. package/dist/utils.js.map +0 -1
  33. /package/dist/{biome.base.json → configs/biome.base.json} +0 -0
  34. /package/dist/{knip.js → configs/knip.js} +0 -0
  35. /package/dist/{prettier.js → configs/prettier.js} +0 -0
  36. /package/dist/{tsconfig.base.json → configs/tsconfig.base.json} +0 -0
  37. /package/dist/{tsdown.js → configs/tsdown.js} +0 -0
  38. /package/dist/{utils.js → configs/utils.js} +0 -0
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env bun
2
+ import path from "node:path";
3
+ import process from "node:process";
4
+ const KNIP_PREPROCESSOR_PATH = `${path.resolve(import.meta.dir, "../configs/knip-preprocessor")}`;
5
+ const knipPreprocessorPathExt = await Bun.file(`${KNIP_PREPROCESSOR_PATH}.ts`).exists() ? ".ts" : ".js";
6
+ const knipPreprocessorPath = `${KNIP_PREPROCESSOR_PATH}${knipPreprocessorPathExt}`;
7
+ process.exitCode = Bun.spawnSync({
8
+ cmd: [
9
+ "knip-bun",
10
+ "--preprocessor",
11
+ knipPreprocessorPath,
12
+ ...process.argv.slice(2)
13
+ ],
14
+ stdout: "inherit",
15
+ stderr: "inherit"
16
+ }).exitCode;
17
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { Preprocessor } from "knip";
2
2
 
3
- //#region src/knip-preprocessor.d.ts
3
+ //#region src/configs/knip-preprocessor.d.ts
4
4
  declare const preprocess: Preprocessor;
5
5
  //#endregion
6
6
  export { preprocess as default };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knip-preprocessor.d.ts","names":[],"sources":["../../src/configs/knip-preprocessor.ts"],"sourcesContent":[],"mappings":";;;cA4BM,YAAY"}
@@ -1,5 +1,4 @@
1
1
  import { knipConfig } from "./knip.js";
2
- import "./index.js";
3
2
  const entries = knipConfig().entry;
4
3
  function filterIssues(options, issueType, filter) {
5
4
  const issuesObject = options.issues[issueType];
@@ -16,7 +15,7 @@ const preprocess = (options) => {
16
15
  filterIssues(options, "unlisted", ([key]) => !key.includes("prettier"));
17
16
  filterIssues(options, "unlisted", ([, issueObj]) => Object.keys(issueObj).length > 0);
18
17
  filterIssues(options, "types", ([key, issueObj]) => {
19
- if (key !== "src/utils.ts") return true;
18
+ if (key !== "src/configs/utils.ts") return true;
20
19
  const typeNames = Object.keys(issueObj);
21
20
  const expectedTypeNames = ["MergeConfigFn", "OptionalMergeConfigFn"];
22
21
  if (typeNames.length !== expectedTypeNames.length) return true;
@@ -0,0 +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,6 +1,6 @@
1
1
  import { OptionalMergeConfigFn } from "./utils.js";
2
2
 
3
- //#region src/knip.d.ts
3
+ //#region src/configs/knip.d.ts
4
4
  declare const knipConfig: OptionalMergeConfigFn<{
5
5
  node?: string | boolean | string[] | {
6
6
  config?: string | string[] | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"knip.d.ts","names":[],"sources":["../src/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;;;;;;;;;;IAC6muP,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;;MAAoP,SAAA;;IAA0rzB,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;;;IAD93iR,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gKAC8quP;;0FAAoP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAA0rzB;;+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;;;;;;;;;;IAC6muP,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;;MAAoP,SAAA;;IAA0rzB,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;;;IAD93iR,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gKAC8quP;;0FAAoP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAA0rzB;;+BAA+G;mCAA8D;8BAAyD;iCAA4D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knip.js","names":[],"sources":["../../src/configs/knip.ts"],"sourcesContent":["import type { KnipConfig } from \"knip\"\n\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// Normally, specifying the `./src/index.ts` entry would cause knip to complain about a redundant entry because it gets automatically included via the tsdown plugin.\n// However, in projects that _don't_ use tsdown, the `./src/index.ts` entry would be missing entirely.\n// To handle this, we specify it and disable the tsdown plugin. This makes knip work in both cases.\n\nconst baseConfig = {\n entry: [\"./src/index.ts\", \"**/*.test.ts\", \"./tsdown.config.ts\"],\n project: [\"**\"],\n tsdown: false,\n} as const satisfies KnipConfig\n\nexport const knipConfig = createMergeConfigFn<KnipConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";AAcA,MAAa,aAAa,oBANP;CACjB,OAAO;EAAC;EAAkB;EAAgB;EAAqB;CAC/D,SAAS,CAAC,KAAK;CACf,QAAQ;CACT,CAEuF"}
@@ -1,7 +1,7 @@
1
1
  import { OptionalMergeConfigFn } from "./utils.js";
2
2
  import * as prettier0 from "prettier";
3
3
 
4
- //#region src/prettier.d.ts
4
+ //#region src/configs/prettier.d.ts
5
5
  declare const prettierConfig: OptionalMergeConfigFn<{
6
6
  [x: string]: unknown;
7
7
  overrides?: Array<{
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prettier.d.ts","names":[],"sources":["../../src/configs/prettier.ts"],"sourcesContent":[],"mappings":";;;;cAoCa;;;;IAAA,YAAA,CAAmF,EAAA,MAAA,GAAA,MAAA,EAAA;IAAA,OAAA,CAAA,EAAA,SAAA,CACwpP,OADxpP;;;;;;;;;EAArE,UAAA,CAAA,EAAA,MAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prettier.js","names":[],"sources":["../../src/configs/prettier.ts"],"sourcesContent":["import type { Config } from \"prettier\"\nimport type { Simplify } from \"type-fest\"\n\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// for some reason the Config type from prettier doesn't satisfy AnyObj unless we simplify it\ntype PrettierConfig = Simplify<Config>\n\nconst baseConfig = {\n printWidth: 120,\n semi: false,\n plugins: [\n \"@prettier/plugin-xml\",\n \"prettier-plugin-sh\",\n \"prettier-plugin-toml\",\n \"prettier-plugin-astro\",\n \"prettier-plugin-tailwindcss\",\n ],\n tailwindStylesheet: \"./src/global.css\",\n overrides: [\n {\n // https://github.com/prettier/prettier/issues/15956\n files: \"*.jsonc\",\n options: {\n trailingComma: \"none\",\n },\n },\n {\n files: \"*.astro\",\n options: {\n parser: \"astro\",\n },\n },\n ],\n} as const satisfies PrettierConfig\n\nexport const prettierConfig = createMergeConfigFn<PrettierConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";AAoCA,MAAa,iBAAiB,oBA5BX;CACjB,YAAY;CACZ,MAAM;CACN,SAAS;EACP;EACA;EACA;EACA;EACA;EACD;CACD,oBAAoB;CACpB,WAAW,CACT;EAEE,OAAO;EACP,SAAS,EACP,eAAe,QAChB;EACF,EACD;EACE,OAAO;EACP,SAAS,EACP,QAAQ,SACT;EACF,CACF;CACF,CAE+F"}
@@ -5,7 +5,7 @@ import * as rolldown_plugin_dts0 from "rolldown-plugin-dts";
5
5
  import * as publint0 from "publint";
6
6
  import * as hookable0 from "hookable";
7
7
 
8
- //#region src/tsdown.d.ts
8
+ //#region src/configs/tsdown.d.ts
9
9
  declare const tsdownConfig: MergeConfigFn<{
10
10
  entry?: rolldown0.InputOption;
11
11
  external?: rolldown0.ExternalOption;
@@ -0,0 +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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsdown.js","names":[],"sources":["../../src/configs/tsdown.ts"],"sourcesContent":["import type { NormalizedUserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// force projects to specify platform\ntype StrictUserConfig = SetRequired<NormalizedUserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n unbundle: true,\n target: false,\n platform: \"neutral\",\n minify: \"dce-only\",\n sourcemap: true,\n hash: false,\n dts: {\n newContext: true,\n sourcemap: true,\n },\n attw: {\n level: \"error\",\n profile: \"esmOnly\",\n },\n publint: true,\n failOnWarn: true,\n} as const satisfies StrictUserConfig\n\nconst binConfig = {\n ...baseConfig,\n entry: [],\n platform: \"node\",\n outExtensions: () => ({ js: \"\" }),\n copy: [],\n unbundle: false,\n sourcemap: false,\n dts: false,\n attw: false,\n publint: false,\n} as const satisfies NormalizedUserConfig\n\nexport const tsdownConfig = createMergeConfigFn<StrictUserConfig, typeof baseConfig, true>(baseConfig)\nexport const tsdownBinConfig = createMergeConfigFn<NormalizedUserConfig, typeof binConfig>(binConfig)\n"],"mappings":";AAQA,MAAM,aAAa;CACjB,OAAO,CAAC,iBAAiB;CACzB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,WAAW;CACX,MAAM;CACN,KAAK;EACH,YAAY;EACZ,WAAW;EACZ;CACD,MAAM;EACJ,OAAO;EACP,SAAS;EACV;CACD,SAAS;CACT,YAAY;CACb;AAED,MAAM,YAAY;CAChB,GAAG;CACH,OAAO,EAAE;CACT,UAAU;CACV,sBAAsB,EAAE,IAAI,IAAI;CAChC,MAAM,EAAE;CACR,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;CACN,SAAS;CACV;AAED,MAAa,eAAe,oBAA+D,WAAW;AACtG,MAAa,kBAAkB,oBAA4D,UAAU"}
@@ -1,6 +1,6 @@
1
1
  import { MergeDeep } from "type-fest";
2
2
 
3
- //#region src/utils.d.ts
3
+ //#region src/configs/utils.d.ts
4
4
 
5
5
  /**
6
6
  * Type representing a merge config function, where the `UserConfig` passed in is merged with `BaseConfig`.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/configs/utils.ts"],"sourcesContent":[],"mappings":";;;;;AAkBA;;AAE6B,UAFZ,aAEY,CAAA,UAAA,EAAA,UAAA,CAAA,CAAA;6BAAA,UACb,CAAA,CAAA,UAAA,EAAA,iBAAA,CAAA,EACX,SADW,CACD,UADC,EACW,iBADX,EAAA;IACD,cAAA,EAAA,QAAA;;;;AAaf;;;;;;;;UAAiB,sDAAsD,cAAc,YAAY;MAC3F"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/configs/utils.ts"],"sourcesContent":["import { mergeWith } from \"es-toolkit\"\nimport { clone } from \"remeda\"\nimport type { MergeDeep } from \"type-fest\"\n\ntype AnyObj = Record<PropertyKey, unknown>\n\n/**\n * A wrapper around es-toolkit's `mergeWith` with a custom merge function that concatenates arrays.\n */\nfunction merge<T extends AnyObj, S extends AnyObj>(target: T, source: S): T & S {\n return mergeWith(target, source, (objValue: unknown, srcValue: unknown) =>\n Array.isArray(objValue) ? objValue.concat(srcValue) : undefined,\n )\n}\n\n/**\n * Type representing a merge config function, where the `UserConfig` passed in is merged with `BaseConfig`.\n */\nexport interface MergeConfigFn<UserConfig, BaseConfig> {\n // biome-ignore lint/style/useShorthandFunctionType: need to use call signature type\n <UserConfigToMerge extends UserConfig>(\n userConfig: UserConfigToMerge,\n ): MergeDeep<BaseConfig, UserConfigToMerge, { arrayMergeMode: \"spread\" }>\n // instead of returning `BaseConfig & UserConfig` (from `merge`), return a more friendly type using `MergeDeep`\n}\n\n/**\n * Type representing an overloaded function signature for MergeConfigFn:\n * - if `UserConfig` is not provided, the return type is `BaseConfig`\n * - if `UserConfig` is provided, the return type is the merged type of `BaseConfig` and `UserConfig`.\n *\n * This is needed to handle the fact that the `userConfig` argument is optional.\n *\n * Note that this extends `MergeConfigFn`, so this type has both function signatures on it.\n */\nexport interface OptionalMergeConfigFn<UserConfig, BaseConfig> extends MergeConfigFn<UserConfig, BaseConfig> {\n (): BaseConfig\n}\n\n/**\n * Creates a config merge function with proper type overloads for merging with a base config.\n */\nexport function createMergeConfigFn<\n UserConfig extends AnyObj,\n BaseConfig extends UserConfig,\n Required extends boolean = false, // if true, the created merge config function requires a userConfig to be passed in\n>(baseConfig: BaseConfig) {\n // we don't care about the specific type of userConfig here because we assert mergeConfigFn as the correct type below\n const mergeConfigFn = (userConfig?: AnyObj) => {\n if (userConfig === undefined) return baseConfig\n // clone both target and source so we never mutate the original objects\n return merge(clone(baseConfig), clone(userConfig))\n }\n\n return mergeConfigFn as Required extends true // if Required is true\n ? MergeConfigFn<UserConfig, BaseConfig> // then the merge config function requires a userConfig to be passed in\n : OptionalMergeConfigFn<UserConfig, BaseConfig> // else, userConfig is optional\n}\n"],"mappings":";;AASA,SAAS,MAA0C,QAAW,QAAkB;AAC9E,QAAO,UAAU,QAAQ,SAAS,UAAmB,aACnD,MAAM,QAAQ,SAAS,GAAG,SAAS,OAAO,SAAS,GAAG,KAAA,EACvD;;AA8BH,SAAgB,oBAId,YAAwB;CAExB,MAAM,iBAAiB,eAAwB;AAC7C,MAAI,eAAe,KAAA,EAAW,QAAO;AAErC,SAAO,MAAM,MAAM,WAAW,EAAE,MAAM,WAAW,CAAC;;AAGpD,QAAO"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { knipConfig } from "./knip.js";
2
- import { prettierConfig } from "./prettier.js";
3
- import { tsdownBinConfig, tsdownConfig } from "./tsdown.js";
1
+ import { knipConfig } from "./configs/knip.js";
2
+ import { prettierConfig } from "./configs/prettier.js";
3
+ import { tsdownBinConfig, tsdownConfig } from "./configs/tsdown.js";
4
4
  export { knipConfig, prettierConfig, tsdownBinConfig, tsdownConfig };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { knipConfig } from "./knip.js";
2
- import { prettierConfig } from "./prettier.js";
3
- import { tsdownBinConfig, tsdownConfig } from "./tsdown.js";
1
+ import { knipConfig } from "./configs/knip.js";
2
+ import { prettierConfig } from "./configs/prettier.js";
3
+ import { tsdownBinConfig, tsdownConfig } from "./configs/tsdown.js";
4
4
  export { knipConfig, prettierConfig, tsdownBinConfig, tsdownConfig };
@@ -0,0 +1,154 @@
1
+ #!/usr/bin/env node
2
+ import path from "node:path";
3
+ import process from "node:process";
4
+ import fs from "node:fs/promises";
5
+ import pc from "picocolors";
6
+ import { attempt, err, isErr } from "ts-explicit-errors";
7
+ import { message, multiple, object, option, string } from "@optique/core";
8
+ import { run } from "@optique/run";
9
+ import ts from "typescript";
10
+ import fss from "node:fs";
11
+ import { getTsconfig } from "get-tsconfig";
12
+ function cli() {
13
+ const options = object({
14
+ write: option("-w", "--write", { description: message`Write changes to files` }),
15
+ skipAlias: option("--skip-alias", { description: message`Skip transforming relative imports to use an alias` }),
16
+ fileIgnorePatterns: multiple(option("-f", "--file-ignore", string({ metavar: "PATTERN" }), { description: message`Additional glob patterns for files to ignore (only applies to import fixes)` })),
17
+ importIgnoreStrings: multiple(option("-i", "--import-ignore", string(), { description: message`An import path *containing* the given string will be ignored` }))
18
+ });
19
+ return run(options, {
20
+ programName: "ts-import-fix",
21
+ help: "option",
22
+ showDefault: { prefix: " [default: " }
23
+ });
24
+ }
25
+ async function checkExports(filePaths) {
26
+ const EXPORT_ERRORS = [];
27
+ const exportCheckResult = await attempt(() => {
28
+ const filePromises = filePaths.map(async (filePath) => {
29
+ const filePathParts = path.parse(filePath);
30
+ if (filePathParts.name === "index") return;
31
+ const sourceCode = await fs.readFile(filePath, "utf8");
32
+ const sourceFile = ts.createSourceFile(filePathParts.base, sourceCode, ts.ScriptTarget.Latest, true);
33
+ const exportDeclarations = [];
34
+ const visit = (node) => {
35
+ if (ts.isExportDeclaration(node)) exportDeclarations.push(node);
36
+ ts.forEachChild(node, visit);
37
+ };
38
+ visit(sourceFile);
39
+ if (exportDeclarations.length === 0) return;
40
+ const exportDeclarationText = exportDeclarations.map((declaration) => declaration.getText()).join("\n");
41
+ EXPORT_ERRORS.push(`${pc.redBright("✗")} ${filePath}\n${pc.dim(exportDeclarationText)}\n`);
42
+ });
43
+ return Promise.all(filePromises);
44
+ });
45
+ if (isErr(exportCheckResult)) return err("something went wrong when checking exports", exportCheckResult);
46
+ if (EXPORT_ERRORS.length > 0) return err(`found export declarations:\n${EXPORT_ERRORS.join("\n")}`, void 0);
47
+ }
48
+ const IMPORT_PATTERN = /(?:import|from)\s+['"]([^'"]+)['"]$/gm;
49
+ function getPathsMap() {
50
+ const tsconfig = getTsconfig();
51
+ if (!tsconfig) return err("failed to load tsconfig", void 0);
52
+ const pathsMap = {};
53
+ for (let [alias, [aliasDir]] of Object.entries(tsconfig.config.compilerOptions?.paths ?? {})) {
54
+ if (!alias.endsWith("/*")) continue;
55
+ if (!aliasDir?.endsWith("/*")) continue;
56
+ aliasDir = aliasDir.slice(0, -2);
57
+ alias = alias.slice(0, -2);
58
+ pathsMap[alias] = aliasDir;
59
+ }
60
+ return pathsMap;
61
+ }
62
+ function changeExtension(parsedPath, newExtension) {
63
+ return {
64
+ ...parsedPath,
65
+ ext: newExtension,
66
+ base: ""
67
+ };
68
+ }
69
+ function transformExtension(filePath) {
70
+ const pathParts = path.parse(filePath);
71
+ if (!(pathParts.ext === ".js" || pathParts.ext === "")) return filePath;
72
+ return path.format(changeExtension(pathParts, ".ts"));
73
+ }
74
+ function transformRelativeImport(filePath, importPath, pathsMap) {
75
+ const currentDir = path.dirname(filePath);
76
+ const absoluteImportPath = path.resolve(currentDir, importPath);
77
+ if (!fss.existsSync(absoluteImportPath)) return err(`skipped transform of '${importPath}': target file does not exist`, void 0);
78
+ for (const [alias, aliasDir] of Object.entries(pathsMap)) {
79
+ const relativeToAliasDir = path.relative(aliasDir, absoluteImportPath);
80
+ if (relativeToAliasDir.startsWith("..")) continue;
81
+ return `${alias}/${relativeToAliasDir}`;
82
+ }
83
+ return err(`could not find alias for '${importPath}'`, void 0);
84
+ }
85
+ async function fixImports(filePaths, { write, importIgnoreStrings, skipAlias }) {
86
+ const IMPORT_ERRORS = [];
87
+ const TRANSFORMED_IMPORTS = [];
88
+ const pathsMap = getPathsMap();
89
+ if (isErr(pathsMap)) return pathsMap;
90
+ const importFixResult = await attempt(() => {
91
+ const filePromises = filePaths.map(async (filePath) => {
92
+ const content = await fs.readFile(filePath, "utf8");
93
+ const importErrorsForFile = [];
94
+ const transformedImportsForFile = [];
95
+ const transformedContent = content.replace(IMPORT_PATTERN, (match, importPath) => {
96
+ const isRelativeImport = importPath.startsWith("./") || importPath.startsWith("../");
97
+ const isAliasImport = Object.keys(pathsMap).some((alias) => importPath.startsWith(alias));
98
+ if (!(isRelativeImport || isAliasImport)) return match;
99
+ if (importIgnoreStrings.some((ignoreString) => importPath.includes(ignoreString))) return match;
100
+ let newImportPath = transformExtension(importPath);
101
+ if (isRelativeImport && !skipAlias) {
102
+ const transformedRelativeImport = transformRelativeImport(filePath, newImportPath, pathsMap);
103
+ if (isErr(transformedRelativeImport)) importErrorsForFile.push(transformedRelativeImport.messageChain);
104
+ else newImportPath = transformedRelativeImport;
105
+ }
106
+ if (newImportPath === importPath) return match;
107
+ const { ext: originalExt } = path.parse(importPath);
108
+ const newPathParts = path.parse(newImportPath);
109
+ const { ext: newExt } = newPathParts;
110
+ let newImportPathString = newImportPath;
111
+ if (newExt !== originalExt) newImportPathString = `${path.format(changeExtension(newPathParts, ""))}${pc.greenBright(newExt)}`;
112
+ transformedImportsForFile.push(`'${importPath}' -> '${newImportPathString}'`);
113
+ return match.replace(importPath, newImportPath);
114
+ });
115
+ if (importErrorsForFile.length > 0) IMPORT_ERRORS.push(`${pc.redBright("✗")} ${filePath}\n${importErrorsForFile.join("\n")}\n`);
116
+ if (transformedImportsForFile.length > 0) TRANSFORMED_IMPORTS.push(`${pc.greenBright("✓")} ${filePath}\n${transformedImportsForFile.join("\n")}\n`);
117
+ if (transformedContent === content) return;
118
+ if (write) await fs.writeFile(filePath, transformedContent);
119
+ });
120
+ return Promise.all(filePromises);
121
+ });
122
+ if (TRANSFORMED_IMPORTS.length > 0) console.log(`${pc.greenBright("[ts-import-fix]")} transformed imports:\n${TRANSFORMED_IMPORTS.join("\n")}`);
123
+ if (isErr(importFixResult)) return err("something went wrong when transforming imports", importFixResult);
124
+ if (IMPORT_ERRORS.length > 0) return err(`failed to transform some imports:\n${IMPORT_ERRORS.join("\n")}`, void 0);
125
+ }
126
+ const FILES_GLOB = "**/*.{ts,tsx,js,jsx,astro}";
127
+ const BASE_IGNORE_PATTERNS = ["node_modules/", "dist/"];
128
+ async function tsImportFix() {
129
+ const { fileIgnorePatterns,...fixImportsOptions } = cli();
130
+ const errors = [];
131
+ const fixImportsIgnorePatterns = [
132
+ ...BASE_IGNORE_PATTERNS,
133
+ "astro.config.ts",
134
+ ...fileIgnorePatterns
135
+ ];
136
+ const [fixImportsFilePaths, checkExportsFilePaths] = await Promise.all([Array.fromAsync(fs.glob(FILES_GLOB, { exclude: fixImportsIgnorePatterns })), Array.fromAsync(fs.glob(FILES_GLOB, { exclude: BASE_IGNORE_PATTERNS }))]);
137
+ const fixImportsResult = await fixImports(fixImportsFilePaths, fixImportsOptions);
138
+ if (isErr(fixImportsResult)) errors.push(fixImportsResult);
139
+ const checkExportsResult = await checkExports(checkExportsFilePaths);
140
+ if (isErr(checkExportsResult)) errors.push(checkExportsResult);
141
+ return errors;
142
+ }
143
+ async function main() {
144
+ const errors = await tsImportFix();
145
+ if (errors.length === 0) {
146
+ console.log(`${pc.greenBright("[ts-import-fix]")} Done`);
147
+ return 0;
148
+ }
149
+ const errorMessage = errors.map((error) => `${pc.redBright("[ts-import-fix]")} ${error.messageChain}`).join("\n\n");
150
+ process.stderr.write(`${errorMessage}\n`);
151
+ return 1;
152
+ }
153
+ if (import.meta.main) process.exitCode = await main();
154
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamhl8/configs",
3
- "version": "0.16.3",
3
+ "version": "0.17.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,12 +17,12 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "bin": {
20
- "adamhl8-knip": "./dist/adamhl8-knip",
21
- "ts-import-fix": "./dist/ts-import-fix"
20
+ "adamhl8-knip": "./dist/adamhl8-knip/index",
21
+ "ts-import-fix": "./dist/ts-import-fix/index"
22
22
  },
23
23
  "exports": {
24
- "./tsconfig": "./dist/tsconfig.base.json",
25
- "./biome": "./dist/biome.base.json",
24
+ "./tsconfig": "./dist/configs/tsconfig.base.json",
25
+ "./biome": "./dist/configs/biome.base.json",
26
26
  ".": {
27
27
  "types": "./dist/index.d.ts",
28
28
  "import": "./dist/index.js"
@@ -31,34 +31,37 @@
31
31
  "files": ["./dist/"],
32
32
  "scripts": {
33
33
  "bundle": "bun lint && tsdown",
34
- "lint": "bun ./generate-biome-rules.ts && markdown-toc -i --bullets '-' --maxdepth 3 ./README.md && tsc --noEmit && biome check --write && ./src/adamhl8-knip.ts",
34
+ "lint": "bun ./generate-biome-rules.ts && markdown-toc -i --bullets '-' --maxdepth 3 ./README.md && ./src/ts-import-fix/index.ts -w --skip-alias && tsc --noEmit && biome check --write && ./src/adamhl8-knip/index.ts",
35
35
  "prepare": "find .githooks -type f -exec ln -srf {} .git/hooks/ \\; || true",
36
36
  "prepublishOnly": "bun bundle"
37
37
  },
38
+ "peerDependencies": {
39
+ "typescript": "^5.0.0"
40
+ },
38
41
  "dependencies": {
42
+ "@optique/core": "^0.5.0-dev.83",
43
+ "@optique/run": "^0.5.0-dev.83",
39
44
  "@prettier/plugin-xml": "^3.4.2",
40
45
  "es-toolkit": "^1.39.10",
46
+ "get-tsconfig": "^4.10.1",
47
+ "picocolors": "^1.1.1",
41
48
  "prettier-plugin-astro": "^0.14.1",
42
49
  "prettier-plugin-sh": "^0.18.0",
43
50
  "prettier-plugin-tailwindcss": "^0.6.14",
44
51
  "prettier-plugin-toml": "^2.0.6",
45
52
  "remeda": "^2.32.0",
53
+ "ts-explicit-errors": "^4.0.1",
54
+ "tsdown": "^0.15.4",
46
55
  "type-fest": "^5.0.1"
47
56
  },
48
57
  "devDependencies": {
49
58
  "@arethetypeswrong/core": "^0.18.2",
50
59
  "@biomejs/biome": "^2.2.4",
51
- "@optique/core": "^0.5.0-dev.83",
52
- "@optique/run": "^0.5.0-dev.83",
53
60
  "@types/bun": "^1.2.22",
54
- "get-tsconfig": "^4.10.1",
55
61
  "knip": "^5.63.1",
56
62
  "markdown-toc": "^1.2.0",
57
- "picocolors": "^1.1.1",
58
63
  "prettier": "^3.6.2",
59
64
  "publint": "^0.3.13",
60
- "ts-explicit-errors": "^4.0.1",
61
- "tsdown": "^0.15.4",
62
65
  "typescript": "^5.9.2"
63
66
  },
64
67
  "publishConfig": {
package/dist/adamhl8-knip DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env bun
2
- import path from "node:path";
3
- import process from "node:process";
4
- const baseKnipPreprocessorPath = `${path.resolve(import.meta.dir, "./knip-preprocessor")}`;
5
- const knipPreprocessorPathExt = await Bun.file(`${baseKnipPreprocessorPath}.ts`).exists() ? ".ts" : ".js";
6
- const knipPreprocessorPath = `${baseKnipPreprocessorPath}${knipPreprocessorPathExt}`;
7
- process.exitCode = Bun.spawnSync({
8
- cmd: [
9
- "knip-bun",
10
- "--preprocessor",
11
- knipPreprocessorPath,
12
- ...process.argv.slice(2)
13
- ],
14
- stdout: "inherit",
15
- stderr: "inherit"
16
- }).exitCode;
17
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"knip-preprocessor.d.ts","names":[],"sources":["../src/knip-preprocessor.ts"],"sourcesContent":[],"mappings":";;;cA4BM,YAAY"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"knip-preprocessor.js","names":["preprocess: Preprocessor"],"sources":["../src/knip-preprocessor.ts"],"sourcesContent":["import type { Preprocessor, ReporterOptions } from \"knip\"\nimport type { Issue, SymbolIssueType } from \"knip/dist/types/issues\"\n\nimport { knipConfig } from \"./index.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/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,eAAgB,QAAO;EACnC,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"}
package/dist/knip.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"knip.js","names":[],"sources":["../src/knip.ts"],"sourcesContent":["import type { KnipConfig } from \"knip\"\n\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// Normally, specifying the `./src/index.ts` entry would cause knip to complain about a redundant entry because it gets automatically included via the tsdown plugin.\n// However, in projects that _don't_ use tsdown, the `./src/index.ts` entry would be missing entirely.\n// To handle this, we specify it and disable the tsdown plugin. This makes knip work in both cases.\n\nconst baseConfig = {\n entry: [\"./src/index.ts\", \"**/*.test.ts\", \"./tsdown.config.ts\"],\n project: [\"**\"],\n tsdown: false,\n} as const satisfies KnipConfig\n\nexport const knipConfig = createMergeConfigFn<KnipConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";AAcA,MAAa,aAAa,oBANP;CACjB,OAAO;EAAC;EAAkB;EAAgB;EAAqB;CAC/D,SAAS,CAAC,KAAK;CACf,QAAQ;CACT,CAEuF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prettier.d.ts","names":[],"sources":["../src/prettier.ts"],"sourcesContent":[],"mappings":";;;;cAoCa;;;;IAAA,YAAA,CAAmF,EAAA,MAAA,GAAA,MAAA,EAAA;IAAA,OAAA,CAAA,EAAA,SAAA,CACwpP,OADxpP;;;;;;;;;EAArE,UAAA,CAAA,EAAA,MAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prettier.js","names":[],"sources":["../src/prettier.ts"],"sourcesContent":["import type { Config } from \"prettier\"\nimport type { Simplify } from \"type-fest\"\n\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// for some reason the Config type from prettier doesn't satisfy AnyObj unless we simplify it\ntype PrettierConfig = Simplify<Config>\n\nconst baseConfig = {\n printWidth: 120,\n semi: false,\n plugins: [\n \"@prettier/plugin-xml\",\n \"prettier-plugin-sh\",\n \"prettier-plugin-toml\",\n \"prettier-plugin-astro\",\n \"prettier-plugin-tailwindcss\",\n ],\n tailwindStylesheet: \"./src/global.css\",\n overrides: [\n {\n // https://github.com/prettier/prettier/issues/15956\n files: \"*.jsonc\",\n options: {\n trailingComma: \"none\",\n },\n },\n {\n files: \"*.astro\",\n options: {\n parser: \"astro\",\n },\n },\n ],\n} as const satisfies PrettierConfig\n\nexport const prettierConfig = createMergeConfigFn<PrettierConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";AAoCA,MAAa,iBAAiB,oBA5BX;CACjB,YAAY;CACZ,MAAM;CACN,SAAS;EACP;EACA;EACA;EACA;EACA;EACD;CACD,oBAAoB;CACpB,WAAW,CACT;EAEE,OAAO;EACP,SAAS,EACP,eAAe,QAChB;EACF,EACD;EACE,OAAO;EACP,SAAS,EACP,QAAQ,SACT;EACF,CACF;CACF,CAE+F"}