Files
nexe/src/patches/flags.ts
T
2022-12-23 12:19:16 -06:00

22 lines
566 B
TypeScript

import type { NexeCompiler } from '../compiler.js'
import { NexeError } from '../compiler.js'
export default async function flags(compiler: NexeCompiler, next: () => Promise<void>) {
const nodeflags = compiler.options.flags
if (nodeflags.length === 0) {
return await next()
}
const replaced = await compiler.replaceInFileAsync(
'node.gyp',
"'node_v8_options%': ''",
`'node_v8_options%': '${nodeflags.join(' ')}'`
)
if (!replaced) {
throw new NexeError('Node Flags not applied. Please report an issue')
}
return await next()
}