Updating NPM dependencies
This commit is contained in:
40
node_modules/whatwg-url/README.md
generated
vendored
40
node_modules/whatwg-url/README.md
generated
vendored
@@ -1,10 +1,12 @@
|
||||
# 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).
|
||||
|
||||
## Current status
|
||||
## Specification conformance
|
||||
|
||||
whatwg-url is currently up to date with the URL spec up to commit [6ef17eb](https://github.com/whatwg/url/commit/6ef17ebe1220a7e7c0cfff0785017502ee18808b).
|
||||
whatwg-url is currently up to date with the URL spec up to commit [a19495e](https://github.com/whatwg/url/commit/a19495e27ad95154543b46f751d1a1bf25553808).
|
||||
|
||||
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"`).
|
||||
|
||||
## API
|
||||
|
||||
@@ -66,3 +68,35 @@ The URL record type has the following API:
|
||||
These properties should be treated with care, as in general changing them will cause the URL record to be in an inconsistent state until the appropriate invocation of `basicURLParse` is used to fix it up. You can see examples of this in the URL Standard, where there are many step sequences like "4. Set context object’s url’s fragment to the empty string. 5. Basic URL parse _input_ with context object’s url as _url_ and fragment state as _state override_." In between those two steps, a URL record is in an unusable state.
|
||||
|
||||
The return value of "failure" in the spec is represented by `null`. That is, functions like `parseURL` and `basicURLParse` can return _either_ a URL record _or_ `null`.
|
||||
|
||||
### `whatwg-url/webidl2js-wrapper` module
|
||||
|
||||
This module exports the `URL` and `URLSearchParams` [interface wrappers API](https://github.com/jsdom/webidl2js#for-interfaces) generated by [webidl2js](https://github.com/jsdom/webidl2js).
|
||||
|
||||
## Development instructions
|
||||
|
||||
First, install [Node.js](https://nodejs.org/). Then, fetch the dependencies of whatwg-url, by running from this directory:
|
||||
|
||||
npm install
|
||||
|
||||
To run tests:
|
||||
|
||||
npm test
|
||||
|
||||
To generate a coverage report:
|
||||
|
||||
npm run coverage
|
||||
|
||||
To build and run the live viewer:
|
||||
|
||||
npm run prepare
|
||||
npm run build-live-viewer
|
||||
|
||||
Serve the contents of the `live-viewer` directory using any web server.
|
||||
|
||||
## Supporting whatwg-url
|
||||
|
||||
The jsdom project (including whatwg-url) is a community-driven project maintained by a team of [volunteers](https://github.com/orgs/jsdom/people). You could support us by:
|
||||
|
||||
- [Getting professional support for whatwg-url](https://tidelift.com/subscription/pkg/npm-whatwg-url?utm_source=npm-whatwg-url&utm_medium=referral&utm_campaign=readme) as part of a Tidelift subscription. Tidelift helps making open source sustainable for us while giving teams assurances for maintenance, licensing, and security.
|
||||
- Contributing directly to the project.
|
||||
|
||||
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;
|
||||
};
|
||||
14
node_modules/whatwg-url/lib/URL-impl.js → node_modules/whatwg-url/dist/URL-impl.js
generated
vendored
14
node_modules/whatwg-url/lib/URL-impl.js → node_modules/whatwg-url/dist/URL-impl.js
generated
vendored
@@ -4,7 +4,7 @@ const urlencoded = require("./urlencoded");
|
||||
const URLSearchParams = require("./URLSearchParams");
|
||||
|
||||
exports.implementation = class URLImpl {
|
||||
constructor(constructorArgs) {
|
||||
constructor(globalObject, constructorArgs) {
|
||||
const url = constructorArgs[0];
|
||||
const base = constructorArgs[1];
|
||||
|
||||
@@ -12,13 +12,13 @@ exports.implementation = class URLImpl {
|
||||
if (base !== undefined) {
|
||||
parsedBase = usm.basicURLParse(base);
|
||||
if (parsedBase === null) {
|
||||
throw new TypeError("Invalid base URL");
|
||||
throw new TypeError(`Invalid base URL: ${base}`);
|
||||
}
|
||||
}
|
||||
|
||||
const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase });
|
||||
if (parsedURL === null) {
|
||||
throw new TypeError("Invalid URL");
|
||||
throw new TypeError(`Invalid URL: ${url}`);
|
||||
}
|
||||
|
||||
const query = parsedURL.query !== null ? parsedURL.query : "";
|
||||
@@ -27,7 +27,7 @@ exports.implementation = class URLImpl {
|
||||
|
||||
// We cannot invoke the "new URLSearchParams object" algorithm without going through the constructor, which strips
|
||||
// question mark by default. Therefore the doNotStripQMark hack is used.
|
||||
this._query = URLSearchParams.createImpl([query], { doNotStripQMark: true });
|
||||
this._query = URLSearchParams.createImpl(globalObject, [query], { doNotStripQMark: true });
|
||||
this._query._url = this;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ exports.implementation = class URLImpl {
|
||||
set href(v) {
|
||||
const parsedURL = usm.basicURLParse(v);
|
||||
if (parsedURL === null) {
|
||||
throw new TypeError("Invalid URL");
|
||||
throw new TypeError(`Invalid URL: ${v}`);
|
||||
}
|
||||
|
||||
this._url = parsedURL;
|
||||
@@ -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");
|
||||
@@ -3,7 +3,7 @@ const stableSortBy = require("lodash.sortby");
|
||||
const urlencoded = require("./urlencoded");
|
||||
|
||||
exports.implementation = class URLSearchParamsImpl {
|
||||
constructor(constructorArgs, { doNotStripQMark = false }) {
|
||||
constructor(globalObject, constructorArgs, { doNotStripQMark = false }) {
|
||||
let init = constructorArgs[0];
|
||||
this._list = [];
|
||||
this._url = null;
|
||||
@@ -26,7 +26,7 @@ exports.implementation = class URLSearchParamsImpl {
|
||||
this._list.push([name, value]);
|
||||
}
|
||||
} else {
|
||||
this._list = urlencoded.parseUrlencoded(init);
|
||||
this._list = urlencoded.parseUrlencodedString(init);
|
||||
}
|
||||
}
|
||||
|
||||
457
node_modules/whatwg-url/dist/URLSearchParams.js
generated
vendored
Normal file
457
node_modules/whatwg-url/dist/URLSearchParams.js
generated
vendored
Normal file
@@ -0,0 +1,457 @@
|
||||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
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 && 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[implSymbol]);
|
||||
const len = values.length;
|
||||
if (index >= len) {
|
||||
return { value: undefined, done: true };
|
||||
}
|
||||
|
||||
const pair = values[index];
|
||||
internal.index = index + 1;
|
||||
return utils.iteratorResult(pair.map(utils.tryWrapperForImpl), kind);
|
||||
},
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
},
|
||||
[Symbol.toStringTag]: {
|
||||
value: "URLSearchParams Iterator",
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
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 'URLSearchParams'.`);
|
||||
};
|
||||
|
||||
exports.createDefaultIterator = (target, kind) => {
|
||||
const iterator = Object.create(IteratorPrototype);
|
||||
Object.defineProperty(iterator, utils.iterInternalSymbol, {
|
||||
value: { target, kind, index: 0 },
|
||||
configurable: true
|
||||
});
|
||||
return iterator;
|
||||
};
|
||||
|
||||
function makeWrapper(globalObject) {
|
||||
if (globalObject[ctorRegistrySymbol] === undefined) {
|
||||
throw new Error("Internal error: invalid global object");
|
||||
}
|
||||
|
||||
const ctor = globalObject[ctorRegistrySymbol]["URLSearchParams"];
|
||||
if (ctor === undefined) {
|
||||
throw new Error("Internal error: constructor URLSearchParams 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 URLSearchParams {
|
||||
constructor() {
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
if (curArg !== undefined) {
|
||||
if (utils.isObject(curArg)) {
|
||||
if (curArg[Symbol.iterator] !== undefined) {
|
||||
if (!utils.isObject(curArg)) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URLSearchParams': parameter 1" + " sequence" + " is not an iterable object."
|
||||
);
|
||||
} else {
|
||||
const V = [];
|
||||
const tmp = curArg;
|
||||
for (let nextItem of tmp) {
|
||||
if (!utils.isObject(nextItem)) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URLSearchParams': parameter 1" +
|
||||
" sequence" +
|
||||
"'s element" +
|
||||
" is not an iterable object."
|
||||
);
|
||||
} else {
|
||||
const V = [];
|
||||
const tmp = nextItem;
|
||||
for (let nextItem of tmp) {
|
||||
nextItem = conversions["USVString"](nextItem, {
|
||||
context:
|
||||
"Failed to construct 'URLSearchParams': parameter 1" +
|
||||
" sequence" +
|
||||
"'s element" +
|
||||
"'s element"
|
||||
});
|
||||
|
||||
V.push(nextItem);
|
||||
}
|
||||
nextItem = V;
|
||||
}
|
||||
|
||||
V.push(nextItem);
|
||||
}
|
||||
curArg = V;
|
||||
}
|
||||
} else {
|
||||
if (!utils.isObject(curArg)) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URLSearchParams': parameter 1" + " record" + " is not an object."
|
||||
);
|
||||
} else {
|
||||
const result = Object.create(null);
|
||||
for (const key of Reflect.ownKeys(curArg)) {
|
||||
const desc = Object.getOwnPropertyDescriptor(curArg, key);
|
||||
if (desc && desc.enumerable) {
|
||||
let typedKey = key;
|
||||
|
||||
typedKey = conversions["USVString"](typedKey, {
|
||||
context: "Failed to construct 'URLSearchParams': parameter 1" + " record" + "'s key"
|
||||
});
|
||||
|
||||
let typedValue = curArg[key];
|
||||
|
||||
typedValue = conversions["USVString"](typedValue, {
|
||||
context: "Failed to construct 'URLSearchParams': parameter 1" + " record" + "'s value"
|
||||
});
|
||||
|
||||
result[typedKey] = typedValue;
|
||||
}
|
||||
}
|
||||
curArg = result;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to construct 'URLSearchParams': parameter 1"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
curArg = "";
|
||||
}
|
||||
args.push(curArg);
|
||||
}
|
||||
return exports.setup(Object.create(new.target.prototype), globalObject, args);
|
||||
}
|
||||
|
||||
append(name, value) {
|
||||
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) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'append' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'append' on 'URLSearchParams': parameter 2"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return esValue[implSymbol].append(...args);
|
||||
}
|
||||
|
||||
delete(name) {
|
||||
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) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'delete' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return esValue[implSymbol].delete(...args);
|
||||
}
|
||||
|
||||
get(name) {
|
||||
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) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'get' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return esValue[implSymbol].get(...args);
|
||||
}
|
||||
|
||||
getAll(name) {
|
||||
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) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'getAll' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return utils.tryWrapperForImpl(esValue[implSymbol].getAll(...args));
|
||||
}
|
||||
|
||||
has(name) {
|
||||
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) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'has' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return esValue[implSymbol].has(...args);
|
||||
}
|
||||
|
||||
set(name, value) {
|
||||
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) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
const args = [];
|
||||
{
|
||||
let curArg = arguments[0];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'set' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
{
|
||||
let curArg = arguments[1];
|
||||
curArg = conversions["USVString"](curArg, {
|
||||
context: "Failed to execute 'set' on 'URLSearchParams': parameter 2"
|
||||
});
|
||||
args.push(curArg);
|
||||
}
|
||||
return esValue[implSymbol].set(...args);
|
||||
}
|
||||
|
||||
sort() {
|
||||
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 esValue[implSymbol].sort();
|
||||
}
|
||||
|
||||
toString() {
|
||||
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 esValue[implSymbol].toString();
|
||||
}
|
||||
|
||||
keys() {
|
||||
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 (!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 (!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 (!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.");
|
||||
}
|
||||
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[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[implSymbol]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Object.defineProperties(URLSearchParams.prototype, {
|
||||
append: { enumerable: true },
|
||||
delete: { enumerable: true },
|
||||
get: { enumerable: true },
|
||||
getAll: { enumerable: true },
|
||||
has: { enumerable: true },
|
||||
set: { enumerable: true },
|
||||
sort: { enumerable: true },
|
||||
toString: { enumerable: true },
|
||||
keys: { enumerable: true },
|
||||
values: { enumerable: true },
|
||||
entries: { enumerable: true },
|
||||
forEach: { enumerable: true },
|
||||
[Symbol.toStringTag]: { value: "URLSearchParams", configurable: true },
|
||||
[Symbol.iterator]: { value: URLSearchParams.prototype.entries, configurable: true, writable: true }
|
||||
});
|
||||
if (globalObject[ctorRegistrySymbol] === undefined) {
|
||||
globalObject[ctorRegistrySymbol] = Object.create(null);
|
||||
}
|
||||
globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParams;
|
||||
|
||||
Object.defineProperty(globalObject, interfaceName, {
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: URLSearchParams
|
||||
});
|
||||
};
|
||||
|
||||
const Impl = require("./URLSearchParams-impl.js");
|
||||
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,12 +3,14 @@ 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,
|
||||
file: null,
|
||||
gopher: 70,
|
||||
http: 80,
|
||||
https: 443,
|
||||
ws: 80,
|
||||
@@ -18,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) {
|
||||
@@ -48,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) {
|
||||
@@ -71,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;
|
||||
|
||||
@@ -334,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) {
|
||||
@@ -375,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;
|
||||
@@ -398,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) {
|
||||
@@ -431,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) {
|
||||
@@ -462,7 +412,7 @@ function domainToASCII(domain, beStrict = false) {
|
||||
useSTD3ASCIIRules: beStrict,
|
||||
verifyDNSLength: beStrict
|
||||
});
|
||||
if (result === null) {
|
||||
if (result === null || result === "") {
|
||||
return failure;
|
||||
}
|
||||
return result;
|
||||
@@ -593,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;
|
||||
}
|
||||
}
|
||||
@@ -681,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";
|
||||
@@ -715,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;
|
||||
@@ -785,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 {
|
||||
@@ -905,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) {
|
||||
@@ -912,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";
|
||||
@@ -954,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;
|
||||
@@ -1048,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";
|
||||
@@ -1080,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;
|
||||
@@ -1106,55 +1026,40 @@ URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCan
|
||||
}
|
||||
|
||||
if (!isNaN(c)) {
|
||||
this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode);
|
||||
this.url.path[0] += utf8PercentEncodeCodePoint(c, isC0ControlPercentEncode);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
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";
|
||||
}
|
||||
URLStateMachine.prototype["parse query"] = function parseQuery(c) {
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
this.buffer = "";
|
||||
if (c === 35) {
|
||||
this.url.fragment = "";
|
||||
this.state = "fragment";
|
||||
}
|
||||
} else {
|
||||
if (!this.stateOverride & c === 35) {
|
||||
this.url.fragment = "";
|
||||
this.state = "fragment";
|
||||
} 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]))) {
|
||||
this.parseError = true;
|
||||
}
|
||||
|
||||
this.buffer += cStr;
|
||||
const queryPercentEncodePredicate = isSpecial(this.url) ? isSpecialQueryPercentEncode : isQueryPercentEncode;
|
||||
// TODO: use "percent-encode after encoding" passing in this.encodingOverride
|
||||
this.url.query += utf8PercentEncodeCodePoint(c, queryPercentEncodePredicate);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
URLStateMachine.prototype["parse fragment"] = function parseFragment(c) {
|
||||
if (isNaN(c)) { // do nothing
|
||||
} else if (c === 0x0) {
|
||||
this.parseError = true;
|
||||
} 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]) ||
|
||||
@@ -1162,7 +1067,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;
|
||||
@@ -1186,15 +1091,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1233,7 +1139,6 @@ module.exports.serializeURLOrigin = function (url) {
|
||||
return "null";
|
||||
}
|
||||
case "ftp":
|
||||
case "gopher":
|
||||
case "http":
|
||||
case "https":
|
||||
case "ws":
|
||||
@@ -1244,8 +1149,14 @@ module.exports.serializeURLOrigin = function (url) {
|
||||
port: url.port
|
||||
});
|
||||
case "file":
|
||||
// spec says "exercise to the reader", chrome says "file://"
|
||||
return "file://";
|
||||
// The spec says:
|
||||
// > Unfortunate as it is, this is left as an exercise to the reader. When in doubt, return a new opaque origin.
|
||||
// Browsers tested so far:
|
||||
// - Chrome says "file://", but treats file: URLs as cross-origin for most (all?) purposes; see e.g.
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=37586
|
||||
// - Firefox says "null", but treats file: URLs as same-origin sometimes based on directory stuff; see
|
||||
// https://developer.mozilla.org/en-US/docs/Archive/Misc_top_level/Same-origin_policy_for_file:_URIs
|
||||
return "null";
|
||||
default:
|
||||
// serializing an opaque origin returns "null"
|
||||
return "null";
|
||||
@@ -1266,19 +1177,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
|
||||
};
|
||||
74
node_modules/whatwg-url/lib/utils.js → node_modules/whatwg-url/dist/utils.js
generated
vendored
74
node_modules/whatwg-url/lib/utils.js → node_modules/whatwg-url/dist/utils.js
generated
vendored
@@ -5,35 +5,12 @@ function isObject(value) {
|
||||
return typeof value === "object" && value !== null || typeof value === "function";
|
||||
}
|
||||
|
||||
function getReferenceToBytes(bufferSource) {
|
||||
// Node.js' Buffer does not allow subclassing for now, so we can get away with a prototype object check for perf.
|
||||
if (Object.getPrototypeOf(bufferSource) === Buffer.prototype) {
|
||||
return bufferSource;
|
||||
}
|
||||
if (bufferSource instanceof ArrayBuffer) {
|
||||
return Buffer.from(bufferSource);
|
||||
}
|
||||
return Buffer.from(bufferSource.buffer, bufferSource.byteOffset, bufferSource.byteLength);
|
||||
}
|
||||
|
||||
function getCopyToBytes(bufferSource) {
|
||||
return Buffer.from(getReferenceToBytes(bufferSource));
|
||||
}
|
||||
|
||||
function mixin(target, source) {
|
||||
const keys = Object.getOwnPropertyNames(source);
|
||||
for (let i = 0; i < keys.length; ++i) {
|
||||
if (keys[i] in target) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i]));
|
||||
}
|
||||
}
|
||||
const hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
|
||||
|
||||
const wrapperSymbol = Symbol("wrapper");
|
||||
const implSymbol = Symbol("impl");
|
||||
const sameObjectCaches = Symbol("SameObject caches");
|
||||
const ctorRegistrySymbol = Symbol.for("[webidl2js] constructor registry");
|
||||
|
||||
function getSameObject(wrapper, prop, creator) {
|
||||
if (!wrapper[sameObjectCaches]) {
|
||||
@@ -68,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") {
|
||||
@@ -84,6 +62,33 @@ function isArrayIndexPropName(P) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const byteLengthGetter =
|
||||
Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
||||
function isArrayBuffer(value) {
|
||||
try {
|
||||
byteLengthGetter.call(value);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
@@ -96,20 +101,26 @@ const namedSetNew = Symbol("named property set new");
|
||||
const namedSetExisting = Symbol("named property set existing");
|
||||
const namedDelete = Symbol("named property delete");
|
||||
|
||||
const asyncIteratorNext = Symbol("async iterator get the next iteration result");
|
||||
const asyncIteratorReturn = Symbol("async iterator return steps");
|
||||
const asyncIteratorInit = Symbol("async iterator initialization steps");
|
||||
const asyncIteratorEOI = Symbol("async iterator end of iteration");
|
||||
|
||||
module.exports = exports = {
|
||||
isObject,
|
||||
getReferenceToBytes,
|
||||
getCopyToBytes,
|
||||
mixin,
|
||||
hasOwn,
|
||||
wrapperSymbol,
|
||||
implSymbol,
|
||||
getSameObject,
|
||||
ctorRegistrySymbol,
|
||||
wrapperForImpl,
|
||||
implForWrapper,
|
||||
tryWrapperForImpl,
|
||||
tryImplForWrapper,
|
||||
iterInternalSymbol,
|
||||
IteratorPrototype,
|
||||
AsyncIteratorPrototype,
|
||||
isArrayBuffer,
|
||||
isArrayIndexPropName,
|
||||
supportsPropertyIndex,
|
||||
supportedPropertyIndices,
|
||||
@@ -121,5 +132,10 @@ module.exports = exports = {
|
||||
namedGet,
|
||||
namedSetNew,
|
||||
namedSetExisting,
|
||||
namedDelete
|
||||
namedDelete,
|
||||
asyncIteratorNext,
|
||||
asyncIteratorReturn,
|
||||
asyncIteratorInit,
|
||||
asyncIteratorEOI,
|
||||
iteratorResult
|
||||
};
|
||||
24
node_modules/whatwg-url/index.js
generated
vendored
Normal file
24
node_modules/whatwg-url/index.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
const { URL, URLSearchParams } = require("./webidl2js-wrapper");
|
||||
const urlStateMachine = require("./dist/url-state-machine");
|
||||
const percentEncoding = require("./dist/percent-encoding");
|
||||
|
||||
const sharedGlobalObject = {};
|
||||
URL.install(sharedGlobalObject, ["Window"]);
|
||||
URLSearchParams.install(sharedGlobalObject, ["Window"]);
|
||||
|
||||
exports.URL = sharedGlobalObject.URL;
|
||||
exports.URLSearchParams = sharedGlobalObject.URLSearchParams;
|
||||
|
||||
exports.parseURL = urlStateMachine.parseURL;
|
||||
exports.basicURLParse = urlStateMachine.basicURLParse;
|
||||
exports.serializeURL = urlStateMachine.serializeURL;
|
||||
exports.serializeHost = urlStateMachine.serializeHost;
|
||||
exports.serializeInteger = urlStateMachine.serializeInteger;
|
||||
exports.serializeURLOrigin = urlStateMachine.serializeURLOrigin;
|
||||
exports.setTheUsername = urlStateMachine.setTheUsername;
|
||||
exports.setThePassword = urlStateMachine.setThePassword;
|
||||
exports.cannotHaveAUsernamePasswordPort = urlStateMachine.cannotHaveAUsernamePasswordPort;
|
||||
|
||||
exports.percentDecode = percentEncoding.percentDecodeBytes;
|
||||
396
node_modules/whatwg-url/lib/URL.js
generated
vendored
396
node_modules/whatwg-url/lib/URL.js
generated
vendored
@@ -1,396 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function URL(url) {
|
||||
if (!new.target) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URL'. Please use the 'new' operator; this constructor " + "cannot be called as a function."
|
||||
);
|
||||
}
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URL': 1 " + "argument required, but only " + arguments.length + " present."
|
||||
);
|
||||
}
|
||||
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length && i < 2; ++i) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = conversions["USVString"](args[0], { context: "Failed to construct 'URL': parameter 1" });
|
||||
|
||||
if (args[1] !== undefined) {
|
||||
args[1] = conversions["USVString"](args[1], { context: "Failed to construct 'URL': parameter 2" });
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.defineProperty(URL, "prototype", {
|
||||
value: URL.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
URL.prototype.toJSON = function toJSON() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].toJSON();
|
||||
};
|
||||
|
||||
Object.defineProperty(URL.prototype, "href", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["href"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.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;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
URL.prototype.toString = function toString() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return this[impl]["href"];
|
||||
};
|
||||
|
||||
Object.defineProperty(URL.prototype, "origin", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["origin"];
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "protocol", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["protocol"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.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;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "username", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["username"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.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;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "password", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["password"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.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;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "host", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["host"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.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;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "hostname", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hostname"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.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;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "port", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["port"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.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;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "pathname", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["pathname"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.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;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "search", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["search"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.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;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "searchParams", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return utils.getSameObject(this, "searchParams", () => {
|
||||
return utils.tryWrapperForImpl(this[impl]["searchParams"]);
|
||||
});
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "hash", {
|
||||
get() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl]["hash"];
|
||||
},
|
||||
|
||||
set(V) {
|
||||
if (!this || !module.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;
|
||||
},
|
||||
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, Symbol.toStringTag, {
|
||||
value: "URL",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
mixedInto: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
|
||||
if (obj instanceof module.exports.mixedInto[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
|
||||
if (wrapper instanceof module.exports.mixedInto[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'URL'.`);
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(URL.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(URL.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: URL,
|
||||
expose: {
|
||||
Window: { URL },
|
||||
Worker: { URL }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require(".//URL-impl.js");
|
||||
449
node_modules/whatwg-url/lib/URLSearchParams.js
generated
vendored
449
node_modules/whatwg-url/lib/URLSearchParams.js
generated
vendored
@@ -1,449 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
const IteratorPrototype = Object.create(utils.IteratorPrototype, {
|
||||
next: {
|
||||
value: function next() {
|
||||
const internal = this[utils.iterInternalSymbol];
|
||||
const { target, kind, index } = internal;
|
||||
const values = Array.from(target[impl]);
|
||||
const len = values.length;
|
||||
if (index >= len) {
|
||||
return { value: undefined, done: true };
|
||||
}
|
||||
|
||||
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 };
|
||||
},
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
},
|
||||
[Symbol.toStringTag]: {
|
||||
value: "URLSearchParamsIterator",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
|
||||
function URLSearchParams() {
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length && i < 1; ++i) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
if (args[0] !== undefined) {
|
||||
if (utils.isObject(args[0])) {
|
||||
if (args[0][Symbol.iterator] !== undefined) {
|
||||
if (!utils.isObject(args[0])) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URLSearchParams': parameter 1" + " sequence" + " is not an iterable object."
|
||||
);
|
||||
} else {
|
||||
const V = [];
|
||||
const tmp = args[0];
|
||||
for (let nextItem of tmp) {
|
||||
if (!utils.isObject(nextItem)) {
|
||||
throw new TypeError(
|
||||
"Failed to construct 'URLSearchParams': parameter 1" +
|
||||
" sequence" +
|
||||
"'s element" +
|
||||
" is not an iterable object."
|
||||
);
|
||||
} else {
|
||||
const V = [];
|
||||
const tmp = nextItem;
|
||||
for (let nextItem of tmp) {
|
||||
nextItem = conversions["USVString"](nextItem, {
|
||||
context:
|
||||
"Failed to construct 'URLSearchParams': parameter 1" + " sequence" + "'s element" + "'s element"
|
||||
});
|
||||
|
||||
V.push(nextItem);
|
||||
}
|
||||
nextItem = V;
|
||||
}
|
||||
|
||||
V.push(nextItem);
|
||||
}
|
||||
args[0] = V;
|
||||
}
|
||||
} else {
|
||||
if (!utils.isObject(args[0])) {
|
||||
throw new TypeError("Failed to construct 'URLSearchParams': parameter 1" + " record" + " is not an object.");
|
||||
} else {
|
||||
const result = Object.create(null);
|
||||
for (const key of Reflect.ownKeys(args[0])) {
|
||||
const desc = Object.getOwnPropertyDescriptor(args[0], key);
|
||||
if (desc && desc.enumerable) {
|
||||
let typedKey = key;
|
||||
let typedValue = args[0][key];
|
||||
|
||||
typedKey = conversions["USVString"](typedKey, {
|
||||
context: "Failed to construct 'URLSearchParams': parameter 1" + " record" + "'s key"
|
||||
});
|
||||
|
||||
typedValue = conversions["USVString"](typedValue, {
|
||||
context: "Failed to construct 'URLSearchParams': parameter 1" + " record" + "'s value"
|
||||
});
|
||||
|
||||
result[typedKey] = typedValue;
|
||||
}
|
||||
}
|
||||
args[0] = result;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
args[0] = conversions["USVString"](args[0], { context: "Failed to construct 'URLSearchParams': parameter 1" });
|
||||
}
|
||||
} else {
|
||||
args[0] = "";
|
||||
}
|
||||
|
||||
iface.setup(this, args);
|
||||
}
|
||||
|
||||
Object.defineProperty(URLSearchParams, "prototype", {
|
||||
value: URLSearchParams.prototype,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(URLSearchParams.prototype, Symbol.iterator, {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
value: function entries() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return module.exports.createDefaultIterator(this, "key+value");
|
||||
}
|
||||
});
|
||||
URLSearchParams.prototype.forEach = function forEach(callback) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'forEach' on 'URLSearchParams': 1 argument required, " + "but only 0 present."
|
||||
);
|
||||
}
|
||||
if (typeof callback !== "function") {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'forEach' on 'URLSearchParams': The callback provided " + "as parameter 1 is not a function."
|
||||
);
|
||||
}
|
||||
const thisArg = arguments[1];
|
||||
let pairs = Array.from(this[impl]);
|
||||
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]);
|
||||
i++;
|
||||
}
|
||||
};
|
||||
URLSearchParams.prototype.append = function append(name, value) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'append' on 'URLSearchParams': 2 " +
|
||||
"arguments required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length && i < 2; ++i) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = conversions["USVString"](args[0], {
|
||||
context: "Failed to execute 'append' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
|
||||
args[1] = conversions["USVString"](args[1], {
|
||||
context: "Failed to execute 'append' on 'URLSearchParams': parameter 2"
|
||||
});
|
||||
|
||||
return this[impl].append(...args);
|
||||
};
|
||||
|
||||
URLSearchParams.prototype.delete = function _(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'delete' on 'URLSearchParams': 1 " +
|
||||
"argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length && i < 1; ++i) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = conversions["USVString"](args[0], {
|
||||
context: "Failed to execute 'delete' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
|
||||
return this[impl].delete(...args);
|
||||
};
|
||||
|
||||
URLSearchParams.prototype.get = function get(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'get' on 'URLSearchParams': 1 " +
|
||||
"argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length && i < 1; ++i) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = conversions["USVString"](args[0], { context: "Failed to execute 'get' on 'URLSearchParams': parameter 1" });
|
||||
|
||||
return this[impl].get(...args);
|
||||
};
|
||||
|
||||
URLSearchParams.prototype.getAll = function getAll(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'getAll' on 'URLSearchParams': 1 " +
|
||||
"argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length && i < 1; ++i) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = conversions["USVString"](args[0], {
|
||||
context: "Failed to execute 'getAll' on 'URLSearchParams': parameter 1"
|
||||
});
|
||||
|
||||
return utils.tryWrapperForImpl(this[impl].getAll(...args));
|
||||
};
|
||||
|
||||
URLSearchParams.prototype.has = function has(name) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'has' on 'URLSearchParams': 1 " +
|
||||
"argument required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length && i < 1; ++i) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = conversions["USVString"](args[0], { context: "Failed to execute 'has' on 'URLSearchParams': parameter 1" });
|
||||
|
||||
return this[impl].has(...args);
|
||||
};
|
||||
|
||||
URLSearchParams.prototype.set = function set(name, value) {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
throw new TypeError(
|
||||
"Failed to execute 'set' on 'URLSearchParams': 2 " +
|
||||
"arguments required, but only " +
|
||||
arguments.length +
|
||||
" present."
|
||||
);
|
||||
}
|
||||
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length && i < 2; ++i) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = conversions["USVString"](args[0], { context: "Failed to execute 'set' on 'URLSearchParams': parameter 1" });
|
||||
|
||||
args[1] = conversions["USVString"](args[1], { context: "Failed to execute 'set' on 'URLSearchParams': parameter 2" });
|
||||
|
||||
return this[impl].set(...args);
|
||||
};
|
||||
|
||||
URLSearchParams.prototype.sort = function sort() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].sort();
|
||||
};
|
||||
|
||||
URLSearchParams.prototype.toString = function toString() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
|
||||
return this[impl].toString();
|
||||
};
|
||||
|
||||
URLSearchParams.prototype.entries = URLSearchParams.prototype[Symbol.iterator];
|
||||
|
||||
URLSearchParams.prototype.keys = function keys() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return module.exports.createDefaultIterator(this, "key");
|
||||
};
|
||||
|
||||
URLSearchParams.prototype.values = function values() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return module.exports.createDefaultIterator(this, "value");
|
||||
};
|
||||
|
||||
Object.defineProperty(URLSearchParams.prototype, Symbol.toStringTag, {
|
||||
value: "URLSearchParams",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
const iface = {
|
||||
mixedInto: [],
|
||||
is(obj) {
|
||||
if (obj) {
|
||||
if (obj[impl] instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
|
||||
if (obj instanceof module.exports.mixedInto[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImpl(obj) {
|
||||
if (obj) {
|
||||
if (obj instanceof Impl.implementation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const wrapper = utils.wrapperForImpl(obj);
|
||||
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
|
||||
if (wrapper instanceof module.exports.mixedInto[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
convert(obj, { context = "The provided value" } = {}) {
|
||||
if (module.exports.is(obj)) {
|
||||
return utils.implForWrapper(obj);
|
||||
}
|
||||
throw new TypeError(`${context} is not of type 'URLSearchParams'.`);
|
||||
},
|
||||
|
||||
createDefaultIterator(target, kind) {
|
||||
const iterator = Object.create(IteratorPrototype);
|
||||
Object.defineProperty(iterator, utils.iterInternalSymbol, {
|
||||
value: { target, kind, index: 0 },
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return iterator;
|
||||
},
|
||||
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(URLSearchParams.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
createImpl(constructorArgs, privateData) {
|
||||
let obj = Object.create(URLSearchParams.prototype);
|
||||
obj = this.setup(obj, constructorArgs, privateData);
|
||||
return utils.implForWrapper(obj);
|
||||
},
|
||||
_internalSetup(obj) {},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
|
||||
privateData.wrapper = obj;
|
||||
|
||||
this._internalSetup(obj);
|
||||
Object.defineProperty(obj, impl, {
|
||||
value: new Impl.implementation(constructorArgs, privateData),
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
if (Impl.init) {
|
||||
Impl.init(obj[impl], privateData);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
interface: URLSearchParams,
|
||||
expose: {
|
||||
Window: { URLSearchParams },
|
||||
Worker: { URLSearchParams }
|
||||
}
|
||||
}; // iface
|
||||
module.exports = iface;
|
||||
|
||||
const Impl = require(".//URLSearchParams-impl.js");
|
||||
16
node_modules/whatwg-url/lib/public-api.js
generated
vendored
16
node_modules/whatwg-url/lib/public-api.js
generated
vendored
@@ -1,16 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
exports.URL = require("./URL").interface;
|
||||
exports.URLSearchParams = require("./URLSearchParams").interface;
|
||||
|
||||
exports.parseURL = require("./url-state-machine").parseURL;
|
||||
exports.basicURLParse = require("./url-state-machine").basicURLParse;
|
||||
exports.serializeURL = require("./url-state-machine").serializeURL;
|
||||
exports.serializeHost = require("./url-state-machine").serializeHost;
|
||||
exports.serializeInteger = require("./url-state-machine").serializeInteger;
|
||||
exports.serializeURLOrigin = require("./url-state-machine").serializeURLOrigin;
|
||||
exports.setTheUsername = require("./url-state-machine").setTheUsername;
|
||||
exports.setThePassword = require("./url-state-machine").setThePassword;
|
||||
exports.cannotHaveAUsernamePasswordPort = require("./url-state-machine").cannotHaveAUsernamePasswordPort;
|
||||
|
||||
exports.percentDecode = require("./urlencoded").percentDecode;
|
||||
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
|
||||
};
|
||||
70
node_modules/whatwg-url/package.json
generated
vendored
70
node_modules/whatwg-url/package.json
generated
vendored
@@ -1,33 +1,28 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"whatwg-url@6.5.0",
|
||||
"/Users/drew.heavner/Documents/Github/upload-google-play"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "whatwg-url@6.5.0",
|
||||
"_id": "whatwg-url@6.5.0",
|
||||
"_from": "whatwg-url@^8.0.0",
|
||||
"_id": "whatwg-url@8.4.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==",
|
||||
"_integrity": "sha512-vwTUFf6V4zhcPkWp/4CQPr1TW9Ml6SF4lVyaIMBdJw5i6qUUJ1QWM4Z6YYVkfka0OUIzVo/0aNtGVGk256IKWw==",
|
||||
"_location": "/whatwg-url",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "whatwg-url@6.5.0",
|
||||
"raw": "whatwg-url@^8.0.0",
|
||||
"name": "whatwg-url",
|
||||
"escapedName": "whatwg-url",
|
||||
"rawSpec": "6.5.0",
|
||||
"rawSpec": "^8.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "6.5.0"
|
||||
"fetchSpec": "^8.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/data-urls",
|
||||
"/jsdom"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz",
|
||||
"_spec": "6.5.0",
|
||||
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play",
|
||||
"_resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.4.0.tgz",
|
||||
"_shasum": "50fb9615b05469591d2b2bd6dfaed2942ed72837",
|
||||
"_spec": "whatwg-url@^8.0.0",
|
||||
"_where": "/home/codespace/workspace/upload-google-play/node_modules/jsdom",
|
||||
"author": {
|
||||
"name": "Sebastian Mayr",
|
||||
"email": "github@smayr.name"
|
||||
@@ -35,25 +30,31 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/jsdom/whatwg-url/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"lodash.sortby": "^4.7.0",
|
||||
"tr46": "^1.0.1",
|
||||
"webidl-conversions": "^4.0.2"
|
||||
"tr46": "^2.0.2",
|
||||
"webidl-conversions": "^6.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "An implementation of the WHATWG URL Standard's URL API and parsing machinery",
|
||||
"devDependencies": {
|
||||
"browserify": "^16.2.2",
|
||||
"domexception": "^1.0.1",
|
||||
"eslint": "^4.19.1",
|
||||
"istanbul": "~0.4.5",
|
||||
"jest": "^22.4.3",
|
||||
"jsdom": "^11.8.0",
|
||||
"recast": "~0.14.7",
|
||||
"request": "^2.85.0",
|
||||
"webidl2js": "^7.4.0"
|
||||
"browserify": "^16.5.2",
|
||||
"domexception": "^2.0.1",
|
||||
"eslint": "^7.7.0",
|
||||
"glob": "^7.1.6",
|
||||
"got": "^11.5.2",
|
||||
"jest": "^26.4.2",
|
||||
"recast": "^0.20.2",
|
||||
"webidl2js": "^16.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"files": [
|
||||
"lib/"
|
||||
"index.js",
|
||||
"webidl2js-wrapper.js",
|
||||
"dist/"
|
||||
],
|
||||
"homepage": "https://github.com/jsdom/whatwg-url#readme",
|
||||
"jest": {
|
||||
@@ -76,20 +77,19 @@
|
||||
]
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "lib/public-api.js",
|
||||
"main": "index.js",
|
||||
"name": "whatwg-url",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jsdom/whatwg-url.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/transform.js && node scripts/convert-idl.js",
|
||||
"build-live-viewer": "browserify lib/public-api.js --standalone whatwgURL > live-viewer/whatwg-url.js",
|
||||
"build-live-viewer": "browserify index.js --standalone whatwgURL > live-viewer/whatwg-url.js",
|
||||
"coverage": "jest --coverage",
|
||||
"lint": "eslint .",
|
||||
"prepublish": "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": "6.5.0"
|
||||
"version": "8.4.0"
|
||||
}
|
||||
|
||||
7
node_modules/whatwg-url/webidl2js-wrapper.js
generated
vendored
Normal file
7
node_modules/whatwg-url/webidl2js-wrapper.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const URL = require("./dist/URL");
|
||||
const URLSearchParams = require("./dist/URLSearchParams");
|
||||
|
||||
exports.URL = URL;
|
||||
exports.URLSearchParams = URLSearchParams;
|
||||
Reference in New Issue
Block a user