node-addon-api 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/README.md +67 -47
- package/napi-inl.deprecated.h +8 -8
- package/napi-inl.h +118 -80
- package/napi.h +513 -424
- package/package.json +25 -5
- package/tools/clang-format.js +30 -10
- package/.clang-format +0 -111
- package/.editorconfig +0 -8
- package/.github/workflows/ci.yml +0 -55
- package/.github/workflows/linter.yml +0 -24
- package/.github/workflows/stale.yml +0 -18
- package/.travis.yml +0 -58
- package/CODE_OF_CONDUCT.md +0 -4
- package/CONTRIBUTING.md +0 -66
- package/appveyor.yml +0 -37
- package/benchmark/README.md +0 -47
- package/benchmark/binding.gyp +0 -25
- package/benchmark/function_args.cc +0 -217
- package/benchmark/function_args.js +0 -60
- package/benchmark/index.js +0 -34
- package/benchmark/property_descriptor.cc +0 -91
- package/benchmark/property_descriptor.js +0 -37
- package/doc/addon.md +0 -157
- package/doc/array.md +0 -81
- package/doc/array_buffer.md +0 -149
- package/doc/async_context.md +0 -86
- package/doc/async_operations.md +0 -31
- package/doc/async_worker.md +0 -427
- package/doc/async_worker_variants.md +0 -557
- package/doc/bigint.md +0 -97
- package/doc/boolean.md +0 -68
- package/doc/buffer.md +0 -144
- package/doc/callback_scope.md +0 -54
- package/doc/callbackinfo.md +0 -97
- package/doc/checker-tool.md +0 -32
- package/doc/class_property_descriptor.md +0 -117
- package/doc/cmake-js.md +0 -68
- package/doc/conversion-tool.md +0 -28
- package/doc/creating_a_release.md +0 -62
- package/doc/dataview.md +0 -248
- package/doc/date.md +0 -68
- package/doc/env.md +0 -132
- package/doc/error.md +0 -120
- package/doc/error_handling.md +0 -186
- package/doc/escapable_handle_scope.md +0 -82
- package/doc/external.md +0 -63
- package/doc/function.md +0 -402
- package/doc/function_reference.md +0 -238
- package/doc/generator.md +0 -13
- package/doc/handle_scope.md +0 -65
- package/doc/hierarchy.md +0 -91
- package/doc/instance_wrap.md +0 -408
- package/doc/memory_management.md +0 -27
- package/doc/name.md +0 -29
- package/doc/node-gyp.md +0 -82
- package/doc/number.md +0 -163
- package/doc/object.md +0 -279
- package/doc/object_lifetime_management.md +0 -83
- package/doc/object_reference.md +0 -117
- package/doc/object_wrap.md +0 -561
- package/doc/prebuild_tools.md +0 -16
- package/doc/promises.md +0 -79
- package/doc/property_descriptor.md +0 -286
- package/doc/range_error.md +0 -59
- package/doc/reference.md +0 -111
- package/doc/setup.md +0 -81
- package/doc/string.md +0 -93
- package/doc/symbol.md +0 -48
- package/doc/threadsafe.md +0 -121
- package/doc/threadsafe_function.md +0 -290
- package/doc/type_error.md +0 -59
- package/doc/typed_array.md +0 -78
- package/doc/typed_array_of.md +0 -137
- package/doc/typed_threadsafe_function.md +0 -307
- package/doc/value.md +0 -340
- package/doc/version_management.md +0 -43
package/package.json
CHANGED
|
@@ -115,6 +115,10 @@
|
|
|
115
115
|
"name": "ikokostya",
|
|
116
116
|
"url": "https://github.com/ikokostya"
|
|
117
117
|
},
|
|
118
|
+
{
|
|
119
|
+
"name": "Jack Xia",
|
|
120
|
+
"url": "https://github.com/JckXia"
|
|
121
|
+
},
|
|
118
122
|
{
|
|
119
123
|
"name": "Jake Barnes",
|
|
120
124
|
"url": "https://github.com/DuBistKomisch"
|
|
@@ -139,6 +143,10 @@
|
|
|
139
143
|
"name": "Jinho Bang",
|
|
140
144
|
"url": "https://github.com/romandev"
|
|
141
145
|
},
|
|
146
|
+
{
|
|
147
|
+
"name": "José Expósito",
|
|
148
|
+
"url": "https://github.com/JoseExposito"
|
|
149
|
+
},
|
|
142
150
|
{
|
|
143
151
|
"name": "joshgarde",
|
|
144
152
|
"url": "https://github.com/joshgarde"
|
|
@@ -155,6 +163,10 @@
|
|
|
155
163
|
"name": "Kevin Eady",
|
|
156
164
|
"url": "https://github.com/KevinEady"
|
|
157
165
|
},
|
|
166
|
+
{
|
|
167
|
+
"name": "Kévin VOYER",
|
|
168
|
+
"url": "https://github.com/kecsou"
|
|
169
|
+
},
|
|
158
170
|
{
|
|
159
171
|
"name": "kidneysolo",
|
|
160
172
|
"url": "https://github.com/kidneysolo"
|
|
@@ -175,6 +187,10 @@
|
|
|
175
187
|
"name": "legendecas",
|
|
176
188
|
"url": "https://github.com/legendecas"
|
|
177
189
|
},
|
|
190
|
+
{
|
|
191
|
+
"name": "LongYinan",
|
|
192
|
+
"url": "https://github.com/Brooooooklyn"
|
|
193
|
+
},
|
|
178
194
|
{
|
|
179
195
|
"name": "Lovell Fuller",
|
|
180
196
|
"url": "https://github.com/lovell"
|
|
@@ -296,8 +312,7 @@
|
|
|
296
312
|
"url": "https://github.com/ZzqiZQute"
|
|
297
313
|
}
|
|
298
314
|
],
|
|
299
|
-
"
|
|
300
|
-
"description": "Node.js API (N-API)",
|
|
315
|
+
"description": "Node.js API (Node-API)",
|
|
301
316
|
"devDependencies": {
|
|
302
317
|
"benchmark": "^2.1.4",
|
|
303
318
|
"bindings": "^1.5.0",
|
|
@@ -329,6 +344,11 @@
|
|
|
329
344
|
"type": "git",
|
|
330
345
|
"url": "git://github.com/nodejs/node-addon-api.git"
|
|
331
346
|
},
|
|
347
|
+
"files": [
|
|
348
|
+
"*.{c,h,gyp,gypi}",
|
|
349
|
+
"package-support.json",
|
|
350
|
+
"tools/"
|
|
351
|
+
],
|
|
332
352
|
"scripts": {
|
|
333
353
|
"prebenchmark": "node-gyp rebuild -C benchmark",
|
|
334
354
|
"benchmark": "node benchmark",
|
|
@@ -339,10 +359,10 @@
|
|
|
339
359
|
"predev:incremental": "node-gyp configure build -C test --debug",
|
|
340
360
|
"dev:incremental": "node test",
|
|
341
361
|
"doc": "doxygen doc/Doxyfile",
|
|
342
|
-
"lint": "node tools/clang-format
|
|
343
|
-
"lint:fix": "
|
|
362
|
+
"lint": "node tools/clang-format",
|
|
363
|
+
"lint:fix": "node tools/clang-format --fix"
|
|
344
364
|
},
|
|
345
365
|
"pre-commit": "lint",
|
|
346
|
-
"version": "3.
|
|
366
|
+
"version": "3.2.0",
|
|
347
367
|
"support": true
|
|
348
368
|
}
|
package/tools/clang-format.js
CHANGED
|
@@ -4,40 +4,60 @@ const spawn = require('child_process').spawnSync;
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
|
|
6
6
|
const filesToCheck = ['*.h', '*.cc'];
|
|
7
|
-
const CLANG_FORMAT_START = process.env.CLANG_FORMAT_START || '
|
|
7
|
+
const CLANG_FORMAT_START = process.env.CLANG_FORMAT_START || 'main';
|
|
8
8
|
|
|
9
9
|
function main(args) {
|
|
10
|
+
let fix = false;
|
|
11
|
+
while (args.length > 0) {
|
|
12
|
+
switch (args[0]) {
|
|
13
|
+
case '-f':
|
|
14
|
+
case '--fix':
|
|
15
|
+
fix = true;
|
|
16
|
+
default:
|
|
17
|
+
}
|
|
18
|
+
args.shift();
|
|
19
|
+
}
|
|
20
|
+
|
|
10
21
|
let clangFormatPath = path.dirname(require.resolve('clang-format'));
|
|
11
22
|
const options = ['--binary=node_modules/.bin/clang-format', '--style=file'];
|
|
23
|
+
if (fix) {
|
|
24
|
+
options.push(CLANG_FORMAT_START);
|
|
25
|
+
} else {
|
|
26
|
+
options.push('--diff', CLANG_FORMAT_START);
|
|
27
|
+
}
|
|
12
28
|
|
|
13
29
|
const gitClangFormatPath = path.join(clangFormatPath,
|
|
14
30
|
'bin/git-clang-format');
|
|
15
31
|
const result = spawn('python', [
|
|
16
32
|
gitClangFormatPath,
|
|
17
33
|
...options,
|
|
18
|
-
'--
|
|
19
|
-
CLANG_FORMAT_START,
|
|
20
|
-
'HEAD',
|
|
34
|
+
'--',
|
|
21
35
|
...filesToCheck
|
|
22
36
|
], { encoding: 'utf-8' });
|
|
23
37
|
|
|
24
|
-
if (result.
|
|
25
|
-
console.error('Error running git-clang-format:', result.
|
|
38
|
+
if (result.stderr) {
|
|
39
|
+
console.error('Error running git-clang-format:', result.stderr);
|
|
26
40
|
return 2;
|
|
27
41
|
}
|
|
28
42
|
|
|
29
43
|
const clangFormatOutput = result.stdout.trim();
|
|
44
|
+
// Bail fast if in fix mode.
|
|
45
|
+
if (fix) {
|
|
46
|
+
console.log(clangFormatOutput);
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
// Detect if there is any complains from clang-format
|
|
30
50
|
if (clangFormatOutput !== '' &&
|
|
31
51
|
clangFormatOutput !== ('no modified files to format') &&
|
|
32
52
|
clangFormatOutput !== ('clang-format did not modify any files')) {
|
|
33
53
|
console.error(clangFormatOutput);
|
|
34
|
-
const fixCmd = '
|
|
54
|
+
const fixCmd = 'npm run lint:fix';
|
|
35
55
|
console.error(`
|
|
36
|
-
ERROR: please run ${fixCmd} to format changes in your commit
|
|
56
|
+
ERROR: please run "${fixCmd}" to format changes in your commit
|
|
37
57
|
Note that when running the command locally, please keep your local
|
|
38
|
-
|
|
58
|
+
main branch and working branch up to date with nodejs/node-addon-api
|
|
39
59
|
to exclude un-related complains.
|
|
40
|
-
Or you can run "env CLANG_FORMAT_START=upstream/
|
|
60
|
+
Or you can run "env CLANG_FORMAT_START=upstream/main ${fixCmd}".`);
|
|
41
61
|
return 1;
|
|
42
62
|
}
|
|
43
63
|
}
|
package/.clang-format
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
Language: Cpp
|
|
3
|
-
# BasedOnStyle: Google
|
|
4
|
-
AccessModifierOffset: -1
|
|
5
|
-
AlignAfterOpenBracket: Align
|
|
6
|
-
AlignConsecutiveAssignments: false
|
|
7
|
-
AlignConsecutiveDeclarations: false
|
|
8
|
-
AlignEscapedNewlines: Right
|
|
9
|
-
AlignOperands: true
|
|
10
|
-
AlignTrailingComments: true
|
|
11
|
-
AllowAllParametersOfDeclarationOnNextLine: true
|
|
12
|
-
AllowShortBlocksOnASingleLine: false
|
|
13
|
-
AllowShortCaseLabelsOnASingleLine: false
|
|
14
|
-
AllowShortFunctionsOnASingleLine: Inline
|
|
15
|
-
AllowShortIfStatementsOnASingleLine: true
|
|
16
|
-
AllowShortLoopsOnASingleLine: true
|
|
17
|
-
AlwaysBreakAfterDefinitionReturnType: None
|
|
18
|
-
AlwaysBreakAfterReturnType: None
|
|
19
|
-
AlwaysBreakBeforeMultilineStrings: false
|
|
20
|
-
AlwaysBreakTemplateDeclarations: true
|
|
21
|
-
BinPackArguments: false
|
|
22
|
-
BinPackParameters: false
|
|
23
|
-
BraceWrapping:
|
|
24
|
-
AfterClass: false
|
|
25
|
-
AfterControlStatement: false
|
|
26
|
-
AfterEnum: false
|
|
27
|
-
AfterFunction: false
|
|
28
|
-
AfterNamespace: false
|
|
29
|
-
AfterObjCDeclaration: false
|
|
30
|
-
AfterStruct: false
|
|
31
|
-
AfterUnion: false
|
|
32
|
-
AfterExternBlock: false
|
|
33
|
-
BeforeCatch: false
|
|
34
|
-
BeforeElse: false
|
|
35
|
-
IndentBraces: false
|
|
36
|
-
SplitEmptyFunction: true
|
|
37
|
-
SplitEmptyRecord: true
|
|
38
|
-
SplitEmptyNamespace: true
|
|
39
|
-
BreakBeforeBinaryOperators: None
|
|
40
|
-
BreakBeforeBraces: Attach
|
|
41
|
-
BreakBeforeInheritanceComma: false
|
|
42
|
-
BreakBeforeTernaryOperators: true
|
|
43
|
-
BreakConstructorInitializersBeforeComma: false
|
|
44
|
-
BreakConstructorInitializers: BeforeColon
|
|
45
|
-
BreakAfterJavaFieldAnnotations: false
|
|
46
|
-
BreakStringLiterals: true
|
|
47
|
-
ColumnLimit: 80
|
|
48
|
-
CommentPragmas: '^ IWYU pragma:'
|
|
49
|
-
CompactNamespaces: false
|
|
50
|
-
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
|
51
|
-
ConstructorInitializerIndentWidth: 4
|
|
52
|
-
ContinuationIndentWidth: 4
|
|
53
|
-
Cpp11BracedListStyle: true
|
|
54
|
-
DerivePointerAlignment: false
|
|
55
|
-
DisableFormat: false
|
|
56
|
-
ExperimentalAutoDetectBinPacking: false
|
|
57
|
-
FixNamespaceComments: true
|
|
58
|
-
ForEachMacros:
|
|
59
|
-
- foreach
|
|
60
|
-
- Q_FOREACH
|
|
61
|
-
- BOOST_FOREACH
|
|
62
|
-
IncludeBlocks: Preserve
|
|
63
|
-
IncludeCategories:
|
|
64
|
-
- Regex: '^<ext/.*\.h>'
|
|
65
|
-
Priority: 2
|
|
66
|
-
- Regex: '^<.*\.h>'
|
|
67
|
-
Priority: 1
|
|
68
|
-
- Regex: '^<.*'
|
|
69
|
-
Priority: 2
|
|
70
|
-
- Regex: '.*'
|
|
71
|
-
Priority: 3
|
|
72
|
-
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
|
73
|
-
IndentCaseLabels: true
|
|
74
|
-
IndentPPDirectives: None
|
|
75
|
-
IndentWidth: 2
|
|
76
|
-
IndentWrappedFunctionNames: false
|
|
77
|
-
JavaScriptQuotes: Leave
|
|
78
|
-
JavaScriptWrapImports: true
|
|
79
|
-
KeepEmptyLinesAtTheStartOfBlocks: false
|
|
80
|
-
MacroBlockBegin: ''
|
|
81
|
-
MacroBlockEnd: ''
|
|
82
|
-
MaxEmptyLinesToKeep: 1
|
|
83
|
-
NamespaceIndentation: None
|
|
84
|
-
ObjCBlockIndentWidth: 2
|
|
85
|
-
ObjCSpaceAfterProperty: false
|
|
86
|
-
ObjCSpaceBeforeProtocolList: false
|
|
87
|
-
PenaltyBreakAssignment: 2
|
|
88
|
-
PenaltyBreakBeforeFirstCallParameter: 1
|
|
89
|
-
PenaltyBreakComment: 300
|
|
90
|
-
PenaltyBreakFirstLessLess: 120
|
|
91
|
-
PenaltyBreakString: 1000
|
|
92
|
-
PenaltyExcessCharacter: 1000000
|
|
93
|
-
PenaltyReturnTypeOnItsOwnLine: 200
|
|
94
|
-
PointerAlignment: Left
|
|
95
|
-
ReflowComments: true
|
|
96
|
-
SortIncludes: true
|
|
97
|
-
SortUsingDeclarations: true
|
|
98
|
-
SpaceAfterCStyleCast: false
|
|
99
|
-
SpaceAfterTemplateKeyword: true
|
|
100
|
-
SpaceBeforeAssignmentOperators: true
|
|
101
|
-
SpaceBeforeParens: ControlStatements
|
|
102
|
-
SpaceInEmptyParentheses: false
|
|
103
|
-
SpacesBeforeTrailingComments: 2
|
|
104
|
-
SpacesInAngles: false
|
|
105
|
-
SpacesInContainerLiterals: true
|
|
106
|
-
SpacesInCStyleCastParentheses: false
|
|
107
|
-
SpacesInParentheses: false
|
|
108
|
-
SpacesInSquareBrackets: false
|
|
109
|
-
Standard: Auto
|
|
110
|
-
TabWidth: 8
|
|
111
|
-
UseTab: Never
|
package/.editorconfig
DELETED
package/.github/workflows/ci.yml
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
name: Node.js CI
|
|
2
|
-
|
|
3
|
-
on: [push, pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
test:
|
|
7
|
-
timeout-minutes: 30
|
|
8
|
-
strategy:
|
|
9
|
-
matrix:
|
|
10
|
-
node-version:
|
|
11
|
-
- node/10
|
|
12
|
-
- node/12
|
|
13
|
-
- node/14
|
|
14
|
-
- node/15
|
|
15
|
-
compiler:
|
|
16
|
-
- gcc
|
|
17
|
-
- clang
|
|
18
|
-
os:
|
|
19
|
-
- ubuntu-16.04 # ubuntu-18.04/ubuntu-latest missing package g++-4.9
|
|
20
|
-
- macos-latest
|
|
21
|
-
runs-on: ${{ matrix.os }}
|
|
22
|
-
steps:
|
|
23
|
-
- uses: actions/checkout@v2
|
|
24
|
-
- name: Install system dependencies
|
|
25
|
-
run: |
|
|
26
|
-
if [ "${{ matrix.compiler }}" = "gcc" -a "${{ matrix.os }}" = ubuntu-* ]; then
|
|
27
|
-
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
|
28
|
-
sudo apt-get update
|
|
29
|
-
sudo apt-get install g++-4.9
|
|
30
|
-
fi
|
|
31
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
32
|
-
run: |
|
|
33
|
-
git clone --branch v1.4.2 --depth 1 https://github.com/jasongin/nvs ~/.nvs
|
|
34
|
-
. ~/.nvs/nvs.sh
|
|
35
|
-
nvs --version
|
|
36
|
-
nvs add ${{ matrix.node-version }}
|
|
37
|
-
nvs use ${{ matrix.node-version }}
|
|
38
|
-
node --version
|
|
39
|
-
npm --version
|
|
40
|
-
npm install
|
|
41
|
-
- name: npm test
|
|
42
|
-
run: |
|
|
43
|
-
if [ "${{ matrix.compiler }}" = "gcc" ]; then
|
|
44
|
-
export CC="gcc" CXX="g++"
|
|
45
|
-
fi
|
|
46
|
-
if [ "${{ matrix.compiler }}" = "gcc" -a "${{ matrix.os }}" = ubuntu-* ]; then
|
|
47
|
-
export CC="gcc-4.9" CXX="g++-4.9" AR="gcc-ar-4.9" RANLIB="gcc-ranlib-4.9" NM="gcc-nm-4.9"
|
|
48
|
-
fi
|
|
49
|
-
if [ "${{ matrix.compiler }}" = "clang" ]; then
|
|
50
|
-
export CC="clang" CXX="clang++"
|
|
51
|
-
fi
|
|
52
|
-
export CFLAGS="$CFLAGS -O3 --coverage" LDFLAGS="$LDFLAGS --coverage"
|
|
53
|
-
echo "CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS\""
|
|
54
|
-
npm run pretest -- --verbose
|
|
55
|
-
node test
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
name: Style Checks
|
|
2
|
-
|
|
3
|
-
on: [push, pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
lint:
|
|
7
|
-
if: github.repository == 'nodejs/node-addon-api'
|
|
8
|
-
strategy:
|
|
9
|
-
matrix:
|
|
10
|
-
node-version: [14.x]
|
|
11
|
-
os: [ubuntu-latest]
|
|
12
|
-
|
|
13
|
-
runs-on: ${{ matrix.os }}
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v2
|
|
16
|
-
with:
|
|
17
|
-
fetch-depth: 0
|
|
18
|
-
- run: git branch -a
|
|
19
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
-
uses: actions/setup-node@v1
|
|
21
|
-
with:
|
|
22
|
-
node-version: ${{ matrix.node-version }}
|
|
23
|
-
- run: npm install
|
|
24
|
-
- run: CLANG_FORMAT_START=refs/remotes/origin/master npm run lint
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
name: "Close stale issues"
|
|
2
|
-
on:
|
|
3
|
-
schedule:
|
|
4
|
-
- cron: "0 0 * * *"
|
|
5
|
-
|
|
6
|
-
jobs:
|
|
7
|
-
stale:
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
steps:
|
|
10
|
-
- uses: actions/stale@v1
|
|
11
|
-
with:
|
|
12
|
-
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
13
|
-
stale-issue-message: 'This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.'
|
|
14
|
-
stale-issue-label: 'stale'
|
|
15
|
-
exempt-issue-label: 'never stale'
|
|
16
|
-
days-before-stale: 90
|
|
17
|
-
days-before-close: 30
|
|
18
|
-
|
package/.travis.yml
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
language: c++
|
|
2
|
-
compiler:
|
|
3
|
-
- clang
|
|
4
|
-
- gcc
|
|
5
|
-
# For Linux, use an Ubuntu 14 image
|
|
6
|
-
dist: trusty
|
|
7
|
-
os:
|
|
8
|
-
- linux
|
|
9
|
-
- osx
|
|
10
|
-
env:
|
|
11
|
-
global:
|
|
12
|
-
# https://github.com/jasongin/nvs/blob/master/doc/CI.md
|
|
13
|
-
- NVS_VERSION=1.4.2
|
|
14
|
-
matrix:
|
|
15
|
-
- NODEJS_VERSION=node/10
|
|
16
|
-
- NODEJS_VERSION=node/12
|
|
17
|
-
- NODEJS_VERSION=node/14
|
|
18
|
-
- NODEJS_VERSION=nightly
|
|
19
|
-
matrix:
|
|
20
|
-
fast_finish: true
|
|
21
|
-
allow_failures:
|
|
22
|
-
- env: NODEJS_VERSION=nightly
|
|
23
|
-
cache:
|
|
24
|
-
directories:
|
|
25
|
-
- node_modules
|
|
26
|
-
- $HOME/.npm
|
|
27
|
-
addons:
|
|
28
|
-
apt:
|
|
29
|
-
sources:
|
|
30
|
-
- ubuntu-toolchain-r-test
|
|
31
|
-
packages:
|
|
32
|
-
- g++-4.9
|
|
33
|
-
before_install:
|
|
34
|
-
# coveralls
|
|
35
|
-
- pip2 install --user cpp-coveralls
|
|
36
|
-
# compilers
|
|
37
|
-
- if [ "$CXX" = "g++" -a "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="g++-4.9" CC="gcc-4.9" AR="gcc-ar-4.9" RANLIB="gcc-ranlib-4.9" NM="gcc-nm-4.9" ; fi
|
|
38
|
-
- if [ "$CXX" = "clang++" ]; then export NPMOPT=--clang=1 ; fi
|
|
39
|
-
- export CFLAGS="$CFLAGS -O3 --coverage" LDFLAGS="$LDFLAGS --coverage"
|
|
40
|
-
- echo "CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS\""
|
|
41
|
-
# nvs
|
|
42
|
-
- git clone --branch v$NVS_VERSION --depth 1 https://github.com/jasongin/nvs ~/.nvs
|
|
43
|
-
- . ~/.nvs/nvs.sh
|
|
44
|
-
- nvs --version
|
|
45
|
-
# node.js
|
|
46
|
-
- nvs add $NODEJS_VERSION
|
|
47
|
-
- nvs use $NODEJS_VERSION
|
|
48
|
-
- node --version
|
|
49
|
-
- npm --version
|
|
50
|
-
install:
|
|
51
|
-
- npm install $NPMOPT
|
|
52
|
-
script:
|
|
53
|
-
# Travis CI sets NVM_NODEJS_ORG_MIRROR, but it makes node-gyp fail to download headers for nightly builds.
|
|
54
|
-
- unset NVM_NODEJS_ORG_MIRROR
|
|
55
|
-
|
|
56
|
-
- npm test
|
|
57
|
-
after_success:
|
|
58
|
-
- cpp-coveralls --gcov-options '\-lp' --build-root test/build --exclude test
|
package/CODE_OF_CONDUCT.md
DELETED
package/CONTRIBUTING.md
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# **node-addon-api** Contribution Philosophy
|
|
2
|
-
|
|
3
|
-
The **node-addon-api** team loves contributions. There are many ways in which you can
|
|
4
|
-
contribute to **node-addon-api**:
|
|
5
|
-
- Source code fixes
|
|
6
|
-
- Additional tests
|
|
7
|
-
- Documentation improvements
|
|
8
|
-
- Joining the N-API working group and participating in meetings
|
|
9
|
-
|
|
10
|
-
## Source changes
|
|
11
|
-
|
|
12
|
-
**node-addon-api** is meant to be a thin convenience wrapper around N-API. With this
|
|
13
|
-
in mind, contributions of any new APIs that wrap around a core N-API API will
|
|
14
|
-
be considered for merge. However, changes that wrap existing **node-addon-api**
|
|
15
|
-
APIs are encouraged to instead be provided as an ecosystem module. The
|
|
16
|
-
**node-addon-api** team is happy to link to a curated set of modules that build on
|
|
17
|
-
top of **node-addon-api** if they have broad usefulness to the community and promote
|
|
18
|
-
a recommended idiom or pattern.
|
|
19
|
-
|
|
20
|
-
### Rationale
|
|
21
|
-
|
|
22
|
-
The N-API team considered a couple different approaches with regards to changes
|
|
23
|
-
extending **node-addon-api**
|
|
24
|
-
- Larger core module - Incorporate these helpers and patterns into **node-addon-api**
|
|
25
|
-
- Extras package - Create a new package (strawman name '**node-addon-api**-extras')
|
|
26
|
-
that contain utility classes and methods that help promote good patterns and
|
|
27
|
-
idioms while writing native addons with **node-addon-api**.
|
|
28
|
-
- Ecosystem - Encourage creation of a module ecosystem around **node-addon-api**
|
|
29
|
-
where folks can build on top of it.
|
|
30
|
-
|
|
31
|
-
#### Larger Core
|
|
32
|
-
This is probably our simplest option in terms of immediate action needed. It
|
|
33
|
-
would involve landing any open PRs against **node-addon-api**, and continuing to
|
|
34
|
-
encourage folks to make PRs for utility helpers against the same repository.
|
|
35
|
-
|
|
36
|
-
The downside of the approach is the following:
|
|
37
|
-
- Less coherency for our API set
|
|
38
|
-
- More maintenance burden on the N-API WG core team.
|
|
39
|
-
|
|
40
|
-
#### Extras Package
|
|
41
|
-
This involves us spinning up a new package which contains the utility classes
|
|
42
|
-
and methods. This has the benefit of having a separate module where helpers
|
|
43
|
-
which make it easier to implement certain patterns and idioms for native addons
|
|
44
|
-
easier.
|
|
45
|
-
|
|
46
|
-
The downside of this approach is the following:
|
|
47
|
-
- Potential for confusion - we'll need to provide clear documentation to help the
|
|
48
|
-
community understand where a particular contribution should be directed to (what
|
|
49
|
-
belongs in **node-addon-api** vs **node-addon-api-extras**)
|
|
50
|
-
- Need to define the level of support/API guarantees
|
|
51
|
-
- Unclear if the maintenance burden on the N-API WG is reduced or not
|
|
52
|
-
|
|
53
|
-
#### Ecosystem
|
|
54
|
-
This doesn't require a ton of up-front work from the N-API WG. Instead of
|
|
55
|
-
accepting utility PRs into **node-addon-api** or creating and maintaining a new
|
|
56
|
-
module, the WG will encourage the creation of an ecosystem of modules that
|
|
57
|
-
build on top of **node-addon-api**, and provide some level of advertising for these
|
|
58
|
-
modules (listing them out on the repository/wiki, using them in workshops/tutorials
|
|
59
|
-
etc).
|
|
60
|
-
|
|
61
|
-
The downside of this approach is the following:
|
|
62
|
-
- Potential for lack of visibility - evangelism and education is hard, and module
|
|
63
|
-
authors might not find right patterns and instead implement things themselves
|
|
64
|
-
- There might be greater friction for the N-API WG in evolving APIs since the
|
|
65
|
-
ecosystem would have taken dependencies on the API shape of **node-addon-api**
|
|
66
|
-
|
package/appveyor.yml
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
environment:
|
|
2
|
-
# https://github.com/jasongin/nvs/blob/master/doc/CI.md
|
|
3
|
-
NVS_VERSION: 1.4.2
|
|
4
|
-
matrix:
|
|
5
|
-
- NODEJS_VERSION: node/10
|
|
6
|
-
- NODEJS_VERSION: node/12
|
|
7
|
-
- NODEJS_VERSION: node/14
|
|
8
|
-
- NODEJS_VERSION: nightly
|
|
9
|
-
|
|
10
|
-
os: Visual Studio 2017
|
|
11
|
-
platform:
|
|
12
|
-
- x86
|
|
13
|
-
- x64
|
|
14
|
-
|
|
15
|
-
install:
|
|
16
|
-
# nvs
|
|
17
|
-
- git clone --branch v%NVS_VERSION% --depth 1 https://github.com/jasongin/nvs %LOCALAPPDATA%\nvs
|
|
18
|
-
- set PATH=%LOCALAPPDATA%\nvs;%PATH%
|
|
19
|
-
- nvs --version
|
|
20
|
-
# node.js
|
|
21
|
-
- nvs add %NODEJS_VERSION%/%PLATFORM%
|
|
22
|
-
- nvs use %NODEJS_VERSION%/%PLATFORM%
|
|
23
|
-
- node --version
|
|
24
|
-
- node -p process.arch
|
|
25
|
-
- npm --version
|
|
26
|
-
# app
|
|
27
|
-
- npm install
|
|
28
|
-
|
|
29
|
-
test_script:
|
|
30
|
-
- npm test
|
|
31
|
-
|
|
32
|
-
build: off
|
|
33
|
-
|
|
34
|
-
version: "{build}"
|
|
35
|
-
|
|
36
|
-
cache:
|
|
37
|
-
- node_modules
|
package/benchmark/README.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Benchmarks
|
|
2
|
-
|
|
3
|
-
## Running the benchmarks
|
|
4
|
-
|
|
5
|
-
From the parent directory, run
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm run-script benchmark
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
The above script supports the following arguments:
|
|
12
|
-
|
|
13
|
-
* `--benchmarks=...`: A semicolon-separated list of benchmark names. These names
|
|
14
|
-
will be mapped to file names in this directory by appending `.js`.
|
|
15
|
-
|
|
16
|
-
## Adding benchmarks
|
|
17
|
-
|
|
18
|
-
The steps below should be followed when adding new benchmarks.
|
|
19
|
-
|
|
20
|
-
0. Decide on a name for the benchmark. This name will be used in several places.
|
|
21
|
-
This example will use the name `new_benchmark`.
|
|
22
|
-
|
|
23
|
-
0. Create files `new_benchmark.cc` and `new_benchmark.js` in this directory.
|
|
24
|
-
|
|
25
|
-
0. Copy an existing benchmark in `binding.gyp` and change the target name prefix
|
|
26
|
-
and the source file name to `new_benchmark`. This should result in two new
|
|
27
|
-
targets which look like this:
|
|
28
|
-
|
|
29
|
-
```gyp
|
|
30
|
-
{
|
|
31
|
-
'target_name': 'new_benchmark',
|
|
32
|
-
'sources': [ 'new_benchmark.cc' ],
|
|
33
|
-
'includes': [ '../except.gypi' ],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
'target_name': 'new_benchmark_noexcept',
|
|
37
|
-
'sources': [ 'new_benchmark.cc' ],
|
|
38
|
-
'includes': [ '../noexcept.gypi' ],
|
|
39
|
-
},
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
There should always be a pair of targets: one bearing the name of the
|
|
43
|
-
benchmark and configured with C++ exceptions enabled, and one bearing the
|
|
44
|
-
same name followed by the suffix `_noexcept` and configured with C++
|
|
45
|
-
exceptions disabled. This will ensure that the benchmark can be written to
|
|
46
|
-
cover both the case where C++ exceptions are enabled and the case where they
|
|
47
|
-
are disabled.
|
package/benchmark/binding.gyp
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
'target_defaults': { 'includes': ['../common.gypi'] },
|
|
3
|
-
'targets': [
|
|
4
|
-
{
|
|
5
|
-
'target_name': 'function_args',
|
|
6
|
-
'sources': [ 'function_args.cc' ],
|
|
7
|
-
'includes': [ '../except.gypi' ],
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
'target_name': 'function_args_noexcept',
|
|
11
|
-
'sources': [ 'function_args.cc' ],
|
|
12
|
-
'includes': [ '../noexcept.gypi' ],
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
'target_name': 'property_descriptor',
|
|
16
|
-
'sources': [ 'property_descriptor.cc' ],
|
|
17
|
-
'includes': [ '../except.gypi' ],
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
'target_name': 'property_descriptor_noexcept',
|
|
21
|
-
'sources': [ 'property_descriptor.cc' ],
|
|
22
|
-
'includes': [ '../noexcept.gypi' ],
|
|
23
|
-
},
|
|
24
|
-
]
|
|
25
|
-
}
|