@emeryld/rrroutes-export 1.0.15 → 1.0.16

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.mjs CHANGED
@@ -1358,6 +1358,7 @@ var CHANGESET_CFG_FIELDS = [
1358
1358
  ];
1359
1359
  var SCHEMA_SECTIONS = ["params", "query", "body", "output"];
1360
1360
  var MODULE_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts", ".js", ".mjs", ".cjs"];
1361
+ var COMPILE_CACHE_VERSION = "v2";
1361
1362
  var SOURCE_KEY_BY_SECTION = {
1362
1363
  params: "paramsSchema",
1363
1364
  query: "querySchema",
@@ -1939,8 +1940,8 @@ function toEmittedModulePath(moduleRel) {
1939
1940
  if (normalized.endsWith(".ts")) return normalized.slice(0, -3) + ".js";
1940
1941
  return normalized;
1941
1942
  }
1942
- function buildCompileCacheKey(commitSha, moduleRel, tsconfigPath, tsconfigStat) {
1943
- return crypto.createHash("sha1").update(commitSha).update("\n").update(normalizePath(moduleRel)).update("\n").update(normalizePath(tsconfigPath)).update("\n").update(String(tsconfigStat.mtimeMs)).update("\n").update(String(tsconfigStat.size)).digest("hex");
1943
+ function buildCompileCacheKey(commitSha, moduleRel, tsconfigKeyPath) {
1944
+ return crypto.createHash("sha1").update(COMPILE_CACHE_VERSION).update("\n").update(commitSha).update("\n").update(normalizePath(moduleRel)).update("\n").update(normalizePath(tsconfigKeyPath)).digest("hex");
1944
1945
  }
1945
1946
  async function collectFilesRecursive(rootDir) {
1946
1947
  const files = [];
@@ -1995,16 +1996,18 @@ async function resolveEmittedEntryPath(emitRoot, moduleRel) {
1995
1996
  }
1996
1997
  async function compileSnapshotEntry(options) {
1997
1998
  const log = options.log ?? (() => void 0);
1998
- const tsconfigStat = await fs2.stat(options.tsconfigPath);
1999
+ const relativeTsconfigPath = normalizePath(
2000
+ path4.relative(options.worktreeDir, options.tsconfigPath)
2001
+ );
2002
+ const tsconfigKeyPath = relativeTsconfigPath.startsWith("..") || path4.isAbsolute(relativeTsconfigPath) ? normalizePath(options.tsconfigPath) : relativeTsconfigPath;
1999
2003
  const cacheKey = buildCompileCacheKey(
2000
2004
  options.commitSha,
2001
2005
  options.moduleRel,
2002
- options.tsconfigPath,
2003
- { mtimeMs: tsconfigStat.mtimeMs, size: tsconfigStat.size }
2006
+ tsconfigKeyPath
2004
2007
  );
2005
2008
  const emitRoot = path4.join(options.cacheRoot, cacheKey, "dist");
2006
- let emittedEntry = path4.resolve(emitRoot, toEmittedModulePath(options.moduleRel));
2007
- if (!options.noCache && await pathExists(emittedEntry)) {
2009
+ let emittedEntry = await resolveEmittedEntryPath(emitRoot, options.moduleRel);
2010
+ if (!options.noCache && emittedEntry && await pathExists(emittedEntry)) {
2008
2011
  log(`[changelog] compile cache hit: ${options.commitSha.slice(0, 12)}`);
2009
2012
  return emittedEntry;
2010
2013
  }
@@ -2052,10 +2055,10 @@ async function compileSnapshotEntry(options) {
2052
2055
  ${message}`
2053
2056
  );
2054
2057
  }
2055
- emittedEntry = await resolveEmittedEntryPath(emitRoot, options.moduleRel) ?? emittedEntry;
2056
- if (!await pathExists(emittedEntry)) {
2058
+ emittedEntry = await resolveEmittedEntryPath(emitRoot, options.moduleRel);
2059
+ if (!emittedEntry || !await pathExists(emittedEntry)) {
2057
2060
  throw new Error(
2058
- `Compiled snapshot entry was not emitted: ${emittedEntry}. Check module/tsconfig compatibility.`
2061
+ `Compiled snapshot entry was not emitted for ${options.moduleRel} under ${emitRoot}. Check module/tsconfig compatibility.`
2059
2062
  );
2060
2063
  }
2061
2064
  log(`[changelog] compiled snapshot entry: ${emittedEntry}`);