Skip to content

Commit

Permalink
lib: export stable submodules in parent builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
Mesteery committed May 12, 2024
1 parent dde2965 commit 48ffa4b
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions lib/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'use strict';

const {
ObjectDefineProperties,
ObjectDefineProperty,
ObjectKeys,
ReflectApply,
Expand Down Expand Up @@ -110,12 +111,34 @@ Stream.compose = compose;
Stream.setDefaultHighWaterMark = setDefaultHighWaterMark;
Stream.getDefaultHighWaterMark = getDefaultHighWaterMark;

ObjectDefineProperty(Stream, 'promises', {
__proto__: null,
configurable: true,
enumerable: true,
get() {
return promises;
let consumers;
let web;
ObjectDefineProperties(Stream, {
consumers: {
__proto__: null,
configurable: true,
enumerable: true,
get() {
consumers ??= require('stream/consumers');
return consumers;
}
},
promises: {
__proto__: null,
configurable: true,
enumerable: true,
get() {
return promises;
},
},
web: {
__proto__: null,
configurable: true,
enumerable: true,
get() {
web ??= require('stream/web');
return web;
}
},
});

Expand Down

0 comments on commit 48ffa4b

Please sign in to comment.