mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
lib: add ERM classes to primordials
Totes three classes: - `DisposableStack` - `AsyncDisposableStack` - `SuppressedError` Signed-off-by: LiviaMedeiros <livia@cirno.name> PR-URL: https://github.com/nodejs/node/pull/67533 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
e23827687f
commit
d4d048c5ca
4 files changed
+45
-21
No files matched your search
@@ -412,16 +412,6 @@ export default [
|
||||
name: 'SubtleCrypto',
|
||||
message: "Use `const { SubtleCrypto } = require('internal/crypto/webcrypto');` instead of the global.",
|
||||
},
|
||||
// DisposableStack and AsyncDisposableStack are not available in primordials because they can be
|
||||
// disabled with --no-js-explicit-resource-management CLI flag.
|
||||
{
|
||||
name: 'DisposableStack',
|
||||
message: 'Use `const { DisposableStack } = globalThis;` instead of the global.',
|
||||
},
|
||||
{
|
||||
name: 'AsyncDisposableStack',
|
||||
message: 'Use `const { AsyncDisposableStack } = globalThis;` instead of the global.',
|
||||
},
|
||||
],
|
||||
'no-restricted-modules': [
|
||||
'error',
|
||||
|
||||
@@ -31,6 +31,8 @@ const {
|
||||
ArrayPrototype,
|
||||
ArrayPrototypeForEach,
|
||||
ArrayPrototypePush,
|
||||
AsyncDisposableStack,
|
||||
AsyncDisposableStackPrototype,
|
||||
AsyncFunctionPrototype,
|
||||
AsyncGeneratorFunctionPrototype,
|
||||
AsyncGeneratorFunctionPrototypePrototype,
|
||||
@@ -48,6 +50,8 @@ const {
|
||||
DataViewPrototype,
|
||||
Date,
|
||||
DatePrototype,
|
||||
DisposableStack,
|
||||
DisposableStackPrototype,
|
||||
Error,
|
||||
ErrorPrototype,
|
||||
EvalError,
|
||||
@@ -106,6 +110,8 @@ const {
|
||||
String,
|
||||
StringIteratorPrototype,
|
||||
StringPrototype,
|
||||
SuppressedError,
|
||||
SuppressedErrorPrototype,
|
||||
Symbol,
|
||||
SymbolPrototype,
|
||||
SyntaxError,
|
||||
@@ -171,6 +177,7 @@ module.exports = function() {
|
||||
EvalErrorPrototype,
|
||||
RangeErrorPrototype,
|
||||
ReferenceErrorPrototype,
|
||||
SuppressedErrorPrototype,
|
||||
SyntaxErrorPrototype,
|
||||
TypeErrorPrototype,
|
||||
URIErrorPrototype,
|
||||
@@ -225,12 +232,14 @@ module.exports = function() {
|
||||
IteratorPrototype, // 27.1.3
|
||||
WrapForValidIteratorPrototype, // 27.1.3.2.2.1
|
||||
AsyncIteratorPrototype, // 27.1.4
|
||||
PromisePrototype, // 27.2
|
||||
GeneratorFunctionPrototype, // 27.3
|
||||
AsyncGeneratorFunctionPrototype, // 27.4
|
||||
// 27.5 GeneratorPrototype
|
||||
DisposableStackPrototype, // 27.3.2.1
|
||||
AsyncDisposableStackPrototype, // 27.4.2.1
|
||||
PromisePrototype, // 27.5.4.4
|
||||
GeneratorFunctionPrototype, // 27.6.2.1
|
||||
AsyncGeneratorFunctionPrototype, // 27.7.3.3
|
||||
// 27.8 GeneratorPrototype
|
||||
GeneratorFunctionPrototypePrototype,
|
||||
// 27.6 AsyncGeneratorPrototype
|
||||
// 27.9 AsyncGeneratorPrototype
|
||||
AsyncGeneratorFunctionPrototypePrototype,
|
||||
AsyncFunctionPrototype, // 27.7
|
||||
|
||||
@@ -270,6 +279,7 @@ module.exports = function() {
|
||||
EvalError,
|
||||
RangeError,
|
||||
ReferenceError,
|
||||
SuppressedError,
|
||||
SyntaxError,
|
||||
TypeError,
|
||||
URIError,
|
||||
@@ -329,14 +339,17 @@ module.exports = function() {
|
||||
Iterator, // 27.1.3
|
||||
WrapForValidIteratorPrototype, // 27.1.3.2.2.1
|
||||
ArrayIteratorPrototype, // 27.1.4
|
||||
Promise, // 27.2
|
||||
// 27.3 GeneratorFunction
|
||||
// 27.5 Generator
|
||||
// 27.2 SymbolDispose
|
||||
DisposableStack, // 27.3
|
||||
AsyncDisposableStack, // 27.4
|
||||
Promise, // 27.5
|
||||
// 27.6 GeneratorFunction
|
||||
// 27.8 Generator
|
||||
GeneratorFunctionPrototype,
|
||||
// 27.4 AsyncGeneratorFunction
|
||||
// 27.6 AsyncGenerator
|
||||
// 27.7 AsyncGeneratorFunction
|
||||
// 27.9 AsyncGenerator
|
||||
AsyncGeneratorFunctionPrototype,
|
||||
// 27.7 AsyncFunction
|
||||
// 27.10 AsyncFunction
|
||||
AsyncFunctionPrototype,
|
||||
|
||||
// 28 Reflection
|
||||
|
||||
@@ -187,12 +187,14 @@ function copyPrototype(src, dest, prefix) {
|
||||
'AggregateError',
|
||||
'Array',
|
||||
'ArrayBuffer',
|
||||
'AsyncDisposableStack',
|
||||
'BigInt',
|
||||
'BigInt64Array',
|
||||
'BigUint64Array',
|
||||
'Boolean',
|
||||
'DataView',
|
||||
'Date',
|
||||
'DisposableStack',
|
||||
'Error',
|
||||
'EvalError',
|
||||
'FinalizationRegistry',
|
||||
@@ -212,6 +214,7 @@ function copyPrototype(src, dest, prefix) {
|
||||
'RegExp',
|
||||
'Set',
|
||||
'String',
|
||||
'SuppressedError',
|
||||
'Symbol',
|
||||
'SyntaxError',
|
||||
'TypeError',
|
||||
|
||||
Vendored
+18
@@ -168,6 +168,14 @@ declare namespace primordials {
|
||||
export const ArrayBufferPrototypeSlice: UncurryThis<typeof ArrayBuffer.prototype.slice>
|
||||
export const ArrayBufferPrototypeTransfer: UncurryThis<typeof ArrayBuffer.prototype.transfer>
|
||||
export const ArrayBufferPrototypeGetByteLength: UncurryGetter<typeof ArrayBuffer.prototype , "byteLength">;
|
||||
export import AsyncDisposableStack = globalThis.AsyncDisposableStack,
|
||||
export const AsyncDisposableStackPrototype: typeof AsyncDisposableStack.prototype
|
||||
export const AsyncDisposableStackAdopt: UncurryThis<typeof AsyncDisposableStack.prototype.adopt>
|
||||
export const AsyncDisposableStackDefer: UncurryThis<typeof AsyncDisposableStack.prototype.defer>
|
||||
export const AsyncDisposableStackDispose: UncurryThis<typeof AsyncDisposableStack.prototype.dispose>
|
||||
export const AsyncDisposableStackMove: UncurryThis<typeof AsyncDisposableStack.prototype.move>
|
||||
export const AsyncDisposableStackUse: UncurryThis<typeof AsyncDisposableStack.prototype.use>
|
||||
export const AsyncDisposableStackSymbolAsyncDispose: UncurryMethod<typeof AsyncDisposableStack.prototype, typeof Symbol.asyncDispose>;
|
||||
export import BigInt = globalThis.BigInt;
|
||||
export const BigIntPrototype: typeof BigInt.prototype
|
||||
export const BigIntAsUintN: typeof BigInt.asUintN
|
||||
@@ -259,6 +267,14 @@ declare namespace primordials {
|
||||
export const DatePrototypeToLocaleDateString: UncurryThis<typeof Date.prototype.toLocaleDateString>
|
||||
export const DatePrototypeToLocaleTimeString: UncurryThis<typeof Date.prototype.toLocaleTimeString>
|
||||
export const DatePrototypeSymbolToPrimitive: UncurryMethod<typeof Date.prototype, typeof Symbol.toPrimitive>;
|
||||
export import DisposableStack = globalThis.DisposableStack,
|
||||
export const DisposableStackPrototype: typeof DisposableStack.prototype
|
||||
export const DisposableStackAdopt: UncurryThis<typeof DisposableStack.prototype.adopt>
|
||||
export const DisposableStackDefer: UncurryThis<typeof DisposableStack.prototype.defer>
|
||||
export const DisposableStackDispose: UncurryThis<typeof DisposableStack.prototype.dispose>
|
||||
export const DisposableStackMove: UncurryThis<typeof DisposableStack.prototype.move>
|
||||
export const DisposableStackUse: UncurryThis<typeof DisposableStack.prototype.use>
|
||||
export const DisposableStackSymbolDispose: UncurryMethod<typeof DisposableStack.prototype, typeof Symbol.dispose>;
|
||||
export import Error = globalThis.Error;
|
||||
export const ErrorPrototype: typeof Error.prototype
|
||||
// @ts-ignore
|
||||
@@ -444,6 +460,8 @@ declare namespace primordials {
|
||||
export const StringPrototypeToWellFormed: UncurryThis<typeof String.prototype.toWellFormed>
|
||||
export const StringPrototypeValueOf: UncurryThis<typeof String.prototype.valueOf>
|
||||
export const StringPrototypeReplaceAll: UncurryThis<typeof String.prototype.replaceAll>
|
||||
export import SuppressedError = globalThis.SuppressedError;
|
||||
export const SuppressedErrorPrototype: typeof SuppressedError.prototype
|
||||
export import Symbol = globalThis.Symbol;
|
||||
export const SymbolPrototype: typeof Symbol.prototype
|
||||
export const SymbolFor: typeof Symbol.for
|
||||
|
||||
Reference in new issue
Block a user