tsdown-config-silverwind 4.2.0 → 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.
Files changed (2) hide show
  1. package/dist/index.js +9 -1
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { createRequire } from "node:module";
1
2
  import { fileURLToPath } from "node:url";
2
3
 
3
4
  // index.ts
@@ -18,6 +19,13 @@ function isSingleEntry(entry) {
18
19
  return keys.length === 1 && !keys[0].includes("*");
19
20
  } else return typeof entry !== "string" || !/[*?(]|\[.*\]|\{[^}]*(?:,|\.\.)/.test(entry);
20
21
  }
22
+ function hasTypescriptApi(url) {
23
+ try {
24
+ return Number.parseInt(createRequire(url)("typescript/package.json").version) < 7;
25
+ } catch {
26
+ return false;
27
+ }
28
+ }
21
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)),
@@ -43,7 +51,7 @@ function base({ url, entry, report, loader, outputOptions, deps, checks, dts, ..
43
51
  },
44
52
  globImport: false,
45
53
  dts: dts !== false && {
46
- generator: "oxc",
54
+ generator: hasTypescriptApi(url) ? "tsc" : "oxc",
47
55
  ...isObject(dts) && dts
48
56
  },
49
57
  deps: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown-config-silverwind",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "Shared tsdown configuration",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": {
@@ -23,16 +23,16 @@
23
23
  "tsdown": "*"
24
24
  },
25
25
  "devDependencies": {
26
- "@types/node": "26.6.3",
27
- "eslint": "10.11.0",
26
+ "@types/node": "26.6.6",
27
+ "eslint": "10.14.0",
28
28
  "eslint-config-silverwind": "155.2.0",
29
29
  "tsdown": "0.23.4",
30
30
  "typescript": "7.0.2",
31
- "typescript-config-silverwind": "21.0.1",
32
- "updates": "19.0.2",
33
- "updates-config-silverwind": "4.0.7",
34
- "versions": "15.5.1",
35
- "vitest": "5.0.2",
36
- "vitest-config-silverwind": "12.0.5"
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"
37
37
  }
38
38
  }