Skip to content

Commit

Permalink
Merge branch 'main' into kevinuehara/adding-typescript-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinuehara authored Sep 19, 2024
2 parents 91361fa + bb40521 commit ccfa065
Show file tree
Hide file tree
Showing 275 changed files with 8,523 additions and 4,645 deletions.
8 changes: 7 additions & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
blank_issues_enabled: true
contact_links:
- name: ⁉️ Need help with Node.js?
- name: ⁉️ Need general help with Node.js?
url: https://github.com/nodejs/help
about: Please file an issue in our help repo.
- name: 📦 Have an issue with npm?
url: https://github.com/npm/cli/issues
about: npm has a seperate issue tracker.
- name: 📡 Have an issue with undici? (`WebSocket`, `fetch`, etc.)
url: https://github.com/nodejs/undici/issues
about: Undici has a seperate issue tracker.
- name: 🌐 Found a problem with nodejs.org beyond the API reference docs?
url: https://github.com/nodejs/nodejs.org/issues/new/choose
about: Please file an issue in the Node.js website repo.
53 changes: 0 additions & 53 deletions .github/workflows/build-windows.yml

This file was deleted.

25 changes: 14 additions & 11 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ For use of AVX2,
* llvm version 3.3 or higher
* nasm version 2.10 or higher in Windows

Please refer to
<https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html> for details.
Please refer to <https://docs.openssl.org/1.1.1/man3/OPENSSL_ia32cap/> for details.

If compiling without one of the above, use `configure` with the
`--openssl-no-asm` flag. Otherwise, `configure` will fail.
Expand Down Expand Up @@ -525,7 +524,7 @@ $ gdb /opt/node-debug/node core.node.8.1535359906
[ASan](https://github.com/google/sanitizers) can help detect various memory
related bugs. ASan builds are currently only supported on linux.
If you want to check it on Windows or macOS or you want a consistent toolchain
on Linux, you can try [Docker](https://www.docker.com/products/docker-desktop)
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
Expand Down Expand Up @@ -618,7 +617,11 @@ vcpkg owns zlib1.dll
vcpkg integrate remove
```

Refs: #24448, <https://github.com/microsoft/vcpkg/issues/37518>, [vcpkg](https://github.com/microsoft/vcpkg/)
Refs:

1. <https://github.com/nodejs/node/issues/24448>
2. <https://github.com/microsoft/vcpkg/issues/37518> / <https://github.com/microsoft/vcpkg/discussions/37546>
3. [vcpkg](https://github.com/microsoft/vcpkg/)

#### Windows Prerequisites

Expand Down Expand Up @@ -677,9 +680,9 @@ packages:
* [NetWide Assembler](https://chocolatey.org/packages/nasm)

To install Node.js prerequisites using
[Boxstarter WebLauncher](https://boxstarter.org/weblauncher), open
[Boxstarter WebLauncher](https://boxstarter.org/weblauncher), visit
<https://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/HEAD/tools/bootstrap/windows_boxstarter>
with Edge browser on the target machine.
with a supported browser.

Alternatively, you can use PowerShell. Run those commands from
an elevated (Administrator) PowerShell terminal:
Expand Down Expand Up @@ -754,7 +757,7 @@ architecture supports \[arm, arm64/aarch64, x86, x86\_64].

## `Intl` (ECMA-402) support

[Intl](https://github.com/nodejs/node/blob/HEAD/doc/api/intl.md) support is
[Intl](doc/api/intl.md) support is
enabled by default.

### Build with full ICU support (all locales supported by ICU)
Expand Down Expand Up @@ -820,7 +823,7 @@ that works for both your host and target environments.
### Build with a specific ICU

You can find other ICU releases at
[the ICU homepage](http://site.icu-project.org/download).
[the ICU homepage](https://icu.unicode.org/download).
Download the file named something like `icu4c-**##.#**-src.tgz` (or
`.zip`).

Expand Down Expand Up @@ -851,7 +854,7 @@ From a tarball URL:
#### Windows

First unpack latest ICU to `deps/icu`
[icu4c-**##.#**-src.tgz](http://site.icu-project.org/download) (or `.zip`)
[icu4c-**##.#**-src.tgz](https://icu.unicode.org/download) (or `.zip`)
as `deps/icu` (You'll have: `deps/icu/source/...`)

```powershell
Expand All @@ -874,10 +877,10 @@ configure option:
## Building Node.js with FIPS-compliant OpenSSL

Node.js supports FIPS when statically or dynamically linked with OpenSSL 3 via
[OpenSSL's provider model](https://www.openssl.org/docs/man3.0/man7/crypto.html#OPENSSL-PROVIDERS).
[OpenSSL's provider model](https://docs.openssl.org/3.0/man7/crypto/#OPENSSL-PROVIDERS).
It is not necessary to rebuild Node.js to enable support for FIPS.

See [FIPS mode](./doc/api/crypto.md#fips-mode) for more information on how to
See [FIPS mode](doc/api/crypto.md#fips-mode) for more information on how to
enable FIPS support in Node.js.

## Building Node.js with external core modules
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V22.md#22.8.0">22.8.0</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V22.md#22.9.0">22.9.0</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V22.md#22.8.0">22.8.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V22.md#22.7.0">22.7.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V22.md#22.6.0">22.6.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V22.md#22.5.1">22.5.1</a><br/>
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ lint-py-build:
ifneq ("","$(wildcard tools/pip/site-packages/ruff)")
# Lint the Python code with ruff.
lint-py:
tools/pip/site-packages/bin/ruff --version
$(info Running Python linter...)
tools/pip/site-packages/bin/ruff check .
else
lint-py:
Expand All @@ -1563,6 +1563,7 @@ lint-yaml-build:
# Lints the YAML files with yamllint.
lint-yaml:
@if [ -d "tools/pip/site-packages/yamllint" ]; then \
$(info Running YAML linter...) \
PYTHONPATH=tools/pip $(PYTHON) -m yamllint .; \
else \
echo 'YAML linting with yamllint is not available'; \
Expand Down
67 changes: 67 additions & 0 deletions benchmark/fixtures/valid.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
BASIC=basic

# COMMENTS=work
#BASIC=basic2
#BASIC=basic3

# previous line intentionally left blank
AFTER_LINE=after_line
EMPTY=
EMPTY_SINGLE_QUOTES=''
EMPTY_DOUBLE_QUOTES=""
EMPTY_BACKTICKS=``
SINGLE_QUOTES='single_quotes'
SINGLE_QUOTES_SPACED=' single quotes '
DOUBLE_QUOTES="double_quotes"
DOUBLE_QUOTES_SPACED=" double quotes "
DOUBLE_QUOTES_INSIDE_SINGLE='double "quotes" work inside single quotes'
DOUBLE_QUOTES_WITH_NO_SPACE_BRACKET="{ port: $MONGOLAB_PORT}"
SINGLE_QUOTES_INSIDE_DOUBLE="single 'quotes' work inside double quotes"
BACKTICKS_INSIDE_SINGLE='`backticks` work inside single quotes'
BACKTICKS_INSIDE_DOUBLE="`backticks` work inside double quotes"
BACKTICKS=`backticks`
BACKTICKS_SPACED=` backticks `
DOUBLE_QUOTES_INSIDE_BACKTICKS=`double "quotes" work inside backticks`
SINGLE_QUOTES_INSIDE_BACKTICKS=`single 'quotes' work inside backticks`
DOUBLE_AND_SINGLE_QUOTES_INSIDE_BACKTICKS=`double "quotes" and single 'quotes' work inside backticks`
EXPAND_NEWLINES="expand\nnew\nlines"
DONT_EXPAND_UNQUOTED=dontexpand\nnewlines
DONT_EXPAND_SQUOTED='dontexpand\nnewlines'
# COMMENTS=work
INLINE_COMMENTS=inline comments # work #very #well
INLINE_COMMENTS_SINGLE_QUOTES='inline comments outside of #singlequotes' # work
INLINE_COMMENTS_DOUBLE_QUOTES="inline comments outside of #doublequotes" # work
INLINE_COMMENTS_BACKTICKS=`inline comments outside of #backticks` # work
INLINE_COMMENTS_SPACE=inline comments start with a#number sign. no space required.
EQUAL_SIGNS=equals==
RETAIN_INNER_QUOTES={"foo": "bar"}
RETAIN_INNER_QUOTES_AS_STRING='{"foo": "bar"}'
RETAIN_INNER_QUOTES_AS_BACKTICKS=`{"foo": "bar's"}`
TRIM_SPACE_FROM_UNQUOTED= some spaced out string
SPACE_BEFORE_DOUBLE_QUOTES= "space before double quotes"
EMAIL=therealnerdybeast@example.tld
SPACED_KEY = parsed
EDGE_CASE_INLINE_COMMENTS="VALUE1" # or "VALUE2" or "VALUE3"

MULTI_DOUBLE_QUOTED="THIS
IS
A
MULTILINE
STRING"

MULTI_SINGLE_QUOTED='THIS
IS
A
MULTILINE
STRING'

MULTI_BACKTICKED=`THIS
IS
A
"MULTILINE'S"
STRING`
export EXPORT_EXAMPLE = ignore export

MULTI_NOT_VALID_QUOTE="
MULTI_NOT_VALID=THIS
IS NOT MULTILINE
2 changes: 1 addition & 1 deletion benchmark/module/module-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, {
files: [5e2],
n: [1, 1e3],
cache: ['true', 'false'],
});
}, { flags: '--no-warnings' });

function main({ n, name, cache, files, dir }) {
tmpdir.refresh();
Expand Down
1 change: 1 addition & 0 deletions benchmark/napi/buffer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
85 changes: 85 additions & 0 deletions benchmark/napi/buffer/binding.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#include <node_api.h>
#include <stdio.h>
#include <stdlib.h>

#define NODE_API_CALL(call) \
do { \
napi_status status = call; \
if (status != napi_ok) { \
fprintf(stderr, #call " failed: %d\n", status); \
abort(); \
} \
} while (0)

#define ABORT_IF_FALSE(condition) \
if (!(condition)) { \
fprintf(stderr, #condition " failed\n"); \
abort(); \
}

static void Finalize(node_api_basic_env env, void* data, void* hint) {
delete[] static_cast<uint8_t*>(data);
}

static napi_value CreateExternalBuffer(napi_env env, napi_callback_info info) {
napi_value argv[2], undefined, start, end;
size_t argc = 2;
int32_t n = 0;
napi_valuetype val_type = napi_undefined;

// Validate params and retrieve start and end function.
NODE_API_CALL(napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr));
ABORT_IF_FALSE(argc == 2);
NODE_API_CALL(napi_typeof(env, argv[0], &val_type));
ABORT_IF_FALSE(val_type == napi_object);
NODE_API_CALL(napi_typeof(env, argv[1], &val_type));
ABORT_IF_FALSE(val_type == napi_number);
NODE_API_CALL(napi_get_named_property(env, argv[0], "start", &start));
NODE_API_CALL(napi_typeof(env, start, &val_type));
ABORT_IF_FALSE(val_type == napi_function);
NODE_API_CALL(napi_get_named_property(env, argv[0], "end", &end));
NODE_API_CALL(napi_typeof(env, end, &val_type));
ABORT_IF_FALSE(val_type == napi_function);
NODE_API_CALL(napi_get_value_int32(env, argv[1], &n));

NODE_API_CALL(napi_get_undefined(env, &undefined));

constexpr uint32_t kBufferLen = 32;

// Start the benchmark.
napi_call_function(env, argv[0], start, 0, nullptr, nullptr);

for (int32_t idx = 0; idx < n; idx++) {
napi_handle_scope scope;
uint8_t* buffer = new uint8_t[kBufferLen];
napi_value jsbuffer;
NODE_API_CALL(napi_open_handle_scope(env, &scope));
NODE_API_CALL(napi_create_external_buffer(
env, kBufferLen, buffer, Finalize, nullptr, &jsbuffer));
NODE_API_CALL(napi_close_handle_scope(env, scope));
}

// Conclude the benchmark.
napi_value end_argv[] = {argv[1]};
NODE_API_CALL(napi_call_function(env, argv[0], end, 1, end_argv, nullptr));

return undefined;
}

NAPI_MODULE_INIT() {
napi_property_descriptor props[] = {
{"createExternalBuffer",
nullptr,
CreateExternalBuffer,
nullptr,
nullptr,
nullptr,
static_cast<napi_property_attributes>(napi_writable | napi_configurable |
napi_enumerable),
nullptr},
};

NODE_API_CALL(napi_define_properties(
env, exports, sizeof(props) / sizeof(*props), props));
return exports;
}
18 changes: 18 additions & 0 deletions benchmark/napi/buffer/binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
'targets': [
{
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'defines': [
'NAPI_EXPERIMENTAL'
]
},
{
'target_name': 'binding_node_api_v8',
'sources': [ 'binding.cc' ],
'defines': [
'NAPI_VERSION=8'
]
}
]
}
14 changes: 14 additions & 0 deletions benchmark/napi/buffer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

const common = require('../../common.js');

const bench = common.createBenchmark(main, {
n: [5e6],
addon: ['binding', 'binding_node_api_v8'],
implem: ['createExternalBuffer'],
});

function main({ n, implem, addon }) {
const binding = require(`./build/${common.buildType}/${addon}`);
binding[implem](bench, n);
}
Loading

0 comments on commit ccfa065

Please sign in to comment.