Skip to content

Commit

Permalink
release: v4.2.3-dev.1
Browse files Browse the repository at this point in the history
  • Loading branch information
qmhc committed Sep 30, 2024
1 parent ed4224f commit c2399be
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## [4.2.3-dev.1](https://github.com/qmhc/vite-plugin-dts/compare/v4.2.3-dev.0...v4.2.3-dev.1) (2024-09-30)

## [4.2.3-dev.0](https://github.com/qmhc/vite-plugin-dts/compare/v4.2.2...v4.2.3-dev.0) (2024-09-30)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-dts",
"version": "4.2.3-dev.0",
"version": "4.2.3-dev.1",
"type": "module",
"packageManager": "[email protected]",
"license": "MIT",
Expand Down
23 changes: 7 additions & 16 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,16 @@ export function transformCode(options: {
return false
}

if (ts.isModuleDeclaration(node)) {
if (ts.isModuleDeclaration(node) && node.body && ts.isModuleBlock(node.body)) {
if (
ts.isIdentifier(node.name) &&
node.name.escapedText === 'global' &&
node.body.statements.some(isVLSNode)
) {
s.remove(node.pos, node.end + 1)
} else if (
node.modifiers?.[0] &&
node.modifiers[0].kind === ts.SyntaxKind.DeclareKeyword &&
node.body &&
ts.isModuleBlock(node.body) &&
!node.body.statements.some(
s => ts.isExportAssignment(s) || ts.isExportDeclaration(s) || ts.isImportDeclaration(s)
)
Expand All @@ -247,19 +251,6 @@ export function transformCode(options: {

return false
}

if (
ts.isModuleDeclaration(node) &&
node.body &&
ts.isModuleBlock(node.body) &&
ts.isIdentifier(node.name) &&
node.name.escapedText === 'global' &&
node.body.statements.some(isVLSNode)
) {
s.remove(node.pos, node.end + 1)

return false
}
})

let prependImports = ''
Expand Down

0 comments on commit c2399be

Please sign in to comment.