remove ignored files
This commit is contained in:
parent
e30a0c0e80
commit
76a160ccbc
1
node_modules/.bin/acorn
generated
vendored
1
node_modules/.bin/acorn
generated
vendored
@ -1 +0,0 @@
|
||||
../acorn/bin/acorn
|
1
node_modules/.bin/is-docker
generated
vendored
1
node_modules/.bin/is-docker
generated
vendored
@ -1 +0,0 @@
|
||||
../is-docker/cli.js
|
1
node_modules/.bin/is-inside-container
generated
vendored
1
node_modules/.bin/is-inside-container
generated
vendored
@ -1 +0,0 @@
|
||||
../is-inside-container/cli.js
|
1
node_modules/.bin/mkdirp
generated
vendored
1
node_modules/.bin/mkdirp
generated
vendored
@ -1 +0,0 @@
|
||||
../mkdirp/bin/cmd.js
|
1
node_modules/.bin/node-which
generated
vendored
1
node_modules/.bin/node-which
generated
vendored
@ -1 +0,0 @@
|
||||
../which/bin/node-which
|
1
node_modules/.bin/resolve
generated
vendored
1
node_modules/.bin/resolve
generated
vendored
@ -1 +0,0 @@
|
||||
../resolve/bin/resolve
|
1
node_modules/.bin/rimraf
generated
vendored
1
node_modules/.bin/rimraf
generated
vendored
@ -1 +0,0 @@
|
||||
../rimraf/bin.js
|
1
node_modules/.bin/tree-kill
generated
vendored
1
node_modules/.bin/tree-kill
generated
vendored
@ -1 +0,0 @@
|
||||
../tree-kill/cli.js
|
1
node_modules/.bin/ts-node
generated
vendored
1
node_modules/.bin/ts-node
generated
vendored
@ -1 +0,0 @@
|
||||
../ts-node/dist/bin.js
|
1
node_modules/.bin/ts-node-cwd
generated
vendored
1
node_modules/.bin/ts-node-cwd
generated
vendored
@ -1 +0,0 @@
|
||||
../ts-node/dist/bin-cwd.js
|
1
node_modules/.bin/ts-node-dev
generated
vendored
1
node_modules/.bin/ts-node-dev
generated
vendored
@ -1 +0,0 @@
|
||||
../ts-node-dev/lib/bin.js
|
1
node_modules/.bin/ts-node-esm
generated
vendored
1
node_modules/.bin/ts-node-esm
generated
vendored
@ -1 +0,0 @@
|
||||
../ts-node/dist/bin-esm.js
|
1
node_modules/.bin/ts-node-script
generated
vendored
1
node_modules/.bin/ts-node-script
generated
vendored
@ -1 +0,0 @@
|
||||
../ts-node/dist/bin-script.js
|
1
node_modules/.bin/ts-node-transpile-only
generated
vendored
1
node_modules/.bin/ts-node-transpile-only
generated
vendored
@ -1 +0,0 @@
|
||||
../ts-node/dist/bin-transpile.js
|
1
node_modules/.bin/ts-script
generated
vendored
1
node_modules/.bin/ts-script
generated
vendored
@ -1 +0,0 @@
|
||||
../ts-node/dist/bin-script-deprecated.js
|
1
node_modules/.bin/tsc
generated
vendored
1
node_modules/.bin/tsc
generated
vendored
@ -1 +0,0 @@
|
||||
../typescript/bin/tsc
|
1
node_modules/.bin/tsnd
generated
vendored
1
node_modules/.bin/tsnd
generated
vendored
@ -1 +0,0 @@
|
||||
../ts-node-dev/lib/bin.js
|
1
node_modules/.bin/tsserver
generated
vendored
1
node_modules/.bin/tsserver
generated
vendored
@ -1 +0,0 @@
|
||||
../typescript/bin/tsserver
|
1260
node_modules/.package-lock.json
generated
vendored
1260
node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
21
node_modules/@cspotcode/source-map-support/LICENSE.md
generated
vendored
21
node_modules/@cspotcode/source-map-support/LICENSE.md
generated
vendored
@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Evan Wallace
|
||||
|
||||
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.
|
289
node_modules/@cspotcode/source-map-support/README.md
generated
vendored
289
node_modules/@cspotcode/source-map-support/README.md
generated
vendored
@ -1,289 +0,0 @@
|
||||
# Source Map Support
|
||||
|
||||
[![NPM version](https://img.shields.io/npm/v/@cspotcode/source-map-support.svg?style=flat)](https://npmjs.org/package/@cspotcode/source-map-support)
|
||||
[![NPM downloads](https://img.shields.io/npm/dm/@cspotcode/source-map-support.svg?style=flat)](https://npmjs.org/package/@cspotcode/source-map-support)
|
||||
[![Build status](https://img.shields.io/github/workflow/status/cspotcode/node-source-map-support/Continuous%20Integration)](https://github.com/cspotcode/node-source-map-support/actions?query=workflow%3A%22Continuous+Integration%22)
|
||||
|
||||
This module provides source map support for stack traces in node via the [V8 stack trace API](https://github.com/v8/v8/wiki/Stack-Trace-API). It uses the [source-map](https://github.com/mozilla/source-map) module to replace the paths and line numbers of source-mapped files with their original paths and line numbers. The output mimics node's stack trace format with the goal of making every compile-to-JS language more of a first-class citizen. Source maps are completely general (not specific to any one language) so you can use source maps with multiple compile-to-JS languages in the same node process.
|
||||
|
||||
## Installation and Usage
|
||||
|
||||
#### Node support
|
||||
|
||||
```
|
||||
$ npm install @cspotcode/source-map-support
|
||||
```
|
||||
|
||||
Source maps can be generated using libraries such as [source-map-index-generator](https://github.com/twolfson/source-map-index-generator). Once you have a valid source map, place a source mapping comment somewhere in the file (usually done automatically or with an option by your transpiler):
|
||||
|
||||
```
|
||||
//# sourceMappingURL=path/to/source.map
|
||||
```
|
||||
|
||||
If multiple sourceMappingURL comments exist in one file, the last sourceMappingURL comment will be
|
||||
respected (e.g. if a file mentions the comment in code, or went through multiple transpilers).
|
||||
The path should either be absolute or relative to the compiled file.
|
||||
|
||||
From here you have two options.
|
||||
|
||||
##### CLI Usage
|
||||
|
||||
```bash
|
||||
node -r @cspotcode/source-map-support/register compiled.js
|
||||
# Or to enable hookRequire
|
||||
node -r @cspotcode/source-map-support/register-hook-require compiled.js
|
||||
```
|
||||
|
||||
##### Programmatic Usage
|
||||
|
||||
Put the following line at the top of the compiled file.
|
||||
|
||||
```js
|
||||
require('@cspotcode/source-map-support').install();
|
||||
```
|
||||
|
||||
It is also possible to install the source map support directly by
|
||||
requiring the `register` module which can be handy with ES6:
|
||||
|
||||
```js
|
||||
import '@cspotcode/source-map-support/register'
|
||||
|
||||
// Instead of:
|
||||
import sourceMapSupport from '@cspotcode/source-map-support'
|
||||
sourceMapSupport.install()
|
||||
```
|
||||
Note: if you're using babel-register, it includes source-map-support already.
|
||||
|
||||
It is also very useful with Mocha:
|
||||
|
||||
```
|
||||
$ mocha --require @cspotcode/source-map-support/register tests/
|
||||
```
|
||||
|
||||
#### Browser support
|
||||
|
||||
This library also works in Chrome. While the DevTools console already supports source maps, the V8 engine doesn't and `Error.prototype.stack` will be incorrect without this library. Everything will just work if you deploy your source files using [browserify](http://browserify.org/). Just make sure to pass the `--debug` flag to the browserify command so your source maps are included in the bundled code.
|
||||
|
||||
This library also works if you use another build process or just include the source files directly. In this case, include the file `browser-source-map-support.js` in your page and call `sourceMapSupport.install()`. It contains the whole library already bundled for the browser using browserify.
|
||||
|
||||
```html
|
||||
<script src="browser-source-map-support.js"></script>
|
||||
<script>sourceMapSupport.install();</script>
|
||||
```
|
||||
|
||||
This library also works if you use AMD (Asynchronous Module Definition), which is used in tools like [RequireJS](http://requirejs.org/). Just list `browser-source-map-support` as a dependency:
|
||||
|
||||
```html
|
||||
<script>
|
||||
define(['browser-source-map-support'], function(sourceMapSupport) {
|
||||
sourceMapSupport.install();
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
This module installs two things: a change to the `stack` property on `Error` objects and a handler for uncaught exceptions that mimics node's default exception handler (the handler can be seen in the demos below). You may want to disable the handler if you have your own uncaught exception handler. This can be done by passing an argument to the installer:
|
||||
|
||||
```js
|
||||
require('@cspotcode/source-map-support').install({
|
||||
handleUncaughtExceptions: false
|
||||
});
|
||||
```
|
||||
|
||||
This module loads source maps from the filesystem by default. You can provide alternate loading behavior through a callback as shown below. For example, [Meteor](https://github.com/meteor) keeps all source maps cached in memory to avoid disk access.
|
||||
|
||||
```js
|
||||
require('@cspotcode/source-map-support').install({
|
||||
retrieveSourceMap: function(source) {
|
||||
if (source === 'compiled.js') {
|
||||
return {
|
||||
url: 'original.js',
|
||||
map: fs.readFileSync('compiled.js.map', 'utf8')
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
The module will by default assume a browser environment if XMLHttpRequest and window are defined. If either of these do not exist it will instead assume a node environment.
|
||||
In some rare cases, e.g. when running a browser emulation and where both variables are also set, you can explictly specify the environment to be either 'browser' or 'node'.
|
||||
|
||||
```js
|
||||
require('@cspotcode/source-map-support').install({
|
||||
environment: 'node'
|
||||
});
|
||||
```
|
||||
|
||||
To support files with inline source maps, the `hookRequire` options can be specified, which will monitor all source files for inline source maps.
|
||||
|
||||
|
||||
```js
|
||||
require('@cspotcode/source-map-support').install({
|
||||
hookRequire: true
|
||||
});
|
||||
```
|
||||
|
||||
This monkey patches the `require` module loading chain, so is not enabled by default and is not recommended for any sort of production usage.
|
||||
|
||||
## Demos
|
||||
|
||||
#### Basic Demo
|
||||
|
||||
original.js:
|
||||
|
||||
```js
|
||||
throw new Error('test'); // This is the original code
|
||||
```
|
||||
|
||||
compiled.js:
|
||||
|
||||
```js
|
||||
require('@cspotcode/source-map-support').install();
|
||||
|
||||
throw new Error('test'); // This is the compiled code
|
||||
// The next line defines the sourceMapping.
|
||||
//# sourceMappingURL=compiled.js.map
|
||||
```
|
||||
|
||||
compiled.js.map:
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 3,
|
||||
"file": "compiled.js",
|
||||
"sources": ["original.js"],
|
||||
"names": [],
|
||||
"mappings": ";;AAAA,MAAM,IAAI"
|
||||
}
|
||||
```
|
||||
|
||||
Run compiled.js using node (notice how the stack trace uses original.js instead of compiled.js):
|
||||
|
||||
```
|
||||
$ node compiled.js
|
||||
|
||||
original.js:1
|
||||
throw new Error('test'); // This is the original code
|
||||
^
|
||||
Error: test
|
||||
at Object.<anonymous> (original.js:1:7)
|
||||
at Module._compile (module.js:456:26)
|
||||
at Object.Module._extensions..js (module.js:474:10)
|
||||
at Module.load (module.js:356:32)
|
||||
at Function.Module._load (module.js:312:12)
|
||||
at Function.Module.runMain (module.js:497:10)
|
||||
at startup (node.js:119:16)
|
||||
at node.js:901:3
|
||||
```
|
||||
|
||||
#### TypeScript Demo
|
||||
|
||||
demo.ts:
|
||||
|
||||
```typescript
|
||||
declare function require(name: string);
|
||||
require('@cspotcode/source-map-support').install();
|
||||
class Foo {
|
||||
constructor() { this.bar(); }
|
||||
bar() { throw new Error('this is a demo'); }
|
||||
}
|
||||
new Foo();
|
||||
```
|
||||
|
||||
Compile and run the file using the TypeScript compiler from the terminal:
|
||||
|
||||
```
|
||||
$ npm install source-map-support typescript
|
||||
$ node_modules/typescript/bin/tsc -sourcemap demo.ts
|
||||
$ node demo.js
|
||||
|
||||
demo.ts:5
|
||||
bar() { throw new Error('this is a demo'); }
|
||||
^
|
||||
Error: this is a demo
|
||||
at Foo.bar (demo.ts:5:17)
|
||||
at new Foo (demo.ts:4:24)
|
||||
at Object.<anonymous> (demo.ts:7:1)
|
||||
at Module._compile (module.js:456:26)
|
||||
at Object.Module._extensions..js (module.js:474:10)
|
||||
at Module.load (module.js:356:32)
|
||||
at Function.Module._load (module.js:312:12)
|
||||
at Function.Module.runMain (module.js:497:10)
|
||||
at startup (node.js:119:16)
|
||||
at node.js:901:3
|
||||
```
|
||||
|
||||
There is also the option to use `-r source-map-support/register` with typescript, without the need add the `require('@cspotcode/source-map-support').install()` in the code base:
|
||||
|
||||
```
|
||||
$ npm install source-map-support typescript
|
||||
$ node_modules/typescript/bin/tsc -sourcemap demo.ts
|
||||
$ node -r source-map-support/register demo.js
|
||||
|
||||
demo.ts:5
|
||||
bar() { throw new Error('this is a demo'); }
|
||||
^
|
||||
Error: this is a demo
|
||||
at Foo.bar (demo.ts:5:17)
|
||||
at new Foo (demo.ts:4:24)
|
||||
at Object.<anonymous> (demo.ts:7:1)
|
||||
at Module._compile (module.js:456:26)
|
||||
at Object.Module._extensions..js (module.js:474:10)
|
||||
at Module.load (module.js:356:32)
|
||||
at Function.Module._load (module.js:312:12)
|
||||
at Function.Module.runMain (module.js:497:10)
|
||||
at startup (node.js:119:16)
|
||||
at node.js:901:3
|
||||
```
|
||||
|
||||
#### CoffeeScript Demo
|
||||
|
||||
demo.coffee:
|
||||
|
||||
```coffee
|
||||
require('@cspotcode/source-map-support').install()
|
||||
foo = ->
|
||||
bar = -> throw new Error 'this is a demo'
|
||||
bar()
|
||||
foo()
|
||||
```
|
||||
|
||||
Compile and run the file using the CoffeeScript compiler from the terminal:
|
||||
|
||||
```sh
|
||||
$ npm install @cspotcode/source-map-support coffeescript
|
||||
$ node_modules/.bin/coffee --map --compile demo.coffee
|
||||
$ node demo.js
|
||||
|
||||
demo.coffee:3
|
||||
bar = -> throw new Error 'this is a demo'
|
||||
^
|
||||
Error: this is a demo
|
||||
at bar (demo.coffee:3:22)
|
||||
at foo (demo.coffee:4:3)
|
||||
at Object.<anonymous> (demo.coffee:5:1)
|
||||
at Object.<anonymous> (demo.coffee:1:1)
|
||||
at Module._compile (module.js:456:26)
|
||||
at Object.Module._extensions..js (module.js:474:10)
|
||||
at Module.load (module.js:356:32)
|
||||
at Function.Module._load (module.js:312:12)
|
||||
at Function.Module.runMain (module.js:497:10)
|
||||
at startup (node.js:119:16)
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
This repo contains both automated tests for node and manual tests for the browser. The automated tests can be run using mocha (type `mocha` in the root directory). To run the manual tests:
|
||||
|
||||
* Build the tests using `build.js`
|
||||
* Launch the HTTP server (`npm run serve-tests`) and visit
|
||||
* http://127.0.0.1:1336/amd-test
|
||||
* http://127.0.0.1:1336/browser-test
|
||||
* http://127.0.0.1:1336/browserify-test - **Currently not working** due to a bug with browserify (see [pull request #66](https://github.com/evanw/node-source-map-support/pull/66) for details).
|
||||
* For `header-test`, run `server.js` inside that directory and visit http://127.0.0.1:1337/
|
||||
|
||||
## License
|
||||
|
||||
This code is available under the [MIT license](http://opensource.org/licenses/MIT).
|
114
node_modules/@cspotcode/source-map-support/browser-source-map-support.js
generated
vendored
114
node_modules/@cspotcode/source-map-support/browser-source-map-support.js
generated
vendored
@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Support for source maps in V8 stack traces
|
||||
* https://github.com/evanw/node-source-map-support
|
||||
*/
|
||||
/*
|
||||
The buffer module from node.js, for the browser.
|
||||
|
||||
@author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
||||
license MIT
|
||||
*/
|
||||
(this.define||function(R,U){this.sourceMapSupport=U()})("browser-source-map-support",function(R){(function e(C,J,A){function p(f,c){if(!J[f]){if(!C[f]){var l="function"==typeof require&&require;if(!c&&l)return l(f,!0);if(t)return t(f,!0);throw Error("Cannot find module '"+f+"'");}l=J[f]={exports:{}};C[f][0].call(l.exports,function(q){var r=C[f][1][q];return p(r?r:q)},l,l.exports,e,C,J,A)}return J[f].exports}for(var t="function"==typeof require&&require,m=0;m<A.length;m++)p(A[m]);return p})({1:[function(C,
|
||||
J,A){R=C("./source-map-support")},{"./source-map-support":21}],2:[function(C,J,A){(function(e){function p(m){m=m.charCodeAt(0);if(43===m)return 62;if(47===m)return 63;if(48>m)return-1;if(58>m)return m-48+52;if(91>m)return m-65;if(123>m)return m-97+26}var t="undefined"!==typeof Uint8Array?Uint8Array:Array;e.toByteArray=function(m){function f(d){q[k++]=d}if(0<m.length%4)throw Error("Invalid string. Length must be a multiple of 4");var c=m.length;var l="="===m.charAt(c-2)?2:"="===m.charAt(c-1)?1:0;var q=
|
||||
new t(3*m.length/4-l);var r=0<l?m.length-4:m.length;var k=0;for(c=0;c<r;c+=4){var u=p(m.charAt(c))<<18|p(m.charAt(c+1))<<12|p(m.charAt(c+2))<<6|p(m.charAt(c+3));f((u&16711680)>>16);f((u&65280)>>8);f(u&255)}2===l?(u=p(m.charAt(c))<<2|p(m.charAt(c+1))>>4,f(u&255)):1===l&&(u=p(m.charAt(c))<<10|p(m.charAt(c+1))<<4|p(m.charAt(c+2))>>2,f(u>>8&255),f(u&255));return q};e.fromByteArray=function(m){var f=m.length%3,c="",l;var q=0;for(l=m.length-f;q<l;q+=3){var r=(m[q]<<16)+(m[q+1]<<8)+m[q+2];r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>
|
||||
18&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>12&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>6&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r&63);c+=r}switch(f){case 1:r=m[m.length-1];c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r<<4&63);c+="==";break;case 2:r=(m[m.length-2]<<8)+
|
||||
m[m.length-1],c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>10),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>4&63),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r<<2&63),c+="="}return c}})("undefined"===typeof A?this.base64js={}:A)},{}],3:[function(C,J,A){},{}],4:[function(C,J,A){(function(e){var p=Object.prototype.toString,t="function"===typeof e.alloc&&"function"===typeof e.allocUnsafe&&"function"===
|
||||
typeof e.from;J.exports=function(m,f,c){if("number"===typeof m)throw new TypeError('"value" argument must not be a number');if("ArrayBuffer"===p.call(m).slice(8,-1)){f>>>=0;var l=m.byteLength-f;if(0>l)throw new RangeError("'offset' is out of bounds");if(void 0===c)c=l;else if(c>>>=0,c>l)throw new RangeError("'length' is out of bounds");return t?e.from(m.slice(f,f+c)):new e(new Uint8Array(m.slice(f,f+c)))}if("string"===typeof m){c=f;if("string"!==typeof c||""===c)c="utf8";if(!e.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding');
|
||||
return t?e.from(m,c):new e(m,c)}return t?e.from(m):new e(m)}}).call(this,C("buffer").Buffer)},{buffer:5}],5:[function(C,J,A){function e(a,b,h){if(!(this instanceof e))return new e(a,b,h);var w=typeof a;if("number"===w)var y=0<a?a>>>0:0;else if("string"===w){if("base64"===b)for(a=(a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")).replace(L,"");0!==a.length%4;)a+="=";y=e.byteLength(a,b)}else if("object"===w&&null!==a)"Buffer"===a.type&&z(a.data)&&(a=a.data),y=0<+a.length?Math.floor(+a.length):0;else throw new TypeError("must start with number, buffer, array or string");
|
||||
if(this.length>G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");if(e.TYPED_ARRAY_SUPPORT)var I=e._augment(new Uint8Array(y));else I=this,I.length=y,I._isBuffer=!0;if(e.TYPED_ARRAY_SUPPORT&&"number"===typeof a.byteLength)I._set(a);else{var K=a;if(z(K)||e.isBuffer(K)||K&&"object"===typeof K&&"number"===typeof K.length)if(e.isBuffer(a))for(b=0;b<y;b++)I[b]=a.readUInt8(b);else for(b=0;b<y;b++)I[b]=(a[b]%256+256)%256;else if("string"===w)I.write(a,
|
||||
0,b);else if("number"===w&&!e.TYPED_ARRAY_SUPPORT&&!h)for(b=0;b<y;b++)I[b]=0}return I}function p(a,b,h){var w="";for(h=Math.min(a.length,h);b<h;b++)w+=String.fromCharCode(a[b]);return w}function t(a,b,h){if(0!==a%1||0>a)throw new RangeError("offset is not uint");if(a+b>h)throw new RangeError("Trying to access beyond buffer length");}function m(a,b,h,w,y,I){if(!e.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>y||b<I)throw new TypeError("value is out of bounds");if(h+w>a.length)throw new TypeError("index out of range");
|
||||
}function f(a,b,h,w){0>b&&(b=65535+b+1);for(var y=0,I=Math.min(a.length-h,2);y<I;y++)a[h+y]=(b&255<<8*(w?y:1-y))>>>8*(w?y:1-y)}function c(a,b,h,w){0>b&&(b=4294967295+b+1);for(var y=0,I=Math.min(a.length-h,4);y<I;y++)a[h+y]=b>>>8*(w?y:3-y)&255}function l(a,b,h,w,y,I){if(b>y||b<I)throw new TypeError("value is out of bounds");if(h+w>a.length)throw new TypeError("index out of range");}function q(a,b,h,w,y){y||l(a,b,h,4,3.4028234663852886E38,-3.4028234663852886E38);v.write(a,b,h,w,23,4);return h+4}function r(a,
|
||||
b,h,w,y){y||l(a,b,h,8,1.7976931348623157E308,-1.7976931348623157E308);v.write(a,b,h,w,52,8);return h+8}function k(a){for(var b=[],h=0;h<a.length;h++){var w=a.charCodeAt(h);if(127>=w)b.push(w);else{var y=h;55296<=w&&57343>=w&&h++;w=encodeURIComponent(a.slice(y,h+1)).substr(1).split("%");for(y=0;y<w.length;y++)b.push(parseInt(w[y],16))}}return b}function u(a){for(var b=[],h=0;h<a.length;h++)b.push(a.charCodeAt(h)&255);return b}function d(a,b,h,w,y){y&&(w-=w%y);for(y=0;y<w&&!(y+h>=b.length||y>=a.length);y++)b[y+
|
||||
h]=a[y];return y}function g(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}var n=C("base64-js"),v=C("ieee754"),z=C("is-array");A.Buffer=e;A.SlowBuffer=e;A.INSPECT_MAX_BYTES=50;e.poolSize=8192;var G=1073741823;e.TYPED_ARRAY_SUPPORT=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);b.foo=function(){return 42};return 42===b.foo()&&"function"===typeof b.subarray&&0===(new Uint8Array(1)).subarray(1,1).byteLength}catch(h){return!1}}();e.isBuffer=function(a){return!(null==
|
||||
a||!a._isBuffer)};e.compare=function(a,b){if(!e.isBuffer(a)||!e.isBuffer(b))throw new TypeError("Arguments must be Buffers");for(var h=a.length,w=b.length,y=0,I=Math.min(h,w);y<I&&a[y]===b[y];y++);y!==I&&(h=a[y],w=b[y]);return h<w?-1:w<h?1:0};e.isEncoding=function(a){switch(String(a).toLowerCase()){case "hex":case "utf8":case "utf-8":case "ascii":case "binary":case "base64":case "raw":case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return!0;default:return!1}};e.concat=function(a,b){if(!z(a))throw new TypeError("Usage: Buffer.concat(list[, length])");
|
||||
if(0===a.length)return new e(0);if(1===a.length)return a[0];var h;if(void 0===b)for(h=b=0;h<a.length;h++)b+=a[h].length;var w=new e(b),y=0;for(h=0;h<a.length;h++){var I=a[h];I.copy(w,y);y+=I.length}return w};e.byteLength=function(a,b){a+="";switch(b||"utf8"){case "ascii":case "binary":case "raw":var h=a.length;break;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":h=2*a.length;break;case "hex":h=a.length>>>1;break;case "utf8":case "utf-8":h=k(a).length;break;case "base64":h=n.toByteArray(a).length;
|
||||
break;default:h=a.length}return h};e.prototype.length=void 0;e.prototype.parent=void 0;e.prototype.toString=function(a,b,h){var w=!1;b>>>=0;h=void 0===h||Infinity===h?this.length:h>>>0;a||(a="utf8");0>b&&(b=0);h>this.length&&(h=this.length);if(h<=b)return"";for(;;)switch(a){case "hex":a=b;b=h;h=this.length;if(!a||0>a)a=0;if(!b||0>b||b>h)b=h;w="";for(h=a;h<b;h++)a=w,w=this[h],w=16>w?"0"+w.toString(16):w.toString(16),w=a+w;return w;case "utf8":case "utf-8":w=a="";for(h=Math.min(this.length,h);b<h;b++)127>=
|
||||
this[b]?(a+=g(w)+String.fromCharCode(this[b]),w=""):w+="%"+this[b].toString(16);return a+g(w);case "ascii":return p(this,b,h);case "binary":return p(this,b,h);case "base64":return b=0===b&&h===this.length?n.fromByteArray(this):n.fromByteArray(this.slice(b,h)),b;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":b=this.slice(b,h);h="";for(a=0;a<b.length;a+=2)h+=String.fromCharCode(b[a]+256*b[a+1]);return h;default:if(w)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase();w=!0}};
|
||||
e.prototype.equals=function(a){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");return 0===e.compare(this,a)};e.prototype.inspect=function(){var a="",b=A.INSPECT_MAX_BYTES;0<this.length&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... "));return"<Buffer "+a+">"};e.prototype.compare=function(a){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");return e.compare(this,a)};e.prototype.get=function(a){console.log(".get() is deprecated. Access using array indexes instead.");
|
||||
return this.readUInt8(a)};e.prototype.set=function(a,b){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(a,b)};e.prototype.write=function(a,b,h,w){if(isFinite(b))isFinite(h)||(w=h,h=void 0);else{var y=w;w=b;b=h;h=y}b=Number(b)||0;y=this.length-b;h?(h=Number(h),h>y&&(h=y)):h=y;w=String(w||"utf8").toLowerCase();switch(w){case "hex":b=Number(b)||0;w=this.length-b;h?(h=Number(h),h>w&&(h=w)):h=w;w=a.length;if(0!==w%2)throw Error("Invalid hex string");h>w/
|
||||
2&&(h=w/2);for(w=0;w<h;w++){y=parseInt(a.substr(2*w,2),16);if(isNaN(y))throw Error("Invalid hex string");this[b+w]=y}a=w;break;case "utf8":case "utf-8":a=d(k(a),this,b,h);break;case "ascii":a=d(u(a),this,b,h);break;case "binary":a=d(u(a),this,b,h);break;case "base64":a=d(n.toByteArray(a),this,b,h);break;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":y=[];for(var I=0;I<a.length;I++){var K=a.charCodeAt(I);w=K>>8;K%=256;y.push(K);y.push(w)}a=d(y,this,b,h,2);break;default:throw new TypeError("Unknown encoding: "+
|
||||
w);}return a};e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};e.prototype.slice=function(a,b){var h=this.length;a=~~a;b=void 0===b?h:~~b;0>a?(a+=h,0>a&&(a=0)):a>h&&(a=h);0>b?(b+=h,0>b&&(b=0)):b>h&&(b=h);b<a&&(b=a);if(e.TYPED_ARRAY_SUPPORT)return e._augment(this.subarray(a,b));h=b-a;for(var w=new e(h,void 0,!0),y=0;y<h;y++)w[y]=this[y+a];return w};e.prototype.readUInt8=function(a,b){b||t(a,1,this.length);return this[a]};e.prototype.readUInt16LE=
|
||||
function(a,b){b||t(a,2,this.length);return this[a]|this[a+1]<<8};e.prototype.readUInt16BE=function(a,b){b||t(a,2,this.length);return this[a]<<8|this[a+1]};e.prototype.readUInt32LE=function(a,b){b||t(a,4,this.length);return(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]};e.prototype.readUInt32BE=function(a,b){b||t(a,4,this.length);return 16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])};e.prototype.readInt8=function(a,b){b||t(a,1,this.length);return this[a]&128?-1*(255-this[a]+1):this[a]};
|
||||
e.prototype.readInt16LE=function(a,b){b||t(a,2,this.length);var h=this[a]|this[a+1]<<8;return h&32768?h|4294901760:h};e.prototype.readInt16BE=function(a,b){b||t(a,2,this.length);var h=this[a+1]|this[a]<<8;return h&32768?h|4294901760:h};e.prototype.readInt32LE=function(a,b){b||t(a,4,this.length);return this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24};e.prototype.readInt32BE=function(a,b){b||t(a,4,this.length);return this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]};e.prototype.readFloatLE=function(a,
|
||||
b){b||t(a,4,this.length);return v.read(this,a,!0,23,4)};e.prototype.readFloatBE=function(a,b){b||t(a,4,this.length);return v.read(this,a,!1,23,4)};e.prototype.readDoubleLE=function(a,b){b||t(a,8,this.length);return v.read(this,a,!0,52,8)};e.prototype.readDoubleBE=function(a,b){b||t(a,8,this.length);return v.read(this,a,!1,52,8)};e.prototype.writeUInt8=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,1,255,0);e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));this[b]=a;return b+1};e.prototype.writeUInt16LE=function(a,
|
||||
b,h){a=+a;b>>>=0;h||m(this,a,b,2,65535,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):f(this,a,b,!0);return b+2};e.prototype.writeUInt16BE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,2,65535,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):f(this,a,b,!1);return b+2};e.prototype.writeUInt32LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,4294967295,0);e.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=a):c(this,a,b,!0);return b+4};e.prototype.writeUInt32BE=function(a,
|
||||
b,h){a=+a;b>>>=0;h||m(this,a,b,4,4294967295,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a):c(this,a,b,!1);return b+4};e.prototype.writeInt8=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,1,127,-128);e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));0>a&&(a=255+a+1);this[b]=a;return b+1};e.prototype.writeInt16LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,2,32767,-32768);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):f(this,a,b,!0);return b+2};e.prototype.writeInt16BE=function(a,
|
||||
b,h){a=+a;b>>>=0;h||m(this,a,b,2,32767,-32768);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):f(this,a,b,!1);return b+2};e.prototype.writeInt32LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,2147483647,-2147483648);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):c(this,a,b,!0);return b+4};e.prototype.writeInt32BE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,2147483647,-2147483648);0>a&&(a=4294967295+a+1);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+
|
||||
2]=a>>>8,this[b+3]=a):c(this,a,b,!1);return b+4};e.prototype.writeFloatLE=function(a,b,h){return q(this,a,b,!0,h)};e.prototype.writeFloatBE=function(a,b,h){return q(this,a,b,!1,h)};e.prototype.writeDoubleLE=function(a,b,h){return r(this,a,b,!0,h)};e.prototype.writeDoubleBE=function(a,b,h){return r(this,a,b,!1,h)};e.prototype.copy=function(a,b,h,w){h||(h=0);w||0===w||(w=this.length);b||(b=0);if(w!==h&&0!==a.length&&0!==this.length){if(w<h)throw new TypeError("sourceEnd < sourceStart");if(0>b||b>=a.length)throw new TypeError("targetStart out of bounds");
|
||||
if(0>h||h>=this.length)throw new TypeError("sourceStart out of bounds");if(0>w||w>this.length)throw new TypeError("sourceEnd out of bounds");w>this.length&&(w=this.length);a.length-b<w-h&&(w=a.length-b+h);w-=h;if(1E3>w||!e.TYPED_ARRAY_SUPPORT)for(var y=0;y<w;y++)a[y+b]=this[y+h];else a._set(this.subarray(h,h+w),b)}};e.prototype.fill=function(a,b,h){a||(a=0);b||(b=0);h||(h=this.length);if(h<b)throw new TypeError("end < start");if(h!==b&&0!==this.length){if(0>b||b>=this.length)throw new TypeError("start out of bounds");
|
||||
if(0>h||h>this.length)throw new TypeError("end out of bounds");if("number"===typeof a)for(;b<h;b++)this[b]=a;else{a=k(a.toString());for(var w=a.length;b<h;b++)this[b]=a[b%w]}return this}};e.prototype.toArrayBuffer=function(){if("undefined"!==typeof Uint8Array){if(e.TYPED_ARRAY_SUPPORT)return(new e(this)).buffer;for(var a=new Uint8Array(this.length),b=0,h=a.length;b<h;b+=1)a[b]=this[b];return a.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser");};var D=e.prototype;e._augment=
|
||||
function(a){a.constructor=e;a._isBuffer=!0;a._get=a.get;a._set=a.set;a.get=D.get;a.set=D.set;a.write=D.write;a.toString=D.toString;a.toLocaleString=D.toString;a.toJSON=D.toJSON;a.equals=D.equals;a.compare=D.compare;a.copy=D.copy;a.slice=D.slice;a.readUInt8=D.readUInt8;a.readUInt16LE=D.readUInt16LE;a.readUInt16BE=D.readUInt16BE;a.readUInt32LE=D.readUInt32LE;a.readUInt32BE=D.readUInt32BE;a.readInt8=D.readInt8;a.readInt16LE=D.readInt16LE;a.readInt16BE=D.readInt16BE;a.readInt32LE=D.readInt32LE;a.readInt32BE=
|
||||
D.readInt32BE;a.readFloatLE=D.readFloatLE;a.readFloatBE=D.readFloatBE;a.readDoubleLE=D.readDoubleLE;a.readDoubleBE=D.readDoubleBE;a.writeUInt8=D.writeUInt8;a.writeUInt16LE=D.writeUInt16LE;a.writeUInt16BE=D.writeUInt16BE;a.writeUInt32LE=D.writeUInt32LE;a.writeUInt32BE=D.writeUInt32BE;a.writeInt8=D.writeInt8;a.writeInt16LE=D.writeInt16LE;a.writeInt16BE=D.writeInt16BE;a.writeInt32LE=D.writeInt32LE;a.writeInt32BE=D.writeInt32BE;a.writeFloatLE=D.writeFloatLE;a.writeFloatBE=D.writeFloatBE;a.writeDoubleLE=
|
||||
D.writeDoubleLE;a.writeDoubleBE=D.writeDoubleBE;a.fill=D.fill;a.inspect=D.inspect;a.toArrayBuffer=D.toArrayBuffer;return a};var L=/[^+\/0-9A-z]/g},{"base64-js":2,ieee754:6,"is-array":7}],6:[function(C,J,A){A.read=function(e,p,t,m,f){var c=8*f-m-1;var l=(1<<c)-1,q=l>>1,r=-7;f=t?f-1:0;var k=t?-1:1,u=e[p+f];f+=k;t=u&(1<<-r)-1;u>>=-r;for(r+=c;0<r;t=256*t+e[p+f],f+=k,r-=8);c=t&(1<<-r)-1;t>>=-r;for(r+=m;0<r;c=256*c+e[p+f],f+=k,r-=8);if(0===t)t=1-q;else{if(t===l)return c?NaN:Infinity*(u?-1:1);c+=Math.pow(2,
|
||||
m);t-=q}return(u?-1:1)*c*Math.pow(2,t-m)};A.write=function(e,p,t,m,f,c){var l,q=8*c-f-1,r=(1<<q)-1,k=r>>1,u=23===f?Math.pow(2,-24)-Math.pow(2,-77):0;c=m?0:c-1;var d=m?1:-1,g=0>p||0===p&&0>1/p?1:0;p=Math.abs(p);isNaN(p)||Infinity===p?(p=isNaN(p)?1:0,m=r):(m=Math.floor(Math.log(p)/Math.LN2),1>p*(l=Math.pow(2,-m))&&(m--,l*=2),p=1<=m+k?p+u/l:p+u*Math.pow(2,1-k),2<=p*l&&(m++,l/=2),m+k>=r?(p=0,m=r):1<=m+k?(p=(p*l-1)*Math.pow(2,f),m+=k):(p=p*Math.pow(2,k-1)*Math.pow(2,f),m=0));for(;8<=f;e[t+c]=p&255,c+=
|
||||
d,p/=256,f-=8);m=m<<f|p;for(q+=f;0<q;e[t+c]=m&255,c+=d,m/=256,q-=8);e[t+c-d]|=128*g}},{}],7:[function(C,J,A){var e=Object.prototype.toString;J.exports=Array.isArray||function(p){return!!p&&"[object Array]"==e.call(p)}},{}],8:[function(C,J,A){(function(e){function p(c,l){for(var q=0,r=c.length-1;0<=r;r--){var k=c[r];"."===k?c.splice(r,1):".."===k?(c.splice(r,1),q++):q&&(c.splice(r,1),q--)}if(l)for(;q--;q)c.unshift("..");return c}function t(c,l){if(c.filter)return c.filter(l);for(var q=[],r=0;r<c.length;r++)l(c[r],
|
||||
r,c)&&q.push(c[r]);return q}var m=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;A.resolve=function(){for(var c="",l=!1,q=arguments.length-1;-1<=q&&!l;q--){var r=0<=q?arguments[q]:e.cwd();if("string"!==typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(c=r+"/"+c,l="/"===r.charAt(0))}c=p(t(c.split("/"),function(k){return!!k}),!l).join("/");return(l?"/":"")+c||"."};A.normalize=function(c){var l=A.isAbsolute(c),q="/"===f(c,-1);(c=p(t(c.split("/"),function(r){return!!r}),
|
||||
!l).join("/"))||l||(c=".");c&&q&&(c+="/");return(l?"/":"")+c};A.isAbsolute=function(c){return"/"===c.charAt(0)};A.join=function(){var c=Array.prototype.slice.call(arguments,0);return A.normalize(t(c,function(l,q){if("string"!==typeof l)throw new TypeError("Arguments to path.join must be strings");return l}).join("/"))};A.relative=function(c,l){function q(n){for(var v=0;v<n.length&&""===n[v];v++);for(var z=n.length-1;0<=z&&""===n[z];z--);return v>z?[]:n.slice(v,z-v+1)}c=A.resolve(c).substr(1);l=A.resolve(l).substr(1);
|
||||
for(var r=q(c.split("/")),k=q(l.split("/")),u=Math.min(r.length,k.length),d=u,g=0;g<u;g++)if(r[g]!==k[g]){d=g;break}u=[];for(g=d;g<r.length;g++)u.push("..");u=u.concat(k.slice(d));return u.join("/")};A.sep="/";A.delimiter=":";A.dirname=function(c){var l=m.exec(c).slice(1);c=l[0];l=l[1];if(!c&&!l)return".";l&&(l=l.substr(0,l.length-1));return c+l};A.basename=function(c,l){var q=m.exec(c).slice(1)[2];l&&q.substr(-1*l.length)===l&&(q=q.substr(0,q.length-l.length));return q};A.extname=function(c){return m.exec(c).slice(1)[3]};
|
||||
var f="b"==="ab".substr(-1)?function(c,l,q){return c.substr(l,q)}:function(c,l,q){0>l&&(l=c.length+l);return c.substr(l,q)}}).call(this,C("g5I+bs"))},{"g5I+bs":9}],9:[function(C,J,A){function e(){}C=J.exports={};C.nextTick=function(){if("undefined"!==typeof window&&window.setImmediate)return function(t){return window.setImmediate(t)};if("undefined"!==typeof window&&window.postMessage&&window.addEventListener){var p=[];window.addEventListener("message",function(t){var m=t.source;m!==window&&null!==
|
||||
m||"process-tick"!==t.data||(t.stopPropagation(),0<p.length&&p.shift()())},!0);return function(t){p.push(t);window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}();C.title="browser";C.browser=!0;C.env={};C.argv=[];C.on=e;C.addListener=e;C.once=e;C.off=e;C.removeListener=e;C.removeAllListeners=e;C.emit=e;C.binding=function(p){throw Error("process.binding is not supported");};C.cwd=function(){return"/"};C.chdir=function(p){throw Error("process.chdir is not supported");}},{}],
|
||||
10:[function(C,J,A){function e(){this._array=[];this._set=m?new Map:Object.create(null)}var p=C("./util"),t=Object.prototype.hasOwnProperty,m="undefined"!==typeof Map;e.fromArray=function(f,c){for(var l=new e,q=0,r=f.length;q<r;q++)l.add(f[q],c);return l};e.prototype.size=function(){return m?this._set.size:Object.getOwnPropertyNames(this._set).length};e.prototype.add=function(f,c){var l=m?f:p.toSetString(f),q=m?this.has(f):t.call(this._set,l),r=this._array.length;q&&!c||this._array.push(f);q||(m?
|
||||
this._set.set(f,r):this._set[l]=r)};e.prototype.has=function(f){if(m)return this._set.has(f);f=p.toSetString(f);return t.call(this._set,f)};e.prototype.indexOf=function(f){if(m){var c=this._set.get(f);if(0<=c)return c}else if(c=p.toSetString(f),t.call(this._set,c))return this._set[c];throw Error('"'+f+'" is not in the set.');};e.prototype.at=function(f){if(0<=f&&f<this._array.length)return this._array[f];throw Error("No element indexed by "+f);};e.prototype.toArray=function(){return this._array.slice()};
|
||||
A.ArraySet=e},{"./util":19}],11:[function(C,J,A){var e=C("./base64");A.encode=function(p){var t="",m=0>p?(-p<<1)+1:p<<1;do p=m&31,m>>>=5,0<m&&(p|=32),t+=e.encode(p);while(0<m);return t};A.decode=function(p,t,m){var f=p.length,c=0,l=0;do{if(t>=f)throw Error("Expected more digits in base 64 VLQ value.");var q=e.decode(p.charCodeAt(t++));if(-1===q)throw Error("Invalid base64 digit: "+p.charAt(t-1));var r=!!(q&32);q&=31;c+=q<<l;l+=5}while(r);p=c>>1;m.value=1===(c&1)?-p:p;m.rest=t}},{"./base64":12}],12:[function(C,
|
||||
J,A){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");A.encode=function(p){if(0<=p&&p<e.length)return e[p];throw new TypeError("Must be between 0 and 63: "+p);};A.decode=function(p){return 65<=p&&90>=p?p-65:97<=p&&122>=p?p-97+26:48<=p&&57>=p?p-48+52:43==p?62:47==p?63:-1}},{}],13:[function(C,J,A){function e(p,t,m,f,c,l){var q=Math.floor((t-p)/2)+p,r=c(m,f[q],!0);return 0===r?q:0<r?1<t-q?e(q,t,m,f,c,l):l==A.LEAST_UPPER_BOUND?t<f.length?t:-1:q:1<q-p?e(p,q,m,f,c,l):l==
|
||||
A.LEAST_UPPER_BOUND?q:0>p?-1:p}A.GREATEST_LOWER_BOUND=1;A.LEAST_UPPER_BOUND=2;A.search=function(p,t,m,f){if(0===t.length)return-1;p=e(-1,t.length,p,t,m,f||A.GREATEST_LOWER_BOUND);if(0>p)return-1;for(;0<=p-1&&0===m(t[p],t[p-1],!0);)--p;return p}},{}],14:[function(C,J,A){function e(){this._array=[];this._sorted=!0;this._last={generatedLine:-1,generatedColumn:0}}var p=C("./util");e.prototype.unsortedForEach=function(t,m){this._array.forEach(t,m)};e.prototype.add=function(t){var m=this._last,f=m.generatedLine,
|
||||
c=t.generatedLine,l=m.generatedColumn,q=t.generatedColumn;c>f||c==f&&q>=l||0>=p.compareByGeneratedPositionsInflated(m,t)?this._last=t:this._sorted=!1;this._array.push(t)};e.prototype.toArray=function(){this._sorted||(this._array.sort(p.compareByGeneratedPositionsInflated),this._sorted=!0);return this._array};A.MappingList=e},{"./util":19}],15:[function(C,J,A){function e(t,m,f){var c=t[m];t[m]=t[f];t[f]=c}function p(t,m,f,c){if(f<c){var l=f-1;e(t,Math.round(f+Math.random()*(c-f)),c);for(var q=t[c],
|
||||
r=f;r<c;r++)0>=m(t[r],q)&&(l+=1,e(t,l,r));e(t,l+1,r);l+=1;p(t,m,f,l-1);p(t,m,l+1,c)}}A.quickSort=function(t,m){p(t,m,0,t.length-1)}},{}],16:[function(C,J,A){function e(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));return null!=d.sections?new m(d,u):new p(d,u)}function p(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));var g=f.getArg(d,"version"),n=f.getArg(d,"sources"),v=f.getArg(d,"names",[]),z=f.getArg(d,"sourceRoot",null),G=f.getArg(d,"sourcesContent",null),D=f.getArg(d,
|
||||
"mappings");d=f.getArg(d,"file",null);if(g!=this._version)throw Error("Unsupported version: "+g);z&&(z=f.normalize(z));n=n.map(String).map(f.normalize).map(function(L){return z&&f.isAbsolute(z)&&f.isAbsolute(L)?f.relative(z,L):L});this._names=l.fromArray(v.map(String),!0);this._sources=l.fromArray(n,!0);this.sourceRoot=z;this.sourcesContent=G;this._mappings=D;this._sourceMapURL=u;this.file=d}function t(){this.generatedColumn=this.generatedLine=0;this.name=this.originalColumn=this.originalLine=this.source=
|
||||
null}function m(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));var g=f.getArg(d,"version");d=f.getArg(d,"sections");if(g!=this._version)throw Error("Unsupported version: "+g);this._sources=new l;this._names=new l;var n={line:-1,column:0};this._sections=d.map(function(v){if(v.url)throw Error("Support for url field in sections not implemented.");var z=f.getArg(v,"offset"),G=f.getArg(z,"line"),D=f.getArg(z,"column");if(G<n.line||G===n.line&&D<n.column)throw Error("Section offsets must be ordered and non-overlapping.");
|
||||
n=z;return{generatedOffset:{generatedLine:G+1,generatedColumn:D+1},consumer:new e(f.getArg(v,"map"),u)}})}var f=C("./util"),c=C("./binary-search"),l=C("./array-set").ArraySet,q=C("./base64-vlq"),r=C("./quick-sort").quickSort;e.fromSourceMap=function(k){return p.fromSourceMap(k)};e.prototype._version=3;e.prototype.__generatedMappings=null;Object.defineProperty(e.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){this.__generatedMappings||this._parseMappings(this._mappings,
|
||||
this.sourceRoot);return this.__generatedMappings}});e.prototype.__originalMappings=null;Object.defineProperty(e.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot);return this.__originalMappings}});e.prototype._charIsMappingSeparator=function(k,u){var d=k.charAt(u);return";"===d||","===d};e.prototype._parseMappings=function(k,u){throw Error("Subclasses must implement _parseMappings");};e.GENERATED_ORDER=
|
||||
1;e.ORIGINAL_ORDER=2;e.GREATEST_LOWER_BOUND=1;e.LEAST_UPPER_BOUND=2;e.prototype.eachMapping=function(k,u,d){u=u||null;switch(d||e.GENERATED_ORDER){case e.GENERATED_ORDER:d=this._generatedMappings;break;case e.ORIGINAL_ORDER:d=this._originalMappings;break;default:throw Error("Unknown order of iteration.");}var g=this.sourceRoot;d.map(function(n){var v=null===n.source?null:this._sources.at(n.source);v=f.computeSourceURL(g,v,this._sourceMapURL);return{source:v,generatedLine:n.generatedLine,generatedColumn:n.generatedColumn,
|
||||
originalLine:n.originalLine,originalColumn:n.originalColumn,name:null===n.name?null:this._names.at(n.name)}},this).forEach(k,u)};e.prototype.allGeneratedPositionsFor=function(k){var u=f.getArg(k,"line"),d={source:f.getArg(k,"source"),originalLine:u,originalColumn:f.getArg(k,"column",0)};null!=this.sourceRoot&&(d.source=f.relative(this.sourceRoot,d.source));if(!this._sources.has(d.source))return[];d.source=this._sources.indexOf(d.source);var g=[];d=this._findMapping(d,this._originalMappings,"originalLine",
|
||||
"originalColumn",f.compareByOriginalPositions,c.LEAST_UPPER_BOUND);if(0<=d){var n=this._originalMappings[d];if(void 0===k.column)for(u=n.originalLine;n&&n.originalLine===u;)g.push({line:f.getArg(n,"generatedLine",null),column:f.getArg(n,"generatedColumn",null),lastColumn:f.getArg(n,"lastGeneratedColumn",null)}),n=this._originalMappings[++d];else for(k=n.originalColumn;n&&n.originalLine===u&&n.originalColumn==k;)g.push({line:f.getArg(n,"generatedLine",null),column:f.getArg(n,"generatedColumn",null),
|
||||
lastColumn:f.getArg(n,"lastGeneratedColumn",null)}),n=this._originalMappings[++d]}return g};A.SourceMapConsumer=e;p.prototype=Object.create(e.prototype);p.prototype.consumer=e;p.fromSourceMap=function(k,u){var d=Object.create(p.prototype),g=d._names=l.fromArray(k._names.toArray(),!0),n=d._sources=l.fromArray(k._sources.toArray(),!0);d.sourceRoot=k._sourceRoot;d.sourcesContent=k._generateSourcesContent(d._sources.toArray(),d.sourceRoot);d.file=k._file;d._sourceMapURL=u;for(var v=k._mappings.toArray().slice(),
|
||||
z=d.__generatedMappings=[],G=d.__originalMappings=[],D=0,L=v.length;D<L;D++){var a=v[D],b=new t;b.generatedLine=a.generatedLine;b.generatedColumn=a.generatedColumn;a.source&&(b.source=n.indexOf(a.source),b.originalLine=a.originalLine,b.originalColumn=a.originalColumn,a.name&&(b.name=g.indexOf(a.name)),G.push(b));z.push(b)}r(d.__originalMappings,f.compareByOriginalPositions);return d};p.prototype._version=3;Object.defineProperty(p.prototype,"sources",{get:function(){return this._sources.toArray().map(function(k){return f.computeSourceURL(this.sourceRoot,
|
||||
k,this._sourceMapURL)},this)}});p.prototype._parseMappings=function(k,u){for(var d=1,g=0,n=0,v=0,z=0,G=0,D=k.length,L=0,a={},b={},h=[],w=[],y,I,K,N,P;L<D;)if(";"===k.charAt(L))d++,L++,g=0;else if(","===k.charAt(L))L++;else{y=new t;y.generatedLine=d;for(N=L;N<D&&!this._charIsMappingSeparator(k,N);N++);I=k.slice(L,N);if(K=a[I])L+=I.length;else{for(K=[];L<N;)q.decode(k,L,b),P=b.value,L=b.rest,K.push(P);if(2===K.length)throw Error("Found a source, but no line and column");if(3===K.length)throw Error("Found a source and line, but no column");
|
||||
a[I]=K}y.generatedColumn=g+K[0];g=y.generatedColumn;1<K.length&&(y.source=z+K[1],z+=K[1],y.originalLine=n+K[2],n=y.originalLine,y.originalLine+=1,y.originalColumn=v+K[3],v=y.originalColumn,4<K.length&&(y.name=G+K[4],G+=K[4]));w.push(y);"number"===typeof y.originalLine&&h.push(y)}r(w,f.compareByGeneratedPositionsDeflated);this.__generatedMappings=w;r(h,f.compareByOriginalPositions);this.__originalMappings=h};p.prototype._findMapping=function(k,u,d,g,n,v){if(0>=k[d])throw new TypeError("Line must be greater than or equal to 1, got "+
|
||||
k[d]);if(0>k[g])throw new TypeError("Column must be greater than or equal to 0, got "+k[g]);return c.search(k,u,n,v)};p.prototype.computeColumnSpans=function(){for(var k=0;k<this._generatedMappings.length;++k){var u=this._generatedMappings[k];if(k+1<this._generatedMappings.length){var d=this._generatedMappings[k+1];if(u.generatedLine===d.generatedLine){u.lastGeneratedColumn=d.generatedColumn-1;continue}}u.lastGeneratedColumn=Infinity}};p.prototype.originalPositionFor=function(k){var u={generatedLine:f.getArg(k,
|
||||
"line"),generatedColumn:f.getArg(k,"column")};k=this._findMapping(u,this._generatedMappings,"generatedLine","generatedColumn",f.compareByGeneratedPositionsDeflated,f.getArg(k,"bias",e.GREATEST_LOWER_BOUND));if(0<=k&&(k=this._generatedMappings[k],k.generatedLine===u.generatedLine)){u=f.getArg(k,"source",null);null!==u&&(u=this._sources.at(u),u=f.computeSourceURL(this.sourceRoot,u,this._sourceMapURL));var d=f.getArg(k,"name",null);null!==d&&(d=this._names.at(d));return{source:u,line:f.getArg(k,"originalLine",
|
||||
null),column:f.getArg(k,"originalColumn",null),name:d}}return{source:null,line:null,column:null,name:null}};p.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(k){return null==k}):!1};p.prototype.sourceContentFor=function(k,u){if(!this.sourcesContent)return null;var d=k;null!=this.sourceRoot&&(d=f.relative(this.sourceRoot,d));if(this._sources.has(d))return this.sourcesContent[this._sources.indexOf(d)];
|
||||
var g=this.sources,n;for(n=0;n<g.length;++n)if(g[n]==k)return this.sourcesContent[n];var v;if(null!=this.sourceRoot&&(v=f.urlParse(this.sourceRoot))){g=d.replace(/^file:\/\//,"");if("file"==v.scheme&&this._sources.has(g))return this.sourcesContent[this._sources.indexOf(g)];if((!v.path||"/"==v.path)&&this._sources.has("/"+d))return this.sourcesContent[this._sources.indexOf("/"+d)]}if(u)return null;throw Error('"'+d+'" is not in the SourceMap.');};p.prototype.generatedPositionFor=function(k){var u=
|
||||
f.getArg(k,"source");null!=this.sourceRoot&&(u=f.relative(this.sourceRoot,u));if(!this._sources.has(u))return{line:null,column:null,lastColumn:null};u=this._sources.indexOf(u);u={source:u,originalLine:f.getArg(k,"line"),originalColumn:f.getArg(k,"column")};k=this._findMapping(u,this._originalMappings,"originalLine","originalColumn",f.compareByOriginalPositions,f.getArg(k,"bias",e.GREATEST_LOWER_BOUND));return 0<=k&&(k=this._originalMappings[k],k.source===u.source)?{line:f.getArg(k,"generatedLine",
|
||||
null),column:f.getArg(k,"generatedColumn",null),lastColumn:f.getArg(k,"lastGeneratedColumn",null)}:{line:null,column:null,lastColumn:null}};A.BasicSourceMapConsumer=p;m.prototype=Object.create(e.prototype);m.prototype.constructor=e;m.prototype._version=3;Object.defineProperty(m.prototype,"sources",{get:function(){for(var k=[],u=0;u<this._sections.length;u++)for(var d=0;d<this._sections[u].consumer.sources.length;d++)k.push(this._sections[u].consumer.sources[d]);return k}});m.prototype.originalPositionFor=
|
||||
function(k){var u={generatedLine:f.getArg(k,"line"),generatedColumn:f.getArg(k,"column")},d=c.search(u,this._sections,function(g,n){var v=g.generatedLine-n.generatedOffset.generatedLine;return v?v:g.generatedColumn-n.generatedOffset.generatedColumn});return(d=this._sections[d])?d.consumer.originalPositionFor({line:u.generatedLine-(d.generatedOffset.generatedLine-1),column:u.generatedColumn-(d.generatedOffset.generatedLine===u.generatedLine?d.generatedOffset.generatedColumn-1:0),bias:k.bias}):{source:null,
|
||||
line:null,column:null,name:null}};m.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(k){return k.consumer.hasContentsOfAllSources()})};m.prototype.sourceContentFor=function(k,u){for(var d=0;d<this._sections.length;d++){var g=this._sections[d].consumer.sourceContentFor(k,!0);if(g)return g}if(u)return null;throw Error('"'+k+'" is not in the SourceMap.');};m.prototype.generatedPositionFor=function(k){for(var u=0;u<this._sections.length;u++){var d=this._sections[u];if(-1!==
|
||||
d.consumer.sources.indexOf(f.getArg(k,"source"))){var g=d.consumer.generatedPositionFor(k);if(g)return{line:g.line+(d.generatedOffset.generatedLine-1),column:g.column+(d.generatedOffset.generatedLine===g.line?d.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}};m.prototype._parseMappings=function(k,u){this.__generatedMappings=[];this.__originalMappings=[];for(var d=0;d<this._sections.length;d++)for(var g=this._sections[d],n=g.consumer._generatedMappings,v=0;v<n.length;v++){var z=
|
||||
n[v],G=g.consumer._sources.at(z.source);G=f.computeSourceURL(g.consumer.sourceRoot,G,this._sourceMapURL);this._sources.add(G);G=this._sources.indexOf(G);var D=null;z.name&&(D=g.consumer._names.at(z.name),this._names.add(D),D=this._names.indexOf(D));z={source:G,generatedLine:z.generatedLine+(g.generatedOffset.generatedLine-1),generatedColumn:z.generatedColumn+(g.generatedOffset.generatedLine===z.generatedLine?g.generatedOffset.generatedColumn-1:0),originalLine:z.originalLine,originalColumn:z.originalColumn,
|
||||
name:D};this.__generatedMappings.push(z);"number"===typeof z.originalLine&&this.__originalMappings.push(z)}r(this.__generatedMappings,f.compareByGeneratedPositionsDeflated);r(this.__originalMappings,f.compareByOriginalPositions)};A.IndexedSourceMapConsumer=m},{"./array-set":10,"./base64-vlq":11,"./binary-search":13,"./quick-sort":15,"./util":19}],17:[function(C,J,A){function e(c){c||(c={});this._file=t.getArg(c,"file",null);this._sourceRoot=t.getArg(c,"sourceRoot",null);this._skipValidation=t.getArg(c,
|
||||
"skipValidation",!1);this._sources=new m;this._names=new m;this._mappings=new f;this._sourcesContents=null}var p=C("./base64-vlq"),t=C("./util"),m=C("./array-set").ArraySet,f=C("./mapping-list").MappingList;e.prototype._version=3;e.fromSourceMap=function(c){var l=c.sourceRoot,q=new e({file:c.file,sourceRoot:l});c.eachMapping(function(r){var k={generated:{line:r.generatedLine,column:r.generatedColumn}};null!=r.source&&(k.source=r.source,null!=l&&(k.source=t.relative(l,k.source)),k.original={line:r.originalLine,
|
||||
column:r.originalColumn},null!=r.name&&(k.name=r.name));q.addMapping(k)});c.sources.forEach(function(r){var k=r;null!==l&&(k=t.relative(l,r));q._sources.has(k)||q._sources.add(k);k=c.sourceContentFor(r);null!=k&&q.setSourceContent(r,k)});return q};e.prototype.addMapping=function(c){var l=t.getArg(c,"generated"),q=t.getArg(c,"original",null),r=t.getArg(c,"source",null);c=t.getArg(c,"name",null);this._skipValidation||this._validateMapping(l,q,r,c);null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r));
|
||||
null!=c&&(c=String(c),this._names.has(c)||this._names.add(c));this._mappings.add({generatedLine:l.line,generatedColumn:l.column,originalLine:null!=q&&q.line,originalColumn:null!=q&&q.column,source:r,name:c})};e.prototype.setSourceContent=function(c,l){var q=c;null!=this._sourceRoot&&(q=t.relative(this._sourceRoot,q));null!=l?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[t.toSetString(q)]=l):this._sourcesContents&&(delete this._sourcesContents[t.toSetString(q)],
|
||||
0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))};e.prototype.applySourceMap=function(c,l,q){var r=l;if(null==l){if(null==c.file)throw Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');r=c.file}var k=this._sourceRoot;null!=k&&(r=t.relative(k,r));var u=new m,d=new m;this._mappings.unsortedForEach(function(g){if(g.source===r&&null!=g.originalLine){var n=c.originalPositionFor({line:g.originalLine,
|
||||
column:g.originalColumn});null!=n.source&&(g.source=n.source,null!=q&&(g.source=t.join(q,g.source)),null!=k&&(g.source=t.relative(k,g.source)),g.originalLine=n.line,g.originalColumn=n.column,null!=n.name&&(g.name=n.name))}n=g.source;null==n||u.has(n)||u.add(n);g=g.name;null==g||d.has(g)||d.add(g)},this);this._sources=u;this._names=d;c.sources.forEach(function(g){var n=c.sourceContentFor(g);null!=n&&(null!=q&&(g=t.join(q,g)),null!=k&&(g=t.relative(k,g)),this.setSourceContent(g,n))},this)};e.prototype._validateMapping=
|
||||
function(c,l,q,r){if(l&&"number"!==typeof l.line&&"number"!==typeof l.column)throw Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(c&&"line"in c&&"column"in c&&0<c.line&&0<=c.column&&!l&&!q&&!r||c&&"line"in c&&"column"in c&&l&&"line"in l&&"column"in l&&0<c.line&&0<=c.column&&0<l.line&&0<=l.column&&
|
||||
q))throw Error("Invalid mapping: "+JSON.stringify({generated:c,source:q,original:l,name:r}));};e.prototype._serializeMappings=function(){for(var c=0,l=1,q=0,r=0,k=0,u=0,d="",g,n,v,z=this._mappings.toArray(),G=0,D=z.length;G<D;G++){n=z[G];g="";if(n.generatedLine!==l)for(c=0;n.generatedLine!==l;)g+=";",l++;else if(0<G){if(!t.compareByGeneratedPositionsInflated(n,z[G-1]))continue;g+=","}g+=p.encode(n.generatedColumn-c);c=n.generatedColumn;null!=n.source&&(v=this._sources.indexOf(n.source),g+=p.encode(v-
|
||||
u),u=v,g+=p.encode(n.originalLine-1-r),r=n.originalLine-1,g+=p.encode(n.originalColumn-q),q=n.originalColumn,null!=n.name&&(n=this._names.indexOf(n.name),g+=p.encode(n-k),k=n));d+=g}return d};e.prototype._generateSourcesContent=function(c,l){return c.map(function(q){if(!this._sourcesContents)return null;null!=l&&(q=t.relative(l,q));q=t.toSetString(q);return Object.prototype.hasOwnProperty.call(this._sourcesContents,q)?this._sourcesContents[q]:null},this)};e.prototype.toJSON=function(){var c={version:this._version,
|
||||
sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};null!=this._file&&(c.file=this._file);null!=this._sourceRoot&&(c.sourceRoot=this._sourceRoot);this._sourcesContents&&(c.sourcesContent=this._generateSourcesContent(c.sources,c.sourceRoot));return c};e.prototype.toString=function(){return JSON.stringify(this.toJSON())};A.SourceMapGenerator=e},{"./array-set":10,"./base64-vlq":11,"./mapping-list":14,"./util":19}],18:[function(C,J,A){function e(f,c,l,q,r){this.children=
|
||||
[];this.sourceContents={};this.line=null==f?null:f;this.column=null==c?null:c;this.source=null==l?null:l;this.name=null==r?null:r;this.$$$isSourceNode$$$=!0;null!=q&&this.add(q)}var p=C("./source-map-generator").SourceMapGenerator,t=C("./util"),m=/(\r?\n)/;e.fromStringWithSourceMap=function(f,c,l){function q(z,G){if(null===z||void 0===z.source)r.add(G);else{var D=l?t.join(l,z.source):z.source;r.add(new e(z.originalLine,z.originalColumn,D,G,z.name))}}var r=new e,k=f.split(m),u=0,d=function(){var z=
|
||||
u<k.length?k[u++]:void 0,G=(u<k.length?k[u++]:void 0)||"";return z+G},g=1,n=0,v=null;c.eachMapping(function(z){if(null!==v)if(g<z.generatedLine)q(v,d()),g++,n=0;else{var G=k[u]||"",D=G.substr(0,z.generatedColumn-n);k[u]=G.substr(z.generatedColumn-n);n=z.generatedColumn;q(v,D);v=z;return}for(;g<z.generatedLine;)r.add(d()),g++;n<z.generatedColumn&&(G=k[u]||"",r.add(G.substr(0,z.generatedColumn)),k[u]=G.substr(z.generatedColumn),n=z.generatedColumn);v=z},this);u<k.length&&(v&&q(v,d()),r.add(k.splice(u).join("")));
|
||||
c.sources.forEach(function(z){var G=c.sourceContentFor(z);null!=G&&(null!=l&&(z=t.join(l,z)),r.setSourceContent(z,G))});return r};e.prototype.add=function(f){if(Array.isArray(f))f.forEach(function(c){this.add(c)},this);else if(f.$$$isSourceNode$$$||"string"===typeof f)f&&this.children.push(f);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+f);return this};e.prototype.prepend=function(f){if(Array.isArray(f))for(var c=f.length-1;0<=c;c--)this.prepend(f[c]);
|
||||
else if(f.$$$isSourceNode$$$||"string"===typeof f)this.children.unshift(f);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+f);return this};e.prototype.walk=function(f){for(var c,l=0,q=this.children.length;l<q;l++)c=this.children[l],c.$$$isSourceNode$$$?c.walk(f):""!==c&&f(c,{source:this.source,line:this.line,column:this.column,name:this.name})};e.prototype.join=function(f){var c,l=this.children.length;if(0<l){var q=[];for(c=0;c<l-1;c++)q.push(this.children[c]),
|
||||
q.push(f);q.push(this.children[c]);this.children=q}return this};e.prototype.replaceRight=function(f,c){var l=this.children[this.children.length-1];l.$$$isSourceNode$$$?l.replaceRight(f,c):"string"===typeof l?this.children[this.children.length-1]=l.replace(f,c):this.children.push("".replace(f,c));return this};e.prototype.setSourceContent=function(f,c){this.sourceContents[t.toSetString(f)]=c};e.prototype.walkSourceContents=function(f){for(var c=0,l=this.children.length;c<l;c++)this.children[c].$$$isSourceNode$$$&&
|
||||
this.children[c].walkSourceContents(f);var q=Object.keys(this.sourceContents);c=0;for(l=q.length;c<l;c++)f(t.fromSetString(q[c]),this.sourceContents[q[c]])};e.prototype.toString=function(){var f="";this.walk(function(c){f+=c});return f};e.prototype.toStringWithSourceMap=function(f){var c="",l=1,q=0,r=new p(f),k=!1,u=null,d=null,g=null,n=null;this.walk(function(v,z){c+=v;null!==z.source&&null!==z.line&&null!==z.column?(u===z.source&&d===z.line&&g===z.column&&n===z.name||r.addMapping({source:z.source,
|
||||
original:{line:z.line,column:z.column},generated:{line:l,column:q},name:z.name}),u=z.source,d=z.line,g=z.column,n=z.name,k=!0):k&&(r.addMapping({generated:{line:l,column:q}}),u=null,k=!1);for(var G=0,D=v.length;G<D;G++)10===v.charCodeAt(G)?(l++,q=0,G+1===D?(u=null,k=!1):k&&r.addMapping({source:z.source,original:{line:z.line,column:z.column},generated:{line:l,column:q},name:z.name})):q++});this.walkSourceContents(function(v,z){r.setSourceContent(v,z)});return{code:c,map:r}};A.SourceNode=e},{"./source-map-generator":17,
|
||||
"./util":19}],19:[function(C,J,A){function e(d){return(d=d.match(k))?{scheme:d[1],auth:d[2],host:d[3],port:d[4],path:d[5]}:null}function p(d){var g="";d.scheme&&(g+=d.scheme+":");g+="//";d.auth&&(g+=d.auth+"@");d.host&&(g+=d.host);d.port&&(g+=":"+d.port);d.path&&(g+=d.path);return g}function t(d){var g=d,n=e(d);if(n){if(!n.path)return d;g=n.path}d=A.isAbsolute(g);g=g.split(/\/+/);for(var v,z=0,G=g.length-1;0<=G;G--)v=g[G],"."===v?g.splice(G,1):".."===v?z++:0<z&&(""===v?(g.splice(G+1,z),z=0):(g.splice(G,
|
||||
2),z--));g=g.join("/");""===g&&(g=d?"/":".");return n?(n.path=g,p(n)):g}function m(d,g){""===d&&(d=".");""===g&&(g=".");var n=e(g),v=e(d);v&&(d=v.path||"/");if(n&&!n.scheme)return v&&(n.scheme=v.scheme),p(n);if(n||g.match(u))return g;if(v&&!v.host&&!v.path)return v.host=g,p(v);n="/"===g.charAt(0)?g:t(d.replace(/\/+$/,"")+"/"+g);return v?(v.path=n,p(v)):n}function f(d){return d}function c(d){return q(d)?"$"+d:d}function l(d){return q(d)?d.slice(1):d}function q(d){if(!d)return!1;var g=d.length;if(9>
|
||||
g||95!==d.charCodeAt(g-1)||95!==d.charCodeAt(g-2)||111!==d.charCodeAt(g-3)||116!==d.charCodeAt(g-4)||111!==d.charCodeAt(g-5)||114!==d.charCodeAt(g-6)||112!==d.charCodeAt(g-7)||95!==d.charCodeAt(g-8)||95!==d.charCodeAt(g-9))return!1;for(g-=10;0<=g;g--)if(36!==d.charCodeAt(g))return!1;return!0}function r(d,g){return d===g?0:null===d?1:null===g?-1:d>g?1:-1}A.getArg=function(d,g,n){if(g in d)return d[g];if(3===arguments.length)return n;throw Error('"'+g+'" is a required argument.');};var k=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,
|
||||
u=/^data:.+,.+$/;A.urlParse=e;A.urlGenerate=p;A.normalize=t;A.join=m;A.isAbsolute=function(d){return"/"===d.charAt(0)||k.test(d)};A.relative=function(d,g){""===d&&(d=".");d=d.replace(/\/$/,"");for(var n=0;0!==g.indexOf(d+"/");){var v=d.lastIndexOf("/");if(0>v)return g;d=d.slice(0,v);if(d.match(/^([^\/]+:\/)?\/*$/))return g;++n}return Array(n+1).join("../")+g.substr(d.length+1)};C=!("__proto__"in Object.create(null));A.toSetString=C?f:c;A.fromSetString=C?f:l;A.compareByOriginalPositions=function(d,
|
||||
g,n){var v=r(d.source,g.source);if(0!==v)return v;v=d.originalLine-g.originalLine;if(0!==v)return v;v=d.originalColumn-g.originalColumn;if(0!==v||n)return v;v=d.generatedColumn-g.generatedColumn;if(0!==v)return v;v=d.generatedLine-g.generatedLine;return 0!==v?v:r(d.name,g.name)};A.compareByGeneratedPositionsDeflated=function(d,g,n){var v=d.generatedLine-g.generatedLine;if(0!==v)return v;v=d.generatedColumn-g.generatedColumn;if(0!==v||n)return v;v=r(d.source,g.source);if(0!==v)return v;v=d.originalLine-
|
||||
g.originalLine;if(0!==v)return v;v=d.originalColumn-g.originalColumn;return 0!==v?v:r(d.name,g.name)};A.compareByGeneratedPositionsInflated=function(d,g){var n=d.generatedLine-g.generatedLine;if(0!==n)return n;n=d.generatedColumn-g.generatedColumn;if(0!==n)return n;n=r(d.source,g.source);if(0!==n)return n;n=d.originalLine-g.originalLine;if(0!==n)return n;n=d.originalColumn-g.originalColumn;return 0!==n?n:r(d.name,g.name)};A.parseSourceMapInput=function(d){return JSON.parse(d.replace(/^\)]}'[^\n]*\n/,
|
||||
""))};A.computeSourceURL=function(d,g,n){g=g||"";d&&("/"!==d[d.length-1]&&"/"!==g[0]&&(d+="/"),g=d+g);if(n){d=e(n);if(!d)throw Error("sourceMapURL could not be parsed");d.path&&(n=d.path.lastIndexOf("/"),0<=n&&(d.path=d.path.substring(0,n+1)));g=m(p(d),g)}return t(g)}},{}],20:[function(C,J,A){A.SourceMapGenerator=C("./lib/source-map-generator").SourceMapGenerator;A.SourceMapConsumer=C("./lib/source-map-consumer").SourceMapConsumer;A.SourceNode=C("./lib/source-node").SourceNode},{"./lib/source-map-consumer":16,
|
||||
"./lib/source-map-generator":17,"./lib/source-node":18}],21:[function(C,J,A){(function(e){function p(){return"browser"===a?!0:"node"===a?!1:"undefined"!==typeof window&&"function"===typeof XMLHttpRequest&&!(window.require&&window.module&&window.process&&"renderer"===window.process.type)}function t(x){return function(B){for(var F=0;F<x.length;F++){var E=x[F](B);if(E)return E}return null}}function m(x,B){if(!x)return B;var F=n.dirname(x),E=/^\w+:\/\/[^\/]*/.exec(F);E=E?E[0]:"";var H=F.slice(E.length);
|
||||
return E&&/^\/\w:/.test(H)?(E+="/",E+n.resolve(F.slice(E.length),B).replace(/\\/g,"/")):E+n.resolve(F.slice(E.length),B)}function f(x){var B=h[x.source];if(!B){var F=N(x.source);F?(B=h[x.source]={url:F.url,map:new g(F.map)},B.map.sourcesContent&&B.map.sources.forEach(function(E,H){var M=B.map.sourcesContent[H];if(M){var S=m(B.url,E);b[S]=M}})):B=h[x.source]={url:null,map:null}}return B&&B.map&&"function"===typeof B.map.originalPositionFor&&(F=B.map.originalPositionFor(x),null!==F.source)?(F.source=
|
||||
m(B.url,F.source),F):x}function c(x){var B=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(x);return B?(x=f({source:B[2],line:+B[3],column:B[4]-1}),"eval at "+B[1]+" ("+x.source+":"+x.line+":"+(x.column+1)+")"):(B=/^eval at ([^(]+) \((.+)\)$/.exec(x))?"eval at "+B[1]+" ("+c(B[2])+")":x}function l(){var x="";if(this.isNative())x="native";else{var B=this.getScriptNameOrSourceURL();!B&&this.isEval()&&(x=this.getEvalOrigin(),x+=", ");x=B?x+B:x+"<anonymous>";B=this.getLineNumber();null!=B&&(x+=":"+B,(B=
|
||||
this.getColumnNumber())&&(x+=":"+B))}B="";var F=this.getFunctionName(),E=!0,H=this.isConstructor();if(this.isToplevel()||H)H?B+="new "+(F||"<anonymous>"):F?B+=F:(B+=x,E=!1);else{H=this.getTypeName();"[object Object]"===H&&(H="null");var M=this.getMethodName();F?(H&&0!=F.indexOf(H)&&(B+=H+"."),B+=F,M&&F.indexOf("."+M)!=F.length-M.length-1&&(B+=" [as "+M+"]")):B+=H+"."+(M||"<anonymous>")}E&&(B+=" ("+x+")");return B}function q(x){var B={};Object.getOwnPropertyNames(Object.getPrototypeOf(x)).forEach(function(F){B[F]=
|
||||
/^(?:is|get)/.test(F)?function(){return x[F].call(x)}:x[F]});B.toString=l;return B}function r(x,B){void 0===B&&(B={nextPosition:null,curPosition:null});if(x.isNative())return B.curPosition=null,x;var F=x.getFileName()||x.getScriptNameOrSourceURL();if(F){var E=x.getLineNumber(),H=x.getColumnNumber()-1,M=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,S=M.test;var V="object"===typeof e&&null!==e?e.version:"";M=S.call(M,V)?0:62;1===E&&H>M&&!p()&&!x.isEval()&&(H-=M);var O=
|
||||
f({source:F,line:E,column:H});B.curPosition=O;x=q(x);var T=x.getFunctionName;x.getFunctionName=function(){return null==B.nextPosition?T():B.nextPosition.name||T()};x.getFileName=function(){return O.source};x.getLineNumber=function(){return O.line};x.getColumnNumber=function(){return O.column+1};x.getScriptNameOrSourceURL=function(){return O.source};return x}var Q=x.isEval()&&x.getEvalOrigin();Q&&(Q=c(Q),x=q(x),x.getEvalOrigin=function(){return Q});return x}function k(x,B){L&&(b={},h={});for(var F=
|
||||
(x.name||"Error")+": "+(x.message||""),E={nextPosition:null,curPosition:null},H=[],M=B.length-1;0<=M;M--)H.push("\n at "+r(B[M],E)),E.nextPosition=E.curPosition;E.curPosition=E.nextPosition=null;return F+H.reverse().join("")}function u(x){var B=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(x.stack);if(B){x=B[1];var F=+B[2];B=+B[3];var E=b[x];if(!E&&v&&v.existsSync(x))try{E=v.readFileSync(x,"utf8")}catch(H){E=""}if(E&&(E=E.split(/(?:\r\n|\r|\n)/)[F-1]))return x+":"+F+"\n"+E+"\n"+Array(B).join(" ")+
|
||||
"^"}return null}function d(){var x=e.emit;e.emit=function(B){if("uncaughtException"===B){var F=arguments[1]&&arguments[1].stack,E=0<this.listeners(B).length;if(F&&!E){F=arguments[1];E=u(F);var H="object"===typeof e&&null!==e?e.stderr:void 0;H&&H._handle&&H._handle.setBlocking&&H._handle.setBlocking(!0);E&&(console.error(),console.error(E));console.error(F.stack);"object"===typeof e&&null!==e&&"function"===typeof e.exit&&e.exit(1);return}}return x.apply(this,arguments)}}var g=C("source-map").SourceMapConsumer,
|
||||
n=C("path");try{var v=C("fs");v.existsSync&&v.readFileSync||(v=null)}catch(x){}var z=C("buffer-from"),G=!1,D=!1,L=!1,a="auto",b={},h={},w=/^data:application\/json[^,]+base64,/,y=[],I=[],K=t(y);y.push(function(x){x=x.trim();/^file:/.test(x)&&(x=x.replace(/file:\/\/\/(\w:)?/,function(E,H){return H?"":"/"}));if(x in b)return b[x];var B="";try{if(v)v.existsSync(x)&&(B=v.readFileSync(x,"utf8"));else{var F=new XMLHttpRequest;F.open("GET",x,!1);F.send(null);4===F.readyState&&200===F.status&&(B=F.responseText)}}catch(E){}return b[x]=
|
||||
B});var N=t(I);I.push(function(x){a:{if(p())try{var B=new XMLHttpRequest;B.open("GET",x,!1);B.send(null);var F=B.getResponseHeader("SourceMap")||B.getResponseHeader("X-SourceMap");if(F){var E=F;break a}}catch(M){}E=K(x);B=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;for(var H;F=B.exec(E);)H=F;E=H?H[1]:null}if(!E)return null;w.test(E)?(H=E.slice(E.indexOf(",")+1),H=z(H,"base64").toString(),E=x):(E=m(x,E),H=K(E));return H?{url:E,
|
||||
map:H}:null});var P=y.slice(0),W=I.slice(0);A.wrapCallSite=r;A.getErrorSource=u;A.mapSourcePosition=f;A.retrieveSourceMap=N;A.install=function(x){x=x||{};if(x.environment&&(a=x.environment,-1===["node","browser","auto"].indexOf(a)))throw Error("environment "+a+" was unknown. Available options are {auto, browser, node}");x.retrieveFile&&(x.overrideRetrieveFile&&(y.length=0),y.unshift(x.retrieveFile));x.retrieveSourceMap&&(x.overrideRetrieveSourceMap&&(I.length=0),I.unshift(x.retrieveSourceMap));if(x.hookRequire&&
|
||||
!p()){var B=J.require("module"),F=B.prototype._compile;F.__sourceMapSupport||(B.prototype._compile=function(E,H){b[H]=E;h[H]=void 0;return F.call(this,E,H)},B.prototype._compile.__sourceMapSupport=!0)}L||(L="emptyCacheBetweenOperations"in x?x.emptyCacheBetweenOperations:!1);G||(G=!0,Error.prepareStackTrace=k);if(!D){x="handleUncaughtExceptions"in x?x.handleUncaughtExceptions:!0;try{!1===J.require("worker_threads").isMainThread&&(x=!1)}catch(E){}x&&"object"===typeof e&&null!==e&&"function"===typeof e.on&&
|
||||
(D=!0,d())}};A.resetRetrieveHandlers=function(){y.length=0;I.length=0;y=P.slice(0);I=W.slice(0);N=t(I);K=t(y)}}).call(this,C("g5I+bs"))},{"buffer-from":4,fs:3,"g5I+bs":9,path:8,"source-map":20}]},{},[1]);return R});
|
50
node_modules/@cspotcode/source-map-support/package.json
generated
vendored
50
node_modules/@cspotcode/source-map-support/package.json
generated
vendored
@ -1,50 +0,0 @@
|
||||
{
|
||||
"name": "@cspotcode/source-map-support",
|
||||
"description": "Fixes stack traces for files with source maps",
|
||||
"version": "0.8.1",
|
||||
"main": "./source-map-support.js",
|
||||
"types": "./source-map-support.d.ts",
|
||||
"scripts": {
|
||||
"build": "node build.js",
|
||||
"serve-tests": "http-server -p 1336",
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"/register.d.ts",
|
||||
"/register.js",
|
||||
"/register-hook-require.d.ts",
|
||||
"/register-hook-require.js",
|
||||
"/source-map-support.d.ts",
|
||||
"/source-map-support.js",
|
||||
"/browser-source-map-support.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "0.3.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/lodash": "^4.14.182",
|
||||
"browserify": "^4.2.3",
|
||||
"coffeescript": "^1.12.7",
|
||||
"http-server": "^0.11.1",
|
||||
"lodash": "^4.17.21",
|
||||
"mocha": "^3.5.3",
|
||||
"semver": "^7.3.7",
|
||||
"source-map": "0.6.1",
|
||||
"webpack": "^1.15.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cspotcode/node-source-map-support"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/cspotcode/node-source-map-support/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"volta": {
|
||||
"node": "16.11.0",
|
||||
"npm": "7.24.2"
|
||||
}
|
||||
}
|
7
node_modules/@cspotcode/source-map-support/register-hook-require.d.ts
generated
vendored
7
node_modules/@cspotcode/source-map-support/register-hook-require.d.ts
generated
vendored
@ -1,7 +0,0 @@
|
||||
// tslint:disable:no-useless-files
|
||||
|
||||
// For following usage:
|
||||
// import '@cspotcode/source-map-support/register-hook-require'
|
||||
// Instead of:
|
||||
// import sourceMapSupport from '@cspotcode/source-map-support'
|
||||
// sourceMapSupport.install({hookRequire: true})
|
3
node_modules/@cspotcode/source-map-support/register-hook-require.js
generated
vendored
3
node_modules/@cspotcode/source-map-support/register-hook-require.js
generated
vendored
@ -1,3 +0,0 @@
|
||||
require('./').install({
|
||||
hookRequire: true
|
||||
});
|
7
node_modules/@cspotcode/source-map-support/register.d.ts
generated
vendored
7
node_modules/@cspotcode/source-map-support/register.d.ts
generated
vendored
@ -1,7 +0,0 @@
|
||||
// tslint:disable:no-useless-files
|
||||
|
||||
// For following usage:
|
||||
// import '@cspotcode/source-map-support/register'
|
||||
// Instead of:
|
||||
// import sourceMapSupport from '@cspotcode/source-map-support'
|
||||
// sourceMapSupport.install()
|
1
node_modules/@cspotcode/source-map-support/register.js
generated
vendored
1
node_modules/@cspotcode/source-map-support/register.js
generated
vendored
@ -1 +0,0 @@
|
||||
require('./').install();
|
76
node_modules/@cspotcode/source-map-support/source-map-support.d.ts
generated
vendored
76
node_modules/@cspotcode/source-map-support/source-map-support.d.ts
generated
vendored
@ -1,76 +0,0 @@
|
||||
// Type definitions for source-map-support 0.5
|
||||
// Project: https://github.com/evanw/node-source-map-support
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Jason Cheatham <https://github.com/jason0x43>
|
||||
// Alcedo Nathaniel De Guzman Jr <https://github.com/natealcedo>
|
||||
// Griffin Yourick <https://github.com/tough-griff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface RawSourceMap {
|
||||
version: 3;
|
||||
sources: string[];
|
||||
names: string[];
|
||||
sourceRoot?: string;
|
||||
sourcesContent?: string[];
|
||||
mappings: string;
|
||||
file: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output of retrieveSourceMap().
|
||||
* From source-map-support:
|
||||
* The map field may be either a string or the parsed JSON object (i.e.,
|
||||
* it must be a valid argument to the SourceMapConsumer constructor).
|
||||
*/
|
||||
export interface UrlAndMap {
|
||||
url: string;
|
||||
map: string | RawSourceMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options to install().
|
||||
*/
|
||||
export interface Options {
|
||||
handleUncaughtExceptions?: boolean | undefined;
|
||||
hookRequire?: boolean | undefined;
|
||||
emptyCacheBetweenOperations?: boolean | undefined;
|
||||
environment?: 'auto' | 'browser' | 'node' | undefined;
|
||||
overrideRetrieveFile?: boolean | undefined;
|
||||
overrideRetrieveSourceMap?: boolean | undefined;
|
||||
retrieveFile?(path: string): string;
|
||||
retrieveSourceMap?(source: string): UrlAndMap | null;
|
||||
/**
|
||||
* Set false to disable redirection of require / import `source-map-support` to `@cspotcode/source-map-support`
|
||||
*/
|
||||
redirectConflictingLibrary?: boolean;
|
||||
/**
|
||||
* Callback will be called every time we redirect due to `redirectConflictingLibrary`
|
||||
* This allows consumers to log helpful warnings if they choose.
|
||||
* @param parent NodeJS.Module which made the require() or require.resolve() call
|
||||
* @param options options object internally passed to node's `_resolveFilename` hook
|
||||
*/
|
||||
onConflictingLibraryRedirect?: (request: string, parent: any, isMain: boolean, options: any, redirectedRequest: string) => void;
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
source: string;
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export function wrapCallSite(frame: any /* StackFrame */): any /* StackFrame */;
|
||||
export function getErrorSource(error: Error): string | null;
|
||||
export function mapSourcePosition(position: Position): Position;
|
||||
export function retrieveSourceMap(source: string): UrlAndMap | null;
|
||||
export function resetRetrieveHandlers(): void;
|
||||
|
||||
/**
|
||||
* Install SourceMap support.
|
||||
* @param options Can be used to e.g. disable uncaughtException handler.
|
||||
*/
|
||||
export function install(options?: Options): void;
|
||||
|
||||
/**
|
||||
* Uninstall SourceMap support.
|
||||
*/
|
||||
export function uninstall(): void;
|
938
node_modules/@cspotcode/source-map-support/source-map-support.js
generated
vendored
938
node_modules/@cspotcode/source-map-support/source-map-support.js
generated
vendored
@ -1,938 +0,0 @@
|
||||
const { TraceMap, originalPositionFor, AnyMap } = require('@jridgewell/trace-mapping');
|
||||
var path = require('path');
|
||||
const { fileURLToPath, pathToFileURL } = require('url');
|
||||
var util = require('util');
|
||||
|
||||
var fs;
|
||||
try {
|
||||
fs = require('fs');
|
||||
if (!fs.existsSync || !fs.readFileSync) {
|
||||
// fs doesn't have all methods we need
|
||||
fs = null;
|
||||
}
|
||||
} catch (err) {
|
||||
/* nop */
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires a module which is protected against bundler minification.
|
||||
*
|
||||
* @param {NodeModule} mod
|
||||
* @param {string} request
|
||||
*/
|
||||
function dynamicRequire(mod, request) {
|
||||
return mod.require(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* enabled: boolean;
|
||||
* originalValue: any;
|
||||
* installedValue: any;
|
||||
* }} HookState
|
||||
* Used for installing and uninstalling hooks
|
||||
*/
|
||||
|
||||
// Increment this if the format of sharedData changes in a breaking way.
|
||||
var sharedDataVersion = 1;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {T} defaults
|
||||
* @returns {T}
|
||||
*/
|
||||
function initializeSharedData(defaults) {
|
||||
var sharedDataKey = 'source-map-support/sharedData';
|
||||
if (typeof Symbol !== 'undefined') {
|
||||
sharedDataKey = Symbol.for(sharedDataKey);
|
||||
}
|
||||
var sharedData = this[sharedDataKey];
|
||||
if (!sharedData) {
|
||||
sharedData = { version: sharedDataVersion };
|
||||
if (Object.defineProperty) {
|
||||
Object.defineProperty(this, sharedDataKey, { value: sharedData });
|
||||
} else {
|
||||
this[sharedDataKey] = sharedData;
|
||||
}
|
||||
}
|
||||
if (sharedDataVersion !== sharedData.version) {
|
||||
throw new Error("Multiple incompatible instances of source-map-support were loaded");
|
||||
}
|
||||
for (var key in defaults) {
|
||||
if (!(key in sharedData)) {
|
||||
sharedData[key] = defaults[key];
|
||||
}
|
||||
}
|
||||
return sharedData;
|
||||
}
|
||||
|
||||
// If multiple instances of source-map-support are loaded into the same
|
||||
// context, they shouldn't overwrite each other. By storing handlers, caches,
|
||||
// and other state on a shared object, different instances of
|
||||
// source-map-support can work together in a limited way. This does require
|
||||
// that future versions of source-map-support continue to support the fields on
|
||||
// this object. If this internal contract ever needs to be broken, increment
|
||||
// sharedDataVersion. (This version number is not the same as any of the
|
||||
// package's version numbers, which should reflect the *external* API of
|
||||
// source-map-support.)
|
||||
var sharedData = initializeSharedData({
|
||||
|
||||
// Only install once if called multiple times
|
||||
// Remember how the environment looked before installation so we can restore if able
|
||||
/** @type {HookState} */
|
||||
errorPrepareStackTraceHook: undefined,
|
||||
/** @type {HookState} */
|
||||
processEmitHook: undefined,
|
||||
/** @type {HookState} */
|
||||
moduleResolveFilenameHook: undefined,
|
||||
|
||||
/** @type {Array<(request: string, parent: any, isMain: boolean, options: any, redirectedRequest: string) => void>} */
|
||||
onConflictingLibraryRedirectArr: [],
|
||||
|
||||
// If true, the caches are reset before a stack trace formatting operation
|
||||
emptyCacheBetweenOperations: false,
|
||||
|
||||
// Maps a file path to a string containing the file contents
|
||||
fileContentsCache: Object.create(null),
|
||||
|
||||
// Maps a file path to a source map for that file
|
||||
/** @type {Record<string, {url: string, map: TraceMap}} */
|
||||
sourceMapCache: Object.create(null),
|
||||
|
||||
// Priority list of retrieve handlers
|
||||
retrieveFileHandlers: [],
|
||||
retrieveMapHandlers: [],
|
||||
|
||||
// Priority list of internally-implemented handlers.
|
||||
// When resetting state, we must keep these.
|
||||
internalRetrieveFileHandlers: [],
|
||||
internalRetrieveMapHandlers: [],
|
||||
|
||||
});
|
||||
|
||||
// Supports {browser, node, auto}
|
||||
var environment = "auto";
|
||||
|
||||
// Regex for detecting source maps
|
||||
var reSourceMap = /^data:application\/json[^,]+base64,/;
|
||||
|
||||
function isInBrowser() {
|
||||
if (environment === "browser")
|
||||
return true;
|
||||
if (environment === "node")
|
||||
return false;
|
||||
return ((typeof window !== 'undefined') && (typeof XMLHttpRequest === 'function') && !(window.require && window.module && window.process && window.process.type === "renderer"));
|
||||
}
|
||||
|
||||
function hasGlobalProcessEventEmitter() {
|
||||
return ((typeof process === 'object') && (process !== null) && (typeof process.on === 'function'));
|
||||
}
|
||||
|
||||
function tryFileURLToPath(v) {
|
||||
if(isFileUrl(v)) {
|
||||
return fileURLToPath(v);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
// TODO un-copy these from resolve-uri; see if they can be exported from that lib
|
||||
function isFileUrl(input) {
|
||||
return input.startsWith('file:');
|
||||
}
|
||||
function isAbsoluteUrl(input) {
|
||||
return schemeRegex.test(input);
|
||||
}
|
||||
// Matches the scheme of a URL, eg "http://"
|
||||
const schemeRegex = /^[\w+.-]+:\/\//;
|
||||
function isSchemeRelativeUrl(input) {
|
||||
return input.startsWith('//');
|
||||
}
|
||||
|
||||
// #region Caches
|
||||
/** @param {string} pathOrFileUrl */
|
||||
function getCacheKey(pathOrFileUrl) {
|
||||
if(pathOrFileUrl.startsWith('node:')) return pathOrFileUrl;
|
||||
if(isFileUrl(pathOrFileUrl)) {
|
||||
// Must normalize spaces to %20, stuff like that
|
||||
return new URL(pathOrFileUrl).toString();
|
||||
} else {
|
||||
try {
|
||||
return pathToFileURL(pathOrFileUrl).toString();
|
||||
} catch {
|
||||
return pathOrFileUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getFileContentsCache(key) {
|
||||
return sharedData.fileContentsCache[getCacheKey(key)];
|
||||
}
|
||||
function hasFileContentsCacheFromKey(key) {
|
||||
return Object.prototype.hasOwnProperty.call(sharedData.fileContentsCache, key);
|
||||
}
|
||||
function getFileContentsCacheFromKey(key) {
|
||||
return sharedData.fileContentsCache[key];
|
||||
}
|
||||
function setFileContentsCache(key, value) {
|
||||
return sharedData.fileContentsCache[getCacheKey(key)] = value;
|
||||
}
|
||||
function getSourceMapCache(key) {
|
||||
return sharedData.sourceMapCache[getCacheKey(key)];
|
||||
}
|
||||
function setSourceMapCache(key, value) {
|
||||
return sharedData.sourceMapCache[getCacheKey(key)] = value;
|
||||
}
|
||||
function clearCaches() {
|
||||
sharedData.fileContentsCache = Object.create(null);
|
||||
sharedData.sourceMapCache = Object.create(null);
|
||||
}
|
||||
// #endregion Caches
|
||||
|
||||
function handlerExec(list, internalList) {
|
||||
return function(arg) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var ret = list[i](arg);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < internalList.length; i++) {
|
||||
var ret = internalList[i](arg);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
var retrieveFile = handlerExec(sharedData.retrieveFileHandlers, sharedData.internalRetrieveFileHandlers);
|
||||
|
||||
sharedData.internalRetrieveFileHandlers.push(function(path) {
|
||||
// Trim the path to make sure there is no extra whitespace.
|
||||
path = path.trim();
|
||||
if (/^file:/.test(path)) {
|
||||
// existsSync/readFileSync can't handle file protocol, but once stripped, it works
|
||||
path = path.replace(/file:\/\/\/(\w:)?/, function(protocol, drive) {
|
||||
return drive ?
|
||||
'' : // file:///C:/dir/file -> C:/dir/file
|
||||
'/'; // file:///root-dir/file -> /root-dir/file
|
||||
});
|
||||
}
|
||||
const key = getCacheKey(path);
|
||||
if(hasFileContentsCacheFromKey(key)) {
|
||||
return getFileContentsCacheFromKey(key);
|
||||
}
|
||||
|
||||
var contents = '';
|
||||
try {
|
||||
if (!fs) {
|
||||
// Use SJAX if we are in the browser
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', path, /** async */ false);
|
||||
xhr.send(null);
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
contents = xhr.responseText;
|
||||
}
|
||||
} else if (fs.existsSync(path)) {
|
||||
// Otherwise, use the filesystem
|
||||
contents = fs.readFileSync(path, 'utf8');
|
||||
}
|
||||
} catch (er) {
|
||||
/* ignore any errors */
|
||||
}
|
||||
|
||||
return setFileContentsCache(path, contents);
|
||||
});
|
||||
|
||||
// Support URLs relative to a directory, but be careful about a protocol prefix
|
||||
// in case we are in the browser (i.e. directories may start with "http://" or "file:///")
|
||||
function supportRelativeURL(file, url) {
|
||||
if(!file) return url;
|
||||
// given that this happens within error formatting codepath, probably best to
|
||||
// fallback instead of throwing if anything goes wrong
|
||||
try {
|
||||
// if should output a URL
|
||||
if(isAbsoluteUrl(file) || isSchemeRelativeUrl(file)) {
|
||||
if(isAbsoluteUrl(url) || isSchemeRelativeUrl(url)) {
|
||||
return new URL(url, file).toString();
|
||||
}
|
||||
if(path.isAbsolute(url)) {
|
||||
return new URL(pathToFileURL(url), file).toString();
|
||||
}
|
||||
// url is relative path or URL
|
||||
return new URL(url.replace(/\\/g, '/'), file).toString();
|
||||
}
|
||||
// if should output a path (unless URL is something like https://)
|
||||
if(path.isAbsolute(file)) {
|
||||
if(isFileUrl(url)) {
|
||||
return fileURLToPath(url);
|
||||
}
|
||||
if(isSchemeRelativeUrl(url)) {
|
||||
return fileURLToPath(new URL(url, 'file://'));
|
||||
}
|
||||
if(isAbsoluteUrl(url)) {
|
||||
// url is a non-file URL
|
||||
// Go with the URL
|
||||
return url;
|
||||
}
|
||||
if(path.isAbsolute(url)) {
|
||||
// Normalize at all? decodeURI or normalize slashes?
|
||||
return path.normalize(url);
|
||||
}
|
||||
// url is relative path or URL
|
||||
return path.join(file, '..', decodeURI(url));
|
||||
}
|
||||
// If we get here, file is relative.
|
||||
// Shouldn't happen since node identifies modules with absolute paths or URLs.
|
||||
// But we can take a stab at returning something meaningful anyway.
|
||||
if(isAbsoluteUrl(url) || isSchemeRelativeUrl(url)) {
|
||||
return url;
|
||||
}
|
||||
return path.join(file, '..', url);
|
||||
} catch(e) {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
// Return pathOrUrl in the same style as matchStyleOf: either a file URL or a native path
|
||||
function matchStyleOfPathOrUrl(matchStyleOf, pathOrUrl) {
|
||||
try {
|
||||
if(isAbsoluteUrl(matchStyleOf) || isSchemeRelativeUrl(matchStyleOf)) {
|
||||
if(isAbsoluteUrl(pathOrUrl) || isSchemeRelativeUrl(pathOrUrl)) return pathOrUrl;
|
||||
if(path.isAbsolute(pathOrUrl)) return pathToFileURL(pathOrUrl).toString();
|
||||
} else if(path.isAbsolute(matchStyleOf)) {
|
||||
if(isAbsoluteUrl(pathOrUrl) || isSchemeRelativeUrl(pathOrUrl)) {
|
||||
return fileURLToPath(new URL(pathOrUrl, 'file://'));
|
||||
}
|
||||
}
|
||||
return pathOrUrl;
|
||||
} catch(e) {
|
||||
return pathOrUrl;
|
||||
}
|
||||
}
|
||||
|
||||
function retrieveSourceMapURL(source) {
|
||||
var fileData;
|
||||
|
||||
if (isInBrowser()) {
|
||||
try {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', source, false);
|
||||
xhr.send(null);
|
||||
fileData = xhr.readyState === 4 ? xhr.responseText : null;
|
||||
|
||||
// Support providing a sourceMappingURL via the SourceMap header
|
||||
var sourceMapHeader = xhr.getResponseHeader("SourceMap") ||
|
||||
xhr.getResponseHeader("X-SourceMap");
|
||||
if (sourceMapHeader) {
|
||||
return sourceMapHeader;
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
// Get the URL of the source map
|
||||
fileData = retrieveFile(tryFileURLToPath(source));
|
||||
var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
|
||||
// Keep executing the search to find the *last* sourceMappingURL to avoid
|
||||
// picking up sourceMappingURLs from comments, strings, etc.
|
||||
var lastMatch, match;
|
||||
while (match = re.exec(fileData)) lastMatch = match;
|
||||
if (!lastMatch) return null;
|
||||
return lastMatch[1];
|
||||
};
|
||||
|
||||
// Can be overridden by the retrieveSourceMap option to install. Takes a
|
||||
// generated source filename; returns a {map, optional url} object, or null if
|
||||
// there is no source map. The map field may be either a string or the parsed
|
||||
// JSON object (ie, it must be a valid argument to the SourceMapConsumer
|
||||
// constructor).
|
||||
/** @type {(source: string) => import('./source-map-support').UrlAndMap | null} */
|
||||
var retrieveSourceMap = handlerExec(sharedData.retrieveMapHandlers, sharedData.internalRetrieveMapHandlers);
|
||||
sharedData.internalRetrieveMapHandlers.push(function(source) {
|
||||
var sourceMappingURL = retrieveSourceMapURL(source);
|
||||
if (!sourceMappingURL) return null;
|
||||
|
||||
// Read the contents of the source map
|
||||
var sourceMapData;
|
||||
if (reSourceMap.test(sourceMappingURL)) {
|
||||
// Support source map URL as a data url
|
||||
var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(',') + 1);
|
||||
sourceMapData = Buffer.from(rawData, "base64").toString();
|
||||
sourceMappingURL = source;
|
||||
} else {
|
||||
// Support source map URLs relative to the source URL
|
||||
sourceMappingURL = supportRelativeURL(source, sourceMappingURL);
|
||||
sourceMapData = retrieveFile(tryFileURLToPath(sourceMappingURL));
|
||||
}
|
||||
|
||||
if (!sourceMapData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
url: sourceMappingURL,
|
||||
map: sourceMapData
|
||||
};
|
||||
});
|
||||
|
||||
function mapSourcePosition(position) {
|
||||
var sourceMap = getSourceMapCache(position.source);
|
||||
if (!sourceMap) {
|
||||
// Call the (overrideable) retrieveSourceMap function to get the source map.
|
||||
var urlAndMap = retrieveSourceMap(position.source);
|
||||
if (urlAndMap) {
|
||||
sourceMap = setSourceMapCache(position.source, {
|
||||
url: urlAndMap.url,
|
||||
map: new AnyMap(urlAndMap.map, urlAndMap.url)
|
||||
});
|
||||
|
||||
// Overwrite trace-mapping's resolutions, because they do not handle
|
||||
// Windows paths the way we want.
|
||||
// TODO Remove now that windows path support was added to resolve-uri and thus trace-mapping?
|
||||
sourceMap.map.resolvedSources = sourceMap.map.sources.map(s => supportRelativeURL(sourceMap.url, s));
|
||||
|
||||
// Load all sources stored inline with the source map into the file cache
|
||||
// to pretend like they are already loaded. They may not exist on disk.
|
||||
if (sourceMap.map.sourcesContent) {
|
||||
sourceMap.map.resolvedSources.forEach(function(resolvedSource, i) {
|
||||
var contents = sourceMap.map.sourcesContent[i];
|
||||
if (contents) {
|
||||
setFileContentsCache(resolvedSource, contents);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
sourceMap = setSourceMapCache(position.source, {
|
||||
url: null,
|
||||
map: null
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve the source URL relative to the URL of the source map
|
||||
if (sourceMap && sourceMap.map) {
|
||||
var originalPosition = originalPositionFor(sourceMap.map, position);
|
||||
|
||||
// Only return the original position if a matching line was found. If no
|
||||
// matching line is found then we return position instead, which will cause
|
||||
// the stack trace to print the path and line for the compiled file. It is
|
||||
// better to give a precise location in the compiled file than a vague
|
||||
// location in the original file.
|
||||
if (originalPosition.source !== null) {
|
||||
// originalPosition.source has *already* been resolved against sourceMap.url
|
||||
// so is *already* as absolute as possible.
|
||||
// However, we want to ensure we output in same format as input: URL or native path
|
||||
originalPosition.source = matchStyleOfPathOrUrl(
|
||||
position.source, originalPosition.source);
|
||||
return originalPosition;
|
||||
}
|
||||
}
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
// Parses code generated by FormatEvalOrigin(), a function inside V8:
|
||||
// https://code.google.com/p/v8/source/browse/trunk/src/messages.js
|
||||
function mapEvalOrigin(origin) {
|
||||
// Most eval() calls are in this format
|
||||
var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
|
||||
if (match) {
|
||||
var position = mapSourcePosition({
|
||||
source: match[2],
|
||||
line: +match[3],
|
||||
column: match[4] - 1
|
||||
});
|
||||
return 'eval at ' + match[1] + ' (' + position.source + ':' +
|
||||
position.line + ':' + (position.column + 1) + ')';
|
||||
}
|
||||
|
||||
// Parse nested eval() calls using recursion
|
||||
match = /^eval at ([^(]+) \((.+)\)$/.exec(origin);
|
||||
if (match) {
|
||||
return 'eval at ' + match[1] + ' (' + mapEvalOrigin(match[2]) + ')';
|
||||
}
|
||||
|
||||
// Make sure we still return useful information if we didn't find anything
|
||||
return origin;
|
||||
}
|
||||
|
||||
// This is copied almost verbatim from the V8 source code at
|
||||
// https://code.google.com/p/v8/source/browse/trunk/src/messages.js
|
||||
// Update 2022-04-29:
|
||||
// https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/builtins/builtins-callsite.cc#L175-L179
|
||||
// https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/objects/call-site-info.cc#L795-L804
|
||||
// https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/objects/call-site-info.cc#L717-L750
|
||||
// The implementation of wrapCallSite() used to just forward to the actual source
|
||||
// code of CallSite.prototype.toString but unfortunately a new release of V8
|
||||
// did something to the prototype chain and broke the shim. The only fix I
|
||||
// could find was copy/paste.
|
||||
function CallSiteToString() {
|
||||
var fileName;
|
||||
var fileLocation = "";
|
||||
if (this.isNative()) {
|
||||
fileLocation = "native";
|
||||
} else {
|
||||
fileName = this.getScriptNameOrSourceURL();
|
||||
if (!fileName && this.isEval()) {
|
||||
fileLocation = this.getEvalOrigin();
|
||||
fileLocation += ", "; // Expecting source position to follow.
|
||||
}
|
||||
|
||||
if (fileName) {
|
||||
fileLocation += fileName;
|
||||
} else {
|
||||
// Source code does not originate from a file and is not native, but we
|
||||
// can still get the source position inside the source string, e.g. in
|
||||
// an eval string.
|
||||
fileLocation += "<anonymous>";
|
||||
}
|
||||
var lineNumber = this.getLineNumber();
|
||||
if (lineNumber != null) {
|
||||
fileLocation += ":" + lineNumber;
|
||||
var columnNumber = this.getColumnNumber();
|
||||
if (columnNumber) {
|
||||
fileLocation += ":" + columnNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var line = "";
|
||||
var isAsync = this.isAsync ? this.isAsync() : false;
|
||||
if(isAsync) {
|
||||
line += 'async ';
|
||||
var isPromiseAll = this.isPromiseAll ? this.isPromiseAll() : false;
|
||||
var isPromiseAny = this.isPromiseAny ? this.isPromiseAny() : false;
|
||||
if(isPromiseAny || isPromiseAll) {
|
||||
line += isPromiseAll ? 'Promise.all (index ' : 'Promise.any (index ';
|
||||
var promiseIndex = this.getPromiseIndex();
|
||||
line += promiseIndex + ')';
|
||||
}
|
||||
}
|
||||
var functionName = this.getFunctionName();
|
||||
var addSuffix = true;
|
||||
var isConstructor = this.isConstructor();
|
||||
var isMethodCall = !(this.isToplevel() || isConstructor);
|
||||
if (isMethodCall) {
|
||||
var typeName = this.getTypeName();
|
||||
// Fixes shim to be backward compatable with Node v0 to v4
|
||||
if (typeName === "[object Object]") {
|
||||
typeName = "null";
|
||||
}
|
||||
var methodName = this.getMethodName();
|
||||
if (functionName) {
|
||||
if (typeName && functionName.indexOf(typeName) != 0) {
|
||||
line += typeName + ".";
|
||||
}
|
||||
line += functionName;
|
||||
if (methodName && functionName.indexOf("." + methodName) != functionName.length - methodName.length - 1) {
|
||||
line += " [as " + methodName + "]";
|
||||
}
|
||||
} else {
|
||||
line += typeName + "." + (methodName || "<anonymous>");
|
||||
}
|
||||
} else if (isConstructor) {
|
||||
line += "new " + (functionName || "<anonymous>");
|
||||
} else if (functionName) {
|
||||
line += functionName;
|
||||
} else {
|
||||
line += fileLocation;
|
||||
addSuffix = false;
|
||||
}
|
||||
if (addSuffix) {
|
||||
line += " (" + fileLocation + ")";
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
function cloneCallSite(frame) {
|
||||
var object = {};
|
||||
Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function(name) {
|
||||
object[name] = /^(?:is|get)/.test(name) ? function() { return frame[name].call(frame); } : frame[name];
|
||||
});
|
||||
object.toString = CallSiteToString;
|
||||
return object;
|
||||
}
|
||||
|
||||
function wrapCallSite(frame, state) {
|
||||
// provides interface backward compatibility
|
||||
if (state === undefined) {
|
||||
state = { nextPosition: null, curPosition: null }
|
||||
}
|
||||
if(frame.isNative()) {
|
||||
state.curPosition = null;
|
||||
return frame;
|
||||
}
|
||||
|
||||
// Most call sites will return the source file from getFileName(), but code
|
||||
// passed to eval() ending in "//# sourceURL=..." will return the source file
|
||||
// from getScriptNameOrSourceURL() instead
|
||||
var source = frame.getFileName() || frame.getScriptNameOrSourceURL();
|
||||
if (source) {
|
||||
// v8 does not expose its internal isWasm, etc methods, so we do this instead.
|
||||
if(source.startsWith('wasm://')) {
|
||||
state.curPosition = null;
|
||||
return frame;
|
||||
}
|
||||
|
||||
var line = frame.getLineNumber();
|
||||
var column = frame.getColumnNumber() - 1;
|
||||
|
||||
// Fix position in Node where some (internal) code is prepended.
|
||||
// See https://github.com/evanw/node-source-map-support/issues/36
|
||||
// Header removed in node at ^10.16 || >=11.11.0
|
||||
// v11 is not an LTS candidate, we can just test the one version with it.
|
||||
// Test node versions for: 10.16-19, 10.20+, 12-19, 20-99, 100+, or 11.11
|
||||
var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;
|
||||
var headerLength = noHeader.test(process.version) ? 0 : 62;
|
||||
if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
|
||||
column -= headerLength;
|
||||
}
|
||||
|
||||
var position = mapSourcePosition({
|
||||
source: source,
|
||||
line: line,
|
||||
column: column
|
||||
});
|
||||
state.curPosition = position;
|
||||
frame = cloneCallSite(frame);
|
||||
var originalFunctionName = frame.getFunctionName;
|
||||
frame.getFunctionName = function() {
|
||||
if (state.nextPosition == null) {
|
||||
return originalFunctionName();
|
||||
}
|
||||
return state.nextPosition.name || originalFunctionName();
|
||||
};
|
||||
frame.getFileName = function() { return position.source; };
|
||||
frame.getLineNumber = function() { return position.line; };
|
||||
frame.getColumnNumber = function() { return position.column + 1; };
|
||||
frame.getScriptNameOrSourceURL = function() { return position.source; };
|
||||
return frame;
|
||||
}
|
||||
|
||||
// Code called using eval() needs special handling
|
||||
var origin = frame.isEval() && frame.getEvalOrigin();
|
||||
if (origin) {
|
||||
origin = mapEvalOrigin(origin);
|
||||
frame = cloneCallSite(frame);
|
||||
frame.getEvalOrigin = function() { return origin; };
|
||||
return frame;
|
||||
}
|
||||
|
||||
// If we get here then we were unable to change the source position
|
||||
return frame;
|
||||
}
|
||||
|
||||
var kIsNodeError = undefined;
|
||||
try {
|
||||
// Get a deliberate ERR_INVALID_ARG_TYPE
|
||||
// TODO is there a better way to reliably get an instance of NodeError?
|
||||
path.resolve(123);
|
||||
} catch(e) {
|
||||
const symbols = Object.getOwnPropertySymbols(e);
|
||||
const symbol = symbols.find(function (s) {return s.toString().indexOf('kIsNodeError') >= 0});
|
||||
if(symbol) kIsNodeError = symbol;
|
||||
}
|
||||
|
||||
const ErrorPrototypeToString = (err) =>Error.prototype.toString.call(err);
|
||||
|
||||
/** @param {HookState} hookState */
|
||||
function createPrepareStackTrace(hookState) {
|
||||
return prepareStackTrace;
|
||||
|
||||
// This function is part of the V8 stack trace API, for more info see:
|
||||
// https://v8.dev/docs/stack-trace-api
|
||||
function prepareStackTrace(error, stack) {
|
||||
if(!hookState.enabled) return hookState.originalValue.apply(this, arguments);
|
||||
|
||||
if (sharedData.emptyCacheBetweenOperations) {
|
||||
clearCaches();
|
||||
}
|
||||
|
||||
// node gives its own errors special treatment. Mimic that behavior
|
||||
// https://github.com/nodejs/node/blob/3cbaabc4622df1b4009b9d026a1a970bdbae6e89/lib/internal/errors.js#L118-L128
|
||||
// https://github.com/nodejs/node/pull/39182
|
||||
var errorString;
|
||||
if (kIsNodeError) {
|
||||
if(kIsNodeError in error) {
|
||||
errorString = `${error.name} [${error.code}]: ${error.message}`;
|
||||
} else {
|
||||
errorString = ErrorPrototypeToString(error);
|
||||
}
|
||||
} else {
|
||||
var name = error.name || 'Error';
|
||||
var message = error.message || '';
|
||||
errorString = message ? name + ": " + message : name;
|
||||
}
|
||||
|
||||
var state = { nextPosition: null, curPosition: null };
|
||||
var processedStack = [];
|
||||
for (var i = stack.length - 1; i >= 0; i--) {
|
||||
processedStack.push('\n at ' + wrapCallSite(stack[i], state));
|
||||
state.nextPosition = state.curPosition;
|
||||
}
|
||||
state.curPosition = state.nextPosition = null;
|
||||
return errorString + processedStack.reverse().join('');
|
||||
}
|
||||
}
|
||||
|
||||
// Generate position and snippet of original source with pointer
|
||||
function getErrorSource(error) {
|
||||
var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
|
||||
if (match) {
|
||||
var source = match[1];
|
||||
var line = +match[2];
|
||||
var column = +match[3];
|
||||
|
||||
// Support the inline sourceContents inside the source map
|
||||
var contents = getFileContentsCache(source);
|
||||
|
||||
const sourceAsPath = tryFileURLToPath(source);
|
||||
|
||||
// Support files on disk
|
||||
if (!contents && fs && fs.existsSync(sourceAsPath)) {
|
||||
try {
|
||||
contents = fs.readFileSync(sourceAsPath, 'utf8');
|
||||
} catch (er) {
|
||||
contents = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Format the line from the original source code like node does
|
||||
if (contents) {
|
||||
var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1];
|
||||
if (code) {
|
||||
return source + ':' + line + '\n' + code + '\n' +
|
||||
new Array(column).join(' ') + '^';
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function printFatalErrorUponExit (error) {
|
||||
var source = getErrorSource(error);
|
||||
|
||||
// Ensure error is printed synchronously and not truncated
|
||||
if (process.stderr._handle && process.stderr._handle.setBlocking) {
|
||||
process.stderr._handle.setBlocking(true);
|
||||
}
|
||||
|
||||
if (source) {
|
||||
console.error(source);
|
||||
}
|
||||
|
||||
// Matches node's behavior for colorized output
|
||||
console.error(
|
||||
util.inspect(error, {
|
||||
customInspect: false,
|
||||
colors: process.stderr.isTTY
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
function shimEmitUncaughtException () {
|
||||
const originalValue = process.emit;
|
||||
var hook = sharedData.processEmitHook = {
|
||||
enabled: true,
|
||||
originalValue,
|
||||
installedValue: undefined
|
||||
};
|
||||
var isTerminatingDueToFatalException = false;
|
||||
var fatalException;
|
||||
|
||||
process.emit = sharedData.processEmitHook.installedValue = function (type) {
|
||||
const hadListeners = originalValue.apply(this, arguments);
|
||||
if(hook.enabled) {
|
||||
if (type === 'uncaughtException' && !hadListeners) {
|
||||
isTerminatingDueToFatalException = true;
|
||||
fatalException = arguments[1];
|
||||
process.exit(1);
|
||||
}
|
||||
if (type === 'exit' && isTerminatingDueToFatalException) {
|
||||
printFatalErrorUponExit(fatalException);
|
||||
}
|
||||
}
|
||||
return hadListeners;
|
||||
};
|
||||
}
|
||||
|
||||
var originalRetrieveFileHandlers = sharedData.retrieveFileHandlers.slice(0);
|
||||
var originalRetrieveMapHandlers = sharedData.retrieveMapHandlers.slice(0);
|
||||
|
||||
exports.wrapCallSite = wrapCallSite;
|
||||
exports.getErrorSource = getErrorSource;
|
||||
exports.mapSourcePosition = mapSourcePosition;
|
||||
exports.retrieveSourceMap = retrieveSourceMap;
|
||||
|
||||
exports.install = function(options) {
|
||||
options = options || {};
|
||||
|
||||
if (options.environment) {
|
||||
environment = options.environment;
|
||||
if (["node", "browser", "auto"].indexOf(environment) === -1) {
|
||||
throw new Error("environment " + environment + " was unknown. Available options are {auto, browser, node}")
|
||||
}
|
||||
}
|
||||
|
||||
// Use dynamicRequire to avoid including in browser bundles
|
||||
var Module = dynamicRequire(module, 'module');
|
||||
|
||||
// Redirect subsequent imports of "source-map-support"
|
||||
// to this package
|
||||
const {redirectConflictingLibrary = true, onConflictingLibraryRedirect} = options;
|
||||
if(redirectConflictingLibrary) {
|
||||
if (!sharedData.moduleResolveFilenameHook) {
|
||||
const originalValue = Module._resolveFilename;
|
||||
const moduleResolveFilenameHook = sharedData.moduleResolveFilenameHook = {
|
||||
enabled: true,
|
||||
originalValue,
|
||||
installedValue: undefined,
|
||||
}
|
||||
Module._resolveFilename = sharedData.moduleResolveFilenameHook.installedValue = function (request, parent, isMain, options) {
|
||||
if (moduleResolveFilenameHook.enabled) {
|
||||
// Match all source-map-support entrypoints: source-map-support, source-map-support/register
|
||||
let requestRedirect;
|
||||
if (request === 'source-map-support') {
|
||||
requestRedirect = './';
|
||||
} else if (request === 'source-map-support/register') {
|
||||
requestRedirect = './register';
|
||||
}
|
||||
|
||||
if (requestRedirect !== undefined) {
|
||||
const newRequest = require.resolve(requestRedirect);
|
||||
for (const cb of sharedData.onConflictingLibraryRedirectArr) {
|
||||
cb(request, parent, isMain, options, newRequest);
|
||||
}
|
||||
request = newRequest;
|
||||
}
|
||||
}
|
||||
|
||||
return originalValue.call(this, request, parent, isMain, options);
|
||||
}
|
||||
}
|
||||
if (onConflictingLibraryRedirect) {
|
||||
sharedData.onConflictingLibraryRedirectArr.push(onConflictingLibraryRedirect);
|
||||
}
|
||||
}
|
||||
|
||||
// Allow sources to be found by methods other than reading the files
|
||||
// directly from disk.
|
||||
if (options.retrieveFile) {
|
||||
if (options.overrideRetrieveFile) {
|
||||
sharedData.retrieveFileHandlers.length = 0;
|
||||
}
|
||||
|
||||
sharedData.retrieveFileHandlers.unshift(options.retrieveFile);
|
||||
}
|
||||
|
||||
// Allow source maps to be found by methods other than reading the files
|
||||
// directly from disk.
|
||||
if (options.retrieveSourceMap) {
|
||||
if (options.overrideRetrieveSourceMap) {
|
||||
sharedData.retrieveMapHandlers.length = 0;
|
||||
}
|
||||
|
||||
sharedData.retrieveMapHandlers.unshift(options.retrieveSourceMap);
|
||||
}
|
||||
|
||||
// Support runtime transpilers that include inline source maps
|
||||
if (options.hookRequire && !isInBrowser()) {
|
||||
var $compile = Module.prototype._compile;
|
||||
|
||||
if (!$compile.__sourceMapSupport) {
|
||||
Module.prototype._compile = function(content, filename) {
|
||||
setFileContentsCache(filename, content);
|
||||
setSourceMapCache(filename, undefined);
|
||||
return $compile.call(this, content, filename);
|
||||
};
|
||||
|
||||
Module.prototype._compile.__sourceMapSupport = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Configure options
|
||||
if (!sharedData.emptyCacheBetweenOperations) {
|
||||
sharedData.emptyCacheBetweenOperations = 'emptyCacheBetweenOperations' in options ?
|
||||
options.emptyCacheBetweenOperations : false;
|
||||
}
|
||||
|
||||
|
||||
// Install the error reformatter
|
||||
if (!sharedData.errorPrepareStackTraceHook) {
|
||||
const originalValue = Error.prepareStackTrace;
|
||||
sharedData.errorPrepareStackTraceHook = {
|
||||
enabled: true,
|
||||
originalValue,
|
||||
installedValue: undefined
|
||||
};
|
||||
Error.prepareStackTrace = sharedData.errorPrepareStackTraceHook.installedValue = createPrepareStackTrace(sharedData.errorPrepareStackTraceHook);
|
||||
}
|
||||
|
||||
if (!sharedData.processEmitHook) {
|
||||
var installHandler = 'handleUncaughtExceptions' in options ?
|
||||
options.handleUncaughtExceptions : true;
|
||||
|
||||
// Do not override 'uncaughtException' with our own handler in Node.js
|
||||
// Worker threads. Workers pass the error to the main thread as an event,
|
||||
// rather than printing something to stderr and exiting.
|
||||
try {
|
||||
// We need to use `dynamicRequire` because `require` on it's own will be optimized by WebPack/Browserify.
|
||||
var worker_threads = dynamicRequire(module, 'worker_threads');
|
||||
if (worker_threads.isMainThread === false) {
|
||||
installHandler = false;
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
// Provide the option to not install the uncaught exception handler. This is
|
||||
// to support other uncaught exception handlers (in test frameworks, for
|
||||
// example). If this handler is not installed and there are no other uncaught
|
||||
// exception handlers, uncaught exceptions will be caught by node's built-in
|
||||
// exception handler and the process will still be terminated. However, the
|
||||
// generated JavaScript code will be shown above the stack trace instead of
|
||||
// the original source code.
|
||||
if (installHandler && hasGlobalProcessEventEmitter()) {
|
||||
shimEmitUncaughtException();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.uninstall = function() {
|
||||
if(sharedData.processEmitHook) {
|
||||
// Disable behavior
|
||||
sharedData.processEmitHook.enabled = false;
|
||||
// If possible, remove our hook function. May not be possible if subsequent third-party hooks have wrapped around us.
|
||||
if(process.emit === sharedData.processEmitHook.installedValue) {
|
||||
process.emit = sharedData.processEmitHook.originalValue;
|
||||
}
|
||||
sharedData.processEmitHook = undefined;
|
||||
}
|
||||
if(sharedData.errorPrepareStackTraceHook) {
|
||||
// Disable behavior
|
||||
sharedData.errorPrepareStackTraceHook.enabled = false;
|
||||
// If possible or necessary, remove our hook function.
|
||||
// In vanilla environments, prepareStackTrace is `undefined`.
|
||||
// We cannot delegate to `undefined` the way we can to a function w/`.apply()`; our only option is to remove the function.
|
||||
// If we are the *first* hook installed, and another was installed on top of us, we have no choice but to remove both.
|
||||
if(Error.prepareStackTrace === sharedData.errorPrepareStackTraceHook.installedValue || typeof sharedData.errorPrepareStackTraceHook.originalValue !== 'function') {
|
||||
Error.prepareStackTrace = sharedData.errorPrepareStackTraceHook.originalValue;
|
||||
}
|
||||
sharedData.errorPrepareStackTraceHook = undefined;
|
||||
}
|
||||
if (sharedData.moduleResolveFilenameHook) {
|
||||
// Disable behavior
|
||||
sharedData.moduleResolveFilenameHook.enabled = false;
|
||||
// If possible, remove our hook function. May not be possible if subsequent third-party hooks have wrapped around us.
|
||||
var Module = dynamicRequire(module, 'module');
|
||||
if(Module._resolveFilename === sharedData.moduleResolveFilenameHook.installedValue) {
|
||||
Module._resolveFilename = sharedData.moduleResolveFilenameHook.originalValue;
|
||||
}
|
||||
sharedData.moduleResolveFilenameHook = undefined;
|
||||
}
|
||||
sharedData.onConflictingLibraryRedirectArr.length = 0;
|
||||
}
|
||||
|
||||
exports.resetRetrieveHandlers = function() {
|
||||
sharedData.retrieveFileHandlers.length = 0;
|
||||
sharedData.retrieveMapHandlers.length = 0;
|
||||
}
|
21
node_modules/@grammyjs/types/LICENSE
generated
vendored
21
node_modules/@grammyjs/types/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021-2023 KnorpelSenf
|
||||
|
||||
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.
|
107
node_modules/@grammyjs/types/README.md
generated
vendored
107
node_modules/@grammyjs/types/README.md
generated
vendored
@ -1,107 +0,0 @@
|
||||
# Telegram Bot API types for grammY
|
||||
|
||||
[grammY](https://github.com/grammyjs/grammY) makes writing Telegram bots easy. Check it out!
|
||||
|
||||
This package just provides type annotations for the complete Telegram Bot API, and applies various transformations to make them usable for grammY. It contains no runnable code.
|
||||
|
||||
Originally, this package is based on `typegram`, but since the update to Telegram Bot API 5.1, `typegram` is no longer directly updated. Instead, this package is maintained and its updates are backported to `typegram`. Hence, both packages are kept up to date with the Telegram Bot API for now.
|
||||
|
||||
## Available Types
|
||||
|
||||
Generally this package just exposes a huge load of `interface`s that correspond to the **types** used throughout the Telegram Bot API.
|
||||
|
||||
Note that the API specification sometimes only has one name for multiple variants of a type, e.g. there is a number of different `Update`s you can receive, but they're all just called `Update`.
|
||||
If you need to access the individual variants of an `Update`, refer to `Update.MessageUpdate` and its siblings.
|
||||
|
||||
In fact, this pattern is used for various types, namely:
|
||||
|
||||
- `CallbackQuery`
|
||||
- `Chat`
|
||||
- `ChatFromGetChat`
|
||||
- `InlineKeyboardButton`
|
||||
- `KeyboardButton`
|
||||
- `Message`
|
||||
- `MessageEntity`
|
||||
- `Location`
|
||||
- `Update`
|
||||
|
||||
Naturally, when the API specification is actually modelling types to be unions (e.g. `InlineQueryResult`), this is reflected here as a union type, too.
|
||||
Those types are not closed.
|
||||
|
||||
## Available Methods
|
||||
|
||||
In addition to the types, this package provides you with another type `Telegram` which contains all available **methods** of the API.
|
||||
There is no further structure applied to this, but if you can come up with something reasonable, please suggest it in an issue or directly open a PR.
|
||||
In grammY, these types are what defines the `bot.api.raw` object.
|
||||
|
||||
Each method takes just a single argument with a structure that corresponds to the object expected by Telegram.
|
||||
The helper type `Opts<M>` (where `M` is the method name) allows grammY to access that type directly.
|
||||
|
||||
## Handling JSON-Serialized Objects
|
||||
|
||||
Some methods of the Telegram Bot API are expected to be called with JSON-serialized objects contained in a property of the payload, rather than an actual JSON payload.
|
||||
In other words, the objects are serialized twice—the first time in order to conform with the docs, and the second time when the payload is actually sent in the POST body to the API server.
|
||||
|
||||
The most prominent example is the `reply_markup` property that appears in a number of different methods, but more than a dozen other properties like this can be found throughout the API.
|
||||
|
||||
Strictly speaking, the `@grammyjs/types` types do not reflect this accurately.
|
||||
Instead of using `string` (representing a serialized object) as the type, `@grammyjs/types` uses the type of the object itself, thus ignoring the serialization step.
|
||||
For instance, instead of declaring `reply_markup: string`, it declares the property as `reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply` because that is what is supposed to be serialized to `string` before calling the respective method.
|
||||
|
||||
That makes sense for the reason that grammY uses the types in its wrapper code around the Telegram Bot API, exposed as `bot.raw.api`.
|
||||
This wrapper code does the necessary JSON serialization automatically for the required properties.
|
||||
Bots written with grammY then do not need to care about which properties to serialize and which not.
|
||||
Given that `@grammyjs/types` refers to the objects themselves instead of their serialized strings, the wrapper code can now simply expose the `@grammyjs/types` types to its consumers without having to transform them before.
|
||||
|
||||
Consequently, the descriptions of all methods are adjusted in order to reflect this, i.e. the JSDoc comments do not mention JSON serialization (in contrast to their official equivalents).
|
||||
|
||||
## Customizing `InputFile`
|
||||
|
||||
The Telegram Bot API lets bots send files in [three different ways](https://core.telegram.org/bots/api#sending-files).
|
||||
Two of those ways are by specifying a `string`—either a `file_id` or a URL.
|
||||
The third option, however, is by uploading files to the server using multipart/form-data.
|
||||
|
||||
The first two means to send a file are already covered by the type annotations across the library.
|
||||
In all places where a `file_id` or a URL is permitted, the corresponding property allows a `string`.
|
||||
|
||||
We will now look at the type declarations that are relevant for uploading files directly.
|
||||
grammY automatically translates calls to `sendDocument` and the like to multipart/form-data uploads when supplied with an `InputFile` object in the `document` property of the argument object.
|
||||
|
||||
`@grammyjs/types` should not have to know what objects you want to support as `InputFile`s.
|
||||
Consequently, the type `InputFile` is not defined in this library.
|
||||
|
||||
Instead, grammY specifies its own version of what an `InputFile` is, hence automatically adjusting `@grammyjs/types` with a custom `InputFile` type used throughout all affected methods and interfaces.
|
||||
This is possible by adding a type parameter to all affected types.
|
||||
grammY then import types parametrises these types with its version of `InputFile`, and re-exports the adjusted types.
|
||||
This is why you should always import Bot API as described here: <https://grammy.dev/guide/api.html#type-definitions-for-the-api>.
|
||||
|
||||
## Differences to the Bot API
|
||||
|
||||
Some documentation strings are intentionally different from what is written on the website.
|
||||
The actual type definitions themselves are never different.
|
||||
|
||||
1. No formatting.
|
||||
We do not leverage the markdown capabilities of JSDoc for the sake of easier copying and thus reduced maintenance efforts.
|
||||
2. No mentions of `JSON-serialized`.
|
||||
As underlying libraries handle serialization, these words are removed from the explanations.
|
||||
3. No mentions of integer numbers that exceed 2^31 but not 2^51.
|
||||
All numbers are 64-bit floats in JS, so this is irrelevant.
|
||||
Note that JS bit operators cast numbers to 32-bit integers and back, but we deliberately ignore this because people who use bit operators on identifiers or file sizes should know what they're doing, and they should also know that it's a bad idea.
|
||||
4. No `More info on Sending Files »`.
|
||||
File handling is abstracted away by the underlying library.
|
||||
Also, without the links, it's useless anyway.
|
||||
The same is true for the links to more info about requesting chats and users.
|
||||
5. No images.
|
||||
Documentation strings containing an image are adjusted to make sense without the images, too.
|
||||
|
||||
## Contributing
|
||||
|
||||
This is a Deno project.
|
||||
All the files are TypeScript files that are published on <https://deno.land/x/grammy_types>.
|
||||
This project uses [deno2node](https://github.com/fromdeno/deno2node) to emit declaration files which are then published on npm.
|
||||
|
||||
If you want to work on this, you do not need to have Node.js installed.
|
||||
You also should not run `npm install`.
|
||||
You only need [Deno](https://deno.land) and the VSCode extensions recommended in this repo.
|
||||
|
||||
Run `deno task` to see available development scripts.
|
22
node_modules/@grammyjs/types/api.d.ts
generated
vendored
22
node_modules/@grammyjs/types/api.d.ts
generated
vendored
@ -1,22 +0,0 @@
|
||||
export interface ApiError {
|
||||
ok: false;
|
||||
error_code: number;
|
||||
description: string;
|
||||
parameters?: ResponseParameters;
|
||||
}
|
||||
export interface ApiSuccess<T> {
|
||||
ok: true;
|
||||
result: T;
|
||||
}
|
||||
/** The response contains an object, which always has a Boolean field 'ok' and may have an optional String field 'description' with a human-readable description of the result. If 'ok' equals true, the request was successful and the result of the query can be found in the 'result' field. In case of an unsuccessful request, 'ok' equals false and the error is explained in the 'description'. An Integer 'error_code' field is also returned, but its contents are subject to change in the future. Some errors may also have an optional field 'parameters' of the type ResponseParameters, which can help to automatically handle the error.
|
||||
|
||||
All methods in the Bot API are case-insensitive.
|
||||
All queries must be made using UTF-8. */
|
||||
export type ApiResponse<T> = ApiError | ApiSuccess<T>;
|
||||
/** Describes why a request was unsuccessful. */
|
||||
export interface ResponseParameters {
|
||||
/** The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
|
||||
migrate_to_chat_id?: number;
|
||||
/** In case of exceeding flood control, the number of seconds left to wait before the request can be repeated */
|
||||
retry_after?: number;
|
||||
}
|
681
node_modules/@grammyjs/types/inline.d.ts
generated
vendored
681
node_modules/@grammyjs/types/inline.d.ts
generated
vendored
@ -1,681 +0,0 @@
|
||||
import type { Chat, User } from "./manage.js";
|
||||
import type { InlineKeyboardMarkup, WebAppInfo } from "./markup.js";
|
||||
import type { Location, MessageEntity, ParseMode } from "./message.js";
|
||||
import type { LabeledPrice } from "./payment.js";
|
||||
/** This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. */
|
||||
export interface InlineQuery {
|
||||
/** Unique identifier for this query */
|
||||
id: string;
|
||||
/** Sender */
|
||||
from: User;
|
||||
/** Text of the query (up to 256 characters) */
|
||||
query: string;
|
||||
/** Offset of the results to be returned, can be controlled by the bot */
|
||||
offset: string;
|
||||
/** Type of the chat from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat */
|
||||
chat_type?: "sender" | Chat["type"];
|
||||
/** Sender location, only for bots that request user location */
|
||||
location?: Location;
|
||||
}
|
||||
/** This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
|
||||
- InlineQueryResultCachedAudio
|
||||
- InlineQueryResultCachedDocument
|
||||
- InlineQueryResultCachedGif
|
||||
- InlineQueryResultCachedMpeg4Gif
|
||||
- InlineQueryResultCachedPhoto
|
||||
- InlineQueryResultCachedSticker
|
||||
- InlineQueryResultCachedVideo
|
||||
- InlineQueryResultCachedVoice
|
||||
- InlineQueryResultArticle
|
||||
- InlineQueryResultAudio
|
||||
- InlineQueryResultContact
|
||||
- InlineQueryResultGame
|
||||
- InlineQueryResultDocument
|
||||
- InlineQueryResultGif
|
||||
- InlineQueryResultLocation
|
||||
- InlineQueryResultMpeg4Gif
|
||||
- InlineQueryResultPhoto
|
||||
- InlineQueryResultVenue
|
||||
- InlineQueryResultVideo
|
||||
- InlineQueryResultVoice
|
||||
|
||||
Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be public. */
|
||||
export type InlineQueryResult = InlineQueryResultCachedAudio | InlineQueryResultCachedDocument | InlineQueryResultCachedGif | InlineQueryResultCachedMpeg4Gif | InlineQueryResultCachedPhoto | InlineQueryResultCachedSticker | InlineQueryResultCachedVideo | InlineQueryResultCachedVoice | InlineQueryResultArticle | InlineQueryResultAudio | InlineQueryResultContact | InlineQueryResultGame | InlineQueryResultDocument | InlineQueryResultGif | InlineQueryResultLocation | InlineQueryResultMpeg4Gif | InlineQueryResultPhoto | InlineQueryResultVenue | InlineQueryResultVideo | InlineQueryResultVoice;
|
||||
/** Represents a link to an article or web page. */
|
||||
export interface InlineQueryResultArticle {
|
||||
/** Type of the result, must be article */
|
||||
type: "article";
|
||||
/** Unique identifier for this result, 1-64 Bytes */
|
||||
id: string;
|
||||
/** Title of the result */
|
||||
title: string;
|
||||
/** Content of the message to be sent */
|
||||
input_message_content: InputMessageContent;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** URL of the result */
|
||||
url?: string;
|
||||
/** Pass True if you don't want the URL to be shown in the message */
|
||||
hide_url?: boolean;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Url of the thumbnail for the result */
|
||||
thumbnail_url?: string;
|
||||
/** Thumbnail width */
|
||||
thumbnail_width?: number;
|
||||
/** Thumbnail height */
|
||||
thumbnail_height?: number;
|
||||
}
|
||||
/** Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. */
|
||||
export interface InlineQueryResultPhoto {
|
||||
/** Type of the result, must be photo */
|
||||
type: "photo";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL of the photo. Photo must be in jpeg format. Photo size must not exceed 5MB */
|
||||
photo_url: string;
|
||||
/** URL of the thumbnail for the photo */
|
||||
thumbnail_url: string;
|
||||
/** Width of the photo */
|
||||
photo_width?: number;
|
||||
/** Height of the photo */
|
||||
photo_height?: number;
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Caption of the photo to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the photo caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the photo */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */
|
||||
export interface InlineQueryResultGif {
|
||||
/** Type of the result, must be gif */
|
||||
type: "gif";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL for the GIF file. File size must not exceed 1MB */
|
||||
gif_url: string;
|
||||
/** Width of the GIF */
|
||||
gif_width?: number;
|
||||
/** Height of the GIF */
|
||||
gif_height?: number;
|
||||
/** Duration of the GIF in seconds */
|
||||
gif_duration?: number;
|
||||
/** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
|
||||
thumbnail_url: string;
|
||||
/** MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” */
|
||||
thumbnail_mime_type?: "image/jpeg" | "image/gif" | "video/mp4";
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Caption of the GIF file to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the GIF animation */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */
|
||||
export interface InlineQueryResultMpeg4Gif {
|
||||
/** Type of the result, must be mpeg4_gif */
|
||||
type: "mpeg4_gif";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL for the MPEG4 file. File size must not exceed 1MB */
|
||||
mpeg4_url: string;
|
||||
/** Video width */
|
||||
mpeg4_width?: number;
|
||||
/** Video height */
|
||||
mpeg4_height?: number;
|
||||
/** Video duration in seconds */
|
||||
mpeg4_duration?: number;
|
||||
/** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
|
||||
thumbnail_url: string;
|
||||
/** MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” */
|
||||
thumbnail_mime_type?: "image/jpeg" | "image/gif" | "video/mp4";
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the video animation */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
|
||||
|
||||
If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content. */
|
||||
export interface InlineQueryResultVideo {
|
||||
/** Type of the result, must be video */
|
||||
type: "video";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL for the embedded video player or video file */
|
||||
video_url: string;
|
||||
/** MIME type of the content of the video URL, “text/html” or “video/mp4” */
|
||||
mime_type: "text/html" | "video/mp4";
|
||||
/** URL of the thumbnail (JPEG only) for the video */
|
||||
thumbnail_url: string;
|
||||
/** Title for the result */
|
||||
title: string;
|
||||
/** Caption of the video to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the video caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Video width */
|
||||
video_width?: number;
|
||||
/** Video height */
|
||||
video_height?: number;
|
||||
/** Video duration in seconds */
|
||||
video_duration?: number;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video). */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultAudio {
|
||||
/** Type of the result, must be audio */
|
||||
type: "audio";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL for the audio file */
|
||||
audio_url: string;
|
||||
/** Title */
|
||||
title: string;
|
||||
/** Caption, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the audio caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Performer */
|
||||
performer?: string;
|
||||
/** Audio duration in seconds */
|
||||
audio_duration?: number;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the audio */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultVoice {
|
||||
/** Type of the result, must be voice */
|
||||
type: "voice";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid URL for the voice recording */
|
||||
voice_url: string;
|
||||
/** Recording title */
|
||||
title: string;
|
||||
/** Caption, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the voice message caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Recording duration in seconds */
|
||||
voice_duration?: number;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the voice recording */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultDocument {
|
||||
/** Type of the result, must be document */
|
||||
type: "document";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** Title for the result */
|
||||
title: string;
|
||||
/** Caption of the document to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the document caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** A valid URL for the file */
|
||||
document_url: string;
|
||||
/** MIME type of the content of the file, either “application/pdf” or “application/zip” */
|
||||
mime_type: "application/pdf" | "application/zip";
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the file */
|
||||
input_message_content?: InputMessageContent;
|
||||
/** URL of the thumbnail (JPEG only) for the file */
|
||||
thumbnail_url?: string;
|
||||
/** Thumbnail width */
|
||||
thumbnail_width?: number;
|
||||
/** Thumbnail height */
|
||||
thumbnail_height?: number;
|
||||
}
|
||||
/** Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultLocation {
|
||||
/** Type of the result, must be location */
|
||||
type: "location";
|
||||
/** Unique identifier for this result, 1-64 Bytes */
|
||||
id: string;
|
||||
/** Location latitude in degrees */
|
||||
latitude: number;
|
||||
/** Location longitude in degrees */
|
||||
longitude: number;
|
||||
/** Location title */
|
||||
title: string;
|
||||
/** The radius of uncertainty for the location, measured in meters; 0-1500 */
|
||||
horizontal_accuracy?: number;
|
||||
/** Period in seconds for which the location can be updated, should be between 60 and 86400. */
|
||||
live_period?: number;
|
||||
/** The direction in which user is moving, in degrees; 1-360. For active live locations only. */
|
||||
heading?: number;
|
||||
/** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
|
||||
proximity_alert_radius?: number;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the location */
|
||||
input_message_content?: InputMessageContent;
|
||||
/** Url of the thumbnail for the result */
|
||||
thumbnail_url?: string;
|
||||
/** Thumbnail width */
|
||||
thumbnail_width?: number;
|
||||
/** Thumbnail height */
|
||||
thumbnail_height?: number;
|
||||
}
|
||||
/** Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultVenue {
|
||||
/** Type of the result, must be venue */
|
||||
type: "venue";
|
||||
/** Unique identifier for this result, 1-64 Bytes */
|
||||
id: string;
|
||||
/** Latitude of the venue location in degrees */
|
||||
latitude: number;
|
||||
/** Longitude of the venue location in degrees */
|
||||
longitude: number;
|
||||
/** Title of the venue */
|
||||
title: string;
|
||||
/** Address of the venue */
|
||||
address: string;
|
||||
/** Foursquare identifier of the venue if known */
|
||||
foursquare_id?: string;
|
||||
/** Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */
|
||||
foursquare_type?: string;
|
||||
/** Google Places identifier of the venue */
|
||||
google_place_id?: string;
|
||||
/** Google Places type of the venue. (See supported types.) */
|
||||
google_place_type?: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the venue */
|
||||
input_message_content?: InputMessageContent;
|
||||
/** Url of the thumbnail for the result */
|
||||
thumbnail_url?: string;
|
||||
/** Thumbnail width */
|
||||
thumbnail_width?: number;
|
||||
/** Thumbnail height */
|
||||
thumbnail_height?: number;
|
||||
}
|
||||
/** Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultContact {
|
||||
/** Type of the result, must be contact */
|
||||
type: "contact";
|
||||
/** Unique identifier for this result, 1-64 Bytes */
|
||||
id: string;
|
||||
/** Contact's phone number */
|
||||
phone_number: string;
|
||||
/** Contact's first name */
|
||||
first_name: string;
|
||||
/** Contact's last name */
|
||||
last_name?: string;
|
||||
/** Additional data about the contact in the form of a vCard, 0-2048 bytes */
|
||||
vcard?: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the contact */
|
||||
input_message_content?: InputMessageContent;
|
||||
/** Url of the thumbnail for the result */
|
||||
thumbnail_url?: string;
|
||||
/** Thumbnail width */
|
||||
thumbnail_width?: number;
|
||||
/** Thumbnail height */
|
||||
thumbnail_height?: number;
|
||||
}
|
||||
/** Represents a Game.
|
||||
|
||||
Note: This will only work in Telegram versions released after October 1, 2016. Older clients will not display any inline results if a game result is among them. */
|
||||
export interface InlineQueryResultGame {
|
||||
/** Type of the result, must be game */
|
||||
type: "game";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** Short name of the game */
|
||||
game_short_name: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
}
|
||||
/** Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. */
|
||||
export interface InlineQueryResultCachedPhoto {
|
||||
/** Type of the result, must be photo */
|
||||
type: "photo";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier of the photo */
|
||||
photo_file_id: string;
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Caption of the photo to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the photo caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the photo */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation. */
|
||||
export interface InlineQueryResultCachedGif {
|
||||
/** Type of the result, must be gif */
|
||||
type: "gif";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier for the GIF file */
|
||||
gif_file_id: string;
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Caption of the GIF file to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the GIF animation */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */
|
||||
export interface InlineQueryResultCachedMpeg4Gif {
|
||||
/** Type of the result, must be mpeg4_gif */
|
||||
type: "mpeg4_gif";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier for the MPEG4 file */
|
||||
mpeg4_file_id: string;
|
||||
/** Title for the result */
|
||||
title?: string;
|
||||
/** Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the video animation */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016 for static stickers and after 06 July, 2019 for animated stickers. Older clients will ignore them.
|
||||
*/
|
||||
export interface InlineQueryResultCachedSticker {
|
||||
/** Type of the result, must be sticker */
|
||||
type: "sticker";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier of the sticker */
|
||||
sticker_file_id: string;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the sticker */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultCachedDocument {
|
||||
/** Type of the result, must be document */
|
||||
type: "document";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** Title for the result */
|
||||
title: string;
|
||||
/** A valid file identifier for the file */
|
||||
document_file_id: string;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Caption of the document to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the document caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the file */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. */
|
||||
export interface InlineQueryResultCachedVideo {
|
||||
/** Type of the result, must be video */
|
||||
type: "video";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier for the video file */
|
||||
video_file_id: string;
|
||||
/** Title for the result */
|
||||
title: string;
|
||||
/** Short description of the result */
|
||||
description?: string;
|
||||
/** Caption of the video to be sent, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the video caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the video */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultCachedVoice {
|
||||
/** Type of the result, must be voice */
|
||||
type: "voice";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier for the voice message */
|
||||
voice_file_id: string;
|
||||
/** Voice message title */
|
||||
title: string;
|
||||
/** Caption, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the voice message caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the voice message */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. */
|
||||
export interface InlineQueryResultCachedAudio {
|
||||
/** Type of the result, must be audio */
|
||||
type: "audio";
|
||||
/** Unique identifier for this result, 1-64 bytes */
|
||||
id: string;
|
||||
/** A valid file identifier for the audio file */
|
||||
audio_file_id: string;
|
||||
/** Caption, 0-1024 characters after entities parsing */
|
||||
caption?: string;
|
||||
/** Mode for parsing entities in the audio caption. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in the caption, which can be specified instead of parse_mode */
|
||||
caption_entities?: MessageEntity[];
|
||||
/** Inline keyboard attached to the message */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
/** Content of the message to be sent instead of the audio */
|
||||
input_message_content?: InputMessageContent;
|
||||
}
|
||||
/** This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 5 types:
|
||||
|
||||
- InputTextMessageContent
|
||||
- InputLocationMessageContent
|
||||
- InputVenueMessageContent
|
||||
- InputContactMessageContent
|
||||
- InputInvoiceMessageContent */
|
||||
export type InputMessageContent = InputTextMessageContent | InputLocationMessageContent | InputVenueMessageContent | InputContactMessageContent | InputInvoiceMessageContent;
|
||||
/** Represents the content of a text message to be sent as the result of an inline query. */
|
||||
export interface InputTextMessageContent {
|
||||
/** Text of the message to be sent, 1-4096 characters */
|
||||
message_text: string;
|
||||
/** Mode for parsing entities in the message text. See formatting options for more details. */
|
||||
parse_mode?: ParseMode;
|
||||
/** List of special entities that appear in message text, which can be specified instead of parse_mode */
|
||||
entities?: MessageEntity[];
|
||||
/** Disables link previews for links in the sent message */
|
||||
disable_web_page_preview?: boolean;
|
||||
}
|
||||
/** Represents the content of a location message to be sent as the result of an inline query. */
|
||||
export interface InputLocationMessageContent {
|
||||
/** Latitude of the location in degrees */
|
||||
latitude: number;
|
||||
/** Longitude of the location in degrees */
|
||||
longitude: number;
|
||||
/** The radius of uncertainty for the location, measured in meters; 0-1500 */
|
||||
horizontal_accuracy?: number;
|
||||
/** Period in seconds for which the location can be updated, should be between 60 and 86400. */
|
||||
live_period?: number;
|
||||
/** For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */
|
||||
heading?: number;
|
||||
/** For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */
|
||||
proximity_alert_radius?: number;
|
||||
}
|
||||
/** Represents the content of a venue message to be sent as the result of an inline query. */
|
||||
export interface InputVenueMessageContent {
|
||||
/** Latitude of the venue in degrees */
|
||||
latitude: number;
|
||||
/** Longitude of the venue in degrees */
|
||||
longitude: number;
|
||||
/** Name of the venue */
|
||||
title: string;
|
||||
/** Address of the venue */
|
||||
address: string;
|
||||
/** Foursquare identifier of the venue, if known */
|
||||
foursquare_id?: string;
|
||||
/** Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */
|
||||
foursquare_type?: string;
|
||||
/** Google Places identifier of the venue */
|
||||
google_place_id?: string;
|
||||
/** Google Places type of the venue. (See supported types.) */
|
||||
google_place_type?: string;
|
||||
}
|
||||
/** Represents the content of a contact message to be sent as the result of an inline query. */
|
||||
export interface InputContactMessageContent {
|
||||
/** Contact's phone number */
|
||||
phone_number: string;
|
||||
/** Contact's first name */
|
||||
first_name: string;
|
||||
/** Contact's last name */
|
||||
last_name?: string;
|
||||
/** Additional data about the contact in the form of a vCard, 0-2048 bytes */
|
||||
vcard?: string;
|
||||
}
|
||||
/** Represents the content of an invoice message to be sent as the result of an inline query. */
|
||||
export interface InputInvoiceMessageContent {
|
||||
/** Product name, 1-32 characters */
|
||||
title: string;
|
||||
/** Product description, 1-255 characters */
|
||||
description: string;
|
||||
/** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */
|
||||
payload: string;
|
||||
/** Payment provider token, obtained via BotFather */
|
||||
provider_token: string;
|
||||
/** Three-letter ISO 4217 currency code, see more on currencies */
|
||||
currency: string;
|
||||
/** Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) */
|
||||
prices: LabeledPrice[];
|
||||
/** The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 */
|
||||
max_tip_amount?: number;
|
||||
/** An array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. */
|
||||
suggested_tip_amounts?: number[];
|
||||
/** Data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. */
|
||||
provider_data?: string;
|
||||
/** URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. */
|
||||
photo_url?: string;
|
||||
/** Photo size in bytes */
|
||||
photo_size?: number;
|
||||
/** Photo width */
|
||||
photo_width?: number;
|
||||
/** Photo height */
|
||||
photo_height?: number;
|
||||
/** Pass True if you require the user's full name to complete the order */
|
||||
need_name?: boolean;
|
||||
/** Pass True if you require the user's phone number to complete the order */
|
||||
need_phone_number?: boolean;
|
||||
/** Pass True if you require the user's email address to complete the order */
|
||||
need_email?: boolean;
|
||||
/** Pass True if you require the user's shipping address to complete the order */
|
||||
need_shipping_address?: boolean;
|
||||
/** Pass True if the user's phone number should be sent to provider */
|
||||
send_phone_number_to_provider?: boolean;
|
||||
/** Pass True if the user's email address should be sent to provider */
|
||||
send_email_to_provider?: boolean;
|
||||
/** Pass True if the final price depends on the shipping method */
|
||||
is_flexible?: boolean;
|
||||
}
|
||||
/** Represents a result of an inline query that was chosen by the user and sent to their chat partner.
|
||||
|
||||
Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates. */
|
||||
export interface ChosenInlineResult {
|
||||
/** The unique identifier for the result that was chosen */
|
||||
result_id: string;
|
||||
/** The user that chose the result */
|
||||
from: User;
|
||||
/** Sender location, only for bots that require user location */
|
||||
location?: Location;
|
||||
/** Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. */
|
||||
inline_message_id?: string;
|
||||
/** The query that was used to obtain the result */
|
||||
query: string;
|
||||
}
|
||||
/** This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.
|
||||
|
||||
Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities. */
|
||||
export interface InlineQueryResultsButton {
|
||||
/** Label text on the button */
|
||||
text: string;
|
||||
/** Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App. */
|
||||
web_app?: WebAppInfo;
|
||||
/** Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only `A-Z`, `a-z`, `0-9`, `_` and `-` are allowed. */
|
||||
start_parameter?: string;
|
||||
}
|
447
node_modules/@grammyjs/types/manage.d.ts
generated
vendored
447
node_modules/@grammyjs/types/manage.d.ts
generated
vendored
@ -1,447 +0,0 @@
|
||||
import type { Location, Message, PhotoSize } from "./message.js";
|
||||
import type { Update } from "./update.js";
|
||||
/** Describes the current status of a webhook. */
|
||||
export interface WebhookInfo {
|
||||
/** Webhook URL, may be empty if webhook is not set up */
|
||||
url?: string;
|
||||
/** True, if a custom certificate was provided for webhook certificate checks */
|
||||
has_custom_certificate: boolean;
|
||||
/** Number of updates awaiting delivery */
|
||||
pending_update_count: number;
|
||||
/** Currently used webhook IP address */
|
||||
ip_address?: string;
|
||||
/** Unix time for the most recent error that happened when trying to deliver an update via webhook */
|
||||
last_error_date: number;
|
||||
/** Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook */
|
||||
last_error_message: string;
|
||||
/** Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters */
|
||||
last_synchronization_error_date?: number;
|
||||
/** The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery */
|
||||
max_connections: number;
|
||||
/** A list of update types the bot is subscribed to. Defaults to all update types except chat_member */
|
||||
allowed_updates: Array<Exclude<keyof Update, "update_id">>;
|
||||
}
|
||||
/** This object represents a Telegram user or bot. */
|
||||
export interface User {
|
||||
/** Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. */
|
||||
id: number;
|
||||
/** True, if this user is a bot */
|
||||
is_bot: boolean;
|
||||
/** User's or bot's first name */
|
||||
first_name: string;
|
||||
/** User's or bot's last name */
|
||||
last_name?: string;
|
||||
/** User's or bot's username */
|
||||
username?: string;
|
||||
/** IETF language tag of the user's language */
|
||||
language_code?: string;
|
||||
/** True, if this user is a Telegram Premium user */
|
||||
is_premium?: true;
|
||||
/** True, if this user added the bot to the attachment menu */
|
||||
added_to_attachment_menu?: true;
|
||||
}
|
||||
/** This object represents a Telegram user or bot that was returned by `getMe`. */
|
||||
export interface UserFromGetMe extends User {
|
||||
is_bot: true;
|
||||
username: string;
|
||||
/** True, if the bot can be invited to groups. Returned only in getMe. */
|
||||
can_join_groups: boolean;
|
||||
/** True, if privacy mode is disabled for the bot. Returned only in getMe. */
|
||||
can_read_all_group_messages: boolean;
|
||||
/** True, if the bot supports inline queries. Returned only in getMe. */
|
||||
supports_inline_queries: boolean;
|
||||
}
|
||||
export declare namespace Chat {
|
||||
/** Internal type holding properties that all kinds of chats share. */
|
||||
interface AbstractChat {
|
||||
/** Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
|
||||
id: number;
|
||||
/** Type of chat, can be either “private”, “group”, “supergroup” or “channel” */
|
||||
type: string;
|
||||
}
|
||||
/** Internal type holding properties that those chats with user names share. */
|
||||
interface UserNameChat {
|
||||
/** Username, for private chats, supergroups and channels if available */
|
||||
username?: string;
|
||||
}
|
||||
/** Internal type holding properties that those chats with titles share. */
|
||||
interface TitleChat {
|
||||
/** Title, for supergroups, channels and group chats */
|
||||
title: string;
|
||||
}
|
||||
/** Internal type representing private chats. */
|
||||
export interface PrivateChat extends AbstractChat, UserNameChat {
|
||||
type: "private";
|
||||
/** First name of the other party in a private chat */
|
||||
first_name: string;
|
||||
/** Last name of the other party in a private chat */
|
||||
last_name?: string;
|
||||
}
|
||||
/** Internal type representing group chats. */
|
||||
export interface GroupChat extends AbstractChat, TitleChat {
|
||||
type: "group";
|
||||
}
|
||||
/** Internal type representing super group chats. */
|
||||
export interface SupergroupChat extends AbstractChat, UserNameChat, TitleChat {
|
||||
type: "supergroup";
|
||||
/** True, if the supergroup chat is a forum (has topics enabled) */
|
||||
is_forum?: true;
|
||||
}
|
||||
/** Internal type representing channel chats. */
|
||||
export interface ChannelChat extends AbstractChat, UserNameChat, TitleChat {
|
||||
type: "channel";
|
||||
}
|
||||
/** Internal type holding properties that those chats returned from `getChat` share. */
|
||||
interface GetChat {
|
||||
/** Chat photo. Returned only in getChat. */
|
||||
photo?: ChatPhoto;
|
||||
/** The most recent pinned message (by sending date). Returned only in getChat. */
|
||||
pinned_message?: Message;
|
||||
/** The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. */
|
||||
message_auto_delete_time?: number;
|
||||
/** True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. */
|
||||
has_protected_content?: true;
|
||||
}
|
||||
/** Internal type holding properties that those private, supergroup, and channel chats returned from `getChat` share. */
|
||||
interface NonGroupGetChat extends GetChat {
|
||||
/** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat. */
|
||||
active_usernames?: string[];
|
||||
}
|
||||
/** Internal type holding properties that those group, supergroup, and channel chats returned from `getChat` share. */
|
||||
interface NonPrivateGetChat extends GetChat {
|
||||
/** Description, for groups, supergroups and channel chats. Returned only in getChat. */
|
||||
description?: string;
|
||||
/** Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. */
|
||||
invite_link?: string;
|
||||
}
|
||||
/** Internal type holding properties that those group and supergroup chats returned from `getChat` share. */
|
||||
interface MultiUserGetChat extends NonPrivateGetChat {
|
||||
/** Default chat member permissions, for groups and supergroups. Returned only in getChat. */
|
||||
permissions?: ChatPermissions;
|
||||
/** True, if the bot can change the group sticker set. Returned only in getChat. */
|
||||
can_set_sticker_set?: true;
|
||||
}
|
||||
/** Internal type holding properties that those supergroup and channel chats returned from `getChat` share. */
|
||||
interface LargeGetChat extends NonPrivateGetChat {
|
||||
/** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat. */
|
||||
linked_chat_id?: number;
|
||||
}
|
||||
/** Internal type representing private chats returned from `getChat`. */
|
||||
export interface PrivateGetChat extends PrivateChat, NonGroupGetChat, GetChat {
|
||||
/** Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. */
|
||||
emoji_status_custom_emoji_id?: string;
|
||||
/** Bio of the other party in a private chat. Returned only in getChat. */
|
||||
bio?: string;
|
||||
/** True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat. */
|
||||
has_private_forwards?: true;
|
||||
/** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat. */
|
||||
has_restricted_voice_and_video_messages?: true;
|
||||
}
|
||||
/** Internal type representing group chats returned from `getChat`. */
|
||||
export interface GroupGetChat extends GroupChat, MultiUserGetChat {
|
||||
}
|
||||
/** Internal type representing supergroup chats returned from `getChat`. */
|
||||
export interface SupergroupGetChat extends SupergroupChat, NonGroupGetChat, MultiUserGetChat, LargeGetChat {
|
||||
/** True, if users need to join the supergroup before they can send messages. Returned only in getChat. */
|
||||
join_to_send_messages?: true;
|
||||
/** True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat. */
|
||||
join_by_request?: true;
|
||||
/** For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. */
|
||||
slow_mode_delay?: number;
|
||||
/** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat. */
|
||||
has_aggressive_anti_spam_enabled?: true;
|
||||
/** For supergroups, name of group sticker set. Returned only in getChat. */
|
||||
sticker_set_name?: string;
|
||||
/** For supergroups, the location to which the supergroup is connected. Returned only in getChat. */
|
||||
location?: ChatLocation;
|
||||
}
|
||||
/** Internal type representing channel chats returned from `getChat`. */
|
||||
export interface ChannelGetChat extends ChannelChat, NonGroupGetChat, LargeGetChat {
|
||||
}
|
||||
export {};
|
||||
}
|
||||
/** This object represents a chat. */
|
||||
export type Chat = Chat.PrivateChat | Chat.GroupChat | Chat.SupergroupChat | Chat.ChannelChat;
|
||||
/** This object represents a Telegram user or bot that was returned by `getChat`. */
|
||||
export type ChatFromGetChat = Chat.PrivateGetChat | Chat.GroupGetChat | Chat.SupergroupGetChat | Chat.ChannelGetChat;
|
||||
/** This object represent a user's profile pictures. */
|
||||
export interface UserProfilePhotos {
|
||||
/** Total number of profile pictures the target user has */
|
||||
total_count: number;
|
||||
/** Requested profile pictures (in up to 4 sizes each) */
|
||||
photos: PhotoSize[][];
|
||||
}
|
||||
/** This object represents a chat photo. */
|
||||
export interface ChatPhoto {
|
||||
/** File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */
|
||||
small_file_id: string;
|
||||
/** Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
small_file_unique_id: string;
|
||||
/** File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */
|
||||
big_file_id: string;
|
||||
/** Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
big_file_unique_id: string;
|
||||
}
|
||||
/** Represents an invite link for a chat. */
|
||||
export interface ChatInviteLink {
|
||||
/** The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with "...". */
|
||||
invite_link: string;
|
||||
/** Creator of the link */
|
||||
creator: User;
|
||||
/** True, if users joining the chat via the link need to be approved by chat administrators */
|
||||
creates_join_request: boolean;
|
||||
/** True, if the link is primary */
|
||||
is_primary: boolean;
|
||||
/** True, if the link is revoked */
|
||||
is_revoked: boolean;
|
||||
/** Invite link name */
|
||||
name?: string;
|
||||
/** Point in time (Unix timestamp) when the link will expire or has been expired */
|
||||
expire_date?: number;
|
||||
/** The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */
|
||||
member_limit?: number;
|
||||
/** Number of pending join requests created using this link */
|
||||
pending_join_request_count?: number;
|
||||
}
|
||||
/** Represents the rights of an administrator in a chat. */
|
||||
export interface ChatAdministratorRights {
|
||||
/** True, if the user's presence in the chat is hidden */
|
||||
is_anonymous: boolean;
|
||||
/** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */
|
||||
can_manage_chat: boolean;
|
||||
/** True, if the administrator can delete messages of other users */
|
||||
can_delete_messages: boolean;
|
||||
/** True, if the administrator can manage video chats */
|
||||
can_manage_video_chats: boolean;
|
||||
/** True, if the administrator can restrict, ban or unban chat members */
|
||||
can_restrict_members: boolean;
|
||||
/** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
|
||||
can_promote_members: boolean;
|
||||
/** True, if the user is allowed to change the chat title, photo and other settings */
|
||||
can_change_info: boolean;
|
||||
/** True, if the user is allowed to invite new users to the chat */
|
||||
can_invite_users: boolean;
|
||||
/** True, if the administrator can post in the channel; channels only */
|
||||
can_post_messages?: boolean;
|
||||
/** True, if the administrator can edit messages of other users and can pin messages; channels only */
|
||||
can_edit_messages?: boolean;
|
||||
/** True, if the user is allowed to pin messages; groups and supergroups only */
|
||||
can_pin_messages?: boolean;
|
||||
/** True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
|
||||
can_manage_topics?: boolean;
|
||||
}
|
||||
/** This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:
|
||||
- ChatMemberOwner
|
||||
- ChatMemberAdministrator
|
||||
- ChatMemberMember
|
||||
- ChatMemberRestricted
|
||||
- ChatMemberLeft
|
||||
- ChatMemberBanned */
|
||||
export type ChatMember = ChatMemberOwner | ChatMemberAdministrator | ChatMemberMember | ChatMemberRestricted | ChatMemberLeft | ChatMemberBanned;
|
||||
/** Represents a chat member that owns the chat and has all administrator privileges. */
|
||||
export interface ChatMemberOwner {
|
||||
/** The member's status in the chat, always “creator” */
|
||||
status: "creator";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
/** True, if the user's presence in the chat is hidden */
|
||||
is_anonymous: boolean;
|
||||
/** Custom title for this user */
|
||||
custom_title?: string;
|
||||
}
|
||||
/** Represents a chat member that has some additional privileges. */
|
||||
export interface ChatMemberAdministrator {
|
||||
/** The member's status in the chat, always “administrator” */
|
||||
status: "administrator";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
/** True, if the bot is allowed to edit administrator privileges of that user */
|
||||
can_be_edited: boolean;
|
||||
/** True, if the user's presence in the chat is hidden */
|
||||
is_anonymous: boolean;
|
||||
/** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */
|
||||
can_manage_chat: boolean;
|
||||
/** True, if the administrator can delete messages of other users */
|
||||
can_delete_messages: boolean;
|
||||
/** True, if the administrator can manage video chats */
|
||||
can_manage_video_chats: boolean;
|
||||
/** True, if the administrator can restrict, ban or unban chat members */
|
||||
can_restrict_members: boolean;
|
||||
/** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
|
||||
can_promote_members: boolean;
|
||||
/** True, if the user is allowed to change the chat title, photo and other settings */
|
||||
can_change_info: boolean;
|
||||
/** True, if the user is allowed to invite new users to the chat */
|
||||
can_invite_users: boolean;
|
||||
/** True, if the administrator can post in the channel; channels only */
|
||||
can_post_messages?: boolean;
|
||||
/** True, if the administrator can edit messages of other users and can pin messages; channels only */
|
||||
can_edit_messages?: boolean;
|
||||
/** True, if the user is allowed to pin messages; groups and supergroups only */
|
||||
can_pin_messages?: boolean;
|
||||
/** True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
|
||||
can_manage_topics?: boolean;
|
||||
/** Custom title for this user */
|
||||
custom_title?: string;
|
||||
}
|
||||
/** Represents a chat member that has no additional privileges or restrictions. */
|
||||
export interface ChatMemberMember {
|
||||
/** The member's status in the chat, always “member” */
|
||||
status: "member";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
}
|
||||
/** Represents a chat member that is under certain restrictions in the chat. Supergroups only. */
|
||||
export interface ChatMemberRestricted {
|
||||
/** The member's status in the chat, always “restricted” */
|
||||
status: "restricted";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
/** True, if the user is a member of the chat at the moment of the request */
|
||||
is_member: boolean;
|
||||
/** True, if the user is allowed to send text messages, contacts, invoices, locations and venues */
|
||||
can_send_messages: boolean;
|
||||
/** True, if the user is allowed to send audios */
|
||||
can_send_audios: boolean;
|
||||
/** True, if the user is allowed to send documents */
|
||||
can_send_documents: boolean;
|
||||
/** True, if the user is allowed to send photos */
|
||||
can_send_photos: boolean;
|
||||
/** True, if the user is allowed to send videos */
|
||||
can_send_videos: boolean;
|
||||
/** True, if the user is allowed to send video notes */
|
||||
can_send_video_notes: boolean;
|
||||
/** True, if the user is allowed to send voice notes */
|
||||
can_send_voice_notes: boolean;
|
||||
/** True, if the user is allowed to send polls */
|
||||
can_send_polls: boolean;
|
||||
/** True, if the user is allowed to send animations, games, stickers and use inline bots */
|
||||
can_send_other_messages: boolean;
|
||||
/** True, if the user is allowed to add web page previews to their messages */
|
||||
can_add_web_page_previews: boolean;
|
||||
/** True, if the user is allowed to change the chat title, photo and other settings */
|
||||
can_change_info: boolean;
|
||||
/** True, if the user is allowed to invite new users to the chat */
|
||||
can_invite_users: boolean;
|
||||
/** True, if the user is allowed to pin messages */
|
||||
can_pin_messages: boolean;
|
||||
/** True, if the user is allowed to create forum topics */
|
||||
can_manage_topics: boolean;
|
||||
/** Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever */
|
||||
until_date: number;
|
||||
}
|
||||
/** Represents a chat member that isn't currently a member of the chat, but may join it themselves. */
|
||||
export interface ChatMemberLeft {
|
||||
/** The member's status in the chat, always “left” */
|
||||
status: "left";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
}
|
||||
/** Represents a chat member that was banned in the chat and can't return to the chat or view chat messages. */
|
||||
export interface ChatMemberBanned {
|
||||
/** The member's status in the chat, always “kicked” */
|
||||
status: "kicked";
|
||||
/** Information about the user */
|
||||
user: User;
|
||||
/** Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever */
|
||||
until_date: number;
|
||||
}
|
||||
/** This object represents changes in the status of a chat member. */
|
||||
export interface ChatMemberUpdated {
|
||||
/** Chat the user belongs to */
|
||||
chat: Chat;
|
||||
/** Performer of the action, which resulted in the change */
|
||||
from: User;
|
||||
/** Date the change was done in Unix time */
|
||||
date: number;
|
||||
/** Previous information about the chat member */
|
||||
old_chat_member: ChatMember;
|
||||
/** New information about the chat member */
|
||||
new_chat_member: ChatMember;
|
||||
/** Chat invite link, which was used by the user to join the chat; for joining by invite link events only. */
|
||||
invite_link?: ChatInviteLink;
|
||||
/** True, if the user joined the chat via a chat folder invite link */
|
||||
via_chat_folder_invite_link?: boolean;
|
||||
}
|
||||
/** Represents a join request sent to a chat. */
|
||||
export interface ChatJoinRequest {
|
||||
/** Chat to which the request was sent */
|
||||
chat: Chat.SupergroupChat | Chat.ChannelChat;
|
||||
/** User that sent the join request */
|
||||
from: User;
|
||||
/** Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user. */
|
||||
user_chat_id: number;
|
||||
/** Date the request was sent in Unix time */
|
||||
date: number;
|
||||
/** Bio of the user. */
|
||||
bio?: string;
|
||||
/** Chat invite link that was used by the user to send the join request */
|
||||
invite_link?: ChatInviteLink;
|
||||
}
|
||||
/** Describes actions that a non-administrator user is allowed to take in a chat. */
|
||||
export interface ChatPermissions {
|
||||
/** True, if the user is allowed to send text messages, contacts, invoices, locations and venues */
|
||||
can_send_messages?: boolean;
|
||||
/** True, if the user is allowed to send audios */
|
||||
can_send_audios?: boolean;
|
||||
/** True, if the user is allowed to send documents */
|
||||
can_send_documents?: boolean;
|
||||
/** True, if the user is allowed to send photos */
|
||||
can_send_photos?: boolean;
|
||||
/** True, if the user is allowed to send videos */
|
||||
can_send_videos?: boolean;
|
||||
/** True, if the user is allowed to send video notes */
|
||||
can_send_video_notes?: boolean;
|
||||
/** True, if the user is allowed to send voice notes */
|
||||
can_send_voice_notes?: boolean;
|
||||
/** True, if the user is allowed to send polls */
|
||||
can_send_polls?: boolean;
|
||||
/** True, if the user is allowed to send animations, games, stickers and use inline bots */
|
||||
can_send_other_messages?: boolean;
|
||||
/** True, if the user is allowed to add web page previews to their messages */
|
||||
can_add_web_page_previews?: boolean;
|
||||
/** True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups */
|
||||
can_change_info?: boolean;
|
||||
/** True, if the user is allowed to invite new users to the chat */
|
||||
can_invite_users?: boolean;
|
||||
/** True, if the user is allowed to pin messages. Ignored in public supergroups */
|
||||
can_pin_messages?: boolean;
|
||||
/** True, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages */
|
||||
can_manage_topics?: boolean;
|
||||
}
|
||||
/** Represents a location to which a chat is connected. */
|
||||
export interface ChatLocation {
|
||||
/** The location to which the supergroup is connected. Can't be a live location. */
|
||||
location: Location;
|
||||
/** Location address; 1-64 characters, as defined by the chat owner */
|
||||
address: string;
|
||||
}
|
||||
/** This object represents a forum topic. */
|
||||
export interface ForumTopic {
|
||||
/** Unique identifier of the forum topic */
|
||||
message_thread_id: number;
|
||||
/** Name of the topic */
|
||||
name: string;
|
||||
/** Color of the topic icon in RGB format */
|
||||
icon_color: number;
|
||||
/** Unique identifier of the custom emoji shown as the topic icon */
|
||||
icon_custom_emoji_id?: string;
|
||||
}
|
||||
/** This object represents a bot command. */
|
||||
export interface BotCommand {
|
||||
/** Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores. */
|
||||
command: string;
|
||||
/** Description of the command; 1-256 characters. */
|
||||
description: string;
|
||||
}
|
||||
/** This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. */
|
||||
export interface File {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
/** File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. */
|
||||
file_path?: string;
|
||||
}
|
222
node_modules/@grammyjs/types/markup.d.ts
generated
vendored
222
node_modules/@grammyjs/types/markup.d.ts
generated
vendored
@ -1,222 +0,0 @@
|
||||
import type { ChatAdministratorRights, User } from "./manage.js";
|
||||
import type { Message } from "./message.js";
|
||||
/** This object represents an inline keyboard that appears right next to the message it belongs to. */
|
||||
export interface InlineKeyboardMarkup {
|
||||
/** Array of button rows, each represented by an Array of InlineKeyboardButton objects */
|
||||
inline_keyboard: InlineKeyboardButton[][];
|
||||
}
|
||||
export declare namespace InlineKeyboardButton {
|
||||
interface AbstractInlineKeyboardButton {
|
||||
/** Label text on the button */
|
||||
text: string;
|
||||
}
|
||||
export interface UrlButton extends AbstractInlineKeyboardButton {
|
||||
/** HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */
|
||||
url: string;
|
||||
}
|
||||
export interface CallbackButton extends AbstractInlineKeyboardButton {
|
||||
/** Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes */
|
||||
callback_data: string;
|
||||
}
|
||||
export interface WebAppButton extends AbstractInlineKeyboardButton {
|
||||
/** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. */
|
||||
web_app: WebAppInfo;
|
||||
}
|
||||
export interface LoginButton extends AbstractInlineKeyboardButton {
|
||||
/** An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. */
|
||||
login_url: LoginUrl;
|
||||
}
|
||||
export interface SwitchInlineButton extends AbstractInlineKeyboardButton {
|
||||
/** If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot's username will be inserted.
|
||||
|
||||
Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm... actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen. */
|
||||
switch_inline_query: string;
|
||||
}
|
||||
export interface SwitchInlineCurrentChatButton extends AbstractInlineKeyboardButton {
|
||||
/** If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted.
|
||||
|
||||
This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options. */
|
||||
switch_inline_query_current_chat: string;
|
||||
}
|
||||
export interface SwitchInlineChosenChatButton extends AbstractInlineKeyboardButton {
|
||||
/** If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field */
|
||||
switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat;
|
||||
}
|
||||
export interface GameButton extends AbstractInlineKeyboardButton {
|
||||
/** Description of the game that will be launched when the user presses the button.
|
||||
|
||||
NOTE: This type of button must always be the first button in the first row. */
|
||||
callback_game: CallbackGame;
|
||||
}
|
||||
export interface PayButton extends AbstractInlineKeyboardButton {
|
||||
/** Specify True, to send a Pay button.
|
||||
|
||||
NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. */
|
||||
pay: boolean;
|
||||
}
|
||||
export {};
|
||||
}
|
||||
/** This object represents one button of an inline keyboard. You must use exactly one of the optional fields. */
|
||||
export type InlineKeyboardButton = InlineKeyboardButton.CallbackButton | InlineKeyboardButton.GameButton | InlineKeyboardButton.LoginButton | InlineKeyboardButton.PayButton | InlineKeyboardButton.SwitchInlineButton | InlineKeyboardButton.SwitchInlineCurrentChatButton | InlineKeyboardButton.SwitchInlineChosenChatButton | InlineKeyboardButton.UrlButton | InlineKeyboardButton.WebAppButton;
|
||||
/** This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in.
|
||||
Telegram apps support these buttons as of version 5.7. */
|
||||
export interface LoginUrl {
|
||||
/** An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.
|
||||
|
||||
NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization. */
|
||||
url: string;
|
||||
/** New text of the button in forwarded messages. */
|
||||
forward_text?: string;
|
||||
/** Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. */
|
||||
bot_username?: string;
|
||||
/** Pass True to request the permission for your bot to send messages to the user. */
|
||||
request_write_access?: boolean;
|
||||
}
|
||||
/** This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query. */
|
||||
export interface SwitchInlineQueryChosenChat {
|
||||
/** The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted */
|
||||
query?: string;
|
||||
/** True, if private chats with users can be chosen */
|
||||
allow_user_chats?: boolean;
|
||||
/** True, if private chats with bots can be chosen */
|
||||
allow_bot_chats?: boolean;
|
||||
/** True, if group and supergroup chats can be chosen */
|
||||
allow_group_chats?: boolean;
|
||||
/** True, if channel chats can be chosen */
|
||||
allow_channel_chats?: boolean;
|
||||
}
|
||||
/** A placeholder, currently holds no information. Use BotFather to set up your game. */
|
||||
export interface CallbackGame {
|
||||
}
|
||||
/** This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
|
||||
|
||||
NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters). */
|
||||
export interface CallbackQuery {
|
||||
/** Unique identifier for this query */
|
||||
id: string;
|
||||
/** Sender */
|
||||
from: User;
|
||||
/** Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old */
|
||||
message?: Message;
|
||||
/** Identifier of the message sent via the bot in inline mode, that originated the query. */
|
||||
inline_message_id?: string;
|
||||
/** Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. */
|
||||
chat_instance: string;
|
||||
/** Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data. */
|
||||
data?: string;
|
||||
/** Short name of a Game to be returned, serves as the unique identifier for the game */
|
||||
game_short_name?: string;
|
||||
}
|
||||
/** This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). */
|
||||
export interface ReplyKeyboardMarkup {
|
||||
/** Array of button rows, each represented by an Array of KeyboardButton objects */
|
||||
keyboard: KeyboardButton[][];
|
||||
/** Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon. */
|
||||
is_persistent?: boolean;
|
||||
/** Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. */
|
||||
resize_keyboard?: boolean;
|
||||
/** Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false. */
|
||||
one_time_keyboard?: boolean;
|
||||
/** The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */
|
||||
input_field_placeholder?: string;
|
||||
/** Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
|
||||
|
||||
Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard. */
|
||||
selective?: boolean;
|
||||
}
|
||||
export declare namespace KeyboardButton {
|
||||
interface CommonButton {
|
||||
/** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */
|
||||
text: string;
|
||||
}
|
||||
interface RequestUserButton extends CommonButton {
|
||||
/** If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a “user_shared” service message. Available in private chats only. */
|
||||
request_user: KeyboardButtonRequestUser;
|
||||
}
|
||||
interface RequestChatButton extends CommonButton {
|
||||
/** If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. */
|
||||
request_chat: KeyboardButtonRequestChat;
|
||||
}
|
||||
interface RequestContactButton extends CommonButton {
|
||||
/** If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. */
|
||||
request_contact: boolean;
|
||||
}
|
||||
interface RequestLocationButton extends CommonButton {
|
||||
/** If True, the user's current location will be sent when the button is pressed. Available in private chats only. */
|
||||
request_location: boolean;
|
||||
}
|
||||
interface RequestPollButton extends CommonButton {
|
||||
/** If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. */
|
||||
request_poll: KeyboardButtonPollType;
|
||||
}
|
||||
interface WebAppButton extends CommonButton {
|
||||
/** If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only. */
|
||||
web_app: WebAppInfo;
|
||||
}
|
||||
}
|
||||
/** This object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_user, request_chat, request_contact, request_location, and request_poll are mutually exclusive. */
|
||||
export type KeyboardButton = KeyboardButton.CommonButton | KeyboardButton.RequestUserButton | KeyboardButton.RequestChatButton | KeyboardButton.RequestContactButton | KeyboardButton.RequestLocationButton | KeyboardButton.RequestPollButton | KeyboardButton.WebAppButton | string;
|
||||
/** This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. */
|
||||
export interface KeyboardButtonPollType {
|
||||
/** If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. */
|
||||
type?: "quiz" | "regular";
|
||||
}
|
||||
/** Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). */
|
||||
export interface ReplyKeyboardRemove {
|
||||
/** Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) */
|
||||
remove_keyboard: true;
|
||||
/** Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
|
||||
|
||||
Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. */
|
||||
selective?: boolean;
|
||||
}
|
||||
/** Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
|
||||
|
||||
Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll:
|
||||
|
||||
Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish.
|
||||
|
||||
Guide the user through a step-by-step process. 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'.
|
||||
|
||||
The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions - without any extra work for the user. */
|
||||
export interface ForceReply {
|
||||
/** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */
|
||||
force_reply: true;
|
||||
/** The placeholder to be shown in the input field when the reply is active; 1-64 characters */
|
||||
input_field_placeholder?: string;
|
||||
/** Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. */
|
||||
selective?: boolean;
|
||||
}
|
||||
/** Describes a Web App. */
|
||||
export interface WebAppInfo {
|
||||
/** An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps */
|
||||
url: string;
|
||||
}
|
||||
/** This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed. */
|
||||
export interface KeyboardButtonRequestUser {
|
||||
/** Signed 32-bit identifier of the request, which will be received back in the UserShared object. Must be unique within the message */
|
||||
request_id: number;
|
||||
/** Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied. */
|
||||
user_is_bot?: boolean;
|
||||
/** Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied. */
|
||||
user_is_premium?: boolean;
|
||||
}
|
||||
/** This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed. */
|
||||
export interface KeyboardButtonRequestChat {
|
||||
/** Signed 32-bit identifier of the request, which will be received back in the ChatShared object. Must be unique within the message */
|
||||
request_id: number;
|
||||
/** Pass True to request a channel chat, pass False to request a group or a supergroup chat. */
|
||||
chat_is_channel: boolean;
|
||||
/** Pass True to request a forum supergroup, pass False to request a non-forum chat. If not specified, no additional restrictions are applied. */
|
||||
chat_is_forum?: boolean;
|
||||
/** Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username. If not specified, no additional restrictions are applied. */
|
||||
chat_has_username?: boolean;
|
||||
/** Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied. */
|
||||
chat_is_created?: boolean;
|
||||
/** An object listing the required administrator rights of the user in the chat. The rights must be a superset of bot_administrator_rights. If not specified, no additional restrictions are applied. */
|
||||
user_administrator_rights?: ChatAdministratorRights;
|
||||
/** An object listing the required administrator rights of the bot in the chat. The rights must be a subset of user_administrator_rights. If not specified, no additional restrictions are applied. */
|
||||
bot_administrator_rights?: ChatAdministratorRights;
|
||||
/** Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied. */
|
||||
bot_is_member?: boolean;
|
||||
}
|
737
node_modules/@grammyjs/types/message.d.ts
generated
vendored
737
node_modules/@grammyjs/types/message.d.ts
generated
vendored
@ -1,737 +0,0 @@
|
||||
import type { Chat, File, User } from "./manage.js";
|
||||
import type { InlineKeyboardMarkup } from "./markup.js";
|
||||
import type { PassportData } from "./passport.js";
|
||||
import type { Invoice, SuccessfulPayment } from "./payment.js";
|
||||
type MsgWith<P extends keyof Message> = Record<P, NonNullable<Message[P]>>;
|
||||
export declare namespace Message {
|
||||
interface ServiceMessage {
|
||||
/** Unique message identifier inside this chat */
|
||||
message_id: number;
|
||||
/** Unique identifier of a message thread or a forum topic to which the message belongs; for supergroups only */
|
||||
message_thread_id?: number;
|
||||
/** Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
|
||||
from?: User;
|
||||
/** Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
|
||||
sender_chat?: Chat;
|
||||
/** Date the message was sent in Unix time */
|
||||
date: number;
|
||||
/** Conversation the message belongs to */
|
||||
chat: Chat;
|
||||
/** True, if the message is sent to a forum topic */
|
||||
is_topic_message?: boolean;
|
||||
}
|
||||
export interface CommonMessage extends ServiceMessage {
|
||||
/** For forwarded messages, sender of the original message */
|
||||
forward_from?: User;
|
||||
/** For messages forwarded from channels or from anonymous administrators, information about the original sender chat */
|
||||
forward_from_chat?: Chat;
|
||||
/** For messages forwarded from channels, identifier of the original message in the channel */
|
||||
forward_from_message_id?: number;
|
||||
/** For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present */
|
||||
forward_signature?: string;
|
||||
/** Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages */
|
||||
forward_sender_name?: string;
|
||||
/** For forwarded messages, date the original message was sent in Unix time */
|
||||
forward_date?: number;
|
||||
/** True, if the message is a channel post that was automatically forwarded to the connected discussion group */
|
||||
is_automatic_forward?: true;
|
||||
/** For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
|
||||
reply_to_message?: ReplyMessage;
|
||||
/** Bot through which the message was sent */
|
||||
via_bot?: User;
|
||||
/** Date the message was last edited in Unix time */
|
||||
edit_date?: number;
|
||||
/** True, if the message can't be forwarded */
|
||||
has_protected_content?: true;
|
||||
/** Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */
|
||||
author_signature?: string;
|
||||
/** Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */
|
||||
reply_markup?: InlineKeyboardMarkup;
|
||||
}
|
||||
export interface CaptionableMessage extends CommonMessage {
|
||||
/** Caption for the animation, audio, document, photo, video or voice */
|
||||
caption?: string;
|
||||
/** For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */
|
||||
caption_entities?: MessageEntity[];
|
||||
}
|
||||
export interface MediaMessage extends CaptionableMessage {
|
||||
/** The unique identifier of a media message group this message belongs to */
|
||||
media_group_id?: string;
|
||||
/** True, if the message media is covered by a spoiler animation */
|
||||
has_media_spoiler?: true;
|
||||
}
|
||||
export type TextMessage = CommonMessage & MsgWith<"text">;
|
||||
export type AudioMessage = CaptionableMessage & MsgWith<"audio">;
|
||||
export type DocumentMessage = CaptionableMessage & MsgWith<"document">;
|
||||
export type AnimationMessage = DocumentMessage & MsgWith<"animation">;
|
||||
export type PhotoMessage = MediaMessage & MsgWith<"photo">;
|
||||
export type StickerMessage = CommonMessage & MsgWith<"sticker">;
|
||||
export type VideoMessage = MediaMessage & MsgWith<"video">;
|
||||
export type VideoNoteMessage = CommonMessage & MsgWith<"video_note">;
|
||||
export type VoiceMessage = CaptionableMessage & MsgWith<"voice">;
|
||||
export type ContactMessage = CommonMessage & MsgWith<"contact">;
|
||||
export type DiceMessage = CommonMessage & MsgWith<"dice">;
|
||||
export type GameMessage = CommonMessage & MsgWith<"game">;
|
||||
export type PollMessage = CommonMessage & MsgWith<"poll">;
|
||||
export type LocationMessage = CommonMessage & MsgWith<"location">;
|
||||
export type VenueMessage = LocationMessage & MsgWith<"venue">;
|
||||
export type NewChatMembersMessage = ServiceMessage & MsgWith<"new_chat_members">;
|
||||
export type LeftChatMemberMessage = ServiceMessage & MsgWith<"left_chat_member">;
|
||||
export type NewChatTitleMessage = ServiceMessage & MsgWith<"new_chat_title">;
|
||||
export type NewChatPhotoMessage = ServiceMessage & MsgWith<"new_chat_photo">;
|
||||
export type DeleteChatPhotoMessage = ServiceMessage & MsgWith<"delete_chat_photo">;
|
||||
export type GroupChatCreatedMessage = ServiceMessage & MsgWith<"group_chat_created">;
|
||||
export type SupergroupChatCreated = ServiceMessage & MsgWith<"supergroup_chat_created">;
|
||||
export type ChannelChatCreatedMessage = ServiceMessage & MsgWith<"channel_chat_created">;
|
||||
export type MessageAutoDeleteTimerChangedMessage = ServiceMessage & MsgWith<"message_auto_delete_timer_changed">;
|
||||
export type MigrateToChatIdMessage = ServiceMessage & MsgWith<"migrate_to_chat_id">;
|
||||
export type MigrateFromChatIdMessage = ServiceMessage & MsgWith<"migrate_from_chat_id">;
|
||||
export type PinnedMessageMessage = ServiceMessage & MsgWith<"pinned_message">;
|
||||
export type InvoiceMessage = ServiceMessage & MsgWith<"invoice">;
|
||||
export type SuccessfulPaymentMessage = ServiceMessage & MsgWith<"successful_payment">;
|
||||
export type UserSharedMessage = ServiceMessage & MsgWith<"user_shared">;
|
||||
export type ChatSharedMessage = ServiceMessage & MsgWith<"chat_shared">;
|
||||
export type ConnectedWebsiteMessage = ServiceMessage & MsgWith<"connected_website">;
|
||||
export type WriteAccessAllowedMessage = ServiceMessage & MsgWith<"write_access_allowed">;
|
||||
export type PassportDataMessage = ServiceMessage & MsgWith<"passport_data">;
|
||||
export type ProximityAlertTriggeredMessage = ServiceMessage & MsgWith<"proximity_alert_triggered">;
|
||||
export type ForumTopicCreatedMessage = ServiceMessage & MsgWith<"forum_topic_created">;
|
||||
export type ForumTopicEditedMessage = ServiceMessage & MsgWith<"forum_topic_edited">;
|
||||
export type ForumTopicClosedMessage = ServiceMessage & MsgWith<"forum_topic_closed">;
|
||||
export type ForumTopicReopenedMessage = ServiceMessage & MsgWith<"forum_topic_reopened">;
|
||||
export type GeneralForumTopicHiddenMessage = ServiceMessage & MsgWith<"general_forum_topic_hidden">;
|
||||
export type GeneralForumTopicUnhiddenMessage = ServiceMessage & MsgWith<"general_forum_topic_unhidden">;
|
||||
export type VideoChatScheduledMessage = ServiceMessage & MsgWith<"video_chat_scheduled">;
|
||||
export type VideoChatStartedMessage = ServiceMessage & MsgWith<"video_chat_started">;
|
||||
export type VideoChatEndedMessage = ServiceMessage & MsgWith<"video_chat_ended">;
|
||||
export type VideoChatParticipantsInvitedMessage = ServiceMessage & MsgWith<"video_chat_participants_invited">;
|
||||
export type WebAppDataMessage = ServiceMessage & MsgWith<"web_app_data">;
|
||||
export {};
|
||||
}
|
||||
type ReplyMessage = Message & {
|
||||
reply_to_message: undefined;
|
||||
};
|
||||
export interface Message extends Message.MediaMessage {
|
||||
/** For text messages, the actual UTF-8 text of the message */
|
||||
text?: string;
|
||||
/** For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text */
|
||||
entities?: MessageEntity[];
|
||||
/** Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set */
|
||||
animation?: Animation;
|
||||
/** Message is an audio file, information about the file */
|
||||
audio?: Audio;
|
||||
/** Message is a general file, information about the file */
|
||||
document?: Document;
|
||||
/** Message is a photo, available sizes of the photo */
|
||||
photo?: PhotoSize[];
|
||||
/** Message is a sticker, information about the sticker */
|
||||
sticker?: Sticker;
|
||||
/** Message is a video, information about the video */
|
||||
video?: Video;
|
||||
/** Message is a video note, information about the video message */
|
||||
video_note?: VideoNote;
|
||||
/** Message is a voice message, information about the file */
|
||||
voice?: Voice;
|
||||
/** Message is a shared contact, information about the contact */
|
||||
contact?: Contact;
|
||||
/** Message is a dice with random value */
|
||||
dice?: Dice;
|
||||
/** Message is a game, information about the game. More about games » */
|
||||
game?: Game;
|
||||
/** Message is a native poll, information about the poll */
|
||||
poll?: Poll;
|
||||
/** Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set */
|
||||
venue?: Venue;
|
||||
/** Message is a shared location, information about the location */
|
||||
location?: Location;
|
||||
/** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */
|
||||
new_chat_members?: User[];
|
||||
/** A member was removed from the group, information about them (this member may be the bot itself) */
|
||||
left_chat_member?: User;
|
||||
/** A chat title was changed to this value */
|
||||
new_chat_title?: string;
|
||||
/** A chat photo was change to this value */
|
||||
new_chat_photo?: PhotoSize[];
|
||||
/** Service message: the chat photo was deleted */
|
||||
delete_chat_photo?: true;
|
||||
/** Service message: the group has been created */
|
||||
group_chat_created?: true;
|
||||
/** Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. */
|
||||
supergroup_chat_created?: true;
|
||||
/** Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */
|
||||
channel_chat_created?: true;
|
||||
/** Service message: auto-delete timer settings changed in the chat */
|
||||
message_auto_delete_timer_changed?: MessageAutoDeleteTimerChanged;
|
||||
/** The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
|
||||
migrate_to_chat_id?: number;
|
||||
/** The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
|
||||
migrate_from_chat_id?: number;
|
||||
/** Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. */
|
||||
pinned_message?: ReplyMessage;
|
||||
/** Message is an invoice for a payment, information about the invoice. More about payments » */
|
||||
invoice?: Invoice;
|
||||
/** Message is a service message about a successful payment, information about the payment. More about payments » */
|
||||
successful_payment?: SuccessfulPayment;
|
||||
/** Service message: a user was shared with the bot */
|
||||
user_shared?: UserShared;
|
||||
/** Service message: a chat was shared with the bot */
|
||||
chat_shared?: ChatShared;
|
||||
/** The domain name of the website on which the user has logged in. More about Telegram Login » */
|
||||
connected_website?: string;
|
||||
/** Service message: the user allowed the bot added to the attachment menu to write messages */
|
||||
write_access_allowed?: WriteAccessAllowed;
|
||||
/** Telegram Passport data */
|
||||
passport_data?: PassportData;
|
||||
/** Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. */
|
||||
proximity_alert_triggered?: ProximityAlertTriggered;
|
||||
/** Service message: forum topic created */
|
||||
forum_topic_created?: ForumTopicCreated;
|
||||
/** Service message: forum topic edited */
|
||||
forum_topic_edited?: ForumTopicEdited;
|
||||
/** Service message: forum topic closed */
|
||||
forum_topic_closed?: ForumTopicClosed;
|
||||
/** Service message: forum topic reopened */
|
||||
forum_topic_reopened?: ForumTopicReopened;
|
||||
/** Service message: the 'General' forum topic hidden */
|
||||
general_forum_topic_hidden?: GeneralForumTopicHidden;
|
||||
/** Service message: the 'General' forum topic unhidden */
|
||||
general_forum_topic_unhidden?: GeneralForumTopicUnhidden;
|
||||
/** Service message: video chat scheduled */
|
||||
video_chat_scheduled?: VideoChatScheduled;
|
||||
/** Service message: video chat started */
|
||||
video_chat_started?: VideoChatStarted;
|
||||
/** Service message: video chat ended */
|
||||
video_chat_ended?: VideoChatEnded;
|
||||
/** Service message: new participants invited to a video chat */
|
||||
video_chat_participants_invited?: VideoChatParticipantsInvited;
|
||||
/** Service message: data sent by a Web App */
|
||||
web_app_data?: WebAppData;
|
||||
}
|
||||
/** This object represents a unique message identifier. */
|
||||
export interface MessageId {
|
||||
/** Unique message identifier */
|
||||
message_id: number;
|
||||
}
|
||||
/** Describes an inline message sent by a Web App on behalf of a user. */
|
||||
export interface SentWebAppMessage {
|
||||
/** Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. */
|
||||
inline_message_id: string;
|
||||
}
|
||||
/** The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, and spoiler text, as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can use either markdown-style or HTML-style formatting.
|
||||
|
||||
Note that Telegram clients will display an **alert** to the user before opening an inline link ('Open this link?' together with the full URL).
|
||||
|
||||
Message entities can be nested, providing following restrictions are met:
|
||||
- If two entities have common characters, then one of them is fully contained inside another.
|
||||
- bold, italic, underline, strikethrough, and spoiler entities can contain and can be part of any other entities, except pre and code.
|
||||
- All other entities can't contain each other.
|
||||
|
||||
Links `tg://user?id=<user_id>` can be used to mention a user by their ID without using a username. Please note:
|
||||
|
||||
- These links will work only if they are used inside an inline link or in an inline keyboard button. For example, they will not work, when used in a message text.
|
||||
- Unless the user is a member of the chat where they were mentioned, these mentions are only guaranteed to work if the user has contacted the bot in private in the past or has sent a callback query to the bot via an inline button and doesn't have Forwarded Messages privacy enabled for the bot.
|
||||
|
||||
#### MarkdownV2 style
|
||||
To use this mode, pass *MarkdownV2* in the *parse_mode* field. Use the following syntax in your message:
|
||||
|
||||
```
|
||||
*bold \*text*
|
||||
_italic \*text_
|
||||
__underline__
|
||||
~strikethrough~
|
||||
||spoiler||
|
||||
*bold _italic bold ~italic bold strikethrough ||italic bold strikethrough spoiler||~ __underline italic bold___ bold*
|
||||
[inline URL](http://www.example.com/)
|
||||
[inline mention of a user](tg://user?id=123456789)
|
||||
![👍](tg://emoji?id=5368324170671202286)
|
||||
`inline fixed-width code`
|
||||
```
|
||||
pre-formatted fixed-width code block
|
||||
```
|
||||
```python
|
||||
pre-formatted fixed-width code block written in the Python programming language
|
||||
```
|
||||
```
|
||||
Please note:
|
||||
|
||||
- Any character with code between 1 and 126 inclusively can be escaped anywhere with a preceding '\' character, in which case it is treated as an ordinary character and not a part of the markup. This implies that '\' character usually must be escaped with a preceding '\' character.
|
||||
- Inside `pre` and `code` entities, all '`' and '\' characters must be escaped with a preceding '\' character.
|
||||
- Inside `(...)` part of inline link definition, all ')' and '\' must be escaped with a preceding '\' character.
|
||||
- A valid emoji must be provided as an alternative value for the custom emoji. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji sticker.
|
||||
- Custom emoji entities can only be used by bots that purchased additional usernames on Fragment.
|
||||
- In all other places characters '_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!' must be escaped with the preceding character '\'.
|
||||
- In case of ambiguity between `italic` and `underline` entities `__` is always greadily treated from left to right as beginning or end of `underline` entity, so instead of `___italic underline___` use `___italic underline_\r__`, where `\r` is a character with code 13, which will be ignored.
|
||||
|
||||
#### HTML style
|
||||
To use this mode, pass *HTML* in the *parse_mode* field. The following tags are currently supported:
|
||||
|
||||
```html
|
||||
<b>bold</b>, <strong>bold</strong>
|
||||
<i>italic</i>, <em>italic</em>
|
||||
<u>underline</u>, <ins>underline</ins>
|
||||
<s>strikethrough</s>, <strike>strikethrough</strike>, <del>strikethrough</del>
|
||||
<span class="tg-spoiler">spoiler</span>, <tg-spoiler>spoiler</tg-spoiler>
|
||||
<b>bold <i>italic bold <s>italic bold strikethrough <span class="tg-spoiler">italic bold strikethrough spoiler</span></s> <u>underline italic bold</u></i> bold</b>
|
||||
<a href="http://www.example.com/">inline URL</a>
|
||||
<a href="tg://user?id=123456789">inline mention of a user</a>
|
||||
<tg-emoji emoji-id="5368324170671202286">👍</tg-emoji>
|
||||
<code>inline fixed-width code</code>
|
||||
<pre>pre-formatted fixed-width code block</pre>
|
||||
<pre><code class="language-python">pre-formatted fixed-width code block written in the Python programming language</code></pre>
|
||||
```
|
||||
Please note:
|
||||
|
||||
- Only the tags mentioned above are currently supported.
|
||||
- All `<`, `>` and `&` symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities (`<` with `<`, `>` with `>` and `&` with `&`).
|
||||
- All numerical HTML entities are supported.
|
||||
- The API currently supports only the following named HTML entities: `<`, `>`, `&` and `"`.
|
||||
- Use nested `pre` and `code` tags, to define programming language for pre entity.
|
||||
- Programming language can't be specified for standalone `code` tags.
|
||||
- A valid emoji must be used as the content of the tg-emoji tag. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji sticker.
|
||||
- Custom emoji entities can only be used by bots that purchased additional usernames on Fragment.
|
||||
|
||||
#### Markdown style
|
||||
This is a legacy mode, retained for backward compatibility. To use this mode, pass *Markdown* in the *parse_mode* field. Use the following syntax in your message:
|
||||
|
||||
```
|
||||
*bold text*
|
||||
_italic text_
|
||||
[inline URL](http://www.example.com/)
|
||||
[inline mention of a user](tg://user?id=123456789)
|
||||
`inline fixed-width code`
|
||||
```
|
||||
pre-formatted fixed-width code block
|
||||
```
|
||||
```python
|
||||
pre-formatted fixed-width code block written in the Python programming language
|
||||
```
|
||||
```
|
||||
Please note:
|
||||
|
||||
- Entities must not be nested, use parse mode MarkdownV2 instead.
|
||||
- There is no way to specify underline and strikethrough entities, use parse mode MarkdownV2 instead.
|
||||
- To escape characters '_', '*', '`', '[' outside of an entity, prepend the characters '\' before them.
|
||||
- Escaping inside entities is not allowed, so entity must be closed first and reopened again: use `_snake_\__case_` for italic `snake_case` and `*2*\**2=4*` for bold `2*2=4`. */
|
||||
export type ParseMode = "Markdown" | "MarkdownV2" | "HTML";
|
||||
export declare namespace MessageEntity {
|
||||
interface AbstractMessageEntity {
|
||||
/** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */
|
||||
type: string;
|
||||
/** Offset in UTF-16 code units to the start of the entity */
|
||||
offset: number;
|
||||
/** Length of the entity in UTF-16 code units */
|
||||
length: number;
|
||||
}
|
||||
export interface CommonMessageEntity extends AbstractMessageEntity {
|
||||
type: "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "italic" | "underline" | "strikethrough" | "spoiler" | "code";
|
||||
}
|
||||
export interface PreMessageEntity extends AbstractMessageEntity {
|
||||
type: "pre";
|
||||
/** For “pre” only, the programming language of the entity text */
|
||||
language?: string;
|
||||
}
|
||||
export interface TextLinkMessageEntity extends AbstractMessageEntity {
|
||||
type: "text_link";
|
||||
/** For “text_link” only, URL that will be opened after user taps on the text */
|
||||
url: string;
|
||||
}
|
||||
export interface TextMentionMessageEntity extends AbstractMessageEntity {
|
||||
type: "text_mention";
|
||||
/** For “text_mention” only, the mentioned user */
|
||||
user: User;
|
||||
}
|
||||
export interface CustomEmojiMessageEntity extends AbstractMessageEntity {
|
||||
type: "custom_emoji";
|
||||
/** For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker */
|
||||
custom_emoji_id: string;
|
||||
}
|
||||
export {};
|
||||
}
|
||||
/** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */
|
||||
export type MessageEntity = MessageEntity.CommonMessageEntity | MessageEntity.CustomEmojiMessageEntity | MessageEntity.PreMessageEntity | MessageEntity.TextLinkMessageEntity | MessageEntity.TextMentionMessageEntity;
|
||||
/** This object represents one size of a photo or a file / sticker thumbnail. */
|
||||
export interface PhotoSize {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Photo width */
|
||||
width: number;
|
||||
/** Photo height */
|
||||
height: number;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
/** This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). */
|
||||
export interface Animation {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Video width as defined by sender */
|
||||
width: number;
|
||||
/** Video height as defined by sender */
|
||||
height: number;
|
||||
/** Duration of the video in seconds as defined by sender */
|
||||
duration: number;
|
||||
/** Animation thumbnail as defined by sender */
|
||||
thumbnail?: PhotoSize;
|
||||
/** Original animation filename as defined by sender */
|
||||
file_name?: string;
|
||||
/** MIME type of the file as defined by sender */
|
||||
mime_type?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
/** This object represents an audio file to be treated as music by the Telegram clients. */
|
||||
export interface Audio {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Duration of the audio in seconds as defined by sender */
|
||||
duration: number;
|
||||
/** Performer of the audio as defined by sender or by audio tags */
|
||||
performer?: string;
|
||||
/** Title of the audio as defined by sender or by audio tags */
|
||||
title?: string;
|
||||
/** Original filename as defined by sender */
|
||||
file_name?: string;
|
||||
/** MIME type of the file as defined by sender */
|
||||
mime_type?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
/** Thumbnail of the album cover to which the music file belongs */
|
||||
thumbnail?: PhotoSize;
|
||||
}
|
||||
/** This object represents a general file (as opposed to photos, voice messages and audio files). */
|
||||
export interface Document {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Document thumbnail as defined by sender */
|
||||
thumbnail?: PhotoSize;
|
||||
/** Original filename as defined by sender */
|
||||
file_name?: string;
|
||||
/** MIME type of the file as defined by sender */
|
||||
mime_type?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
/** This object represents a video file. */
|
||||
export interface Video {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Video width as defined by sender */
|
||||
width: number;
|
||||
/** Video height as defined by sender */
|
||||
height: number;
|
||||
/** Duration of the video in seconds as defined by sender */
|
||||
duration: number;
|
||||
/** Video thumbnail */
|
||||
thumbnail?: PhotoSize;
|
||||
/** Original filename as defined by sender */
|
||||
file_name?: string;
|
||||
/** MIME type of the file as defined by sender */
|
||||
mime_type?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
/** This object represents a video message (available in Telegram apps as of v.4.0). */
|
||||
export interface VideoNote {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Video width and height (diameter of the video message) as defined by sender */
|
||||
length: number;
|
||||
/** Duration of the video in seconds as defined by sender */
|
||||
duration: number;
|
||||
/** Video thumbnail */
|
||||
thumbnail?: PhotoSize;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
/** This object represents a voice note. */
|
||||
export interface Voice {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Duration of the audio in seconds as defined by sender */
|
||||
duration: number;
|
||||
/** MIME type of the file as defined by sender */
|
||||
mime_type?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
/** This object represents a phone contact. */
|
||||
export interface Contact {
|
||||
/** Contact's phone number */
|
||||
phone_number: string;
|
||||
/** Contact's first name */
|
||||
first_name: string;
|
||||
/** Contact's last name */
|
||||
last_name?: string;
|
||||
/** Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. */
|
||||
user_id?: number;
|
||||
/** Additional data about the contact in the form of a vCard */
|
||||
vcard?: string;
|
||||
}
|
||||
/** This object represents an animated emoji that displays a random value. */
|
||||
export interface Dice {
|
||||
/** Emoji on which the dice throw animation is based */
|
||||
emoji: string;
|
||||
/** Value of the dice, 1-6 for "🎲", "🎯" and "🎳" base emoji, 1-5 for "🏀" and "⚽" base emoji, 1-64 for "🎰" base emoji */
|
||||
value: number;
|
||||
}
|
||||
/** This object contains information about one answer option in a poll. */
|
||||
export interface PollOption {
|
||||
/** Option text, 1-100 characters */
|
||||
text: string;
|
||||
/** Number of users that voted for this option */
|
||||
voter_count: number;
|
||||
}
|
||||
/** This object represents an answer of a user in a non-anonymous poll. */
|
||||
export interface PollAnswer {
|
||||
/** Unique poll identifier */
|
||||
poll_id: string;
|
||||
/** The user, who changed the answer to the poll */
|
||||
user: User;
|
||||
/** 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. */
|
||||
option_ids: number[];
|
||||
}
|
||||
/** This object contains information about a poll. */
|
||||
export interface Poll {
|
||||
/** Unique poll identifier */
|
||||
id: string;
|
||||
/** Poll question, 1-300 characters */
|
||||
question: string;
|
||||
/** List of poll options */
|
||||
options: PollOption[];
|
||||
/** Total number of users that voted in the poll */
|
||||
total_voter_count: number;
|
||||
/** True, if the poll is closed */
|
||||
is_closed: boolean;
|
||||
/** True, if the poll is anonymous */
|
||||
is_anonymous: boolean;
|
||||
/** Poll type, currently can be “regular” or “quiz” */
|
||||
type: "regular" | "quiz";
|
||||
/** True, if the poll allows multiple answers */
|
||||
allows_multiple_answers: boolean;
|
||||
/** 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. */
|
||||
correct_option_id?: number;
|
||||
/** Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters */
|
||||
explanation?: string;
|
||||
/** Special entities like usernames, URLs, bot commands, etc. that appear in the explanation */
|
||||
explanation_entities?: MessageEntity[];
|
||||
/** Amount of time in seconds the poll will be active after creation */
|
||||
open_period?: number;
|
||||
/** Point in time (Unix timestamp) when the poll will be automatically closed */
|
||||
close_date?: number;
|
||||
}
|
||||
/** This object represents a point on the map. */
|
||||
export interface Location {
|
||||
/** Longitude as defined by sender */
|
||||
longitude: number;
|
||||
/** Latitude as defined by sender */
|
||||
latitude: number;
|
||||
/** The radius of uncertainty for the location, measured in meters; 0-1500 */
|
||||
horizontal_accuracy?: number;
|
||||
/** Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only. */
|
||||
live_period?: number;
|
||||
/** The direction in which user is moving, in degrees; 1-360. For active live locations only. */
|
||||
heading?: number;
|
||||
/** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
|
||||
proximity_alert_radius?: number;
|
||||
}
|
||||
/** This object represents a venue. */
|
||||
export interface Venue {
|
||||
/** Venue location. Can't be a live location */
|
||||
location: Location;
|
||||
/** Name of the venue */
|
||||
title: string;
|
||||
/** Address of the venue */
|
||||
address: string;
|
||||
/** Foursquare identifier of the venue */
|
||||
foursquare_id?: string;
|
||||
/** Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */
|
||||
foursquare_type?: string;
|
||||
/** Google Places identifier of the venue */
|
||||
google_place_id?: string;
|
||||
/** Google Places type of the venue. (See supported types.) */
|
||||
google_place_type?: string;
|
||||
}
|
||||
/** This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user. */
|
||||
export interface ProximityAlertTriggered {
|
||||
/** User that triggered the alert */
|
||||
traveler: User;
|
||||
/** User that set the alert */
|
||||
watcher: User;
|
||||
/** The distance between the users */
|
||||
distance: number;
|
||||
}
|
||||
/** This object represents a service message about a change in auto-delete timer settings. */
|
||||
export interface MessageAutoDeleteTimerChanged {
|
||||
/** New auto-delete time for messages in the chat; in seconds */
|
||||
message_auto_delete_time: number;
|
||||
}
|
||||
/** This object represents a service message about a new forum topic created in the chat. */
|
||||
export interface ForumTopicCreated {
|
||||
/** Name of the topic */
|
||||
name: string;
|
||||
/** Color of the topic icon in RGB format */
|
||||
icon_color: number;
|
||||
/** Unique identifier of the custom emoji shown as the topic icon */
|
||||
icon_custom_emoji_id?: string;
|
||||
}
|
||||
/** This object represents a service message about an edited forum topic. */
|
||||
export interface ForumTopicEdited {
|
||||
/** New name of the topic, if it was edited */
|
||||
name?: string;
|
||||
/** New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed */
|
||||
icon_custom_emoji_id?: string;
|
||||
}
|
||||
/** This object represents a service message about a forum topic closed in the chat. Currently holds no information. */
|
||||
export interface ForumTopicClosed {
|
||||
}
|
||||
/** This object represents a service message about a forum topic reopened in the chat. Currently holds no information. */
|
||||
export interface ForumTopicReopened {
|
||||
}
|
||||
/** This object represents a service message about General forum topic hidden in the chat. Currently holds no information. */
|
||||
export interface GeneralForumTopicHidden {
|
||||
}
|
||||
/** This object represents a service message about General forum topic unhidden in the chat. Currently holds no information. */
|
||||
export interface GeneralForumTopicUnhidden {
|
||||
}
|
||||
/** This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUser button. */
|
||||
export interface UserShared {
|
||||
/** Identifier of the request */
|
||||
request_id: number;
|
||||
/** Identifier of the shared user. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means. */
|
||||
user_id: number;
|
||||
}
|
||||
/** This object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button. */
|
||||
export interface ChatShared {
|
||||
/** Identifier of the request */
|
||||
request_id: number;
|
||||
/** Identifier of the shared chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means. */
|
||||
chat_id: number;
|
||||
}
|
||||
/** This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link. */
|
||||
export interface WriteAccessAllowed {
|
||||
/** Name of the Web App which was launched from a link */
|
||||
web_app_name?: string;
|
||||
}
|
||||
/** This object represents a service message about a video chat scheduled in the chat. */
|
||||
export interface VideoChatScheduled {
|
||||
/** Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator */
|
||||
start_date: number;
|
||||
}
|
||||
/** This object represents a service message about a video chat started in the chat. Currently holds no information. */
|
||||
export interface VideoChatStarted {
|
||||
}
|
||||
/** This object represents a service message about a video chat ended in the chat. */
|
||||
export interface VideoChatEnded {
|
||||
/** Video chat duration in seconds */
|
||||
duration: number;
|
||||
}
|
||||
/** This object represents a service message about new members invited to a video chat. */
|
||||
export interface VideoChatParticipantsInvited {
|
||||
/** New members that were invited to the video chat */
|
||||
users: User[];
|
||||
}
|
||||
/** Describes data sent from a Web App to the bot. */
|
||||
export interface WebAppData {
|
||||
/** The data. Be aware that a bad client can send arbitrary data in this field. */
|
||||
data: string;
|
||||
/** Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field. */
|
||||
button_text: string;
|
||||
}
|
||||
/** This object represents a sticker. */
|
||||
export interface Sticker {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video. */
|
||||
type: "regular" | "mask" | "custom_emoji";
|
||||
/** Sticker width */
|
||||
width: number;
|
||||
/** Sticker height */
|
||||
height: number;
|
||||
/** True, if the sticker is animated */
|
||||
is_animated: boolean;
|
||||
/** True, if the sticker is a video sticker */
|
||||
is_video: boolean;
|
||||
/** Sticker thumbnail in the .WEBP or .JPG format */
|
||||
thumbnail?: PhotoSize;
|
||||
/** Emoji associated with the sticker */
|
||||
emoji?: string;
|
||||
/** Name of the sticker set to which the sticker belongs */
|
||||
set_name?: string;
|
||||
/** For premium regular stickers, premium animation for the sticker */
|
||||
premium_animation?: File;
|
||||
/** For mask stickers, the position where the mask should be placed */
|
||||
mask_position?: MaskPosition;
|
||||
/** For custom emoji stickers, unique identifier of the custom emoji */
|
||||
custom_emoji_id?: string;
|
||||
/** File size in bytes */
|
||||
file_size?: number;
|
||||
}
|
||||
/** This object represents a sticker set. */
|
||||
export interface StickerSet {
|
||||
/** Sticker set name */
|
||||
name: string;
|
||||
/** Sticker set title */
|
||||
title: string;
|
||||
/** Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji” */
|
||||
sticker_type: "regular" | "mask" | "custom_emoji";
|
||||
/** True, if the sticker set contains animated stickers */
|
||||
is_animated: boolean;
|
||||
/** True, if the sticker set contains video stickers */
|
||||
is_video: boolean;
|
||||
/** List of all set stickers */
|
||||
stickers: Sticker[];
|
||||
/** Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format */
|
||||
thumbnail?: PhotoSize;
|
||||
}
|
||||
/** This object describes the position on faces where a mask should be placed by default. */
|
||||
export interface MaskPosition {
|
||||
/** The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”. */
|
||||
point: "forehead" | "eyes" | "mouth" | "chin";
|
||||
/** Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. */
|
||||
x_shift: number;
|
||||
/** Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. */
|
||||
y_shift: number;
|
||||
/** Mask scaling coefficient. For example, 2.0 means double size. */
|
||||
scale: number;
|
||||
}
|
||||
/** This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. */
|
||||
export interface Game {
|
||||
/** Title of the game */
|
||||
title: string;
|
||||
/** Description of the game */
|
||||
description: string;
|
||||
/** Photo that will be displayed in the game message in chats. */
|
||||
photo: PhotoSize[];
|
||||
/** Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters. */
|
||||
text: string;
|
||||
/** Special entities that appear in text, such as usernames, URLs, bot commands, etc. */
|
||||
text_entities: MessageEntity[];
|
||||
/** Animation that will be displayed in the game message in chats. Upload via BotFather */
|
||||
animation: Animation;
|
||||
}
|
||||
/** This object represents one row of the high scores table for a game. */
|
||||
export interface GameHighScore {
|
||||
/** Position in high score table for the game */
|
||||
position: number;
|
||||
/** User */
|
||||
user: User;
|
||||
/** Score */
|
||||
score: number;
|
||||
}
|
||||
export {};
|
1543
node_modules/@grammyjs/types/methods.d.ts
generated
vendored
1543
node_modules/@grammyjs/types/methods.d.ts
generated
vendored
File diff suppressed because it is too large
Load Diff
10
node_modules/@grammyjs/types/mod.d.ts
generated
vendored
10
node_modules/@grammyjs/types/mod.d.ts
generated
vendored
@ -1,10 +0,0 @@
|
||||
export * from "./api.js";
|
||||
export * from "./inline.js";
|
||||
export * from "./manage.js";
|
||||
export * from "./markup.js";
|
||||
export * from "./message.js";
|
||||
export * from "./methods.js";
|
||||
export * from "./passport.js";
|
||||
export * from "./payment.js";
|
||||
export * from "./settings.js";
|
||||
export * from "./update.js";
|
2
node_modules/@grammyjs/types/mod.js
generated
vendored
2
node_modules/@grammyjs/types/mod.js
generated
vendored
@ -1,2 +0,0 @@
|
||||
/* The comment below makes Vite recognize an empty main file as a valid CJS module. */
|
||||
// module.exports
|
34
node_modules/@grammyjs/types/package.json
generated
vendored
34
node_modules/@grammyjs/types/package.json
generated
vendored
@ -1,34 +0,0 @@
|
||||
{
|
||||
"name": "@grammyjs/types",
|
||||
"version": "3.1.2",
|
||||
"description": "Telegram Bot API type declarations for grammY",
|
||||
"main": "mod.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/grammyjs/types.git"
|
||||
},
|
||||
"keywords": [
|
||||
"grammy",
|
||||
"telegram",
|
||||
"bot",
|
||||
"api",
|
||||
"types"
|
||||
],
|
||||
"scripts": {
|
||||
"prepare": "deno task backport"
|
||||
},
|
||||
"author": "KnorpelSenf",
|
||||
"types": "mod.d.ts",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/grammyjs/types/issues"
|
||||
},
|
||||
"files": [
|
||||
"*.d.ts",
|
||||
"mod.js"
|
||||
],
|
||||
"homepage": "https://grammy.dev/",
|
||||
"devDependencies": {
|
||||
"deno-bin": "^1.31.1"
|
||||
}
|
||||
}
|
163
node_modules/@grammyjs/types/passport.d.ts
generated
vendored
163
node_modules/@grammyjs/types/passport.d.ts
generated
vendored
@ -1,163 +0,0 @@
|
||||
/** Describes Telegram Passport data shared with the bot by the user. */
|
||||
export interface PassportData {
|
||||
/** Array with information about documents and other Telegram Passport elements that was shared with the bot */
|
||||
data: EncryptedPassportElement[];
|
||||
/** Encrypted credentials required to decrypt the data */
|
||||
credentials: EncryptedCredentials;
|
||||
}
|
||||
/** This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB. */
|
||||
export interface PassportFile {
|
||||
/** Identifier for this file, which can be used to download or reuse the file */
|
||||
file_id: string;
|
||||
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
||||
file_unique_id: string;
|
||||
/** File size in bytes */
|
||||
file_size: number;
|
||||
/** Unix time when the file was uploaded */
|
||||
file_date: number;
|
||||
}
|
||||
/** Describes documents or other Telegram Passport elements shared with the bot by the user. */
|
||||
export interface EncryptedPassportElement {
|
||||
/** Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”. */
|
||||
type: "personal_details" | "passport" | "driver_license" | "identity_card" | "internal_passport" | "address" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration" | "phone_number" | "email";
|
||||
/** Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
data?: string;
|
||||
/** User's verified phone number, available only for “phone_number” type */
|
||||
phone_number?: string;
|
||||
/** User's verified email address, available only for “email” type */
|
||||
email?: string;
|
||||
/** Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
files?: PassportFile[];
|
||||
/** Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
front_side?: PassportFile;
|
||||
/** Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
reverse_side?: PassportFile;
|
||||
/** Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
selfie?: PassportFile;
|
||||
/** Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
|
||||
translation?: PassportFile[];
|
||||
/** Base64-encoded element hash for using in PassportElementErrorUnspecified */
|
||||
hash: string;
|
||||
}
|
||||
/** Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. */
|
||||
export interface EncryptedCredentials {
|
||||
/** Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication */
|
||||
data: string;
|
||||
/** Base64-encoded data hash for data authentication */
|
||||
hash: string;
|
||||
/** Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption */
|
||||
secret: string;
|
||||
}
|
||||
/** This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
|
||||
- PassportElementErrorDataField
|
||||
- PassportElementErrorFrontSide
|
||||
- PassportElementErrorReverseSide
|
||||
- PassportElementErrorSelfie
|
||||
- PassportElementErrorFile
|
||||
- PassportElementErrorFiles
|
||||
- PassportElementErrorTranslationFile
|
||||
- PassportElementErrorTranslationFiles
|
||||
- PassportElementErrorUnspecified
|
||||
*/
|
||||
export type PassportElementError = PassportElementErrorDataField | PassportElementErrorFrontSide | PassportElementErrorReverseSide | PassportElementErrorSelfie | PassportElementErrorFile | PassportElementErrorFiles | PassportElementErrorTranslationFile | PassportElementErrorTranslationFiles | PassportElementErrorUnspecified;
|
||||
/** Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes. */
|
||||
export interface PassportElementErrorDataField {
|
||||
/** Error source, must be data */
|
||||
source: "data";
|
||||
/** The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address” */
|
||||
type: "personal_details" | "passport" | "driver_license" | "identity_card" | "internal_passport" | "address";
|
||||
/** Name of the data field which has the error */
|
||||
field_name: string;
|
||||
/** Base64-encoded data hash */
|
||||
data_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
/** Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes. */
|
||||
export interface PassportElementErrorFrontSide {
|
||||
/** Error source, must be front_side */
|
||||
source: "front_side";
|
||||
/** The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” */
|
||||
type: "passport" | "driver_license" | "identity_card" | "internal_passport";
|
||||
/** Base64-encoded hash of the file with the front side of the document */
|
||||
file_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
/** Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes. */
|
||||
export interface PassportElementErrorReverseSide {
|
||||
/** Error source, must be reverse_side */
|
||||
source: "reverse_side";
|
||||
/** The section of the user's Telegram Passport which has the issue, one of “driver_license”, “identity_card” */
|
||||
type: "driver_license" | "identity_card";
|
||||
/** Base64-encoded hash of the file with the reverse side of the document */
|
||||
file_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
/** Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. */
|
||||
export interface PassportElementErrorSelfie {
|
||||
/** Error source, must be selfie */
|
||||
source: "selfie";
|
||||
/** The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” */
|
||||
type: "passport" | "driver_license" | "identity_card" | "internal_passport";
|
||||
/** Base64-encoded hash of the file with the selfie */
|
||||
file_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
/** Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. */
|
||||
export interface PassportElementErrorFile {
|
||||
/** Error source, must be file */
|
||||
source: "file";
|
||||
/** The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
|
||||
type: "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
|
||||
/** Base64-encoded file hash */
|
||||
file_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
/** Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. */
|
||||
export interface PassportElementErrorFiles {
|
||||
/** Error source, must be files */
|
||||
source: "files";
|
||||
/** The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
|
||||
type: "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
|
||||
/** List of base64-encoded file hashes */
|
||||
file_hashes: string[];
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
/** Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. */
|
||||
export interface PassportElementErrorTranslationFile {
|
||||
/** Error source, must be translation_file */
|
||||
source: "translation_file";
|
||||
/** Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
|
||||
type: "passport" | "driver_license" | "identity_card" | "internal_passport" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
|
||||
/** Base64-encoded file hash */
|
||||
file_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
/** Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change. */
|
||||
export interface PassportElementErrorTranslationFiles {
|
||||
/** Error source, must be translation_files */
|
||||
source: "translation_files";
|
||||
/** Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
|
||||
type: "passport" | "driver_license" | "identity_card" | "internal_passport" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
|
||||
/** List of base64-encoded file hashes */
|
||||
file_hashes: string[];
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
||||
/** Represents an issue in an unspecified place. The error is considered resolved when new data is added. */
|
||||
export interface PassportElementErrorUnspecified {
|
||||
/** Error source, must be unspecified */
|
||||
source: "unspecified";
|
||||
/** Type of element of the user's Telegram Passport which has the issue */
|
||||
type: string;
|
||||
/** Base64-encoded element hash */
|
||||
element_hash: string;
|
||||
/** Error message */
|
||||
message: string;
|
||||
}
|
101
node_modules/@grammyjs/types/payment.d.ts
generated
vendored
101
node_modules/@grammyjs/types/payment.d.ts
generated
vendored
@ -1,101 +0,0 @@
|
||||
import type { User } from "./manage.js";
|
||||
/** This object represents a portion of the price for goods or services. */
|
||||
export interface LabeledPrice {
|
||||
/** Portion label */
|
||||
label: string;
|
||||
/** Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
|
||||
amount: number;
|
||||
}
|
||||
/** This object contains basic information about an invoice. */
|
||||
export interface Invoice {
|
||||
/** Product name */
|
||||
title: string;
|
||||
/** Product description */
|
||||
description: string;
|
||||
/** Unique bot deep-linking parameter that can be used to generate this invoice */
|
||||
start_parameter: string;
|
||||
/** Three-letter ISO 4217 currency code */
|
||||
currency: string;
|
||||
/** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
|
||||
total_amount: number;
|
||||
}
|
||||
/** This object represents a shipping address. */
|
||||
export interface ShippingAddress {
|
||||
/** Two-letter ISO 3166-1 alpha-2 country code */
|
||||
country_code: string;
|
||||
/** State, if applicable */
|
||||
state: string;
|
||||
/** City */
|
||||
city: string;
|
||||
/** First line for the address */
|
||||
street_line1: string;
|
||||
/** Second line for the address */
|
||||
street_line2: string;
|
||||
/** Address post code */
|
||||
post_code: string;
|
||||
}
|
||||
/** This object represents information about an order. */
|
||||
export interface OrderInfo {
|
||||
/** User name */
|
||||
name?: string;
|
||||
/** User's phone number */
|
||||
phone_number?: string;
|
||||
/** User email */
|
||||
email?: string;
|
||||
/** User shipping address */
|
||||
shipping_address?: ShippingAddress;
|
||||
}
|
||||
/** This object represents one shipping option. */
|
||||
export interface ShippingOption {
|
||||
/** Shipping option identifier */
|
||||
id: string;
|
||||
/** Option title */
|
||||
title: string;
|
||||
/** List of price portions */
|
||||
prices: LabeledPrice[];
|
||||
}
|
||||
/** This object contains basic information about a successful payment. */
|
||||
export interface SuccessfulPayment {
|
||||
/** Three-letter ISO 4217 currency code */
|
||||
currency: string;
|
||||
/** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
|
||||
total_amount: number;
|
||||
/** Bot specified invoice payload */
|
||||
invoice_payload: string;
|
||||
/** Identifier of the shipping option chosen by the user */
|
||||
shipping_option_id?: string;
|
||||
/** Order information provided by the user */
|
||||
order_info?: OrderInfo;
|
||||
/** Telegram payment identifier */
|
||||
telegram_payment_charge_id: string;
|
||||
/** Provider payment identifier */
|
||||
provider_payment_charge_id: string;
|
||||
}
|
||||
/** This object contains information about an incoming shipping query. */
|
||||
export interface ShippingQuery {
|
||||
/** Unique query identifier */
|
||||
id: string;
|
||||
/** User who sent the query */
|
||||
from: User;
|
||||
/** Bot specified invoice payload */
|
||||
invoice_payload: string;
|
||||
/** User specified shipping address */
|
||||
shipping_address: ShippingAddress;
|
||||
}
|
||||
/** This object contains information about an incoming pre-checkout query. */
|
||||
export interface PreCheckoutQuery {
|
||||
/** Unique query identifier */
|
||||
id: string;
|
||||
/** User who sent the query */
|
||||
from: User;
|
||||
/** Three-letter ISO 4217 currency code */
|
||||
currency: string;
|
||||
/** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
|
||||
total_amount: number;
|
||||
/** Bot specified invoice payload */
|
||||
invoice_payload: string;
|
||||
/** Identifier of the shipping option chosen by the user */
|
||||
shipping_option_id?: string;
|
||||
/** Order information provided by the user */
|
||||
order_info?: OrderInfo;
|
||||
}
|
120
node_modules/@grammyjs/types/settings.d.ts
generated
vendored
120
node_modules/@grammyjs/types/settings.d.ts
generated
vendored
@ -1,120 +0,0 @@
|
||||
import type { WebAppInfo } from "./markup.js";
|
||||
/** This object represents the bot's name. */
|
||||
export interface BotName {
|
||||
/** The bot's name */
|
||||
name: string;
|
||||
}
|
||||
/** This object represents the bot's description. */
|
||||
export interface BotDescription {
|
||||
/** The bot's description */
|
||||
description: string;
|
||||
}
|
||||
/** This object represents the bot's short description. */
|
||||
export interface BotShortDescription {
|
||||
/** The bot's short description */
|
||||
short_description: string;
|
||||
}
|
||||
/** This object describes the bot's menu button in a private chat. It should be one of
|
||||
- MenuButtonCommands
|
||||
- MenuButtonWebApp
|
||||
- MenuButtonDefault
|
||||
|
||||
If a menu button other than MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands. */
|
||||
export type MenuButton = MenuButtonCommands | MenuButtonWebApp | MenuButtonDefault;
|
||||
/** Represents a menu button, which opens the bot's list of commands. */
|
||||
export interface MenuButtonCommands {
|
||||
/** Type of the button, must be commands */
|
||||
type: "commands";
|
||||
}
|
||||
/** Represents a menu button, which launches a Web App. */
|
||||
export interface MenuButtonWebApp {
|
||||
/** Button type, must be web_app */
|
||||
type: "web_app";
|
||||
/** Text on the button */
|
||||
text: string;
|
||||
/** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. */
|
||||
web_app: WebAppInfo;
|
||||
}
|
||||
/** Describes that no specific value for the menu button was set. */
|
||||
export interface MenuButtonDefault {
|
||||
/** Type of the button, must be default */
|
||||
type: "default";
|
||||
}
|
||||
/** This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:
|
||||
- BotCommandScopeDefault
|
||||
- BotCommandScopeAllPrivateChats
|
||||
- BotCommandScopeAllGroupChats
|
||||
- BotCommandScopeAllChatAdministrators
|
||||
- BotCommandScopeChat
|
||||
- BotCommandScopeChatAdministrators
|
||||
- BotCommandScopeChatMember
|
||||
|
||||
## Determining list of commands
|
||||
|
||||
The following algorithm is used to determine the list of commands for a particular user viewing the bot menu. The first list of commands which is set is returned:
|
||||
|
||||
### Commands in the chat with the bot
|
||||
- botCommandScopeChat + language_code
|
||||
- botCommandScopeChat
|
||||
- botCommandScopeAllPrivateChats + language_code
|
||||
- botCommandScopeAllPrivateChats
|
||||
- botCommandScopeDefault + language_code
|
||||
- botCommandScopeDefault
|
||||
|
||||
### Commands in group and supergroup chats
|
||||
- botCommandScopeChatMember + language_code
|
||||
- botCommandScopeChatMember
|
||||
- botCommandScopeChatAdministrators + language_code (administrators only)
|
||||
- botCommandScopeChatAdministrators (administrators only)
|
||||
- botCommandScopeChat + language_code
|
||||
- botCommandScopeChat
|
||||
- botCommandScopeAllChatAdministrators + language_code (administrators only)
|
||||
- botCommandScopeAllChatAdministrators (administrators only)
|
||||
- botCommandScopeAllGroupChats + language_code
|
||||
- botCommandScopeAllGroupChats
|
||||
- botCommandScopeDefault + language_code
|
||||
- botCommandScopeDefault */
|
||||
export type BotCommandScope = BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember;
|
||||
/** Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user. */
|
||||
export interface BotCommandScopeDefault {
|
||||
/** Scope type, must be default */
|
||||
type: "default";
|
||||
}
|
||||
/** Represents the scope of bot commands, covering all private chats. */
|
||||
export interface BotCommandScopeAllPrivateChats {
|
||||
/** Scope type, must be all_private_chats */
|
||||
type: "all_private_chats";
|
||||
}
|
||||
/** Represents the scope of bot commands, covering all group and supergroup chats. */
|
||||
export interface BotCommandScopeAllGroupChats {
|
||||
/** Scope type, must be all_group_chats */
|
||||
type: "all_group_chats";
|
||||
}
|
||||
/** Represents the scope of bot commands, covering all group and supergroup chat administrators. */
|
||||
export interface BotCommandScopeAllChatAdministrators {
|
||||
/** Scope type, must be all_chat_administrators */
|
||||
type: "all_chat_administrators";
|
||||
}
|
||||
/** Represents the scope of bot commands, covering a specific chat. */
|
||||
export interface BotCommandScopeChat {
|
||||
/** Scope type, must be chat */
|
||||
type: "chat";
|
||||
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
|
||||
chat_id: number | string;
|
||||
}
|
||||
/** Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat. */
|
||||
export interface BotCommandScopeChatAdministrators {
|
||||
/** Scope type, must be chat_administrators */
|
||||
type: "chat_administrators";
|
||||
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
|
||||
chat_id: number | string;
|
||||
}
|
||||
/** Represents the scope of bot commands, covering a specific member of a group or supergroup chat. */
|
||||
export interface BotCommandScopeChatMember {
|
||||
/** Scope type, must be chat_member */
|
||||
type: "chat_member";
|
||||
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
|
||||
chat_id: number | string;
|
||||
/** Unique identifier of the target user */
|
||||
user_id: number;
|
||||
}
|
56
node_modules/@grammyjs/types/update.d.ts
generated
vendored
56
node_modules/@grammyjs/types/update.d.ts
generated
vendored
@ -1,56 +0,0 @@
|
||||
import type { ChosenInlineResult, InlineQuery } from "./inline.js";
|
||||
import type { Chat, ChatJoinRequest, ChatMemberUpdated, User } from "./manage.js";
|
||||
import type { CallbackQuery } from "./markup.js";
|
||||
import type { Message, Poll, PollAnswer } from "./message.js";
|
||||
import type { PreCheckoutQuery, ShippingQuery } from "./payment.js";
|
||||
/** Internal namespace used to make some message types more accurate */
|
||||
export declare namespace Update {
|
||||
/** Internal type holding properties that message updates in channels share. */
|
||||
interface Channel {
|
||||
chat: Chat.ChannelChat;
|
||||
}
|
||||
/** Internal type holding properties that message updates outside of channels share. */
|
||||
interface NonChannel {
|
||||
chat: Exclude<Chat, Chat.ChannelChat>;
|
||||
from: User;
|
||||
}
|
||||
/** Internal type holding properties that updates about edited messages share. */
|
||||
interface Edited {
|
||||
/** Date the message was last edited in Unix time */
|
||||
edit_date: number;
|
||||
}
|
||||
}
|
||||
/** This object represents an incoming update.
|
||||
At most one of the optional parameters can be present in any given update. */
|
||||
export interface Update {
|
||||
/** The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */
|
||||
update_id: number;
|
||||
/** New incoming message of any kind - text, photo, sticker, etc. */
|
||||
message?: Message & Update.NonChannel;
|
||||
/** New version of a message that is known to the bot and was edited */
|
||||
edited_message?: Message & Update.Edited & Update.NonChannel;
|
||||
/** New incoming channel post of any kind - text, photo, sticker, etc. */
|
||||
channel_post?: Message & Update.Channel;
|
||||
/** New version of a channel post that is known to the bot and was edited */
|
||||
edited_channel_post?: Message & Update.Edited & Update.Channel;
|
||||
/** New incoming inline query */
|
||||
inline_query?: InlineQuery;
|
||||
/** The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. */
|
||||
chosen_inline_result?: ChosenInlineResult;
|
||||
/** New incoming callback query */
|
||||
callback_query?: CallbackQuery;
|
||||
/** New incoming shipping query. Only for invoices with flexible price */
|
||||
shipping_query?: ShippingQuery;
|
||||
/** New incoming pre-checkout query. Contains full information about checkout */
|
||||
pre_checkout_query?: PreCheckoutQuery;
|
||||
/** New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot */
|
||||
poll?: Poll;
|
||||
/** A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. */
|
||||
poll_answer?: PollAnswer;
|
||||
/** The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. */
|
||||
my_chat_member?: ChatMemberUpdated;
|
||||
/** A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. */
|
||||
chat_member?: ChatMemberUpdated;
|
||||
/** A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates. */
|
||||
chat_join_request?: ChatJoinRequest;
|
||||
}
|
19
node_modules/@jridgewell/resolve-uri/LICENSE
generated
vendored
19
node_modules/@jridgewell/resolve-uri/LICENSE
generated
vendored
@ -1,19 +0,0 @@
|
||||
Copyright 2019 Justin Ridgewell <jridgewell@google.com>
|
||||
|
||||
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.
|
40
node_modules/@jridgewell/resolve-uri/README.md
generated
vendored
40
node_modules/@jridgewell/resolve-uri/README.md
generated
vendored
@ -1,40 +0,0 @@
|
||||
# @jridgewell/resolve-uri
|
||||
|
||||
> Resolve a URI relative to an optional base URI
|
||||
|
||||
Resolve any combination of absolute URIs, protocol-realtive URIs, absolute paths, or relative paths.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install @jridgewell/resolve-uri
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
function resolve(input: string, base?: string): string;
|
||||
```
|
||||
|
||||
```js
|
||||
import resolve from '@jridgewell/resolve-uri';
|
||||
|
||||
resolve('foo', 'https://example.com'); // => 'https://example.com/foo'
|
||||
```
|
||||
|
||||
| Input | Base | Resolution | Explanation |
|
||||
|-----------------------|-------------------------|--------------------------------|--------------------------------------------------------------|
|
||||
| `https://example.com` | _any_ | `https://example.com/` | Input is normalized only |
|
||||
| `//example.com` | `https://base.com/` | `https://example.com/` | Input inherits the base's protocol |
|
||||
| `//example.com` | _rest_ | `//example.com/` | Input is normalized only |
|
||||
| `/example` | `https://base.com/` | `https://base.com/example` | Input inherits the base's origin |
|
||||
| `/example` | `//base.com/` | `//base.com/example` | Input inherits the base's host and remains protocol relative |
|
||||
| `/example` | _rest_ | `/example` | Input is normalized only |
|
||||
| `example` | `https://base.com/dir/` | `https://base.com/dir/example` | Input is joined with the base |
|
||||
| `example` | `https://base.com/file` | `https://base.com/example` | Input is joined with the base without its file |
|
||||
| `example` | `//base.com/dir/` | `//base.com/dir/example` | Input is joined with the base's last directory |
|
||||
| `example` | `//base.com/file` | `//base.com/example` | Input is joined with the base without its file |
|
||||
| `example` | `/base/dir/` | `/base/dir/example` | Input is joined with the base's last directory |
|
||||
| `example` | `/base/file` | `/base/example` | Input is joined with the base without its file |
|
||||
| `example` | `base/dir/` | `base/dir/example` | Input is joined with the base's last directory |
|
||||
| `example` | `base/file` | `base/example` | Input is joined with the base without its file |
|
242
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
generated
vendored
242
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
generated
vendored
@ -1,242 +0,0 @@
|
||||
// Matches the scheme of a URL, eg "http://"
|
||||
const schemeRegex = /^[\w+.-]+:\/\//;
|
||||
/**
|
||||
* Matches the parts of a URL:
|
||||
* 1. Scheme, including ":", guaranteed.
|
||||
* 2. User/password, including "@", optional.
|
||||
* 3. Host, guaranteed.
|
||||
* 4. Port, including ":", optional.
|
||||
* 5. Path, including "/", optional.
|
||||
* 6. Query, including "?", optional.
|
||||
* 7. Hash, including "#", optional.
|
||||
*/
|
||||
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
||||
/**
|
||||
* File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
|
||||
* with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
|
||||
*
|
||||
* 1. Host, optional.
|
||||
* 2. Path, which may include "/", guaranteed.
|
||||
* 3. Query, including "?", optional.
|
||||
* 4. Hash, including "#", optional.
|
||||
*/
|
||||
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
||||
var UrlType;
|
||||
(function (UrlType) {
|
||||
UrlType[UrlType["Empty"] = 1] = "Empty";
|
||||
UrlType[UrlType["Hash"] = 2] = "Hash";
|
||||
UrlType[UrlType["Query"] = 3] = "Query";
|
||||
UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
|
||||
UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
|
||||
UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
|
||||
UrlType[UrlType["Absolute"] = 7] = "Absolute";
|
||||
})(UrlType || (UrlType = {}));
|
||||
function isAbsoluteUrl(input) {
|
||||
return schemeRegex.test(input);
|
||||
}
|
||||
function isSchemeRelativeUrl(input) {
|
||||
return input.startsWith('//');
|
||||
}
|
||||
function isAbsolutePath(input) {
|
||||
return input.startsWith('/');
|
||||
}
|
||||
function isFileUrl(input) {
|
||||
return input.startsWith('file:');
|
||||
}
|
||||
function isRelative(input) {
|
||||
return /^[.?#]/.test(input);
|
||||
}
|
||||
function parseAbsoluteUrl(input) {
|
||||
const match = urlRegex.exec(input);
|
||||
return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
|
||||
}
|
||||
function parseFileUrl(input) {
|
||||
const match = fileRegex.exec(input);
|
||||
const path = match[2];
|
||||
return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
|
||||
}
|
||||
function makeUrl(scheme, user, host, port, path, query, hash) {
|
||||
return {
|
||||
scheme,
|
||||
user,
|
||||
host,
|
||||
port,
|
||||
path,
|
||||
query,
|
||||
hash,
|
||||
type: UrlType.Absolute,
|
||||
};
|
||||
}
|
||||
function parseUrl(input) {
|
||||
if (isSchemeRelativeUrl(input)) {
|
||||
const url = parseAbsoluteUrl('http:' + input);
|
||||
url.scheme = '';
|
||||
url.type = UrlType.SchemeRelative;
|
||||
return url;
|
||||
}
|
||||
if (isAbsolutePath(input)) {
|
||||
const url = parseAbsoluteUrl('http://foo.com' + input);
|
||||
url.scheme = '';
|
||||
url.host = '';
|
||||
url.type = UrlType.AbsolutePath;
|
||||
return url;
|
||||
}
|
||||
if (isFileUrl(input))
|
||||
return parseFileUrl(input);
|
||||
if (isAbsoluteUrl(input))
|
||||
return parseAbsoluteUrl(input);
|
||||
const url = parseAbsoluteUrl('http://foo.com/' + input);
|
||||
url.scheme = '';
|
||||
url.host = '';
|
||||
url.type = input
|
||||
? input.startsWith('?')
|
||||
? UrlType.Query
|
||||
: input.startsWith('#')
|
||||
? UrlType.Hash
|
||||
: UrlType.RelativePath
|
||||
: UrlType.Empty;
|
||||
return url;
|
||||
}
|
||||
function stripPathFilename(path) {
|
||||
// If a path ends with a parent directory "..", then it's a relative path with excess parent
|
||||
// paths. It's not a file, so we can't strip it.
|
||||
if (path.endsWith('/..'))
|
||||
return path;
|
||||
const index = path.lastIndexOf('/');
|
||||
return path.slice(0, index + 1);
|
||||
}
|
||||
function mergePaths(url, base) {
|
||||
normalizePath(base, base.type);
|
||||
// If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
|
||||
// path).
|
||||
if (url.path === '/') {
|
||||
url.path = base.path;
|
||||
}
|
||||
else {
|
||||
// Resolution happens relative to the base path's directory, not the file.
|
||||
url.path = stripPathFilename(base.path) + url.path;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
|
||||
* "foo/.". We need to normalize to a standard representation.
|
||||
*/
|
||||
function normalizePath(url, type) {
|
||||
const rel = type <= UrlType.RelativePath;
|
||||
const pieces = url.path.split('/');
|
||||
// We need to preserve the first piece always, so that we output a leading slash. The item at
|
||||
// pieces[0] is an empty string.
|
||||
let pointer = 1;
|
||||
// Positive is the number of real directories we've output, used for popping a parent directory.
|
||||
// Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
|
||||
let positive = 0;
|
||||
// We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
|
||||
// generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
|
||||
// real directory, we won't need to append, unless the other conditions happen again.
|
||||
let addTrailingSlash = false;
|
||||
for (let i = 1; i < pieces.length; i++) {
|
||||
const piece = pieces[i];
|
||||
// An empty directory, could be a trailing slash, or just a double "//" in the path.
|
||||
if (!piece) {
|
||||
addTrailingSlash = true;
|
||||
continue;
|
||||
}
|
||||
// If we encounter a real directory, then we don't need to append anymore.
|
||||
addTrailingSlash = false;
|
||||
// A current directory, which we can always drop.
|
||||
if (piece === '.')
|
||||
continue;
|
||||
// A parent directory, we need to see if there are any real directories we can pop. Else, we
|
||||
// have an excess of parents, and we'll need to keep the "..".
|
||||
if (piece === '..') {
|
||||
if (positive) {
|
||||
addTrailingSlash = true;
|
||||
positive--;
|
||||
pointer--;
|
||||
}
|
||||
else if (rel) {
|
||||
// If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
|
||||
// URL, protocol relative URL, or an absolute path, we don't need to keep excess.
|
||||
pieces[pointer++] = piece;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// We've encountered a real directory. Move it to the next insertion pointer, which accounts for
|
||||
// any popped or dropped directories.
|
||||
pieces[pointer++] = piece;
|
||||
positive++;
|
||||
}
|
||||
let path = '';
|
||||
for (let i = 1; i < pointer; i++) {
|
||||
path += '/' + pieces[i];
|
||||
}
|
||||
if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
|
||||
path += '/';
|
||||
}
|
||||
url.path = path;
|
||||
}
|
||||
/**
|
||||
* Attempts to resolve `input` URL/path relative to `base`.
|
||||
*/
|
||||
function resolve(input, base) {
|
||||
if (!input && !base)
|
||||
return '';
|
||||
const url = parseUrl(input);
|
||||
let inputType = url.type;
|
||||
if (base && inputType !== UrlType.Absolute) {
|
||||
const baseUrl = parseUrl(base);
|
||||
const baseType = baseUrl.type;
|
||||
switch (inputType) {
|
||||
case UrlType.Empty:
|
||||
url.hash = baseUrl.hash;
|
||||
// fall through
|
||||
case UrlType.Hash:
|
||||
url.query = baseUrl.query;
|
||||
// fall through
|
||||
case UrlType.Query:
|
||||
case UrlType.RelativePath:
|
||||
mergePaths(url, baseUrl);
|
||||
// fall through
|
||||
case UrlType.AbsolutePath:
|
||||
// The host, user, and port are joined, you can't copy one without the others.
|
||||
url.user = baseUrl.user;
|
||||
url.host = baseUrl.host;
|
||||
url.port = baseUrl.port;
|
||||
// fall through
|
||||
case UrlType.SchemeRelative:
|
||||
// The input doesn't have a schema at least, so we need to copy at least that over.
|
||||
url.scheme = baseUrl.scheme;
|
||||
}
|
||||
if (baseType > inputType)
|
||||
inputType = baseType;
|
||||
}
|
||||
normalizePath(url, inputType);
|
||||
const queryHash = url.query + url.hash;
|
||||
switch (inputType) {
|
||||
// This is impossible, because of the empty checks at the start of the function.
|
||||
// case UrlType.Empty:
|
||||
case UrlType.Hash:
|
||||
case UrlType.Query:
|
||||
return queryHash;
|
||||
case UrlType.RelativePath: {
|
||||
// The first char is always a "/", and we need it to be relative.
|
||||
const path = url.path.slice(1);
|
||||
if (!path)
|
||||
return queryHash || '.';
|
||||
if (isRelative(base || input) && !isRelative(path)) {
|
||||
// If base started with a leading ".", or there is no base and input started with a ".",
|
||||
// then we need to ensure that the relative path starts with a ".". We don't know if
|
||||
// relative starts with a "..", though, so check before prepending.
|
||||
return './' + path + queryHash;
|
||||
}
|
||||
return path + queryHash;
|
||||
}
|
||||
case UrlType.AbsolutePath:
|
||||
return url.path + queryHash;
|
||||
default:
|
||||
return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
|
||||
}
|
||||
}
|
||||
|
||||
export { resolve as default };
|
||||
//# sourceMappingURL=resolve-uri.mjs.map
|
1
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map
generated
vendored
1
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
250
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js
generated
vendored
250
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js
generated
vendored
@ -1,250 +0,0 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.resolveURI = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
// Matches the scheme of a URL, eg "http://"
|
||||
const schemeRegex = /^[\w+.-]+:\/\//;
|
||||
/**
|
||||
* Matches the parts of a URL:
|
||||
* 1. Scheme, including ":", guaranteed.
|
||||
* 2. User/password, including "@", optional.
|
||||
* 3. Host, guaranteed.
|
||||
* 4. Port, including ":", optional.
|
||||
* 5. Path, including "/", optional.
|
||||
* 6. Query, including "?", optional.
|
||||
* 7. Hash, including "#", optional.
|
||||
*/
|
||||
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
||||
/**
|
||||
* File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
|
||||
* with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
|
||||
*
|
||||
* 1. Host, optional.
|
||||
* 2. Path, which may include "/", guaranteed.
|
||||
* 3. Query, including "?", optional.
|
||||
* 4. Hash, including "#", optional.
|
||||
*/
|
||||
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
||||
var UrlType;
|
||||
(function (UrlType) {
|
||||
UrlType[UrlType["Empty"] = 1] = "Empty";
|
||||
UrlType[UrlType["Hash"] = 2] = "Hash";
|
||||
UrlType[UrlType["Query"] = 3] = "Query";
|
||||
UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
|
||||
UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
|
||||
UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
|
||||
UrlType[UrlType["Absolute"] = 7] = "Absolute";
|
||||
})(UrlType || (UrlType = {}));
|
||||
function isAbsoluteUrl(input) {
|
||||
return schemeRegex.test(input);
|
||||
}
|
||||
function isSchemeRelativeUrl(input) {
|
||||
return input.startsWith('//');
|
||||
}
|
||||
function isAbsolutePath(input) {
|
||||
return input.startsWith('/');
|
||||
}
|
||||
function isFileUrl(input) {
|
||||
return input.startsWith('file:');
|
||||
}
|
||||
function isRelative(input) {
|
||||
return /^[.?#]/.test(input);
|
||||
}
|
||||
function parseAbsoluteUrl(input) {
|
||||
const match = urlRegex.exec(input);
|
||||
return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
|
||||
}
|
||||
function parseFileUrl(input) {
|
||||
const match = fileRegex.exec(input);
|
||||
const path = match[2];
|
||||
return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
|
||||
}
|
||||
function makeUrl(scheme, user, host, port, path, query, hash) {
|
||||
return {
|
||||
scheme,
|
||||
user,
|
||||
host,
|
||||
port,
|
||||
path,
|
||||
query,
|
||||
hash,
|
||||
type: UrlType.Absolute,
|
||||
};
|
||||
}
|
||||
function parseUrl(input) {
|
||||
if (isSchemeRelativeUrl(input)) {
|
||||
const url = parseAbsoluteUrl('http:' + input);
|
||||
url.scheme = '';
|
||||
url.type = UrlType.SchemeRelative;
|
||||
return url;
|
||||
}
|
||||
if (isAbsolutePath(input)) {
|
||||
const url = parseAbsoluteUrl('http://foo.com' + input);
|
||||
url.scheme = '';
|
||||
url.host = '';
|
||||
url.type = UrlType.AbsolutePath;
|
||||
return url;
|
||||
}
|
||||
if (isFileUrl(input))
|
||||
return parseFileUrl(input);
|
||||
if (isAbsoluteUrl(input))
|
||||
return parseAbsoluteUrl(input);
|
||||
const url = parseAbsoluteUrl('http://foo.com/' + input);
|
||||
url.scheme = '';
|
||||
url.host = '';
|
||||
url.type = input
|
||||
? input.startsWith('?')
|
||||
? UrlType.Query
|
||||
: input.startsWith('#')
|
||||
? UrlType.Hash
|
||||
: UrlType.RelativePath
|
||||
: UrlType.Empty;
|
||||
return url;
|
||||
}
|
||||
function stripPathFilename(path) {
|
||||
// If a path ends with a parent directory "..", then it's a relative path with excess parent
|
||||
// paths. It's not a file, so we can't strip it.
|
||||
if (path.endsWith('/..'))
|
||||
return path;
|
||||
const index = path.lastIndexOf('/');
|
||||
return path.slice(0, index + 1);
|
||||
}
|
||||
function mergePaths(url, base) {
|
||||
normalizePath(base, base.type);
|
||||
// If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
|
||||
// path).
|
||||
if (url.path === '/') {
|
||||
url.path = base.path;
|
||||
}
|
||||
else {
|
||||
// Resolution happens relative to the base path's directory, not the file.
|
||||
url.path = stripPathFilename(base.path) + url.path;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
|
||||
* "foo/.". We need to normalize to a standard representation.
|
||||
*/
|
||||
function normalizePath(url, type) {
|
||||
const rel = type <= UrlType.RelativePath;
|
||||
const pieces = url.path.split('/');
|
||||
// We need to preserve the first piece always, so that we output a leading slash. The item at
|
||||
// pieces[0] is an empty string.
|
||||
let pointer = 1;
|
||||
// Positive is the number of real directories we've output, used for popping a parent directory.
|
||||
// Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
|
||||
let positive = 0;
|
||||
// We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
|
||||
// generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
|
||||
// real directory, we won't need to append, unless the other conditions happen again.
|
||||
let addTrailingSlash = false;
|
||||
for (let i = 1; i < pieces.length; i++) {
|
||||
const piece = pieces[i];
|
||||
// An empty directory, could be a trailing slash, or just a double "//" in the path.
|
||||
if (!piece) {
|
||||
addTrailingSlash = true;
|
||||
continue;
|
||||
}
|
||||
// If we encounter a real directory, then we don't need to append anymore.
|
||||
addTrailingSlash = false;
|
||||
// A current directory, which we can always drop.
|
||||
if (piece === '.')
|
||||
continue;
|
||||
// A parent directory, we need to see if there are any real directories we can pop. Else, we
|
||||
// have an excess of parents, and we'll need to keep the "..".
|
||||
if (piece === '..') {
|
||||
if (positive) {
|
||||
addTrailingSlash = true;
|
||||
positive--;
|
||||
pointer--;
|
||||
}
|
||||
else if (rel) {
|
||||
// If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
|
||||
// URL, protocol relative URL, or an absolute path, we don't need to keep excess.
|
||||
pieces[pointer++] = piece;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// We've encountered a real directory. Move it to the next insertion pointer, which accounts for
|
||||
// any popped or dropped directories.
|
||||
pieces[pointer++] = piece;
|
||||
positive++;
|
||||
}
|
||||
let path = '';
|
||||
for (let i = 1; i < pointer; i++) {
|
||||
path += '/' + pieces[i];
|
||||
}
|
||||
if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
|
||||
path += '/';
|
||||
}
|
||||
url.path = path;
|
||||
}
|
||||
/**
|
||||
* Attempts to resolve `input` URL/path relative to `base`.
|
||||
*/
|
||||
function resolve(input, base) {
|
||||
if (!input && !base)
|
||||
return '';
|
||||
const url = parseUrl(input);
|
||||
let inputType = url.type;
|
||||
if (base && inputType !== UrlType.Absolute) {
|
||||
const baseUrl = parseUrl(base);
|
||||
const baseType = baseUrl.type;
|
||||
switch (inputType) {
|
||||
case UrlType.Empty:
|
||||
url.hash = baseUrl.hash;
|
||||
// fall through
|
||||
case UrlType.Hash:
|
||||
url.query = baseUrl.query;
|
||||
// fall through
|
||||
case UrlType.Query:
|
||||
case UrlType.RelativePath:
|
||||
mergePaths(url, baseUrl);
|
||||
// fall through
|
||||
case UrlType.AbsolutePath:
|
||||
// The host, user, and port are joined, you can't copy one without the others.
|
||||
url.user = baseUrl.user;
|
||||
url.host = baseUrl.host;
|
||||
url.port = baseUrl.port;
|
||||
// fall through
|
||||
case UrlType.SchemeRelative:
|
||||
// The input doesn't have a schema at least, so we need to copy at least that over.
|
||||
url.scheme = baseUrl.scheme;
|
||||
}
|
||||
if (baseType > inputType)
|
||||
inputType = baseType;
|
||||
}
|
||||
normalizePath(url, inputType);
|
||||
const queryHash = url.query + url.hash;
|
||||
switch (inputType) {
|
||||
// This is impossible, because of the empty checks at the start of the function.
|
||||
// case UrlType.Empty:
|
||||
case UrlType.Hash:
|
||||
case UrlType.Query:
|
||||
return queryHash;
|
||||
case UrlType.RelativePath: {
|
||||
// The first char is always a "/", and we need it to be relative.
|
||||
const path = url.path.slice(1);
|
||||
if (!path)
|
||||
return queryHash || '.';
|
||||
if (isRelative(base || input) && !isRelative(path)) {
|
||||
// If base started with a leading ".", or there is no base and input started with a ".",
|
||||
// then we need to ensure that the relative path starts with a ".". We don't know if
|
||||
// relative starts with a "..", though, so check before prepending.
|
||||
return './' + path + queryHash;
|
||||
}
|
||||
return path + queryHash;
|
||||
}
|
||||
case UrlType.AbsolutePath:
|
||||
return url.path + queryHash;
|
||||
default:
|
||||
return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
|
||||
}
|
||||
}
|
||||
|
||||
return resolve;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=resolve-uri.umd.js.map
|
1
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map
generated
vendored
1
node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts
generated
vendored
4
node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts
generated
vendored
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* Attempts to resolve `input` URL/path relative to `base`.
|
||||
*/
|
||||
export default function resolve(input: string, base: string | undefined): string;
|
69
node_modules/@jridgewell/resolve-uri/package.json
generated
vendored
69
node_modules/@jridgewell/resolve-uri/package.json
generated
vendored
@ -1,69 +0,0 @@
|
||||
{
|
||||
"name": "@jridgewell/resolve-uri",
|
||||
"version": "3.1.1",
|
||||
"description": "Resolve a URI relative to an optional base URI",
|
||||
"keywords": [
|
||||
"resolve",
|
||||
"uri",
|
||||
"url",
|
||||
"path"
|
||||
],
|
||||
"author": "Justin Ridgewell <justin@ridgewell.name>",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/jridgewell/resolve-uri",
|
||||
"main": "dist/resolve-uri.umd.js",
|
||||
"module": "dist/resolve-uri.mjs",
|
||||
"types": "dist/types/resolve-uri.d.ts",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"types": "./dist/types/resolve-uri.d.ts",
|
||||
"browser": "./dist/resolve-uri.umd.js",
|
||||
"require": "./dist/resolve-uri.umd.js",
|
||||
"import": "./dist/resolve-uri.mjs"
|
||||
},
|
||||
"./dist/resolve-uri.umd.js"
|
||||
],
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf dist",
|
||||
"build": "run-s -n build:*",
|
||||
"build:rollup": "rollup -c rollup.config.js",
|
||||
"build:ts": "tsc --project tsconfig.build.json",
|
||||
"lint": "run-s -n lint:*",
|
||||
"lint:prettier": "npm run test:lint:prettier -- --write",
|
||||
"lint:ts": "npm run test:lint:ts -- --fix",
|
||||
"pretest": "run-s build:rollup",
|
||||
"test": "run-s -n test:lint test:only",
|
||||
"test:debug": "mocha --inspect-brk",
|
||||
"test:lint": "run-s -n test:lint:*",
|
||||
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
||||
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
||||
"test:only": "mocha",
|
||||
"test:coverage": "c8 mocha",
|
||||
"test:watch": "mocha --watch",
|
||||
"prepublishOnly": "npm run preversion",
|
||||
"preversion": "run-s test build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jridgewell/resolve-uri-latest": "npm:@jridgewell/resolve-uri@*",
|
||||
"@rollup/plugin-typescript": "8.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "5.10.0",
|
||||
"@typescript-eslint/parser": "5.10.0",
|
||||
"c8": "7.11.0",
|
||||
"eslint": "8.7.0",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"mocha": "9.2.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "2.5.1",
|
||||
"rollup": "2.66.0",
|
||||
"typescript": "4.5.5"
|
||||
}
|
||||
}
|
21
node_modules/@jridgewell/sourcemap-codec/LICENSE
generated
vendored
21
node_modules/@jridgewell/sourcemap-codec/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2015 Rich Harris
|
||||
|
||||
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.
|
200
node_modules/@jridgewell/sourcemap-codec/README.md
generated
vendored
200
node_modules/@jridgewell/sourcemap-codec/README.md
generated
vendored
@ -1,200 +0,0 @@
|
||||
# @jridgewell/sourcemap-codec
|
||||
|
||||
Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit).
|
||||
|
||||
|
||||
## Why?
|
||||
|
||||
Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap.
|
||||
|
||||
This package makes the process slightly easier.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @jridgewell/sourcemap-codec
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { encode, decode } from '@jridgewell/sourcemap-codec';
|
||||
|
||||
var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
|
||||
|
||||
assert.deepEqual( decoded, [
|
||||
// the first line (of the generated code) has no mappings,
|
||||
// as shown by the starting semi-colon (which separates lines)
|
||||
[],
|
||||
|
||||
// the second line contains four (comma-separated) segments
|
||||
[
|
||||
// segments are encoded as you'd expect:
|
||||
// [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ]
|
||||
|
||||
// i.e. the first segment begins at column 2, and maps back to the second column
|
||||
// of the second line (both zero-based) of the 0th source, and uses the 0th
|
||||
// name in the `map.names` array
|
||||
[ 2, 0, 2, 2, 0 ],
|
||||
|
||||
// the remaining segments are 4-length rather than 5-length,
|
||||
// because they don't map a name
|
||||
[ 4, 0, 2, 4 ],
|
||||
[ 6, 0, 2, 5 ],
|
||||
[ 7, 0, 2, 7 ]
|
||||
],
|
||||
|
||||
// the final line contains two segments
|
||||
[
|
||||
[ 2, 1, 10, 19 ],
|
||||
[ 12, 1, 11, 20 ]
|
||||
]
|
||||
]);
|
||||
|
||||
var encoded = encode( decoded );
|
||||
assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
|
||||
```
|
||||
|
||||
## Benchmarks
|
||||
|
||||
```
|
||||
node v18.0.0
|
||||
|
||||
amp.js.map - 45120 segments
|
||||
|
||||
Decode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 5479160 bytes
|
||||
sourcemap-codec 5659336 bytes
|
||||
source-map-0.6.1 17144440 bytes
|
||||
source-map-0.8.0 6867424 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Decode speed:
|
||||
decode: @jridgewell/sourcemap-codec x 502 ops/sec ±1.03% (90 runs sampled)
|
||||
decode: sourcemap-codec x 445 ops/sec ±0.97% (92 runs sampled)
|
||||
decode: source-map-0.6.1 x 36.01 ops/sec ±1.64% (49 runs sampled)
|
||||
decode: source-map-0.8.0 x 367 ops/sec ±0.04% (95 runs sampled)
|
||||
Fastest is decode: @jridgewell/sourcemap-codec
|
||||
|
||||
Encode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 1261620 bytes
|
||||
sourcemap-codec 9119248 bytes
|
||||
source-map-0.6.1 8968560 bytes
|
||||
source-map-0.8.0 8952952 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Encode speed:
|
||||
encode: @jridgewell/sourcemap-codec x 738 ops/sec ±0.42% (98 runs sampled)
|
||||
encode: sourcemap-codec x 238 ops/sec ±0.73% (88 runs sampled)
|
||||
encode: source-map-0.6.1 x 162 ops/sec ±0.43% (84 runs sampled)
|
||||
encode: source-map-0.8.0 x 191 ops/sec ±0.34% (90 runs sampled)
|
||||
Fastest is encode: @jridgewell/sourcemap-codec
|
||||
|
||||
|
||||
***
|
||||
|
||||
|
||||
babel.min.js.map - 347793 segments
|
||||
|
||||
Decode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 35338184 bytes
|
||||
sourcemap-codec 35922736 bytes
|
||||
source-map-0.6.1 62366360 bytes
|
||||
source-map-0.8.0 44337416 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Decode speed:
|
||||
decode: @jridgewell/sourcemap-codec x 40.35 ops/sec ±4.47% (54 runs sampled)
|
||||
decode: sourcemap-codec x 36.76 ops/sec ±3.67% (51 runs sampled)
|
||||
decode: source-map-0.6.1 x 4.44 ops/sec ±2.15% (16 runs sampled)
|
||||
decode: source-map-0.8.0 x 59.35 ops/sec ±0.05% (78 runs sampled)
|
||||
Fastest is decode: source-map-0.8.0
|
||||
|
||||
Encode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 7212604 bytes
|
||||
sourcemap-codec 21421456 bytes
|
||||
source-map-0.6.1 25286888 bytes
|
||||
source-map-0.8.0 25498744 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Encode speed:
|
||||
encode: @jridgewell/sourcemap-codec x 112 ops/sec ±0.13% (84 runs sampled)
|
||||
encode: sourcemap-codec x 30.23 ops/sec ±2.76% (53 runs sampled)
|
||||
encode: source-map-0.6.1 x 19.43 ops/sec ±3.70% (37 runs sampled)
|
||||
encode: source-map-0.8.0 x 19.40 ops/sec ±3.26% (37 runs sampled)
|
||||
Fastest is encode: @jridgewell/sourcemap-codec
|
||||
|
||||
|
||||
***
|
||||
|
||||
|
||||
preact.js.map - 1992 segments
|
||||
|
||||
Decode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 500272 bytes
|
||||
sourcemap-codec 516864 bytes
|
||||
source-map-0.6.1 1596672 bytes
|
||||
source-map-0.8.0 517272 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Decode speed:
|
||||
decode: @jridgewell/sourcemap-codec x 16,137 ops/sec ±0.17% (99 runs sampled)
|
||||
decode: sourcemap-codec x 12,139 ops/sec ±0.13% (99 runs sampled)
|
||||
decode: source-map-0.6.1 x 1,264 ops/sec ±0.12% (100 runs sampled)
|
||||
decode: source-map-0.8.0 x 9,894 ops/sec ±0.08% (101 runs sampled)
|
||||
Fastest is decode: @jridgewell/sourcemap-codec
|
||||
|
||||
Encode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 321026 bytes
|
||||
sourcemap-codec 830832 bytes
|
||||
source-map-0.6.1 586608 bytes
|
||||
source-map-0.8.0 586680 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Encode speed:
|
||||
encode: @jridgewell/sourcemap-codec x 19,876 ops/sec ±0.78% (95 runs sampled)
|
||||
encode: sourcemap-codec x 6,983 ops/sec ±0.15% (100 runs sampled)
|
||||
encode: source-map-0.6.1 x 5,070 ops/sec ±0.12% (102 runs sampled)
|
||||
encode: source-map-0.8.0 x 5,641 ops/sec ±0.17% (100 runs sampled)
|
||||
Fastest is encode: @jridgewell/sourcemap-codec
|
||||
|
||||
|
||||
***
|
||||
|
||||
|
||||
react.js.map - 5726 segments
|
||||
|
||||
Decode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 734848 bytes
|
||||
sourcemap-codec 954200 bytes
|
||||
source-map-0.6.1 2276432 bytes
|
||||
source-map-0.8.0 955488 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Decode speed:
|
||||
decode: @jridgewell/sourcemap-codec x 5,723 ops/sec ±0.12% (98 runs sampled)
|
||||
decode: sourcemap-codec x 4,555 ops/sec ±0.09% (101 runs sampled)
|
||||
decode: source-map-0.6.1 x 437 ops/sec ±0.11% (93 runs sampled)
|
||||
decode: source-map-0.8.0 x 3,441 ops/sec ±0.15% (100 runs sampled)
|
||||
Fastest is decode: @jridgewell/sourcemap-codec
|
||||
|
||||
Encode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 638672 bytes
|
||||
sourcemap-codec 1109840 bytes
|
||||
source-map-0.6.1 1321224 bytes
|
||||
source-map-0.8.0 1324448 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Encode speed:
|
||||
encode: @jridgewell/sourcemap-codec x 6,801 ops/sec ±0.48% (98 runs sampled)
|
||||
encode: sourcemap-codec x 2,533 ops/sec ±0.13% (101 runs sampled)
|
||||
encode: source-map-0.6.1 x 2,248 ops/sec ±0.08% (100 runs sampled)
|
||||
encode: source-map-0.8.0 x 2,303 ops/sec ±0.15% (100 runs sampled)
|
||||
Fastest is encode: @jridgewell/sourcemap-codec
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
MIT
|
164
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
generated
vendored
164
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
generated
vendored
@ -1,164 +0,0 @@
|
||||
const comma = ','.charCodeAt(0);
|
||||
const semicolon = ';'.charCodeAt(0);
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
const intToChar = new Uint8Array(64); // 64 possible chars.
|
||||
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
||||
for (let i = 0; i < chars.length; i++) {
|
||||
const c = chars.charCodeAt(i);
|
||||
intToChar[i] = c;
|
||||
charToInt[c] = i;
|
||||
}
|
||||
// Provide a fallback for older environments.
|
||||
const td = typeof TextDecoder !== 'undefined'
|
||||
? /* #__PURE__ */ new TextDecoder()
|
||||
: typeof Buffer !== 'undefined'
|
||||
? {
|
||||
decode(buf) {
|
||||
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||
return out.toString();
|
||||
},
|
||||
}
|
||||
: {
|
||||
decode(buf) {
|
||||
let out = '';
|
||||
for (let i = 0; i < buf.length; i++) {
|
||||
out += String.fromCharCode(buf[i]);
|
||||
}
|
||||
return out;
|
||||
},
|
||||
};
|
||||
function decode(mappings) {
|
||||
const state = new Int32Array(5);
|
||||
const decoded = [];
|
||||
let index = 0;
|
||||
do {
|
||||
const semi = indexOf(mappings, index);
|
||||
const line = [];
|
||||
let sorted = true;
|
||||
let lastCol = 0;
|
||||
state[0] = 0;
|
||||
for (let i = index; i < semi; i++) {
|
||||
let seg;
|
||||
i = decodeInteger(mappings, i, state, 0); // genColumn
|
||||
const col = state[0];
|
||||
if (col < lastCol)
|
||||
sorted = false;
|
||||
lastCol = col;
|
||||
if (hasMoreVlq(mappings, i, semi)) {
|
||||
i = decodeInteger(mappings, i, state, 1); // sourcesIndex
|
||||
i = decodeInteger(mappings, i, state, 2); // sourceLine
|
||||
i = decodeInteger(mappings, i, state, 3); // sourceColumn
|
||||
if (hasMoreVlq(mappings, i, semi)) {
|
||||
i = decodeInteger(mappings, i, state, 4); // namesIndex
|
||||
seg = [col, state[1], state[2], state[3], state[4]];
|
||||
}
|
||||
else {
|
||||
seg = [col, state[1], state[2], state[3]];
|
||||
}
|
||||
}
|
||||
else {
|
||||
seg = [col];
|
||||
}
|
||||
line.push(seg);
|
||||
}
|
||||
if (!sorted)
|
||||
sort(line);
|
||||
decoded.push(line);
|
||||
index = semi + 1;
|
||||
} while (index <= mappings.length);
|
||||
return decoded;
|
||||
}
|
||||
function indexOf(mappings, index) {
|
||||
const idx = mappings.indexOf(';', index);
|
||||
return idx === -1 ? mappings.length : idx;
|
||||
}
|
||||
function decodeInteger(mappings, pos, state, j) {
|
||||
let value = 0;
|
||||
let shift = 0;
|
||||
let integer = 0;
|
||||
do {
|
||||
const c = mappings.charCodeAt(pos++);
|
||||
integer = charToInt[c];
|
||||
value |= (integer & 31) << shift;
|
||||
shift += 5;
|
||||
} while (integer & 32);
|
||||
const shouldNegate = value & 1;
|
||||
value >>>= 1;
|
||||
if (shouldNegate) {
|
||||
value = -0x80000000 | -value;
|
||||
}
|
||||
state[j] += value;
|
||||
return pos;
|
||||
}
|
||||
function hasMoreVlq(mappings, i, length) {
|
||||
if (i >= length)
|
||||
return false;
|
||||
return mappings.charCodeAt(i) !== comma;
|
||||
}
|
||||
function sort(line) {
|
||||
line.sort(sortComparator);
|
||||
}
|
||||
function sortComparator(a, b) {
|
||||
return a[0] - b[0];
|
||||
}
|
||||
function encode(decoded) {
|
||||
const state = new Int32Array(5);
|
||||
const bufLength = 1024 * 16;
|
||||
const subLength = bufLength - 36;
|
||||
const buf = new Uint8Array(bufLength);
|
||||
const sub = buf.subarray(0, subLength);
|
||||
let pos = 0;
|
||||
let out = '';
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const line = decoded[i];
|
||||
if (i > 0) {
|
||||
if (pos === bufLength) {
|
||||
out += td.decode(buf);
|
||||
pos = 0;
|
||||
}
|
||||
buf[pos++] = semicolon;
|
||||
}
|
||||
if (line.length === 0)
|
||||
continue;
|
||||
state[0] = 0;
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const segment = line[j];
|
||||
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
||||
// may push a comma.
|
||||
if (pos > subLength) {
|
||||
out += td.decode(sub);
|
||||
buf.copyWithin(0, subLength, pos);
|
||||
pos -= subLength;
|
||||
}
|
||||
if (j > 0)
|
||||
buf[pos++] = comma;
|
||||
pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
|
||||
if (segment.length === 1)
|
||||
continue;
|
||||
pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
|
||||
pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
|
||||
pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
|
||||
if (segment.length === 4)
|
||||
continue;
|
||||
pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
|
||||
}
|
||||
}
|
||||
return out + td.decode(buf.subarray(0, pos));
|
||||
}
|
||||
function encodeInteger(buf, pos, state, segment, j) {
|
||||
const next = segment[j];
|
||||
let num = next - state[j];
|
||||
state[j] = next;
|
||||
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
||||
do {
|
||||
let clamped = num & 0b011111;
|
||||
num >>>= 5;
|
||||
if (num > 0)
|
||||
clamped |= 0b100000;
|
||||
buf[pos++] = intToChar[clamped];
|
||||
} while (num > 0);
|
||||
return pos;
|
||||
}
|
||||
|
||||
export { decode, encode };
|
||||
//# sourceMappingURL=sourcemap-codec.mjs.map
|
1
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map
generated
vendored
1
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
175
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js
generated
vendored
175
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js
generated
vendored
@ -1,175 +0,0 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sourcemapCodec = {}));
|
||||
})(this, (function (exports) { 'use strict';
|
||||
|
||||
const comma = ','.charCodeAt(0);
|
||||
const semicolon = ';'.charCodeAt(0);
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
const intToChar = new Uint8Array(64); // 64 possible chars.
|
||||
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
||||
for (let i = 0; i < chars.length; i++) {
|
||||
const c = chars.charCodeAt(i);
|
||||
intToChar[i] = c;
|
||||
charToInt[c] = i;
|
||||
}
|
||||
// Provide a fallback for older environments.
|
||||
const td = typeof TextDecoder !== 'undefined'
|
||||
? /* #__PURE__ */ new TextDecoder()
|
||||
: typeof Buffer !== 'undefined'
|
||||
? {
|
||||
decode(buf) {
|
||||
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||
return out.toString();
|
||||
},
|
||||
}
|
||||
: {
|
||||
decode(buf) {
|
||||
let out = '';
|
||||
for (let i = 0; i < buf.length; i++) {
|
||||
out += String.fromCharCode(buf[i]);
|
||||
}
|
||||
return out;
|
||||
},
|
||||
};
|
||||
function decode(mappings) {
|
||||
const state = new Int32Array(5);
|
||||
const decoded = [];
|
||||
let index = 0;
|
||||
do {
|
||||
const semi = indexOf(mappings, index);
|
||||
const line = [];
|
||||
let sorted = true;
|
||||
let lastCol = 0;
|
||||
state[0] = 0;
|
||||
for (let i = index; i < semi; i++) {
|
||||
let seg;
|
||||
i = decodeInteger(mappings, i, state, 0); // genColumn
|
||||
const col = state[0];
|
||||
if (col < lastCol)
|
||||
sorted = false;
|
||||
lastCol = col;
|
||||
if (hasMoreVlq(mappings, i, semi)) {
|
||||
i = decodeInteger(mappings, i, state, 1); // sourcesIndex
|
||||
i = decodeInteger(mappings, i, state, 2); // sourceLine
|
||||
i = decodeInteger(mappings, i, state, 3); // sourceColumn
|
||||
if (hasMoreVlq(mappings, i, semi)) {
|
||||
i = decodeInteger(mappings, i, state, 4); // namesIndex
|
||||
seg = [col, state[1], state[2], state[3], state[4]];
|
||||
}
|
||||
else {
|
||||
seg = [col, state[1], state[2], state[3]];
|
||||
}
|
||||
}
|
||||
else {
|
||||
seg = [col];
|
||||
}
|
||||
line.push(seg);
|
||||
}
|
||||
if (!sorted)
|
||||
sort(line);
|
||||
decoded.push(line);
|
||||
index = semi + 1;
|
||||
} while (index <= mappings.length);
|
||||
return decoded;
|
||||
}
|
||||
function indexOf(mappings, index) {
|
||||
const idx = mappings.indexOf(';', index);
|
||||
return idx === -1 ? mappings.length : idx;
|
||||
}
|
||||
function decodeInteger(mappings, pos, state, j) {
|
||||
let value = 0;
|
||||
let shift = 0;
|
||||
let integer = 0;
|
||||
do {
|
||||
const c = mappings.charCodeAt(pos++);
|
||||
integer = charToInt[c];
|
||||
value |= (integer & 31) << shift;
|
||||
shift += 5;
|
||||
} while (integer & 32);
|
||||
const shouldNegate = value & 1;
|
||||
value >>>= 1;
|
||||
if (shouldNegate) {
|
||||
value = -0x80000000 | -value;
|
||||
}
|
||||
state[j] += value;
|
||||
return pos;
|
||||
}
|
||||
function hasMoreVlq(mappings, i, length) {
|
||||
if (i >= length)
|
||||
return false;
|
||||
return mappings.charCodeAt(i) !== comma;
|
||||
}
|
||||
function sort(line) {
|
||||
line.sort(sortComparator);
|
||||
}
|
||||
function sortComparator(a, b) {
|
||||
return a[0] - b[0];
|
||||
}
|
||||
function encode(decoded) {
|
||||
const state = new Int32Array(5);
|
||||
const bufLength = 1024 * 16;
|
||||
const subLength = bufLength - 36;
|
||||
const buf = new Uint8Array(bufLength);
|
||||
const sub = buf.subarray(0, subLength);
|
||||
let pos = 0;
|
||||
let out = '';
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const line = decoded[i];
|
||||
if (i > 0) {
|
||||
if (pos === bufLength) {
|
||||
out += td.decode(buf);
|
||||
pos = 0;
|
||||
}
|
||||
buf[pos++] = semicolon;
|
||||
}
|
||||
if (line.length === 0)
|
||||
continue;
|
||||
state[0] = 0;
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const segment = line[j];
|
||||
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
||||
// may push a comma.
|
||||
if (pos > subLength) {
|
||||
out += td.decode(sub);
|
||||
buf.copyWithin(0, subLength, pos);
|
||||
pos -= subLength;
|
||||
}
|
||||
if (j > 0)
|
||||
buf[pos++] = comma;
|
||||
pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
|
||||
if (segment.length === 1)
|
||||
continue;
|
||||
pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
|
||||
pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
|
||||
pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
|
||||
if (segment.length === 4)
|
||||
continue;
|
||||
pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
|
||||
}
|
||||
}
|
||||
return out + td.decode(buf.subarray(0, pos));
|
||||
}
|
||||
function encodeInteger(buf, pos, state, segment, j) {
|
||||
const next = segment[j];
|
||||
let num = next - state[j];
|
||||
state[j] = next;
|
||||
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
||||
do {
|
||||
let clamped = num & 0b011111;
|
||||
num >>>= 5;
|
||||
if (num > 0)
|
||||
clamped |= 0b100000;
|
||||
buf[pos++] = intToChar[clamped];
|
||||
} while (num > 0);
|
||||
return pos;
|
||||
}
|
||||
|
||||
exports.decode = decode;
|
||||
exports.encode = encode;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=sourcemap-codec.umd.js.map
|
1
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map
generated
vendored
1
node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map
generated
vendored
File diff suppressed because one or more lines are too long
6
node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts
generated
vendored
6
node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts
generated
vendored
@ -1,6 +0,0 @@
|
||||
export declare type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number];
|
||||
export declare type SourceMapLine = SourceMapSegment[];
|
||||
export declare type SourceMapMappings = SourceMapLine[];
|
||||
export declare function decode(mappings: string): SourceMapMappings;
|
||||
export declare function encode(decoded: SourceMapMappings): string;
|
||||
export declare function encode(decoded: Readonly<SourceMapMappings>): string;
|
74
node_modules/@jridgewell/sourcemap-codec/package.json
generated
vendored
74
node_modules/@jridgewell/sourcemap-codec/package.json
generated
vendored
@ -1,74 +0,0 @@
|
||||
{
|
||||
"name": "@jridgewell/sourcemap-codec",
|
||||
"version": "1.4.15",
|
||||
"description": "Encode/decode sourcemap mappings",
|
||||
"keywords": [
|
||||
"sourcemap",
|
||||
"vlq"
|
||||
],
|
||||
"main": "dist/sourcemap-codec.umd.js",
|
||||
"module": "dist/sourcemap-codec.mjs",
|
||||
"types": "dist/types/sourcemap-codec.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"types": "./dist/types/sourcemap-codec.d.ts",
|
||||
"browser": "./dist/sourcemap-codec.umd.js",
|
||||
"require": "./dist/sourcemap-codec.umd.js",
|
||||
"import": "./dist/sourcemap-codec.mjs"
|
||||
},
|
||||
"./dist/sourcemap-codec.umd.js"
|
||||
],
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"benchmark": "run-s build:rollup benchmark:*",
|
||||
"benchmark:install": "cd benchmark && npm install",
|
||||
"benchmark:only": "node --expose-gc benchmark/index.js",
|
||||
"build": "run-s -n build:*",
|
||||
"build:rollup": "rollup -c rollup.config.js",
|
||||
"build:ts": "tsc --project tsconfig.build.json",
|
||||
"lint": "run-s -n lint:*",
|
||||
"lint:prettier": "npm run test:lint:prettier -- --write",
|
||||
"lint:ts": "npm run test:lint:ts -- --fix",
|
||||
"prebuild": "rm -rf dist",
|
||||
"prepublishOnly": "npm run preversion",
|
||||
"preversion": "run-s test build",
|
||||
"pretest": "run-s build:rollup",
|
||||
"test": "run-s -n test:lint test:only",
|
||||
"test:debug": "mocha --inspect-brk",
|
||||
"test:lint": "run-s -n test:lint:*",
|
||||
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
||||
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
||||
"test:only": "mocha",
|
||||
"test:coverage": "c8 mocha",
|
||||
"test:watch": "mocha --watch"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jridgewell/sourcemap-codec.git"
|
||||
},
|
||||
"author": "Rich Harris",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "8.3.0",
|
||||
"@types/node": "17.0.15",
|
||||
"@typescript-eslint/eslint-plugin": "5.10.0",
|
||||
"@typescript-eslint/parser": "5.10.0",
|
||||
"benchmark": "2.1.4",
|
||||
"c8": "7.11.2",
|
||||
"eslint": "8.7.0",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"mocha": "9.2.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "2.5.1",
|
||||
"rollup": "2.64.0",
|
||||
"source-map": "0.6.1",
|
||||
"source-map-js": "1.0.2",
|
||||
"sourcemap-codec": "1.4.8",
|
||||
"typescript": "4.5.4"
|
||||
}
|
||||
}
|
19
node_modules/@jridgewell/trace-mapping/LICENSE
generated
vendored
19
node_modules/@jridgewell/trace-mapping/LICENSE
generated
vendored
@ -1,19 +0,0 @@
|
||||
Copyright 2022 Justin Ridgewell <justin@ridgewell.name>
|
||||
|
||||
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.
|
193
node_modules/@jridgewell/trace-mapping/README.md
generated
vendored
193
node_modules/@jridgewell/trace-mapping/README.md
generated
vendored
@ -1,193 +0,0 @@
|
||||
# @jridgewell/trace-mapping
|
||||
|
||||
> Trace the original position through a source map
|
||||
|
||||
`trace-mapping` allows you to take the line and column of an output file and trace it to the
|
||||
original location in the source file through a source map.
|
||||
|
||||
You may already be familiar with the [`source-map`][source-map] package's `SourceMapConsumer`. This
|
||||
provides the same `originalPositionFor` and `generatedPositionFor` API, without requiring WASM.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install @jridgewell/trace-mapping
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { TraceMap, originalPositionFor, generatedPositionFor } from '@jridgewell/trace-mapping';
|
||||
|
||||
const tracer = new TraceMap({
|
||||
version: 3,
|
||||
sources: ['input.js'],
|
||||
names: ['foo'],
|
||||
mappings: 'KAyCIA',
|
||||
});
|
||||
|
||||
// Lines start at line 1, columns at column 0.
|
||||
const traced = originalPositionFor(tracer, { line: 1, column: 5 });
|
||||
assert.deepEqual(traced, {
|
||||
source: 'input.js',
|
||||
line: 42,
|
||||
column: 4,
|
||||
name: 'foo',
|
||||
});
|
||||
|
||||
const generated = generatedPositionFor(tracer, {
|
||||
source: 'input.js',
|
||||
line: 42,
|
||||
column: 4,
|
||||
});
|
||||
assert.deepEqual(generated, {
|
||||
line: 1,
|
||||
column: 5,
|
||||
});
|
||||
```
|
||||
|
||||
We also provide a lower level API to get the actual segment that matches our line and column. Unlike
|
||||
`originalPositionFor`, `traceSegment` uses a 0-base for `line`:
|
||||
|
||||
```typescript
|
||||
import { traceSegment } from '@jridgewell/trace-mapping';
|
||||
|
||||
// line is 0-base.
|
||||
const traced = traceSegment(tracer, /* line */ 0, /* column */ 5);
|
||||
|
||||
// Segments are [outputColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
|
||||
// Again, line is 0-base and so is sourceLine
|
||||
assert.deepEqual(traced, [5, 0, 41, 4, 0]);
|
||||
```
|
||||
|
||||
### SectionedSourceMaps
|
||||
|
||||
The sourcemap spec defines a special `sections` field that's designed to handle concatenation of
|
||||
output code with associated sourcemaps. This type of sourcemap is rarely used (no major build tool
|
||||
produces it), but if you are hand coding a concatenation you may need it. We provide an `AnyMap`
|
||||
helper that can receive either a regular sourcemap or a `SectionedSourceMap` and returns a
|
||||
`TraceMap` instance:
|
||||
|
||||
```typescript
|
||||
import { AnyMap } from '@jridgewell/trace-mapping';
|
||||
const fooOutput = 'foo';
|
||||
const barOutput = 'bar';
|
||||
const output = [fooOutput, barOutput].join('\n');
|
||||
|
||||
const sectioned = new AnyMap({
|
||||
version: 3,
|
||||
sections: [
|
||||
{
|
||||
// 0-base line and column
|
||||
offset: { line: 0, column: 0 },
|
||||
// fooOutput's sourcemap
|
||||
map: {
|
||||
version: 3,
|
||||
sources: ['foo.js'],
|
||||
names: ['foo'],
|
||||
mappings: 'AAAAA',
|
||||
},
|
||||
},
|
||||
{
|
||||
// barOutput's sourcemap will not affect the first line, only the second
|
||||
offset: { line: 1, column: 0 },
|
||||
map: {
|
||||
version: 3,
|
||||
sources: ['bar.js'],
|
||||
names: ['bar'],
|
||||
mappings: 'AAAAA',
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const traced = originalPositionFor(sectioned, {
|
||||
line: 2,
|
||||
column: 0,
|
||||
});
|
||||
|
||||
assert.deepEqual(traced, {
|
||||
source: 'bar.js',
|
||||
line: 1,
|
||||
column: 0,
|
||||
name: 'bar',
|
||||
});
|
||||
```
|
||||
|
||||
## Benchmarks
|
||||
|
||||
```
|
||||
node v18.0.0
|
||||
|
||||
amp.js.map
|
||||
trace-mapping: decoded JSON input x 183 ops/sec ±0.41% (87 runs sampled)
|
||||
trace-mapping: encoded JSON input x 384 ops/sec ±0.89% (89 runs sampled)
|
||||
trace-mapping: decoded Object input x 3,085 ops/sec ±0.24% (100 runs sampled)
|
||||
trace-mapping: encoded Object input x 452 ops/sec ±0.80% (84 runs sampled)
|
||||
source-map-js: encoded Object input x 88.82 ops/sec ±0.45% (77 runs sampled)
|
||||
source-map-0.6.1: encoded Object input x 38.39 ops/sec ±1.88% (52 runs sampled)
|
||||
Fastest is trace-mapping: decoded Object input
|
||||
|
||||
trace-mapping: decoded originalPositionFor x 4,025,347 ops/sec ±0.15% (97 runs sampled)
|
||||
trace-mapping: encoded originalPositionFor x 3,333,136 ops/sec ±1.26% (90 runs sampled)
|
||||
source-map-js: encoded originalPositionFor x 824,978 ops/sec ±1.06% (94 runs sampled)
|
||||
source-map-0.6.1: encoded originalPositionFor x 741,300 ops/sec ±0.93% (92 runs sampled)
|
||||
source-map-0.8.0: encoded originalPositionFor x 2,587,603 ops/sec ±0.75% (97 runs sampled)
|
||||
Fastest is trace-mapping: decoded originalPositionFor
|
||||
|
||||
***
|
||||
|
||||
babel.min.js.map
|
||||
trace-mapping: decoded JSON input x 17.43 ops/sec ±8.81% (33 runs sampled)
|
||||
trace-mapping: encoded JSON input x 34.18 ops/sec ±4.67% (50 runs sampled)
|
||||
trace-mapping: decoded Object input x 1,010 ops/sec ±0.41% (98 runs sampled)
|
||||
trace-mapping: encoded Object input x 39.45 ops/sec ±4.01% (52 runs sampled)
|
||||
source-map-js: encoded Object input x 6.57 ops/sec ±3.04% (21 runs sampled)
|
||||
source-map-0.6.1: encoded Object input x 4.23 ops/sec ±2.93% (15 runs sampled)
|
||||
Fastest is trace-mapping: decoded Object input
|
||||
|
||||
trace-mapping: decoded originalPositionFor x 7,576,265 ops/sec ±0.74% (96 runs sampled)
|
||||
trace-mapping: encoded originalPositionFor x 5,019,743 ops/sec ±0.74% (94 runs sampled)
|
||||
source-map-js: encoded originalPositionFor x 3,396,137 ops/sec ±42.32% (95 runs sampled)
|
||||
source-map-0.6.1: encoded originalPositionFor x 3,753,176 ops/sec ±0.72% (95 runs sampled)
|
||||
source-map-0.8.0: encoded originalPositionFor x 6,423,633 ops/sec ±0.74% (95 runs sampled)
|
||||
Fastest is trace-mapping: decoded originalPositionFor
|
||||
|
||||
***
|
||||
|
||||
preact.js.map
|
||||
trace-mapping: decoded JSON input x 3,499 ops/sec ±0.18% (98 runs sampled)
|
||||
trace-mapping: encoded JSON input x 6,078 ops/sec ±0.25% (99 runs sampled)
|
||||
trace-mapping: decoded Object input x 254,788 ops/sec ±0.13% (100 runs sampled)
|
||||
trace-mapping: encoded Object input x 14,063 ops/sec ±0.27% (94 runs sampled)
|
||||
source-map-js: encoded Object input x 2,465 ops/sec ±0.25% (98 runs sampled)
|
||||
source-map-0.6.1: encoded Object input x 1,174 ops/sec ±1.90% (95 runs sampled)
|
||||
Fastest is trace-mapping: decoded Object input
|
||||
|
||||
trace-mapping: decoded originalPositionFor x 7,720,171 ops/sec ±0.14% (97 runs sampled)
|
||||
trace-mapping: encoded originalPositionFor x 6,864,485 ops/sec ±0.16% (101 runs sampled)
|
||||
source-map-js: encoded originalPositionFor x 2,387,219 ops/sec ±0.28% (98 runs sampled)
|
||||
source-map-0.6.1: encoded originalPositionFor x 1,565,339 ops/sec ±0.32% (101 runs sampled)
|
||||
source-map-0.8.0: encoded originalPositionFor x 3,819,732 ops/sec ±0.38% (98 runs sampled)
|
||||
Fastest is trace-mapping: decoded originalPositionFor
|
||||
|
||||
***
|
||||
|
||||
react.js.map
|
||||
trace-mapping: decoded JSON input x 1,719 ops/sec ±0.19% (99 runs sampled)
|
||||
trace-mapping: encoded JSON input x 4,284 ops/sec ±0.51% (99 runs sampled)
|
||||
trace-mapping: decoded Object input x 94,668 ops/sec ±0.08% (99 runs sampled)
|
||||
trace-mapping: encoded Object input x 5,287 ops/sec ±0.24% (99 runs sampled)
|
||||
source-map-js: encoded Object input x 814 ops/sec ±0.20% (98 runs sampled)
|
||||
source-map-0.6.1: encoded Object input x 429 ops/sec ±0.24% (94 runs sampled)
|
||||
Fastest is trace-mapping: decoded Object input
|
||||
|
||||
trace-mapping: decoded originalPositionFor x 28,927,989 ops/sec ±0.61% (94 runs sampled)
|
||||
trace-mapping: encoded originalPositionFor x 27,394,475 ops/sec ±0.55% (97 runs sampled)
|
||||
source-map-js: encoded originalPositionFor x 16,856,730 ops/sec ±0.45% (96 runs sampled)
|
||||
source-map-0.6.1: encoded originalPositionFor x 12,258,950 ops/sec ±0.41% (97 runs sampled)
|
||||
source-map-0.8.0: encoded originalPositionFor x 22,272,990 ops/sec ±0.58% (95 runs sampled)
|
||||
Fastest is trace-mapping: decoded originalPositionFor
|
||||
```
|
||||
|
||||
[source-map]: https://www.npmjs.com/package/source-map
|
514
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
generated
vendored
514
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
generated
vendored
@ -1,514 +0,0 @@
|
||||
import { encode, decode } from '@jridgewell/sourcemap-codec';
|
||||
import resolveUri from '@jridgewell/resolve-uri';
|
||||
|
||||
function resolve(input, base) {
|
||||
// The base is always treated as a directory, if it's not empty.
|
||||
// https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
|
||||
// https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
|
||||
if (base && !base.endsWith('/'))
|
||||
base += '/';
|
||||
return resolveUri(input, base);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes everything after the last "/", but leaves the slash.
|
||||
*/
|
||||
function stripFilename(path) {
|
||||
if (!path)
|
||||
return '';
|
||||
const index = path.lastIndexOf('/');
|
||||
return path.slice(0, index + 1);
|
||||
}
|
||||
|
||||
const COLUMN = 0;
|
||||
const SOURCES_INDEX = 1;
|
||||
const SOURCE_LINE = 2;
|
||||
const SOURCE_COLUMN = 3;
|
||||
const NAMES_INDEX = 4;
|
||||
const REV_GENERATED_LINE = 1;
|
||||
const REV_GENERATED_COLUMN = 2;
|
||||
|
||||
function maybeSort(mappings, owned) {
|
||||
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
||||
if (unsortedIndex === mappings.length)
|
||||
return mappings;
|
||||
// If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If
|
||||
// not, we do not want to modify the consumer's input array.
|
||||
if (!owned)
|
||||
mappings = mappings.slice();
|
||||
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
|
||||
mappings[i] = sortSegments(mappings[i], owned);
|
||||
}
|
||||
return mappings;
|
||||
}
|
||||
function nextUnsortedSegmentLine(mappings, start) {
|
||||
for (let i = start; i < mappings.length; i++) {
|
||||
if (!isSorted(mappings[i]))
|
||||
return i;
|
||||
}
|
||||
return mappings.length;
|
||||
}
|
||||
function isSorted(line) {
|
||||
for (let j = 1; j < line.length; j++) {
|
||||
if (line[j][COLUMN] < line[j - 1][COLUMN]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function sortSegments(line, owned) {
|
||||
if (!owned)
|
||||
line = line.slice();
|
||||
return line.sort(sortComparator);
|
||||
}
|
||||
function sortComparator(a, b) {
|
||||
return a[COLUMN] - b[COLUMN];
|
||||
}
|
||||
|
||||
let found = false;
|
||||
/**
|
||||
* A binary search implementation that returns the index if a match is found.
|
||||
* If no match is found, then the left-index (the index associated with the item that comes just
|
||||
* before the desired index) is returned. To maintain proper sort order, a splice would happen at
|
||||
* the next index:
|
||||
*
|
||||
* ```js
|
||||
* const array = [1, 3];
|
||||
* const needle = 2;
|
||||
* const index = binarySearch(array, needle, (item, needle) => item - needle);
|
||||
*
|
||||
* assert.equal(index, 0);
|
||||
* array.splice(index + 1, 0, needle);
|
||||
* assert.deepEqual(array, [1, 2, 3]);
|
||||
* ```
|
||||
*/
|
||||
function binarySearch(haystack, needle, low, high) {
|
||||
while (low <= high) {
|
||||
const mid = low + ((high - low) >> 1);
|
||||
const cmp = haystack[mid][COLUMN] - needle;
|
||||
if (cmp === 0) {
|
||||
found = true;
|
||||
return mid;
|
||||
}
|
||||
if (cmp < 0) {
|
||||
low = mid + 1;
|
||||
}
|
||||
else {
|
||||
high = mid - 1;
|
||||
}
|
||||
}
|
||||
found = false;
|
||||
return low - 1;
|
||||
}
|
||||
function upperBound(haystack, needle, index) {
|
||||
for (let i = index + 1; i < haystack.length; i++, index++) {
|
||||
if (haystack[i][COLUMN] !== needle)
|
||||
break;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
function lowerBound(haystack, needle, index) {
|
||||
for (let i = index - 1; i >= 0; i--, index--) {
|
||||
if (haystack[i][COLUMN] !== needle)
|
||||
break;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
function memoizedState() {
|
||||
return {
|
||||
lastKey: -1,
|
||||
lastNeedle: -1,
|
||||
lastIndex: -1,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* This overly complicated beast is just to record the last tested line/column and the resulting
|
||||
* index, allowing us to skip a few tests if mappings are monotonically increasing.
|
||||
*/
|
||||
function memoizedBinarySearch(haystack, needle, state, key) {
|
||||
const { lastKey, lastNeedle, lastIndex } = state;
|
||||
let low = 0;
|
||||
let high = haystack.length - 1;
|
||||
if (key === lastKey) {
|
||||
if (needle === lastNeedle) {
|
||||
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
||||
return lastIndex;
|
||||
}
|
||||
if (needle >= lastNeedle) {
|
||||
// lastIndex may be -1 if the previous needle was not found.
|
||||
low = lastIndex === -1 ? 0 : lastIndex;
|
||||
}
|
||||
else {
|
||||
high = lastIndex;
|
||||
}
|
||||
}
|
||||
state.lastKey = key;
|
||||
state.lastNeedle = needle;
|
||||
return (state.lastIndex = binarySearch(haystack, needle, low, high));
|
||||
}
|
||||
|
||||
// Rebuilds the original source files, with mappings that are ordered by source line/column instead
|
||||
// of generated line/column.
|
||||
function buildBySources(decoded, memos) {
|
||||
const sources = memos.map(buildNullArray);
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const line = decoded[i];
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const seg = line[j];
|
||||
if (seg.length === 1)
|
||||
continue;
|
||||
const sourceIndex = seg[SOURCES_INDEX];
|
||||
const sourceLine = seg[SOURCE_LINE];
|
||||
const sourceColumn = seg[SOURCE_COLUMN];
|
||||
const originalSource = sources[sourceIndex];
|
||||
const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = []));
|
||||
const memo = memos[sourceIndex];
|
||||
// The binary search either found a match, or it found the left-index just before where the
|
||||
// segment should go. Either way, we want to insert after that. And there may be multiple
|
||||
// generated segments associated with an original location, so there may need to move several
|
||||
// indexes before we find where we need to insert.
|
||||
const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine));
|
||||
insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]);
|
||||
}
|
||||
}
|
||||
return sources;
|
||||
}
|
||||
function insert(array, index, value) {
|
||||
for (let i = array.length; i > index; i--) {
|
||||
array[i] = array[i - 1];
|
||||
}
|
||||
array[index] = value;
|
||||
}
|
||||
// Null arrays allow us to use ordered index keys without actually allocating contiguous memory like
|
||||
// a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations.
|
||||
// Numeric properties on objects are magically sorted in ascending order by the engine regardless of
|
||||
// the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending
|
||||
// order when iterating with for-in.
|
||||
function buildNullArray() {
|
||||
return { __proto__: null };
|
||||
}
|
||||
|
||||
const AnyMap = function (map, mapUrl) {
|
||||
const parsed = typeof map === 'string' ? JSON.parse(map) : map;
|
||||
if (!('sections' in parsed))
|
||||
return new TraceMap(parsed, mapUrl);
|
||||
const mappings = [];
|
||||
const sources = [];
|
||||
const sourcesContent = [];
|
||||
const names = [];
|
||||
const { sections } = parsed;
|
||||
let i = 0;
|
||||
for (; i < sections.length - 1; i++) {
|
||||
const no = sections[i + 1].offset;
|
||||
addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, no.line, no.column);
|
||||
}
|
||||
if (sections.length > 0) {
|
||||
addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, Infinity, Infinity);
|
||||
}
|
||||
const joined = {
|
||||
version: 3,
|
||||
file: parsed.file,
|
||||
names,
|
||||
sources,
|
||||
sourcesContent,
|
||||
mappings,
|
||||
};
|
||||
return presortedDecodedMap(joined);
|
||||
};
|
||||
function addSection(section, mapUrl, mappings, sources, sourcesContent, names, stopLine, stopColumn) {
|
||||
const map = AnyMap(section.map, mapUrl);
|
||||
const { line: lineOffset, column: columnOffset } = section.offset;
|
||||
const sourcesOffset = sources.length;
|
||||
const namesOffset = names.length;
|
||||
const decoded = decodedMappings(map);
|
||||
const { resolvedSources } = map;
|
||||
append(sources, resolvedSources);
|
||||
append(sourcesContent, map.sourcesContent || fillSourcesContent(resolvedSources.length));
|
||||
append(names, map.names);
|
||||
// If this section jumps forwards several lines, we need to add lines to the output mappings catch up.
|
||||
for (let i = mappings.length; i <= lineOffset; i++)
|
||||
mappings.push([]);
|
||||
// We can only add so many lines before we step into the range that the next section's map
|
||||
// controls. When we get to the last line, then we'll start checking the segments to see if
|
||||
// they've crossed into the column range.
|
||||
const stopI = stopLine - lineOffset;
|
||||
const len = Math.min(decoded.length, stopI + 1);
|
||||
for (let i = 0; i < len; i++) {
|
||||
const line = decoded[i];
|
||||
// On the 0th loop, the line will already exist due to a previous section, or the line catch up
|
||||
// loop above.
|
||||
const out = i === 0 ? mappings[lineOffset] : (mappings[lineOffset + i] = []);
|
||||
// On the 0th loop, the section's column offset shifts us forward. On all other lines (since the
|
||||
// map can be multiple lines), it doesn't.
|
||||
const cOffset = i === 0 ? columnOffset : 0;
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const seg = line[j];
|
||||
const column = cOffset + seg[COLUMN];
|
||||
// If this segment steps into the column range that the next section's map controls, we need
|
||||
// to stop early.
|
||||
if (i === stopI && column >= stopColumn)
|
||||
break;
|
||||
if (seg.length === 1) {
|
||||
out.push([column]);
|
||||
continue;
|
||||
}
|
||||
const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];
|
||||
const sourceLine = seg[SOURCE_LINE];
|
||||
const sourceColumn = seg[SOURCE_COLUMN];
|
||||
if (seg.length === 4) {
|
||||
out.push([column, sourcesIndex, sourceLine, sourceColumn]);
|
||||
continue;
|
||||
}
|
||||
out.push([column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
function append(arr, other) {
|
||||
for (let i = 0; i < other.length; i++)
|
||||
arr.push(other[i]);
|
||||
}
|
||||
// Sourcemaps don't need to have sourcesContent, and if they don't, we need to create an array of
|
||||
// equal length to the sources. This is because the sources and sourcesContent are paired arrays,
|
||||
// where `sourcesContent[i]` is the content of the `sources[i]` file. If we didn't, then joined
|
||||
// sourcemap would desynchronize the sources/contents.
|
||||
function fillSourcesContent(len) {
|
||||
const sourcesContent = [];
|
||||
for (let i = 0; i < len; i++)
|
||||
sourcesContent[i] = null;
|
||||
return sourcesContent;
|
||||
}
|
||||
|
||||
const INVALID_ORIGINAL_MAPPING = Object.freeze({
|
||||
source: null,
|
||||
line: null,
|
||||
column: null,
|
||||
name: null,
|
||||
});
|
||||
const INVALID_GENERATED_MAPPING = Object.freeze({
|
||||
line: null,
|
||||
column: null,
|
||||
});
|
||||
const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';
|
||||
const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';
|
||||
const LEAST_UPPER_BOUND = -1;
|
||||
const GREATEST_LOWER_BOUND = 1;
|
||||
/**
|
||||
* Returns the encoded (VLQ string) form of the SourceMap's mappings field.
|
||||
*/
|
||||
let encodedMappings;
|
||||
/**
|
||||
* Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
|
||||
*/
|
||||
let decodedMappings;
|
||||
/**
|
||||
* A low-level API to find the segment associated with a generated line/column (think, from a
|
||||
* stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
|
||||
*/
|
||||
let traceSegment;
|
||||
/**
|
||||
* A higher-level API to find the source/line/column associated with a generated line/column
|
||||
* (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
|
||||
* `source-map` library.
|
||||
*/
|
||||
let originalPositionFor;
|
||||
/**
|
||||
* Finds the source/line/column directly after the mapping returned by originalPositionFor, provided
|
||||
* the found mapping is from the same source and line as the originalPositionFor mapping.
|
||||
*
|
||||
* Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1`
|
||||
* using the same needle that would return `id` when calling `originalPositionFor`.
|
||||
*/
|
||||
let generatedPositionFor;
|
||||
/**
|
||||
* Iterates each mapping in generated position order.
|
||||
*/
|
||||
let eachMapping;
|
||||
/**
|
||||
* A helper that skips sorting of the input map's mappings array, which can be expensive for larger
|
||||
* maps.
|
||||
*/
|
||||
let presortedDecodedMap;
|
||||
/**
|
||||
* Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
|
||||
* a sourcemap, or to JSON.stringify.
|
||||
*/
|
||||
let decodedMap;
|
||||
/**
|
||||
* Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
|
||||
* a sourcemap, or to JSON.stringify.
|
||||
*/
|
||||
let encodedMap;
|
||||
class TraceMap {
|
||||
constructor(map, mapUrl) {
|
||||
this._decodedMemo = memoizedState();
|
||||
this._bySources = undefined;
|
||||
this._bySourceMemos = undefined;
|
||||
const isString = typeof map === 'string';
|
||||
if (!isString && map.constructor === TraceMap)
|
||||
return map;
|
||||
const parsed = (isString ? JSON.parse(map) : map);
|
||||
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
||||
this.version = version;
|
||||
this.file = file;
|
||||
this.names = names;
|
||||
this.sourceRoot = sourceRoot;
|
||||
this.sources = sources;
|
||||
this.sourcesContent = sourcesContent;
|
||||
if (sourceRoot || mapUrl) {
|
||||
const from = resolve(sourceRoot || '', stripFilename(mapUrl));
|
||||
this.resolvedSources = sources.map((s) => resolve(s || '', from));
|
||||
}
|
||||
else {
|
||||
this.resolvedSources = sources.map((s) => s || '');
|
||||
}
|
||||
const { mappings } = parsed;
|
||||
if (typeof mappings === 'string') {
|
||||
this._encoded = mappings;
|
||||
this._decoded = undefined;
|
||||
}
|
||||
else {
|
||||
this._encoded = undefined;
|
||||
this._decoded = maybeSort(mappings, isString);
|
||||
}
|
||||
}
|
||||
}
|
||||
(() => {
|
||||
encodedMappings = (map) => {
|
||||
var _a;
|
||||
return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = encode(map._decoded)));
|
||||
};
|
||||
decodedMappings = (map) => {
|
||||
return (map._decoded || (map._decoded = decode(map._encoded)));
|
||||
};
|
||||
traceSegment = (map, line, column) => {
|
||||
const decoded = decodedMappings(map);
|
||||
// It's common for parent source maps to have pointers to lines that have no
|
||||
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
||||
if (line >= decoded.length)
|
||||
return null;
|
||||
return traceSegmentInternal(decoded[line], map._decodedMemo, line, column, GREATEST_LOWER_BOUND);
|
||||
};
|
||||
originalPositionFor = (map, { line, column, bias }) => {
|
||||
line--;
|
||||
if (line < 0)
|
||||
throw new Error(LINE_GTR_ZERO);
|
||||
if (column < 0)
|
||||
throw new Error(COL_GTR_EQ_ZERO);
|
||||
const decoded = decodedMappings(map);
|
||||
// It's common for parent source maps to have pointers to lines that have no
|
||||
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
||||
if (line >= decoded.length)
|
||||
return INVALID_ORIGINAL_MAPPING;
|
||||
const segment = traceSegmentInternal(decoded[line], map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
|
||||
if (segment == null)
|
||||
return INVALID_ORIGINAL_MAPPING;
|
||||
if (segment.length == 1)
|
||||
return INVALID_ORIGINAL_MAPPING;
|
||||
const { names, resolvedSources } = map;
|
||||
return {
|
||||
source: resolvedSources[segment[SOURCES_INDEX]],
|
||||
line: segment[SOURCE_LINE] + 1,
|
||||
column: segment[SOURCE_COLUMN],
|
||||
name: segment.length === 5 ? names[segment[NAMES_INDEX]] : null,
|
||||
};
|
||||
};
|
||||
generatedPositionFor = (map, { source, line, column, bias }) => {
|
||||
line--;
|
||||
if (line < 0)
|
||||
throw new Error(LINE_GTR_ZERO);
|
||||
if (column < 0)
|
||||
throw new Error(COL_GTR_EQ_ZERO);
|
||||
const { sources, resolvedSources } = map;
|
||||
let sourceIndex = sources.indexOf(source);
|
||||
if (sourceIndex === -1)
|
||||
sourceIndex = resolvedSources.indexOf(source);
|
||||
if (sourceIndex === -1)
|
||||
return INVALID_GENERATED_MAPPING;
|
||||
const generated = (map._bySources || (map._bySources = buildBySources(decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState)))));
|
||||
const memos = map._bySourceMemos;
|
||||
const segments = generated[sourceIndex][line];
|
||||
if (segments == null)
|
||||
return INVALID_GENERATED_MAPPING;
|
||||
const segment = traceSegmentInternal(segments, memos[sourceIndex], line, column, bias || GREATEST_LOWER_BOUND);
|
||||
if (segment == null)
|
||||
return INVALID_GENERATED_MAPPING;
|
||||
return {
|
||||
line: segment[REV_GENERATED_LINE] + 1,
|
||||
column: segment[REV_GENERATED_COLUMN],
|
||||
};
|
||||
};
|
||||
eachMapping = (map, cb) => {
|
||||
const decoded = decodedMappings(map);
|
||||
const { names, resolvedSources } = map;
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const line = decoded[i];
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const seg = line[j];
|
||||
const generatedLine = i + 1;
|
||||
const generatedColumn = seg[0];
|
||||
let source = null;
|
||||
let originalLine = null;
|
||||
let originalColumn = null;
|
||||
let name = null;
|
||||
if (seg.length !== 1) {
|
||||
source = resolvedSources[seg[1]];
|
||||
originalLine = seg[2] + 1;
|
||||
originalColumn = seg[3];
|
||||
}
|
||||
if (seg.length === 5)
|
||||
name = names[seg[4]];
|
||||
cb({
|
||||
generatedLine,
|
||||
generatedColumn,
|
||||
source,
|
||||
originalLine,
|
||||
originalColumn,
|
||||
name,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
presortedDecodedMap = (map, mapUrl) => {
|
||||
const clone = Object.assign({}, map);
|
||||
clone.mappings = [];
|
||||
const tracer = new TraceMap(clone, mapUrl);
|
||||
tracer._decoded = map.mappings;
|
||||
return tracer;
|
||||
};
|
||||
decodedMap = (map) => {
|
||||
return {
|
||||
version: 3,
|
||||
file: map.file,
|
||||
names: map.names,
|
||||
sourceRoot: map.sourceRoot,
|
||||
sources: map.sources,
|
||||
sourcesContent: map.sourcesContent,
|
||||
mappings: decodedMappings(map),
|
||||
};
|
||||
};
|
||||
encodedMap = (map) => {
|
||||
return {
|
||||
version: 3,
|
||||
file: map.file,
|
||||
names: map.names,
|
||||
sourceRoot: map.sourceRoot,
|
||||
sources: map.sources,
|
||||
sourcesContent: map.sourcesContent,
|
||||
mappings: encodedMappings(map),
|
||||
};
|
||||
};
|
||||
})();
|
||||
function traceSegmentInternal(segments, memo, line, column, bias) {
|
||||
let index = memoizedBinarySearch(segments, column, memo, line);
|
||||
if (found) {
|
||||
index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
|
||||
}
|
||||
else if (bias === LEAST_UPPER_BOUND)
|
||||
index++;
|
||||
if (index === -1 || index === segments.length)
|
||||
return null;
|
||||
return segments[index];
|
||||
}
|
||||
|
||||
export { AnyMap, GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, TraceMap, decodedMap, decodedMappings, eachMapping, encodedMap, encodedMappings, generatedPositionFor, originalPositionFor, presortedDecodedMap, traceSegment };
|
||||
//# sourceMappingURL=trace-mapping.mjs.map
|
1
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map
generated
vendored
1
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
528
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js
generated
vendored
528
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js
generated
vendored
@ -1,528 +0,0 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jridgewell/sourcemap-codec'), require('@jridgewell/resolve-uri')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', '@jridgewell/sourcemap-codec', '@jridgewell/resolve-uri'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.traceMapping = {}, global.sourcemapCodec, global.resolveURI));
|
||||
})(this, (function (exports, sourcemapCodec, resolveUri) { 'use strict';
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
var resolveUri__default = /*#__PURE__*/_interopDefaultLegacy(resolveUri);
|
||||
|
||||
function resolve(input, base) {
|
||||
// The base is always treated as a directory, if it's not empty.
|
||||
// https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
|
||||
// https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
|
||||
if (base && !base.endsWith('/'))
|
||||
base += '/';
|
||||
return resolveUri__default["default"](input, base);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes everything after the last "/", but leaves the slash.
|
||||
*/
|
||||
function stripFilename(path) {
|
||||
if (!path)
|
||||
return '';
|
||||
const index = path.lastIndexOf('/');
|
||||
return path.slice(0, index + 1);
|
||||
}
|
||||
|
||||
const COLUMN = 0;
|
||||
const SOURCES_INDEX = 1;
|
||||
const SOURCE_LINE = 2;
|
||||
const SOURCE_COLUMN = 3;
|
||||
const NAMES_INDEX = 4;
|
||||
const REV_GENERATED_LINE = 1;
|
||||
const REV_GENERATED_COLUMN = 2;
|
||||
|
||||
function maybeSort(mappings, owned) {
|
||||
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
||||
if (unsortedIndex === mappings.length)
|
||||
return mappings;
|
||||
// If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If
|
||||
// not, we do not want to modify the consumer's input array.
|
||||
if (!owned)
|
||||
mappings = mappings.slice();
|
||||
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
|
||||
mappings[i] = sortSegments(mappings[i], owned);
|
||||
}
|
||||
return mappings;
|
||||
}
|
||||
function nextUnsortedSegmentLine(mappings, start) {
|
||||
for (let i = start; i < mappings.length; i++) {
|
||||
if (!isSorted(mappings[i]))
|
||||
return i;
|
||||
}
|
||||
return mappings.length;
|
||||
}
|
||||
function isSorted(line) {
|
||||
for (let j = 1; j < line.length; j++) {
|
||||
if (line[j][COLUMN] < line[j - 1][COLUMN]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function sortSegments(line, owned) {
|
||||
if (!owned)
|
||||
line = line.slice();
|
||||
return line.sort(sortComparator);
|
||||
}
|
||||
function sortComparator(a, b) {
|
||||
return a[COLUMN] - b[COLUMN];
|
||||
}
|
||||
|
||||
let found = false;
|
||||
/**
|
||||
* A binary search implementation that returns the index if a match is found.
|
||||
* If no match is found, then the left-index (the index associated with the item that comes just
|
||||
* before the desired index) is returned. To maintain proper sort order, a splice would happen at
|
||||
* the next index:
|
||||
*
|
||||
* ```js
|
||||
* const array = [1, 3];
|
||||
* const needle = 2;
|
||||
* const index = binarySearch(array, needle, (item, needle) => item - needle);
|
||||
*
|
||||
* assert.equal(index, 0);
|
||||
* array.splice(index + 1, 0, needle);
|
||||
* assert.deepEqual(array, [1, 2, 3]);
|
||||
* ```
|
||||
*/
|
||||
function binarySearch(haystack, needle, low, high) {
|
||||
while (low <= high) {
|
||||
const mid = low + ((high - low) >> 1);
|
||||
const cmp = haystack[mid][COLUMN] - needle;
|
||||
if (cmp === 0) {
|
||||
found = true;
|
||||
return mid;
|
||||
}
|
||||
if (cmp < 0) {
|
||||
low = mid + 1;
|
||||
}
|
||||
else {
|
||||
high = mid - 1;
|
||||
}
|
||||
}
|
||||
found = false;
|
||||
return low - 1;
|
||||
}
|
||||
function upperBound(haystack, needle, index) {
|
||||
for (let i = index + 1; i < haystack.length; i++, index++) {
|
||||
if (haystack[i][COLUMN] !== needle)
|
||||
break;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
function lowerBound(haystack, needle, index) {
|
||||
for (let i = index - 1; i >= 0; i--, index--) {
|
||||
if (haystack[i][COLUMN] !== needle)
|
||||
break;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
function memoizedState() {
|
||||
return {
|
||||
lastKey: -1,
|
||||
lastNeedle: -1,
|
||||
lastIndex: -1,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* This overly complicated beast is just to record the last tested line/column and the resulting
|
||||
* index, allowing us to skip a few tests if mappings are monotonically increasing.
|
||||
*/
|
||||
function memoizedBinarySearch(haystack, needle, state, key) {
|
||||
const { lastKey, lastNeedle, lastIndex } = state;
|
||||
let low = 0;
|
||||
let high = haystack.length - 1;
|
||||
if (key === lastKey) {
|
||||
if (needle === lastNeedle) {
|
||||
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
||||
return lastIndex;
|
||||
}
|
||||
if (needle >= lastNeedle) {
|
||||
// lastIndex may be -1 if the previous needle was not found.
|
||||
low = lastIndex === -1 ? 0 : lastIndex;
|
||||
}
|
||||
else {
|
||||
high = lastIndex;
|
||||
}
|
||||
}
|
||||
state.lastKey = key;
|
||||
state.lastNeedle = needle;
|
||||
return (state.lastIndex = binarySearch(haystack, needle, low, high));
|
||||
}
|
||||
|
||||
// Rebuilds the original source files, with mappings that are ordered by source line/column instead
|
||||
// of generated line/column.
|
||||
function buildBySources(decoded, memos) {
|
||||
const sources = memos.map(buildNullArray);
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const line = decoded[i];
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const seg = line[j];
|
||||
if (seg.length === 1)
|
||||
continue;
|
||||
const sourceIndex = seg[SOURCES_INDEX];
|
||||
const sourceLine = seg[SOURCE_LINE];
|
||||
const sourceColumn = seg[SOURCE_COLUMN];
|
||||
const originalSource = sources[sourceIndex];
|
||||
const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = []));
|
||||
const memo = memos[sourceIndex];
|
||||
// The binary search either found a match, or it found the left-index just before where the
|
||||
// segment should go. Either way, we want to insert after that. And there may be multiple
|
||||
// generated segments associated with an original location, so there may need to move several
|
||||
// indexes before we find where we need to insert.
|
||||
const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine));
|
||||
insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]);
|
||||
}
|
||||
}
|
||||
return sources;
|
||||
}
|
||||
function insert(array, index, value) {
|
||||
for (let i = array.length; i > index; i--) {
|
||||
array[i] = array[i - 1];
|
||||
}
|
||||
array[index] = value;
|
||||
}
|
||||
// Null arrays allow us to use ordered index keys without actually allocating contiguous memory like
|
||||
// a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations.
|
||||
// Numeric properties on objects are magically sorted in ascending order by the engine regardless of
|
||||
// the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending
|
||||
// order when iterating with for-in.
|
||||
function buildNullArray() {
|
||||
return { __proto__: null };
|
||||
}
|
||||
|
||||
const AnyMap = function (map, mapUrl) {
|
||||
const parsed = typeof map === 'string' ? JSON.parse(map) : map;
|
||||
if (!('sections' in parsed))
|
||||
return new TraceMap(parsed, mapUrl);
|
||||
const mappings = [];
|
||||
const sources = [];
|
||||
const sourcesContent = [];
|
||||
const names = [];
|
||||
const { sections } = parsed;
|
||||
let i = 0;
|
||||
for (; i < sections.length - 1; i++) {
|
||||
const no = sections[i + 1].offset;
|
||||
addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, no.line, no.column);
|
||||
}
|
||||
if (sections.length > 0) {
|
||||
addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, Infinity, Infinity);
|
||||
}
|
||||
const joined = {
|
||||
version: 3,
|
||||
file: parsed.file,
|
||||
names,
|
||||
sources,
|
||||
sourcesContent,
|
||||
mappings,
|
||||
};
|
||||
return exports.presortedDecodedMap(joined);
|
||||
};
|
||||
function addSection(section, mapUrl, mappings, sources, sourcesContent, names, stopLine, stopColumn) {
|
||||
const map = AnyMap(section.map, mapUrl);
|
||||
const { line: lineOffset, column: columnOffset } = section.offset;
|
||||
const sourcesOffset = sources.length;
|
||||
const namesOffset = names.length;
|
||||
const decoded = exports.decodedMappings(map);
|
||||
const { resolvedSources } = map;
|
||||
append(sources, resolvedSources);
|
||||
append(sourcesContent, map.sourcesContent || fillSourcesContent(resolvedSources.length));
|
||||
append(names, map.names);
|
||||
// If this section jumps forwards several lines, we need to add lines to the output mappings catch up.
|
||||
for (let i = mappings.length; i <= lineOffset; i++)
|
||||
mappings.push([]);
|
||||
// We can only add so many lines before we step into the range that the next section's map
|
||||
// controls. When we get to the last line, then we'll start checking the segments to see if
|
||||
// they've crossed into the column range.
|
||||
const stopI = stopLine - lineOffset;
|
||||
const len = Math.min(decoded.length, stopI + 1);
|
||||
for (let i = 0; i < len; i++) {
|
||||
const line = decoded[i];
|
||||
// On the 0th loop, the line will already exist due to a previous section, or the line catch up
|
||||
// loop above.
|
||||
const out = i === 0 ? mappings[lineOffset] : (mappings[lineOffset + i] = []);
|
||||
// On the 0th loop, the section's column offset shifts us forward. On all other lines (since the
|
||||
// map can be multiple lines), it doesn't.
|
||||
const cOffset = i === 0 ? columnOffset : 0;
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const seg = line[j];
|
||||
const column = cOffset + seg[COLUMN];
|
||||
// If this segment steps into the column range that the next section's map controls, we need
|
||||
// to stop early.
|
||||
if (i === stopI && column >= stopColumn)
|
||||
break;
|
||||
if (seg.length === 1) {
|
||||
out.push([column]);
|
||||
continue;
|
||||
}
|
||||
const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];
|
||||
const sourceLine = seg[SOURCE_LINE];
|
||||
const sourceColumn = seg[SOURCE_COLUMN];
|
||||
if (seg.length === 4) {
|
||||
out.push([column, sourcesIndex, sourceLine, sourceColumn]);
|
||||
continue;
|
||||
}
|
||||
out.push([column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
function append(arr, other) {
|
||||
for (let i = 0; i < other.length; i++)
|
||||
arr.push(other[i]);
|
||||
}
|
||||
// Sourcemaps don't need to have sourcesContent, and if they don't, we need to create an array of
|
||||
// equal length to the sources. This is because the sources and sourcesContent are paired arrays,
|
||||
// where `sourcesContent[i]` is the content of the `sources[i]` file. If we didn't, then joined
|
||||
// sourcemap would desynchronize the sources/contents.
|
||||
function fillSourcesContent(len) {
|
||||
const sourcesContent = [];
|
||||
for (let i = 0; i < len; i++)
|
||||
sourcesContent[i] = null;
|
||||
return sourcesContent;
|
||||
}
|
||||
|
||||
const INVALID_ORIGINAL_MAPPING = Object.freeze({
|
||||
source: null,
|
||||
line: null,
|
||||
column: null,
|
||||
name: null,
|
||||
});
|
||||
const INVALID_GENERATED_MAPPING = Object.freeze({
|
||||
line: null,
|
||||
column: null,
|
||||
});
|
||||
const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';
|
||||
const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';
|
||||
const LEAST_UPPER_BOUND = -1;
|
||||
const GREATEST_LOWER_BOUND = 1;
|
||||
/**
|
||||
* Returns the encoded (VLQ string) form of the SourceMap's mappings field.
|
||||
*/
|
||||
exports.encodedMappings = void 0;
|
||||
/**
|
||||
* Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
|
||||
*/
|
||||
exports.decodedMappings = void 0;
|
||||
/**
|
||||
* A low-level API to find the segment associated with a generated line/column (think, from a
|
||||
* stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
|
||||
*/
|
||||
exports.traceSegment = void 0;
|
||||
/**
|
||||
* A higher-level API to find the source/line/column associated with a generated line/column
|
||||
* (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
|
||||
* `source-map` library.
|
||||
*/
|
||||
exports.originalPositionFor = void 0;
|
||||
/**
|
||||
* Finds the source/line/column directly after the mapping returned by originalPositionFor, provided
|
||||
* the found mapping is from the same source and line as the originalPositionFor mapping.
|
||||
*
|
||||
* Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1`
|
||||
* using the same needle that would return `id` when calling `originalPositionFor`.
|
||||
*/
|
||||
exports.generatedPositionFor = void 0;
|
||||
/**
|
||||
* Iterates each mapping in generated position order.
|
||||
*/
|
||||
exports.eachMapping = void 0;
|
||||
/**
|
||||
* A helper that skips sorting of the input map's mappings array, which can be expensive for larger
|
||||
* maps.
|
||||
*/
|
||||
exports.presortedDecodedMap = void 0;
|
||||
/**
|
||||
* Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
|
||||
* a sourcemap, or to JSON.stringify.
|
||||
*/
|
||||
exports.decodedMap = void 0;
|
||||
/**
|
||||
* Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
|
||||
* a sourcemap, or to JSON.stringify.
|
||||
*/
|
||||
exports.encodedMap = void 0;
|
||||
class TraceMap {
|
||||
constructor(map, mapUrl) {
|
||||
this._decodedMemo = memoizedState();
|
||||
this._bySources = undefined;
|
||||
this._bySourceMemos = undefined;
|
||||
const isString = typeof map === 'string';
|
||||
if (!isString && map.constructor === TraceMap)
|
||||
return map;
|
||||
const parsed = (isString ? JSON.parse(map) : map);
|
||||
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
||||
this.version = version;
|
||||
this.file = file;
|
||||
this.names = names;
|
||||
this.sourceRoot = sourceRoot;
|
||||
this.sources = sources;
|
||||
this.sourcesContent = sourcesContent;
|
||||
if (sourceRoot || mapUrl) {
|
||||
const from = resolve(sourceRoot || '', stripFilename(mapUrl));
|
||||
this.resolvedSources = sources.map((s) => resolve(s || '', from));
|
||||
}
|
||||
else {
|
||||
this.resolvedSources = sources.map((s) => s || '');
|
||||
}
|
||||
const { mappings } = parsed;
|
||||
if (typeof mappings === 'string') {
|
||||
this._encoded = mappings;
|
||||
this._decoded = undefined;
|
||||
}
|
||||
else {
|
||||
this._encoded = undefined;
|
||||
this._decoded = maybeSort(mappings, isString);
|
||||
}
|
||||
}
|
||||
}
|
||||
(() => {
|
||||
exports.encodedMappings = (map) => {
|
||||
var _a;
|
||||
return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = sourcemapCodec.encode(map._decoded)));
|
||||
};
|
||||
exports.decodedMappings = (map) => {
|
||||
return (map._decoded || (map._decoded = sourcemapCodec.decode(map._encoded)));
|
||||
};
|
||||
exports.traceSegment = (map, line, column) => {
|
||||
const decoded = exports.decodedMappings(map);
|
||||
// It's common for parent source maps to have pointers to lines that have no
|
||||
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
||||
if (line >= decoded.length)
|
||||
return null;
|
||||
return traceSegmentInternal(decoded[line], map._decodedMemo, line, column, GREATEST_LOWER_BOUND);
|
||||
};
|
||||
exports.originalPositionFor = (map, { line, column, bias }) => {
|
||||
line--;
|
||||
if (line < 0)
|
||||
throw new Error(LINE_GTR_ZERO);
|
||||
if (column < 0)
|
||||
throw new Error(COL_GTR_EQ_ZERO);
|
||||
const decoded = exports.decodedMappings(map);
|
||||
// It's common for parent source maps to have pointers to lines that have no
|
||||
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
||||
if (line >= decoded.length)
|
||||
return INVALID_ORIGINAL_MAPPING;
|
||||
const segment = traceSegmentInternal(decoded[line], map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
|
||||
if (segment == null)
|
||||
return INVALID_ORIGINAL_MAPPING;
|
||||
if (segment.length == 1)
|
||||
return INVALID_ORIGINAL_MAPPING;
|
||||
const { names, resolvedSources } = map;
|
||||
return {
|
||||
source: resolvedSources[segment[SOURCES_INDEX]],
|
||||
line: segment[SOURCE_LINE] + 1,
|
||||
column: segment[SOURCE_COLUMN],
|
||||
name: segment.length === 5 ? names[segment[NAMES_INDEX]] : null,
|
||||
};
|
||||
};
|
||||
exports.generatedPositionFor = (map, { source, line, column, bias }) => {
|
||||
line--;
|
||||
if (line < 0)
|
||||
throw new Error(LINE_GTR_ZERO);
|
||||
if (column < 0)
|
||||
throw new Error(COL_GTR_EQ_ZERO);
|
||||
const { sources, resolvedSources } = map;
|
||||
let sourceIndex = sources.indexOf(source);
|
||||
if (sourceIndex === -1)
|
||||
sourceIndex = resolvedSources.indexOf(source);
|
||||
if (sourceIndex === -1)
|
||||
return INVALID_GENERATED_MAPPING;
|
||||
const generated = (map._bySources || (map._bySources = buildBySources(exports.decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState)))));
|
||||
const memos = map._bySourceMemos;
|
||||
const segments = generated[sourceIndex][line];
|
||||
if (segments == null)
|
||||
return INVALID_GENERATED_MAPPING;
|
||||
const segment = traceSegmentInternal(segments, memos[sourceIndex], line, column, bias || GREATEST_LOWER_BOUND);
|
||||
if (segment == null)
|
||||
return INVALID_GENERATED_MAPPING;
|
||||
return {
|
||||
line: segment[REV_GENERATED_LINE] + 1,
|
||||
column: segment[REV_GENERATED_COLUMN],
|
||||
};
|
||||
};
|
||||
exports.eachMapping = (map, cb) => {
|
||||
const decoded = exports.decodedMappings(map);
|
||||
const { names, resolvedSources } = map;
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const line = decoded[i];
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const seg = line[j];
|
||||
const generatedLine = i + 1;
|
||||
const generatedColumn = seg[0];
|
||||
let source = null;
|
||||
let originalLine = null;
|
||||
let originalColumn = null;
|
||||
let name = null;
|
||||
if (seg.length !== 1) {
|
||||
source = resolvedSources[seg[1]];
|
||||
originalLine = seg[2] + 1;
|
||||
originalColumn = seg[3];
|
||||
}
|
||||
if (seg.length === 5)
|
||||
name = names[seg[4]];
|
||||
cb({
|
||||
generatedLine,
|
||||
generatedColumn,
|
||||
source,
|
||||
originalLine,
|
||||
originalColumn,
|
||||
name,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.presortedDecodedMap = (map, mapUrl) => {
|
||||
const clone = Object.assign({}, map);
|
||||
clone.mappings = [];
|
||||
const tracer = new TraceMap(clone, mapUrl);
|
||||
tracer._decoded = map.mappings;
|
||||
return tracer;
|
||||
};
|
||||
exports.decodedMap = (map) => {
|
||||
return {
|
||||
version: 3,
|
||||
file: map.file,
|
||||
names: map.names,
|
||||
sourceRoot: map.sourceRoot,
|
||||
sources: map.sources,
|
||||
sourcesContent: map.sourcesContent,
|
||||
mappings: exports.decodedMappings(map),
|
||||
};
|
||||
};
|
||||
exports.encodedMap = (map) => {
|
||||
return {
|
||||
version: 3,
|
||||
file: map.file,
|
||||
names: map.names,
|
||||
sourceRoot: map.sourceRoot,
|
||||
sources: map.sources,
|
||||
sourcesContent: map.sourcesContent,
|
||||
mappings: exports.encodedMappings(map),
|
||||
};
|
||||
};
|
||||
})();
|
||||
function traceSegmentInternal(segments, memo, line, column, bias) {
|
||||
let index = memoizedBinarySearch(segments, column, memo, line);
|
||||
if (found) {
|
||||
index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
|
||||
}
|
||||
else if (bias === LEAST_UPPER_BOUND)
|
||||
index++;
|
||||
if (index === -1 || index === segments.length)
|
||||
return null;
|
||||
return segments[index];
|
||||
}
|
||||
|
||||
exports.AnyMap = AnyMap;
|
||||
exports.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND;
|
||||
exports.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND;
|
||||
exports.TraceMap = TraceMap;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=trace-mapping.umd.js.map
|
1
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map
generated
vendored
1
node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map
generated
vendored
File diff suppressed because one or more lines are too long
8
node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts
generated
vendored
8
node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts
generated
vendored
@ -1,8 +0,0 @@
|
||||
import { TraceMap } from './trace-mapping';
|
||||
import type { SectionedSourceMapInput } from './types';
|
||||
declare type AnyMap = {
|
||||
new (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap;
|
||||
(map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap;
|
||||
};
|
||||
export declare const AnyMap: AnyMap;
|
||||
export {};
|
32
node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts
generated
vendored
32
node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts
generated
vendored
@ -1,32 +0,0 @@
|
||||
import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment';
|
||||
export declare type MemoState = {
|
||||
lastKey: number;
|
||||
lastNeedle: number;
|
||||
lastIndex: number;
|
||||
};
|
||||
export declare let found: boolean;
|
||||
/**
|
||||
* A binary search implementation that returns the index if a match is found.
|
||||
* If no match is found, then the left-index (the index associated with the item that comes just
|
||||
* before the desired index) is returned. To maintain proper sort order, a splice would happen at
|
||||
* the next index:
|
||||
*
|
||||
* ```js
|
||||
* const array = [1, 3];
|
||||
* const needle = 2;
|
||||
* const index = binarySearch(array, needle, (item, needle) => item - needle);
|
||||
*
|
||||
* assert.equal(index, 0);
|
||||
* array.splice(index + 1, 0, needle);
|
||||
* assert.deepEqual(array, [1, 2, 3]);
|
||||
* ```
|
||||
*/
|
||||
export declare function binarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, low: number, high: number): number;
|
||||
export declare function upperBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number;
|
||||
export declare function lowerBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number;
|
||||
export declare function memoizedState(): MemoState;
|
||||
/**
|
||||
* This overly complicated beast is just to record the last tested line/column and the resulting
|
||||
* index, allowing us to skip a few tests if mappings are monotonically increasing.
|
||||
*/
|
||||
export declare function memoizedBinarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, state: MemoState, key: number): number;
|
7
node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts
generated
vendored
7
node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts
generated
vendored
@ -1,7 +0,0 @@
|
||||
import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment';
|
||||
import type { MemoState } from './binary-search';
|
||||
export declare type Source = {
|
||||
__proto__: null;
|
||||
[line: number]: Exclude<ReverseSegment, [number]>[];
|
||||
};
|
||||
export default function buildBySources(decoded: readonly SourceMapSegment[][], memos: MemoState[]): Source[];
|
1
node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts
generated
vendored
1
node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts
generated
vendored
@ -1 +0,0 @@
|
||||
export default function resolve(input: string, base: string | undefined): string;
|
2
node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts
generated
vendored
2
node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts
generated
vendored
@ -1,2 +0,0 @@
|
||||
import type { SourceMapSegment } from './sourcemap-segment';
|
||||
export default function maybeSort(mappings: SourceMapSegment[][], owned: boolean): SourceMapSegment[][];
|
16
node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts
generated
vendored
16
node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts
generated
vendored
@ -1,16 +0,0 @@
|
||||
declare type GeneratedColumn = number;
|
||||
declare type SourcesIndex = number;
|
||||
declare type SourceLine = number;
|
||||
declare type SourceColumn = number;
|
||||
declare type NamesIndex = number;
|
||||
declare type GeneratedLine = number;
|
||||
export declare type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];
|
||||
export declare type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn];
|
||||
export declare const COLUMN = 0;
|
||||
export declare const SOURCES_INDEX = 1;
|
||||
export declare const SOURCE_LINE = 2;
|
||||
export declare const SOURCE_COLUMN = 3;
|
||||
export declare const NAMES_INDEX = 4;
|
||||
export declare const REV_GENERATED_LINE = 1;
|
||||
export declare const REV_GENERATED_COLUMN = 2;
|
||||
export {};
|
4
node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts
generated
vendored
4
node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts
generated
vendored
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* Removes everything after the last "/", but leaves the slash.
|
||||
*/
|
||||
export default function stripFilename(path: string | undefined | null): string;
|
70
node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts
generated
vendored
70
node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts
generated
vendored
@ -1,70 +0,0 @@
|
||||
import type { SourceMapSegment } from './sourcemap-segment';
|
||||
import type { SourceMapV3, DecodedSourceMap, EncodedSourceMap, InvalidOriginalMapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, SourceMapInput, Needle, SourceNeedle, SourceMap, EachMapping } from './types';
|
||||
export type { SourceMapSegment } from './sourcemap-segment';
|
||||
export type { SourceMapInput, SectionedSourceMapInput, DecodedSourceMap, EncodedSourceMap, SectionedSourceMap, InvalidOriginalMapping, OriginalMapping as Mapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, EachMapping, } from './types';
|
||||
export declare const LEAST_UPPER_BOUND = -1;
|
||||
export declare const GREATEST_LOWER_BOUND = 1;
|
||||
/**
|
||||
* Returns the encoded (VLQ string) form of the SourceMap's mappings field.
|
||||
*/
|
||||
export declare let encodedMappings: (map: TraceMap) => EncodedSourceMap['mappings'];
|
||||
/**
|
||||
* Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
|
||||
*/
|
||||
export declare let decodedMappings: (map: TraceMap) => Readonly<DecodedSourceMap['mappings']>;
|
||||
/**
|
||||
* A low-level API to find the segment associated with a generated line/column (think, from a
|
||||
* stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
|
||||
*/
|
||||
export declare let traceSegment: (map: TraceMap, line: number, column: number) => Readonly<SourceMapSegment> | null;
|
||||
/**
|
||||
* A higher-level API to find the source/line/column associated with a generated line/column
|
||||
* (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
|
||||
* `source-map` library.
|
||||
*/
|
||||
export declare let originalPositionFor: (map: TraceMap, needle: Needle) => OriginalMapping | InvalidOriginalMapping;
|
||||
/**
|
||||
* Finds the source/line/column directly after the mapping returned by originalPositionFor, provided
|
||||
* the found mapping is from the same source and line as the originalPositionFor mapping.
|
||||
*
|
||||
* Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1`
|
||||
* using the same needle that would return `id` when calling `originalPositionFor`.
|
||||
*/
|
||||
export declare let generatedPositionFor: (map: TraceMap, needle: SourceNeedle) => GeneratedMapping | InvalidGeneratedMapping;
|
||||
/**
|
||||
* Iterates each mapping in generated position order.
|
||||
*/
|
||||
export declare let eachMapping: (map: TraceMap, cb: (mapping: EachMapping) => void) => void;
|
||||
/**
|
||||
* A helper that skips sorting of the input map's mappings array, which can be expensive for larger
|
||||
* maps.
|
||||
*/
|
||||
export declare let presortedDecodedMap: (map: DecodedSourceMap, mapUrl?: string) => TraceMap;
|
||||
/**
|
||||
* Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
|
||||
* a sourcemap, or to JSON.stringify.
|
||||
*/
|
||||
export declare let decodedMap: (map: TraceMap) => Omit<DecodedSourceMap, 'mappings'> & {
|
||||
mappings: readonly SourceMapSegment[][];
|
||||
};
|
||||
/**
|
||||
* Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
|
||||
* a sourcemap, or to JSON.stringify.
|
||||
*/
|
||||
export declare let encodedMap: (map: TraceMap) => EncodedSourceMap;
|
||||
export { AnyMap } from './any-map';
|
||||
export declare class TraceMap implements SourceMap {
|
||||
version: SourceMapV3['version'];
|
||||
file: SourceMapV3['file'];
|
||||
names: SourceMapV3['names'];
|
||||
sourceRoot: SourceMapV3['sourceRoot'];
|
||||
sources: SourceMapV3['sources'];
|
||||
sourcesContent: SourceMapV3['sourcesContent'];
|
||||
resolvedSources: string[];
|
||||
private _encoded;
|
||||
private _decoded;
|
||||
private _decodedMemo;
|
||||
private _bySources;
|
||||
private _bySourceMemos;
|
||||
constructor(map: SourceMapInput, mapUrl?: string | null);
|
||||
}
|
85
node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts
generated
vendored
85
node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts
generated
vendored
@ -1,85 +0,0 @@
|
||||
import type { SourceMapSegment } from './sourcemap-segment';
|
||||
import type { TraceMap } from './trace-mapping';
|
||||
export interface SourceMapV3 {
|
||||
file?: string | null;
|
||||
names: string[];
|
||||
sourceRoot?: string;
|
||||
sources: (string | null)[];
|
||||
sourcesContent?: (string | null)[];
|
||||
version: 3;
|
||||
}
|
||||
export interface EncodedSourceMap extends SourceMapV3 {
|
||||
mappings: string;
|
||||
}
|
||||
export interface DecodedSourceMap extends SourceMapV3 {
|
||||
mappings: SourceMapSegment[][];
|
||||
}
|
||||
export interface Section {
|
||||
offset: {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
map: EncodedSourceMap | DecodedSourceMap | SectionedSourceMap;
|
||||
}
|
||||
export interface SectionedSourceMap {
|
||||
file?: string | null;
|
||||
sections: Section[];
|
||||
version: 3;
|
||||
}
|
||||
export declare type OriginalMapping = {
|
||||
source: string | null;
|
||||
line: number;
|
||||
column: number;
|
||||
name: string | null;
|
||||
};
|
||||
export declare type InvalidOriginalMapping = {
|
||||
source: null;
|
||||
line: null;
|
||||
column: null;
|
||||
name: null;
|
||||
};
|
||||
export declare type GeneratedMapping = {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
export declare type InvalidGeneratedMapping = {
|
||||
line: null;
|
||||
column: null;
|
||||
};
|
||||
export declare type SourceMapInput = string | EncodedSourceMap | DecodedSourceMap | TraceMap;
|
||||
export declare type SectionedSourceMapInput = SourceMapInput | SectionedSourceMap;
|
||||
export declare type Needle = {
|
||||
line: number;
|
||||
column: number;
|
||||
bias?: 1 | -1;
|
||||
};
|
||||
export declare type SourceNeedle = {
|
||||
source: string;
|
||||
line: number;
|
||||
column: number;
|
||||
bias?: 1 | -1;
|
||||
};
|
||||
export declare type EachMapping = {
|
||||
generatedLine: number;
|
||||
generatedColumn: number;
|
||||
source: null;
|
||||
originalLine: null;
|
||||
originalColumn: null;
|
||||
name: null;
|
||||
} | {
|
||||
generatedLine: number;
|
||||
generatedColumn: number;
|
||||
source: string | null;
|
||||
originalLine: number;
|
||||
originalColumn: number;
|
||||
name: string | null;
|
||||
};
|
||||
export declare abstract class SourceMap {
|
||||
version: SourceMapV3['version'];
|
||||
file: SourceMapV3['file'];
|
||||
names: SourceMapV3['names'];
|
||||
sourceRoot: SourceMapV3['sourceRoot'];
|
||||
sources: SourceMapV3['sources'];
|
||||
sourcesContent: SourceMapV3['sourcesContent'];
|
||||
resolvedSources: SourceMapV3['sources'];
|
||||
}
|
70
node_modules/@jridgewell/trace-mapping/package.json
generated
vendored
70
node_modules/@jridgewell/trace-mapping/package.json
generated
vendored
@ -1,70 +0,0 @@
|
||||
{
|
||||
"name": "@jridgewell/trace-mapping",
|
||||
"version": "0.3.9",
|
||||
"description": "Trace the original position through a source map",
|
||||
"keywords": [
|
||||
"source",
|
||||
"map"
|
||||
],
|
||||
"main": "dist/trace-mapping.umd.js",
|
||||
"module": "dist/trace-mapping.mjs",
|
||||
"typings": "dist/types/trace-mapping.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"browser": "./dist/trace-mapping.umd.js",
|
||||
"require": "./dist/trace-mapping.umd.js",
|
||||
"import": "./dist/trace-mapping.mjs"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"author": "Justin Ridgewell <justin@ridgewell.name>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jridgewell/trace-mapping.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"benchmark": "run-s build:rollup benchmark:*",
|
||||
"benchmark:install": "cd benchmark && npm install",
|
||||
"benchmark:only": "node benchmark/index.mjs",
|
||||
"build": "run-s -n build:*",
|
||||
"build:rollup": "rollup -c rollup.config.js",
|
||||
"build:ts": "tsc --project tsconfig.build.json",
|
||||
"lint": "run-s -n lint:*",
|
||||
"lint:prettier": "npm run test:lint:prettier -- --write",
|
||||
"lint:ts": "npm run test:lint:ts -- --fix",
|
||||
"prebuild": "rm -rf dist",
|
||||
"prepublishOnly": "npm run preversion",
|
||||
"preversion": "run-s test build",
|
||||
"test": "run-s -n test:lint test:only",
|
||||
"test:debug": "ava debug",
|
||||
"test:lint": "run-s -n test:lint:*",
|
||||
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts' '**/*.md'",
|
||||
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
||||
"test:only": "c8 ava",
|
||||
"test:watch": "ava --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "8.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "5.10.0",
|
||||
"@typescript-eslint/parser": "5.10.0",
|
||||
"ava": "4.0.1",
|
||||
"benchmark": "2.1.4",
|
||||
"c8": "7.11.0",
|
||||
"esbuild": "0.14.14",
|
||||
"esbuild-node-loader": "0.6.4",
|
||||
"eslint": "8.7.0",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "2.5.1",
|
||||
"rollup": "2.64.0",
|
||||
"typescript": "4.5.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
}
|
21
node_modules/@tsconfig/node10/LICENSE
generated
vendored
21
node_modules/@tsconfig/node10/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
40
node_modules/@tsconfig/node10/README.md
generated
vendored
40
node_modules/@tsconfig/node10/README.md
generated
vendored
@ -1,40 +0,0 @@
|
||||
### A base TSConfig for working with Node 10.
|
||||
|
||||
Add the package to your `"devDependencies"`:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @tsconfig/node10
|
||||
yarn add --dev @tsconfig/node10
|
||||
```
|
||||
|
||||
Add to your `tsconfig.json`:
|
||||
|
||||
```json
|
||||
"extends": "@tsconfig/node10/tsconfig.json"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
The `tsconfig.json`:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Node 10",
|
||||
|
||||
"compilerOptions": {
|
||||
"lib": ["es2018"],
|
||||
"module": "commonjs",
|
||||
"target": "es2018",
|
||||
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/node10.json).
|
1
node_modules/@tsconfig/node10/package.json
generated
vendored
1
node_modules/@tsconfig/node10/package.json
generated
vendored
@ -1 +0,0 @@
|
||||
{"name":"@tsconfig/node10","repository":{"type":"git","url":"https://github.com/tsconfig/bases.git","directory":"bases"},"license":"MIT","description":"A base TSConfig for working with Node 10.","keywords":["tsconfig","node10"],"version":"1.0.9"}
|
16
node_modules/@tsconfig/node10/tsconfig.json
generated
vendored
16
node_modules/@tsconfig/node10/tsconfig.json
generated
vendored
@ -1,16 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Node 10",
|
||||
|
||||
"compilerOptions": {
|
||||
"lib": ["es2018"],
|
||||
"module": "commonjs",
|
||||
"target": "es2018",
|
||||
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
21
node_modules/@tsconfig/node12/LICENSE
generated
vendored
21
node_modules/@tsconfig/node12/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
40
node_modules/@tsconfig/node12/README.md
generated
vendored
40
node_modules/@tsconfig/node12/README.md
generated
vendored
@ -1,40 +0,0 @@
|
||||
### A base TSConfig for working with Node 12.
|
||||
|
||||
Add the package to your `"devDependencies"`:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @tsconfig/node12
|
||||
yarn add --dev @tsconfig/node12
|
||||
```
|
||||
|
||||
Add to your `tsconfig.json`:
|
||||
|
||||
```json
|
||||
"extends": "@tsconfig/node12/tsconfig.json"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
The `tsconfig.json`:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Node 12",
|
||||
|
||||
"compilerOptions": {
|
||||
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"],
|
||||
"module": "commonjs",
|
||||
"target": "es2019",
|
||||
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/node12.json).
|
1
node_modules/@tsconfig/node12/package.json
generated
vendored
1
node_modules/@tsconfig/node12/package.json
generated
vendored
@ -1 +0,0 @@
|
||||
{"name":"@tsconfig/node12","repository":{"type":"git","url":"https://github.com/tsconfig/bases.git","directory":"bases"},"license":"MIT","description":"A base TSConfig for working with Node 12.","keywords":["tsconfig","node12"],"version":"1.0.11"}
|
16
node_modules/@tsconfig/node12/tsconfig.json
generated
vendored
16
node_modules/@tsconfig/node12/tsconfig.json
generated
vendored
@ -1,16 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Node 12",
|
||||
|
||||
"compilerOptions": {
|
||||
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"],
|
||||
"module": "commonjs",
|
||||
"target": "es2019",
|
||||
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
21
node_modules/@tsconfig/node14/LICENSE
generated
vendored
21
node_modules/@tsconfig/node14/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
40
node_modules/@tsconfig/node14/README.md
generated
vendored
40
node_modules/@tsconfig/node14/README.md
generated
vendored
@ -1,40 +0,0 @@
|
||||
### A base TSConfig for working with Node 14.
|
||||
|
||||
Add the package to your `"devDependencies"`:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @tsconfig/node14
|
||||
yarn add --dev @tsconfig/node14
|
||||
```
|
||||
|
||||
Add to your `tsconfig.json`:
|
||||
|
||||
```json
|
||||
"extends": "@tsconfig/node14/tsconfig.json"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
The `tsconfig.json`:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Node 14",
|
||||
|
||||
"compilerOptions": {
|
||||
"lib": ["es2020"],
|
||||
"module": "commonjs",
|
||||
"target": "es2020",
|
||||
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/node14.json).
|
1
node_modules/@tsconfig/node14/package.json
generated
vendored
1
node_modules/@tsconfig/node14/package.json
generated
vendored
@ -1 +0,0 @@
|
||||
{"name":"@tsconfig/node14","repository":{"type":"git","url":"https://github.com/tsconfig/bases.git","directory":"bases"},"license":"MIT","description":"A base TSConfig for working with Node 14.","keywords":["tsconfig","node14"],"version":"1.0.3"}
|
16
node_modules/@tsconfig/node14/tsconfig.json
generated
vendored
16
node_modules/@tsconfig/node14/tsconfig.json
generated
vendored
@ -1,16 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Node 14",
|
||||
|
||||
"compilerOptions": {
|
||||
"lib": ["es2020"],
|
||||
"module": "commonjs",
|
||||
"target": "es2020",
|
||||
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
21
node_modules/@tsconfig/node16/LICENSE
generated
vendored
21
node_modules/@tsconfig/node16/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
40
node_modules/@tsconfig/node16/README.md
generated
vendored
40
node_modules/@tsconfig/node16/README.md
generated
vendored
@ -1,40 +0,0 @@
|
||||
### A base TSConfig for working with Node 16.
|
||||
|
||||
Add the package to your `"devDependencies"`:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @tsconfig/node16
|
||||
yarn add --dev @tsconfig/node16
|
||||
```
|
||||
|
||||
Add to your `tsconfig.json`:
|
||||
|
||||
```json
|
||||
"extends": "@tsconfig/node16/tsconfig.json"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
The `tsconfig.json`:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Node 16",
|
||||
|
||||
"compilerOptions": {
|
||||
"lib": ["es2021"],
|
||||
"module": "Node16",
|
||||
"target": "es2021",
|
||||
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/node16.json).
|
15
node_modules/@tsconfig/node16/package.json
generated
vendored
15
node_modules/@tsconfig/node16/package.json
generated
vendored
@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "@tsconfig/node16",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tsconfig/bases.git",
|
||||
"directory": "bases"
|
||||
},
|
||||
"license": "MIT",
|
||||
"description": "A base TSConfig for working with Node 16.",
|
||||
"keywords": [
|
||||
"tsconfig",
|
||||
"node16"
|
||||
],
|
||||
"version": "1.0.4"
|
||||
}
|
16
node_modules/@tsconfig/node16/tsconfig.json
generated
vendored
16
node_modules/@tsconfig/node16/tsconfig.json
generated
vendored
@ -1,16 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Node 16",
|
||||
|
||||
"compilerOptions": {
|
||||
"lib": ["es2021"],
|
||||
"module": "Node16",
|
||||
"target": "es2021",
|
||||
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
21
node_modules/@types/node/LICENSE
generated
vendored
21
node_modules/@types/node/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
16
node_modules/@types/node/README.md
generated
vendored
16
node_modules/@types/node/README.md
generated
vendored
@ -1,16 +0,0 @@
|
||||
# Installation
|
||||
> `npm install --save @types/node`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for Node.js (https://nodejs.org/).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Fri, 11 Aug 2023 19:32:47 GMT
|
||||
* Dependencies: none
|
||||
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
|
972
node_modules/@types/node/assert.d.ts
generated
vendored
972
node_modules/@types/node/assert.d.ts
generated
vendored
@ -1,972 +0,0 @@
|
||||
/**
|
||||
* The `node:assert` module provides a set of assertion functions for verifying
|
||||
* invariants.
|
||||
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/assert.js)
|
||||
*/
|
||||
declare module 'assert' {
|
||||
/**
|
||||
* An alias of {@link ok}.
|
||||
* @since v0.5.9
|
||||
* @param value The input that is checked for being truthy.
|
||||
*/
|
||||
function assert(value: unknown, message?: string | Error): asserts value;
|
||||
namespace assert {
|
||||
/**
|
||||
* Indicates the failure of an assertion. All errors thrown by the `node:assert`module will be instances of the `AssertionError` class.
|
||||
*/
|
||||
class AssertionError extends Error {
|
||||
/**
|
||||
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
|
||||
*/
|
||||
actual: unknown;
|
||||
/**
|
||||
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
|
||||
*/
|
||||
expected: unknown;
|
||||
/**
|
||||
* Set to the passed in operator value.
|
||||
*/
|
||||
operator: string;
|
||||
/**
|
||||
* Indicates if the message was auto-generated (`true`) or not.
|
||||
*/
|
||||
generatedMessage: boolean;
|
||||
/**
|
||||
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
|
||||
*/
|
||||
code: 'ERR_ASSERTION';
|
||||
constructor(options?: {
|
||||
/** If provided, the error message is set to this value. */
|
||||
message?: string | undefined;
|
||||
/** The `actual` property on the error instance. */
|
||||
actual?: unknown | undefined;
|
||||
/** The `expected` property on the error instance. */
|
||||
expected?: unknown | undefined;
|
||||
/** The `operator` property on the error instance. */
|
||||
operator?: string | undefined;
|
||||
/** If provided, the generated stack trace omits frames before this function. */
|
||||
// tslint:disable-next-line:ban-types
|
||||
stackStartFn?: Function | undefined;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* This feature is deprecated and will be removed in a future version.
|
||||
* Please consider using alternatives such as the `mock` helper function.
|
||||
* @since v14.2.0, v12.19.0
|
||||
* @deprecated Deprecated
|
||||
*/
|
||||
class CallTracker {
|
||||
/**
|
||||
* The wrapper function is expected to be called exactly `exact` times. If the
|
||||
* function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
|
||||
* error.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert';
|
||||
*
|
||||
* // Creates call tracker.
|
||||
* const tracker = new assert.CallTracker();
|
||||
*
|
||||
* function func() {}
|
||||
*
|
||||
* // Returns a function that wraps func() that must be called exact times
|
||||
* // before tracker.verify().
|
||||
* const callsfunc = tracker.calls(func);
|
||||
* ```
|
||||
* @since v14.2.0, v12.19.0
|
||||
* @param [fn='A no-op function']
|
||||
* @param [exact=1]
|
||||
* @return that wraps `fn`.
|
||||
*/
|
||||
calls(exact?: number): () => void;
|
||||
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
|
||||
/**
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert';
|
||||
*
|
||||
* const tracker = new assert.CallTracker();
|
||||
*
|
||||
* function func() {}
|
||||
* const callsfunc = tracker.calls(func);
|
||||
* callsfunc(1, 2, 3);
|
||||
*
|
||||
* assert.deepStrictEqual(tracker.getCalls(callsfunc),
|
||||
* [{ thisArg: undefined, arguments: [1, 2, 3] }]);
|
||||
* ```
|
||||
* @since v18.8.0, v16.18.0
|
||||
* @param fn
|
||||
* @return An Array with all the calls to a tracked function.
|
||||
*/
|
||||
getCalls(fn: Function): CallTrackerCall[];
|
||||
/**
|
||||
* The arrays contains information about the expected and actual number of calls of
|
||||
* the functions that have not been called the expected number of times.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert';
|
||||
*
|
||||
* // Creates call tracker.
|
||||
* const tracker = new assert.CallTracker();
|
||||
*
|
||||
* function func() {}
|
||||
*
|
||||
* // Returns a function that wraps func() that must be called exact times
|
||||
* // before tracker.verify().
|
||||
* const callsfunc = tracker.calls(func, 2);
|
||||
*
|
||||
* // Returns an array containing information on callsfunc()
|
||||
* console.log(tracker.report());
|
||||
* // [
|
||||
* // {
|
||||
* // message: 'Expected the func function to be executed 2 time(s) but was
|
||||
* // executed 0 time(s).',
|
||||
* // actual: 0,
|
||||
* // expected: 2,
|
||||
* // operator: 'func',
|
||||
* // stack: stack trace
|
||||
* // }
|
||||
* // ]
|
||||
* ```
|
||||
* @since v14.2.0, v12.19.0
|
||||
* @return An Array of objects containing information about the wrapper functions returned by `calls`.
|
||||
*/
|
||||
report(): CallTrackerReportInformation[];
|
||||
/**
|
||||
* Reset calls of the call tracker.
|
||||
* If a tracked function is passed as an argument, the calls will be reset for it.
|
||||
* If no arguments are passed, all tracked functions will be reset.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert';
|
||||
*
|
||||
* const tracker = new assert.CallTracker();
|
||||
*
|
||||
* function func() {}
|
||||
* const callsfunc = tracker.calls(func);
|
||||
*
|
||||
* callsfunc();
|
||||
* // Tracker was called once
|
||||
* assert.strictEqual(tracker.getCalls(callsfunc).length, 1);
|
||||
*
|
||||
* tracker.reset(callsfunc);
|
||||
* assert.strictEqual(tracker.getCalls(callsfunc).length, 0);
|
||||
* ```
|
||||
* @since v18.8.0, v16.18.0
|
||||
* @param fn a tracked function to reset.
|
||||
*/
|
||||
reset(fn?: Function): void;
|
||||
/**
|
||||
* Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that
|
||||
* have not been called the expected number of times.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert';
|
||||
*
|
||||
* // Creates call tracker.
|
||||
* const tracker = new assert.CallTracker();
|
||||
*
|
||||
* function func() {}
|
||||
*
|
||||
* // Returns a function that wraps func() that must be called exact times
|
||||
* // before tracker.verify().
|
||||
* const callsfunc = tracker.calls(func, 2);
|
||||
*
|
||||
* callsfunc();
|
||||
*
|
||||
* // Will throw an error since callsfunc() was only called once.
|
||||
* tracker.verify();
|
||||
* ```
|
||||
* @since v14.2.0, v12.19.0
|
||||
*/
|
||||
verify(): void;
|
||||
}
|
||||
interface CallTrackerCall {
|
||||
thisArg: object;
|
||||
arguments: unknown[];
|
||||
}
|
||||
interface CallTrackerReportInformation {
|
||||
message: string;
|
||||
/** The actual number of times the function was called. */
|
||||
actual: number;
|
||||
/** The number of times the function was expected to be called. */
|
||||
expected: number;
|
||||
/** The name of the function that is wrapped. */
|
||||
operator: string;
|
||||
/** A stack trace of the function. */
|
||||
stack: object;
|
||||
}
|
||||
type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error;
|
||||
/**
|
||||
* Throws an `AssertionError` with the provided error message or a default
|
||||
* error message. If the `message` parameter is an instance of an `Error` then
|
||||
* it will be thrown instead of the `AssertionError`.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.fail();
|
||||
* // AssertionError [ERR_ASSERTION]: Failed
|
||||
*
|
||||
* assert.fail('boom');
|
||||
* // AssertionError [ERR_ASSERTION]: boom
|
||||
*
|
||||
* assert.fail(new TypeError('need array'));
|
||||
* // TypeError: need array
|
||||
* ```
|
||||
*
|
||||
* Using `assert.fail()` with more than two arguments is possible but deprecated.
|
||||
* See below for further details.
|
||||
* @since v0.1.21
|
||||
* @param [message='Failed']
|
||||
*/
|
||||
function fail(message?: string | Error): never;
|
||||
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
||||
function fail(
|
||||
actual: unknown,
|
||||
expected: unknown,
|
||||
message?: string | Error,
|
||||
operator?: string,
|
||||
// tslint:disable-next-line:ban-types
|
||||
stackStartFn?: Function
|
||||
): never;
|
||||
/**
|
||||
* Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
|
||||
*
|
||||
* If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default
|
||||
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
||||
* If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
|
||||
*
|
||||
* Be aware that in the `repl` the error message will be different to the one
|
||||
* thrown in a file! See below for further details.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.ok(true);
|
||||
* // OK
|
||||
* assert.ok(1);
|
||||
* // OK
|
||||
*
|
||||
* assert.ok();
|
||||
* // AssertionError: No value argument passed to `assert.ok()`
|
||||
*
|
||||
* assert.ok(false, 'it\'s false');
|
||||
* // AssertionError: it's false
|
||||
*
|
||||
* // In the repl:
|
||||
* assert.ok(typeof 123 === 'string');
|
||||
* // AssertionError: false == true
|
||||
*
|
||||
* // In a file (e.g. test.js):
|
||||
* assert.ok(typeof 123 === 'string');
|
||||
* // AssertionError: The expression evaluated to a falsy value:
|
||||
* //
|
||||
* // assert.ok(typeof 123 === 'string')
|
||||
*
|
||||
* assert.ok(false);
|
||||
* // AssertionError: The expression evaluated to a falsy value:
|
||||
* //
|
||||
* // assert.ok(false)
|
||||
*
|
||||
* assert.ok(0);
|
||||
* // AssertionError: The expression evaluated to a falsy value:
|
||||
* //
|
||||
* // assert.ok(0)
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* // Using `assert()` works the same:
|
||||
* assert(0);
|
||||
* // AssertionError: The expression evaluated to a falsy value:
|
||||
* //
|
||||
* // assert(0)
|
||||
* ```
|
||||
* @since v0.1.21
|
||||
*/
|
||||
function ok(value: unknown, message?: string | Error): asserts value;
|
||||
/**
|
||||
* **Strict assertion mode**
|
||||
*
|
||||
* An alias of {@link strictEqual}.
|
||||
*
|
||||
* **Legacy assertion mode**
|
||||
*
|
||||
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
|
||||
*
|
||||
* Tests shallow, coercive equality between the `actual` and `expected` parameters
|
||||
* using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
|
||||
* and treated as being identical if both sides are `NaN`.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert';
|
||||
*
|
||||
* assert.equal(1, 1);
|
||||
* // OK, 1 == 1
|
||||
* assert.equal(1, '1');
|
||||
* // OK, 1 == '1'
|
||||
* assert.equal(NaN, NaN);
|
||||
* // OK
|
||||
*
|
||||
* assert.equal(1, 2);
|
||||
* // AssertionError: 1 == 2
|
||||
* assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
|
||||
* // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
|
||||
* ```
|
||||
*
|
||||
* If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default
|
||||
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
||||
* @since v0.1.21
|
||||
*/
|
||||
function equal(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||
/**
|
||||
* **Strict assertion mode**
|
||||
*
|
||||
* An alias of {@link notStrictEqual}.
|
||||
*
|
||||
* **Legacy assertion mode**
|
||||
*
|
||||
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
|
||||
*
|
||||
* Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
|
||||
* specially handled and treated as being identical if both sides are `NaN`.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert';
|
||||
*
|
||||
* assert.notEqual(1, 2);
|
||||
* // OK
|
||||
*
|
||||
* assert.notEqual(1, 1);
|
||||
* // AssertionError: 1 != 1
|
||||
*
|
||||
* assert.notEqual(1, '1');
|
||||
* // AssertionError: 1 != '1'
|
||||
* ```
|
||||
*
|
||||
* If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error
|
||||
* message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
||||
* @since v0.1.21
|
||||
*/
|
||||
function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||
/**
|
||||
* **Strict assertion mode**
|
||||
*
|
||||
* An alias of {@link deepStrictEqual}.
|
||||
*
|
||||
* **Legacy assertion mode**
|
||||
*
|
||||
* > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead.
|
||||
*
|
||||
* Tests for deep equality between the `actual` and `expected` parameters. Consider
|
||||
* using {@link deepStrictEqual} instead. {@link deepEqual} can have
|
||||
* surprising results.
|
||||
*
|
||||
* _Deep equality_ means that the enumerable "own" properties of child objects
|
||||
* are also recursively evaluated by the following rules.
|
||||
* @since v0.1.21
|
||||
*/
|
||||
function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||
/**
|
||||
* **Strict assertion mode**
|
||||
*
|
||||
* An alias of {@link notDeepStrictEqual}.
|
||||
*
|
||||
* **Legacy assertion mode**
|
||||
*
|
||||
* > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead.
|
||||
*
|
||||
* Tests for any deep inequality. Opposite of {@link deepEqual}.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert';
|
||||
*
|
||||
* const obj1 = {
|
||||
* a: {
|
||||
* b: 1,
|
||||
* },
|
||||
* };
|
||||
* const obj2 = {
|
||||
* a: {
|
||||
* b: 2,
|
||||
* },
|
||||
* };
|
||||
* const obj3 = {
|
||||
* a: {
|
||||
* b: 1,
|
||||
* },
|
||||
* };
|
||||
* const obj4 = { __proto__: obj1 };
|
||||
*
|
||||
* assert.notDeepEqual(obj1, obj1);
|
||||
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
||||
*
|
||||
* assert.notDeepEqual(obj1, obj2);
|
||||
* // OK
|
||||
*
|
||||
* assert.notDeepEqual(obj1, obj3);
|
||||
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
||||
*
|
||||
* assert.notDeepEqual(obj1, obj4);
|
||||
* // OK
|
||||
* ```
|
||||
*
|
||||
* If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default
|
||||
* error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
||||
* instead of the `AssertionError`.
|
||||
* @since v0.1.21
|
||||
*/
|
||||
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||
/**
|
||||
* Tests strict equality between the `actual` and `expected` parameters as
|
||||
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.strictEqual(1, 2);
|
||||
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
||||
* //
|
||||
* // 1 !== 2
|
||||
*
|
||||
* assert.strictEqual(1, 1);
|
||||
* // OK
|
||||
*
|
||||
* assert.strictEqual('Hello foobar', 'Hello World!');
|
||||
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
||||
* // + actual - expected
|
||||
* //
|
||||
* // + 'Hello foobar'
|
||||
* // - 'Hello World!'
|
||||
* // ^
|
||||
*
|
||||
* const apples = 1;
|
||||
* const oranges = 2;
|
||||
* assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
|
||||
* // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2
|
||||
*
|
||||
* assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
|
||||
* // TypeError: Inputs are not identical
|
||||
* ```
|
||||
*
|
||||
* If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
|
||||
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
||||
* instead of the `AssertionError`.
|
||||
* @since v0.1.21
|
||||
*/
|
||||
function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
||||
/**
|
||||
* Tests strict inequality between the `actual` and `expected` parameters as
|
||||
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.notStrictEqual(1, 2);
|
||||
* // OK
|
||||
*
|
||||
* assert.notStrictEqual(1, 1);
|
||||
* // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to:
|
||||
* //
|
||||
* // 1
|
||||
*
|
||||
* assert.notStrictEqual(1, '1');
|
||||
* // OK
|
||||
* ```
|
||||
*
|
||||
* If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
|
||||
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
||||
* instead of the `AssertionError`.
|
||||
* @since v0.1.21
|
||||
*/
|
||||
function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||
/**
|
||||
* Tests for deep equality between the `actual` and `expected` parameters.
|
||||
* "Deep" equality means that the enumerable "own" properties of child objects
|
||||
* are recursively evaluated also by the following rules.
|
||||
* @since v1.2.0
|
||||
*/
|
||||
function deepStrictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
||||
/**
|
||||
* Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
|
||||
* // OK
|
||||
* ```
|
||||
*
|
||||
* If the values are deeply and strictly equal, an `AssertionError` is thrown
|
||||
* with a `message` property set equal to the value of the `message` parameter. If
|
||||
* the `message` parameter is undefined, a default error message is assigned. If
|
||||
* the `message` parameter is an instance of an `Error` then it will be thrown
|
||||
* instead of the `AssertionError`.
|
||||
* @since v1.2.0
|
||||
*/
|
||||
function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||
/**
|
||||
* Expects the function `fn` to throw an error.
|
||||
*
|
||||
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
||||
* a validation object where each property will be tested for strict deep equality,
|
||||
* or an instance of error where each property will be tested for strict deep
|
||||
* equality including the non-enumerable `message` and `name` properties. When
|
||||
* using an object, it is also possible to use a regular expression, when
|
||||
* validating against a string property. See below for examples.
|
||||
*
|
||||
* If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation
|
||||
* fails.
|
||||
*
|
||||
* Custom validation object/error instance:
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* const err = new TypeError('Wrong value');
|
||||
* err.code = 404;
|
||||
* err.foo = 'bar';
|
||||
* err.info = {
|
||||
* nested: true,
|
||||
* baz: 'text',
|
||||
* };
|
||||
* err.reg = /abc/i;
|
||||
*
|
||||
* assert.throws(
|
||||
* () => {
|
||||
* throw err;
|
||||
* },
|
||||
* {
|
||||
* name: 'TypeError',
|
||||
* message: 'Wrong value',
|
||||
* info: {
|
||||
* nested: true,
|
||||
* baz: 'text',
|
||||
* },
|
||||
* // Only properties on the validation object will be tested for.
|
||||
* // Using nested objects requires all properties to be present. Otherwise
|
||||
* // the validation is going to fail.
|
||||
* },
|
||||
* );
|
||||
*
|
||||
* // Using regular expressions to validate error properties:
|
||||
* assert.throws(
|
||||
* () => {
|
||||
* throw err;
|
||||
* },
|
||||
* {
|
||||
* // The `name` and `message` properties are strings and using regular
|
||||
* // expressions on those will match against the string. If they fail, an
|
||||
* // error is thrown.
|
||||
* name: /^TypeError$/,
|
||||
* message: /Wrong/,
|
||||
* foo: 'bar',
|
||||
* info: {
|
||||
* nested: true,
|
||||
* // It is not possible to use regular expressions for nested properties!
|
||||
* baz: 'text',
|
||||
* },
|
||||
* // The `reg` property contains a regular expression and only if the
|
||||
* // validation object contains an identical regular expression, it is going
|
||||
* // to pass.
|
||||
* reg: /abc/i,
|
||||
* },
|
||||
* );
|
||||
*
|
||||
* // Fails due to the different `message` and `name` properties:
|
||||
* assert.throws(
|
||||
* () => {
|
||||
* const otherErr = new Error('Not found');
|
||||
* // Copy all enumerable properties from `err` to `otherErr`.
|
||||
* for (const [key, value] of Object.entries(err)) {
|
||||
* otherErr[key] = value;
|
||||
* }
|
||||
* throw otherErr;
|
||||
* },
|
||||
* // The error's `message` and `name` properties will also be checked when using
|
||||
* // an error as validation object.
|
||||
* err,
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* Validate instanceof using constructor:
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.throws(
|
||||
* () => {
|
||||
* throw new Error('Wrong value');
|
||||
* },
|
||||
* Error,
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions):
|
||||
*
|
||||
* Using a regular expression runs `.toString` on the error object, and will
|
||||
* therefore also include the error name.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.throws(
|
||||
* () => {
|
||||
* throw new Error('Wrong value');
|
||||
* },
|
||||
* /^Error: Wrong value$/,
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* Custom error validation:
|
||||
*
|
||||
* The function must return `true` to indicate all internal validations passed.
|
||||
* It will otherwise fail with an `AssertionError`.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.throws(
|
||||
* () => {
|
||||
* throw new Error('Wrong value');
|
||||
* },
|
||||
* (err) => {
|
||||
* assert(err instanceof Error);
|
||||
* assert(/value/.test(err));
|
||||
* // Avoid returning anything from validation functions besides `true`.
|
||||
* // Otherwise, it's not clear what part of the validation failed. Instead,
|
||||
* // throw an error about the specific validation that failed (as done in this
|
||||
* // example) and add as much helpful debugging information to that error as
|
||||
* // possible.
|
||||
* return true;
|
||||
* },
|
||||
* 'unexpected error',
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* `error` cannot be a string. If a string is provided as the second
|
||||
* argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same
|
||||
* message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
|
||||
* a string as the second argument gets considered:
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* function throwingFirst() {
|
||||
* throw new Error('First');
|
||||
* }
|
||||
*
|
||||
* function throwingSecond() {
|
||||
* throw new Error('Second');
|
||||
* }
|
||||
*
|
||||
* function notThrowing() {}
|
||||
*
|
||||
* // The second argument is a string and the input function threw an Error.
|
||||
* // The first case will not throw as it does not match for the error message
|
||||
* // thrown by the input function!
|
||||
* assert.throws(throwingFirst, 'Second');
|
||||
* // In the next example the message has no benefit over the message from the
|
||||
* // error and since it is not clear if the user intended to actually match
|
||||
* // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.
|
||||
* assert.throws(throwingSecond, 'Second');
|
||||
* // TypeError [ERR_AMBIGUOUS_ARGUMENT]
|
||||
*
|
||||
* // The string is only used (as message) in case the function does not throw:
|
||||
* assert.throws(notThrowing, 'Second');
|
||||
* // AssertionError [ERR_ASSERTION]: Missing expected exception: Second
|
||||
*
|
||||
* // If it was intended to match for the error message do this instead:
|
||||
* // It does not throw because the error messages match.
|
||||
* assert.throws(throwingSecond, /Second$/);
|
||||
*
|
||||
* // If the error message does not match, an AssertionError is thrown.
|
||||
* assert.throws(throwingFirst, /Second$/);
|
||||
* // AssertionError [ERR_ASSERTION]
|
||||
* ```
|
||||
*
|
||||
* Due to the confusing error-prone notation, avoid a string as the second
|
||||
* argument.
|
||||
* @since v0.1.21
|
||||
*/
|
||||
function throws(block: () => unknown, message?: string | Error): void;
|
||||
function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
||||
/**
|
||||
* Asserts that the function `fn` does not throw an error.
|
||||
*
|
||||
* Using `assert.doesNotThrow()` is actually not useful because there
|
||||
* is no benefit in catching an error and then rethrowing it. Instead, consider
|
||||
* adding a comment next to the specific code path that should not throw and keep
|
||||
* error messages as expressive as possible.
|
||||
*
|
||||
* When `assert.doesNotThrow()` is called, it will immediately call the `fn`function.
|
||||
*
|
||||
* If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a
|
||||
* different type, or if the `error` parameter is undefined, the error is
|
||||
* propagated back to the caller.
|
||||
*
|
||||
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
|
||||
* function. See {@link throws} for more details.
|
||||
*
|
||||
* The following, for instance, will throw the `TypeError` because there is no
|
||||
* matching error type in the assertion:
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.doesNotThrow(
|
||||
* () => {
|
||||
* throw new TypeError('Wrong value');
|
||||
* },
|
||||
* SyntaxError,
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* However, the following will result in an `AssertionError` with the message
|
||||
* 'Got unwanted exception...':
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.doesNotThrow(
|
||||
* () => {
|
||||
* throw new TypeError('Wrong value');
|
||||
* },
|
||||
* TypeError,
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.doesNotThrow(
|
||||
* () => {
|
||||
* throw new TypeError('Wrong value');
|
||||
* },
|
||||
* /Wrong value/,
|
||||
* 'Whoops',
|
||||
* );
|
||||
* // Throws: AssertionError: Got unwanted exception: Whoops
|
||||
* ```
|
||||
* @since v0.1.21
|
||||
*/
|
||||
function doesNotThrow(block: () => unknown, message?: string | Error): void;
|
||||
function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
||||
/**
|
||||
* Throws `value` if `value` is not `undefined` or `null`. This is useful when
|
||||
* testing the `error` argument in callbacks. The stack trace contains all frames
|
||||
* from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.ifError(null);
|
||||
* // OK
|
||||
* assert.ifError(0);
|
||||
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0
|
||||
* assert.ifError('error');
|
||||
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'
|
||||
* assert.ifError(new Error());
|
||||
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error
|
||||
*
|
||||
* // Create some random error frames.
|
||||
* let err;
|
||||
* (function errorFrame() {
|
||||
* err = new Error('test error');
|
||||
* })();
|
||||
*
|
||||
* (function ifErrorFrame() {
|
||||
* assert.ifError(err);
|
||||
* })();
|
||||
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
|
||||
* // at ifErrorFrame
|
||||
* // at errorFrame
|
||||
* ```
|
||||
* @since v0.1.97
|
||||
*/
|
||||
function ifError(value: unknown): asserts value is null | undefined;
|
||||
/**
|
||||
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
||||
* calls the function and awaits the returned promise to complete. It will then
|
||||
* check that the promise is rejected.
|
||||
*
|
||||
* If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the
|
||||
* function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error
|
||||
* handler is skipped.
|
||||
*
|
||||
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
||||
*
|
||||
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
||||
* an object where each property will be tested for, or an instance of error where
|
||||
* each property will be tested for including the non-enumerable `message` and`name` properties.
|
||||
*
|
||||
* If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* await assert.rejects(
|
||||
* async () => {
|
||||
* throw new TypeError('Wrong value');
|
||||
* },
|
||||
* {
|
||||
* name: 'TypeError',
|
||||
* message: 'Wrong value',
|
||||
* },
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* await assert.rejects(
|
||||
* async () => {
|
||||
* throw new TypeError('Wrong value');
|
||||
* },
|
||||
* (err) => {
|
||||
* assert.strictEqual(err.name, 'TypeError');
|
||||
* assert.strictEqual(err.message, 'Wrong value');
|
||||
* return true;
|
||||
* },
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.rejects(
|
||||
* Promise.reject(new Error('Wrong value')),
|
||||
* Error,
|
||||
* ).then(() => {
|
||||
* // ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* `error` cannot be a string. If a string is provided as the second
|
||||
* argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the
|
||||
* example in {@link throws} carefully if using a string as the second
|
||||
* argument gets considered.
|
||||
* @since v10.0.0
|
||||
*/
|
||||
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
|
||||
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
|
||||
/**
|
||||
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
||||
* calls the function and awaits the returned promise to complete. It will then
|
||||
* check that the promise is not rejected.
|
||||
*
|
||||
* If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
||||
* the function does not return a promise, `assert.doesNotReject()` will return a
|
||||
* rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases
|
||||
* the error handler is skipped.
|
||||
*
|
||||
* Using `assert.doesNotReject()` is actually not useful because there is little
|
||||
* benefit in catching a rejection and then rejecting it again. Instead, consider
|
||||
* adding a comment next to the specific code path that should not reject and keep
|
||||
* error messages as expressive as possible.
|
||||
*
|
||||
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
|
||||
* function. See {@link throws} for more details.
|
||||
*
|
||||
* Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* await assert.doesNotReject(
|
||||
* async () => {
|
||||
* throw new TypeError('Wrong value');
|
||||
* },
|
||||
* SyntaxError,
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
|
||||
* .then(() => {
|
||||
* // ...
|
||||
* });
|
||||
* ```
|
||||
* @since v10.0.0
|
||||
*/
|
||||
function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
|
||||
function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
|
||||
/**
|
||||
* Expects the `string` input to match the regular expression.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.match('I will fail', /pass/);
|
||||
* // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
|
||||
*
|
||||
* assert.match(123, /pass/);
|
||||
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
||||
*
|
||||
* assert.match('I will pass', /pass/);
|
||||
* // OK
|
||||
* ```
|
||||
*
|
||||
* If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
|
||||
* to the value of the `message` parameter. If the `message` parameter is
|
||||
* undefined, a default error message is assigned. If the `message` parameter is an
|
||||
* instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
||||
* @since v13.6.0, v12.16.0
|
||||
*/
|
||||
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
||||
/**
|
||||
* Expects the `string` input not to match the regular expression.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'node:assert/strict';
|
||||
*
|
||||
* assert.doesNotMatch('I will fail', /fail/);
|
||||
* // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
|
||||
*
|
||||
* assert.doesNotMatch(123, /pass/);
|
||||
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
||||
*
|
||||
* assert.doesNotMatch('I will pass', /different/);
|
||||
* // OK
|
||||
* ```
|
||||
*
|
||||
* If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
|
||||
* to the value of the `message` parameter. If the `message` parameter is
|
||||
* undefined, a default error message is assigned. If the `message` parameter is an
|
||||
* instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
||||
* @since v13.6.0, v12.16.0
|
||||
*/
|
||||
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
||||
const strict: Omit<typeof assert, 'equal' | 'notEqual' | 'deepEqual' | 'notDeepEqual' | 'ok' | 'strictEqual' | 'deepStrictEqual' | 'ifError' | 'strict'> & {
|
||||
(value: unknown, message?: string | Error): asserts value;
|
||||
equal: typeof strictEqual;
|
||||
notEqual: typeof notStrictEqual;
|
||||
deepEqual: typeof deepStrictEqual;
|
||||
notDeepEqual: typeof notDeepStrictEqual;
|
||||
// Mapped types and assertion functions are incompatible?
|
||||
// TS2775: Assertions require every name in the call target
|
||||
// to be declared with an explicit type annotation.
|
||||
ok: typeof ok;
|
||||
strictEqual: typeof strictEqual;
|
||||
deepStrictEqual: typeof deepStrictEqual;
|
||||
ifError: typeof ifError;
|
||||
strict: typeof strict;
|
||||
};
|
||||
}
|
||||
export = assert;
|
||||
}
|
||||
declare module 'node:assert' {
|
||||
import assert = require('assert');
|
||||
export = assert;
|
||||
}
|
8
node_modules/@types/node/assert/strict.d.ts
generated
vendored
8
node_modules/@types/node/assert/strict.d.ts
generated
vendored
@ -1,8 +0,0 @@
|
||||
declare module 'assert/strict' {
|
||||
import { strict } from 'node:assert';
|
||||
export = strict;
|
||||
}
|
||||
declare module 'node:assert/strict' {
|
||||
import { strict } from 'node:assert';
|
||||
export = strict;
|
||||
}
|
530
node_modules/@types/node/async_hooks.d.ts
generated
vendored
530
node_modules/@types/node/async_hooks.d.ts
generated
vendored
@ -1,530 +0,0 @@
|
||||
/**
|
||||
* We strongly discourage the use of the `async_hooks` API.
|
||||
* Other APIs that can cover most of its use cases include:
|
||||
*
|
||||
* * `AsyncLocalStorage` tracks async context
|
||||
* * `process.getActiveResourcesInfo()` tracks active resources
|
||||
*
|
||||
* The `node:async_hooks` module provides an API to track asynchronous resources.
|
||||
* It can be accessed using:
|
||||
*
|
||||
* ```js
|
||||
* import async_hooks from 'node:async_hooks';
|
||||
* ```
|
||||
* @experimental
|
||||
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/async_hooks.js)
|
||||
*/
|
||||
declare module 'async_hooks' {
|
||||
/**
|
||||
* ```js
|
||||
* import { executionAsyncId } from 'node:async_hooks';
|
||||
* import fs from 'node:fs';
|
||||
*
|
||||
* console.log(executionAsyncId()); // 1 - bootstrap
|
||||
* fs.open(path, 'r', (err, fd) => {
|
||||
* console.log(executionAsyncId()); // 6 - open()
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* The ID returned from `executionAsyncId()` is related to execution timing, not
|
||||
* causality (which is covered by `triggerAsyncId()`):
|
||||
*
|
||||
* ```js
|
||||
* const server = net.createServer((conn) => {
|
||||
* // Returns the ID of the server, not of the new connection, because the
|
||||
* // callback runs in the execution scope of the server's MakeCallback().
|
||||
* async_hooks.executionAsyncId();
|
||||
*
|
||||
* }).listen(port, () => {
|
||||
* // Returns the ID of a TickObject (process.nextTick()) because all
|
||||
* // callbacks passed to .listen() are wrapped in a nextTick().
|
||||
* async_hooks.executionAsyncId();
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Promise contexts may not get precise `executionAsyncIds` by default.
|
||||
* See the section on `promise execution tracking`.
|
||||
* @since v8.1.0
|
||||
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
||||
*/
|
||||
function executionAsyncId(): number;
|
||||
/**
|
||||
* Resource objects returned by `executionAsyncResource()` are most often internal
|
||||
* Node.js handle objects with undocumented APIs. Using any functions or properties
|
||||
* on the object is likely to crash your application and should be avoided.
|
||||
*
|
||||
* Using `executionAsyncResource()` in the top-level execution context will
|
||||
* return an empty object as there is no handle or request object to use,
|
||||
* but having an object representing the top-level can be helpful.
|
||||
*
|
||||
* ```js
|
||||
* import { open } from 'node:fs';
|
||||
* import { executionAsyncId, executionAsyncResource } from 'node:async_hooks';
|
||||
*
|
||||
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
|
||||
* open(new URL(import.meta.url), 'r', (err, fd) => {
|
||||
* console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* This can be used to implement continuation local storage without the
|
||||
* use of a tracking `Map` to store the metadata:
|
||||
*
|
||||
* ```js
|
||||
* import { createServer } from 'node:http';
|
||||
* import {
|
||||
* executionAsyncId,
|
||||
* executionAsyncResource,
|
||||
* createHook,
|
||||
* } from 'async_hooks';
|
||||
* const sym = Symbol('state'); // Private symbol to avoid pollution
|
||||
*
|
||||
* createHook({
|
||||
* init(asyncId, type, triggerAsyncId, resource) {
|
||||
* const cr = executionAsyncResource();
|
||||
* if (cr) {
|
||||
* resource[sym] = cr[sym];
|
||||
* }
|
||||
* },
|
||||
* }).enable();
|
||||
*
|
||||
* const server = createServer((req, res) => {
|
||||
* executionAsyncResource()[sym] = { state: req.url };
|
||||
* setTimeout(function() {
|
||||
* res.end(JSON.stringify(executionAsyncResource()[sym]));
|
||||
* }, 100);
|
||||
* }).listen(3000);
|
||||
* ```
|
||||
* @since v13.9.0, v12.17.0
|
||||
* @return The resource representing the current execution. Useful to store data within the resource.
|
||||
*/
|
||||
function executionAsyncResource(): object;
|
||||
/**
|
||||
* ```js
|
||||
* const server = net.createServer((conn) => {
|
||||
* // The resource that caused (or triggered) this callback to be called
|
||||
* // was that of the new connection. Thus the return value of triggerAsyncId()
|
||||
* // is the asyncId of "conn".
|
||||
* async_hooks.triggerAsyncId();
|
||||
*
|
||||
* }).listen(port, () => {
|
||||
* // Even though all callbacks passed to .listen() are wrapped in a nextTick()
|
||||
* // the callback itself exists because the call to the server's .listen()
|
||||
* // was made. So the return value would be the ID of the server.
|
||||
* async_hooks.triggerAsyncId();
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
||||
* the section on `promise execution tracking`.
|
||||
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
||||
*/
|
||||
function triggerAsyncId(): number;
|
||||
interface HookCallbacks {
|
||||
/**
|
||||
* Called when a class is constructed that has the possibility to emit an asynchronous event.
|
||||
* @param asyncId a unique ID for the async resource
|
||||
* @param type the type of the async resource
|
||||
* @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
|
||||
* @param resource reference to the resource representing the async operation, needs to be released during destroy
|
||||
*/
|
||||
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
|
||||
/**
|
||||
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
|
||||
* The before callback is called just before said callback is executed.
|
||||
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
|
||||
*/
|
||||
before?(asyncId: number): void;
|
||||
/**
|
||||
* Called immediately after the callback specified in before is completed.
|
||||
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
|
||||
*/
|
||||
after?(asyncId: number): void;
|
||||
/**
|
||||
* Called when a promise has resolve() called. This may not be in the same execution id
|
||||
* as the promise itself.
|
||||
* @param asyncId the unique id for the promise that was resolve()d.
|
||||
*/
|
||||
promiseResolve?(asyncId: number): void;
|
||||
/**
|
||||
* Called after the resource corresponding to asyncId is destroyed
|
||||
* @param asyncId a unique ID for the async resource
|
||||
*/
|
||||
destroy?(asyncId: number): void;
|
||||
}
|
||||
interface AsyncHook {
|
||||
/**
|
||||
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
|
||||
*/
|
||||
enable(): this;
|
||||
/**
|
||||
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
|
||||
*/
|
||||
disable(): this;
|
||||
}
|
||||
/**
|
||||
* Registers functions to be called for different lifetime events of each async
|
||||
* operation.
|
||||
*
|
||||
* The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the
|
||||
* respective asynchronous event during a resource's lifetime.
|
||||
*
|
||||
* All callbacks are optional. For example, if only resource cleanup needs to
|
||||
* be tracked, then only the `destroy` callback needs to be passed. The
|
||||
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
|
||||
*
|
||||
* ```js
|
||||
* import { createHook } from 'node:async_hooks';
|
||||
*
|
||||
* const asyncHook = createHook({
|
||||
* init(asyncId, type, triggerAsyncId, resource) { },
|
||||
* destroy(asyncId) { },
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* The callbacks will be inherited via the prototype chain:
|
||||
*
|
||||
* ```js
|
||||
* class MyAsyncCallbacks {
|
||||
* init(asyncId, type, triggerAsyncId, resource) { }
|
||||
* destroy(asyncId) {}
|
||||
* }
|
||||
*
|
||||
* class MyAddedCallbacks extends MyAsyncCallbacks {
|
||||
* before(asyncId) { }
|
||||
* after(asyncId) { }
|
||||
* }
|
||||
*
|
||||
* const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
|
||||
* ```
|
||||
*
|
||||
* Because promises are asynchronous resources whose lifecycle is tracked
|
||||
* via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
|
||||
* @since v8.1.0
|
||||
* @param callbacks The `Hook Callbacks` to register
|
||||
* @return Instance used for disabling and enabling hooks
|
||||
*/
|
||||
function createHook(callbacks: HookCallbacks): AsyncHook;
|
||||
interface AsyncResourceOptions {
|
||||
/**
|
||||
* The ID of the execution context that created this async event.
|
||||
* @default executionAsyncId()
|
||||
*/
|
||||
triggerAsyncId?: number | undefined;
|
||||
/**
|
||||
* Disables automatic `emitDestroy` when the object is garbage collected.
|
||||
* This usually does not need to be set (even if `emitDestroy` is called
|
||||
* manually), unless the resource's `asyncId` is retrieved and the
|
||||
* sensitive API's `emitDestroy` is called with it.
|
||||
* @default false
|
||||
*/
|
||||
requireManualDestroy?: boolean | undefined;
|
||||
}
|
||||
/**
|
||||
* The class `AsyncResource` is designed to be extended by the embedder's async
|
||||
* resources. Using this, users can easily trigger the lifetime events of their
|
||||
* own resources.
|
||||
*
|
||||
* The `init` hook will trigger when an `AsyncResource` is instantiated.
|
||||
*
|
||||
* The following is an overview of the `AsyncResource` API.
|
||||
*
|
||||
* ```js
|
||||
* import { AsyncResource, executionAsyncId } from 'node:async_hooks';
|
||||
*
|
||||
* // AsyncResource() is meant to be extended. Instantiating a
|
||||
* // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
||||
* // async_hook.executionAsyncId() is used.
|
||||
* const asyncResource = new AsyncResource(
|
||||
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false },
|
||||
* );
|
||||
*
|
||||
* // Run a function in the execution context of the resource. This will
|
||||
* // * establish the context of the resource
|
||||
* // * trigger the AsyncHooks before callbacks
|
||||
* // * call the provided function `fn` with the supplied arguments
|
||||
* // * trigger the AsyncHooks after callbacks
|
||||
* // * restore the original execution context
|
||||
* asyncResource.runInAsyncScope(fn, thisArg, ...args);
|
||||
*
|
||||
* // Call AsyncHooks destroy callbacks.
|
||||
* asyncResource.emitDestroy();
|
||||
*
|
||||
* // Return the unique ID assigned to the AsyncResource instance.
|
||||
* asyncResource.asyncId();
|
||||
*
|
||||
* // Return the trigger ID for the AsyncResource instance.
|
||||
* asyncResource.triggerAsyncId();
|
||||
* ```
|
||||
*/
|
||||
class AsyncResource {
|
||||
/**
|
||||
* AsyncResource() is meant to be extended. Instantiating a
|
||||
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
||||
* async_hook.executionAsyncId() is used.
|
||||
* @param type The type of async event.
|
||||
* @param triggerAsyncId The ID of the execution context that created
|
||||
* this async event (default: `executionAsyncId()`), or an
|
||||
* AsyncResourceOptions object (since v9.3.0)
|
||||
*/
|
||||
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
|
||||
/**
|
||||
* Binds the given function to the current execution context.
|
||||
* @since v14.8.0, v12.19.0
|
||||
* @param fn The function to bind to the current execution context.
|
||||
* @param type An optional name to associate with the underlying `AsyncResource`.
|
||||
*/
|
||||
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(fn: Func, type?: string, thisArg?: ThisArg): Func;
|
||||
/**
|
||||
* Binds the given function to execute to this `AsyncResource`'s scope.
|
||||
* @since v14.8.0, v12.19.0
|
||||
* @param fn The function to bind to the current `AsyncResource`.
|
||||
*/
|
||||
bind<Func extends (...args: any[]) => any>(fn: Func): Func;
|
||||
/**
|
||||
* Call the provided function with the provided arguments in the execution context
|
||||
* of the async resource. This will establish the context, trigger the AsyncHooks
|
||||
* before callbacks, call the function, trigger the AsyncHooks after callbacks, and
|
||||
* then restore the original execution context.
|
||||
* @since v9.6.0
|
||||
* @param fn The function to call in the execution context of this async resource.
|
||||
* @param thisArg The receiver to be used for the function call.
|
||||
* @param args Optional arguments to pass to the function.
|
||||
*/
|
||||
runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
|
||||
/**
|
||||
* Call all `destroy` hooks. This should only ever be called once. An error will
|
||||
* be thrown if it is called more than once. This **must** be manually called. If
|
||||
* the resource is left to be collected by the GC then the `destroy` hooks will
|
||||
* never be called.
|
||||
* @return A reference to `asyncResource`.
|
||||
*/
|
||||
emitDestroy(): this;
|
||||
/**
|
||||
* @return The unique `asyncId` assigned to the resource.
|
||||
*/
|
||||
asyncId(): number;
|
||||
/**
|
||||
*
|
||||
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
|
||||
*/
|
||||
triggerAsyncId(): number;
|
||||
}
|
||||
/**
|
||||
* This class creates stores that stay coherent through asynchronous operations.
|
||||
*
|
||||
* While you can create your own implementation on top of the `node:async_hooks`module, `AsyncLocalStorage` should be preferred as it is a performant and memory
|
||||
* safe implementation that involves significant optimizations that are non-obvious
|
||||
* to implement.
|
||||
*
|
||||
* The following example uses `AsyncLocalStorage` to build a simple logger
|
||||
* that assigns IDs to incoming HTTP requests and includes them in messages
|
||||
* logged within each request.
|
||||
*
|
||||
* ```js
|
||||
* import http from 'node:http';
|
||||
* import { AsyncLocalStorage } from 'node:async_hooks';
|
||||
*
|
||||
* const asyncLocalStorage = new AsyncLocalStorage();
|
||||
*
|
||||
* function logWithId(msg) {
|
||||
* const id = asyncLocalStorage.getStore();
|
||||
* console.log(`${id !== undefined ? id : '-'}:`, msg);
|
||||
* }
|
||||
*
|
||||
* let idSeq = 0;
|
||||
* http.createServer((req, res) => {
|
||||
* asyncLocalStorage.run(idSeq++, () => {
|
||||
* logWithId('start');
|
||||
* // Imagine any chain of async operations here
|
||||
* setImmediate(() => {
|
||||
* logWithId('finish');
|
||||
* res.end();
|
||||
* });
|
||||
* });
|
||||
* }).listen(8080);
|
||||
*
|
||||
* http.get('http://localhost:8080');
|
||||
* http.get('http://localhost:8080');
|
||||
* // Prints:
|
||||
* // 0: start
|
||||
* // 1: start
|
||||
* // 0: finish
|
||||
* // 1: finish
|
||||
* ```
|
||||
*
|
||||
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
|
||||
* Multiple instances can safely exist simultaneously without risk of interfering
|
||||
* with each other's data.
|
||||
* @since v13.10.0, v12.17.0
|
||||
*/
|
||||
class AsyncLocalStorage<T> {
|
||||
/**
|
||||
* Binds the given function to the current execution context.
|
||||
* @since v19.8.0
|
||||
* @experimental
|
||||
* @param fn The function to bind to the current execution context.
|
||||
* @return A new function that calls `fn` within the captured execution context.
|
||||
*/
|
||||
static bind<Func extends (...args: any[]) => any>(fn: Func): Func;
|
||||
/**
|
||||
* Captures the current execution context and returns a function that accepts a
|
||||
* function as an argument. Whenever the returned function is called, it
|
||||
* calls the function passed to it within the captured context.
|
||||
*
|
||||
* ```js
|
||||
* const asyncLocalStorage = new AsyncLocalStorage();
|
||||
* const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot());
|
||||
* const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore()));
|
||||
* console.log(result); // returns 123
|
||||
* ```
|
||||
*
|
||||
* AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple
|
||||
* async context tracking purposes, for example:
|
||||
*
|
||||
* ```js
|
||||
* class Foo {
|
||||
* #runInAsyncScope = AsyncLocalStorage.snapshot();
|
||||
*
|
||||
* get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); }
|
||||
* }
|
||||
*
|
||||
* const foo = asyncLocalStorage.run(123, () => new Foo());
|
||||
* console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
|
||||
* ```
|
||||
* @since v19.8.0
|
||||
* @experimental
|
||||
* @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
|
||||
*/
|
||||
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
|
||||
/**
|
||||
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
|
||||
* to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
|
||||
*
|
||||
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
||||
* instance will be exited.
|
||||
*
|
||||
* Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores
|
||||
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
||||
* along with the corresponding async resources.
|
||||
*
|
||||
* Use this method when the `asyncLocalStorage` is not in use anymore
|
||||
* in the current process.
|
||||
* @since v13.10.0, v12.17.0
|
||||
* @experimental
|
||||
*/
|
||||
disable(): void;
|
||||
/**
|
||||
* Returns the current store.
|
||||
* If called outside of an asynchronous context initialized by
|
||||
* calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
|
||||
* returns `undefined`.
|
||||
* @since v13.10.0, v12.17.0
|
||||
*/
|
||||
getStore(): T | undefined;
|
||||
/**
|
||||
* Runs a function synchronously within a context and returns its
|
||||
* return value. The store is not accessible outside of the callback function.
|
||||
* The store is accessible to any asynchronous operations created within the
|
||||
* callback.
|
||||
*
|
||||
* The optional `args` are passed to the callback function.
|
||||
*
|
||||
* If the callback function throws an error, the error is thrown by `run()` too.
|
||||
* The stacktrace is not impacted by this call and the context is exited.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* const store = { id: 2 };
|
||||
* try {
|
||||
* asyncLocalStorage.run(store, () => {
|
||||
* asyncLocalStorage.getStore(); // Returns the store object
|
||||
* setTimeout(() => {
|
||||
* asyncLocalStorage.getStore(); // Returns the store object
|
||||
* }, 200);
|
||||
* throw new Error();
|
||||
* });
|
||||
* } catch (e) {
|
||||
* asyncLocalStorage.getStore(); // Returns undefined
|
||||
* // The error will be caught here
|
||||
* }
|
||||
* ```
|
||||
* @since v13.10.0, v12.17.0
|
||||
*/
|
||||
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
|
||||
/**
|
||||
* Runs a function synchronously outside of a context and returns its
|
||||
* return value. The store is not accessible within the callback function or
|
||||
* the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`.
|
||||
*
|
||||
* The optional `args` are passed to the callback function.
|
||||
*
|
||||
* If the callback function throws an error, the error is thrown by `exit()` too.
|
||||
* The stacktrace is not impacted by this call and the context is re-entered.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* // Within a call to run
|
||||
* try {
|
||||
* asyncLocalStorage.getStore(); // Returns the store object or value
|
||||
* asyncLocalStorage.exit(() => {
|
||||
* asyncLocalStorage.getStore(); // Returns undefined
|
||||
* throw new Error();
|
||||
* });
|
||||
* } catch (e) {
|
||||
* asyncLocalStorage.getStore(); // Returns the same object or value
|
||||
* // The error will be caught here
|
||||
* }
|
||||
* ```
|
||||
* @since v13.10.0, v12.17.0
|
||||
* @experimental
|
||||
*/
|
||||
exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
|
||||
/**
|
||||
* Transitions into the context for the remainder of the current
|
||||
* synchronous execution and then persists the store through any following
|
||||
* asynchronous calls.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* const store = { id: 1 };
|
||||
* // Replaces previous store with the given store object
|
||||
* asyncLocalStorage.enterWith(store);
|
||||
* asyncLocalStorage.getStore(); // Returns the store object
|
||||
* someAsyncOperation(() => {
|
||||
* asyncLocalStorage.getStore(); // Returns the same object
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* This transition will continue for the _entire_ synchronous execution.
|
||||
* This means that if, for example, the context is entered within an event
|
||||
* handler subsequent event handlers will also run within that context unless
|
||||
* specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons
|
||||
* to use the latter method.
|
||||
*
|
||||
* ```js
|
||||
* const store = { id: 1 };
|
||||
*
|
||||
* emitter.on('my-event', () => {
|
||||
* asyncLocalStorage.enterWith(store);
|
||||
* });
|
||||
* emitter.on('my-event', () => {
|
||||
* asyncLocalStorage.getStore(); // Returns the same object
|
||||
* });
|
||||
*
|
||||
* asyncLocalStorage.getStore(); // Returns undefined
|
||||
* emitter.emit('my-event');
|
||||
* asyncLocalStorage.getStore(); // Returns the same object
|
||||
* ```
|
||||
* @since v13.11.0, v12.17.0
|
||||
* @experimental
|
||||
*/
|
||||
enterWith(store: T): void;
|
||||
}
|
||||
}
|
||||
declare module 'node:async_hooks' {
|
||||
export * from 'async_hooks';
|
||||
}
|
2354
node_modules/@types/node/buffer.d.ts
generated
vendored
2354
node_modules/@types/node/buffer.d.ts
generated
vendored
File diff suppressed because it is too large
Load Diff
1395
node_modules/@types/node/child_process.d.ts
generated
vendored
1395
node_modules/@types/node/child_process.d.ts
generated
vendored
File diff suppressed because it is too large
Load Diff
414
node_modules/@types/node/cluster.d.ts
generated
vendored
414
node_modules/@types/node/cluster.d.ts
generated
vendored
@ -1,414 +0,0 @@
|
||||
/**
|
||||
* Clusters of Node.js processes can be used to run multiple instances of Node.js
|
||||
* that can distribute workloads among their application threads. When process
|
||||
* isolation is not needed, use the `worker_threads` module instead, which
|
||||
* allows running multiple application threads within a single Node.js instance.
|
||||
*
|
||||
* The cluster module allows easy creation of child processes that all share
|
||||
* server ports.
|
||||
*
|
||||
* ```js
|
||||
* import cluster from 'node:cluster';
|
||||
* import http from 'node:http';
|
||||
* import { availableParallelism } from 'node:os';
|
||||
* import process from 'node:process';
|
||||
*
|
||||
* const numCPUs = availableParallelism();
|
||||
*
|
||||
* if (cluster.isPrimary) {
|
||||
* console.log(`Primary ${process.pid} is running`);
|
||||
*
|
||||
* // Fork workers.
|
||||
* for (let i = 0; i < numCPUs; i++) {
|
||||
* cluster.fork();
|
||||
* }
|
||||
*
|
||||
* cluster.on('exit', (worker, code, signal) => {
|
||||
* console.log(`worker ${worker.process.pid} died`);
|
||||
* });
|
||||
* } else {
|
||||
* // Workers can share any TCP connection
|
||||
* // In this case it is an HTTP server
|
||||
* http.createServer((req, res) => {
|
||||
* res.writeHead(200);
|
||||
* res.end('hello world\n');
|
||||
* }).listen(8000);
|
||||
*
|
||||
* console.log(`Worker ${process.pid} started`);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Running Node.js will now share port 8000 between the workers:
|
||||
*
|
||||
* ```console
|
||||
* $ node server.js
|
||||
* Primary 3596 is running
|
||||
* Worker 4324 started
|
||||
* Worker 4520 started
|
||||
* Worker 6056 started
|
||||
* Worker 5644 started
|
||||
* ```
|
||||
*
|
||||
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
||||
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/cluster.js)
|
||||
*/
|
||||
declare module 'cluster' {
|
||||
import * as child from 'node:child_process';
|
||||
import EventEmitter = require('node:events');
|
||||
import * as net from 'node:net';
|
||||
type SerializationType = 'json' | 'advanced';
|
||||
export interface ClusterSettings {
|
||||
execArgv?: string[] | undefined; // default: process.execArgv
|
||||
exec?: string | undefined;
|
||||
args?: string[] | undefined;
|
||||
silent?: boolean | undefined;
|
||||
stdio?: any[] | undefined;
|
||||
uid?: number | undefined;
|
||||
gid?: number | undefined;
|
||||
inspectPort?: number | (() => number) | undefined;
|
||||
serialization?: SerializationType | undefined;
|
||||
cwd?: string | undefined;
|
||||
windowsHide?: boolean | undefined;
|
||||
}
|
||||
export interface Address {
|
||||
address: string;
|
||||
port: number;
|
||||
addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6"
|
||||
}
|
||||
/**
|
||||
* A `Worker` object contains all public information and method about a worker.
|
||||
* In the primary it can be obtained using `cluster.workers`. In a worker
|
||||
* it can be obtained using `cluster.worker`.
|
||||
* @since v0.7.0
|
||||
*/
|
||||
export class Worker extends EventEmitter {
|
||||
/**
|
||||
* Each new worker is given its own unique id, this id is stored in the`id`.
|
||||
*
|
||||
* While a worker is alive, this is the key that indexes it in`cluster.workers`.
|
||||
* @since v0.8.0
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
* All workers are created using `child_process.fork()`, the returned object
|
||||
* from this function is stored as `.process`. In a worker, the global `process`is stored.
|
||||
*
|
||||
* See: `Child Process module`.
|
||||
*
|
||||
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
|
||||
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
|
||||
* accidental disconnection.
|
||||
* @since v0.7.0
|
||||
*/
|
||||
process: child.ChildProcess;
|
||||
/**
|
||||
* Send a message to a worker or primary, optionally with a handle.
|
||||
*
|
||||
* In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
|
||||
*
|
||||
* In a worker, this sends a message to the primary. It is identical to`process.send()`.
|
||||
*
|
||||
* This example will echo back all messages from the primary:
|
||||
*
|
||||
* ```js
|
||||
* if (cluster.isPrimary) {
|
||||
* const worker = cluster.fork();
|
||||
* worker.send('hi there');
|
||||
*
|
||||
* } else if (cluster.isWorker) {
|
||||
* process.on('message', (msg) => {
|
||||
* process.send(msg);
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
* @since v0.7.0
|
||||
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
|
||||
*/
|
||||
send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
|
||||
send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
|
||||
send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
|
||||
/**
|
||||
* This function will kill the worker. In the primary worker, it does this by
|
||||
* disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`.
|
||||
*
|
||||
* The `kill()` function kills the worker process without waiting for a graceful
|
||||
* disconnect, it has the same behavior as `worker.process.kill()`.
|
||||
*
|
||||
* This method is aliased as `worker.destroy()` for backwards compatibility.
|
||||
*
|
||||
* In a worker, `process.kill()` exists, but it is not this function;
|
||||
* it is `kill()`.
|
||||
* @since v0.9.12
|
||||
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
|
||||
*/
|
||||
kill(signal?: string): void;
|
||||
destroy(signal?: string): void;
|
||||
/**
|
||||
* In a worker, this function will close all servers, wait for the `'close'` event
|
||||
* on those servers, and then disconnect the IPC channel.
|
||||
*
|
||||
* In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself.
|
||||
*
|
||||
* Causes `.exitedAfterDisconnect` to be set.
|
||||
*
|
||||
* After a server is closed, it will no longer accept new connections,
|
||||
* but connections may be accepted by any other listening worker. Existing
|
||||
* connections will be allowed to close as usual. When no more connections exist,
|
||||
* see `server.close()`, the IPC channel to the worker will close allowing it
|
||||
* to die gracefully.
|
||||
*
|
||||
* The above applies _only_ to server connections, client connections are not
|
||||
* automatically closed by workers, and disconnect does not wait for them to close
|
||||
* before exiting.
|
||||
*
|
||||
* In a worker, `process.disconnect` exists, but it is not this function;
|
||||
* it is `disconnect()`.
|
||||
*
|
||||
* Because long living server connections may block workers from disconnecting, it
|
||||
* may be useful to send a message, so application specific actions may be taken to
|
||||
* close them. It also may be useful to implement a timeout, killing a worker if
|
||||
* the `'disconnect'` event has not been emitted after some time.
|
||||
*
|
||||
* ```js
|
||||
* if (cluster.isPrimary) {
|
||||
* const worker = cluster.fork();
|
||||
* let timeout;
|
||||
*
|
||||
* worker.on('listening', (address) => {
|
||||
* worker.send('shutdown');
|
||||
* worker.disconnect();
|
||||
* timeout = setTimeout(() => {
|
||||
* worker.kill();
|
||||
* }, 2000);
|
||||
* });
|
||||
*
|
||||
* worker.on('disconnect', () => {
|
||||
* clearTimeout(timeout);
|
||||
* });
|
||||
*
|
||||
* } else if (cluster.isWorker) {
|
||||
* const net = require('node:net');
|
||||
* const server = net.createServer((socket) => {
|
||||
* // Connections never end
|
||||
* });
|
||||
*
|
||||
* server.listen(8000);
|
||||
*
|
||||
* process.on('message', (msg) => {
|
||||
* if (msg === 'shutdown') {
|
||||
* // Initiate graceful close of any connections to server
|
||||
* }
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
* @since v0.7.7
|
||||
* @return A reference to `worker`.
|
||||
*/
|
||||
disconnect(): void;
|
||||
/**
|
||||
* This function returns `true` if the worker is connected to its primary via its
|
||||
* IPC channel, `false` otherwise. A worker is connected to its primary after it
|
||||
* has been created. It is disconnected after the `'disconnect'` event is emitted.
|
||||
* @since v0.11.14
|
||||
*/
|
||||
isConnected(): boolean;
|
||||
/**
|
||||
* This function returns `true` if the worker's process has terminated (either
|
||||
* because of exiting or being signaled). Otherwise, it returns `false`.
|
||||
*
|
||||
* ```js
|
||||
* import cluster from 'node:cluster';
|
||||
* import http from 'node:http';
|
||||
* import { availableParallelism } from 'node:os';
|
||||
* import process from 'node:process';
|
||||
*
|
||||
* const numCPUs = availableParallelism();
|
||||
*
|
||||
* if (cluster.isPrimary) {
|
||||
* console.log(`Primary ${process.pid} is running`);
|
||||
*
|
||||
* // Fork workers.
|
||||
* for (let i = 0; i < numCPUs; i++) {
|
||||
* cluster.fork();
|
||||
* }
|
||||
*
|
||||
* cluster.on('fork', (worker) => {
|
||||
* console.log('worker is dead:', worker.isDead());
|
||||
* });
|
||||
*
|
||||
* cluster.on('exit', (worker, code, signal) => {
|
||||
* console.log('worker is dead:', worker.isDead());
|
||||
* });
|
||||
* } else {
|
||||
* // Workers can share any TCP connection. In this case, it is an HTTP server.
|
||||
* http.createServer((req, res) => {
|
||||
* res.writeHead(200);
|
||||
* res.end(`Current process\n ${process.pid}`);
|
||||
* process.kill(process.pid);
|
||||
* }).listen(8000);
|
||||
* }
|
||||
* ```
|
||||
* @since v0.11.14
|
||||
*/
|
||||
isDead(): boolean;
|
||||
/**
|
||||
* This property is `true` if the worker exited due to `.disconnect()`.
|
||||
* If the worker exited any other way, it is `false`. If the
|
||||
* worker has not exited, it is `undefined`.
|
||||
*
|
||||
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
|
||||
* voluntary and accidental exit, the primary may choose not to respawn a worker
|
||||
* based on this value.
|
||||
*
|
||||
* ```js
|
||||
* cluster.on('exit', (worker, code, signal) => {
|
||||
* if (worker.exitedAfterDisconnect === true) {
|
||||
* console.log('Oh, it was just voluntary – no need to worry');
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* // kill worker
|
||||
* worker.kill();
|
||||
* ```
|
||||
* @since v6.0.0
|
||||
*/
|
||||
exitedAfterDisconnect: boolean;
|
||||
/**
|
||||
* events.EventEmitter
|
||||
* 1. disconnect
|
||||
* 2. error
|
||||
* 3. exit
|
||||
* 4. listening
|
||||
* 5. message
|
||||
* 6. online
|
||||
*/
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: 'disconnect', listener: () => void): this;
|
||||
addListener(event: 'error', listener: (error: Error) => void): this;
|
||||
addListener(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||
addListener(event: 'listening', listener: (address: Address) => void): this;
|
||||
addListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
addListener(event: 'online', listener: () => void): this;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: 'disconnect'): boolean;
|
||||
emit(event: 'error', error: Error): boolean;
|
||||
emit(event: 'exit', code: number, signal: string): boolean;
|
||||
emit(event: 'listening', address: Address): boolean;
|
||||
emit(event: 'message', message: any, handle: net.Socket | net.Server): boolean;
|
||||
emit(event: 'online'): boolean;
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: 'disconnect', listener: () => void): this;
|
||||
on(event: 'error', listener: (error: Error) => void): this;
|
||||
on(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||
on(event: 'listening', listener: (address: Address) => void): this;
|
||||
on(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
on(event: 'online', listener: () => void): this;
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: 'disconnect', listener: () => void): this;
|
||||
once(event: 'error', listener: (error: Error) => void): this;
|
||||
once(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||
once(event: 'listening', listener: (address: Address) => void): this;
|
||||
once(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
once(event: 'online', listener: () => void): this;
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: 'disconnect', listener: () => void): this;
|
||||
prependListener(event: 'error', listener: (error: Error) => void): this;
|
||||
prependListener(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||
prependListener(event: 'listening', listener: (address: Address) => void): this;
|
||||
prependListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependListener(event: 'online', listener: () => void): this;
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: 'disconnect', listener: () => void): this;
|
||||
prependOnceListener(event: 'error', listener: (error: Error) => void): this;
|
||||
prependOnceListener(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||
prependOnceListener(event: 'listening', listener: (address: Address) => void): this;
|
||||
prependOnceListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependOnceListener(event: 'online', listener: () => void): this;
|
||||
}
|
||||
export interface Cluster extends EventEmitter {
|
||||
disconnect(callback?: () => void): void;
|
||||
fork(env?: any): Worker;
|
||||
/** @deprecated since v16.0.0 - use isPrimary. */
|
||||
readonly isMaster: boolean;
|
||||
readonly isPrimary: boolean;
|
||||
readonly isWorker: boolean;
|
||||
schedulingPolicy: number;
|
||||
readonly settings: ClusterSettings;
|
||||
/** @deprecated since v16.0.0 - use setupPrimary. */
|
||||
setupMaster(settings?: ClusterSettings): void;
|
||||
/**
|
||||
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings.
|
||||
*/
|
||||
setupPrimary(settings?: ClusterSettings): void;
|
||||
readonly worker?: Worker | undefined;
|
||||
readonly workers?: NodeJS.Dict<Worker> | undefined;
|
||||
readonly SCHED_NONE: number;
|
||||
readonly SCHED_RR: number;
|
||||
/**
|
||||
* events.EventEmitter
|
||||
* 1. disconnect
|
||||
* 2. exit
|
||||
* 3. fork
|
||||
* 4. listening
|
||||
* 5. message
|
||||
* 6. online
|
||||
* 7. setup
|
||||
*/
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||
addListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
addListener(event: 'fork', listener: (worker: Worker) => void): this;
|
||||
addListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||
addListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
addListener(event: 'online', listener: (worker: Worker) => void): this;
|
||||
addListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: 'disconnect', worker: Worker): boolean;
|
||||
emit(event: 'exit', worker: Worker, code: number, signal: string): boolean;
|
||||
emit(event: 'fork', worker: Worker): boolean;
|
||||
emit(event: 'listening', worker: Worker, address: Address): boolean;
|
||||
emit(event: 'message', worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
|
||||
emit(event: 'online', worker: Worker): boolean;
|
||||
emit(event: 'setup', settings: ClusterSettings): boolean;
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||
on(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
on(event: 'fork', listener: (worker: Worker) => void): this;
|
||||
on(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||
on(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
on(event: 'online', listener: (worker: Worker) => void): this;
|
||||
on(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||
once(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
once(event: 'fork', listener: (worker: Worker) => void): this;
|
||||
once(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||
once(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||
once(event: 'online', listener: (worker: Worker) => void): this;
|
||||
once(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||
prependListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
prependListener(event: 'fork', listener: (worker: Worker) => void): this;
|
||||
prependListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependListener(event: 'message', listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void): this;
|
||||
prependListener(event: 'online', listener: (worker: Worker) => void): this;
|
||||
prependListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||
prependOnceListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||
prependOnceListener(event: 'fork', listener: (worker: Worker) => void): this;
|
||||
prependOnceListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||
// the handle is a net.Socket or net.Server object, or undefined.
|
||||
prependOnceListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this;
|
||||
prependOnceListener(event: 'online', listener: (worker: Worker) => void): this;
|
||||
prependOnceListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||
}
|
||||
const cluster: Cluster;
|
||||
export default cluster;
|
||||
}
|
||||
declare module 'node:cluster' {
|
||||
export * from 'cluster';
|
||||
export { default as default } from 'cluster';
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user