@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.
@@ -141,10 +141,7 @@ declare function toRouteSnapshots(payload: FinalizedLeavesExport): Record<string
141
141
  declare function toSourceObjectSnapshots(routesByKey: Record<string, RouteSnapshot>): Record<string, SourceObjectSnapshot>;
142
142
  declare function resolveSnapshotTsconfig(worktreeDir: string, modulePath: string, tsconfigOverride?: string): Promise<string>;
143
143
  declare function toEmittedModulePath(moduleRel: string): string;
144
- declare function buildCompileCacheKey(commitSha: string, moduleRel: string, tsconfigPath: string, tsconfigStat: {
145
- mtimeMs: number;
146
- size: number;
147
- }): string;
144
+ declare function buildCompileCacheKey(commitSha: string, moduleRel: string, tsconfigKeyPath: string): string;
148
145
  declare function compileSnapshotEntry(options: {
149
146
  worktreeDir: string;
150
147
  moduleRel: string;
package/dist/index.cjs CHANGED
@@ -1414,6 +1414,7 @@ var CHANGESET_CFG_FIELDS = [
1414
1414
  ];
1415
1415
  var SCHEMA_SECTIONS = ["params", "query", "body", "output"];
1416
1416
  var MODULE_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts", ".js", ".mjs", ".cjs"];
1417
+ var COMPILE_CACHE_VERSION = "v2";
1417
1418
  var SOURCE_KEY_BY_SECTION = {
1418
1419
  params: "paramsSchema",
1419
1420
  query: "querySchema",
@@ -1995,8 +1996,8 @@ function toEmittedModulePath(moduleRel) {
1995
1996
  if (normalized.endsWith(".ts")) return normalized.slice(0, -3) + ".js";
1996
1997
  return normalized;
1997
1998
  }
1998
- function buildCompileCacheKey(commitSha, moduleRel, tsconfigPath, tsconfigStat) {
1999
- return import_node_crypto.default.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");
1999
+ function buildCompileCacheKey(commitSha, moduleRel, tsconfigKeyPath) {
2000
+ return import_node_crypto.default.createHash("sha1").update(COMPILE_CACHE_VERSION).update("\n").update(commitSha).update("\n").update(normalizePath(moduleRel)).update("\n").update(normalizePath(tsconfigKeyPath)).digest("hex");
2000
2001
  }
2001
2002
  async function collectFilesRecursive(rootDir) {
2002
2003
  const files = [];
@@ -2051,16 +2052,18 @@ async function resolveEmittedEntryPath(emitRoot, moduleRel) {
2051
2052
  }
2052
2053
  async function compileSnapshotEntry(options) {
2053
2054
  const log = options.log ?? (() => void 0);
2054
- const tsconfigStat = await import_promises2.default.stat(options.tsconfigPath);
2055
+ const relativeTsconfigPath = normalizePath(
2056
+ import_node_path4.default.relative(options.worktreeDir, options.tsconfigPath)
2057
+ );
2058
+ const tsconfigKeyPath = relativeTsconfigPath.startsWith("..") || import_node_path4.default.isAbsolute(relativeTsconfigPath) ? normalizePath(options.tsconfigPath) : relativeTsconfigPath;
2055
2059
  const cacheKey = buildCompileCacheKey(
2056
2060
  options.commitSha,
2057
2061
  options.moduleRel,
2058
- options.tsconfigPath,
2059
- { mtimeMs: tsconfigStat.mtimeMs, size: tsconfigStat.size }
2062
+ tsconfigKeyPath
2060
2063
  );
2061
2064
  const emitRoot = import_node_path4.default.join(options.cacheRoot, cacheKey, "dist");
2062
- let emittedEntry = import_node_path4.default.resolve(emitRoot, toEmittedModulePath(options.moduleRel));
2063
- if (!options.noCache && await pathExists(emittedEntry)) {
2065
+ let emittedEntry = await resolveEmittedEntryPath(emitRoot, options.moduleRel);
2066
+ if (!options.noCache && emittedEntry && await pathExists(emittedEntry)) {
2064
2067
  log(`[changelog] compile cache hit: ${options.commitSha.slice(0, 12)}`);
2065
2068
  return emittedEntry;
2066
2069
  }
@@ -2108,10 +2111,10 @@ async function compileSnapshotEntry(options) {
2108
2111
  ${message}`
2109
2112
  );
2110
2113
  }
2111
- emittedEntry = await resolveEmittedEntryPath(emitRoot, options.moduleRel) ?? emittedEntry;
2112
- if (!await pathExists(emittedEntry)) {
2114
+ emittedEntry = await resolveEmittedEntryPath(emitRoot, options.moduleRel);
2115
+ if (!emittedEntry || !await pathExists(emittedEntry)) {
2113
2116
  throw new Error(
2114
- `Compiled snapshot entry was not emitted: ${emittedEntry}. Check module/tsconfig compatibility.`
2117
+ `Compiled snapshot entry was not emitted for ${options.moduleRel} under ${emitRoot}. Check module/tsconfig compatibility.`
2115
2118
  );
2116
2119
  }
2117
2120
  log(`[changelog] compiled snapshot entry: ${emittedEntry}`);