aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/async_hooks.exports.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/async_hooks.exports.js')
-rw-r--r--src/bun.js/async_hooks.exports.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/bun.js/async_hooks.exports.js b/src/bun.js/async_hooks.exports.js
index 1b5664bc2..055159934 100644
--- a/src/bun.js/async_hooks.exports.js
+++ b/src/bun.js/async_hooks.exports.js
@@ -145,11 +145,19 @@ class AsyncResource {
constructor(type, triggerAsyncId) {
this.type = type;
this.triggerAsyncId = triggerAsyncId;
+
+ if (AsyncResource.allowedRunInAsyncScope.has(type)) {
+ this.runInAsyncScope = this.#runInAsyncScope;
+ }
}
type;
triggerAsyncId;
+ // We probably will not fully support AsyncResource
+ // But some packages in the wild do depend on it
+ static allowedRunInAsyncScope = new Set(["prisma-client-request"]);
+
emitBefore() {
return true;
}
@@ -160,7 +168,9 @@ class AsyncResource {
emitDestroy() {}
- runInAsyncScope(fn, ...args) {
+ runInAsyncScope;
+
+ #runInAsyncScope(fn, ...args) {
notImplemented();
var result, err;
process.nextTick(fn => {