bc2c72d4e8
CI / infra:
- Replace azure-pipelines with GitHub Actions (build-asset.yml)
- Build and publish pre-built assets for windows-x64, mac-arm64,
linux-x64, and linux-x64-musl on tag push
- Remove EOL Node 18 and 20 from build matrix; default to lts/*, 22, 24
Bug fixes:
- fix: _assembleDeliverable deadlock — bundle.finalize() must be called
before MultiStream starts consuming; calling it in the Transform's
first-chunk callback deadlocked because archiver never emits without
finalize, so the sentinel and trailers were never written
- fix: ESM realpathSync ENOENT on Node 22.22+ / Node 24 — these versions
removed the ENOENT catch in finalizeResolution; VFS paths don't exist
on real FS so binding.lstat throws. Two-pronged fix:
(1) boot-nexe.ts: install ENOENT-tolerant wrapper before _compile()
(2) shim.ts: re-apply wrapper after shimFs() overwrites boot-nexe's
patch, so the ESM resolver captures the tolerant version at first
ESM load
- fix: replace got (unmaintained) with axios in download step
- fix: update default remote to oxmc/nexe releases
Features:
- macOS binary signing support (patchMachOExecutable)
- bundleRules option for fine-grained VFS include/exclude per module
- Improved SnapshotZipFS path handling and fallback behaviour
81 lines
3.0 KiB
TypeScript
81 lines
3.0 KiB
TypeScript
import { normalizeOptions } from '../src/options'
|
|
import { expect } from 'chai'
|
|
import * as path from 'path'
|
|
|
|
const ext = process.platform === 'win32' ? '.exe' : ''
|
|
|
|
describe('options', () => {
|
|
describe('cwd', () => {
|
|
it('should use process.cwd() if nothing is provided', () => {
|
|
const options = normalizeOptions()
|
|
expect(options.cwd).to.equal(process.cwd())
|
|
})
|
|
it('should use the main module in a package directory (if not in a TTY)', () => {
|
|
const options = normalizeOptions()
|
|
if (!process.stdin.isTTY) {
|
|
expect(options.input).to.equal('[stdin]')
|
|
} else {
|
|
expect(options.input).to.equal(path.resolve('./index.js'))
|
|
}
|
|
})
|
|
it('should resolve relative paths for input', () => {
|
|
const options = normalizeOptions({ input: 'test/fixture/entry.js' })
|
|
expect(options.input).to.equal(path.resolve('./test/fixture/entry.js'))
|
|
})
|
|
it('should accept a module entry as input', () => {
|
|
const options = normalizeOptions({ input: 'test/fixture' })
|
|
expect(options.input).to.equal(path.resolve('./test/fixture/entry.js'))
|
|
})
|
|
it('should resolve pathed options against cwd', () => {
|
|
const cwd = path.join(process.cwd(), 'test/fixture')
|
|
const options = normalizeOptions({
|
|
cwd,
|
|
input: 'entry',
|
|
output: 'abc',
|
|
temp: './d'
|
|
})
|
|
expect(options.temp).to.equal(path.resolve(cwd, './d'))
|
|
expect(options.input).to.equal(path.resolve(cwd, 'entry.js'))
|
|
expect(options.output).to.equal(path.resolve(cwd, `abc${ext}`))
|
|
})
|
|
})
|
|
|
|
describe('remote', () => {
|
|
it('should use default remote', () => {
|
|
const options = normalizeOptions({})
|
|
expect(options.remote).to.equal(`https://github.com/oxmc/nexe/releases/download/v${require('../package.json').version}/`)
|
|
})
|
|
it('should append trailing slash to third-party remote if necessary', () => {
|
|
const options = normalizeOptions({
|
|
remote: 'https://sitejs.org/nexe'
|
|
})
|
|
expect(options.remote).to.equal('https://sitejs.org/nexe/')
|
|
})
|
|
it('should not append trailing slash to third-party remote that already has one', () => {
|
|
const options = normalizeOptions({
|
|
remote: 'https://sitejs.org/nexe/'
|
|
})
|
|
expect(options.remote).to.equal('https://sitejs.org/nexe/')
|
|
})
|
|
})
|
|
|
|
describe('output', () => {
|
|
it('should work', () => {
|
|
const options = normalizeOptions({
|
|
output: './some-output'
|
|
})
|
|
expect(options.output).to.equal(path.resolve(`./some-output${ext}`))
|
|
})
|
|
it('should default to the input file name if not index', () => {
|
|
const options = normalizeOptions({
|
|
input: './test/fixture'
|
|
})
|
|
expect(options.output).to.equal(path.resolve(`./entry${ext}`))
|
|
})
|
|
it('should default to the folder/project name if filename is index', () => {
|
|
const options = normalizeOptions({ cwd: './test/fixture2' })
|
|
expect(options.output).to.equal(path.resolve(`./test/fixture2/fixture2${ext}`))
|
|
})
|
|
})
|
|
})
|