From 26b649ef1fa41e4dd9e886c6d66ffc2b636cce7e Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Sun, 3 Mar 2024 19:35:05 +0100 Subject: [PATCH] RSC: Rename to buildRscClientAndServer to better reflect what it's doing --- packages/vite/src/buildFeServer.ts | 8 ++------ .../{buildRscFeServer.ts => buildRscClientAndServer.ts} | 7 ++++++- 2 files changed, 8 insertions(+), 7 deletions(-) rename packages/vite/src/{buildRscFeServer.ts => buildRscClientAndServer.ts} (82%) diff --git a/packages/vite/src/buildFeServer.ts b/packages/vite/src/buildFeServer.ts index be53d95d929c..8fcbea89aa4f 100644 --- a/packages/vite/src/buildFeServer.ts +++ b/packages/vite/src/buildFeServer.ts @@ -3,7 +3,7 @@ import { getConfig, getPaths } from '@redwoodjs/project-config' import { buildRouteHooks } from './buildRouteHooks' import { buildRouteManifest } from './buildRouteManifest' -import { buildRscFeServer } from './buildRscFeServer' +import { buildRscClientAndServer } from './buildRscClientAndServer' import { buildForStreamingServer } from './streaming/buildForStreamingServer' import { ensureProcessDirWeb } from './utils' @@ -42,14 +42,10 @@ export const buildFeServer = async ({ verbose, webDir }: BuildOptions = {}) => { throw new Error('RSC entries file not found') } - await buildRscFeServer() + await buildRscClientAndServer() // Write a route manifest return await buildRouteManifest() - - // - // RSC specific code ends here - // } // We generate the RSC client bundle in the rscBuildClient function diff --git a/packages/vite/src/buildRscFeServer.ts b/packages/vite/src/buildRscClientAndServer.ts similarity index 82% rename from packages/vite/src/buildRscFeServer.ts rename to packages/vite/src/buildRscClientAndServer.ts index e0946b2b58cf..a9b8b23af8d3 100644 --- a/packages/vite/src/buildRscFeServer.ts +++ b/packages/vite/src/buildRscClientAndServer.ts @@ -5,7 +5,7 @@ import { rscBuildCopyCssAssets } from './rsc/rscBuildCopyCssAssets' import { rscBuildForServer } from './rsc/rscBuildForServer' import { rscBuildRwEnvVars } from './rsc/rscBuildRwEnvVars' -export const buildRscFeServer = async () => { +export const buildRscClientAndServer = async () => { // Analyze all files and generate a list of RSCs and RSFs const { clientEntryFiles, serverEntryFiles } = await rscBuildAnalyze() @@ -20,9 +20,14 @@ export const buildRscFeServer = async () => { ) // Copy CSS assets from server to client + // + // TODO (RSC): We need to better understand how this work and how it can be + // improved. + // Can we do this more similar to how it's done for streaming? await rscBuildCopyCssAssets(serverBuildOutput) // Mappings from server to client asset file names + // Used by the RSC worker await rscBuildClientEntriesMappings( clientBuildOutput, serverBuildOutput,