vite-plugin-dts 1.4.0 → 1.4.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.js CHANGED
@@ -582,7 +582,7 @@ ${import_chalk.default.cyan("[vite:dts]")} Can not resolve declaration directory
582
582
  }
583
583
  },
584
584
  async closeBundle() {
585
- var _a2, _b2, _c, _d, _e, _f;
585
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
586
586
  if (!outputDirs || !project || isBundle)
587
587
  return;
588
588
  logger.info(import_chalk.default.green(`
@@ -592,15 +592,17 @@ ${logPrefix} Start generate declaration files...`));
592
592
  sourceDtsFiles.clear();
593
593
  const startTime = Date.now();
594
594
  const tsConfig = (_a2 = (0, import_typescript.readConfigFile)(tsConfigPath, project.getFileSystem().readFileSync).config) != null ? _a2 : {};
595
- const include = (_c = (_b2 = options.include) != null ? _b2 : tsConfig.include) != null ? _c : "**/*";
596
- const exclude = (_d = options.exclude) != null ? _d : tsConfig.exclude;
595
+ const parentTsConfigPath = tsConfig.extends && ensureAbsolute(tsConfig.extends, root);
596
+ const parentTsConfig = parentTsConfigPath ? (0, import_typescript.readConfigFile)(parentTsConfigPath, project.getFileSystem().readFileSync).config : {};
597
+ const include = (_d = (_c = (_b2 = options.include) != null ? _b2 : tsConfig.include) != null ? _c : parentTsConfig.include) != null ? _d : "**/*";
598
+ const exclude = (_g = (_f = (_e = options.exclude) != null ? _e : tsConfig.exclude) != null ? _f : parentTsConfig.exclude) != null ? _g : "node_modules/**";
597
599
  bundleDebug("read config");
598
600
  const includedFileSet = /* @__PURE__ */ new Set();
599
601
  if (include && include.length) {
600
602
  const files = await (0, import_fast_glob.default)(ensureArray(include).map(normalizeGlob), {
601
603
  cwd: root,
602
604
  absolute: true,
603
- ignore: ensureArray(exclude != null ? exclude : ["node_modules/**"]).map(normalizeGlob)
605
+ ignore: ensureArray(exclude).map(normalizeGlob)
604
606
  });
605
607
  files.forEach((file) => {
606
608
  if (dtsRE2.test(file)) {
@@ -700,8 +702,8 @@ export default ${libName}
700
702
  if (typeof beforeWriteFile === "function") {
701
703
  const result = beforeWriteFile(typesPath, content);
702
704
  if (result && isNativeObj(result)) {
703
- typesPath = (_e = result.filePath) != null ? _e : typesPath;
704
- content = (_f = result.content) != null ? _f : content;
705
+ typesPath = (_h = result.filePath) != null ? _h : typesPath;
706
+ content = (_i = result.content) != null ? _i : content;
705
707
  }
706
708
  }
707
709
  await import_fs_extra.default.writeFile(typesPath, content, "utf-8");
package/dist/index.mjs CHANGED
@@ -564,7 +564,7 @@ ${chalk.cyan("[vite:dts]")} Can not resolve declaration directory, please check
564
564
  }
565
565
  },
566
566
  async closeBundle() {
567
- var _a2, _b2, _c, _d, _e, _f;
567
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
568
568
  if (!outputDirs || !project || isBundle)
569
569
  return;
570
570
  logger.info(chalk.green(`
@@ -574,15 +574,17 @@ ${logPrefix} Start generate declaration files...`));
574
574
  sourceDtsFiles.clear();
575
575
  const startTime = Date.now();
576
576
  const tsConfig = (_a2 = readConfigFile(tsConfigPath, project.getFileSystem().readFileSync).config) != null ? _a2 : {};
577
- const include = (_c = (_b2 = options.include) != null ? _b2 : tsConfig.include) != null ? _c : "**/*";
578
- const exclude = (_d = options.exclude) != null ? _d : tsConfig.exclude;
577
+ const parentTsConfigPath = tsConfig.extends && ensureAbsolute(tsConfig.extends, root);
578
+ const parentTsConfig = parentTsConfigPath ? readConfigFile(parentTsConfigPath, project.getFileSystem().readFileSync).config : {};
579
+ const include = (_d = (_c = (_b2 = options.include) != null ? _b2 : tsConfig.include) != null ? _c : parentTsConfig.include) != null ? _d : "**/*";
580
+ const exclude = (_g = (_f = (_e = options.exclude) != null ? _e : tsConfig.exclude) != null ? _f : parentTsConfig.exclude) != null ? _g : "node_modules/**";
579
581
  bundleDebug("read config");
580
582
  const includedFileSet = /* @__PURE__ */ new Set();
581
583
  if (include && include.length) {
582
584
  const files = await glob(ensureArray(include).map(normalizeGlob), {
583
585
  cwd: root,
584
586
  absolute: true,
585
- ignore: ensureArray(exclude != null ? exclude : ["node_modules/**"]).map(normalizeGlob)
587
+ ignore: ensureArray(exclude).map(normalizeGlob)
586
588
  });
587
589
  files.forEach((file) => {
588
590
  if (dtsRE2.test(file)) {
@@ -682,8 +684,8 @@ export default ${libName}
682
684
  if (typeof beforeWriteFile === "function") {
683
685
  const result = beforeWriteFile(typesPath, content);
684
686
  if (result && isNativeObj(result)) {
685
- typesPath = (_e = result.filePath) != null ? _e : typesPath;
686
- content = (_f = result.content) != null ? _f : content;
687
+ typesPath = (_h = result.filePath) != null ? _h : typesPath;
688
+ content = (_i = result.content) != null ? _i : content;
687
689
  }
688
690
  }
689
691
  await fs.writeFile(typesPath, content, "utf-8");
package/package.json CHANGED
@@ -93,5 +93,5 @@
93
93
  "test:e2e": "cd example && cross-env DEBUG=\"vite-plugin-dts:bundle\" vite build"
94
94
  },
95
95
  "types": "dist/index.d.ts",
96
- "version": "1.4.0"
96
+ "version": "1.4.1"
97
97
  }