Skip to content

Commit f7e72a4

Browse files
Merge pull request #1049 from nodejs/main
Create a new pull request by comparing changes across two branches
2 parents fbc75cf + a327288 commit f7e72a4

File tree

106 files changed

+4684
-1983
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+4684
-1983
lines changed

.github/workflows/test-shared.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ on:
1818
- deps/cares/**
1919
- deps/crates/**
2020
- deps/corepack/**
21+
- deps/googletest/**
22+
- deps/histogram/**
2123
- deps/icu-small/**
2224
- deps/icu-tmp/**
2325
- deps/llhttp/**
@@ -64,6 +66,8 @@ on:
6466
- deps/cares/**
6567
- deps/crates/**
6668
- deps/corepack/**
69+
- deps/googletest/**
70+
- deps/histogram/**
6771
- deps/icu-small/**
6872
- deps/icu-tmp/**
6973
- deps/llhttp/**

BUILDING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ Binaries at <https://nodejs.org/download/release/> are produced on:
178178
Starting with Node.js 25, official Linux binaries are linked with `libatomic` and these systems
179179
must have the `libatomic` runtime installed and available at execution time to run the binaries.
180180
The package name for the `libatomic` runtime is typically `libatomic` or `libatomic1` depending
181-
on your Linux distibution.
181+
on your Linux distribution.
182182

183183
<!--lint disable final-definition-->
184184

@@ -635,7 +635,7 @@ on Linux, you can try [Docker](https://www.docker.com/products/docker-desktop/)
635635
(using an image like `gengjiawen/node-build:2020-02-14`).
636636

637637
The `--debug` is not necessary and will slow down build and testing, but it can
638-
show clear stacktrace if ASan hits an issue.
638+
show a clear stack trace if ASan hits an issue.
639639

640640
```bash
641641
./configure --debug --enable-asan && make -j4
@@ -713,8 +713,8 @@ the number of parallel build tasks (`-j<n>`).
713713

714714
#### Tips
715715

716-
You may need disable vcpkg integration if you got link error about symbol
717-
redefine related to zlib.lib(zlib1.dll), even you never install it by hand,
716+
You may need to disable vcpkg integration if you encounter a link error about symbol
717+
redefinition related to zlib.lib(zlib1.dll), even if you never installed it by hand,
718718
as vcpkg is part of CLion and Visual Studio now.
719719

720720
```powershell
@@ -889,7 +889,7 @@ cp c:\ccache\ccache.exe c:\ccache\cl.exe
889889
```
890890

891891
With newer version of Visual Studio, it may need the copy to be `clang-cl.exe`
892-
instead. If the output of `vcbuild.bat` suggestion missing `clang-cl.exe`, copy
892+
instead. If the output of `vcbuild.bat` suggests missing `clang-cl.exe`, copy
893893
it differently:
894894

895895
```powershell
@@ -1052,7 +1052,7 @@ configure option:
10521052
## Building Node.js with Temporal support
10531053

10541054
Node.js supports the [Temporal](https://github.com/tc39/proposal-temporal) APIs, when
1055-
linking statically or dynamically with a version [temporal\_rs](https://github.com/boa-dev/temporal).
1055+
linking statically or dynamically with a version of [temporal\_rs](https://github.com/boa-dev/temporal).
10561056

10571057
To build Node.js with Temporal support, a Rust toolchain is required:
10581058

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,8 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
12371237
$(RM) -r $(TARNAME)/deps/brotli
12381238
$(RM) -r $(TARNAME)/deps/cares
12391239
$(RM) -r $(TARNAME)/deps/crates
1240+
$(RM) -r $(TARNAME)/deps/googletest
1241+
$(RM) -r $(TARNAME)/deps/histogram
12401242
$(RM) -r $(TARNAME)/deps/icu-small
12411243
$(RM) -r $(TARNAME)/deps/icu-tmp
12421244
$(RM) -r $(TARNAME)/deps/llhttp

configure.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,50 @@
263263
help='Use the specified path to system CA (PEM format) in addition to '
264264
'the OpenSSL supplied CA store or compiled-in Mozilla CA copy.')
265265

266+
shared_optgroup.add_argument('--shared-gtest',
267+
action='store_true',
268+
dest='shared_gtest',
269+
default=None,
270+
help='link to a shared googletest DLL instead of static linking')
271+
272+
shared_optgroup.add_argument('--shared-gtest-includes',
273+
action='store',
274+
dest='shared_gtest_includes',
275+
help='directory containing googletest header files')
276+
277+
shared_optgroup.add_argument('--shared-gtest-libname',
278+
action='store',
279+
dest='shared_gtest_libname',
280+
default='gtest',
281+
help='alternative lib name to link to [default: %(default)s]')
282+
283+
shared_optgroup.add_argument('--shared-gtest-libpath',
284+
action='store',
285+
dest='shared_gtest_libpath',
286+
help='a directory to search for the shared googletest DLL')
287+
288+
shared_optgroup.add_argument('--shared-hdr-histogram',
289+
action='store_true',
290+
dest='shared_hdr_histogram',
291+
default=None,
292+
help='link to a shared HdrHistogram DLL instead of static linking')
293+
294+
shared_optgroup.add_argument('--shared-hdr-histogram-includes',
295+
action='store',
296+
dest='shared_hdr_histogram_includes',
297+
help='directory containing HdrHistogram header files')
298+
299+
shared_optgroup.add_argument('--shared-hdr-histogram-libname',
300+
action='store',
301+
dest='shared_hdr_histogram_libname',
302+
default='hdr_histogram',
303+
help='alternative lib name to link to [default: %(default)s]')
304+
305+
shared_optgroup.add_argument('--shared-hdr-histogram-libpath',
306+
action='store',
307+
dest='shared_hdr_histogram_libpath',
308+
help='a directory to search for the shared HdrHistogram DLL')
309+
266310
parser.add_argument('--experimental-http-parser',
267311
action='store_true',
268312
dest='experimental_http_parser',
@@ -2409,6 +2453,8 @@ def make_bin_override():
24092453
configure_library('simdutf', output)
24102454
configure_library('brotli', output, pkgname=['libbrotlidec', 'libbrotlienc'])
24112455
configure_library('cares', output, pkgname='libcares')
2456+
configure_library('gtest', output)
2457+
configure_library('hdr_histogram', output)
24122458
configure_library('nghttp2', output, pkgname='libnghttp2')
24132459
configure_library('nghttp3', output, pkgname='libnghttp3')
24142460
configure_library('ngtcp2', output, pkgname='libngtcp2')

deps/cjs-module-lexer/dist/lexer.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps/cjs-module-lexer/dist/lexer.mjs

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

deps/cjs-module-lexer/lexer.js

Lines changed: 163 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function parseCJS (source, name = '@') {
5555
function decode (str) {
5656
if (str[0] === '"' || str[0] === '\'') {
5757
try {
58-
const decoded = (0, eval)(str);
58+
const decoded = scanStringLiteral(str);
5959
// Filter to exclude non-matching UTF-16 surrogate strings
6060
for (let i = 0; i < decoded.length; i++) {
6161
const surrogatePrefix = decoded.charCodeAt(i) & 0xFC00;
@@ -1027,6 +1027,168 @@ function tryParseLiteralExports () {
10271027
}
10281028
}
10291029

1030+
// This function and it's callees are duplicated in src/lexer.js
1031+
function scanStringLiteral (source) {
1032+
const quote = source[0];
1033+
1034+
// try JSON.parse first for performance
1035+
if (quote === '"') {
1036+
try {
1037+
return JSON.parse(source);
1038+
} catch {
1039+
// ignored
1040+
}
1041+
} else if (quote === "'" && source.length > 1 && source[source.length - 1] === "'" && source.indexOf('"') === -1) {
1042+
try {
1043+
return JSON.parse('"' + source.slice(1, -1) + '"');
1044+
} catch {
1045+
// ignored
1046+
}
1047+
}
1048+
1049+
// fall back to doing it the hard way
1050+
let parsed = '';
1051+
let index = { v: 1 };
1052+
1053+
while (index.v < source.length) {
1054+
const char = source[index.v];
1055+
switch (char) {
1056+
case quote: {
1057+
return parsed;
1058+
}
1059+
case '\\': {
1060+
++index.v;
1061+
parsed += scanEscapeSequence(source, index);
1062+
break;
1063+
}
1064+
case '\r':
1065+
case '\n': {
1066+
throw new SyntaxError();
1067+
}
1068+
default: {
1069+
++index.v;
1070+
parsed += char;
1071+
}
1072+
}
1073+
}
1074+
1075+
throw new SyntaxError();
1076+
}
1077+
1078+
function scanEscapeSequence (source, index) {
1079+
if (index.v === source.length) {
1080+
throw new SyntaxError();
1081+
}
1082+
const char = source[index.v];
1083+
++index.v;
1084+
switch (char) {
1085+
case '\r': {
1086+
if (source[index.v] === '\n') {
1087+
++index.v;
1088+
}
1089+
// fall through
1090+
}
1091+
case '\n':
1092+
case '\u2028':
1093+
case '\u2029': {
1094+
return '';
1095+
}
1096+
case 'r': {
1097+
return '\r';
1098+
}
1099+
case 'n': {
1100+
return '\n';
1101+
}
1102+
case 't': {
1103+
return '\t';
1104+
}
1105+
case 'b': {
1106+
return '\b';
1107+
}
1108+
case 'f': {
1109+
return '\f';
1110+
}
1111+
case 'v': {
1112+
return '\v';
1113+
}
1114+
case 'x': {
1115+
return scanHexEscapeSequence(source, index);
1116+
}
1117+
case 'u': {
1118+
return scanUnicodeEscapeSequence(source, index);
1119+
}
1120+
case '0':
1121+
case '1':
1122+
case '2':
1123+
case '3':
1124+
case '4':
1125+
case '5':
1126+
case '6':
1127+
case '7': {
1128+
return scanOctalEscapeSequence(char, source, index);
1129+
}
1130+
default: {
1131+
return char;
1132+
}
1133+
}
1134+
}
1135+
1136+
function scanHexEscapeSequence (source, index) {
1137+
const a = readHex(source[index.v]);
1138+
++index.v;
1139+
const b = readHex(source[index.v]);
1140+
++index.v;
1141+
return String.fromCodePoint(a * 16 + b);
1142+
}
1143+
1144+
function scanUnicodeEscapeSequence (source, index) {
1145+
let result = 0;
1146+
if (source[index.v] === '{') {
1147+
++index.v;
1148+
do {
1149+
result = result * 16 + readHex(source[index.v]);
1150+
if (result > 0x10FFFF) {
1151+
throw new SyntaxError();
1152+
}
1153+
++index.v;
1154+
} while (source[index.v] !== '}');
1155+
++index.v;
1156+
} else {
1157+
for (let i = 0; i < 4; ++i) {
1158+
result = result * 16 + readHex(source[index.v]);
1159+
++index.v;
1160+
}
1161+
}
1162+
return String.fromCodePoint(result);
1163+
}
1164+
1165+
function scanOctalEscapeSequence (char, source, index) {
1166+
let toRead = char <= '3' ? 2 : 1;
1167+
let result = +char;
1168+
do {
1169+
char = source[index.v];
1170+
if (char < '0' || char > '7') {
1171+
break;
1172+
}
1173+
result = result * 8 + (+char);
1174+
++index.v;
1175+
--toRead;
1176+
} while (toRead > 0);
1177+
return String.fromCodePoint(result);
1178+
}
1179+
1180+
function readHex (char) {
1181+
if (char >= '0' && char <= '9') {
1182+
return +char;
1183+
} else if (char >= 'a' && char <= 'f') {
1184+
return char.charCodeAt(0) - 87;
1185+
} else if (char >= 'A' && char <= 'F') {
1186+
return char.charCodeAt(0) - 55;
1187+
}
1188+
throw new SyntaxError();
1189+
}
1190+
1191+
10301192
// --- Extracted from AcornJS ---
10311193
//(https://github.com/acornjs/acorn/blob/master/acorn/src/identifier.js#L23
10321194
//

0 commit comments

Comments
 (0)