Compare commits
No commits in common. "e9e30f987bc32f27961742ce8055513c393d055b" and "458e9ce7d7507667d2e01c97101f5a8f87b12d6a" have entirely different histories.
e9e30f987b
...
458e9ce7d7
2436 changed files with 2399341 additions and 619 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
||||||
application-key.json
|
application-key.json
|
||||||
.idea/
|
.idea/
|
||||||
|
*.json
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
|
|
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
6
.idea/jsLibraryMappings.xml
Normal file
6
.idea/jsLibraryMappings.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptLibraryMappings">
|
||||||
|
<includedPredefinedLibrary name="Node.js Core" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/splid-js-test.iml" filepath="$PROJECT_DIR$/.idea/splid-js-test.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
19
.idea/php.xml
Normal file
19
.idea/php.xml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MessDetectorOptionsConfiguration">
|
||||||
|
<option name="transferred" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PHPCSFixerOptionsConfiguration">
|
||||||
|
<option name="transferred" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||||
|
<option name="highlightLevel" value="WARNING" />
|
||||||
|
<option name="transferred" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PhpStanOptionsConfiguration">
|
||||||
|
<option name="transferred" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PsalmOptionsConfiguration">
|
||||||
|
<option name="transferred" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/splid-js-test.iml
Normal file
8
.idea/splid-js-test.iml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
1
node_modules/.bin/uuid
generated
vendored
Symbolic link
1
node_modules/.bin/uuid
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../uuid/dist/bin/uuid
|
22
node_modules/agent-base/LICENSE
generated
vendored
Normal file
22
node_modules/agent-base/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
69
node_modules/agent-base/README.md
generated
vendored
Normal file
69
node_modules/agent-base/README.md
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
agent-base
|
||||||
|
==========
|
||||||
|
### Turn a function into an [`http.Agent`][http.Agent] instance
|
||||||
|
|
||||||
|
This module is a thin wrapper around the base `http.Agent` class.
|
||||||
|
|
||||||
|
It provides an abstract class that must define a `connect()` function,
|
||||||
|
which is responsible for creating the underlying socket that the HTTP
|
||||||
|
client requests will use.
|
||||||
|
|
||||||
|
The `connect()` function may return an arbitrary `Duplex` stream, or
|
||||||
|
another `http.Agent` instance to delegate the request to, and may be
|
||||||
|
asynchronous (by defining an `async` function).
|
||||||
|
|
||||||
|
Instances of this agent can be used with the `http` and `https`
|
||||||
|
modules. To differentiate, the options parameter in the `connect()`
|
||||||
|
function includes a `secureEndpoint` property, which can be checked
|
||||||
|
to determine what type of socket should be returned.
|
||||||
|
|
||||||
|
#### Some subclasses:
|
||||||
|
|
||||||
|
Here are some more interesting uses of `agent-base`.
|
||||||
|
Send a pull request to list yours!
|
||||||
|
|
||||||
|
* [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints
|
||||||
|
* [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints
|
||||||
|
* [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS
|
||||||
|
* [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
|
Here's a minimal example that creates a new `net.Socket` or `tls.Socket`
|
||||||
|
based on the `secureEndpoint` property. This agent can be used with both
|
||||||
|
the `http` and `https` modules.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import * as net from 'net';
|
||||||
|
import * as tls from 'tls';
|
||||||
|
import * as http from 'http';
|
||||||
|
import { Agent } from 'agent-base';
|
||||||
|
|
||||||
|
class MyAgent extends Agent {
|
||||||
|
connect(req, opts) {
|
||||||
|
// `secureEndpoint` is true when using the "https" module
|
||||||
|
if (opts.secureEndpoint) {
|
||||||
|
return tls.connect(opts);
|
||||||
|
} else {
|
||||||
|
return net.connect(opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Keep alive enabled means that `connect()` will only be
|
||||||
|
// invoked when a new connection needs to be created
|
||||||
|
const agent = new MyAgent({ keepAlive: true });
|
||||||
|
|
||||||
|
// Pass the `agent` option when creating the HTTP request
|
||||||
|
http.get('http://nodejs.org/api/', { agent }, (res) => {
|
||||||
|
console.log('"response" event!', res.headers);
|
||||||
|
res.pipe(process.stdout);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
[http-proxy-agent]: ../http-proxy-agent
|
||||||
|
[https-proxy-agent]: ../https-proxy-agent
|
||||||
|
[pac-proxy-agent]: ../pac-proxy-agent
|
||||||
|
[socks-proxy-agent]: ../socks-proxy-agent
|
||||||
|
[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent
|
15
node_modules/agent-base/dist/helpers.d.ts
generated
vendored
Normal file
15
node_modules/agent-base/dist/helpers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/// <reference types="node" />
|
||||||
|
/// <reference types="node" />
|
||||||
|
/// <reference types="node" />
|
||||||
|
/// <reference types="node" />
|
||||||
|
/// <reference types="node" />
|
||||||
|
import * as http from 'http';
|
||||||
|
import * as https from 'https';
|
||||||
|
import type { Readable } from 'stream';
|
||||||
|
export type ThenableRequest = http.ClientRequest & {
|
||||||
|
then: Promise<http.IncomingMessage>['then'];
|
||||||
|
};
|
||||||
|
export declare function toBuffer(stream: Readable): Promise<Buffer>;
|
||||||
|
export declare function json(stream: Readable): Promise<any>;
|
||||||
|
export declare function req(url: string | URL, opts?: https.RequestOptions): ThenableRequest;
|
||||||
|
//# sourceMappingURL=helpers.d.ts.map
|
1
node_modules/agent-base/dist/helpers.d.ts.map
generated
vendored
Normal file
1
node_modules/agent-base/dist/helpers.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,GAAG;IAClD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,wBAAsB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAQhE;AAGD,wBAAsB,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAUzD;AAED,wBAAgB,GAAG,CAClB,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,GAAE,KAAK,CAAC,cAAmB,GAC7B,eAAe,CAcjB"}
|
66
node_modules/agent-base/dist/helpers.js
generated
vendored
Normal file
66
node_modules/agent-base/dist/helpers.js
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.req = exports.json = exports.toBuffer = void 0;
|
||||||
|
const http = __importStar(require("http"));
|
||||||
|
const https = __importStar(require("https"));
|
||||||
|
async function toBuffer(stream) {
|
||||||
|
let length = 0;
|
||||||
|
const chunks = [];
|
||||||
|
for await (const chunk of stream) {
|
||||||
|
length += chunk.length;
|
||||||
|
chunks.push(chunk);
|
||||||
|
}
|
||||||
|
return Buffer.concat(chunks, length);
|
||||||
|
}
|
||||||
|
exports.toBuffer = toBuffer;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
async function json(stream) {
|
||||||
|
const buf = await toBuffer(stream);
|
||||||
|
const str = buf.toString('utf8');
|
||||||
|
try {
|
||||||
|
return JSON.parse(str);
|
||||||
|
}
|
||||||
|
catch (_err) {
|
||||||
|
const err = _err;
|
||||||
|
err.message += ` (input: ${str})`;
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.json = json;
|
||||||
|
function req(url, opts = {}) {
|
||||||
|
const href = typeof url === 'string' ? url : url.href;
|
||||||
|
const req = (href.startsWith('https:') ? https : http).request(url, opts);
|
||||||
|
const promise = new Promise((resolve, reject) => {
|
||||||
|
req
|
||||||
|
.once('response', resolve)
|
||||||
|
.once('error', reject)
|
||||||
|
.end();
|
||||||
|
});
|
||||||
|
req.then = promise.then.bind(promise);
|
||||||
|
return req;
|
||||||
|
}
|
||||||
|
exports.req = req;
|
||||||
|
//# sourceMappingURL=helpers.js.map
|
1
node_modules/agent-base/dist/helpers.js.map
generated
vendored
Normal file
1
node_modules/agent-base/dist/helpers.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,6CAA+B;AAOxB,KAAK,UAAU,QAAQ,CAAC,MAAgB;IAC9C,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE;QACjC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACnB;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC;AARD,4BAQC;AAED,8DAA8D;AACvD,KAAK,UAAU,IAAI,CAAC,MAAgB;IAC1C,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACvB;IAAC,OAAO,IAAa,EAAE;QACvB,MAAM,GAAG,GAAG,IAAa,CAAC;QAC1B,GAAG,CAAC,OAAO,IAAI,YAAY,GAAG,GAAG,CAAC;QAClC,MAAM,GAAG,CAAC;KACV;AACF,CAAC;AAVD,oBAUC;AAED,SAAgB,GAAG,CAClB,GAAiB,EACjB,OAA6B,EAAE;IAE/B,MAAM,IAAI,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACtD,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAC7D,GAAG,EACH,IAAI,CACe,CAAC;IACrB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrE,GAAG;aACD,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC;aACzB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;aACrB,GAAG,EAAqB,CAAC;IAC5B,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,GAAG,CAAC;AACZ,CAAC;AAjBD,kBAiBC"}
|
41
node_modules/agent-base/dist/index.d.ts
generated
vendored
Normal file
41
node_modules/agent-base/dist/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/// <reference types="node" />
|
||||||
|
/// <reference types="node" />
|
||||||
|
/// <reference types="node" />
|
||||||
|
/// <reference types="node" />
|
||||||
|
import * as net from 'net';
|
||||||
|
import * as tls from 'tls';
|
||||||
|
import * as http from 'http';
|
||||||
|
import type { Duplex } from 'stream';
|
||||||
|
export * from './helpers';
|
||||||
|
interface HttpConnectOpts extends net.TcpNetConnectOpts {
|
||||||
|
secureEndpoint: false;
|
||||||
|
protocol?: string;
|
||||||
|
}
|
||||||
|
interface HttpsConnectOpts extends tls.ConnectionOptions {
|
||||||
|
secureEndpoint: true;
|
||||||
|
protocol?: string;
|
||||||
|
port: number;
|
||||||
|
}
|
||||||
|
export type AgentConnectOpts = HttpConnectOpts | HttpsConnectOpts;
|
||||||
|
declare const INTERNAL: unique symbol;
|
||||||
|
export declare abstract class Agent extends http.Agent {
|
||||||
|
private [INTERNAL];
|
||||||
|
options: Partial<net.TcpNetConnectOpts & tls.ConnectionOptions>;
|
||||||
|
keepAlive: boolean;
|
||||||
|
constructor(opts?: http.AgentOptions);
|
||||||
|
abstract connect(req: http.ClientRequest, options: AgentConnectOpts): Promise<Duplex | http.Agent> | Duplex | http.Agent;
|
||||||
|
/**
|
||||||
|
* Determine whether this is an `http` or `https` request.
|
||||||
|
*/
|
||||||
|
isSecureEndpoint(options?: AgentConnectOpts): boolean;
|
||||||
|
private incrementSockets;
|
||||||
|
private decrementSockets;
|
||||||
|
getName(options: AgentConnectOpts): string;
|
||||||
|
createSocket(req: http.ClientRequest, options: AgentConnectOpts, cb: (err: Error | null, s?: Duplex) => void): void;
|
||||||
|
createConnection(): Duplex;
|
||||||
|
get defaultPort(): number;
|
||||||
|
set defaultPort(v: number);
|
||||||
|
get protocol(): string;
|
||||||
|
set protocol(v: string);
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=index.d.ts.map
|
1
node_modules/agent-base/dist/index.d.ts.map
generated
vendored
Normal file
1
node_modules/agent-base/dist/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,cAAc,WAAW,CAAC;AAE1B,UAAU,eAAgB,SAAQ,GAAG,CAAC,iBAAiB;IACtD,cAAc,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,gBAAiB,SAAQ,GAAG,CAAC,iBAAiB;IACvD,cAAc,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAElE,QAAA,MAAM,QAAQ,eAAmC,CAAC;AAQlD,8BAAsB,KAAM,SAAQ,IAAI,CAAC,KAAK;IAC7C,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAgB;IAGlC,OAAO,EAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACjE,SAAS,EAAG,OAAO,CAAC;gBAER,IAAI,CAAC,EAAE,IAAI,CAAC,YAAY;IAKpC,QAAQ,CAAC,OAAO,CACf,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,OAAO,EAAE,gBAAgB,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,KAAK;IAErD;;OAEG;IACH,gBAAgB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO;IAqCrD,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM;IAa1C,YAAY,CACX,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,OAAO,EAAE,gBAAgB,EACzB,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;IAgC5C,gBAAgB,IAAI,MAAM;IAW1B,IAAI,WAAW,IAAI,MAAM,CAKxB;IAED,IAAI,WAAW,CAAC,CAAC,EAAE,MAAM,EAIxB;IAED,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED,IAAI,QAAQ,CAAC,CAAC,EAAE,MAAM,EAIrB;CACD"}
|
180
node_modules/agent-base/dist/index.js
generated
vendored
Normal file
180
node_modules/agent-base/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||||
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.Agent = void 0;
|
||||||
|
const net = __importStar(require("net"));
|
||||||
|
const http = __importStar(require("http"));
|
||||||
|
const https_1 = require("https");
|
||||||
|
__exportStar(require("./helpers"), exports);
|
||||||
|
const INTERNAL = Symbol('AgentBaseInternalState');
|
||||||
|
class Agent extends http.Agent {
|
||||||
|
constructor(opts) {
|
||||||
|
super(opts);
|
||||||
|
this[INTERNAL] = {};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Determine whether this is an `http` or `https` request.
|
||||||
|
*/
|
||||||
|
isSecureEndpoint(options) {
|
||||||
|
if (options) {
|
||||||
|
// First check the `secureEndpoint` property explicitly, since this
|
||||||
|
// means that a parent `Agent` is "passing through" to this instance.
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
if (typeof options.secureEndpoint === 'boolean') {
|
||||||
|
return options.secureEndpoint;
|
||||||
|
}
|
||||||
|
// If no explicit `secure` endpoint, check if `protocol` property is
|
||||||
|
// set. This will usually be the case since using a full string URL
|
||||||
|
// or `URL` instance should be the most common usage.
|
||||||
|
if (typeof options.protocol === 'string') {
|
||||||
|
return options.protocol === 'https:';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Finally, if no `protocol` property was set, then fall back to
|
||||||
|
// checking the stack trace of the current call stack, and try to
|
||||||
|
// detect the "https" module.
|
||||||
|
const { stack } = new Error();
|
||||||
|
if (typeof stack !== 'string')
|
||||||
|
return false;
|
||||||
|
return stack
|
||||||
|
.split('\n')
|
||||||
|
.some((l) => l.indexOf('(https.js:') !== -1 ||
|
||||||
|
l.indexOf('node:https:') !== -1);
|
||||||
|
}
|
||||||
|
// In order to support async signatures in `connect()` and Node's native
|
||||||
|
// connection pooling in `http.Agent`, the array of sockets for each origin
|
||||||
|
// has to be updated synchronously. This is so the length of the array is
|
||||||
|
// accurate when `addRequest()` is next called. We achieve this by creating a
|
||||||
|
// fake socket and adding it to `sockets[origin]` and incrementing
|
||||||
|
// `totalSocketCount`.
|
||||||
|
incrementSockets(name) {
|
||||||
|
// If `maxSockets` and `maxTotalSockets` are both Infinity then there is no
|
||||||
|
// need to create a fake socket because Node.js native connection pooling
|
||||||
|
// will never be invoked.
|
||||||
|
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// All instances of `sockets` are expected TypeScript errors. The
|
||||||
|
// alternative is to add it as a private property of this class but that
|
||||||
|
// will break TypeScript subclassing.
|
||||||
|
if (!this.sockets[name]) {
|
||||||
|
// @ts-expect-error `sockets` is readonly in `@types/node`
|
||||||
|
this.sockets[name] = [];
|
||||||
|
}
|
||||||
|
const fakeSocket = new net.Socket({ writable: false });
|
||||||
|
this.sockets[name].push(fakeSocket);
|
||||||
|
// @ts-expect-error `totalSocketCount` isn't defined in `@types/node`
|
||||||
|
this.totalSocketCount++;
|
||||||
|
return fakeSocket;
|
||||||
|
}
|
||||||
|
decrementSockets(name, socket) {
|
||||||
|
if (!this.sockets[name] || socket === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const sockets = this.sockets[name];
|
||||||
|
const index = sockets.indexOf(socket);
|
||||||
|
if (index !== -1) {
|
||||||
|
sockets.splice(index, 1);
|
||||||
|
// @ts-expect-error `totalSocketCount` isn't defined in `@types/node`
|
||||||
|
this.totalSocketCount--;
|
||||||
|
if (sockets.length === 0) {
|
||||||
|
// @ts-expect-error `sockets` is readonly in `@types/node`
|
||||||
|
delete this.sockets[name];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// In order to properly update the socket pool, we need to call `getName()` on
|
||||||
|
// the core `https.Agent` if it is a secureEndpoint.
|
||||||
|
getName(options) {
|
||||||
|
const secureEndpoint = typeof options.secureEndpoint === 'boolean'
|
||||||
|
? options.secureEndpoint
|
||||||
|
: this.isSecureEndpoint(options);
|
||||||
|
if (secureEndpoint) {
|
||||||
|
// @ts-expect-error `getName()` isn't defined in `@types/node`
|
||||||
|
return https_1.Agent.prototype.getName.call(this, options);
|
||||||
|
}
|
||||||
|
// @ts-expect-error `getName()` isn't defined in `@types/node`
|
||||||
|
return super.getName(options);
|
||||||
|
}
|
||||||
|
createSocket(req, options, cb) {
|
||||||
|
const connectOpts = {
|
||||||
|
...options,
|
||||||
|
secureEndpoint: this.isSecureEndpoint(options),
|
||||||
|
};
|
||||||
|
const name = this.getName(connectOpts);
|
||||||
|
const fakeSocket = this.incrementSockets(name);
|
||||||
|
Promise.resolve()
|
||||||
|
.then(() => this.connect(req, connectOpts))
|
||||||
|
.then((socket) => {
|
||||||
|
this.decrementSockets(name, fakeSocket);
|
||||||
|
if (socket instanceof http.Agent) {
|
||||||
|
try {
|
||||||
|
// @ts-expect-error `addRequest()` isn't defined in `@types/node`
|
||||||
|
return socket.addRequest(req, connectOpts);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
return cb(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this[INTERNAL].currentSocket = socket;
|
||||||
|
// @ts-expect-error `createSocket()` isn't defined in `@types/node`
|
||||||
|
super.createSocket(req, options, cb);
|
||||||
|
}, (err) => {
|
||||||
|
this.decrementSockets(name, fakeSocket);
|
||||||
|
cb(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
createConnection() {
|
||||||
|
const socket = this[INTERNAL].currentSocket;
|
||||||
|
this[INTERNAL].currentSocket = undefined;
|
||||||
|
if (!socket) {
|
||||||
|
throw new Error('No socket was returned in the `connect()` function');
|
||||||
|
}
|
||||||
|
return socket;
|
||||||
|
}
|
||||||
|
get defaultPort() {
|
||||||
|
return (this[INTERNAL].defaultPort ??
|
||||||
|
(this.protocol === 'https:' ? 443 : 80));
|
||||||
|
}
|
||||||
|
set defaultPort(v) {
|
||||||
|
if (this[INTERNAL]) {
|
||||||
|
this[INTERNAL].defaultPort = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get protocol() {
|
||||||
|
return (this[INTERNAL].protocol ??
|
||||||
|
(this.isSecureEndpoint() ? 'https:' : 'http:'));
|
||||||
|
}
|
||||||
|
set protocol(v) {
|
||||||
|
if (this[INTERNAL]) {
|
||||||
|
this[INTERNAL].protocol = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Agent = Agent;
|
||||||
|
//# sourceMappingURL=index.js.map
|
1
node_modules/agent-base/dist/index.js.map
generated
vendored
Normal file
1
node_modules/agent-base/dist/index.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAE3B,2CAA6B;AAC7B,iCAA4C;AAG5C,4CAA0B;AAe1B,MAAM,QAAQ,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAQlD,MAAsB,KAAM,SAAQ,IAAI,CAAC,KAAK;IAO7C,YAAY,IAAwB;QACnC,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;IACrB,CAAC;IAOD;;OAEG;IACH,gBAAgB,CAAC,OAA0B;QAC1C,IAAI,OAAO,EAAE;YACZ,mEAAmE;YACnE,qEAAqE;YACrE,8DAA8D;YAC9D,IAAI,OAAQ,OAAe,CAAC,cAAc,KAAK,SAAS,EAAE;gBACzD,OAAO,OAAO,CAAC,cAAc,CAAC;aAC9B;YAED,oEAAoE;YACpE,mEAAmE;YACnE,qDAAqD;YACrD,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;gBACzC,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC;aACrC;SACD;QAED,gEAAgE;QAChE,iEAAiE;QACjE,6BAA6B;QAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC;QAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5C,OAAO,KAAK;aACV,KAAK,CAAC,IAAI,CAAC;aACX,IAAI,CACJ,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAChC,CAAC;IACJ,CAAC;IAED,wEAAwE;IACxE,2EAA2E;IAC3E,yEAAyE;IACzE,6EAA6E;IAC7E,kEAAkE;IAClE,sBAAsB;IACd,gBAAgB,CAAC,IAAY;QACpC,2EAA2E;QAC3E,yEAAyE;QACzE,yBAAyB;QACzB,IAAI,IAAI,CAAC,UAAU,KAAK,QAAQ,IAAI,IAAI,CAAC,eAAe,KAAK,QAAQ,EAAE;YACtE,OAAO,IAAI,CAAC;SACZ;QACD,iEAAiE;QACjE,wEAAwE;QACxE,qCAAqC;QACrC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACxB,0DAA0D;YAC1D,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SACxB;QACD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACtD,qEAAqE;QACrE,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,OAAO,UAAU,CAAC;IACnB,CAAC;IAEO,gBAAgB,CAAC,IAAY,EAAE,MAAyB;QAC/D,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,KAAK,IAAI,EAAE;YAC3C,OAAO;SACP;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAiB,CAAC;QACnD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACjB,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACzB,sEAAsE;YACtE,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;gBACzB,0DAA0D;gBAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aAC1B;SACD;IACF,CAAC;IAED,8EAA8E;IAC9E,oDAAoD;IACpD,OAAO,CAAC,OAAyB;QAChC,MAAM,cAAc,GACnB,OAAO,OAAO,CAAC,cAAc,KAAK,SAAS;YAC1C,CAAC,CAAC,OAAO,CAAC,cAAc;YACxB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,cAAc,EAAE;YACnB,8DAA8D;YAC9D,OAAO,aAAU,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACxD;QACD,8DAA8D;QAC9D,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,YAAY,CACX,GAAuB,EACvB,OAAyB,EACzB,EAA2C;QAE3C,MAAM,WAAW,GAAG;YACnB,GAAG,OAAO;YACV,cAAc,EAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;SAC9C,CAAC;QACF,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACvC,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,CAAC,OAAO,EAAE;aACf,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;aAC1C,IAAI,CACJ,CAAC,MAAM,EAAE,EAAE;YACV,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YACxC,IAAI,MAAM,YAAY,IAAI,CAAC,KAAK,EAAE;gBACjC,IAAI;oBACH,iEAAiE;oBACjE,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;iBAC3C;gBAAC,OAAO,GAAY,EAAE;oBACtB,OAAO,EAAE,CAAC,GAAY,CAAC,CAAC;iBACxB;aACD;YACD,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,GAAG,MAAM,CAAC;YACtC,mEAAmE;YACnE,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QACtC,CAAC,EACD,CAAC,GAAG,EAAE,EAAE;YACP,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YACxC,EAAE,CAAC,GAAG,CAAC,CAAC;QACT,CAAC,CACD,CAAC;IACJ,CAAC;IAED,gBAAgB;QACf,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC;QAC5C,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,GAAG,SAAS,CAAC;QACzC,IAAI,CAAC,MAAM,EAAE;YACZ,MAAM,IAAI,KAAK,CACd,oDAAoD,CACpD,CAAC;SACF;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED,IAAI,WAAW;QACd,OAAO,CACN,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW;YAC1B,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CACvC,CAAC;IACH,CAAC;IAED,IAAI,WAAW,CAAC,CAAS;QACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE;YACnB,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC;SAC/B;IACF,CAAC;IAED,IAAI,QAAQ;QACX,OAAO,CACN,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ;YACvB,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAC9C,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,CAAC,CAAS;QACrB,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE;YACnB,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC;SAC5B;IACF,CAAC;CACD;AArLD,sBAqLC"}
|
21
node_modules/base64-js/LICENSE
generated
vendored
Normal file
21
node_modules/base64-js/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Jameson Little
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
34
node_modules/base64-js/README.md
generated
vendored
Normal file
34
node_modules/base64-js/README.md
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
base64-js
|
||||||
|
=========
|
||||||
|
|
||||||
|
`base64-js` does basic base64 encoding/decoding in pure JS.
|
||||||
|
|
||||||
|
[](http://travis-ci.org/beatgammit/base64-js)
|
||||||
|
|
||||||
|
Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data.
|
||||||
|
|
||||||
|
Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does.
|
||||||
|
|
||||||
|
## install
|
||||||
|
|
||||||
|
With [npm](https://npmjs.org) do:
|
||||||
|
|
||||||
|
`npm install base64-js` and `var base64js = require('base64-js')`
|
||||||
|
|
||||||
|
For use in web browsers do:
|
||||||
|
|
||||||
|
`<script src="base64js.min.js"></script>`
|
||||||
|
|
||||||
|
[Get supported base64-js with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-base64-js?utm_source=npm-base64-js&utm_medium=referral&utm_campaign=readme)
|
||||||
|
|
||||||
|
## methods
|
||||||
|
|
||||||
|
`base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.
|
||||||
|
|
||||||
|
* `byteLength` - Takes a base64 string and returns length of byte array
|
||||||
|
* `toByteArray` - Takes a base64 string and returns a byte array
|
||||||
|
* `fromByteArray` - Takes a byte array and returns a base64 string
|
||||||
|
|
||||||
|
## license
|
||||||
|
|
||||||
|
MIT
|
1
node_modules/base64-js/base64js.min.js
generated
vendored
Normal file
1
node_modules/base64-js/base64js.min.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
(function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,b.base64js=a()}})(function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b}()({"/":[function(a,b,c){'use strict';function d(a){var b=a.length;if(0<b%4)throw new Error("Invalid string. Length must be a multiple of 4");var c=a.indexOf("=");-1===c&&(c=b);var d=c===b?0:4-c%4;return[c,d]}function e(a,b,c){return 3*(b+c)/4-c}function f(a){var b,c,f=d(a),g=f[0],h=f[1],j=new m(e(a,g,h)),k=0,n=0<h?g-4:g;for(c=0;c<n;c+=4)b=l[a.charCodeAt(c)]<<18|l[a.charCodeAt(c+1)]<<12|l[a.charCodeAt(c+2)]<<6|l[a.charCodeAt(c+3)],j[k++]=255&b>>16,j[k++]=255&b>>8,j[k++]=255&b;return 2===h&&(b=l[a.charCodeAt(c)]<<2|l[a.charCodeAt(c+1)]>>4,j[k++]=255&b),1===h&&(b=l[a.charCodeAt(c)]<<10|l[a.charCodeAt(c+1)]<<4|l[a.charCodeAt(c+2)]>>2,j[k++]=255&b>>8,j[k++]=255&b),j}function g(a){return k[63&a>>18]+k[63&a>>12]+k[63&a>>6]+k[63&a]}function h(a,b,c){for(var d,e=[],f=b;f<c;f+=3)d=(16711680&a[f]<<16)+(65280&a[f+1]<<8)+(255&a[f+2]),e.push(g(d));return e.join("")}function j(a){for(var b,c=a.length,d=c%3,e=[],f=16383,g=0,j=c-d;g<j;g+=f)e.push(h(a,g,g+f>j?j:g+f));return 1===d?(b=a[c-1],e.push(k[b>>2]+k[63&b<<4]+"==")):2===d&&(b=(a[c-2]<<8)+a[c-1],e.push(k[b>>10]+k[63&b>>4]+k[63&b<<2]+"=")),e.join("")}c.byteLength=function(a){var b=d(a),c=b[0],e=b[1];return 3*(c+e)/4-e},c.toByteArray=f,c.fromByteArray=j;for(var k=[],l=[],m="undefined"==typeof Uint8Array?Array:Uint8Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,p=n.length;o<p;++o)k[o]=n[o],l[n.charCodeAt(o)]=o;l[45]=62,l[95]=63},{}]},{},[])("/")});
|
3
node_modules/base64-js/index.d.ts
generated
vendored
Normal file
3
node_modules/base64-js/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export function byteLength(b64: string): number;
|
||||||
|
export function toByteArray(b64: string): Uint8Array;
|
||||||
|
export function fromByteArray(uint8: Uint8Array): string;
|
150
node_modules/base64-js/index.js
generated
vendored
Normal file
150
node_modules/base64-js/index.js
generated
vendored
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
exports.byteLength = byteLength
|
||||||
|
exports.toByteArray = toByteArray
|
||||||
|
exports.fromByteArray = fromByteArray
|
||||||
|
|
||||||
|
var lookup = []
|
||||||
|
var revLookup = []
|
||||||
|
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
||||||
|
|
||||||
|
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
||||||
|
for (var i = 0, len = code.length; i < len; ++i) {
|
||||||
|
lookup[i] = code[i]
|
||||||
|
revLookup[code.charCodeAt(i)] = i
|
||||||
|
}
|
||||||
|
|
||||||
|
// Support decoding URL-safe base64 strings, as Node.js does.
|
||||||
|
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
||||||
|
revLookup['-'.charCodeAt(0)] = 62
|
||||||
|
revLookup['_'.charCodeAt(0)] = 63
|
||||||
|
|
||||||
|
function getLens (b64) {
|
||||||
|
var len = b64.length
|
||||||
|
|
||||||
|
if (len % 4 > 0) {
|
||||||
|
throw new Error('Invalid string. Length must be a multiple of 4')
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trim off extra bytes after placeholder bytes are found
|
||||||
|
// See: https://github.com/beatgammit/base64-js/issues/42
|
||||||
|
var validLen = b64.indexOf('=')
|
||||||
|
if (validLen === -1) validLen = len
|
||||||
|
|
||||||
|
var placeHoldersLen = validLen === len
|
||||||
|
? 0
|
||||||
|
: 4 - (validLen % 4)
|
||||||
|
|
||||||
|
return [validLen, placeHoldersLen]
|
||||||
|
}
|
||||||
|
|
||||||
|
// base64 is 4/3 + up to two characters of the original data
|
||||||
|
function byteLength (b64) {
|
||||||
|
var lens = getLens(b64)
|
||||||
|
var validLen = lens[0]
|
||||||
|
var placeHoldersLen = lens[1]
|
||||||
|
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||||
|
}
|
||||||
|
|
||||||
|
function _byteLength (b64, validLen, placeHoldersLen) {
|
||||||
|
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||||
|
}
|
||||||
|
|
||||||
|
function toByteArray (b64) {
|
||||||
|
var tmp
|
||||||
|
var lens = getLens(b64)
|
||||||
|
var validLen = lens[0]
|
||||||
|
var placeHoldersLen = lens[1]
|
||||||
|
|
||||||
|
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
||||||
|
|
||||||
|
var curByte = 0
|
||||||
|
|
||||||
|
// if there are placeholders, only get up to the last complete 4 chars
|
||||||
|
var len = placeHoldersLen > 0
|
||||||
|
? validLen - 4
|
||||||
|
: validLen
|
||||||
|
|
||||||
|
var i
|
||||||
|
for (i = 0; i < len; i += 4) {
|
||||||
|
tmp =
|
||||||
|
(revLookup[b64.charCodeAt(i)] << 18) |
|
||||||
|
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
||||||
|
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
||||||
|
revLookup[b64.charCodeAt(i + 3)]
|
||||||
|
arr[curByte++] = (tmp >> 16) & 0xFF
|
||||||
|
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||||
|
arr[curByte++] = tmp & 0xFF
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placeHoldersLen === 2) {
|
||||||
|
tmp =
|
||||||
|
(revLookup[b64.charCodeAt(i)] << 2) |
|
||||||
|
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
||||||
|
arr[curByte++] = tmp & 0xFF
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placeHoldersLen === 1) {
|
||||||
|
tmp =
|
||||||
|
(revLookup[b64.charCodeAt(i)] << 10) |
|
||||||
|
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
||||||
|
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
||||||
|
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||||
|
arr[curByte++] = tmp & 0xFF
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr
|
||||||
|
}
|
||||||
|
|
||||||
|
function tripletToBase64 (num) {
|
||||||
|
return lookup[num >> 18 & 0x3F] +
|
||||||
|
lookup[num >> 12 & 0x3F] +
|
||||||
|
lookup[num >> 6 & 0x3F] +
|
||||||
|
lookup[num & 0x3F]
|
||||||
|
}
|
||||||
|
|
||||||
|
function encodeChunk (uint8, start, end) {
|
||||||
|
var tmp
|
||||||
|
var output = []
|
||||||
|
for (var i = start; i < end; i += 3) {
|
||||||
|
tmp =
|
||||||
|
((uint8[i] << 16) & 0xFF0000) +
|
||||||
|
((uint8[i + 1] << 8) & 0xFF00) +
|
||||||
|
(uint8[i + 2] & 0xFF)
|
||||||
|
output.push(tripletToBase64(tmp))
|
||||||
|
}
|
||||||
|
return output.join('')
|
||||||
|
}
|
||||||
|
|
||||||
|
function fromByteArray (uint8) {
|
||||||
|
var tmp
|
||||||
|
var len = uint8.length
|
||||||
|
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
||||||
|
var parts = []
|
||||||
|
var maxChunkLength = 16383 // must be multiple of 3
|
||||||
|
|
||||||
|
// go through the array every three bytes, we'll deal with trailing stuff later
|
||||||
|
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
||||||
|
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// pad the end with zeros, but make sure to not forget the extra bytes
|
||||||
|
if (extraBytes === 1) {
|
||||||
|
tmp = uint8[len - 1]
|
||||||
|
parts.push(
|
||||||
|
lookup[tmp >> 2] +
|
||||||
|
lookup[(tmp << 4) & 0x3F] +
|
||||||
|
'=='
|
||||||
|
)
|
||||||
|
} else if (extraBytes === 2) {
|
||||||
|
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
||||||
|
parts.push(
|
||||||
|
lookup[tmp >> 10] +
|
||||||
|
lookup[(tmp >> 4) & 0x3F] +
|
||||||
|
lookup[(tmp << 2) & 0x3F] +
|
||||||
|
'='
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return parts.join('')
|
||||||
|
}
|
376
node_modules/bignumber.js/CHANGELOG.md
generated
vendored
Normal file
376
node_modules/bignumber.js/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,376 @@
|
||||||
|
#### 9.3.0
|
||||||
|
|
||||||
|
* 19/04/25
|
||||||
|
* Refactor type declarations:
|
||||||
|
* Rename *bignumber.d.ts* to *types.d.ts*.
|
||||||
|
* Rename *bignumber.d.cts* to *bignumber.d.ts*.
|
||||||
|
* Add `export as namespace` to *bignumber.d.ts*.
|
||||||
|
* Remove subpath exports from *package.json*.
|
||||||
|
* Refactor named export from *bignumber.d.mts*.
|
||||||
|
* #383 Remove `?` from static `BigNumber` and `default` properties.
|
||||||
|
* Add blank lines after titles in *CHANGELOG.md*.
|
||||||
|
|
||||||
|
#### 9.2.1
|
||||||
|
|
||||||
|
* 08/04/25
|
||||||
|
* ##371 #382 Add `BigNumber` as named export.
|
||||||
|
|
||||||
|
#### 9.2.0
|
||||||
|
|
||||||
|
* 03/04/25
|
||||||
|
* #355 Support `BigInt` argument.
|
||||||
|
* #371 Provide separate type definitions for CommonJS and ES modules.
|
||||||
|
* #374 Correct `comparedTo` return type.
|
||||||
|
|
||||||
|
#### 9.1.2
|
||||||
|
|
||||||
|
* 28/08/23
|
||||||
|
* #354 Amend `round` to avoid bug in v8 Maglev compiler.
|
||||||
|
* [BUGFIX] #344 `minimum(0, -0)` should be `-0`.
|
||||||
|
|
||||||
|
#### 9.1.1
|
||||||
|
|
||||||
|
* 04/12/22
|
||||||
|
* #338 [BUGFIX] `exponentiatedBy`: ensure `0**-n === Infinity` for very large `n`.
|
||||||
|
|
||||||
|
#### 9.1.0
|
||||||
|
|
||||||
|
* 08/08/22
|
||||||
|
* #329 Remove `import` example.
|
||||||
|
* #277 Resolve lint warnings and add number `toString` note.
|
||||||
|
* Correct `decimalPlaces()` return type in *bignumber.d.ts*.
|
||||||
|
* Add ES module global `crypto` example.
|
||||||
|
* #322 Add `exports` field to *package.json*.
|
||||||
|
* #251 (#308) Amend *bignumber.d.ts* to allow instantiating a BigNumber without `new`.
|
||||||
|
|
||||||
|
#### 9.0.2
|
||||||
|
|
||||||
|
* 12/12/21
|
||||||
|
* #250 [BUGFIX] Allow use of user-defined alphabet for base 10.
|
||||||
|
* #295 Remove *bignumber.min.js* and amend *README.md*.
|
||||||
|
* Update *.travis.yml* and *LICENCE.md*.
|
||||||
|
|
||||||
|
#### 9.0.1
|
||||||
|
|
||||||
|
* 28/09/20
|
||||||
|
* [BUGFIX] #276 Correct `sqrt` initial estimate.
|
||||||
|
* Update *.travis.yml*, *LICENCE.md* and *README.md*.
|
||||||
|
|
||||||
|
#### 9.0.0
|
||||||
|
|
||||||
|
* 27/05/2019
|
||||||
|
* For compatibility with legacy browsers, remove `Symbol` references.
|
||||||
|
|
||||||
|
#### 8.1.1
|
||||||
|
|
||||||
|
* 24/02/2019
|
||||||
|
* [BUGFIX] #222 Restore missing `var` to `export BigNumber`.
|
||||||
|
* Allow any key in BigNumber.Instance in *bignumber.d.ts*.
|
||||||
|
|
||||||
|
#### 8.1.0
|
||||||
|
|
||||||
|
* 23/02/2019
|
||||||
|
* [NEW FEATURE] #220 Create a BigNumber using `{s, e, c}`.
|
||||||
|
* [NEW FEATURE] `isBigNumber`: if `BigNumber.DEBUG` is `true`, also check that the BigNumber instance is well-formed.
|
||||||
|
* Remove `instanceof` checks; just use `_isBigNumber` to identify a BigNumber instance.
|
||||||
|
* Add `_isBigNumber` to prototype in *bignumber.mjs*.
|
||||||
|
* Add tests for BigNumber creation from object.
|
||||||
|
* Update *API.html*.
|
||||||
|
|
||||||
|
#### 8.0.2
|
||||||
|
|
||||||
|
* 13/01/2019
|
||||||
|
* #209 `toPrecision` without argument should follow `toString`.
|
||||||
|
* Improve *Use* section of *README*.
|
||||||
|
* Optimise `toString(10)`.
|
||||||
|
* Add verson number to API doc.
|
||||||
|
|
||||||
|
#### 8.0.1
|
||||||
|
|
||||||
|
* 01/11/2018
|
||||||
|
* Rest parameter must be array type in *bignumber.d.ts*.
|
||||||
|
|
||||||
|
#### 8.0.0
|
||||||
|
|
||||||
|
* 01/11/2018
|
||||||
|
* [NEW FEATURE] Add `BigNumber.sum` method.
|
||||||
|
* [NEW FEATURE]`toFormat`: add `prefix` and `suffix` options.
|
||||||
|
* [NEW FEATURE] #178 Pass custom formatting to `toFormat`.
|
||||||
|
* [BREAKING CHANGE] #184 `toFraction`: return array of BigNumbers not strings.
|
||||||
|
* [NEW FEATURE] #185 Enable overwrite of `valueOf` to prevent accidental addition to string.
|
||||||
|
* #183 Add Node.js `crypto` requirement to documentation.
|
||||||
|
* [BREAKING CHANGE] #198 Disallow signs and whitespace in custom alphabet.
|
||||||
|
* [NEW FEATURE] #188 Implement `util.inspect.custom` for Node.js REPL.
|
||||||
|
* #170 Make `isBigNumber` a type guard in *bignumber.d.ts*.
|
||||||
|
* [BREAKING CHANGE] `BigNumber.min` and `BigNumber.max`: don't accept an array.
|
||||||
|
* Update *.travis.yml*.
|
||||||
|
* Remove *bower.json*.
|
||||||
|
|
||||||
|
#### 7.2.1
|
||||||
|
|
||||||
|
* 24/05/2018
|
||||||
|
* Add `browser` field to *package.json*.
|
||||||
|
|
||||||
|
#### 7.2.0
|
||||||
|
|
||||||
|
* 22/05/2018
|
||||||
|
* #166 Correct *.mjs* file. Remove extension from `main` field in *package.json*.
|
||||||
|
|
||||||
|
#### 7.1.0
|
||||||
|
|
||||||
|
* 18/05/2018
|
||||||
|
* Add `module` field to *package.json* for *bignumber.mjs*.
|
||||||
|
|
||||||
|
#### 7.0.2
|
||||||
|
|
||||||
|
* 17/05/2018
|
||||||
|
* #165 Bugfix: upper-case letters for bases 11-36 in a custom alphabet.
|
||||||
|
* Add note to *README* regarding creating BigNumbers from Number values.
|
||||||
|
|
||||||
|
#### 7.0.1
|
||||||
|
|
||||||
|
* 26/04/2018
|
||||||
|
* #158 Fix global object variable name typo.
|
||||||
|
|
||||||
|
#### 7.0.0
|
||||||
|
|
||||||
|
* 26/04/2018
|
||||||
|
* #143 Remove global BigNumber from typings.
|
||||||
|
* #144 Enable compatibility with `Object.freeze(Object.prototype)`.
|
||||||
|
* #148 #123 #11 Only throw on a number primitive with more than 15 significant digits if `BigNumber.DEBUG` is `true`.
|
||||||
|
* Only throw on an invalid BigNumber value if `BigNumber.DEBUG` is `true`. Return BigNumber `NaN` instead.
|
||||||
|
* #154 `exponentiatedBy`: allow BigNumber exponent.
|
||||||
|
* #156 Prevent Content Security Policy *unsafe-eval* issue.
|
||||||
|
* `toFraction`: allow `Infinity` maximum denominator.
|
||||||
|
* Comment-out some excess tests to reduce test time.
|
||||||
|
* Amend indentation and other spacing.
|
||||||
|
|
||||||
|
#### 6.0.0
|
||||||
|
|
||||||
|
* 26/01/2018
|
||||||
|
* #137 Implement `APLHABET` configuration option.
|
||||||
|
* Remove `ERRORS` configuration option.
|
||||||
|
* Remove `toDigits` method; extend `precision` method accordingly.
|
||||||
|
* Remove s`round` method; extend `decimalPlaces` method accordingly.
|
||||||
|
* Remove methods: `ceil`, `floor`, and `truncated`.
|
||||||
|
* Remove method aliases: `add`, `cmp`, `isInt`, `isNeg`, `trunc`, `mul`, `neg` and `sub`.
|
||||||
|
* Rename methods: `shift` to `shiftedBy`, `another` to `clone`, `toPower` to `exponentiatedBy`, and `equals` to `isEqualTo`.
|
||||||
|
* Rename methods: add `is` prefix to `greaterThan`, `greaterThanOrEqualTo`, `lessThan` and `lessThanOrEqualTo`.
|
||||||
|
* Add methods: `multipliedBy`, `isBigNumber`, `isPositive`, `integerValue`, `maximum` and `minimum`.
|
||||||
|
* Refactor test suite.
|
||||||
|
* Add *CHANGELOG.md*.
|
||||||
|
* Rewrite *bignumber.d.ts*.
|
||||||
|
* Redo API image.
|
||||||
|
|
||||||
|
#### 5.0.0
|
||||||
|
|
||||||
|
* 27/11/2017
|
||||||
|
* #81 Don't throw on constructor call without `new`.
|
||||||
|
|
||||||
|
#### 4.1.0
|
||||||
|
|
||||||
|
* 26/09/2017
|
||||||
|
* Remove node 0.6 from *.travis.yml*.
|
||||||
|
* Add *bignumber.mjs*.
|
||||||
|
|
||||||
|
#### 4.0.4
|
||||||
|
|
||||||
|
* 03/09/2017
|
||||||
|
* Add missing aliases to *bignumber.d.ts*.
|
||||||
|
|
||||||
|
#### 4.0.3
|
||||||
|
|
||||||
|
* 30/08/2017
|
||||||
|
* Add types: *bignumber.d.ts*.
|
||||||
|
|
||||||
|
#### 4.0.2
|
||||||
|
|
||||||
|
* 03/05/2017
|
||||||
|
* #120 Workaround Safari/Webkit bug.
|
||||||
|
|
||||||
|
#### 4.0.1
|
||||||
|
|
||||||
|
* 05/04/2017
|
||||||
|
* #121 BigNumber.default to BigNumber['default'].
|
||||||
|
|
||||||
|
#### 4.0.0
|
||||||
|
|
||||||
|
* 09/01/2017
|
||||||
|
* Replace BigNumber.isBigNumber method with isBigNumber prototype property.
|
||||||
|
|
||||||
|
#### 3.1.2
|
||||||
|
|
||||||
|
* 08/01/2017
|
||||||
|
* Minor documentation edit.
|
||||||
|
|
||||||
|
#### 3.1.1
|
||||||
|
|
||||||
|
* 08/01/2017
|
||||||
|
* Uncomment `isBigNumber` tests.
|
||||||
|
* Ignore dot files.
|
||||||
|
|
||||||
|
#### 3.1.0
|
||||||
|
|
||||||
|
* 08/01/2017
|
||||||
|
* Add `isBigNumber` method.
|
||||||
|
|
||||||
|
#### 3.0.2
|
||||||
|
|
||||||
|
* 08/01/2017
|
||||||
|
* Bugfix: Possible incorrect value of `ERRORS` after a `BigNumber.another` call (due to `parseNumeric` declaration in outer scope).
|
||||||
|
|
||||||
|
#### 3.0.1
|
||||||
|
|
||||||
|
* 23/11/2016
|
||||||
|
* Apply fix for old ipads with `%` issue, see #57 and #102.
|
||||||
|
* Correct error message.
|
||||||
|
|
||||||
|
#### 3.0.0
|
||||||
|
|
||||||
|
* 09/11/2016
|
||||||
|
* Remove `require('crypto')` - leave it to the user.
|
||||||
|
* Add `BigNumber.set` as `BigNumber.config` alias.
|
||||||
|
* Default `POW_PRECISION` to `0`.
|
||||||
|
|
||||||
|
#### 2.4.0
|
||||||
|
|
||||||
|
* 14/07/2016
|
||||||
|
* #97 Add exports to support ES6 imports.
|
||||||
|
|
||||||
|
#### 2.3.0
|
||||||
|
|
||||||
|
* 07/03/2016
|
||||||
|
* #86 Add modulus parameter to `toPower`.
|
||||||
|
|
||||||
|
#### 2.2.0
|
||||||
|
|
||||||
|
* 03/03/2016
|
||||||
|
* #91 Permit larger JS integers.
|
||||||
|
|
||||||
|
#### 2.1.4
|
||||||
|
|
||||||
|
* 15/12/2015
|
||||||
|
* Correct UMD.
|
||||||
|
|
||||||
|
#### 2.1.3
|
||||||
|
|
||||||
|
* 13/12/2015
|
||||||
|
* Refactor re global object and crypto availability when bundling.
|
||||||
|
|
||||||
|
#### 2.1.2
|
||||||
|
|
||||||
|
* 10/12/2015
|
||||||
|
* Bugfix: `window.crypto` not assigned to `crypto`.
|
||||||
|
|
||||||
|
#### 2.1.1
|
||||||
|
|
||||||
|
* 09/12/2015
|
||||||
|
* Prevent code bundler from adding `crypto` shim.
|
||||||
|
|
||||||
|
#### 2.1.0
|
||||||
|
|
||||||
|
* 26/10/2015
|
||||||
|
* For `valueOf` and `toJSON`, include the minus sign with negative zero.
|
||||||
|
|
||||||
|
#### 2.0.8
|
||||||
|
|
||||||
|
* 2/10/2015
|
||||||
|
* Internal round function bugfix.
|
||||||
|
|
||||||
|
#### 2.0.6
|
||||||
|
|
||||||
|
* 31/03/2015
|
||||||
|
* Add bower.json. Tweak division after in-depth review.
|
||||||
|
|
||||||
|
#### 2.0.5
|
||||||
|
|
||||||
|
* 25/03/2015
|
||||||
|
* Amend README. Remove bitcoin address.
|
||||||
|
|
||||||
|
#### 2.0.4
|
||||||
|
|
||||||
|
* 25/03/2015
|
||||||
|
* Critical bugfix #58: division.
|
||||||
|
|
||||||
|
#### 2.0.3
|
||||||
|
|
||||||
|
* 18/02/2015
|
||||||
|
* Amend README. Add source map.
|
||||||
|
|
||||||
|
#### 2.0.2
|
||||||
|
|
||||||
|
* 18/02/2015
|
||||||
|
* Correct links.
|
||||||
|
|
||||||
|
#### 2.0.1
|
||||||
|
|
||||||
|
* 18/02/2015
|
||||||
|
* Add `max`, `min`, `precision`, `random`, `shiftedBy`, `toDigits` and `truncated` methods.
|
||||||
|
* Add the short-forms: `add`, `mul`, `sd`, `sub` and `trunc`.
|
||||||
|
* Add an `another` method to enable multiple independent constructors to be created.
|
||||||
|
* Add support for the base 2, 8 and 16 prefixes `0b`, `0o` and `0x`.
|
||||||
|
* Enable a rounding mode to be specified as a second parameter to `toExponential`, `toFixed`, `toFormat` and `toPrecision`.
|
||||||
|
* Add a `CRYPTO` configuration property so cryptographically-secure pseudo-random number generation can be specified.
|
||||||
|
* Add a `MODULO_MODE` configuration property to enable the rounding mode used by the `modulo` operation to be specified.
|
||||||
|
* Add a `POW_PRECISION` configuration property to enable the number of significant digits calculated by the power operation to be limited.
|
||||||
|
* Improve code quality.
|
||||||
|
* Improve documentation.
|
||||||
|
|
||||||
|
#### 2.0.0
|
||||||
|
|
||||||
|
* 29/12/2014
|
||||||
|
* Add `dividedToIntegerBy`, `isInteger` and `toFormat` methods.
|
||||||
|
* Remove the following short-forms: `isF`, `isZ`, `toE`, `toF`, `toFr`, `toN`, `toP`, `toS`.
|
||||||
|
* Store a BigNumber's coefficient in base 1e14, rather than base 10.
|
||||||
|
* Add fast path for integers to BigNumber constructor.
|
||||||
|
* Incorporate the library into the online documentation.
|
||||||
|
|
||||||
|
#### 1.5.0
|
||||||
|
|
||||||
|
* 13/11/2014
|
||||||
|
* Add `toJSON` and `decimalPlaces` methods.
|
||||||
|
|
||||||
|
#### 1.4.1
|
||||||
|
|
||||||
|
* 08/06/2014
|
||||||
|
* Amend README.
|
||||||
|
|
||||||
|
#### 1.4.0
|
||||||
|
|
||||||
|
* 08/05/2014
|
||||||
|
* Add `toNumber`.
|
||||||
|
|
||||||
|
#### 1.3.0
|
||||||
|
|
||||||
|
* 08/11/2013
|
||||||
|
* Ensure correct rounding of `sqrt` in all, rather than almost all, cases.
|
||||||
|
* Maximum radix to 64.
|
||||||
|
|
||||||
|
#### 1.2.1
|
||||||
|
|
||||||
|
* 17/10/2013
|
||||||
|
* Sign of zero when x < 0 and x + (-x) = 0.
|
||||||
|
|
||||||
|
#### 1.2.0
|
||||||
|
|
||||||
|
* 19/9/2013
|
||||||
|
* Throw Error objects for stack.
|
||||||
|
|
||||||
|
#### 1.1.1
|
||||||
|
|
||||||
|
* 22/8/2013
|
||||||
|
* Show original value in constructor error message.
|
||||||
|
|
||||||
|
#### 1.1.0
|
||||||
|
|
||||||
|
* 1/8/2013
|
||||||
|
* Allow numbers with trailing radix point.
|
||||||
|
|
||||||
|
#### 1.0.1
|
||||||
|
|
||||||
|
* Bugfix: error messages with incorrect method name
|
||||||
|
|
||||||
|
#### 1.0.0
|
||||||
|
|
||||||
|
* 8/11/2012
|
||||||
|
* Initial release
|
26
node_modules/bignumber.js/LICENCE.md
generated
vendored
Normal file
26
node_modules/bignumber.js/LICENCE.md
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Copyright © `<2025>` `Michael Mclaughlin`
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the “Software”), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use,
|
||||||
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
288
node_modules/bignumber.js/README.md
generated
vendored
Normal file
288
node_modules/bignumber.js/README.md
generated
vendored
Normal file
|
@ -0,0 +1,288 @@
|
||||||
|

|
||||||
|
|
||||||
|
A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic.
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/bignumber.js)
|
||||||
|
[](https://www.npmjs.com/package/bignumber.js)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Integers and decimals
|
||||||
|
- Simple API but full-featured
|
||||||
|
- Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal
|
||||||
|
- 8 KB minified and gzipped
|
||||||
|
- Replicates the `toExponential`, `toFixed`, `toPrecision` and `toString` methods of JavaScript's Number type
|
||||||
|
- Includes a `toFraction` and a correctly-rounded `squareRoot` method
|
||||||
|
- Supports cryptographically-secure pseudo-random number generation
|
||||||
|
- No dependencies
|
||||||
|
- Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only
|
||||||
|
- Comprehensive [documentation](http://mikemcl.github.io/bignumber.js/) and test set
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
If a smaller and simpler library is required see [big.js](https://github.com/MikeMcl/big.js/).
|
||||||
|
It's less than half the size but only works with decimal numbers and only has half the methods.
|
||||||
|
It also has fewer configuration options than this library, and does not allow `NaN` or `Infinity`.
|
||||||
|
|
||||||
|
See also [decimal.js](https://github.com/MikeMcl/decimal.js/), which among other things adds support for non-integer powers, and performs all operations to a specified number of significant digits.
|
||||||
|
|
||||||
|
## Load
|
||||||
|
|
||||||
|
The library is the single JavaScript file *bignumber.js* or ES module *bignumber.mjs*.
|
||||||
|
|
||||||
|
### Browser
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src='path/to/bignumber.js'></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
> ES module
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script type="module">
|
||||||
|
import BigNumber from './path/to/bignumber.mjs';
|
||||||
|
```
|
||||||
|
|
||||||
|
> Get a minified version from a CDN:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src='https://cdn.jsdelivr.net/npm/bignumber.js@9.3.0/bignumber.min.js'></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
### [Node.js](http://nodejs.org)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install bignumber.js
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const BigNumber = require('bignumber.js');
|
||||||
|
```
|
||||||
|
|
||||||
|
> ES module
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import BigNumber from "bignumber.js";
|
||||||
|
```
|
||||||
|
|
||||||
|
### [Deno](https://deno.land/)
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// @deno-types="https://raw.githubusercontent.com/mikemcl/bignumber.js/v9.3.0/bignumber.d.mts"
|
||||||
|
import BigNumber from 'https://raw.githubusercontent.com/mikemcl/bignumber.js/v9.3.0/bignumber.mjs';
|
||||||
|
|
||||||
|
// @deno-types="https://unpkg.com/bignumber.js@latest/bignumber.d.mts"
|
||||||
|
import { BigNumber } from 'https://unpkg.com/bignumber.js@latest/bignumber.mjs';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Use
|
||||||
|
|
||||||
|
The library exports a single constructor function, [`BigNumber`](http://mikemcl.github.io/bignumber.js/#bignumber), which accepts a value of type Number, String or BigNumber,
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
let x = new BigNumber(123.4567);
|
||||||
|
let y = BigNumber('123456.7e-3');
|
||||||
|
let z = new BigNumber(x);
|
||||||
|
x.isEqualTo(y) && y.isEqualTo(z) && x.isEqualTo(z); // true
|
||||||
|
```
|
||||||
|
|
||||||
|
To get the string value of a BigNumber use [`toString()`](http://mikemcl.github.io/bignumber.js/#toS) or [`toFixed()`](http://mikemcl.github.io/bignumber.js/#toFix). Using `toFixed()` prevents exponential notation being returned, no matter how large or small the value.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
let x = new BigNumber('1111222233334444555566');
|
||||||
|
x.toString(); // "1.111222233334444555566e+21"
|
||||||
|
x.toFixed(); // "1111222233334444555566"
|
||||||
|
```
|
||||||
|
|
||||||
|
If the limited precision of Number values is not well understood, it is recommended to create BigNumbers from String values rather than Number values to avoid a potential loss of precision.
|
||||||
|
|
||||||
|
*In all further examples below, `let`, semicolons and `toString` calls are not shown. If a commented-out value is in quotes it means `toString` has been called on the preceding expression.*
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Precision loss from using numeric literals with more than 15 significant digits.
|
||||||
|
new BigNumber(1.0000000000000001) // '1'
|
||||||
|
new BigNumber(88259496234518.57) // '88259496234518.56'
|
||||||
|
new BigNumber(99999999999999999999) // '100000000000000000000'
|
||||||
|
|
||||||
|
// Precision loss from using numeric literals outside the range of Number values.
|
||||||
|
new BigNumber(2e+308) // 'Infinity'
|
||||||
|
new BigNumber(1e-324) // '0'
|
||||||
|
|
||||||
|
// Precision loss from the unexpected result of arithmetic with Number values.
|
||||||
|
new BigNumber(0.7 + 0.1) // '0.7999999999999999'
|
||||||
|
```
|
||||||
|
|
||||||
|
When creating a BigNumber from a Number, note that a BigNumber is created from a Number's decimal `toString()` value not from its underlying binary value. If the latter is required, then pass the Number's `toString(2)` value and specify base 2.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
new BigNumber(Number.MAX_VALUE.toString(2), 2)
|
||||||
|
```
|
||||||
|
|
||||||
|
BigNumbers can be created from values in bases from 2 to 36. See [`ALPHABET`](http://mikemcl.github.io/bignumber.js/#alphabet) to extend this range.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
a = new BigNumber(1011, 2) // "11"
|
||||||
|
b = new BigNumber('zz.9', 36) // "1295.25"
|
||||||
|
c = a.plus(b) // "1306.25"
|
||||||
|
```
|
||||||
|
|
||||||
|
*Performance is better if base 10 is NOT specified for decimal values. Only specify base 10 when you want to limit the number of decimal places of the input value to the current [`DECIMAL_PLACES`](http://mikemcl.github.io/bignumber.js/#decimal-places) setting.*
|
||||||
|
|
||||||
|
A BigNumber is immutable in the sense that it is not changed by its methods.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
0.3 - 0.1 // 0.19999999999999998
|
||||||
|
x = new BigNumber(0.3)
|
||||||
|
x.minus(0.1) // "0.2"
|
||||||
|
x // "0.3"
|
||||||
|
```
|
||||||
|
|
||||||
|
The methods that return a BigNumber can be chained.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
x.dividedBy(y).plus(z).times(9)
|
||||||
|
x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').integerValue()
|
||||||
|
```
|
||||||
|
|
||||||
|
Some of the longer method names have a shorter alias.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
x.squareRoot().dividedBy(y).exponentiatedBy(3).isEqualTo(x.sqrt().div(y).pow(3)) // true
|
||||||
|
x.modulo(y).multipliedBy(z).eq(x.mod(y).times(z)) // true
|
||||||
|
```
|
||||||
|
|
||||||
|
As with JavaScript's Number type, there are [`toExponential`](http://mikemcl.github.io/bignumber.js/#toE), [`toFixed`](http://mikemcl.github.io/bignumber.js/#toFix) and [`toPrecision`](http://mikemcl.github.io/bignumber.js/#toP) methods.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
x = new BigNumber(255.5)
|
||||||
|
x.toExponential(5) // "2.55500e+2"
|
||||||
|
x.toFixed(5) // "255.50000"
|
||||||
|
x.toPrecision(5) // "255.50"
|
||||||
|
x.toNumber() // 255.5
|
||||||
|
```
|
||||||
|
|
||||||
|
A base can be specified for [`toString`](http://mikemcl.github.io/bignumber.js/#toS).
|
||||||
|
|
||||||
|
*Performance is better if base 10 is NOT specified, i.e. use `toString()` not `toString(10)`. Only specify base 10 when you want to limit the number of decimal places of the string to the current [`DECIMAL_PLACES`](http://mikemcl.github.io/bignumber.js/#decimal-places) setting.*
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
x.toString(16) // "ff.8"
|
||||||
|
```
|
||||||
|
|
||||||
|
There is a [`toFormat`](http://mikemcl.github.io/bignumber.js/#toFor) method which may be useful for internationalisation.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
y = new BigNumber('1234567.898765')
|
||||||
|
y.toFormat(2) // "1,234,567.90"
|
||||||
|
```
|
||||||
|
|
||||||
|
The maximum number of decimal places of the result of an operation involving division (i.e. a division, square root, base conversion or negative power operation) is set using the `set` or `config` method of the `BigNumber` constructor.
|
||||||
|
|
||||||
|
The other arithmetic operations always give the exact result.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
BigNumber.set({ DECIMAL_PLACES: 10, ROUNDING_MODE: 4 })
|
||||||
|
|
||||||
|
x = new BigNumber(2)
|
||||||
|
y = new BigNumber(3)
|
||||||
|
z = x.dividedBy(y) // "0.6666666667"
|
||||||
|
z.squareRoot() // "0.8164965809"
|
||||||
|
z.exponentiatedBy(-3) // "3.3749999995"
|
||||||
|
z.toString(2) // "0.1010101011"
|
||||||
|
z.multipliedBy(z) // "0.44444444448888888889"
|
||||||
|
z.multipliedBy(z).decimalPlaces(10) // "0.4444444445"
|
||||||
|
```
|
||||||
|
|
||||||
|
There is a [`toFraction`](http://mikemcl.github.io/bignumber.js/#toFr) method with an optional *maximum denominator* argument
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
y = new BigNumber(355)
|
||||||
|
pi = y.dividedBy(113) // "3.1415929204"
|
||||||
|
pi.toFraction() // [ "7853982301", "2500000000" ]
|
||||||
|
pi.toFraction(1000) // [ "355", "113" ]
|
||||||
|
```
|
||||||
|
|
||||||
|
and [`isNaN`](http://mikemcl.github.io/bignumber.js/#isNaN) and [`isFinite`](http://mikemcl.github.io/bignumber.js/#isF) methods, as `NaN` and `Infinity` are valid `BigNumber` values.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
x = new BigNumber(NaN) // "NaN"
|
||||||
|
y = new BigNumber(Infinity) // "Infinity"
|
||||||
|
x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite() // true
|
||||||
|
```
|
||||||
|
|
||||||
|
The value of a BigNumber is stored in a decimal floating point format in terms of a coefficient, exponent and sign.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
x = new BigNumber(-123.456);
|
||||||
|
x.c // [ 123, 45600000000000 ] coefficient (i.e. significand)
|
||||||
|
x.e // 2 exponent
|
||||||
|
x.s // -1 sign
|
||||||
|
```
|
||||||
|
|
||||||
|
For advanced usage, multiple BigNumber constructors can be created, each with its own independent configuration.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Set DECIMAL_PLACES for the original BigNumber constructor
|
||||||
|
BigNumber.set({ DECIMAL_PLACES: 10 })
|
||||||
|
|
||||||
|
// Create another BigNumber constructor, optionally passing in a configuration object
|
||||||
|
BN = BigNumber.clone({ DECIMAL_PLACES: 5 })
|
||||||
|
|
||||||
|
x = new BigNumber(1)
|
||||||
|
y = new BN(1)
|
||||||
|
|
||||||
|
x.div(3) // '0.3333333333'
|
||||||
|
y.div(3) // '0.33333'
|
||||||
|
```
|
||||||
|
|
||||||
|
To avoid having to call `toString` or `valueOf` on a BigNumber to get its value in the Node.js REPL or when using `console.log` use
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
BigNumber.prototype[require('util').inspect.custom] = BigNumber.prototype.valueOf;
|
||||||
|
```
|
||||||
|
|
||||||
|
For further information see the [API](http://mikemcl.github.io/bignumber.js/) reference in the *doc* directory.
|
||||||
|
|
||||||
|
## Test
|
||||||
|
|
||||||
|
The *test/modules* directory contains the test scripts for each method.
|
||||||
|
|
||||||
|
The tests can be run with Node.js or a browser. For Node.js use
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node test/test
|
||||||
|
```
|
||||||
|
|
||||||
|
To test a single method, use, for example
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node test/methods/toFraction
|
||||||
|
```
|
||||||
|
|
||||||
|
For the browser, open *test/test.html*.
|
||||||
|
|
||||||
|
## Minify
|
||||||
|
|
||||||
|
To minify using, for example, [terser](https://github.com/terser/terser)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install -g terser
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
terser big.js -c -m -o big.min.js
|
||||||
|
```
|
||||||
|
|
||||||
|
## Licence
|
||||||
|
|
||||||
|
The MIT Licence.
|
||||||
|
|
||||||
|
See [LICENCE](https://github.com/MikeMcl/bignumber.js/blob/master/LICENCE).
|
6
node_modules/bignumber.js/bignumber.d.mts
generated
vendored
Normal file
6
node_modules/bignumber.js/bignumber.d.mts
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
/// <reference path="./types.d.ts" />
|
||||||
|
|
||||||
|
export default BigNumber;
|
||||||
|
|
||||||
|
declare const BigNumberType: typeof BigNumber;
|
||||||
|
export { BigNumberType as BigNumber };
|
5
node_modules/bignumber.js/bignumber.d.ts
generated
vendored
Normal file
5
node_modules/bignumber.js/bignumber.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/// <reference path="./types.d.ts" />
|
||||||
|
|
||||||
|
export = BigNumber;
|
||||||
|
|
||||||
|
export as namespace BigNumber;
|
2922
node_modules/bignumber.js/bignumber.js
generated
vendored
Normal file
2922
node_modules/bignumber.js/bignumber.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
2907
node_modules/bignumber.js/bignumber.mjs
generated
vendored
Normal file
2907
node_modules/bignumber.js/bignumber.mjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
2249
node_modules/bignumber.js/doc/API.html
generated
vendored
Normal file
2249
node_modules/bignumber.js/doc/API.html
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1821
node_modules/bignumber.js/types.d.ts
generated
vendored
Normal file
1821
node_modules/bignumber.js/types.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
2
node_modules/buffer-equal-constant-time/.npmignore
generated
vendored
Normal file
2
node_modules/buffer-equal-constant-time/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
.*.sw[mnop]
|
||||||
|
node_modules/
|
4
node_modules/buffer-equal-constant-time/.travis.yml
generated
vendored
Normal file
4
node_modules/buffer-equal-constant-time/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "0.11"
|
||||||
|
- "0.10"
|
12
node_modules/buffer-equal-constant-time/LICENSE.txt
generated
vendored
Normal file
12
node_modules/buffer-equal-constant-time/LICENSE.txt
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
Copyright (c) 2013, GoInstant Inc., a salesforce.com company
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of salesforce.com, nor GoInstant, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
50
node_modules/buffer-equal-constant-time/README.md
generated
vendored
Normal file
50
node_modules/buffer-equal-constant-time/README.md
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
# buffer-equal-constant-time
|
||||||
|
|
||||||
|
Constant-time `Buffer` comparison for node.js. Should work with browserify too.
|
||||||
|
|
||||||
|
[](https://travis-ci.org/goinstant/buffer-equal-constant-time)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install buffer-equal-constant-time
|
||||||
|
```
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
var bufferEq = require('buffer-equal-constant-time');
|
||||||
|
|
||||||
|
var a = new Buffer('asdf');
|
||||||
|
var b = new Buffer('asdf');
|
||||||
|
if (bufferEq(a,b)) {
|
||||||
|
// the same!
|
||||||
|
} else {
|
||||||
|
// different in at least one byte!
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
If you'd like to install an `.equal()` method onto the node.js `Buffer` and
|
||||||
|
`SlowBuffer` prototypes:
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('buffer-equal-constant-time').install();
|
||||||
|
|
||||||
|
var a = new Buffer('asdf');
|
||||||
|
var b = new Buffer('asdf');
|
||||||
|
if (a.equal(b)) {
|
||||||
|
// the same!
|
||||||
|
} else {
|
||||||
|
// different in at least one byte!
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
To get rid of the installed `.equal()` method, call `.restore()`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('buffer-equal-constant-time').restore();
|
||||||
|
```
|
||||||
|
|
||||||
|
# Legal
|
||||||
|
|
||||||
|
© 2013 GoInstant Inc., a salesforce.com company
|
||||||
|
|
||||||
|
Licensed under the BSD 3-clause license.
|
41
node_modules/buffer-equal-constant-time/index.js
generated
vendored
Normal file
41
node_modules/buffer-equal-constant-time/index.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/*jshint node:true */
|
||||||
|
'use strict';
|
||||||
|
var Buffer = require('buffer').Buffer; // browserify
|
||||||
|
var SlowBuffer = require('buffer').SlowBuffer;
|
||||||
|
|
||||||
|
module.exports = bufferEq;
|
||||||
|
|
||||||
|
function bufferEq(a, b) {
|
||||||
|
|
||||||
|
// shortcutting on type is necessary for correctness
|
||||||
|
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// buffer sizes should be well-known information, so despite this
|
||||||
|
// shortcutting, it doesn't leak any information about the *contents* of the
|
||||||
|
// buffers.
|
||||||
|
if (a.length !== b.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var c = 0;
|
||||||
|
for (var i = 0; i < a.length; i++) {
|
||||||
|
/*jshint bitwise:false */
|
||||||
|
c |= a[i] ^ b[i]; // XOR
|
||||||
|
}
|
||||||
|
return c === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferEq.install = function() {
|
||||||
|
Buffer.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
|
||||||
|
return bufferEq(this, that);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var origBufEqual = Buffer.prototype.equal;
|
||||||
|
var origSlowBufEqual = SlowBuffer.prototype.equal;
|
||||||
|
bufferEq.restore = function() {
|
||||||
|
Buffer.prototype.equal = origBufEqual;
|
||||||
|
SlowBuffer.prototype.equal = origSlowBufEqual;
|
||||||
|
};
|
42
node_modules/buffer-equal-constant-time/test.js
generated
vendored
Normal file
42
node_modules/buffer-equal-constant-time/test.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*jshint node:true */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var bufferEq = require('./index');
|
||||||
|
var assert = require('assert');
|
||||||
|
|
||||||
|
describe('buffer-equal-constant-time', function() {
|
||||||
|
var a = new Buffer('asdfasdf123456');
|
||||||
|
var b = new Buffer('asdfasdf123456');
|
||||||
|
var c = new Buffer('asdfasdf');
|
||||||
|
|
||||||
|
describe('bufferEq', function() {
|
||||||
|
it('says a == b', function() {
|
||||||
|
assert.strictEqual(bufferEq(a, b), true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('says a != c', function() {
|
||||||
|
assert.strictEqual(bufferEq(a, c), false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('install/restore', function() {
|
||||||
|
before(function() {
|
||||||
|
bufferEq.install();
|
||||||
|
});
|
||||||
|
after(function() {
|
||||||
|
bufferEq.restore();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('installed an .equal method', function() {
|
||||||
|
var SlowBuffer = require('buffer').SlowBuffer;
|
||||||
|
assert.ok(Buffer.prototype.equal);
|
||||||
|
assert.ok(SlowBuffer.prototype.equal);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('infected existing Buffers', function() {
|
||||||
|
assert.strictEqual(a.equal(b), true);
|
||||||
|
assert.strictEqual(a.equal(c), false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
17
node_modules/call-bind-apply-helpers/.eslintrc
generated
vendored
Normal file
17
node_modules/call-bind-apply-helpers/.eslintrc
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
|
||||||
|
"extends": "@ljharb",
|
||||||
|
|
||||||
|
"rules": {
|
||||||
|
"func-name-matching": 0,
|
||||||
|
"id-length": 0,
|
||||||
|
"new-cap": [2, {
|
||||||
|
"capIsNewExceptions": [
|
||||||
|
"GetIntrinsic",
|
||||||
|
],
|
||||||
|
}],
|
||||||
|
"no-extra-parens": 0,
|
||||||
|
"no-magic-numbers": 0,
|
||||||
|
},
|
||||||
|
}
|
12
node_modules/call-bind-apply-helpers/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/call-bind-apply-helpers/.github/FUNDING.yml
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: [ljharb]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: npm/call-bind-apply-helpers
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
9
node_modules/call-bind-apply-helpers/.nycrc
generated
vendored
Normal file
9
node_modules/call-bind-apply-helpers/.nycrc
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"all": true,
|
||||||
|
"check-coverage": false,
|
||||||
|
"reporter": ["text-summary", "text", "html", "json"],
|
||||||
|
"exclude": [
|
||||||
|
"coverage",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
}
|
30
node_modules/call-bind-apply-helpers/CHANGELOG.md
generated
vendored
Normal file
30
node_modules/call-bind-apply-helpers/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.0.2](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.1...v1.0.2) - 2025-02-12
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [types] improve inferred types [`e6f9586`](https://github.com/ljharb/call-bind-apply-helpers/commit/e6f95860a3c72879cb861a858cdfb8138fbedec1)
|
||||||
|
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`e43d540`](https://github.com/ljharb/call-bind-apply-helpers/commit/e43d5409f97543bfbb11f345d47d8ce4e066d8c1)
|
||||||
|
|
||||||
|
## [v1.0.1](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.0...v1.0.1) - 2024-12-08
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [types] `reflectApply`: fix types [`4efc396`](https://github.com/ljharb/call-bind-apply-helpers/commit/4efc3965351a4f02cc55e836fa391d3d11ef2ef8)
|
||||||
|
- [Fix] `reflectApply`: oops, Reflect is not a function [`83cc739`](https://github.com/ljharb/call-bind-apply-helpers/commit/83cc7395de6b79b7730bdf092f1436f0b1263c75)
|
||||||
|
- [Dev Deps] update `@arethetypeswrong/cli` [`80bd5d3`](https://github.com/ljharb/call-bind-apply-helpers/commit/80bd5d3ae58b4f6b6995ce439dd5a1bcb178a940)
|
||||||
|
|
||||||
|
## v1.0.0 - 2024-12-05
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- Initial implementation, tests, readme [`7879629`](https://github.com/ljharb/call-bind-apply-helpers/commit/78796290f9b7430c9934d6f33d94ae9bc89fce04)
|
||||||
|
- Initial commit [`3f1dc16`](https://github.com/ljharb/call-bind-apply-helpers/commit/3f1dc164afc43285631b114a5f9dd9137b2b952f)
|
||||||
|
- npm init [`081df04`](https://github.com/ljharb/call-bind-apply-helpers/commit/081df048c312fcee400922026f6e97281200a603)
|
||||||
|
- Only apps should have lockfiles [`5b9ca0f`](https://github.com/ljharb/call-bind-apply-helpers/commit/5b9ca0fe8101ebfaf309c549caac4e0a017ed930)
|
21
node_modules/call-bind-apply-helpers/LICENSE
generated
vendored
Normal file
21
node_modules/call-bind-apply-helpers/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Jordan Harband
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
62
node_modules/call-bind-apply-helpers/README.md
generated
vendored
Normal file
62
node_modules/call-bind-apply-helpers/README.md
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
# call-bind-apply-helpers <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||||
|
|
||||||
|
[![github actions][actions-image]][actions-url]
|
||||||
|
[![coverage][codecov-image]][codecov-url]
|
||||||
|
[![dependency status][deps-svg]][deps-url]
|
||||||
|
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||||
|
[![License][license-image]][license-url]
|
||||||
|
[![Downloads][downloads-image]][downloads-url]
|
||||||
|
|
||||||
|
[![npm badge][npm-badge-png]][package-url]
|
||||||
|
|
||||||
|
Helper functions around Function call/apply/bind, for use in `call-bind`.
|
||||||
|
|
||||||
|
The only packages that should likely ever use this package directly are `call-bind` and `get-intrinsic`.
|
||||||
|
Please use `call-bind` unless you have a very good reason not to.
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save call-bind-apply-helpers
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage/Examples
|
||||||
|
|
||||||
|
```js
|
||||||
|
const assert = require('assert');
|
||||||
|
const callBindBasic = require('call-bind-apply-helpers');
|
||||||
|
|
||||||
|
function f(a, b) {
|
||||||
|
assert.equal(this, 1);
|
||||||
|
assert.equal(a, 2);
|
||||||
|
assert.equal(b, 3);
|
||||||
|
assert.equal(arguments.length, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fBound = callBindBasic([f, 1]);
|
||||||
|
|
||||||
|
delete Function.prototype.call;
|
||||||
|
delete Function.prototype.bind;
|
||||||
|
|
||||||
|
fBound(2, 3);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
Clone the repo, `npm install`, and run `npm test`
|
||||||
|
|
||||||
|
[package-url]: https://npmjs.org/package/call-bind-apply-helpers
|
||||||
|
[npm-version-svg]: https://versionbadg.es/ljharb/call-bind-apply-helpers.svg
|
||||||
|
[deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers.svg
|
||||||
|
[deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers
|
||||||
|
[dev-deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers/dev-status.svg
|
||||||
|
[dev-deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers#info=devDependencies
|
||||||
|
[npm-badge-png]: https://nodei.co/npm/call-bind-apply-helpers.png?downloads=true&stars=true
|
||||||
|
[license-image]: https://img.shields.io/npm/l/call-bind-apply-helpers.svg
|
||||||
|
[license-url]: LICENSE
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/call-bind-apply-helpers.svg
|
||||||
|
[downloads-url]: https://npm-stat.com/charts.html?package=call-bind-apply-helpers
|
||||||
|
[codecov-image]: https://codecov.io/gh/ljharb/call-bind-apply-helpers/branch/main/graphs/badge.svg
|
||||||
|
[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind-apply-helpers/
|
||||||
|
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind-apply-helpers
|
||||||
|
[actions-url]: https://github.com/ljharb/call-bind-apply-helpers/actions
|
1
node_modules/call-bind-apply-helpers/actualApply.d.ts
generated
vendored
Normal file
1
node_modules/call-bind-apply-helpers/actualApply.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export = Reflect.apply;
|
10
node_modules/call-bind-apply-helpers/actualApply.js
generated
vendored
Normal file
10
node_modules/call-bind-apply-helpers/actualApply.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var bind = require('function-bind');
|
||||||
|
|
||||||
|
var $apply = require('./functionApply');
|
||||||
|
var $call = require('./functionCall');
|
||||||
|
var $reflectApply = require('./reflectApply');
|
||||||
|
|
||||||
|
/** @type {import('./actualApply')} */
|
||||||
|
module.exports = $reflectApply || bind.call($call, $apply);
|
19
node_modules/call-bind-apply-helpers/applyBind.d.ts
generated
vendored
Normal file
19
node_modules/call-bind-apply-helpers/applyBind.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import actualApply from './actualApply';
|
||||||
|
|
||||||
|
type TupleSplitHead<T extends any[], N extends number> = T['length'] extends N
|
||||||
|
? T
|
||||||
|
: T extends [...infer R, any]
|
||||||
|
? TupleSplitHead<R, N>
|
||||||
|
: never
|
||||||
|
|
||||||
|
type TupleSplitTail<T, N extends number, O extends any[] = []> = O['length'] extends N
|
||||||
|
? T
|
||||||
|
: T extends [infer F, ...infer R]
|
||||||
|
? TupleSplitTail<[...R], N, [...O, F]>
|
||||||
|
: never
|
||||||
|
|
||||||
|
type TupleSplit<T extends any[], N extends number> = [TupleSplitHead<T, N>, TupleSplitTail<T, N>]
|
||||||
|
|
||||||
|
declare function applyBind(...args: TupleSplit<Parameters<typeof actualApply>, 2>[1]): ReturnType<typeof actualApply>;
|
||||||
|
|
||||||
|
export = applyBind;
|
10
node_modules/call-bind-apply-helpers/applyBind.js
generated
vendored
Normal file
10
node_modules/call-bind-apply-helpers/applyBind.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var bind = require('function-bind');
|
||||||
|
var $apply = require('./functionApply');
|
||||||
|
var actualApply = require('./actualApply');
|
||||||
|
|
||||||
|
/** @type {import('./applyBind')} */
|
||||||
|
module.exports = function applyBind() {
|
||||||
|
return actualApply(bind, $apply, arguments);
|
||||||
|
};
|
1
node_modules/call-bind-apply-helpers/functionApply.d.ts
generated
vendored
Normal file
1
node_modules/call-bind-apply-helpers/functionApply.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export = Function.prototype.apply;
|
4
node_modules/call-bind-apply-helpers/functionApply.js
generated
vendored
Normal file
4
node_modules/call-bind-apply-helpers/functionApply.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** @type {import('./functionApply')} */
|
||||||
|
module.exports = Function.prototype.apply;
|
1
node_modules/call-bind-apply-helpers/functionCall.d.ts
generated
vendored
Normal file
1
node_modules/call-bind-apply-helpers/functionCall.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export = Function.prototype.call;
|
4
node_modules/call-bind-apply-helpers/functionCall.js
generated
vendored
Normal file
4
node_modules/call-bind-apply-helpers/functionCall.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** @type {import('./functionCall')} */
|
||||||
|
module.exports = Function.prototype.call;
|
64
node_modules/call-bind-apply-helpers/index.d.ts
generated
vendored
Normal file
64
node_modules/call-bind-apply-helpers/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
type RemoveFromTuple<
|
||||||
|
Tuple extends readonly unknown[],
|
||||||
|
RemoveCount extends number,
|
||||||
|
Index extends 1[] = []
|
||||||
|
> = Index["length"] extends RemoveCount
|
||||||
|
? Tuple
|
||||||
|
: Tuple extends [infer First, ...infer Rest]
|
||||||
|
? RemoveFromTuple<Rest, RemoveCount, [...Index, 1]>
|
||||||
|
: Tuple;
|
||||||
|
|
||||||
|
type ConcatTuples<
|
||||||
|
Prefix extends readonly unknown[],
|
||||||
|
Suffix extends readonly unknown[]
|
||||||
|
> = [...Prefix, ...Suffix];
|
||||||
|
|
||||||
|
type ExtractFunctionParams<T> = T extends (this: infer TThis, ...args: infer P extends readonly unknown[]) => infer R
|
||||||
|
? { thisArg: TThis; params: P; returnType: R }
|
||||||
|
: never;
|
||||||
|
|
||||||
|
type BindFunction<
|
||||||
|
T extends (this: any, ...args: any[]) => any,
|
||||||
|
TThis,
|
||||||
|
TBoundArgs extends readonly unknown[],
|
||||||
|
ReceiverBound extends boolean
|
||||||
|
> = ExtractFunctionParams<T> extends {
|
||||||
|
thisArg: infer OrigThis;
|
||||||
|
params: infer P extends readonly unknown[];
|
||||||
|
returnType: infer R;
|
||||||
|
}
|
||||||
|
? ReceiverBound extends true
|
||||||
|
? (...args: RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>) => R extends [OrigThis, ...infer Rest]
|
||||||
|
? [TThis, ...Rest] // Replace `this` with `thisArg`
|
||||||
|
: R
|
||||||
|
: <U, RemainingArgs extends RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>>(
|
||||||
|
thisArg: U,
|
||||||
|
...args: RemainingArgs
|
||||||
|
) => R extends [OrigThis, ...infer Rest]
|
||||||
|
? [U, ...ConcatTuples<TBoundArgs, Rest>] // Preserve bound args in return type
|
||||||
|
: R
|
||||||
|
: never;
|
||||||
|
|
||||||
|
declare function callBind<
|
||||||
|
const T extends (this: any, ...args: any[]) => any,
|
||||||
|
Extracted extends ExtractFunctionParams<T>,
|
||||||
|
const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[],
|
||||||
|
const TThis extends Extracted["thisArg"]
|
||||||
|
>(
|
||||||
|
args: [fn: T, thisArg: TThis, ...boundArgs: TBoundArgs]
|
||||||
|
): BindFunction<T, TThis, TBoundArgs, true>;
|
||||||
|
|
||||||
|
declare function callBind<
|
||||||
|
const T extends (this: any, ...args: any[]) => any,
|
||||||
|
Extracted extends ExtractFunctionParams<T>,
|
||||||
|
const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[]
|
||||||
|
>(
|
||||||
|
args: [fn: T, ...boundArgs: TBoundArgs]
|
||||||
|
): BindFunction<T, Extracted["thisArg"], TBoundArgs, false>;
|
||||||
|
|
||||||
|
declare function callBind<const TArgs extends readonly unknown[]>(
|
||||||
|
args: [fn: Exclude<TArgs[0], Function>, ...rest: TArgs]
|
||||||
|
): never;
|
||||||
|
|
||||||
|
// export as namespace callBind;
|
||||||
|
export = callBind;
|
15
node_modules/call-bind-apply-helpers/index.js
generated
vendored
Normal file
15
node_modules/call-bind-apply-helpers/index.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var bind = require('function-bind');
|
||||||
|
var $TypeError = require('es-errors/type');
|
||||||
|
|
||||||
|
var $call = require('./functionCall');
|
||||||
|
var $actualApply = require('./actualApply');
|
||||||
|
|
||||||
|
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
|
||||||
|
module.exports = function callBindBasic(args) {
|
||||||
|
if (args.length < 1 || typeof args[0] !== 'function') {
|
||||||
|
throw new $TypeError('a function is required');
|
||||||
|
}
|
||||||
|
return $actualApply(bind, $call, args);
|
||||||
|
};
|
3
node_modules/call-bind-apply-helpers/reflectApply.d.ts
generated
vendored
Normal file
3
node_modules/call-bind-apply-helpers/reflectApply.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
declare const reflectApply: false | typeof Reflect.apply;
|
||||||
|
|
||||||
|
export = reflectApply;
|
4
node_modules/call-bind-apply-helpers/reflectApply.js
generated
vendored
Normal file
4
node_modules/call-bind-apply-helpers/reflectApply.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** @type {import('./reflectApply')} */
|
||||||
|
module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply;
|
63
node_modules/call-bind-apply-helpers/test/index.js
generated
vendored
Normal file
63
node_modules/call-bind-apply-helpers/test/index.js
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var callBind = require('../');
|
||||||
|
var hasStrictMode = require('has-strict-mode')();
|
||||||
|
var forEach = require('for-each');
|
||||||
|
var inspect = require('object-inspect');
|
||||||
|
var v = require('es-value-fixtures');
|
||||||
|
|
||||||
|
var test = require('tape');
|
||||||
|
|
||||||
|
test('callBindBasic', function (t) {
|
||||||
|
forEach(v.nonFunctions, function (nonFunction) {
|
||||||
|
t['throws'](
|
||||||
|
// @ts-expect-error
|
||||||
|
function () { callBind([nonFunction]); },
|
||||||
|
TypeError,
|
||||||
|
inspect(nonFunction) + ' is not a function'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
var sentinel = { sentinel: true };
|
||||||
|
/** @type {<T, A extends number, B extends number>(this: T, a: A, b: B) => [T | undefined, A, B]} */
|
||||||
|
var func = function (a, b) {
|
||||||
|
// eslint-disable-next-line no-invalid-this
|
||||||
|
return [!hasStrictMode && this === global ? undefined : this, a, b];
|
||||||
|
};
|
||||||
|
t.equal(func.length, 2, 'original function length is 2');
|
||||||
|
|
||||||
|
/** type {(thisArg: unknown, a: number, b: number) => [unknown, number, number]} */
|
||||||
|
var bound = callBind([func]);
|
||||||
|
/** type {((a: number, b: number) => [typeof sentinel, typeof a, typeof b])} */
|
||||||
|
var boundR = callBind([func, sentinel]);
|
||||||
|
/** type {((b: number) => [typeof sentinel, number, typeof b])} */
|
||||||
|
var boundArg = callBind([func, sentinel, /** @type {const} */ (1)]);
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with no args');
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args');
|
||||||
|
// @ts-expect-error
|
||||||
|
t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func too few args');
|
||||||
|
// @ts-expect-error
|
||||||
|
t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args');
|
||||||
|
// @ts-expect-error
|
||||||
|
t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args');
|
||||||
|
|
||||||
|
t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args');
|
||||||
|
t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with right args');
|
||||||
|
t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args');
|
||||||
|
t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg');
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args');
|
||||||
|
// @ts-expect-error
|
||||||
|
t.deepEqual(bound(1, 2, 3, 4), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args');
|
||||||
|
// @ts-expect-error
|
||||||
|
t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args');
|
||||||
|
// @ts-expect-error
|
||||||
|
t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args');
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
13
node_modules/call-bound/.eslintrc
generated
vendored
Normal file
13
node_modules/call-bound/.eslintrc
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
|
||||||
|
"extends": "@ljharb",
|
||||||
|
|
||||||
|
"rules": {
|
||||||
|
"new-cap": [2, {
|
||||||
|
"capIsNewExceptions": [
|
||||||
|
"GetIntrinsic",
|
||||||
|
],
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
}
|
12
node_modules/call-bound/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/call-bound/.github/FUNDING.yml
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: [ljharb]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: npm/call-bound
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
9
node_modules/call-bound/.nycrc
generated
vendored
Normal file
9
node_modules/call-bound/.nycrc
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"all": true,
|
||||||
|
"check-coverage": false,
|
||||||
|
"reporter": ["text-summary", "text", "html", "json"],
|
||||||
|
"exclude": [
|
||||||
|
"coverage",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
}
|
42
node_modules/call-bound/CHANGELOG.md
generated
vendored
Normal file
42
node_modules/call-bound/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.0.4](https://github.com/ljharb/call-bound/compare/v1.0.3...v1.0.4) - 2025-03-03
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [types] improve types [`e648922`](https://github.com/ljharb/call-bound/commit/e6489222a9e54f350fbf952ceabe51fd8b6027ff)
|
||||||
|
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`a42a5eb`](https://github.com/ljharb/call-bound/commit/a42a5ebe6c1b54fcdc7997c7dc64fdca9e936719)
|
||||||
|
- [Deps] update `call-bind-apply-helpers`, `get-intrinsic` [`f529eac`](https://github.com/ljharb/call-bound/commit/f529eac132404c17156bbc23ab2297a25d0f20b8)
|
||||||
|
|
||||||
|
## [v1.0.3](https://github.com/ljharb/call-bound/compare/v1.0.2...v1.0.3) - 2024-12-15
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [Refactor] use `call-bind-apply-helpers` instead of `call-bind` [`5e0b134`](https://github.com/ljharb/call-bound/commit/5e0b13496df14fb7d05dae9412f088da8d3f75be)
|
||||||
|
- [Deps] update `get-intrinsic` [`41fc967`](https://github.com/ljharb/call-bound/commit/41fc96732a22c7b7e8f381f93ccc54bb6293be2e)
|
||||||
|
- [readme] fix example [`79a0137`](https://github.com/ljharb/call-bound/commit/79a0137723f7c6d09c9c05452bbf8d5efb5d6e49)
|
||||||
|
- [meta] add `sideEffects` flag [`08b07be`](https://github.com/ljharb/call-bound/commit/08b07be7f1c03f67dc6f3cdaf0906259771859f7)
|
||||||
|
|
||||||
|
## [v1.0.2](https://github.com/ljharb/call-bound/compare/v1.0.1...v1.0.2) - 2024-12-10
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `gopd` [`e6a5ffe`](https://github.com/ljharb/call-bound/commit/e6a5ffe849368fe4f74dfd6cdeca1b9baa39e8d5)
|
||||||
|
- [Deps] update `call-bind`, `get-intrinsic` [`2aeb5b5`](https://github.com/ljharb/call-bound/commit/2aeb5b521dc2b2683d1345c753ea1161de2d1c14)
|
||||||
|
- [types] improve return type [`1a0c9fe`](https://github.com/ljharb/call-bound/commit/1a0c9fe3114471e7ca1f57d104e2efe713bb4871)
|
||||||
|
|
||||||
|
## v1.0.1 - 2024-12-05
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- Initial implementation, tests, readme, types [`6d94121`](https://github.com/ljharb/call-bound/commit/6d94121a9243602e506334069f7a03189fe3363d)
|
||||||
|
- Initial commit [`0eae867`](https://github.com/ljharb/call-bound/commit/0eae867334ea025c33e6e91cdecfc9df96680cf9)
|
||||||
|
- npm init [`71b2479`](https://github.com/ljharb/call-bound/commit/71b2479c6723e0b7d91a6b663613067e98b7b275)
|
||||||
|
- Only apps should have lockfiles [`c3754a9`](https://github.com/ljharb/call-bound/commit/c3754a949b7f9132b47e2d18c1729889736741eb)
|
||||||
|
- [actions] skip `npm ls` in node < 10 [`74275a5`](https://github.com/ljharb/call-bound/commit/74275a5186b8caf6309b6b97472bdcb0df4683a8)
|
||||||
|
- [Dev Deps] add missing peer dep [`1354de8`](https://github.com/ljharb/call-bound/commit/1354de8679413e4ae9c523d85f76fa7a5e032d97)
|
21
node_modules/call-bound/LICENSE
generated
vendored
Normal file
21
node_modules/call-bound/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Jordan Harband
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
53
node_modules/call-bound/README.md
generated
vendored
Normal file
53
node_modules/call-bound/README.md
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
# call-bound <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||||
|
|
||||||
|
[![github actions][actions-image]][actions-url]
|
||||||
|
[![coverage][codecov-image]][codecov-url]
|
||||||
|
[![dependency status][deps-svg]][deps-url]
|
||||||
|
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||||
|
[![License][license-image]][license-url]
|
||||||
|
[![Downloads][downloads-image]][downloads-url]
|
||||||
|
|
||||||
|
[![npm badge][npm-badge-png]][package-url]
|
||||||
|
|
||||||
|
Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`.
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save call-bound
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage/Examples
|
||||||
|
|
||||||
|
```js
|
||||||
|
const assert = require('assert');
|
||||||
|
const callBound = require('call-bound');
|
||||||
|
|
||||||
|
const slice = callBound('Array.prototype.slice');
|
||||||
|
|
||||||
|
delete Function.prototype.call;
|
||||||
|
delete Function.prototype.bind;
|
||||||
|
delete Array.prototype.slice;
|
||||||
|
|
||||||
|
assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
Clone the repo, `npm install`, and run `npm test`
|
||||||
|
|
||||||
|
[package-url]: https://npmjs.org/package/call-bound
|
||||||
|
[npm-version-svg]: https://versionbadg.es/ljharb/call-bound.svg
|
||||||
|
[deps-svg]: https://david-dm.org/ljharb/call-bound.svg
|
||||||
|
[deps-url]: https://david-dm.org/ljharb/call-bound
|
||||||
|
[dev-deps-svg]: https://david-dm.org/ljharb/call-bound/dev-status.svg
|
||||||
|
[dev-deps-url]: https://david-dm.org/ljharb/call-bound#info=devDependencies
|
||||||
|
[npm-badge-png]: https://nodei.co/npm/call-bound.png?downloads=true&stars=true
|
||||||
|
[license-image]: https://img.shields.io/npm/l/call-bound.svg
|
||||||
|
[license-url]: LICENSE
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/call-bound.svg
|
||||||
|
[downloads-url]: https://npm-stat.com/charts.html?package=call-bound
|
||||||
|
[codecov-image]: https://codecov.io/gh/ljharb/call-bound/branch/main/graphs/badge.svg
|
||||||
|
[codecov-url]: https://app.codecov.io/gh/ljharb/call-bound/
|
||||||
|
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bound
|
||||||
|
[actions-url]: https://github.com/ljharb/call-bound/actions
|
94
node_modules/call-bound/index.d.ts
generated
vendored
Normal file
94
node_modules/call-bound/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
type Intrinsic = typeof globalThis;
|
||||||
|
|
||||||
|
type IntrinsicName = keyof Intrinsic | `%${keyof Intrinsic}%`;
|
||||||
|
|
||||||
|
type IntrinsicPath = IntrinsicName | `${StripPercents<IntrinsicName>}.${string}` | `%${StripPercents<IntrinsicName>}.${string}%`;
|
||||||
|
|
||||||
|
type AllowMissing = boolean;
|
||||||
|
|
||||||
|
type StripPercents<T extends string> = T extends `%${infer U}%` ? U : T;
|
||||||
|
|
||||||
|
type BindMethodPrecise<F> =
|
||||||
|
F extends (this: infer This, ...args: infer Args) => infer R
|
||||||
|
? (obj: This, ...args: Args) => R
|
||||||
|
: F extends {
|
||||||
|
(this: infer This1, ...args: infer Args1): infer R1;
|
||||||
|
(this: infer This2, ...args: infer Args2): infer R2
|
||||||
|
}
|
||||||
|
? {
|
||||||
|
(obj: This1, ...args: Args1): R1;
|
||||||
|
(obj: This2, ...args: Args2): R2
|
||||||
|
}
|
||||||
|
: never
|
||||||
|
|
||||||
|
// Extract method type from a prototype
|
||||||
|
type GetPrototypeMethod<T extends keyof typeof globalThis, M extends string> =
|
||||||
|
(typeof globalThis)[T] extends { prototype: any }
|
||||||
|
? M extends keyof (typeof globalThis)[T]['prototype']
|
||||||
|
? (typeof globalThis)[T]['prototype'][M]
|
||||||
|
: never
|
||||||
|
: never
|
||||||
|
|
||||||
|
// Get static property/method
|
||||||
|
type GetStaticMember<T extends keyof typeof globalThis, P extends string> =
|
||||||
|
P extends keyof (typeof globalThis)[T] ? (typeof globalThis)[T][P] : never
|
||||||
|
|
||||||
|
// Type that maps string path to actual bound function or value with better precision
|
||||||
|
type BoundIntrinsic<S extends string> =
|
||||||
|
S extends `${infer Obj}.prototype.${infer Method}`
|
||||||
|
? Obj extends keyof typeof globalThis
|
||||||
|
? BindMethodPrecise<GetPrototypeMethod<Obj, Method & string>>
|
||||||
|
: unknown
|
||||||
|
: S extends `${infer Obj}.${infer Prop}`
|
||||||
|
? Obj extends keyof typeof globalThis
|
||||||
|
? GetStaticMember<Obj, Prop & string>
|
||||||
|
: unknown
|
||||||
|
: unknown
|
||||||
|
|
||||||
|
declare function arraySlice<T>(array: readonly T[], start?: number, end?: number): T[];
|
||||||
|
declare function arraySlice<T>(array: ArrayLike<T>, start?: number, end?: number): T[];
|
||||||
|
declare function arraySlice<T>(array: IArguments, start?: number, end?: number): T[];
|
||||||
|
|
||||||
|
// Special cases for methods that need explicit typing
|
||||||
|
interface SpecialCases {
|
||||||
|
'%Object.prototype.isPrototypeOf%': (thisArg: {}, obj: unknown) => boolean;
|
||||||
|
'%String.prototype.replace%': {
|
||||||
|
(str: string, searchValue: string | RegExp, replaceValue: string): string;
|
||||||
|
(str: string, searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string
|
||||||
|
};
|
||||||
|
'%Object.prototype.toString%': (obj: {}) => string;
|
||||||
|
'%Object.prototype.hasOwnProperty%': (obj: {}, v: PropertyKey) => boolean;
|
||||||
|
'%Array.prototype.slice%': typeof arraySlice;
|
||||||
|
'%Array.prototype.map%': <T, U>(array: readonly T[], callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any) => U[];
|
||||||
|
'%Array.prototype.filter%': <T>(array: readonly T[], predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any) => T[];
|
||||||
|
'%Array.prototype.indexOf%': <T>(array: readonly T[], searchElement: T, fromIndex?: number) => number;
|
||||||
|
'%Function.prototype.apply%': <T, A extends any[], R>(fn: (...args: A) => R, thisArg: any, args: A) => R;
|
||||||
|
'%Function.prototype.call%': <T, A extends any[], R>(fn: (...args: A) => R, thisArg: any, ...args: A) => R;
|
||||||
|
'%Function.prototype.bind%': <T, A extends any[], R>(fn: (...args: A) => R, thisArg: any, ...args: A) => (...remainingArgs: A) => R;
|
||||||
|
'%Promise.prototype.then%': {
|
||||||
|
<T, R>(promise: Promise<T>, onfulfilled: (value: T) => R | PromiseLike<R>): Promise<R>;
|
||||||
|
<T, R>(promise: Promise<T>, onfulfilled: ((value: T) => R | PromiseLike<R>) | undefined | null, onrejected: (reason: any) => R | PromiseLike<R>): Promise<R>;
|
||||||
|
};
|
||||||
|
'%RegExp.prototype.test%': (regexp: RegExp, str: string) => boolean;
|
||||||
|
'%RegExp.prototype.exec%': (regexp: RegExp, str: string) => RegExpExecArray | null;
|
||||||
|
'%Error.prototype.toString%': (error: Error) => string;
|
||||||
|
'%TypeError.prototype.toString%': (error: TypeError) => string;
|
||||||
|
'%String.prototype.split%': (
|
||||||
|
obj: unknown,
|
||||||
|
splitter: string | RegExp | {
|
||||||
|
[Symbol.split](string: string, limit?: number): string[];
|
||||||
|
},
|
||||||
|
limit?: number | undefined
|
||||||
|
) => string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a bound function for a prototype method, or a value for a static property.
|
||||||
|
*
|
||||||
|
* @param name - The name of the intrinsic (e.g. 'Array.prototype.slice')
|
||||||
|
* @param {AllowMissing} [allowMissing] - Whether to allow missing intrinsics (default: false)
|
||||||
|
*/
|
||||||
|
declare function callBound<K extends keyof SpecialCases | StripPercents<keyof SpecialCases>, S extends IntrinsicPath>(name: K, allowMissing?: AllowMissing): SpecialCases[`%${StripPercents<K>}%`];
|
||||||
|
declare function callBound<K extends keyof SpecialCases | StripPercents<keyof SpecialCases>, S extends IntrinsicPath>(name: S, allowMissing?: AllowMissing): BoundIntrinsic<S>;
|
||||||
|
|
||||||
|
export = callBound;
|
19
node_modules/call-bound/index.js
generated
vendored
Normal file
19
node_modules/call-bound/index.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var GetIntrinsic = require('get-intrinsic');
|
||||||
|
|
||||||
|
var callBindBasic = require('call-bind-apply-helpers');
|
||||||
|
|
||||||
|
/** @type {(thisArg: string, searchString: string, position?: number) => number} */
|
||||||
|
var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);
|
||||||
|
|
||||||
|
/** @type {import('.')} */
|
||||||
|
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
||||||
|
/* eslint no-extra-parens: 0 */
|
||||||
|
|
||||||
|
var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing));
|
||||||
|
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
||||||
|
return callBindBasic(/** @type {const} */ ([intrinsic]));
|
||||||
|
}
|
||||||
|
return intrinsic;
|
||||||
|
};
|
61
node_modules/call-bound/test/index.js
generated
vendored
Normal file
61
node_modules/call-bound/test/index.js
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var test = require('tape');
|
||||||
|
|
||||||
|
var callBound = require('../');
|
||||||
|
|
||||||
|
/** @template {true} T @template U @typedef {T extends U ? T : never} AssertType */
|
||||||
|
|
||||||
|
test('callBound', function (t) {
|
||||||
|
// static primitive
|
||||||
|
t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself');
|
||||||
|
t.equal(callBound('%Array.length%'), Array.length, '%Array.length% yields itself');
|
||||||
|
|
||||||
|
// static non-function object
|
||||||
|
t.equal(callBound('Array.prototype'), Array.prototype, 'Array.prototype yields itself');
|
||||||
|
t.equal(callBound('%Array.prototype%'), Array.prototype, '%Array.prototype% yields itself');
|
||||||
|
t.equal(callBound('Array.constructor'), Array.constructor, 'Array.constructor yields itself');
|
||||||
|
t.equal(callBound('%Array.constructor%'), Array.constructor, '%Array.constructor% yields itself');
|
||||||
|
|
||||||
|
// static function
|
||||||
|
t.equal(callBound('Date.parse'), Date.parse, 'Date.parse yields itself');
|
||||||
|
t.equal(callBound('%Date.parse%'), Date.parse, '%Date.parse% yields itself');
|
||||||
|
|
||||||
|
// prototype primitive
|
||||||
|
t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself');
|
||||||
|
t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself');
|
||||||
|
|
||||||
|
var x = callBound('Object.prototype.toString');
|
||||||
|
var y = callBound('%Object.prototype.toString%');
|
||||||
|
|
||||||
|
// prototype function
|
||||||
|
t.notEqual(x, Object.prototype.toString, 'Object.prototype.toString does not yield itself');
|
||||||
|
t.notEqual(y, Object.prototype.toString, '%Object.prototype.toString% does not yield itself');
|
||||||
|
t.equal(x(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original');
|
||||||
|
t.equal(y(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original');
|
||||||
|
|
||||||
|
t['throws'](
|
||||||
|
// @ts-expect-error
|
||||||
|
function () { callBound('does not exist'); },
|
||||||
|
SyntaxError,
|
||||||
|
'nonexistent intrinsic throws'
|
||||||
|
);
|
||||||
|
t['throws'](
|
||||||
|
// @ts-expect-error
|
||||||
|
function () { callBound('does not exist', true); },
|
||||||
|
SyntaxError,
|
||||||
|
'allowMissing arg still throws for unknown intrinsic'
|
||||||
|
);
|
||||||
|
|
||||||
|
t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) {
|
||||||
|
st['throws'](
|
||||||
|
function () { callBound('WeakRef'); },
|
||||||
|
TypeError,
|
||||||
|
'real but absent intrinsic throws'
|
||||||
|
);
|
||||||
|
st.equal(callBound('WeakRef', true), undefined, 'allowMissing arg avoids exception');
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
20
node_modules/debug/LICENSE
generated
vendored
Normal file
20
node_modules/debug/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
Copyright (c) 2018-2021 Josh Junon
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||||
|
and associated documentation files (the 'Software'), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||||
|
portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||||
|
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
481
node_modules/debug/README.md
generated
vendored
Normal file
481
node_modules/debug/README.md
generated
vendored
Normal file
|
@ -0,0 +1,481 @@
|
||||||
|
# debug
|
||||||
|
[](#backers)
|
||||||
|
[](#sponsors)
|
||||||
|
|
||||||
|
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||||
|
|
||||||
|
A tiny JavaScript debugging utility modelled after Node.js core's debugging
|
||||||
|
technique. Works in Node.js and web browsers.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install debug
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||||
|
|
||||||
|
Example [_app.js_](./examples/node/app.js):
|
||||||
|
|
||||||
|
```js
|
||||||
|
var debug = require('debug')('http')
|
||||||
|
, http = require('http')
|
||||||
|
, name = 'My App';
|
||||||
|
|
||||||
|
// fake app
|
||||||
|
|
||||||
|
debug('booting %o', name);
|
||||||
|
|
||||||
|
http.createServer(function(req, res){
|
||||||
|
debug(req.method + ' ' + req.url);
|
||||||
|
res.end('hello\n');
|
||||||
|
}).listen(3000, function(){
|
||||||
|
debug('listening');
|
||||||
|
});
|
||||||
|
|
||||||
|
// fake worker of some kind
|
||||||
|
|
||||||
|
require('./worker');
|
||||||
|
```
|
||||||
|
|
||||||
|
Example [_worker.js_](./examples/node/worker.js):
|
||||||
|
|
||||||
|
```js
|
||||||
|
var a = require('debug')('worker:a')
|
||||||
|
, b = require('debug')('worker:b');
|
||||||
|
|
||||||
|
function work() {
|
||||||
|
a('doing lots of uninteresting work');
|
||||||
|
setTimeout(work, Math.random() * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
work();
|
||||||
|
|
||||||
|
function workb() {
|
||||||
|
b('doing some work');
|
||||||
|
setTimeout(workb, Math.random() * 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
workb();
|
||||||
|
```
|
||||||
|
|
||||||
|
The `DEBUG` environment variable is then used to enable these based on space or
|
||||||
|
comma-delimited names.
|
||||||
|
|
||||||
|
Here are some examples:
|
||||||
|
|
||||||
|
<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
|
||||||
|
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
|
||||||
|
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
|
||||||
|
|
||||||
|
#### Windows command prompt notes
|
||||||
|
|
||||||
|
##### CMD
|
||||||
|
|
||||||
|
On Windows the environment variable is set using the `set` command.
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
set DEBUG=*,-not_this
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
set DEBUG=* & node app.js
|
||||||
|
```
|
||||||
|
|
||||||
|
##### PowerShell (VS Code default)
|
||||||
|
|
||||||
|
PowerShell uses different syntax to set environment variables.
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
$env:DEBUG = "*,-not_this"
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
$env:DEBUG='app';node app.js
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, run the program to be debugged as usual.
|
||||||
|
|
||||||
|
npm script example:
|
||||||
|
```js
|
||||||
|
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
|
||||||
|
```
|
||||||
|
|
||||||
|
## Namespace Colors
|
||||||
|
|
||||||
|
Every debug instance has a color generated for it based on its namespace name.
|
||||||
|
This helps when visually parsing the debug output to identify which debug instance
|
||||||
|
a debug line belongs to.
|
||||||
|
|
||||||
|
#### Node.js
|
||||||
|
|
||||||
|
In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
|
||||||
|
the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
|
||||||
|
otherwise debug will only use a small handful of basic colors.
|
||||||
|
|
||||||
|
<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
|
||||||
|
|
||||||
|
#### Web Browser
|
||||||
|
|
||||||
|
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||||
|
option. These are WebKit web inspectors, Firefox ([since version
|
||||||
|
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||||
|
and the Firebug plugin for Firefox (any version).
|
||||||
|
|
||||||
|
<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
|
||||||
|
|
||||||
|
|
||||||
|
## Millisecond diff
|
||||||
|
|
||||||
|
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||||
|
|
||||||
|
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||||
|
|
||||||
|
When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
|
||||||
|
|
||||||
|
<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
|
||||||
|
|
||||||
|
|
||||||
|
## Conventions
|
||||||
|
|
||||||
|
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
|
||||||
|
|
||||||
|
## Wildcards
|
||||||
|
|
||||||
|
The `*` character may be used as a wildcard. Suppose for example your library has
|
||||||
|
debuggers named "connect:bodyParser", "connect:compress", "connect:session",
|
||||||
|
instead of listing all three with
|
||||||
|
`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
|
||||||
|
`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||||
|
|
||||||
|
You can also exclude specific debuggers by prefixing them with a "-" character.
|
||||||
|
For example, `DEBUG=*,-connect:*` would include all debuggers except those
|
||||||
|
starting with "connect:".
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
When running through Node.js, you can set a few environment variables that will
|
||||||
|
change the behavior of the debug logging:
|
||||||
|
|
||||||
|
| Name | Purpose |
|
||||||
|
|-----------|-------------------------------------------------|
|
||||||
|
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||||
|
| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
|
||||||
|
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||||
|
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||||
|
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||||
|
|
||||||
|
|
||||||
|
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||||
|
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||||
|
See the Node.js documentation for
|
||||||
|
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||||
|
for the complete list.
|
||||||
|
|
||||||
|
## Formatters
|
||||||
|
|
||||||
|
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
|
||||||
|
Below are the officially supported formatters:
|
||||||
|
|
||||||
|
| Formatter | Representation |
|
||||||
|
|-----------|----------------|
|
||||||
|
| `%O` | Pretty-print an Object on multiple lines. |
|
||||||
|
| `%o` | Pretty-print an Object all on a single line. |
|
||||||
|
| `%s` | String. |
|
||||||
|
| `%d` | Number (both integer and float). |
|
||||||
|
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||||
|
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||||
|
|
||||||
|
|
||||||
|
### Custom formatters
|
||||||
|
|
||||||
|
You can add custom formatters by extending the `debug.formatters` object.
|
||||||
|
For example, if you wanted to add support for rendering a Buffer as hex with
|
||||||
|
`%h`, you could do something like:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const createDebug = require('debug')
|
||||||
|
createDebug.formatters.h = (v) => {
|
||||||
|
return v.toString('hex')
|
||||||
|
}
|
||||||
|
|
||||||
|
// …elsewhere
|
||||||
|
const debug = createDebug('foo')
|
||||||
|
debug('this is hex: %h', new Buffer('hello world'))
|
||||||
|
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Browser Support
|
||||||
|
|
||||||
|
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||||
|
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||||
|
if you don't want to build it yourself.
|
||||||
|
|
||||||
|
Debug's enable state is currently persisted by `localStorage`.
|
||||||
|
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||||
|
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
localStorage.debug = 'worker:*'
|
||||||
|
```
|
||||||
|
|
||||||
|
And then refresh the page.
|
||||||
|
|
||||||
|
```js
|
||||||
|
a = debug('worker:a');
|
||||||
|
b = debug('worker:b');
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
a('doing some work');
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
b('doing some work');
|
||||||
|
}, 1200);
|
||||||
|
```
|
||||||
|
|
||||||
|
In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_.
|
||||||
|
|
||||||
|
<img width="647" src="https://user-images.githubusercontent.com/7143133/152083257-29034707-c42c-4959-8add-3cee850e6fcf.png">
|
||||||
|
|
||||||
|
## Output streams
|
||||||
|
|
||||||
|
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||||
|
|
||||||
|
Example [_stdout.js_](./examples/node/stdout.js):
|
||||||
|
|
||||||
|
```js
|
||||||
|
var debug = require('debug');
|
||||||
|
var error = debug('app:error');
|
||||||
|
|
||||||
|
// by default stderr is used
|
||||||
|
error('goes to stderr!');
|
||||||
|
|
||||||
|
var log = debug('app:log');
|
||||||
|
// set this namespace to log via console.log
|
||||||
|
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||||
|
log('goes to stdout');
|
||||||
|
error('still goes to stderr!');
|
||||||
|
|
||||||
|
// set all output to go via console.info
|
||||||
|
// overrides all per-namespace log settings
|
||||||
|
debug.log = console.info.bind(console);
|
||||||
|
error('now goes to stdout via console.info');
|
||||||
|
log('still goes to stdout, but via console.info now');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Extend
|
||||||
|
You can simply extend debugger
|
||||||
|
```js
|
||||||
|
const log = require('debug')('auth');
|
||||||
|
|
||||||
|
//creates new debug instance with extended namespace
|
||||||
|
const logSign = log.extend('sign');
|
||||||
|
const logLogin = log.extend('login');
|
||||||
|
|
||||||
|
log('hello'); // auth hello
|
||||||
|
logSign('hello'); //auth:sign hello
|
||||||
|
logLogin('hello'); //auth:login hello
|
||||||
|
```
|
||||||
|
|
||||||
|
## Set dynamically
|
||||||
|
|
||||||
|
You can also enable debug dynamically by calling the `enable()` method :
|
||||||
|
|
||||||
|
```js
|
||||||
|
let debug = require('debug');
|
||||||
|
|
||||||
|
console.log(1, debug.enabled('test'));
|
||||||
|
|
||||||
|
debug.enable('test');
|
||||||
|
console.log(2, debug.enabled('test'));
|
||||||
|
|
||||||
|
debug.disable();
|
||||||
|
console.log(3, debug.enabled('test'));
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
print :
|
||||||
|
```
|
||||||
|
1 false
|
||||||
|
2 true
|
||||||
|
3 false
|
||||||
|
```
|
||||||
|
|
||||||
|
Usage :
|
||||||
|
`enable(namespaces)`
|
||||||
|
`namespaces` can include modes separated by a colon and wildcards.
|
||||||
|
|
||||||
|
Note that calling `enable()` completely overrides previously set DEBUG variable :
|
||||||
|
|
||||||
|
```
|
||||||
|
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
|
||||||
|
=> false
|
||||||
|
```
|
||||||
|
|
||||||
|
`disable()`
|
||||||
|
|
||||||
|
Will disable all namespaces. The functions returns the namespaces currently
|
||||||
|
enabled (and skipped). This can be useful if you want to disable debugging
|
||||||
|
temporarily without knowing what was enabled to begin with.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
let debug = require('debug');
|
||||||
|
debug.enable('foo:*,-foo:bar');
|
||||||
|
let namespaces = debug.disable();
|
||||||
|
debug.enable(namespaces);
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: There is no guarantee that the string will be identical to the initial
|
||||||
|
enable string, but semantically they will be identical.
|
||||||
|
|
||||||
|
## Checking whether a debug target is enabled
|
||||||
|
|
||||||
|
After you've created a debug instance, you can determine whether or not it is
|
||||||
|
enabled by checking the `enabled` property:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const debug = require('debug')('http');
|
||||||
|
|
||||||
|
if (debug.enabled) {
|
||||||
|
// do stuff...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also manually toggle this property to force the debug instance to be
|
||||||
|
enabled or disabled.
|
||||||
|
|
||||||
|
## Usage in child processes
|
||||||
|
|
||||||
|
Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process.
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
worker = fork(WORKER_WRAP_PATH, [workerPath], {
|
||||||
|
stdio: [
|
||||||
|
/* stdin: */ 0,
|
||||||
|
/* stdout: */ 'pipe',
|
||||||
|
/* stderr: */ 'pipe',
|
||||||
|
'ipc',
|
||||||
|
],
|
||||||
|
env: Object.assign({}, process.env, {
|
||||||
|
DEBUG_COLORS: 1 // without this settings, colors won't be shown
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
worker.stderr.pipe(process.stderr, { end: false });
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
- TJ Holowaychuk
|
||||||
|
- Nathan Rajlich
|
||||||
|
- Andrew Rhyne
|
||||||
|
- Josh Junon
|
||||||
|
|
||||||
|
## Backers
|
||||||
|
|
||||||
|
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
Copyright (c) 2018-2021 Josh Junon
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
272
node_modules/debug/src/browser.js
generated
vendored
Normal file
272
node_modules/debug/src/browser.js
generated
vendored
Normal file
|
@ -0,0 +1,272 @@
|
||||||
|
/* eslint-env browser */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the web browser implementation of `debug()`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.formatArgs = formatArgs;
|
||||||
|
exports.save = save;
|
||||||
|
exports.load = load;
|
||||||
|
exports.useColors = useColors;
|
||||||
|
exports.storage = localstorage();
|
||||||
|
exports.destroy = (() => {
|
||||||
|
let warned = false;
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (!warned) {
|
||||||
|
warned = true;
|
||||||
|
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Colors.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.colors = [
|
||||||
|
'#0000CC',
|
||||||
|
'#0000FF',
|
||||||
|
'#0033CC',
|
||||||
|
'#0033FF',
|
||||||
|
'#0066CC',
|
||||||
|
'#0066FF',
|
||||||
|
'#0099CC',
|
||||||
|
'#0099FF',
|
||||||
|
'#00CC00',
|
||||||
|
'#00CC33',
|
||||||
|
'#00CC66',
|
||||||
|
'#00CC99',
|
||||||
|
'#00CCCC',
|
||||||
|
'#00CCFF',
|
||||||
|
'#3300CC',
|
||||||
|
'#3300FF',
|
||||||
|
'#3333CC',
|
||||||
|
'#3333FF',
|
||||||
|
'#3366CC',
|
||||||
|
'#3366FF',
|
||||||
|
'#3399CC',
|
||||||
|
'#3399FF',
|
||||||
|
'#33CC00',
|
||||||
|
'#33CC33',
|
||||||
|
'#33CC66',
|
||||||
|
'#33CC99',
|
||||||
|
'#33CCCC',
|
||||||
|
'#33CCFF',
|
||||||
|
'#6600CC',
|
||||||
|
'#6600FF',
|
||||||
|
'#6633CC',
|
||||||
|
'#6633FF',
|
||||||
|
'#66CC00',
|
||||||
|
'#66CC33',
|
||||||
|
'#9900CC',
|
||||||
|
'#9900FF',
|
||||||
|
'#9933CC',
|
||||||
|
'#9933FF',
|
||||||
|
'#99CC00',
|
||||||
|
'#99CC33',
|
||||||
|
'#CC0000',
|
||||||
|
'#CC0033',
|
||||||
|
'#CC0066',
|
||||||
|
'#CC0099',
|
||||||
|
'#CC00CC',
|
||||||
|
'#CC00FF',
|
||||||
|
'#CC3300',
|
||||||
|
'#CC3333',
|
||||||
|
'#CC3366',
|
||||||
|
'#CC3399',
|
||||||
|
'#CC33CC',
|
||||||
|
'#CC33FF',
|
||||||
|
'#CC6600',
|
||||||
|
'#CC6633',
|
||||||
|
'#CC9900',
|
||||||
|
'#CC9933',
|
||||||
|
'#CCCC00',
|
||||||
|
'#CCCC33',
|
||||||
|
'#FF0000',
|
||||||
|
'#FF0033',
|
||||||
|
'#FF0066',
|
||||||
|
'#FF0099',
|
||||||
|
'#FF00CC',
|
||||||
|
'#FF00FF',
|
||||||
|
'#FF3300',
|
||||||
|
'#FF3333',
|
||||||
|
'#FF3366',
|
||||||
|
'#FF3399',
|
||||||
|
'#FF33CC',
|
||||||
|
'#FF33FF',
|
||||||
|
'#FF6600',
|
||||||
|
'#FF6633',
|
||||||
|
'#FF9900',
|
||||||
|
'#FF9933',
|
||||||
|
'#FFCC00',
|
||||||
|
'#FFCC33'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||||
|
* and the Firebug extension (any Firefox version) are known
|
||||||
|
* to support "%c" CSS customizations.
|
||||||
|
*
|
||||||
|
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||||
|
*/
|
||||||
|
|
||||||
|
// eslint-disable-next-line complexity
|
||||||
|
function useColors() {
|
||||||
|
// NB: In an Electron preload script, document will be defined but not fully
|
||||||
|
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||||
|
// explicitly
|
||||||
|
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Internet Explorer and Edge do not support colors.
|
||||||
|
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let m;
|
||||||
|
|
||||||
|
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
||||||
|
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||||
|
// eslint-disable-next-line no-return-assign
|
||||||
|
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||||
|
// Is firebug? http://stackoverflow.com/a/398120/376773
|
||||||
|
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||||
|
// Is firefox >= v31?
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||||
|
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
|
||||||
|
// Double check webkit in userAgent just in case we are in a worker
|
||||||
|
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Colorize log arguments if enabled.
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function formatArgs(args) {
|
||||||
|
args[0] = (this.useColors ? '%c' : '') +
|
||||||
|
this.namespace +
|
||||||
|
(this.useColors ? ' %c' : ' ') +
|
||||||
|
args[0] +
|
||||||
|
(this.useColors ? '%c ' : ' ') +
|
||||||
|
'+' + module.exports.humanize(this.diff);
|
||||||
|
|
||||||
|
if (!this.useColors) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const c = 'color: ' + this.color;
|
||||||
|
args.splice(1, 0, c, 'color: inherit');
|
||||||
|
|
||||||
|
// The final "%c" is somewhat tricky, because there could be other
|
||||||
|
// arguments passed either before or after the %c, so we need to
|
||||||
|
// figure out the correct index to insert the CSS into
|
||||||
|
let index = 0;
|
||||||
|
let lastC = 0;
|
||||||
|
args[0].replace(/%[a-zA-Z%]/g, match => {
|
||||||
|
if (match === '%%') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
if (match === '%c') {
|
||||||
|
// We only are interested in the *last* %c
|
||||||
|
// (the user may have provided their own)
|
||||||
|
lastC = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
args.splice(lastC, 0, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invokes `console.debug()` when available.
|
||||||
|
* No-op when `console.debug` is not a "function".
|
||||||
|
* If `console.debug` is not available, falls back
|
||||||
|
* to `console.log`.
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
exports.log = console.debug || console.log || (() => {});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save `namespaces`.
|
||||||
|
*
|
||||||
|
* @param {String} namespaces
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
function save(namespaces) {
|
||||||
|
try {
|
||||||
|
if (namespaces) {
|
||||||
|
exports.storage.setItem('debug', namespaces);
|
||||||
|
} else {
|
||||||
|
exports.storage.removeItem('debug');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// Swallow
|
||||||
|
// XXX (@Qix-) should we be logging these?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load `namespaces`.
|
||||||
|
*
|
||||||
|
* @return {String} returns the previously persisted debug modes
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
function load() {
|
||||||
|
let r;
|
||||||
|
try {
|
||||||
|
r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
|
||||||
|
} catch (error) {
|
||||||
|
// Swallow
|
||||||
|
// XXX (@Qix-) should we be logging these?
|
||||||
|
}
|
||||||
|
|
||||||
|
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||||
|
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||||
|
r = process.env.DEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Localstorage attempts to return the localstorage.
|
||||||
|
*
|
||||||
|
* This is necessary because safari throws
|
||||||
|
* when a user disables cookies/localstorage
|
||||||
|
* and you attempt to access it.
|
||||||
|
*
|
||||||
|
* @return {LocalStorage}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function localstorage() {
|
||||||
|
try {
|
||||||
|
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
||||||
|
// The Browser also has localStorage in the global context.
|
||||||
|
return localStorage;
|
||||||
|
} catch (error) {
|
||||||
|
// Swallow
|
||||||
|
// XXX (@Qix-) should we be logging these?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = require('./common')(exports);
|
||||||
|
|
||||||
|
const {formatters} = module.exports;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
formatters.j = function (v) {
|
||||||
|
try {
|
||||||
|
return JSON.stringify(v);
|
||||||
|
} catch (error) {
|
||||||
|
return '[UnexpectedJSONParseError]: ' + error.message;
|
||||||
|
}
|
||||||
|
};
|
292
node_modules/debug/src/common.js
generated
vendored
Normal file
292
node_modules/debug/src/common.js
generated
vendored
Normal file
|
@ -0,0 +1,292 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the common logic for both the Node.js and web browser
|
||||||
|
* implementations of `debug()`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function setup(env) {
|
||||||
|
createDebug.debug = createDebug;
|
||||||
|
createDebug.default = createDebug;
|
||||||
|
createDebug.coerce = coerce;
|
||||||
|
createDebug.disable = disable;
|
||||||
|
createDebug.enable = enable;
|
||||||
|
createDebug.enabled = enabled;
|
||||||
|
createDebug.humanize = require('ms');
|
||||||
|
createDebug.destroy = destroy;
|
||||||
|
|
||||||
|
Object.keys(env).forEach(key => {
|
||||||
|
createDebug[key] = env[key];
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The currently active debug mode names, and names to skip.
|
||||||
|
*/
|
||||||
|
|
||||||
|
createDebug.names = [];
|
||||||
|
createDebug.skips = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||||
|
*
|
||||||
|
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||||
|
*/
|
||||||
|
createDebug.formatters = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects a color for a debug namespace
|
||||||
|
* @param {String} namespace The namespace string for the debug instance to be colored
|
||||||
|
* @return {Number|String} An ANSI color code for the given namespace
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
function selectColor(namespace) {
|
||||||
|
let hash = 0;
|
||||||
|
|
||||||
|
for (let i = 0; i < namespace.length; i++) {
|
||||||
|
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||||||
|
hash |= 0; // Convert to 32bit integer
|
||||||
|
}
|
||||||
|
|
||||||
|
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
||||||
|
}
|
||||||
|
createDebug.selectColor = selectColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a debugger with the given `namespace`.
|
||||||
|
*
|
||||||
|
* @param {String} namespace
|
||||||
|
* @return {Function}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
function createDebug(namespace) {
|
||||||
|
let prevTime;
|
||||||
|
let enableOverride = null;
|
||||||
|
let namespacesCache;
|
||||||
|
let enabledCache;
|
||||||
|
|
||||||
|
function debug(...args) {
|
||||||
|
// Disabled?
|
||||||
|
if (!debug.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const self = debug;
|
||||||
|
|
||||||
|
// Set `diff` timestamp
|
||||||
|
const curr = Number(new Date());
|
||||||
|
const ms = curr - (prevTime || curr);
|
||||||
|
self.diff = ms;
|
||||||
|
self.prev = prevTime;
|
||||||
|
self.curr = curr;
|
||||||
|
prevTime = curr;
|
||||||
|
|
||||||
|
args[0] = createDebug.coerce(args[0]);
|
||||||
|
|
||||||
|
if (typeof args[0] !== 'string') {
|
||||||
|
// Anything else let's inspect with %O
|
||||||
|
args.unshift('%O');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply any `formatters` transformations
|
||||||
|
let index = 0;
|
||||||
|
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
||||||
|
// If we encounter an escaped % then don't increase the array index
|
||||||
|
if (match === '%%') {
|
||||||
|
return '%';
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
const formatter = createDebug.formatters[format];
|
||||||
|
if (typeof formatter === 'function') {
|
||||||
|
const val = args[index];
|
||||||
|
match = formatter.call(self, val);
|
||||||
|
|
||||||
|
// Now we need to remove `args[index]` since it's inlined in the `format`
|
||||||
|
args.splice(index, 1);
|
||||||
|
index--;
|
||||||
|
}
|
||||||
|
return match;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Apply env-specific formatting (colors, etc.)
|
||||||
|
createDebug.formatArgs.call(self, args);
|
||||||
|
|
||||||
|
const logFn = self.log || createDebug.log;
|
||||||
|
logFn.apply(self, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
debug.namespace = namespace;
|
||||||
|
debug.useColors = createDebug.useColors();
|
||||||
|
debug.color = createDebug.selectColor(namespace);
|
||||||
|
debug.extend = extend;
|
||||||
|
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
||||||
|
|
||||||
|
Object.defineProperty(debug, 'enabled', {
|
||||||
|
enumerable: true,
|
||||||
|
configurable: false,
|
||||||
|
get: () => {
|
||||||
|
if (enableOverride !== null) {
|
||||||
|
return enableOverride;
|
||||||
|
}
|
||||||
|
if (namespacesCache !== createDebug.namespaces) {
|
||||||
|
namespacesCache = createDebug.namespaces;
|
||||||
|
enabledCache = createDebug.enabled(namespace);
|
||||||
|
}
|
||||||
|
|
||||||
|
return enabledCache;
|
||||||
|
},
|
||||||
|
set: v => {
|
||||||
|
enableOverride = v;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Env-specific initialization logic for debug instances
|
||||||
|
if (typeof createDebug.init === 'function') {
|
||||||
|
createDebug.init(debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
function extend(namespace, delimiter) {
|
||||||
|
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||||||
|
newDebug.log = this.log;
|
||||||
|
return newDebug;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables a debug mode by namespaces. This can include modes
|
||||||
|
* separated by a colon and wildcards.
|
||||||
|
*
|
||||||
|
* @param {String} namespaces
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
function enable(namespaces) {
|
||||||
|
createDebug.save(namespaces);
|
||||||
|
createDebug.namespaces = namespaces;
|
||||||
|
|
||||||
|
createDebug.names = [];
|
||||||
|
createDebug.skips = [];
|
||||||
|
|
||||||
|
const split = (typeof namespaces === 'string' ? namespaces : '')
|
||||||
|
.trim()
|
||||||
|
.replace(/\s+/g, ',')
|
||||||
|
.split(',')
|
||||||
|
.filter(Boolean);
|
||||||
|
|
||||||
|
for (const ns of split) {
|
||||||
|
if (ns[0] === '-') {
|
||||||
|
createDebug.skips.push(ns.slice(1));
|
||||||
|
} else {
|
||||||
|
createDebug.names.push(ns);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given string matches a namespace template, honoring
|
||||||
|
* asterisks as wildcards.
|
||||||
|
*
|
||||||
|
* @param {String} search
|
||||||
|
* @param {String} template
|
||||||
|
* @return {Boolean}
|
||||||
|
*/
|
||||||
|
function matchesTemplate(search, template) {
|
||||||
|
let searchIndex = 0;
|
||||||
|
let templateIndex = 0;
|
||||||
|
let starIndex = -1;
|
||||||
|
let matchIndex = 0;
|
||||||
|
|
||||||
|
while (searchIndex < search.length) {
|
||||||
|
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
|
||||||
|
// Match character or proceed with wildcard
|
||||||
|
if (template[templateIndex] === '*') {
|
||||||
|
starIndex = templateIndex;
|
||||||
|
matchIndex = searchIndex;
|
||||||
|
templateIndex++; // Skip the '*'
|
||||||
|
} else {
|
||||||
|
searchIndex++;
|
||||||
|
templateIndex++;
|
||||||
|
}
|
||||||
|
} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
|
||||||
|
// Backtrack to the last '*' and try to match more characters
|
||||||
|
templateIndex = starIndex + 1;
|
||||||
|
matchIndex++;
|
||||||
|
searchIndex = matchIndex;
|
||||||
|
} else {
|
||||||
|
return false; // No match
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle trailing '*' in template
|
||||||
|
while (templateIndex < template.length && template[templateIndex] === '*') {
|
||||||
|
templateIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return templateIndex === template.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable debug output.
|
||||||
|
*
|
||||||
|
* @return {String} namespaces
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
function disable() {
|
||||||
|
const namespaces = [
|
||||||
|
...createDebug.names,
|
||||||
|
...createDebug.skips.map(namespace => '-' + namespace)
|
||||||
|
].join(',');
|
||||||
|
createDebug.enable('');
|
||||||
|
return namespaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the given mode name is enabled, false otherwise.
|
||||||
|
*
|
||||||
|
* @param {String} name
|
||||||
|
* @return {Boolean}
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
function enabled(name) {
|
||||||
|
for (const skip of createDebug.skips) {
|
||||||
|
if (matchesTemplate(name, skip)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const ns of createDebug.names) {
|
||||||
|
if (matchesTemplate(name, ns)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Coerce `val`.
|
||||||
|
*
|
||||||
|
* @param {Mixed} val
|
||||||
|
* @return {Mixed}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
function coerce(val) {
|
||||||
|
if (val instanceof Error) {
|
||||||
|
return val.stack || val.message;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* XXX DO NOT USE. This is a temporary stub function.
|
||||||
|
* XXX It WILL be removed in the next major release.
|
||||||
|
*/
|
||||||
|
function destroy() {
|
||||||
|
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
||||||
|
}
|
||||||
|
|
||||||
|
createDebug.enable(createDebug.load());
|
||||||
|
|
||||||
|
return createDebug;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = setup;
|
10
node_modules/debug/src/index.js
generated
vendored
Normal file
10
node_modules/debug/src/index.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/**
|
||||||
|
* Detect Electron renderer / nwjs process, which is node, but we should
|
||||||
|
* treat as a browser.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||||||
|
module.exports = require('./browser.js');
|
||||||
|
} else {
|
||||||
|
module.exports = require('./node.js');
|
||||||
|
}
|
263
node_modules/debug/src/node.js
generated
vendored
Normal file
263
node_modules/debug/src/node.js
generated
vendored
Normal file
|
@ -0,0 +1,263 @@
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const tty = require('tty');
|
||||||
|
const util = require('util');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the Node.js implementation of `debug()`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.init = init;
|
||||||
|
exports.log = log;
|
||||||
|
exports.formatArgs = formatArgs;
|
||||||
|
exports.save = save;
|
||||||
|
exports.load = load;
|
||||||
|
exports.useColors = useColors;
|
||||||
|
exports.destroy = util.deprecate(
|
||||||
|
() => {},
|
||||||
|
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Colors.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
||||||
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
|
const supportsColor = require('supports-color');
|
||||||
|
|
||||||
|
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
||||||
|
exports.colors = [
|
||||||
|
20,
|
||||||
|
21,
|
||||||
|
26,
|
||||||
|
27,
|
||||||
|
32,
|
||||||
|
33,
|
||||||
|
38,
|
||||||
|
39,
|
||||||
|
40,
|
||||||
|
41,
|
||||||
|
42,
|
||||||
|
43,
|
||||||
|
44,
|
||||||
|
45,
|
||||||
|
56,
|
||||||
|
57,
|
||||||
|
62,
|
||||||
|
63,
|
||||||
|
68,
|
||||||
|
69,
|
||||||
|
74,
|
||||||
|
75,
|
||||||
|
76,
|
||||||
|
77,
|
||||||
|
78,
|
||||||
|
79,
|
||||||
|
80,
|
||||||
|
81,
|
||||||
|
92,
|
||||||
|
93,
|
||||||
|
98,
|
||||||
|
99,
|
||||||
|
112,
|
||||||
|
113,
|
||||||
|
128,
|
||||||
|
129,
|
||||||
|
134,
|
||||||
|
135,
|
||||||
|
148,
|
||||||
|
149,
|
||||||
|
160,
|
||||||
|
161,
|
||||||
|
162,
|
||||||
|
163,
|
||||||
|
164,
|
||||||
|
165,
|
||||||
|
166,
|
||||||
|
167,
|
||||||
|
168,
|
||||||
|
169,
|
||||||
|
170,
|
||||||
|
171,
|
||||||
|
172,
|
||||||
|
173,
|
||||||
|
178,
|
||||||
|
179,
|
||||||
|
184,
|
||||||
|
185,
|
||||||
|
196,
|
||||||
|
197,
|
||||||
|
198,
|
||||||
|
199,
|
||||||
|
200,
|
||||||
|
201,
|
||||||
|
202,
|
||||||
|
203,
|
||||||
|
204,
|
||||||
|
205,
|
||||||
|
206,
|
||||||
|
207,
|
||||||
|
208,
|
||||||
|
209,
|
||||||
|
214,
|
||||||
|
215,
|
||||||
|
220,
|
||||||
|
221
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build up the default `inspectOpts` object from the environment variables.
|
||||||
|
*
|
||||||
|
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
||||||
|
return /^debug_/i.test(key);
|
||||||
|
}).reduce((obj, key) => {
|
||||||
|
// Camel-case
|
||||||
|
const prop = key
|
||||||
|
.substring(6)
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/_([a-z])/g, (_, k) => {
|
||||||
|
return k.toUpperCase();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Coerce string value into JS value
|
||||||
|
let val = process.env[key];
|
||||||
|
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
||||||
|
val = true;
|
||||||
|
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
||||||
|
val = false;
|
||||||
|
} else if (val === 'null') {
|
||||||
|
val = null;
|
||||||
|
} else {
|
||||||
|
val = Number(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
obj[prop] = val;
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function useColors() {
|
||||||
|
return 'colors' in exports.inspectOpts ?
|
||||||
|
Boolean(exports.inspectOpts.colors) :
|
||||||
|
tty.isatty(process.stderr.fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds ANSI color escape codes if enabled.
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function formatArgs(args) {
|
||||||
|
const {namespace: name, useColors} = this;
|
||||||
|
|
||||||
|
if (useColors) {
|
||||||
|
const c = this.color;
|
||||||
|
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
||||||
|
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
||||||
|
|
||||||
|
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||||
|
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
||||||
|
} else {
|
||||||
|
args[0] = getDate() + name + ' ' + args[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDate() {
|
||||||
|
if (exports.inspectOpts.hideDate) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return new Date().toISOString() + ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function log(...args) {
|
||||||
|
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save `namespaces`.
|
||||||
|
*
|
||||||
|
* @param {String} namespaces
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
function save(namespaces) {
|
||||||
|
if (namespaces) {
|
||||||
|
process.env.DEBUG = namespaces;
|
||||||
|
} else {
|
||||||
|
// If you set a process.env field to null or undefined, it gets cast to the
|
||||||
|
// string 'null' or 'undefined'. Just delete instead.
|
||||||
|
delete process.env.DEBUG;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load `namespaces`.
|
||||||
|
*
|
||||||
|
* @return {String} returns the previously persisted debug modes
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
return process.env.DEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init logic for `debug` instances.
|
||||||
|
*
|
||||||
|
* Create a new `inspectOpts` object in case `useColors` is set
|
||||||
|
* differently for a particular `debug` instance.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function init(debug) {
|
||||||
|
debug.inspectOpts = {};
|
||||||
|
|
||||||
|
const keys = Object.keys(exports.inspectOpts);
|
||||||
|
for (let i = 0; i < keys.length; i++) {
|
||||||
|
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = require('./common')(exports);
|
||||||
|
|
||||||
|
const {formatters} = module.exports;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map %o to `util.inspect()`, all on a single line.
|
||||||
|
*/
|
||||||
|
|
||||||
|
formatters.o = function (v) {
|
||||||
|
this.inspectOpts.colors = this.useColors;
|
||||||
|
return util.inspect(v, this.inspectOpts)
|
||||||
|
.split('\n')
|
||||||
|
.map(str => str.trim())
|
||||||
|
.join(' ');
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
formatters.O = function (v) {
|
||||||
|
this.inspectOpts.colors = this.useColors;
|
||||||
|
return util.inspect(v, this.inspectOpts);
|
||||||
|
};
|
5
node_modules/dunder-proto/.eslintrc
generated
vendored
Normal file
5
node_modules/dunder-proto/.eslintrc
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
|
||||||
|
"extends": "@ljharb",
|
||||||
|
}
|
12
node_modules/dunder-proto/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/dunder-proto/.github/FUNDING.yml
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: [ljharb]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: npm/dunder-proto
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
13
node_modules/dunder-proto/.nycrc
generated
vendored
Normal file
13
node_modules/dunder-proto/.nycrc
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"all": true,
|
||||||
|
"check-coverage": false,
|
||||||
|
"reporter": ["text-summary", "text", "html", "json"],
|
||||||
|
"lines": 86,
|
||||||
|
"statements": 85.93,
|
||||||
|
"functions": 82.43,
|
||||||
|
"branches": 76.06,
|
||||||
|
"exclude": [
|
||||||
|
"coverage",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
}
|
24
node_modules/dunder-proto/CHANGELOG.md
generated
vendored
Normal file
24
node_modules/dunder-proto/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.0.1](https://github.com/es-shims/dunder-proto/compare/v1.0.0...v1.0.1) - 2024-12-16
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [Fix] do not crash when `--disable-proto=throw` [`6c367d9`](https://github.com/es-shims/dunder-proto/commit/6c367d919bc1604778689a297bbdbfea65752847)
|
||||||
|
- [Tests] ensure noproto tests only use the current version of dunder-proto [`b02365b`](https://github.com/es-shims/dunder-proto/commit/b02365b9cf889c4a2cac7be0c3cfc90a789af36c)
|
||||||
|
- [Dev Deps] update `@arethetypeswrong/cli`, `@types/tape` [`e3c5c3b`](https://github.com/es-shims/dunder-proto/commit/e3c5c3bd81cf8cef7dff2eca19e558f0e307f666)
|
||||||
|
- [Deps] update `call-bind-apply-helpers` [`19f1da0`](https://github.com/es-shims/dunder-proto/commit/19f1da028b8dd0d05c85bfd8f7eed2819b686450)
|
||||||
|
|
||||||
|
## v1.0.0 - 2024-12-06
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- Initial implementation, tests, readme, types [`a5b74b0`](https://github.com/es-shims/dunder-proto/commit/a5b74b0082f5270cb0905cd9a2e533cee7498373)
|
||||||
|
- Initial commit [`73fb5a3`](https://github.com/es-shims/dunder-proto/commit/73fb5a353b51ac2ab00c9fdeb0114daffd4c07a8)
|
||||||
|
- npm init [`80152dc`](https://github.com/es-shims/dunder-proto/commit/80152dc98155da4eb046d9f67a87ed96e8280a1d)
|
||||||
|
- Only apps should have lockfiles [`03e6660`](https://github.com/es-shims/dunder-proto/commit/03e6660a1d70dc401f3e217a031475ec537243dd)
|
21
node_modules/dunder-proto/LICENSE
generated
vendored
Normal file
21
node_modules/dunder-proto/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 ECMAScript Shims
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
54
node_modules/dunder-proto/README.md
generated
vendored
Normal file
54
node_modules/dunder-proto/README.md
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# dunder-proto <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||||
|
|
||||||
|
[![github actions][actions-image]][actions-url]
|
||||||
|
[![coverage][codecov-image]][codecov-url]
|
||||||
|
[![License][license-image]][license-url]
|
||||||
|
[![Downloads][downloads-image]][downloads-url]
|
||||||
|
|
||||||
|
[![npm badge][npm-badge-png]][package-url]
|
||||||
|
|
||||||
|
If available, the `Object.prototype.__proto__` accessor and mutator, call-bound.
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save dunder-proto
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage/Examples
|
||||||
|
|
||||||
|
```js
|
||||||
|
const assert = require('assert');
|
||||||
|
const getDunder = require('dunder-proto/get');
|
||||||
|
const setDunder = require('dunder-proto/set');
|
||||||
|
|
||||||
|
const obj = {};
|
||||||
|
|
||||||
|
assert.equal('toString' in obj, true);
|
||||||
|
assert.equal(getDunder(obj), Object.prototype);
|
||||||
|
|
||||||
|
setDunder(obj, null);
|
||||||
|
|
||||||
|
assert.equal('toString' in obj, false);
|
||||||
|
assert.equal(getDunder(obj), null);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
Clone the repo, `npm install`, and run `npm test`
|
||||||
|
|
||||||
|
[package-url]: https://npmjs.org/package/dunder-proto
|
||||||
|
[npm-version-svg]: https://versionbadg.es/es-shims/dunder-proto.svg
|
||||||
|
[deps-svg]: https://david-dm.org/es-shims/dunder-proto.svg
|
||||||
|
[deps-url]: https://david-dm.org/es-shims/dunder-proto
|
||||||
|
[dev-deps-svg]: https://david-dm.org/es-shims/dunder-proto/dev-status.svg
|
||||||
|
[dev-deps-url]: https://david-dm.org/es-shims/dunder-proto#info=devDependencies
|
||||||
|
[npm-badge-png]: https://nodei.co/npm/dunder-proto.png?downloads=true&stars=true
|
||||||
|
[license-image]: https://img.shields.io/npm/l/dunder-proto.svg
|
||||||
|
[license-url]: LICENSE
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/dunder-proto.svg
|
||||||
|
[downloads-url]: https://npm-stat.com/charts.html?package=dunder-proto
|
||||||
|
[codecov-image]: https://codecov.io/gh/es-shims/dunder-proto/branch/main/graphs/badge.svg
|
||||||
|
[codecov-url]: https://app.codecov.io/gh/es-shims/dunder-proto/
|
||||||
|
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/dunder-proto
|
||||||
|
[actions-url]: https://github.com/es-shims/dunder-proto/actions
|
5
node_modules/dunder-proto/get.d.ts
generated
vendored
Normal file
5
node_modules/dunder-proto/get.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
declare function getDunderProto(target: {}): object | null;
|
||||||
|
|
||||||
|
declare const x: false | typeof getDunderProto;
|
||||||
|
|
||||||
|
export = x;
|
30
node_modules/dunder-proto/get.js
generated
vendored
Normal file
30
node_modules/dunder-proto/get.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var callBind = require('call-bind-apply-helpers');
|
||||||
|
var gOPD = require('gopd');
|
||||||
|
|
||||||
|
var hasProtoAccessor;
|
||||||
|
try {
|
||||||
|
// eslint-disable-next-line no-extra-parens, no-proto
|
||||||
|
hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
|
||||||
|
} catch (e) {
|
||||||
|
if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-extra-parens
|
||||||
|
var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
|
||||||
|
|
||||||
|
var $Object = Object;
|
||||||
|
var $getPrototypeOf = $Object.getPrototypeOf;
|
||||||
|
|
||||||
|
/** @type {import('./get')} */
|
||||||
|
module.exports = desc && typeof desc.get === 'function'
|
||||||
|
? callBind([desc.get])
|
||||||
|
: typeof $getPrototypeOf === 'function'
|
||||||
|
? /** @type {import('./get')} */ function getDunder(value) {
|
||||||
|
// eslint-disable-next-line eqeqeq
|
||||||
|
return $getPrototypeOf(value == null ? value : $Object(value));
|
||||||
|
}
|
||||||
|
: false;
|
5
node_modules/dunder-proto/set.d.ts
generated
vendored
Normal file
5
node_modules/dunder-proto/set.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
declare function setDunderProto<P extends null | object>(target: {}, proto: P): P;
|
||||||
|
|
||||||
|
declare const x: false | typeof setDunderProto;
|
||||||
|
|
||||||
|
export = x;
|
35
node_modules/dunder-proto/set.js
generated
vendored
Normal file
35
node_modules/dunder-proto/set.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var callBind = require('call-bind-apply-helpers');
|
||||||
|
var gOPD = require('gopd');
|
||||||
|
var $TypeError = require('es-errors/type');
|
||||||
|
|
||||||
|
/** @type {{ __proto__?: object | null }} */
|
||||||
|
var obj = {};
|
||||||
|
try {
|
||||||
|
obj.__proto__ = null; // eslint-disable-line no-proto
|
||||||
|
} catch (e) {
|
||||||
|
if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var hasProtoMutator = !('toString' in obj);
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-extra-parens
|
||||||
|
var desc = gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
|
||||||
|
|
||||||
|
/** @type {import('./set')} */
|
||||||
|
module.exports = hasProtoMutator && (
|
||||||
|
// eslint-disable-next-line no-extra-parens
|
||||||
|
(!!desc && typeof desc.set === 'function' && /** @type {import('./set')} */ (callBind([desc.set])))
|
||||||
|
|| /** @type {import('./set')} */ function setDunder(object, proto) {
|
||||||
|
// this is node v0.10 or older, which doesn't have Object.setPrototypeOf and has undeniable __proto__
|
||||||
|
if (object == null) { // eslint-disable-line eqeqeq
|
||||||
|
throw new $TypeError('set Object.prototype.__proto__ called on null or undefined');
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-proto, no-param-reassign, no-extra-parens
|
||||||
|
/** @type {{ __proto__?: object | null }} */ (object).__proto__ = proto;
|
||||||
|
return proto;
|
||||||
|
}
|
||||||
|
);
|
34
node_modules/dunder-proto/test/get.js
generated
vendored
Normal file
34
node_modules/dunder-proto/test/get.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var test = require('tape');
|
||||||
|
|
||||||
|
var getDunderProto = require('../get');
|
||||||
|
|
||||||
|
test('getDunderProto', { skip: !getDunderProto }, function (t) {
|
||||||
|
if (!getDunderProto) {
|
||||||
|
throw 'should never happen; this is just for type narrowing'; // eslint-disable-line no-throw-literal
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
t['throws'](function () { getDunderProto(); }, TypeError, 'throws if no argument');
|
||||||
|
// @ts-expect-error
|
||||||
|
t['throws'](function () { getDunderProto(undefined); }, TypeError, 'throws with undefined');
|
||||||
|
// @ts-expect-error
|
||||||
|
t['throws'](function () { getDunderProto(null); }, TypeError, 'throws with null');
|
||||||
|
|
||||||
|
t.equal(getDunderProto({}), Object.prototype);
|
||||||
|
t.equal(getDunderProto([]), Array.prototype);
|
||||||
|
t.equal(getDunderProto(function () {}), Function.prototype);
|
||||||
|
t.equal(getDunderProto(/./g), RegExp.prototype);
|
||||||
|
t.equal(getDunderProto(42), Number.prototype);
|
||||||
|
t.equal(getDunderProto(true), Boolean.prototype);
|
||||||
|
t.equal(getDunderProto('foo'), String.prototype);
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('no dunder proto', { skip: !!getDunderProto }, function (t) {
|
||||||
|
t.notOk('__proto__' in Object.prototype, 'no __proto__ in Object.prototype');
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
4
node_modules/dunder-proto/test/index.js
generated
vendored
Normal file
4
node_modules/dunder-proto/test/index.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
require('./get');
|
||||||
|
require('./set');
|
50
node_modules/dunder-proto/test/set.js
generated
vendored
Normal file
50
node_modules/dunder-proto/test/set.js
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var test = require('tape');
|
||||||
|
|
||||||
|
var setDunderProto = require('../set');
|
||||||
|
|
||||||
|
test('setDunderProto', { skip: !setDunderProto }, function (t) {
|
||||||
|
if (!setDunderProto) {
|
||||||
|
throw 'should never happen; this is just for type narrowing'; // eslint-disable-line no-throw-literal
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
t['throws'](function () { setDunderProto(); }, TypeError, 'throws if no arguments');
|
||||||
|
// @ts-expect-error
|
||||||
|
t['throws'](function () { setDunderProto(undefined); }, TypeError, 'throws with undefined and nothing');
|
||||||
|
// @ts-expect-error
|
||||||
|
t['throws'](function () { setDunderProto(undefined, undefined); }, TypeError, 'throws with undefined and undefined');
|
||||||
|
// @ts-expect-error
|
||||||
|
t['throws'](function () { setDunderProto(null); }, TypeError, 'throws with null and undefined');
|
||||||
|
// @ts-expect-error
|
||||||
|
t['throws'](function () { setDunderProto(null, undefined); }, TypeError, 'throws with null and undefined');
|
||||||
|
|
||||||
|
/** @type {{ inherited?: boolean }} */
|
||||||
|
var obj = {};
|
||||||
|
t.ok('toString' in obj, 'object initially has toString');
|
||||||
|
|
||||||
|
setDunderProto(obj, null);
|
||||||
|
t.notOk('toString' in obj, 'object no longer has toString');
|
||||||
|
|
||||||
|
t.notOk('inherited' in obj, 'object lacks inherited property');
|
||||||
|
setDunderProto(obj, { inherited: true });
|
||||||
|
t.equal(obj.inherited, true, 'object has inherited property');
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('no dunder proto', { skip: !!setDunderProto }, function (t) {
|
||||||
|
if ('__proto__' in Object.prototype) {
|
||||||
|
t['throws'](
|
||||||
|
// @ts-expect-error
|
||||||
|
function () { ({}).__proto__ = null; }, // eslint-disable-line no-proto
|
||||||
|
Error,
|
||||||
|
'throws when setting Object.prototype.__proto__'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
t.notOk('__proto__' in Object.prototype, 'no __proto__ in Object.prototype');
|
||||||
|
}
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
1
node_modules/ecdsa-sig-formatter/CODEOWNERS
generated
vendored
Normal file
1
node_modules/ecdsa-sig-formatter/CODEOWNERS
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* @omsmith
|
201
node_modules/ecdsa-sig-formatter/LICENSE
generated
vendored
Normal file
201
node_modules/ecdsa-sig-formatter/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright 2015 D2L Corporation
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
65
node_modules/ecdsa-sig-formatter/README.md
generated
vendored
Normal file
65
node_modules/ecdsa-sig-formatter/README.md
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
# ecdsa-sig-formatter
|
||||||
|
|
||||||
|
[](https://travis-ci.org/Brightspace/node-ecdsa-sig-formatter) [](https://coveralls.io/r/Brightspace/node-ecdsa-sig-formatter)
|
||||||
|
|
||||||
|
Translate between JOSE and ASN.1/DER encodings for ECDSA signatures
|
||||||
|
|
||||||
|
## Install
|
||||||
|
```sh
|
||||||
|
npm install ecdsa-sig-formatter --save
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```js
|
||||||
|
var format = require('ecdsa-sig-formatter');
|
||||||
|
|
||||||
|
var derSignature = '..'; // asn.1/DER encoded ecdsa signature
|
||||||
|
|
||||||
|
var joseSignature = format.derToJose(derSignature);
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `.derToJose(Buffer|String signature, String alg)` -> `String`
|
||||||
|
|
||||||
|
Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature.
|
||||||
|
Returns a _base64 url_ encoded `String`.
|
||||||
|
|
||||||
|
* If _signature_ is a `String`, it should be _base64_ encoded
|
||||||
|
* _alg_ must be one of _ES256_, _ES384_ or _ES512_
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `.joseToDer(Buffer|String signature, String alg)` -> `Buffer`
|
||||||
|
|
||||||
|
Convert the JOSE-style concatenated signature to an ASN.1/DER encoded
|
||||||
|
signature. Returns a `Buffer`
|
||||||
|
|
||||||
|
* If _signature_ is a `String`, it should be _base64 url_ encoded
|
||||||
|
* _alg_ must be one of _ES256_, _ES384_ or _ES512_
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
1. **Fork** the repository. Committing directly against this repository is
|
||||||
|
highly discouraged.
|
||||||
|
|
||||||
|
2. Make your modifications in a branch, updating and writing new unit tests
|
||||||
|
as necessary in the `spec` directory.
|
||||||
|
|
||||||
|
3. Ensure that all tests pass with `npm test`
|
||||||
|
|
||||||
|
4. `rebase` your changes against master. *Do not merge*.
|
||||||
|
|
||||||
|
5. Submit a pull request to this repository. Wait for tests to run and someone
|
||||||
|
to chime in.
|
||||||
|
|
||||||
|
### Code Style
|
||||||
|
|
||||||
|
This repository is configured with [EditorConfig][EditorConfig] and
|
||||||
|
[ESLint][ESLint] rules.
|
||||||
|
|
||||||
|
[EditorConfig]: http://editorconfig.org/
|
||||||
|
[ESLint]: http://eslint.org
|
17
node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts
generated
vendored
Normal file
17
node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/// <reference types="node" />
|
||||||
|
|
||||||
|
declare module "ecdsa-sig-formatter" {
|
||||||
|
/**
|
||||||
|
* Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature. Returns a base64 url encoded String.
|
||||||
|
* If signature is a String, it should be base64 encoded
|
||||||
|
* alg must be one of ES256, ES384 or ES512
|
||||||
|
*/
|
||||||
|
export function derToJose(signature: Buffer | string, alg: string): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the JOSE-style concatenated signature to an ASN.1/DER encoded signature. Returns a Buffer
|
||||||
|
* If signature is a String, it should be base64 url encoded
|
||||||
|
* alg must be one of ES256, ES384 or ES512
|
||||||
|
*/
|
||||||
|
export function joseToDer(signature: Buffer | string, alg: string): Buffer
|
||||||
|
}
|
187
node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js
generated
vendored
Normal file
187
node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js
generated
vendored
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var Buffer = require('safe-buffer').Buffer;
|
||||||
|
|
||||||
|
var getParamBytesForAlg = require('./param-bytes-for-alg');
|
||||||
|
|
||||||
|
var MAX_OCTET = 0x80,
|
||||||
|
CLASS_UNIVERSAL = 0,
|
||||||
|
PRIMITIVE_BIT = 0x20,
|
||||||
|
TAG_SEQ = 0x10,
|
||||||
|
TAG_INT = 0x02,
|
||||||
|
ENCODED_TAG_SEQ = (TAG_SEQ | PRIMITIVE_BIT) | (CLASS_UNIVERSAL << 6),
|
||||||
|
ENCODED_TAG_INT = TAG_INT | (CLASS_UNIVERSAL << 6);
|
||||||
|
|
||||||
|
function base64Url(base64) {
|
||||||
|
return base64
|
||||||
|
.replace(/=/g, '')
|
||||||
|
.replace(/\+/g, '-')
|
||||||
|
.replace(/\//g, '_');
|
||||||
|
}
|
||||||
|
|
||||||
|
function signatureAsBuffer(signature) {
|
||||||
|
if (Buffer.isBuffer(signature)) {
|
||||||
|
return signature;
|
||||||
|
} else if ('string' === typeof signature) {
|
||||||
|
return Buffer.from(signature, 'base64');
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new TypeError('ECDSA signature must be a Base64 string or a Buffer');
|
||||||
|
}
|
||||||
|
|
||||||
|
function derToJose(signature, alg) {
|
||||||
|
signature = signatureAsBuffer(signature);
|
||||||
|
var paramBytes = getParamBytesForAlg(alg);
|
||||||
|
|
||||||
|
// the DER encoded param should at most be the param size, plus a padding
|
||||||
|
// zero, since due to being a signed integer
|
||||||
|
var maxEncodedParamLength = paramBytes + 1;
|
||||||
|
|
||||||
|
var inputLength = signature.length;
|
||||||
|
|
||||||
|
var offset = 0;
|
||||||
|
if (signature[offset++] !== ENCODED_TAG_SEQ) {
|
||||||
|
throw new Error('Could not find expected "seq"');
|
||||||
|
}
|
||||||
|
|
||||||
|
var seqLength = signature[offset++];
|
||||||
|
if (seqLength === (MAX_OCTET | 1)) {
|
||||||
|
seqLength = signature[offset++];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inputLength - offset < seqLength) {
|
||||||
|
throw new Error('"seq" specified length of "' + seqLength + '", only "' + (inputLength - offset) + '" remaining');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (signature[offset++] !== ENCODED_TAG_INT) {
|
||||||
|
throw new Error('Could not find expected "int" for "r"');
|
||||||
|
}
|
||||||
|
|
||||||
|
var rLength = signature[offset++];
|
||||||
|
|
||||||
|
if (inputLength - offset - 2 < rLength) {
|
||||||
|
throw new Error('"r" specified length of "' + rLength + '", only "' + (inputLength - offset - 2) + '" available');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxEncodedParamLength < rLength) {
|
||||||
|
throw new Error('"r" specified length of "' + rLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
|
||||||
|
}
|
||||||
|
|
||||||
|
var rOffset = offset;
|
||||||
|
offset += rLength;
|
||||||
|
|
||||||
|
if (signature[offset++] !== ENCODED_TAG_INT) {
|
||||||
|
throw new Error('Could not find expected "int" for "s"');
|
||||||
|
}
|
||||||
|
|
||||||
|
var sLength = signature[offset++];
|
||||||
|
|
||||||
|
if (inputLength - offset !== sLength) {
|
||||||
|
throw new Error('"s" specified length of "' + sLength + '", expected "' + (inputLength - offset) + '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxEncodedParamLength < sLength) {
|
||||||
|
throw new Error('"s" specified length of "' + sLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
|
||||||
|
}
|
||||||
|
|
||||||
|
var sOffset = offset;
|
||||||
|
offset += sLength;
|
||||||
|
|
||||||
|
if (offset !== inputLength) {
|
||||||
|
throw new Error('Expected to consume entire buffer, but "' + (inputLength - offset) + '" bytes remain');
|
||||||
|
}
|
||||||
|
|
||||||
|
var rPadding = paramBytes - rLength,
|
||||||
|
sPadding = paramBytes - sLength;
|
||||||
|
|
||||||
|
var dst = Buffer.allocUnsafe(rPadding + rLength + sPadding + sLength);
|
||||||
|
|
||||||
|
for (offset = 0; offset < rPadding; ++offset) {
|
||||||
|
dst[offset] = 0;
|
||||||
|
}
|
||||||
|
signature.copy(dst, offset, rOffset + Math.max(-rPadding, 0), rOffset + rLength);
|
||||||
|
|
||||||
|
offset = paramBytes;
|
||||||
|
|
||||||
|
for (var o = offset; offset < o + sPadding; ++offset) {
|
||||||
|
dst[offset] = 0;
|
||||||
|
}
|
||||||
|
signature.copy(dst, offset, sOffset + Math.max(-sPadding, 0), sOffset + sLength);
|
||||||
|
|
||||||
|
dst = dst.toString('base64');
|
||||||
|
dst = base64Url(dst);
|
||||||
|
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
|
function countPadding(buf, start, stop) {
|
||||||
|
var padding = 0;
|
||||||
|
while (start + padding < stop && buf[start + padding] === 0) {
|
||||||
|
++padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
var needsSign = buf[start + padding] >= MAX_OCTET;
|
||||||
|
if (needsSign) {
|
||||||
|
--padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
return padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
function joseToDer(signature, alg) {
|
||||||
|
signature = signatureAsBuffer(signature);
|
||||||
|
var paramBytes = getParamBytesForAlg(alg);
|
||||||
|
|
||||||
|
var signatureBytes = signature.length;
|
||||||
|
if (signatureBytes !== paramBytes * 2) {
|
||||||
|
throw new TypeError('"' + alg + '" signatures must be "' + paramBytes * 2 + '" bytes, saw "' + signatureBytes + '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
var rPadding = countPadding(signature, 0, paramBytes);
|
||||||
|
var sPadding = countPadding(signature, paramBytes, signature.length);
|
||||||
|
var rLength = paramBytes - rPadding;
|
||||||
|
var sLength = paramBytes - sPadding;
|
||||||
|
|
||||||
|
var rsBytes = 1 + 1 + rLength + 1 + 1 + sLength;
|
||||||
|
|
||||||
|
var shortLength = rsBytes < MAX_OCTET;
|
||||||
|
|
||||||
|
var dst = Buffer.allocUnsafe((shortLength ? 2 : 3) + rsBytes);
|
||||||
|
|
||||||
|
var offset = 0;
|
||||||
|
dst[offset++] = ENCODED_TAG_SEQ;
|
||||||
|
if (shortLength) {
|
||||||
|
// Bit 8 has value "0"
|
||||||
|
// bits 7-1 give the length.
|
||||||
|
dst[offset++] = rsBytes;
|
||||||
|
} else {
|
||||||
|
// Bit 8 of first octet has value "1"
|
||||||
|
// bits 7-1 give the number of additional length octets.
|
||||||
|
dst[offset++] = MAX_OCTET | 1;
|
||||||
|
// length, base 256
|
||||||
|
dst[offset++] = rsBytes & 0xff;
|
||||||
|
}
|
||||||
|
dst[offset++] = ENCODED_TAG_INT;
|
||||||
|
dst[offset++] = rLength;
|
||||||
|
if (rPadding < 0) {
|
||||||
|
dst[offset++] = 0;
|
||||||
|
offset += signature.copy(dst, offset, 0, paramBytes);
|
||||||
|
} else {
|
||||||
|
offset += signature.copy(dst, offset, rPadding, paramBytes);
|
||||||
|
}
|
||||||
|
dst[offset++] = ENCODED_TAG_INT;
|
||||||
|
dst[offset++] = sLength;
|
||||||
|
if (sPadding < 0) {
|
||||||
|
dst[offset++] = 0;
|
||||||
|
signature.copy(dst, offset, paramBytes);
|
||||||
|
} else {
|
||||||
|
signature.copy(dst, offset, paramBytes + sPadding);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
derToJose: derToJose,
|
||||||
|
joseToDer: joseToDer
|
||||||
|
};
|
23
node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js
generated
vendored
Normal file
23
node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
function getParamSize(keySize) {
|
||||||
|
var result = ((keySize / 8) | 0) + (keySize % 8 === 0 ? 0 : 1);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
var paramBytesForAlg = {
|
||||||
|
ES256: getParamSize(256),
|
||||||
|
ES384: getParamSize(384),
|
||||||
|
ES512: getParamSize(521)
|
||||||
|
};
|
||||||
|
|
||||||
|
function getParamBytesForAlg(alg) {
|
||||||
|
var paramBytes = paramBytesForAlg[alg];
|
||||||
|
if (paramBytes) {
|
||||||
|
return paramBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error('Unknown algorithm "' + alg + '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = getParamBytesForAlg;
|
13
node_modules/es-define-property/.eslintrc
generated
vendored
Normal file
13
node_modules/es-define-property/.eslintrc
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
|
||||||
|
"extends": "@ljharb",
|
||||||
|
|
||||||
|
"rules": {
|
||||||
|
"new-cap": ["error", {
|
||||||
|
"capIsNewExceptions": [
|
||||||
|
"GetIntrinsic",
|
||||||
|
],
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
}
|
12
node_modules/es-define-property/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/es-define-property/.github/FUNDING.yml
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: [ljharb]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: npm/es-define-property
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with a single custom sponsorship URL
|
9
node_modules/es-define-property/.nycrc
generated
vendored
Normal file
9
node_modules/es-define-property/.nycrc
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"all": true,
|
||||||
|
"check-coverage": false,
|
||||||
|
"reporter": ["text-summary", "text", "html", "json"],
|
||||||
|
"exclude": [
|
||||||
|
"coverage",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
}
|
29
node_modules/es-define-property/CHANGELOG.md
generated
vendored
Normal file
29
node_modules/es-define-property/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.0.1](https://github.com/ljharb/es-define-property/compare/v1.0.0...v1.0.1) - 2024-12-06
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [types] use shared tsconfig [`954a663`](https://github.com/ljharb/es-define-property/commit/954a66360326e508a0e5daa4b07493d58f5e110e)
|
||||||
|
- [actions] split out node 10-20, and 20+ [`3a8e84b`](https://github.com/ljharb/es-define-property/commit/3a8e84b23883f26ff37b3e82ff283834228e18c6)
|
||||||
|
- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/get-intrinsic`, `@types/tape`, `auto-changelog`, `gopd`, `tape` [`86ae27b`](https://github.com/ljharb/es-define-property/commit/86ae27bb8cc857b23885136fad9cbe965ae36612)
|
||||||
|
- [Refactor] avoid using `get-intrinsic` [`02480c0`](https://github.com/ljharb/es-define-property/commit/02480c0353ef6118965282977c3864aff53d98b1)
|
||||||
|
- [Tests] replace `aud` with `npm audit` [`f6093ff`](https://github.com/ljharb/es-define-property/commit/f6093ff74ab51c98015c2592cd393bd42478e773)
|
||||||
|
- [Tests] configure testling [`7139e66`](https://github.com/ljharb/es-define-property/commit/7139e66959247a56086d9977359caef27c6849e7)
|
||||||
|
- [Dev Deps] update `tape` [`b901b51`](https://github.com/ljharb/es-define-property/commit/b901b511a75e001a40ce1a59fef7d9ffcfc87482)
|
||||||
|
- [Tests] fix types in tests [`469d269`](https://github.com/ljharb/es-define-property/commit/469d269fd141b1e773ec053a9fa35843493583e0)
|
||||||
|
- [Dev Deps] add missing peer dep [`733acfb`](https://github.com/ljharb/es-define-property/commit/733acfb0c4c96edf337e470b89a25a5b3724c352)
|
||||||
|
|
||||||
|
## v1.0.0 - 2024-02-12
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- Initial implementation, tests, readme, types [`3e154e1`](https://github.com/ljharb/es-define-property/commit/3e154e11a2fee09127220f5e503bf2c0a31dd480)
|
||||||
|
- Initial commit [`07d98de`](https://github.com/ljharb/es-define-property/commit/07d98de34a4dc31ff5e83a37c0c3f49e0d85cd50)
|
||||||
|
- npm init [`c4eb634`](https://github.com/ljharb/es-define-property/commit/c4eb6348b0d3886aac36cef34ad2ee0665ea6f3e)
|
||||||
|
- Only apps should have lockfiles [`7af86ec`](https://github.com/ljharb/es-define-property/commit/7af86ec1d311ec0b17fdfe616a25f64276903856)
|
21
node_modules/es-define-property/LICENSE
generated
vendored
Normal file
21
node_modules/es-define-property/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Jordan Harband
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
49
node_modules/es-define-property/README.md
generated
vendored
Normal file
49
node_modules/es-define-property/README.md
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# es-define-property <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||||
|
|
||||||
|
[![github actions][actions-image]][actions-url]
|
||||||
|
[![coverage][codecov-image]][codecov-url]
|
||||||
|
[![License][license-image]][license-url]
|
||||||
|
[![Downloads][downloads-image]][downloads-url]
|
||||||
|
|
||||||
|
[![npm badge][npm-badge-png]][package-url]
|
||||||
|
|
||||||
|
`Object.defineProperty`, but not IE 8's broken one.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
|
const $defineProperty = require('es-define-property');
|
||||||
|
|
||||||
|
if ($defineProperty) {
|
||||||
|
assert.equal($defineProperty, Object.defineProperty);
|
||||||
|
} else if (Object.defineProperty) {
|
||||||
|
assert.equal($defineProperty, false, 'this is IE 8');
|
||||||
|
} else {
|
||||||
|
assert.equal($defineProperty, false, 'this is an ES3 engine');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
Simply clone the repo, `npm install`, and run `npm test`
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
|
||||||
|
|
||||||
|
[package-url]: https://npmjs.org/package/es-define-property
|
||||||
|
[npm-version-svg]: https://versionbadg.es/ljharb/es-define-property.svg
|
||||||
|
[deps-svg]: https://david-dm.org/ljharb/es-define-property.svg
|
||||||
|
[deps-url]: https://david-dm.org/ljharb/es-define-property
|
||||||
|
[dev-deps-svg]: https://david-dm.org/ljharb/es-define-property/dev-status.svg
|
||||||
|
[dev-deps-url]: https://david-dm.org/ljharb/es-define-property#info=devDependencies
|
||||||
|
[npm-badge-png]: https://nodei.co/npm/es-define-property.png?downloads=true&stars=true
|
||||||
|
[license-image]: https://img.shields.io/npm/l/es-define-property.svg
|
||||||
|
[license-url]: LICENSE
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/es-define-property.svg
|
||||||
|
[downloads-url]: https://npm-stat.com/charts.html?package=es-define-property
|
||||||
|
[codecov-image]: https://codecov.io/gh/ljharb/es-define-property/branch/main/graphs/badge.svg
|
||||||
|
[codecov-url]: https://app.codecov.io/gh/ljharb/es-define-property/
|
||||||
|
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-define-property
|
||||||
|
[actions-url]: https://github.com/ljharb/es-define-property/actions
|
3
node_modules/es-define-property/index.d.ts
generated
vendored
Normal file
3
node_modules/es-define-property/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
declare const defineProperty: false | typeof Object.defineProperty;
|
||||||
|
|
||||||
|
export = defineProperty;
|
14
node_modules/es-define-property/index.js
generated
vendored
Normal file
14
node_modules/es-define-property/index.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** @type {import('.')} */
|
||||||
|
var $defineProperty = Object.defineProperty || false;
|
||||||
|
if ($defineProperty) {
|
||||||
|
try {
|
||||||
|
$defineProperty({}, 'a', { value: 1 });
|
||||||
|
} catch (e) {
|
||||||
|
// IE 8 has a broken defineProperty
|
||||||
|
$defineProperty = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = $defineProperty;
|
56
node_modules/es-define-property/test/index.js
generated
vendored
Normal file
56
node_modules/es-define-property/test/index.js
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var $defineProperty = require('../');
|
||||||
|
|
||||||
|
var test = require('tape');
|
||||||
|
var gOPD = require('gopd');
|
||||||
|
|
||||||
|
test('defineProperty: supported', { skip: !$defineProperty }, function (t) {
|
||||||
|
t.plan(4);
|
||||||
|
|
||||||
|
t.equal(typeof $defineProperty, 'function', 'defineProperty is supported');
|
||||||
|
if ($defineProperty && gOPD) { // this `if` check is just to shut TS up
|
||||||
|
/** @type {{ a: number, b?: number, c?: number }} */
|
||||||
|
var o = { a: 1 };
|
||||||
|
|
||||||
|
$defineProperty(o, 'b', { enumerable: true, value: 2 });
|
||||||
|
t.deepEqual(
|
||||||
|
gOPD(o, 'b'),
|
||||||
|
{
|
||||||
|
configurable: false,
|
||||||
|
enumerable: true,
|
||||||
|
value: 2,
|
||||||
|
writable: false
|
||||||
|
},
|
||||||
|
'property descriptor is as expected'
|
||||||
|
);
|
||||||
|
|
||||||
|
$defineProperty(o, 'c', { enumerable: false, value: 3, writable: true });
|
||||||
|
t.deepEqual(
|
||||||
|
gOPD(o, 'c'),
|
||||||
|
{
|
||||||
|
configurable: false,
|
||||||
|
enumerable: false,
|
||||||
|
value: 3,
|
||||||
|
writable: true
|
||||||
|
},
|
||||||
|
'property descriptor is as expected'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
t.equal($defineProperty, Object.defineProperty, 'defineProperty is Object.defineProperty');
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('defineProperty: not supported', { skip: !!$defineProperty }, function (t) {
|
||||||
|
t.notOk($defineProperty, 'defineProperty is not supported');
|
||||||
|
|
||||||
|
t.match(
|
||||||
|
typeof $defineProperty,
|
||||||
|
/^(?:undefined|boolean)$/,
|
||||||
|
'`typeof defineProperty` is `undefined` or `boolean`'
|
||||||
|
);
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue