fix: export libuv symbols (#24659)

* fix: export libuv symbols

* add test for linux and windows

* mac linker flags

* assuming same foo.so path for macos

* use --whole-archive flag for mac as well

* use force_load for mac

* refactor: use napi c api directly

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
This commit is contained in:
Teo Koon Peng 2020-08-11 18:17:18 +08:00 committed by GitHub
commit 14aba3f0de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 115 additions and 1 deletions

View file

@ -44,6 +44,27 @@ describe('modules support', () => {
});
});
const enablePlatforms: NodeJS.Platform[] = [
'linux',
'darwin',
'win32'
];
ifdescribe(nativeModulesEnabled && enablePlatforms.includes(process.platform))('module that use uv_dlopen', () => {
it('can be required in renderer', async () => {
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } });
w.loadURL('about:blank');
await expect(w.webContents.executeJavaScript('{ require(\'uv-dlopen\'); null }')).to.be.fulfilled();
});
ifit(features.isRunAsNodeEnabled())('can be required in node binary', async function () {
const child = childProcess.fork(path.join(fixtures, 'module', 'uv-dlopen.js'));
await new Promise(resolve => child.once('exit', (exitCode) => {
expect(exitCode).to.equal(0);
resolve();
}));
});
});
describe('q', () => {
describe('Q.when', () => {
it('emits the fullfil callback', (done) => {