@@ -20,8 +20,8 @@ export class WebContainerFiles {
2020 const cache = new FileMapCache ( logger , server , { contentDir, templatesDir } ) ;
2121
2222 this . _watcher = watch ( [
23- ` ${ contentDir } / **/${ FILES_FOLDER_NAME } /**/*`,
24- ` ${ contentDir } / **/${ SOLUTION_FOLDER_NAME } /**/*`,
23+ path . join ( contentDir , ` **/${ FILES_FOLDER_NAME } /**/*`) ,
24+ path . join ( contentDir , ` **/${ SOLUTION_FOLDER_NAME } /**/*`) ,
2525 templatesDir ,
2626 ] ) ;
2727
@@ -57,12 +57,18 @@ export class WebContainerFiles {
5757 const { contentDir, templatesDir } = this . _folders ( projectRoot ) ;
5858
5959 const folders = await glob (
60- [ `${ contentDir } /**/${ FILES_FOLDER_NAME } ` , `${ contentDir } /**/${ SOLUTION_FOLDER_NAME } ` , `${ templatesDir } /*` ] ,
60+ [
61+ `${ glob . convertPathToPattern ( contentDir ) } /**/${ FILES_FOLDER_NAME } ` ,
62+ `${ glob . convertPathToPattern ( contentDir ) } /**/${ SOLUTION_FOLDER_NAME } ` ,
63+ `${ glob . convertPathToPattern ( templatesDir ) } /*` ,
64+ ] ,
6165 { onlyDirectories : true } ,
6266 ) ;
6367
6468 await Promise . all (
6569 folders . map ( async ( folder ) => {
70+ folder = path . normalize ( folder ) ;
71+
6672 const fileRef = getFilesRef ( folder , { contentDir, templatesDir } ) ;
6773 const dest = fileURLToPath ( new URL ( fileRef , dir ) ) ;
6874
@@ -198,7 +204,7 @@ class FileMapCache {
198204}
199205
200206async function createFileMap ( dir : string ) {
201- const filePaths = await glob ( `${ dir } /**/*` , {
207+ const filePaths = await glob ( `${ glob . convertPathToPattern ( dir ) } /**/*` , {
202208 onlyFiles : true ,
203209 } ) ;
204210
@@ -261,5 +267,5 @@ function getFilesRef(pathToFolder: string, { contentDir, templatesDir }: Content
261267 pathToFolder = 'template' + pathToFolder . slice ( templatesDir . length ) ;
262268 }
263269
264- return encodeURIComponent ( pathToFolder . replaceAll ( '/' , '-' ) . replaceAll ( '_' , '' ) ) + '.json' ;
270+ return encodeURIComponent ( pathToFolder . replaceAll ( / [ \/ \\ ] + / g , '-' ) . replaceAll ( '_' , '' ) ) + '.json' ;
265271}
0 commit comments