rolldown-plugin-dts 0.10.1 → 0.11.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/README.md CHANGED
@@ -6,6 +6,8 @@ A Rolldown plugin to generate and bundle dts files.
6
6
 
7
7
  ## Install
8
8
 
9
+ ⚠️ Requires `rolldown@1.0.0-beta.8-commit.534fde3` (which is canary) or later.
10
+
9
11
  ```bash
10
12
  npm i rolldown-plugin-dts
11
13
  ```
@@ -25,7 +27,7 @@ export default {
25
27
  }
26
28
  ```
27
29
 
28
- You can find a real demo in [here](./rolldown.config.ts).
30
+ You can find an example in [here](./rolldown.config.ts).
29
31
 
30
32
  ## Options
31
33
 
@@ -68,7 +70,7 @@ interface Options {
68
70
  compilerOptions?: TsConfigJson.CompilerOptions
69
71
 
70
72
  /**
71
- * When `true`, the plugin will generate `.d.ts` files using `oxc-transform`,
73
+ * When `true`, the plugin will generate `.d.ts` files using Oxc,
72
74
  * which is blazingly faster than `typescript` compiler.
73
75
  *
74
76
  * This option is enabled when `isolatedDeclarations` in `compilerOptions` is set to `true`.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TsConfigJson } from "get-tsconfig";
2
- import { IsolatedDeclarationsOptions } from "oxc-transform";
2
+ import { IsolatedDeclarationsOptions } from "rolldown/experimental";
3
3
  import { Plugin } from "rolldown";
4
4
 
5
5
  //#region src/fake-js.d.ts
@@ -51,7 +51,7 @@ interface Options {
51
51
  */
52
52
  compilerOptions?: TsConfigJson.CompilerOptions;
53
53
  /**
54
- * When `true`, the plugin will generate `.d.ts` files using `oxc-transform`,
54
+ * When `true`, the plugin will generate `.d.ts` files using Oxc,
55
55
  * which is blazingly faster than `typescript` compiler.
56
56
  *
57
57
  * This option is enabled when `isolatedDeclarations` in `compilerOptions` is set to `true`.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import _generate from "@babel/generator";
6
6
  import { parse } from "@babel/parser";
7
7
  import * as t from "@babel/types";
8
8
  import { isDeclarationType, isTypeOf } from "ast-kit";
9
- import { isolatedDeclaration } from "oxc-transform";
9
+ import { isolatedDeclaration } from "rolldown/experimental";
10
10
  import { createRequire } from "node:module";
11
11
  import { createResolver } from "dts-resolver";
12
12
 
@@ -417,9 +417,11 @@ function createFakeJsPlugin({ dtsInput, sourcemap }) {
417
417
  generateBundle(options, bundle) {
418
418
  for (const chunk of Object.values(bundle)) {
419
419
  if (chunk.type !== "asset" || !RE_DTS_MAP.test(chunk.fileName) || typeof chunk.source !== "string") continue;
420
- const maps = JSON.parse(chunk.source);
421
- maps.sourcesContent = null;
422
- chunk.source = JSON.stringify(maps);
420
+ if (sourcemap) {
421
+ const maps = JSON.parse(chunk.source);
422
+ maps.sourcesContent = null;
423
+ chunk.source = JSON.stringify(maps);
424
+ } else delete bundle[chunk.fileName];
423
425
  }
424
426
  }
425
427
  };
@@ -870,7 +872,7 @@ function createDtsResolvePlugin({ tsconfig, resolve }) {
870
872
  if (!shouldResolve) return external;
871
873
  }
872
874
  if (RE_TS.test(resolution) && !RE_DTS.test(resolution)) {
873
- await Promise.any([this.load({ id: resolution }), new Promise((resolve$1) => setTimeout(resolve$1, 200))]);
875
+ await this.load({ id: resolution });
874
876
  resolution = filename_ts_to_dts(resolution);
875
877
  }
876
878
  if (RE_DTS.test(resolution)) return resolution;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown-plugin-dts",
3
- "version": "0.10.1",
3
+ "version": "0.11.1",
4
4
  "description": "A Rolldown plugin to bundle dts files",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@
28
28
  "access": "public"
29
29
  },
30
30
  "peerDependencies": {
31
- "rolldown": "^1.0.0-beta.7",
31
+ "rolldown": "^1.0.0-beta.8-commit.534fde3",
32
32
  "typescript": "^5.0.0"
33
33
  },
34
34
  "peerDependenciesMeta": {
@@ -43,8 +43,7 @@
43
43
  "ast-kit": "^1.4.3",
44
44
  "debug": "^4.4.0",
45
45
  "dts-resolver": "^1.1.0",
46
- "get-tsconfig": "^4.10.0",
47
- "oxc-transform": "^0.67.0"
46
+ "get-tsconfig": "^4.10.0"
48
47
  },
49
48
  "devDependencies": {
50
49
  "@sxzz/eslint-config": "^6.2.0",
@@ -59,7 +58,7 @@
59
58
  "eslint": "^9.25.1",
60
59
  "estree-walker": "^3.0.3",
61
60
  "prettier": "^3.5.3",
62
- "rolldown": "1.0.0-beta.8-commit.6aca0ce",
61
+ "rolldown": "^1.0.0-beta.8-commit.534fde3",
63
62
  "rollup-plugin-dts": "^6.2.1",
64
63
  "tinyglobby": "^0.2.13",
65
64
  "tsdown": "^0.10.2",
@@ -71,7 +70,7 @@
71
70
  "node": ">=20.18.0"
72
71
  },
73
72
  "resolutions": {
74
- "rolldown": "1.0.0-beta.8-commit.6aca0ce",
73
+ "rolldown": "^1.0.0-beta.8-commit.534fde3",
75
74
  "rolldown-plugin-dts": "workspace:*"
76
75
  },
77
76
  "prettier": "@sxzz/prettier-config",