vite-plugin-dts 4.2.2-dev.0 → 4.2.3-dev.0
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 +18 -0
- package/dist/index.mjs +18 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -525,6 +525,20 @@ function transformAlias(importer, dir, aliases, aliasesExclude) {
|
|
|
525
525
|
}
|
|
526
526
|
return importer;
|
|
527
527
|
}
|
|
528
|
+
function isVLSNode(node) {
|
|
529
|
+
if (ts__default.isVariableStatement(node)) {
|
|
530
|
+
return node.declarationList.declarations.some(
|
|
531
|
+
(d) => ts__default.isIdentifier(d.name) && `${d.name.escapedText}`.startsWith("__VLS_")
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
if (ts__default.isTypeAliasDeclaration(node)) {
|
|
535
|
+
return `${node.name.escapedText}`.startsWith("__VLS_");
|
|
536
|
+
}
|
|
537
|
+
if (ts__default.isFunctionDeclaration(node)) {
|
|
538
|
+
return !!node.name && `${node.name.escapedText}`.startsWith("__VLS_");
|
|
539
|
+
}
|
|
540
|
+
return false;
|
|
541
|
+
}
|
|
528
542
|
function transformCode(options) {
|
|
529
543
|
const s = new MagicString__default(options.content);
|
|
530
544
|
const ast = ts__default.createSourceFile("a.ts", options.content, ts__default.ScriptTarget.Latest);
|
|
@@ -611,6 +625,10 @@ function transformCode(options) {
|
|
|
611
625
|
}
|
|
612
626
|
return false;
|
|
613
627
|
}
|
|
628
|
+
if (ts__default.isModuleDeclaration(node) && node.body && ts__default.isModuleBlock(node.body) && ts__default.isIdentifier(node.name) && node.name.escapedText === "global" && node.body.statements.some(isVLSNode)) {
|
|
629
|
+
s.remove(node.pos, node.end + 1);
|
|
630
|
+
return false;
|
|
631
|
+
}
|
|
614
632
|
});
|
|
615
633
|
let prependImports = "";
|
|
616
634
|
importMap.forEach((importSet, libName) => {
|
package/dist/index.mjs
CHANGED
|
@@ -521,6 +521,20 @@ function transformAlias(importer, dir, aliases, aliasesExclude) {
|
|
|
521
521
|
}
|
|
522
522
|
return importer;
|
|
523
523
|
}
|
|
524
|
+
function isVLSNode(node) {
|
|
525
|
+
if (ts.isVariableStatement(node)) {
|
|
526
|
+
return node.declarationList.declarations.some(
|
|
527
|
+
(d) => ts.isIdentifier(d.name) && `${d.name.escapedText}`.startsWith("__VLS_")
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
if (ts.isTypeAliasDeclaration(node)) {
|
|
531
|
+
return `${node.name.escapedText}`.startsWith("__VLS_");
|
|
532
|
+
}
|
|
533
|
+
if (ts.isFunctionDeclaration(node)) {
|
|
534
|
+
return !!node.name && `${node.name.escapedText}`.startsWith("__VLS_");
|
|
535
|
+
}
|
|
536
|
+
return false;
|
|
537
|
+
}
|
|
524
538
|
function transformCode(options) {
|
|
525
539
|
const s = new MagicString(options.content);
|
|
526
540
|
const ast = ts.createSourceFile("a.ts", options.content, ts.ScriptTarget.Latest);
|
|
@@ -607,6 +621,10 @@ function transformCode(options) {
|
|
|
607
621
|
}
|
|
608
622
|
return false;
|
|
609
623
|
}
|
|
624
|
+
if (ts.isModuleDeclaration(node) && node.body && ts.isModuleBlock(node.body) && ts.isIdentifier(node.name) && node.name.escapedText === "global" && node.body.statements.some(isVLSNode)) {
|
|
625
|
+
s.remove(node.pos, node.end + 1);
|
|
626
|
+
return false;
|
|
627
|
+
}
|
|
610
628
|
});
|
|
611
629
|
let prependImports = "";
|
|
612
630
|
importMap.forEach((importSet, libName) => {
|