GeezerVison is showing github.com — lib: add ERM classes to primordials · nodejs/node@d4d048c
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/eslint.config_partial.mjs -10Lines changed: 0 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -412,16 +412,6 @@ export default [ | 412 | 412 | name: 'SubtleCrypto', | 413 | 413 | message: "Use `const { SubtleCrypto } = require('internal/crypto/webcrypto');` instead of the global.", | 414 | 414 | }, | 415 | | - // DisposableStack and AsyncDisposableStack are not available in primordials because they can be | 416 | | - // disabled with --no-js-explicit-resource-management CLI flag. | 417 | | - { | 418 | | - name: 'DisposableStack', | 419 | | - message: 'Use `const { DisposableStack } = globalThis;` instead of the global.', | 420 | | - }, | 421 | | - { | 422 | | - name: 'AsyncDisposableStack', | 423 | | - message: 'Use `const { AsyncDisposableStack } = globalThis;` instead of the global.', | 424 | | - }, | 425 | 415 | ], | 426 | 416 | 'no-restricted-modules': [ | 427 | 417 | 'error', | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/freeze_intrinsics.js +24-11Lines changed: 24 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,6 +31,8 @@ const { | 31 | 31 | ArrayPrototype, | 32 | 32 | ArrayPrototypeForEach, | 33 | 33 | ArrayPrototypePush, | | 34 | + AsyncDisposableStack, | | 35 | + AsyncDisposableStackPrototype, | 34 | 36 | AsyncFunctionPrototype, | 35 | 37 | AsyncGeneratorFunctionPrototype, | 36 | 38 | AsyncGeneratorFunctionPrototypePrototype, | @@ -48,6 +50,8 @@ const { | 48 | 50 | DataViewPrototype, | 49 | 51 | Date, | 50 | 52 | DatePrototype, | | 53 | + DisposableStack, | | 54 | + DisposableStackPrototype, | 51 | 55 | Error, | 52 | 56 | ErrorPrototype, | 53 | 57 | EvalError, | @@ -106,6 +110,8 @@ const { | 106 | 110 | String, | 107 | 111 | StringIteratorPrototype, | 108 | 112 | StringPrototype, | | 113 | + SuppressedError, | | 114 | + SuppressedErrorPrototype, | 109 | 115 | Symbol, | 110 | 116 | SymbolPrototype, | 111 | 117 | SyntaxError, | @@ -171,6 +177,7 @@ module.exports = function() { | 171 | 177 | EvalErrorPrototype, | 172 | 178 | RangeErrorPrototype, | 173 | 179 | ReferenceErrorPrototype, | | 180 | + SuppressedErrorPrototype, | 174 | 181 | SyntaxErrorPrototype, | 175 | 182 | TypeErrorPrototype, | 176 | 183 | URIErrorPrototype, | @@ -225,12 +232,14 @@ module.exports = function() { | 225 | 232 | IteratorPrototype, // 27.1.3 | 226 | 233 | WrapForValidIteratorPrototype, // 27.1.3.2.2.1 | 227 | 234 | AsyncIteratorPrototype, // 27.1.4 | 228 | | - PromisePrototype, // 27.2 | 229 | | - GeneratorFunctionPrototype, // 27.3 | 230 | | - AsyncGeneratorFunctionPrototype, // 27.4 | 231 | | - // 27.5 GeneratorPrototype | | 235 | + DisposableStackPrototype, // 27.3.2.1 | | 236 | + AsyncDisposableStackPrototype, // 27.4.2.1 | | 237 | + PromisePrototype, // 27.5.4.4 | | 238 | + GeneratorFunctionPrototype, // 27.6.2.1 | | 239 | + AsyncGeneratorFunctionPrototype, // 27.7.3.3 | | 240 | + // 27.8 GeneratorPrototype | 232 | 241 | GeneratorFunctionPrototypePrototype, | 233 | | - // 27.6 AsyncGeneratorPrototype | | 242 | + // 27.9 AsyncGeneratorPrototype | 234 | 243 | AsyncGeneratorFunctionPrototypePrototype, | 235 | 244 | AsyncFunctionPrototype, // 27.7 | 236 | 245 |
| @@ -270,6 +279,7 @@ module.exports = function() { | 270 | 279 | EvalError, | 271 | 280 | RangeError, | 272 | 281 | ReferenceError, | | 282 | + SuppressedError, | 273 | 283 | SyntaxError, | 274 | 284 | TypeError, | 275 | 285 | URIError, | @@ -329,14 +339,17 @@ module.exports = function() { | 329 | 339 | Iterator, // 27.1.3 | 330 | 340 | WrapForValidIteratorPrototype, // 27.1.3.2.2.1 | 331 | 341 | ArrayIteratorPrototype, // 27.1.4 | 332 | | - Promise, // 27.2 | 333 | | - // 27.3 GeneratorFunction | 334 | | - // 27.5 Generator | | 342 | + // 27.2 SymbolDispose | | 343 | + DisposableStack, // 27.3 | | 344 | + AsyncDisposableStack, // 27.4 | | 345 | + Promise, // 27.5 | | 346 | + // 27.6 GeneratorFunction | | 347 | + // 27.8 Generator | 335 | 348 | GeneratorFunctionPrototype, | 336 | | - // 27.4 AsyncGeneratorFunction | 337 | | - // 27.6 AsyncGenerator | | 349 | + // 27.7 AsyncGeneratorFunction | | 350 | + // 27.9 AsyncGenerator | 338 | 351 | AsyncGeneratorFunctionPrototype, | 339 | | - // 27.7 AsyncFunction | | 352 | + // 27.10 AsyncFunction | 340 | 353 | AsyncFunctionPrototype, | 341 | 354 |
| 342 | 355 | // 28 Reflection | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/per_context/primordials.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -187,12 +187,14 @@ function copyPrototype(src, dest, prefix) { | 187 | 187 | 'AggregateError', | 188 | 188 | 'Array', | 189 | 189 | 'ArrayBuffer', | | 190 | + 'AsyncDisposableStack', | 190 | 191 | 'BigInt', | 191 | 192 | 'BigInt64Array', | 192 | 193 | 'BigUint64Array', | 193 | 194 | 'Boolean', | 194 | 195 | 'DataView', | 195 | 196 | 'Date', | | 197 | + 'DisposableStack', | 196 | 198 | 'Error', | 197 | 199 | 'EvalError', | 198 | 200 | 'FinalizationRegistry', | @@ -212,6 +214,7 @@ function copyPrototype(src, dest, prefix) { | 212 | 214 | 'RegExp', | 213 | 215 | 'Set', | 214 | 216 | 'String', | | 217 | + 'SuppressedError', | 215 | 218 | 'Symbol', | 216 | 219 | 'SyntaxError', | 217 | 220 | 'TypeError', | |
Collapse file Copy file name to clipboardExpand all lines: typings/primordials.d.ts +18Lines changed: 18 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -168,6 +168,14 @@ declare namespace primordials { | 168 | 168 | export const ArrayBufferPrototypeSlice: UncurryThis<typeof ArrayBuffer.prototype.slice> | 169 | 169 | export const ArrayBufferPrototypeTransfer: UncurryThis<typeof ArrayBuffer.prototype.transfer> | 170 | 170 | export const ArrayBufferPrototypeGetByteLength: UncurryGetter<typeof ArrayBuffer.prototype , "byteLength">; | | 171 | + export import AsyncDisposableStack = globalThis.AsyncDisposableStack, | | 172 | + export const AsyncDisposableStackPrototype: typeof AsyncDisposableStack.prototype | | 173 | + export const AsyncDisposableStackAdopt: UncurryThis<typeof AsyncDisposableStack.prototype.adopt> | | 174 | + export const AsyncDisposableStackDefer: UncurryThis<typeof AsyncDisposableStack.prototype.defer> | | 175 | + export const AsyncDisposableStackDispose: UncurryThis<typeof AsyncDisposableStack.prototype.dispose> | | 176 | + export const AsyncDisposableStackMove: UncurryThis<typeof AsyncDisposableStack.prototype.move> | | 177 | + export const AsyncDisposableStackUse: UncurryThis<typeof AsyncDisposableStack.prototype.use> | | 178 | + export const AsyncDisposableStackSymbolAsyncDispose: UncurryMethod<typeof AsyncDisposableStack.prototype, typeof Symbol.asyncDispose>; | 171 | 179 | export import BigInt = globalThis.BigInt; | 172 | 180 | export const BigIntPrototype: typeof BigInt.prototype | 173 | 181 | export const BigIntAsUintN: typeof BigInt.asUintN | @@ -259,6 +267,14 @@ declare namespace primordials { | 259 | 267 | export const DatePrototypeToLocaleDateString: UncurryThis<typeof Date.prototype.toLocaleDateString> | 260 | 268 | export const DatePrototypeToLocaleTimeString: UncurryThis<typeof Date.prototype.toLocaleTimeString> | 261 | 269 | export const DatePrototypeSymbolToPrimitive: UncurryMethod<typeof Date.prototype, typeof Symbol.toPrimitive>; | | 270 | + export import DisposableStack = globalThis.DisposableStack, | | 271 | + export const DisposableStackPrototype: typeof DisposableStack.prototype | | 272 | + export const DisposableStackAdopt: UncurryThis<typeof DisposableStack.prototype.adopt> | | 273 | + export const DisposableStackDefer: UncurryThis<typeof DisposableStack.prototype.defer> | | 274 | + export const DisposableStackDispose: UncurryThis<typeof DisposableStack.prototype.dispose> | | 275 | + export const DisposableStackMove: UncurryThis<typeof DisposableStack.prototype.move> | | 276 | + export const DisposableStackUse: UncurryThis<typeof DisposableStack.prototype.use> | | 277 | + export const DisposableStackSymbolDispose: UncurryMethod<typeof DisposableStack.prototype, typeof Symbol.dispose>; | 262 | 278 | export import Error = globalThis.Error; | 263 | 279 | export const ErrorPrototype: typeof Error.prototype | 264 | 280 | // @ts-ignore | @@ -444,6 +460,8 @@ declare namespace primordials { | 444 | 460 | export const StringPrototypeToWellFormed: UncurryThis<typeof String.prototype.toWellFormed> | 445 | 461 | export const StringPrototypeValueOf: UncurryThis<typeof String.prototype.valueOf> | 446 | 462 | export const StringPrototypeReplaceAll: UncurryThis<typeof String.prototype.replaceAll> | | 463 | + export import SuppressedError = globalThis.SuppressedError; | | 464 | + export const SuppressedErrorPrototype: typeof SuppressedError.prototype | 447 | 465 | export import Symbol = globalThis.Symbol; | 448 | 466 | export const SymbolPrototype: typeof Symbol.prototype | 449 | 467 | export const SymbolFor: typeof Symbol.for | |
|