|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +// This file stores JS builting that can not become primordials yet because |
| 4 | +// they can be disabled by runtime flags, or are not enabled by default yet. |
| 5 | + |
| 6 | +// Without this module, the only choice we would have is getting them from |
| 7 | +// the global proxy which is mutable from userland. This is especially important |
| 8 | +// for lazy-loaded builting required in modules participating in early bootstrap. |
| 9 | +// In such modules, we are usually unable to get these builting synchronously, |
| 10 | +// this applies to synchronous destructuring of this module. |
| 11 | +// Importing the module itself is fine at any point, including top level of file. |
| 12 | + |
| 13 | +let _AsyncDisposableStack; |
| 14 | +let _DisposableStack; |
| 15 | +let _Float16Array; |
| 16 | +let _Intl; |
| 17 | +let _Iterator; |
| 18 | +let _ShadowRealm; |
| 19 | +let _SharedArrayBuffer; |
| 20 | +let _Temporal; |
| 21 | +let _Uint8ArrayFromHex; |
| 22 | +let _Uint8ArrayFromBase64; |
| 23 | +let _WebAssembly; |
| 24 | + |
| 25 | +module.exports = { |
| 26 | + get AsyncDisposableStack() { |
| 27 | + return _AsyncDisposableStack; |
| 28 | + }, |
| 29 | + get DisposableStack() { |
| 30 | + return _DisposableStack; |
| 31 | + }, |
| 32 | + get Float16Array() { |
| 33 | + return _Float16Array; |
| 34 | + }, |
| 35 | + get Intl() { |
| 36 | + return _Intl; |
| 37 | + }, |
| 38 | + get Iterator() { |
| 39 | + return _Iterator; |
| 40 | + }, |
| 41 | + get ShadowRealm() { |
| 42 | + return _ShadowRealm; |
| 43 | + }, |
| 44 | + get SharedArrayBuffer() { |
| 45 | + return _SharedArrayBuffer; |
| 46 | + }, |
| 47 | + get Temporal() { |
| 48 | + return _Temporal; |
| 49 | + }, |
| 50 | + get Uint8ArrayFromHex() { |
| 51 | + return _Uint8ArrayFromHex; |
| 52 | + }, |
| 53 | + get Uint8ArrayFromBase64() { |
| 54 | + return _Uint8ArrayFromBase64; |
| 55 | + }, |
| 56 | + get WebAssembly() { |
| 57 | + return _WebAssembly; |
| 58 | + }, |
| 59 | + _init({ |
| 60 | + AsyncDisposableStack, |
| 61 | + DisposableStack, |
| 62 | + Float16Array, |
| 63 | + Intl, |
| 64 | + Iterator, |
| 65 | + ShadowRealm, |
| 66 | + SharedArrayBuffer, |
| 67 | + Temporal, |
| 68 | + Uint8Array: { |
| 69 | + fromBase64, |
| 70 | + fromHex, |
| 71 | + }, |
| 72 | + WebAssembly, |
| 73 | + }) { |
| 74 | + _AsyncDisposableStack = AsyncDisposableStack; |
| 75 | + _DisposableStack = DisposableStack; |
| 76 | + _Float16Array = Float16Array; |
| 77 | + _Intl = Intl; |
| 78 | + _Iterator = Iterator; |
| 79 | + _ShadowRealm = ShadowRealm; |
| 80 | + _SharedArrayBuffer = SharedArrayBuffer; |
| 81 | + _Temporal = Temporal; |
| 82 | + _Uint8ArrayFromBase64 = fromBase64; |
| 83 | + _Uint8ArrayFromHex = fromHex; |
| 84 | + _WebAssembly = WebAssembly; |
| 85 | + |
| 86 | + delete this._init; |
| 87 | + }, |
| 88 | +}; |
0 commit comments