mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 12:20:04 +02:00
update node modules
This commit is contained in:
265
node_modules/whatwg-url/lib/URL.js
generated
vendored
265
node_modules/whatwg-url/lib/URL.js
generated
vendored
@@ -5,57 +5,44 @@ const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function URL(url) {
|
||||
if (!new.target) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URL'. Please use the 'new' operator; this constructor " + "cannot be called as a function."
|
||||
);
|
||||
}
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URL': 1 " + "argument required, but only " + arguments.length + " present."
|
||||
);
|
||||
class URL {
|
||||
constructor(url) {
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError("Failed to construct 'URL': 1 argument required, but only " + arguments.length + " present.");
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, { context: "Failed to construct 'URL': parameter 1" });
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
if (curArg !== undefined) {
|
||||
curArg = conversions["USVString"](curArg, { context: "Failed to construct 'URL': parameter 2" });
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return iface.setup(Object.create(new.target.prototype), args);
|
||||
}
|
||||
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length && i < 2; ++i) {
|
||||
args[i] = arguments[i];
|
||||
toJSON() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].toJSON();
|
||||
}
|
||||
|
||||
args[0] = conversions["USVString"](args[0], { context: "Failed to construct 'URL': parameter 1" });
|
||||
|
||||
if (args[1] !== undefined) {
|
||||
args[1] = conversions["USVString"](args[1], { context: "Failed to construct 'URL': parameter 2" });
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.defineProperty(URL, "prototype", {
|
||||
value: URL.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
URL.prototype.toJSON = function toJSON() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].toJSON();
|
||||
};
|
||||
|
||||
Object.defineProperty(URL.prototype, "href", {
|
||||
get() {
|
||||
get href() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["href"];
|
||||
},
|
||||
}
|
||||
|
||||
set(V) {
|
||||
set href(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
@@ -63,42 +50,32 @@ Object.defineProperty(URL.prototype, "href", {
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'href' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["href"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
URL.prototype.toString = function toString() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return this[impl]["href"];
|
||||
};
|
||||
|
||||
Object.defineProperty(URL.prototype, "origin", {
|
||||
get() {
|
||||
toString() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return this[impl]["href"];
|
||||
}
|
||||
|
||||
get origin() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["origin"];
|
||||
},
|
||||
}
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "protocol", {
|
||||
get() {
|
||||
get protocol() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["protocol"];
|
||||
},
|
||||
}
|
||||
|
||||
set(V) {
|
||||
set protocol(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
@@ -106,22 +83,17 @@ Object.defineProperty(URL.prototype, "protocol", {
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'protocol' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["protocol"] = V;
|
||||
},
|
||||
}
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "username", {
|
||||
get() {
|
||||
get username() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["username"];
|
||||
},
|
||||
}
|
||||
|
||||
set(V) {
|
||||
set username(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
@@ -129,22 +101,17 @@ Object.defineProperty(URL.prototype, "username", {
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'username' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["username"] = V;
|
||||
},
|
||||
}
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "password", {
|
||||
get() {
|
||||
get password() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["password"];
|
||||
},
|
||||
}
|
||||
|
||||
set(V) {
|
||||
set password(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
@@ -152,22 +119,17 @@ Object.defineProperty(URL.prototype, "password", {
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'password' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["password"] = V;
|
||||
},
|
||||
}
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "host", {
|
||||
get() {
|
||||
get host() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["host"];
|
||||
},
|
||||
}
|
||||
|
||||
set(V) {
|
||||
set host(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
@@ -175,22 +137,17 @@ Object.defineProperty(URL.prototype, "host", {
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'host' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["host"] = V;
|
||||
},
|
||||
}
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "hostname", {
|
||||
get() {
|
||||
get hostname() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hostname"];
|
||||
},
|
||||
}
|
||||
|
||||
set(V) {
|
||||
set hostname(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
@@ -198,22 +155,17 @@ Object.defineProperty(URL.prototype, "hostname", {
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'hostname' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["hostname"] = V;
|
||||
},
|
||||
}
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "port", {
|
||||
get() {
|
||||
get port() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["port"];
|
||||
},
|
||||
}
|
||||
|
||||
set(V) {
|
||||
set port(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
@@ -221,22 +173,17 @@ Object.defineProperty(URL.prototype, "port", {
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'port' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["port"] = V;
|
||||
},
|
||||
}
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "pathname", {
|
||||
get() {
|
||||
get pathname() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["pathname"];
|
||||
},
|
||||
}
|
||||
|
||||
set(V) {
|
||||
set pathname(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
@@ -244,22 +191,17 @@ Object.defineProperty(URL.prototype, "pathname", {
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'pathname' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["pathname"] = V;
|
||||
},
|
||||
}
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "search", {
|
||||
get() {
|
||||
get search() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["search"];
|
||||
},
|
||||
}
|
||||
|
||||
set(V) {
|
||||
set search(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
@@ -267,14 +209,9 @@ Object.defineProperty(URL.prototype, "search", {
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'search' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["search"] = V;
|
||||
},
|
||||
}
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "searchParams", {
|
||||
get() {
|
||||
get searchParams() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
@@ -282,22 +219,17 @@ Object.defineProperty(URL.prototype, "searchParams", {
|
||||
return utils.getSameObject(this, "searchParams", () => {
|
||||
return utils.tryWrapperForImpl(this[impl]["searchParams"]);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "hash", {
|
||||
get() {
|
||||
get hash() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hash"];
|
||||
},
|
||||
}
|
||||
|
||||
set(V) {
|
||||
set hash(V) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
@@ -305,28 +237,37 @@ Object.defineProperty(URL.prototype, "hash", {
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'hash' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["hash"] = V;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}
|
||||
}
|
||||
Object.defineProperties(URL.prototype, {
|
||||
toJSON: { enumerable: true },
|
||||
href: { enumerable: true },
|
||||
toString: { enumerable: true },
|
||||
origin: { enumerable: true },
|
||||
protocol: { enumerable: true },
|
||||
username: { enumerable: true },
|
||||
password: { enumerable: true },
|
||||
host: { enumerable: true },
|
||||
hostname: { enumerable: true },
|
||||
port: { enumerable: true },
|
||||
pathname: { enumerable: true },
|
||||
search: { enumerable: true },
|
||||
searchParams: { enumerable: true },
|
||||
hash: { enumerable: true },
|
||||
[Symbol.toStringTag]: { value: "URL", configurable: true }
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, Symbol.toStringTag, {
|
||||
value: "URL",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
mixedInto: [],
|
||||
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
|
||||
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
|
||||
// implementing this mixin interface.
|
||||
_mixedIntoPredicates: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (obj[impl] instanceof Impl.implementation) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
|
||||
if (obj instanceof module.exports.mixedInto[i]) {
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -340,8 +281,8 @@ const iface = {
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
|
||||
if (wrapper instanceof module.exports.mixedInto[i]) {
|
||||
for (const isMixedInto of module.exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -374,8 +315,6 @@ const iface = {
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
@@ -393,4 +332,4 @@ const iface = {
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require(".//URL-impl.js");
|
||||
const Impl = require("./URL-impl.js");
|
||||
|
Reference in New Issue
Block a user