Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a749ced

Browse filesBrowse files
debadree25juanarbol
authored andcommitted
src: add undici and acorn to process.versions
Fixes: #45260 Refs: #45599 Refs: #45260 PR-URL: #45621 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent 1e32520 commit a749ced
Copy full SHA for a749ced

File tree

Expand file treeCollapse file tree

7 files changed

+72
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

7 files changed

+72
-1
lines changed
Open diff view settings
Collapse file

‎src/acorn_version.h‎

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// This is an auto generated file, please do not edit.
2+
// Refer to tools/update-acorn.sh
3+
#ifndef SRC_ACORN_VERSION_H_
4+
#define SRC_ACORN_VERSION_H_
5+
#define ACORN_VERSION "8.8.1"
6+
#endif // SRC_ACORN_VERSION_H_
Collapse file

‎src/node_metadata.cc‎

Copy file name to clipboardExpand all lines: src/node_metadata.cc
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#include "node_metadata.h"
2+
#include "acorn_version.h"
23
#include "ares.h"
34
#include "brotli/encode.h"
45
#include "llhttp.h"
56
#include "nghttp2/nghttp2ver.h"
67
#include "node.h"
8+
#include "undici_version.h"
79
#include "util.h"
810
#include "uv.h"
911
#include "uvwasi.h"
@@ -90,6 +92,10 @@ Metadata::Versions::Versions() {
9092
std::to_string((BrotliEncoderVersion() & 0xFFF000) >> 12) +
9193
"." +
9294
std::to_string(BrotliEncoderVersion() & 0xFFF);
95+
#ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH
96+
undici = UNDICI_VERSION;
97+
#endif
98+
acorn = ACORN_VERSION;
9399

94100
uvwasi = UVWASI_VERSION_STRING;
95101

Collapse file

‎src/node_metadata.h‎

Copy file name to clipboardExpand all lines: src/node_metadata.h
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ namespace node {
2727
#define NODE_HAS_RELEASE_URLS
2828
#endif
2929

30+
#ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH
31+
#define NODE_VERSIONS_KEY_UNDICI(V) V(undici)
32+
#else
33+
#define NODE_VERSIONS_KEY_UNDICI(V)
34+
#endif
35+
3036
#define NODE_VERSIONS_KEYS_BASE(V) \
3137
V(node) \
3238
V(v8) \
@@ -38,7 +44,9 @@ namespace node {
3844
V(nghttp2) \
3945
V(napi) \
4046
V(llhttp) \
41-
V(uvwasi)
47+
V(uvwasi) \
48+
V(acorn) \
49+
NODE_VERSIONS_KEY_UNDICI(V)
4250

4351
#if HAVE_OPENSSL
4452
#define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl)
Collapse file

‎src/undici_version.h‎

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// This is an auto generated file, please do not edit.
2+
// Refer to tools/update-undici.sh
3+
#ifndef SRC_UNDICI_VERSION_H_
4+
#define SRC_UNDICI_VERSION_H_
5+
#define UNDICI_VERSION "5.14.0"
6+
#endif // SRC_UNDICI_VERSION_H_
Collapse file

‎test/parallel/test-process-versions.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-process-versions.js
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
const common = require('../common');
33
const assert = require('assert');
44

5+
// Import of pure js (non-shared) deps for comparison
6+
const acorn = require('../../deps/acorn/acorn/package.json');
7+
58
const expected_keys = [
69
'ares',
710
'brotli',
@@ -14,8 +17,15 @@ const expected_keys = [
1417
'napi',
1518
'llhttp',
1619
'uvwasi',
20+
'acorn',
1721
];
1822

23+
const hasUndici = process.config.variables.node_builtin_shareable_builtins.includes('deps/undici/undici.js');
24+
25+
if (hasUndici) {
26+
expected_keys.push('undici');
27+
}
28+
1929
if (common.hasCrypto) {
2030
expected_keys.push('openssl');
2131
}
@@ -39,13 +49,18 @@ assert.deepStrictEqual(actual_keys, expected_keys);
3949

4050
const commonTemplate = /^\d+\.\d+\.\d+(?:-.*)?$/;
4151

52+
assert.match(process.versions.acorn, commonTemplate);
4253
assert.match(process.versions.ares, commonTemplate);
4354
assert.match(process.versions.brotli, commonTemplate);
4455
assert.match(process.versions.llhttp, commonTemplate);
4556
assert.match(process.versions.node, commonTemplate);
4657
assert.match(process.versions.uv, commonTemplate);
4758
assert.match(process.versions.zlib, commonTemplate);
4859

60+
if (hasUndici) {
61+
assert.match(process.versions.undici, commonTemplate);
62+
}
63+
4964
assert.match(
5065
process.versions.v8,
5166
/^\d+\.\d+\.\d+(?:\.\d+)?-node\.\d+(?: \(candidate\))?$/
@@ -70,3 +85,12 @@ for (let i = 0; i < expected_keys.length; i++) {
7085

7186
assert.strictEqual(process.config.variables.napi_build_version,
7287
process.versions.napi);
88+
89+
if (hasUndici) {
90+
const undici = require('../../deps/undici/src/package.json');
91+
const expectedUndiciVersion = undici.version;
92+
assert.strictEqual(process.versions.undici, expectedUndiciVersion);
93+
}
94+
95+
const expectedAcornVersion = acorn.version;
96+
assert.strictEqual(process.versions.acorn, expectedAcornVersion);
Collapse file

‎tools/update-acorn.sh‎

Copy file name to clipboardExpand all lines: tools/update-acorn.sh
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ rm -rf deps/acorn/acorn
2323
"$NODE" "$NPM" init --yes
2424

2525
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn
26+
cd node_modules/acorn
27+
# get acorn version
28+
ACORN_VERSION=$("$NODE" -p "require('./package.json').version")
29+
# update this version information in src/acorn_version.h
30+
FILE_PATH="$ROOT/src/acorn_version.h"
31+
echo "// This is an auto generated file, please do not edit." > "$FILE_PATH"
32+
echo "// Refer to tools/update-acorn.sh" >> "$FILE_PATH"
33+
echo "#ifndef SRC_ACORN_VERSION_H_" >> "$FILE_PATH"
34+
echo "#define SRC_ACORN_VERSION_H_" >> "$FILE_PATH"
35+
echo "#define ACORN_VERSION \"$ACORN_VERSION\"" >> "$FILE_PATH"
36+
echo "#endif // SRC_ACORN_VERSION_H_" >> "$FILE_PATH"
2637
)
2738

2839
mv acorn-tmp/node_modules/acorn deps/acorn
Collapse file

‎tools/update-undici.sh‎

Copy file name to clipboardExpand all lines: tools/update-undici.sh
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ rm -f deps/undici/undici.js
2626
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts undici
2727
cd node_modules/undici
2828
"$NODE" "$NPM" run build:node
29+
# get the new version of undici
30+
UNDICI_VERSION=$("$NODE" -p "require('./package.json').version")
31+
# update this version information in src/undici_version.h
32+
FILE_PATH="$ROOT/src/undici_version.h"
33+
echo "// This is an auto generated file, please do not edit." > "$FILE_PATH"
34+
echo "// Refer to tools/update-undici.sh" >> "$FILE_PATH"
35+
echo "#ifndef SRC_ACORN_VERSION_H_" >> "$FILE_PATH"
36+
echo "#define SRC_ACORN_VERSION_H_" >> "$FILE_PATH"
37+
echo "#define UNDICI_VERSION \"$UNDICI_VERSION\"" >> "$FILE_PATH"
38+
echo "#endif // SRC_ACORN_VERSION_H_" >> "$FILE_PATH"
2939
)
3040

3141
mv undici-tmp/node_modules/undici deps/undici/src

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.