Skip to content

Commit 9ecd2dd

Browse files
committed
Import node (N-API) and node-addon-api
I want to build a Node.js native module. Import Node.js' source code (just enough for compiling against N-API) and node-addon-api's source code (for C++ bindings to N-API's C interface).
1 parent edc145b commit 9ecd2dd

30 files changed

+16953
-0
lines changed

vendor/README.txt

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,58 @@ Release URL: https://github.com/open-source-parsers/jsoncpp/releases/tag/1.9.4
105105
Release date: September 25, 2020
106106
Version: 1.9.4
107107

108+
## node
109+
110+
The node directory contains Node.js, a JavaScript runtime environment.
111+
112+
Only the following files have been kept to reduce storage consumption:
113+
114+
* node/AUTHORS
115+
* node/LICENSE
116+
* node/README.md
117+
* node/src/js_native_api.h
118+
* node/src/js_native_api_types.h
119+
* node/src/node_api.h
120+
* node/src/node_api_types.h
121+
122+
Copyright: Copyright Node.js contributors. All rights reserved.; various
123+
Download URL: https://nodejs.org/download/release/v14.17.3/node-v14.17.3.tar.xz
124+
Download date: July 25, 2021
125+
Git commit: 9fb7b48c5ed7707fbc4007a2e3fc99aec7587d8b
126+
License file: node/LICENSE
127+
License type: MIT; various
128+
Location: node
129+
Project URL: https://nodejs.org/
130+
Release URL: https://nodejs.org/download/release/v14.17.3/
131+
Release date: July 5, 2021
132+
Version: v14.17.3
133+
134+
## node-addon-api
135+
136+
The node-addon-api directory contains node-addon-api, header-only C++ wrapper
137+
classes which simplify the use of the C based Node-API provided by Node.js when
138+
using C++.
139+
140+
The following directories have been deleted to reduce storage consumption:
141+
142+
* node-addon-api/.github/
143+
* node-addon-api/benchmark/
144+
* node-addon-api/doc/
145+
* node-addon-api/test/
146+
* node-addon-api/tools/
147+
148+
Copyright: Copyright (c) 2017 Node.js API collaborators
149+
Download URL: https://github.com/nodejs/node-addon-api/archive/refs/tags/4.0.0.tar.gz
150+
Download date: July 25, 2021
151+
Git commit: ad76ad07f914fab02be5778ec67485916c4626d9
152+
License file: node-addon-api/LICENSE.md
153+
License type: MIT
154+
Location: node-addon-api
155+
Project URL: https://github.com/nodejs/node-addon-api
156+
Release URL: https://github.com/nodejs/node-addon-api/releases/tag/4.0.0
157+
Release date: June 15, 2021
158+
Version: 4.0.0
159+
108160
## simdjson
109161

110162
The simdjson directory contains simdjson, a C++ library for parsing JSON.

vendor/node-addon-api/.clang-format

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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

vendor/node-addon-api/.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
trim_trailing_whitespace = true
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 2

vendor/node-addon-api/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/node_modules
2+
/build
3+
/benchmark/build
4+
/benchmark/src
5+
/test/addon_build/addons

vendor/node-addon-api/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

vendor/node-addon-api/.travis.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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/HEAD/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

0 commit comments

Comments
 (0)