@@ -112,6 +112,35 @@ function minsvg(data: string): string {
112112 return result . data
113113}
114114
115+ /**
116+ * Return a path with POSIX style separators
117+ *
118+ * The default function assumes UNIX system, so it just returns the path.
119+ *
120+ * @param p - string path
121+ * @returns String path
122+ */
123+ let assurePosixSep = function ( p : string ) : string {
124+ return p
125+ } ;
126+
127+ /**
128+ * Return a path with POSIX style separators
129+ *
130+ * The Windows variant of this function replaces the separator with regex.
131+ *
132+ * @param p - string path
133+ * @returns String path
134+ */
135+ const winSepRegex = new RegExp ( `\\${ path . win32 . sep } ` , "g" ) ;
136+ function assurePosixSepWin ( p : string ) : string {
137+ return p . replace ( winSepRegex , path . posix . sep )
138+ } ;
139+
140+ if ( path . sep === path . win32 . sep ) {
141+ assurePosixSep = assurePosixSepWin ;
142+ }
143+
115144/* ----------------------------------------------------------------------------
116145 * Tasks
117146 * ------------------------------------------------------------------------- */
@@ -187,7 +216,7 @@ const sources$ = copyAll("**/*.py", {
187216const stylesheets$ = resolve ( "**/[!_]*.scss" , { cwd : "src" } )
188217 . pipe (
189218 mergeMap ( file => zip (
190- of ( ext ( file , ".css" ) . replace ( / ( o v e r r i d e s | t e m p l a t e s ) \/ / , "" ) ) ,
219+ of ( ext ( file , ".css" ) . replace ( new RegExp ( `( overrides|templates)\\ ${ path . sep } ` ) , "" ) ) ,
191220 transformStyle ( {
192221 from : `src/${ file } ` ,
193222 to : ext ( `${ base } /${ file } ` , ".css" )
@@ -199,7 +228,7 @@ const stylesheets$ = resolve("**/[!_]*.scss", { cwd: "src" })
199228const javascripts$ = resolve ( "**/{custom,bundle,search}.ts" , { cwd : "src" } )
200229 . pipe (
201230 mergeMap ( file => zip (
202- of ( ext ( file , ".js" ) . replace ( / ( o v e r r i d e s | t e m p l a t e s ) \/ / , "" ) ) ,
231+ of ( ext ( file , ".js" ) . replace ( new RegExp ( `( overrides|templates)\\ ${ path . sep } ` ) , "" ) ) ,
203232 transformScript ( {
204233 from : `src/${ file } ` ,
205234 to : ext ( `${ base } /${ file } ` , ".js" )
@@ -229,10 +258,10 @@ const manifest$ = merge(
229258 . pipe (
230259 scan ( ( prev , mapping ) => (
231260 mapping . reduce ( ( next , [ key , value ] ) => (
232- next . set ( key , value . replace (
233- new RegExp ( `${ base } \\/(overrides|templates)\\/ ` ) ,
261+ next . set ( assurePosixSep ( key ) , assurePosixSep ( value . replace (
262+ new RegExp ( `${ base } \\/(overrides|templates)\\${ path . sep } ` ) ,
234263 ""
235- ) )
264+ ) ) )
236265 ) , prev )
237266 ) , new Map < string , string > ( ) ) ,
238267 )
@@ -291,8 +320,8 @@ const icons$ = defer(() => resolve("**/*.svg", {
291320} ) )
292321 . pipe (
293322 reduce ( ( index , file ) => index . set (
294- file . replace ( / \. s v g $ / , "" ) . replace ( / \/ / g , "-" ) ,
295- file
323+ file . replace ( / \. s v g $ / , "" ) . replace ( new RegExp ( `\\ ${ path . sep } ` , "g" ) , "-" ) ,
324+ assurePosixSep ( file )
296325 ) , new Map < string , string > ( ) )
297326 )
298327
@@ -372,7 +401,7 @@ const schema$ = merge(
372401 "reference/icons-emojis/#search"
373402 ] . join ( "/" ) ,
374403 "type" : "string" ,
375- "enum" : icons . map ( icon => icon . replace ( ".svg" , "" ) )
404+ "enum" : icons . map ( icon => assurePosixSep ( icon . replace ( ".svg" , "" ) ) )
376405 } ) ) ,
377406 switchMap ( data => write (
378407 "docs/schema/assets/icons.json" ,
0 commit comments