Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

fix(eve): keep dev generations stable across Rolldown rebuilds (#5171)

Andrew Barba7b8a5203aca3
diff --git a/.changeset/stable-rolldown-runtime-generations.md b/.changeset/stable-rolldown-runtime-generations.md
new file mode 100644
index 000000000..a1e528c8b
--- /dev/null
+++ b/.changeset/stable-rolldown-runtime-generations.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Fix unnecessary `eve dev` runtime-generation changes when Nitro installs newer Rolldown versions. No-op rebuilds and environment-only reloads now keep the active runtime snapshot unchanged instead of treating bundler debug comments as runtime changes.
diff --git a/packages/eve/src/internal/authored-module-loader.ts b/packages/eve/src/internal/authored-module-loader.ts
index 9b1391991..36bded3c8 100644
--- a/packages/eve/src/internal/authored-module-loader.ts
+++ b/packages/eve/src/internal/authored-module-loader.ts
@@ -225,7 +225,7 @@ export async function bundleAuthoredModuleForGeneration(
modulePath: string,
options: AuthoredModuleLoadOptions = {},
): Promise<string> {
- const code = await buildAuthoredModuleBundle(modulePath, options, {
+ return await buildAuthoredModuleBundle(modulePath, options, {
packageBoundaryPlugin: createGenerationPackageBoundaryPlugin({
externalDependencies: normalizeExternalDependencies(options.externalDependencies),
packageRoot: resolveAuthoredPackageRoot(modulePath),
@@ -233,8 +233,6 @@ export async function bundleAuthoredModuleForGeneration(
plugins: [createAuthoredDirectiveGuardPlugin()],
sourcemap: false,
});
-
- return removeRolldownModuleRegionComments(code);
}
/** One path-preserving entry in an extension distribution graph. */
@@ -298,7 +296,7 @@ export async function bundleExtensionDistributionGraph(input: {
const imports = new Set<string>();
for (const item of result.output) {
if (item.type === "chunk") {
- files.set(item.fileName, removeRolldownModuleRegionComments(item.code));
+ files.set(item.fileName, item.code);
for (const specifier of [...item.imports, ...item.dynamicImports]) imports.add(specifier);
}
}
@@ -411,7 +409,7 @@ export async function bundleAuthoredModuleMapForGeneration(input: {
});
return {
authoredWorkflowModules: workflowSources.modules(),
- code: removeRolldownModuleRegionComments(chunk.code),
+ code: chunk.code,
sourceModules: workflowSources.sourceModules().filter((id) => id !== input.moduleMapPath),
workflowSourceFingerprint: workflowSources.fingerprint(),
};
@@ -616,13 +614,6 @@ export function createAuthoredWorkflowDirectivePlugin(input: {
};
}
-function removeRolldownModuleRegionComments(code: string): string {
- return code
- .split("\n")
- .filter((line) => !line.startsWith("//#region ") && line !== "//#endregion")
- .join("\n");
-}
-
async function loadBundledAuthoredModule(
modulePath: string,
options: AuthoredModuleLoadOptions,
diff --git a/packages/eve/src/internal/bundler/nitro-rolldown.integration.test.ts b/packages/eve/src/internal/bundler/nitro-rolldown.integration.test.ts
index 09d8b2f37..ba9bbb79c 100644
--- a/packages/eve/src/internal/bundler/nitro-rolldown.integration.test.ts
+++ b/packages/eve/src/internal/bundler/nitro-rolldown.integration.test.ts
@@ -36,6 +36,32 @@ describe("buildSingleRolldownChunk", () => {
).rejects.toThrow('standard condition "import"');
});
+ it("keeps bundle bytes stable across compiler workspace paths", async () => {
+ const bundle = async (workspace: string) => {
+ const entry = `virtual:${workspace}/module-map.mjs`;
+ return await buildSingleRolldownChunk("compiler workspace fixture", {
+ input: entry,
+ plugins: [
+ {
+ name: "compiler-workspace-fixture",
+ resolveId(id: string) {
+ return id === entry ? id : undefined;
+ },
+ load(id: string) {
+ return id === entry ? "export const answer = 42;" : undefined;
+ },
+ },
+ ],
+ output: { comments: false, format: "esm" },
+ });
+ };
+
+ const first = await bundle("first");
+ const second = await bundle("second");
+
+ expect(second.code).toBe(first.code);
+ });
+
it("preserves require conditions inside bundled CommonJS dependencies", async () => {
const dir = mkdtempSync(join(tmpdir(), "eve-rolldown-conditions-"));
const parentRoot = join(dir, "node_modules", "cjs-parent");
diff --git a/packages/eve/src/internal/bundler/nitro-rolldown.ts b/packages/eve/src/internal/bundler/nitro-rolldown.ts
index 0bcfcdfa3..a507ede6c 100644
--- a/packages/eve/src/internal/bundler/nitro-rolldown.ts
+++ b/packages/eve/src/internal/bundler/nitro-rolldown.ts
@@ -107,11 +107,16 @@ export async function parseWithNitroRolldownAst(
* unresolved imports.
*/
export async function buildWithNitroRolldown(
- options: Record<string, unknown>,
+ options: Record<string, unknown> & { readonly experimental?: Record<string, unknown> },
): Promise<RolldownOutput> {
assertCustomRolldownConditionNames(options);
const { build } = await loadNitroRolldown();
- return await build({ onLog: onRolldownBuildLog, ...options });
+ return await build({
+ onLog: onRolldownBuildLog,
+ ...options,
+ // Debug module IDs contain temporary workspace paths and destabilize runtime fingerprints.
+ experimental: { ...options.experimental, attachDebugInfo: "none" },
+ });
}
// Unlike the Nitro host build, whose dependency graph deliberately leaves