@d1g1tal/tsbuild 1.1.0 → 1.1.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.
@@ -911,17 +911,20 @@ var DeclarationBundler = class {
911
911
  const dtsPath = posix.normalize(Paths.join(outDir, Paths.relative(rootDir, sourceWithoutExt) + FileExtension.DTS));
912
912
  return this.declarationFiles.has(dtsPath) ? dtsPath : sourcePath;
913
913
  }
914
+ let bestMatch;
915
+ let bestRelativeLength = Infinity;
914
916
  for (const dtsPath of this.declarationFiles.keys()) {
915
917
  if (!dtsPath.endsWith(FileExtension.DTS)) {
916
918
  continue;
917
919
  }
918
920
  const withoutOutDir = dtsPath.startsWith(outDir + "/") ? dtsPath.slice(outDir.length + 1) : dtsPath;
919
921
  const relativeDtsPath = withoutOutDir.slice(0, -FileExtension.DTS.length);
920
- if (sourceWithoutExt === relativeDtsPath || sourceWithoutExt.endsWith("/" + relativeDtsPath)) {
921
- return dtsPath;
922
+ if ((sourceWithoutExt === relativeDtsPath || sourceWithoutExt.endsWith("/" + relativeDtsPath)) && relativeDtsPath.length < bestRelativeLength) {
923
+ bestRelativeLength = relativeDtsPath.length;
924
+ bestMatch = dtsPath;
922
925
  }
923
926
  }
924
- return sourcePath;
927
+ return bestMatch ?? sourcePath;
925
928
  }
926
929
  /**
927
930
  * Extract import statements from declaration file content using AST
@@ -1767,6 +1770,8 @@ var IncrementalBuildCache = class {
1767
1770
  cacheFilePath;
1768
1771
  /** Pre-loading promise started in constructor for async cache restoration */
1769
1772
  cacheLoaded;
1773
+ /** Set to true when invalidate() is called to prevent stale cache from being restored */
1774
+ invalidated = false;
1770
1775
  /**
1771
1776
  * Creates a new build cache instance and begins pre-loading the cache asynchronously.
1772
1777
  * @param projectRoot - Root directory of the project
@@ -1798,6 +1803,9 @@ var IncrementalBuildCache = class {
1798
1803
  * @param target - The map to populate with cached declarations
1799
1804
  */
1800
1805
  async restore(target) {
1806
+ if (this.invalidated) {
1807
+ return;
1808
+ }
1801
1809
  const cache = await this.cacheLoaded;
1802
1810
  if (cache === void 0) {
1803
1811
  return;
@@ -1816,6 +1824,7 @@ var IncrementalBuildCache = class {
1816
1824
  }
1817
1825
  /** Invalidates the build cache by removing the cache directory. */
1818
1826
  invalidate() {
1827
+ this.invalidated = true;
1819
1828
  try {
1820
1829
  rmSync(this.cacheDirectoryPath, defaultCleanOptions);
1821
1830
  } catch {
@@ -1973,7 +1982,7 @@ var _TypeScriptProject = class _TypeScriptProject {
1973
1982
  return Files.empty(this.buildConfiguration.outDir);
1974
1983
  }
1975
1984
  async build() {
1976
- Logger.header(`\u{1F680} tsbuild v${"1.1.0"}${this.configuration.compilerOptions.incremental ? " [incremental]" : ""}`);
1985
+ Logger.header(`\u{1F680} tsbuild v${"1.1.1"}${this.configuration.compilerOptions.incremental ? " [incremental]" : ""}`);
1977
1986
  try {
1978
1987
  const processes = [];
1979
1988
  const filesWereEmitted = await this.typeCheck();
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TypeScriptProject
3
- } from "./BLUMG6XT.js";
3
+ } from "./YGGCSRAC.js";
4
4
  import "./VMWNQL2J.js";
5
5
  export {
6
6
  TypeScriptProject
package/dist/tsbuild.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  BuildError,
4
4
  TypeScriptProject
5
- } from "./BLUMG6XT.js";
5
+ } from "./YGGCSRAC.js";
6
6
  import "./VMWNQL2J.js";
7
7
 
8
8
  // src/tsbuild.ts
@@ -30,7 +30,7 @@ if (help) {
30
30
  process.exit(0);
31
31
  }
32
32
  if (version) {
33
- console.log("1.1.0");
33
+ console.log("1.1.1");
34
34
  process.exit(0);
35
35
  }
36
36
  var typeScriptOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d1g1tal/tsbuild",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "packageManager": "pnpm@10.29.3",
5
5
  "description": "A fast, ESM-only TypeScript build tool combining the TypeScript API for type checking and declaration generation, esbuild for bundling, and SWC for decorator metadata.",
6
6
  "type": "module",