rolldown-plugin-dts 0.22.2 → 0.22.4

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/filename.mjs CHANGED
@@ -1,13 +1,12 @@
1
1
  import { RUNTIME_MODULE_ID } from "rolldown";
2
2
  import { exactRegex } from "rolldown/filter";
3
-
4
3
  //#region src/filename.ts
5
4
  const RE_JS = /\.([cm]?)jsx?$/;
6
5
  const RE_TS = /\.([cm]?)tsx?$/;
7
6
  const RE_DTS = /\.d\.([cm]?)ts$/;
8
7
  const RE_DTS_MAP = /\.d\.([cm]?)ts\.map$/;
9
8
  const RE_NODE_MODULES = /[\\/]node_modules[\\/]/;
10
- const RE_CSS = /\.css$/;
9
+ const RE_CSS = /\.(?:css|scss|sass|less|styl|stylus)$/;
11
10
  const RE_VUE = /\.vue$/;
12
11
  const RE_JSON = /\.json$/;
13
12
  const RE_ROLLDOWN_RUNTIME = exactRegex(RUNTIME_MODULE_ID);
@@ -26,6 +25,5 @@ function resolveTemplateFn(fn, chunk) {
26
25
  function replaceTemplateName(template, name) {
27
26
  return template.replaceAll("[name]", name);
28
27
  }
29
-
30
28
  //#endregion
31
- export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_JSON, RE_NODE_MODULES, RE_ROLLDOWN_RUNTIME, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn };
29
+ export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_JSON, RE_NODE_MODULES, RE_ROLLDOWN_RUNTIME, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn };
@@ -1,4 +1,4 @@
1
- import { r as TscContext } from "./context-BbNuMjMl.mjs";
1
+ import { r as TscContext } from "./context-Cc-Tkynb.mjs";
2
2
  import { SourceMapInput } from "rolldown";
3
3
  import { TsConfigJson } from "get-tsconfig";
4
4
  import ts from "typescript";
package/dist/index.mjs CHANGED
@@ -7,27 +7,15 @@ import { isIdentifierName } from "@babel/helper-validator-identifier";
7
7
  import { parse } from "@babel/parser";
8
8
  import * as t from "@babel/types";
9
9
  import { isDeclarationType, isIdentifierOf, isTypeOf, resolveString, walkAST } from "ast-kit";
10
- const {
11
- fork,
12
- spawn
13
- } = globalThis.process.getBuiltinModule("node:child_process");
14
- const {
15
- existsSync
16
- } = globalThis.process.getBuiltinModule("node:fs");
17
- const {
18
- mkdtemp,
19
- readFile,
20
- rm
21
- } = globalThis.process.getBuiltinModule("node:fs/promises");
10
+ const { fork, spawn } = globalThis.process.getBuiltinModule("node:child_process");
11
+ const { existsSync } = globalThis.process.getBuiltinModule("node:fs");
12
+ const { mkdtemp, readFile, rm } = globalThis.process.getBuiltinModule("node:fs/promises");
22
13
  const path = globalThis.process.getBuiltinModule("node:path");
23
14
  import { ResolverFactory, isolatedDeclarationSync } from "rolldown/experimental";
24
- const {
25
- tmpdir
26
- } = globalThis.process.getBuiltinModule("node:os");
15
+ const { tmpdir } = globalThis.process.getBuiltinModule("node:os");
27
16
  const process = globalThis.process;
28
17
  import { getTsconfig, parseTsconfig } from "get-tsconfig";
29
18
  import { createResolver } from "dts-resolver";
30
-
31
19
  //#region src/dts-input.ts
32
20
  function createDtsInputPlugin({ sideEffects }) {
33
21
  return {
@@ -61,7 +49,6 @@ function createDtsInputPlugin({ sideEffects }) {
61
49
  }
62
50
  };
63
51
  }
64
-
65
52
  //#endregion
66
53
  //#region src/fake-js.ts
67
54
  function createFakeJsPlugin({ sourcemap, cjsDefault, sideEffects }) {
@@ -487,7 +474,7 @@ function isReferenceId(node) {
487
474
  return isTypeOf(node, ["Identifier", "MemberExpression"]);
488
475
  }
489
476
  function isHelperImport(node) {
490
- return node.type === "ImportDeclaration" && node.specifiers.length === 1 && node.specifiers.every((spec) => spec.type === "ImportSpecifier" && spec.imported.type === "Identifier" && ["__exportAll", "__reExport"].includes(spec.local.name));
477
+ return node.type === "ImportDeclaration" && node.specifiers.every((spec) => spec.type === "ImportSpecifier" && spec.imported.type === "Identifier" && ["__exportAll", "__reExport"].includes(spec.local.name));
491
478
  }
492
479
  /**
493
480
  * patch `.d.ts` suffix in import source to `.js`
@@ -647,7 +634,6 @@ function inheritNodeComments(oldNode, newNode) {
647
634
  newNode.leadingComments = collectReferenceDirectives(newNode.leadingComments, true);
648
635
  return newNode;
649
636
  }
650
-
651
637
  //#endregion
652
638
  //#region src/tsgo.ts
653
639
  const debug$3 = createDebug("rolldown-plugin-dts:tsgo");
@@ -690,7 +676,6 @@ async function runTsgo(rootDir, tsconfig, sourcemap, tsgoPath) {
690
676
  await spawnAsync(tsgo, args, { stdio: "inherit" });
691
677
  return tsgoDist;
692
678
  }
693
-
694
679
  //#endregion
695
680
  //#region src/generate.ts
696
681
  const debug$2 = createDebug("rolldown-plugin-dts:generate");
@@ -929,7 +914,6 @@ function collectJsonExports(code) {
929
914
  else if (member.key.type === "StringLiteral") exports.push(member.key.value);
930
915
  return exports;
931
916
  }
932
-
933
917
  //#endregion
934
918
  //#region src/options.ts
935
919
  let warnedTsgo = false;
@@ -997,7 +981,6 @@ function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = f
997
981
  tsgo
998
982
  };
999
983
  }
1000
-
1001
984
  //#endregion
1002
985
  //#region src/resolver.ts
1003
986
  const debug$1 = createDebug("rolldown-plugin-dts:resolver");
@@ -1060,7 +1043,7 @@ function createDtsResolvePlugin({ cwd, tsconfig, tsconfigRaw, resolver, sideEffe
1060
1043
  async function resolveDtsPath(id, importer, rolldownResolution) {
1061
1044
  let dtsPath;
1062
1045
  if (resolver === "tsc") {
1063
- const { tscResolve } = await import("./resolver-j7HY1N36.mjs");
1046
+ const { tscResolve } = await import("./resolver-CdD-yT15.mjs");
1064
1047
  dtsPath = tscResolve(id, importer, cwd, tsconfig, tsconfigRaw);
1065
1048
  } else dtsPath = baseDtsResolver(id, importer);
1066
1049
  debug$1("Using %s for dts import: %O -> %O", resolver, id, dtsPath);
@@ -1075,7 +1058,6 @@ function createDtsResolvePlugin({ cwd, tsconfig, tsconfigRaw, resolver, sideEffe
1075
1058
  function isFilePath(id) {
1076
1059
  return id.startsWith(".") || path.isAbsolute(id);
1077
1060
  }
1078
-
1079
1061
  //#endregion
1080
1062
  //#region src/index.ts
1081
1063
  const debug = createDebug("rolldown-plugin-dts:options");
@@ -1089,6 +1071,5 @@ function dts(options = {}) {
1089
1071
  plugins.push(createDtsResolvePlugin(resolved), createFakeJsPlugin(resolved));
1090
1072
  return plugins;
1091
1073
  }
1092
-
1093
1074
  //#endregion
1094
- export { createFakeJsPlugin, createGeneratePlugin, dts, resolveOptions };
1075
+ export { createFakeJsPlugin, createGeneratePlugin, dts, resolveOptions };
@@ -2,7 +2,6 @@ const __cjs_require = globalThis.process.getBuiltinModule("module").createRequir
2
2
  import { createDebug } from "obug";
3
3
  const path = globalThis.process.getBuiltinModule("node:path");
4
4
  const ts = __cjs_require("typescript");
5
-
6
5
  //#region src/tsc/resolver.ts
7
6
  const debug = createDebug("rolldown-plugin-dts:tsc-resolver");
8
7
  function tscResolve(id, importer, cwd, tsconfig, tsconfigRaw, reference) {
@@ -15,6 +14,5 @@ function tscResolve(id, importer, cwd, tsconfig, tsconfigRaw, reference) {
15
14
  debug(`tsc resolving id "%s" from "%s" -> %O`, id, importer, resolved.resolvedModule);
16
15
  return resolved.resolvedModule?.resolvedFileName;
17
16
  }
18
-
19
17
  //#endregion
20
- export { tscResolve };
18
+ export { tscResolve };
@@ -1,19 +1,13 @@
1
1
  const __cjs_require = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
2
2
  import { RE_DTS, RE_DTS_MAP } from "./filename.mjs";
3
3
  import { globalContext } from "./tsc-context.mjs";
4
- const {
5
- createRequire
6
- } = globalThis.process.getBuiltinModule("node:module");
4
+ const { createRequire } = globalThis.process.getBuiltinModule("node:module");
7
5
  import { createDebug } from "obug";
8
6
  const path = globalThis.process.getBuiltinModule("node:path");
9
7
  const ts = __cjs_require("typescript");
10
- const {
11
- pathToFileURL
12
- } = globalThis.process.getBuiltinModule("node:url");
13
-
8
+ const { pathToFileURL } = globalThis.process.getBuiltinModule("node:url");
14
9
  //#region \0rolldown/runtime.js
15
10
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
16
-
17
11
  //#endregion
18
12
  //#region src/tsc/system.ts
19
13
  const debug$4 = createDebug("rolldown-plugin-dts:tsc-system");
@@ -64,7 +58,6 @@ function createMemorySystem(files) {
64
58
  }
65
59
  };
66
60
  }
67
-
68
61
  //#endregion
69
62
  //#region src/tsc/utils.ts
70
63
  const formatHost = {
@@ -87,7 +80,6 @@ function setSourceMapRoot(map, originalFilePath, finalFilePath) {
87
80
  const finalDir = path.posix.dirname(pathToFileURL(finalFilePath).pathname);
88
81
  if (originalDir !== finalDir) map.sourceRoot = path.posix.relative(finalDir, originalDir);
89
82
  }
90
-
91
83
  //#endregion
92
84
  //#region src/tsc/emit-build.ts
93
85
  const debug$3 = createDebug("rolldown-plugin-dts:tsc-build");
@@ -241,7 +233,6 @@ function patchCompilerOptions(options, extraOptions) {
241
233
  const createProgramWithPatchedCompilerOptions = (rootNames, options, ...args) => {
242
234
  return ts.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, patchCompilerOptions(options ?? {}, null), ...args);
243
235
  };
244
-
245
236
  //#endregion
246
237
  //#region src/tsc/volar.ts
247
238
  const debug$2 = createDebug("rolldown-plugin-dts:volar");
@@ -255,7 +246,7 @@ function loadVueLanguageTools() {
255
246
  };
256
247
  } catch (error) {
257
248
  debug$2("vue language tools not found", error);
258
- throw new Error("Failed to load vue language tools. Please manually install vue-tsc.");
249
+ throw new Error("Failed to load vue language tools. Please manually install vue-tsc.", { cause: error });
259
250
  }
260
251
  }
261
252
  function initVueLanguageTools() {
@@ -291,7 +282,7 @@ function initTsMacro() {
291
282
  };
292
283
  } catch (error) {
293
284
  debug("ts-macro language tools not found", error);
294
- throw new Error("Failed to load ts-macro language tools. Please manually install @ts-macro/tsc.");
285
+ throw new Error("Failed to load ts-macro language tools. Please manually install @ts-macro/tsc.", { cause: error });
295
286
  }
296
287
  }
297
288
  function createProgramFactory(ts, options) {
@@ -306,7 +297,6 @@ function createProgramFactory(ts, options) {
306
297
  return { languagePlugins };
307
298
  });
308
299
  }
309
-
310
300
  //#endregion
311
301
  //#region src/tsc/emit-compiler.ts
312
302
  const debug$1 = createDebug("rolldown-plugin-dts:tsc-compiler");
@@ -425,7 +415,6 @@ function tscEmitCompiler(tscOptions) {
425
415
  map
426
416
  };
427
417
  }
428
-
429
418
  //#endregion
430
419
  //#region src/tsc/index.ts
431
420
  const debug = createDebug("rolldown-plugin-dts:tsc");
@@ -435,6 +424,5 @@ function tscEmit(tscOptions) {
435
424
  if (tscOptions.build) return tscEmitBuild(tscOptions);
436
425
  else return tscEmitCompiler(tscOptions);
437
426
  }
438
-
439
427
  //#endregion
440
- export { tscEmit as t };
428
+ export { tscEmit as t };
@@ -1,2 +1,2 @@
1
- import { a as globalContext, i as createContext, n as SourceFileToProjectMap, o as invalidateContextFile, r as TscContext, t as ParsedProject } from "./context-BbNuMjMl.mjs";
1
+ import { a as globalContext, i as createContext, n as SourceFileToProjectMap, o as invalidateContextFile, r as TscContext, t as ParsedProject } from "./context-Cc-Tkynb.mjs";
2
2
  export { ParsedProject, SourceFileToProjectMap, TscContext, createContext, globalContext, invalidateContextFile };
@@ -1,6 +1,5 @@
1
1
  import { createDebug } from "obug";
2
2
  const path = globalThis.process.getBuiltinModule("node:path");
3
-
4
3
  //#region src/tsc/context.ts
5
4
  const debug = createDebug("rolldown-plugin-dts:tsc-context");
6
5
  function createContext() {
@@ -20,6 +19,5 @@ function invalidateContextFile(context, file) {
20
19
  context.projects.clear();
21
20
  }
22
21
  const globalContext = createContext();
23
-
24
22
  //#endregion
25
- export { createContext, globalContext, invalidateContextFile };
23
+ export { createContext, globalContext, invalidateContextFile };
@@ -1,4 +1,4 @@
1
- import { t as tscEmit } from "./index-CJd0fw6p.mjs";
1
+ import { t as tscEmit } from "./index-lpAqB_wE.mjs";
2
2
 
3
3
  //#region src/tsc/worker.d.ts
4
4
  declare const functions: {
@@ -1,12 +1,10 @@
1
- import { t as tscEmit } from "./tsc-GyRYMxqk.mjs";
1
+ import { t as tscEmit } from "./tsc-Bq8zpODY.mjs";
2
2
  const process = globalThis.process;
3
3
  import { createBirpc } from "birpc";
4
-
5
4
  //#region src/tsc/worker.ts
6
5
  createBirpc({ tscEmit }, {
7
6
  post: (data) => process.send(data),
8
7
  on: (fn) => process.on("message", fn)
9
8
  });
10
-
11
9
  //#endregion
12
- export { };
10
+ export {};
package/dist/tsc.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as TscResult, n as TscModule, r as TscOptions, t as tscEmit } from "./index-CJd0fw6p.mjs";
1
+ import { i as TscResult, n as TscModule, r as TscOptions, t as tscEmit } from "./index-lpAqB_wE.mjs";
2
2
  export { TscModule, TscOptions, TscResult, tscEmit };
package/dist/tsc.mjs CHANGED
@@ -1,3 +1,2 @@
1
- import { t as tscEmit } from "./tsc-GyRYMxqk.mjs";
2
-
3
- export { tscEmit };
1
+ import { t as tscEmit } from "./tsc-Bq8zpODY.mjs";
2
+ export { tscEmit };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rolldown-plugin-dts",
3
3
  "type": "module",
4
- "version": "0.22.2",
4
+ "version": "0.22.4",
5
5
  "description": "A Rolldown plugin to generate and bundle dts files.",
6
6
  "author": "Kevin Deng <sxzz@sxzz.moe>",
7
7
  "license": "MIT",
@@ -62,10 +62,10 @@
62
62
  }
63
63
  },
64
64
  "dependencies": {
65
- "@babel/generator": "8.0.0-rc.1",
66
- "@babel/helper-validator-identifier": "8.0.0-rc.1",
67
- "@babel/parser": "8.0.0-rc.1",
68
- "@babel/types": "8.0.0-rc.1",
65
+ "@babel/generator": "8.0.0-rc.2",
66
+ "@babel/helper-validator-identifier": "8.0.0-rc.2",
67
+ "@babel/parser": "8.0.0-rc.2",
68
+ "@babel/types": "8.0.0-rc.2",
69
69
  "ast-kit": "^3.0.0-beta.1",
70
70
  "birpc": "^4.0.0",
71
71
  "dts-resolver": "^2.1.3",
@@ -74,32 +74,32 @@
74
74
  },
75
75
  "devDependencies": {
76
76
  "@jridgewell/source-map": "^0.3.11",
77
- "@sxzz/eslint-config": "^7.8.1",
77
+ "@sxzz/eslint-config": "^7.8.3",
78
78
  "@sxzz/prettier-config": "^2.3.1",
79
79
  "@sxzz/test-utils": "^0.5.15",
80
- "@types/node": "^25.3.1",
81
- "@typescript/native-preview": "7.0.0-dev.20260226.1",
80
+ "@types/node": "^25.3.3",
81
+ "@typescript/native-preview": "7.0.0-dev.20260305.1",
82
82
  "@volar/typescript": "^2.4.28",
83
83
  "@vue/language-core": "^3.2.5",
84
- "arktype": "^2.1.29",
84
+ "arktype": "^2.2.0",
85
85
  "bumpp": "^10.4.1",
86
86
  "diff": "^8.0.3",
87
87
  "eslint": "^10.0.2",
88
88
  "prettier": "^3.8.1",
89
- "rolldown": "^1.0.0-rc.5",
90
- "rolldown-plugin-dts-snapshot": "^0.3.2",
89
+ "rolldown": "^1.0.0-rc.7",
90
+ "rolldown-plugin-dts-snapshot": "^0.4.0",
91
91
  "rolldown-plugin-require-cjs": "^0.3.3",
92
92
  "rollup-plugin-dts": "^6.3.0",
93
93
  "tinyglobby": "^0.2.15",
94
- "tsdown": "^0.21.0-beta.1",
95
- "typescript": "6.0.0-beta",
94
+ "tsdown": "^0.21.0-beta.2",
95
+ "typescript": "6.0.0-dev.20260301",
96
96
  "vitest": "^4.0.18",
97
97
  "vue": "^3.5.29",
98
98
  "vue-tsc": "^3.2.5",
99
99
  "zod": "^4.3.6"
100
100
  },
101
101
  "resolutions": {
102
- "rolldown": "^1.0.0-rc.5"
102
+ "rolldown": "^1.0.0-rc.7"
103
103
  },
104
104
  "prettier": "@sxzz/prettier-config",
105
105
  "scripts": {