rolldown-plugin-dts 0.7.0 → 0.7.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
@@ -56,7 +56,7 @@ interface Options {
56
56
  * When `true`, the plugin will generate `.d.ts` files using `oxc-transform`,
57
57
  * which is blazingly faster than `typescript` compiler.
58
58
  *
59
- * This option is enabled when `isolatedDeclaration` in `compilerOptions` is set to `true`.
59
+ * This option is enabled when `isolatedDeclarations` in `compilerOptions` is set to `true`.
60
60
  */
61
61
  isolatedDeclaration?: boolean | Omit<IsolatedDeclarationsOptions, 'sourcemap'>
62
62
 
package/dist/index.d.ts CHANGED
@@ -35,7 +35,7 @@ interface Options {
35
35
  * When `true`, the plugin will generate `.d.ts` files using `oxc-transform`,
36
36
  * which is blazingly faster than `typescript` compiler.
37
37
  *
38
- * This option is enabled when `isolatedDeclaration` in `compilerOptions` is set to `true`.
38
+ * This option is enabled when `isolatedDeclarations` in `compilerOptions` is set to `true`.
39
39
  */
40
40
  isolatedDeclaration?: boolean | Omit<IsolatedDeclarationsOptions, "sourcemap">;
41
41
  /** Resolve external types used in dts files from `node_modules` */
package/dist/index.js CHANGED
@@ -172,7 +172,7 @@ function getIdentifierRange(node, offset = 0) {
172
172
  //#endregion
173
173
  //#region src/utils/filename.ts
174
174
  const RE_JS = /\.([cm]?)js$/;
175
- const RE_TS = /\.([cm]?)ts$/;
175
+ const RE_TS = /\.([cm]?)tsx?$/;
176
176
  const RE_DTS = /\.d\.([cm]?)ts$/;
177
177
  const RE_NODE_MODULES = /node_modules/;
178
178
  function filename_js_to_dts(id) {
@@ -374,17 +374,18 @@ function collectDependencies(s, node, getIdentifierIndex) {
374
374
  if (node$1.computed && isReferenceId(node$1.key)) addDependency(node$1.key);
375
375
  if ("value" in node$1 && isReferenceId(node$1.value)) addDependency(node$1.value);
376
376
  } else if (node$1.type === "TSTypeReference") addDependency(node$1.typeName);
377
- else if (node$1.type === "TSTypeQuery") addDependency(node$1.exprName);
378
- else if (node$1.type === "TSImportType") {
377
+ else if (node$1.type === "TSTypeQuery") {
378
+ if (node$1.exprName.type !== "TSImportType") addDependency(node$1.exprName);
379
+ } else if (node$1.type === "TSImportType") {
379
380
  if (node$1.argument.type !== "TSLiteralType" || node$1.argument.literal.type !== "Literal" || typeof node$1.argument.literal.value !== "string") return;
380
381
  const source = node$1.argument.literal.value;
381
- const imported = node$1.qualifier && s.sliceNode(node$1.qualifier);
382
- const local = importNamespace(s, source, imported, getIdentifierIndex);
382
+ const imported = node$1.qualifier && resolveTSTypeName(node$1.qualifier);
383
+ const local = importNamespace(s, source, imported && s.sliceNode(imported), getIdentifierIndex);
383
384
  addDependency({
384
385
  type: "Identifier",
385
386
  name: local,
386
- start: node$1.start + (node$1.isTypeOf ? 7 : 0),
387
- end: node$1.qualifier ? node$1.qualifier.end : node$1.end
387
+ start: node$1.start,
388
+ end: imported ? imported.end : node$1.end
388
389
  });
389
390
  }
390
391
  } });
@@ -394,6 +395,10 @@ function collectDependencies(s, node, getIdentifierIndex) {
394
395
  deps.add(node$1);
395
396
  }
396
397
  }
398
+ function resolveTSTypeName(node) {
399
+ if (node.type === "Identifier") return node;
400
+ return resolveTSTypeName(node.left);
401
+ }
397
402
  function isReferenceId(node) {
398
403
  return !!node && (node.type === "Identifier" || node.type === "MemberExpression");
399
404
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown-plugin-dts",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "A Rolldown plugin to bundle dts files",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,19 +38,19 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "debug": "^4.4.0",
41
- "dts-resolver": "^0.1.0",
41
+ "dts-resolver": "^0.1.1",
42
42
  "get-tsconfig": "^4.10.0",
43
43
  "magic-string-ast": "^0.9.1",
44
- "oxc-parser": "^0.62.0",
45
- "oxc-transform": "^0.62.0"
44
+ "oxc-parser": "^0.64.0",
45
+ "oxc-transform": "^0.64.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@sxzz/eslint-config": "^6.1.1",
49
49
  "@sxzz/prettier-config": "^2.2.1",
50
- "@sxzz/test-utils": "^0.5.4",
50
+ "@sxzz/test-utils": "^0.5.5",
51
51
  "@types/debug": "^4.1.12",
52
52
  "@types/diff": "^7.0.2",
53
- "@types/node": "^22.14.0",
53
+ "@types/node": "^22.14.1",
54
54
  "bumpp": "^10.1.0",
55
55
  "diff": "^7.0.0",
56
56
  "eslint": "^9.24.0",
@@ -58,7 +58,7 @@
58
58
  "prettier": "^3.5.3",
59
59
  "rolldown": "^1.0.0-beta.7",
60
60
  "rollup-plugin-dts": "^6.2.1",
61
- "tsdown": "^0.8.0-beta.1",
61
+ "tsdown": "^0.8.0",
62
62
  "tsx": "^4.19.3",
63
63
  "typescript": "^5.8.3",
64
64
  "vitest": "^3.1.1"