@adamhl8/configs 0.15.5 → 0.15.7
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/bin/{adamhl-knip → adamhl8-knip} +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -81
- package/dist/knip-preprocessor.d.ts +7 -0
- package/dist/knip-preprocessor.d.ts.map +1 -0
- package/dist/knip-preprocessor.js +3 -1
- package/dist/knip-preprocessor.js.map +1 -0
- package/dist/src.js +83 -0
- package/dist/src.js.map +1 -0
- package/package.json +2 -2
- package/dist/index.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1246,6 +1246,7 @@ declare const tsdownConfig: {
|
|
|
1246
1246
|
readonly platform: "neutral";
|
|
1247
1247
|
readonly minify: "dce-only";
|
|
1248
1248
|
readonly sourcemap: true;
|
|
1249
|
+
readonly hash: false;
|
|
1249
1250
|
readonly dts: {
|
|
1250
1251
|
readonly newContext: true;
|
|
1251
1252
|
readonly sourcemap: true;
|
|
@@ -1264,6 +1265,7 @@ declare const tsdownConfig: {
|
|
|
1264
1265
|
readonly platform: "neutral";
|
|
1265
1266
|
readonly minify: "dce-only";
|
|
1266
1267
|
readonly sourcemap: true;
|
|
1268
|
+
readonly hash: false;
|
|
1267
1269
|
readonly dts: {
|
|
1268
1270
|
readonly newContext: true;
|
|
1269
1271
|
readonly sourcemap: true;
|
|
@@ -1281,6 +1283,7 @@ declare const tsdownConfig: {
|
|
|
1281
1283
|
readonly platform: "neutral";
|
|
1282
1284
|
readonly minify: "dce-only";
|
|
1283
1285
|
readonly sourcemap: true;
|
|
1286
|
+
readonly hash: false;
|
|
1284
1287
|
readonly dts: {
|
|
1285
1288
|
readonly newContext: true;
|
|
1286
1289
|
readonly sourcemap: true;
|
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,MAA2E,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;MAAA,KAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;;;;;;;;;IACykuP,KAAA,CAAA,EAAA,MAAA,GAAA,OAAA,GAAA,MAAA,EAAA,GAAA;;;MAAoP,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;IAA0rzB,GAAA,CAAA,EAAA,MAAA,GAAA,OAAA,GAAA,MAAA,EAAA,GAAA;MAA+G,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;MAA8D,KAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;MAAyD,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;IAA4D,CAAA,GAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICiBp2iR,CAAA,GAAA,SAA2E;IAAA,UAAA,CAAA,EAAA,MAAA,GAAA,OAAA,GAAA,MAAA,EAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/knip.ts","../src/prettier.ts","../src/tsdown.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAea;;;;;;;;MAAA,MAA2E,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;MAAA,KAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;;;;;;;;;IACykuP,KAAA,CAAA,EAAA,MAAA,GAAA,OAAA,GAAA,MAAA,EAAA,GAAA;;;MAAoP,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA;;IAA0rzB,GAAA,CAAA,EAAA,MAAA,GAAA,OAAA,GAAA,MA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,OAAA,CAAA;;IFT2zuP,SAAA,QAAA,EAAA,IAAA;;IAA0rzB,SAAA,QAAA,EAAA,SAAA;IAA+G,SAAA,MAAA,EAAA,UAAA;IAA8D,SAAA,SAAA,EAAA,IAAA;IAAyD,SAAA,IAAA,EAAA,KAAA;IAA4D,SAAA,GAAA,EAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,82 +1,2 @@
|
|
|
1
|
-
import {
|
|
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
|
-
function merge(target, source) {
|
|
24
|
-
return mergeWith(target, source, (objValue, srcValue) => Array.isArray(objValue) ? objValue.concat(srcValue) : void 0);
|
|
25
|
-
}
|
|
26
|
-
function createMergeConfigFn(baseConfig$3) {
|
|
27
|
-
function mergeConfig(userConfig) {
|
|
28
|
-
if (userConfig === void 0) return baseConfig$3;
|
|
29
|
-
if (!(isPlainObject(baseConfig$3) && isPlainObject(userConfig))) throw new Error(`target and/or source is not an object: target='${baseConfig$3}'\nsource='${userConfig}'`);
|
|
30
|
-
return merge(baseConfig$3, userConfig);
|
|
31
|
-
}
|
|
32
|
-
return mergeConfig;
|
|
33
|
-
}
|
|
34
|
-
const knipConfig = createMergeConfigFn({
|
|
35
|
-
entry: [
|
|
36
|
-
"./src/index.ts",
|
|
37
|
-
"**/*.test.ts",
|
|
38
|
-
"./tsdown.config.ts"
|
|
39
|
-
],
|
|
40
|
-
project: ["**"],
|
|
41
|
-
tsdown: false
|
|
42
|
-
});
|
|
43
|
-
const prettierConfig = createMergeConfigFn({
|
|
44
|
-
printWidth: 120,
|
|
45
|
-
semi: false,
|
|
46
|
-
plugins: [
|
|
47
|
-
"@prettier/plugin-xml",
|
|
48
|
-
"prettier-plugin-sh",
|
|
49
|
-
"prettier-plugin-toml",
|
|
50
|
-
"prettier-plugin-astro",
|
|
51
|
-
"prettier-plugin-tailwindcss"
|
|
52
|
-
],
|
|
53
|
-
tailwindStylesheet: "./src/global.css",
|
|
54
|
-
overrides: [{
|
|
55
|
-
files: "*.jsonc",
|
|
56
|
-
options: { trailingComma: "none" }
|
|
57
|
-
}, {
|
|
58
|
-
files: "*.astro",
|
|
59
|
-
options: { parser: "astro" }
|
|
60
|
-
}]
|
|
61
|
-
});
|
|
62
|
-
const tsdownConfig = createMergeConfigFn({
|
|
63
|
-
entry: ["./src/index.ts"],
|
|
64
|
-
unbundle: true,
|
|
65
|
-
target: false,
|
|
66
|
-
platform: "neutral",
|
|
67
|
-
minify: "dce-only",
|
|
68
|
-
sourcemap: true,
|
|
69
|
-
dts: {
|
|
70
|
-
newContext: true,
|
|
71
|
-
sourcemap: true
|
|
72
|
-
},
|
|
73
|
-
attw: {
|
|
74
|
-
level: "error",
|
|
75
|
-
profile: "esmOnly"
|
|
76
|
-
},
|
|
77
|
-
publint: true,
|
|
78
|
-
failOnWarn: true
|
|
79
|
-
});
|
|
1
|
+
import { knipConfig, prettierConfig, tsdownConfig } from "./src.js";
|
|
80
2
|
export { knipConfig, prettierConfig, tsdownConfig };
|
|
81
|
-
|
|
82
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knip-preprocessor.d.ts","names":[],"sources":["../src/knip-preprocessor.ts"],"sourcesContent":[],"mappings":";;;cAOM,YAAY"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { knipConfig } from "./
|
|
1
|
+
import { knipConfig } from "./src.js";
|
|
2
2
|
const entries = knipConfig().entry;
|
|
3
3
|
const preprocess = (options) => {
|
|
4
4
|
const filteredConfigurationHints = [...options.configurationHints].filter((hint) => !(typeof hint.identifier === "string" && entries.includes(hint.identifier) && hint.type === "entry-empty"));
|
|
@@ -7,3 +7,5 @@ const preprocess = (options) => {
|
|
|
7
7
|
};
|
|
8
8
|
var knip_preprocessor_default = preprocess;
|
|
9
9
|
export { knip_preprocessor_default as default };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=knip-preprocessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knip-preprocessor.js","names":["preprocess: Preprocessor"],"sources":["../src/knip-preprocessor.ts"],"sourcesContent":["import type { Preprocessor } from \"knip\"\n\n// biome-ignore lint/plugin: ignore\nimport { knipConfig } from \"./index.ts\"\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 !(typeof hint.identifier === \"string\" && entries.includes(hint.identifier) && hint.type === \"entry-empty\"),\n )\n options.configurationHints = new Set(filteredConfigurationHints)\n return options\n}\n\nexport default preprocess\n"],"mappings":";AAKA,MAAM,UAAU,YAAY,CAAC;AAE7B,MAAMA,cAA4B,YAAY;CAE5C,MAAM,6BAA6B,CAAC,GAAG,QAAQ,mBAAmB,CAAC,QAChE,SACC,EAAE,OAAO,KAAK,eAAe,YAAY,QAAQ,SAAS,KAAK,WAAW,IAAI,KAAK,SAAS,eAC/F;AACD,SAAQ,qBAAqB,IAAI,IAAI,2BAA2B;AAChE,QAAO;;AAGT,IAAA,4BAAe"}
|
package/dist/src.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
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
|
+
function merge(target, source) {
|
|
24
|
+
return mergeWith(target, source, (objValue, srcValue) => Array.isArray(objValue) ? objValue.concat(srcValue) : void 0);
|
|
25
|
+
}
|
|
26
|
+
function createMergeConfigFn(baseConfig$3) {
|
|
27
|
+
function mergeConfig(userConfig) {
|
|
28
|
+
if (userConfig === void 0) return baseConfig$3;
|
|
29
|
+
if (!(isPlainObject(baseConfig$3) && isPlainObject(userConfig))) throw new Error(`target and/or source is not an object: target='${baseConfig$3}'\nsource='${userConfig}'`);
|
|
30
|
+
return merge(baseConfig$3, userConfig);
|
|
31
|
+
}
|
|
32
|
+
return mergeConfig;
|
|
33
|
+
}
|
|
34
|
+
const knipConfig = createMergeConfigFn({
|
|
35
|
+
entry: [
|
|
36
|
+
"./src/index.ts",
|
|
37
|
+
"**/*.test.ts",
|
|
38
|
+
"./tsdown.config.ts"
|
|
39
|
+
],
|
|
40
|
+
project: ["**"],
|
|
41
|
+
tsdown: false
|
|
42
|
+
});
|
|
43
|
+
const prettierConfig = createMergeConfigFn({
|
|
44
|
+
printWidth: 120,
|
|
45
|
+
semi: false,
|
|
46
|
+
plugins: [
|
|
47
|
+
"@prettier/plugin-xml",
|
|
48
|
+
"prettier-plugin-sh",
|
|
49
|
+
"prettier-plugin-toml",
|
|
50
|
+
"prettier-plugin-astro",
|
|
51
|
+
"prettier-plugin-tailwindcss"
|
|
52
|
+
],
|
|
53
|
+
tailwindStylesheet: "./src/global.css",
|
|
54
|
+
overrides: [{
|
|
55
|
+
files: "*.jsonc",
|
|
56
|
+
options: { trailingComma: "none" }
|
|
57
|
+
}, {
|
|
58
|
+
files: "*.astro",
|
|
59
|
+
options: { parser: "astro" }
|
|
60
|
+
}]
|
|
61
|
+
});
|
|
62
|
+
const tsdownConfig = createMergeConfigFn({
|
|
63
|
+
entry: ["./src/index.ts"],
|
|
64
|
+
unbundle: true,
|
|
65
|
+
target: false,
|
|
66
|
+
platform: "neutral",
|
|
67
|
+
minify: "dce-only",
|
|
68
|
+
sourcemap: true,
|
|
69
|
+
hash: false,
|
|
70
|
+
dts: {
|
|
71
|
+
newContext: true,
|
|
72
|
+
sourcemap: true
|
|
73
|
+
},
|
|
74
|
+
attw: {
|
|
75
|
+
level: "error",
|
|
76
|
+
profile: "esmOnly"
|
|
77
|
+
},
|
|
78
|
+
publint: true,
|
|
79
|
+
failOnWarn: true
|
|
80
|
+
});
|
|
81
|
+
export { knipConfig, prettierConfig, tsdownConfig };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=src.js.map
|
package/dist/src.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src.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 */\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 * 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 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 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,SAAS,MAA0C,QAAW,QAAkB;AAC9E,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;ACRxF,MAAa,eAAe,oBApBT;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,CAEyF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamhl8/configs",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"files": ["dist/"],
|
|
31
31
|
"scripts": {
|
|
32
32
|
"bundle": "bun lint && bun tsdown",
|
|
33
|
-
"lint": "bun generate-biome-rules.ts && tsc --noEmit && biome check --write && bun ./src/bin/
|
|
33
|
+
"lint": "bun generate-biome-rules.ts && tsc --noEmit && biome check --write && bun ./src/bin/adamhl8-knip.ts",
|
|
34
34
|
"postinstall": "mkdir -p ./node_modules/@adamhl8/configs/dist/ && cp -r ./src/biome-plugins/ ./node_modules/@adamhl8/configs/dist/",
|
|
35
35
|
"prepare": "find .githooks -type f -exec ln -srf {} .git/hooks/ \\; || true",
|
|
36
36
|
"prepublishOnly": "bun bundle"
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 */\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 * 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,aAAa,OAAO,KAAK,OAAO;AACtC,MAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;EACxC,MAAM,MAAM,WAAW;AACvB,MAAI,iBAAiB,IAAI,CACrB;EAEJ,MA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