Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/test-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ on:
- deps/cares/**
- deps/crates/**
- deps/corepack/**
- deps/googletest/**
- deps/histogram/**
- deps/icu-small/**
- deps/icu-tmp/**
- deps/llhttp/**
Expand Down Expand Up @@ -64,6 +66,8 @@ on:
- deps/cares/**
- deps/crates/**
- deps/corepack/**
- deps/googletest/**
- deps/histogram/**
- deps/icu-small/**
- deps/icu-tmp/**
- deps/llhttp/**
Expand Down
12 changes: 6 additions & 6 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Binaries at <https://nodejs.org/download/release/> are produced on:
Starting with Node.js 25, official Linux binaries are linked with `libatomic` and these systems
must have the `libatomic` runtime installed and available at execution time to run the binaries.
The package name for the `libatomic` runtime is typically `libatomic` or `libatomic1` depending
on your Linux distibution.
on your Linux distribution.

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

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

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

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

#### Tips

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

```powershell
Expand Down Expand Up @@ -889,7 +889,7 @@ cp c:\ccache\ccache.exe c:\ccache\cl.exe
```

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

```powershell
Expand Down Expand Up @@ -1052,7 +1052,7 @@ configure option:
## Building Node.js with Temporal support

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

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

Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,8 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
$(RM) -r $(TARNAME)/deps/brotli
$(RM) -r $(TARNAME)/deps/cares
$(RM) -r $(TARNAME)/deps/crates
$(RM) -r $(TARNAME)/deps/googletest
$(RM) -r $(TARNAME)/deps/histogram
$(RM) -r $(TARNAME)/deps/icu-small
$(RM) -r $(TARNAME)/deps/icu-tmp
$(RM) -r $(TARNAME)/deps/llhttp
Expand Down
46 changes: 46 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,50 @@
help='Use the specified path to system CA (PEM format) in addition to '
'the OpenSSL supplied CA store or compiled-in Mozilla CA copy.')

shared_optgroup.add_argument('--shared-gtest',
action='store_true',
dest='shared_gtest',
default=None,
help='link to a shared googletest DLL instead of static linking')

shared_optgroup.add_argument('--shared-gtest-includes',
action='store',
dest='shared_gtest_includes',
help='directory containing googletest header files')

shared_optgroup.add_argument('--shared-gtest-libname',
action='store',
dest='shared_gtest_libname',
default='gtest',
help='alternative lib name to link to [default: %(default)s]')

shared_optgroup.add_argument('--shared-gtest-libpath',
action='store',
dest='shared_gtest_libpath',
help='a directory to search for the shared googletest DLL')

shared_optgroup.add_argument('--shared-hdr-histogram',
action='store_true',
dest='shared_hdr_histogram',
default=None,
help='link to a shared HdrHistogram DLL instead of static linking')

shared_optgroup.add_argument('--shared-hdr-histogram-includes',
action='store',
dest='shared_hdr_histogram_includes',
help='directory containing HdrHistogram header files')

shared_optgroup.add_argument('--shared-hdr-histogram-libname',
action='store',
dest='shared_hdr_histogram_libname',
default='hdr_histogram',
help='alternative lib name to link to [default: %(default)s]')

shared_optgroup.add_argument('--shared-hdr-histogram-libpath',
action='store',
dest='shared_hdr_histogram_libpath',
help='a directory to search for the shared HdrHistogram DLL')

parser.add_argument('--experimental-http-parser',
action='store_true',
dest='experimental_http_parser',
Expand Down Expand Up @@ -2409,6 +2453,8 @@ def make_bin_override():
configure_library('simdutf', output)
configure_library('brotli', output, pkgname=['libbrotlidec', 'libbrotlienc'])
configure_library('cares', output, pkgname='libcares')
configure_library('gtest', output)
configure_library('hdr_histogram', output)
configure_library('nghttp2', output, pkgname='libnghttp2')
configure_library('nghttp3', output, pkgname='libnghttp3')
configure_library('ngtcp2', output, pkgname='libngtcp2')
Expand Down
2 changes: 1 addition & 1 deletion deps/cjs-module-lexer/dist/lexer.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/cjs-module-lexer/dist/lexer.mjs

Large diffs are not rendered by default.

164 changes: 163 additions & 1 deletion deps/cjs-module-lexer/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function parseCJS (source, name = '@') {
function decode (str) {
if (str[0] === '"' || str[0] === '\'') {
try {
const decoded = (0, eval)(str);
const decoded = scanStringLiteral(str);
// Filter to exclude non-matching UTF-16 surrogate strings
for (let i = 0; i < decoded.length; i++) {
const surrogatePrefix = decoded.charCodeAt(i) & 0xFC00;
Expand Down Expand Up @@ -1027,6 +1027,168 @@ function tryParseLiteralExports () {
}
}

// This function and it's callees are duplicated in src/lexer.js
function scanStringLiteral (source) {
const quote = source[0];

// try JSON.parse first for performance
if (quote === '"') {
try {
return JSON.parse(source);
} catch {
// ignored
}
} else if (quote === "'" && source.length > 1 && source[source.length - 1] === "'" && source.indexOf('"') === -1) {
try {
return JSON.parse('"' + source.slice(1, -1) + '"');
} catch {
// ignored
}
}

// fall back to doing it the hard way
let parsed = '';
let index = { v: 1 };

while (index.v < source.length) {
const char = source[index.v];
switch (char) {
case quote: {
return parsed;
}
case '\\': {
++index.v;
parsed += scanEscapeSequence(source, index);
break;
}
case '\r':
case '\n': {
throw new SyntaxError();
}
default: {
++index.v;
parsed += char;
}
}
}

throw new SyntaxError();
}

function scanEscapeSequence (source, index) {
if (index.v === source.length) {
throw new SyntaxError();
}
const char = source[index.v];
++index.v;
switch (char) {
case '\r': {
if (source[index.v] === '\n') {
++index.v;
}
// fall through
}
case '\n':
case '\u2028':
case '\u2029': {
return '';
}
case 'r': {
return '\r';
}
case 'n': {
return '\n';
}
case 't': {
return '\t';
}
case 'b': {
return '\b';
}
case 'f': {
return '\f';
}
case 'v': {
return '\v';
}
case 'x': {
return scanHexEscapeSequence(source, index);
}
case 'u': {
return scanUnicodeEscapeSequence(source, index);
}
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7': {
return scanOctalEscapeSequence(char, source, index);
}
default: {
return char;
}
}
}

function scanHexEscapeSequence (source, index) {
const a = readHex(source[index.v]);
++index.v;
const b = readHex(source[index.v]);
++index.v;
return String.fromCodePoint(a * 16 + b);
}

function scanUnicodeEscapeSequence (source, index) {
let result = 0;
if (source[index.v] === '{') {
++index.v;
do {
result = result * 16 + readHex(source[index.v]);
if (result > 0x10FFFF) {
throw new SyntaxError();
}
++index.v;
} while (source[index.v] !== '}');
++index.v;
} else {
for (let i = 0; i < 4; ++i) {
result = result * 16 + readHex(source[index.v]);
++index.v;
}
}
return String.fromCodePoint(result);
}

function scanOctalEscapeSequence (char, source, index) {
let toRead = char <= '3' ? 2 : 1;
let result = +char;
do {
char = source[index.v];
if (char < '0' || char > '7') {
break;
}
result = result * 8 + (+char);
++index.v;
--toRead;
} while (toRead > 0);
return String.fromCodePoint(result);
}

function readHex (char) {
if (char >= '0' && char <= '9') {
return +char;
} else if (char >= 'a' && char <= 'f') {
return char.charCodeAt(0) - 87;
} else if (char >= 'A' && char <= 'F') {
return char.charCodeAt(0) - 55;
}
throw new SyntaxError();
}


// --- Extracted from AcornJS ---
//(https://github.com/acornjs/acorn/blob/master/acorn/src/identifier.js#L23
//
Expand Down
Loading
Loading