Split bundler up into multiple files (#20192)

This commit is contained in:
Zack Radisic
2025-06-06 18:34:18 -07:00
committed by GitHub
parent 5b0523a32a
commit fa1d37b4e3
39 changed files with 16151 additions and 14144 deletions

View File

@@ -0,0 +1,36 @@
pub fn postProcessHTMLChunk(ctx: GenerateChunkCtx, worker: *ThreadPool.Worker, chunk: *Chunk) !void {
// This is where we split output into pieces
const c = ctx.c;
var j = StringJoiner{
.allocator = worker.allocator,
.watcher = .{
.input = chunk.unique_key,
},
};
const compile_results = chunk.compile_results_for_chunk;
for (compile_results) |compile_result| {
j.push(compile_result.code(), bun.default_allocator);
}
j.ensureNewlineAtEnd();
chunk.intermediate_output = c.breakOutputIntoPieces(
worker.allocator,
&j,
@as(u32, @truncate(ctx.chunks.len)),
) catch bun.outOfMemory();
chunk.isolated_hash = c.generateIsolatedHash(chunk);
}
const bun = @import("bun");
const LinkerContext = bun.bundle_v2.LinkerContext;
const Chunk = bun.bundle_v2.Chunk;
const GenerateChunkCtx = bun.bundle_v2.LinkerContext.GenerateChunkCtx;
const ThreadPool = bun.bundle_v2.ThreadPool;
const StringJoiner = bun.StringJoiner;