@pkgjs/parseargs
Advanced tools
Comparing version 0.9.0 to 0.9.1
# Changelog | ||
## [0.9.1](https://github.com/pkgjs/parseargs/compare/v0.9.0...v0.9.1) (2022-06-20) | ||
### Bug Fixes | ||
* **runtime:** support node 14+ ([#135](https://github.com/pkgjs/parseargs/issues/135)) ([6a1c5a6](https://github.com/pkgjs/parseargs/commit/6a1c5a6f7cadf2f035e004027e2742e3c4ce554b)) | ||
## [0.9.0](https://github.com/pkgjs/parseargs/compare/v0.8.0...v0.9.0) (2022-05-23) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "@pkgjs/parseargs", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "Polyfill of future proposal for `util.parseArgs()`", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"main": "index.js", | ||
@@ -6,0 +9,0 @@ "exports": { |
@@ -0,1 +1,26 @@ | ||
/* | ||
This file is copied from https://github.com/nodejs/node/blob/v14.19.3/lib/internal/per_context/primordials.js | ||
under the following license: | ||
Copyright Node.js contributors. All rights reserved. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to | ||
deal in the Software without restriction, including without limitation the | ||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
sell copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
IN THE SOFTWARE. | ||
*/ | ||
'use strict'; | ||
@@ -172,3 +197,2 @@ | ||
[ | ||
'AggregateError', | ||
'Array', | ||
@@ -184,3 +208,2 @@ 'ArrayBuffer', | ||
'EvalError', | ||
'FinalizationRegistry', | ||
'Float32Array', | ||
@@ -209,3 +232,2 @@ 'Float64Array', | ||
'WeakMap', | ||
'WeakRef', | ||
'WeakSet', | ||
@@ -238,12 +260,8 @@ ].forEach((name) => { | ||
{ name: 'TypedArray', original: Reflect.getPrototypeOf(Uint8Array) }, | ||
{ | ||
name: 'ArrayIterator', original: { | ||
prototype: Reflect.getPrototypeOf(Array.prototype[Symbol.iterator]()), | ||
} | ||
}, | ||
{ | ||
name: 'StringIterator', original: { | ||
prototype: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()), | ||
} | ||
}, | ||
{ name: 'ArrayIterator', original: { | ||
prototype: Reflect.getPrototypeOf(Array.prototype[Symbol.iterator]()), | ||
} }, | ||
{ name: 'StringIterator', original: { | ||
prototype: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()), | ||
} }, | ||
].forEach(({ name, original }) => { | ||
@@ -261,3 +279,2 @@ primordials[name] = original; | ||
ArrayPrototypeForEach, | ||
FinalizationRegistry, | ||
FunctionPrototypeCall, | ||
@@ -267,8 +284,5 @@ Map, | ||
ObjectSetPrototypeOf, | ||
Promise, | ||
PromisePrototypeThen, | ||
Set, | ||
SymbolIterator, | ||
WeakMap, | ||
WeakRef, | ||
WeakSet, | ||
@@ -318,5 +332,2 @@ } = primordials; | ||
/** | ||
* @type {typeof primordials.makeSafe} | ||
*/ | ||
const makeSafe = (unsafe, safe) => { | ||
@@ -336,3 +347,3 @@ if (SymbolIterator in unsafe.prototype) { | ||
const createIterator = uncurryThis(desc.value); | ||
next ??= uncurryThis(createIterator(dummy).next); | ||
next = next ?? uncurryThis(createIterator(dummy).next); | ||
const SafeIterator = createSafeIterator(createIterator, next); | ||
@@ -374,3 +385,2 @@ desc.value = function() { | ||
); | ||
primordials.SafeSet = makeSafe( | ||
@@ -389,51 +399,2 @@ Set, | ||
primordials.SafeFinalizationRegistry = makeSafe( | ||
FinalizationRegistry, | ||
class SafeFinalizationRegistry extends FinalizationRegistry { | ||
// eslint-disable-next-line no-useless-constructor | ||
constructor(cleanupCallback) { super(cleanupCallback); } | ||
} | ||
); | ||
primordials.SafeWeakRef = makeSafe( | ||
WeakRef, | ||
class SafeWeakRef extends WeakRef { | ||
// eslint-disable-next-line no-useless-constructor | ||
constructor(target) { super(target); } | ||
} | ||
); | ||
const SafePromise = makeSafe( | ||
Promise, | ||
class SafePromise extends Promise { | ||
// eslint-disable-next-line no-useless-constructor | ||
constructor(executor) { super(executor); } | ||
} | ||
); | ||
primordials.PromisePrototypeCatch = (thisPromise, onRejected) => | ||
PromisePrototypeThen(thisPromise, undefined, onRejected); | ||
/** | ||
* Attaches a callback that is invoked when the Promise is settled (fulfilled or | ||
* rejected). The resolved value cannot be modified from the callback. | ||
* Prefer using async functions when possible. | ||
* @param {Promise<any>} thisPromise | ||
* @param {() => void) | undefined | null} onFinally The callback to execute | ||
* when the Promise is settled (fulfilled or rejected). | ||
* @returns {Promise} A Promise for the completion of the callback. | ||
*/ | ||
primordials.SafePromisePrototypeFinally = (thisPromise, onFinally) => | ||
// Wrapping on a new Promise is necessary to not expose the SafePromise | ||
// prototype to user-land. | ||
new Promise((a, b) => | ||
new SafePromise((a, b) => PromisePrototypeThen(thisPromise, a, b)) | ||
.finally(onFinally) | ||
.then(a, b) | ||
); | ||
primordials.AsyncIteratorPrototype = | ||
primordials.ReflectGetPrototypeOf( | ||
primordials.ReflectGetPrototypeOf( | ||
async function* () { }).prototype); | ||
ObjectSetPrototypeOf(primordials, null); | ||
@@ -440,0 +401,0 @@ ObjectFreeze(primordials); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61038
11
910