@adamhl8/configs 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -10
- package/dist/biome.base.json +1 -1
- package/dist/index.d.ts +22 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ bun add -D @adamhl8/configs
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
####
|
|
26
|
+
#### Notes
|
|
27
27
|
|
|
28
28
|
```jsonc
|
|
29
29
|
"json": {
|
|
@@ -46,11 +46,8 @@ bun add -D @adamhl8/configs
|
|
|
46
46
|
|
|
47
47
|
```ts
|
|
48
48
|
import { knipConfig } from "@adamhl8/configs"
|
|
49
|
-
import type { KnipConfig } from "knip"
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
export default config
|
|
50
|
+
export default knipConfig({ ... })
|
|
54
51
|
```
|
|
55
52
|
|
|
56
53
|
### tsdown
|
|
@@ -59,15 +56,13 @@ export default config
|
|
|
59
56
|
import { tsdownConfig } from "@adamhl8/configs"
|
|
60
57
|
import { defineConfig } from "tsdown"
|
|
61
58
|
|
|
62
|
-
export default defineConfig(tsdownConfig())
|
|
59
|
+
export default defineConfig(tsdownConfig({ ... }))
|
|
63
60
|
```
|
|
64
61
|
|
|
65
62
|
### prettier
|
|
66
63
|
|
|
67
64
|
```js
|
|
68
|
-
import {
|
|
65
|
+
import { prettierConfig } from "@adamhl8/configs"
|
|
69
66
|
|
|
70
|
-
export default {
|
|
71
|
-
...config,
|
|
72
|
-
}
|
|
67
|
+
export default prettierConfig({ ... })
|
|
73
68
|
```
|
package/dist/biome.base.json
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
1
|
+
import * as type_fest_source_internal_type_js3 from "type-fest/source/internal/type.js";
|
|
2
|
+
import * as type_fest4 from "type-fest";
|
|
3
|
+
import * as type_fest_source_conditional_simplify_js3 from "type-fest/source/conditional-simplify.js";
|
|
4
|
+
import * as type_fest_source_merge_deep_js0 from "type-fest/source/merge-deep.js";
|
|
5
5
|
import { Config } from "prettier";
|
|
6
6
|
import * as tsdown0 from "tsdown";
|
|
7
7
|
|
|
8
8
|
//#region src/knip.d.ts
|
|
9
9
|
declare const knipConfig: {
|
|
10
10
|
(): {
|
|
11
|
-
entry:
|
|
12
|
-
project:
|
|
13
|
-
tsdown: false;
|
|
11
|
+
readonly entry: ["./src/index.ts", "**/*.test.ts", "./tsdown.config.ts"];
|
|
12
|
+
readonly project: ["**"];
|
|
13
|
+
readonly tsdown: false;
|
|
14
14
|
};
|
|
15
15
|
<UserConfig extends {
|
|
16
16
|
node?: string | boolean | string[] | {
|
|
@@ -1164,19 +1164,19 @@ declare const knipConfig: {
|
|
|
1164
1164
|
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
1165
1165
|
includeEntryExports?: boolean | undefined;
|
|
1166
1166
|
}> | undefined;
|
|
1167
|
-
}>(userConfig: UserConfig):
|
|
1168
|
-
entry:
|
|
1169
|
-
project:
|
|
1170
|
-
tsdown: false;
|
|
1171
|
-
} |
|
|
1172
|
-
entry:
|
|
1173
|
-
project:
|
|
1174
|
-
tsdown: false;
|
|
1167
|
+
}>(userConfig: UserConfig): type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<[undefined] extends [{
|
|
1168
|
+
readonly entry: ["./src/index.ts", "**/*.test.ts", "./tsdown.config.ts"];
|
|
1169
|
+
readonly project: ["**"];
|
|
1170
|
+
readonly tsdown: false;
|
|
1171
|
+
} | type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<UserConfig, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object>] ? never : type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<UserConfig, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object> extends infer T ? T extends type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<UserConfig, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object> ? T extends type_fest4.UnknownRecord ? type_fest_source_merge_deep_js0.MergeDeepRecord<{
|
|
1172
|
+
readonly entry: ["./src/index.ts", "**/*.test.ts", "./tsdown.config.ts"];
|
|
1173
|
+
readonly project: ["**"];
|
|
1174
|
+
readonly tsdown: false;
|
|
1175
1175
|
}, T, {
|
|
1176
1176
|
recurseIntoArrays: false;
|
|
1177
1177
|
spreadTopLevelArrays: true;
|
|
1178
1178
|
arrayMergeMode: "spread";
|
|
1179
|
-
}> : never : never : never,
|
|
1179
|
+
}> : never : never : never, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object>;
|
|
1180
1180
|
};
|
|
1181
1181
|
//#endregion
|
|
1182
1182
|
//#region src/prettier.d.ts
|
|
@@ -1198,7 +1198,7 @@ declare const prettierConfig: {
|
|
|
1198
1198
|
};
|
|
1199
1199
|
}];
|
|
1200
1200
|
};
|
|
1201
|
-
<UserConfig extends Config>(userConfig: UserConfig):
|
|
1201
|
+
<UserConfig extends Config>(userConfig: UserConfig): type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<[undefined] extends [{
|
|
1202
1202
|
readonly printWidth: 120;
|
|
1203
1203
|
readonly semi: false;
|
|
1204
1204
|
readonly plugins: ["@prettier/plugin-xml", "prettier-plugin-sh", "prettier-plugin-toml", "prettier-plugin-astro", "prettier-plugin-tailwindcss"];
|
|
@@ -1214,7 +1214,7 @@ declare const prettierConfig: {
|
|
|
1214
1214
|
readonly parser: "astro";
|
|
1215
1215
|
};
|
|
1216
1216
|
}];
|
|
1217
|
-
} |
|
|
1217
|
+
} | type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<UserConfig, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object>] ? never : type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<UserConfig, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object> extends infer T ? T extends type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<UserConfig, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object> ? T extends type_fest4.UnknownRecord ? type_fest_source_merge_deep_js0.MergeDeepRecord<{
|
|
1218
1218
|
readonly printWidth: 120;
|
|
1219
1219
|
readonly semi: false;
|
|
1220
1220
|
readonly plugins: ["@prettier/plugin-xml", "prettier-plugin-sh", "prettier-plugin-toml", "prettier-plugin-astro", "prettier-plugin-tailwindcss"];
|
|
@@ -1234,7 +1234,7 @@ declare const prettierConfig: {
|
|
|
1234
1234
|
recurseIntoArrays: false;
|
|
1235
1235
|
spreadTopLevelArrays: true;
|
|
1236
1236
|
arrayMergeMode: "spread";
|
|
1237
|
-
}> : never : never : never,
|
|
1237
|
+
}> : never : never : never, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object>;
|
|
1238
1238
|
};
|
|
1239
1239
|
//#endregion
|
|
1240
1240
|
//#region src/tsdown.d.ts
|
|
@@ -1257,7 +1257,7 @@ declare const tsdownConfig: {
|
|
|
1257
1257
|
readonly publint: true;
|
|
1258
1258
|
readonly failOnWarn: true;
|
|
1259
1259
|
};
|
|
1260
|
-
<UserConfig extends tsdown0.UserConfig>(userConfig: UserConfig):
|
|
1260
|
+
<UserConfig extends tsdown0.UserConfig>(userConfig: UserConfig): type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<[undefined] extends [{
|
|
1261
1261
|
readonly entry: ["./src/index.ts"];
|
|
1262
1262
|
readonly unbundle: true;
|
|
1263
1263
|
readonly target: false;
|
|
@@ -1274,7 +1274,7 @@ declare const tsdownConfig: {
|
|
|
1274
1274
|
};
|
|
1275
1275
|
readonly publint: true;
|
|
1276
1276
|
readonly failOnWarn: true;
|
|
1277
|
-
} |
|
|
1277
|
+
} | type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<UserConfig, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object>] ? never : type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<UserConfig, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object> extends infer T ? T extends type_fest_source_conditional_simplify_js3.ConditionalSimplifyDeep<UserConfig, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object> ? T extends type_fest4.UnknownRecord ? type_fest_source_merge_deep_js0.MergeDeepRecord<{
|
|
1278
1278
|
readonly entry: ["./src/index.ts"];
|
|
1279
1279
|
readonly unbundle: true;
|
|
1280
1280
|
readonly target: false;
|
|
@@ -1295,7 +1295,7 @@ declare const tsdownConfig: {
|
|
|
1295
1295
|
recurseIntoArrays: false;
|
|
1296
1296
|
spreadTopLevelArrays: true;
|
|
1297
1297
|
arrayMergeMode: "spread";
|
|
1298
|
-
}> : never : never : never,
|
|
1298
|
+
}> : never : never : never, type_fest_source_internal_type_js3.NonRecursiveType | Set<unknown> | Map<unknown, unknown> | type_fest4.UnknownArray, object>;
|
|
1299
1299
|
};
|
|
1300
1300
|
//#endregion
|
|
1301
1301
|
export { knipConfig, prettierConfig, tsdownConfig };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/knip.ts","../src/prettier.ts","../src/tsdown.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAea;;;;;;;;MAAA,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gCAAyD;mCAA4D;;;;;;;;;;;;;;;;;;;cCiBp2iR;;;;;;;MDlBA,SAA2E,KAAA,EAAA,SAAA;MAAA,SAAA,OAAA,EAAA;;;;;;;;;;4BACykuP,CAAA,CAAA,UAAA,YAAA,CAAA,mEAAA,CAAA,CAAA,SAAA,CAAA,SAAA,CAAA;;;IAAoP,SAAA,OAAA,EAAA,CAAA,sBAAA,EAAA,oBAAA,EAAA,sBAAA,EAAA,uBAAA,EAAA,6BAAA,CAAA;;IAA0rzB,SAAA,SAAA,EAAA,CAAA;MAA+G,SAAA,KAAA,EAAA,SAAA;MAA8D,SAAA,OAAA,EAAA;QAAyD,SAAA,aAAA,EAAA,MAAA;MAA4D,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cEQp2iR;;;;;;;;IFTA,SAA2E,GAAA,EAAA;MAAA,SAAA,UAAA,EAAA,IAAA;;;;;;;;;;sBESE,OAAA,CAAA,UFRukuP,CAAA,CAAA,UAAA,YAAA,CAAA,mEAAA,CAAA,CAAA,SAAA,CAAA,SAAA,CAAA;;;IAAoP,SAAA,MAAA,EAAA,KAAA;;IAA0rzB,SAAA,MAAA,EAAA,UAAA;IAA+G,SAAA,SAAA,EAAA,IAAA;IAA8D,SAAA,GAAA,EAAA;MAAyD,SAAA,UAAA,EAAA,IAAA;MAA4D,SAAA,SAAA,EAAA,IAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["merge","baseConfig","baseConfig","baseConfig"],"sources":["../node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs","../node_modules/es-toolkit/dist/object/mergeWith.mjs","../src/utils.ts","../src/knip.ts","../src/prettier.ts","../src/tsdown.ts"],"sourcesContent":["function isUnsafeProperty(key) {\n return key === '__proto__';\n}\n\nexport { isUnsafeProperty };\n","function isObjectLike(value) {\n return typeof value === 'object' && value !== null;\n}\n\nexport { isObjectLike };\n","import { isUnsafeProperty } from '../_internal/isUnsafeProperty.mjs';\nimport { isObjectLike } from '../compat/predicate/isObjectLike.mjs';\n\nfunction mergeWith(target, source, merge) {\n const sourceKeys = Object.keys(source);\n for (let i = 0; i < sourceKeys.length; i++) {\n const key = sourceKeys[i];\n if (isUnsafeProperty(key)) {\n continue;\n }\n const sourceValue = source[key];\n const targetValue = target[key];\n const merged = merge(targetValue, sourceValue, key, target, source);\n if (merged !== undefined) {\n target[key] = merged;\n }\n else if (Array.isArray(sourceValue)) {\n target[key] = mergeWith(targetValue ?? [], sourceValue, merge);\n }\n else if (isObjectLike(targetValue) && isObjectLike(sourceValue)) {\n target[key] = mergeWith(targetValue ?? {}, sourceValue, merge);\n }\n else if (targetValue === undefined || sourceValue !== undefined) {\n target[key] = sourceValue;\n }\n }\n return target;\n}\n\nexport { mergeWith };\n","import { mergeWith } from \"es-toolkit\"\nimport { isPlainObject } 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 */\nexport function 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 * Creates a config merge function with proper type overloads for merging with a base config.\n */\nexport function createMergeConfigFn<UserConfigType, BaseConfig extends UserConfigType>(baseConfig: BaseConfig) {\n //\n\n // if `userConfig` is not provided, return the type of `baseConfig`\n function mergeConfig(): BaseConfig\n\n // if `userConfig` is provided, instead of returning `BaseConfig & UserConfig` (from `merge`), return a more friendly type using `MergeDeep`\n function mergeConfig<UserConfig extends UserConfigType>(\n userConfig: UserConfig,\n ): MergeDeep<BaseConfig, UserConfig, { arrayMergeMode: \"spread\" }>\n\n function mergeConfig<UserConfig extends UserConfigType>(userConfig?: UserConfig) {\n if (userConfig === undefined) return baseConfig\n\n if (!(isPlainObject(baseConfig) && isPlainObject(userConfig)))\n throw new Error(`target and/or source is not an object: target='${baseConfig}'\\nsource='${userConfig}'`)\n\n return merge(baseConfig, userConfig)\n }\n\n return mergeConfig\n}\n","import type { KnipConfig } from \"knip\"\n\n// biome-ignore lint/plugin: ignore\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} satisfies KnipConfig\n\nexport const knipConfig = createMergeConfigFn<KnipConfig, typeof baseConfig>(baseConfig)\n","import type { Config } from \"prettier\"\n\n// biome-ignore lint/plugin: ignore\nimport { createMergeConfigFn } from \"./utils.ts\"\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 Config\n\nexport const prettierConfig = createMergeConfigFn<Config, typeof baseConfig>(baseConfig)\n","import type { UserConfig } from \"tsdown\"\n\n// biome-ignore lint/plugin: ignore\nimport { createMergeConfigFn } from \"./utils.ts\"\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 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 UserConfig\n\nexport const tsdownConfig = createMergeConfigFn<UserConfig, typeof baseConfig>(baseConfig)\n"],"x_google_ignoreList":[0,1,2],"mappings":";AAAA,SAAS,iBAAiB,KAAK;AAC3B,QAAO,QAAQ;;ACDnB,SAAS,aAAa,OAAO;AACzB,QAAO,OAAO,UAAU,YAAY,UAAU;;ACElD,SAAS,UAAU,QAAQ,QAAQ,SAAO;CACtC,MAAM,aAAa,OAAO,KAAK,OAAO;AACtC,MAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;EACxC,MAAM,MAAM,WAAW;AACvB,MAAI,iBAAiB,IAAI,CACrB;EAEJ,MAAM,cAAc,OAAO;EAC3B,MAAM,cAAc,OAAO;EAC3B,MAAM,SAASA,QAAM,aAAa,aAAa,KAAK,QAAQ,OAAO;AACnE,MAAI,WAAW,KAAA,EACX,QAAO,OAAO;WAET,MAAM,QAAQ,YAAY,CAC/B,QAAO,OAAO,UAAU,eAAe,EAAE,EAAE,aAAaA,QAAM;WAEzD,aAAa,YAAY,IAAI,aAAa,YAAY,CAC3D,QAAO,OAAO,UAAU,eAAe,EAAE,EAAE,aAAaA,QAAM;WAEzD,gBAAgB,KAAA,KAAa,gBAAgB,KAAA,EAClD,QAAO,OAAO;;AAGtB,QAAO;;ACjBX,SAAgB,MAA0C,QAAW,QAAkB;AACrF,QAAO,UAAU,QAAQ,SAAS,UAAmB,aACnD,MAAM,QAAQ,SAAS,GAAG,SAAS,OAAO,SAAS,GAAG,KAAA,EACvD;;AAMH,SAAgB,oBAAuE,cAAwB;CAW7G,SAAS,YAA+C,YAAyB;AAC/E,MAAI,eAAe,KAAA,EAAW,QAAOG;AAErC,MAAI,EAAE,cAAcA,aAAW,IAAI,cAAc,WAAW,EAC1D,OAAM,IAAI,MAAM,kDAAkDA,aAAW,aAAa,WAAW,GAAG;AAE1G,SAAO,MAAMA,cAAY,WAAW;;AAGtC,QAAO;;ACvBT,MAAa,aAAa,oBANP;CACjB,OAAO;EAAC;EAAkB;EAAgB;EAAqB;CAC/D,SAAS,CAAC,KAAK;CACf,QAAQ;CACT,CAEuF;ACkBxF,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,CAEuF;ACTxF,MAAa,eAAe,oBAnBT;CACjB,OAAO,CAAC,iBAAiB;CACzB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,WAAW;CACX,KAAK;EACH,YAAY;EACZ,WAAW;EACZ;CACD,MAAM;EACJ,OAAO;EACP,SAAS;EACV;CACD,SAAS;CACT,YAAY;CACb,CAEyF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["merge","baseConfig","baseConfig","baseConfig"],"sources":["../node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs","../node_modules/es-toolkit/dist/object/mergeWith.mjs","../src/utils.ts","../src/knip.ts","../src/prettier.ts","../src/tsdown.ts"],"sourcesContent":["function isUnsafeProperty(key) {\n return key === '__proto__';\n}\n\nexport { isUnsafeProperty };\n","function isObjectLike(value) {\n return typeof value === 'object' && value !== null;\n}\n\nexport { isObjectLike };\n","import { isUnsafeProperty } from '../_internal/isUnsafeProperty.mjs';\nimport { isObjectLike } from '../compat/predicate/isObjectLike.mjs';\n\nfunction mergeWith(target, source, merge) {\n const sourceKeys = Object.keys(source);\n for (let i = 0; i < sourceKeys.length; i++) {\n const key = sourceKeys[i];\n if (isUnsafeProperty(key)) {\n continue;\n }\n const sourceValue = source[key];\n const targetValue = target[key];\n const merged = merge(targetValue, sourceValue, key, target, source);\n if (merged !== undefined) {\n target[key] = merged;\n }\n else if (Array.isArray(sourceValue)) {\n target[key] = mergeWith(targetValue ?? [], sourceValue, merge);\n }\n else if (isObjectLike(targetValue) && isObjectLike(sourceValue)) {\n target[key] = mergeWith(targetValue ?? {}, sourceValue, merge);\n }\n else if (targetValue === undefined || sourceValue !== undefined) {\n target[key] = sourceValue;\n }\n }\n return target;\n}\n\nexport { mergeWith };\n","import { mergeWith } from \"es-toolkit\"\nimport { isPlainObject } 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 */\nexport function 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 * Creates a config merge function with proper type overloads for merging with a base config.\n */\nexport function createMergeConfigFn<UserConfigType, BaseConfig extends UserConfigType>(baseConfig: BaseConfig) {\n //\n\n // if `userConfig` is not provided, return the type of `baseConfig`\n function mergeConfig(): BaseConfig\n\n // if `userConfig` is provided, instead of returning `BaseConfig & UserConfig` (from `merge`), return a more friendly type using `MergeDeep`\n function mergeConfig<UserConfig extends UserConfigType>(\n userConfig: UserConfig,\n ): MergeDeep<BaseConfig, UserConfig, { arrayMergeMode: \"spread\" }>\n\n function mergeConfig<UserConfig extends UserConfigType>(userConfig?: UserConfig) {\n if (userConfig === undefined) return baseConfig\n\n if (!(isPlainObject(baseConfig) && isPlainObject(userConfig)))\n throw new Error(`target and/or source is not an object: target='${baseConfig}'\\nsource='${userConfig}'`)\n\n return merge(baseConfig, userConfig)\n }\n\n return mergeConfig\n}\n","import type { KnipConfig } from \"knip\"\n\n// biome-ignore lint/plugin: ignore\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","import type { Config } from \"prettier\"\n\n// biome-ignore lint/plugin: ignore\nimport { createMergeConfigFn } from \"./utils.ts\"\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 Config\n\nexport const prettierConfig = createMergeConfigFn<Config, typeof baseConfig>(baseConfig)\n","import type { UserConfig } from \"tsdown\"\n\n// biome-ignore lint/plugin: ignore\nimport { createMergeConfigFn } from \"./utils.ts\"\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 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 UserConfig\n\nexport const tsdownConfig = createMergeConfigFn<UserConfig, typeof baseConfig>(baseConfig)\n"],"x_google_ignoreList":[0,1,2],"mappings":";AAAA,SAAS,iBAAiB,KAAK;AAC3B,QAAO,QAAQ;;ACDnB,SAAS,aAAa,OAAO;AACzB,QAAO,OAAO,UAAU,YAAY,UAAU;;ACElD,SAAS,UAAU,QAAQ,QAAQ,SAAO;CACtC,MAAM,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