rolldown-plugin-dts 0.17.3 → 0.17.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/README.md +9 -0
- package/dist/{filename.d.ts → filename.d.mts} +1 -1
- package/dist/{filename.js → filename.mjs} +1 -1
- package/dist/{index-UvaKF8Pg.d.ts → index-C4bAW0sP.d.mts} +1 -1
- package/dist/{index.d.ts → index.d.mts} +11 -1
- package/dist/{index.js → index.mjs} +19 -200
- package/dist/resolver-DymnxKPB.mjs +17 -0
- package/dist/{tsc--GG3zA2e.js → tsc-Oohh5fvr.mjs} +1 -1
- package/dist/{tsc-context.d.ts → tsc-context.d.mts} +1 -1
- package/dist/tsc-context.mjs +3 -0
- package/dist/{tsc-worker.d.ts → tsc-worker.d.mts} +2 -2
- package/dist/{tsc-worker.js → tsc-worker.mjs} +2 -2
- package/dist/tsc.d.mts +3 -0
- package/dist/tsc.mjs +4 -0
- package/package.json +22 -23
- package/dist/tsc-context.js +0 -3
- package/dist/tsc.d.ts +0 -3
- package/dist/tsc.js +0 -4
- /package/dist/{context-Cf8MAZaX.d.ts → context-CJDCoB2H.d.mts} +0 -0
- /package/dist/{context-BacUE4pM.js → context-Db5EuGKU.mjs} +0 -0
- /package/dist/{filename-DDjuEak0.js → filename-DhMOFFZT.mjs} +0 -0
- /package/dist/{filename-0s1tyon-.d.ts → filename-GAo446AD.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -91,6 +91,15 @@ By default, dependencies are external, resulting in `import { Type } from 'some-
|
|
|
91
91
|
- `false`: (Default) Keeps all dependencies external.
|
|
92
92
|
- `(string | RegExp)[]`: Bundles only dependencies matching the provided strings or regular expressions (e.g. `['pkg-a', /^@scope\//]`).
|
|
93
93
|
|
|
94
|
+
#### `resolver`
|
|
95
|
+
|
|
96
|
+
Specifies a resolver to resolve type definitions, especially for `node_modules`.
|
|
97
|
+
|
|
98
|
+
- `'oxc'`: Uses Oxc's module resolution, which is faster and more efficient.
|
|
99
|
+
- `'tsc'`: Uses TypeScript's native module resolution, which may be more compatible with complex setups, but slower.
|
|
100
|
+
|
|
101
|
+
Defaults to `'oxc'`.
|
|
102
|
+
|
|
94
103
|
#### `cjsDefault`
|
|
95
104
|
|
|
96
105
|
Determines how the default export is emitted.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RE_JSON, c as RE_VUE, d as filename_to_dts, f as replaceTemplateName, i as RE_JS, l as filename_dts_to, n as RE_DTS, o as RE_NODE_MODULES, p as resolveTemplateFn, r as RE_DTS_MAP, s as RE_TS, t as RE_CSS, u as filename_js_to_dts } from "./filename-
|
|
1
|
+
import { a as RE_JSON, c as RE_VUE, d as filename_to_dts, f as replaceTemplateName, i as RE_JS, l as filename_dts_to, n as RE_DTS, o as RE_NODE_MODULES, p as resolveTemplateFn, r as RE_DTS_MAP, s as RE_TS, t as RE_CSS, u as filename_js_to_dts } from "./filename-GAo446AD.mjs";
|
|
2
2
|
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_JSON, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as RE_JSON, c as RE_VUE, d as filename_to_dts, f as replaceTemplateName, i as RE_JS, l as filename_dts_to, n as RE_DTS, o as RE_NODE_MODULES, p as resolveTemplateFn, r as RE_DTS_MAP, s as RE_TS, t as RE_CSS, u as filename_js_to_dts } from "./filename-
|
|
1
|
+
import { a as RE_JSON, c as RE_VUE, d as filename_to_dts, f as replaceTemplateName, i as RE_JS, l as filename_dts_to, n as RE_DTS, o as RE_NODE_MODULES, p as resolveTemplateFn, r as RE_DTS_MAP, s as RE_TS, t as RE_CSS, u as filename_js_to_dts } from "./filename-DhMOFFZT.mjs";
|
|
2
2
|
|
|
3
3
|
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_JSON, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as RE_JSON, c as RE_VUE, i as RE_JS, n as RE_DTS, o as RE_NODE_MODULES, r as RE_DTS_MAP, s as RE_TS, t as RE_CSS } from "./filename-
|
|
1
|
+
import { a as RE_JSON, c as RE_VUE, i as RE_JS, n as RE_DTS, o as RE_NODE_MODULES, r as RE_DTS_MAP, s as RE_TS, t as RE_CSS } from "./filename-GAo446AD.mjs";
|
|
2
2
|
import { IsolatedDeclarationsOptions } from "rolldown/experimental";
|
|
3
3
|
import { TsConfigJson } from "get-tsconfig";
|
|
4
4
|
import { AddonFunction, Plugin } from "rolldown";
|
|
@@ -57,6 +57,15 @@ interface GeneralOptions {
|
|
|
57
57
|
*/
|
|
58
58
|
resolve?: boolean | (string | RegExp)[];
|
|
59
59
|
/**
|
|
60
|
+
* Specifies a resolver to resolve type definitions, especially for `node_modules`.
|
|
61
|
+
*
|
|
62
|
+
* - `'oxc'`: Uses Oxc's module resolution, which is faster and more efficient.
|
|
63
|
+
* - `'tsc'`: Uses TypeScript's native module resolution, which may be more compatible with complex setups, but slower.
|
|
64
|
+
*
|
|
65
|
+
* @default 'oxc'
|
|
66
|
+
*/
|
|
67
|
+
resolver?: "oxc" | "tsc";
|
|
68
|
+
/**
|
|
60
69
|
* Determines how the default export is emitted.
|
|
61
70
|
*
|
|
62
71
|
* If set to `true`, and you are only exporting a single item using `export default ...`,
|
|
@@ -195,6 +204,7 @@ declare function resolveOptions({
|
|
|
195
204
|
compilerOptions,
|
|
196
205
|
sourcemap,
|
|
197
206
|
resolve,
|
|
207
|
+
resolver,
|
|
198
208
|
cjsDefault,
|
|
199
209
|
banner,
|
|
200
210
|
footer,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const __cjs_require = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
|
|
2
|
-
import { a as RE_JSON, c as RE_VUE, d as filename_to_dts, f as replaceTemplateName, i as RE_JS, l as filename_dts_to, n as RE_DTS, o as RE_NODE_MODULES, p as resolveTemplateFn, r as RE_DTS_MAP, s as RE_TS, t as RE_CSS, u as filename_js_to_dts } from "./filename-
|
|
3
|
-
import { n as globalContext, r as invalidateContextFile, t as createContext } from "./context-
|
|
2
|
+
import { a as RE_JSON, c as RE_VUE, d as filename_to_dts, f as replaceTemplateName, i as RE_JS, l as filename_dts_to, n as RE_DTS, o as RE_NODE_MODULES, p as resolveTemplateFn, r as RE_DTS_MAP, s as RE_TS, t as RE_CSS, u as filename_js_to_dts } from "./filename-DhMOFFZT.mjs";
|
|
3
|
+
import { n as globalContext, r as invalidateContextFile, t as createContext } from "./context-Db5EuGKU.mjs";
|
|
4
4
|
const Debug = __cjs_require("debug");
|
|
5
5
|
import MagicString from "magic-string";
|
|
6
6
|
const {
|
|
@@ -10,7 +10,7 @@ const {
|
|
|
10
10
|
parse
|
|
11
11
|
} = __cjs_require("@babel/parser");
|
|
12
12
|
const t = __cjs_require("@babel/types");
|
|
13
|
-
import { isDeclarationType, isTypeOf, resolveString } from "ast-kit";
|
|
13
|
+
import { isDeclarationType, isIdentifierOf, isTypeOf, resolveString, walkAST } from "ast-kit";
|
|
14
14
|
const {
|
|
15
15
|
fork,
|
|
16
16
|
spawn
|
|
@@ -96,192 +96,6 @@ function createDtsInputPlugin({ sideEffects }) {
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
//#endregion
|
|
100
|
-
//#region node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/walker.js
|
|
101
|
-
/**
|
|
102
|
-
* @typedef { import('estree').Node} Node
|
|
103
|
-
* @typedef {{
|
|
104
|
-
* skip: () => void;
|
|
105
|
-
* remove: () => void;
|
|
106
|
-
* replace: (node: Node) => void;
|
|
107
|
-
* }} WalkerContext
|
|
108
|
-
*/
|
|
109
|
-
var WalkerBase = class {
|
|
110
|
-
constructor() {
|
|
111
|
-
/** @type {boolean} */
|
|
112
|
-
this.should_skip = false;
|
|
113
|
-
/** @type {boolean} */
|
|
114
|
-
this.should_remove = false;
|
|
115
|
-
/** @type {Node | null} */
|
|
116
|
-
this.replacement = null;
|
|
117
|
-
/** @type {WalkerContext} */
|
|
118
|
-
this.context = {
|
|
119
|
-
skip: () => this.should_skip = true,
|
|
120
|
-
remove: () => this.should_remove = true,
|
|
121
|
-
replace: (node) => this.replacement = node
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* @template {Node} Parent
|
|
126
|
-
* @param {Parent | null | undefined} parent
|
|
127
|
-
* @param {keyof Parent | null | undefined} prop
|
|
128
|
-
* @param {number | null | undefined} index
|
|
129
|
-
* @param {Node} node
|
|
130
|
-
*/
|
|
131
|
-
replace(parent, prop, index, node) {
|
|
132
|
-
if (parent && prop) if (index != null)
|
|
133
|
-
/** @type {Array<Node>} */ parent[prop][index] = node;
|
|
134
|
-
else
|
|
135
|
-
/** @type {Node} */ parent[prop] = node;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* @template {Node} Parent
|
|
139
|
-
* @param {Parent | null | undefined} parent
|
|
140
|
-
* @param {keyof Parent | null | undefined} prop
|
|
141
|
-
* @param {number | null | undefined} index
|
|
142
|
-
*/
|
|
143
|
-
remove(parent, prop, index) {
|
|
144
|
-
if (parent && prop) if (index !== null && index !== void 0)
|
|
145
|
-
/** @type {Array<Node>} */ parent[prop].splice(index, 1);
|
|
146
|
-
else delete parent[prop];
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
//#endregion
|
|
151
|
-
//#region node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/sync.js
|
|
152
|
-
/**
|
|
153
|
-
* @typedef { import('estree').Node} Node
|
|
154
|
-
* @typedef { import('./walker.js').WalkerContext} WalkerContext
|
|
155
|
-
* @typedef {(
|
|
156
|
-
* this: WalkerContext,
|
|
157
|
-
* node: Node,
|
|
158
|
-
* parent: Node | null,
|
|
159
|
-
* key: string | number | symbol | null | undefined,
|
|
160
|
-
* index: number | null | undefined
|
|
161
|
-
* ) => void} SyncHandler
|
|
162
|
-
*/
|
|
163
|
-
var SyncWalker = class extends WalkerBase {
|
|
164
|
-
/**
|
|
165
|
-
*
|
|
166
|
-
* @param {SyncHandler} [enter]
|
|
167
|
-
* @param {SyncHandler} [leave]
|
|
168
|
-
*/
|
|
169
|
-
constructor(enter, leave) {
|
|
170
|
-
super();
|
|
171
|
-
/** @type {boolean} */
|
|
172
|
-
this.should_skip = false;
|
|
173
|
-
/** @type {boolean} */
|
|
174
|
-
this.should_remove = false;
|
|
175
|
-
/** @type {Node | null} */
|
|
176
|
-
this.replacement = null;
|
|
177
|
-
/** @type {WalkerContext} */
|
|
178
|
-
this.context = {
|
|
179
|
-
skip: () => this.should_skip = true,
|
|
180
|
-
remove: () => this.should_remove = true,
|
|
181
|
-
replace: (node) => this.replacement = node
|
|
182
|
-
};
|
|
183
|
-
/** @type {SyncHandler | undefined} */
|
|
184
|
-
this.enter = enter;
|
|
185
|
-
/** @type {SyncHandler | undefined} */
|
|
186
|
-
this.leave = leave;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* @template {Node} Parent
|
|
190
|
-
* @param {Node} node
|
|
191
|
-
* @param {Parent | null} parent
|
|
192
|
-
* @param {keyof Parent} [prop]
|
|
193
|
-
* @param {number | null} [index]
|
|
194
|
-
* @returns {Node | null}
|
|
195
|
-
*/
|
|
196
|
-
visit(node, parent, prop, index) {
|
|
197
|
-
if (node) {
|
|
198
|
-
if (this.enter) {
|
|
199
|
-
const _should_skip = this.should_skip;
|
|
200
|
-
const _should_remove = this.should_remove;
|
|
201
|
-
const _replacement = this.replacement;
|
|
202
|
-
this.should_skip = false;
|
|
203
|
-
this.should_remove = false;
|
|
204
|
-
this.replacement = null;
|
|
205
|
-
this.enter.call(this.context, node, parent, prop, index);
|
|
206
|
-
if (this.replacement) {
|
|
207
|
-
node = this.replacement;
|
|
208
|
-
this.replace(parent, prop, index, node);
|
|
209
|
-
}
|
|
210
|
-
if (this.should_remove) this.remove(parent, prop, index);
|
|
211
|
-
const skipped = this.should_skip;
|
|
212
|
-
const removed = this.should_remove;
|
|
213
|
-
this.should_skip = _should_skip;
|
|
214
|
-
this.should_remove = _should_remove;
|
|
215
|
-
this.replacement = _replacement;
|
|
216
|
-
if (skipped) return node;
|
|
217
|
-
if (removed) return null;
|
|
218
|
-
}
|
|
219
|
-
/** @type {keyof Node} */
|
|
220
|
-
let key;
|
|
221
|
-
for (key in node) {
|
|
222
|
-
/** @type {unknown} */
|
|
223
|
-
const value = node[key];
|
|
224
|
-
if (value && typeof value === "object") {
|
|
225
|
-
if (Array.isArray(value)) {
|
|
226
|
-
const nodes = value;
|
|
227
|
-
for (let i = 0; i < nodes.length; i += 1) {
|
|
228
|
-
const item = nodes[i];
|
|
229
|
-
if (isNode(item)) {
|
|
230
|
-
if (!this.visit(item, node, key, i)) i--;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
} else if (isNode(value)) this.visit(value, node, key, null);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
if (this.leave) {
|
|
237
|
-
const _replacement = this.replacement;
|
|
238
|
-
const _should_remove = this.should_remove;
|
|
239
|
-
this.replacement = null;
|
|
240
|
-
this.should_remove = false;
|
|
241
|
-
this.leave.call(this.context, node, parent, prop, index);
|
|
242
|
-
if (this.replacement) {
|
|
243
|
-
node = this.replacement;
|
|
244
|
-
this.replace(parent, prop, index, node);
|
|
245
|
-
}
|
|
246
|
-
if (this.should_remove) this.remove(parent, prop, index);
|
|
247
|
-
const removed = this.should_remove;
|
|
248
|
-
this.replacement = _replacement;
|
|
249
|
-
this.should_remove = _should_remove;
|
|
250
|
-
if (removed) return null;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return node;
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
/**
|
|
257
|
-
* Ducktype a node.
|
|
258
|
-
*
|
|
259
|
-
* @param {unknown} value
|
|
260
|
-
* @returns {value is Node}
|
|
261
|
-
*/
|
|
262
|
-
function isNode(value) {
|
|
263
|
-
return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string";
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
//#endregion
|
|
267
|
-
//#region node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/index.js
|
|
268
|
-
/**
|
|
269
|
-
* @typedef {import('estree').Node} Node
|
|
270
|
-
* @typedef {import('./sync.js').SyncHandler} SyncHandler
|
|
271
|
-
* @typedef {import('./async.js').AsyncHandler} AsyncHandler
|
|
272
|
-
*/
|
|
273
|
-
/**
|
|
274
|
-
* @param {Node} ast
|
|
275
|
-
* @param {{
|
|
276
|
-
* enter?: SyncHandler
|
|
277
|
-
* leave?: SyncHandler
|
|
278
|
-
* }} walker
|
|
279
|
-
* @returns {Node | null}
|
|
280
|
-
*/
|
|
281
|
-
function walk(ast, { enter, leave }) {
|
|
282
|
-
return new SyncWalker(enter, leave).visit(ast, null);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
99
|
//#endregion
|
|
286
100
|
//#region src/fake-js.ts
|
|
287
101
|
function createFakeJsPlugin({ sourcemap, cjsDefault, sideEffects }) {
|
|
@@ -504,7 +318,7 @@ function createFakeJsPlugin({ sourcemap, cjsDefault, sideEffects }) {
|
|
|
504
318
|
*/
|
|
505
319
|
function collectParams(node) {
|
|
506
320
|
const typeParams = [];
|
|
507
|
-
|
|
321
|
+
walkAST(node, { leave(node$1) {
|
|
508
322
|
if ("typeParameters" in node$1 && node$1.typeParameters?.type === "TSTypeParameterDeclaration") typeParams.push(...node$1.typeParameters.params);
|
|
509
323
|
} });
|
|
510
324
|
const paramMap = /* @__PURE__ */ new Map();
|
|
@@ -522,7 +336,7 @@ function createFakeJsPlugin({ sourcemap, cjsDefault, sideEffects }) {
|
|
|
522
336
|
function collectDependencies(node, namespaceStmts) {
|
|
523
337
|
const deps = /* @__PURE__ */ new Set();
|
|
524
338
|
const seen = /* @__PURE__ */ new Set();
|
|
525
|
-
|
|
339
|
+
walkAST(node, { leave(node$1) {
|
|
526
340
|
if (node$1.type === "ExportNamedDeclaration") {
|
|
527
341
|
for (const specifier of node$1.specifiers) if (specifier.type === "ExportSpecifier") addDependency(specifier.local);
|
|
528
342
|
} else if (node$1.type === "TSInterfaceDeclaration" && node$1.extends) for (const heritage of node$1.extends || []) addDependency(TSEntityNameToRuntime(heritage.expression));
|
|
@@ -615,7 +429,7 @@ function isRuntimeBindingArrayElements(elements) {
|
|
|
615
429
|
return t.isNumericLiteral(symbolId) && t.isArrowFunctionExpression(deps) && (!effect || t.isCallExpression(effect));
|
|
616
430
|
}
|
|
617
431
|
function isThisExpression(node) {
|
|
618
|
-
return node
|
|
432
|
+
return isIdentifierOf(node, "this") || node.type === "MemberExpression" && isThisExpression(node.object);
|
|
619
433
|
}
|
|
620
434
|
function TSEntityNameToRuntime(node) {
|
|
621
435
|
if (node.type === "Identifier") return node;
|
|
@@ -627,7 +441,7 @@ function getIdFromTSEntityName(node) {
|
|
|
627
441
|
return getIdFromTSEntityName(node.left);
|
|
628
442
|
}
|
|
629
443
|
function isReferenceId(node) {
|
|
630
|
-
return
|
|
444
|
+
return isTypeOf(node, ["Identifier", "MemberExpression"]);
|
|
631
445
|
}
|
|
632
446
|
function isHelperImport(node) {
|
|
633
447
|
return node.type === "ImportDeclaration" && node.specifiers.length === 1 && node.specifiers.every((spec) => spec.type === "ImportSpecifier" && spec.imported.type === "Identifier" && ["__export", "__reExport"].includes(spec.local.name));
|
|
@@ -698,7 +512,7 @@ function patchTsNamespace(nodes) {
|
|
|
698
512
|
function patchReExport(nodes) {
|
|
699
513
|
const exportsNames = /* @__PURE__ */ new Map();
|
|
700
514
|
for (const [i, node] of nodes.entries()) if (node.type === "ImportDeclaration" && node.specifiers.length === 1 && node.specifiers[0].type === "ImportSpecifier" && node.specifiers[0].local.type === "Identifier" && node.specifiers[0].local.name.endsWith("_exports")) exportsNames.set(node.specifiers[0].local.name, node.specifiers[0].local.name);
|
|
701
|
-
else if (node.type === "ExpressionStatement" && node.expression.type === "CallExpression" && node.expression.callee
|
|
515
|
+
else if (node.type === "ExpressionStatement" && node.expression.type === "CallExpression" && isIdentifierOf(node.expression.callee, "__reExport")) {
|
|
702
516
|
const args = node.expression.arguments;
|
|
703
517
|
exportsNames.set(args[0].name, args[1].name);
|
|
704
518
|
} else if (node.type === "VariableDeclaration" && node.declarations.length === 1 && node.declarations[0].init?.type === "MemberExpression" && node.declarations[0].init.object.type === "Identifier" && exportsNames.has(node.declarations[0].init.object.name)) nodes[i] = {
|
|
@@ -824,7 +638,7 @@ function createGeneratePlugin({ tsconfig, tsconfigRaw, build, incremental, cwd,
|
|
|
824
638
|
on: (fn) => childProcess.on("message", fn)
|
|
825
639
|
});
|
|
826
640
|
} else {
|
|
827
|
-
tscModule = await import("./tsc.
|
|
641
|
+
tscModule = await import("./tsc.mjs");
|
|
828
642
|
if (newContext) tscContext = createContext();
|
|
829
643
|
}
|
|
830
644
|
if (!Array.isArray(options.input)) for (const [name, id] of Object.entries(options.input)) {
|
|
@@ -1041,7 +855,7 @@ function collectJsonExports(code) {
|
|
|
1041
855
|
//#endregion
|
|
1042
856
|
//#region src/options.ts
|
|
1043
857
|
let warnedTsgo = false;
|
|
1044
|
-
function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = false, tsconfig, tsconfigRaw: overriddenTsconfigRaw = {}, compilerOptions = {}, sourcemap, resolve = false, cjsDefault = false, banner, footer, sideEffects = false, build = false, incremental = false, vue = false, tsMacro = false, parallel = false, eager = false, newContext = false, emitJs, oxc, tsgo = false }) {
|
|
858
|
+
function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = false, tsconfig, tsconfigRaw: overriddenTsconfigRaw = {}, compilerOptions = {}, sourcemap, resolve = false, resolver = "oxc", cjsDefault = false, banner, footer, sideEffects = false, build = false, incremental = false, vue = false, tsMacro = false, parallel = false, eager = false, newContext = false, emitJs, oxc, tsgo = false }) {
|
|
1045
859
|
let resolvedTsconfig;
|
|
1046
860
|
if (tsconfig === true || tsconfig == null) {
|
|
1047
861
|
const { config, path: path$1 } = getTsconfig(cwd) || {};
|
|
@@ -1089,6 +903,7 @@ function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = f
|
|
|
1089
903
|
tsconfigRaw,
|
|
1090
904
|
sourcemap,
|
|
1091
905
|
resolve,
|
|
906
|
+
resolver,
|
|
1092
907
|
cjsDefault,
|
|
1093
908
|
banner,
|
|
1094
909
|
footer,
|
|
@@ -1111,7 +926,7 @@ function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = f
|
|
|
1111
926
|
function isSourceFile(id) {
|
|
1112
927
|
return RE_TS.test(id) || RE_VUE.test(id) || RE_JSON.test(id);
|
|
1113
928
|
}
|
|
1114
|
-
function createDtsResolvePlugin({ tsconfig, resolve, sideEffects }) {
|
|
929
|
+
function createDtsResolvePlugin({ cwd, tsconfig, tsconfigRaw, resolve, resolver, sideEffects }) {
|
|
1115
930
|
const baseDtsResolver = createResolver({
|
|
1116
931
|
tsconfig,
|
|
1117
932
|
resolveNodeModules: !!resolve,
|
|
@@ -1131,7 +946,7 @@ function createDtsResolvePlugin({ tsconfig, resolve, sideEffects }) {
|
|
|
1131
946
|
};
|
|
1132
947
|
if (RE_CSS.test(id)) return external;
|
|
1133
948
|
const rolldownResolution = await this.resolve(id, importer, options);
|
|
1134
|
-
const dtsResolution = resolveDtsPath(id, importer, rolldownResolution);
|
|
949
|
+
const dtsResolution = await resolveDtsPath(id, importer, rolldownResolution);
|
|
1135
950
|
if (!dtsResolution) return isFilePath(id) ? null : external;
|
|
1136
951
|
if (RE_NODE_MODULES.test(dtsResolution) && !shouldBundleNodeModule(id) && (!RE_NODE_MODULES.test(importer) || rolldownResolution?.external)) return external;
|
|
1137
952
|
if (RE_DTS.test(dtsResolution)) return {
|
|
@@ -1152,8 +967,12 @@ function createDtsResolvePlugin({ tsconfig, resolve, sideEffects }) {
|
|
|
1152
967
|
if (typeof resolve === "boolean") return resolve;
|
|
1153
968
|
return resolve.some((pattern) => typeof pattern === "string" ? id === pattern : pattern.test(id));
|
|
1154
969
|
}
|
|
1155
|
-
function resolveDtsPath(id, importer, rolldownResolution) {
|
|
1156
|
-
let dtsPath
|
|
970
|
+
async function resolveDtsPath(id, importer, rolldownResolution) {
|
|
971
|
+
let dtsPath;
|
|
972
|
+
if (resolver === "tsc") {
|
|
973
|
+
const { tscResolve } = await import("./resolver-DymnxKPB.mjs");
|
|
974
|
+
dtsPath = tscResolve(id, importer, cwd, tsconfig, tsconfigRaw);
|
|
975
|
+
} else dtsPath = baseDtsResolver(id, importer);
|
|
1157
976
|
if (dtsPath) dtsPath = path.normalize(dtsPath);
|
|
1158
977
|
if (!dtsPath || !isSourceFile(dtsPath)) {
|
|
1159
978
|
if (rolldownResolution && isFilePath(rolldownResolution.id) && isSourceFile(rolldownResolution.id) && !rolldownResolution.external) return rolldownResolution.id;
|
|
@@ -0,0 +1,17 @@
|
|
|
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");
|
|
4
|
+
const ts = __cjs_require("typescript");
|
|
5
|
+
|
|
6
|
+
//#region src/tsc/resolver.ts
|
|
7
|
+
const debug = Debug("rolldown-plugin-dts:tsc-resolver");
|
|
8
|
+
function tscResolve(id, importer, cwd, tsconfig, tsconfigRaw, reference) {
|
|
9
|
+
const baseDir = tsconfig ? path.dirname(tsconfig) : cwd;
|
|
10
|
+
const parsedConfig = ts.parseJsonConfigFileContent(tsconfigRaw, ts.sys, baseDir);
|
|
11
|
+
const resolved = ts.bundlerModuleNameResolver(id, importer, parsedConfig.options, ts.sys, void 0, reference);
|
|
12
|
+
debug(`tsc resolving id "%s" from "%s" -> %O`, id, importer, resolved.resolvedModule);
|
|
13
|
+
return resolved.resolvedModule?.resolvedFileName;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { tscResolve };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __cjs_require = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
|
|
2
|
-
import { n as globalContext } from "./context-
|
|
2
|
+
import { n as globalContext } from "./context-Db5EuGKU.mjs";
|
|
3
3
|
const {
|
|
4
4
|
createRequire
|
|
5
5
|
} = globalThis.process.getBuiltinModule("node:module");
|
|
@@ -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-
|
|
1
|
+
import { a as globalContext, i as createContext, n as SourceFileToProjectMap, o as invalidateContextFile, r as TscContext, t as ParsedProject } from "./context-CJDCoB2H.mjs";
|
|
2
2
|
export { ParsedProject, SourceFileToProjectMap, TscContext, createContext, globalContext, invalidateContextFile };
|
package/dist/tsc.d.mts
ADDED
package/dist/tsc.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown-plugin-dts",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
4
4
|
"description": "A Rolldown plugin to generate and bundle dts files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"files": [
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
|
-
"main": "./dist/index.
|
|
29
|
-
"module": "./dist/index.
|
|
30
|
-
"types": "./dist/index.d.
|
|
28
|
+
"main": "./dist/index.mjs",
|
|
29
|
+
"module": "./dist/index.mjs",
|
|
30
|
+
"types": "./dist/index.d.mts",
|
|
31
31
|
"exports": {
|
|
32
|
-
".": "./dist/index.
|
|
33
|
-
"./filename": "./dist/filename.
|
|
34
|
-
"./tsc": "./dist/tsc.
|
|
35
|
-
"./tsc-context": "./dist/tsc-context.
|
|
36
|
-
"./tsc-worker": "./dist/tsc-worker.
|
|
32
|
+
".": "./dist/index.mjs",
|
|
33
|
+
"./filename": "./dist/filename.mjs",
|
|
34
|
+
"./tsc": "./dist/tsc.mjs",
|
|
35
|
+
"./tsc-context": "./dist/tsc-context.mjs",
|
|
36
|
+
"./tsc-worker": "./dist/tsc-worker.mjs",
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
@@ -64,38 +64,37 @@
|
|
|
64
64
|
"@babel/generator": "^7.28.5",
|
|
65
65
|
"@babel/parser": "^7.28.5",
|
|
66
66
|
"@babel/types": "^7.28.5",
|
|
67
|
-
"ast-kit": "^2.
|
|
68
|
-
"birpc": "^2.
|
|
67
|
+
"ast-kit": "^2.2.0",
|
|
68
|
+
"birpc": "^2.7.0",
|
|
69
69
|
"debug": "^4.4.3",
|
|
70
70
|
"dts-resolver": "^2.1.2",
|
|
71
71
|
"get-tsconfig": "^4.13.0",
|
|
72
72
|
"magic-string": "^0.30.21"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@sxzz/eslint-config": "^7.2.
|
|
75
|
+
"@sxzz/eslint-config": "^7.2.8",
|
|
76
76
|
"@sxzz/prettier-config": "^2.2.4",
|
|
77
77
|
"@sxzz/test-utils": "^0.5.12",
|
|
78
78
|
"@types/babel__generator": "^7.27.0",
|
|
79
79
|
"@types/debug": "^4.1.12",
|
|
80
|
-
"@types/node": "^24.
|
|
81
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
80
|
+
"@types/node": "^24.10.0",
|
|
81
|
+
"@typescript/native-preview": "7.0.0-dev.20251108.1",
|
|
82
82
|
"@volar/typescript": "^2.4.23",
|
|
83
|
-
"@vue/language-core": "^3.1.
|
|
84
|
-
"arktype": "^2.1.
|
|
83
|
+
"@vue/language-core": "^3.1.3",
|
|
84
|
+
"arktype": "^2.1.25",
|
|
85
85
|
"bumpp": "^10.3.1",
|
|
86
86
|
"diff": "^8.0.2",
|
|
87
|
-
"eslint": "^9.
|
|
88
|
-
"estree-walker": "^3.0.3",
|
|
87
|
+
"eslint": "^9.39.1",
|
|
89
88
|
"prettier": "^3.6.2",
|
|
90
|
-
"rolldown": "^1.0.0-beta.
|
|
89
|
+
"rolldown": "^1.0.0-beta.47",
|
|
91
90
|
"rolldown-plugin-require-cjs": "^0.3.1",
|
|
92
91
|
"rollup-plugin-dts": "^6.2.3",
|
|
93
92
|
"tinyglobby": "^0.2.15",
|
|
94
|
-
"tsdown": "^0.
|
|
93
|
+
"tsdown": "^0.16.1",
|
|
95
94
|
"typescript": "^5.9.3",
|
|
96
|
-
"vitest": "^4.0.
|
|
97
|
-
"vue": "^3.5.
|
|
98
|
-
"vue-tsc": "^3.1.
|
|
95
|
+
"vitest": "^4.0.8",
|
|
96
|
+
"vue": "^3.5.24",
|
|
97
|
+
"vue-tsc": "^3.1.3"
|
|
99
98
|
},
|
|
100
99
|
"engines": {
|
|
101
100
|
"node": ">=20.18.0"
|
package/dist/tsc-context.js
DELETED
package/dist/tsc.d.ts
DELETED
package/dist/tsc.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|