@kcconfigs/tsdown 0.1.0-beta.2 → 0.1.0-beta.3

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 CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.0-beta.3](https://github.com/kc-workspace/kcws/compare/@kcconfigs/tsdown+v0.1.0-beta.2...@kcconfigs/tsdown+v0.1.0-beta.3) (2026-01-13)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **kcconfigs/tsconfig:** remove default types and kctypes, user must install themselves
9
+
10
+ ### Features
11
+
12
+ * **kcconfigs/tsconfig:** remove default types and kctypes, user must install themselves ([5f2989d](https://github.com/kc-workspace/kcws/commit/5f2989d1c091a3ae78f43ce5320ff232246e035f))
13
+ * **kcconfigs/tsdown:** tsdown output is now minify by default ([2a1080c](https://github.com/kc-workspace/kcws/commit/2a1080cf438c73e6142a827708d3f31f25c3bc8f))
14
+
15
+
16
+ ### Bugfixes
17
+
18
+ * **kcconfigs/tsdown:** fix type error due to stricter rules ([ca046a8](https://github.com/kc-workspace/kcws/commit/ca046a86dd9578a9212f0fb2383beada36ed70d8))
19
+ * **script:** pnpm type:check should use tsc --noEmit instead of tsc --build ([e92504c](https://github.com/kc-workspace/kcws/commit/e92504ca6fca6bcfa2a863303000a5ba61d2dd40))
20
+
21
+
22
+ ### Documentation
23
+
24
+ * add package version and changelog to documentation site ([722fab5](https://github.com/kc-workspace/kcws/commit/722fab5e2472b7d4e4fd5ba446c369f36bd1b4f1))
25
+
26
+
27
+ ### Dependencies
28
+
29
+ * The following workspace dependencies were updated
30
+ * devDependencies
31
+ * @kcconfigs/biome bumped to 0.2.1
32
+ * @kcconfigs/tsconfig bumped to 0.1.0
33
+
3
34
  ## [0.1.0-beta.2](https://github.com/kc-workspace/kcws/compare/@kcconfigs/tsdown+v0.1.0-beta.1...@kcconfigs/tsdown+v0.1.0-beta.2) (2026-01-10)
4
35
 
5
36
 
package/dist/index.cjs CHANGED
@@ -1,92 +1,4 @@
1
1
  // @generated by tsdown, DO NOT edit it manually
2
- let tsdown = require("tsdown");
3
-
4
- //#region src/utils/defineDts.ts
5
- const defineDts = (dts) => {
6
- const blacklist = ["resolve"];
7
- const _dts = {
8
- sourcemap: true,
9
- resolve: false
10
- };
11
- if (dts === false) return;
12
- if (typeof dts === "object") for (const [key, value] of Object.entries(dts)) {
13
- if (blacklist.includes(key)) continue;
14
- _dts[key] = value;
15
- }
16
- return _dts;
17
- };
18
-
19
- //#endregion
20
- //#region src/utils/defineFormat.ts
21
- const banner = "// @generated by tsdown, DO NOT edit it manually";
22
- const footer = "// Generated by @kcconfigs/tsdown";
23
- const defineFormat = (format) => {
24
- const defaultFormat = {
25
- esm: {
26
- sourcemap: true,
27
- outputOptions: {
28
- postBanner: banner,
29
- postFooter: footer
30
- }
31
- },
32
- cjs: {
33
- sourcemap: true,
34
- outputOptions: {
35
- postBanner: banner,
36
- postFooter: footer
37
- }
38
- }
39
- };
40
- if (typeof format === "string") switch (format) {
41
- case "module":
42
- case "esm":
43
- case "es": return { esm: defaultFormat.esm };
44
- case "commonjs":
45
- case "cjs": return { cjs: defaultFormat.cjs };
46
- }
47
- else if (Array.isArray(format)) return format.reduce((prev, curr) => {
48
- return Object.assign(prev, defineFormat(curr));
49
- }, {});
50
- else if (typeof format === "object") return Object.assign(defaultFormat, format);
51
- return defaultFormat;
52
- };
53
-
54
- //#endregion
55
- //#region src/index.ts
56
- /**
57
- * @public Defines the configuration for tsdown.
58
- * @param configs UserConfig for tsdown
59
- * @returns The merged UserConfig
60
- */
61
- const defineConfig = (config, ...configs) => {
62
- const { format, dts, ...rest } = config ?? {};
63
- const baseConfig = {
64
- entry: ["./src/index.ts"],
65
- platform: "neutral",
66
- fixedExtension: false,
67
- outDir: "dist",
68
- clean: true,
69
- publint: {
70
- enabled: true,
71
- level: "warning"
72
- },
73
- unused: {
74
- enabled: true,
75
- level: "warning",
76
- depKinds: ["dependencies", "peerDependencies"]
77
- },
78
- attw: {
79
- enabled: true,
80
- level: "error",
81
- profile: "node16"
82
- },
83
- format: defineFormat(format),
84
- dts: defineDts(dts)
85
- };
86
- return [rest, ...configs].reduce(tsdown.mergeConfig, baseConfig);
87
- };
88
-
89
- //#endregion
90
- exports.defineConfig = defineConfig;
2
+ let e=require(`tsdown`);const t=e=>{if(e===!1)return;let t={sourcemap:!0,resolve:!1};return typeof e==`object`?(delete e.resolve,{...t,...e}):t},n=`// @generated by tsdown, DO NOT edit it manually`,r=`// Generated by @kcconfigs/tsdown`,i=e=>{let t={esm:{sourcemap:!0,outputOptions:{postBanner:n,postFooter:r}},cjs:{sourcemap:!0,outputOptions:{postBanner:n,postFooter:r}}};if(typeof e==`string`)switch(e){case`module`:case`esm`:case`es`:return{esm:t.esm};case`commonjs`:case`cjs`:return{cjs:t.cjs}}else if(Array.isArray(e))return e.reduce((e,t)=>Object.assign(e,i(t)),{});else if(typeof e==`object`)return Object.assign(t,e);return t},a=(n,...r)=>{let{format:a,dts:o,...s}=n??{},c={entry:[`./src/index.ts`],platform:`neutral`,fixedExtension:!1,outDir:`dist`,clean:!0,minify:!0,publint:{enabled:!0,level:`warning`},unused:{enabled:!0,level:`warning`,depKinds:[`dependencies`,`peerDependencies`]},attw:{enabled:!0,level:`error`,profile:`node16`}},l=i(a);l&&(c.format=l);let u=t(o);return u&&(c.dts=u),[s,...r].reduce(e.mergeConfig,c)};exports.defineConfig=a;
91
3
  // Generated by @kcconfigs/tsdown
92
4
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["blacklist: Key[]","_dts: DtsOptions","defaultFormat: FormatObject","baseConfig: _UserConfig","_mergeConfig"],"sources":["../src/utils/defineDts.ts","../src/utils/defineFormat.ts","../src/index.ts"],"sourcesContent":["import type { DtsOptions, WithEnabled } from \"tsdown\";\n\nexport const defineDts = (\n\tdts: WithEnabled<DtsOptions>,\n): WithUndefined<DtsOptions> => {\n\ttype Key = keyof DtsOptions;\n\n\tconst blacklist: Key[] = [\"resolve\"];\n\n\tconst _dts: DtsOptions = {\n\t\tsourcemap: true,\n\t\tresolve: false,\n\t};\n\tif (dts === false) {\n\t\treturn undefined;\n\t}\n\tif (typeof dts === \"object\") {\n\t\tfor (const [key, value] of Object.entries(dts)) {\n\t\t\tif (blacklist.includes(key as Key)) continue;\n\t\t\t_dts[key as Key] = value;\n\t\t}\n\t}\n\n\treturn _dts;\n};\n","import type { Format, ResolvedConfig } from \"tsdown\";\n\ntype FormatValue = Partial<ResolvedConfig>;\ntype FormatObject = Partial<Record<Format, FormatValue>>;\ntype FormatOption = Format | Array<Format> | FormatObject;\n\nconst banner = \"// @generated by tsdown, DO NOT edit it manually\";\nconst footer = \"// Generated by @kcconfigs/tsdown\";\n\nexport const defineFormat = (\n\tformat: WithUndefined<FormatOption>,\n): WithUndefined<FormatObject> => {\n\tconst defaultFormat: FormatObject = {\n\t\tesm: {\n\t\t\tsourcemap: true,\n\t\t\toutputOptions: {\n\t\t\t\tpostBanner: banner,\n\t\t\t\tpostFooter: footer,\n\t\t\t},\n\t\t},\n\t\tcjs: {\n\t\t\tsourcemap: true,\n\t\t\toutputOptions: {\n\t\t\t\tpostBanner: banner,\n\t\t\t\tpostFooter: footer,\n\t\t\t},\n\t\t},\n\t};\n\n\tif (typeof format === \"string\") {\n\t\tswitch (format) {\n\t\t\tcase \"module\":\n\t\t\tcase \"esm\":\n\t\t\tcase \"es\":\n\t\t\t\treturn { esm: defaultFormat.esm };\n\t\t\tcase \"commonjs\":\n\t\t\tcase \"cjs\":\n\t\t\t\treturn { cjs: defaultFormat.cjs };\n\t\t}\n\t} else if (Array.isArray(format)) {\n\t\treturn format.reduce<FormatObject>((prev, curr) => {\n\t\t\treturn Object.assign(prev, defineFormat(curr));\n\t\t}, {} as FormatObject);\n\t} else if (typeof format === \"object\") {\n\t\treturn Object.assign(defaultFormat, format);\n\t}\n\n\treturn defaultFormat;\n};\n","import {\n\tmergeConfig as _mergeConfig,\n\ttype UserConfig as _UserConfig,\n} from \"tsdown\";\nimport { defineDts } from \"./utils/defineDts\";\nimport { defineFormat } from \"./utils/defineFormat\";\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\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: defineFormat(format),\n\t\tdts: defineDts(dts),\n\t};\n\n\treturn [rest, ...configs].reduce(_mergeConfig, baseConfig);\n};\n"],"mappings":";;;;AAEA,MAAa,aACZ,QAC+B;CAG/B,MAAMA,YAAmB,CAAC,UAAU;CAEpC,MAAMC,OAAmB;EACxB,WAAW;EACX,SAAS;EACT;AACD,KAAI,QAAQ,MACX;AAED,KAAI,OAAO,QAAQ,SAClB,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,IAAI,EAAE;AAC/C,MAAI,UAAU,SAAS,IAAW,CAAE;AACpC,OAAK,OAAc;;AAIrB,QAAO;;;;;ACjBR,MAAM,SAAS;AACf,MAAM,SAAS;AAEf,MAAa,gBACZ,WACiC;CACjC,MAAMC,gBAA8B;EACnC,KAAK;GACJ,WAAW;GACX,eAAe;IACd,YAAY;IACZ,YAAY;IACZ;GACD;EACD,KAAK;GACJ,WAAW;GACX,eAAe;IACd,YAAY;IACZ,YAAY;IACZ;GACD;EACD;AAED,KAAI,OAAO,WAAW,SACrB,SAAQ,QAAR;EACC,KAAK;EACL,KAAK;EACL,KAAK,KACJ,QAAO,EAAE,KAAK,cAAc,KAAK;EAClC,KAAK;EACL,KAAK,MACJ,QAAO,EAAE,KAAK,cAAc,KAAK;;UAEzB,MAAM,QAAQ,OAAO,CAC/B,QAAO,OAAO,QAAsB,MAAM,SAAS;AAClD,SAAO,OAAO,OAAO,MAAM,aAAa,KAAK,CAAC;IAC5C,EAAE,CAAiB;UACZ,OAAO,WAAW,SAC5B,QAAO,OAAO,OAAO,eAAe,OAAO;AAG5C,QAAO;;;;;;;;;;AC9BR,MAAa,gBACZ,QACA,GAAG,YACa;CAChB,MAAM,EAAE,QAAQ,KAAK,GAAG,SAAS,UAAW,EAAE;CAE9C,MAAMC,aAA0B;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,aAAa,OAAO;EAC5B,KAAK,UAAU,IAAI;EACnB;AAED,QAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,OAAOC,oBAAc,WAAW"}
1
+ {"version":3,"file":"index.cjs","names":["baseConfig: _UserConfig","_mergeConfig"],"sources":["../src/utils/defineDts.ts","../src/utils/defineFormat.ts","../src/index.ts"],"sourcesContent":["import type { DtsOptions, WithEnabled } from \"tsdown\";\n\nexport const defineDts = (\n\tdts: WithEnabled<DtsOptions>,\n): WithUndefined<DtsOptions> => {\n\tif (dts === false) {\n\t\treturn undefined;\n\t}\n\n\tconst defaultDts = {\n\t\tsourcemap: true,\n\t\tresolve: false,\n\t} satisfies DtsOptions;\n\n\tif (typeof dts === \"object\") {\n\t\tdelete dts.resolve;\n\t\treturn {\n\t\t\t...defaultDts,\n\t\t\t...dts,\n\t\t};\n\t}\n\n\treturn defaultDts;\n};\n","import type { Format, ResolvedConfig } from \"tsdown\";\n\ntype FormatValue = Partial<ResolvedConfig>;\ntype FormatObject = Partial<Record<Format, FormatValue>>;\ntype FormatOption = Format | Array<Format> | FormatObject;\n\nconst banner = \"// @generated by tsdown, DO NOT edit it manually\";\nconst footer = \"// Generated by @kcconfigs/tsdown\";\n\nexport const defineFormat = (\n\tformat: WithUndefined<FormatOption>,\n): WithUndefined<FormatObject> => {\n\tconst defaultFormat = {\n\t\tesm: {\n\t\t\tsourcemap: true,\n\t\t\toutputOptions: {\n\t\t\t\tpostBanner: banner,\n\t\t\t\tpostFooter: footer,\n\t\t\t},\n\t\t} satisfies FormatValue,\n\t\tcjs: {\n\t\t\tsourcemap: true,\n\t\t\toutputOptions: {\n\t\t\t\tpostBanner: banner,\n\t\t\t\tpostFooter: footer,\n\t\t\t},\n\t\t} satisfies FormatValue,\n\t};\n\n\tif (typeof format === \"string\") {\n\t\tswitch (format) {\n\t\t\tcase \"module\":\n\t\t\tcase \"esm\":\n\t\t\tcase \"es\":\n\t\t\t\treturn { esm: defaultFormat.esm };\n\t\t\tcase \"commonjs\":\n\t\t\tcase \"cjs\":\n\t\t\t\treturn { cjs: defaultFormat.cjs };\n\t\t}\n\t} else if (Array.isArray(format)) {\n\t\treturn format.reduce<FormatObject>((prev, curr) => {\n\t\t\treturn Object.assign(prev, defineFormat(curr));\n\t\t}, {} as FormatObject);\n\t} else if (typeof format === \"object\") {\n\t\treturn Object.assign(defaultFormat, format);\n\t}\n\n\treturn defaultFormat;\n};\n","import {\n\tmergeConfig as _mergeConfig,\n\ttype UserConfig as _UserConfig,\n} from \"tsdown\";\nimport { defineDts } from \"./utils/defineDts\";\nimport { defineFormat } from \"./utils/defineFormat\";\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: _format, dts: _dts, ...rest } = config ?? ({} as _UserConfig);\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\tminify: 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};\n\n\tconst format = defineFormat(_format);\n\tif (format) baseConfig.format = format;\n\n\tconst dts = defineDts(_dts);\n\tif (dts) baseConfig.dts = dts;\n\n\treturn [rest, ...configs].reduce(_mergeConfig, baseConfig);\n};\n"],"mappings":";wBAEA,MAAa,EACZ,GAC+B,CAC/B,GAAI,IAAQ,GACX,OAGD,IAAM,EAAa,CAClB,UAAW,GACX,QAAS,GACT,CAUD,OARI,OAAO,GAAQ,UAClB,OAAO,EAAI,QACJ,CACN,GAAG,EACH,GAAG,EACH,EAGK,GChBF,EAAS,mDACT,EAAS,oCAEF,EACZ,GACiC,CACjC,IAAM,EAAgB,CACrB,IAAK,CACJ,UAAW,GACX,cAAe,CACd,WAAY,EACZ,WAAY,EACZ,CACD,CACD,IAAK,CACJ,UAAW,GACX,cAAe,CACd,WAAY,EACZ,WAAY,EACZ,CACD,CACD,CAED,GAAI,OAAO,GAAW,SACrB,OAAQ,EAAR,CACC,IAAK,SACL,IAAK,MACL,IAAK,KACJ,MAAO,CAAE,IAAK,EAAc,IAAK,CAClC,IAAK,WACL,IAAK,MACJ,MAAO,CAAE,IAAK,EAAc,IAAK,SAEzB,MAAM,QAAQ,EAAO,CAC/B,OAAO,EAAO,QAAsB,EAAM,IAClC,OAAO,OAAO,EAAM,EAAa,EAAK,CAAC,CAC5C,EAAE,CAAiB,SACZ,OAAO,GAAW,SAC5B,OAAO,OAAO,OAAO,EAAe,EAAO,CAG5C,OAAO,GC9BK,GACZ,EACA,GAAG,IACa,CAChB,GAAM,CAAE,OAAQ,EAAS,IAAK,EAAM,GAAG,GAAS,GAAW,EAAE,CAEvDA,EAA0B,CAC/B,MAAO,CAAC,iBAAiB,CACzB,SAAU,UACV,eAAgB,GAChB,OAAQ,OACR,MAAO,GACP,OAAQ,GACR,QAAS,CACR,QAAS,GACT,MAAO,UACP,CACD,OAAQ,CACP,QAAS,GACT,MAAO,UACP,SAAU,CAAC,eAAgB,mBAAmB,CAC9C,CACD,KAAM,CACL,QAAS,GACT,MAAO,QAGP,QAAS,SACT,CACD,CAEK,EAAS,EAAa,EAAQ,CAChC,IAAQ,EAAW,OAAS,GAEhC,IAAM,EAAM,EAAU,EAAK,CAG3B,OAFI,IAAK,EAAW,IAAM,GAEnB,CAAC,EAAM,GAAG,EAAQ,CAAC,OAAOC,EAAAA,YAAc,EAAW"}
package/dist/index.js CHANGED
@@ -1,92 +1,4 @@
1
1
  // @generated by tsdown, DO NOT edit it manually
2
- import { mergeConfig } from "tsdown";
3
-
4
- //#region src/utils/defineDts.ts
5
- const defineDts = (dts) => {
6
- const blacklist = ["resolve"];
7
- const _dts = {
8
- sourcemap: true,
9
- resolve: false
10
- };
11
- if (dts === false) return;
12
- if (typeof dts === "object") for (const [key, value] of Object.entries(dts)) {
13
- if (blacklist.includes(key)) continue;
14
- _dts[key] = value;
15
- }
16
- return _dts;
17
- };
18
-
19
- //#endregion
20
- //#region src/utils/defineFormat.ts
21
- const banner = "// @generated by tsdown, DO NOT edit it manually";
22
- const footer = "// Generated by @kcconfigs/tsdown";
23
- const defineFormat = (format) => {
24
- const defaultFormat = {
25
- esm: {
26
- sourcemap: true,
27
- outputOptions: {
28
- postBanner: banner,
29
- postFooter: footer
30
- }
31
- },
32
- cjs: {
33
- sourcemap: true,
34
- outputOptions: {
35
- postBanner: banner,
36
- postFooter: footer
37
- }
38
- }
39
- };
40
- if (typeof format === "string") switch (format) {
41
- case "module":
42
- case "esm":
43
- case "es": return { esm: defaultFormat.esm };
44
- case "commonjs":
45
- case "cjs": return { cjs: defaultFormat.cjs };
46
- }
47
- else if (Array.isArray(format)) return format.reduce((prev, curr) => {
48
- return Object.assign(prev, defineFormat(curr));
49
- }, {});
50
- else if (typeof format === "object") return Object.assign(defaultFormat, format);
51
- return defaultFormat;
52
- };
53
-
54
- //#endregion
55
- //#region src/index.ts
56
- /**
57
- * @public Defines the configuration for tsdown.
58
- * @param configs UserConfig for tsdown
59
- * @returns The merged UserConfig
60
- */
61
- const defineConfig = (config, ...configs) => {
62
- const { format, dts, ...rest } = config ?? {};
63
- const baseConfig = {
64
- entry: ["./src/index.ts"],
65
- platform: "neutral",
66
- fixedExtension: false,
67
- outDir: "dist",
68
- clean: true,
69
- publint: {
70
- enabled: true,
71
- level: "warning"
72
- },
73
- unused: {
74
- enabled: true,
75
- level: "warning",
76
- depKinds: ["dependencies", "peerDependencies"]
77
- },
78
- attw: {
79
- enabled: true,
80
- level: "error",
81
- profile: "node16"
82
- },
83
- format: defineFormat(format),
84
- dts: defineDts(dts)
85
- };
86
- return [rest, ...configs].reduce(mergeConfig, baseConfig);
87
- };
88
-
89
- //#endregion
90
- export { defineConfig };
2
+ import{mergeConfig as e}from"tsdown";const t=e=>{if(e===!1)return;let t={sourcemap:!0,resolve:!1};return typeof e==`object`?(delete e.resolve,{...t,...e}):t},n=`// @generated by tsdown, DO NOT edit it manually`,r=`// Generated by @kcconfigs/tsdown`,i=e=>{let t={esm:{sourcemap:!0,outputOptions:{postBanner:n,postFooter:r}},cjs:{sourcemap:!0,outputOptions:{postBanner:n,postFooter:r}}};if(typeof e==`string`)switch(e){case`module`:case`esm`:case`es`:return{esm:t.esm};case`commonjs`:case`cjs`:return{cjs:t.cjs}}else if(Array.isArray(e))return e.reduce((e,t)=>Object.assign(e,i(t)),{});else if(typeof e==`object`)return Object.assign(t,e);return t},a=(n,...r)=>{let{format:a,dts:o,...s}=n??{},c={entry:[`./src/index.ts`],platform:`neutral`,fixedExtension:!1,outDir:`dist`,clean:!0,minify:!0,publint:{enabled:!0,level:`warning`},unused:{enabled:!0,level:`warning`,depKinds:[`dependencies`,`peerDependencies`]},attw:{enabled:!0,level:`error`,profile:`node16`}},l=i(a);l&&(c.format=l);let u=t(o);return u&&(c.dts=u),[s,...r].reduce(e,c)};export{a as defineConfig};
91
3
  // Generated by @kcconfigs/tsdown
92
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["blacklist: Key[]","_dts: DtsOptions","defaultFormat: FormatObject","baseConfig: _UserConfig","_mergeConfig"],"sources":["../src/utils/defineDts.ts","../src/utils/defineFormat.ts","../src/index.ts"],"sourcesContent":["import type { DtsOptions, WithEnabled } from \"tsdown\";\n\nexport const defineDts = (\n\tdts: WithEnabled<DtsOptions>,\n): WithUndefined<DtsOptions> => {\n\ttype Key = keyof DtsOptions;\n\n\tconst blacklist: Key[] = [\"resolve\"];\n\n\tconst _dts: DtsOptions = {\n\t\tsourcemap: true,\n\t\tresolve: false,\n\t};\n\tif (dts === false) {\n\t\treturn undefined;\n\t}\n\tif (typeof dts === \"object\") {\n\t\tfor (const [key, value] of Object.entries(dts)) {\n\t\t\tif (blacklist.includes(key as Key)) continue;\n\t\t\t_dts[key as Key] = value;\n\t\t}\n\t}\n\n\treturn _dts;\n};\n","import type { Format, ResolvedConfig } from \"tsdown\";\n\ntype FormatValue = Partial<ResolvedConfig>;\ntype FormatObject = Partial<Record<Format, FormatValue>>;\ntype FormatOption = Format | Array<Format> | FormatObject;\n\nconst banner = \"// @generated by tsdown, DO NOT edit it manually\";\nconst footer = \"// Generated by @kcconfigs/tsdown\";\n\nexport const defineFormat = (\n\tformat: WithUndefined<FormatOption>,\n): WithUndefined<FormatObject> => {\n\tconst defaultFormat: FormatObject = {\n\t\tesm: {\n\t\t\tsourcemap: true,\n\t\t\toutputOptions: {\n\t\t\t\tpostBanner: banner,\n\t\t\t\tpostFooter: footer,\n\t\t\t},\n\t\t},\n\t\tcjs: {\n\t\t\tsourcemap: true,\n\t\t\toutputOptions: {\n\t\t\t\tpostBanner: banner,\n\t\t\t\tpostFooter: footer,\n\t\t\t},\n\t\t},\n\t};\n\n\tif (typeof format === \"string\") {\n\t\tswitch (format) {\n\t\t\tcase \"module\":\n\t\t\tcase \"esm\":\n\t\t\tcase \"es\":\n\t\t\t\treturn { esm: defaultFormat.esm };\n\t\t\tcase \"commonjs\":\n\t\t\tcase \"cjs\":\n\t\t\t\treturn { cjs: defaultFormat.cjs };\n\t\t}\n\t} else if (Array.isArray(format)) {\n\t\treturn format.reduce<FormatObject>((prev, curr) => {\n\t\t\treturn Object.assign(prev, defineFormat(curr));\n\t\t}, {} as FormatObject);\n\t} else if (typeof format === \"object\") {\n\t\treturn Object.assign(defaultFormat, format);\n\t}\n\n\treturn defaultFormat;\n};\n","import {\n\tmergeConfig as _mergeConfig,\n\ttype UserConfig as _UserConfig,\n} from \"tsdown\";\nimport { defineDts } from \"./utils/defineDts\";\nimport { defineFormat } from \"./utils/defineFormat\";\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\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: defineFormat(format),\n\t\tdts: defineDts(dts),\n\t};\n\n\treturn [rest, ...configs].reduce(_mergeConfig, baseConfig);\n};\n"],"mappings":";;;;AAEA,MAAa,aACZ,QAC+B;CAG/B,MAAMA,YAAmB,CAAC,UAAU;CAEpC,MAAMC,OAAmB;EACxB,WAAW;EACX,SAAS;EACT;AACD,KAAI,QAAQ,MACX;AAED,KAAI,OAAO,QAAQ,SAClB,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,IAAI,EAAE;AAC/C,MAAI,UAAU,SAAS,IAAW,CAAE;AACpC,OAAK,OAAc;;AAIrB,QAAO;;;;;ACjBR,MAAM,SAAS;AACf,MAAM,SAAS;AAEf,MAAa,gBACZ,WACiC;CACjC,MAAMC,gBAA8B;EACnC,KAAK;GACJ,WAAW;GACX,eAAe;IACd,YAAY;IACZ,YAAY;IACZ;GACD;EACD,KAAK;GACJ,WAAW;GACX,eAAe;IACd,YAAY;IACZ,YAAY;IACZ;GACD;EACD;AAED,KAAI,OAAO,WAAW,SACrB,SAAQ,QAAR;EACC,KAAK;EACL,KAAK;EACL,KAAK,KACJ,QAAO,EAAE,KAAK,cAAc,KAAK;EAClC,KAAK;EACL,KAAK,MACJ,QAAO,EAAE,KAAK,cAAc,KAAK;;UAEzB,MAAM,QAAQ,OAAO,CAC/B,QAAO,OAAO,QAAsB,MAAM,SAAS;AAClD,SAAO,OAAO,OAAO,MAAM,aAAa,KAAK,CAAC;IAC5C,EAAE,CAAiB;UACZ,OAAO,WAAW,SAC5B,QAAO,OAAO,OAAO,eAAe,OAAO;AAG5C,QAAO;;;;;;;;;;AC9BR,MAAa,gBACZ,QACA,GAAG,YACa;CAChB,MAAM,EAAE,QAAQ,KAAK,GAAG,SAAS,UAAW,EAAE;CAE9C,MAAMC,aAA0B;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,aAAa,OAAO;EAC5B,KAAK,UAAU,IAAI;EACnB;AAED,QAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,OAAOC,aAAc,WAAW"}
1
+ {"version":3,"file":"index.js","names":["baseConfig: _UserConfig","_mergeConfig"],"sources":["../src/utils/defineDts.ts","../src/utils/defineFormat.ts","../src/index.ts"],"sourcesContent":["import type { DtsOptions, WithEnabled } from \"tsdown\";\n\nexport const defineDts = (\n\tdts: WithEnabled<DtsOptions>,\n): WithUndefined<DtsOptions> => {\n\tif (dts === false) {\n\t\treturn undefined;\n\t}\n\n\tconst defaultDts = {\n\t\tsourcemap: true,\n\t\tresolve: false,\n\t} satisfies DtsOptions;\n\n\tif (typeof dts === \"object\") {\n\t\tdelete dts.resolve;\n\t\treturn {\n\t\t\t...defaultDts,\n\t\t\t...dts,\n\t\t};\n\t}\n\n\treturn defaultDts;\n};\n","import type { Format, ResolvedConfig } from \"tsdown\";\n\ntype FormatValue = Partial<ResolvedConfig>;\ntype FormatObject = Partial<Record<Format, FormatValue>>;\ntype FormatOption = Format | Array<Format> | FormatObject;\n\nconst banner = \"// @generated by tsdown, DO NOT edit it manually\";\nconst footer = \"// Generated by @kcconfigs/tsdown\";\n\nexport const defineFormat = (\n\tformat: WithUndefined<FormatOption>,\n): WithUndefined<FormatObject> => {\n\tconst defaultFormat = {\n\t\tesm: {\n\t\t\tsourcemap: true,\n\t\t\toutputOptions: {\n\t\t\t\tpostBanner: banner,\n\t\t\t\tpostFooter: footer,\n\t\t\t},\n\t\t} satisfies FormatValue,\n\t\tcjs: {\n\t\t\tsourcemap: true,\n\t\t\toutputOptions: {\n\t\t\t\tpostBanner: banner,\n\t\t\t\tpostFooter: footer,\n\t\t\t},\n\t\t} satisfies FormatValue,\n\t};\n\n\tif (typeof format === \"string\") {\n\t\tswitch (format) {\n\t\t\tcase \"module\":\n\t\t\tcase \"esm\":\n\t\t\tcase \"es\":\n\t\t\t\treturn { esm: defaultFormat.esm };\n\t\t\tcase \"commonjs\":\n\t\t\tcase \"cjs\":\n\t\t\t\treturn { cjs: defaultFormat.cjs };\n\t\t}\n\t} else if (Array.isArray(format)) {\n\t\treturn format.reduce<FormatObject>((prev, curr) => {\n\t\t\treturn Object.assign(prev, defineFormat(curr));\n\t\t}, {} as FormatObject);\n\t} else if (typeof format === \"object\") {\n\t\treturn Object.assign(defaultFormat, format);\n\t}\n\n\treturn defaultFormat;\n};\n","import {\n\tmergeConfig as _mergeConfig,\n\ttype UserConfig as _UserConfig,\n} from \"tsdown\";\nimport { defineDts } from \"./utils/defineDts\";\nimport { defineFormat } from \"./utils/defineFormat\";\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: _format, dts: _dts, ...rest } = config ?? ({} as _UserConfig);\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\tminify: 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};\n\n\tconst format = defineFormat(_format);\n\tif (format) baseConfig.format = format;\n\n\tconst dts = defineDts(_dts);\n\tif (dts) baseConfig.dts = dts;\n\n\treturn [rest, ...configs].reduce(_mergeConfig, baseConfig);\n};\n"],"mappings":";qCAEA,MAAa,EACZ,GAC+B,CAC/B,GAAI,IAAQ,GACX,OAGD,IAAM,EAAa,CAClB,UAAW,GACX,QAAS,GACT,CAUD,OARI,OAAO,GAAQ,UAClB,OAAO,EAAI,QACJ,CACN,GAAG,EACH,GAAG,EACH,EAGK,GChBF,EAAS,mDACT,EAAS,oCAEF,EACZ,GACiC,CACjC,IAAM,EAAgB,CACrB,IAAK,CACJ,UAAW,GACX,cAAe,CACd,WAAY,EACZ,WAAY,EACZ,CACD,CACD,IAAK,CACJ,UAAW,GACX,cAAe,CACd,WAAY,EACZ,WAAY,EACZ,CACD,CACD,CAED,GAAI,OAAO,GAAW,SACrB,OAAQ,EAAR,CACC,IAAK,SACL,IAAK,MACL,IAAK,KACJ,MAAO,CAAE,IAAK,EAAc,IAAK,CAClC,IAAK,WACL,IAAK,MACJ,MAAO,CAAE,IAAK,EAAc,IAAK,SAEzB,MAAM,QAAQ,EAAO,CAC/B,OAAO,EAAO,QAAsB,EAAM,IAClC,OAAO,OAAO,EAAM,EAAa,EAAK,CAAC,CAC5C,EAAE,CAAiB,SACZ,OAAO,GAAW,SAC5B,OAAO,OAAO,OAAO,EAAe,EAAO,CAG5C,OAAO,GC9BK,GACZ,EACA,GAAG,IACa,CAChB,GAAM,CAAE,OAAQ,EAAS,IAAK,EAAM,GAAG,GAAS,GAAW,EAAE,CAEvDA,EAA0B,CAC/B,MAAO,CAAC,iBAAiB,CACzB,SAAU,UACV,eAAgB,GAChB,OAAQ,OACR,MAAO,GACP,OAAQ,GACR,QAAS,CACR,QAAS,GACT,MAAO,UACP,CACD,OAAQ,CACP,QAAS,GACT,MAAO,UACP,SAAU,CAAC,eAAgB,mBAAmB,CAC9C,CACD,KAAM,CACL,QAAS,GACT,MAAO,QAGP,QAAS,SACT,CACD,CAEK,EAAS,EAAa,EAAQ,CAChC,IAAQ,EAAW,OAAS,GAEhC,IAAM,EAAM,EAAU,EAAK,CAG3B,OAFI,IAAK,EAAW,IAAM,GAEnB,CAAC,EAAM,GAAG,EAAQ,CAAC,OAAOC,EAAc,EAAW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kcconfigs/tsdown",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "Shared tsdown configuration",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -11,8 +11,9 @@
11
11
  },
12
12
  "devDependencies": {
13
13
  "@biomejs/biome": "2.3.10",
14
- "@kcconfigs/biome": "0.2.0",
15
- "@kcconfigs/tsconfig": "0.1.0-beta.2"
14
+ "@kcconfigs/tsconfig": "0.1.0",
15
+ "@kctypes/generic": "1.30.3",
16
+ "@kcconfigs/biome": "0.2.1"
16
17
  },
17
18
  "peerDependencies": {
18
19
  "tsdown": "^0.18.0",
@@ -87,6 +88,6 @@
87
88
  "format:check": "biome format",
88
89
  "lint": "biome lint --fix --unsafe",
89
90
  "lint:check": "biome lint",
90
- "type:check": "tsc --build"
91
+ "type:check": "tsc --noEmit"
91
92
  }
92
93
  }
package/src/index.ts CHANGED
@@ -19,7 +19,7 @@ export const defineConfig = (
19
19
  config?: _UserConfig,
20
20
  ...configs: UserConfig[]
21
21
  ): UserConfig => {
22
- const { format, dts, ...rest } = config ?? ({} as _UserConfig);
22
+ const { format: _format, dts: _dts, ...rest } = config ?? ({} as _UserConfig);
23
23
 
24
24
  const baseConfig: _UserConfig = {
25
25
  entry: ["./src/index.ts"],
@@ -27,6 +27,7 @@ export const defineConfig = (
27
27
  fixedExtension: false,
28
28
  outDir: "dist",
29
29
  clean: true,
30
+ minify: true,
30
31
  publint: {
31
32
  enabled: true,
32
33
  level: "warning",
@@ -43,9 +44,13 @@ export const defineConfig = (
43
44
  // https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/NoResolution.md#true-positive-node-10-doesnt-support-packagejson-exports
44
45
  profile: "node16",
45
46
  },
46
- format: defineFormat(format),
47
- dts: defineDts(dts),
48
47
  };
49
48
 
49
+ const format = defineFormat(_format);
50
+ if (format) baseConfig.format = format;
51
+
52
+ const dts = defineDts(_dts);
53
+ if (dts) baseConfig.dts = dts;
54
+
50
55
  return [rest, ...configs].reduce(_mergeConfig, baseConfig);
51
56
  };
@@ -3,23 +3,22 @@ import type { DtsOptions, WithEnabled } from "tsdown";
3
3
  export const defineDts = (
4
4
  dts: WithEnabled<DtsOptions>,
5
5
  ): WithUndefined<DtsOptions> => {
6
- type Key = keyof DtsOptions;
7
-
8
- const blacklist: Key[] = ["resolve"];
9
-
10
- const _dts: DtsOptions = {
11
- sourcemap: true,
12
- resolve: false,
13
- };
14
6
  if (dts === false) {
15
7
  return undefined;
16
8
  }
9
+
10
+ const defaultDts = {
11
+ sourcemap: true,
12
+ resolve: false,
13
+ } satisfies DtsOptions;
14
+
17
15
  if (typeof dts === "object") {
18
- for (const [key, value] of Object.entries(dts)) {
19
- if (blacklist.includes(key as Key)) continue;
20
- _dts[key as Key] = value;
21
- }
16
+ delete dts.resolve;
17
+ return {
18
+ ...defaultDts,
19
+ ...dts,
20
+ };
22
21
  }
23
22
 
24
- return _dts;
23
+ return defaultDts;
25
24
  };
@@ -10,21 +10,21 @@ const footer = "// Generated by @kcconfigs/tsdown";
10
10
  export const defineFormat = (
11
11
  format: WithUndefined<FormatOption>,
12
12
  ): WithUndefined<FormatObject> => {
13
- const defaultFormat: FormatObject = {
13
+ const defaultFormat = {
14
14
  esm: {
15
15
  sourcemap: true,
16
16
  outputOptions: {
17
17
  postBanner: banner,
18
18
  postFooter: footer,
19
19
  },
20
- },
20
+ } satisfies FormatValue,
21
21
  cjs: {
22
22
  sourcemap: true,
23
23
  outputOptions: {
24
24
  postBanner: banner,
25
25
  postFooter: footer,
26
26
  },
27
- },
27
+ } satisfies FormatValue,
28
28
  };
29
29
 
30
30
  if (typeof format === "string") {