Commit 0fcc1d27 authored by Will Binns-Smith's avatar Will Binns-Smith

Update turbopack debug-ids snapshot for simplified HMR registration

Reflect the removal of the multicast __turbopack_server_hmr_handlers__
dispatcher from the compiled runtime.
Co-Authored-By: 's avatarClaude <noreply@anthropic.com>
parent 32977b34
...@@ -1696,44 +1696,11 @@ function __turbopack_server_hmr_apply__(update) { ...@@ -1696,44 +1696,11 @@ function __turbopack_server_hmr_apply__(update) {
return false; return false;
} }
} }
const handlers = globalThis.__turbopack_server_hmr_handlers__ ?? new Map(); // All Node.js server endpoints share a single chunking context and therefore a
const chunkPrefix = path.relative(RUNTIME_ROOT, path.dirname(__filename)); // single runtime file — install the handler directly on globalThis. When the
if (handlers.size === 0) { // runtime is re-evaluated after require.cache eviction, the assignment simply
// First registration in this generation: install the routing dispatcher. // reinstalls the fresh handler.
globalThis.__turbopack_server_hmr_apply__ = (update)=>{ globalThis.__turbopack_server_hmr_apply__ = __turbopack_server_hmr_apply__;
const registry = globalThis.__turbopack_server_hmr_handlers__ ?? new Map();
const updateChunkPaths = Object.keys(update.instruction?.chunks ?? {});
const toCall = [];
if (updateChunkPaths.length === 0) {
for (const entry of registry.values())toCall.push(entry);
} else {
const seen = new Set();
for (const chunkPath of updateChunkPaths){
const dir = path.dirname(chunkPath);
for (const [key, entry] of registry){
if (dir === entry.chunkPrefix && !seen.has(key)) {
seen.add(key);
toCall.push(entry);
}
}
}
}
let applied = false;
for (const { handler } of toCall){
try {
if (handler(update)) applied = true;
} catch (err) {
console.error('[Server HMR] Handler error:', err);
}
}
return applied;
};
}
globalThis.__turbopack_server_hmr_handlers__ = handlers;
handlers.set(__filename, {
handler: __turbopack_server_hmr_apply__,
chunkPrefix
});
//# sourceMappingURL=%5Bturbopack%5D_runtime.js.map //# sourceMappingURL=%5Bturbopack%5D_runtime.js.map
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment