@@ -33,6 +33,7 @@ import {
3333 BINDING_NAME as D1_TAG_BINDING_NAME ,
3434 NAME as D1_TAG_NAME ,
3535} from "../../api/overrides/tag-cache/d1-next-tag-cache.js" ;
36+ import { normalizePath } from "../build/utils/normalize-path.js" ;
3637import type { WranglerTarget } from "../utils/run-wrangler.js" ;
3738import { runWrangler } from "../utils/run-wrangler.js" ;
3839
@@ -57,8 +58,8 @@ export function getCacheAssets(opts: BuildOptions): CacheAsset[] {
5758 const assets : CacheAsset [ ] = [ ] ;
5859
5960 for ( const file of allFiles ) {
60- const fullPath = file . fullpathPosix ( ) ;
61- const relativePath = path . relative ( path . join ( opts . outputDir , "cache" ) , fullPath ) ;
61+ const fullPath = file . fullpath ( ) ;
62+ const relativePath = normalizePath ( path . relative ( path . join ( opts . outputDir , "cache" ) , fullPath ) ) ;
6263
6364 if ( relativePath . startsWith ( "__fetch" ) ) {
6465 const [ __fetch , buildId , ...keyParts ] = relativePath . split ( "/" ) ;
@@ -129,7 +130,11 @@ async function populateR2IncrementalCache(
129130 } ) ;
130131 runWrangler (
131132 options ,
132- [ "r2 object put" , quoteShellMeta ( path . join ( bucket , cacheKey ) ) , `--file ${ quoteShellMeta ( fullPath ) } ` ] ,
133+ [
134+ "r2 object put" ,
135+ quoteShellMeta ( normalizePath ( path . join ( bucket , cacheKey ) ) ) ,
136+ `--file ${ quoteShellMeta ( fullPath ) } ` ,
137+ ] ,
133138 // NOTE: R2 does not support the environment flag and results in the following error:
134139 // Incorrect type for the 'cacheExpiry' field on 'HttpMetadata': the provided value is not of type 'date'.
135140 { target : populateCacheOptions . target , logging : "error" }
0 commit comments