mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 20:30:04 +02:00
update packages to latest version
This commit is contained in:
91
node_modules/domexception/lib/utils.js
generated
vendored
91
node_modules/domexception/lib/utils.js
generated
vendored
@@ -2,17 +2,65 @@
|
||||
|
||||
// Returns "Type(value) is Object" in ES terminology.
|
||||
function isObject(value) {
|
||||
return typeof value === "object" && value !== null || typeof value === "function";
|
||||
return (typeof value === "object" && value !== null) || typeof value === "function";
|
||||
}
|
||||
|
||||
function hasOwn(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
const hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
|
||||
|
||||
// Like `Object.assign`, but using `[[GetOwnProperty]]` and `[[DefineOwnProperty]]`
|
||||
// instead of `[[Get]]` and `[[Set]]` and only allowing objects
|
||||
function define(target, source) {
|
||||
for (const key of Reflect.ownKeys(source)) {
|
||||
const descriptor = Reflect.getOwnPropertyDescriptor(source, key);
|
||||
if (descriptor && !Reflect.defineProperty(target, key, descriptor)) {
|
||||
throw new TypeError(`Cannot redefine property: ${String(key)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function newObjectInRealm(globalObject, object) {
|
||||
const ctorRegistry = initCtorRegistry(globalObject);
|
||||
return Object.defineProperties(
|
||||
Object.create(ctorRegistry["%Object.prototype%"]),
|
||||
Object.getOwnPropertyDescriptors(object)
|
||||
);
|
||||
}
|
||||
|
||||
const wrapperSymbol = Symbol("wrapper");
|
||||
const implSymbol = Symbol("impl");
|
||||
const sameObjectCaches = Symbol("SameObject caches");
|
||||
const ctorRegistrySymbol = Symbol.for("[webidl2js] constructor registry");
|
||||
const ctorRegistrySymbol = Symbol.for("[webidl2js] constructor registry");
|
||||
|
||||
const AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(async function* () {}).prototype);
|
||||
|
||||
function initCtorRegistry(globalObject) {
|
||||
if (hasOwn(globalObject, ctorRegistrySymbol)) {
|
||||
return globalObject[ctorRegistrySymbol];
|
||||
}
|
||||
|
||||
const ctorRegistry = Object.create(null);
|
||||
|
||||
// In addition to registering all the WebIDL2JS-generated types in the constructor registry,
|
||||
// we also register a few intrinsics that we make use of in generated code, since they are not
|
||||
// easy to grab from the globalObject variable.
|
||||
ctorRegistry["%Object.prototype%"] = globalObject.Object.prototype;
|
||||
ctorRegistry["%IteratorPrototype%"] = Object.getPrototypeOf(
|
||||
Object.getPrototypeOf(new globalObject.Array()[Symbol.iterator]())
|
||||
);
|
||||
|
||||
try {
|
||||
ctorRegistry["%AsyncIteratorPrototype%"] = Object.getPrototypeOf(
|
||||
Object.getPrototypeOf(
|
||||
globalObject.eval("(async function* () {})").prototype
|
||||
)
|
||||
);
|
||||
} catch {
|
||||
ctorRegistry["%AsyncIteratorPrototype%"] = AsyncIteratorPrototype;
|
||||
}
|
||||
|
||||
globalObject[ctorRegistrySymbol] = ctorRegistry;
|
||||
return ctorRegistry;
|
||||
}
|
||||
|
||||
function getSameObject(wrapper, prop, creator) {
|
||||
if (!wrapper[sameObjectCaches]) {
|
||||
@@ -46,14 +94,13 @@ function tryImplForWrapper(wrapper) {
|
||||
}
|
||||
|
||||
const iterInternalSymbol = Symbol("internal");
|
||||
const IteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
|
||||
|
||||
function isArrayIndexPropName(P) {
|
||||
if (typeof P !== "string") {
|
||||
return false;
|
||||
}
|
||||
const i = P >>> 0;
|
||||
if (i === Math.pow(2, 32) - 1) {
|
||||
if (i === 2 ** 32 - 1) {
|
||||
return false;
|
||||
}
|
||||
const s = `${i}`;
|
||||
@@ -74,6 +121,22 @@ function isArrayBuffer(value) {
|
||||
}
|
||||
}
|
||||
|
||||
function iteratorResult([key, value], kind) {
|
||||
let result;
|
||||
switch (kind) {
|
||||
case "key":
|
||||
result = key;
|
||||
break;
|
||||
case "value":
|
||||
result = value;
|
||||
break;
|
||||
case "key+value":
|
||||
result = [key, value];
|
||||
break;
|
||||
}
|
||||
return { value: result, done: false };
|
||||
}
|
||||
|
||||
const supportsPropertyIndex = Symbol("supports property index");
|
||||
const supportedPropertyIndices = Symbol("supported property indices");
|
||||
const supportsPropertyName = Symbol("supports property name");
|
||||
@@ -86,19 +149,26 @@ const namedSetNew = Symbol("named property set new");
|
||||
const namedSetExisting = Symbol("named property set existing");
|
||||
const namedDelete = Symbol("named property delete");
|
||||
|
||||
const asyncIteratorNext = Symbol("async iterator get the next iteration result");
|
||||
const asyncIteratorReturn = Symbol("async iterator return steps");
|
||||
const asyncIteratorInit = Symbol("async iterator initialization steps");
|
||||
const asyncIteratorEOI = Symbol("async iterator end of iteration");
|
||||
|
||||
module.exports = exports = {
|
||||
isObject,
|
||||
hasOwn,
|
||||
define,
|
||||
newObjectInRealm,
|
||||
wrapperSymbol,
|
||||
implSymbol,
|
||||
getSameObject,
|
||||
ctorRegistrySymbol,
|
||||
initCtorRegistry,
|
||||
wrapperForImpl,
|
||||
implForWrapper,
|
||||
tryWrapperForImpl,
|
||||
tryImplForWrapper,
|
||||
iterInternalSymbol,
|
||||
IteratorPrototype,
|
||||
isArrayBuffer,
|
||||
isArrayIndexPropName,
|
||||
supportsPropertyIndex,
|
||||
@@ -111,5 +181,10 @@ module.exports = exports = {
|
||||
namedGet,
|
||||
namedSetNew,
|
||||
namedSetExisting,
|
||||
namedDelete
|
||||
namedDelete,
|
||||
asyncIteratorNext,
|
||||
asyncIteratorReturn,
|
||||
asyncIteratorInit,
|
||||
asyncIteratorEOI,
|
||||
iteratorResult
|
||||
};
|
||||
|
Reference in New Issue
Block a user