Skip to content

Commit

Permalink
perf: optimize actions
Browse files Browse the repository at this point in the history
  • Loading branch information
aralroca committed Nov 28, 2024
1 parent cca4cee commit 08dbb27
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/brisa/src/utils/compile-files/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export default async function compileFiles() {
if (websocketPath) entrypoints.push(websocketPath);
if (integrationsPath) entrypoints.push(integrationsPath);

const actionWrites: Promise<number>[] = [];
const { success, logs, outputs } = await Bun.build({
entrypoints,
outdir: BUILD_DIR,
Expand Down Expand Up @@ -111,9 +112,11 @@ export default async function compileFiles() {

actionsEntrypoints.push(actionEntrypoint);
actionIdCount += 1;
await Bun.write(
actionEntrypoint,
transpileActions(result.code),
actionWrites.push(
Bun.write(
actionEntrypoint,
transpileActions(result.code),
),
);
}

Expand Down Expand Up @@ -142,7 +145,9 @@ export default async function compileFiles() {
if (!success) return { success, logs, pagesSize: {} };

if (actionsEntrypoints.length) {
const actionResult = await buildActions({ actionsEntrypoints, define });
const actionResult = await Promise.all(actionWrites).then(() =>
buildActions({ actionsEntrypoints, define }),
);
if (!actionResult.success) logs.push(...actionResult.logs);
}

Expand Down

0 comments on commit 08dbb27

Please sign in to comment.