@adamhl8/configs 0.15.9 → 0.15.10
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/dist/index.d.ts +52 -1290
- package/dist/index.d.ts.map +1 -1
- package/dist/knip-preprocessor.d.ts.map +1 -1
- package/dist/src.js +3 -22
- package/dist/src.js.map +1 -1
- package/dist/tsconfig.base.json +2 -2
- package/package.json +4 -4
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":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["knipConfig: MergeConfigFn<KnipConfig, typeof baseConfig>","prettierConfig: MergeConfigFn<Config, typeof baseConfig>","tsdownConfig: MergeConfigFn<UserConfig, typeof baseConfig>"],"sources":["../src/utils.ts","../src/knip.ts","../src/prettier.ts","../src/tsdown.ts"],"sourcesContent":[],"mappings":";;;;;;KAeK,wBAAwB,UAAU,GAAG;;AAbX,CAAA,CAAA;AAa1B,UAEY,aAFZ,eAAkC,qBAE2B,cAFxB;EAAb,EAAA,EAIvB,UAJuB;EAE7B,CAAA,mBAIsB,cAJL,CAAA,CAAA,UAAA,EAIiC,UAJjC,CAAA,EAI8C,eAJ9C,CAI8D,UAJ9D,EAI0E,UAJ1E,CAAA;;;;cCNX;;;;ADTyB,CAAA;AAa1B,cCEQA,UDFR,ECEoB,aDFpB,CCEkC,UDFlC,EAAA,OCEqD,YDFrD,CAAA;;;cERC;;;;EFLyB,SAa1B,kBAAA,EAAA,kBAAA;EAAA,SAAA,SAAA,EAAA,SAAA,CAAA;aAAkC,KAAA,EAAA,SAAA;aAAG,OAAA,EAAA;eAAb,aAAA,EAAA,MAAA;IAAA,CAAA;EAE7B,CAAA,EAAiB;IAAA,SAAA,KAAA,EAAA,SAAA;aAAiD,OAAA,EAAA;eAE5D,MAAA,EAAA,OAAA;;;;AAEqF,cEc9EC,cFd8E,EEc9D,aFd8D,CEchD,MFdgD,EAAA,OEcjC,YFdiC,CAAA;;;cGdrF;;;;EHLyB,SAa1B,QAAA,EAAA,SAAA;EAAA,SAAA,MAAA,EAAA,UAAA;WAAkC,SAAA,EAAA,IAAA;WAAG,IAAA,EAAA,KAAA;WAAb,GAAA,EAAA;IAAA,SAAA,UAAA,EAAA,IAAA;IAE7B,SAAiB,SAAA,EAAA,IAAA;IAAA,SAAA,GAAA,EAAA,IAAA;;WAEX,IAAA,EAAA;aAEgB,KAAA,EAAA,OAAA;aAA4B,OAAA,EAAA,SAAA;;WAAyC,OAAA,EAAA,IAAA;WAA5B,UAAA,EAAA,IAAA;CAAA;cGOlDC,cAAc,cAAc,qBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knip-preprocessor.d.ts","names":[],"sources":["../src/knip-preprocessor.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"knip-preprocessor.d.ts","names":["preprocess: Preprocessor"],"sources":["../src/knip-preprocessor.ts"],"sourcesContent":[],"mappings":";;;cAOMA,YAAY"}
|
package/dist/src.js
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
|
+
import { mergeWith } from "es-toolkit";
|
|
1
2
|
import { isPlainObject } from "remeda";
|
|
2
|
-
function isUnsafeProperty(key) {
|
|
3
|
-
return key === "__proto__";
|
|
4
|
-
}
|
|
5
|
-
function isObjectLike(value) {
|
|
6
|
-
return typeof value === "object" && value !== null;
|
|
7
|
-
}
|
|
8
|
-
function mergeWith(target, source, merge$1) {
|
|
9
|
-
const sourceKeys = Object.keys(source);
|
|
10
|
-
for (let i = 0; i < sourceKeys.length; i++) {
|
|
11
|
-
const key = sourceKeys[i];
|
|
12
|
-
if (isUnsafeProperty(key)) continue;
|
|
13
|
-
const sourceValue = source[key];
|
|
14
|
-
const targetValue = target[key];
|
|
15
|
-
const merged = merge$1(targetValue, sourceValue, key, target, source);
|
|
16
|
-
if (merged !== void 0) target[key] = merged;
|
|
17
|
-
else if (Array.isArray(sourceValue)) target[key] = mergeWith(targetValue ?? [], sourceValue, merge$1);
|
|
18
|
-
else if (isObjectLike(targetValue) && isObjectLike(sourceValue)) target[key] = mergeWith(targetValue ?? {}, sourceValue, merge$1);
|
|
19
|
-
else if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;
|
|
20
|
-
}
|
|
21
|
-
return target;
|
|
22
|
-
}
|
|
23
3
|
function merge(target, source) {
|
|
24
4
|
return mergeWith(target, source, (objValue, srcValue) => Array.isArray(objValue) ? objValue.concat(srcValue) : void 0);
|
|
25
5
|
}
|
|
@@ -69,7 +49,8 @@ const tsdownConfig = createMergeConfigFn({
|
|
|
69
49
|
hash: false,
|
|
70
50
|
dts: {
|
|
71
51
|
newContext: true,
|
|
72
|
-
sourcemap: true
|
|
52
|
+
sourcemap: true,
|
|
53
|
+
oxc: true
|
|
73
54
|
},
|
|
74
55
|
attw: {
|
|
75
56
|
level: "error",
|
package/dist/src.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"src.js","names":["
|
|
1
|
+
{"version":3,"file":"src.js","names":["baseConfig","baseConfig","knipConfig: MergeConfigFn<KnipConfig, typeof baseConfig>","baseConfig","prettierConfig: MergeConfigFn<Config, typeof baseConfig>","tsdownConfig: MergeConfigFn<UserConfig, typeof baseConfig>"],"sources":["../src/utils.ts","../src/knip.ts","../src/prettier.ts","../src/tsdown.ts"],"sourcesContent":["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 */\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\ntype MergeDeepConcat<D, S> = MergeDeep<D, S, { arrayMergeMode: \"spread\" }>\n\nexport interface MergeConfigFn<UserConfigType, BaseConfig extends UserConfigType> {\n // if `userConfig` is not provided, return the type of `baseConfig`\n (): BaseConfig\n // if `userConfig` is provided, instead of returning `BaseConfig & UserConfig` (from `merge`), return a more friendly type using `MergeDeep`\n <UserConfig extends UserConfigType>(userConfig: UserConfig): MergeDeepConcat<BaseConfig, UserConfig>\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>(\n baseConfig: BaseConfig,\n): MergeConfigFn<UserConfigType, BaseConfig> {\n function mergeConfig(): BaseConfig\n\n function mergeConfig<UserConfig extends UserConfigType>(\n userConfig: UserConfig,\n ): MergeDeepConcat<BaseConfig, UserConfig>\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 type { MergeConfigFn } from \"./utils.ts\"\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: MergeConfigFn<KnipConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n","import type { Config } from \"prettier\"\n\n// biome-ignore lint/plugin: ignore\nimport type { MergeConfigFn } from \"./utils.ts\"\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: MergeConfigFn<Config, typeof baseConfig> = createMergeConfigFn(baseConfig)\n","import type { UserConfig } from \"tsdown\"\n\n// biome-ignore lint/plugin: ignore\nimport type { MergeConfigFn } from \"./utils.ts\"\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 hash: false,\n dts: {\n newContext: true,\n sourcemap: true,\n oxc: 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: MergeConfigFn<UserConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\n"],"mappings":";;AASA,SAAS,MAA0C,QAAW,QAAkB;AAC9E,QAAO,UAAU,QAAQ,SAAS,UAAmB,aACnD,MAAM,QAAQ,SAAS,GAAG,SAAS,OAAO,SAAS,GAAG,KAAA,EACvD;;AAeH,SAAgB,oBACd,cAC2C;CAO3C,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;;AC5BT,MAAaD,aAA2D,oBANrD;CACjB,OAAO;EAAC;EAAkB;EAAgB;EAAqB;CAC/D,SAAS,CAAC,KAAK;CACf,QAAQ;CACT,CAEsG;ACkBvG,MAAaE,iBAA2D,oBA5BrD;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,CAEsG;ACPvG,MAAaC,eAA6D,oBArBvD;CACjB,OAAO,CAAC,iBAAiB;CACzB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,WAAW;CACX,MAAM;CACN,KAAK;EACH,YAAY;EACZ,WAAW;EACX,KAAK;EACN;CACD,MAAM;EACJ,OAAO;EACP,SAAS;EACV;CACD,SAAS;CACT,YAAY;CACb,CAEwG"}
|
package/dist/tsconfig.base.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
"target": "ESNext",
|
|
6
6
|
"jsx": "react-jsx",
|
|
7
|
-
"module": "
|
|
8
|
-
"moduleResolution": "
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
9
|
"moduleDetection": "force",
|
|
10
10
|
"isolatedModules": true,
|
|
11
11
|
"verbatimModuleSyntax": true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamhl8/configs",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@prettier/plugin-xml": "^3.4.2",
|
|
40
|
+
"es-toolkit": "^1.39.10",
|
|
40
41
|
"prettier-plugin-astro": "^0.14.1",
|
|
41
42
|
"prettier-plugin-sh": "^0.18.0",
|
|
42
43
|
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
43
44
|
"prettier-plugin-toml": "^2.0.6",
|
|
44
|
-
"remeda": "^2.31.1"
|
|
45
|
+
"remeda": "^2.31.1",
|
|
46
|
+
"type-fest": "^5.0.0"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
49
|
"@arethetypeswrong/core": "^0.18.2",
|
|
48
50
|
"@biomejs/biome": "^2.2.4",
|
|
49
51
|
"@types/bun": "^1.2.22",
|
|
50
|
-
"es-toolkit": "^1.39.10",
|
|
51
52
|
"knip": "^5.63.1",
|
|
52
53
|
"prettier": "^3.6.2",
|
|
53
54
|
"publint": "^0.3.12",
|
|
54
55
|
"tsdown": "^0.15.1",
|
|
55
|
-
"type-fest": "^4.41.0",
|
|
56
56
|
"typescript": "^5.9.2"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|