@adamhl8/configs 0.17.14 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -211,27 +211,47 @@
211
211
  "useYield": "error"
212
212
  },
213
213
  "nursery": {
214
+ "noAmbiguousAnchorText": "error",
215
+ "noBeforeInteractiveScriptOutsideDocument": "error",
214
216
  "noContinue": "off",
215
217
  "noDeprecatedImports": "error",
218
+ "noDivRegex": "error",
219
+ "noDuplicateArgumentNames": "error",
220
+ "noDuplicateAttributes": "error",
216
221
  "noDuplicateDependencies": "error",
222
+ "noDuplicateEnumValueNames": "error",
223
+ "noDuplicateEnumValues": "error",
224
+ "noDuplicateFieldDefinitionNames": "error",
225
+ "noDuplicateGraphqlOperationName": "error",
226
+ "noDuplicateInputFieldNames": "error",
227
+ "noDuplicateVariableNames": "error",
217
228
  "noDuplicatedSpreadProps": "error",
218
229
  "noEmptySource": "error",
219
230
  "noEqualsToNull": "error",
231
+ "noExcessiveClassesPerFile": "error",
232
+ "noExcessiveLinesPerFile": "error",
233
+ "noFloatingClasses": "error",
220
234
  "noFloatingPromises": "error",
221
235
  "noForIn": "error",
222
236
  "noImportCycles": "error",
223
237
  "noIncrementDecrement": "off",
224
238
  "noJsxLiterals": "off",
239
+ "noJsxPropsBind": "error",
225
240
  "noLeakedRender": "error",
226
241
  "noMisusedPromises": "error",
242
+ "noMultiAssign": "error",
227
243
  "noMultiStr": "error",
228
244
  "noNextAsyncClientComponent": "error",
229
245
  "noParametersOnlyUsedInRecursion": "error",
230
246
  "noProto": "error",
231
247
  "noReactForwardRef": "error",
248
+ "noReturnAssign": "error",
249
+ "noRootType": "error",
250
+ "noScriptUrl": "error",
232
251
  "noShadow": "error",
233
252
  "noSyncScripts": "off",
234
253
  "noTernary": "off",
254
+ "noUndeclaredEnvVars": "error",
235
255
  "noUnknownAttribute": "error",
236
256
  "noUnnecessaryConditions": "error",
237
257
  "noUnresolvedImports": "off",
@@ -240,32 +260,50 @@
240
260
  "noUselessUndefined": "error",
241
261
  "noVueDataObjectDeclaration": "off",
242
262
  "noVueDuplicateKeys": "off",
263
+ "noVueOptionsApi": "error",
243
264
  "noVueReservedKeys": "off",
244
265
  "noVueReservedProps": "off",
266
+ "noVueSetupPropsReactivityLoss": "error",
245
267
  "noVueVIfWithVFor": "off",
246
268
  "useArraySortCompare": "error",
269
+ "useAwaitThenable": "off",
247
270
  "useConsistentArrowReturn": "error",
248
271
  "useConsistentGraphqlDescriptions": "error",
249
272
  "useDeprecatedDate": "error",
273
+ "useDestructuring": "error",
274
+ "useErrorCause": "error",
250
275
  "useExhaustiveSwitchCases": "error",
251
276
  "useExplicitType": "off",
252
277
  "useFind": "error",
278
+ "useInlineScriptId": "error",
279
+ "useLoneAnonymousOperation": "error",
280
+ "useLoneExecutableDefinition": "error",
253
281
  "useMaxParams": "error",
254
282
  "useQwikMethodUsage": "off",
255
283
  "useQwikValidLexicalScope": "off",
284
+ "useRegexpExec": "error",
285
+ "useRequiredScripts": "error",
256
286
  "useSortedClasses": "error",
257
287
  "useSpread": "error",
258
- "useUniqueGraphqlOperationName": "error",
288
+ "useVueConsistentDefinePropsDeclaration": "error",
289
+ "useVueConsistentVBindStyle": "error",
290
+ "useVueConsistentVOnStyle": "error",
259
291
  "useVueDefineMacrosOrder": "off",
260
292
  "useVueHyphenatedAttributes": "off",
261
293
  "useVueMultiWordComponentNames": "off",
294
+ "useVueVForKey": "error",
295
+ "useVueValidTemplateRoot": "error",
262
296
  "useVueValidVBind": "off",
297
+ "useVueValidVCloak": "error",
263
298
  "useVueValidVElse": "off",
264
299
  "useVueValidVElseIf": "off",
265
300
  "useVueValidVHtml": "off",
266
301
  "useVueValidVIf": "off",
267
302
  "useVueValidVOn": "off",
268
- "useVueValidVText": "off"
303
+ "useVueValidVOnce": "error",
304
+ "useVueValidVPre": "error",
305
+ "useVueValidVText": "off",
306
+ "useVueVapor": "error"
269
307
  },
270
308
  "performance": {
271
309
  "noAccumulatingSpread": "error",
@@ -1,4 +1,4 @@
1
- import { Preprocessor } from "knip";
1
+ import { Preprocessor } from "../node_modules/knip/dist/types/issues.js";
2
2
 
3
3
  //#region src/configs/knip-preprocessor.d.ts
4
4
  declare const preprocess: Preprocessor;
@@ -1 +1 @@
1
- {"version":3,"file":"knip-preprocessor.d.ts","names":[],"sources":["../../src/configs/knip-preprocessor.ts"],"sourcesContent":[],"mappings":";;;cAyFM,YAAY"}
1
+ {"version":3,"file":"knip-preprocessor.d.ts","names":[],"sources":["../../src/configs/knip-preprocessor.ts"],"mappings":";;;cA4FM,UAAA,EAAY,YAAA"}
@@ -11,8 +11,7 @@ function modifyIssues(options, issueType, mapFn) {
11
11
  }
12
12
  const entries = knipConfig().entry;
13
13
  const preprocess = (options) => {
14
- 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")));
15
- options.configurationHints = new Set(filteredConfigurationHints);
14
+ options.configurationHints = options.configurationHints.filter((hint) => !(entries.some((entry) => typeof hint.identifier === "string" && hint.identifier.includes(entry)) && (hint.type === "entry-empty" || hint.type === "entry-redundant")));
16
15
  modifyIssues(options, "unlisted", ([, issueRecordEntries]) => issueRecordEntries.filter(([key]) => !key.includes("prettier")));
17
16
  modifyIssues(options, "types", ([filePath, issueRecordEntries]) => {
18
17
  if (filePath !== "src/configs/utils.ts") return issueRecordEntries;
@@ -1 +1 @@
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;CAEtD,MAAM,qBAAqB,qBADA,YAAY,eAAe;AAGtD,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"}
1
+ {"version":3,"file":"knip-preprocessor.js","names":[],"sources":["../../src/configs/knip-preprocessor.ts"],"sourcesContent":["import type {\n IssueRecords,\n Preprocessor,\n ReporterOptions,\n SymbolIssueType,\n} from \"../../node_modules/knip/dist/types/issues.d.ts\"\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 options.configurationHints = 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\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":";AA2DA,SAAS,aACP,SACA,WACA,OACA;CACA,MAAM,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,MAAM,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;CAEtD,MAAM,qBAAqB,qBADA,YAAY,eAAe;AAGtD,SAAQ,SAAS,aAAa,qBAAqB;AACnD,SAAQ,OAAO,aAAa;;AAG9B,MAAM,UAAU,YAAY,CAAC;AAE7B,MAAM,cAA4B,YAAY;AAE5C,SAAQ,qBAAqB,QAAQ,mBAAmB,QACrD,SACC,EACE,QAAQ,MAAM,UAAU,OAAO,KAAK,eAAe,YAAY,KAAK,WAAW,SAAS,MAAM,CAAC,KAC9F,KAAK,SAAS,iBAAiB,KAAK,SAAS,oBAEnD;AAED,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"}
@@ -1,12 +1,13 @@
1
+ import { RawConfigurationOrFn } from "../node_modules/knip/dist/types/config.js";
1
2
  import { OptionalMergeConfigFn } from "./utils.js";
2
- import { KnipConfig } from "knip";
3
3
 
4
4
  //#region src/configs/knip.d.ts
5
- declare const knipConfig: OptionalMergeConfigFn<KnipConfig, {
5
+ declare const baseConfig: {
6
6
  readonly entry: ["./src/index.ts", "**/*.test.ts", "./tsdown.config.ts"];
7
7
  readonly project: ["**"];
8
8
  readonly tsdown: false;
9
- }>;
9
+ };
10
+ declare const knipConfig: OptionalMergeConfigFn<RawConfigurationOrFn, typeof baseConfig>;
10
11
  //#endregion
11
12
  export { knipConfig };
12
13
  //# sourceMappingURL=knip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"knip.d.ts","names":[],"sources":["../../src/configs/knip.ts"],"sourcesContent":[],"mappings":";;;;cAca,YAAU,sBAAA;;;EAAV,SAAA,MAA2E,EAAA,KAAA"}
1
+ {"version":3,"file":"knip.d.ts","names":[],"sources":["../../src/configs/knip.ts"],"mappings":";;;;cASM,UAAA;EAAA;;;;cAMO,UAAA,EAAY,qBAAA,CAAsB,oBAAA,SAAmB,UAAA"}
@@ -1 +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
+ {"version":3,"file":"knip.js","names":[],"sources":["../../src/configs/knip.ts"],"sourcesContent":["import type { KnipConfig } from \"knip\"\n\nimport type { OptionalMergeConfigFn } from \"./utils.ts\"\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: OptionalMergeConfigFn<KnipConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";AAeA,MAAa,aAAmE,oBAN7D;CACjB,OAAO;EAAC;EAAkB;EAAgB;EAAqB;CAC/D,SAAS,CAAC,KAAK;CACf,QAAQ;CACT,CAE8G"}
@@ -1,46 +1,10 @@
1
1
  import { OptionalMergeConfigFn } from "./utils.js";
2
- import * as prettier0 from "prettier";
2
+ import { Simplify } from "type-fest";
3
+ import { Config } from "prettier";
3
4
 
4
5
  //#region src/configs/prettier.d.ts
5
- declare const prettierConfig: OptionalMergeConfigFn<{
6
- [x: string]: unknown;
7
- overrides?: Array<{
8
- files: string | string[];
9
- excludeFiles?: string | string[];
10
- options?: prettier0.Options;
11
- }>;
12
- semi?: boolean;
13
- singleQuote?: boolean;
14
- jsxSingleQuote?: boolean;
15
- trailingComma?: "none" | "es5" | "all";
16
- bracketSpacing?: boolean;
17
- objectWrap?: "preserve" | "collapse";
18
- bracketSameLine?: boolean;
19
- rangeStart?: number;
20
- rangeEnd?: number;
21
- parser?: prettier0.LiteralUnion<prettier0.BuiltInParserName>;
22
- filepath?: string;
23
- requirePragma?: boolean;
24
- insertPragma?: boolean;
25
- checkIgnorePragma?: boolean;
26
- proseWrap?: "always" | "never" | "preserve";
27
- arrowParens?: "avoid" | "always";
28
- plugins?: Array<string | URL | prettier0.Plugin>;
29
- htmlWhitespaceSensitivity?: "css" | "strict" | "ignore";
30
- endOfLine?: "auto" | "lf" | "crlf" | "cr";
31
- quoteProps?: "as-needed" | "consistent" | "preserve";
32
- vueIndentScriptAndStyle?: boolean;
33
- embeddedLanguageFormatting?: "auto" | "off";
34
- singleAttributePerLine?: boolean;
35
- experimentalOperatorPosition?: "start" | "end";
36
- experimentalTernaries?: boolean;
37
- jsxBracketSameLine?: boolean;
38
- printWidth?: number;
39
- tabWidth?: number;
40
- useTabs?: boolean;
41
- parentParser?: string | undefined | undefined;
42
- __embeddedInHtml?: boolean | undefined | undefined;
43
- }, {
6
+ type PrettierConfig = Simplify<Config>;
7
+ declare const baseConfig: {
44
8
  readonly printWidth: 120;
45
9
  readonly semi: false;
46
10
  readonly plugins: ["@prettier/plugin-xml", "prettier-plugin-sh", "prettier-plugin-toml", "prettier-plugin-astro", "prettier-plugin-tailwindcss"];
@@ -56,7 +20,8 @@ declare const prettierConfig: OptionalMergeConfigFn<{
56
20
  readonly parser: "astro";
57
21
  };
58
22
  }];
59
- }>;
23
+ };
24
+ declare const prettierConfig: OptionalMergeConfigFn<PrettierConfig, typeof baseConfig>;
60
25
  //#endregion
61
26
  export { prettierConfig };
62
27
  //# sourceMappingURL=prettier.d.ts.map
@@ -1 +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,OACwpP,CAAA,EADxpP,SAAA,CACwpP,OAAA;;;;;;;;EAD7tP,eAAA,CAAA,EAAA,OAAA"}
1
+ {"version":3,"file":"prettier.d.ts","names":[],"sources":["../../src/configs/prettier.ts"],"mappings":";;;;;KAOK,cAAA,GAAiB,QAAA,CAAS,MAAA;AAAA,cAEzB,UAAA;EAAA;;;;;;;;;;;;;;;;cA4BO,cAAA,EAAgB,qBAAA,CAAsB,cAAA,SAAuB,UAAA"}
@@ -1 +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"}
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 type { OptionalMergeConfigFn } from \"./utils.ts\"\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: OptionalMergeConfigFn<PrettierConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";AAqCA,MAAa,iBAA2E,oBA5BrE;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,CAEsH"}
@@ -1,73 +1,10 @@
1
1
  import { MergeConfigFn, OptionalMergeConfigFn } from "./utils.js";
2
- import * as rolldown0 from "rolldown";
3
- import * as tsdown0 from "tsdown";
2
+ import { SetRequired } from "type-fest";
4
3
  import { UserConfig } from "tsdown";
5
- import * as rolldown_plugin_dts0 from "rolldown-plugin-dts";
6
- import * as publint0 from "publint";
7
- import * as hookable0 from "hookable";
8
4
 
9
5
  //#region src/configs/tsdown.d.ts
10
- declare const tsdownConfig: MergeConfigFn<{
11
- entry?: rolldown0.InputOption;
12
- external?: rolldown0.ExternalOption;
13
- noExternal?: (string | RegExp | (string | RegExp)[]) | tsdown0.NoExternalFn;
14
- inlineOnly?: string | RegExp | (string | RegExp)[];
15
- skipNodeModulesBundle?: boolean;
16
- alias?: Record<string, string>;
17
- tsconfig?: string | boolean;
18
- target?: string | string[] | false;
19
- env?: Record<string, any>;
20
- define?: Record<string, string>;
21
- shims?: boolean;
22
- treeshake?: boolean | rolldown0.TreeshakingOptions;
23
- loader?: rolldown0.ModuleTypes;
24
- removeNodeProtocol?: boolean;
25
- nodeProtocol?: "strip" | boolean;
26
- plugins?: rolldown0.RolldownPluginOption<any>;
27
- inputOptions?: rolldown0.InputOptions | ((options: rolldown0.InputOptions, format: tsdown0.NormalizedFormat, context: {
28
- cjsDts: boolean;
29
- }) => void | rolldown0.InputOptions | Promise<void | rolldown0.InputOptions | null> | null);
30
- format?: tsdown0.Format | tsdown0.Format[];
31
- globalName?: string;
32
- outDir?: string;
33
- sourcemap?: tsdown0.Sourcemap;
34
- clean?: boolean | string[];
35
- minify?: boolean | "dce-only" | rolldown0.MinifyOptions;
36
- footer?: tsdown0.ChunkAddon;
37
- banner?: tsdown0.ChunkAddon;
38
- unbundle?: boolean;
39
- bundle?: boolean;
40
- fixedExtension?: boolean;
41
- outExtensions?: tsdown0.OutExtensionFactory;
42
- hash?: boolean;
43
- cjsDefault?: boolean;
44
- outputOptions?: rolldown0.OutputOptions | ((options: rolldown0.OutputOptions, format: tsdown0.NormalizedFormat, context: {
45
- cjsDts: boolean;
46
- }) => void | rolldown0.OutputOptions | Promise<void | rolldown0.OutputOptions | null> | null);
47
- cwd?: string;
48
- name?: string;
49
- silent?: boolean;
50
- logLevel?: "silent" | ("error" | "warn" | "info");
51
- failOnWarn?: boolean | tsdown0.CIOption;
52
- customLogger?: tsdown0.Logger;
53
- fromVite?: boolean | "vitest";
54
- watch?: boolean | (string | string[]);
55
- ignoreWatch?: string | RegExp | (string | RegExp)[];
56
- onSuccess?: string | ((config: tsdown0.ResolvedConfig, signal: AbortSignal) => void | Promise<void>);
57
- debug?: tsdown0.WithEnabled<tsdown0.DebugOptions>;
58
- dts?: tsdown0.WithEnabled<rolldown_plugin_dts0.Options>;
59
- unused?: tsdown0.WithEnabled<UnusedOptions>;
60
- publint?: tsdown0.WithEnabled<publint0.Options>;
61
- attw?: tsdown0.WithEnabled<tsdown0.AttwOptions>;
62
- report?: tsdown0.WithEnabled<tsdown0.ReportOptions>;
63
- globImport?: boolean;
64
- exports?: tsdown0.WithEnabled<tsdown0.ExportsOptions>;
65
- publicDir?: tsdown0.CopyOptions | tsdown0.CopyOptionsFn;
66
- copy?: tsdown0.CopyOptions | tsdown0.CopyOptionsFn;
67
- hooks?: Partial<tsdown0.TsdownHooks> | ((hooks: hookable0.Hookable<tsdown0.TsdownHooks>) => void | Promise<void>);
68
- workspace?: tsdown0.Workspace | (string | string[]) | true;
69
- platform: "node" | "neutral" | "browser";
70
- }, {
6
+ type StrictUserConfig = SetRequired<UserConfig, "platform">;
7
+ declare const baseConfig: {
71
8
  readonly entry: ["./src/index.ts"];
72
9
  readonly unbundle: true;
73
10
  readonly target: false;
@@ -77,6 +14,7 @@ declare const tsdownConfig: MergeConfigFn<{
77
14
  readonly sourcemap: true;
78
15
  readonly hash: false;
79
16
  readonly dts: {
17
+ readonly resolver: "tsc";
80
18
  readonly newContext: true;
81
19
  readonly sourcemap: true;
82
20
  };
@@ -86,14 +24,13 @@ declare const tsdownConfig: MergeConfigFn<{
86
24
  };
87
25
  readonly publint: true;
88
26
  readonly failOnWarn: true;
89
- }>;
90
- declare const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, {
27
+ };
28
+ declare const binConfig: {
91
29
  readonly entry: [];
92
30
  readonly platform: "node";
93
31
  readonly outExtensions: () => {
94
32
  js: string;
95
33
  };
96
- readonly copy: [];
97
34
  readonly unbundle: false;
98
35
  readonly sourcemap: false;
99
36
  readonly dts: false;
@@ -104,7 +41,9 @@ declare const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, {
104
41
  readonly minify: "dce-only";
105
42
  readonly hash: false;
106
43
  readonly failOnWarn: true;
107
- }>;
44
+ };
45
+ declare const tsdownConfig: MergeConfigFn<StrictUserConfig, typeof baseConfig>;
46
+ declare const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, typeof binConfig>;
108
47
  //#endregion
109
48
  export { tsdownBinConfig, tsdownConfig };
110
49
  //# sourceMappingURL=tsdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsdown.d.ts","names":[],"sources":["../../src/configs/tsdown.ts"],"sourcesContent":[],"mappings":";;;;;;;;;cA0Ca;UAAyF,SAAA,CAAA;;;;;;;EAAzF,MAAA,CAAA,EAAA,MAAyF,GAAA,MAAA,EAAA,GAAA,KAAA;EAAA,GAAA,CAAA,QAAA,CAAA,MAAA,EAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA7E,SAAA,IAAA,EAAA;IACZ,SAAA,KAA8E,EAAA,OAAA;;;;;;cAA9E,iBAAe,sBAAA"}
1
+ {"version":3,"file":"tsdown.d.ts","names":[],"sources":["../../src/configs/tsdown.ts"],"mappings":";;;;;KAOK,gBAAA,GAAmB,WAAA,CAAY,UAAA;AAAA,cAE9B,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;cAsBA,SAAA;EAAA;;;;;;;;;;;;;;;;cAYO,YAAA,EAAc,aAAA,CAAc,gBAAA,SAAyB,UAAA;AAAA,cACrD,eAAA,EAAiB,qBAAA,CAAsB,UAAA,SAAmB,SAAA"}
@@ -9,6 +9,7 @@ const baseConfig = {
9
9
  sourcemap: true,
10
10
  hash: false,
11
11
  dts: {
12
+ resolver: "tsc",
12
13
  newContext: true,
13
14
  sourcemap: true
14
15
  },
@@ -24,7 +25,6 @@ const binConfig = {
24
25
  entry: [],
25
26
  platform: "node",
26
27
  outExtensions: () => ({ js: "" }),
27
- copy: [],
28
28
  unbundle: false,
29
29
  sourcemap: false,
30
30
  dts: false,
@@ -1 +1 @@
1
- {"version":3,"file":"tsdown.js","names":[],"sources":["../../src/configs/tsdown.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// force projects to specify platform\ntype StrictUserConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n unbundle: true,\n target: false,\n platform: \"neutral\",\n fixedExtension: false,\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: \"esm-only\",\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 UserConfig\n\nexport const tsdownConfig = createMergeConfigFn<StrictUserConfig, typeof baseConfig, true>(baseConfig)\nexport const tsdownBinConfig = createMergeConfigFn<UserConfig, typeof binConfig>(binConfig)\n"],"mappings":";AAQA,MAAM,aAAa;CACjB,OAAO,CAAC,iBAAiB;CACzB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,gBAAgB;CAChB,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,oBAAkD,UAAU"}
1
+ {"version":3,"file":"tsdown.js","names":[],"sources":["../../src/configs/tsdown.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport type { MergeConfigFn, OptionalMergeConfigFn } from \"./utils.ts\"\nimport { createMergeConfigFn } from \"./utils.ts\"\n\n// force projects to specify platform\ntype StrictUserConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n unbundle: true,\n target: false,\n platform: \"neutral\",\n fixedExtension: false,\n minify: \"dce-only\",\n sourcemap: true,\n hash: false,\n dts: {\n resolver: \"tsc\",\n newContext: true,\n sourcemap: true,\n },\n attw: {\n level: \"error\",\n profile: \"esm-only\",\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 unbundle: false,\n sourcemap: false,\n dts: false,\n attw: false,\n publint: false,\n} as const satisfies UserConfig\n\nexport const tsdownConfig: MergeConfigFn<StrictUserConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\nexport const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, typeof binConfig> = createMergeConfigFn(binConfig)\n"],"mappings":";AASA,MAAM,aAAa;CACjB,OAAO,CAAC,iBAAiB;CACzB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,gBAAgB;CAChB,QAAQ;CACR,WAAW;CACX,MAAM;CACN,KAAK;EACH,UAAU;EACV,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,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;CACN,SAAS;CACV;AAED,MAAa,eAAmE,oBAAoB,WAAW;AAC/G,MAAa,kBAAuE,oBAAoB,UAAU"}
@@ -1,9 +1,8 @@
1
1
  import { MergeDeep } from "type-fest";
2
2
 
3
3
  //#region src/configs/utils.d.ts
4
-
5
4
  /**
6
- * Type representing a merge config function, where the `UserConfig` passed in is merged with `BaseConfig`.
5
+ * The merge config function, where the `UserConfig` passed in is merged with `BaseConfig`.
7
6
  */
8
7
  interface MergeConfigFn<UserConfig, BaseConfig> {
9
8
  <UserConfigToMerge extends UserConfig>(userConfig: UserConfigToMerge): MergeDeep<BaseConfig, UserConfigToMerge, {
@@ -11,12 +10,10 @@ interface MergeConfigFn<UserConfig, BaseConfig> {
11
10
  }>;
12
11
  }
13
12
  /**
14
- * Type representing an overloaded function signature for MergeConfigFn:
13
+ * The optional merge config function, where the `userConfig` argument is optional.
15
14
  * - if `UserConfig` is not provided, the return type is `BaseConfig`
16
15
  * - if `UserConfig` is provided, the return type is the merged type of `BaseConfig` and `UserConfig`.
17
16
  *
18
- * This is needed to handle the fact that the `userConfig` argument is optional.
19
- *
20
17
  * Note that this extends `MergeConfigFn`, so this type has both function signatures on it.
21
18
  */
22
19
  interface OptionalMergeConfigFn<UserConfig, BaseConfig> extends MergeConfigFn<UserConfig, BaseConfig> {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/configs/utils.ts"],"sourcesContent":[],"mappings":";;;;;AAkBA;;AAGgB,UAHC,aAGD,CAAA,UAAA,EAAA,UAAA,CAAA,CAAA;EACD,CAAA,0BAFc,UAEd,CAAA,CAAA,UAAA,EADC,iBACD,CAAA,EAAV,SAAU,CAAA,UAAA,EAAY,iBAAZ,EAAA;IAAY,cAAA,EAAA,QAAA;EAAtB,CAAA,CAAA;;AAaL;;;;;;;;;UAAiB,sDAAsD,cAAc,YAAY;MAC3F"}
1
+ {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/configs/utils.ts"],"mappings":";;;;AAkBA;;UAAiB,aAAA;EAAA,2BAEY,UAAA,EACzB,UAAA,EAAY,iBAAA,GACX,SAAA,CAAU,UAAA,EAAY,iBAAA;IAAqB,cAAA;EAAA;AAAA;;;;;;;;UAW/B,qBAAA,iCAAsD,aAAA,CAAc,UAAA,EAAY,UAAA;EAAA,IAC3F,UAAA;AAAA"}
@@ -1 +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 = object\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"}
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 = object\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 * The 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 * The optional merge config function, where the `userConfig` argument is optional.\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 * 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<UserConfig extends AnyObj, BaseConfig extends UserConfig>(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 MergeConfigFn<UserConfig, BaseConfig> & OptionalMergeConfigFn<UserConfig, BaseConfig>\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;;AA4BH,SAAgB,oBAA8E,YAAwB;CAEpH,MAAM,iBAAiB,eAAwB;AAC7C,MAAI,eAAe,KAAA,EAAW,QAAO;AAErC,SAAO,MAAM,MAAM,WAAW,EAAE,MAAM,WAAW,CAAC;;AAGpD,QAAO"}
@@ -13,7 +13,7 @@ function cli() {
13
13
  return run(object({
14
14
  write: option("-w", "--write", { description: message`Write changes to files` }),
15
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)` })),
16
+ fileIgnorePatterns: multiple(option("-f", "--file-ignore", string({ metavar: "PATTERN" }), { description: message`Additional glob patterns for files to ignore` })),
17
17
  importIgnoreStrings: multiple(option("-i", "--import-ignore", string(), { description: message`An import path *containing* the given string will be ignored` }))
18
18
  }), {
19
19
  programName: "ts-import-fix",
@@ -167,19 +167,23 @@ async function fixImports(filePaths, { write, importIgnoreStrings, skipAlias })
167
167
  if (IMPORT_ERRORS.length > 0) return err(`failed to transform some imports:\n${IMPORT_ERRORS.join("\n")}`, void 0);
168
168
  }
169
169
  const FILES_GLOB = "**/*.{ts,tsx,js,jsx,astro}";
170
- const BASE_IGNORE_PATTERNS = ["node_modules/", "dist/"];
170
+ const BASE_IGNORE_PATTERNS = [
171
+ ".git/",
172
+ "node_modules/",
173
+ "dist/"
174
+ ];
171
175
  async function tsImportFix() {
172
176
  const { fileIgnorePatterns, ...fixImportsOptions } = cli();
173
177
  const errors = [];
174
- const fixImportsIgnorePatterns = [
178
+ const allFileIgnorePatterns = [
175
179
  ...BASE_IGNORE_PATTERNS,
176
180
  "astro.config.ts",
177
181
  ...fileIgnorePatterns
178
182
  ];
179
- const [fixImportsFilePaths, checkExportsFilePaths] = await Promise.all([Array.fromAsync(fs.glob(FILES_GLOB, { exclude: fixImportsIgnorePatterns })), Array.fromAsync(fs.glob(FILES_GLOB, { exclude: BASE_IGNORE_PATTERNS }))]);
180
- const fixImportsResult = await fixImports(fixImportsFilePaths, fixImportsOptions);
183
+ const filePaths = await Array.fromAsync(fs.glob(FILES_GLOB, { exclude: allFileIgnorePatterns }));
184
+ const fixImportsResult = await fixImports(filePaths, fixImportsOptions);
181
185
  if (isErr(fixImportsResult)) errors.push(fixImportsResult);
182
- const checkExportsResult = await checkExports(checkExportsFilePaths);
186
+ const checkExportsResult = await checkExports(filePaths);
183
187
  if (isErr(checkExportsResult)) errors.push(checkExportsResult);
184
188
  return errors;
185
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamhl8/configs",
3
- "version": "0.17.14",
3
+ "version": "0.18.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,29 +39,29 @@
39
39
  "typescript": "^5.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "@optique/core": "^0.7.0",
43
- "@optique/run": "^0.7.0",
42
+ "@optique/core": "^0.9.1",
43
+ "@optique/run": "^0.9.1",
44
44
  "@prettier/plugin-xml": "^3.4.2",
45
- "es-toolkit": "^1.42.0",
45
+ "es-toolkit": "^1.44.0",
46
46
  "get-tsconfig": "^4.13.0",
47
47
  "picocolors": "^1.1.1",
48
48
  "prettier-plugin-astro": "^0.14.1",
49
49
  "prettier-plugin-sh": "^0.18.0",
50
- "prettier-plugin-tailwindcss": "^0.7.1",
50
+ "prettier-plugin-tailwindcss": "^0.7.2",
51
51
  "prettier-plugin-toml": "^2.0.6",
52
- "remeda": "^2.32.0",
53
- "ts-explicit-errors": "^4.0.1",
54
- "tsdown": "^0.17.0-beta.1",
55
- "type-fest": "^5.2.0"
52
+ "remeda": "^2.33.4",
53
+ "ts-explicit-errors": "^4.1.1",
54
+ "type-fest": "^5.4.1"
56
55
  },
57
56
  "devDependencies": {
58
57
  "@arethetypeswrong/core": "^0.18.2",
59
- "@biomejs/biome": "^2.3.8",
60
- "@types/bun": "^1.3.3",
61
- "knip": "^5.70.2",
58
+ "@biomejs/biome": "^2.3.12",
59
+ "@types/bun": "^1.3.6",
60
+ "knip": "^5.82.1",
62
61
  "markdown-toc": "^1.2.0",
63
- "prettier": "^3.7.2",
64
- "publint": "^0.3.15",
62
+ "prettier": "^3.8.1",
63
+ "publint": "^0.3.17",
64
+ "tsdown": "^0.20.1",
65
65
  "typescript": "^5.9.3"
66
66
  },
67
67
  "publishConfig": {