rolldown-plugin-dts 0.16.5 → 0.16.6

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,13 +1,13 @@
1
- import ts from "typescript";
1
+ import Ts from "typescript";
2
2
 
3
3
  //#region src/tsc/context.d.ts
4
4
  interface ParsedProject {
5
5
  tsconfigPath: string;
6
- parsedConfig: ts.ParsedCommandLine;
6
+ parsedConfig: Ts.ParsedCommandLine;
7
7
  }
8
8
  type SourceFileToProjectMap = Map<string, ParsedProject>;
9
9
  interface TscContext {
10
- programs: ts.Program[];
10
+ programs: Ts.Program[];
11
11
  files: Map<string, string>;
12
12
  projects: Map<string, SourceFileToProjectMap>;
13
13
  }
@@ -15,4 +15,4 @@ declare function createContext(): TscContext;
15
15
  declare function invalidateContextFile(context: TscContext, file: string): void;
16
16
  declare const globalContext: TscContext;
17
17
  //#endregion
18
- export { ParsedProject, SourceFileToProjectMap, TscContext, createContext, globalContext, invalidateContextFile };
18
+ export { ParsedProject, SourceFileToProjectMap, type Ts, TscContext, createContext, globalContext, invalidateContextFile };
@@ -1,12 +1,11 @@
1
- import { TscContext } from "./context-DXNtAHtR.js";
1
+ import { Ts, TscContext } from "./context-BafOW9LT.js";
2
2
  import { TsConfigJson } from "get-tsconfig";
3
- import ts from "typescript";
4
3
  import { SourceMapInput } from "rolldown";
5
4
 
6
5
  //#region src/tsc/types.d.ts
7
6
  interface TscModule {
8
- program: ts.Program;
9
- file: ts.SourceFile;
7
+ program: Ts.Program;
8
+ file: Ts.SourceFile;
10
9
  }
11
10
  interface TscOptions {
12
11
  tsconfig?: string;
package/dist/index.js CHANGED
@@ -1,9 +1,8 @@
1
1
  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-Dd76wOJT.js";
2
2
  import { createContext, globalContext, invalidateContextFile } from "./context-Digr9tkU.js";
3
+ import { createRequire } from "node:module";
3
4
  import Debug from "debug";
4
5
  import MagicString from "magic-string";
5
- import _generate from "@babel/generator";
6
- import { parse } from "@babel/parser";
7
6
  import * as t from "@babel/types";
8
7
  import { isDeclarationType, isTypeOf, resolveString } from "ast-kit";
9
8
  import { fork, spawn } from "node:child_process";
@@ -268,7 +267,9 @@ function walk(ast, { enter, leave }) {
268
267
 
269
268
  //#endregion
270
269
  //#region src/fake-js.ts
271
- const generate = _generate.default || _generate;
270
+ const require = createRequire(import.meta.url);
271
+ const { parse } = require("@babel/parser");
272
+ const generate = require("@babel/generator").default;
272
273
  function createFakeJsPlugin({ sourcemap, cjsDefault }) {
273
274
  let symbolIdx = 0;
274
275
  const identifierMap = Object.create(null);
@@ -973,30 +974,30 @@ function createDtsResolvePlugin({ tsconfig, resolve }) {
973
974
  resolveNodeModules: !!resolve,
974
975
  ResolverFactory
975
976
  });
976
- const resolveDtsPath = (id, importer, rolldownResolution) => {
977
+ function resolveDtsPath(id, importer, rolldownResolution) {
977
978
  let dtsPath = baseDtsResolver(id, importer);
978
979
  if (dtsPath) dtsPath = path.normalize(dtsPath);
979
980
  if (!dtsPath || !isSourceFile(dtsPath)) {
980
- if (rolldownResolution && isSourceFile(rolldownResolution.id)) return rolldownResolution.id;
981
+ if (rolldownResolution && isFilePath(rolldownResolution.id) && isSourceFile(rolldownResolution.id) && !rolldownResolution.external) return rolldownResolution.id;
981
982
  return null;
982
983
  }
983
984
  return dtsPath;
984
- };
985
+ }
985
986
  return {
986
987
  name: "rolldown-plugin-dts:resolver",
987
988
  resolveId: {
988
989
  order: "pre",
989
990
  async handler(id, importer, options) {
991
+ if (!importer || !RE_DTS.test(importer)) return;
990
992
  const external = {
991
993
  id,
992
994
  external: true,
993
995
  moduleSideEffects: false
994
996
  };
995
- if (!importer || !RE_DTS.test(importer)) return;
996
997
  if (RE_CSS.test(id)) return external;
997
998
  const rolldownResolution = await this.resolve(id, importer, options);
998
999
  const dtsResolution = resolveDtsPath(id, importer, rolldownResolution);
999
- if (!dtsResolution) return id.startsWith(".") || path.isAbsolute(id) ? null : external;
1000
+ if (!dtsResolution) return isFilePath(id) ? null : external;
1000
1001
  if (RE_NODE_MODULES.test(dtsResolution) && !shouldBundleNodeModule(id) && (!RE_NODE_MODULES.test(importer) || rolldownResolution?.external)) return external;
1001
1002
  if (RE_DTS.test(dtsResolution)) return dtsResolution;
1002
1003
  if (isSourceFile(dtsResolution)) {
@@ -1007,6 +1008,9 @@ function createDtsResolvePlugin({ tsconfig, resolve }) {
1007
1008
  }
1008
1009
  };
1009
1010
  }
1011
+ function isFilePath(id) {
1012
+ return id.startsWith(".") || path.isAbsolute(id);
1013
+ }
1010
1014
 
1011
1015
  //#endregion
1012
1016
  //#region src/index.ts
@@ -2,9 +2,13 @@ import { globalContext } from "./context-Digr9tkU.js";
2
2
  import { createRequire } from "node:module";
3
3
  import Debug from "debug";
4
4
  import path from "node:path";
5
- import ts from "typescript";
6
5
  import { pathToFileURL } from "node:url";
7
6
 
7
+ //#region src/tsc/require-tsc.ts
8
+ const require$1 = createRequire(import.meta.url);
9
+ const ts = require$1("typescript");
10
+
11
+ //#endregion
8
12
  //#region src/tsc/system.ts
9
13
  const debug$3 = Debug("rolldown-plugin-dts:tsc-system");
10
14
  /**
@@ -1,2 +1,2 @@
1
- import { ParsedProject, SourceFileToProjectMap, TscContext, createContext, globalContext, invalidateContextFile } from "./context-DXNtAHtR.js";
1
+ import { ParsedProject, SourceFileToProjectMap, TscContext, createContext, globalContext, invalidateContextFile } from "./context-BafOW9LT.js";
2
2
  export { ParsedProject, SourceFileToProjectMap, TscContext, createContext, globalContext, invalidateContextFile };
@@ -1,5 +1,5 @@
1
- import "./context-DXNtAHtR.js";
2
- import { tscEmit } from "./index-CxJisQQS.js";
1
+ import "./context-BafOW9LT.js";
2
+ import { tscEmit } from "./index-BJoOXlKM.js";
3
3
 
4
4
  //#region src/tsc/worker.d.ts
5
5
  declare const functions: {
@@ -1,5 +1,5 @@
1
1
  import "./context-Digr9tkU.js";
2
- import { tscEmit } from "./tsc-DLbQk3B6.js";
2
+ import { tscEmit } from "./tsc-CCjlVYkv.js";
3
3
  import process from "node:process";
4
4
  import { createBirpc } from "birpc";
5
5
 
package/dist/tsc.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import "./context-DXNtAHtR.js";
2
- import { TscModule, TscOptions, TscResult, tscEmit } from "./index-CxJisQQS.js";
1
+ import "./context-BafOW9LT.js";
2
+ import { TscModule, TscOptions, TscResult, tscEmit } from "./index-BJoOXlKM.js";
3
3
  export { TscModule, TscOptions, TscResult, tscEmit };
package/dist/tsc.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./context-Digr9tkU.js";
2
- import { tscEmit } from "./tsc-DLbQk3B6.js";
2
+ import { tscEmit } from "./tsc-CCjlVYkv.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.5",
3
+ "version": "0.16.6",
4
4
  "description": "A Rolldown plugin to generate and bundle dts files.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -66,7 +66,7 @@
66
66
  "@babel/types": "^7.28.4",
67
67
  "ast-kit": "^2.1.2",
68
68
  "birpc": "^2.5.0",
69
- "debug": "^4.4.1",
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"
@@ -74,26 +74,27 @@
74
74
  "devDependencies": {
75
75
  "@sxzz/eslint-config": "^7.1.4",
76
76
  "@sxzz/prettier-config": "^2.2.4",
77
- "@sxzz/test-utils": "^0.5.10",
77
+ "@sxzz/test-utils": "^0.5.11",
78
78
  "@types/babel__generator": "^7.27.0",
79
79
  "@types/debug": "^4.1.12",
80
- "@types/node": "^24.3.1",
81
- "@typescript/native-preview": "7.0.0-dev.20250911.1",
80
+ "@types/node": "^24.5.2",
81
+ "@typescript/native-preview": "7.0.0-dev.20250918.1",
82
82
  "@volar/typescript": "^2.4.23",
83
- "@vue/language-core": "^3.0.6",
83
+ "@vue/language-core": "^3.0.7",
84
+ "arktype": "^2.1.22",
84
85
  "bumpp": "^10.2.3",
85
86
  "diff": "^8.0.2",
86
87
  "eslint": "^9.35.0",
87
88
  "estree-walker": "^3.0.3",
88
89
  "prettier": "^3.6.2",
89
- "rolldown": "^1.0.0-beta.37",
90
+ "rolldown": "^1.0.0-beta.38",
90
91
  "rollup-plugin-dts": "^6.2.3",
91
92
  "tinyglobby": "^0.2.15",
92
- "tsdown": "^0.15.0",
93
+ "tsdown": "^0.15.2",
93
94
  "typescript": "^5.9.2",
94
95
  "vitest": "^3.2.4",
95
96
  "vue": "^3.5.21",
96
- "vue-tsc": "^3.0.6"
97
+ "vue-tsc": "^3.0.7"
97
98
  },
98
99
  "engines": {
99
100
  "node": ">=20.18.0"