rolldown-plugin-dts 0.27.5 → 0.27.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.
- package/dist/index.mjs +7 -9
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -177,13 +177,10 @@ function createFakeJsPlugin({ sourcemap, cjsDefault, sideEffects }) {
|
|
|
177
177
|
childrenNode,
|
|
178
178
|
...sideEffectNode ? [sideEffectNode] : []
|
|
179
179
|
]);
|
|
180
|
-
const runtimeAssignment = b.variableDeclaration("var", [b.variableDeclarator({
|
|
181
|
-
...bindings[0],
|
|
182
|
-
typeAnnotation: null
|
|
183
|
-
}, runtimeArrayNode), ...bindings.slice(1).map((binding) => b.variableDeclarator({
|
|
180
|
+
const runtimeAssignment = b.variableDeclaration("var", [b.variableDeclarator(b.arrayPattern(bindings.map((binding) => ({
|
|
184
181
|
...binding,
|
|
185
182
|
typeAnnotation: null
|
|
186
|
-
}))]);
|
|
183
|
+
}))), runtimeArrayNode)]);
|
|
187
184
|
if (isDefaultExport) {
|
|
188
185
|
appendStmts.push(b.exportNamedDeclaration(null, [b.exportSpecifier(bindings[0], b.identifier("default"))]));
|
|
189
186
|
setStmt(runtimeAssignment);
|
|
@@ -230,16 +227,17 @@ function createFakeJsPlugin({ sourcemap, cjsDefault, sideEffects }) {
|
|
|
230
227
|
if (newNode || newNode === false) return newNode;
|
|
231
228
|
if (node.type !== "VariableDeclaration") return node;
|
|
232
229
|
if (!isRuntimeBindingVariableDeclaration(node)) return null;
|
|
233
|
-
const
|
|
230
|
+
const decl = node.declarations[0];
|
|
231
|
+
const [declarationIdNode, depsFn, children] = decl.init.elements;
|
|
234
232
|
const declarationId = declarationIdNode.value;
|
|
235
233
|
const declaration = getDeclaration(declarationId);
|
|
236
234
|
if (sourcemap) walk(declaration.decl, { enter(node) {
|
|
237
235
|
node.start = void 0;
|
|
238
236
|
node.end = void 0;
|
|
239
237
|
} });
|
|
240
|
-
for (const [i,
|
|
238
|
+
for (const [i, id] of decl.id.elements.entries()) {
|
|
241
239
|
const transformedBinding = {
|
|
242
|
-
...
|
|
240
|
+
...id,
|
|
243
241
|
typeAnnotation: declaration.bindings[i].typeAnnotation
|
|
244
242
|
};
|
|
245
243
|
overwriteNode(declaration.bindings[i], transformedBinding);
|
|
@@ -605,7 +603,7 @@ function isCjsDtsInputSyntax(node) {
|
|
|
605
603
|
* Check if the given node is a {@link RuntimeBindingVariableDeclration}
|
|
606
604
|
*/
|
|
607
605
|
function isRuntimeBindingVariableDeclaration(node) {
|
|
608
|
-
return node?.type === "VariableDeclaration" && node.declarations.length
|
|
606
|
+
return node?.type === "VariableDeclaration" && node.declarations.length === 1 && node.declarations[0].type === "VariableDeclarator" && node.declarations[0].id.type === "ArrayPattern" && isRuntimeBindingArrayExpression(node.declarations[0].init);
|
|
609
607
|
}
|
|
610
608
|
/**
|
|
611
609
|
* Check if the given node is a {@link RuntimeBindingArrayExpression}
|