+4
-4
@@ -15,7 +15,7 @@ import {
|
||||
} from './util'
|
||||
import { NexeOptions, version } from './options'
|
||||
import { NexeTarget } from './target'
|
||||
import combineStreams = require('multistream')
|
||||
import MultiStream = require('multistream')
|
||||
import { Bundle, toStream } from './fs/bundle'
|
||||
|
||||
const isBsd = Boolean(~process.platform.indexOf('bsd'))
|
||||
@@ -136,8 +136,8 @@ export class NexeCompiler {
|
||||
}
|
||||
|
||||
@bound
|
||||
addResource(file: string, content?: Buffer | string) {
|
||||
return this.bundle.addResource(file, content)
|
||||
addResource(absoluteFileName: string, content?: Buffer | string) {
|
||||
return this.bundle.addResource(absoluteFileName, content)
|
||||
}
|
||||
|
||||
get binaryConfiguration() {
|
||||
@@ -309,7 +309,7 @@ export class NexeCompiler {
|
||||
const lengths = Buffer.from(Array(16))
|
||||
lengths.writeDoubleLE(codeSize, 0)
|
||||
lengths.writeDoubleLE(this.bundle.blobSize, 8)
|
||||
return combineStreams([
|
||||
return new (MultiStream as any)([
|
||||
binary,
|
||||
toStream(startup),
|
||||
this.bundle.toStream(),
|
||||
|
||||
+6
-3
@@ -14,9 +14,12 @@ function makeRelative(cwd: string, path: string) {
|
||||
}
|
||||
|
||||
export function toStream(content: Buffer | string) {
|
||||
const readable = new Readable({ read() {} })
|
||||
readable.push(content)
|
||||
readable.push(null)
|
||||
const readable = new Readable({
|
||||
read() {
|
||||
this.push(content)
|
||||
this.push(null)
|
||||
}
|
||||
})
|
||||
return readable
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,9 @@
|
||||
import { NexeCompiler } from '../compiler'
|
||||
import { wrap } from '../util'
|
||||
|
||||
export default function(compiler: NexeCompiler, next: () => Promise<void>) {
|
||||
export default async function(compiler: NexeCompiler, next: () => Promise<void>) {
|
||||
await next()
|
||||
|
||||
compiler.shims.push(
|
||||
wrap(
|
||||
`process.__nexe = ${JSON.stringify(compiler.binaryConfiguration)};\n` +
|
||||
@@ -32,6 +34,4 @@ export default function(compiler: NexeCompiler, next: () => Promise<void>) {
|
||||
}
|
||||
`)
|
||||
)
|
||||
|
||||
return next()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user