Skip to content

Commit

Permalink
src: add cjs_module_lexer_version base64_version
Browse files Browse the repository at this point in the history
src: add cjs_module_lexer_version base64_version

src: add cjs_module_lexer_version base64_version
src: add cjs_module_lexer_version base64_version
  • Loading branch information
MrJithil committed Dec 12, 2022
1 parent c6c3eea commit 3b1d99c
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/base64_version.h
@@ -0,0 +1 @@
#define BASE64_VERSION "0.5.0" // NOLINT(build/header_guard)
1 change: 1 addition & 0 deletions src/cjs_module_lexer_version.h
@@ -0,0 +1 @@
#define CJS_MODULE_LEXER_VERSION "1.2.2" // NOLINT(build/header_guard)
4 changes: 4 additions & 0 deletions src/node_metadata.cc
@@ -1,6 +1,8 @@
#include "node_metadata.h"
#include "ares.h"
#include "base64_version.h"
#include "brotli/encode.h"
#include "cjs_module_lexer_version.h"
#include "llhttp.h"
#include "nghttp2/nghttp2ver.h"
#include "node.h"
Expand Down Expand Up @@ -90,6 +92,8 @@ Metadata::Versions::Versions() {
std::to_string((BrotliEncoderVersion() & 0xFFF000) >> 12) +
"." +
std::to_string(BrotliEncoderVersion() & 0xFFF);
cjs_module_lexer = CJS_MODULE_LEXER_VERSION;
base64 = BASE64_VERSION;

uvwasi = UVWASI_VERSION_STRING;

Expand Down
4 changes: 3 additions & 1 deletion src/node_metadata.h
Expand Up @@ -38,7 +38,9 @@ namespace node {
V(nghttp2) \
V(napi) \
V(llhttp) \
V(uvwasi)
V(uvwasi) \
V(cjs_module_lexer) \
V(base64)

#if HAVE_OPENSSL
#define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl)
Expand Down
8 changes: 8 additions & 0 deletions test/parallel/test-process-versions.js
Expand Up @@ -2,6 +2,8 @@
const common = require('../common');
const assert = require('assert');

const cjs_module_lexer = require('../../deps/cjs-module-lexer/package.json');

const expected_keys = [
'ares',
'brotli',
Expand All @@ -14,6 +16,8 @@ const expected_keys = [
'napi',
'llhttp',
'uvwasi',
'cjs_module_lexer',
'base64',
];

if (common.hasCrypto) {
Expand Down Expand Up @@ -51,6 +55,7 @@ assert.match(
/^\d+\.\d+\.\d+(?:\.\d+)?-node\.\d+(?: \(candidate\))?$/
);
assert.match(process.versions.modules, /^\d+$/);
assert.match(process.versions.cjs_module_lexer, commonTemplate);

if (common.hasCrypto) {
const versionRegex = common.hasOpenSSL3 ?
Expand All @@ -70,3 +75,6 @@ for (let i = 0; i < expected_keys.length; i++) {

assert.strictEqual(process.config.variables.napi_build_version,
process.versions.napi);

const expectedCjsModuleLexerVersion = cjs_module_lexer.version;
assert.strictEqual(process.versions.cjs_module_lexer, expectedCjsModuleLexerVersion);
2 changes: 2 additions & 0 deletions tools/update-base64.sh
Expand Up @@ -45,3 +45,5 @@ echo ""
echo "$ git add -A deps/base64/base64"
echo "$ git commit -m \"deps: update base64 to $BASE64_VERSION\""
echo ""

echo "#define BASE64_VERSION \"$BASE64_VERSION\" // NOLINT(build/header_guard)" > "$BASE_DIR/src/base64_version.h"
19 changes: 19 additions & 0 deletions tools/update-deps-version-files.sh
@@ -0,0 +1,19 @@
#!/bin/sh

# Shell script to update version file of the deps in the source tree.
# This script could be used to update the version file for deps that do not have their
# own update scripts

# update cjs_module_lexer_version.h
{
ROOT="$PWD/"
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
[ -x "$NODE" ] || NODE=$(command -v node)

# cjs-module-lexer
cd deps/cjs-module-lexer || exit
# get cjs-module-lexer version
CJS_MODULE_LEXER_VERSION=$("$NODE" -p "require('./package.json').version")
# update this version information in src/cjs_module_lexer_version.h
echo "#define CJS_MODULE_LEXER_VERSION \"$CJS_MODULE_LEXER_VERSION\" // NOLINT(build/header_guard)" > "$ROOT/src/cjs_module_lexer_version.h"
}

0 comments on commit 3b1d99c

Please sign in to comment.