@emeryld/rrroutes-export 1.0.8 → 1.0.10

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/README.md CHANGED
@@ -66,13 +66,19 @@ Settings:
66
66
  - `--html <path>`: optional. Baked HTML viewer for changelog payload.
67
67
  - `--tsconfig <path>`: optional. TS config used for source extraction in snapshots.
68
68
  - `--with-source`: accepted for parity; changelog mode always enables source extraction.
69
+ - `--cache-dir <path>`: optional. Directory for per-commit compile cache artifacts.
70
+ - `--no-cache`: optional flag. Disable compile cache and force recompilation.
69
71
 
70
72
  Behavior summary:
71
73
 
72
74
  - Resolves commit path from `from..to` (chronological).
75
+ - Builds commit-aware module path candidates (current path + extension variants + rename history).
73
76
  - Filters commits to those touching module tree/relevant config files.
74
77
  - Ensures tip commit is always included.
75
78
  - Creates a temp git worktree per selected commit.
79
+ - For TypeScript module entries, compiles the commit snapshot to JS and imports emitted output.
80
+ - For JavaScript module entries, imports directly from worktree.
81
+ - If module entrypoint cannot be resolved for a commit, changelog uses an empty snapshot for that commit (timeline continuity).
76
82
  - Exports snapshots, then computes adjacent diffs:
77
83
  - route events (`route_added`, `route_removed`, `schema_changed`, `cfg_changed`)
78
84
  - source-object events (`source_object_added`, `source_object_removed`, `source_schema_changed`)
@@ -80,8 +86,17 @@ Behavior summary:
80
86
  Runtime progress logs:
81
87
 
82
88
  - `rrroutes-export-changelog` now prints step-by-step progress (window resolution, commit filtering, per-commit snapshot progress, diff totals, output writing, cleanup).
89
+ - Changelog logs include compile lifecycle details: selected tsconfig, cache hit/miss, emitted entry path.
90
+ - Changelog logs include per-commit module resolution and unresolved-entry fallback messages.
83
91
  - Bundle script prints stage logs for snapshot export + changelog export.
84
92
 
93
+ Troubleshooting historical TS imports:
94
+
95
+ - Changelog execution no longer relies on direct Node runtime loading of TS sources.
96
+ - Historical imports like `./x.js` pointing to `x.ts` are handled by snapshot compilation.
97
+ - If tsconfig auto-discovery fails, pass `--tsconfig`.
98
+ - If entrypoint path moved across history, changelog resolves rename history automatically.
99
+
85
100
  ## Recommended end-to-end script
86
101
 
87
102
  Use this when you want one command to produce everything (snapshot + changelog + HTML + summary + timestamped storage).
@@ -95,6 +110,7 @@ pnpm --filter @emeryld/rrroutes-export run export:bundle -- \
95
110
  --tsconfig ./tsconfig.json \
96
111
  --from v1.4.0 \
97
112
  --to HEAD \
113
+ --cache-dir ./.rroutes-exports/.cache \
98
114
  --dir ./.rrroutes-exports
99
115
  ```
100
116
 
@@ -105,6 +121,8 @@ Bundle script settings (`scripts/export-release-bundle.ts`):
105
121
  - `--tsconfig <path>`: optional.
106
122
  - `--from <rev>`: optional.
107
123
  - `--to <rev>`: optional.
124
+ - `--cache-dir <path>`: optional.
125
+ - `--no-cache`: optional flag.
108
126
  - `--dir <path>`: optional base directory for stored bundles. Default: `.rrroutes-exports`.
109
127
 
110
128
  Per run, it writes a timestamped directory:
@@ -138,6 +156,8 @@ const changelog = await exportFinalizedLeavesChangelog({
138
156
  exportName: 'leaves',
139
157
  from: 'v1.4.0',
140
158
  to: 'HEAD',
159
+ cacheDir: './.cache/rrroutes-export',
160
+ noCache: false,
141
161
  outFile: './finalized-leaves.changelog.json',
142
162
  htmlFile: './finalized-leaves.changelog.viewer.html',
143
163
  log: (message) => console.log(message),
@@ -6,6 +6,8 @@ export type FinalizedLeavesChangelogCliArgs = {
6
6
  tsconfigPath?: string;
7
7
  from?: string;
8
8
  to?: string;
9
+ cacheDir?: string;
10
+ noCache: boolean;
9
11
  };
10
12
  export declare function parseFinalizedLeavesChangelogCliArgs(argv: string[]): FinalizedLeavesChangelogCliArgs;
11
13
  export declare function runExportFinalizedLeavesChangelogCli(argv: string[]): Promise<{
@@ -32,6 +32,7 @@ type CommitSnapshot = {
32
32
  commit: ChangelogCommit;
33
33
  routesByKey: Record<string, RouteSnapshot>;
34
34
  sourceObjectsById: Record<string, SourceObjectSnapshot>;
35
+ unresolvedModule?: boolean;
35
36
  };
36
37
  type DiffOp = 'added' | 'removed' | 'changed';
37
38
  export type SchemaPathDelta = {
@@ -96,6 +97,7 @@ export type FinalizedLeavesChangelogExport = {
96
97
  from: string;
97
98
  to: string;
98
99
  selectedCommitCount: number;
100
+ unresolvedModuleCommits?: string[];
99
101
  };
100
102
  commits: ChangelogCommit[];
101
103
  byRoute: Record<string, RouteChangeEvent[]>;
@@ -115,16 +117,40 @@ export type ExportFinalizedLeavesChangelogOptions = {
115
117
  includeSource?: boolean;
116
118
  handlers?: ExportFinalizedLeavesOptions['handlers'];
117
119
  log?: (message: string) => void;
120
+ cacheDir?: string;
121
+ noCache?: boolean;
118
122
  };
119
123
  declare function resolveCommitWindow(cwd: string, from?: string, to?: string): Promise<{
120
124
  from: string;
121
125
  to: string;
122
126
  }>;
123
127
  declare function resolveCommitPath(cwd: string, fromCommit: string, toCommit: string): Promise<string[]>;
124
- declare function filterCommits(cwd: string, commits: string[], moduleRel: string, tsconfigRel?: string): Promise<string[]>;
128
+ declare function buildModulePathCandidates(repoRoot: string, toCommit: string, requestedModuleRel: string): Promise<string[]>;
129
+ declare function resolveModulePathForCommit(repoRoot: string, commitSha: string, candidates: readonly string[]): Promise<string | undefined>;
130
+ declare function filterCommits(cwd: string, commits: string[], moduleCandidates: readonly string[], tsconfigRel?: string): Promise<string[]>;
125
131
  declare function buildSourceIdentity(section: ChangelogSchemaSection, value: Record<string, unknown>): SourceIdentity;
126
132
  declare function toRouteSnapshots(payload: FinalizedLeavesExport): Record<string, RouteSnapshot>;
127
133
  declare function toSourceObjectSnapshots(routesByKey: Record<string, RouteSnapshot>): Record<string, SourceObjectSnapshot>;
134
+ declare function resolveSnapshotTsconfig(worktreeDir: string, modulePath: string, tsconfigOverride?: string): Promise<string>;
135
+ declare function toEmittedModulePath(moduleRel: string): string;
136
+ declare function buildCompileCacheKey(commitSha: string, moduleRel: string, tsconfigPath: string, tsconfigStat: {
137
+ mtimeMs: number;
138
+ size: number;
139
+ }): string;
140
+ declare function compileSnapshotEntry(options: {
141
+ worktreeDir: string;
142
+ moduleRel: string;
143
+ modulePath: string;
144
+ tsconfigPath: string;
145
+ commitSha: string;
146
+ cacheRoot: string;
147
+ noCache?: boolean;
148
+ log?: (message: string) => void;
149
+ }): Promise<string>;
150
+ declare function loadSnapshotExport(options: {
151
+ entryPath: string;
152
+ exportName: string;
153
+ }): Promise<{}>;
128
154
  declare function diffSnapshots(previous: CommitSnapshot, current: CommitSnapshot): {
129
155
  routeEvents: RouteChangeEvent[];
130
156
  sourceEvents: SourceObjectChangeEvent[];
@@ -138,6 +164,13 @@ export declare const __private: {
138
164
  resolveCommitWindow: typeof resolveCommitWindow;
139
165
  resolveCommitPath: typeof resolveCommitPath;
140
166
  filterCommits: typeof filterCommits;
167
+ buildModulePathCandidates: typeof buildModulePathCandidates;
168
+ resolveModulePathForCommit: typeof resolveModulePathForCommit;
169
+ resolveSnapshotTsconfig: typeof resolveSnapshotTsconfig;
170
+ toEmittedModulePath: typeof toEmittedModulePath;
171
+ buildCompileCacheKey: typeof buildCompileCacheKey;
172
+ compileSnapshotEntry: typeof compileSnapshotEntry;
173
+ loadSnapshotExport: typeof loadSnapshotExport;
141
174
  toRouteSnapshots: typeof toRouteSnapshots;
142
175
  toSourceObjectSnapshots: typeof toSourceObjectSnapshots;
143
176
  diffSnapshots: typeof diffSnapshots;