@kcconfigs/tsdown 0.0.1 → 0.1.0-beta.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,46 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0-beta.1](https://github.com/kc-workspace/kcws/compare/@kcconfigs/tsdown#v0.1.0-beta.0...@kcconfigs/tsdown+v0.1.0-beta.1) (2025-12-28)
4
+
5
+
6
+ ### Bugfixes
7
+
8
+ * **kcconfigs/tsdown:** use outputOptions.postBanner and postFooter instead ([89c8369](https://github.com/kc-workspace/kcws/commit/89c836950926fa04db5f5007fa0274f128ee18bb))
9
+ * update all [@kcconfigs](https://github.com/kcconfigs) description so it trigger new deployment with new tag separator ([cf5be8c](https://github.com/kc-workspace/kcws/commit/cf5be8cc02fba8becb7e8f31fd6f3a741c0f0b95))
10
+
11
+
12
+ ### Dependencies
13
+
14
+ * The following workspace dependencies were updated
15
+ * devDependencies
16
+ * @kcconfigs/biome bumped to 0.1.1
17
+ * @kcconfigs/tsconfig bumped to 0.1.0-beta.1
18
+
19
+ ## 0.1.0-beta.0 (2025-12-26)
20
+
21
+
22
+ ### Features
23
+
24
+ * **core:** move all packages into packages/* directory ([58230cd](https://github.com/kc-workspace/kcws/commit/58230cd286d0dea953d232806c91508ebfc57701))
25
+ * **kcconfigs/tsdown:** add source and typedoc conditions in exports ([6911d45](https://github.com/kc-workspace/kcws/commit/6911d4557f67362d78e959b88af8f110a78ee3a0))
26
+
27
+
28
+ ### Performance Improvements
29
+
30
+ * **kcconfigs/tsdown:** add [@generated](https://github.com/generated) to generated file ([f3efbca](https://github.com/kc-workspace/kcws/commit/f3efbca38e221ad9445e09fd4b772d3cc07c3027))
31
+ * **kcconfigs/tsdown:** enabled publint, unused, and arethetypewrong validators by default ([fd8a89e](https://github.com/kc-workspace/kcws/commit/fd8a89edfa6385c1211f5077499c56adf18f4b2c))
32
+
33
+
34
+ ### Bugfixes
35
+
36
+ * homepage contains invalid url ([0ee37d6](https://github.com/kc-workspace/kcws/commit/0ee37d641fe5b04fb019099915c8aa3ddfed3be7))
37
+ * **kcconfigs/tsdown:** attw should be error or no one will care and disable older node <16 ([7735770](https://github.com/kc-workspace/kcws/commit/77357707a071f358657b27e8eafeff626924442e))
38
+ * trigger re-release please ([65447a7](https://github.com/kc-workspace/kcws/commit/65447a776ed2f8638f6f35a4d00277d407143114))
39
+
40
+
41
+ ### Dependencies
42
+
43
+ * The following workspace dependencies were updated
44
+ * devDependencies
45
+ * @kcconfigs/biome bumped to 0.1.0
46
+ * @kcconfigs/tsconfig bumped to 0.1.0-beta.0
package/dist/index.cjs ADDED
@@ -0,0 +1,87 @@
1
+ // @generated by tsdown, DO NOT edit it manually
2
+ let tsdown = require("tsdown");
3
+
4
+ //#region src/index.ts
5
+ /**
6
+ * @public Defines the configuration for tsdown.
7
+ * @param configs UserConfig for tsdown
8
+ * @returns The merged UserConfig
9
+ */
10
+ const defineConfig = (config, ...configs) => {
11
+ const { format, dts, ...rest } = config ?? {};
12
+ let _dts = dts;
13
+ if (_dts === void 0 || _dts === null) _dts = {
14
+ sourcemap: true,
15
+ resolve: false
16
+ };
17
+ else if (typeof _dts === "object") {
18
+ var _dts2;
19
+ (_dts2 = _dts).sourcemap ?? (_dts2.sourcemap = true);
20
+ _dts.resolve = false;
21
+ }
22
+ const banner = "// @generated by tsdown, DO NOT edit it manually";
23
+ const footer = "// Generated by @kcconfigs/tsdown";
24
+ let _format = format;
25
+ if (_format === void 0 || _format === null) _format = {
26
+ esm: {
27
+ sourcemap: true,
28
+ outputOptions: {
29
+ postBanner: banner,
30
+ postFooter: footer
31
+ }
32
+ },
33
+ cjs: {
34
+ sourcemap: true,
35
+ outputOptions: {
36
+ postBanner: banner,
37
+ postFooter: footer
38
+ }
39
+ }
40
+ };
41
+ else if (Array.isArray(_format)) _format = _format.reduce((obj, fmt) => {
42
+ obj[fmt] = {
43
+ sourcemap: true,
44
+ outputOptions: {
45
+ postBanner: banner,
46
+ postFooter: footer
47
+ }
48
+ };
49
+ return obj;
50
+ }, {});
51
+ else if (typeof _format === "object") _format = Object.fromEntries(Object.entries(_format).map(([key, value]) => {
52
+ return [key, {
53
+ sourcemap: true,
54
+ footer,
55
+ ...value
56
+ }];
57
+ }));
58
+ return (0, tsdown.defineConfig)([{
59
+ entry: ["./src/index.ts"],
60
+ platform: "neutral",
61
+ fixedExtension: false,
62
+ outDir: "dist",
63
+ clean: true,
64
+ publint: {
65
+ enabled: true,
66
+ level: "warning"
67
+ },
68
+ unused: {
69
+ enabled: true,
70
+ level: "warning",
71
+ depKinds: ["dependencies", "peerDependencies"]
72
+ },
73
+ attw: {
74
+ enabled: true,
75
+ level: "error",
76
+ profile: "node16"
77
+ },
78
+ format: _format,
79
+ dts: _dts,
80
+ ...rest
81
+ }].concat(...configs));
82
+ };
83
+
84
+ //#endregion
85
+ exports.defineConfig = defineConfig;
86
+ // Generated by @kcconfigs/tsdown
87
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import {\n\tdefineConfig as _defineConfig,\n\ttype UserConfig as _UserConfig,\n} from \"tsdown\";\n\n/**\n * @public Custom User Config exported from defineConfig function\n */\nexport type UserConfig = _UserConfig[];\n\n/**\n * @public Defines the configuration for tsdown.\n * @param configs UserConfig for tsdown\n * @returns The merged UserConfig\n */\nexport const defineConfig = (\n\tconfig?: _UserConfig,\n\t...configs: UserConfig\n): UserConfig => {\n\tconst { format, dts, ...rest } = config ?? ({} as _UserConfig);\n\n\tlet _dts = dts;\n\tif (_dts === undefined || _dts === null) {\n\t\t_dts = {\n\t\t\tsourcemap: true,\n\t\t\tresolve: false,\n\t\t};\n\t} else if (typeof _dts === \"object\") {\n\t\t_dts.sourcemap ??= true;\n\t\t_dts.resolve = false;\n\t}\n\n\tconst banner = \"// @generated by tsdown, DO NOT edit it manually\";\n\tconst footer = \"// Generated by @kcconfigs/tsdown\";\n\tlet _format = format;\n\tif (_format === undefined || _format === null) {\n\t\t_format = {\n\t\t\tesm: {\n\t\t\t\tsourcemap: true,\n\t\t\t\toutputOptions: {\n\t\t\t\t\tpostBanner: banner,\n\t\t\t\t\tpostFooter: footer,\n\t\t\t\t},\n\t\t\t},\n\t\t\tcjs: {\n\t\t\t\tsourcemap: true,\n\t\t\t\toutputOptions: {\n\t\t\t\t\tpostBanner: banner,\n\t\t\t\t\tpostFooter: footer,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t} else if (Array.isArray(_format)) {\n\t\t_format = _format.reduce(\n\t\t\t(obj, fmt) => {\n\t\t\t\tobj[fmt] = {\n\t\t\t\t\tsourcemap: true,\n\t\t\t\t\toutputOptions: {\n\t\t\t\t\t\tpostBanner: banner,\n\t\t\t\t\t\tpostFooter: footer,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn obj;\n\t\t\t},\n\t\t\t{} as Exclude<_UserConfig[\"format\"], undefined | string | Array<unknown>>,\n\t\t);\n\t} else if (typeof _format === \"object\") {\n\t\t_format = Object.fromEntries(\n\t\t\tObject.entries(_format).map(([key, value]) => {\n\t\t\t\treturn [key, { sourcemap: true, footer, ...value }];\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst baseConfig: _UserConfig = {\n\t\tentry: [\"./src/index.ts\"],\n\t\tplatform: \"neutral\",\n\t\tfixedExtension: false,\n\t\toutDir: \"dist\",\n\t\tclean: true,\n\t\tpublint: {\n\t\t\tenabled: true,\n\t\t\tlevel: \"warning\",\n\t\t},\n\t\tunused: {\n\t\t\tenabled: true,\n\t\t\tlevel: \"warning\",\n\t\t\tdepKinds: [\"dependencies\", \"peerDependencies\"],\n\t\t},\n\t\tattw: {\n\t\t\tenabled: true,\n\t\t\tlevel: \"error\",\n\t\t\t// We don't build package for node older than 10\n\t\t\t// https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/NoResolution.md#true-positive-node-10-doesnt-support-packagejson-exports\n\t\t\tprofile: \"node16\",\n\t\t},\n\t\tformat: _format,\n\t\tdts: _dts,\n\t\t...rest,\n\t};\n\n\treturn _defineConfig([baseConfig].concat(...configs));\n};\n"],"mappings":";;;;;;;;;AAeA,MAAa,gBACZ,QACA,GAAG,YACa;CAChB,MAAM,EAAE,QAAQ,KAAK,GAAG,SAAS,UAAW,EAAE;CAE9C,IAAI,OAAO;AACX,KAAI,SAAS,UAAa,SAAS,KAClC,QAAO;EACN,WAAW;EACX,SAAS;EACT;UACS,OAAO,SAAS,UAAU;;AACpC,iBAAK,gCAAc;AACnB,OAAK,UAAU;;CAGhB,MAAM,SAAS;CACf,MAAM,SAAS;CACf,IAAI,UAAU;AACd,KAAI,YAAY,UAAa,YAAY,KACxC,WAAU;EACT,KAAK;GACJ,WAAW;GACX,eAAe;IACd,YAAY;IACZ,YAAY;IACZ;GACD;EACD,KAAK;GACJ,WAAW;GACX,eAAe;IACd,YAAY;IACZ,YAAY;IACZ;GACD;EACD;UACS,MAAM,QAAQ,QAAQ,CAChC,WAAU,QAAQ,QAChB,KAAK,QAAQ;AACb,MAAI,OAAO;GACV,WAAW;GACX,eAAe;IACd,YAAY;IACZ,YAAY;IACZ;GACD;AACD,SAAO;IAER,EAAE,CACF;UACS,OAAO,YAAY,SAC7B,WAAU,OAAO,YAChB,OAAO,QAAQ,QAAQ,CAAC,KAAK,CAAC,KAAK,WAAW;AAC7C,SAAO,CAAC,KAAK;GAAE,WAAW;GAAM;GAAQ,GAAG;GAAO,CAAC;GAClD,CACF;AA8BF,iCAAqB,CA3BW;EAC/B,OAAO,CAAC,iBAAiB;EACzB,UAAU;EACV,gBAAgB;EAChB,QAAQ;EACR,OAAO;EACP,SAAS;GACR,SAAS;GACT,OAAO;GACP;EACD,QAAQ;GACP,SAAS;GACT,OAAO;GACP,UAAU,CAAC,gBAAgB,mBAAmB;GAC9C;EACD,MAAM;GACL,SAAS;GACT,OAAO;GAGP,SAAS;GACT;EACD,QAAQ;EACR,KAAK;EACL,GAAG;EACH,CAEgC,CAAC,OAAO,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,19 @@
1
+ // @generated by tsdown, DO NOT edit it manually
2
+ import { UserConfig as UserConfig$1 } from "tsdown";
3
+
4
+ //#region src/index.d.ts
5
+
6
+ /**
7
+ * @public Custom User Config exported from defineConfig function
8
+ */
9
+ type UserConfig = UserConfig$1[];
10
+ /**
11
+ * @public Defines the configuration for tsdown.
12
+ * @param configs UserConfig for tsdown
13
+ * @returns The merged UserConfig
14
+ */
15
+ declare const defineConfig: (config?: UserConfig$1, ...configs: UserConfig) => UserConfig;
16
+ //#endregion
17
+ export { UserConfig, defineConfig };
18
+ // Generated by @kcconfigs/tsdown
19
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAQA;AAOa,KAPD,UAAA,GAAa,YAUtB,EAAA;;;;;;cAHU,wBACH,0BACG,eACV"}
@@ -0,0 +1,19 @@
1
+ // @generated by tsdown, DO NOT edit it manually
2
+ import { UserConfig as UserConfig$1 } from "tsdown";
3
+
4
+ //#region src/index.d.ts
5
+
6
+ /**
7
+ * @public Custom User Config exported from defineConfig function
8
+ */
9
+ type UserConfig = UserConfig$1[];
10
+ /**
11
+ * @public Defines the configuration for tsdown.
12
+ * @param configs UserConfig for tsdown
13
+ * @returns The merged UserConfig
14
+ */
15
+ declare const defineConfig: (config?: UserConfig$1, ...configs: UserConfig) => UserConfig;
16
+ //#endregion
17
+ export { UserConfig, defineConfig };
18
+ // Generated by @kcconfigs/tsdown
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAQA;AAOa,KAPD,UAAA,GAAa,YAUtB,EAAA;;;;;;cAHU,wBACH,0BACG,eACV"}
package/dist/index.js ADDED
@@ -0,0 +1,87 @@
1
+ // @generated by tsdown, DO NOT edit it manually
2
+ import { defineConfig as defineConfig$1 } from "tsdown";
3
+
4
+ //#region src/index.ts
5
+ /**
6
+ * @public Defines the configuration for tsdown.
7
+ * @param configs UserConfig for tsdown
8
+ * @returns The merged UserConfig
9
+ */
10
+ const defineConfig = (config, ...configs) => {
11
+ const { format, dts, ...rest } = config ?? {};
12
+ let _dts = dts;
13
+ if (_dts === void 0 || _dts === null) _dts = {
14
+ sourcemap: true,
15
+ resolve: false
16
+ };
17
+ else if (typeof _dts === "object") {
18
+ var _dts2;
19
+ (_dts2 = _dts).sourcemap ?? (_dts2.sourcemap = true);
20
+ _dts.resolve = false;
21
+ }
22
+ const banner = "// @generated by tsdown, DO NOT edit it manually";
23
+ const footer = "// Generated by @kcconfigs/tsdown";
24
+ let _format = format;
25
+ if (_format === void 0 || _format === null) _format = {
26
+ esm: {
27
+ sourcemap: true,
28
+ outputOptions: {
29
+ postBanner: banner,
30
+ postFooter: footer
31
+ }
32
+ },
33
+ cjs: {
34
+ sourcemap: true,
35
+ outputOptions: {
36
+ postBanner: banner,
37
+ postFooter: footer
38
+ }
39
+ }
40
+ };
41
+ else if (Array.isArray(_format)) _format = _format.reduce((obj, fmt) => {
42
+ obj[fmt] = {
43
+ sourcemap: true,
44
+ outputOptions: {
45
+ postBanner: banner,
46
+ postFooter: footer
47
+ }
48
+ };
49
+ return obj;
50
+ }, {});
51
+ else if (typeof _format === "object") _format = Object.fromEntries(Object.entries(_format).map(([key, value]) => {
52
+ return [key, {
53
+ sourcemap: true,
54
+ footer,
55
+ ...value
56
+ }];
57
+ }));
58
+ return defineConfig$1([{
59
+ entry: ["./src/index.ts"],
60
+ platform: "neutral",
61
+ fixedExtension: false,
62
+ outDir: "dist",
63
+ clean: true,
64
+ publint: {
65
+ enabled: true,
66
+ level: "warning"
67
+ },
68
+ unused: {
69
+ enabled: true,
70
+ level: "warning",
71
+ depKinds: ["dependencies", "peerDependencies"]
72
+ },
73
+ attw: {
74
+ enabled: true,
75
+ level: "error",
76
+ profile: "node16"
77
+ },
78
+ format: _format,
79
+ dts: _dts,
80
+ ...rest
81
+ }].concat(...configs));
82
+ };
83
+
84
+ //#endregion
85
+ export { defineConfig };
86
+ // Generated by @kcconfigs/tsdown
87
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_defineConfig"],"sources":["../src/index.ts"],"sourcesContent":["import {\n\tdefineConfig as _defineConfig,\n\ttype UserConfig as _UserConfig,\n} from \"tsdown\";\n\n/**\n * @public Custom User Config exported from defineConfig function\n */\nexport type UserConfig = _UserConfig[];\n\n/**\n * @public Defines the configuration for tsdown.\n * @param configs UserConfig for tsdown\n * @returns The merged UserConfig\n */\nexport const defineConfig = (\n\tconfig?: _UserConfig,\n\t...configs: UserConfig\n): UserConfig => {\n\tconst { format, dts, ...rest } = config ?? ({} as _UserConfig);\n\n\tlet _dts = dts;\n\tif (_dts === undefined || _dts === null) {\n\t\t_dts = {\n\t\t\tsourcemap: true,\n\t\t\tresolve: false,\n\t\t};\n\t} else if (typeof _dts === \"object\") {\n\t\t_dts.sourcemap ??= true;\n\t\t_dts.resolve = false;\n\t}\n\n\tconst banner = \"// @generated by tsdown, DO NOT edit it manually\";\n\tconst footer = \"// Generated by @kcconfigs/tsdown\";\n\tlet _format = format;\n\tif (_format === undefined || _format === null) {\n\t\t_format = {\n\t\t\tesm: {\n\t\t\t\tsourcemap: true,\n\t\t\t\toutputOptions: {\n\t\t\t\t\tpostBanner: banner,\n\t\t\t\t\tpostFooter: footer,\n\t\t\t\t},\n\t\t\t},\n\t\t\tcjs: {\n\t\t\t\tsourcemap: true,\n\t\t\t\toutputOptions: {\n\t\t\t\t\tpostBanner: banner,\n\t\t\t\t\tpostFooter: footer,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t} else if (Array.isArray(_format)) {\n\t\t_format = _format.reduce(\n\t\t\t(obj, fmt) => {\n\t\t\t\tobj[fmt] = {\n\t\t\t\t\tsourcemap: true,\n\t\t\t\t\toutputOptions: {\n\t\t\t\t\t\tpostBanner: banner,\n\t\t\t\t\t\tpostFooter: footer,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn obj;\n\t\t\t},\n\t\t\t{} as Exclude<_UserConfig[\"format\"], undefined | string | Array<unknown>>,\n\t\t);\n\t} else if (typeof _format === \"object\") {\n\t\t_format = Object.fromEntries(\n\t\t\tObject.entries(_format).map(([key, value]) => {\n\t\t\t\treturn [key, { sourcemap: true, footer, ...value }];\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst baseConfig: _UserConfig = {\n\t\tentry: [\"./src/index.ts\"],\n\t\tplatform: \"neutral\",\n\t\tfixedExtension: false,\n\t\toutDir: \"dist\",\n\t\tclean: true,\n\t\tpublint: {\n\t\t\tenabled: true,\n\t\t\tlevel: \"warning\",\n\t\t},\n\t\tunused: {\n\t\t\tenabled: true,\n\t\t\tlevel: \"warning\",\n\t\t\tdepKinds: [\"dependencies\", \"peerDependencies\"],\n\t\t},\n\t\tattw: {\n\t\t\tenabled: true,\n\t\t\tlevel: \"error\",\n\t\t\t// We don't build package for node older than 10\n\t\t\t// https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/NoResolution.md#true-positive-node-10-doesnt-support-packagejson-exports\n\t\t\tprofile: \"node16\",\n\t\t},\n\t\tformat: _format,\n\t\tdts: _dts,\n\t\t...rest,\n\t};\n\n\treturn _defineConfig([baseConfig].concat(...configs));\n};\n"],"mappings":";;;;;;;;;AAeA,MAAa,gBACZ,QACA,GAAG,YACa;CAChB,MAAM,EAAE,QAAQ,KAAK,GAAG,SAAS,UAAW,EAAE;CAE9C,IAAI,OAAO;AACX,KAAI,SAAS,UAAa,SAAS,KAClC,QAAO;EACN,WAAW;EACX,SAAS;EACT;UACS,OAAO,SAAS,UAAU;;AACpC,iBAAK,gCAAc;AACnB,OAAK,UAAU;;CAGhB,MAAM,SAAS;CACf,MAAM,SAAS;CACf,IAAI,UAAU;AACd,KAAI,YAAY,UAAa,YAAY,KACxC,WAAU;EACT,KAAK;GACJ,WAAW;GACX,eAAe;IACd,YAAY;IACZ,YAAY;IACZ;GACD;EACD,KAAK;GACJ,WAAW;GACX,eAAe;IACd,YAAY;IACZ,YAAY;IACZ;GACD;EACD;UACS,MAAM,QAAQ,QAAQ,CAChC,WAAU,QAAQ,QAChB,KAAK,QAAQ;AACb,MAAI,OAAO;GACV,WAAW;GACX,eAAe;IACd,YAAY;IACZ,YAAY;IACZ;GACD;AACD,SAAO;IAER,EAAE,CACF;UACS,OAAO,YAAY,SAC7B,WAAU,OAAO,YAChB,OAAO,QAAQ,QAAQ,CAAC,KAAK,CAAC,KAAK,WAAW;AAC7C,SAAO,CAAC,KAAK;GAAE,WAAW;GAAM;GAAQ,GAAG;GAAO,CAAC;GAClD,CACF;AA8BF,QAAOA,eAAc,CA3BW;EAC/B,OAAO,CAAC,iBAAiB;EACzB,UAAU;EACV,gBAAgB;EAChB,QAAQ;EACR,OAAO;EACP,SAAS;GACR,SAAS;GACT,OAAO;GACP;EACD,QAAQ;GACP,SAAS;GACT,OAAO;GACP,UAAU,CAAC,gBAAgB,mBAAmB;GAC9C;EACD,MAAM;GACL,SAAS;GACT,OAAO;GAGP,SAAS;GACT;EACD,QAAQ;EACR,KAAK;EACL,GAAG;EACH,CAEgC,CAAC,OAAO,GAAG,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@kcconfigs/tsdown",
3
- "version": "0.0.1",
3
+ "version": "0.1.0-beta.1",
4
+ "description": "Shared tsdown configuration",
5
+ "type": "module",
6
+ "dependencies": {
7
+ "tsdown": "0.18.1",
8
+ "publint": "0.3.16",
9
+ "unplugin-unused": "0.5.6",
10
+ "@arethetypeswrong/core": "0.18.2"
11
+ },
12
+ "devDependencies": {
13
+ "@biomejs/biome": "2.3.10",
14
+ "@kcconfigs/tsconfig": "0.1.0-beta.1",
15
+ "@kcconfigs/biome": "0.1.1"
16
+ },
17
+ "peerDependencies": {
18
+ "tsdown": "^0.17.0",
19
+ "publint": "^0.3.0",
20
+ "unplugin-unused": "^0.5.0",
21
+ "@arethetypeswrong/core": "^0.18.0"
22
+ },
23
+ "peerDependenciesMeta": {
24
+ "publint": {
25
+ "optional": true
26
+ },
27
+ "unplugin-unused": {
28
+ "optional": true
29
+ },
30
+ "@arethetypeswrong/core": {
31
+ "optional": true
32
+ }
33
+ },
34
+ "main": "./dist/index.js",
35
+ "types": "./dist/index.d.cts",
36
+ "exports": {
37
+ ".": {
38
+ "source": "./src/index.ts",
39
+ "typedoc": "./src/index.ts",
40
+ "require": {
41
+ "types": "./dist/index.d.cts",
42
+ "default": "./dist/index.cjs"
43
+ },
44
+ "default": {
45
+ "types": "./dist/index.d.ts",
46
+ "default": "./dist/index.js"
47
+ }
48
+ }
49
+ },
4
50
  "license": "AGPL-3.0-only",
5
51
  "homepage": "https://github.com/kc-workspace/kcws/tree/main/packages/@kcconfigs/tsdown",
6
52
  "repository": {
@@ -13,10 +59,34 @@
13
59
  "email": "kcws@kc.in.th",
14
60
  "url": "https://github.com/kamontat"
15
61
  },
62
+ "keywords": [
63
+ "config",
64
+ "typescript",
65
+ "tsdown",
66
+ "library",
67
+ "compiler",
68
+ "bundler"
69
+ ],
70
+ "files": [
71
+ "CHANGELOG.json",
72
+ "CHANGELOG.md",
73
+ "dist",
74
+ "src"
75
+ ],
16
76
  "engines": {
17
77
  "node": ">=14"
18
78
  },
19
79
  "publishConfig": {
20
80
  "access": "public"
81
+ },
82
+ "scripts": {
83
+ "build": "tsdown --config-loader unrun",
84
+ "fix": "biome check --fix --unsafe",
85
+ "check": "pnpm run lint:check && pnpm run format:check && pnpm run type:check",
86
+ "format": "biome format --fix",
87
+ "format:check": "biome format",
88
+ "lint": "biome lint --fix --unsafe",
89
+ "lint:check": "biome lint",
90
+ "type:check": "tsc --build"
21
91
  }
22
92
  }
package/src/index.ts ADDED
@@ -0,0 +1,103 @@
1
+ import {
2
+ defineConfig as _defineConfig,
3
+ type UserConfig as _UserConfig,
4
+ } from "tsdown";
5
+
6
+ /**
7
+ * @public Custom User Config exported from defineConfig function
8
+ */
9
+ export type UserConfig = _UserConfig[];
10
+
11
+ /**
12
+ * @public Defines the configuration for tsdown.
13
+ * @param configs UserConfig for tsdown
14
+ * @returns The merged UserConfig
15
+ */
16
+ export const defineConfig = (
17
+ config?: _UserConfig,
18
+ ...configs: UserConfig
19
+ ): UserConfig => {
20
+ const { format, dts, ...rest } = config ?? ({} as _UserConfig);
21
+
22
+ let _dts = dts;
23
+ if (_dts === undefined || _dts === null) {
24
+ _dts = {
25
+ sourcemap: true,
26
+ resolve: false,
27
+ };
28
+ } else if (typeof _dts === "object") {
29
+ _dts.sourcemap ??= true;
30
+ _dts.resolve = false;
31
+ }
32
+
33
+ const banner = "// @generated by tsdown, DO NOT edit it manually";
34
+ const footer = "// Generated by @kcconfigs/tsdown";
35
+ let _format = format;
36
+ if (_format === undefined || _format === null) {
37
+ _format = {
38
+ esm: {
39
+ sourcemap: true,
40
+ outputOptions: {
41
+ postBanner: banner,
42
+ postFooter: footer,
43
+ },
44
+ },
45
+ cjs: {
46
+ sourcemap: true,
47
+ outputOptions: {
48
+ postBanner: banner,
49
+ postFooter: footer,
50
+ },
51
+ },
52
+ };
53
+ } else if (Array.isArray(_format)) {
54
+ _format = _format.reduce(
55
+ (obj, fmt) => {
56
+ obj[fmt] = {
57
+ sourcemap: true,
58
+ outputOptions: {
59
+ postBanner: banner,
60
+ postFooter: footer,
61
+ },
62
+ };
63
+ return obj;
64
+ },
65
+ {} as Exclude<_UserConfig["format"], undefined | string | Array<unknown>>,
66
+ );
67
+ } else if (typeof _format === "object") {
68
+ _format = Object.fromEntries(
69
+ Object.entries(_format).map(([key, value]) => {
70
+ return [key, { sourcemap: true, footer, ...value }];
71
+ }),
72
+ );
73
+ }
74
+
75
+ const baseConfig: _UserConfig = {
76
+ entry: ["./src/index.ts"],
77
+ platform: "neutral",
78
+ fixedExtension: false,
79
+ outDir: "dist",
80
+ clean: true,
81
+ publint: {
82
+ enabled: true,
83
+ level: "warning",
84
+ },
85
+ unused: {
86
+ enabled: true,
87
+ level: "warning",
88
+ depKinds: ["dependencies", "peerDependencies"],
89
+ },
90
+ attw: {
91
+ enabled: true,
92
+ level: "error",
93
+ // We don't build package for node older than 10
94
+ // https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/NoResolution.md#true-positive-node-10-doesnt-support-packagejson-exports
95
+ profile: "node16",
96
+ },
97
+ format: _format,
98
+ dts: _dts,
99
+ ...rest,
100
+ };
101
+
102
+ return _defineConfig([baseConfig].concat(...configs));
103
+ };