chore: support node 10

This commit is contained in:
calebboyd
2018-04-08 23:35:52 -05:00
committed by Caleb Boyd
parent 5ac93b43ec
commit ad41f07d85
6 changed files with 10817 additions and 495 deletions
+5 -3
View File
@@ -8,16 +8,18 @@ function makeRelative(cwd: string, path: string) {
return './' + relative(cwd, path)
}
let producer = async function(compiler: NexeCompiler) {
let producer = async function(compiler: NexeCompiler): Promise<string> {
const { cwd, input } = compiler.options
const { files } = await resolveFiles(compiler.options.input, { cwd, expand: true })
const { files, entries } = await resolveFiles(input, { cwd, expand: true })
const mainFileContents = (entries[input].contents as string) || ''
Object.keys(files).forEach(filename => {
const file = files[filename]!
if (file && file.contents) {
compiler.addResource(makeRelative(cwd, filename), Buffer.from(file.contents))
}
})
return Promise.resolve('require(' + JSON.stringify(makeRelative(cwd, input)) + ')')
return Promise.resolve(mainFileContents)
}
export default async function bundle(compiler: NexeCompiler, next: any) {