vite-plugin-dts 3.8.1 → 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 CHANGED
@@ -497,7 +497,7 @@ function transformCode(options) {
497
497
  );
498
498
  if (!options.staticImport) {
499
499
  s.update(node.argument.literal.pos, node.argument.literal.end, `'${libName}'`);
500
- return false;
500
+ return !!node.typeArguments;
501
501
  }
502
502
  const importSet = importMap.get(libName) ?? importMap.set(libName, /* @__PURE__ */ new Set()).get(libName);
503
503
  let usedType = node.qualifier.escapedText;
@@ -536,7 +536,12 @@ function transformCode(options) {
536
536
  return false;
537
537
  }
538
538
  if (ts__default.isModuleDeclaration(node)) {
539
- declareModules.push(s.slice(node.pos, node.end + 1));
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;
540
545
  }
541
546
  });
542
547
  importMap.forEach((importSet, libName) => {
package/dist/index.mjs CHANGED
@@ -494,7 +494,7 @@ function transformCode(options) {
494
494
  );
495
495
  if (!options.staticImport) {
496
496
  s.update(node.argument.literal.pos, node.argument.literal.end, `'${libName}'`);
497
- return false;
497
+ return !!node.typeArguments;
498
498
  }
499
499
  const importSet = importMap.get(libName) ?? importMap.set(libName, /* @__PURE__ */ new Set()).get(libName);
500
500
  let usedType = node.qualifier.escapedText;
@@ -533,7 +533,12 @@ function transformCode(options) {
533
533
  return false;
534
534
  }
535
535
  if (ts.isModuleDeclaration(node)) {
536
- declareModules.push(s.slice(node.pos, node.end + 1));
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;
537
542
  }
538
543
  });
539
544
  importMap.forEach((importSet, libName) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-dts",
3
- "version": "3.8.1",
3
+ "version": "3.8.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "qmhc",