Skip to content

fs: add support for async iterators to fs.writeFile #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
df3465a
test: move test-net-connect-econnrefused from pummel to sequential
Trott Apr 29, 2021
f71166b
doc: use sentence case in headers in src/crypto/README.md
Trott May 3, 2021
671c289
2021-05-04, Version 16.1.0 (Current)
targos May 3, 2021
9df904b
doc: corrected workload name as per the latest VS Installer
MrJithil May 1, 2021
3219309
doc: remove extraneous dash from flag prefix
rhcarvalho May 4, 2021
f9d6de4
build: compile with -std=gnu++14
RaisinTen May 2, 2021
b034151
tools: make GH Actions workflows work if default branch is not master
aduh95 May 3, 2021
3a6116d
test: run message and pseudo-tty tests in parallel
richardlau May 1, 2021
431d375
doc: use AIX instead of Aix in fs.md
Trott May 4, 2021
e8eb6ac
doc: fix broken AHAFS link in fs doc
Trott May 4, 2021
46d83b3
typings: add JSDoc typings for readline
VoltrexKeyva Apr 15, 2021
9643128
doc: clarify DiffieHellmanGroup class docs
Linkgoron Apr 22, 2021
7abc7e4
node-api: faster threadsafe_function
indutny May 1, 2021
d5c7345
test: increase coverage for Blob
Lxxyx May 3, 2021
7d74487
test: increase coverage for AbortController
Lxxyx May 3, 2021
efd70f4
test: complete coverage of querystring
pd4d10 May 3, 2021
26e318a
doc: use `HEAD` instead of `master` for links
aduh95 May 3, 2021
aed17e9
doc: fix code example in ecdh.setPublicKey()
JBaczuk May 4, 2021
67ea715
test: update OpenSSL 3.0.0-alpha15 error messages
danbev Apr 28, 2021
2ff93c8
test: skip tests for openssl-3.0.0-alpha15
danbev Apr 28, 2021
c6dc931
lib: make `IterableWeakMap` safe to iterate
aduh95 May 3, 2021
bed947b
debugger: rename inspector-cli test module to debugger
Trott May 4, 2021
b373a2c
Revert "worker: remove `ERR_CLOSED_MESSAGE_PORT`"
juanarbol May 3, 2021
75073ab
src: make workers messaging more resilient
juanarbol May 3, 2021
d5f0c83
debugger: wrap lines longer than 80 chars
Trott May 4, 2021
c42849f
debugger: avoid non-ASCII char in code file
Trott May 4, 2021
7eb28e3
debugger: disable only the lint rules required by current file state
Trott May 4, 2021
8231cc4
fs: use `assert` in `fsCall` argument checking
pd4d10 May 3, 2021
2465062
test: improve fs coverage
pd4d10 May 3, 2021
50dd62e
deps: V8: backport c0fceaa0669b
Apr 21, 2021
774874d
deps: V8: cherry-pick 272445f10927
Apr 22, 2021
53f86d5
deps: V8: cherry-pick 5f4413194480
Apr 27, 2021
0415798
deps: V8: cherry-pick 4c074516397b
Apr 29, 2021
c8e4020
deps: V8: cherry-pick fa4cb172cde2
May 3, 2021
f37c26b
async_hooks: use new v8::Context PromiseHook API
Qard Dec 4, 2020
9158d61
debugger: refactor to use internal modules
aduh95 May 5, 2021
fdcf45a
doc: typo stats() should be stat(); clarity
700software May 4, 2021
434b369
test: increase coverage for Histogram
Lxxyx May 5, 2021
464535b
deps: patch V8 to 9.0.257.25
targos May 5, 2021
df8af88
buffer: remove unreachable code
pd4d10 May 4, 2021
184e0f7
build: add missing torque output sources
richardlau May 6, 2021
29f1b60
test: call functions internally
VoltrexKeyva May 5, 2021
52e4fb5
meta: add v8 team
gengjiawen May 6, 2021
785d76d
fs: add support for async iterators to `fs.writeFile`
May 3, 2021
6f21783
fixup! fs: add support for async iterators to fs.writeFile
May 9, 2021
c0b87d6
fixup! fixup! fs: add support for async iterators to `fs.writeFile`
May 14, 2021
05a5728
fixup! fixup! fixup! fs: add support for async iterators to `fs.write…
May 17, 2021
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/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,7 @@
/lib/internal/bootstrap/* @nodejs/startup
/tools/code_cache/* @nodejs/startup
/tools/snapshot/* @nodejs/startup

# V8
/deps/v8/* @nodejs/v8-update
/tools/v8_gypfiles/* @nodejs/v8-update
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!--
Before submitting a pull request, please read
https://github.com/nodejs/node/blob/master/CONTRIBUTING.md.
https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md.
Commit message formatting guidelines:
https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines
https://github.com/nodejs/node/blob/HEAD/doc/guides/contributing/pull-requests.md#commit-message-guidelines
For code changes:
1. Include tests for any bug fixes or new features.
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- main
- v[0-9]+.x-staging
- v[0-9]+.x

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
- v[0-9]+.x
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/commit-queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
# See https://github.com/nodejs/node-core-utils/pull/486
fetch-depth: 0
# A personal token is required because pushing with GITHUB_TOKEN will
# prevent commits from running CI after they land on master. It needs
# prevent commits from running CI after they land. It needs
# to be set here because `checkout` configures GitHub authentication
# for push as well.
token: ${{ secrets.GH_USER_TOKEN }}
Expand Down Expand Up @@ -63,15 +63,13 @@ jobs:
owner: ${{ env.OWNER }}
repo: ${{ env.REPOSITORY }}
# Commit queue is only enabled for the default branch on the repository
# TODO(mmarchini): get the default branch programmatically instead of
# assuming `master`
base_ref: "master"
base_ref: ${{ github.repository.default_branch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Configure node-core-utils
run: |
ncu-config set branch master
ncu-config set branch ${{ github.repository.default_branch }}
ncu-config set upstream origin
ncu-config set username "${{ secrets.GH_USER_NAME }}"
ncu-config set token "${{ secrets.GH_USER_TOKEN }}"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/coverage-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
push:
branches:
- master
- main
paths-ignore:
- 'doc/**'
- 'deps/**'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/coverage-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
push:
branches:
- master
- main
paths-ignore:
- 'doc/**'
- 'deps/**'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- main
- v[0-9]+.x-staging
- v[0-9]+.x

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- main
- v[0-9]+.x-staging
- v[0-9]+.x

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/notify-force-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ on:
push:
branches:
- master
- main

name: Notify on Force Push
jobs:
Expand All @@ -17,7 +18,7 @@ jobs:
SLACK_ICON: https://github.com/nodejs.png?size=48
SLACK_TITLE: '${{ github.actor }} force-pushed to ${{ github.ref }}'
SLACK_MESSAGE: |
A commit was force-pushed to <https://github.com/${{ github.repository }}/tree/master|${{ github.repository }}@master> by <https://github.com/${{ github.actor }}|${{ github.actor }}>
A commit was force-pushed to <https://github.com/${{ github.repository }}/tree/${{ github.repository.default_branch }}|${{ github.repository }}@${{ github.repository.default_branch }}> by <https://github.com/${{ github.actor }}|${{ github.actor }}>
Before: <https://github.com/${{ github.repository }}/commit/${{ github.event.before }}|${{ github.event.before }}>
After: <https://github.com/${{ github.repository }}/commit/${{ github.event.after }}|${{ github.event.after }}>
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
- v[0-9]+.x
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
- v[0-9]+.x
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
- v[0-9]+.x
Expand Down
6 changes: 3 additions & 3 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ to run it again before invoking `make -j4`.
* [Python 3.9](https://www.microsoft.com/en-us/p/python-39/9p7qfqmjrfp7)
* The "Desktop development with C++" workload from
[Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) or
the "Visual C++ build tools" workload from the
the "C++ build tools" workload from the
[Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019),
with the default optional components
* Basic Unix tools required for some tests,
Expand Down Expand Up @@ -660,7 +660,7 @@ $ make

## `Intl` (ECMA-402) support

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

### Build with full ICU support (all locales supported by ICU)
Expand Down Expand Up @@ -804,4 +804,4 @@ When Node.js is built (with an intention to distribute) with an ABI
incompatible with the official Node.js builds (e.g. using a ABI incompatible
version of a dependency), please reserve and use a custom `NODE_MODULE_VERSION`
by opening a pull request against the registry available at
<https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json>.
<https://github.com/nodejs/node/blob/HEAD/doc/abi_version_registry.json>.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V16.md#16.0.0">16.0.0</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V16.md#16.1.0">16.1.0</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V16.md#16.0.0">16.0.0</a><br/>
</td>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V15.md#15.14.0">15.14.0</a></b><br/>
Expand Down
2 changes: 1 addition & 1 deletion GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,5 @@ The TSC follows a [Consensus Seeking][] decision-making model per the

[Collaborators discussion page]: https://github.com/orgs/nodejs/teams/collaborators/discussions
[Consensus Seeking]: https://en.wikipedia.org/wiki/Consensus-seeking_decision-making
[TSC Charter]: https://github.com/nodejs/TSC/blob/master/TSC-Charter.md
[TSC Charter]: https://github.com/nodejs/TSC/blob/HEAD/TSC-Charter.md
[nodejs/node]: https://github.com/nodejs/node
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -681,13 +681,13 @@ Other keys used to sign some previous releases:
Node.js is available under the
[MIT license](https://opensource.org/licenses/MIT). Node.js also includes
external libraries that are available under a variety of licenses. See
[LICENSE](https://github.com/nodejs/node/blob/master/LICENSE) for the full
[LICENSE](https://github.com/nodejs/node/blob/HEAD/LICENSE) for the full
license text.

[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md
[Code of Conduct]: https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md
[Contributing to the project]: CONTRIBUTING.md
[Node.js Website]: https://nodejs.org/
[OpenJS Foundation]: https://openjsf.org/
[Strategic Initiatives]: https://github.com/nodejs/TSC/blob/master/Strategic-Initiatives.md
[Strategic Initiatives]: https://github.com/nodejs/TSC/blob/HEAD/Strategic-Initiatives.md
[Technical values and prioritization]: doc/guides/technical-values.md
[Working Groups]: https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md
[Working Groups]: https://github.com/nodejs/TSC/blob/HEAD/WORKING_GROUPS.md
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ maintainers and should also be coordinated through the Node.js Ecosystem
Security Team via [HackerOne](https://hackerone.com/nodejs-ecosystem).

Details regarding this process can be found in the
[Security Working Group repository](https://github.com/nodejs/security-wg/blob/master/processes/third_party_vuln_process.md).
[Security Working Group repository](https://github.com/nodejs/security-wg/blob/HEAD/processes/third_party_vuln_process.md).

Thank you for improving the security of Node.js and its ecosystem. Your efforts
and responsible disclosure are greatly appreciated and will be acknowledged.
Expand Down
2 changes: 1 addition & 1 deletion benchmark/_http-benchmarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require('path');
const fs = require('fs');

const requirementsURL =
'https://github.com/nodejs/node/blob/master/benchmark/writing-and-running-benchmarks.md#http-benchmark-requirements';
'https://github.com/nodejs/node/blob/HEAD/benchmark/writing-and-running-benchmarks.md#http-benchmark-requirements';

// The port used by servers and wrk
exports.PORT = Number(process.env.PORT) || 12346;
Expand Down
6 changes: 3 additions & 3 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.11',
'v8_embedder_string': '-node.16',

##### V8 defaults for Node.js #####

Expand Down Expand Up @@ -375,7 +375,7 @@
}],
[ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', {
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++1y' ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++14' ],
'defines': [ '__STDC_FORMAT_MACROS' ],
'ldflags': [ '-rdynamic' ],
'target_conditions': [
Expand Down Expand Up @@ -519,7 +519,7 @@
['clang==1', {
'xcode_settings': {
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++1y', # -std=gnu++1y
'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++14', # -std=gnu++14
'CLANG_CXX_LIBRARY': 'libc++',
},
}],
Expand Down
1 change: 1 addition & 0 deletions deps/v8/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ Seo Sanghyeon <[email protected]>
Shawn Anastasio <[email protected]>
Shawn Presser <[email protected]>
Stefan Penner <[email protected]>
Stephen Belanger <[email protected]>
Sylvestre Ledru <[email protected]>
Taketoshi Aono <[email protected]>
Tao Liqiang <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 9
#define V8_MINOR_VERSION 0
#define V8_BUILD_NUMBER 257
#define V8_PATCH_LEVEL 24
#define V8_PATCH_LEVEL 25

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
12 changes: 12 additions & 0 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -10794,6 +10794,18 @@ class V8_EXPORT Context : public Data {
*/
void SetContinuationPreservedEmbedderData(Local<Value> context);

/**
* Set or clear hooks to be invoked for promise lifecycle operations.
* To clear a hook, set it to an empty v8::Function. Each function will
* receive the observed promise as the first argument. If a chaining
* operation is used on a promise, the init will additionally receive
* the parent promise as the second argument.
*/
void SetPromiseHooks(Local<Function> init_hook,
Local<Function> before_hook,
Local<Function> after_hook,
Local<Function> resolve_hook);

/**
* Stack-allocated class which sets the execution context for all
* operations executed within a local scope.
Expand Down
39 changes: 39 additions & 0 deletions deps/v8/src/api/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6147,6 +6147,45 @@ void Context::SetContinuationPreservedEmbedderData(Local<Value> data) {
*i::Handle<i::HeapObject>::cast(Utils::OpenHandle(*data)));
}

void v8::Context::SetPromiseHooks(Local<Function> init_hook,
Local<Function> before_hook,
Local<Function> after_hook,
Local<Function> resolve_hook) {
i::Handle<i::Context> context = Utils::OpenHandle(this);
i::Isolate* isolate = context->GetIsolate();

i::Handle<i::Object> init = isolate->factory()->undefined_value();
i::Handle<i::Object> before = isolate->factory()->undefined_value();
i::Handle<i::Object> after = isolate->factory()->undefined_value();
i::Handle<i::Object> resolve = isolate->factory()->undefined_value();

bool has_hook = false;

if (!init_hook.IsEmpty()) {
init = Utils::OpenHandle(*init_hook);
has_hook = true;
}
if (!before_hook.IsEmpty()) {
before = Utils::OpenHandle(*before_hook);
has_hook = true;
}
if (!after_hook.IsEmpty()) {
after = Utils::OpenHandle(*after_hook);
has_hook = true;
}
if (!resolve_hook.IsEmpty()) {
resolve = Utils::OpenHandle(*resolve_hook);
has_hook = true;
}

isolate->SetHasContextPromiseHooks(has_hook);

context->native_context().set_promise_hook_init_function(*init);
context->native_context().set_promise_hook_before_function(*before);
context->native_context().set_promise_hook_after_function(*after);
context->native_context().set_promise_hook_resolve_function(*resolve);
}

MaybeLocal<Context> metrics::Recorder::GetContext(
Isolate* isolate, metrics::Recorder::ContextId id) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
Expand Down
4 changes: 3 additions & 1 deletion deps/v8/src/builtins/builtins-async-function-gen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,14 @@ TF_BUILTIN(AsyncFunctionEnter, AsyncFunctionBuiltinsAssembler) {
StoreObjectFieldNoWriteBarrier(
async_function_object, JSAsyncFunctionObject::kPromiseOffset, promise);

RunContextPromiseHookInit(context, promise, UndefinedConstant());

// Fire promise hooks if enabled and push the Promise under construction
// in an async function on the catch prediction stack to handle exceptions
// thrown before the first await.
Label if_instrumentation(this, Label::kDeferred),
if_instrumentation_done(this);
Branch(IsPromiseHookEnabledOrDebugIsActiveOrHasAsyncEventDelegate(),
Branch(IsIsolatePromiseHookEnabledOrDebugIsActiveOrHasAsyncEventDelegate(),
&if_instrumentation, &if_instrumentation_done);
BIND(&if_instrumentation);
{
Expand Down
Loading