async_hooks: expose async_wrap providers · nodejs/node@0691649 · GitHub
Skip to content

Commit 0691649

Browse files
RafaelGSStargos
authored andcommitted
async_hooks: expose async_wrap providers
docs: add asyncWrapProviders api doc tests(async_hooks): use internalBinding for comparisson fix(test-async-wrap): lint error docs: use REPLACEME for asyncWrapProviders update: use freeze and copy for asyncWrapProviders update(async_hooks): use primordials on asyncWrapProviders fix: use common to expect error docs(asyncWrapProviders): rephrase return type fix: lint md fix: lint md docs(async_hooks): typo Co-authored-by: Stephen Belanger <admin@stephenbelanger.com> update(asyncWrapProviders): add __proto__ as null Co-authored-by: Simone Busoli <simone.busoli@gmail.com> Co-authored-by: Michaël Zasso <targos@protonmail.com> test: adjust __proto__ assertion docs: add DEP0111 link PR-URL: #40760 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
1 parent 415b42f commit 0691649

4 files changed

Lines changed: 37 additions & 0 deletions

File tree

doc/api/async_hooks.md

Lines changed: 13 additions & 0 deletions

lib/async_hooks.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const {
1111
ObjectIs,
1212
ReflectApply,
1313
Symbol,
14+
ObjectFreeze,
1415
} = primordials;
1516

1617
const {
@@ -29,6 +30,7 @@ const internal_async_hooks = require('internal/async_hooks');
2930
// resource gets gced.
3031
const { registerDestroyHook } = internal_async_hooks;
3132
const {
33+
asyncWrap,
3234
executionAsyncId,
3335
triggerAsyncId,
3436
// Private API
@@ -352,6 +354,7 @@ module.exports = {
352354
executionAsyncId,
353355
triggerAsyncId,
354356
executionAsyncResource,
357+
asyncWrapProviders: ObjectFreeze({ __proto__: null, ...asyncWrap.Providers }),
355358
// Embedder API
356359
AsyncResource,
357360
};

lib/internal/async_hooks.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,5 +612,8 @@ module.exports = {
612612
after: emitAfterNative,
613613
destroy: emitDestroyNative,
614614
promise_resolve: emitPromiseResolveNative
615+
},
616+
asyncWrap: {
617+
Providers: async_wrap.Providers,
615618
}
616619
};
Lines changed: 18 additions & 0 deletions

0 commit comments

Comments
 (0)