mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-02 20:00:05 +02:00
update node modules
This commit is contained in:
12
node_modules/whatwg-url/README.md
generated
vendored
12
node_modules/whatwg-url/README.md
generated
vendored
@@ -1,13 +1,15 @@
|
||||
# whatwg-url
|
||||
|
||||
whatwg-url is a full implementation of the WHATWG [URL Standard](https://url.spec.whatwg.org/). It can be used standalone, but it also exposes a lot of the internal algorithms that are useful for integrating a URL parser into a project like [jsdom](https://github.com/tmpvar/jsdom).
|
||||
whatwg-url is a full implementation of the WHATWG [URL Standard](https://url.spec.whatwg.org/). It can be used standalone, but it also exposes a lot of the internal algorithms that are useful for integrating a URL parser into a project like [jsdom](https://github.com/jsdom/jsdom).
|
||||
|
||||
## Specification conformance
|
||||
|
||||
whatwg-url is currently up to date with the URL spec up to commit [cceb435](https://github.com/whatwg/url/commit/cceb4356cca233b6dfdaabd888263157b2204e44).
|
||||
whatwg-url is currently up to date with the URL spec up to commit [0915d88](https://github.com/whatwg/url/commit/0915d886bbf409331857f56e6d2bfd0cb5e01de7).
|
||||
|
||||
For `file:` URLs, whose [origin is left unspecified](https://url.spec.whatwg.org/#concept-url-origin), whatwg-url chooses to use a new opaque origin (which serializes to `"null"`).
|
||||
|
||||
whatwg-url does not yet implement any encoding handling beyond UTF-8. That is, the _encoding override_ parameter does not exist in our API.
|
||||
|
||||
## API
|
||||
|
||||
### The `URL` and `URLSearchParams` classes
|
||||
@@ -18,8 +20,8 @@ The main API is provided by the [`URL`](https://url.spec.whatwg.org/#url-class)
|
||||
|
||||
The following methods are exported for use by places like jsdom that need to implement things like [`HTMLHyperlinkElementUtils`](https://html.spec.whatwg.org/#htmlhyperlinkelementutils). They mostly operate on or return an "internal URL" or ["URL record"](https://url.spec.whatwg.org/#concept-url) type.
|
||||
|
||||
- [URL parser](https://url.spec.whatwg.org/#concept-url-parser): `parseURL(input, { baseURL, encodingOverride })`
|
||||
- [Basic URL parser](https://url.spec.whatwg.org/#concept-basic-url-parser): `basicURLParse(input, { baseURL, encodingOverride, url, stateOverride })`
|
||||
- [URL parser](https://url.spec.whatwg.org/#concept-url-parser): `parseURL(input, { baseURL })`
|
||||
- [Basic URL parser](https://url.spec.whatwg.org/#concept-basic-url-parser): `basicURLParse(input, { baseURL, url, stateOverride })`
|
||||
- [URL serializer](https://url.spec.whatwg.org/#concept-url-serializer): `serializeURL(urlRecord, excludeFragment)`
|
||||
- [Host serializer](https://url.spec.whatwg.org/#concept-host-serializer): `serializeHost(hostFromURLRecord)`
|
||||
- [Serialize an integer](https://url.spec.whatwg.org/#serialize-an-integer): `serializeInteger(number)`
|
||||
@@ -89,7 +91,7 @@ To generate a coverage report:
|
||||
|
||||
To build and run the live viewer:
|
||||
|
||||
npm run build
|
||||
npm run prepare
|
||||
npm run build-live-viewer
|
||||
|
||||
Serve the contents of the `live-viewer` directory using any web server.
|
||||
|
46
node_modules/whatwg-url/dist/Function.js
generated
vendored
Normal file
46
node_modules/whatwg-url/dist/Function.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
exports.convert = (value, { context = "The provided value" } = {}) => {
|
||||
if (typeof value !== "function") {
|
||||
throw new TypeError(context + " is not a function");
|
||||
}
|
||||
|
||||
function invokeTheCallbackFunction(...args) {
|
||||
if (new.target !== undefined) {
|
||||
throw new Error("Internal error: invokeTheCallbackFunction is not a constructor");
|
||||
}
|
||||
|
||||
const thisArg = utils.tryWrapperForImpl(this);
|
||||
let callResult;
|
||||
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
args[i] = utils.tryWrapperForImpl(args[i]);
|
||||
}
|
||||
|
||||
callResult = Reflect.apply(value, thisArg, args);
|
||||
|
||||
callResult = conversions["any"](callResult, { context: context });
|
||||
|
||||
return callResult;
|
||||
}
|
||||
|
||||
invokeTheCallbackFunction.construct = (...args) => {
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
args[i] = utils.tryWrapperForImpl(args[i]);
|
||||
}
|
||||
|
||||
let callResult = Reflect.construct(value, args);
|
||||
|
||||
callResult = conversions["any"](callResult, { context: context });
|
||||
|
||||
return callResult;
|
||||
};
|
||||
|
||||
invokeTheCallbackFunction[utils.wrapperSymbol] = value;
|
||||
invokeTheCallbackFunction.objectReference = value;
|
||||
|
||||
return invokeTheCallbackFunction;
|
||||
};
|
4
node_modules/whatwg-url/lib/URL-impl.js → node_modules/whatwg-url/dist/URL-impl.js
generated
vendored
4
node_modules/whatwg-url/lib/URL-impl.js → node_modules/whatwg-url/dist/URL-impl.js
generated
vendored
@@ -46,7 +46,7 @@ exports.implementation = class URLImpl {
|
||||
this._query._list.splice(0);
|
||||
const { query } = parsedURL;
|
||||
if (query !== null) {
|
||||
this._query._list = urlencoded.parseUrlencoded(query);
|
||||
this._query._list = urlencoded.parseUrlencodedString(query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ exports.implementation = class URLImpl {
|
||||
const input = v[0] === "?" ? v.substring(1) : v;
|
||||
url.query = "";
|
||||
usm.basicURLParse(input, { url, stateOverride: "query" });
|
||||
this._query._list = urlencoded.parseUrlencoded(input);
|
||||
this._query._list = urlencoded.parseUrlencodedString(input);
|
||||
}
|
||||
|
||||
get searchParams() {
|
417
node_modules/whatwg-url/dist/URL.js
generated
vendored
Normal file
417
node_modules/whatwg-url/dist/URL.js
generated
vendored
Normal file
@@ -0,0 +1,417 @@
|
||||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const implSymbol = utils.implSymbol;
|
||||
const ctorRegistrySymbol = utils.ctorRegistrySymbol;
|
||||
|
||||
const interfaceName = "URL";
|
||||
|
||||
exports.is = value => {
|
||||
return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation;
|
||||
};
|
||||
exports.isImpl = value => {
|
||||
return utils.isObject(value) && value instanceof Impl.implementation;
|
||||
};
|
||||
exports.convert = (value, { context = "The provided value" } = {}) => {
|
||||
if (exports.is(value)) {
|
||||
return utils.implForWrapper(value);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'URL'.`);
|
||||
};
|
||||
|
||||
function makeWrapper(globalObject) {
|
||||
if (globalObject[ctorRegistrySymbol] === undefined) {
|
||||
throw new Error("Internal error: invalid global object");
|
||||
}
|
||||
|
||||
const ctor = globalObject[ctorRegistrySymbol]["URL"];
|
||||
if (ctor === undefined) {
|
||||
throw new Error("Internal error: constructor URL is not installed on the passed global object");
|
||||
}
|
||||
|
||||
return Object.create(ctor.prototype);
|
||||
}
|
||||
|
||||
exports.create = (globalObject, constructorArgs, privateData) => {
|
||||
const wrapper = makeWrapper(globalObject);
|
||||
return exports.setup(wrapper, globalObject, constructorArgs, privateData);
|
||||
};
|
||||
|
||||
exports.createImpl = (globalObject, constructorArgs, privateData) => {
|
||||
const wrapper = exports.create(globalObject, constructorArgs, privateData);
|
||||
return utils.implForWrapper(wrapper);
|
||||
};
|
||||
|
||||
exports._internalSetup = (wrapper, globalObject) => {};
|
||||
|
||||
exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => {
|
||||
privateData.wrapper = wrapper;
|
||||
|
||||
exports._internalSetup(wrapper, globalObject);
|
||||
Object.defineProperty(wrapper, implSymbol, {
|
||||
value: new Impl.implementation(globalObject, constructorArgs, privateData),
|
||||
configurable: true
|
||||
});
|
||||
|
||||
wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
|
||||
if (Impl.init) {
|
||||
Impl.init(wrapper[implSymbol]);
|
||||
}
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
exports.new = globalObject => {
|
||||
const wrapper = makeWrapper(globalObject);
|
||||
|
||||
exports._internalSetup(wrapper, globalObject);
|
||||
Object.defineProperty(wrapper, implSymbol, {
|
||||
value: Object.create(Impl.implementation.prototype),
|
||||
configurable: true
|
||||
});
|
||||
|
||||
wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
|
||||
if (Impl.init) {
|
||||
Impl.init(wrapper[implSymbol]);
|
||||
}
|
||||
return wrapper[implSymbol];
|
||||
};
|
||||
|
||||
const exposed = new Set(["Window", "Worker"]);
|
||||
|
||||
exports.install = (globalObject, globalNames) => {
|
||||
if (!globalNames.some(globalName => exposed.has(globalName))) {
|
||||
return;
|
||||
}
|
||||
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 exports.setup(Object.create(new.target.prototype), globalObject, args);
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'toJSON' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol].toJSON();
|
||||
}
|
||||
|
||||
get href() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get href' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["href"];
|
||||
}
|
||||
|
||||
set href(V) {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'set href' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'href' property on 'URL': The provided value" });
|
||||
|
||||
esValue[implSymbol]["href"] = V;
|
||||
}
|
||||
|
||||
toString() {
|
||||
const esValue = this;
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'toString' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["href"];
|
||||
}
|
||||
|
||||
get origin() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get origin' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["origin"];
|
||||
}
|
||||
|
||||
get protocol() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get protocol' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["protocol"];
|
||||
}
|
||||
|
||||
set protocol(V) {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'set protocol' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'protocol' property on 'URL': The provided value"
|
||||
});
|
||||
|
||||
esValue[implSymbol]["protocol"] = V;
|
||||
}
|
||||
|
||||
get username() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get username' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["username"];
|
||||
}
|
||||
|
||||
set username(V) {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'set username' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'username' property on 'URL': The provided value"
|
||||
});
|
||||
|
||||
esValue[implSymbol]["username"] = V;
|
||||
}
|
||||
|
||||
get password() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get password' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["password"];
|
||||
}
|
||||
|
||||
set password(V) {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'set password' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'password' property on 'URL': The provided value"
|
||||
});
|
||||
|
||||
esValue[implSymbol]["password"] = V;
|
||||
}
|
||||
|
||||
get host() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get host' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["host"];
|
||||
}
|
||||
|
||||
set host(V) {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'set host' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'host' property on 'URL': The provided value" });
|
||||
|
||||
esValue[implSymbol]["host"] = V;
|
||||
}
|
||||
|
||||
get hostname() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get hostname' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["hostname"];
|
||||
}
|
||||
|
||||
set hostname(V) {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'set hostname' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'hostname' property on 'URL': The provided value"
|
||||
});
|
||||
|
||||
esValue[implSymbol]["hostname"] = V;
|
||||
}
|
||||
|
||||
get port() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get port' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["port"];
|
||||
}
|
||||
|
||||
set port(V) {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'set port' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'port' property on 'URL': The provided value" });
|
||||
|
||||
esValue[implSymbol]["port"] = V;
|
||||
}
|
||||
|
||||
get pathname() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get pathname' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["pathname"];
|
||||
}
|
||||
|
||||
set pathname(V) {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'set pathname' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'pathname' property on 'URL': The provided value"
|
||||
});
|
||||
|
||||
esValue[implSymbol]["pathname"] = V;
|
||||
}
|
||||
|
||||
get search() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get search' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["search"];
|
||||
}
|
||||
|
||||
set search(V) {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'set search' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'search' property on 'URL': The provided value" });
|
||||
|
||||
esValue[implSymbol]["search"] = V;
|
||||
}
|
||||
|
||||
get searchParams() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get searchParams' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return utils.getSameObject(this, "searchParams", () => {
|
||||
return utils.tryWrapperForImpl(esValue[implSymbol]["searchParams"]);
|
||||
});
|
||||
}
|
||||
|
||||
get hash() {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get hash' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
return esValue[implSymbol]["hash"];
|
||||
}
|
||||
|
||||
set hash(V) {
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'set hash' called on an object that is not a valid instance of URL.");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'hash' property on 'URL': The provided value" });
|
||||
|
||||
esValue[implSymbol]["hash"] = V;
|
||||
}
|
||||
}
|
||||
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 }
|
||||
});
|
||||
if (globalObject[ctorRegistrySymbol] === undefined) {
|
||||
globalObject[ctorRegistrySymbol] = Object.create(null);
|
||||
}
|
||||
globalObject[ctorRegistrySymbol][interfaceName] = URL;
|
||||
|
||||
Object.defineProperty(globalObject, interfaceName, {
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: URL
|
||||
});
|
||||
|
||||
if (globalNames.includes("Window")) {
|
||||
Object.defineProperty(globalObject, "webkitURL", {
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: URL
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const Impl = require("./URL-impl.js");
|
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
const stableSortBy = require("lodash.sortby");
|
||||
const stableSortBy = require("lodash/sortBy");
|
||||
const urlencoded = require("./urlencoded");
|
||||
|
||||
exports.implementation = class URLSearchParamsImpl {
|
||||
@@ -26,7 +26,7 @@ exports.implementation = class URLSearchParamsImpl {
|
||||
this._list.push([name, value]);
|
||||
}
|
||||
} else {
|
||||
this._list = urlencoded.parseUrlencoded(init);
|
||||
this._list = urlencoded.parseUrlencodedString(init);
|
||||
}
|
||||
}
|
||||
|
@@ -3,17 +3,22 @@
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const ctorRegistry = utils.ctorRegistrySymbol;
|
||||
const Function = require("./Function.js");
|
||||
const implSymbol = utils.implSymbol;
|
||||
const ctorRegistrySymbol = utils.ctorRegistrySymbol;
|
||||
|
||||
const interfaceName = "URLSearchParams";
|
||||
|
||||
const IteratorPrototype = Object.create(utils.IteratorPrototype, {
|
||||
next: {
|
||||
value: function next() {
|
||||
const internal = this[utils.iterInternalSymbol];
|
||||
const internal = this && this[utils.iterInternalSymbol];
|
||||
if (!internal) {
|
||||
throw new TypeError("next() called on a value that is not an iterator prototype object");
|
||||
}
|
||||
|
||||
const { target, kind, index } = internal;
|
||||
const values = Array.from(target[impl]);
|
||||
const values = Array.from(target[implSymbol]);
|
||||
const len = values.length;
|
||||
if (index >= len) {
|
||||
return { value: undefined, done: true };
|
||||
@@ -21,21 +26,7 @@ const IteratorPrototype = Object.create(utils.IteratorPrototype, {
|
||||
|
||||
const pair = values[index];
|
||||
internal.index = index + 1;
|
||||
const [key, value] = pair.map(utils.tryWrapperForImpl);
|
||||
|
||||
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 };
|
||||
return utils.iteratorResult(pair.map(utils.tryWrapperForImpl), kind);
|
||||
},
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
@@ -47,48 +38,20 @@ const IteratorPrototype = Object.create(utils.IteratorPrototype, {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
exports._mixedIntoPredicates = [];
|
||||
exports.is = function is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
exports.is = value => {
|
||||
return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation;
|
||||
};
|
||||
exports.isImpl = function isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
exports.isImpl = value => {
|
||||
return utils.isObject(value) && value instanceof Impl.implementation;
|
||||
};
|
||||
exports.convert = function convert(obj, { context = "The provided value" } = {}) {
|
||||
if (exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
exports.convert = (value, { context = "The provided value" } = {}) => {
|
||||
if (exports.is(value)) {
|
||||
return utils.implForWrapper(value);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'URLSearchParams'.`);
|
||||
};
|
||||
|
||||
exports.createDefaultIterator = function createDefaultIterator(target, kind) {
|
||||
exports.createDefaultIterator = (target, kind) => {
|
||||
const iterator = Object.create(IteratorPrototype);
|
||||
Object.defineProperty(iterator, utils.iterInternalSymbol, {
|
||||
value: { target, kind, index: 0 },
|
||||
@@ -97,42 +60,69 @@ exports.createDefaultIterator = function createDefaultIterator(target, kind) {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
exports.create = function create(globalObject, constructorArgs, privateData) {
|
||||
if (globalObject[ctorRegistry] === undefined) {
|
||||
function makeWrapper(globalObject) {
|
||||
if (globalObject[ctorRegistrySymbol] === undefined) {
|
||||
throw new Error("Internal error: invalid global object");
|
||||
}
|
||||
|
||||
const ctor = globalObject[ctorRegistry]["URLSearchParams"];
|
||||
const ctor = globalObject[ctorRegistrySymbol]["URLSearchParams"];
|
||||
if (ctor === undefined) {
|
||||
throw new Error("Internal error: constructor URLSearchParams is not installed on the passed global object");
|
||||
}
|
||||
|
||||
let obj = Object.create(ctor.prototype);
|
||||
obj = exports.setup(obj, globalObject, constructorArgs, privateData);
|
||||
return obj;
|
||||
};
|
||||
exports.createImpl = function createImpl(globalObject, constructorArgs, privateData) {
|
||||
const obj = exports.create(globalObject, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
};
|
||||
exports._internalSetup = function _internalSetup(obj) {};
|
||||
exports.setup = function setup(obj, globalObject, constructorArgs = [], privateData = {}) {
|
||||
privateData.wrapper = obj;
|
||||
return Object.create(ctor.prototype);
|
||||
}
|
||||
|
||||
exports._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
exports.create = (globalObject, constructorArgs, privateData) => {
|
||||
const wrapper = makeWrapper(globalObject);
|
||||
return exports.setup(wrapper, globalObject, constructorArgs, privateData);
|
||||
};
|
||||
|
||||
exports.createImpl = (globalObject, constructorArgs, privateData) => {
|
||||
const wrapper = exports.create(globalObject, constructorArgs, privateData);
|
||||
return utils.implForWrapper(wrapper);
|
||||
};
|
||||
|
||||
exports._internalSetup = (wrapper, globalObject) => {};
|
||||
|
||||
exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => {
|
||||
privateData.wrapper = wrapper;
|
||||
|
||||
exports._internalSetup(wrapper, globalObject);
|
||||
Object.defineProperty(wrapper, implSymbol, {
|
||||
value: new Impl.implementation(globalObject, constructorArgs, privateData),
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
Impl.init(wrapper[implSymbol]);
|
||||
}
|
||||
return obj;
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
exports.install = function install(globalObject) {
|
||||
exports.new = globalObject => {
|
||||
const wrapper = makeWrapper(globalObject);
|
||||
|
||||
exports._internalSetup(wrapper, globalObject);
|
||||
Object.defineProperty(wrapper, implSymbol, {
|
||||
value: Object.create(Impl.implementation.prototype),
|
||||
configurable: true
|
||||
});
|
||||
|
||||
wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
|
||||
if (Impl.init) {
|
||||
Impl.init(wrapper[implSymbol]);
|
||||
}
|
||||
return wrapper[implSymbol];
|
||||
};
|
||||
|
||||
const exposed = new Set(["Window", "Worker"]);
|
||||
|
||||
exports.install = (globalObject, globalNames) => {
|
||||
if (!globalNames.some(globalName => exposed.has(globalName))) {
|
||||
return;
|
||||
}
|
||||
class URLSearchParams {
|
||||
constructor() {
|
||||
const args = [];
|
||||
@@ -219,8 +209,9 @@ exports.install = function install(globalObject) {
|
||||
}
|
||||
|
||||
append(name, value) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'append' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
@@ -245,12 +236,13 @@ exports.install = function install(globalObject) {
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].append(...args);
|
||||
return esValue[implSymbol].append(...args);
|
||||
}
|
||||
|
||||
delete(name) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'delete' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
@@ -268,12 +260,13 @@ exports.install = function install(globalObject) {
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].delete(...args);
|
||||
return esValue[implSymbol].delete(...args);
|
||||
}
|
||||
|
||||
get(name) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'get' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
@@ -291,12 +284,13 @@ exports.install = function install(globalObject) {
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].get(...args);
|
||||
return esValue[implSymbol].get(...args);
|
||||
}
|
||||
|
||||
getAll(name) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'getAll' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
@@ -314,12 +308,13 @@ exports.install = function install(globalObject) {
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(this[impl].getAll(...args));
|
||||
return utils.tryWrapperForImpl(esValue[implSymbol].getAll(...args));
|
||||
}
|
||||
|
||||
has(name) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'has' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
@@ -337,12 +332,13 @@ exports.install = function install(globalObject) {
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].has(...args);
|
||||
return esValue[implSymbol].has(...args);
|
||||
}
|
||||
|
||||
set(name, value) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'set' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
@@ -367,65 +363,65 @@ exports.install = function install(globalObject) {
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return this[impl].set(...args);
|
||||
return esValue[implSymbol].set(...args);
|
||||
}
|
||||
|
||||
sort() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'sort' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
|
||||
return this[impl].sort();
|
||||
return esValue[implSymbol].sort();
|
||||
}
|
||||
|
||||
toString() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
const esValue = this !== null && this !== undefined ? this : globalObject;
|
||||
if (!exports.is(esValue)) {
|
||||
throw new TypeError("'toString' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
|
||||
return this[impl].toString();
|
||||
return esValue[implSymbol].toString();
|
||||
}
|
||||
|
||||
keys() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
if (!exports.is(this)) {
|
||||
throw new TypeError("'keys' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
return exports.createDefaultIterator(this, "key");
|
||||
}
|
||||
|
||||
values() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
if (!exports.is(this)) {
|
||||
throw new TypeError("'values' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
return exports.createDefaultIterator(this, "value");
|
||||
}
|
||||
|
||||
entries() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
if (!exports.is(this)) {
|
||||
throw new TypeError("'entries' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
return exports.createDefaultIterator(this, "key+value");
|
||||
}
|
||||
|
||||
forEach(callback) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
if (!exports.is(this)) {
|
||||
throw new TypeError("'forEach' called on an object that is not a valid instance of URLSearchParams.");
|
||||
}
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError("Failed to execute 'forEach' on 'iterable': 1 argument required, " + "but only 0 present.");
|
||||
}
|
||||
if (typeof callback !== "function") {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'forEach' on 'iterable': The callback provided " + "as parameter 1 is not a function."
|
||||
);
|
||||
}
|
||||
callback = Function.convert(callback, {
|
||||
context: "Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1"
|
||||
});
|
||||
const thisArg = arguments[1];
|
||||
let pairs = Array.from(this[impl]);
|
||||
let pairs = Array.from(this[implSymbol]);
|
||||
let i = 0;
|
||||
while (i < pairs.length) {
|
||||
const [key, value] = pairs[i].map(utils.tryWrapperForImpl);
|
||||
callback.call(thisArg, value, key, this);
|
||||
pairs = Array.from(this[impl]);
|
||||
pairs = Array.from(this[implSymbol]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -446,10 +442,10 @@ exports.install = function install(globalObject) {
|
||||
[Symbol.toStringTag]: { value: "URLSearchParams", configurable: true },
|
||||
[Symbol.iterator]: { value: URLSearchParams.prototype.entries, configurable: true, writable: true }
|
||||
});
|
||||
if (globalObject[ctorRegistry] === undefined) {
|
||||
globalObject[ctorRegistry] = Object.create(null);
|
||||
if (globalObject[ctorRegistrySymbol] === undefined) {
|
||||
globalObject[ctorRegistrySymbol] = Object.create(null);
|
||||
}
|
||||
globalObject[ctorRegistry][interfaceName] = URLSearchParams;
|
||||
globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParams;
|
||||
|
||||
Object.defineProperty(globalObject, interfaceName, {
|
||||
configurable: true,
|
30
node_modules/whatwg-url/dist/VoidFunction.js
generated
vendored
Normal file
30
node_modules/whatwg-url/dist/VoidFunction.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
exports.convert = (value, { context = "The provided value" } = {}) => {
|
||||
if (typeof value !== "function") {
|
||||
throw new TypeError(context + " is not a function");
|
||||
}
|
||||
|
||||
function invokeTheCallbackFunction() {
|
||||
if (new.target !== undefined) {
|
||||
throw new Error("Internal error: invokeTheCallbackFunction is not a constructor");
|
||||
}
|
||||
|
||||
const thisArg = utils.tryWrapperForImpl(this);
|
||||
let callResult;
|
||||
|
||||
callResult = Reflect.apply(value, thisArg, []);
|
||||
}
|
||||
|
||||
invokeTheCallbackFunction.construct = () => {
|
||||
let callResult = Reflect.construct(value, []);
|
||||
};
|
||||
|
||||
invokeTheCallbackFunction[utils.wrapperSymbol] = value;
|
||||
invokeTheCallbackFunction.objectReference = value;
|
||||
|
||||
return invokeTheCallbackFunction;
|
||||
};
|
26
node_modules/whatwg-url/dist/encoding.js
generated
vendored
Normal file
26
node_modules/whatwg-url/dist/encoding.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
let { TextEncoder, TextDecoder } = require("util");
|
||||
// Handle browserify's lack of support (https://github.com/browserify/node-util/issues/46), which
|
||||
// is important for the live viewer:
|
||||
if (!TextEncoder) {
|
||||
TextEncoder = global.TextEncoder;
|
||||
}
|
||||
if (!TextDecoder) {
|
||||
TextDecoder = global.TextDecoder;
|
||||
}
|
||||
|
||||
const utf8Encoder = new TextEncoder();
|
||||
const utf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
||||
|
||||
function utf8Encode(string) {
|
||||
return utf8Encoder.encode(string);
|
||||
}
|
||||
|
||||
function utf8DecodeWithoutBOM(bytes) {
|
||||
return utf8Decoder.decode(bytes);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
utf8Encode,
|
||||
utf8DecodeWithoutBOM
|
||||
};
|
2
node_modules/whatwg-url/lib/infra.js → node_modules/whatwg-url/dist/infra.js
generated
vendored
2
node_modules/whatwg-url/lib/infra.js → node_modules/whatwg-url/dist/infra.js
generated
vendored
@@ -1,5 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
// Note that we take code points as JS numbers, not JS strings.
|
||||
|
||||
function isASCIIDigit(c) {
|
||||
return c >= 0x30 && c <= 0x39;
|
||||
}
|
141
node_modules/whatwg-url/dist/percent-encoding.js
generated
vendored
Normal file
141
node_modules/whatwg-url/dist/percent-encoding.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
"use strict";
|
||||
const { isASCIIHex } = require("./infra");
|
||||
const { utf8Encode } = require("./encoding");
|
||||
|
||||
// https://url.spec.whatwg.org/#percent-encode
|
||||
function percentEncode(c) {
|
||||
let hex = c.toString(16).toUpperCase();
|
||||
if (hex.length === 1) {
|
||||
hex = "0" + hex;
|
||||
}
|
||||
|
||||
return "%" + hex;
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#percent-decode
|
||||
function percentDecodeBytes(input) {
|
||||
const output = new Uint8Array(input.byteLength);
|
||||
let outputIndex = 0;
|
||||
for (let i = 0; i < input.byteLength; ++i) {
|
||||
const byte = input[i];
|
||||
if (byte !== 0x25) {
|
||||
output[outputIndex++] = byte;
|
||||
} else if (byte === 0x25 && (!isASCIIHex(input[i + 1]) || !isASCIIHex(input[i + 2]))) {
|
||||
output[outputIndex++] = byte;
|
||||
} else {
|
||||
const bytePoint = parseInt(String.fromCodePoint(input[i + 1], input[i + 2]), 16);
|
||||
output[outputIndex++] = bytePoint;
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: remove the Buffer.from in the next major version; it's only needed for back-compat, and sticking to standard
|
||||
// typed arrays is nicer and simpler.
|
||||
// See https://github.com/jsdom/data-urls/issues/17 for background.
|
||||
return Buffer.from(output.slice(0, outputIndex));
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#string-percent-decode
|
||||
function percentDecodeString(input) {
|
||||
const bytes = utf8Encode(input);
|
||||
return percentDecodeBytes(bytes);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#c0-control-percent-encode-set
|
||||
function isC0ControlPercentEncode(c) {
|
||||
return c <= 0x1F || c > 0x7E;
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#fragment-percent-encode-set
|
||||
const extraFragmentPercentEncodeSet = new Set([32, 34, 60, 62, 96]);
|
||||
function isFragmentPercentEncode(c) {
|
||||
return isC0ControlPercentEncode(c) || extraFragmentPercentEncodeSet.has(c);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#query-percent-encode-set
|
||||
const extraQueryPercentEncodeSet = new Set([32, 34, 35, 60, 62]);
|
||||
function isQueryPercentEncode(c) {
|
||||
return isC0ControlPercentEncode(c) || extraQueryPercentEncodeSet.has(c);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#special-query-percent-encode-set
|
||||
function isSpecialQueryPercentEncode(c) {
|
||||
return isQueryPercentEncode(c) || c === 39;
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#path-percent-encode-set
|
||||
const extraPathPercentEncodeSet = new Set([63, 96, 123, 125]);
|
||||
function isPathPercentEncode(c) {
|
||||
return isQueryPercentEncode(c) || extraPathPercentEncodeSet.has(c);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#userinfo-percent-encode-set
|
||||
const extraUserinfoPercentEncodeSet =
|
||||
new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]);
|
||||
function isUserinfoPercentEncode(c) {
|
||||
return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#component-percent-encode-set
|
||||
const extraComponentPercentEncodeSet = new Set([36, 37, 38, 43, 44]);
|
||||
function isComponentPercentEncode(c) {
|
||||
return isUserinfoPercentEncode(c) || extraComponentPercentEncodeSet.has(c);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set
|
||||
const extraURLEncodedPercentEncodeSet = new Set([33, 39, 40, 41, 126]);
|
||||
function isURLEncodedPercentEncode(c) {
|
||||
return isComponentPercentEncode(c) || extraURLEncodedPercentEncodeSet.has(c);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#code-point-percent-encode-after-encoding
|
||||
// https://url.spec.whatwg.org/#utf-8-percent-encode
|
||||
// Assuming encoding is always utf-8 allows us to trim one of the logic branches. TODO: support encoding.
|
||||
// The "-Internal" variant here has code points as JS strings. The external version used by other files has code points
|
||||
// as JS numbers, like the rest of the codebase.
|
||||
function utf8PercentEncodeCodePointInternal(codePoint, percentEncodePredicate) {
|
||||
const bytes = utf8Encode(codePoint);
|
||||
let output = "";
|
||||
for (const byte of bytes) {
|
||||
// Our percentEncodePredicate operates on bytes, not code points, so this is slightly different from the spec.
|
||||
if (!percentEncodePredicate(byte)) {
|
||||
output += String.fromCharCode(byte);
|
||||
} else {
|
||||
output += percentEncode(byte);
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function utf8PercentEncodeCodePoint(codePoint, percentEncodePredicate) {
|
||||
return utf8PercentEncodeCodePointInternal(String.fromCodePoint(codePoint), percentEncodePredicate);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#string-percent-encode-after-encoding
|
||||
// https://url.spec.whatwg.org/#string-utf-8-percent-encode
|
||||
function utf8PercentEncodeString(input, percentEncodePredicate, spaceAsPlus = false) {
|
||||
let output = "";
|
||||
for (const codePoint of input) {
|
||||
if (spaceAsPlus && codePoint === " ") {
|
||||
output += "+";
|
||||
} else {
|
||||
output += utf8PercentEncodeCodePointInternal(codePoint, percentEncodePredicate);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isC0ControlPercentEncode,
|
||||
isFragmentPercentEncode,
|
||||
isQueryPercentEncode,
|
||||
isSpecialQueryPercentEncode,
|
||||
isPathPercentEncode,
|
||||
isUserinfoPercentEncode,
|
||||
isURLEncodedPercentEncode,
|
||||
percentDecodeString,
|
||||
percentDecodeBytes,
|
||||
utf8PercentEncodeString,
|
||||
utf8PercentEncodeCodePoint
|
||||
};
|
@@ -3,7 +3,10 @@ const punycode = require("punycode");
|
||||
const tr46 = require("tr46");
|
||||
|
||||
const infra = require("./infra");
|
||||
const { percentEncode, percentDecode } = require("./urlencoded");
|
||||
const { utf8DecodeWithoutBOM } = require("./encoding");
|
||||
const { percentDecodeString, utf8PercentEncodeCodePoint, utf8PercentEncodeString, isC0ControlPercentEncode,
|
||||
isFragmentPercentEncode, isQueryPercentEncode, isSpecialQueryPercentEncode, isPathPercentEncode,
|
||||
isUserinfoPercentEncode } = require("./percent-encoding");
|
||||
|
||||
const specialSchemes = {
|
||||
ftp: 21,
|
||||
@@ -17,7 +20,7 @@ const specialSchemes = {
|
||||
const failure = Symbol("failure");
|
||||
|
||||
function countSymbols(str) {
|
||||
return punycode.ucs2.decode(str).length;
|
||||
return [...str].length;
|
||||
}
|
||||
|
||||
function at(input, idx) {
|
||||
@@ -47,11 +50,11 @@ function isNormalizedWindowsDriveLetterString(string) {
|
||||
}
|
||||
|
||||
function containsForbiddenHostCodePoint(string) {
|
||||
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1;
|
||||
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/) !== -1;
|
||||
}
|
||||
|
||||
function containsForbiddenHostCodePointExcludingPercent(string) {
|
||||
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1;
|
||||
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/) !== -1;
|
||||
}
|
||||
|
||||
function isSpecialScheme(scheme) {
|
||||
@@ -70,48 +73,6 @@ function defaultPort(scheme) {
|
||||
return specialSchemes[scheme];
|
||||
}
|
||||
|
||||
function utf8PercentEncode(c) {
|
||||
const buf = Buffer.from(c);
|
||||
|
||||
let str = "";
|
||||
|
||||
for (let i = 0; i < buf.length; ++i) {
|
||||
str += percentEncode(buf[i]);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function isC0ControlPercentEncode(c) {
|
||||
return c <= 0x1F || c > 0x7E;
|
||||
}
|
||||
|
||||
const extraUserinfoPercentEncodeSet =
|
||||
new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]);
|
||||
function isUserinfoPercentEncode(c) {
|
||||
return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c);
|
||||
}
|
||||
|
||||
const extraFragmentPercentEncodeSet = new Set([32, 34, 60, 62, 96]);
|
||||
function isFragmentPercentEncode(c) {
|
||||
return isC0ControlPercentEncode(c) || extraFragmentPercentEncodeSet.has(c);
|
||||
}
|
||||
|
||||
const extraPathPercentEncodeSet = new Set([35, 63, 123, 125]);
|
||||
function isPathPercentEncode(c) {
|
||||
return isFragmentPercentEncode(c) || extraPathPercentEncodeSet.has(c);
|
||||
}
|
||||
|
||||
function percentEncodeChar(c, encodeSetPredicate) {
|
||||
const cStr = String.fromCodePoint(c);
|
||||
|
||||
if (encodeSetPredicate(c)) {
|
||||
return utf8PercentEncode(cStr);
|
||||
}
|
||||
|
||||
return cStr;
|
||||
}
|
||||
|
||||
function parseIPv4Number(input) {
|
||||
let R = 10;
|
||||
|
||||
@@ -333,8 +294,7 @@ function parseIPv6(input) {
|
||||
|
||||
function serializeIPv6(address) {
|
||||
let output = "";
|
||||
const seqResult = findLongestZeroSequence(address);
|
||||
const compress = seqResult.idx;
|
||||
const compress = findLongestZeroSequence(address);
|
||||
let ignore0 = false;
|
||||
|
||||
for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) {
|
||||
@@ -374,7 +334,7 @@ function parseHost(input, isNotSpecialArg = false) {
|
||||
return parseOpaqueHost(input);
|
||||
}
|
||||
|
||||
const domain = percentDecode(Buffer.from(input)).toString();
|
||||
const domain = utf8DecodeWithoutBOM(percentDecodeString(input));
|
||||
const asciiDomain = domainToASCII(domain);
|
||||
if (asciiDomain === failure) {
|
||||
return failure;
|
||||
@@ -397,12 +357,7 @@ function parseOpaqueHost(input) {
|
||||
return failure;
|
||||
}
|
||||
|
||||
let output = "";
|
||||
const decoded = punycode.ucs2.decode(input);
|
||||
for (let i = 0; i < decoded.length; ++i) {
|
||||
output += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
|
||||
}
|
||||
return output;
|
||||
return utf8PercentEncodeString(input, isC0ControlPercentEncode);
|
||||
}
|
||||
|
||||
function findLongestZeroSequence(arr) {
|
||||
@@ -430,14 +385,10 @@ function findLongestZeroSequence(arr) {
|
||||
|
||||
// if trailing zeros
|
||||
if (currLen > maxLen) {
|
||||
maxIdx = currStart;
|
||||
maxLen = currLen;
|
||||
return currStart;
|
||||
}
|
||||
|
||||
return {
|
||||
idx: maxIdx,
|
||||
len: maxLen
|
||||
};
|
||||
return maxIdx;
|
||||
}
|
||||
|
||||
function serializeHost(host) {
|
||||
@@ -592,7 +543,7 @@ URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) {
|
||||
if (this.url.scheme === "file" && this.url.host === "") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -680,32 +631,8 @@ URLStateMachine.prototype["parse path or authority"] = function parsePathOrAutho
|
||||
|
||||
URLStateMachine.prototype["parse relative"] = function parseRelative(c) {
|
||||
this.url.scheme = this.base.scheme;
|
||||
if (isNaN(c)) {
|
||||
this.url.username = this.base.username;
|
||||
this.url.password = this.base.password;
|
||||
this.url.host = this.base.host;
|
||||
this.url.port = this.base.port;
|
||||
this.url.path = this.base.path.slice();
|
||||
this.url.query = this.base.query;
|
||||
} else if (c === 47) {
|
||||
if (c === 47) {
|
||||
this.state = "relative slash";
|
||||
} else if (c === 63) {
|
||||
this.url.username = this.base.username;
|
||||
this.url.password = this.base.password;
|
||||
this.url.host = this.base.host;
|
||||
this.url.port = this.base.port;
|
||||
this.url.path = this.base.path.slice();
|
||||
this.url.query = "";
|
||||
this.state = "query";
|
||||
} else if (c === 35) {
|
||||
this.url.username = this.base.username;
|
||||
this.url.password = this.base.password;
|
||||
this.url.host = this.base.host;
|
||||
this.url.port = this.base.port;
|
||||
this.url.path = this.base.path.slice();
|
||||
this.url.query = this.base.query;
|
||||
this.url.fragment = "";
|
||||
this.state = "fragment";
|
||||
} else if (isSpecial(this.url) && c === 92) {
|
||||
this.parseError = true;
|
||||
this.state = "relative slash";
|
||||
@@ -714,10 +641,20 @@ URLStateMachine.prototype["parse relative"] = function parseRelative(c) {
|
||||
this.url.password = this.base.password;
|
||||
this.url.host = this.base.host;
|
||||
this.url.port = this.base.port;
|
||||
this.url.path = this.base.path.slice(0, this.base.path.length - 1);
|
||||
|
||||
this.state = "path";
|
||||
--this.pointer;
|
||||
this.url.path = this.base.path.slice();
|
||||
this.url.query = this.base.query;
|
||||
if (c === 63) {
|
||||
this.url.query = "";
|
||||
this.state = "query";
|
||||
} else if (c === 35) {
|
||||
this.url.fragment = "";
|
||||
this.state = "fragment";
|
||||
} else if (!isNaN(c)) {
|
||||
this.url.query = null;
|
||||
this.url.path.pop();
|
||||
this.state = "path";
|
||||
--this.pointer;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -784,7 +721,7 @@ URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr)
|
||||
this.passwordTokenSeenFlag = true;
|
||||
continue;
|
||||
}
|
||||
const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode);
|
||||
const encodedCodePoints = utf8PercentEncodeCodePoint(codePoint, isUserinfoPercentEncode);
|
||||
if (this.passwordTokenSeenFlag) {
|
||||
this.url.password += encodedCodePoints;
|
||||
} else {
|
||||
@@ -904,6 +841,7 @@ function startsWithWindowsDriveLetter(input, pointer) {
|
||||
|
||||
URLStateMachine.prototype["parse file"] = function parseFile(c) {
|
||||
this.url.scheme = "file";
|
||||
this.url.host = "";
|
||||
|
||||
if (c === 47 || c === 92) {
|
||||
if (c === 92) {
|
||||
@@ -911,28 +849,22 @@ URLStateMachine.prototype["parse file"] = function parseFile(c) {
|
||||
}
|
||||
this.state = "file slash";
|
||||
} else if (this.base !== null && this.base.scheme === "file") {
|
||||
if (isNaN(c)) {
|
||||
this.url.host = this.base.host;
|
||||
this.url.path = this.base.path.slice();
|
||||
this.url.query = this.base.query;
|
||||
} else if (c === 63) {
|
||||
this.url.host = this.base.host;
|
||||
this.url.path = this.base.path.slice();
|
||||
this.url.host = this.base.host;
|
||||
this.url.path = this.base.path.slice();
|
||||
this.url.query = this.base.query;
|
||||
if (c === 63) {
|
||||
this.url.query = "";
|
||||
this.state = "query";
|
||||
} else if (c === 35) {
|
||||
this.url.host = this.base.host;
|
||||
this.url.path = this.base.path.slice();
|
||||
this.url.query = this.base.query;
|
||||
this.url.fragment = "";
|
||||
this.state = "fragment";
|
||||
} else {
|
||||
} else if (!isNaN(c)) {
|
||||
this.url.query = null;
|
||||
if (!startsWithWindowsDriveLetter(this.input, this.pointer)) {
|
||||
this.url.host = this.base.host;
|
||||
this.url.path = this.base.path.slice();
|
||||
shortenPath(this.url);
|
||||
} else {
|
||||
this.parseError = true;
|
||||
this.url.path = [];
|
||||
}
|
||||
|
||||
this.state = "path";
|
||||
@@ -953,13 +885,12 @@ URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) {
|
||||
}
|
||||
this.state = "file host";
|
||||
} else {
|
||||
if (this.base !== null && this.base.scheme === "file" &&
|
||||
!startsWithWindowsDriveLetter(this.input, this.pointer)) {
|
||||
if (isNormalizedWindowsDriveLetterString(this.base.path[0])) {
|
||||
if (this.base !== null && this.base.scheme === "file") {
|
||||
if (!startsWithWindowsDriveLetter(this.input, this.pointer) &&
|
||||
isNormalizedWindowsDriveLetterString(this.base.path[0])) {
|
||||
this.url.path.push(this.base.path[0]);
|
||||
} else {
|
||||
this.url.host = this.base.host;
|
||||
}
|
||||
this.url.host = this.base.host;
|
||||
}
|
||||
this.state = "path";
|
||||
--this.pointer;
|
||||
@@ -1047,21 +978,11 @@ URLStateMachine.prototype["parse path"] = function parsePath(c) {
|
||||
this.url.path.push("");
|
||||
} else if (!isSingleDot(this.buffer)) {
|
||||
if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) {
|
||||
if (this.url.host !== "" && this.url.host !== null) {
|
||||
this.parseError = true;
|
||||
this.url.host = "";
|
||||
}
|
||||
this.buffer = this.buffer[0] + ":";
|
||||
}
|
||||
this.url.path.push(this.buffer);
|
||||
}
|
||||
this.buffer = "";
|
||||
if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) {
|
||||
while (this.url.path.length > 1 && this.url.path[0] === "") {
|
||||
this.parseError = true;
|
||||
this.url.path.shift();
|
||||
}
|
||||
}
|
||||
if (c === 63) {
|
||||
this.url.query = "";
|
||||
this.state = "query";
|
||||
@@ -1079,7 +1000,7 @@ URLStateMachine.prototype["parse path"] = function parsePath(c) {
|
||||
this.parseError = true;
|
||||
}
|
||||
|
||||
this.buffer += percentEncodeChar(c, isPathPercentEncode);
|
||||
this.buffer += utf8PercentEncodeCodePoint(c, isPathPercentEncode);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1105,7 +1026,7 @@ URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCan
|
||||
}
|
||||
|
||||
if (!isNaN(c)) {
|
||||
this.url.path[0] += percentEncodeChar(c, isC0ControlPercentEncode);
|
||||
this.url.path[0] += utf8PercentEncodeCodePoint(c, isC0ControlPercentEncode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1113,30 +1034,23 @@ URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCan
|
||||
};
|
||||
|
||||
URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) {
|
||||
if (isNaN(c) || (!this.stateOverride && c === 35)) {
|
||||
if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") {
|
||||
this.encodingOverride = "utf-8";
|
||||
}
|
||||
if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") {
|
||||
this.encodingOverride = "utf-8";
|
||||
}
|
||||
|
||||
const buffer = Buffer.from(this.buffer); // TODO: Use encoding override instead
|
||||
for (let i = 0; i < buffer.length; ++i) {
|
||||
if (buffer[i] < 0x21 ||
|
||||
buffer[i] > 0x7E ||
|
||||
buffer[i] === 0x22 || buffer[i] === 0x23 || buffer[i] === 0x3C || buffer[i] === 0x3E ||
|
||||
(buffer[i] === 0x27 && isSpecial(this.url))) {
|
||||
this.url.query += percentEncode(buffer[i]);
|
||||
} else {
|
||||
this.url.query += String.fromCodePoint(buffer[i]);
|
||||
}
|
||||
}
|
||||
if ((!this.stateOverride && c === 35) || isNaN(c)) {
|
||||
const queryPercentEncodePredicate = isSpecial(this.url) ? isSpecialQueryPercentEncode : isQueryPercentEncode;
|
||||
this.url.query += utf8PercentEncodeString(this.buffer, queryPercentEncodePredicate);
|
||||
|
||||
this.buffer = "";
|
||||
|
||||
if (c === 35) {
|
||||
this.url.fragment = "";
|
||||
this.state = "fragment";
|
||||
}
|
||||
} else {
|
||||
} else if (!isNaN(c)) {
|
||||
// TODO: If c is not a URL code point and not "%", parse error.
|
||||
|
||||
if (c === 37 &&
|
||||
(!infra.isASCIIHex(this.input[this.pointer + 1]) ||
|
||||
!infra.isASCIIHex(this.input[this.pointer + 2]))) {
|
||||
@@ -1158,7 +1072,7 @@ URLStateMachine.prototype["parse fragment"] = function parseFragment(c) {
|
||||
this.parseError = true;
|
||||
}
|
||||
|
||||
this.url.fragment += percentEncodeChar(c, isFragmentPercentEncode);
|
||||
this.url.fragment += utf8PercentEncodeCodePoint(c, isFragmentPercentEncode);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1182,15 +1096,16 @@ function serializeURL(url, excludeFragment) {
|
||||
if (url.port !== null) {
|
||||
output += ":" + url.port;
|
||||
}
|
||||
} else if (url.host === null && url.scheme === "file") {
|
||||
output += "//";
|
||||
}
|
||||
|
||||
if (url.cannotBeABaseURL) {
|
||||
output += url.path[0];
|
||||
} else {
|
||||
for (const string of url.path) {
|
||||
output += "/" + string;
|
||||
if (url.host === null && url.path.length > 1 && url.path[0] === "") {
|
||||
output += "/.";
|
||||
}
|
||||
for (const segment of url.path) {
|
||||
output += "/" + segment;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1267,19 +1182,11 @@ module.exports.basicURLParse = function (input, options) {
|
||||
};
|
||||
|
||||
module.exports.setTheUsername = function (url, username) {
|
||||
url.username = "";
|
||||
const decoded = punycode.ucs2.decode(username);
|
||||
for (let i = 0; i < decoded.length; ++i) {
|
||||
url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode);
|
||||
}
|
||||
url.username = utf8PercentEncodeString(username, isUserinfoPercentEncode);
|
||||
};
|
||||
|
||||
module.exports.setThePassword = function (url, password) {
|
||||
url.password = "";
|
||||
const decoded = punycode.ucs2.decode(password);
|
||||
for (let i = 0; i < decoded.length; ++i) {
|
||||
url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode);
|
||||
}
|
||||
url.password = utf8PercentEncodeString(password, isUserinfoPercentEncode);
|
||||
};
|
||||
|
||||
module.exports.serializeHost = serializeHost;
|
103
node_modules/whatwg-url/dist/urlencoded.js
generated
vendored
Normal file
103
node_modules/whatwg-url/dist/urlencoded.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
const { utf8Encode, utf8DecodeWithoutBOM } = require("./encoding");
|
||||
const { percentDecodeBytes, utf8PercentEncodeString, isURLEncodedPercentEncode } = require("./percent-encoding");
|
||||
|
||||
// https://url.spec.whatwg.org/#concept-urlencoded-parser
|
||||
function parseUrlencoded(input) {
|
||||
const sequences = strictlySplitByteSequence(input, 38);
|
||||
const output = [];
|
||||
for (const bytes of sequences) {
|
||||
if (bytes.length === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let name;
|
||||
let value;
|
||||
const indexOfEqual = bytes.indexOf(61);
|
||||
|
||||
if (indexOfEqual >= 0) {
|
||||
name = bytes.slice(0, indexOfEqual);
|
||||
value = bytes.slice(indexOfEqual + 1);
|
||||
} else {
|
||||
name = bytes;
|
||||
value = new Uint8Array(0);
|
||||
}
|
||||
|
||||
name = replaceByteInByteSequence(name, 0x2B, 0x20);
|
||||
value = replaceByteInByteSequence(value, 0x2B, 0x20);
|
||||
|
||||
const nameString = utf8DecodeWithoutBOM(percentDecodeBytes(name));
|
||||
const valueString = utf8DecodeWithoutBOM(percentDecodeBytes(value));
|
||||
|
||||
output.push([nameString, valueString]);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#concept-urlencoded-string-parser
|
||||
function parseUrlencodedString(input) {
|
||||
return parseUrlencoded(utf8Encode(input));
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#concept-urlencoded-serializer
|
||||
function serializeUrlencoded(tuples, encodingOverride = undefined) {
|
||||
let encoding = "utf-8";
|
||||
if (encodingOverride !== undefined) {
|
||||
// TODO "get the output encoding", i.e. handle encoding labels vs. names.
|
||||
encoding = encodingOverride;
|
||||
}
|
||||
|
||||
let output = "";
|
||||
for (const [i, tuple] of tuples.entries()) {
|
||||
// TODO: handle encoding override
|
||||
|
||||
const name = utf8PercentEncodeString(tuple[0], isURLEncodedPercentEncode, true);
|
||||
|
||||
let value = tuple[1];
|
||||
if (tuple.length > 2 && tuple[2] !== undefined) {
|
||||
if (tuple[2] === "hidden" && name === "_charset_") {
|
||||
value = encoding;
|
||||
} else if (tuple[2] === "file") {
|
||||
// value is a File object
|
||||
value = value.name;
|
||||
}
|
||||
}
|
||||
|
||||
value = utf8PercentEncodeString(value, isURLEncodedPercentEncode, true);
|
||||
|
||||
if (i !== 0) {
|
||||
output += "&";
|
||||
}
|
||||
output += `${name}=${value}`;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function strictlySplitByteSequence(buf, cp) {
|
||||
const list = [];
|
||||
let last = 0;
|
||||
let i = buf.indexOf(cp);
|
||||
while (i >= 0) {
|
||||
list.push(buf.slice(last, i));
|
||||
last = i + 1;
|
||||
i = buf.indexOf(cp, last);
|
||||
}
|
||||
if (last !== buf.length) {
|
||||
list.push(buf.slice(last));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
function replaceByteInByteSequence(buf, from, to) {
|
||||
let i = buf.indexOf(from);
|
||||
while (i >= 0) {
|
||||
buf[i] = to;
|
||||
i = buf.indexOf(from, i + 1);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
parseUrlencodedString,
|
||||
serializeUrlencoded
|
||||
};
|
34
node_modules/whatwg-url/lib/utils.js → node_modules/whatwg-url/dist/utils.js
generated
vendored
34
node_modules/whatwg-url/lib/utils.js → node_modules/whatwg-url/dist/utils.js
generated
vendored
@@ -5,9 +5,7 @@ function isObject(value) {
|
||||
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);
|
||||
|
||||
const wrapperSymbol = Symbol("wrapper");
|
||||
const implSymbol = Symbol("impl");
|
||||
@@ -47,6 +45,7 @@ function tryImplForWrapper(wrapper) {
|
||||
|
||||
const iterInternalSymbol = Symbol("internal");
|
||||
const IteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
|
||||
const AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(async function* () {}).prototype);
|
||||
|
||||
function isArrayIndexPropName(P) {
|
||||
if (typeof P !== "string") {
|
||||
@@ -74,6 +73,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,6 +101,11 @@ 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,
|
||||
@@ -99,6 +119,7 @@ module.exports = exports = {
|
||||
tryImplForWrapper,
|
||||
iterInternalSymbol,
|
||||
IteratorPrototype,
|
||||
AsyncIteratorPrototype,
|
||||
isArrayBuffer,
|
||||
isArrayIndexPropName,
|
||||
supportsPropertyIndex,
|
||||
@@ -111,5 +132,10 @@ module.exports = exports = {
|
||||
namedGet,
|
||||
namedSetNew,
|
||||
namedSetExisting,
|
||||
namedDelete
|
||||
namedDelete,
|
||||
asyncIteratorNext,
|
||||
asyncIteratorReturn,
|
||||
asyncIteratorInit,
|
||||
asyncIteratorEOI,
|
||||
iteratorResult
|
||||
};
|
10
node_modules/whatwg-url/index.js
generated
vendored
10
node_modules/whatwg-url/index.js
generated
vendored
@@ -1,12 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
const { URL, URLSearchParams } = require("./webidl2js-wrapper");
|
||||
const urlStateMachine = require("./lib/url-state-machine");
|
||||
const urlEncoded = require("./lib/urlencoded");
|
||||
const urlStateMachine = require("./dist/url-state-machine");
|
||||
const percentEncoding = require("./dist/percent-encoding");
|
||||
|
||||
const sharedGlobalObject = {};
|
||||
URL.install(sharedGlobalObject);
|
||||
URLSearchParams.install(sharedGlobalObject);
|
||||
URL.install(sharedGlobalObject, ["Window"]);
|
||||
URLSearchParams.install(sharedGlobalObject, ["Window"]);
|
||||
|
||||
exports.URL = sharedGlobalObject.URL;
|
||||
exports.URLSearchParams = sharedGlobalObject.URLSearchParams;
|
||||
@@ -21,4 +21,4 @@ exports.setTheUsername = urlStateMachine.setTheUsername;
|
||||
exports.setThePassword = urlStateMachine.setThePassword;
|
||||
exports.cannotHaveAUsernamePasswordPort = urlStateMachine.cannotHaveAUsernamePasswordPort;
|
||||
|
||||
exports.percentDecode = urlEncoded.percentDecode;
|
||||
exports.percentDecode = percentEncoding.percentDecodeBytes;
|
||||
|
363
node_modules/whatwg-url/lib/URL.js
generated
vendored
363
node_modules/whatwg-url/lib/URL.js
generated
vendored
@@ -1,363 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
const ctorRegistry = utils.ctorRegistrySymbol;
|
||||
|
||||
const interfaceName = "URL";
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
exports._mixedIntoPredicates = [];
|
||||
exports.is = function is(obj) {
|
||||
if (obj) {
|
||||
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (const isMixedInto of exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
exports.isImpl = function isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (const isMixedInto of exports._mixedIntoPredicates) {
|
||||
if (isMixedInto(wrapper)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
exports.convert = function convert(obj, { context = "The provided value" } = {}) {
|
||||
if (exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'URL'.`);
|
||||
};
|
||||
|
||||
exports.create = function create(globalObject, constructorArgs, privateData) {
|
||||
if (globalObject[ctorRegistry] === undefined) {
|
||||
throw new Error("Internal error: invalid global object");
|
||||
}
|
||||
|
||||
const ctor = globalObject[ctorRegistry]["URL"];
|
||||
if (ctor === undefined) {
|
||||
throw new Error("Internal error: constructor URL is not installed on the passed global object");
|
||||
}
|
||||
|
||||
let obj = Object.create(ctor.prototype);
|
||||
obj = exports.setup(obj, globalObject, constructorArgs, privateData);
|
||||
return obj;
|
||||
};
|
||||
exports.createImpl = function createImpl(globalObject, constructorArgs, privateData) {
|
||||
const obj = exports.create(globalObject, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
};
|
||||
exports._internalSetup = function _internalSetup(obj) {};
|
||||
exports.setup = function setup(obj, globalObject, constructorArgs = [], privateData = {}) {
|
||||
privateData.wrapper = obj;
|
||||
|
||||
exports._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(globalObject, constructorArgs, privateData),
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
|
||||
exports.install = function install(globalObject) {
|
||||
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 exports.setup(Object.create(new.target.prototype), globalObject, args);
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].toJSON();
|
||||
}
|
||||
|
||||
get href() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["href"];
|
||||
}
|
||||
|
||||
set href(V) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'href' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["href"] = V;
|
||||
}
|
||||
|
||||
toString() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return this[impl]["href"];
|
||||
}
|
||||
|
||||
get origin() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["origin"];
|
||||
}
|
||||
|
||||
get protocol() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["protocol"];
|
||||
}
|
||||
|
||||
set protocol(V) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'protocol' property on 'URL': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["protocol"] = V;
|
||||
}
|
||||
|
||||
get username() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["username"];
|
||||
}
|
||||
|
||||
set username(V) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'username' property on 'URL': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["username"] = V;
|
||||
}
|
||||
|
||||
get password() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["password"];
|
||||
}
|
||||
|
||||
set password(V) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'password' property on 'URL': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["password"] = V;
|
||||
}
|
||||
|
||||
get host() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["host"];
|
||||
}
|
||||
|
||||
set host(V) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'host' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["host"] = V;
|
||||
}
|
||||
|
||||
get hostname() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hostname"];
|
||||
}
|
||||
|
||||
set hostname(V) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'hostname' property on 'URL': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["hostname"] = V;
|
||||
}
|
||||
|
||||
get port() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["port"];
|
||||
}
|
||||
|
||||
set port(V) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'port' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["port"] = V;
|
||||
}
|
||||
|
||||
get pathname() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["pathname"];
|
||||
}
|
||||
|
||||
set pathname(V) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, {
|
||||
context: "Failed to set the 'pathname' property on 'URL': The provided value"
|
||||
});
|
||||
|
||||
this[impl]["pathname"] = V;
|
||||
}
|
||||
|
||||
get search() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["search"];
|
||||
}
|
||||
|
||||
set search(V) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'search' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["search"] = V;
|
||||
}
|
||||
|
||||
get searchParams() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.getSameObject(this, "searchParams", () => {
|
||||
return utils.tryWrapperForImpl(this[impl]["searchParams"]);
|
||||
});
|
||||
}
|
||||
|
||||
get hash() {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hash"];
|
||||
}
|
||||
|
||||
set hash(V) {
|
||||
if (!this || !exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
V = conversions["USVString"](V, { context: "Failed to set the 'hash' property on 'URL': The provided value" });
|
||||
|
||||
this[impl]["hash"] = V;
|
||||
}
|
||||
}
|
||||
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 }
|
||||
});
|
||||
if (globalObject[ctorRegistry] === undefined) {
|
||||
globalObject[ctorRegistry] = Object.create(null);
|
||||
}
|
||||
globalObject[ctorRegistry][interfaceName] = URL;
|
||||
|
||||
Object.defineProperty(globalObject, interfaceName, {
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: URL
|
||||
});
|
||||
};
|
||||
|
||||
const Impl = require("./URL-impl.js");
|
138
node_modules/whatwg-url/lib/urlencoded.js
generated
vendored
138
node_modules/whatwg-url/lib/urlencoded.js
generated
vendored
@@ -1,138 +0,0 @@
|
||||
"use strict";
|
||||
const { isASCIIHex } = require("./infra");
|
||||
|
||||
function strictlySplitByteSequence(buf, cp) {
|
||||
const list = [];
|
||||
let last = 0;
|
||||
let i = buf.indexOf(cp);
|
||||
while (i >= 0) {
|
||||
list.push(buf.slice(last, i));
|
||||
last = i + 1;
|
||||
i = buf.indexOf(cp, last);
|
||||
}
|
||||
if (last !== buf.length) {
|
||||
list.push(buf.slice(last));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
function replaceByteInByteSequence(buf, from, to) {
|
||||
let i = buf.indexOf(from);
|
||||
while (i >= 0) {
|
||||
buf[i] = to;
|
||||
i = buf.indexOf(from, i + 1);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
function percentEncode(c) {
|
||||
let hex = c.toString(16).toUpperCase();
|
||||
if (hex.length === 1) {
|
||||
hex = "0" + hex;
|
||||
}
|
||||
|
||||
return "%" + hex;
|
||||
}
|
||||
|
||||
function percentDecode(input) {
|
||||
const output = Buffer.alloc(input.byteLength);
|
||||
let ptr = 0;
|
||||
for (let i = 0; i < input.length; ++i) {
|
||||
if (input[i] !== 37 || !isASCIIHex(input[i + 1]) || !isASCIIHex(input[i + 2])) {
|
||||
output[ptr++] = input[i];
|
||||
} else {
|
||||
output[ptr++] = parseInt(input.slice(i + 1, i + 3).toString(), 16);
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
return output.slice(0, ptr);
|
||||
}
|
||||
|
||||
function parseUrlencoded(input) {
|
||||
const sequences = strictlySplitByteSequence(input, 38);
|
||||
const output = [];
|
||||
for (const bytes of sequences) {
|
||||
if (bytes.length === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let name;
|
||||
let value;
|
||||
const indexOfEqual = bytes.indexOf(61);
|
||||
|
||||
if (indexOfEqual >= 0) {
|
||||
name = bytes.slice(0, indexOfEqual);
|
||||
value = bytes.slice(indexOfEqual + 1);
|
||||
} else {
|
||||
name = bytes;
|
||||
value = Buffer.alloc(0);
|
||||
}
|
||||
|
||||
name = replaceByteInByteSequence(Buffer.from(name), 43, 32);
|
||||
value = replaceByteInByteSequence(Buffer.from(value), 43, 32);
|
||||
|
||||
output.push([percentDecode(name).toString(), percentDecode(value).toString()]);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function serializeUrlencodedByte(input) {
|
||||
let output = "";
|
||||
for (const byte of input) {
|
||||
if (byte === 32) {
|
||||
output += "+";
|
||||
} else if (byte === 42 ||
|
||||
byte === 45 ||
|
||||
byte === 46 ||
|
||||
(byte >= 48 && byte <= 57) ||
|
||||
(byte >= 65 && byte <= 90) ||
|
||||
byte === 95 ||
|
||||
(byte >= 97 && byte <= 122)) {
|
||||
output += String.fromCodePoint(byte);
|
||||
} else {
|
||||
output += percentEncode(byte);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function serializeUrlencoded(tuples, encodingOverride = undefined) {
|
||||
let encoding = "utf-8";
|
||||
if (encodingOverride !== undefined) {
|
||||
encoding = encodingOverride;
|
||||
}
|
||||
|
||||
let output = "";
|
||||
for (const [i, tuple] of tuples.entries()) {
|
||||
// TODO: handle encoding override
|
||||
const name = serializeUrlencodedByte(Buffer.from(tuple[0]));
|
||||
let value = tuple[1];
|
||||
if (tuple.length > 2 && tuple[2] !== undefined) {
|
||||
if (tuple[2] === "hidden" && name === "_charset_") {
|
||||
value = encoding;
|
||||
} else if (tuple[2] === "file") {
|
||||
// value is a File object
|
||||
value = value.name;
|
||||
}
|
||||
}
|
||||
value = serializeUrlencodedByte(Buffer.from(value));
|
||||
if (i !== 0) {
|
||||
output += "&";
|
||||
}
|
||||
output += `${name}=${value}`;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
percentEncode,
|
||||
percentDecode,
|
||||
|
||||
// application/x-www-form-urlencoded string parser
|
||||
parseUrlencoded(input) {
|
||||
return parseUrlencoded(Buffer.from(input));
|
||||
},
|
||||
|
||||
// application/x-www-form-urlencoded serializer
|
||||
serializeUrlencoded
|
||||
};
|
12
node_modules/whatwg-url/node_modules/webidl-conversions/LICENSE.md
generated
vendored
12
node_modules/whatwg-url/node_modules/webidl-conversions/LICENSE.md
generated
vendored
@@ -1,12 +0,0 @@
|
||||
# The BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2014, Domenic Denicola
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
79
node_modules/whatwg-url/node_modules/webidl-conversions/README.md
generated
vendored
79
node_modules/whatwg-url/node_modules/webidl-conversions/README.md
generated
vendored
@@ -1,79 +0,0 @@
|
||||
# Web IDL Type Conversions on JavaScript Values
|
||||
|
||||
This package implements, in JavaScript, the algorithms to convert a given JavaScript value according to a given [Web IDL](http://heycam.github.io/webidl/) [type](http://heycam.github.io/webidl/#idl-types).
|
||||
|
||||
The goal is that you should be able to write code like
|
||||
|
||||
```js
|
||||
"use strict";
|
||||
const conversions = require("webidl-conversions");
|
||||
|
||||
function doStuff(x, y) {
|
||||
x = conversions["boolean"](x);
|
||||
y = conversions["unsigned long"](y);
|
||||
// actual algorithm code here
|
||||
}
|
||||
```
|
||||
|
||||
and your function `doStuff` will behave the same as a Web IDL operation declared as
|
||||
|
||||
```webidl
|
||||
void doStuff(boolean x, unsigned long y);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package's main module's default export is an object with a variety of methods, each corresponding to a different Web IDL type. Each method, when invoked on a JavaScript value, will give back the new JavaScript value that results after passing through the Web IDL conversion rules. (See below for more details on what that means.) Alternately, the method could throw an error, if the Web IDL algorithm is specified to do so: for example `conversions["float"](NaN)` [will throw a `TypeError`](http://heycam.github.io/webidl/#es-float).
|
||||
|
||||
Each method also accepts a second, optional, parameter for miscellaneous options. For conversion methods that throw errors, a string option `{ context }` may be provided to provide more information in the error message. (For example, `conversions["float"](NaN, { context: "Argument 1 of Interface's operation" })` will throw an error with message `"Argument 1 of Interface's operation is not a finite floating-point value."`) Specific conversions may also accept other options, the details of which can be found below.
|
||||
|
||||
## Conversions implemented
|
||||
|
||||
Conversions for all of the basic types from the Web IDL specification are implemented:
|
||||
|
||||
- [`any`](https://heycam.github.io/webidl/#es-any)
|
||||
- [`void`](https://heycam.github.io/webidl/#es-void)
|
||||
- [`boolean`](https://heycam.github.io/webidl/#es-boolean)
|
||||
- [Integer types](https://heycam.github.io/webidl/#es-integer-types), which can additionally be provided the boolean options `{ clamp, enforceRange }` as a second parameter
|
||||
- [`float`](https://heycam.github.io/webidl/#es-float), [`unrestricted float`](https://heycam.github.io/webidl/#es-unrestricted-float)
|
||||
- [`double`](https://heycam.github.io/webidl/#es-double), [`unrestricted double`](https://heycam.github.io/webidl/#es-unrestricted-double)
|
||||
- [`DOMString`](https://heycam.github.io/webidl/#es-DOMString), which can additionally be provided the boolean option `{ treatNullAsEmptyString }` as a second parameter
|
||||
- [`ByteString`](https://heycam.github.io/webidl/#es-ByteString), [`USVString`](https://heycam.github.io/webidl/#es-USVString)
|
||||
- [`object`](https://heycam.github.io/webidl/#es-object)
|
||||
- [Buffer source types](https://heycam.github.io/webidl/#es-buffer-source-types)
|
||||
|
||||
Additionally, for convenience, the following derived type definitions are implemented:
|
||||
|
||||
- [`ArrayBufferView`](https://heycam.github.io/webidl/#ArrayBufferView)
|
||||
- [`BufferSource`](https://heycam.github.io/webidl/#BufferSource)
|
||||
- [`DOMTimeStamp`](https://heycam.github.io/webidl/#DOMTimeStamp)
|
||||
- [`Function`](https://heycam.github.io/webidl/#Function)
|
||||
- [`VoidFunction`](https://heycam.github.io/webidl/#VoidFunction) (although it will not censor the return type)
|
||||
|
||||
Derived types, such as nullable types, promise types, sequences, records, etc. are not handled by this library. You may wish to investigate the [webidl2js](https://github.com/jsdom/webidl2js) project.
|
||||
|
||||
### A note on the `long long` types
|
||||
|
||||
The `long long` and `unsigned long long` Web IDL types can hold values that cannot be stored in JavaScript numbers, so the conversion is imperfect. For example, converting the JavaScript number `18446744073709552000` to a Web IDL `long long` is supposed to produce the Web IDL value `-18446744073709551232`. Since we are representing our Web IDL values in JavaScript, we can't represent `-18446744073709551232`, so we instead the best we could do is `-18446744073709552000` as the output.
|
||||
|
||||
This library actually doesn't even get that far. Producing those results would require doing accurate modular arithmetic on 64-bit intermediate values, but JavaScript does not make this easy. We could pull in a big-integer library as a dependency, but in lieu of that, we for now have decided to just produce inaccurate results if you pass in numbers that are not strictly between `Number.MIN_SAFE_INTEGER` and `Number.MAX_SAFE_INTEGER`.
|
||||
|
||||
## Background
|
||||
|
||||
What's actually going on here, conceptually, is pretty weird. Let's try to explain.
|
||||
|
||||
Web IDL, as part of its madness-inducing design, has its own type system. When people write algorithms in web platform specs, they usually operate on Web IDL values, i.e. instances of Web IDL types. For example, if they were specifying the algorithm for our `doStuff` operation above, they would treat `x` as a Web IDL value of [Web IDL type `boolean`](http://heycam.github.io/webidl/#idl-boolean). Crucially, they would _not_ treat `x` as a JavaScript variable whose value is either the JavaScript `true` or `false`. They're instead working in a different type system altogether, with its own rules.
|
||||
|
||||
Separately from its type system, Web IDL defines a ["binding"](http://heycam.github.io/webidl/#ecmascript-binding) of the type system into JavaScript. This contains rules like: when you pass a JavaScript value to the JavaScript method that manifests a given Web IDL operation, how does that get converted into a Web IDL value? For example, a JavaScript `true` passed in the position of a Web IDL `boolean` argument becomes a Web IDL `true`. But, a JavaScript `true` passed in the position of a [Web IDL `unsigned long`](http://heycam.github.io/webidl/#idl-unsigned-long) becomes a Web IDL `1`. And so on.
|
||||
|
||||
Finally, we have the actual implementation code. This is usually C++, although these days [some smart people are using Rust](https://github.com/servo/servo). The implementation, of course, has its own type system. So when they implement the Web IDL algorithms, they don't actually use Web IDL values, since those aren't "real" outside of specs. Instead, implementations apply the Web IDL binding rules in such a way as to convert incoming JavaScript values into C++ values. For example, if code in the browser called `doStuff(true, true)`, then the implementation code would eventually receive a C++ `bool` containing `true` and a C++ `uint32_t` containing `1`.
|
||||
|
||||
The upside of all this is that implementations can abstract all the conversion logic away, letting Web IDL handle it, and focus on implementing the relevant methods in C++ with values of the correct type already provided. That is payoff of Web IDL, in a nutshell.
|
||||
|
||||
And getting to that payoff is the goal of _this_ project—but for JavaScript implementations, instead of C++ ones. That is, this library is designed to make it easier for JavaScript developers to write functions that behave like a given Web IDL operation. So conceptually, the conversion pipeline, which in its general form is JavaScript values ↦ Web IDL values ↦ implementation-language values, in this case becomes JavaScript values ↦ Web IDL values ↦ JavaScript values. And that intermediate step is where all the logic is performed: a JavaScript `true` becomes a Web IDL `1` in an unsigned long context, which then becomes a JavaScript `1`.
|
||||
|
||||
## Don't use this
|
||||
|
||||
Seriously, why would you ever use this? You really shouldn't. Web IDL is … strange, and you shouldn't be emulating its semantics. If you're looking for a generic argument-processing library, you should find one with better rules than those from Web IDL. In general, your JavaScript should not be trying to become more like Web IDL; if anything, we should fix Web IDL to make it more like JavaScript.
|
||||
|
||||
The _only_ people who should use this are those trying to create faithful implementations (or polyfills) of web platform interfaces defined in Web IDL. Its main consumer is the [jsdom](https://github.com/jsdom/jsdom) project.
|
361
node_modules/whatwg-url/node_modules/webidl-conversions/lib/index.js
generated
vendored
361
node_modules/whatwg-url/node_modules/webidl-conversions/lib/index.js
generated
vendored
@@ -1,361 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
function _(message, opts) {
|
||||
return `${opts && opts.context ? opts.context : "Value"} ${message}.`;
|
||||
}
|
||||
|
||||
function type(V) {
|
||||
if (V === null) {
|
||||
return "Null";
|
||||
}
|
||||
switch (typeof V) {
|
||||
case "undefined":
|
||||
return "Undefined";
|
||||
case "boolean":
|
||||
return "Boolean";
|
||||
case "number":
|
||||
return "Number";
|
||||
case "string":
|
||||
return "String";
|
||||
case "symbol":
|
||||
return "Symbol";
|
||||
case "object":
|
||||
// Falls through
|
||||
case "function":
|
||||
// Falls through
|
||||
default:
|
||||
// Per ES spec, typeof returns an implemention-defined value that is not any of the existing ones for
|
||||
// uncallable non-standard exotic objects. Yet Type() which the Web IDL spec depends on returns Object for
|
||||
// such cases. So treat the default case as an object.
|
||||
return "Object";
|
||||
}
|
||||
}
|
||||
|
||||
// Round x to the nearest integer, choosing the even integer if it lies halfway between two.
|
||||
function evenRound(x) {
|
||||
// There are four cases for numbers with fractional part being .5:
|
||||
//
|
||||
// case | x | floor(x) | round(x) | expected | x <> 0 | x % 1 | x & 1 | example
|
||||
// 1 | 2n + 0.5 | 2n | 2n + 1 | 2n | > | 0.5 | 0 | 0.5 -> 0
|
||||
// 2 | 2n + 1.5 | 2n + 1 | 2n + 2 | 2n + 2 | > | 0.5 | 1 | 1.5 -> 2
|
||||
// 3 | -2n - 0.5 | -2n - 1 | -2n | -2n | < | -0.5 | 0 | -0.5 -> 0
|
||||
// 4 | -2n - 1.5 | -2n - 2 | -2n - 1 | -2n - 2 | < | -0.5 | 1 | -1.5 -> -2
|
||||
// (where n is a non-negative integer)
|
||||
//
|
||||
// Branch here for cases 1 and 4
|
||||
if ((x > 0 && (x % 1) === +0.5 && (x & 1) === 0) ||
|
||||
(x < 0 && (x % 1) === -0.5 && (x & 1) === 1)) {
|
||||
return censorNegativeZero(Math.floor(x));
|
||||
}
|
||||
|
||||
return censorNegativeZero(Math.round(x));
|
||||
}
|
||||
|
||||
function integerPart(n) {
|
||||
return censorNegativeZero(Math.trunc(n));
|
||||
}
|
||||
|
||||
function sign(x) {
|
||||
return x < 0 ? -1 : 1;
|
||||
}
|
||||
|
||||
function modulo(x, y) {
|
||||
// https://tc39.github.io/ecma262/#eqn-modulo
|
||||
// Note that http://stackoverflow.com/a/4467559/3191 does NOT work for large modulos
|
||||
const signMightNotMatch = x % y;
|
||||
if (sign(y) !== sign(signMightNotMatch)) {
|
||||
return signMightNotMatch + y;
|
||||
}
|
||||
return signMightNotMatch;
|
||||
}
|
||||
|
||||
function censorNegativeZero(x) {
|
||||
return x === 0 ? 0 : x;
|
||||
}
|
||||
|
||||
function createIntegerConversion(bitLength, typeOpts) {
|
||||
const isSigned = !typeOpts.unsigned;
|
||||
|
||||
let lowerBound;
|
||||
let upperBound;
|
||||
if (bitLength === 64) {
|
||||
upperBound = Math.pow(2, 53) - 1;
|
||||
lowerBound = !isSigned ? 0 : -Math.pow(2, 53) + 1;
|
||||
} else if (!isSigned) {
|
||||
lowerBound = 0;
|
||||
upperBound = Math.pow(2, bitLength) - 1;
|
||||
} else {
|
||||
lowerBound = -Math.pow(2, bitLength - 1);
|
||||
upperBound = Math.pow(2, bitLength - 1) - 1;
|
||||
}
|
||||
|
||||
const twoToTheBitLength = Math.pow(2, bitLength);
|
||||
const twoToOneLessThanTheBitLength = Math.pow(2, bitLength - 1);
|
||||
|
||||
return (V, opts) => {
|
||||
if (opts === undefined) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
let x = +V;
|
||||
x = censorNegativeZero(x); // Spec discussion ongoing: https://github.com/heycam/webidl/issues/306
|
||||
|
||||
if (opts.enforceRange) {
|
||||
if (!Number.isFinite(x)) {
|
||||
throw new TypeError(_("is not a finite number", opts));
|
||||
}
|
||||
|
||||
x = integerPart(x);
|
||||
|
||||
if (x < lowerBound || x > upperBound) {
|
||||
throw new TypeError(_(
|
||||
`is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`, opts));
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
if (!Number.isNaN(x) && opts.clamp) {
|
||||
x = Math.min(Math.max(x, lowerBound), upperBound);
|
||||
x = evenRound(x);
|
||||
return x;
|
||||
}
|
||||
|
||||
if (!Number.isFinite(x) || x === 0) {
|
||||
return 0;
|
||||
}
|
||||
x = integerPart(x);
|
||||
|
||||
// Math.pow(2, 64) is not accurately representable in JavaScript, so try to avoid these per-spec operations if
|
||||
// possible. Hopefully it's an optimization for the non-64-bitLength cases too.
|
||||
if (x >= lowerBound && x <= upperBound) {
|
||||
return x;
|
||||
}
|
||||
|
||||
// These will not work great for bitLength of 64, but oh well. See the README for more details.
|
||||
x = modulo(x, twoToTheBitLength);
|
||||
if (isSigned && x >= twoToOneLessThanTheBitLength) {
|
||||
return x - twoToTheBitLength;
|
||||
}
|
||||
return x;
|
||||
};
|
||||
}
|
||||
|
||||
exports.any = V => {
|
||||
return V;
|
||||
};
|
||||
|
||||
exports.void = function () {
|
||||
return undefined;
|
||||
};
|
||||
|
||||
exports.boolean = function (val) {
|
||||
return !!val;
|
||||
};
|
||||
|
||||
exports.byte = createIntegerConversion(8, { unsigned: false });
|
||||
exports.octet = createIntegerConversion(8, { unsigned: true });
|
||||
|
||||
exports.short = createIntegerConversion(16, { unsigned: false });
|
||||
exports["unsigned short"] = createIntegerConversion(16, { unsigned: true });
|
||||
|
||||
exports.long = createIntegerConversion(32, { unsigned: false });
|
||||
exports["unsigned long"] = createIntegerConversion(32, { unsigned: true });
|
||||
|
||||
exports["long long"] = createIntegerConversion(64, { unsigned: false });
|
||||
exports["unsigned long long"] = createIntegerConversion(64, { unsigned: true });
|
||||
|
||||
exports.double = (V, opts) => {
|
||||
const x = +V;
|
||||
|
||||
if (!Number.isFinite(x)) {
|
||||
throw new TypeError(_("is not a finite floating-point value", opts));
|
||||
}
|
||||
|
||||
return x;
|
||||
};
|
||||
|
||||
exports["unrestricted double"] = V => {
|
||||
const x = +V;
|
||||
|
||||
return x;
|
||||
};
|
||||
|
||||
exports.float = (V, opts) => {
|
||||
const x = +V;
|
||||
|
||||
if (!Number.isFinite(x)) {
|
||||
throw new TypeError(_("is not a finite floating-point value", opts));
|
||||
}
|
||||
|
||||
if (Object.is(x, -0)) {
|
||||
return x;
|
||||
}
|
||||
|
||||
const y = Math.fround(x);
|
||||
|
||||
if (!Number.isFinite(y)) {
|
||||
throw new TypeError(_("is outside the range of a single-precision floating-point value", opts));
|
||||
}
|
||||
|
||||
return y;
|
||||
};
|
||||
|
||||
exports["unrestricted float"] = V => {
|
||||
const x = +V;
|
||||
|
||||
if (isNaN(x)) {
|
||||
return x;
|
||||
}
|
||||
|
||||
if (Object.is(x, -0)) {
|
||||
return x;
|
||||
}
|
||||
|
||||
return Math.fround(x);
|
||||
};
|
||||
|
||||
exports.DOMString = function (V, opts) {
|
||||
if (opts === undefined) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
if (opts.treatNullAsEmptyString && V === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (typeof V === "symbol") {
|
||||
throw new TypeError(_("is a symbol, which cannot be converted to a string", opts));
|
||||
}
|
||||
|
||||
return String(V);
|
||||
};
|
||||
|
||||
exports.ByteString = (V, opts) => {
|
||||
const x = exports.DOMString(V, opts);
|
||||
let c;
|
||||
for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) {
|
||||
if (c > 255) {
|
||||
throw new TypeError(_("is not a valid ByteString", opts));
|
||||
}
|
||||
}
|
||||
|
||||
return x;
|
||||
};
|
||||
|
||||
exports.USVString = (V, opts) => {
|
||||
const S = exports.DOMString(V, opts);
|
||||
const n = S.length;
|
||||
const U = [];
|
||||
for (let i = 0; i < n; ++i) {
|
||||
const c = S.charCodeAt(i);
|
||||
if (c < 0xD800 || c > 0xDFFF) {
|
||||
U.push(String.fromCodePoint(c));
|
||||
} else if (0xDC00 <= c && c <= 0xDFFF) {
|
||||
U.push(String.fromCodePoint(0xFFFD));
|
||||
} else if (i === n - 1) {
|
||||
U.push(String.fromCodePoint(0xFFFD));
|
||||
} else {
|
||||
const d = S.charCodeAt(i + 1);
|
||||
if (0xDC00 <= d && d <= 0xDFFF) {
|
||||
const a = c & 0x3FF;
|
||||
const b = d & 0x3FF;
|
||||
U.push(String.fromCodePoint((2 << 15) + ((2 << 9) * a) + b));
|
||||
++i;
|
||||
} else {
|
||||
U.push(String.fromCodePoint(0xFFFD));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return U.join("");
|
||||
};
|
||||
|
||||
exports.object = (V, opts) => {
|
||||
if (type(V) !== "Object") {
|
||||
throw new TypeError(_("is not an object", opts));
|
||||
}
|
||||
|
||||
return V;
|
||||
};
|
||||
|
||||
// Not exported, but used in Function and VoidFunction.
|
||||
|
||||
// Neither Function nor VoidFunction is defined with [TreatNonObjectAsNull], so
|
||||
// handling for that is omitted.
|
||||
function convertCallbackFunction(V, opts) {
|
||||
if (typeof V !== "function") {
|
||||
throw new TypeError(_("is not a function", opts));
|
||||
}
|
||||
return V;
|
||||
}
|
||||
|
||||
const abByteLengthGetter =
|
||||
Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
||||
|
||||
function isArrayBuffer(V) {
|
||||
try {
|
||||
abByteLengthGetter.call(V);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// I don't think we can reliably detect detached ArrayBuffers.
|
||||
exports.ArrayBuffer = (V, opts) => {
|
||||
if (!isArrayBuffer(V)) {
|
||||
throw new TypeError(_("is not a view on an ArrayBuffer object", opts));
|
||||
}
|
||||
return V;
|
||||
};
|
||||
|
||||
const dvByteLengthGetter =
|
||||
Object.getOwnPropertyDescriptor(DataView.prototype, "byteLength").get;
|
||||
exports.DataView = (V, opts) => {
|
||||
try {
|
||||
dvByteLengthGetter.call(V);
|
||||
return V;
|
||||
} catch (e) {
|
||||
throw new TypeError(_("is not a view on an DataView object", opts));
|
||||
}
|
||||
};
|
||||
|
||||
[
|
||||
Int8Array, Int16Array, Int32Array, Uint8Array,
|
||||
Uint16Array, Uint32Array, Uint8ClampedArray, Float32Array, Float64Array
|
||||
].forEach(func => {
|
||||
const name = func.name;
|
||||
const article = /^[AEIOU]/.test(name) ? "an" : "a";
|
||||
exports[name] = (V, opts) => {
|
||||
if (!ArrayBuffer.isView(V) || V.constructor.name !== name) {
|
||||
throw new TypeError(_(`is not ${article} ${name} object`, opts));
|
||||
}
|
||||
|
||||
return V;
|
||||
};
|
||||
});
|
||||
|
||||
// Common definitions
|
||||
|
||||
exports.ArrayBufferView = (V, opts) => {
|
||||
if (!ArrayBuffer.isView(V)) {
|
||||
throw new TypeError(_("is not a view on an ArrayBuffer object", opts));
|
||||
}
|
||||
|
||||
return V;
|
||||
};
|
||||
|
||||
exports.BufferSource = (V, opts) => {
|
||||
if (!ArrayBuffer.isView(V) && !isArrayBuffer(V)) {
|
||||
throw new TypeError(_("is not an ArrayBuffer object or a view on one", opts));
|
||||
}
|
||||
|
||||
return V;
|
||||
};
|
||||
|
||||
exports.DOMTimeStamp = exports["unsigned long long"];
|
||||
|
||||
exports.Function = convertCallbackFunction;
|
||||
|
||||
exports.VoidFunction = convertCallbackFunction;
|
66
node_modules/whatwg-url/node_modules/webidl-conversions/package.json
generated
vendored
66
node_modules/whatwg-url/node_modules/webidl-conversions/package.json
generated
vendored
@@ -1,66 +0,0 @@
|
||||
{
|
||||
"_from": "webidl-conversions@^5.0.0",
|
||||
"_id": "webidl-conversions@5.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==",
|
||||
"_location": "/whatwg-url/webidl-conversions",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "webidl-conversions@^5.0.0",
|
||||
"name": "webidl-conversions",
|
||||
"escapedName": "webidl-conversions",
|
||||
"rawSpec": "^5.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/whatwg-url"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz",
|
||||
"_shasum": "ae59c8a00b121543a2acc65c0434f57b0fc11aff",
|
||||
"_spec": "webidl-conversions@^5.0.0",
|
||||
"_where": "D:\\Projects\\minifyfromhtml\\node_modules\\whatwg-url",
|
||||
"author": {
|
||||
"name": "Domenic Denicola",
|
||||
"email": "d@domenic.me",
|
||||
"url": "https://domenic.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jsdom/webidl-conversions/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Implements the WebIDL algorithms for converting to and from JavaScript values",
|
||||
"devDependencies": {
|
||||
"eslint": "^6.7.2",
|
||||
"mocha": "^6.2.2",
|
||||
"nyc": "^14.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"homepage": "https://github.com/jsdom/webidl-conversions#readme",
|
||||
"keywords": [
|
||||
"webidl",
|
||||
"web",
|
||||
"types"
|
||||
],
|
||||
"license": "BSD-2-Clause",
|
||||
"main": "lib/index.js",
|
||||
"name": "webidl-conversions",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jsdom/webidl-conversions.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "nyc mocha test/*.js",
|
||||
"lint": "eslint .",
|
||||
"test": "mocha test/*.js"
|
||||
},
|
||||
"version": "5.0.0"
|
||||
}
|
44
node_modules/whatwg-url/package.json
generated
vendored
44
node_modules/whatwg-url/package.json
generated
vendored
@@ -1,27 +1,27 @@
|
||||
{
|
||||
"_from": "whatwg-url@^8.0.0",
|
||||
"_id": "whatwg-url@8.1.0",
|
||||
"_from": "whatwg-url@^8.5.0",
|
||||
"_id": "whatwg-url@8.5.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-vEIkwNi9Hqt4TV9RdnaBPNt+E2Sgmo3gePebCRgZ1R7g6d23+53zCTnuB0amKI4AXq6VM8jj2DUAa0S1vjJxkw==",
|
||||
"_integrity": "sha512-fy+R77xWv0AiqfLl4nuGUlQ3/6b5uNfQ4WAbGQVMYshCTCCPK9psC1nWh3XHuxGVCtlcDDQPQW1csmmIQo+fwg==",
|
||||
"_location": "/whatwg-url",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "whatwg-url@^8.0.0",
|
||||
"raw": "whatwg-url@^8.5.0",
|
||||
"name": "whatwg-url",
|
||||
"escapedName": "whatwg-url",
|
||||
"rawSpec": "^8.0.0",
|
||||
"rawSpec": "^8.5.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^8.0.0"
|
||||
"fetchSpec": "^8.5.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/data-urls",
|
||||
"/jsdom"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.1.0.tgz",
|
||||
"_shasum": "c628acdcf45b82274ce7281ee31dd3c839791771",
|
||||
"_spec": "whatwg-url@^8.0.0",
|
||||
"_resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.5.0.tgz",
|
||||
"_shasum": "7752b8464fc0903fec89aa9846fc9efe07351fd3",
|
||||
"_spec": "whatwg-url@^8.5.0",
|
||||
"_where": "D:\\Projects\\minifyfromhtml\\node_modules\\jsdom",
|
||||
"author": {
|
||||
"name": "Sebastian Mayr",
|
||||
@@ -32,20 +32,21 @@
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"lodash.sortby": "^4.7.0",
|
||||
"lodash": "^4.7.0",
|
||||
"tr46": "^2.0.2",
|
||||
"webidl-conversions": "^5.0.0"
|
||||
"webidl-conversions": "^6.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "An implementation of the WHATWG URL Standard's URL API and parsing machinery",
|
||||
"devDependencies": {
|
||||
"browserify": "^16.5.0",
|
||||
"browserify": "^17.0.0",
|
||||
"domexception": "^2.0.1",
|
||||
"eslint": "^6.8.0",
|
||||
"got": "^10.6.0",
|
||||
"jest": "^25.1.0",
|
||||
"recast": "^0.18.7",
|
||||
"webidl2js": "^14.0.0"
|
||||
"eslint": "^7.20.0",
|
||||
"glob": "^7.1.6",
|
||||
"got": "^11.8.1",
|
||||
"jest": "^26.6.3",
|
||||
"recast": "^0.20.4",
|
||||
"webidl2js": "^16.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
@@ -53,7 +54,7 @@
|
||||
"files": [
|
||||
"index.js",
|
||||
"webidl2js-wrapper.js",
|
||||
"lib/"
|
||||
"dist/"
|
||||
],
|
||||
"homepage": "https://github.com/jsdom/whatwg-url#readme",
|
||||
"jest": {
|
||||
@@ -83,13 +84,12 @@
|
||||
"url": "git+https://github.com/jsdom/whatwg-url.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/transform.js && node scripts/convert-idl.js",
|
||||
"build-live-viewer": "browserify index.js --standalone whatwgURL > live-viewer/whatwg-url.js",
|
||||
"coverage": "jest --coverage",
|
||||
"lint": "eslint .",
|
||||
"prepare": "node scripts/transform.js && node scripts/convert-idl.js",
|
||||
"pretest": "node scripts/get-latest-platform-tests.js && node scripts/transform.js && node scripts/convert-idl.js",
|
||||
"prepare": "node scripts/transform.js",
|
||||
"pretest": "node scripts/get-latest-platform-tests.js && node scripts/transform.js",
|
||||
"test": "jest"
|
||||
},
|
||||
"version": "8.1.0"
|
||||
"version": "8.5.0"
|
||||
}
|
||||
|
4
node_modules/whatwg-url/webidl2js-wrapper.js
generated
vendored
4
node_modules/whatwg-url/webidl2js-wrapper.js
generated
vendored
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const URL = require("./lib/URL");
|
||||
const URLSearchParams = require("./lib/URLSearchParams");
|
||||
const URL = require("./dist/URL");
|
||||
const URLSearchParams = require("./dist/URLSearchParams");
|
||||
|
||||
exports.URL = URL;
|
||||
exports.URLSearchParams = URLSearchParams;
|
||||
|
Reference in New Issue
Block a user