vite-plugin-dts 2.0.0-beta.2 → 2.0.0-beta.3
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 +33 -42
- package/dist/index.mjs +32 -41
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -599,6 +599,7 @@ const defaultIndex = "index.d.ts";
|
|
|
599
599
|
const noop = () => {
|
|
600
600
|
};
|
|
601
601
|
const extPrefix = (file) => mtjsRE.test(file) ? "m" : ctjsRE.test(file) ? "c" : "";
|
|
602
|
+
const resolve = (...paths) => vite.normalizePath(node_path.resolve(...paths));
|
|
602
603
|
const logPrefix = kolorist.cyan("[vite:dts]");
|
|
603
604
|
const bundleDebug = debug("vite-plugin-dts:bundle");
|
|
604
605
|
function dtsPlugin(options = {}) {
|
|
@@ -640,7 +641,7 @@ function dtsPlugin(options = {}) {
|
|
|
640
641
|
let allowJs = false;
|
|
641
642
|
let transformError = false;
|
|
642
643
|
function internalTransform(code, id) {
|
|
643
|
-
if (!filter(id)) {
|
|
644
|
+
if (!project || !filter(id)) {
|
|
644
645
|
return;
|
|
645
646
|
}
|
|
646
647
|
if (vueRE.test(id)) {
|
|
@@ -735,7 +736,7 @@ ${kolorist.cyan(
|
|
|
735
736
|
compilerOptions: mergeObjects(compilerOptions, {
|
|
736
737
|
rootDir: compilerOptions.rootDir || root,
|
|
737
738
|
noEmitOnError,
|
|
738
|
-
outDir:
|
|
739
|
+
outDir: outputDirs[0],
|
|
739
740
|
declarationDir: void 0,
|
|
740
741
|
noUnusedParameters: false,
|
|
741
742
|
declaration: true,
|
|
@@ -848,6 +849,7 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
848
849
|
}
|
|
849
850
|
bundleDebug("diagnostics");
|
|
850
851
|
}
|
|
852
|
+
const outputDir = outputDirs[0];
|
|
851
853
|
const dtsOutputFiles = Array.from(sourceDtsFiles).map((sourceFile) => ({
|
|
852
854
|
path: sourceFile.getFilePath(),
|
|
853
855
|
content: sourceFile.getFullText()
|
|
@@ -855,16 +857,13 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
855
857
|
const service = project.getLanguageService();
|
|
856
858
|
const outputFiles = project.getSourceFiles().map(
|
|
857
859
|
(sourceFile) => service.getEmitOutput(sourceFile, true).getOutputFiles().map((outputFile) => ({
|
|
858
|
-
path:
|
|
860
|
+
path: resolve(root, node_path.relative(outputDir, outputFile.compilerObject.name)),
|
|
859
861
|
content: outputFile.getText()
|
|
860
862
|
}))
|
|
861
863
|
).flat().concat(dtsOutputFiles);
|
|
862
864
|
bundleDebug("emit");
|
|
863
|
-
|
|
864
|
-
entryRoot = queryPublicPath(outputFiles.map((file) => file.path));
|
|
865
|
-
}
|
|
865
|
+
entryRoot = entryRoot || queryPublicPath(outputFiles.map((file) => file.path));
|
|
866
866
|
entryRoot = ensureAbsolute(entryRoot, root);
|
|
867
|
-
const outputDir = outputDirs[0];
|
|
868
867
|
await runParallel(os.cpus().length, outputFiles, async (outputFile) => {
|
|
869
868
|
let filePath = outputFile.path;
|
|
870
869
|
let content = outputFile.content;
|
|
@@ -877,43 +876,46 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
877
876
|
content = transformAliasImport(filePath, content, aliases, aliasesExclude);
|
|
878
877
|
content = staticImport || rollupTypes ? transformDynamicImport(content) : content;
|
|
879
878
|
}
|
|
880
|
-
filePath =
|
|
879
|
+
filePath = resolve(
|
|
881
880
|
outputDir,
|
|
882
881
|
node_path.relative(entryRoot, cleanVueFileName ? filePath.replace(".vue.d.ts", ".d.ts") : filePath)
|
|
883
882
|
);
|
|
883
|
+
content = cleanVueFileName ? content.replace(/['"](.+)\.vue['"]/g, '"$1"') : content;
|
|
884
884
|
if (typeof beforeWriteFile === "function") {
|
|
885
885
|
const result = beforeWriteFile(filePath, content);
|
|
886
886
|
if (result === false)
|
|
887
887
|
return;
|
|
888
888
|
if (result && isNativeObj(result)) {
|
|
889
|
-
filePath = result.filePath
|
|
889
|
+
filePath = result.filePath || filePath;
|
|
890
890
|
content = result.content ?? content;
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
|
+
filePath = vite.normalizePath(filePath);
|
|
893
894
|
await fs.mkdir(node_path.dirname(filePath), { recursive: true });
|
|
894
|
-
await fs.writeFile(
|
|
895
|
-
|
|
896
|
-
cleanVueFileName ? content.replace(/['"](.+)\.vue['"]/g, '"$1"') : content,
|
|
897
|
-
"utf-8"
|
|
898
|
-
);
|
|
899
|
-
emittedFiles.set(
|
|
900
|
-
vite.normalizePath(filePath),
|
|
901
|
-
cleanVueFileName ? content.replace(/['"](.+)\.vue['"]/g, '"$1"') : content
|
|
902
|
-
);
|
|
895
|
+
await fs.writeFile(filePath, content, "utf-8");
|
|
896
|
+
emittedFiles.set(filePath, content);
|
|
903
897
|
});
|
|
904
898
|
bundleDebug("output");
|
|
899
|
+
if (copyDtsFiles) {
|
|
900
|
+
await runParallel(os.cpus().length, dtsOutputFiles, async ({ path, content }) => {
|
|
901
|
+
const filePath = resolve(outputDir, node_path.basename(path));
|
|
902
|
+
await fs.writeFile(filePath, content, "utf-8");
|
|
903
|
+
emittedFiles.set(filePath, content);
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
bundleDebug("copy dts");
|
|
905
907
|
if (insertTypesEntry || rollupTypes) {
|
|
906
|
-
const pkgPath =
|
|
908
|
+
const pkgPath = resolve(root, "package.json");
|
|
907
909
|
const pkg = fs.existsSync(pkgPath) ? JSON.parse(await fs.readFile(pkgPath, "utf-8")) : {};
|
|
908
910
|
const entryNames = Object.keys(entries);
|
|
909
|
-
const types = pkg.types || pkg.typings || pkg.publishConfig?.types || pkg.publishConfig?.typings;
|
|
911
|
+
const types = pkg.types || pkg.typings || pkg.publishConfig?.types || pkg.publishConfig?.typings || (pkg.exports?.["."] || pkg.exports?.["./"])?.types;
|
|
910
912
|
const multiple = entryNames.length > 1;
|
|
911
|
-
const typesPath = types ?
|
|
913
|
+
const typesPath = types ? resolve(root, types) : resolve(outputDir, indexName);
|
|
912
914
|
for (const name of entryNames) {
|
|
913
|
-
let filePath = multiple ?
|
|
915
|
+
let filePath = multiple ? resolve(outputDir, `${name.replace(tsRE, "")}.d.ts`) : typesPath;
|
|
914
916
|
if (fs.existsSync(filePath))
|
|
915
917
|
continue;
|
|
916
|
-
const index =
|
|
918
|
+
const index = resolve(
|
|
917
919
|
outputDir,
|
|
918
920
|
node_path.relative(entryRoot, `${entries[name].replace(tsRE, "")}.d.ts`)
|
|
919
921
|
);
|
|
@@ -938,21 +940,19 @@ export default ${libName}
|
|
|
938
940
|
content = result.content ?? content;
|
|
939
941
|
}
|
|
940
942
|
}
|
|
943
|
+
filePath = vite.normalizePath(filePath);
|
|
941
944
|
if (result !== false) {
|
|
942
945
|
await fs.writeFile(filePath, content, "utf-8");
|
|
943
|
-
emittedFiles.set(
|
|
946
|
+
emittedFiles.set(filePath, content);
|
|
944
947
|
}
|
|
945
948
|
}
|
|
946
949
|
bundleDebug("insert index");
|
|
947
950
|
if (rollupTypes) {
|
|
948
951
|
logger.info(kolorist.green(`${logPrefix} Start rollup declaration files...`));
|
|
949
952
|
const rollupFiles = /* @__PURE__ */ new Set();
|
|
950
|
-
for (const [filePath, content] of emittedFiles) {
|
|
951
|
-
project.createSourceFile(filePath, content, { overwrite: true });
|
|
952
|
-
}
|
|
953
953
|
if (multiple) {
|
|
954
954
|
for (const name of entryNames) {
|
|
955
|
-
const path =
|
|
955
|
+
const path = resolve(outputDir, `${name.replace(tsRE, "")}.d.ts`);
|
|
956
956
|
rollupDeclarationFiles({
|
|
957
957
|
root,
|
|
958
958
|
compilerOptions,
|
|
@@ -961,9 +961,8 @@ export default ${libName}
|
|
|
961
961
|
fileName: node_path.basename(path),
|
|
962
962
|
libFolder: libFolderPath
|
|
963
963
|
});
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
rollupFiles.add(wroteFile);
|
|
964
|
+
emittedFiles.delete(path);
|
|
965
|
+
rollupFiles.add(path);
|
|
967
966
|
}
|
|
968
967
|
} else {
|
|
969
968
|
rollupDeclarationFiles({
|
|
@@ -974,9 +973,8 @@ export default ${libName}
|
|
|
974
973
|
fileName: node_path.basename(typesPath),
|
|
975
974
|
libFolder: libFolderPath
|
|
976
975
|
});
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
rollupFiles.add(wroteFile);
|
|
976
|
+
emittedFiles.delete(typesPath);
|
|
977
|
+
rollupFiles.add(typesPath);
|
|
980
978
|
}
|
|
981
979
|
await runParallel(os.cpus().length, Array.from(emittedFiles.keys()), (f) => fs.unlink(f));
|
|
982
980
|
removeDirIfEmpty(outputDir);
|
|
@@ -984,13 +982,6 @@ export default ${libName}
|
|
|
984
982
|
for (const file of rollupFiles) {
|
|
985
983
|
emittedFiles.set(file, await fs.readFile(file, "utf-8"));
|
|
986
984
|
}
|
|
987
|
-
if (copyDtsFiles) {
|
|
988
|
-
await runParallel(os.cpus().length, dtsOutputFiles, async ({ path, content }) => {
|
|
989
|
-
const filePath = node_path.resolve(outputDir, node_path.basename(path));
|
|
990
|
-
await fs.writeFile(filePath, content, "utf-8");
|
|
991
|
-
emittedFiles.set(vite.normalizePath(filePath), content);
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
985
|
bundleDebug("rollup");
|
|
995
986
|
}
|
|
996
987
|
}
|
|
@@ -1003,7 +994,7 @@ export default ${libName}
|
|
|
1003
994
|
const relativePath = node_path.relative(outputDir, wroteFile);
|
|
1004
995
|
await Promise.all(
|
|
1005
996
|
dirs.map(async (dir) => {
|
|
1006
|
-
const filePath =
|
|
997
|
+
const filePath = resolve(dir, relativePath);
|
|
1007
998
|
await fs.mkdir(node_path.dirname(filePath), { recursive: true });
|
|
1008
999
|
await fs.writeFile(filePath, content, "utf-8");
|
|
1009
1000
|
})
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import __cjs_mod__ from 'module';
|
|
|
5
5
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
7
7
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
8
|
-
import { isAbsolute, resolve, dirname, normalize, sep, relative, basename } from 'node:path';
|
|
8
|
+
import { isAbsolute, resolve as resolve$1, dirname, normalize, sep, relative, basename } from 'node:path';
|
|
9
9
|
import fs from 'fs-extra';
|
|
10
10
|
import os from 'os';
|
|
11
11
|
import { cyan, yellow, red, green } from 'kolorist';
|
|
@@ -69,7 +69,7 @@ function mergeObjects(sourceObj, targetObj) {
|
|
|
69
69
|
return sourceObj;
|
|
70
70
|
}
|
|
71
71
|
function ensureAbsolute(path, root) {
|
|
72
|
-
return path ? isAbsolute(path) ? path : resolve(root, path) : root;
|
|
72
|
+
return path ? isAbsolute(path) ? path : resolve$1(root, path) : root;
|
|
73
73
|
}
|
|
74
74
|
function ensureArray(value) {
|
|
75
75
|
return Array.isArray(value) ? value : value ? [value] : [];
|
|
@@ -134,7 +134,7 @@ function removeDirIfEmpty(dir) {
|
|
|
134
134
|
}
|
|
135
135
|
let onlyHasDir = true;
|
|
136
136
|
for (const file of readdirSync(dir)) {
|
|
137
|
-
const abs = resolve(dir, file);
|
|
137
|
+
const abs = resolve$1(dir, file);
|
|
138
138
|
if (lstatSync(abs).isDirectory()) {
|
|
139
139
|
if (!removeDirIfEmpty(abs)) {
|
|
140
140
|
onlyHasDir = false;
|
|
@@ -514,7 +514,7 @@ function rollupDeclarationFiles({
|
|
|
514
514
|
fileName,
|
|
515
515
|
libFolder
|
|
516
516
|
}) {
|
|
517
|
-
const configObjectFullPath = resolve(root, "api-extractor.json");
|
|
517
|
+
const configObjectFullPath = resolve$1(root, "api-extractor.json");
|
|
518
518
|
const packageJsonLookup = new PackageJsonLookup();
|
|
519
519
|
const packageJsonFullPath = packageJsonLookup.tryGetPackageJsonFilePathFor(configObjectFullPath);
|
|
520
520
|
if (!dtsRE$1.test(fileName)) {
|
|
@@ -539,7 +539,7 @@ function rollupDeclarationFiles({
|
|
|
539
539
|
},
|
|
540
540
|
dtsRollup: {
|
|
541
541
|
enabled: true,
|
|
542
|
-
publicTrimmedFilePath: resolve(outputDir, fileName)
|
|
542
|
+
publicTrimmedFilePath: resolve$1(outputDir, fileName)
|
|
543
543
|
},
|
|
544
544
|
tsdocMetadata: {
|
|
545
545
|
enabled: false
|
|
@@ -563,7 +563,7 @@ function rollupDeclarationFiles({
|
|
|
563
563
|
const compilerState = CompilerState.create(extractorConfig, {
|
|
564
564
|
localBuild: false,
|
|
565
565
|
showVerboseMessages: false,
|
|
566
|
-
typescriptCompilerFolder: libFolder ? resolve(libFolder, "..") : void 0
|
|
566
|
+
typescriptCompilerFolder: libFolder ? resolve$1(libFolder, "..") : void 0
|
|
567
567
|
});
|
|
568
568
|
const sourceMapper = new SourceMapper();
|
|
569
569
|
const messageRouter = new MessageRouter({
|
|
@@ -604,6 +604,7 @@ const defaultIndex = "index.d.ts";
|
|
|
604
604
|
const noop = () => {
|
|
605
605
|
};
|
|
606
606
|
const extPrefix = (file) => mtjsRE.test(file) ? "m" : ctjsRE.test(file) ? "c" : "";
|
|
607
|
+
const resolve = (...paths) => normalizePath(resolve$1(...paths));
|
|
607
608
|
const logPrefix = cyan("[vite:dts]");
|
|
608
609
|
const bundleDebug = debug("vite-plugin-dts:bundle");
|
|
609
610
|
function dtsPlugin(options = {}) {
|
|
@@ -645,7 +646,7 @@ function dtsPlugin(options = {}) {
|
|
|
645
646
|
let allowJs = false;
|
|
646
647
|
let transformError = false;
|
|
647
648
|
function internalTransform(code, id) {
|
|
648
|
-
if (!filter(id)) {
|
|
649
|
+
if (!project || !filter(id)) {
|
|
649
650
|
return;
|
|
650
651
|
}
|
|
651
652
|
if (vueRE.test(id)) {
|
|
@@ -740,7 +741,7 @@ ${cyan(
|
|
|
740
741
|
compilerOptions: mergeObjects(compilerOptions, {
|
|
741
742
|
rootDir: compilerOptions.rootDir || root,
|
|
742
743
|
noEmitOnError,
|
|
743
|
-
outDir:
|
|
744
|
+
outDir: outputDirs[0],
|
|
744
745
|
declarationDir: void 0,
|
|
745
746
|
noUnusedParameters: false,
|
|
746
747
|
declaration: true,
|
|
@@ -853,6 +854,7 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
853
854
|
}
|
|
854
855
|
bundleDebug("diagnostics");
|
|
855
856
|
}
|
|
857
|
+
const outputDir = outputDirs[0];
|
|
856
858
|
const dtsOutputFiles = Array.from(sourceDtsFiles).map((sourceFile) => ({
|
|
857
859
|
path: sourceFile.getFilePath(),
|
|
858
860
|
content: sourceFile.getFullText()
|
|
@@ -860,16 +862,13 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
860
862
|
const service = project.getLanguageService();
|
|
861
863
|
const outputFiles = project.getSourceFiles().map(
|
|
862
864
|
(sourceFile) => service.getEmitOutput(sourceFile, true).getOutputFiles().map((outputFile) => ({
|
|
863
|
-
path:
|
|
865
|
+
path: resolve(root, relative(outputDir, outputFile.compilerObject.name)),
|
|
864
866
|
content: outputFile.getText()
|
|
865
867
|
}))
|
|
866
868
|
).flat().concat(dtsOutputFiles);
|
|
867
869
|
bundleDebug("emit");
|
|
868
|
-
|
|
869
|
-
entryRoot = queryPublicPath(outputFiles.map((file) => file.path));
|
|
870
|
-
}
|
|
870
|
+
entryRoot = entryRoot || queryPublicPath(outputFiles.map((file) => file.path));
|
|
871
871
|
entryRoot = ensureAbsolute(entryRoot, root);
|
|
872
|
-
const outputDir = outputDirs[0];
|
|
873
872
|
await runParallel(os.cpus().length, outputFiles, async (outputFile) => {
|
|
874
873
|
let filePath = outputFile.path;
|
|
875
874
|
let content = outputFile.content;
|
|
@@ -886,32 +885,35 @@ ${logPrefix} Start generate declaration files...`));
|
|
|
886
885
|
outputDir,
|
|
887
886
|
relative(entryRoot, cleanVueFileName ? filePath.replace(".vue.d.ts", ".d.ts") : filePath)
|
|
888
887
|
);
|
|
888
|
+
content = cleanVueFileName ? content.replace(/['"](.+)\.vue['"]/g, '"$1"') : content;
|
|
889
889
|
if (typeof beforeWriteFile === "function") {
|
|
890
890
|
const result = beforeWriteFile(filePath, content);
|
|
891
891
|
if (result === false)
|
|
892
892
|
return;
|
|
893
893
|
if (result && isNativeObj(result)) {
|
|
894
|
-
filePath = result.filePath
|
|
894
|
+
filePath = result.filePath || filePath;
|
|
895
895
|
content = result.content ?? content;
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
|
+
filePath = normalizePath(filePath);
|
|
898
899
|
await fs.mkdir(dirname(filePath), { recursive: true });
|
|
899
|
-
await fs.writeFile(
|
|
900
|
-
|
|
901
|
-
cleanVueFileName ? content.replace(/['"](.+)\.vue['"]/g, '"$1"') : content,
|
|
902
|
-
"utf-8"
|
|
903
|
-
);
|
|
904
|
-
emittedFiles.set(
|
|
905
|
-
normalizePath(filePath),
|
|
906
|
-
cleanVueFileName ? content.replace(/['"](.+)\.vue['"]/g, '"$1"') : content
|
|
907
|
-
);
|
|
900
|
+
await fs.writeFile(filePath, content, "utf-8");
|
|
901
|
+
emittedFiles.set(filePath, content);
|
|
908
902
|
});
|
|
909
903
|
bundleDebug("output");
|
|
904
|
+
if (copyDtsFiles) {
|
|
905
|
+
await runParallel(os.cpus().length, dtsOutputFiles, async ({ path, content }) => {
|
|
906
|
+
const filePath = resolve(outputDir, basename(path));
|
|
907
|
+
await fs.writeFile(filePath, content, "utf-8");
|
|
908
|
+
emittedFiles.set(filePath, content);
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
bundleDebug("copy dts");
|
|
910
912
|
if (insertTypesEntry || rollupTypes) {
|
|
911
913
|
const pkgPath = resolve(root, "package.json");
|
|
912
914
|
const pkg = fs.existsSync(pkgPath) ? JSON.parse(await fs.readFile(pkgPath, "utf-8")) : {};
|
|
913
915
|
const entryNames = Object.keys(entries);
|
|
914
|
-
const types = pkg.types || pkg.typings || pkg.publishConfig?.types || pkg.publishConfig?.typings;
|
|
916
|
+
const types = pkg.types || pkg.typings || pkg.publishConfig?.types || pkg.publishConfig?.typings || (pkg.exports?.["."] || pkg.exports?.["./"])?.types;
|
|
915
917
|
const multiple = entryNames.length > 1;
|
|
916
918
|
const typesPath = types ? resolve(root, types) : resolve(outputDir, indexName);
|
|
917
919
|
for (const name of entryNames) {
|
|
@@ -943,18 +945,16 @@ export default ${libName}
|
|
|
943
945
|
content = result.content ?? content;
|
|
944
946
|
}
|
|
945
947
|
}
|
|
948
|
+
filePath = normalizePath(filePath);
|
|
946
949
|
if (result !== false) {
|
|
947
950
|
await fs.writeFile(filePath, content, "utf-8");
|
|
948
|
-
emittedFiles.set(
|
|
951
|
+
emittedFiles.set(filePath, content);
|
|
949
952
|
}
|
|
950
953
|
}
|
|
951
954
|
bundleDebug("insert index");
|
|
952
955
|
if (rollupTypes) {
|
|
953
956
|
logger.info(green(`${logPrefix} Start rollup declaration files...`));
|
|
954
957
|
const rollupFiles = /* @__PURE__ */ new Set();
|
|
955
|
-
for (const [filePath, content] of emittedFiles) {
|
|
956
|
-
project.createSourceFile(filePath, content, { overwrite: true });
|
|
957
|
-
}
|
|
958
958
|
if (multiple) {
|
|
959
959
|
for (const name of entryNames) {
|
|
960
960
|
const path = resolve(outputDir, `${name.replace(tsRE, "")}.d.ts`);
|
|
@@ -966,9 +966,8 @@ export default ${libName}
|
|
|
966
966
|
fileName: basename(path),
|
|
967
967
|
libFolder: libFolderPath
|
|
968
968
|
});
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
rollupFiles.add(wroteFile);
|
|
969
|
+
emittedFiles.delete(path);
|
|
970
|
+
rollupFiles.add(path);
|
|
972
971
|
}
|
|
973
972
|
} else {
|
|
974
973
|
rollupDeclarationFiles({
|
|
@@ -979,9 +978,8 @@ export default ${libName}
|
|
|
979
978
|
fileName: basename(typesPath),
|
|
980
979
|
libFolder: libFolderPath
|
|
981
980
|
});
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
rollupFiles.add(wroteFile);
|
|
981
|
+
emittedFiles.delete(typesPath);
|
|
982
|
+
rollupFiles.add(typesPath);
|
|
985
983
|
}
|
|
986
984
|
await runParallel(os.cpus().length, Array.from(emittedFiles.keys()), (f) => fs.unlink(f));
|
|
987
985
|
removeDirIfEmpty(outputDir);
|
|
@@ -989,13 +987,6 @@ export default ${libName}
|
|
|
989
987
|
for (const file of rollupFiles) {
|
|
990
988
|
emittedFiles.set(file, await fs.readFile(file, "utf-8"));
|
|
991
989
|
}
|
|
992
|
-
if (copyDtsFiles) {
|
|
993
|
-
await runParallel(os.cpus().length, dtsOutputFiles, async ({ path, content }) => {
|
|
994
|
-
const filePath = resolve(outputDir, basename(path));
|
|
995
|
-
await fs.writeFile(filePath, content, "utf-8");
|
|
996
|
-
emittedFiles.set(normalizePath(filePath), content);
|
|
997
|
-
});
|
|
998
|
-
}
|
|
999
990
|
bundleDebug("rollup");
|
|
1000
991
|
}
|
|
1001
992
|
}
|