-14.14.0
+15.5.0
+15.4.0
+15.3.0
+15.2.1
+15.2.0
+15.1.0
+15.0.1
+15.0.0
+ |
+
+14.15.3
+14.15.2
+14.15.1
+14.15.0
+14.14.0
14.13.1
14.13.0
14.12.0
@@ -49,7 +65,9 @@ release.
14.0.0
|
-12.19.0
+12.20.0
+12.19.1
+12.19.0
12.18.4
12.18.3
12.18.2
@@ -84,7 +102,8 @@ release.
12.0.0
|
-10.22.1
+10.23.0
+10.22.1
10.22.0
10.21.0
10.20.1
diff --git a/GOVERNANCE.md b/GOVERNANCE.md
index aeb1d9c65e1f11..f47fb56e5b0cfb 100644
--- a/GOVERNANCE.md
+++ b/GOVERNANCE.md
@@ -151,8 +151,9 @@ The nomination passes if no Collaborators oppose it after one week. Otherwise,
the nomination fails.
There are steps a nominator can take in advance to make a nomination as
-frictionless as possible. Use the [Collaborators discussion page][] to request
-feedback from other Collaborators in private. A nominator may also work with the
+frictionless as possible. To request feedback from other Collaborators in
+ private, use the [Collaborators discussion page][]
+ (which only Collaborators may view). A nominator may also work with the
nominee to improve their contribution profile.
Collaborators might overlook someone with valuable contributions. In that case,
diff --git a/LICENSE b/LICENSE
index 58c78bf36f6f65..2d4040e537adad 100644
--- a/LICENSE
+++ b/LICENSE
@@ -53,6 +53,8 @@ The externally maintained libraries used by Node.js are:
- Acorn, located at deps/acorn, is licensed as follows:
"""
+ MIT License
+
Copyright (C) 2012-2018 by various contributors (see AUTHORS)
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -416,9 +418,9 @@ The externally maintained libraries used by Node.js are:
# Copyright (c) 2013 International Business Machines Corporation
# and others. All Rights Reserved.
#
- # Project: http://code.google.com/p/lao-dictionary/
- # Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
- # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
+ # Project: https://github.com/veer66/lao-dictionary
+ # Dictionary: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary.txt
+ # License: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary-LICENSE.txt
# (copied below)
#
# This file is derived from the above dictionary, with slight
@@ -1246,12 +1248,12 @@ The externally maintained libraries used by Node.js are:
THE SOFTWARE.
"""
-- babel-eslint, located at tools/node_modules/babel-eslint, is licensed as follows:
+- Babel, located at tools/node_modules/@babel, is licensed as follows:
"""
- Copyright (c) 2014-2016 Sebastian McKenzie
-
MIT License
+ Copyright (c) 2014-present Sebastian McKenzie and other contributors
+
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
diff --git a/Makefile b/Makefile
index b78b9a7337e958..4a6e59536bb4d2 100644
--- a/Makefile
+++ b/Makefile
@@ -65,8 +65,8 @@ V ?= 0
available-node = \
if [ -x $(PWD)/$(NODE) ] && [ -e $(PWD)/$(NODE) ]; then \
$(PWD)/$(NODE) $(1); \
- elif [ -x `which node` ] && [ -e `which node` ] && [ `which node` ]; then \
- `which node` $(1); \
+ elif [ -x `command -v node` ] && [ -e `command -v node` ] && [ `command -v node` ]; then \
+ `command -v node` $(1); \
else \
echo "No available node, cannot run \"node $(1)\""; \
exit 1; \
@@ -123,7 +123,7 @@ $(NODE_G_EXE): config.gypi out/Debug/build.ninja
if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Debug/$(NODE_EXE) $@; fi
else
$(NODE_EXE) $(NODE_G_EXE):
- echo This Makefile currently only supports building with 'make' or 'ninja'
+ $(warning This Makefile currently only supports building with 'make' or 'ninja')
endif
endif
@@ -133,12 +133,9 @@ CONFIG_FLAGS += --debug
endif
.PHONY: with-code-cache
-with-code-cache:
- echo "'with-code-cache' target is a noop"
-
.PHONY: test-code-cache
-test-code-cache: with-code-cache
- echo "'test-code-cache' target is a noop"
+with-code-cache test-code-cache:
+ $(warning '$@' target is a noop)
out/Makefile: config.gypi common.gypi node.gyp \
deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \
@@ -200,20 +197,11 @@ check: test
# Remove files generated by running coverage, put the non-instrumented lib back
# in place
coverage-clean:
- if [ -d lib_ ]; then $(RM) -r lib; mv lib_ lib; fi
$(RM) -r node_modules
$(RM) -r gcovr build
- $(RM) -r out/$(BUILDTYPE)/.coverage
- $(RM) out/$(BUILDTYPE)/obj.target/node/gen/*.gcda
- $(RM) out/$(BUILDTYPE)/obj.target/node/src/*.gcda
- $(RM) out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcda
- $(RM) out/$(BUILDTYPE)/obj.target/node/gen/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/node/src/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/cctest/src/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/cctest/test/cctest/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/embedtest/src/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/embedtest/test/embedding/*.gcno
+ $(RM) -r coverage/tmp
+ $(FIND) out/$(BUILDTYPE)/obj.target \( -name "*.gcda" -o -name "*.gcno" \) \
+ -type f -exec $(RM) {} \;
.PHONY: coverage
# Build and test with code coverage reporting. Leave the lib directory
@@ -248,8 +236,8 @@ coverage-test: coverage-build
$(RM) out/$(BUILDTYPE)/obj.target/node/src/*/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node_lib/src/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node_lib/src/*/*.gcda
- -NODE_V8_COVERAGE=out/$(BUILDTYPE)/.coverage \
- TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) $(COVTESTS)
+ -NODE_V8_COVERAGE=coverage/tmp \
+ TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) $(COVTESTS)
$(MAKE) coverage-report-js
-(cd out && "../gcovr/scripts/gcovr" \
--gcov-exclude='.*\b(deps|usr|out|cctest|embedding)\b' -v \
@@ -262,17 +250,10 @@ coverage-test: coverage-build
@grep -A3 Lines coverage/cxxcoverage.html | grep style \
| sed 's/<[^>]*>//g'| sed 's/ //g'
-COV_REPORT_OPTIONS = --reporter=html \
- --temp-directory=out/$(BUILDTYPE)/.coverage --omit-relative=false \
- --resolve=./lib --exclude="benchmark/" --exclude="deps/" --exclude="test/" --exclude="tools/" \
- --wrapper-length=0
-ifdef COV_ENFORCE_THRESHOLD
- COV_REPORT_OPTIONS += --check-coverage --lines=$(COV_ENFORCE_THRESHOLD)
-endif
-
.PHONY: coverage-report-js
coverage-report-js:
- $(NODE) ./node_modules/.bin/c8 report $(COV_REPORT_OPTIONS)
+ -$(MAKE) coverage-build-js
+ $(NODE) ./node_modules/.bin/c8 report
.PHONY: cctest
# Runs the C++ tests using the built `cctest` executable.
@@ -297,6 +278,7 @@ v8:
.PHONY: jstest
jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
+ $(TEST_CI_ARGS) \
--skip-tests=$(CI_SKIP_TESTS) \
$(JS_SUITES) \
$(NATIVE_SUITES)
@@ -307,9 +289,8 @@ tooltest:
.PHONY: coverage-run-js
coverage-run-js:
- $(RM) -r out/$(BUILDTYPE)/.coverage
- $(MAKE) coverage-build-js
- -NODE_V8_COVERAGE=out/$(BUILDTYPE)/.coverage CI_SKIP_TESTS=$(COV_SKIP_TESTS) \
+ $(RM) -r coverage/tmp
+ -NODE_V8_COVERAGE=coverage/tmp CI_SKIP_TESTS=$(COV_SKIP_TESTS) \
TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) jstest
$(MAKE) coverage-report-js
@@ -468,7 +449,7 @@ benchmark/napi/.buildstamp: $(ADDONS_PREREQS) \
.PHONY: clear-stalled
clear-stalled:
- @echo "Clean up any leftover processes but don't error if found."
+ $(info Clean up any leftover processes but don't error if found.)
ps awwx | grep Release/node | grep -v grep | cat
@PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
if [ "$${PS_OUT}" ]; then \
@@ -519,7 +500,7 @@ test-ci-js: | clear-stalled
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
$(TEST_CI_ARGS) $(CI_JS_SUITES)
- @echo "Clean up any leftover processes, error if found."
+ $(info Clean up any leftover processes, error if found.)
ps awwx | grep Release/node | grep -v grep | cat
@PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
if [ "$${PS_OUT}" ]; then \
@@ -535,7 +516,7 @@ test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tes
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
$(TEST_CI_ARGS) $(CI_JS_SUITES) $(CI_NATIVE_SUITES) $(CI_DOC)
out/Release/embedtest 'require("./test/embedding/test-embedding.js")'
- @echo "Clean up any leftover processes, error if found."
+ $(info Clean up any leftover processes, error if found.)
ps awwx | grep Release/node | grep -v grep | cat
@PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
if [ "$${PS_OUT}" ]; then \
@@ -599,7 +580,7 @@ test-hash-seed: all
$(NODE) test/pummel/test-hash-seed.js
.PHONY: test-doc
-test-doc: doc-only lint ## Builds, lints, and verifies the docs.
+test-doc: doc-only lint-md ## Builds, lints, and verifies the docs.
@if [ "$(shell $(node_use_openssl))" != "true" ]; then \
echo "Skipping test-doc (no crypto)"; \
else \
@@ -612,7 +593,7 @@ test-known-issues: all
# Related CI job: node-test-npm
test-npm: $(NODE_EXE) ## Run the npm test suite on deps/npm.
- $(NODE) tools/test-npm-package --install --logfile=test-npm.tap deps/npm test-node
+ $(NODE) tools/test-npm-package --install --logfile=test-npm.tap deps/npm test
test-npm-publish: $(NODE_EXE)
npm_package_config_publishtest=true $(NODE) deps/npm/test/run.js
@@ -671,7 +652,7 @@ test-v8: v8 ## Runs the V8 test suite on deps/v8.
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) $(V8_TEST_OPTIONS) \
mjsunit cctest debugger inspector message preparser \
$(TAP_V8)
- @echo Testing hash seed
+ $(info Testing hash seed)
$(MAKE) test-hash-seed
test-v8-intl: v8
@@ -691,9 +672,8 @@ test-v8-all: test-v8 test-v8-intl test-v8-benchmarks test-v8-updates
# runs all v8 tests
else
test-v8 test-v8-intl test-v8-benchmarks test-v8-all:
- @echo "Testing v8 is not available through the source tarball."
- @echo "Use the git repo instead:" \
- "$ git clone https://github.com/nodejs/node.git"
+ $(warning Testing V8 is not available through the source tarball.)
+ $(warning Use the git repo instead: $$ git clone https://github.com/nodejs/node.git)
endif
apidoc_dirs = out/doc out/doc/api out/doc/api/assets
@@ -918,7 +898,7 @@ BINARYNAME=$(TARNAME)-$(PLATFORM)-$(ARCH)
endif
BINARYTAR=$(BINARYNAME).tar
# OSX doesn't have xz installed by default, http://macpkg.sourceforge.net/
-HAS_XZ ?= $(shell which xz > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)
+HAS_XZ ?= $(shell command -v xz > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)
# Supply SKIP_XZ=1 to explicitly skip .tar.xz creation
SKIP_XZ ?= 0
XZ = $(shell [ $(HAS_XZ) -eq 1 -a $(SKIP_XZ) -eq 0 ] && echo 1 || echo 0)
@@ -928,14 +908,13 @@ MACOSOUTDIR=out/macos
ifeq ($(SKIP_XZ), 1)
check-xz:
- @echo "SKIP_XZ=1 supplied, skipping .tar.xz creation"
+ $(info SKIP_XZ=1 supplied, skipping .tar.xz creation)
else
ifeq ($(HAS_XZ), 1)
check-xz:
else
check-xz:
- @echo "No xz command, cannot continue"
- @exit 1
+ $(error No xz command, cannot continue)
endif
endif
@@ -1000,7 +979,7 @@ $(PKG): release-only
--release-urlbase=$(RELEASE_URLBASE) \
$(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
$(MAKE) install V=$(V) DESTDIR=$(MACOSOUTDIR)/dist/node
- SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" bash \
+ SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" sh \
tools/osx-codesign.sh
mkdir -p $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
mkdir -p $(MACOSOUTDIR)/pkgs
@@ -1022,8 +1001,8 @@ $(PKG): release-only
productbuild --distribution $(MACOSOUTDIR)/installer/productbuild/distribution.xml \
--resources $(MACOSOUTDIR)/installer/productbuild/Resources \
--package-path $(MACOSOUTDIR)/pkgs ./$(PKG)
- SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" bash tools/osx-productsign.sh
- bash tools/osx-notarize.sh $(FULLVERSION)
+ SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" sh tools/osx-productsign.sh
+ sh tools/osx-notarize.sh $(FULLVERSION)
.PHONY: pkg
# Builds the macOS installer for releases.
@@ -1141,7 +1120,7 @@ $(BINARYTAR): release-only
cp LICENSE $(BINARYNAME)
cp CHANGELOG.md $(BINARYNAME)
ifeq ($(OSTYPE),darwin)
- SIGN="$(CODESIGN_CERT)" PKGDIR="$(BINARYNAME)" bash tools/osx-codesign.sh
+ SIGN="$(CODESIGN_CERT)" PKGDIR="$(BINARYNAME)" sh tools/osx-codesign.sh
endif
tar -cf $(BINARYNAME).tar $(BINARYNAME)
$(RM) -r $(BINARYNAME)
@@ -1168,12 +1147,9 @@ ifeq ($(XZ), 1)
endif
.PHONY: bench-all
-bench-all: bench-addons-build
- @echo "Please use benchmark/run.js or benchmark/compare.js to run the benchmarks."
-
.PHONY: bench
-bench: bench-addons-build
- @echo "Please use benchmark/run.js or benchmark/compare.js to run the benchmarks."
+bench bench-all: bench-addons-build
+ $(warning Please use benchmark/run.js or benchmark/compare.js to run the benchmarks.)
# Build required addons for benchmark before running it.
.PHONY: bench-addons-build
@@ -1197,7 +1173,7 @@ lint-md-clean:
.PHONY: lint-md-build
lint-md-build:
- $(warning "Deprecated no-op target 'lint-md-build'")
+ $(warning Deprecated no-op target 'lint-md-build')
ifeq ("$(wildcard tools/.mdlintstamp)","")
LINT_MD_NEWER =
@@ -1212,19 +1188,19 @@ LINT_MD_FILES = $(shell $(FIND) $(LINT_MD_TARGETS) -type f \
run-lint-md = tools/lint-md.js -q -f --no-stdout $(LINT_MD_FILES)
# Lint all changed markdown files maintained by us
tools/.mdlintstamp: $(LINT_MD_FILES)
- @echo "Running Markdown linter..."
+ $(info Running Markdown linter...)
@$(call available-node,$(run-lint-md))
@touch $@
.PHONY: lint-md
# Lints the markdown documents maintained by us in the codebase.
-lint-md: | tools/.mdlintstamp
+lint-md: lint-js-doc | tools/.mdlintstamp
LINT_JS_TARGETS = .eslintrc.js benchmark doc lib test tools
run-lint-js = tools/node_modules/eslint/bin/eslint.js --cache \
- --report-unused-disable-directives --ext=.js,.mjs,.md $(LINT_JS_TARGETS)
+ --report-unused-disable-directives --ext=$(EXTENSIONS) $(LINT_JS_TARGETS)
run-lint-js-fix = $(run-lint-js) --fix
.PHONY: lint-js-fix
@@ -1232,9 +1208,12 @@ lint-js-fix:
@$(call available-node,$(run-lint-js-fix))
.PHONY: lint-js
+.PHONY: lint-js-doc
# Note that on the CI `lint-js-ci` is run instead.
# Lints the JavaScript code with eslint.
-lint-js:
+lint-js lint-js-fix: EXTENSIONS=.js,.mjs,.md
+lint-js-doc: EXTENSIONS=.md
+lint-js lint-js-doc:
@if [ "$(shell $(node_use_openssl))" != "true" ]; then \
echo "Skipping $@ (no crypto)"; \
else \
@@ -1243,7 +1222,7 @@ lint-js:
fi
jslint: lint-js
- @echo "Please use lint-js instead of jslint"
+ $(warning Please use lint-js instead of jslint)
run-lint-js-ci = tools/node_modules/eslint/bin/eslint.js \
--report-unused-disable-directives --ext=.js,.mjs,.md -f tap \
@@ -1252,11 +1231,11 @@ run-lint-js-ci = tools/node_modules/eslint/bin/eslint.js \
.PHONY: lint-js-ci
# On the CI the output is emitted in the TAP format.
lint-js-ci:
- @echo "Running JS linter..."
+ $(info Running JS linter...)
@$(call available-node,$(run-lint-js-ci))
jslint-ci: lint-js-ci
- @echo "Please use lint-js-ci instead of jslint-ci"
+ $(warning Please use lint-js-ci instead of jslint-ci)
LINT_CPP_ADDON_DOC_FILES_GLOB = test/addons/??_*/*.cc test/addons/??_*/*.h
LINT_CPP_ADDON_DOC_FILES = $(wildcard $(LINT_CPP_ADDON_DOC_FILES_GLOB))
@@ -1313,15 +1292,15 @@ CLANG_FORMAT_START ?= HEAD
# $ CLANG_FORMAT_START=master make format-cpp
format-cpp: ## Format C++ diff from $CLANG_FORMAT_START to current changes
ifneq ("","$(wildcard tools/clang-format/node_modules/)")
- @echo "Formatting C++ diff from $(CLANG_FORMAT_START).."
+ $(info Formatting C++ diff from $(CLANG_FORMAT_START)..)
@$(PYTHON) tools/clang-format/node_modules/.bin/git-clang-format \
--binary=tools/clang-format/node_modules/.bin/clang-format \
--style=file \
$(CLANG_FORMAT_START) -- \
$(LINT_CPP_FILES)
else
- @echo "clang-format is not installed."
- @echo "To install (requires internet access) run: $ make format-cpp-build"
+ $(info clang-format is not installed.)
+ $(info To install (requires internet access) run: $$ make format-cpp-build)
endif
ifeq ($(V),1)
@@ -1334,7 +1313,7 @@ endif
lint-cpp: tools/.cpplintstamp
tools/.cpplintstamp: $(LINT_CPP_FILES)
- @echo "Running C++ linter..."
+ $(info Running C++ linter...)
@$(PYTHON) tools/cpplint.py $(CPPLINT_QUIET) $?
@$(PYTHON) tools/checkimports.py $?
@touch $@
@@ -1343,19 +1322,19 @@ tools/.cpplintstamp: $(LINT_CPP_FILES)
lint-addon-docs: tools/.doclintstamp
tools/.doclintstamp: test/addons/.docbuildstamp
- @echo "Running C++ linter on addon docs..."
+ $(info Running C++ linter on addon docs...)
@$(PYTHON) tools/cpplint.py $(CPPLINT_QUIET) --filter=$(ADDON_DOC_LINT_FLAGS) \
$(LINT_CPP_ADDON_DOC_FILES_GLOB)
@touch $@
cpplint: lint-cpp
- @echo "Please use lint-cpp instead of cpplint"
+ $(warning Please use lint-cpp instead of cpplint)
.PHONY: lint-py-build
# python -m pip install flake8
# Try with '--system' is to overcome systems that blindly set '--user'
lint-py-build:
- @echo "Pip installing flake8 linter on $(shell $(PYTHON) --version)..."
+ $(info Pip installing flake8 linter on $(shell $(PYTHON) --version)...)
$(PYTHON) -m pip install --upgrade -t tools/pip/site-packages flake8 || \
$(PYTHON) -m pip install --upgrade --system -t tools/pip/site-packages flake8
@@ -1367,8 +1346,8 @@ lint-py:
PYTHONPATH=tools/pip $(PYTHON) -m flake8 --count --show-source --statistics .
else
lint-py:
- @echo "Python linting with flake8 is not avalible"
- @echo "Run 'make lint-py-build'"
+ $(warning Python linting with flake8 is not available)
+ $(warning Run 'make lint-py-build')
endif
.PHONY: lint
@@ -1394,12 +1373,9 @@ lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs
exit 1 ; \
fi
else
-lint:
- @echo "Linting is not available through the source tarball."
- @echo "Use the git repo instead:" \
- "$ git clone https://github.com/nodejs/node.git"
-
-lint-ci: lint
+lint lint-ci:
+ $(info Linting is not available through the source tarball.)
+ $(info Use the git repo instead: $$ git clone https://github.com/nodejs/node.git)
endif
.PHONY: lint-clean
@@ -1407,7 +1383,7 @@ lint-clean:
$(RM) tools/.*lintstamp
$(RM) .eslintcache
-HAS_DOCKER ?= $(shell which docker > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)
+HAS_DOCKER ?= $(shell command -v docker > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)
ifeq ($(HAS_DOCKER), 1)
DOCKER_COMMAND ?= docker run -it -v $(PWD):/node
@@ -1419,6 +1395,5 @@ gen-openssl: ## Generate platform dependent openssl files (requires docker)
$(DOCKER_COMMAND) node-openssl-builder make -C deps/openssl/config
else
gen-openssl:
- @echo "No docker command, cannot continue"
- @exit 1
+ $(error No docker command, cannot continue)
endif
diff --git a/README.md b/README.md
index a5066a675f0a8e..512cd485b8f57a 100644
--- a/README.md
+++ b/README.md
@@ -34,6 +34,7 @@ The Node.js project uses an [open governance model](./GOVERNANCE.md). The
* [TSC (Technical Steering Committee)](#tsc-technical-steering-committee)
* [Collaborators](#collaborators)
* [Release Keys](#release-keys)
+* [License](#license)
## Support
@@ -52,7 +53,7 @@ Looking for help? Check out the
* **LTS**: Releases that receive Long-term Support, with a focus on stability
and security. Every even-numbered major version will become an LTS release.
LTS releases receive 12 months of _Active LTS_ support and a further 18 months
- of _Maintenance_. LTS release lines have alphabetically-ordered codenames,
+ of _Maintenance_. LTS release lines have alphabetically-ordered code names,
beginning with v4 Argon. There are no breaking changes or feature additions,
except in some special circumstances.
* **Nightly**: Code from the Current branch built every 24-hours when there are
@@ -264,8 +265,6 @@ For information about the governance of the Node.js project, see
**Bradley Farias** <bradley.meck@gmail.com>
* [bmeurer](https://github.com/bmeurer) -
**Benedikt Meurer** <benedikt.meurer@gmail.com>
-* [bnoordhuis](https://github.com/bnoordhuis) -
-**Ben Noordhuis** <info@bnoordhuis.nl>
* [boneskull](https://github.com/boneskull) -
**Christopher Hiller** <boneskull@boneskull.com> (he/him)
* [BridgeAR](https://github.com/BridgeAR) -
@@ -286,8 +285,6 @@ For information about the governance of the Node.js project, see
**Danielle Adams** <adamzdanielle@gmail.com> (she/her)
* [davisjam](https://github.com/davisjam) -
**Jamie Davis** <davisjam@vt.edu> (he/him)
-* [DerekNonGeneric](https://github.com/DerekNonGeneric) -
-**Derek Lewis** <DerekNonGeneric@inf.is> (he/him)
* [devnexen](https://github.com/devnexen) -
**David Carlier** <devnexen@gmail.com>
* [devsnek](https://github.com/devsnek) -
@@ -374,6 +371,8 @@ For information about the governance of the Node.js project, see
**Ali Ijaz Sheikh** <ofrobots@google.com> (he/him)
* [oyyd](https://github.com/oyyd) -
**Ouyang Yadong** <oyydoibh@gmail.com> (he/him)
+* [PoojaDurgad](https://github.com/PoojaDurgad) -
+**Pooja D P** <Pooja.D.P@ibm.com> (she/her)
* [psmarshall](https://github.com/psmarshall) -
**Peter Marshall** <petermarshall@chromium.org> (he/him)
* [puzpuzpuz](https://github.com/puzpuzpuz) -
@@ -390,8 +389,6 @@ For information about the governance of the Node.js project, see
**Ricky Zhou** <0x19951125@gmail.com> (he/him)
* [ronag](https://github.com/ronag) -
**Robert Nagy** <ronagy@icloud.com>
-* [ronkorving](https://github.com/ronkorving) -
-**Ron Korving** <ron@ronkorving.nl>
* [rubys](https://github.com/rubys) -
**Sam Ruby** <rubys@intertwingly.net>
* [ruyadorno](https://github.com/ruyadorno) -
@@ -406,8 +403,6 @@ For information about the governance of the Node.js project, see
**Santiago Gimeno** <santiago.gimeno@gmail.com>
* [seishun](https://github.com/seishun) -
**Nikolai Vavilov** <vvnicholas@gmail.com>
-* [shigeki](https://github.com/shigeki) -
-**Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him)
* [shisama](https://github.com/shisama) -
**Masashi Hirano** <shisama07@gmail.com> (he/him)
* [silverwind](https://github.com/silverwind) -
@@ -453,6 +448,8 @@ For information about the governance of the Node.js project, see
**Anna M. Kedzierska** <anna.m.kedzierska@gmail.com>
* [aqrln](https://github.com/aqrln) -
**Alexey Orlenko** <eaglexrlnk@gmail.com> (he/him)
+* [bnoordhuis](https://github.com/bnoordhuis) -
+**Ben Noordhuis** <info@bnoordhuis.nl>
* [brendanashworth](https://github.com/brendanashworth) -
**Brendan Ashworth** <brendan.ashworth@me.com>
* [calvinmetcalf](https://github.com/calvinmetcalf) -
@@ -463,6 +460,8 @@ For information about the governance of the Node.js project, see
**Claudio Rodriguez** <cjrodr@yahoo.com>
* [DavidCai1993](https://github.com/DavidCai1993) -
**David Cai** <davidcai1993@yahoo.com> (he/him)
+* [DerekNonGeneric](https://github.com/DerekNonGeneric) -
+**Derek Lewis** <DerekNonGeneric@inf.is> (he/him)
* [digitalinfinity](https://github.com/digitalinfinity) -
**Hitesh Kanwathirtha** <digitalinfinity@gmail.com> (he/him)
* [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) -
@@ -541,12 +540,16 @@ For information about the governance of the Node.js project, see
**Robert Kowalski** <rok@kowalski.gd>
* [romankl](https://github.com/romankl) -
**Roman Klauke** <romaaan.git@gmail.com>
+* [ronkorving](https://github.com/ronkorving) -
+**Ron Korving** <ron@ronkorving.nl>
* [RReverser](https://github.com/RReverser) -
**Ingvar Stepanyan** <me@rreverser.com>
* [sam-github](https://github.com/sam-github) -
**Sam Roberts** <vieuxtech@gmail.com>
* [sebdeckers](https://github.com/sebdeckers) -
**Sebastiaan Deckers** <sebdeckers83@gmail.com>
+* [shigeki](https://github.com/shigeki) -
+**Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him)
* [stefanmb](https://github.com/stefanmb) -
**Stefan Budeanu** <stefan@budeanu.com>
* [tellnes](https://github.com/tellnes) -
@@ -574,6 +577,8 @@ maintaining the Node.js project.
* [PoojaDurgad](https://github.com/PoojaDurgad) -
**Pooja Durgad** <Pooja.D.P@ibm.com>
+* [RaisinTen](https://github.com/RaisinTen) -
+**Darshan Sen** <raisinten@gmail.com>
### Release Keys
@@ -583,6 +588,8 @@ Primary GPG keys for Node.js Releasers (some Releasers sign with subkeys):
`4ED778F539E3634C779C87C6D7062848A1AB005C`
* **Colin Ihrig** <cjihrig@gmail.com>
`94AE36675C464D64BAFA68DD7434390BDBE9B9C5`
+* **Danielle Adams** <adamzdanielle@gmail.com>
+`1C050899334244A8AF75E53792EF661D867B9DFA`
* **James M Snell** <jasnell@keybase.io>
`71DCFD284A79C3B38668286BC97EC7A07EDE3FC1`
* **Michaël Zasso** <targos@protonmail.com>
@@ -600,11 +607,13 @@ Primary GPG keys for Node.js Releasers (some Releasers sign with subkeys):
* **Shelley Vohr** <shelley.vohr@gmail.com>
`B9E2F5981AA6E0CD28160D9FF13993A75599653C`
-To import the full set of trusted release keys:
+To import the full set of trusted release keys (including subkeys possibly used
+to sign releases):
```bash
gpg --keyserver pool.sks-keyservers.net --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C
gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5
+gpg --keyserver pool.sks-keyservers.net --recv-keys 1C050899334244A8AF75E53792EF661D867B9DFA
gpg --keyserver pool.sks-keyservers.net --recv-keys 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1
gpg --keyserver pool.sks-keyservers.net --recv-keys 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
gpg --keyserver pool.sks-keyservers.net --recv-keys C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
@@ -637,6 +646,14 @@ Other keys used to sign some previous releases:
* **Timothy J Fontaine** <tjfontaine@gmail.com>
`7937DFD2AB06298B2293C3187D33FF9D0246406D`
+## License
+
+Node.js is available under the
+[MIT license](https://opensource.org/licenses/MIT). Node.js also includes
+external libraries that are available under a variety of licenses. See
+[LICENSE](https://github.com/nodejs/node/blob/master/LICENSE) for the full
+license text.
+
[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md
[Contributing to the project]: CONTRIBUTING.md
[Node.js Website]: https://nodejs.org/
diff --git a/android-configure b/android-configure
index a7cb2b9c8b4a78..ecb13f399e4d5d 100755
--- a/android-configure
+++ b/android-configure
@@ -10,7 +10,7 @@
if [ $# -ne 3 ]; then
echo "$0 should have 3 parameters: ndk_path, target_arch and sdk_version"
- exit 1
+ return 1
fi
NDK_PATH=$1
@@ -44,21 +44,21 @@ case $ARCH in
;;
*)
echo "Unsupported architecture provided: $ARCH"
- exit 1
+ return 1
;;
esac
HOST_OS="linux"
HOST_ARCH="x86_64"
-export CC_host=$(which gcc)
-export CXX_host=$(which g++)
+export CC_host=$(command -v gcc)
+export CXX_host=$(command -v g++)
host_gcc_version=$($CC_host --version | grep gcc | awk '{print $NF}')
major=$(echo $host_gcc_version | awk -F . '{print $1}')
minor=$(echo $host_gcc_version | awk -F . '{print $2}')
if [ -z $major ] || [ -z $minor ] || [ $major -lt 6 ] || [ $major -eq 6 -a $minor -lt 3 ]; then
echo "host gcc $host_gcc_version is too old, need gcc 6.3.0"
- exit 1
+ return 1
fi
SUFFIX="$TOOLCHAIN_NAME$ANDROID_SDK_VERSION"
diff --git a/benchmark/_benchmark_progress.js b/benchmark/_benchmark_progress.js
index 1b7ac738f6de0d..6c925f34e68202 100644
--- a/benchmark/_benchmark_progress.js
+++ b/benchmark/_benchmark_progress.js
@@ -39,7 +39,6 @@ class BenchmarkProgress {
this.completedConfig = 0;
// Total number of configurations for the current file
this.scheduledConfig = 0;
- this.interval; // Updates the elapsed time.
}
startQueue(index) {
diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js
index d0f192e75948b6..f25bcd319882f6 100644
--- a/benchmark/_http-benchmarkers.js
+++ b/benchmark/_http-benchmarkers.js
@@ -29,7 +29,8 @@ class AutocannonBenchmarker {
for (const field in options.headers) {
args.push('-H', `${field}=${options.headers[field]}`);
}
- args.push(`http://127.0.0.1:${options.port}${options.path}`);
+ const scheme = options.scheme || 'http';
+ args.push(`${scheme}://127.0.0.1:${options.port}${options.path}`);
const child = child_process.spawn(this.executable, args);
return child;
}
@@ -60,11 +61,12 @@ class WrkBenchmarker {
const duration = typeof options.duration === 'number' ?
Math.max(options.duration, 1) :
options.duration;
+ const scheme = options.scheme || 'http';
const args = [
'-d', duration,
'-c', options.connections,
'-t', Math.min(options.connections, require('os').cpus().length || 8),
- `http://127.0.0.1:${options.port}${options.path}`,
+ `${scheme}://127.0.0.1:${options.port}${options.path}`,
];
for (const field in options.headers) {
args.push('-H', `${field}: ${options.headers[field]}`);
@@ -90,8 +92,8 @@ class WrkBenchmarker {
*/
class TestDoubleBenchmarker {
constructor(type) {
- // `type` is the type of benchmarker. Possible values are 'http' and
- // 'http2'.
+ // `type` is the type of benchmarker. Possible values are 'http', 'https',
+ // and 'http2'.
this.name = `test-double-${type}`;
this.executable = path.resolve(__dirname, '_test-double-benchmarker.js');
this.present = fs.existsSync(this.executable);
@@ -101,8 +103,9 @@ class TestDoubleBenchmarker {
create(options) {
process.env.duration = process.env.duration || options.duration || 5;
+ const scheme = options.scheme || 'http';
const env = {
- test_url: `http://127.0.0.1:${options.port}${options.path}`,
+ test_url: `${scheme}://127.0.0.1:${options.port}${options.path}`,
...process.env
};
@@ -179,6 +182,7 @@ const http_benchmarkers = [
new WrkBenchmarker(),
new AutocannonBenchmarker(),
new TestDoubleBenchmarker('http'),
+ new TestDoubleBenchmarker('https'),
new TestDoubleBenchmarker('http2'),
new H2LoadBenchmarker(),
];
diff --git a/benchmark/_test-double-benchmarker.js b/benchmark/_test-double-benchmarker.js
index 60264dfd46a606..89843d4616cc50 100644
--- a/benchmark/_test-double-benchmarker.js
+++ b/benchmark/_test-double-benchmarker.js
@@ -1,10 +1,15 @@
'use strict';
const myModule = process.argv[2];
-if (!['http', 'http2'].includes(myModule)) {
+if (!['http', 'https', 'http2'].includes(myModule)) {
throw new Error(`Invalid module for benchmark test double: ${myModule}`);
}
+let options;
+if (myModule === 'https') {
+ options = { rejectUnauthorized: false };
+}
+
const http = require(myModule);
const duration = +process.env.duration;
@@ -33,8 +38,12 @@ function request(res, client) {
}
function run() {
- if (http.get) { // HTTP
- http.get(url, request);
+ if (http.get) { // HTTP or HTTPS
+ if (options) {
+ http.get(url, options, request);
+ } else {
+ http.get(url, request);
+ }
} else { // HTTP/2
const client = http.connect(url);
client.on('error', (e) => { throw e; });
diff --git a/benchmark/child_process/child-process-params.js b/benchmark/child_process/child-process-params.js
index df930395b2a015..8db8d3ace20c53 100644
--- a/benchmark/child_process/child-process-params.js
+++ b/benchmark/child_process/child-process-params.js
@@ -82,6 +82,7 @@ function main({ n, methodName, params }) {
}
break;
case 'execFileSync':
+ case 'spawnSync':
switch (params) {
case 1:
bench.start();
@@ -119,24 +120,5 @@ function main({ n, methodName, params }) {
break;
}
break;
- case 'spawnSync':
- switch (params) {
- case 1:
- bench.start();
- for (let i = 0; i < n; i++) method(command);
- bench.end(n);
- break;
- case 2:
- bench.start();
- for (let i = 0; i < n; i++) method(command, args);
- bench.end(n);
- break;
- case 3:
- bench.start();
- for (let i = 0; i < n; i++) method(command, args, options);
- bench.end(n);
- break;
- }
- break;
}
}
diff --git a/benchmark/child_process/child-process-read-ipc.js b/benchmark/child_process/child-process-read-ipc.js
index 827f75b1e54bd1..280505026cd02e 100644
--- a/benchmark/child_process/child-process-read-ipc.js
+++ b/benchmark/child_process/child-process-read-ipc.js
@@ -13,7 +13,7 @@ if (process.argv[2] === 'child') {
const bench = common.createBenchmark(main, {
len: [
64, 256, 1024, 4096, 16384, 65536,
- 65536 << 4, 65536 << 8,
+ 65536 << 4, 65536 << 6 - 1,
],
dur: [5]
});
diff --git a/benchmark/common.js b/benchmark/common.js
index 701a8d6c34f07f..bdccd6605f365e 100644
--- a/benchmark/common.js
+++ b/benchmark/common.js
@@ -4,24 +4,24 @@ const child_process = require('child_process');
const http_benchmarkers = require('./_http-benchmarkers.js');
class Benchmark {
- // Used to make sure a benchmark only start a timer once
- #started = false;
+ constructor(fn, configs, options = {}) {
+ // Used to make sure a benchmark only start a timer once
+ this._started = false;
- // Indicate that the benchmark ended
- #ended = false;
+ // Indicate that the benchmark ended
+ this._ended = false;
- // Holds process.hrtime value
- #time = [0, 0];
+ // Holds process.hrtime value
+ this._time = [0, 0];
- // Use the file name as the name of the benchmark
- name = require.main.filename.slice(__dirname.length + 1);
+ // Use the file name as the name of the benchmark
+ this.name = require.main.filename.slice(__dirname.length + 1);
- // Execution arguments i.e. flags used to run the jobs
- flags = process.env.NODE_BENCHMARK_FLAGS ?
- process.env.NODE_BENCHMARK_FLAGS.split(/\s+/) :
- [];
+ // Execution arguments i.e. flags used to run the jobs
+ this.flags = process.env.NODE_BENCHMARK_FLAGS ?
+ process.env.NODE_BENCHMARK_FLAGS.split(/\s+/) :
+ [];
- constructor(fn, configs, options = {}) {
// Parse job-specific configuration from the command line arguments
const argv = process.argv.slice(2);
const parsed_args = this._parseArgs(argv, configs, options);
@@ -214,21 +214,21 @@ class Benchmark {
}
start() {
- if (this.#started) {
+ if (this._started) {
throw new Error('Called start more than once in a single benchmark');
}
- this.#started = true;
- this.#time = process.hrtime();
+ this._started = true;
+ this._time = process.hrtime();
}
end(operations) {
// Get elapsed time now and do error checking later for accuracy.
- const elapsed = process.hrtime(this.#time);
+ const elapsed = process.hrtime(this._time);
- if (!this.#started) {
+ if (!this._started) {
throw new Error('called end without start');
}
- if (this.#ended) {
+ if (this._ended) {
throw new Error('called end multiple times');
}
if (typeof operations !== 'number') {
@@ -244,7 +244,7 @@ class Benchmark {
elapsed[1] = 1;
}
- this.#ended = true;
+ this._ended = true;
const time = elapsed[0] + elapsed[1] / 1e9;
const rate = operations / time;
this.report(rate, elapsed);
diff --git a/benchmark/diagnostics_channel/http.js b/benchmark/diagnostics_channel/http.js
new file mode 100644
index 00000000000000..55fac8a706df15
--- /dev/null
+++ b/benchmark/diagnostics_channel/http.js
@@ -0,0 +1,96 @@
+'use strict';
+const common = require('../common.js');
+const dc = require('diagnostics_channel');
+const { AsyncLocalStorage } = require('async_hooks');
+const http = require('http');
+
+const bench = common.createBenchmark(main, {
+ apm: ['none', 'diagnostics_channel', 'patch'],
+ type: 'buffer',
+ len: 1024,
+ chunks: 4,
+ connections: [50, 500],
+ chunkedEnc: 1,
+ duration: 5
+});
+
+function main({ apm, connections, duration, type, len, chunks, chunkedEnc }) {
+ const done = { none, patch, diagnostics_channel }[apm]();
+
+ const server = require('../fixtures/simple-http-server.js')
+ .listen(common.PORT)
+ .on('listening', () => {
+ const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
+ bench.http({
+ path,
+ connections,
+ duration
+ }, () => {
+ server.close();
+ if (done) done();
+ });
+ });
+}
+
+function none() {}
+
+function patch() {
+ const als = new AsyncLocalStorage();
+ const times = [];
+
+ const { emit } = http.Server.prototype;
+ function wrappedEmit(...args) {
+ const [name, req, res] = args;
+ if (name === 'request') {
+ als.enterWith({
+ url: req.url,
+ start: process.hrtime.bigint()
+ });
+
+ res.on('finish', () => {
+ times.push({
+ ...als.getStore(),
+ statusCode: res.statusCode,
+ end: process.hrtime.bigint()
+ });
+ });
+ }
+ return emit.apply(this, args);
+ }
+ http.Server.prototype.emit = wrappedEmit;
+
+ return () => {
+ http.Server.prototype.emit = emit;
+ };
+}
+
+function diagnostics_channel() {
+ const als = new AsyncLocalStorage();
+ const times = [];
+
+ const start = dc.channel('http.server.request.start');
+ const finish = dc.channel('http.server.response.finish');
+
+ function onStart(req) {
+ als.enterWith({
+ url: req.url,
+ start: process.hrtime.bigint()
+ });
+ }
+
+ function onFinish(res) {
+ times.push({
+ ...als.getStore(),
+ statusCode: res.statusCode,
+ end: process.hrtime.bigint()
+ });
+ }
+
+ start.subscribe(onStart);
+ finish.subscribe(onFinish);
+
+ return () => {
+ start.unsubscribe(onStart);
+ finish.unsubscribe(onFinish);
+ };
+}
diff --git a/benchmark/diagnostics_channel/publish.js b/benchmark/diagnostics_channel/publish.js
new file mode 100644
index 00000000000000..31a770c8627919
--- /dev/null
+++ b/benchmark/diagnostics_channel/publish.js
@@ -0,0 +1,29 @@
+'use strict';
+const common = require('../common.js');
+const dc = require('diagnostics_channel');
+
+const bench = common.createBenchmark(main, {
+ n: [1e8],
+ subscribers: [0, 1, 10],
+});
+
+function noop() {}
+
+function main({ n, subscribers }) {
+ const channel = dc.channel('test');
+ for (let i = 0; i < subscribers; i++) {
+ channel.subscribe(noop);
+ }
+
+ const data = {
+ foo: 'bar'
+ };
+
+ bench.start();
+ for (let i = 0; i < n; i++) {
+ if (channel.hasSubscribers) {
+ channel.publish(data);
+ }
+ }
+ bench.end(n);
+}
diff --git a/benchmark/diagnostics_channel/subscribe.js b/benchmark/diagnostics_channel/subscribe.js
new file mode 100644
index 00000000000000..1415054588c4b1
--- /dev/null
+++ b/benchmark/diagnostics_channel/subscribe.js
@@ -0,0 +1,19 @@
+'use strict';
+const common = require('../common.js');
+const dc = require('diagnostics_channel');
+
+const bench = common.createBenchmark(main, {
+ n: [1e8],
+});
+
+function noop() {}
+
+function main({ n }) {
+ const channel = dc.channel('channel.0');
+
+ bench.start();
+ for (let i = 0; i < n; i++) {
+ channel.subscribe(noop);
+ }
+ bench.end(n);
+}
diff --git a/benchmark/es/destructuring-bench.js b/benchmark/es/destructuring-bench.js
index c07c0383da91ac..d412b82757f083 100644
--- a/benchmark/es/destructuring-bench.js
+++ b/benchmark/es/destructuring-bench.js
@@ -12,7 +12,8 @@ function runSwapManual(n) {
let x, y, r;
bench.start();
for (let i = 0; i < n; i++) {
- x = 1, y = 2;
+ x = 1;
+ y = 2;
r = x;
x = y;
y = r;
@@ -26,7 +27,8 @@ function runSwapDestructured(n) {
let x, y;
bench.start();
for (let i = 0; i < n; i++) {
- x = 1, y = 2;
+ x = 1;
+ y = 2;
[x, y] = [y, x];
assert.strictEqual(x, 2);
assert.strictEqual(y, 1);
diff --git a/benchmark/fixtures/require-builtins.js b/benchmark/fixtures/require-builtins.js
new file mode 100644
index 00000000000000..685eef1875b301
--- /dev/null
+++ b/benchmark/fixtures/require-builtins.js
@@ -0,0 +1,44 @@
+'use strict';
+
+const list = [
+ 'async_hooks',
+ 'assert',
+ 'buffer',
+ 'child_process',
+ 'console',
+ 'constants',
+ 'crypto',
+ 'cluster',
+ 'dgram',
+ 'dns',
+ 'domain',
+ 'events',
+ 'fs',
+ 'http',
+ 'http2',
+ 'https',
+ 'module',
+ 'net',
+ 'os',
+ 'path',
+ 'perf_hooks',
+ 'process',
+ 'punycode',
+ 'querystring',
+ 'readline',
+ 'repl',
+ 'stream',
+ 'string_decoder',
+ 'timers',
+ 'tls',
+ 'tty',
+ 'url',
+ 'util',
+ 'vm',
+ 'zlib',
+];
+
+for (let i = 0; i < list.length; ++i) {
+ const item = list[i];
+ require(item);
+}
diff --git a/benchmark/fixtures/simple-https-server.js b/benchmark/fixtures/simple-https-server.js
new file mode 100644
index 00000000000000..d3b07a110113d7
--- /dev/null
+++ b/benchmark/fixtures/simple-https-server.js
@@ -0,0 +1,72 @@
+'use strict';
+
+const fixtures = require('../../test/common/fixtures');
+const https = require('https');
+
+const options = {
+ key: fixtures.readKey('rsa_private.pem'),
+ cert: fixtures.readKey('rsa_cert.crt')
+};
+
+const storedBytes = Object.create(null);
+const storedBuffer = Object.create(null);
+
+module.exports = https.createServer(options, (req, res) => {
+ // URL format: ////chunkedEnc
+ const params = req.url.split('/');
+ const command = params[1];
+ let body = '';
+ const arg = params[2];
+ const n_chunks = parseInt(params[3], 10);
+ const chunkedEnc = params.length >= 5 && params[4] === '0' ? false : true;
+ let status = 200;
+
+ let n, i;
+ if (command === 'bytes') {
+ n = ~~arg;
+ if (n <= 0)
+ throw new Error('bytes called with n <= 0');
+ if (storedBytes[n] === undefined) {
+ storedBytes[n] = 'C'.repeat(n);
+ }
+ body = storedBytes[n];
+ } else if (command === 'buffer') {
+ n = ~~arg;
+ if (n <= 0)
+ throw new Error('buffer called with n <= 0');
+ if (storedBuffer[n] === undefined) {
+ storedBuffer[n] = Buffer.allocUnsafe(n);
+ for (i = 0; i < n; i++) {
+ storedBuffer[n][i] = 'C'.charCodeAt(0);
+ }
+ }
+ body = storedBuffer[n];
+ } else {
+ status = 404;
+ body = 'not found\n';
+ }
+
+ // example: https://localhost:port/bytes/512/4
+ // sends a 512 byte body in 4 chunks of 128 bytes
+ const len = body.length;
+ if (chunkedEnc) {
+ res.writeHead(status, {
+ 'Content-Type': 'text/plain',
+ 'Transfer-Encoding': 'chunked'
+ });
+ } else {
+ res.writeHead(status, {
+ 'Content-Type': 'text/plain',
+ 'Content-Length': len.toString()
+ });
+ }
+ // send body in chunks
+ if (n_chunks > 1) {
+ const step = Math.floor(len / n_chunks) || 1;
+ for (i = 0, n = (n_chunks - 1); i < n; ++i)
+ res.write(body.slice(i * step, i * step + step));
+ res.end(body.slice((n_chunks - 1) * step));
+ } else {
+ res.end(body);
+ }
+});
diff --git a/benchmark/fs/bench-statSync-failure.js b/benchmark/fs/bench-statSync-failure.js
new file mode 100644
index 00000000000000..82cb24c09f4af2
--- /dev/null
+++ b/benchmark/fs/bench-statSync-failure.js
@@ -0,0 +1,28 @@
+'use strict';
+
+const common = require('../common');
+const fs = require('fs');
+const path = require('path');
+
+const bench = common.createBenchmark(main, {
+ n: [1e6],
+ statSyncType: ['throw', 'noThrow']
+});
+
+
+function main({ n, statSyncType }) {
+ const arg = path.join(__dirname, 'non.existent');
+
+ bench.start();
+ for (let i = 0; i < n; i++) {
+ if (statSyncType === 'noThrow') {
+ fs.statSync(arg, { throwIfNoEntry: false });
+ } else {
+ try {
+ fs.statSync(arg);
+ } catch {
+ }
+ }
+ }
+ bench.end(n);
+}
diff --git a/benchmark/fs/bench-statSync.js b/benchmark/fs/bench-statSync.js
index 0c9366a402cb71..e75d6603fcfc64 100644
--- a/benchmark/fs/bench-statSync.js
+++ b/benchmark/fs/bench-statSync.js
@@ -21,6 +21,6 @@ function main({ n, statSyncType }) {
}
bench.end(n);
- if (statSyncType === 'fstat')
+ if (statSyncType === 'fstatSync')
fs.closeSync(arg);
}
diff --git a/benchmark/https/simple.js b/benchmark/https/simple.js
new file mode 100644
index 00000000000000..243546c346f484
--- /dev/null
+++ b/benchmark/https/simple.js
@@ -0,0 +1,29 @@
+'use strict';
+const common = require('../common.js');
+
+const bench = common.createBenchmark(main, {
+ type: ['bytes', 'buffer'],
+ len: [4, 1024, 102400],
+ chunks: [1, 4],
+ c: [50, 500],
+ chunkedEnc: [1, 0],
+ benchmarker: ['test-double-https'],
+ duration: 5
+});
+
+function main({ type, len, chunks, c, chunkedEnc, duration }) {
+ const server = require('../fixtures/simple-https-server.js')
+ .listen(common.PORT)
+ .on('listening', () => {
+ const path = `/${type}/${len}/${chunks}/${chunkedEnc}`;
+
+ bench.http({
+ path,
+ connections: c,
+ scheme: 'https',
+ duration
+ }, () => {
+ server.close();
+ });
+ });
+}
diff --git a/benchmark/misc/hidestackframes.js b/benchmark/misc/hidestackframes.js
new file mode 100644
index 00000000000000..5b14f2d95b22e2
--- /dev/null
+++ b/benchmark/misc/hidestackframes.js
@@ -0,0 +1,45 @@
+'use strict';
+
+const common = require('../common.js');
+
+const bench = common.createBenchmark(main, {
+ type: ['hide-stackframes-throw', 'direct-call-throw',
+ 'hide-stackframes-noerr', 'direct-call-noerr'],
+ n: [10e4]
+}, {
+ flags: ['--expose-internals']
+});
+
+function main({ n, type }) {
+ const {
+ hideStackFrames,
+ codes: {
+ ERR_INVALID_ARG_TYPE,
+ },
+ } = require('internal/errors');
+
+ const testfn = (value) => {
+ if (typeof value !== 'number') {
+ throw new ERR_INVALID_ARG_TYPE('Benchmark', 'number', value);
+ }
+ };
+
+ let fn = testfn;
+ if (type.startsWith('hide-stackframe'))
+ fn = hideStackFrames(testfn);
+ let value = 42;
+ if (type.endsWith('-throw'))
+ value = 'err';
+
+ bench.start();
+
+ for (let i = 0; i < n; i++) {
+ try {
+ fn(value);
+ } catch {
+ // No-op
+ }
+ }
+
+ bench.end(n);
+}
diff --git a/benchmark/misc/startup.js b/benchmark/misc/startup.js
index da24ee65199077..dea5a31753f8fe 100644
--- a/benchmark/misc/startup.js
+++ b/benchmark/misc/startup.js
@@ -7,7 +7,11 @@ let Worker; // Lazy loaded in main
const bench = common.createBenchmark(main, {
dur: [1],
- script: ['benchmark/fixtures/require-cachable', 'test/fixtures/semicolon'],
+ script: [
+ 'benchmark/fixtures/require-builtins',
+ 'benchmark/fixtures/require-cachable',
+ 'test/fixtures/semicolon',
+ ],
mode: ['process', 'worker']
}, {
flags: ['--expose-internals']
diff --git a/benchmark/napi/function_args/binding.cc b/benchmark/napi/function_args/binding.cc
index 2c54dd424d405d..078fe0ee3ea767 100644
--- a/benchmark/napi/function_args/binding.cc
+++ b/benchmark/napi/function_args/binding.cc
@@ -123,7 +123,9 @@ void CallWithArguments(const FunctionCallbackInfo& args) {
}
}
-void Initialize(Local |