rolldown-plugin-dts 0.16.8 → 0.16.9

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.
@@ -1,11 +1,9 @@
1
- import { createRequire } from "node:module";
1
+ const __cjs_require = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
2
+ const Debug = __cjs_require("debug");
3
+ const path = globalThis.process.getBuiltinModule("node:path");
2
4
 
3
- //#region rolldown:runtime
4
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
-
6
- //#endregion
7
5
  //#region src/tsc/context.ts
8
- const debug = __require("debug")("rolldown-plugin-dts:tsc-context");
6
+ const debug = Debug("rolldown-plugin-dts:tsc-context");
9
7
  function createContext() {
10
8
  return {
11
9
  programs: [],
@@ -14,6 +12,7 @@ function createContext() {
14
12
  };
15
13
  }
16
14
  function invalidateContextFile(context, file) {
15
+ file = path.resolve(file).replaceAll("\\", "/");
17
16
  debug(`invalidating context file: ${file}`);
18
17
  context.files.delete(file);
19
18
  context.programs = context.programs.filter((program) => {
@@ -24,4 +23,4 @@ function invalidateContextFile(context, file) {
24
23
  const globalContext = createContext();
25
24
 
26
25
  //#endregion
27
- export { __require, createContext, globalContext, invalidateContextFile };
26
+ export { createContext, globalContext, invalidateContextFile };
package/dist/index.js CHANGED
@@ -1,14 +1,34 @@
1
- import { __require, createContext, globalContext, invalidateContextFile } from "./context-CzXq1eN7.js";
1
+ const __cjs_require = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
2
2
  import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn } from "./filename-DCSs6tgU.js";
3
+ import { createContext, globalContext, invalidateContextFile } from "./context-BGY_fVH1.js";
4
+ const Debug = __cjs_require("debug");
3
5
  import MagicString from "magic-string";
6
+ const {
7
+ generate
8
+ } = __cjs_require("@babel/generator");
9
+ const {
10
+ parse
11
+ } = __cjs_require("@babel/parser");
12
+ const t = __cjs_require("@babel/types");
4
13
  import { isDeclarationType, isTypeOf, resolveString } from "ast-kit";
5
- import { fork, spawn } from "node:child_process";
6
- import { existsSync } from "node:fs";
7
- import { mkdtemp, readFile, rm } from "node:fs/promises";
8
- import { tmpdir } from "node:os";
9
- import path from "node:path";
14
+ const {
15
+ fork,
16
+ spawn
17
+ } = globalThis.process.getBuiltinModule("node:child_process");
18
+ const {
19
+ existsSync
20
+ } = globalThis.process.getBuiltinModule("node:fs");
21
+ const {
22
+ mkdtemp,
23
+ readFile,
24
+ rm
25
+ } = globalThis.process.getBuiltinModule("node:fs/promises");
26
+ const {
27
+ tmpdir
28
+ } = globalThis.process.getBuiltinModule("node:os");
29
+ const path = globalThis.process.getBuiltinModule("node:path");
10
30
  import { ResolverFactory, isolatedDeclaration } from "rolldown/experimental";
11
- import process from "node:process";
31
+ const process = globalThis.process;
12
32
  import { getTsconfig, parseTsconfig } from "get-tsconfig";
13
33
  import { createResolver } from "dts-resolver";
14
34
 
@@ -48,10 +68,10 @@ function createDtsInputPlugin() {
48
68
  name: "rolldown-plugin-dts:dts-input",
49
69
  options(options) {
50
70
  return {
51
- treeshake: options.treeshake !== false ? {
71
+ treeshake: options.treeshake === false ? false : {
52
72
  ...options.treeshake === true ? {} : options.treeshake,
53
73
  moduleSideEffects: false
54
- } : false,
74
+ },
55
75
  ...options
56
76
  };
57
77
  },
@@ -264,9 +284,6 @@ function walk(ast, { enter, leave }) {
264
284
 
265
285
  //#endregion
266
286
  //#region src/fake-js.ts
267
- const { generate } = __require("@babel/generator");
268
- const { parse } = __require("@babel/parser");
269
- const t = __require("@babel/types");
270
287
  function createFakeJsPlugin({ sourcemap, cjsDefault }) {
271
288
  let symbolIdx = 0;
272
289
  const identifierMap = Object.create(null);
@@ -489,16 +506,22 @@ function createFakeJsPlugin({ sourcemap, cjsDefault }) {
489
506
  ])) {
490
507
  if (node$1.computed && isReferenceId(node$1.key)) addDependency(node$1.key);
491
508
  if ("value" in node$1 && isReferenceId(node$1.value)) addDependency(node$1.value);
492
- } else if (node$1.type === "TSTypeReference") addDependency(TSEntityNameToRuntime(node$1.typeName));
493
- else if (node$1.type === "TSTypeQuery") {
494
- if (seen.has(node$1.exprName)) return;
495
- if (node$1.exprName.type !== "TSImportType") addDependency(TSEntityNameToRuntime(node$1.exprName));
496
- } else if (node$1.type === "TSImportType") {
497
- seen.add(node$1);
498
- const source = node$1.argument;
499
- const imported = node$1.qualifier;
500
- const dep = importNamespace(node$1, imported, source, namespaceStmts);
501
- addDependency(dep);
509
+ } else switch (node$1.type) {
510
+ case "TSTypeReference":
511
+ addDependency(TSEntityNameToRuntime(node$1.typeName));
512
+ break;
513
+ case "TSTypeQuery":
514
+ if (seen.has(node$1.exprName)) return;
515
+ if (node$1.exprName.type !== "TSImportType") addDependency(TSEntityNameToRuntime(node$1.exprName));
516
+ break;
517
+ case "TSImportType": {
518
+ seen.add(node$1);
519
+ const source = node$1.argument;
520
+ const imported = node$1.qualifier;
521
+ const dep = importNamespace(node$1, imported, source, namespaceStmts);
522
+ addDependency(dep);
523
+ break;
524
+ }
502
525
  }
503
526
  } });
504
527
  return Array.from(deps);
@@ -692,8 +715,7 @@ function inheritNodeComments(oldNode, newNode) {
692
715
 
693
716
  //#endregion
694
717
  //#region src/generate.ts
695
- const Debug$1 = __require("debug");
696
- const debug$1 = Debug$1("rolldown-plugin-dts:generate");
718
+ const debug$1 = Debug("rolldown-plugin-dts:generate");
697
719
  const WORKER_URL = "./tsc-worker.js";
698
720
  const spawnAsync = (...args) => new Promise((resolve, reject) => {
699
721
  const child = spawn(...args);
@@ -873,7 +895,7 @@ function createGeneratePlugin({ tsconfig, tsconfigRaw, build, incremental, cwd,
873
895
  }
874
896
  async function runTsgo(root, tsconfig) {
875
897
  const tsgoPkg = import.meta.resolve("@typescript/native-preview/package.json");
876
- const { default: getExePath } = await import(new URL("./lib/getExePath.js", tsgoPkg).href);
898
+ const { default: getExePath } = await import(new URL("lib/getExePath.js", tsgoPkg).href);
877
899
  const tsgo = getExePath();
878
900
  const tsgoDist = await mkdtemp(path.join(tmpdir(), "rolldown-plugin-dts-"));
879
901
  debug$1("[tsgo] tsgoDist", tsgoDist);
@@ -1014,7 +1036,6 @@ function isFilePath(id) {
1014
1036
 
1015
1037
  //#endregion
1016
1038
  //#region src/index.ts
1017
- const Debug = __require("debug");
1018
1039
  const debug = Debug("rolldown-plugin-dts:options");
1019
1040
  function dts(options = {}) {
1020
1041
  debug("resolving dts options");
@@ -1,44 +1,54 @@
1
- import { __require, globalContext } from "./context-CzXq1eN7.js";
2
- import path from "node:path";
3
- import { pathToFileURL } from "node:url";
1
+ const __cjs_require = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
2
+ import { globalContext } from "./context-BGY_fVH1.js";
3
+ const {
4
+ createRequire
5
+ } = globalThis.process.getBuiltinModule("node:module");
6
+ const Debug = __cjs_require("debug");
7
+ const path = globalThis.process.getBuiltinModule("node:path");
8
+ const ts = __cjs_require("typescript");
9
+ const {
10
+ pathToFileURL
11
+ } = globalThis.process.getBuiltinModule("node:url");
4
12
 
13
+ //#region rolldown:runtime
14
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
15
+
16
+ //#endregion
5
17
  //#region src/tsc/system.ts
6
- const Debug$4 = __require("debug");
7
- const ts$4 = __require("typescript");
8
- const debug$3 = Debug$4("rolldown-plugin-dts:tsc-system");
18
+ const debug$3 = Debug("rolldown-plugin-dts:tsc-system");
9
19
  /**
10
20
  * A system that writes files to both memory and disk. It will try read files
11
21
  * from memory firstly and fallback to disk if not found.
12
22
  */
13
23
  function createFsSystem(files) {
14
24
  return {
15
- ...ts$4.sys,
25
+ ...ts.sys,
16
26
  write(message) {
17
27
  debug$3(message);
18
28
  },
19
29
  resolvePath(path$1) {
20
30
  if (files.has(path$1)) return path$1;
21
- return ts$4.sys.resolvePath(path$1);
31
+ return ts.sys.resolvePath(path$1);
22
32
  },
23
33
  directoryExists(directory) {
24
34
  if (Array.from(files.keys()).some((path$1) => path$1.startsWith(directory))) return true;
25
- return ts$4.sys.directoryExists(directory);
35
+ return ts.sys.directoryExists(directory);
26
36
  },
27
37
  fileExists(fileName) {
28
38
  if (files.has(fileName)) return true;
29
- return ts$4.sys.fileExists(fileName);
39
+ return ts.sys.fileExists(fileName);
30
40
  },
31
41
  readFile(fileName, ...args) {
32
42
  if (files.has(fileName)) return files.get(fileName);
33
- return ts$4.sys.readFile(fileName, ...args);
43
+ return ts.sys.readFile(fileName, ...args);
34
44
  },
35
45
  writeFile(path$1, data, ...args) {
36
46
  files.set(path$1, data);
37
- ts$4.sys.writeFile(path$1, data, ...args);
47
+ ts.sys.writeFile(path$1, data, ...args);
38
48
  },
39
49
  deleteFile(fileName, ...args) {
40
50
  files.delete(fileName);
41
- ts$4.sys.deleteFile?.(fileName, ...args);
51
+ ts.sys.deleteFile?.(fileName, ...args);
42
52
  }
43
53
  };
44
54
  }
@@ -56,18 +66,17 @@ function createMemorySystem(files) {
56
66
 
57
67
  //#endregion
58
68
  //#region src/tsc/utils.ts
59
- const ts$3 = __require("typescript");
60
69
  const formatHost = {
61
- getCurrentDirectory: () => ts$3.sys.getCurrentDirectory(),
62
- getNewLine: () => ts$3.sys.newLine,
63
- getCanonicalFileName: ts$3.sys.useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase()
70
+ getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
71
+ getNewLine: () => ts.sys.newLine,
72
+ getCanonicalFileName: ts.sys.useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase()
64
73
  };
65
74
  const stripPrivateFields = (ctx) => {
66
75
  const visitor = (node) => {
67
- if (ts$3.isPropertySignature(node) && ts$3.isPrivateIdentifier(node.name)) return ctx.factory.updatePropertySignature(node, node.modifiers, ctx.factory.createStringLiteral(node.name.text), node.questionToken, node.type);
68
- return ts$3.visitEachChild(node, visitor, ctx);
76
+ if (ts.isPropertySignature(node) && ts.isPrivateIdentifier(node.name)) return ctx.factory.updatePropertySignature(node, node.modifiers, ctx.factory.createStringLiteral(node.name.text), node.questionToken, node.type);
77
+ return ts.visitEachChild(node, visitor, ctx);
69
78
  };
70
- return (sourceFile) => ts$3.visitNode(sourceFile, visitor, ts$3.isSourceFile) ?? sourceFile;
79
+ return (sourceFile) => ts.visitNode(sourceFile, visitor, ts.isSourceFile) ?? sourceFile;
71
80
  };
72
81
  const customTransformers = { afterDeclarations: [stripPrivateFields] };
73
82
  function setSourceMapRoot(map, originalFilePath, finalFilePath) {
@@ -80,9 +89,7 @@ function setSourceMapRoot(map, originalFilePath, finalFilePath) {
80
89
 
81
90
  //#endregion
82
91
  //#region src/tsc/emit-build.ts
83
- const Debug$3 = __require("debug");
84
- const ts$2 = __require("typescript");
85
- const debug$2 = Debug$3("rolldown-plugin-dts:tsc-build");
92
+ const debug$2 = Debug("rolldown-plugin-dts:tsc-build");
86
93
  function tscEmitBuild(tscOptions) {
87
94
  const { id, tsconfig, incremental, context = globalContext, sourcemap } = tscOptions;
88
95
  debug$2(`running tscEmitBuild id: ${id}, tsconfig: ${tsconfig}, incremental: ${incremental}`);
@@ -97,7 +104,7 @@ function tscEmitBuild(tscOptions) {
97
104
  }
98
105
  debug$2(`loaded project ${project.tsconfigPath} for ${id}`);
99
106
  const ignoreCase = !fsSystem.useCaseSensitiveFileNames;
100
- const outputFiles = ts$2.getOutputFileNames(project.parsedConfig, resolvedId, ignoreCase);
107
+ const outputFiles = ts.getOutputFileNames(project.parsedConfig, resolvedId, ignoreCase);
101
108
  let code;
102
109
  let map;
103
110
  for (const outputFile of outputFiles) {
@@ -152,8 +159,8 @@ function buildProjects(fsSystem, tsconfig, force, sourcemap) {
152
159
  debug$2(`start building projects for ${tsconfig}`);
153
160
  const projects = collectProjectGraph(tsconfig, fsSystem, force, sourcemap);
154
161
  debug$2("collected %d projects: %j", projects.length, projects.map((project) => project.tsconfigPath));
155
- const host = ts$2.createSolutionBuilderHost(fsSystem, createProgramWithPatchedCompilerOptions);
156
- const exitStatus = ts$2.createSolutionBuilder(host, [tsconfig], {
162
+ const host = ts.createSolutionBuilderHost(fsSystem, createProgramWithPatchedCompilerOptions);
163
+ const exitStatus = ts.createSolutionBuilder(host, [tsconfig], {
157
164
  force,
158
165
  verbose: true
159
166
  }).build(void 0, void 0, void 0, (project) => {
@@ -188,19 +195,19 @@ function collectProjectGraph(rootTsconfigPath, fsSystem, force, sourcemap) {
188
195
  tsconfigPath,
189
196
  parsedConfig
190
197
  });
191
- for (const ref of parsedConfig.projectReferences ?? []) stack.push(ts$2.resolveProjectReferencePath(ref));
198
+ for (const ref of parsedConfig.projectReferences ?? []) stack.push(ts.resolveProjectReferencePath(ref));
192
199
  }
193
200
  return projects;
194
201
  }
195
202
  function parseTsconfig(tsconfigPath, fsSystem) {
196
203
  const diagnostics = [];
197
- const parsedConfig = ts$2.getParsedCommandLineOfConfigFile(tsconfigPath, void 0, {
204
+ const parsedConfig = ts.getParsedCommandLineOfConfigFile(tsconfigPath, void 0, {
198
205
  ...fsSystem,
199
206
  onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
200
207
  diagnostics.push(diagnostic);
201
208
  }
202
209
  });
203
- if (diagnostics.length) throw new Error(`[rolldown-plugin-dts] Unable to read ${tsconfigPath}: ${ts$2.formatDiagnostics(diagnostics, formatHost)}`);
210
+ if (diagnostics.length) throw new Error(`[rolldown-plugin-dts] Unable to read ${tsconfigPath}: ${ts.formatDiagnostics(diagnostics, formatHost)}`);
204
211
  return parsedConfig;
205
212
  }
206
213
  function patchCompilerOptions(options, extraOptions) {
@@ -232,27 +239,26 @@ function patchCompilerOptions(options, extraOptions) {
232
239
  return options;
233
240
  }
234
241
  const createProgramWithPatchedCompilerOptions = (rootNames, options, ...args) => {
235
- return ts$2.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, patchCompilerOptions(options ?? {}, null), ...args);
242
+ return ts.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, patchCompilerOptions(options ?? {}, null), ...args);
236
243
  };
237
244
 
238
245
  //#endregion
239
246
  //#region src/tsc/volar.ts
240
- const Debug$2 = __require("debug");
241
247
  function loadVueLanguageTools() {
242
- const debug$4 = Debug$2("rolldown-plugin-dts:vue");
248
+ const debug$4 = Debug("rolldown-plugin-dts:vue");
243
249
  debug$4("loading vue language tools");
244
250
  try {
245
251
  const vueTscPath = __require.resolve("vue-tsc");
246
252
  const { proxyCreateProgram } = __require(__require.resolve("@volar/typescript", { paths: [vueTscPath] }));
247
253
  const vue = __require(__require.resolve("@vue/language-core", { paths: [vueTscPath] }));
248
- const getLanguagePlugin = (ts$5, options) => {
254
+ const getLanguagePlugin = (ts$1, options) => {
249
255
  const $rootDir = options.options.$rootDir;
250
256
  const $configRaw = options.options.$configRaw;
251
- const resolver = new vue.CompilerOptionsResolver(ts$5.sys.fileExists);
257
+ const resolver = new vue.CompilerOptionsResolver(ts$1.sys.fileExists);
252
258
  resolver.addConfig($configRaw?.vueCompilerOptions ?? {}, $rootDir);
253
259
  const vueOptions = resolver.build();
254
- vue.writeGlobalTypes(vueOptions, ts$5.sys.writeFile);
255
- return vue.createVueLanguagePlugin(ts$5, options.options, vueOptions, (id) => id);
260
+ vue.writeGlobalTypes(vueOptions, ts$1.sys.writeFile);
261
+ return vue.createVueLanguagePlugin(ts$1, options.options, vueOptions, (id) => id);
256
262
  };
257
263
  return {
258
264
  proxyCreateProgram,
@@ -264,16 +270,16 @@ function loadVueLanguageTools() {
264
270
  }
265
271
  }
266
272
  function loadTsMacro() {
267
- const debug$4 = Debug$2("rolldown-plugin-dts:ts-macro");
273
+ const debug$4 = Debug("rolldown-plugin-dts:ts-macro");
268
274
  debug$4("loading ts-macro language tools");
269
275
  try {
270
276
  const tsMacroPath = __require.resolve("@ts-macro/tsc");
271
277
  const { proxyCreateProgram } = __require(__require.resolve("@volar/typescript", { paths: [tsMacroPath] }));
272
278
  const tsMacro = __require(__require.resolve("@ts-macro/language-plugin", { paths: [tsMacroPath] }));
273
279
  const { getOptions } = __require(__require.resolve("@ts-macro/language-plugin/options", { paths: [tsMacroPath] }));
274
- const getLanguagePlugin = (ts$5, options) => {
280
+ const getLanguagePlugin = (ts$1, options) => {
275
281
  const $rootDir = options.options.$rootDir;
276
- return tsMacro.getLanguagePlugins(ts$5, options.options, getOptions(ts$5, $rootDir))[0];
282
+ return tsMacro.getLanguagePlugins(ts$1, options.options, getOptions(ts$1, $rootDir))[0];
277
283
  };
278
284
  return {
279
285
  proxyCreateProgram,
@@ -284,24 +290,22 @@ function loadTsMacro() {
284
290
  throw new Error("Failed to load ts-macro language tools. Please manually install @ts-macro/tsc.");
285
291
  }
286
292
  }
287
- function createProgramFactory(ts$5, options) {
293
+ function createProgramFactory(ts$1, options) {
288
294
  const vueLanguageTools = options.vue ? loadVueLanguageTools() : void 0;
289
295
  const tsMacroLanguageTools = options.tsMacro ? loadTsMacro() : void 0;
290
296
  const proxyCreateProgram = vueLanguageTools?.proxyCreateProgram || tsMacroLanguageTools?.proxyCreateProgram;
291
- if (!proxyCreateProgram) return ts$5.createProgram;
292
- return proxyCreateProgram(ts$5, ts$5.createProgram, (ts$6, options$1) => {
297
+ if (!proxyCreateProgram) return ts$1.createProgram;
298
+ return proxyCreateProgram(ts$1, ts$1.createProgram, (ts$2, options$1) => {
293
299
  const languagePlugins = [];
294
- if (vueLanguageTools) languagePlugins.push(vueLanguageTools.getLanguagePlugin(ts$6, options$1));
295
- if (tsMacroLanguageTools) languagePlugins.push(tsMacroLanguageTools.getLanguagePlugin(ts$6, options$1));
300
+ if (vueLanguageTools) languagePlugins.push(vueLanguageTools.getLanguagePlugin(ts$2, options$1));
301
+ if (tsMacroLanguageTools) languagePlugins.push(tsMacroLanguageTools.getLanguagePlugin(ts$2, options$1));
296
302
  return { languagePlugins };
297
303
  });
298
304
  }
299
305
 
300
306
  //#endregion
301
307
  //#region src/tsc/emit-compiler.ts
302
- const Debug$1 = __require("debug");
303
- const ts$1 = __require("typescript");
304
- const debug$1 = Debug$1("rolldown-plugin-dts:tsc-compiler");
308
+ const debug$1 = Debug("rolldown-plugin-dts:tsc-compiler");
305
309
  const defaultCompilerOptions = {
306
310
  declaration: true,
307
311
  noEmit: false,
@@ -312,7 +316,7 @@ const defaultCompilerOptions = {
312
316
  skipLibCheck: true,
313
317
  target: 99,
314
318
  resolveJsonModule: true,
315
- moduleResolution: ts$1.ModuleResolutionKind.Bundler
319
+ moduleResolution: ts.ModuleResolutionKind.Bundler
316
320
  };
317
321
  function createOrGetTsModule(options) {
318
322
  const { id, entries, context = globalContext } = options;
@@ -337,7 +341,7 @@ function createOrGetTsModule(options) {
337
341
  function createTsProgram({ entries, id, tsconfig, tsconfigRaw, vue, tsMacro, cwd, context = globalContext }) {
338
342
  const fsSystem = createFsSystem(context.files);
339
343
  const baseDir = tsconfig ? path.dirname(tsconfig) : cwd;
340
- const parsedConfig = ts$1.parseJsonConfigFileContent(tsconfigRaw, fsSystem, baseDir);
344
+ const parsedConfig = ts.parseJsonConfigFileContent(tsconfigRaw, fsSystem, baseDir);
341
345
  debug$1(`Creating program for root project: ${baseDir}`);
342
346
  return createTsProgramFromParsedConfig({
343
347
  parsedConfig,
@@ -357,8 +361,8 @@ function createTsProgramFromParsedConfig({ parsedConfig, fsSystem, baseDir, id,
357
361
  $rootDir: baseDir
358
362
  };
359
363
  const rootNames = [...new Set([id, ...entries || parsedConfig.fileNames].map((f) => fsSystem.resolvePath(f)))];
360
- const host = ts$1.createCompilerHost(compilerOptions, true);
361
- const program = createProgramFactory(ts$1, {
364
+ const host = ts.createCompilerHost(compilerOptions, true);
365
+ const program = createProgramFactory(ts, {
362
366
  vue,
363
367
  tsMacro
364
368
  })({
@@ -371,12 +375,12 @@ function createTsProgramFromParsedConfig({ parsedConfig, fsSystem, baseDir, id,
371
375
  if (!sourceFile) {
372
376
  debug$1(`source file not found in program: ${id}`);
373
377
  if (!!parsedConfig.projectReferences?.length) throw new Error(`[rolldown-plugin-dts] Unable to load ${id}; You have "references" in your tsconfig file. Perhaps you want to add \`dts: { build: true }\` in your config?`);
374
- if (!fsSystem.fileExists(id)) {
375
- debug$1(`File ${id} does not exist on disk.`);
376
- throw new Error(`Source file not found: ${id}`);
377
- } else {
378
+ if (fsSystem.fileExists(id)) {
378
379
  debug$1(`File ${id} exists on disk.`);
379
380
  throw new Error(`Unable to load file ${id} from the program. This seems like a bug of rolldown-plugin-dts. Please report this issue to https://github.com/sxzz/rolldown-plugin-dts/issues`);
381
+ } else {
382
+ debug$1(`File ${id} does not exist on disk.`);
383
+ throw new Error(`Source file not found: ${id}`);
380
384
  }
381
385
  }
382
386
  return {
@@ -400,7 +404,7 @@ function tscEmitCompiler(tscOptions) {
400
404
  dtsCode = code;
401
405
  }
402
406
  }, void 0, true, customTransformers, true);
403
- if (emitSkipped && diagnostics.length) return { error: ts$1.formatDiagnostics(diagnostics, formatHost) };
407
+ if (emitSkipped && diagnostics.length) return { error: ts.formatDiagnostics(diagnostics, formatHost) };
404
408
  if (!dtsCode && file.isDeclarationFile) {
405
409
  debug$1("nothing was emitted. fallback to sourceFile text.");
406
410
  dtsCode = file.getFullText();
@@ -413,8 +417,6 @@ function tscEmitCompiler(tscOptions) {
413
417
 
414
418
  //#endregion
415
419
  //#region src/tsc/index.ts
416
- const Debug = __require("debug");
417
- const ts = __require("typescript");
418
420
  const debug = Debug("rolldown-plugin-dts:tsc");
419
421
  debug(`loaded typescript: ${ts.version}`);
420
422
  function tscEmit(tscOptions) {
@@ -1,3 +1,3 @@
1
- import { createContext, globalContext, invalidateContextFile } from "./context-CzXq1eN7.js";
1
+ import { createContext, globalContext, invalidateContextFile } from "./context-BGY_fVH1.js";
2
2
 
3
3
  export { createContext, globalContext, invalidateContextFile };
@@ -1,6 +1,6 @@
1
- import "./context-CzXq1eN7.js";
2
- import { tscEmit } from "./tsc-ExCTFf5T.js";
3
- import process from "node:process";
1
+ import { tscEmit } from "./tsc-BsZXDoCU.js";
2
+ import "./context-BGY_fVH1.js";
3
+ const process = globalThis.process;
4
4
  import { createBirpc } from "birpc";
5
5
 
6
6
  //#region src/tsc/worker.ts
package/dist/tsc.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./context-CzXq1eN7.js";
2
- import { tscEmit } from "./tsc-ExCTFf5T.js";
1
+ import { tscEmit } from "./tsc-BsZXDoCU.js";
2
+ import "./context-BGY_fVH1.js";
3
3
 
4
4
  export { tscEmit };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown-plugin-dts",
3
- "version": "0.16.8",
3
+ "version": "0.16.9",
4
4
  "description": "A Rolldown plugin to generate and bundle dts files.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -65,37 +65,37 @@
65
65
  "@babel/parser": "^7.28.4",
66
66
  "@babel/types": "^7.28.4",
67
67
  "ast-kit": "^2.1.2",
68
- "birpc": "^2.5.0",
68
+ "birpc": "^2.6.1",
69
69
  "debug": "^4.4.3",
70
70
  "dts-resolver": "^2.1.2",
71
71
  "get-tsconfig": "^4.10.1",
72
72
  "magic-string": "^0.30.19"
73
73
  },
74
74
  "devDependencies": {
75
- "@sxzz/eslint-config": "^7.1.4",
75
+ "@sxzz/eslint-config": "^7.2.5",
76
76
  "@sxzz/prettier-config": "^2.2.4",
77
77
  "@sxzz/test-utils": "^0.5.11",
78
78
  "@types/babel__generator": "^7.27.0",
79
79
  "@types/debug": "^4.1.12",
80
80
  "@types/node": "^24.5.2",
81
- "@typescript/native-preview": "7.0.0-dev.20250921.1",
81
+ "@typescript/native-preview": "7.0.0-dev.20250925.1",
82
82
  "@volar/typescript": "^2.4.23",
83
- "@vue/language-core": "^3.0.7",
83
+ "@vue/language-core": "^3.0.8",
84
84
  "arktype": "^2.1.22",
85
85
  "bumpp": "^10.2.3",
86
86
  "diff": "^8.0.2",
87
87
  "eslint": "^9.36.0",
88
88
  "estree-walker": "^3.0.3",
89
89
  "prettier": "^3.6.2",
90
- "rolldown": "^1.0.0-beta.38",
91
- "rolldown-plugin-require-cjs": "^0.1.4",
90
+ "rolldown": "^1.0.0-beta.40",
91
+ "rolldown-plugin-require-cjs": "^0.3.0",
92
92
  "rollup-plugin-dts": "^6.2.3",
93
93
  "tinyglobby": "^0.2.15",
94
94
  "tsdown": "^0.15.4",
95
95
  "typescript": "^5.9.2",
96
96
  "vitest": "^3.2.4",
97
- "vue": "^3.5.21",
98
- "vue-tsc": "^3.0.7"
97
+ "vue": "^3.5.22",
98
+ "vue-tsc": "^3.0.8"
99
99
  },
100
100
  "engines": {
101
101
  "node": ">=20.18.0"