@adamhl8/configs 0.15.12 → 0.15.13
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 +4 -66
- package/dist/index.js +3 -1
- package/dist/knip-preprocessor.js +2 -1
- package/dist/knip-preprocessor.js.map +1 -1
- package/dist/knip.d.ts +13 -0
- package/dist/knip.d.ts.map +1 -0
- package/dist/knip.js +13 -0
- package/dist/knip.js.map +1 -0
- package/dist/prettier.d.ts +25 -0
- package/dist/prettier.d.ts.map +1 -0
- package/dist/prettier.js +23 -0
- package/dist/prettier.js.map +1 -0
- package/dist/tsdown.d.ts +27 -0
- package/dist/tsdown.d.ts.map +1 -0
- package/dist/tsdown.js +37 -0
- package/dist/tsdown.js.map +1 -0
- package/dist/utils.d.ts +13 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +16 -0
- package/dist/utils.js.map +1 -0
- package/package.json +1 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/src.js +0 -77
- package/dist/src.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,66 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//#region src/utils.d.ts
|
|
7
|
-
type MergeDeepConcat<D, S> = MergeDeep<D, S, {
|
|
8
|
-
arrayMergeMode: "spread";
|
|
9
|
-
}>;
|
|
10
|
-
interface MergeConfigFn<UserConfigType, BaseConfig extends UserConfigType> {
|
|
11
|
-
(): BaseConfig;
|
|
12
|
-
<UserConfig extends UserConfigType>(userConfig: UserConfig): MergeDeepConcat<BaseConfig, UserConfig>;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/knip.d.ts
|
|
16
|
-
declare const baseConfig$2: {
|
|
17
|
-
readonly entry: ["./src/index.ts", "**/*.test.ts", "./tsdown.config.ts"];
|
|
18
|
-
readonly project: ["**"];
|
|
19
|
-
readonly tsdown: false;
|
|
20
|
-
};
|
|
21
|
-
declare const knipConfig: MergeConfigFn<KnipConfig, typeof baseConfig$2>;
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/prettier.d.ts
|
|
24
|
-
declare const baseConfig$1: {
|
|
25
|
-
readonly printWidth: 120;
|
|
26
|
-
readonly semi: false;
|
|
27
|
-
readonly plugins: ["@prettier/plugin-xml", "prettier-plugin-sh", "prettier-plugin-toml", "prettier-plugin-astro", "prettier-plugin-tailwindcss"];
|
|
28
|
-
readonly tailwindStylesheet: "./src/global.css";
|
|
29
|
-
readonly overrides: [{
|
|
30
|
-
readonly files: "*.jsonc";
|
|
31
|
-
readonly options: {
|
|
32
|
-
readonly trailingComma: "none";
|
|
33
|
-
};
|
|
34
|
-
}, {
|
|
35
|
-
readonly files: "*.astro";
|
|
36
|
-
readonly options: {
|
|
37
|
-
readonly parser: "astro";
|
|
38
|
-
};
|
|
39
|
-
}];
|
|
40
|
-
};
|
|
41
|
-
declare const prettierConfig: MergeConfigFn<Config, typeof baseConfig$1>;
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/tsdown.d.ts
|
|
44
|
-
declare const baseConfig: {
|
|
45
|
-
readonly entry: ["./src/index.ts"];
|
|
46
|
-
readonly unbundle: true;
|
|
47
|
-
readonly target: false;
|
|
48
|
-
readonly platform: "neutral";
|
|
49
|
-
readonly minify: "dce-only";
|
|
50
|
-
readonly sourcemap: true;
|
|
51
|
-
readonly hash: false;
|
|
52
|
-
readonly dts: {
|
|
53
|
-
readonly newContext: true;
|
|
54
|
-
readonly sourcemap: true;
|
|
55
|
-
};
|
|
56
|
-
readonly attw: {
|
|
57
|
-
readonly level: "error";
|
|
58
|
-
readonly profile: "esmOnly";
|
|
59
|
-
};
|
|
60
|
-
readonly publint: true;
|
|
61
|
-
readonly failOnWarn: true;
|
|
62
|
-
};
|
|
63
|
-
declare const tsdownConfig: MergeConfigFn<UserConfig$1, typeof baseConfig>;
|
|
64
|
-
//#endregion
|
|
65
|
-
export { knipConfig, prettierConfig, tsdownConfig };
|
|
66
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { knipConfig } from "./knip.js";
|
|
2
|
+
import { prettierConfig } from "./prettier.js";
|
|
3
|
+
import { tsdownConfig } from "./tsdown.js";
|
|
4
|
+
export { knipConfig, prettierConfig, tsdownConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { knipConfig } from "./
|
|
1
|
+
import { knipConfig } from "./knip.js";
|
|
2
|
+
import "./index.js";
|
|
2
3
|
const entries = knipConfig().entry;
|
|
3
4
|
const preprocess = (options) => {
|
|
4
5
|
const filteredConfigurationHints = [...options.configurationHints].filter((hint) => !(typeof hint.identifier === "string" && entries.includes(hint.identifier) && hint.type === "entry-empty"));
|
|
@@ -1 +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":"
|
|
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/knip.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MergeConfigFn } from "./utils.js";
|
|
2
|
+
import { KnipConfig } from "knip";
|
|
3
|
+
|
|
4
|
+
//#region src/knip.d.ts
|
|
5
|
+
declare const baseConfig: {
|
|
6
|
+
readonly entry: ["./src/index.ts", "**/*.test.ts", "./tsdown.config.ts"];
|
|
7
|
+
readonly project: ["**"];
|
|
8
|
+
readonly tsdown: false;
|
|
9
|
+
};
|
|
10
|
+
declare const knipConfig: MergeConfigFn<KnipConfig, typeof baseConfig>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { knipConfig };
|
|
13
|
+
//# sourceMappingURL=knip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knip.d.ts","names":[],"sources":["../src/knip.ts"],"sourcesContent":[],"mappings":";;;;cAWM;;EAAA,SAAA,OAIyB,EAAA,CAAA,IAAA,CAAA;EAElB,SAAA,MAA0F,EAAA,KAAA;CAAA;AAAhE,cAA1B,UAA0B,EAAd,aAAc,CAAA,UAAA,EAAA,OAAmB,UAAnB,CAAA"}
|
package/dist/knip.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createMergeConfigFn } from "./utils.js";
|
|
2
|
+
const knipConfig = createMergeConfigFn({
|
|
3
|
+
entry: [
|
|
4
|
+
"./src/index.ts",
|
|
5
|
+
"**/*.test.ts",
|
|
6
|
+
"./tsdown.config.ts"
|
|
7
|
+
],
|
|
8
|
+
project: ["**"],
|
|
9
|
+
tsdown: false
|
|
10
|
+
});
|
|
11
|
+
export { knipConfig };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=knip.js.map
|
package/dist/knip.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knip.js","names":["knipConfig: MergeConfigFn<KnipConfig, typeof baseConfig>"],"sources":["../src/knip.ts"],"sourcesContent":["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"],"mappings":";AAiBA,MAAaA,aAA2D,oBANrD;CACjB,OAAO;EAAC;EAAkB;EAAgB;EAAqB;CAC/D,SAAS,CAAC,KAAK;CACf,QAAQ;CACT,CAEsG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MergeConfigFn } from "./utils.js";
|
|
2
|
+
import { Config } from "prettier";
|
|
3
|
+
|
|
4
|
+
//#region src/prettier.d.ts
|
|
5
|
+
declare const baseConfig: {
|
|
6
|
+
readonly printWidth: 120;
|
|
7
|
+
readonly semi: false;
|
|
8
|
+
readonly plugins: ["@prettier/plugin-xml", "prettier-plugin-sh", "prettier-plugin-toml", "prettier-plugin-astro", "prettier-plugin-tailwindcss"];
|
|
9
|
+
readonly tailwindStylesheet: "./src/global.css";
|
|
10
|
+
readonly overrides: [{
|
|
11
|
+
readonly files: "*.jsonc";
|
|
12
|
+
readonly options: {
|
|
13
|
+
readonly trailingComma: "none";
|
|
14
|
+
};
|
|
15
|
+
}, {
|
|
16
|
+
readonly files: "*.astro";
|
|
17
|
+
readonly options: {
|
|
18
|
+
readonly parser: "astro";
|
|
19
|
+
};
|
|
20
|
+
}];
|
|
21
|
+
};
|
|
22
|
+
declare const prettierConfig: MergeConfigFn<Config, typeof baseConfig>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { prettierConfig };
|
|
25
|
+
//# sourceMappingURL=prettier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettier.d.ts","names":[],"sources":["../src/prettier.ts"],"sourcesContent":[],"mappings":";;;;cAOM;;EAAA,SAAA,IA0BqB,EAAA,KAAA;EAEd,SAAA,OAAA,EAA0F,CAAA,sBAAA,EAAA,oBAAA,EAAA,sBAAA,EAAA,uBAAA,EAAA,6BAAA,CAAA;EAAA,SAAA,kBAAA,EAAA,kBAAA;WAA5D,SAAA,EAAA,CAAA;IAAe,SAAA,KAAA,EAAA,SAAA;IAA7B,SAAA,OAAA,EAAA;MAAa,SAAA,aAAA,EAAA,MAAA;;;;;;;;;cAA7B,gBAAgB,cAAc,eAAe"}
|
package/dist/prettier.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createMergeConfigFn } from "./utils.js";
|
|
2
|
+
const prettierConfig = createMergeConfigFn({
|
|
3
|
+
printWidth: 120,
|
|
4
|
+
semi: false,
|
|
5
|
+
plugins: [
|
|
6
|
+
"@prettier/plugin-xml",
|
|
7
|
+
"prettier-plugin-sh",
|
|
8
|
+
"prettier-plugin-toml",
|
|
9
|
+
"prettier-plugin-astro",
|
|
10
|
+
"prettier-plugin-tailwindcss"
|
|
11
|
+
],
|
|
12
|
+
tailwindStylesheet: "./src/global.css",
|
|
13
|
+
overrides: [{
|
|
14
|
+
files: "*.jsonc",
|
|
15
|
+
options: { trailingComma: "none" }
|
|
16
|
+
}, {
|
|
17
|
+
files: "*.astro",
|
|
18
|
+
options: { parser: "astro" }
|
|
19
|
+
}]
|
|
20
|
+
});
|
|
21
|
+
export { prettierConfig };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=prettier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettier.js","names":["prettierConfig: MergeConfigFn<Config, typeof baseConfig>"],"sources":["../src/prettier.ts"],"sourcesContent":["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"],"mappings":";AAmCA,MAAaA,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"}
|
package/dist/tsdown.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MergeConfigFn } from "./utils.js";
|
|
2
|
+
import { UserConfig } from "tsdown";
|
|
3
|
+
|
|
4
|
+
//#region src/tsdown.d.ts
|
|
5
|
+
declare const baseConfig: {
|
|
6
|
+
readonly entry: ["./src/index.ts"];
|
|
7
|
+
readonly unbundle: true;
|
|
8
|
+
readonly target: false;
|
|
9
|
+
readonly platform: "neutral";
|
|
10
|
+
readonly minify: "dce-only";
|
|
11
|
+
readonly sourcemap: true;
|
|
12
|
+
readonly hash: false;
|
|
13
|
+
readonly dts: {
|
|
14
|
+
readonly newContext: true;
|
|
15
|
+
readonly sourcemap: true;
|
|
16
|
+
};
|
|
17
|
+
readonly attw: {
|
|
18
|
+
readonly level: "error";
|
|
19
|
+
readonly profile: "esmOnly";
|
|
20
|
+
};
|
|
21
|
+
readonly publint: true;
|
|
22
|
+
readonly failOnWarn: true;
|
|
23
|
+
};
|
|
24
|
+
declare const tsdownConfig: MergeConfigFn<UserConfig, typeof baseConfig>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { tsdownConfig };
|
|
27
|
+
//# sourceMappingURL=tsdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsdown.d.ts","names":[],"sources":["../src/tsdown.ts"],"sourcesContent":[],"mappings":";;;;cAOM;;EAAA,SAAA,QAkByB,EAAA,IAAA;EAelB,SAAA,MAA4F,EAAA,KAAA;EAAA,SAAA,QAAA,EAAA,SAAA;WAAhE,MAAA,EAAA,UAAA;WAAmB,SAAA,EAAA,IAAA;WAAjC,IAAA,EAAA,KAAA;EAAa,SAAA,GAAA,EAAA;;;;;;;;;;;cAA3B,cAAc,cAAc,mBAAmB"}
|
package/dist/tsdown.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createMergeConfigFn } from "./utils.js";
|
|
2
|
+
const baseConfig = {
|
|
3
|
+
entry: ["./src/index.ts"],
|
|
4
|
+
unbundle: true,
|
|
5
|
+
target: false,
|
|
6
|
+
platform: "neutral",
|
|
7
|
+
minify: "dce-only",
|
|
8
|
+
sourcemap: true,
|
|
9
|
+
hash: false,
|
|
10
|
+
dts: {
|
|
11
|
+
newContext: true,
|
|
12
|
+
sourcemap: true
|
|
13
|
+
},
|
|
14
|
+
attw: {
|
|
15
|
+
level: "error",
|
|
16
|
+
profile: "esmOnly"
|
|
17
|
+
},
|
|
18
|
+
publint: true,
|
|
19
|
+
failOnWarn: true
|
|
20
|
+
};
|
|
21
|
+
const binConfig = {
|
|
22
|
+
...baseConfig,
|
|
23
|
+
entry: [],
|
|
24
|
+
platform: "node",
|
|
25
|
+
outExtensions: () => ({ js: "" }),
|
|
26
|
+
copy: [],
|
|
27
|
+
unbundle: false,
|
|
28
|
+
sourcemap: false,
|
|
29
|
+
dts: false,
|
|
30
|
+
attw: false,
|
|
31
|
+
publint: false
|
|
32
|
+
};
|
|
33
|
+
const tsdownConfig = createMergeConfigFn(baseConfig);
|
|
34
|
+
createMergeConfigFn(binConfig);
|
|
35
|
+
export { tsdownConfig };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=tsdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsdown.js","names":["tsdownConfig: MergeConfigFn<UserConfig, typeof baseConfig>","tsdownBinConfig: MergeConfigFn<UserConfig, typeof binConfig>"],"sources":["../src/tsdown.ts"],"sourcesContent":["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 },\n attw: {\n level: \"error\",\n profile: \"esmOnly\",\n },\n publint: true,\n failOnWarn: true,\n} as const satisfies UserConfig\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: MergeConfigFn<UserConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\nexport const tsdownBinConfig: MergeConfigFn<UserConfig, typeof binConfig> = createMergeConfigFn(binConfig)\n"],"mappings":";AAOA,MAAM,aAAa;CACjB,OAAO,CAAC,iBAAiB;CACzB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,WAAW;CACX,MAAM;CACN,KAAK;EACH,YAAY;EACZ,WAAW;EACZ;CACD,MAAM;EACJ,OAAO;EACP,SAAS;EACV;CACD,SAAS;CACT,YAAY;CACb;AAED,MAAM,YAAY;CAChB,GAAG;CACH,OAAO,EAAE;CACT,UAAU;CACV,sBAAsB,EAAE,IAAI,IAAI;CAChC,MAAM,EAAE;CACR,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;CACN,SAAS;CACV;AAED,MAAaA,eAA6D,oBAAoB,WAAW;AAC7B,oBAAoB,UAAU"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MergeDeep } from "type-fest";
|
|
2
|
+
|
|
3
|
+
//#region src/utils.d.ts
|
|
4
|
+
type MergeDeepConcat<D, S> = MergeDeep<D, S, {
|
|
5
|
+
arrayMergeMode: "spread";
|
|
6
|
+
}>;
|
|
7
|
+
interface MergeConfigFn<UserConfigType, BaseConfig extends UserConfigType> {
|
|
8
|
+
(): BaseConfig;
|
|
9
|
+
<UserConfig extends UserConfigType>(userConfig: UserConfig): MergeDeepConcat<BaseConfig, UserConfig>;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { MergeConfigFn };
|
|
13
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../src/utils.ts"],"sourcesContent":[],"mappings":";;;KAeK,wBAAwB,UAAU,GAAG;;AAbA,CAAA,CAAA;AAatB,UAEH,aAFG,CAAA,cAAA,EAAA,mBAE8C,cAF9C,CAAA,CAAA;MAId,UAJiC;sBAMjB,cANoB,CAAA,CAAA,UAAA,EAMQ,UANR,CAAA,EAMqB,eANrB,CAMqC,UANrC,EAMiD,UANjD,CAAA"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { mergeWith } from "es-toolkit";
|
|
2
|
+
import { isPlainObject } from "remeda";
|
|
3
|
+
function merge(target, source) {
|
|
4
|
+
return mergeWith(target, source, (objValue, srcValue) => Array.isArray(objValue) ? objValue.concat(srcValue) : void 0);
|
|
5
|
+
}
|
|
6
|
+
function createMergeConfigFn(baseConfig) {
|
|
7
|
+
function mergeConfig(userConfig) {
|
|
8
|
+
if (userConfig === void 0) return baseConfig;
|
|
9
|
+
if (!(isPlainObject(baseConfig) && isPlainObject(userConfig))) throw new Error(`target and/or source is not an object: target='${baseConfig}'\nsource='${userConfig}'`);
|
|
10
|
+
return merge(baseConfig, userConfig);
|
|
11
|
+
}
|
|
12
|
+
return mergeConfig;
|
|
13
|
+
}
|
|
14
|
+
export { createMergeConfigFn };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.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"],"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,YAC2C;CAO3C,SAAS,YAA+C,YAAyB;AAC/E,MAAI,eAAe,KAAA,EAAW,QAAO;AAErC,MAAI,EAAE,cAAc,WAAW,IAAI,cAAc,WAAW,EAC1D,OAAM,IAAI,MAAM,kDAAkD,WAAW,aAAa,WAAW,GAAG;AAE1G,SAAO,MAAM,YAAY,WAAW;;AAGtC,QAAO"}
|
package/package.json
CHANGED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/utils.ts","../src/knip.ts","../src/prettier.ts","../src/tsdown.ts"],"sourcesContent":[],"mappings":";;;;;;KAeK,wBAAwB,UAAU,GAAG;;;UAEzB,iDAAiD;MAE5D;EAJD,CAAA,mBAMiB,cANF,CAAA,CAAA,UAAA,EAM8B,UAN9B,CAAA,EAM2C,eAN3C,CAM2D,UAN3D,EAMuE,UANvE,CAAA;;;;cCJd;;;;ADToC,CAAA;AAatB,cCEP,UDFO,ECEK,aDFL,CCEmB,UDFnB,EAAA,OCEsC,YDFtC,CAAA;;;cERd;;;;EFQD,SAAA,kBAAe,EAAA,kBAAA;EAAA,SAAA,SAAA,EAAA,CAAA;IAAmB,SAAA,KAAA,EAAA,SAAA;IAAG,SAAA,OAAA,EAAA;MAAb,SAAA,aAAA,EAAA,MAAA;IAAS,CAAA;EAErB,CAAA,EAAA;IAAa,SAAA,KAAA,EAAA,SAAA;IAAoC,SAAA,OAAA,EAAA;MAE5D,SAAA,MAAA,EAAA,OAAA;IAEgB,CAAA;;;AAAqE,cEc9E,cFd8E,EEc9D,aFd8D,CEchD,MFdgD,EAAA,OEcjC,YFdiC,CAAA;;;cGdrF;;;;EHQD,SAAA,QAAA,EAAe,SAAA;EAAA,SAAA,MAAA,EAAA,UAAA;WAAmB,SAAA,EAAA,IAAA;WAAG,IAAA,EAAA,KAAA;WAAb,GAAA,EAAA;IAAS,SAAA,UAAA,EAAA,IAAA;IAErB,SAAA,SAAa,EAAA,IAAA;EAAA,CAAA;WAAoC,IAAA,EAAA;IAE5D,SAAA,KAAA,EAAA,OAAA;IAEgB,SAAA,OAAA,EAAA,SAAA;;WAAyD,OAAA,EAAA,IAAA;WAAY,UAAA,EAAA,IAAA;;AEchD,cCK9B,YDL8B,ECKhB,aDLgB,CCKF,YDLE,EAAA,OCKiB,UDLjB,CAAA"}
|
package/dist/src.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { mergeWith } from "es-toolkit";
|
|
2
|
-
import { isPlainObject } from "remeda";
|
|
3
|
-
function merge(target, source) {
|
|
4
|
-
return mergeWith(target, source, (objValue, srcValue) => Array.isArray(objValue) ? objValue.concat(srcValue) : void 0);
|
|
5
|
-
}
|
|
6
|
-
function createMergeConfigFn(baseConfig$3) {
|
|
7
|
-
function mergeConfig(userConfig) {
|
|
8
|
-
if (userConfig === void 0) return baseConfig$3;
|
|
9
|
-
if (!(isPlainObject(baseConfig$3) && isPlainObject(userConfig))) throw new Error(`target and/or source is not an object: target='${baseConfig$3}'\nsource='${userConfig}'`);
|
|
10
|
-
return merge(baseConfig$3, userConfig);
|
|
11
|
-
}
|
|
12
|
-
return mergeConfig;
|
|
13
|
-
}
|
|
14
|
-
const knipConfig = createMergeConfigFn({
|
|
15
|
-
entry: [
|
|
16
|
-
"./src/index.ts",
|
|
17
|
-
"**/*.test.ts",
|
|
18
|
-
"./tsdown.config.ts"
|
|
19
|
-
],
|
|
20
|
-
project: ["**"],
|
|
21
|
-
tsdown: false
|
|
22
|
-
});
|
|
23
|
-
const prettierConfig = createMergeConfigFn({
|
|
24
|
-
printWidth: 120,
|
|
25
|
-
semi: false,
|
|
26
|
-
plugins: [
|
|
27
|
-
"@prettier/plugin-xml",
|
|
28
|
-
"prettier-plugin-sh",
|
|
29
|
-
"prettier-plugin-toml",
|
|
30
|
-
"prettier-plugin-astro",
|
|
31
|
-
"prettier-plugin-tailwindcss"
|
|
32
|
-
],
|
|
33
|
-
tailwindStylesheet: "./src/global.css",
|
|
34
|
-
overrides: [{
|
|
35
|
-
files: "*.jsonc",
|
|
36
|
-
options: { trailingComma: "none" }
|
|
37
|
-
}, {
|
|
38
|
-
files: "*.astro",
|
|
39
|
-
options: { parser: "astro" }
|
|
40
|
-
}]
|
|
41
|
-
});
|
|
42
|
-
const baseConfig = {
|
|
43
|
-
entry: ["./src/index.ts"],
|
|
44
|
-
unbundle: true,
|
|
45
|
-
target: false,
|
|
46
|
-
platform: "neutral",
|
|
47
|
-
minify: "dce-only",
|
|
48
|
-
sourcemap: true,
|
|
49
|
-
hash: false,
|
|
50
|
-
dts: {
|
|
51
|
-
newContext: true,
|
|
52
|
-
sourcemap: true
|
|
53
|
-
},
|
|
54
|
-
attw: {
|
|
55
|
-
level: "error",
|
|
56
|
-
profile: "esmOnly"
|
|
57
|
-
},
|
|
58
|
-
publint: true,
|
|
59
|
-
failOnWarn: true
|
|
60
|
-
};
|
|
61
|
-
const binConfig = {
|
|
62
|
-
...baseConfig,
|
|
63
|
-
entry: [],
|
|
64
|
-
platform: "node",
|
|
65
|
-
outExtensions: () => ({ js: "" }),
|
|
66
|
-
copy: [],
|
|
67
|
-
unbundle: false,
|
|
68
|
-
sourcemap: false,
|
|
69
|
-
dts: false,
|
|
70
|
-
attw: false,
|
|
71
|
-
publint: false
|
|
72
|
-
};
|
|
73
|
-
const tsdownConfig = createMergeConfigFn(baseConfig);
|
|
74
|
-
createMergeConfigFn(binConfig);
|
|
75
|
-
export { knipConfig, prettierConfig, tsdownConfig };
|
|
76
|
-
|
|
77
|
-
//# sourceMappingURL=src.js.map
|
package/dist/src.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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>","tsdownBinConfig: MergeConfigFn<UserConfig, typeof binConfig>"],"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 },\n attw: {\n level: \"error\",\n profile: \"esmOnly\",\n },\n publint: true,\n failOnWarn: true,\n} as const satisfies UserConfig\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: MergeConfigFn<UserConfig, typeof baseConfig> = createMergeConfigFn(baseConfig)\nexport const tsdownBinConfig: MergeConfigFn<UserConfig, typeof binConfig> = createMergeConfigFn(binConfig)\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;AC5BvG,MAAM,aAAa;CACjB,OAAO,CAAC,iBAAiB;CACzB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,WAAW;CACX,MAAM;CACN,KAAK;EACH,YAAY;EACZ,WAAW;EACZ;CACD,MAAM;EACJ,OAAO;EACP,SAAS;EACV;CACD,SAAS;CACT,YAAY;CACb;AAED,MAAM,YAAY;CAChB,GAAG;CACH,OAAO,EAAE;CACT,UAAU;CACV,sBAAsB,EAAE,IAAI,IAAI;CAChC,MAAM,EAAE;CACR,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;CACN,SAAS;CACV;AAED,MAAaC,eAA6D,oBAAoB,WAAW;AAC7B,oBAAoB,UAAU"}
|