mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
src: add undici and acorn to process.versions
Fixes: https://github.com/nodejs/node/issues/45260 Refs: https://github.com/nodejs/node/pull/45599 Refs: https://github.com/nodejs/node/issues/45260 PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
ca2ec902e9
commit
9d1d94819f
7 changed files with 72 additions and 1 deletions
6
src/acorn_version.h
Normal file
6
src/acorn_version.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
// 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_
|
||||
#define ACORN_VERSION "8.8.1"
|
||||
#endif // SRC_ACORN_VERSION_H_
|
|
@ -1,9 +1,11 @@
|
|||
#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"
|
||||
|
@ -90,6 +92,10 @@ 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;
|
||||
|
||||
|
|
|
@ -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) \
|
||||
|
@ -38,7 +44,9 @@ namespace node {
|
|||
V(nghttp2) \
|
||||
V(napi) \
|
||||
V(llhttp) \
|
||||
V(uvwasi)
|
||||
V(uvwasi) \
|
||||
V(acorn) \
|
||||
NODE_VERSIONS_KEY_UNDICI(V)
|
||||
|
||||
#if HAVE_OPENSSL
|
||||
#define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl)
|
||||
|
|
6
src/undici_version.h
Normal file
6
src/undici_version.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
// 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_
|
||||
#define UNDICI_VERSION "5.14.0"
|
||||
#endif // SRC_UNDICI_VERSION_H_
|
|
@ -2,6 +2,9 @@
|
|||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
// Import of pure js (non-shared) deps for comparison
|
||||
const acorn = require('../../deps/acorn/acorn/package.json');
|
||||
|
||||
const expected_keys = [
|
||||
'ares',
|
||||
'brotli',
|
||||
|
@ -14,8 +17,15 @@ const expected_keys = [
|
|||
'napi',
|
||||
'llhttp',
|
||||
'uvwasi',
|
||||
'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');
|
||||
}
|
||||
|
@ -39,6 +49,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);
|
||||
|
@ -46,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\))?$/
|
||||
|
@ -70,3 +85,12 @@ for (let i = 0; i < expected_keys.length; i++) {
|
|||
|
||||
assert.strictEqual(process.config.variables.napi_build_version,
|
||||
process.versions.napi);
|
||||
|
||||
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);
|
||||
|
|
|
@ -23,6 +23,17 @@ 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
|
||||
FILE_PATH="$ROOT/src/acorn_version.h"
|
||||
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"
|
||||
echo "#define ACORN_VERSION \"$ACORN_VERSION\"" >> "$FILE_PATH"
|
||||
echo "#endif // SRC_ACORN_VERSION_H_" >> "$FILE_PATH"
|
||||
)
|
||||
|
||||
mv acorn-tmp/node_modules/acorn deps/acorn
|
||||
|
|
|
@ -26,6 +26,16 @@ 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/undici_version.h
|
||||
FILE_PATH="$ROOT/src/undici_version.h"
|
||||
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"
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue