vite-plugin-dts 4.5.0 → 4.5.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/dist/index.cjs +14 -9
- package/dist/index.mjs +14 -9
- package/package.json +14 -14
package/dist/index.cjs
CHANGED
|
@@ -535,7 +535,7 @@ function isAliasMatch(alias, importer) {
|
|
|
535
535
|
return importer.indexOf(alias.find) === 0 && (alias.find.endsWith("/") || importer.substring(alias.find.length)[0] === "/");
|
|
536
536
|
}
|
|
537
537
|
function transformAlias(importer, dir, aliases, aliasesExclude) {
|
|
538
|
-
if (aliases
|
|
538
|
+
if (aliases?.length && !aliasesExclude.some((e) => isRegExp(e) ? e.test(importer) : String(e) === importer)) {
|
|
539
539
|
const matchedAlias = aliases.find((alias) => isAliasMatch(alias, importer));
|
|
540
540
|
if (matchedAlias) {
|
|
541
541
|
const replacement = node_path.isAbsolute(matchedAlias.replacement) ? normalizePath(node_path.relative(dir, matchedAlias.replacement)) : normalizePath(matchedAlias.replacement);
|
|
@@ -597,7 +597,7 @@ function transformCode(options) {
|
|
|
597
597
|
if (node.importClause.namedBindings && ts__default.isNamedImports(node.importClause.namedBindings)) {
|
|
598
598
|
node.importClause.namedBindings.elements.forEach((element) => {
|
|
599
599
|
if (element.propertyName) {
|
|
600
|
-
importSet.add(`${element.propertyName.
|
|
600
|
+
importSet.add(`${element.propertyName.getText(ast)} as ${element.name.escapedText}`);
|
|
601
601
|
} else {
|
|
602
602
|
importSet.add(element.name.escapedText);
|
|
603
603
|
}
|
|
@@ -649,10 +649,16 @@ function transformCode(options) {
|
|
|
649
649
|
if (ts__default.isModuleDeclaration(node) && node.body && ts__default.isModuleBlock(node.body)) {
|
|
650
650
|
if (ts__default.isIdentifier(node.name) && node.name.escapedText === "global" && node.body.statements.some(isVLSNode)) {
|
|
651
651
|
s.remove(node.pos, node.end);
|
|
652
|
-
} else if (
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
652
|
+
} else if (ts__default.isStringLiteral(node.name)) {
|
|
653
|
+
const libName = toLibName(node.name.text);
|
|
654
|
+
if (libName !== node.name.text) {
|
|
655
|
+
s.update(node.name.pos, node.name.end, ` '${libName}'`);
|
|
656
|
+
}
|
|
657
|
+
if (!libName.startsWith(".") && node.modifiers?.[0] && node.modifiers[0].kind === ts__default.SyntaxKind.DeclareKeyword && !node.body.statements.some(
|
|
658
|
+
(s2) => ts__default.isExportAssignment(s2) || ts__default.isExportDeclaration(s2) || ts__default.isImportDeclaration(s2)
|
|
659
|
+
)) {
|
|
660
|
+
declareModules.push(s.slice(node.pos, node.end + 1));
|
|
661
|
+
}
|
|
656
662
|
}
|
|
657
663
|
return false;
|
|
658
664
|
}
|
|
@@ -676,7 +682,7 @@ function hasNormalExport(content) {
|
|
|
676
682
|
if (ts__default.isExportDeclaration(node)) {
|
|
677
683
|
if (node.exportClause && ts__default.isNamedExports(node.exportClause)) {
|
|
678
684
|
for (const element of node.exportClause.elements) {
|
|
679
|
-
if (element.name.
|
|
685
|
+
if (element.name.getText(ast) !== "default") {
|
|
680
686
|
has = true;
|
|
681
687
|
break;
|
|
682
688
|
}
|
|
@@ -704,7 +710,7 @@ function hasExportDefault(content) {
|
|
|
704
710
|
has = true;
|
|
705
711
|
} else if (ts__default.isExportDeclaration(node) && node.exportClause && ts__default.isNamedExports(node.exportClause)) {
|
|
706
712
|
for (const element of node.exportClause.elements) {
|
|
707
|
-
if (element.name.
|
|
713
|
+
if (element.name.getText(ast) === "default") {
|
|
708
714
|
has = true;
|
|
709
715
|
break;
|
|
710
716
|
}
|
|
@@ -737,7 +743,6 @@ const fixedCompilerOptions = {
|
|
|
737
743
|
noEmit: false,
|
|
738
744
|
declaration: true,
|
|
739
745
|
emitDeclarationOnly: true,
|
|
740
|
-
noUnusedParameters: false,
|
|
741
746
|
checkJs: false,
|
|
742
747
|
skipLibCheck: true,
|
|
743
748
|
preserveSymlinks: false,
|
package/dist/index.mjs
CHANGED
|
@@ -531,7 +531,7 @@ function isAliasMatch(alias, importer) {
|
|
|
531
531
|
return importer.indexOf(alias.find) === 0 && (alias.find.endsWith("/") || importer.substring(alias.find.length)[0] === "/");
|
|
532
532
|
}
|
|
533
533
|
function transformAlias(importer, dir, aliases, aliasesExclude) {
|
|
534
|
-
if (aliases
|
|
534
|
+
if (aliases?.length && !aliasesExclude.some((e) => isRegExp(e) ? e.test(importer) : String(e) === importer)) {
|
|
535
535
|
const matchedAlias = aliases.find((alias) => isAliasMatch(alias, importer));
|
|
536
536
|
if (matchedAlias) {
|
|
537
537
|
const replacement = isAbsolute(matchedAlias.replacement) ? normalizePath(relative(dir, matchedAlias.replacement)) : normalizePath(matchedAlias.replacement);
|
|
@@ -593,7 +593,7 @@ function transformCode(options) {
|
|
|
593
593
|
if (node.importClause.namedBindings && ts.isNamedImports(node.importClause.namedBindings)) {
|
|
594
594
|
node.importClause.namedBindings.elements.forEach((element) => {
|
|
595
595
|
if (element.propertyName) {
|
|
596
|
-
importSet.add(`${element.propertyName.
|
|
596
|
+
importSet.add(`${element.propertyName.getText(ast)} as ${element.name.escapedText}`);
|
|
597
597
|
} else {
|
|
598
598
|
importSet.add(element.name.escapedText);
|
|
599
599
|
}
|
|
@@ -645,10 +645,16 @@ function transformCode(options) {
|
|
|
645
645
|
if (ts.isModuleDeclaration(node) && node.body && ts.isModuleBlock(node.body)) {
|
|
646
646
|
if (ts.isIdentifier(node.name) && node.name.escapedText === "global" && node.body.statements.some(isVLSNode)) {
|
|
647
647
|
s.remove(node.pos, node.end);
|
|
648
|
-
} else if (
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
648
|
+
} else if (ts.isStringLiteral(node.name)) {
|
|
649
|
+
const libName = toLibName(node.name.text);
|
|
650
|
+
if (libName !== node.name.text) {
|
|
651
|
+
s.update(node.name.pos, node.name.end, ` '${libName}'`);
|
|
652
|
+
}
|
|
653
|
+
if (!libName.startsWith(".") && node.modifiers?.[0] && node.modifiers[0].kind === ts.SyntaxKind.DeclareKeyword && !node.body.statements.some(
|
|
654
|
+
(s2) => ts.isExportAssignment(s2) || ts.isExportDeclaration(s2) || ts.isImportDeclaration(s2)
|
|
655
|
+
)) {
|
|
656
|
+
declareModules.push(s.slice(node.pos, node.end + 1));
|
|
657
|
+
}
|
|
652
658
|
}
|
|
653
659
|
return false;
|
|
654
660
|
}
|
|
@@ -672,7 +678,7 @@ function hasNormalExport(content) {
|
|
|
672
678
|
if (ts.isExportDeclaration(node)) {
|
|
673
679
|
if (node.exportClause && ts.isNamedExports(node.exportClause)) {
|
|
674
680
|
for (const element of node.exportClause.elements) {
|
|
675
|
-
if (element.name.
|
|
681
|
+
if (element.name.getText(ast) !== "default") {
|
|
676
682
|
has = true;
|
|
677
683
|
break;
|
|
678
684
|
}
|
|
@@ -700,7 +706,7 @@ function hasExportDefault(content) {
|
|
|
700
706
|
has = true;
|
|
701
707
|
} else if (ts.isExportDeclaration(node) && node.exportClause && ts.isNamedExports(node.exportClause)) {
|
|
702
708
|
for (const element of node.exportClause.elements) {
|
|
703
|
-
if (element.name.
|
|
709
|
+
if (element.name.getText(ast) === "default") {
|
|
704
710
|
has = true;
|
|
705
711
|
break;
|
|
706
712
|
}
|
|
@@ -733,7 +739,6 @@ const fixedCompilerOptions = {
|
|
|
733
739
|
noEmit: false,
|
|
734
740
|
declaration: true,
|
|
735
741
|
emitDeclarationOnly: true,
|
|
736
|
-
noUnusedParameters: false,
|
|
737
742
|
checkJs: false,
|
|
738
743
|
skipLibCheck: true,
|
|
739
744
|
preserveSymlinks: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-dts",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "qmhc",
|
|
@@ -36,27 +36,27 @@
|
|
|
36
36
|
"url": "https://github.com/qmhc/vite-plugin-dts/issues"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@microsoft/api-extractor": "^7.
|
|
39
|
+
"@microsoft/api-extractor": "^7.50.1",
|
|
40
40
|
"@rollup/pluginutils": "^5.1.4",
|
|
41
41
|
"@volar/typescript": "^2.4.11",
|
|
42
|
-
"@vue/language-core": "2.2.
|
|
42
|
+
"@vue/language-core": "2.2.4",
|
|
43
43
|
"compare-versions": "^6.1.1",
|
|
44
44
|
"debug": "^4.4.0",
|
|
45
45
|
"kolorist": "^1.8.0",
|
|
46
|
-
"local-pkg": "^0.
|
|
46
|
+
"local-pkg": "^1.0.0",
|
|
47
47
|
"magic-string": "^0.30.17"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@commitlint/cli": "^19.
|
|
50
|
+
"@commitlint/cli": "^19.7.1",
|
|
51
51
|
"@types/debug": "^4.1.12",
|
|
52
52
|
"@types/minimist": "^1.2.5",
|
|
53
|
-
"@types/node": "^22.
|
|
53
|
+
"@types/node": "^22.13.5",
|
|
54
54
|
"@types/prompts": "^2.4.9",
|
|
55
55
|
"@types/semver": "^7.5.8",
|
|
56
56
|
"@vexip-ui/commitlint-config": "^0.5.0",
|
|
57
57
|
"@vexip-ui/eslint-config": "^0.12.1",
|
|
58
58
|
"@vexip-ui/prettier-config": "^1.0.0",
|
|
59
|
-
"@vexip-ui/scripts": "^1.
|
|
59
|
+
"@vexip-ui/scripts": "^1.2.0",
|
|
60
60
|
"@vue/eslint-config-standard": "^8.0.1",
|
|
61
61
|
"@vue/eslint-config-typescript": "^13.0.0",
|
|
62
62
|
"conventional-changelog-cli": "^5.0.0",
|
|
@@ -64,19 +64,19 @@
|
|
|
64
64
|
"execa": "^9.5.2",
|
|
65
65
|
"husky": "^9.1.7",
|
|
66
66
|
"is-ci": "^4.1.0",
|
|
67
|
-
"lint-staged": "^15.3
|
|
67
|
+
"lint-staged": "^15.4.3",
|
|
68
68
|
"minimist": "^1.2.8",
|
|
69
69
|
"pinst": "^3.0.0",
|
|
70
|
-
"prettier": "^3.
|
|
70
|
+
"prettier": "^3.5.2",
|
|
71
71
|
"pretty-quick": "^4.0.0",
|
|
72
72
|
"prompts": "^2.4.2",
|
|
73
73
|
"rimraf": "^6.0.1",
|
|
74
|
-
"semver": "^7.
|
|
75
|
-
"tsx": "^4.19.
|
|
74
|
+
"semver": "^7.7.1",
|
|
75
|
+
"tsx": "^4.19.3",
|
|
76
76
|
"typescript": "5.7.3",
|
|
77
|
-
"unbuild": "^3.
|
|
78
|
-
"vite": "^6.0
|
|
79
|
-
"vitest": "^
|
|
77
|
+
"unbuild": "^3.3.1",
|
|
78
|
+
"vite": "^6.2.0",
|
|
79
|
+
"vitest": "^3.0.7"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"typescript": "*",
|