@@ -13,6 +13,7 @@ import type {
1313 WebSocketManifestMeta ,
1414} from "./types" ;
1515import type { WebSocketRouteDefinition } from "../router/websocket" ;
16+ import { toSlash } from "../shared/utils" ;
1617
1718/**
1819 * Compute a CF-compatible asset hash: SHA-256, first 32 hex chars.
@@ -41,7 +42,7 @@ export function collectAndHashAssets(dir: string): {
4142 try {
4243 const files = collectFiles ( dir ) ;
4344 for ( const filePath of files ) {
44- const relativePath = "/" + relative ( dir , filePath ) ;
45+ const relativePath = "/" + toSlash ( relative ( dir , filePath ) ) ;
4546 const content = readFileSync ( filePath ) ;
4647 assetManifest [ relativePath ] = {
4748 hash : computeAssetHash ( content ) ,
@@ -223,7 +224,7 @@ export function packageBuild(
223224 const workerDir = join ( distDir , workerDirName ) ;
224225 const workerFiles = collectFiles ( workerDir ) ;
225226 for ( const filePath of workerFiles ) {
226- const relativePath = relative ( workerDir , filePath ) ;
227+ const relativePath = toSlash ( relative ( workerDir , filePath ) ) ;
227228 if ( ! isWorkerModule ( relativePath ) ) continue ;
228229 const content = readFileSync ( filePath ) ;
229230 formData . append ( `worker:${ relativePath } ` , new Blob ( [ content ] ) , relativePath ) ;
@@ -234,7 +235,7 @@ export function packageBuild(
234235 try {
235236 const clientFiles = collectFiles ( clientDir ) ;
236237 for ( const filePath of clientFiles ) {
237- const relativePath = relative ( clientDir , filePath ) ;
238+ const relativePath = toSlash ( relative ( clientDir , filePath ) ) ;
238239 if ( neededAssets && ! neededAssets . has ( "/" + relativePath ) ) continue ;
239240 const content = readFileSync ( filePath ) ;
240241 formData . append ( `asset:${ relativePath } ` , new Blob ( [ content ] ) , relativePath ) ;
@@ -286,7 +287,7 @@ export function packageStaticBuild(
286287
287288 const files = collectFiles ( outputDir ) ;
288289 for ( const filePath of files ) {
289- const relativePath = relative ( outputDir , filePath ) ;
290+ const relativePath = toSlash ( relative ( outputDir , filePath ) ) ;
290291 if ( neededAssets && ! neededAssets . has ( "/" + relativePath ) ) continue ;
291292 const content = readFileSync ( filePath ) ;
292293 formData . append ( `asset:${ relativePath } ` , new Blob ( [ content ] ) , relativePath ) ;
@@ -396,7 +397,7 @@ export function packageFrameworkBuild(opts: {
396397 // Worker files
397398 const workerFiles = collectFiles ( opts . workerDir ) ;
398399 for ( const filePath of workerFiles ) {
399- const relativePath = relative ( opts . workerDir , filePath ) ;
400+ const relativePath = toSlash ( relative ( opts . workerDir , filePath ) ) ;
400401 if ( ! isWorkerModule ( relativePath ) ) continue ;
401402 const content = readFileSync ( filePath ) ;
402403 formData . append ( `worker:${ relativePath } ` , new Blob ( [ content ] ) , relativePath ) ;
@@ -408,7 +409,7 @@ export function packageFrameworkBuild(opts: {
408409 for ( const filePath of assetFiles ) {
409410 // Skip worker files when workerDir overlaps with assetsDir
410411 if ( isOverlap && filePath . replace ( / \\ / g, "/" ) . startsWith ( workerDirNorm ) ) continue ;
411- const relativePath = relative ( opts . assetsDir , filePath ) ;
412+ const relativePath = toSlash ( relative ( opts . assetsDir , filePath ) ) ;
412413 if ( opts . neededAssets && ! opts . neededAssets . has ( "/" + relativePath ) ) continue ;
413414 const content = readFileSync ( filePath ) ;
414415 formData . append ( `asset:${ relativePath } ` , new Blob ( [ content ] ) , relativePath ) ;
0 commit comments