node
#oss
Refs
Node.jsへのコントリビュート解説、そしてOSSへ貢献するということ
https://github.com/pulls?page=1&q=involves%3Akuriyosh+-user%3Akuriyosh
https://github.com/nodejs/node/blob/master/doc/api/errors.md
where to find internalBinding file in nodejs source code?
internalBinding
https://github.com/nodejs/node/blob/master/BUILDING.md#running-tests
$ python3 tools/test.py test/parallel/test-stream2-transform.js
プロトタイプ汚染周りの提案と primordials.js
https://github.com/nodejs/node/blob/main/doc/contributing/pull-requests.md#the-process-of-making-changes
PRフロー
code: zsh
git fetch upstream HEAD
code: zsh
git rebase FETCH_HEAD
Rust + Node-APIでクロスプラットフォーム向けnpmパッケージを公開する
fs関連でnodejsにコントリビュートしました
issue
https://github.com/nodejs/node/blob/main/test/addons/parse-encoding/test.js
code: test-fs-opendir.js
for (const encoding of 'ascii', 'base64', 'base64url', 'binary', 'buffer', 'hex', 'latin1', 'ucs2', 'ucs-2') {
assert.doesNotThrow(
() => fs.opendirSync(testDir, common.mustNotMutateObjectDeep({ encoding })),
TypeError
)
}
// Check error thrown on invalid values of encoding
assert.throws(
() => fs.opendirSync(testDir, common.mustNotMutateObjectDeep({ encoding: 'invalid-encoding' })),
{
code: 'ERR_INVALID_ARG_VALUE'
});
issue
assert(files.includes(dirent.name), 'files' should include ${dirent});
issue
fs: delete rs flag from internal code
https://codebrowser.bddppq.com/libuv/libuv/
issue
test: fs.openSync doesn't recive callback
issue
macでbuild
https://github.com/nodejs/node/blob/master/BUILDING.md
code: zsh
~/desktop/node
$ ./configure
Node.js configure: Found Python 3.8.0...
ERROR: Did not find a new enough assembler, install one or build with
--openssl-no-asm.
Please refer to BUILDING.md
https://github.com/nodejs/node/blob/master/BUILDING.md#official-binary-platforms-and-toolchains
If compiling without one of the above, use configure with the --openssl-no-asm flag. Otherwise, configure will fail.
Rust#6155870bb96bbf0000c51b59
code: zsh
$ brew update
Already up-to-date.
~/desktop/node
$ bre upgrade
< brew y, n: y
==> Upgrading 79 outdated packages:
git-lfs 2.8.0 -> 3.0.1
pyenv 1.2.16 -> 2.0.7
terraform 0.14.5 -> 1.0.8
code: zsh
~/desktop/node
$ ./configure --openssl-no-asm
Node.js configure: Found Python 3.8.0...
WARNING: --openssl-no-asm will result in binaries that do not take advantage
of modern CPU cryptographic instructions and will therefore be slower.
Please refer to BUILDING.md
WARNING: warnings were emitted in the configure phase
INFO: configure completed successfully
code: zsh
$ make j4
g++: error: unrecognized command line option '-stdlib=libc++'
make1: *** /Users/tagawahirotaka/Desktop/node/out/Release/obj.host/icutools/deps/icu-small/source/tools/toolutil/collationinfo.o Error 1
make1: *** Waiting for unfinished jobs....
rm 2261f164e8c70d2a5d1281cd065950350f61afee.intermediate
make: *** node Error 2
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc
変わらず
MacでGCCを"正しく"環境構築しよう!
issue
linuxでbuild
https://www.thefunky-monkey.com/page/ubuntu-4-0416-0416-1017-04python-3-6/
https://tabeta-log.blogspot.com/2019/05/ubuntu-g5565.html
code: bash
~/desktop/node
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9
sudo: ホスト tagawahirotaka の名前解決ができません
update-alternatives: /usr/bin/gcc (gcc) を提供するために自動モードで /usr/bin/gcc-9 を使います
~/desktop/node
$ g++ --version
g++ (Ubuntu 9.4.0-1ubuntu1~16.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~/desktop/node
$ ./configure
Node.js configure: Found Python 3.6.13...
INFO: configure completed successfully
$ make jstest が最速?
Remember to recompile with make -j4 in between test runs if you change code in the lib or src directories.
$ ./node ./test/parallel/test-url-pathtofileurl.js でデバッグ可能
issue
test/parallel/test-url-pathtofileurl.jsのassert改善
issue
test-url-parse-queryでも@deprecatedとわかるように
deno_std#616bbb0eb96bbf0000eea1fc
issue
test: Add auth option case for url.format
test/parallel/test-url-format-whatwg.jsのauth
1ヶ月半回ってマージ
issue
https://github.com/denoland/deno_std/pull/1516#issuecomment-958937084
issue
proto.readUIntLE = readUIntLE; 重複
test-buffer-tostring.js
見間違いだった
issue
util.format(new SharedArrayBuffer(4)), 位置
issue
テストデバッグ
./node ./test/parallel/test-util-log.js
issue
code: zsh
$ make jstest
profiling: /Users/wafuwafu13/Desktop/node/out/Release/obj.target/node/gen/node_snapshot.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000003)
profiling: /Users/wafuwafu13/Desktop/node/out/Release/obj.target/node/gen/node_snapshot.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000000)
profiling: /Users/wafuwafu13/Desktop/node/out/Release/obj.target/node/gen/node_snapshot.gcda: cannot merge previous GCDA file: corrupt arc tag (0x5c03b9fb)
profiling: /Users/wafuwafu13/Desktop/node/out/Release/obj.target/node/gen/node_snapshot.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000003)
profiling: /Users/wafuwafu13/Desktop/node/out/Release/obj.target/node/gen/node_snapshot.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000000)
profiling: /Users/wafuwafu13/Desktop/node/out/Release/obj.target/node/gen/node_snapshot.gcda: cannot merge previous GCDA file: corrupt arc tag (0x5c03b9fb)
profiling: /Users/wafuwafu13/Desktop/node/out/Release/obj.target/node/gen/node_snapshot.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000003)
profiling: /Users/wafuwafu13/Desktop/node/out/Release/obj.target/node/gen/node_snapshot.gcda: cannot merge previous run count: corrupt object tag (0x000001c5)
issue
throws when options.buffer is null そもそもない