File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -189,15 +189,15 @@ export const build = async (...files) => {
189189 }
190190
191191 specificLoadPipeline . push ( async ( source , filepath ) => {
192- for ( const match of source . matchAll ( / r e a d F i l e S y n c \( (?: " ( [ ^ " \\ ] + ) " | ' ( [ ^ ' \\ ] + ) ' ) [ ) , ] / gu) ) {
193- await fsFilesAdd ( match [ 1 ] || match [ 2 ] )
192+ for ( const m of source . matchAll ( / r e a d F i l e S y n c \( \s * (?: " ( [ ^ " \\ ] + ) " | ' ( [ ^ ' \\ ] + ) ' ) [ ) , ] / gu) ) {
193+ await fsFilesAdd ( m [ 1 ] || m [ 2 ] )
194194 }
195195
196196 // E.g. path.join(import.meta.dirname, './fixtures/data.json'), dirname is inlined by loadPipeline already
197197 const dir = dirname ( filepath )
198- for ( const match of source . matchAll ( / j o i n \( ( " [ ^ " \\ ] + " ) , (?: " ( [ ^ " \\ ] + ) " | ' ( [ ^ ' \\ ] + ) ' ) \) / gu) ) {
199- if ( match [ 1 ] !== JSON . stringify ( dir ) ) continue // only allow files relative to dirname, from loadPipeline
200- const file = relative ( cwd , join ( dir , match [ 2 ] || match [ 3 ] ) )
198+ for ( const m of source . matchAll ( / j o i n \( \s * ( " [ ^ " \\ ] + " ) , \s * (?: " ( [ ^ " \\ ] + ) " | ' ( [ ^ ' \\ ] + ) ' ) \s * \) / gu) ) {
199+ if ( m [ 1 ] !== JSON . stringify ( dir ) ) continue // only allow files relative to dirname, from loadPipeline
200+ const file = relative ( cwd , join ( dir , m [ 2 ] || m [ 3 ] ) )
201201 if ( / \. ( j s o n | t x t ) $ / u. test ( file ) ) await fsFilesAdd ( file ) // only allow json/txt files
202202 }
203203
You can’t perform that action at this time.
0 commit comments