Compare commits

..

10 Commits

@ -1,3 +1,3 @@
# loader # loader
loader: loads content in a frame and sets up sandbox and CSP loader: builds content to load in a frame and set up sandbox and CSP

@ -61,7 +61,7 @@ export class Builder {
return `// append: ${s}\n${match}` return `// append: ${s}\n${match}`
} }
).replaceAll( ).replaceAll(
/^\s*import\s+(\{[^}]+\})\s+from\s+("[^"]+"|')/gms, /^\s*import\s+(\{[^}]+\})\s+from\s+("[^"]+")/gms,
(match, p1, p2) => { (match, p1, p2) => {
const vars = p1.replaceAll(' as ', ': ') const vars = p1.replaceAll(' as ', ': ')
const importPath = p2.slice(1, -1) const importPath = p2.slice(1, -1)
@ -91,7 +91,7 @@ export class Builder {
) )
) )
} else { } else {
return s => s return ({data}) => data
} }
} }
@ -101,22 +101,29 @@ export class Builder {
({name, data}) => ([name, data]) ({name, data}) => ([name, data])
) )
) )
const replace = this.buildReplace(filesMap)
const intro = this.buildModule({ const intro = this.buildModule({
name: '_intro.js', name: '_intro.js',
data: ( data: replace({
'_intro.js' in filesMap ? name: '_intro.js',
filesMap['_intro.js'] : data: (
defaultIntro '_intro.js' in filesMap ?
), filesMap['_intro.js'] :
defaultIntro
),
files: this.files,
})
}) })
const replace = this.buildReplace(filesMap)
const modules = this.files.filter(({name}) => ( const modules = this.files.filter(({name}) => (
name.endsWith('.js') && name.endsWith('.js') &&
!name.startsWith('_') !name.startsWith('_')
)).map(file => ( )).map(file => (
this.buildModule({ this.buildModule({
...file, ...file,
data: replace(file.data), data: replace({
...file,
files: this.files,
}),
}) })
)) ))
const styles = this.files.filter(({name}) => ( const styles = this.files.filter(({name}) => (

@ -5,9 +5,11 @@ export class EditorBuild {
'forms/button-group.js', 'forms/button-group.js',
'dialog/dialog.js', 'dialog/dialog.js',
'menu/dropdown.js', 'menu/dropdown.js',
'editor/header.js',
'editor/file-group.js', 'editor/file-group.js',
'editor/file-view.js', 'editor/file-view.js',
'editor/text-edit.js', 'editor/text-edit.js',
'editor/code-edit.js',
'loader/builder.js', 'loader/builder.js',
'editor/app.js', 'editor/app.js',
] ]

Loading…
Cancel
Save