vite-plugin-dts 4.4.0 → 4.5.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 +26 -44
- package/dist/index.mjs +25 -43
- package/package.json +33 -37
package/dist/index.cjs
CHANGED
|
@@ -198,7 +198,7 @@ function tryGetPkgPath(beginPath) {
|
|
|
198
198
|
}
|
|
199
199
|
const parentDir = normalizePath(node_path.dirname(beginPath));
|
|
200
200
|
if (!parentDir || parentDir === beginPath) {
|
|
201
|
-
pkgPathCache.set(beginPath,
|
|
201
|
+
pkgPathCache.set(beginPath, undefined);
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
return tryGetPkgPath(parentDir);
|
|
@@ -214,16 +214,13 @@ function toCapitalCase(value) {
|
|
|
214
214
|
function findTypesPath(...pkgs) {
|
|
215
215
|
let path;
|
|
216
216
|
for (const pkg of pkgs) {
|
|
217
|
-
if (typeof pkg !== "object")
|
|
218
|
-
continue;
|
|
217
|
+
if (typeof pkg !== "object") continue;
|
|
219
218
|
path = pkg.types || pkg.typings || pkg.exports?.types || pkg.exports?.["."]?.types || pkg.exports?.["./"]?.types;
|
|
220
|
-
if (path)
|
|
221
|
-
return path;
|
|
219
|
+
if (path) return path;
|
|
222
220
|
}
|
|
223
221
|
}
|
|
224
222
|
function setModuleResolution(options) {
|
|
225
|
-
if (options.moduleResolution)
|
|
226
|
-
return;
|
|
223
|
+
if (options.moduleResolution) return;
|
|
227
224
|
const module = typeof options.module === "number" ? options.module : options.target ?? ts__default.ScriptTarget.ES5 >= 2 ? ts__default.ModuleKind.ES2015 : ts__default.ModuleKind.CommonJS;
|
|
228
225
|
let moduleResolution;
|
|
229
226
|
switch (module) {
|
|
@@ -310,7 +307,7 @@ function importResolves(path) {
|
|
|
310
307
|
}
|
|
311
308
|
function tryGetPackageInfo(name) {
|
|
312
309
|
if (process.versions.pnp) {
|
|
313
|
-
const targetRequire = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
310
|
+
const targetRequire = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
314
311
|
try {
|
|
315
312
|
return localPkg.getPackageInfoSync(
|
|
316
313
|
targetRequire.resolve(`${name}/package.json`, { paths: [process.cwd()] })
|
|
@@ -420,8 +417,7 @@ function JsonResolver() {
|
|
|
420
417
|
},
|
|
421
418
|
transform({ id, root, program }) {
|
|
422
419
|
const sourceFile = program.getSourceFile(id);
|
|
423
|
-
if (!sourceFile)
|
|
424
|
-
return [];
|
|
420
|
+
if (!sourceFile) return [];
|
|
425
421
|
return [
|
|
426
422
|
{
|
|
427
423
|
path: node_path.relative(root, `${id}.d.ts`),
|
|
@@ -438,8 +434,7 @@ export default _default;
|
|
|
438
434
|
const svelteRE = /\.svelte$/;
|
|
439
435
|
let lowerVersion;
|
|
440
436
|
function querySvelteVersion() {
|
|
441
|
-
if (typeof lowerVersion === "boolean")
|
|
442
|
-
return;
|
|
437
|
+
if (typeof lowerVersion === "boolean") return;
|
|
443
438
|
try {
|
|
444
439
|
const version = tryGetPackageInfo("svelte")?.version;
|
|
445
440
|
lowerVersion = version ? compareVersions.compare(version, "4.0.0", "<") : false;
|
|
@@ -475,19 +470,17 @@ function VueResolver() {
|
|
|
475
470
|
},
|
|
476
471
|
transform({ id, code, program }) {
|
|
477
472
|
const sourceFile = program.getSourceFile(id) || program.getSourceFile(id + ".ts") || program.getSourceFile(id + ".js") || program.getSourceFile(id + ".tsx") || program.getSourceFile(id + ".jsx");
|
|
478
|
-
if (!sourceFile)
|
|
479
|
-
return [];
|
|
473
|
+
if (!sourceFile) return [];
|
|
480
474
|
const outputs = [];
|
|
481
475
|
program.emit(
|
|
482
476
|
sourceFile,
|
|
483
477
|
(path, content) => {
|
|
484
478
|
outputs.push({ path, content });
|
|
485
479
|
},
|
|
486
|
-
|
|
480
|
+
undefined,
|
|
487
481
|
true
|
|
488
482
|
);
|
|
489
|
-
if (!program.getCompilerOptions().declarationMap)
|
|
490
|
-
return outputs;
|
|
483
|
+
if (!program.getCompilerOptions().declarationMap) return outputs;
|
|
491
484
|
const [beforeScript] = code.split(/\s*<script.*>/);
|
|
492
485
|
const beforeLines = beforeScript.split("\n").length;
|
|
493
486
|
for (const output of outputs) {
|
|
@@ -536,12 +529,9 @@ function walkSourceFile(sourceFile, callback) {
|
|
|
536
529
|
sourceFile.forEachChild((child) => walkNode(child, sourceFile, callback));
|
|
537
530
|
}
|
|
538
531
|
function isAliasMatch(alias, importer) {
|
|
539
|
-
if (isRegExp(alias.find))
|
|
540
|
-
|
|
541
|
-
if (importer
|
|
542
|
-
return false;
|
|
543
|
-
if (importer === alias.find)
|
|
544
|
-
return true;
|
|
532
|
+
if (isRegExp(alias.find)) return alias.find.test(importer);
|
|
533
|
+
if (importer.length < alias.find.length) return false;
|
|
534
|
+
if (importer === alias.find) return true;
|
|
545
535
|
return importer.indexOf(alias.find) === 0 && (alias.find.endsWith("/") || importer.substring(alias.find.length)[0] === "/");
|
|
546
536
|
}
|
|
547
537
|
function transformAlias(importer, dir, aliases, aliasesExclude) {
|
|
@@ -557,10 +547,8 @@ function transformAlias(importer, dir, aliases, aliasesExclude) {
|
|
|
557
547
|
const absolutePath = node_path.resolve(dir, truthPath);
|
|
558
548
|
const normalizedPath = normalizePath(node_path.relative(dir, absolutePath));
|
|
559
549
|
const resultPath = normalizedPath.startsWith(".") ? normalizedPath : `./${normalizedPath}`;
|
|
560
|
-
if (!isAliasGlobal(matchedAlias))
|
|
561
|
-
|
|
562
|
-
if (importResolves(absolutePath))
|
|
563
|
-
return resultPath;
|
|
550
|
+
if (!isAliasGlobal(matchedAlias)) return resultPath;
|
|
551
|
+
if (importResolves(absolutePath)) return resultPath;
|
|
564
552
|
}
|
|
565
553
|
}
|
|
566
554
|
return importer;
|
|
@@ -753,7 +741,7 @@ const fixedCompilerOptions = {
|
|
|
753
741
|
checkJs: false,
|
|
754
742
|
skipLibCheck: true,
|
|
755
743
|
preserveSymlinks: false,
|
|
756
|
-
noEmitOnError:
|
|
744
|
+
noEmitOnError: undefined,
|
|
757
745
|
target: ts__default.ScriptTarget.ESNext
|
|
758
746
|
};
|
|
759
747
|
const noop = () => {
|
|
@@ -883,8 +871,7 @@ ${logPrefix} ${kolorist.yellow(
|
|
|
883
871
|
bundleDebug("parse vite config");
|
|
884
872
|
},
|
|
885
873
|
options(options2) {
|
|
886
|
-
if (entries)
|
|
887
|
-
return;
|
|
874
|
+
if (entries) return;
|
|
888
875
|
const input = typeof options2.input === "string" ? [options2.input] : options2.input;
|
|
889
876
|
if (Array.isArray(input)) {
|
|
890
877
|
entries = input.reduce(
|
|
@@ -904,13 +891,12 @@ ${logPrefix} ${kolorist.yellow(
|
|
|
904
891
|
bundleDebug("parse options");
|
|
905
892
|
},
|
|
906
893
|
async buildStart() {
|
|
907
|
-
if (program)
|
|
908
|
-
return;
|
|
894
|
+
if (program) return;
|
|
909
895
|
bundleDebug("begin buildStart");
|
|
910
896
|
timeRecord = 0;
|
|
911
897
|
const startTime = Date.now();
|
|
912
898
|
configPath = tsconfigPath ? ensureAbsolute(tsconfigPath, root) : ts__default.findConfigFile(root, ts__default.sys.fileExists);
|
|
913
|
-
const content = configPath ? languageCore.createParsedCommandLine(ts__default, ts__default.sys, configPath) :
|
|
899
|
+
const content = configPath ? languageCore.createParsedCommandLine(ts__default, ts__default.sys, configPath) : undefined;
|
|
914
900
|
compilerOptions = {
|
|
915
901
|
...content?.options || {},
|
|
916
902
|
...options.compilerOptions || {},
|
|
@@ -934,7 +920,7 @@ ${logPrefix} ${kolorist.yellow(
|
|
|
934
920
|
// Here we are using the default value to set the `baseUrl` to the current directory if no value exists. This is
|
|
935
921
|
// the same behavior as the TS Compiler. See TS source:
|
|
936
922
|
// https://github.com/microsoft/TypeScript/blob/3386e943215613c40f68ba0b108cda1ddb7faee1/src/compiler/utilities.ts#L6493-L6501
|
|
937
|
-
baseUrl = compilerOptions.paths ? process.cwd() :
|
|
923
|
+
baseUrl = compilerOptions.paths ? process.cwd() : undefined,
|
|
938
924
|
paths
|
|
939
925
|
} = compilerOptions;
|
|
940
926
|
if (pathsToAliases && baseUrl && paths) {
|
|
@@ -1044,7 +1030,7 @@ ${logPrefix} ${kolorist.yellow(
|
|
|
1044
1030
|
text
|
|
1045
1031
|
);
|
|
1046
1032
|
},
|
|
1047
|
-
|
|
1033
|
+
undefined,
|
|
1048
1034
|
true
|
|
1049
1035
|
);
|
|
1050
1036
|
}
|
|
@@ -1073,8 +1059,7 @@ ${logPrefix} ${kolorist.yellow(
|
|
|
1073
1059
|
},
|
|
1074
1060
|
async writeBundle() {
|
|
1075
1061
|
transformedFiles.clear();
|
|
1076
|
-
if (!host || !program || bundled)
|
|
1077
|
-
return;
|
|
1062
|
+
if (!host || !program || bundled) return;
|
|
1078
1063
|
bundled = true;
|
|
1079
1064
|
bundleDebug("begin writeBundle");
|
|
1080
1065
|
logger.info(kolorist.green(`
|
|
@@ -1086,8 +1071,7 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
1086
1071
|
const writeOutput = async (path, content, outDir2, record = true) => {
|
|
1087
1072
|
if (typeof beforeWriteFile === "function") {
|
|
1088
1073
|
const result = await unwrapPromise(beforeWriteFile(path, content));
|
|
1089
|
-
if (result === false)
|
|
1090
|
-
return;
|
|
1074
|
+
if (result === false) return;
|
|
1091
1075
|
if (result) {
|
|
1092
1076
|
path = result.filePath || path;
|
|
1093
1077
|
content = result.content ?? content;
|
|
@@ -1107,8 +1091,7 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
1107
1091
|
};
|
|
1108
1092
|
const sourceFiles = program.getSourceFiles();
|
|
1109
1093
|
for (const sourceFile of sourceFiles) {
|
|
1110
|
-
if (!filter(sourceFile.fileName))
|
|
1111
|
-
continue;
|
|
1094
|
+
if (!filter(sourceFile.fileName)) continue;
|
|
1112
1095
|
if (copyDtsFiles && dtsRE.test(sourceFile.fileName)) {
|
|
1113
1096
|
setOutputFile(normalizePath(sourceFile.fileName), sourceFile.getFullText());
|
|
1114
1097
|
}
|
|
@@ -1121,7 +1104,7 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
1121
1104
|
text
|
|
1122
1105
|
);
|
|
1123
1106
|
},
|
|
1124
|
-
|
|
1107
|
+
undefined,
|
|
1125
1108
|
true
|
|
1126
1109
|
);
|
|
1127
1110
|
rootFiles.delete(sourceFile.fileName);
|
|
@@ -1228,8 +1211,7 @@ ${logPrefix} ${kolorist.yellow(
|
|
|
1228
1211
|
}
|
|
1229
1212
|
for (const name of entryNames) {
|
|
1230
1213
|
const entryDtsPath = multiple ? cleanPath(resolve(outDir, tsToDts(name)), emittedFiles) : typesPath;
|
|
1231
|
-
if (node_fs.existsSync(entryDtsPath))
|
|
1232
|
-
continue;
|
|
1214
|
+
if (node_fs.existsSync(entryDtsPath)) continue;
|
|
1233
1215
|
const sourceEntry = normalizePath(
|
|
1234
1216
|
cleanPath(resolve(outDir, node_path.relative(entryRoot, tsToDts(entries[name]))), emittedFiles)
|
|
1235
1217
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -194,7 +194,7 @@ function tryGetPkgPath(beginPath) {
|
|
|
194
194
|
}
|
|
195
195
|
const parentDir = normalizePath(dirname(beginPath));
|
|
196
196
|
if (!parentDir || parentDir === beginPath) {
|
|
197
|
-
pkgPathCache.set(beginPath,
|
|
197
|
+
pkgPathCache.set(beginPath, undefined);
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
200
|
return tryGetPkgPath(parentDir);
|
|
@@ -210,16 +210,13 @@ function toCapitalCase(value) {
|
|
|
210
210
|
function findTypesPath(...pkgs) {
|
|
211
211
|
let path;
|
|
212
212
|
for (const pkg of pkgs) {
|
|
213
|
-
if (typeof pkg !== "object")
|
|
214
|
-
continue;
|
|
213
|
+
if (typeof pkg !== "object") continue;
|
|
215
214
|
path = pkg.types || pkg.typings || pkg.exports?.types || pkg.exports?.["."]?.types || pkg.exports?.["./"]?.types;
|
|
216
|
-
if (path)
|
|
217
|
-
return path;
|
|
215
|
+
if (path) return path;
|
|
218
216
|
}
|
|
219
217
|
}
|
|
220
218
|
function setModuleResolution(options) {
|
|
221
|
-
if (options.moduleResolution)
|
|
222
|
-
return;
|
|
219
|
+
if (options.moduleResolution) return;
|
|
223
220
|
const module = typeof options.module === "number" ? options.module : options.target ?? ts.ScriptTarget.ES5 >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
|
|
224
221
|
let moduleResolution;
|
|
225
222
|
switch (module) {
|
|
@@ -416,8 +413,7 @@ function JsonResolver() {
|
|
|
416
413
|
},
|
|
417
414
|
transform({ id, root, program }) {
|
|
418
415
|
const sourceFile = program.getSourceFile(id);
|
|
419
|
-
if (!sourceFile)
|
|
420
|
-
return [];
|
|
416
|
+
if (!sourceFile) return [];
|
|
421
417
|
return [
|
|
422
418
|
{
|
|
423
419
|
path: relative(root, `${id}.d.ts`),
|
|
@@ -434,8 +430,7 @@ export default _default;
|
|
|
434
430
|
const svelteRE = /\.svelte$/;
|
|
435
431
|
let lowerVersion;
|
|
436
432
|
function querySvelteVersion() {
|
|
437
|
-
if (typeof lowerVersion === "boolean")
|
|
438
|
-
return;
|
|
433
|
+
if (typeof lowerVersion === "boolean") return;
|
|
439
434
|
try {
|
|
440
435
|
const version = tryGetPackageInfo("svelte")?.version;
|
|
441
436
|
lowerVersion = version ? compare(version, "4.0.0", "<") : false;
|
|
@@ -471,19 +466,17 @@ function VueResolver() {
|
|
|
471
466
|
},
|
|
472
467
|
transform({ id, code, program }) {
|
|
473
468
|
const sourceFile = program.getSourceFile(id) || program.getSourceFile(id + ".ts") || program.getSourceFile(id + ".js") || program.getSourceFile(id + ".tsx") || program.getSourceFile(id + ".jsx");
|
|
474
|
-
if (!sourceFile)
|
|
475
|
-
return [];
|
|
469
|
+
if (!sourceFile) return [];
|
|
476
470
|
const outputs = [];
|
|
477
471
|
program.emit(
|
|
478
472
|
sourceFile,
|
|
479
473
|
(path, content) => {
|
|
480
474
|
outputs.push({ path, content });
|
|
481
475
|
},
|
|
482
|
-
|
|
476
|
+
undefined,
|
|
483
477
|
true
|
|
484
478
|
);
|
|
485
|
-
if (!program.getCompilerOptions().declarationMap)
|
|
486
|
-
return outputs;
|
|
479
|
+
if (!program.getCompilerOptions().declarationMap) return outputs;
|
|
487
480
|
const [beforeScript] = code.split(/\s*<script.*>/);
|
|
488
481
|
const beforeLines = beforeScript.split("\n").length;
|
|
489
482
|
for (const output of outputs) {
|
|
@@ -532,12 +525,9 @@ function walkSourceFile(sourceFile, callback) {
|
|
|
532
525
|
sourceFile.forEachChild((child) => walkNode(child, sourceFile, callback));
|
|
533
526
|
}
|
|
534
527
|
function isAliasMatch(alias, importer) {
|
|
535
|
-
if (isRegExp(alias.find))
|
|
536
|
-
|
|
537
|
-
if (importer
|
|
538
|
-
return false;
|
|
539
|
-
if (importer === alias.find)
|
|
540
|
-
return true;
|
|
528
|
+
if (isRegExp(alias.find)) return alias.find.test(importer);
|
|
529
|
+
if (importer.length < alias.find.length) return false;
|
|
530
|
+
if (importer === alias.find) return true;
|
|
541
531
|
return importer.indexOf(alias.find) === 0 && (alias.find.endsWith("/") || importer.substring(alias.find.length)[0] === "/");
|
|
542
532
|
}
|
|
543
533
|
function transformAlias(importer, dir, aliases, aliasesExclude) {
|
|
@@ -553,10 +543,8 @@ function transformAlias(importer, dir, aliases, aliasesExclude) {
|
|
|
553
543
|
const absolutePath = resolve$1(dir, truthPath);
|
|
554
544
|
const normalizedPath = normalizePath(relative(dir, absolutePath));
|
|
555
545
|
const resultPath = normalizedPath.startsWith(".") ? normalizedPath : `./${normalizedPath}`;
|
|
556
|
-
if (!isAliasGlobal(matchedAlias))
|
|
557
|
-
|
|
558
|
-
if (importResolves(absolutePath))
|
|
559
|
-
return resultPath;
|
|
546
|
+
if (!isAliasGlobal(matchedAlias)) return resultPath;
|
|
547
|
+
if (importResolves(absolutePath)) return resultPath;
|
|
560
548
|
}
|
|
561
549
|
}
|
|
562
550
|
return importer;
|
|
@@ -749,7 +737,7 @@ const fixedCompilerOptions = {
|
|
|
749
737
|
checkJs: false,
|
|
750
738
|
skipLibCheck: true,
|
|
751
739
|
preserveSymlinks: false,
|
|
752
|
-
noEmitOnError:
|
|
740
|
+
noEmitOnError: undefined,
|
|
753
741
|
target: ts.ScriptTarget.ESNext
|
|
754
742
|
};
|
|
755
743
|
const noop = () => {
|
|
@@ -879,8 +867,7 @@ ${logPrefix} ${yellow(
|
|
|
879
867
|
bundleDebug("parse vite config");
|
|
880
868
|
},
|
|
881
869
|
options(options2) {
|
|
882
|
-
if (entries)
|
|
883
|
-
return;
|
|
870
|
+
if (entries) return;
|
|
884
871
|
const input = typeof options2.input === "string" ? [options2.input] : options2.input;
|
|
885
872
|
if (Array.isArray(input)) {
|
|
886
873
|
entries = input.reduce(
|
|
@@ -900,13 +887,12 @@ ${logPrefix} ${yellow(
|
|
|
900
887
|
bundleDebug("parse options");
|
|
901
888
|
},
|
|
902
889
|
async buildStart() {
|
|
903
|
-
if (program)
|
|
904
|
-
return;
|
|
890
|
+
if (program) return;
|
|
905
891
|
bundleDebug("begin buildStart");
|
|
906
892
|
timeRecord = 0;
|
|
907
893
|
const startTime = Date.now();
|
|
908
894
|
configPath = tsconfigPath ? ensureAbsolute(tsconfigPath, root) : ts.findConfigFile(root, ts.sys.fileExists);
|
|
909
|
-
const content = configPath ? createParsedCommandLine(ts, ts.sys, configPath) :
|
|
895
|
+
const content = configPath ? createParsedCommandLine(ts, ts.sys, configPath) : undefined;
|
|
910
896
|
compilerOptions = {
|
|
911
897
|
...content?.options || {},
|
|
912
898
|
...options.compilerOptions || {},
|
|
@@ -930,7 +916,7 @@ ${logPrefix} ${yellow(
|
|
|
930
916
|
// Here we are using the default value to set the `baseUrl` to the current directory if no value exists. This is
|
|
931
917
|
// the same behavior as the TS Compiler. See TS source:
|
|
932
918
|
// https://github.com/microsoft/TypeScript/blob/3386e943215613c40f68ba0b108cda1ddb7faee1/src/compiler/utilities.ts#L6493-L6501
|
|
933
|
-
baseUrl = compilerOptions.paths ? process.cwd() :
|
|
919
|
+
baseUrl = compilerOptions.paths ? process.cwd() : undefined,
|
|
934
920
|
paths
|
|
935
921
|
} = compilerOptions;
|
|
936
922
|
if (pathsToAliases && baseUrl && paths) {
|
|
@@ -1040,7 +1026,7 @@ ${logPrefix} ${yellow(
|
|
|
1040
1026
|
text
|
|
1041
1027
|
);
|
|
1042
1028
|
},
|
|
1043
|
-
|
|
1029
|
+
undefined,
|
|
1044
1030
|
true
|
|
1045
1031
|
);
|
|
1046
1032
|
}
|
|
@@ -1069,8 +1055,7 @@ ${logPrefix} ${yellow(
|
|
|
1069
1055
|
},
|
|
1070
1056
|
async writeBundle() {
|
|
1071
1057
|
transformedFiles.clear();
|
|
1072
|
-
if (!host || !program || bundled)
|
|
1073
|
-
return;
|
|
1058
|
+
if (!host || !program || bundled) return;
|
|
1074
1059
|
bundled = true;
|
|
1075
1060
|
bundleDebug("begin writeBundle");
|
|
1076
1061
|
logger.info(green(`
|
|
@@ -1082,8 +1067,7 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
1082
1067
|
const writeOutput = async (path, content, outDir2, record = true) => {
|
|
1083
1068
|
if (typeof beforeWriteFile === "function") {
|
|
1084
1069
|
const result = await unwrapPromise(beforeWriteFile(path, content));
|
|
1085
|
-
if (result === false)
|
|
1086
|
-
return;
|
|
1070
|
+
if (result === false) return;
|
|
1087
1071
|
if (result) {
|
|
1088
1072
|
path = result.filePath || path;
|
|
1089
1073
|
content = result.content ?? content;
|
|
@@ -1103,8 +1087,7 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
1103
1087
|
};
|
|
1104
1088
|
const sourceFiles = program.getSourceFiles();
|
|
1105
1089
|
for (const sourceFile of sourceFiles) {
|
|
1106
|
-
if (!filter(sourceFile.fileName))
|
|
1107
|
-
continue;
|
|
1090
|
+
if (!filter(sourceFile.fileName)) continue;
|
|
1108
1091
|
if (copyDtsFiles && dtsRE.test(sourceFile.fileName)) {
|
|
1109
1092
|
setOutputFile(normalizePath(sourceFile.fileName), sourceFile.getFullText());
|
|
1110
1093
|
}
|
|
@@ -1117,7 +1100,7 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
1117
1100
|
text
|
|
1118
1101
|
);
|
|
1119
1102
|
},
|
|
1120
|
-
|
|
1103
|
+
undefined,
|
|
1121
1104
|
true
|
|
1122
1105
|
);
|
|
1123
1106
|
rootFiles.delete(sourceFile.fileName);
|
|
@@ -1224,8 +1207,7 @@ ${logPrefix} ${yellow(
|
|
|
1224
1207
|
}
|
|
1225
1208
|
for (const name of entryNames) {
|
|
1226
1209
|
const entryDtsPath = multiple ? cleanPath(resolve(outDir, tsToDts(name)), emittedFiles) : typesPath;
|
|
1227
|
-
if (existsSync(entryDtsPath))
|
|
1228
|
-
continue;
|
|
1210
|
+
if (existsSync(entryDtsPath)) continue;
|
|
1229
1211
|
const sourceEntry = normalizePath(
|
|
1230
1212
|
cleanPath(resolve(outDir, relative(entryRoot, tsToDts(entries[name]))), emittedFiles)
|
|
1231
1213
|
);
|
package/package.json
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-dts",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"packageManager": "pnpm@9.13.2",
|
|
6
5
|
"license": "MIT",
|
|
7
6
|
"author": "qmhc",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build": "tsx scripts/build.ts",
|
|
10
|
-
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path .",
|
|
11
|
-
"dev": "unbuild --stub",
|
|
12
|
-
"_postinstall": "is-ci || husky install",
|
|
13
|
-
"lint": "eslint --ext .js,.jsx,.ts,.tsx \"{src,tests}/**\"",
|
|
14
|
-
"precommit": "lint-staged -c ./.husky/.lintstagedrc -q --allow-empty",
|
|
15
|
-
"prepublishOnly": "pinst --disable",
|
|
16
|
-
"prettier": "pretty-quick --staged && pnpm run lint",
|
|
17
|
-
"postpublish": "pinst --enable",
|
|
18
|
-
"release": "tsx scripts/release.ts",
|
|
19
|
-
"test": "vitest run",
|
|
20
|
-
"test:dev": "vitest",
|
|
21
|
-
"test:react": "pnpm -C examples/react build",
|
|
22
|
-
"test:svelte": "pnpm -C examples/svelte build",
|
|
23
|
-
"test:ts": "pnpm -C examples/ts build",
|
|
24
|
-
"test:vue": "pnpm -C examples/vue build"
|
|
25
|
-
},
|
|
26
7
|
"main": "dist/index.cjs",
|
|
27
8
|
"module": "dist/index.mjs",
|
|
28
9
|
"types": "dist/index.d.ts",
|
|
@@ -36,9 +17,6 @@
|
|
|
36
17
|
"files": [
|
|
37
18
|
"dist"
|
|
38
19
|
],
|
|
39
|
-
"engines": {
|
|
40
|
-
"node": "^14.18.0 || >=16.0.0"
|
|
41
|
-
},
|
|
42
20
|
"keywords": [
|
|
43
21
|
"vite",
|
|
44
22
|
"vite-plugin",
|
|
@@ -58,10 +36,10 @@
|
|
|
58
36
|
"url": "https://github.com/qmhc/vite-plugin-dts/issues"
|
|
59
37
|
},
|
|
60
38
|
"dependencies": {
|
|
61
|
-
"@microsoft/api-extractor": "^7.
|
|
39
|
+
"@microsoft/api-extractor": "^7.49.1",
|
|
62
40
|
"@rollup/pluginutils": "^5.1.4",
|
|
63
41
|
"@volar/typescript": "^2.4.11",
|
|
64
|
-
"@vue/language-core": "2.
|
|
42
|
+
"@vue/language-core": "2.2.0",
|
|
65
43
|
"compare-versions": "^6.1.1",
|
|
66
44
|
"debug": "^4.4.0",
|
|
67
45
|
"kolorist": "^1.8.0",
|
|
@@ -69,35 +47,36 @@
|
|
|
69
47
|
"magic-string": "^0.30.17"
|
|
70
48
|
},
|
|
71
49
|
"devDependencies": {
|
|
72
|
-
"@commitlint/cli": "^19.
|
|
50
|
+
"@commitlint/cli": "^19.6.1",
|
|
73
51
|
"@types/debug": "^4.1.12",
|
|
74
52
|
"@types/minimist": "^1.2.5",
|
|
75
|
-
"@types/node": "^22.
|
|
53
|
+
"@types/node": "^22.10.5",
|
|
76
54
|
"@types/prompts": "^2.4.9",
|
|
77
55
|
"@types/semver": "^7.5.8",
|
|
78
56
|
"@vexip-ui/commitlint-config": "^0.5.0",
|
|
79
57
|
"@vexip-ui/eslint-config": "^0.12.1",
|
|
80
58
|
"@vexip-ui/prettier-config": "^1.0.0",
|
|
59
|
+
"@vexip-ui/scripts": "^1.1.4",
|
|
81
60
|
"@vue/eslint-config-standard": "^8.0.1",
|
|
82
61
|
"@vue/eslint-config-typescript": "^13.0.0",
|
|
83
62
|
"conventional-changelog-cli": "^5.0.0",
|
|
84
63
|
"eslint": "^8.57.0",
|
|
85
|
-
"execa": "^
|
|
86
|
-
"husky": "^
|
|
87
|
-
"is-ci": "^
|
|
88
|
-
"lint-staged": "^15.
|
|
64
|
+
"execa": "^9.5.2",
|
|
65
|
+
"husky": "^9.1.7",
|
|
66
|
+
"is-ci": "^4.1.0",
|
|
67
|
+
"lint-staged": "^15.3.0",
|
|
89
68
|
"minimist": "^1.2.8",
|
|
90
69
|
"pinst": "^3.0.0",
|
|
91
|
-
"prettier": "^3.
|
|
70
|
+
"prettier": "^3.4.2",
|
|
92
71
|
"pretty-quick": "^4.0.0",
|
|
93
72
|
"prompts": "^2.4.2",
|
|
94
73
|
"rimraf": "^6.0.1",
|
|
95
74
|
"semver": "^7.6.3",
|
|
96
75
|
"tsx": "^4.19.2",
|
|
97
|
-
"typescript": "5.
|
|
98
|
-
"unbuild": "^2.0
|
|
99
|
-
"vite": "^
|
|
100
|
-
"vitest": "^2.1.
|
|
76
|
+
"typescript": "5.7.3",
|
|
77
|
+
"unbuild": "^3.2.0",
|
|
78
|
+
"vite": "^6.0.7",
|
|
79
|
+
"vitest": "^2.1.8"
|
|
101
80
|
},
|
|
102
81
|
"peerDependencies": {
|
|
103
82
|
"typescript": "*",
|
|
@@ -107,5 +86,22 @@
|
|
|
107
86
|
"vite": {
|
|
108
87
|
"optional": true
|
|
109
88
|
}
|
|
89
|
+
},
|
|
90
|
+
"scripts": {
|
|
91
|
+
"build": "tsx scripts/build.ts",
|
|
92
|
+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path .",
|
|
93
|
+
"dev": "unbuild --stub",
|
|
94
|
+
"_postinstall": "is-ci || husky install",
|
|
95
|
+
"lint": "eslint --ext .js,.jsx,.ts,.tsx \"{src,tests}/**\"",
|
|
96
|
+
"precommit": "lint-staged -c ./.husky/.lintstagedrc -q --allow-empty",
|
|
97
|
+
"prettier": "pretty-quick --staged && pnpm run lint",
|
|
98
|
+
"publish:ci": "tsx scripts/publish.ts",
|
|
99
|
+
"release": "tsx scripts/release.ts",
|
|
100
|
+
"test": "vitest run",
|
|
101
|
+
"test:dev": "vitest",
|
|
102
|
+
"test:react": "pnpm -C examples/react build",
|
|
103
|
+
"test:svelte": "pnpm -C examples/svelte build",
|
|
104
|
+
"test:ts": "pnpm -C examples/ts build",
|
|
105
|
+
"test:vue": "pnpm -C examples/vue build"
|
|
110
106
|
}
|
|
111
|
-
}
|
|
107
|
+
}
|