vite-plugin-dts 3.8.0 → 3.8.2
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.cjs +12 -3
- package/dist/index.mjs +12 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -477,7 +477,11 @@ function transformCode(options) {
|
|
|
477
477
|
}
|
|
478
478
|
if (node.importClause.namedBindings && ts__default.isNamedImports(node.importClause.namedBindings)) {
|
|
479
479
|
node.importClause.namedBindings.elements.forEach((element) => {
|
|
480
|
-
|
|
480
|
+
if (element.propertyName) {
|
|
481
|
+
importSet.add(`${element.propertyName.escapedText} as ${element.name.escapedText}`);
|
|
482
|
+
} else {
|
|
483
|
+
importSet.add(element.name.escapedText);
|
|
484
|
+
}
|
|
481
485
|
});
|
|
482
486
|
}
|
|
483
487
|
s.remove(node.pos, node.end);
|
|
@@ -493,7 +497,7 @@ function transformCode(options) {
|
|
|
493
497
|
);
|
|
494
498
|
if (!options.staticImport) {
|
|
495
499
|
s.update(node.argument.literal.pos, node.argument.literal.end, `'${libName}'`);
|
|
496
|
-
return
|
|
500
|
+
return !!node.typeArguments;
|
|
497
501
|
}
|
|
498
502
|
const importSet = importMap.get(libName) ?? importMap.set(libName, /* @__PURE__ */ new Set()).get(libName);
|
|
499
503
|
let usedType = node.qualifier.escapedText;
|
|
@@ -532,7 +536,12 @@ function transformCode(options) {
|
|
|
532
536
|
return false;
|
|
533
537
|
}
|
|
534
538
|
if (ts__default.isModuleDeclaration(node)) {
|
|
535
|
-
|
|
539
|
+
if (node.body && ts__default.isModuleBlock(node.body) && !node.body.statements.some(
|
|
540
|
+
(s2) => ts__default.isExportAssignment(s2) || ts__default.isExportDeclaration(s2) || ts__default.isImportDeclaration(s2)
|
|
541
|
+
)) {
|
|
542
|
+
declareModules.push(s.slice(node.pos, node.end + 1));
|
|
543
|
+
}
|
|
544
|
+
return false;
|
|
536
545
|
}
|
|
537
546
|
});
|
|
538
547
|
importMap.forEach((importSet, libName) => {
|
package/dist/index.mjs
CHANGED
|
@@ -474,7 +474,11 @@ function transformCode(options) {
|
|
|
474
474
|
}
|
|
475
475
|
if (node.importClause.namedBindings && ts.isNamedImports(node.importClause.namedBindings)) {
|
|
476
476
|
node.importClause.namedBindings.elements.forEach((element) => {
|
|
477
|
-
|
|
477
|
+
if (element.propertyName) {
|
|
478
|
+
importSet.add(`${element.propertyName.escapedText} as ${element.name.escapedText}`);
|
|
479
|
+
} else {
|
|
480
|
+
importSet.add(element.name.escapedText);
|
|
481
|
+
}
|
|
478
482
|
});
|
|
479
483
|
}
|
|
480
484
|
s.remove(node.pos, node.end);
|
|
@@ -490,7 +494,7 @@ function transformCode(options) {
|
|
|
490
494
|
);
|
|
491
495
|
if (!options.staticImport) {
|
|
492
496
|
s.update(node.argument.literal.pos, node.argument.literal.end, `'${libName}'`);
|
|
493
|
-
return
|
|
497
|
+
return !!node.typeArguments;
|
|
494
498
|
}
|
|
495
499
|
const importSet = importMap.get(libName) ?? importMap.set(libName, /* @__PURE__ */ new Set()).get(libName);
|
|
496
500
|
let usedType = node.qualifier.escapedText;
|
|
@@ -529,7 +533,12 @@ function transformCode(options) {
|
|
|
529
533
|
return false;
|
|
530
534
|
}
|
|
531
535
|
if (ts.isModuleDeclaration(node)) {
|
|
532
|
-
|
|
536
|
+
if (node.body && ts.isModuleBlock(node.body) && !node.body.statements.some(
|
|
537
|
+
(s2) => ts.isExportAssignment(s2) || ts.isExportDeclaration(s2) || ts.isImportDeclaration(s2)
|
|
538
|
+
)) {
|
|
539
|
+
declareModules.push(s.slice(node.pos, node.end + 1));
|
|
540
|
+
}
|
|
541
|
+
return false;
|
|
533
542
|
}
|
|
534
543
|
});
|
|
535
544
|
importMap.forEach((importSet, libName) => {
|