tsdown-config-silverwind 4.1.4 → 4.2.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/dist/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { UserConfig } from "tsdown";
2
- //#region index.d.ts
3
2
  type CustomConfig = UserConfig & {
4
3
  url: string;
5
4
  };
6
- export declare function base({ url, entry, report, loader, outputOptions, deps, checks, ...other }: CustomConfig): UserConfig;
5
+ export declare function base({ url, entry, report, loader, outputOptions, deps, checks, dts, ...other }: CustomConfig): UserConfig;
7
6
  export declare function nodeLib({ url, entry, outputOptions, ...other }: CustomConfig): UserConfig;
8
7
  export declare function webLib(config: CustomConfig): UserConfig;
9
8
  export declare function nodeCli(config: CustomConfig): UserConfig;
10
- //#endregion
9
+ export {};
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
+ import { createRequire } from "node:module";
1
2
  import { fileURLToPath } from "node:url";
2
3
 
3
- //#region index.ts
4
+ // index.ts
4
5
  function isObject(obj) {
5
6
  return Object.prototype.toString.call(obj) === "[object Object]";
6
7
  }
@@ -18,7 +19,14 @@ function isSingleEntry(entry) {
18
19
  return keys.length === 1 && !keys[0].includes("*");
19
20
  } else return typeof entry !== "string" || !/[*?(]|\[.*\]|\{[^}]*(?:,|\.\.)/.test(entry);
20
21
  }
21
- function base({ url, entry, report, loader, outputOptions, deps, checks, ...other }) {
22
+ function hasTypescriptApi(url) {
23
+ try {
24
+ return Number.parseInt(createRequire(url)("typescript/package.json").version) < 7;
25
+ } catch {
26
+ return false;
27
+ }
28
+ }
29
+ function base({ url, entry, report, loader, outputOptions, deps, checks, dts, ...other }) {
22
30
  return {
23
31
  entry: entry ?? fileURLToPath(new URL("index.ts", url)),
24
32
  report: typeof report === "boolean" || typeof report === "string" ? report : {
@@ -42,7 +50,10 @@ function base({ url, entry, report, loader, outputOptions, deps, checks, ...othe
42
50
  ...checks
43
51
  },
44
52
  globImport: false,
45
- dts: true,
53
+ dts: dts !== false && {
54
+ generator: hasTypescriptApi(url) ? "tsc" : "oxc",
55
+ ...isObject(dts) && dts
56
+ },
46
57
  deps: {
47
58
  onlyBundle: false,
48
59
  ...deps
@@ -75,5 +86,4 @@ function nodeCli(config) {
75
86
  });
76
87
  }
77
88
 
78
- //#endregion
79
89
  export { base, nodeCli, nodeLib, webLib };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown-config-silverwind",
3
- "version": "4.1.4",
3
+ "version": "4.2.1",
4
4
  "description": "Shared tsdown configuration",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": {
@@ -23,17 +23,16 @@
23
23
  "tsdown": "*"
24
24
  },
25
25
  "devDependencies": {
26
- "@types/node": "26.6.3",
27
- "@typescript/native-preview": "7.0.0-dev.20260707.2",
28
- "eslint": "10.11.0",
29
- "eslint-config-silverwind": "151.0.1",
30
- "tsdown": "0.23.0",
31
- "typescript": "6.0.3",
32
- "typescript-config-silverwind": "21.0.1",
33
- "updates": "19.0.2",
34
- "updates-config-silverwind": "4.0.7",
35
- "versions": "15.5.1",
36
- "vitest": "5.0.2",
37
- "vitest-config-silverwind": "12.0.5"
26
+ "@types/node": "26.6.6",
27
+ "eslint": "10.14.0",
28
+ "eslint-config-silverwind": "155.2.0",
29
+ "tsdown": "0.23.4",
30
+ "typescript": "7.0.2",
31
+ "typescript-config-silverwind": "21.0.2",
32
+ "updates": "20.0.0",
33
+ "updates-config-silverwind": "4.1.0",
34
+ "versions": "15.5.2",
35
+ "vitest": "5.0.5",
36
+ "vitest-config-silverwind": "12.0.6"
38
37
  }
39
38
  }