vite-plugin-dts 4.0.1 → 4.0.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/LICENSE +21 -21
- package/README.md +408 -408
- package/README.zh-CN.md +408 -408
- package/dist/index.cjs +8 -5
- package/dist/index.mjs +8 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -203,7 +203,10 @@ function getTsConfig(tsConfigPath, readFileSync) {
|
|
|
203
203
|
function getTsLibFolder({ root, entryRoot }) {
|
|
204
204
|
let libFolder;
|
|
205
205
|
try {
|
|
206
|
-
libFolder = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).resolve("typescript").replace(
|
|
206
|
+
libFolder = normalizePath(node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).resolve("typescript")).replace(
|
|
207
|
+
/node_modules\/typescript.*/,
|
|
208
|
+
"node_modules/typescript"
|
|
209
|
+
);
|
|
207
210
|
} catch {
|
|
208
211
|
libFolder = resolve(root, "node_modules/typescript");
|
|
209
212
|
if (!node_fs.existsSync(libFolder)) {
|
|
@@ -1185,16 +1188,16 @@ ${logPrefix} ${kolorist.yellow(
|
|
|
1185
1188
|
let fromPath = normalizePath(node_path.relative(node_path.dirname(entryDtsPath), sourceEntry));
|
|
1186
1189
|
fromPath = fromPath.replace(dtsRE, "");
|
|
1187
1190
|
fromPath = fullRelativeRE.test(fromPath) ? fromPath : `./${fromPath}`;
|
|
1188
|
-
let content = "";
|
|
1191
|
+
let content = "export {}\n";
|
|
1189
1192
|
if (emittedFiles.has(sourceEntry)) {
|
|
1190
1193
|
if (hasNormalExport(emittedFiles.get(sourceEntry))) {
|
|
1191
|
-
content
|
|
1192
|
-
`;
|
|
1194
|
+
content = `export * from '${fromPath}'
|
|
1195
|
+
${content}`;
|
|
1193
1196
|
}
|
|
1194
1197
|
if (hasExportDefault(emittedFiles.get(sourceEntry))) {
|
|
1195
1198
|
content += `import ${libName} from '${fromPath}'
|
|
1196
1199
|
export default ${libName}
|
|
1197
|
-
`;
|
|
1200
|
+
${content}`;
|
|
1198
1201
|
}
|
|
1199
1202
|
}
|
|
1200
1203
|
await writeOutput(cleanPath(entryDtsPath), content, outDir);
|
package/dist/index.mjs
CHANGED
|
@@ -199,7 +199,10 @@ function getTsConfig(tsConfigPath, readFileSync) {
|
|
|
199
199
|
function getTsLibFolder({ root, entryRoot }) {
|
|
200
200
|
let libFolder;
|
|
201
201
|
try {
|
|
202
|
-
libFolder = createRequire(import.meta.url).resolve("typescript").replace(
|
|
202
|
+
libFolder = normalizePath(createRequire(import.meta.url).resolve("typescript")).replace(
|
|
203
|
+
/node_modules\/typescript.*/,
|
|
204
|
+
"node_modules/typescript"
|
|
205
|
+
);
|
|
203
206
|
} catch {
|
|
204
207
|
libFolder = resolve(root, "node_modules/typescript");
|
|
205
208
|
if (!existsSync(libFolder)) {
|
|
@@ -1181,16 +1184,16 @@ ${logPrefix} ${yellow(
|
|
|
1181
1184
|
let fromPath = normalizePath(relative(dirname(entryDtsPath), sourceEntry));
|
|
1182
1185
|
fromPath = fromPath.replace(dtsRE, "");
|
|
1183
1186
|
fromPath = fullRelativeRE.test(fromPath) ? fromPath : `./${fromPath}`;
|
|
1184
|
-
let content = "";
|
|
1187
|
+
let content = "export {}\n";
|
|
1185
1188
|
if (emittedFiles.has(sourceEntry)) {
|
|
1186
1189
|
if (hasNormalExport(emittedFiles.get(sourceEntry))) {
|
|
1187
|
-
content
|
|
1188
|
-
`;
|
|
1190
|
+
content = `export * from '${fromPath}'
|
|
1191
|
+
${content}`;
|
|
1189
1192
|
}
|
|
1190
1193
|
if (hasExportDefault(emittedFiles.get(sourceEntry))) {
|
|
1191
1194
|
content += `import ${libName} from '${fromPath}'
|
|
1192
1195
|
export default ${libName}
|
|
1193
|
-
`;
|
|
1196
|
+
${content}`;
|
|
1194
1197
|
}
|
|
1195
1198
|
}
|
|
1196
1199
|
await writeOutput(cleanPath(entryDtsPath), content, outDir);
|