-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
n-api: remove n-api module loading flag
Remove the command line flag that was needed for N-API module loading. Re: nodejs/vm#9 PR-URL: #14902 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Hitesh Kanwathirtha <digitalinfinity@gmail.com>
- Loading branch information
Showing
15 changed files
with
86 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "test_warning", | ||
"sources": [ "test_warning.c" ] | ||
}, | ||
{ | ||
"target_name": "test_warning2", | ||
"sources": [ "test_warning2.c" ] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
if (process.argv[2] === 'child') { | ||
const common = require('../../common'); | ||
console.log(require(`./build/${common.buildType}/test_warning`)); | ||
console.log(require(`./build/${common.buildType}/test_warning2`)); | ||
} else { | ||
const run = require('child_process').spawnSync; | ||
const assert = require('assert'); | ||
const warning = 'Warning: N-API is an experimental feature and could ' + | ||
'change at any time.'; | ||
|
||
const result = run(process.execPath, [__filename, 'child']); | ||
assert.deepStrictEqual(result.stdout.toString().match(/\S+/g), ['42', '1337'], | ||
'Modules loaded correctly'); | ||
assert.deepStrictEqual(result.stderr.toString().split(warning).length, 2, | ||
'Warning was displayed only once'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <node_api.h> | ||
#include "../common.h" | ||
|
||
napi_value Init(napi_env env, napi_value exports) { | ||
napi_value result; | ||
NAPI_CALL(env, | ||
napi_create_uint32(env, 42, &result)); | ||
return result; | ||
} | ||
|
||
NAPI_MODULE(test_warning, Init) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <node_api.h> | ||
#include "../common.h" | ||
|
||
napi_value Init(napi_env env, napi_value exports) { | ||
napi_value result; | ||
NAPI_CALL(env, | ||
napi_create_uint32(env, 1337, &result)); | ||
return result; | ||
} | ||
|
||
NAPI_MODULE(test_warning2, Init) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters