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/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(/node_modules\/typescript.*/, "node_modules/typescript");
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 += `export * from '${fromPath}'
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(/node_modules\/typescript.*/, "node_modules/typescript");
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 += `export * from '${fromPath}'
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-dts",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "type": "module",
5
5
  "packageManager": "pnpm@8.3.0",
6
6
  "license": "MIT",