From 317bfe55a67bfa836423c2af4406aa817d1d70ab Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Fri, 25 Nov 2022 13:37:25 +0530 Subject: [PATCH 01/31] src: add undici and acorn to process.versions Attempted to update undici version when the update scripts are run Fixes: https://github.com/nodejs/node/issues/45260 Refs: https://github.com/nodejs/node/pull/45599 --- src/node_metadata.cc | 4 ++++ src/node_metadata.h | 7 ++++--- tools/update-undici.sh | 7 +++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/node_metadata.cc b/src/node_metadata.cc index d4c8ccde21d397..3569cc3f2082f0 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -29,6 +29,9 @@ #include #endif // NODE_HAVE_I18N_SUPPORT +// version definitions of pure js deps +#define UNDICI_VERSION "5.12.0" + namespace node { namespace per_process { @@ -90,6 +93,7 @@ Metadata::Versions::Versions() { std::to_string((BrotliEncoderVersion() & 0xFFF000) >> 12) + "." + std::to_string(BrotliEncoderVersion() & 0xFFF); + undici = UNDICI_VERSION; uvwasi = UVWASI_VERSION_STRING; diff --git a/src/node_metadata.h b/src/node_metadata.h index 89c2d36611ee7b..529f2239be893f 100644 --- a/src/node_metadata.h +++ b/src/node_metadata.h @@ -38,7 +38,8 @@ namespace node { V(nghttp2) \ V(napi) \ V(llhttp) \ - V(uvwasi) + V(uvwasi) \ + V(undici) #if HAVE_OPENSSL #define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl) @@ -57,8 +58,8 @@ namespace node { #endif // NODE_HAVE_I18N_SUPPORT #ifdef OPENSSL_INFO_QUIC -#define NODE_VERSIONS_KEY_QUIC(V) \ - V(ngtcp2) \ +#define NODE_VERSIONS_KEY_QUIC(V) \ + V(ngtcp2) \ V(nghttp3) #else #define NODE_VERSIONS_KEY_QUIC(V) diff --git a/tools/update-undici.sh b/tools/update-undici.sh index 8350e215272808..8df4cbcdb06422 100755 --- a/tools/update-undici.sh +++ b/tools/update-undici.sh @@ -26,6 +26,13 @@ rm -f deps/undici/undici.js "$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts undici cd node_modules/undici "$NODE" "$NPM" run build:node + # get the new version of undici + UNDICI_VERSION=$("$NODE" -p "require('./package.json').version") + # update this version information in src/node_metadata.cc + sed -i '' "s/UNDICI_VERSION \"[0-9.]*\"/UNDICI_VERSION \"$UNDICI_VERSION\"/" "$ROOT/src/node_metadata.cc" + # commit these changes + git add "$ROOT/src/node_metadata.cc" + git commit -m "src: update undici version to $UNDICI_VERSION" ) mv undici-tmp/node_modules/undici deps/undici/src From db5993dca21c0b556f29ec61f867c117c515c405 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Fri, 25 Nov 2022 17:19:09 +0530 Subject: [PATCH 02/31] tools: update script to use a more portable version of sed Co-authored-by: Antoine du Hamel --- tools/update-undici.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/update-undici.sh b/tools/update-undici.sh index 8df4cbcdb06422..f5f87391d49a73 100755 --- a/tools/update-undici.sh +++ b/tools/update-undici.sh @@ -29,7 +29,9 @@ rm -f deps/undici/undici.js # get the new version of undici UNDICI_VERSION=$("$NODE" -p "require('./package.json').version") # update this version information in src/node_metadata.cc - sed -i '' "s/UNDICI_VERSION \"[0-9.]*\"/UNDICI_VERSION \"$UNDICI_VERSION\"/" "$ROOT/src/node_metadata.cc" + git show HEAD:src/node_metadata.cc | \ + sed "s/UNDICI_VERSION \"[0-9.]*\"/UNDICI_VERSION \"$UNDICI_VERSION\"/" \ + > "$ROOT/src/node_metadata.cc" # commit these changes git add "$ROOT/src/node_metadata.cc" git commit -m "src: update undici version to $UNDICI_VERSION" From 196effe15f66fb50b8be0405818b0086b3a481cf Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Fri, 25 Nov 2022 19:14:52 +0530 Subject: [PATCH 03/31] tools: updated script to remove git commit Removed git commit step since its a repetition Co-authored-by: Darshan Sen --- tools/update-undici.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/update-undici.sh b/tools/update-undici.sh index f5f87391d49a73..db98f82bc9103b 100755 --- a/tools/update-undici.sh +++ b/tools/update-undici.sh @@ -32,9 +32,6 @@ rm -f deps/undici/undici.js git show HEAD:src/node_metadata.cc | \ sed "s/UNDICI_VERSION \"[0-9.]*\"/UNDICI_VERSION \"$UNDICI_VERSION\"/" \ > "$ROOT/src/node_metadata.cc" - # commit these changes - git add "$ROOT/src/node_metadata.cc" - git commit -m "src: update undici version to $UNDICI_VERSION" ) mv undici-tmp/node_modules/undici deps/undici/src From 7a6cfc7f00bd562c3b042a4e9667ee846a5c707c Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Fri, 25 Nov 2022 23:05:38 +0530 Subject: [PATCH 04/31] test: added test for undici version --- test/parallel/test-process-versions.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 2ec7a0f84a5280..3cda046571441c 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -2,6 +2,9 @@ const common = require('../common'); const assert = require('assert'); +// import of pure js deps for comparison +const undici = require('../../deps/undici/src/package.json'); + const expected_keys = [ 'ares', 'brotli', @@ -14,6 +17,7 @@ const expected_keys = [ 'napi', 'llhttp', 'uvwasi', + 'undici', ]; if (common.hasCrypto) { @@ -45,6 +49,7 @@ assert.match(process.versions.llhttp, commonTemplate); assert.match(process.versions.node, commonTemplate); assert.match(process.versions.uv, commonTemplate); assert.match(process.versions.zlib, commonTemplate); +assert.match(process.versions.undici, commonTemplate); assert.match( process.versions.v8, @@ -53,12 +58,12 @@ assert.match( assert.match(process.versions.modules, /^\d+$/); if (common.hasCrypto) { - const versionRegex = common.hasOpenSSL3 ? - // The following also matches a development version of OpenSSL 3.x which - // can be in the format '3.0.0-alpha4-dev'. This can be handy when building - // and linking against the main development branch of OpenSSL. - /^\d+\.\d+\.\d+(?:[-+][a-z0-9]+)*$/ : - /^\d+\.\d+\.\d+[a-z]?(\+quic)?(-fips)?$/; + const versionRegex = common.hasOpenSSL3 + ? // The following also matches a development version of OpenSSL 3.x which + // can be in the format '3.0.0-alpha4-dev'. This can be handy when building + // and linking against the main development branch of OpenSSL. + /^\d+\.\d+\.\d+(?:[-+][a-z0-9]+)*$/ + : /^\d+\.\d+\.\d+[a-z]?(\+quic)?(-fips)?$/; assert.match(process.versions.openssl, versionRegex); } @@ -68,5 +73,10 @@ for (let i = 0; i < expected_keys.length; i++) { assert.strictEqual(descriptor.writable, false); } -assert.strictEqual(process.config.variables.napi_build_version, - process.versions.napi); +assert.strictEqual( + process.config.variables.napi_build_version, + process.versions.napi +); + +const expectedUndiciVersion = undici.version; +assert.strictEqual(process.versions.undici, expectedUndiciVersion); From 8c9efc0022d31b3e2078fa283a74336069a9f6a0 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sat, 26 Nov 2022 00:21:46 +0530 Subject: [PATCH 05/31] src,tools: move the version definitions to a seprate file for undici --- src/node_metadata.cc | 3 +-- src/undici_version.h | 1 + tools/update-undici.sh | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) create mode 100644 src/undici_version.h diff --git a/src/node_metadata.cc b/src/node_metadata.cc index 3569cc3f2082f0..778ffcba338c2e 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -9,6 +9,7 @@ #include "uvwasi.h" #include "v8.h" #include "zlib.h" +#include "undici_version.h" #if HAVE_OPENSSL #include @@ -29,8 +30,6 @@ #include #endif // NODE_HAVE_I18N_SUPPORT -// version definitions of pure js deps -#define UNDICI_VERSION "5.12.0" namespace node { diff --git a/src/undici_version.h b/src/undici_version.h new file mode 100644 index 00000000000000..2cbec3b9b429e1 --- /dev/null +++ b/src/undici_version.h @@ -0,0 +1 @@ +#define UNDICI_VERSION "1.0.0" \ No newline at end of file diff --git a/tools/update-undici.sh b/tools/update-undici.sh index db98f82bc9103b..2755599b79a1d5 100755 --- a/tools/update-undici.sh +++ b/tools/update-undici.sh @@ -28,10 +28,8 @@ rm -f deps/undici/undici.js "$NODE" "$NPM" run build:node # get the new version of undici UNDICI_VERSION=$("$NODE" -p "require('./package.json').version") - # update this version information in src/node_metadata.cc - git show HEAD:src/node_metadata.cc | \ - sed "s/UNDICI_VERSION \"[0-9.]*\"/UNDICI_VERSION \"$UNDICI_VERSION\"/" \ - > "$ROOT/src/node_metadata.cc" + # update this version information in src/undici_version.h + echo "#define UNDICI_VERSION \"$UNDICI_VERSION\"" > "$ROOT/src/undici_version.h" ) mv undici-tmp/node_modules/undici deps/undici/src From 7af879316cbe9e65cd05b36b6a26837ea2babd06 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sat, 26 Nov 2022 00:43:23 +0530 Subject: [PATCH 06/31] src,tools: added version information for acorn --- src/acorn_version.h | 1 + src/node_metadata.cc | 2 ++ src/node_metadata.h | 1 + tools/update-acorn.sh | 5 +++++ 4 files changed, 9 insertions(+) create mode 100644 src/acorn_version.h diff --git a/src/acorn_version.h b/src/acorn_version.h new file mode 100644 index 00000000000000..d21702ab55ed88 --- /dev/null +++ b/src/acorn_version.h @@ -0,0 +1 @@ +#define ACORN_VERSION "8.8.1" diff --git a/src/node_metadata.cc b/src/node_metadata.cc index 778ffcba338c2e..b409f474a680c6 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -10,6 +10,7 @@ #include "v8.h" #include "zlib.h" #include "undici_version.h" +#include "acorn_version.h" #if HAVE_OPENSSL #include @@ -93,6 +94,7 @@ Metadata::Versions::Versions() { "." + std::to_string(BrotliEncoderVersion() & 0xFFF); undici = UNDICI_VERSION; + acorn = ACORN_VERSION; uvwasi = UVWASI_VERSION_STRING; diff --git a/src/node_metadata.h b/src/node_metadata.h index 529f2239be893f..5238ccd13858be 100644 --- a/src/node_metadata.h +++ b/src/node_metadata.h @@ -39,6 +39,7 @@ namespace node { V(napi) \ V(llhttp) \ V(uvwasi) \ + V(acorn) \ V(undici) #if HAVE_OPENSSL diff --git a/tools/update-acorn.sh b/tools/update-acorn.sh index fadcb242884d77..e344becda336ac 100755 --- a/tools/update-acorn.sh +++ b/tools/update-acorn.sh @@ -23,6 +23,11 @@ rm -rf deps/acorn/acorn "$NODE" "$NPM" init --yes "$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn + cd node_modules/acorn + # get acorn version + ACORN_VERSION=$("$NODE" -p "require('./package.json').version") + # update this version information in src/acorn_version.h + echo "#define ACORN_VERSION \"$ACORN_VERSION\"" > "$ROOT/src/acorn_version.h" ) mv acorn-tmp/node_modules/acorn deps/acorn From dbf55e2f363497ac7d4b449d6349dd350f356ec9 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sat, 26 Nov 2022 00:43:41 +0530 Subject: [PATCH 07/31] test: added tests for acorn version --- test/parallel/test-process-versions.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 3cda046571441c..294e48dfa39fb2 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -4,6 +4,7 @@ const assert = require('assert'); // import of pure js deps for comparison const undici = require('../../deps/undici/src/package.json'); +const acorn = require('../../deps/acorn/acorn/package.json'); const expected_keys = [ 'ares', @@ -18,6 +19,7 @@ const expected_keys = [ 'llhttp', 'uvwasi', 'undici', + 'acorn', ]; if (common.hasCrypto) { @@ -80,3 +82,6 @@ assert.strictEqual( const expectedUndiciVersion = undici.version; assert.strictEqual(process.versions.undici, expectedUndiciVersion); + +const expectedAcornVersion = acorn.version; +assert.strictEqual(process.versions.acorn, expectedAcornVersion); From f444e8a417efb8716eb5641386000b231a7a713f Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sat, 26 Nov 2022 00:55:51 +0530 Subject: [PATCH 08/31] src: use proper version for undici --- src/undici_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/undici_version.h b/src/undici_version.h index 2cbec3b9b429e1..3a23b725427d34 100644 --- a/src/undici_version.h +++ b/src/undici_version.h @@ -1 +1 @@ -#define UNDICI_VERSION "1.0.0" \ No newline at end of file +#define UNDICI_VERSION "5.12.0" \ No newline at end of file From bb7c816336ea53797e3ef56e2a384711acc5a49c Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sat, 26 Nov 2022 10:10:10 +0530 Subject: [PATCH 09/31] src: src/undici_version.h update file endline Co-authored-by: Antoine du Hamel --- src/undici_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/undici_version.h b/src/undici_version.h index 3a23b725427d34..cda165410cc97a 100644 --- a/src/undici_version.h +++ b/src/undici_version.h @@ -1 +1 @@ -#define UNDICI_VERSION "5.12.0" \ No newline at end of file +#define UNDICI_VERSION "5.12.0" From d15264c1e00460a218de4c9276487ffa3bfd958b Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sat, 26 Nov 2022 10:10:42 +0530 Subject: [PATCH 10/31] src: src/node_metadata.cc update file endline Co-authored-by: Antoine du Hamel --- src/node_metadata.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/node_metadata.cc b/src/node_metadata.cc index b409f474a680c6..d7615ba335c848 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -31,7 +31,6 @@ #include #endif // NODE_HAVE_I18N_SUPPORT - namespace node { namespace per_process { From 75480f046180b855a6819395b35e1a2d76966297 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sat, 26 Nov 2022 17:28:56 +0530 Subject: [PATCH 11/31] src: added header gaurds to version information header files --- src/acorn_version.h | 3 +++ src/undici_version.h | 3 +++ tools/update-acorn.sh | 5 ++++- tools/update-undici.sh | 5 ++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/acorn_version.h b/src/acorn_version.h index d21702ab55ed88..3c479ba52439f0 100644 --- a/src/acorn_version.h +++ b/src/acorn_version.h @@ -1 +1,4 @@ +#ifndef SRC_ACORN_VERSION_H_ +#define SRC_ACORN_VERSION_H_ #define ACORN_VERSION "8.8.1" +#endif // SRC_ACORN_VERSION_H_ diff --git a/src/undici_version.h b/src/undici_version.h index cda165410cc97a..30ecbda76d0616 100644 --- a/src/undici_version.h +++ b/src/undici_version.h @@ -1 +1,4 @@ +#ifndef SRC_UNDICI_VERSION_H_ +#define SRC_UNDICI_VERSION_H_ #define UNDICI_VERSION "5.12.0" +#endif // SRC_UNDICI_VERSION_H_ diff --git a/tools/update-acorn.sh b/tools/update-acorn.sh index e344becda336ac..070f82f26facc3 100755 --- a/tools/update-acorn.sh +++ b/tools/update-acorn.sh @@ -27,7 +27,10 @@ rm -rf deps/acorn/acorn # get acorn version ACORN_VERSION=$("$NODE" -p "require('./package.json').version") # update this version information in src/acorn_version.h - echo "#define ACORN_VERSION \"$ACORN_VERSION\"" > "$ROOT/src/acorn_version.h" + echo "#ifndef SRC_ACORN_VERSION_H_" > "$ROOT/src/acorn_version.h" + echo "#define SRC_ACORN_VERSION_H_" >> "$ROOT/src/acorn_version.h" + echo "#define ACORN_VERSION \"$ACORN_VERSION\"" >> "$ROOT/src/acorn_version.h" + echo "#endif // SRC_ACORN_VERSION_H_" >> "$ROOT/src/acorn_version.h" ) mv acorn-tmp/node_modules/acorn deps/acorn diff --git a/tools/update-undici.sh b/tools/update-undici.sh index 2755599b79a1d5..a5091603dfaac4 100755 --- a/tools/update-undici.sh +++ b/tools/update-undici.sh @@ -29,7 +29,10 @@ rm -f deps/undici/undici.js # get the new version of undici UNDICI_VERSION=$("$NODE" -p "require('./package.json').version") # update this version information in src/undici_version.h - echo "#define UNDICI_VERSION \"$UNDICI_VERSION\"" > "$ROOT/src/undici_version.h" + echo "#ifndef SRC_ACORN_VERSION_H_" > "$ROOT/src/undici_version.h" + echo "#define SRC_ACORN_VERSION_H_" >> "$ROOT/src/undici_version.h" + echo "#define UNDICI_VERSION \"$UNDICI_VERSION\"" >> "$ROOT/src/undici_version.h" + echo "#endif // SRC_ACORN_VERSION_H_" >> "$ROOT/src/undici_version.h" ) mv undici-tmp/node_modules/undici deps/undici/src From 109d7521adcace51cc1325bd159d1d0f1b15815c Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sat, 26 Nov 2022 17:29:38 +0530 Subject: [PATCH 12/31] src: fixed linting issues in metadata files --- src/node_metadata.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_metadata.cc b/src/node_metadata.cc index d7615ba335c848..53bbff28c1e839 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -1,16 +1,16 @@ #include "node_metadata.h" +#include "acorn_version.h" #include "ares.h" #include "brotli/encode.h" #include "llhttp.h" #include "nghttp2/nghttp2ver.h" #include "node.h" +#include "undici_version.h" #include "util.h" #include "uv.h" #include "uvwasi.h" #include "v8.h" #include "zlib.h" -#include "undici_version.h" -#include "acorn_version.h" #if HAVE_OPENSSL #include From 3e3669e32d9445c7bd5a52b4b499bc0b8778cf91 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sat, 26 Nov 2022 17:30:18 +0530 Subject: [PATCH 13/31] tools: fixed linting issues in js test file --- test/parallel/test-process-versions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 294e48dfa39fb2..0a2e364e9ca631 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -2,7 +2,7 @@ const common = require('../common'); const assert = require('assert'); -// import of pure js deps for comparison +// Import of pure js deps for comparison const undici = require('../../deps/undici/src/package.json'); const acorn = require('../../deps/acorn/acorn/package.json'); From e275998efdfa442bc82c723779f8a67689665b7b Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Fri, 2 Dec 2022 19:02:41 +0530 Subject: [PATCH 14/31] src: added files are automated comments --- src/acorn_version.h | 2 ++ src/undici_version.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/acorn_version.h b/src/acorn_version.h index 3c479ba52439f0..630f1378b0e979 100644 --- a/src/acorn_version.h +++ b/src/acorn_version.h @@ -1,3 +1,5 @@ +// This is a auto generated file, please do not edit. +// Refer to tools/update-acorn.sh #ifndef SRC_ACORN_VERSION_H_ #define SRC_ACORN_VERSION_H_ #define ACORN_VERSION "8.8.1" diff --git a/src/undici_version.h b/src/undici_version.h index 30ecbda76d0616..0a6367053f8a0a 100644 --- a/src/undici_version.h +++ b/src/undici_version.h @@ -1,3 +1,5 @@ +// This is a auto generated file, please do not edit. +// Refer to tools/update-undici.sh #ifndef SRC_UNDICI_VERSION_H_ #define SRC_UNDICI_VERSION_H_ #define UNDICI_VERSION "5.12.0" From 95f4921c5483feccdbd2b1574ceae24c835dc568 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Fri, 2 Dec 2022 19:03:34 +0530 Subject: [PATCH 15/31] tools: add comments when rewriting the file --- tools/update-acorn.sh | 11 +++++++---- tools/update-undici.sh | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tools/update-acorn.sh b/tools/update-acorn.sh index 070f82f26facc3..2fcd768e55a864 100755 --- a/tools/update-acorn.sh +++ b/tools/update-acorn.sh @@ -27,10 +27,13 @@ rm -rf deps/acorn/acorn # get acorn version ACORN_VERSION=$("$NODE" -p "require('./package.json').version") # update this version information in src/acorn_version.h - echo "#ifndef SRC_ACORN_VERSION_H_" > "$ROOT/src/acorn_version.h" - echo "#define SRC_ACORN_VERSION_H_" >> "$ROOT/src/acorn_version.h" - echo "#define ACORN_VERSION \"$ACORN_VERSION\"" >> "$ROOT/src/acorn_version.h" - echo "#endif // SRC_ACORN_VERSION_H_" >> "$ROOT/src/acorn_version.h" + FILE_PATH="$ROOT/src/acorn_version.h" + echo "// This is a auto generated file, please do not edit." > "$FILE_PATH" + echo "// Refer to tools/update-acorn.sh" >> "$FILE_PATH" + echo "#ifndef SRC_ACORN_VERSION_H_" >> "$FILE_PATH" + echo "#define SRC_ACORN_VERSION_H_" >> "$FILE_PATH" + echo "#define ACORN_VERSION \"$ACORN_VERSION\"" >> "$FILE_PATH" + echo "#endif // SRC_ACORN_VERSION_H_" >> "$FILE_PATH" ) mv acorn-tmp/node_modules/acorn deps/acorn diff --git a/tools/update-undici.sh b/tools/update-undici.sh index a5091603dfaac4..6a251adfe4db0f 100755 --- a/tools/update-undici.sh +++ b/tools/update-undici.sh @@ -29,10 +29,13 @@ rm -f deps/undici/undici.js # get the new version of undici UNDICI_VERSION=$("$NODE" -p "require('./package.json').version") # update this version information in src/undici_version.h - echo "#ifndef SRC_ACORN_VERSION_H_" > "$ROOT/src/undici_version.h" - echo "#define SRC_ACORN_VERSION_H_" >> "$ROOT/src/undici_version.h" - echo "#define UNDICI_VERSION \"$UNDICI_VERSION\"" >> "$ROOT/src/undici_version.h" - echo "#endif // SRC_ACORN_VERSION_H_" >> "$ROOT/src/undici_version.h" + FILE_PATH="$ROOT/src/undici_version.h" + echo "// This is a auto generated file, please do not edit." > "$FILE_PATH" + echo "// Refer to tools/update-undici.sh" >> "$FILE_PATH" + echo "#ifndef SRC_ACORN_VERSION_H_" >> "$FILE_PATH" + echo "#define SRC_ACORN_VERSION_H_" >> "$FILE_PATH" + echo "#define UNDICI_VERSION \"$UNDICI_VERSION\"" >> "$FILE_PATH" + echo "#endif // SRC_ACORN_VERSION_H_" >> "$FILE_PATH" ) mv undici-tmp/node_modules/undici deps/undici/src From 864554131900814a947950bc974c7a549974ef74 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sun, 4 Dec 2022 15:18:01 +0530 Subject: [PATCH 16/31] nit: fix comment Co-authored-by: Joyee Cheung --- src/undici_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/undici_version.h b/src/undici_version.h index 0a6367053f8a0a..2409e503157797 100644 --- a/src/undici_version.h +++ b/src/undici_version.h @@ -1,4 +1,4 @@ -// This is a auto generated file, please do not edit. +// This is an auto generated file, please do not edit. // Refer to tools/update-undici.sh #ifndef SRC_UNDICI_VERSION_H_ #define SRC_UNDICI_VERSION_H_ From 8433bdd4ad42efd84abc09973ace81ead235ee9a Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sun, 4 Dec 2022 15:18:14 +0530 Subject: [PATCH 17/31] nit: fix comment Co-authored-by: Joyee Cheung --- src/acorn_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acorn_version.h b/src/acorn_version.h index 630f1378b0e979..986d1de1f07e34 100644 --- a/src/acorn_version.h +++ b/src/acorn_version.h @@ -1,4 +1,4 @@ -// This is a auto generated file, please do not edit. +// This is an auto generated file, please do not edit. // Refer to tools/update-acorn.sh #ifndef SRC_ACORN_VERSION_H_ #define SRC_ACORN_VERSION_H_ From 1455a91fb0115085e6474a4621cb851925b0bf7d Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sun, 4 Dec 2022 15:29:28 +0530 Subject: [PATCH 18/31] nit: update comments --- tools/update-acorn.sh | 2 +- tools/update-undici.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/update-acorn.sh b/tools/update-acorn.sh index 2fcd768e55a864..514b5e509706d2 100755 --- a/tools/update-acorn.sh +++ b/tools/update-acorn.sh @@ -28,7 +28,7 @@ rm -rf deps/acorn/acorn ACORN_VERSION=$("$NODE" -p "require('./package.json').version") # update this version information in src/acorn_version.h FILE_PATH="$ROOT/src/acorn_version.h" - echo "// This is a auto generated file, please do not edit." > "$FILE_PATH" + echo "// This is an auto generated file, please do not edit." > "$FILE_PATH" echo "// Refer to tools/update-acorn.sh" >> "$FILE_PATH" echo "#ifndef SRC_ACORN_VERSION_H_" >> "$FILE_PATH" echo "#define SRC_ACORN_VERSION_H_" >> "$FILE_PATH" diff --git a/tools/update-undici.sh b/tools/update-undici.sh index 6a251adfe4db0f..d3642088c5a14e 100755 --- a/tools/update-undici.sh +++ b/tools/update-undici.sh @@ -30,7 +30,7 @@ rm -f deps/undici/undici.js UNDICI_VERSION=$("$NODE" -p "require('./package.json').version") # update this version information in src/undici_version.h FILE_PATH="$ROOT/src/undici_version.h" - echo "// This is a auto generated file, please do not edit." > "$FILE_PATH" + echo "// This is an auto generated file, please do not edit." > "$FILE_PATH" echo "// Refer to tools/update-undici.sh" >> "$FILE_PATH" echo "#ifndef SRC_ACORN_VERSION_H_" >> "$FILE_PATH" echo "#define SRC_ACORN_VERSION_H_" >> "$FILE_PATH" From 122d080e89b311af2f45f1eb6d03df02ea785160 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Sun, 4 Dec 2022 15:30:03 +0530 Subject: [PATCH 19/31] src: bump up undici version --- src/undici_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/undici_version.h b/src/undici_version.h index 2409e503157797..8370c2a19020dc 100644 --- a/src/undici_version.h +++ b/src/undici_version.h @@ -2,5 +2,5 @@ // Refer to tools/update-undici.sh #ifndef SRC_UNDICI_VERSION_H_ #define SRC_UNDICI_VERSION_H_ -#define UNDICI_VERSION "5.12.0" +#define UNDICI_VERSION "5.13.0" #endif // SRC_UNDICI_VERSION_H_ From 8d11336c34339d4bac172e0646a401763700d91c Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Mon, 12 Dec 2022 12:59:13 +0530 Subject: [PATCH 20/31] fix linting issues --- test/parallel/test-process-versions.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 0a2e364e9ca631..d2c16eb4cf7356 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -60,12 +60,11 @@ assert.match( assert.match(process.versions.modules, /^\d+$/); if (common.hasCrypto) { - const versionRegex = common.hasOpenSSL3 - ? // The following also matches a development version of OpenSSL 3.x which - // can be in the format '3.0.0-alpha4-dev'. This can be handy when building - // and linking against the main development branch of OpenSSL. - /^\d+\.\d+\.\d+(?:[-+][a-z0-9]+)*$/ - : /^\d+\.\d+\.\d+[a-z]?(\+quic)?(-fips)?$/; + const versionRegex = common.hasOpenSSL3 ? // The following also matches a development version of OpenSSL 3.x which + // can be in the format '3.0.0-alpha4-dev'. This can be handy when building + // and linking against the main development branch of OpenSSL. + /^\d+\.\d+\.\d+(?:[-+][a-z0-9]+)*$/ : + /^\d+\.\d+\.\d+[a-z]?(\+quic)?(-fips)?$/; assert.match(process.versions.openssl, versionRegex); } From b17c6b4b0cbcf97fd2ff4da1b4d07b1037379ff4 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Mon, 12 Dec 2022 13:13:04 +0530 Subject: [PATCH 21/31] lint: update test-process-versions.js Co-authored-by: Antoine du Hamel --- test/parallel/test-process-versions.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index d2c16eb4cf7356..ed2fb7591b0c87 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -60,9 +60,10 @@ assert.match( assert.match(process.versions.modules, /^\d+$/); if (common.hasCrypto) { - const versionRegex = common.hasOpenSSL3 ? // The following also matches a development version of OpenSSL 3.x which - // can be in the format '3.0.0-alpha4-dev'. This can be handy when building - // and linking against the main development branch of OpenSSL. + const versionRegex = common.hasOpenSSL3 ? + // The following also matches a development version of OpenSSL 3.x which + // can be in the format '3.0.0-alpha4-dev'. This can be handy when building + // and linking against the main development branch of OpenSSL. /^\d+\.\d+\.\d+(?:[-+][a-z0-9]+)*$/ : /^\d+\.\d+\.\d+[a-z]?(\+quic)?(-fips)?$/; assert.match(process.versions.openssl, versionRegex); From 6e1786511b66bb37814d75f377855804c3647c5f Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Mon, 12 Dec 2022 13:13:19 +0530 Subject: [PATCH 22/31] lint: test/parallel/test-process-versions.js Co-authored-by: Antoine du Hamel --- test/parallel/test-process-versions.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index ed2fb7591b0c87..a2f0c086ff47b5 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -75,10 +75,8 @@ for (let i = 0; i < expected_keys.length; i++) { assert.strictEqual(descriptor.writable, false); } -assert.strictEqual( - process.config.variables.napi_build_version, - process.versions.napi -); +assert.strictEqual(process.config.variables.napi_build_version, + process.versions.napi); const expectedUndiciVersion = undici.version; assert.strictEqual(process.versions.undici, expectedUndiciVersion); From 3cf68e7b59f5e2c0f08e198f17b4d004e0baf154 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Mon, 12 Dec 2022 13:13:30 +0530 Subject: [PATCH 23/31] lint: src/node_metadata.h Co-authored-by: Antoine du Hamel --- src/node_metadata.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_metadata.h b/src/node_metadata.h index 5238ccd13858be..3602901d063e0d 100644 --- a/src/node_metadata.h +++ b/src/node_metadata.h @@ -59,8 +59,8 @@ namespace node { #endif // NODE_HAVE_I18N_SUPPORT #ifdef OPENSSL_INFO_QUIC -#define NODE_VERSIONS_KEY_QUIC(V) \ - V(ngtcp2) \ +#define NODE_VERSIONS_KEY_QUIC(V) \ + V(ngtcp2) \ V(nghttp3) #else #define NODE_VERSIONS_KEY_QUIC(V) From 298b01fde221b2e311a5f6198849cb235ff16c1d Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Mon, 12 Dec 2022 13:26:20 +0530 Subject: [PATCH 24/31] test: make list alphabetical Co-authored-by: Antoine du Hamel --- test/parallel/test-process-versions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index a2f0c086ff47b5..4d514315d2a39b 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -49,9 +49,9 @@ assert.match(process.versions.ares, commonTemplate); assert.match(process.versions.brotli, commonTemplate); assert.match(process.versions.llhttp, commonTemplate); assert.match(process.versions.node, commonTemplate); +assert.match(process.versions.undici, commonTemplate); assert.match(process.versions.uv, commonTemplate); assert.match(process.versions.zlib, commonTemplate); -assert.match(process.versions.undici, commonTemplate); assert.match( process.versions.v8, From 6ce7f8926a3dbdea3b60e3e13e8ee5d22c12b416 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Mon, 12 Dec 2022 13:28:07 +0530 Subject: [PATCH 25/31] test: add acorn to test version match --- test/parallel/test-process-versions.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 4d514315d2a39b..c9892dc0730b60 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -45,6 +45,7 @@ assert.deepStrictEqual(actual_keys, expected_keys); const commonTemplate = /^\d+\.\d+\.\d+(?:-.*)?$/; +assert.match(process.versions.acorn, commonTemplate); assert.match(process.versions.ares, commonTemplate); assert.match(process.versions.brotli, commonTemplate); assert.match(process.versions.llhttp, commonTemplate); From 08d8398718527a28f7650e905fe0ed17fe5cd567 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Tue, 13 Dec 2022 10:43:20 +0530 Subject: [PATCH 26/31] bump up undici version --- src/undici_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/undici_version.h b/src/undici_version.h index 8370c2a19020dc..a788b1f78e7a4e 100644 --- a/src/undici_version.h +++ b/src/undici_version.h @@ -2,5 +2,5 @@ // Refer to tools/update-undici.sh #ifndef SRC_UNDICI_VERSION_H_ #define SRC_UNDICI_VERSION_H_ -#define UNDICI_VERSION "5.13.0" +#define UNDICI_VERSION "5.14.0" #endif // SRC_UNDICI_VERSION_H_ From 5a77a9d4f8b8dccec77afe12228843ccb2dae76c Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Thu, 15 Dec 2022 21:59:44 +0530 Subject: [PATCH 27/31] src: remove undici version if externalised --- src/node_metadata.cc | 2 ++ src/node_metadata.h | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/node_metadata.cc b/src/node_metadata.cc index 53bbff28c1e839..a58f5bc01e12d7 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -92,7 +92,9 @@ Metadata::Versions::Versions() { std::to_string((BrotliEncoderVersion() & 0xFFF000) >> 12) + "." + std::to_string(BrotliEncoderVersion() & 0xFFF); + #ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH undici = UNDICI_VERSION; + #endif acorn = ACORN_VERSION; uvwasi = UVWASI_VERSION_STRING; diff --git a/src/node_metadata.h b/src/node_metadata.h index 3602901d063e0d..6c29c0ebdd7c01 100644 --- a/src/node_metadata.h +++ b/src/node_metadata.h @@ -27,6 +27,12 @@ namespace node { #define NODE_HAS_RELEASE_URLS #endif +#ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH +#define NODE_VERSIONS_KEY_UNDICI(V) V(undici) +#else +#define NODE_VERSIONS_KEY_UNDICI(V) +#endif + #define NODE_VERSIONS_KEYS_BASE(V) \ V(node) \ V(v8) \ @@ -40,7 +46,7 @@ namespace node { V(llhttp) \ V(uvwasi) \ V(acorn) \ - V(undici) + NODE_VERSIONS_KEY_UNDICI(V) #if HAVE_OPENSSL #define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl) From b1041a390262bb85f3f6b6ff8d32488d51440bb8 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Thu, 15 Dec 2022 22:09:43 +0530 Subject: [PATCH 28/31] fix lint --- src/node_metadata.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_metadata.cc b/src/node_metadata.cc index a58f5bc01e12d7..5f87d12ff2acde 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -93,7 +93,7 @@ Metadata::Versions::Versions() { "." + std::to_string(BrotliEncoderVersion() & 0xFFF); #ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH - undici = UNDICI_VERSION; + undici = UNDICI_VERSION; #endif acorn = ACORN_VERSION; From fd754974cc82b90558fecd8651b7f05305286e01 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Thu, 15 Dec 2022 22:32:58 +0530 Subject: [PATCH 29/31] test: check if shared undici exists --- test/parallel/test-process-versions.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index c9892dc0730b60..f939dcfd46b358 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -2,8 +2,7 @@ const common = require('../common'); const assert = require('assert'); -// Import of pure js deps for comparison -const undici = require('../../deps/undici/src/package.json'); +// Import of pure js (non-shared) deps for comparison const acorn = require('../../deps/acorn/acorn/package.json'); const expected_keys = [ @@ -18,10 +17,15 @@ const expected_keys = [ 'napi', 'llhttp', 'uvwasi', - 'undici', 'acorn', ]; +const hasUndici = process.config.variables.node_builtin_shareable_builtins.includes('deps/undici/undici.js'); + +if (hasUndici) { + expected_keys.push('undici'); +} + if (common.hasCrypto) { expected_keys.push('openssl'); } @@ -50,7 +54,6 @@ assert.match(process.versions.ares, commonTemplate); assert.match(process.versions.brotli, commonTemplate); assert.match(process.versions.llhttp, commonTemplate); assert.match(process.versions.node, commonTemplate); -assert.match(process.versions.undici, commonTemplate); assert.match(process.versions.uv, commonTemplate); assert.match(process.versions.zlib, commonTemplate); @@ -70,6 +73,10 @@ if (common.hasCrypto) { assert.match(process.versions.openssl, versionRegex); } +if (hasUndici) { + assert.match(process.versions.undici, commonTemplate); +} + for (let i = 0; i < expected_keys.length; i++) { const key = expected_keys[i]; const descriptor = Object.getOwnPropertyDescriptor(process.versions, key); @@ -79,8 +86,11 @@ for (let i = 0; i < expected_keys.length; i++) { assert.strictEqual(process.config.variables.napi_build_version, process.versions.napi); -const expectedUndiciVersion = undici.version; -assert.strictEqual(process.versions.undici, expectedUndiciVersion); +if (hasUndici) { + const undici = require('../../deps/undici/src/package.json'); + const expectedUndiciVersion = undici.version; + assert.strictEqual(process.versions.undici, expectedUndiciVersion); +} const expectedAcornVersion = acorn.version; assert.strictEqual(process.versions.acorn, expectedAcornVersion); From 06a76e47a8aab8e8ae20df1e68eb9b6db12a7e65 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Thu, 15 Dec 2022 22:34:45 +0530 Subject: [PATCH 30/31] lint fix again --- src/node_metadata.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node_metadata.cc b/src/node_metadata.cc index 5f87d12ff2acde..fefad37c894fd6 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -92,9 +92,9 @@ Metadata::Versions::Versions() { std::to_string((BrotliEncoderVersion() & 0xFFF000) >> 12) + "." + std::to_string(BrotliEncoderVersion() & 0xFFF); - #ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH - undici = UNDICI_VERSION; - #endif +#ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH + undici = UNDICI_VERSION; +#endif acorn = ACORN_VERSION; uvwasi = UVWASI_VERSION_STRING; From c2e2d39db7c6f25b6b060ab69afcab6344b035a6 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Thu, 15 Dec 2022 22:35:55 +0530 Subject: [PATCH 31/31] test: small refactor --- test/parallel/test-process-versions.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index f939dcfd46b358..54722cbf59ab66 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -57,6 +57,10 @@ assert.match(process.versions.node, commonTemplate); assert.match(process.versions.uv, commonTemplate); assert.match(process.versions.zlib, commonTemplate); +if (hasUndici) { + assert.match(process.versions.undici, commonTemplate); +} + assert.match( process.versions.v8, /^\d+\.\d+\.\d+(?:\.\d+)?-node\.\d+(?: \(candidate\))?$/ @@ -73,10 +77,6 @@ if (common.hasCrypto) { assert.match(process.versions.openssl, versionRegex); } -if (hasUndici) { - assert.match(process.versions.undici, commonTemplate); -} - for (let i = 0; i < expected_keys.length; i++) { const key = expected_keys[i]; const descriptor = Object.getOwnPropertyDescriptor(process.versions, key);