tsdown-config-silverwind 1.2.1 → 1.4.0

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 CHANGED
@@ -12,5 +12,9 @@ declare function webLib({
12
12
  url,
13
13
  ...other
14
14
  }: CustomConfig): Options;
15
+ declare function nodeCli({
16
+ url,
17
+ ...other
18
+ }: CustomConfig): Options;
15
19
  //#endregion
16
- export { CustomConfig, nodeLib, webLib };
20
+ export { CustomConfig, nodeCli, nodeLib, webLib };
package/dist/index.js CHANGED
@@ -2,14 +2,39 @@ import { fileURLToPath } from "node:url";
2
2
  import { platform } from "node:os";
3
3
 
4
4
  //#region index.ts
5
- const base = ({ url,...other }) => {
6
- let entry = fileURLToPath(new URL("index.ts", url));
7
- if (platform() === "win32") entry = entry.replaceAll("\\", "/");
5
+ function isObject(obj) {
6
+ return Object.prototype.toString.call(obj) === "[object Object]";
7
+ }
8
+ function fixWindowsPath(entry) {
9
+ return entry.replaceAll("\\", "/");
10
+ }
11
+ function fixEntry(entry) {
12
+ if (platform() !== "win32") return entry;
13
+ if (typeof entry === "string") return fixWindowsPath(entry);
14
+ else if (Array.isArray(entry)) return entry.map((entry$1) => fixWindowsPath(entry$1));
15
+ else if (isObject(entry)) return Object.fromEntries(Object.entries(entry).map(([key, value]) => {
16
+ return [key, fixWindowsPath(value)];
17
+ }));
18
+ else return entry;
19
+ }
20
+ const base = ({ url, entry, report, loader, outputOptions,...other }) => {
8
21
  return {
9
- entry,
10
- report: {
22
+ entry: fixEntry(entry ?? fileURLToPath(new URL("index.ts", url))),
23
+ report: typeof report === "boolean" ? report : {
11
24
  gzip: false,
12
- brotli: false
25
+ brotli: false,
26
+ ...isObject(report) && { report }
27
+ },
28
+ loader: {
29
+ ".svg": "text",
30
+ ".md": "text",
31
+ ".xml": "text",
32
+ ".txt": "text",
33
+ ...loader
34
+ },
35
+ outputOptions: {
36
+ legalComments: "none",
37
+ ...outputOptions
13
38
  },
14
39
  ...other
15
40
  };
@@ -28,6 +53,13 @@ function webLib({ url,...other }) {
28
53
  ...other
29
54
  });
30
55
  }
56
+ function nodeCli({ url,...other }) {
57
+ return nodeLib({
58
+ platform: "node",
59
+ url,
60
+ ...other
61
+ });
62
+ }
31
63
 
32
64
  //#endregion
33
- export { nodeLib, webLib };
65
+ export { nodeCli, nodeLib, webLib };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown-config-silverwind",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "Shared tsdown configuration",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": "silverwind/tsdown-config-silverwind",
@@ -23,8 +23,8 @@
23
23
  "tsdown": "0.15.5",
24
24
  "typescript": "5.9.2",
25
25
  "typescript-config-silverwind": "10.0.2",
26
- "updates": "16.7.2",
27
- "versions": "13.1.2",
26
+ "updates": "16.7.3",
27
+ "versions": "13.2.0",
28
28
  "vitest": "3.2.4",
29
29
  "vitest-config-silverwind": "10.2.0"
30
30
  }