@@ -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 ( "/" ) ;
@@ -121,7 +122,11 @@ function populateR2IncrementalCache(
121122
122123 runWrangler (
123124 options ,
124- [ "r2 object put" , JSON . stringify ( path . join ( bucket , cacheKey ) ) , `--file ${ JSON . stringify ( fullPath ) } ` ] ,
125+ [
126+ "r2 object put" ,
127+ JSON . stringify ( normalizePath ( path . join ( bucket , cacheKey ) ) ) ,
128+ `--file ${ JSON . stringify ( fullPath ) } ` ,
129+ ] ,
125130 // NOTE: R2 does not support the environment flag and results in the following error:
126131 // Incorrect type for the 'cacheExpiry' field on 'HttpMetadata': the provided value is not of type 'date'.
127132 { target : populateCacheOptions . target , excludeRemoteFlag : true , logging : "error" }
0 commit comments