vite-plugin-dts 4.0.0 → 4.0.1
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/LICENSE +21 -21
- package/README.md +408 -408
- package/README.zh-CN.md +408 -408
- package/dist/index.cjs +11 -7
- package/dist/index.mjs +11 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -661,16 +661,20 @@ function transformCode(options) {
|
|
|
661
661
|
diffLineCount: importMap.size && importCount < importMap.size ? importMap.size - importCount : null
|
|
662
662
|
};
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function hasNormalExport(content) {
|
|
665
665
|
const ast = ts__default.createSourceFile("a.ts", content, ts__default.ScriptTarget.Latest);
|
|
666
666
|
let has = false;
|
|
667
667
|
walkSourceFile(ast, (node) => {
|
|
668
|
-
if (ts__default.isExportDeclaration(node)
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
668
|
+
if (ts__default.isExportDeclaration(node)) {
|
|
669
|
+
if (node.exportClause && ts__default.isNamedExports(node.exportClause)) {
|
|
670
|
+
for (const element of node.exportClause.elements) {
|
|
671
|
+
if (element.name.escapedText !== "default") {
|
|
672
|
+
has = true;
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
673
675
|
}
|
|
676
|
+
} else {
|
|
677
|
+
has = true;
|
|
674
678
|
}
|
|
675
679
|
} else if ("modifiers" in node && Array.isArray(node.modifiers) && node.modifiers.length > 1) {
|
|
676
680
|
for (let i = 0, len = node.modifiers.length; i < len; ++i) {
|
|
@@ -1183,7 +1187,7 @@ ${logPrefix} ${kolorist.yellow(
|
|
|
1183
1187
|
fromPath = fullRelativeRE.test(fromPath) ? fromPath : `./${fromPath}`;
|
|
1184
1188
|
let content = "";
|
|
1185
1189
|
if (emittedFiles.has(sourceEntry)) {
|
|
1186
|
-
if (
|
|
1190
|
+
if (hasNormalExport(emittedFiles.get(sourceEntry))) {
|
|
1187
1191
|
content += `export * from '${fromPath}'
|
|
1188
1192
|
`;
|
|
1189
1193
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -657,16 +657,20 @@ function transformCode(options) {
|
|
|
657
657
|
diffLineCount: importMap.size && importCount < importMap.size ? importMap.size - importCount : null
|
|
658
658
|
};
|
|
659
659
|
}
|
|
660
|
-
function
|
|
660
|
+
function hasNormalExport(content) {
|
|
661
661
|
const ast = ts.createSourceFile("a.ts", content, ts.ScriptTarget.Latest);
|
|
662
662
|
let has = false;
|
|
663
663
|
walkSourceFile(ast, (node) => {
|
|
664
|
-
if (ts.isExportDeclaration(node)
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
664
|
+
if (ts.isExportDeclaration(node)) {
|
|
665
|
+
if (node.exportClause && ts.isNamedExports(node.exportClause)) {
|
|
666
|
+
for (const element of node.exportClause.elements) {
|
|
667
|
+
if (element.name.escapedText !== "default") {
|
|
668
|
+
has = true;
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
669
671
|
}
|
|
672
|
+
} else {
|
|
673
|
+
has = true;
|
|
670
674
|
}
|
|
671
675
|
} else if ("modifiers" in node && Array.isArray(node.modifiers) && node.modifiers.length > 1) {
|
|
672
676
|
for (let i = 0, len = node.modifiers.length; i < len; ++i) {
|
|
@@ -1179,7 +1183,7 @@ ${logPrefix} ${yellow(
|
|
|
1179
1183
|
fromPath = fullRelativeRE.test(fromPath) ? fromPath : `./${fromPath}`;
|
|
1180
1184
|
let content = "";
|
|
1181
1185
|
if (emittedFiles.has(sourceEntry)) {
|
|
1182
|
-
if (
|
|
1186
|
+
if (hasNormalExport(emittedFiles.get(sourceEntry))) {
|
|
1183
1187
|
content += `export * from '${fromPath}'
|
|
1184
1188
|
`;
|
|
1185
1189
|
}
|