feat: 초기 프로젝트 설정 및 룰.md 파일 추가
This commit is contained in:
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# Dependencies
|
||||
**/node_modules/
|
||||
|
||||
# Databases
|
||||
*.db
|
||||
*.sqlite3
|
||||
|
||||
# Uploads & Logs
|
||||
**/uploads/
|
||||
**/logs/
|
||||
*.log
|
||||
|
||||
# Environment variables
|
||||
.env
|
||||
.env.*
|
||||
|
||||
# OS generated files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# IDEs
|
||||
.idea/
|
||||
.vscode/
|
||||
4392
api.hyungi.net/node_modules/.package-lock.json
generated
vendored
4392
api.hyungi.net/node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
10
api.hyungi.net/node_modules/@gar/promisify/LICENSE.md
generated
vendored
10
api.hyungi.net/node_modules/@gar/promisify/LICENSE.md
generated
vendored
@@ -1,10 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright © 2020-2022 Michael Garvin
|
||||
|
||||
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.
|
||||
|
||||
65
api.hyungi.net/node_modules/@gar/promisify/README.md
generated
vendored
65
api.hyungi.net/node_modules/@gar/promisify/README.md
generated
vendored
@@ -1,65 +0,0 @@
|
||||
# @gar/promisify
|
||||
|
||||
### Promisify an entire object or class instance
|
||||
|
||||
This module leverages es6 Proxy and Reflect to promisify every function in an
|
||||
object or class instance.
|
||||
|
||||
It assumes the callback that the function is expecting is the last
|
||||
parameter, and that it is an error-first callback with only one value,
|
||||
i.e. `(err, value) => ...`. This mirrors node's `util.promisify` method.
|
||||
|
||||
In order that you can use it as a one-stop-shop for all your promisify
|
||||
needs, you can also pass it a function. That function will be
|
||||
promisified as normal using node's built-in `util.promisify` method.
|
||||
|
||||
[node's custom promisified
|
||||
functions](https://nodejs.org/api/util.html#util_custom_promisified_functions)
|
||||
will also be mirrored, further allowing this to be a drop-in replacement
|
||||
for the built-in `util.promisify`.
|
||||
|
||||
### Examples
|
||||
|
||||
Promisify an entire object
|
||||
|
||||
```javascript
|
||||
|
||||
const promisify = require('@gar/promisify')
|
||||
|
||||
class Foo {
|
||||
constructor (attr) {
|
||||
this.attr = attr
|
||||
}
|
||||
|
||||
double (input, cb) {
|
||||
cb(null, input * 2)
|
||||
}
|
||||
|
||||
const foo = new Foo('baz')
|
||||
const promisified = promisify(foo)
|
||||
|
||||
console.log(promisified.attr)
|
||||
console.log(await promisified.double(1024))
|
||||
```
|
||||
|
||||
Promisify a function
|
||||
|
||||
```javascript
|
||||
|
||||
const promisify = require('@gar/promisify')
|
||||
|
||||
function foo (a, cb) {
|
||||
if (a !== 'bad') {
|
||||
return cb(null, 'ok')
|
||||
}
|
||||
return cb('not ok')
|
||||
}
|
||||
|
||||
const promisified = promisify(foo)
|
||||
|
||||
// This will resolve to 'ok'
|
||||
promisified('good')
|
||||
|
||||
// this will reject
|
||||
promisified('bad')
|
||||
```
|
||||
36
api.hyungi.net/node_modules/@gar/promisify/index.js
generated
vendored
36
api.hyungi.net/node_modules/@gar/promisify/index.js
generated
vendored
@@ -1,36 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
const { promisify } = require('util')
|
||||
|
||||
const handler = {
|
||||
get: function (target, prop, receiver) {
|
||||
if (typeof target[prop] !== 'function') {
|
||||
return target[prop]
|
||||
}
|
||||
if (target[prop][promisify.custom]) {
|
||||
return function () {
|
||||
return Reflect.get(target, prop, receiver)[promisify.custom].apply(target, arguments)
|
||||
}
|
||||
}
|
||||
return function () {
|
||||
return new Promise((resolve, reject) => {
|
||||
Reflect.get(target, prop, receiver).apply(target, [...arguments, function (err, result) {
|
||||
if (err) {
|
||||
return reject(err)
|
||||
}
|
||||
resolve(result)
|
||||
}])
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function (thingToPromisify) {
|
||||
if (typeof thingToPromisify === 'function') {
|
||||
return promisify(thingToPromisify)
|
||||
}
|
||||
if (typeof thingToPromisify === 'object') {
|
||||
return new Proxy(thingToPromisify, handler)
|
||||
}
|
||||
throw new TypeError('Can only promisify functions or objects')
|
||||
}
|
||||
32
api.hyungi.net/node_modules/@gar/promisify/package.json
generated
vendored
32
api.hyungi.net/node_modules/@gar/promisify/package.json
generated
vendored
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "@gar/promisify",
|
||||
"version": "1.1.3",
|
||||
"description": "Promisify an entire class or object",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/wraithgar/gar-promisify.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "standard",
|
||||
"lint:fix": "standard --fix",
|
||||
"test": "lab -a @hapi/code -t 100",
|
||||
"posttest": "npm run lint"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promisify",
|
||||
"all",
|
||||
"class",
|
||||
"object"
|
||||
],
|
||||
"author": "Gar <gar+npm@danger.computer>",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@hapi/code": "^8.0.1",
|
||||
"@hapi/lab": "^24.1.0",
|
||||
"standard": "^16.0.3"
|
||||
}
|
||||
}
|
||||
22
api.hyungi.net/node_modules/@hexagon/base64/LICENSE
generated
vendored
22
api.hyungi.net/node_modules/@hexagon/base64/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2021-2022 Hexagon <github.com/Hexagon>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
69
api.hyungi.net/node_modules/@hexagon/base64/README.md
generated
vendored
69
api.hyungi.net/node_modules/@hexagon/base64/README.md
generated
vendored
@@ -1,69 +0,0 @@
|
||||
<p align="center">
|
||||
<img src="https://cdn.jsdelivr.net/gh/hexagon/base64@main/base64.png" alt="@hexagon/base64" width="200" height="200"><br>
|
||||
<br>Probably the only JavaScript base64 library you'll ever need!<br>
|
||||
</p>
|
||||
|
||||
# @hexagon/base64
|
||||
|
||||
Encode, decode and validate base64/base64url to string/arraybuffer and vice-versa. Works in Node, Deno and browser.
|
||||
|
||||
[](https://github.com/Hexagon/base64/actions/workflows/node.js.yml) [](https://github.com/Hexagon/base64/actions/workflows/deno.yml)
|
||||
[](https://badge.fury.io/js/@hexagon%2Fbase64) [](https://www.npmjs.org/package/@hexagon/base64) [](https://www.jsdelivr.com/package/npm/@hexagon/base64) [](https://www.codacy.com/gh/Hexagon/base64/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Hexagon/base64&utm_campaign=Badge_Grade)
|
||||
[](https://github.com/Hexagon/base64/blob/master/LICENSE)
|
||||
|
||||
* Supports regular base64 and base64url
|
||||
* Convert to/from string or arraybuffer
|
||||
* Validate / identify base64 and base64url
|
||||
* Works in Node.js >=4.0 (both require and import).
|
||||
* Works in Deno >=1.16.
|
||||
* Works in browsers as standalone, UMD or ES-module.
|
||||
* Includes [TypeScript](https://www.typescriptlang.org/) typings.
|
||||
|
||||
|
||||
```javascript
|
||||
// Encode string as regular base64
|
||||
const example1enc = base64.fromString("Hellö Wörld, how are you doing today?!");
|
||||
console.log(example1enc);
|
||||
// > SGVsbMO2IFfDtnJsZCwgaG93IGFyZSB5b3UgZG9pbmcgdG9kYXk/IQ==
|
||||
|
||||
// Decode string as regular base64
|
||||
const example1dec = base64.toString("SGVsbMO2IFfDtnJsZCwgaG93IGFyZSB5b3UgZG9pbmcgdG9kYXk/IQ==");
|
||||
console.log(example1dec);
|
||||
// > Hellö Wörld, how are you doing today?!
|
||||
```
|
||||
|
||||
Full documentation available at [base64.56k.guru](https://base64.56k.guru)
|
||||
|
||||
## Quick Installation
|
||||
|
||||
Node.js: `npm install @hexagon/base64 --save`
|
||||
|
||||
Deno: `import base64 from "https://deno.land/x/b64@1.1.28/src/base64.js";`
|
||||
|
||||
For browser/cdn usage, refer to the documentation.
|
||||
|
||||
### Quick API
|
||||
|
||||
- __fromArrayBuffer(buffer, urlMode)__ - Encodes `ArrayBuffer` into base64 or base64url if urlMode(optional) is true
|
||||
- __toArrayBuffer(str, urlMode)__ - Decodes base64url string (or base64url string if urlMode is true) to `ArrayBuffer`
|
||||
|
||||
- __fromString(str, urlMode)__ - Encodes `String` into base64 string(base64url string if urlMode is true)
|
||||
- __toString(str, urlMode)__ - Decodes base64 or base64url string to `String`
|
||||
|
||||
- __validate(str, urlMode)__ - Returns true if `String` str is valid base64/base64 dependending on urlMode
|
||||
|
||||
## Contributing
|
||||
|
||||
See [Contribution Guide](https://base64.56k.guru/contributing.html)
|
||||
|
||||
## Donations
|
||||
|
||||
If you found this library helpful and wish to support its development, consider making a donation through [Hexagon's GitHub Sponsors page](https://github.com/sponsors/hexagon). Your generosity ensures the library's continued development and maintenance.
|
||||
|
||||
### Contributors
|
||||
|
||||
The underlying code is loosely based on [github.com/niklasvh/base64-arraybuffer](https://github.com/niklasvh/base64-arraybuffer)
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
12
api.hyungi.net/node_modules/@hexagon/base64/SECURITY.md
generated
vendored
12
api.hyungi.net/node_modules/@hexagon/base64/SECURITY.md
generated
vendored
@@ -1,12 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 4.0.x | :white_check_mark: |
|
||||
| < 4.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Email hexagon@56k.guru. Do NOT report an issue, we will have a look at it asap.
|
||||
198
api.hyungi.net/node_modules/@hexagon/base64/dist/base64.cjs
generated
vendored
198
api.hyungi.net/node_modules/@hexagon/base64/dist/base64.cjs
generated
vendored
@@ -1,198 +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.base64 = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/* ------------------------------------------------------------------------------------
|
||||
|
||||
base64 - MIT License - Hexagon <hexagon@56k.guru>
|
||||
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
License:
|
||||
|
||||
Copyright (c) 2021 Hexagon <hexagon@56k.guru>
|
||||
|
||||
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.
|
||||
|
||||
------------------------------------------------------------------------------------ */
|
||||
|
||||
const
|
||||
// Regular base64 characters
|
||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
||||
|
||||
// Base64url characters
|
||||
charsUrl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
|
||||
|
||||
genLookup = (target) => {
|
||||
const lookupTemp = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
||||
const len = chars.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
lookupTemp[target.charCodeAt(i)] = i;
|
||||
}
|
||||
return lookupTemp;
|
||||
},
|
||||
|
||||
// Use a lookup table to find the index.
|
||||
lookup = genLookup(chars),
|
||||
lookupUrl = genLookup(charsUrl);
|
||||
|
||||
/**
|
||||
* Pre-calculated regexes for validating base64 and base64url
|
||||
*/
|
||||
const base64UrlPattern = /^[-A-Za-z0-9\-_]*$/;
|
||||
const base64Pattern = /^[-A-Za-z0-9+/]*={0,3}$/;
|
||||
|
||||
/**
|
||||
* @namespace base64
|
||||
*/
|
||||
const base64 = {};
|
||||
|
||||
/**
|
||||
* Convenience function for converting a base64 encoded string to an ArrayBuffer instance
|
||||
* @public
|
||||
*
|
||||
* @param {string} data - Base64 representation of data
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be expected
|
||||
* @returns {ArrayBuffer} - Decoded data
|
||||
*/
|
||||
base64.toArrayBuffer = (data, urlMode) => {
|
||||
const
|
||||
len = data.length;
|
||||
let bufferLength = data.length * 0.75,
|
||||
i,
|
||||
p = 0,
|
||||
encoded1,
|
||||
encoded2,
|
||||
encoded3,
|
||||
encoded4;
|
||||
|
||||
if (data[data.length - 1] === "=") {
|
||||
bufferLength--;
|
||||
if (data[data.length - 2] === "=") {
|
||||
bufferLength--;
|
||||
}
|
||||
}
|
||||
|
||||
const
|
||||
arraybuffer = new ArrayBuffer(bufferLength),
|
||||
bytes = new Uint8Array(arraybuffer),
|
||||
target = urlMode ? lookupUrl : lookup;
|
||||
|
||||
for (i = 0; i < len; i += 4) {
|
||||
encoded1 = target[data.charCodeAt(i)];
|
||||
encoded2 = target[data.charCodeAt(i + 1)];
|
||||
encoded3 = target[data.charCodeAt(i + 2)];
|
||||
encoded4 = target[data.charCodeAt(i + 3)];
|
||||
|
||||
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
|
||||
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
|
||||
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
|
||||
}
|
||||
|
||||
return arraybuffer;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Convenience function for creating a base64 encoded string from an ArrayBuffer instance
|
||||
* @public
|
||||
*
|
||||
* @param {ArrayBuffer} arrBuf - ArrayBuffer to be encoded
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be returned
|
||||
* @returns {string} - Base64 representation of data
|
||||
*/
|
||||
base64.fromArrayBuffer = (arrBuf, urlMode) => {
|
||||
const bytes = new Uint8Array(arrBuf);
|
||||
let
|
||||
i,
|
||||
result = "";
|
||||
|
||||
const
|
||||
len = bytes.length,
|
||||
target = urlMode ? charsUrl : chars;
|
||||
|
||||
for (i = 0; i < len; i += 3) {
|
||||
result += target[bytes[i] >> 2];
|
||||
result += target[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
||||
result += target[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
||||
result += target[bytes[i + 2] & 63];
|
||||
}
|
||||
|
||||
const remainder = len % 3;
|
||||
if (remainder === 2) {
|
||||
result = result.substring(0, result.length - 1) + (urlMode ? "" : "=");
|
||||
} else if (remainder === 1) {
|
||||
result = result.substring(0, result.length - 2) + (urlMode ? "" : "==");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Convenience function for converting base64 to string
|
||||
* @public
|
||||
*
|
||||
* @param {string} str - Base64 encoded string to be decoded
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be expected
|
||||
* @returns {string} - Decoded string
|
||||
*/
|
||||
base64.toString = (str, urlMode) => {
|
||||
return new TextDecoder().decode(base64.toArrayBuffer(str, urlMode));
|
||||
};
|
||||
|
||||
/**
|
||||
* Convenience function for converting a javascript string to base64
|
||||
* @public
|
||||
*
|
||||
* @param {string} str - String to be converted to base64
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be returned
|
||||
* @returns {string} - Base64 encoded string
|
||||
*/
|
||||
base64.fromString = (str, urlMode) => {
|
||||
return base64.fromArrayBuffer(new TextEncoder().encode(str), urlMode);
|
||||
};
|
||||
|
||||
/**
|
||||
* Function to validate base64
|
||||
* @public
|
||||
* @param {string} encoded - Base64 or Base64url encoded data
|
||||
* @param {boolean} [urlMode] - If set to true, base64url will be expected
|
||||
* @returns {boolean} - Valid base64/base64url?
|
||||
*/
|
||||
base64.validate = (encoded, urlMode) => {
|
||||
|
||||
// Bail out if not string
|
||||
if (!(typeof encoded === "string" || encoded instanceof String)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Go on validate
|
||||
try {
|
||||
return urlMode ? base64UrlPattern.test(encoded) : base64Pattern.test(encoded);
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
base64.base64 = base64;
|
||||
|
||||
return base64;
|
||||
|
||||
}));
|
||||
1
api.hyungi.net/node_modules/@hexagon/base64/dist/base64.min.js
generated
vendored
1
api.hyungi.net/node_modules/@hexagon/base64/dist/base64.min.js
generated
vendored
@@ -1 +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.base64=factory())})(this,function(){"use strict";const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",charsUrl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",genLookup=target=>{const lookupTemp=typeof Uint8Array==="undefined"?[]:new Uint8Array(256);const len=chars.length;for(let i=0;i<len;i++){lookupTemp[target.charCodeAt(i)]=i}return lookupTemp},lookup=genLookup(chars),lookupUrl=genLookup(charsUrl);const base64UrlPattern=/^[-A-Za-z0-9\-_]*$/;const base64Pattern=/^[-A-Za-z0-9+/]*={0,3}$/;const base64={};base64.toArrayBuffer=(data,urlMode)=>{const len=data.length;let bufferLength=data.length*.75,i,p=0,encoded1,encoded2,encoded3,encoded4;if(data[data.length-1]==="="){bufferLength--;if(data[data.length-2]==="="){bufferLength--}}const arraybuffer=new ArrayBuffer(bufferLength),bytes=new Uint8Array(arraybuffer),target=urlMode?lookupUrl:lookup;for(i=0;i<len;i+=4){encoded1=target[data.charCodeAt(i)];encoded2=target[data.charCodeAt(i+1)];encoded3=target[data.charCodeAt(i+2)];encoded4=target[data.charCodeAt(i+3)];bytes[p++]=encoded1<<2|encoded2>>4;bytes[p++]=(encoded2&15)<<4|encoded3>>2;bytes[p++]=(encoded3&3)<<6|encoded4&63}return arraybuffer};base64.fromArrayBuffer=(arrBuf,urlMode)=>{const bytes=new Uint8Array(arrBuf);let i,result="";const len=bytes.length,target=urlMode?charsUrl:chars;for(i=0;i<len;i+=3){result+=target[bytes[i]>>2];result+=target[(bytes[i]&3)<<4|bytes[i+1]>>4];result+=target[(bytes[i+1]&15)<<2|bytes[i+2]>>6];result+=target[bytes[i+2]&63]}const remainder=len%3;if(remainder===2){result=result.substring(0,result.length-1)+(urlMode?"":"=")}else if(remainder===1){result=result.substring(0,result.length-2)+(urlMode?"":"==")}return result};base64.toString=(str,urlMode)=>{return(new TextDecoder).decode(base64.toArrayBuffer(str,urlMode))};base64.fromString=(str,urlMode)=>{return base64.fromArrayBuffer((new TextEncoder).encode(str),urlMode)};base64.validate=(encoded,urlMode)=>{if(!(typeof encoded==="string"||encoded instanceof String)){return false}try{return urlMode?base64UrlPattern.test(encoded):base64Pattern.test(encoded)}catch(_e){return false}};base64.base64=base64;return base64});
|
||||
1
api.hyungi.net/node_modules/@hexagon/base64/dist/base64.min.js.map
generated
vendored
1
api.hyungi.net/node_modules/@hexagon/base64/dist/base64.min.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["dist/base64.cjs"],"names":["global","factory","exports","module","define","amd","globalThis","self","base64","this","chars","charsUrl","genLookup","lookupTemp","Uint8Array","len","length","let","i","target","charCodeAt","lookup","lookupUrl","base64UrlPattern","base64Pattern","toArrayBuffer","data","urlMode","bufferLength","p","encoded1","encoded2","encoded3","encoded4","arraybuffer","ArrayBuffer","bytes","fromArrayBuffer","arrBuf","result","remainder","substring","toString","str","TextDecoder","decode","fromString","TextEncoder","encode","validate","encoded","String","test","_e"],"mappings":"CAAA,SAAWA,OAAQC,SAClB,OAAOC,UAAY,UAAY,OAAOC,SAAW,YAAcA,OAAOD,QAAUD,QAAQ,EACxF,OAAOG,SAAW,YAAcA,OAAOC,IAAMD,OAAOH,OAAO,GAC1DD,OAAS,OAAOM,aAAe,YAAcA,WAAaN,QAAUO,KAAMP,OAAOQ,OAASP,QAAQ,EACnG,GAAEQ,KAAM,WAAe,aA8BvB,MAECC,MAAQ,mEAGRC,SAAW,mEAEXC,UAAY,SACX,MAAMC,WAAa,OAAOC,aAAe,YAAc,GAAK,IAAIA,WAAW,GAAG,EAC9E,MAAMC,IAAML,MAAMM,OAClB,IAAKC,IAAIC,EAAI,EAAGA,EAAIH,IAAKG,CAAC,GAAI,CAC7BL,WAAWM,OAAOC,WAAWF,CAAC,GAAKA,CACpC,CACA,OAAOL,UACR,EAGAQ,OAAST,UAAUF,KAAK,EACxBY,UAAYV,UAAUD,QAAQ,EAK/B,MAAMY,iBAAmB,qBACzB,MAAMC,cAAgB,0BAKtB,MAAMhB,OAAS,GAUfA,OAAOiB,cAAgB,CAACC,KAAMC,WAC7B,MACCZ,IAAMW,KAAKV,OACZC,IAAIW,aAAeF,KAAKV,OAAS,IAChCE,EACAW,EAAI,EACJC,SACAC,SACAC,SACAC,SAED,GAAIP,KAAKA,KAAKV,OAAS,KAAO,IAAK,CAClCY,YAAY,GACZ,GAAIF,KAAKA,KAAKV,OAAS,KAAO,IAAK,CAClCY,YAAY,EACb,CACD,CAEA,MACCM,YAAc,IAAIC,YAAYP,YAAY,EAC1CQ,MAAQ,IAAItB,WAAWoB,WAAW,EAClCf,OAASQ,QAAUL,UAAYD,OAEhC,IAAKH,EAAI,EAAGA,EAAIH,IAAKG,GAAK,EAAG,CAC5BY,SAAWX,OAAOO,KAAKN,WAAWF,CAAC,GACnCa,SAAWZ,OAAOO,KAAKN,WAAWF,EAAI,CAAC,GACvCc,SAAWb,OAAOO,KAAKN,WAAWF,EAAI,CAAC,GACvCe,SAAWd,OAAOO,KAAKN,WAAWF,EAAI,CAAC,GAEvCkB,MAAMP,CAAC,IAAOC,UAAY,EAAMC,UAAY,EAC5CK,MAAMP,CAAC,KAAQE,SAAW,KAAO,EAAMC,UAAY,EACnDI,MAAMP,CAAC,KAAQG,SAAW,IAAM,EAAMC,SAAW,EAClD,CAEA,OAAOC,WAER,EAUA1B,OAAO6B,gBAAkB,CAACC,OAAQX,WACjC,MAAMS,MAAQ,IAAItB,WAAWwB,MAAM,EACnCrB,IACCC,EACAqB,OAAS,GAEV,MACCxB,IAAMqB,MAAMpB,OACZG,OAASQ,QAAUhB,SAAWD,MAE/B,IAAKQ,EAAI,EAAGA,EAAIH,IAAKG,GAAK,EAAG,CAC5BqB,QAAUpB,OAAOiB,MAAMlB,IAAM,GAC7BqB,QAAUpB,QAASiB,MAAMlB,GAAK,IAAM,EAAMkB,MAAMlB,EAAI,IAAM,GAC1DqB,QAAUpB,QAASiB,MAAMlB,EAAI,GAAK,KAAO,EAAMkB,MAAMlB,EAAI,IAAM,GAC/DqB,QAAUpB,OAAOiB,MAAMlB,EAAI,GAAK,GACjC,CAEA,MAAMsB,UAAYzB,IAAM,EACxB,GAAIyB,YAAc,EAAG,CACpBD,OAASA,OAAOE,UAAU,EAAGF,OAAOvB,OAAS,CAAC,GAAKW,QAAU,GAAK,IACnE,MAAO,GAAIa,YAAc,EAAG,CAC3BD,OAASA,OAAOE,UAAU,EAAGF,OAAOvB,OAAS,CAAC,GAAKW,QAAU,GAAK,KACnE,CAEA,OAAOY,MAER,EAUA/B,OAAOkC,SAAW,CAACC,IAAKhB,WACvB,OAAO,IAAIiB,aAAcC,OAAOrC,OAAOiB,cAAckB,IAAKhB,OAAO,CAAC,CACnE,EAUAnB,OAAOsC,WAAa,CAACH,IAAKhB,WACzB,OAAOnB,OAAO6B,iBAAgB,IAAIU,aAAcC,OAAOL,GAAG,EAAGhB,OAAO,CACrE,EASAnB,OAAOyC,SAAW,CAACC,QAASvB,WAG3B,GAAI,EAAE,OAAOuB,UAAY,UAAYA,mBAAmBC,QAAS,CAChE,OAAO,KACR,CAGA,IACC,OAAOxB,QAAUJ,iBAAiB6B,KAAKF,OAAO,EAAI1B,cAAc4B,KAAKF,OAAO,CAG7E,CAFE,MAAOG,IACR,OAAO,KACR,CACD,EAEA7C,OAAOA,OAASA,OAEhB,OAAOA,MAEP,CAAC"}
|
||||
1
api.hyungi.net/node_modules/@hexagon/base64/dist/base64.min.mjs
generated
vendored
1
api.hyungi.net/node_modules/@hexagon/base64/dist/base64.min.mjs
generated
vendored
@@ -1 +0,0 @@
|
||||
const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",charsUrl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",genLookup=target=>{const lookupTemp=typeof Uint8Array==="undefined"?[]:new Uint8Array(256);const len=chars.length;for(let i=0;i<len;i++){lookupTemp[target.charCodeAt(i)]=i}return lookupTemp},lookup=genLookup(chars),lookupUrl=genLookup(charsUrl);const base64UrlPattern=/^[-A-Za-z0-9\-_]*$/;const base64Pattern=/^[-A-Za-z0-9+/]*={0,3}$/;const base64={};base64.toArrayBuffer=(data,urlMode)=>{const len=data.length;let bufferLength=data.length*.75,i,p=0,encoded1,encoded2,encoded3,encoded4;if(data[data.length-1]==="="){bufferLength--;if(data[data.length-2]==="="){bufferLength--}}const arraybuffer=new ArrayBuffer(bufferLength),bytes=new Uint8Array(arraybuffer),target=urlMode?lookupUrl:lookup;for(i=0;i<len;i+=4){encoded1=target[data.charCodeAt(i)];encoded2=target[data.charCodeAt(i+1)];encoded3=target[data.charCodeAt(i+2)];encoded4=target[data.charCodeAt(i+3)];bytes[p++]=encoded1<<2|encoded2>>4;bytes[p++]=(encoded2&15)<<4|encoded3>>2;bytes[p++]=(encoded3&3)<<6|encoded4&63}return arraybuffer};base64.fromArrayBuffer=(arrBuf,urlMode)=>{const bytes=new Uint8Array(arrBuf);let i,result="";const len=bytes.length,target=urlMode?charsUrl:chars;for(i=0;i<len;i+=3){result+=target[bytes[i]>>2];result+=target[(bytes[i]&3)<<4|bytes[i+1]>>4];result+=target[(bytes[i+1]&15)<<2|bytes[i+2]>>6];result+=target[bytes[i+2]&63]}const remainder=len%3;if(remainder===2){result=result.substring(0,result.length-1)+(urlMode?"":"=")}else if(remainder===1){result=result.substring(0,result.length-2)+(urlMode?"":"==")}return result};base64.toString=(str,urlMode)=>{return(new TextDecoder).decode(base64.toArrayBuffer(str,urlMode))};base64.fromString=(str,urlMode)=>{return base64.fromArrayBuffer((new TextEncoder).encode(str),urlMode)};base64.validate=(encoded,urlMode)=>{if(!(typeof encoded==="string"||encoded instanceof String)){return false}try{return urlMode?base64UrlPattern.test(encoded):base64Pattern.test(encoded)}catch(_e){return false}};base64.base64=base64;export{base64,base64 as default};
|
||||
1
api.hyungi.net/node_modules/@hexagon/base64/dist/base64.min.mjs.map
generated
vendored
1
api.hyungi.net/node_modules/@hexagon/base64/dist/base64.min.mjs.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["dist/base64.mjs"],"names":["chars","charsUrl","genLookup","lookupTemp","Uint8Array","len","length","let","i","target","charCodeAt","lookup","lookupUrl","base64UrlPattern","base64Pattern","base64","toArrayBuffer","data","urlMode","bufferLength","p","encoded1","encoded2","encoded3","encoded4","arraybuffer","ArrayBuffer","bytes","fromArrayBuffer","arrBuf","result","remainder","substring","toString","str","TextDecoder","decode","fromString","TextEncoder","encode","validate","encoded","String","test","_e"],"mappings":"AA4BA,MAECA,MAAQ,mEAGRC,SAAW,mEAEXC,UAAY,SACX,MAAMC,WAAa,OAAOC,aAAe,YAAc,GAAK,IAAIA,WAAW,GAAG,EAC9E,MAAMC,IAAML,MAAMM,OAClB,IAAKC,IAAIC,EAAI,EAAGA,EAAIH,IAAKG,CAAC,GAAI,CAC7BL,WAAWM,OAAOC,WAAWF,CAAC,GAAKA,CACpC,CACA,OAAOL,UACR,EAGAQ,OAAST,UAAUF,KAAK,EACxBY,UAAYV,UAAUD,QAAQ,EAK/B,MAAMY,iBAAmB,qBACzB,MAAMC,cAAgB,0BAKtB,MAAMC,OAAS,GAUfA,OAAOC,cAAgB,CAACC,KAAMC,WAC7B,MACCb,IAAMY,KAAKX,OACZC,IAAIY,aAAeF,KAAKX,OAAS,IAChCE,EACAY,EAAI,EACJC,SACAC,SACAC,SACAC,SAED,GAAIP,KAAKA,KAAKX,OAAS,KAAO,IAAK,CAClCa,YAAY,GACZ,GAAIF,KAAKA,KAAKX,OAAS,KAAO,IAAK,CAClCa,YAAY,EACb,CACD,CAEA,MACCM,YAAc,IAAIC,YAAYP,YAAY,EAC1CQ,MAAQ,IAAIvB,WAAWqB,WAAW,EAClChB,OAASS,QAAUN,UAAYD,OAEhC,IAAKH,EAAI,EAAGA,EAAIH,IAAKG,GAAK,EAAG,CAC5Ba,SAAWZ,OAAOQ,KAAKP,WAAWF,CAAC,GACnCc,SAAWb,OAAOQ,KAAKP,WAAWF,EAAI,CAAC,GACvCe,SAAWd,OAAOQ,KAAKP,WAAWF,EAAI,CAAC,GACvCgB,SAAWf,OAAOQ,KAAKP,WAAWF,EAAI,CAAC,GAEvCmB,MAAMP,CAAC,IAAOC,UAAY,EAAMC,UAAY,EAC5CK,MAAMP,CAAC,KAAQE,SAAW,KAAO,EAAMC,UAAY,EACnDI,MAAMP,CAAC,KAAQG,SAAW,IAAM,EAAMC,SAAW,EAClD,CAEA,OAAOC,WAER,EAUAV,OAAOa,gBAAkB,CAACC,OAAQX,WACjC,MAAMS,MAAQ,IAAIvB,WAAWyB,MAAM,EACnCtB,IACCC,EACAsB,OAAS,GAEV,MACCzB,IAAMsB,MAAMrB,OACZG,OAASS,QAAUjB,SAAWD,MAE/B,IAAKQ,EAAI,EAAGA,EAAIH,IAAKG,GAAK,EAAG,CAC5BsB,QAAUrB,OAAOkB,MAAMnB,IAAM,GAC7BsB,QAAUrB,QAASkB,MAAMnB,GAAK,IAAM,EAAMmB,MAAMnB,EAAI,IAAM,GAC1DsB,QAAUrB,QAASkB,MAAMnB,EAAI,GAAK,KAAO,EAAMmB,MAAMnB,EAAI,IAAM,GAC/DsB,QAAUrB,OAAOkB,MAAMnB,EAAI,GAAK,GACjC,CAEA,MAAMuB,UAAY1B,IAAM,EACxB,GAAI0B,YAAc,EAAG,CACpBD,OAASA,OAAOE,UAAU,EAAGF,OAAOxB,OAAS,CAAC,GAAKY,QAAU,GAAK,IACnE,MAAO,GAAIa,YAAc,EAAG,CAC3BD,OAASA,OAAOE,UAAU,EAAGF,OAAOxB,OAAS,CAAC,GAAKY,QAAU,GAAK,KACnE,CAEA,OAAOY,MAER,EAUAf,OAAOkB,SAAW,CAACC,IAAKhB,WACvB,OAAO,IAAIiB,aAAcC,OAAOrB,OAAOC,cAAckB,IAAKhB,OAAO,CAAC,CACnE,EAUAH,OAAOsB,WAAa,CAACH,IAAKhB,WACzB,OAAOH,OAAOa,iBAAgB,IAAIU,aAAcC,OAAOL,GAAG,EAAGhB,OAAO,CACrE,EASAH,OAAOyB,SAAW,CAACC,QAASvB,WAG3B,GAAI,EAAE,OAAOuB,UAAY,UAAYA,mBAAmBC,QAAS,CAChE,OAAO,KACR,CAGA,IACC,OAAOxB,QAAUL,iBAAiB8B,KAAKF,OAAO,EAAI3B,cAAc6B,KAAKF,OAAO,CAG7E,CAFE,MAAOG,IACR,OAAO,KACR,CACD,EAEA7B,OAAOA,OAASA,cAEPA,OAAQA,iBAAmB"}
|
||||
73
api.hyungi.net/node_modules/@hexagon/base64/package.json
generated
vendored
73
api.hyungi.net/node_modules/@hexagon/base64/package.json
generated
vendored
@@ -1,73 +0,0 @@
|
||||
{
|
||||
"name": "@hexagon/base64",
|
||||
"version": "1.1.28",
|
||||
"description": "Base64 and base64url to string or arraybuffer, and back. Node, Deno or browser.",
|
||||
"author": "Hexagon <github.com/hexagon>",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Niklas von Hertzen",
|
||||
"email": "niklasvh@gmail.com",
|
||||
"url": "https://hertzen.com"
|
||||
}
|
||||
],
|
||||
"homepage": "https://base64.56k.guru",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/hexagon/base64"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/hexagon/base64/issues"
|
||||
},
|
||||
"files": [
|
||||
"dist/*",
|
||||
"src/*",
|
||||
"types/*",
|
||||
"SECURITY.md"
|
||||
],
|
||||
"keywords": [
|
||||
"base64",
|
||||
"base64url",
|
||||
"parser",
|
||||
"base64",
|
||||
"isomorphic",
|
||||
"arraybuffer",
|
||||
"string"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "uvu test test.base64.js",
|
||||
"test:dist": "uvu test/node/js && npm run test:ts",
|
||||
"test:coverage": "c8 --include=src npm test",
|
||||
"test:lint": "eslint ./**/*.js ./**/*.cjs",
|
||||
"test:lint:fix": "eslint --fix ./**/*.js ./**/*.cjs",
|
||||
"test:ts": "tsc --strict --noEmit ./test/node/ts/basics.ts",
|
||||
"build": "npm update && npm run build:precleanup && npm run test:lint && npm run build:typings && npm run build:dist && npm run build:minify && npm run build:cleanup && npm run test:coverage && npm run test:dist",
|
||||
"build:ci": "npm run test:lint && npm run build:typings && npm run build:dist && npm run build:minify && npm run build:cleanup && npm run test:coverage && npm run test:dist",
|
||||
"build:precleanup": "(rm -rf types/* || del /Q types\\*) && (rm -rf dist/* || del /Q dist\\*)",
|
||||
"build:dist": "rollup -c ./rollup.config.js",
|
||||
"build:minify": "uglifyjs dist/base64.cjs --source-map -o dist/base64.min.js && uglifyjs dist/base64.mjs --source-map -o dist/base64.min.mjs",
|
||||
"build:typings": "tsc",
|
||||
"build:cleanup": "(rm dist/base64.mjs || del dist\\base64.mjs)"
|
||||
},
|
||||
"type": "module",
|
||||
"main": "./dist/base64.cjs",
|
||||
"browser": "./dist/base64.min.js",
|
||||
"module": "./src/base64.js",
|
||||
"types": "types/base64.single.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./src/base64.js",
|
||||
"require": "./dist/base64.cjs",
|
||||
"browser": "./dist/base64.min.js"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"c8": "^8.0.1",
|
||||
"eslint": "^8.46.0",
|
||||
"jsdoc": "^4.0.2",
|
||||
"rollup": "^3.27.2",
|
||||
"typescript": "^5.2.2",
|
||||
"uglify-js": "^3.17.4",
|
||||
"uvu": "^0.5.6"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
190
api.hyungi.net/node_modules/@hexagon/base64/src/base64.js
generated
vendored
190
api.hyungi.net/node_modules/@hexagon/base64/src/base64.js
generated
vendored
@@ -1,190 +0,0 @@
|
||||
/* ------------------------------------------------------------------------------------
|
||||
|
||||
base64 - MIT License - Hexagon <hexagon@56k.guru>
|
||||
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
License:
|
||||
|
||||
Copyright (c) 2021 Hexagon <hexagon@56k.guru>
|
||||
|
||||
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.
|
||||
|
||||
------------------------------------------------------------------------------------ */
|
||||
|
||||
const
|
||||
// Regular base64 characters
|
||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
||||
|
||||
// Base64url characters
|
||||
charsUrl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
|
||||
|
||||
genLookup = (target) => {
|
||||
const lookupTemp = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
||||
const len = chars.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
lookupTemp[target.charCodeAt(i)] = i;
|
||||
}
|
||||
return lookupTemp;
|
||||
},
|
||||
|
||||
// Use a lookup table to find the index.
|
||||
lookup = genLookup(chars),
|
||||
lookupUrl = genLookup(charsUrl);
|
||||
|
||||
/**
|
||||
* Pre-calculated regexes for validating base64 and base64url
|
||||
*/
|
||||
const base64UrlPattern = /^[-A-Za-z0-9\-_]*$/;
|
||||
const base64Pattern = /^[-A-Za-z0-9+/]*={0,3}$/;
|
||||
|
||||
/**
|
||||
* @namespace base64
|
||||
*/
|
||||
const base64 = {};
|
||||
|
||||
/**
|
||||
* Convenience function for converting a base64 encoded string to an ArrayBuffer instance
|
||||
* @public
|
||||
*
|
||||
* @param {string} data - Base64 representation of data
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be expected
|
||||
* @returns {ArrayBuffer} - Decoded data
|
||||
*/
|
||||
base64.toArrayBuffer = (data, urlMode) => {
|
||||
const
|
||||
len = data.length;
|
||||
let bufferLength = data.length * 0.75,
|
||||
i,
|
||||
p = 0,
|
||||
encoded1,
|
||||
encoded2,
|
||||
encoded3,
|
||||
encoded4;
|
||||
|
||||
if (data[data.length - 1] === "=") {
|
||||
bufferLength--;
|
||||
if (data[data.length - 2] === "=") {
|
||||
bufferLength--;
|
||||
}
|
||||
}
|
||||
|
||||
const
|
||||
arraybuffer = new ArrayBuffer(bufferLength),
|
||||
bytes = new Uint8Array(arraybuffer),
|
||||
target = urlMode ? lookupUrl : lookup;
|
||||
|
||||
for (i = 0; i < len; i += 4) {
|
||||
encoded1 = target[data.charCodeAt(i)];
|
||||
encoded2 = target[data.charCodeAt(i + 1)];
|
||||
encoded3 = target[data.charCodeAt(i + 2)];
|
||||
encoded4 = target[data.charCodeAt(i + 3)];
|
||||
|
||||
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
|
||||
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
|
||||
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
|
||||
}
|
||||
|
||||
return arraybuffer;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Convenience function for creating a base64 encoded string from an ArrayBuffer instance
|
||||
* @public
|
||||
*
|
||||
* @param {ArrayBuffer} arrBuf - ArrayBuffer to be encoded
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be returned
|
||||
* @returns {string} - Base64 representation of data
|
||||
*/
|
||||
base64.fromArrayBuffer = (arrBuf, urlMode) => {
|
||||
const bytes = new Uint8Array(arrBuf);
|
||||
let
|
||||
i,
|
||||
result = "";
|
||||
|
||||
const
|
||||
len = bytes.length,
|
||||
target = urlMode ? charsUrl : chars;
|
||||
|
||||
for (i = 0; i < len; i += 3) {
|
||||
result += target[bytes[i] >> 2];
|
||||
result += target[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
||||
result += target[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
||||
result += target[bytes[i + 2] & 63];
|
||||
}
|
||||
|
||||
const remainder = len % 3;
|
||||
if (remainder === 2) {
|
||||
result = result.substring(0, result.length - 1) + (urlMode ? "" : "=");
|
||||
} else if (remainder === 1) {
|
||||
result = result.substring(0, result.length - 2) + (urlMode ? "" : "==");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Convenience function for converting base64 to string
|
||||
* @public
|
||||
*
|
||||
* @param {string} str - Base64 encoded string to be decoded
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be expected
|
||||
* @returns {string} - Decoded string
|
||||
*/
|
||||
base64.toString = (str, urlMode) => {
|
||||
return new TextDecoder().decode(base64.toArrayBuffer(str, urlMode));
|
||||
};
|
||||
|
||||
/**
|
||||
* Convenience function for converting a javascript string to base64
|
||||
* @public
|
||||
*
|
||||
* @param {string} str - String to be converted to base64
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be returned
|
||||
* @returns {string} - Base64 encoded string
|
||||
*/
|
||||
base64.fromString = (str, urlMode) => {
|
||||
return base64.fromArrayBuffer(new TextEncoder().encode(str), urlMode);
|
||||
};
|
||||
|
||||
/**
|
||||
* Function to validate base64
|
||||
* @public
|
||||
* @param {string} encoded - Base64 or Base64url encoded data
|
||||
* @param {boolean} [urlMode] - If set to true, base64url will be expected
|
||||
* @returns {boolean} - Valid base64/base64url?
|
||||
*/
|
||||
base64.validate = (encoded, urlMode) => {
|
||||
|
||||
// Bail out if not string
|
||||
if (!(typeof encoded === "string" || encoded instanceof String)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Go on validate
|
||||
try {
|
||||
return urlMode ? base64UrlPattern.test(encoded) : base64Pattern.test(encoded);
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
base64.base64 = base64;
|
||||
export default base64;
|
||||
export { base64 };
|
||||
3
api.hyungi.net/node_modules/@hexagon/base64/src/base64.single.js
generated
vendored
3
api.hyungi.net/node_modules/@hexagon/base64/src/base64.single.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import base64 from "./base64.js";
|
||||
|
||||
export default base64;
|
||||
48
api.hyungi.net/node_modules/@hexagon/base64/types/base64.d.ts
generated
vendored
48
api.hyungi.net/node_modules/@hexagon/base64/types/base64.d.ts
generated
vendored
@@ -1,48 +0,0 @@
|
||||
export default base64;
|
||||
export namespace base64 {
|
||||
/**
|
||||
* Convenience function for converting a base64 encoded string to an ArrayBuffer instance
|
||||
* @public
|
||||
*
|
||||
* @param {string} data - Base64 representation of data
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be expected
|
||||
* @returns {ArrayBuffer} - Decoded data
|
||||
*/
|
||||
export function toArrayBuffer(data: string, urlMode?: boolean): ArrayBuffer;
|
||||
/**
|
||||
* Convenience function for creating a base64 encoded string from an ArrayBuffer instance
|
||||
* @public
|
||||
*
|
||||
* @param {ArrayBuffer} arrBuf - ArrayBuffer to be encoded
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be returned
|
||||
* @returns {string} - Base64 representation of data
|
||||
*/
|
||||
export function fromArrayBuffer(arrBuf: ArrayBuffer, urlMode?: boolean): string;
|
||||
/**
|
||||
* Convenience function for converting base64 to string
|
||||
* @public
|
||||
*
|
||||
* @param {string} str - Base64 encoded string to be decoded
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be expected
|
||||
* @returns {string} - Decoded string
|
||||
*/
|
||||
export function toString(str: string, urlMode?: boolean): string;
|
||||
/**
|
||||
* Convenience function for converting a javascript string to base64
|
||||
* @public
|
||||
*
|
||||
* @param {string} str - String to be converted to base64
|
||||
* @param {boolean} [urlMode] - If set to true, URL mode string will be returned
|
||||
* @returns {string} - Base64 encoded string
|
||||
*/
|
||||
export function fromString(str: string, urlMode?: boolean): string;
|
||||
/**
|
||||
* Function to validate base64
|
||||
* @public
|
||||
* @param {string} encoded - Base64 or Base64url encoded data
|
||||
* @param {boolean} [urlMode] - If set to true, base64url will be expected
|
||||
* @returns {boolean} - Valid base64/base64url?
|
||||
*/
|
||||
export function validate(encoded: string, urlMode?: boolean): boolean;
|
||||
export { base64 };
|
||||
}
|
||||
2
api.hyungi.net/node_modules/@hexagon/base64/types/base64.single.d.ts
generated
vendored
2
api.hyungi.net/node_modules/@hexagon/base64/types/base64.single.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
export default base64;
|
||||
import base64 from "./base64.js";
|
||||
21
api.hyungi.net/node_modules/@levischuck/tiny-cbor/LICENSE
generated
vendored
21
api.hyungi.net/node_modules/@levischuck/tiny-cbor/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Levi
|
||||
|
||||
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.
|
||||
81
api.hyungi.net/node_modules/@levischuck/tiny-cbor/README.md
generated
vendored
81
api.hyungi.net/node_modules/@levischuck/tiny-cbor/README.md
generated
vendored
@@ -1,81 +0,0 @@
|
||||
# Tiny CBOR
|
||||
|
||||
[](https://github.com/LeviSchuck/tiny-cbor/actions)
|
||||
[](https://codecov.io/gh/levischuck/tiny-cbor)
|
||||
[](https://www.npmjs.com/package/@levischuck/tiny-cbor)
|
||||
[](https://jsr.io/@levischuck/tiny-cbor)
|
||||
[](https://github.com/LeviSchuck/tiny-cbor/blob/main/LICENSE.txt)
|
||||

|
||||
|
||||
This minimal generic library decodes and encodes most useful CBOR structures
|
||||
into simple JavaScript structures:
|
||||
|
||||
- Maps with keys as `string`s or `number`s with `CBORType` values as a `Map`
|
||||
- Arrays of `CBORType` values
|
||||
- integers as `number`s
|
||||
- float32 and float64 as `number`s
|
||||
- float16 `NaN`, `Infinity`, `-Infinity`
|
||||
- `string`s
|
||||
- byte strings as `Uint8Array`
|
||||
- booleans
|
||||
- `null` and `undefined`
|
||||
- tags as `CBORTag(tag, value)`
|
||||
|
||||
## Limitations
|
||||
|
||||
This implementation does not support:
|
||||
|
||||
- indefinite length maps, arrays, text strings, or byte strings.
|
||||
- half precision floating point numbers
|
||||
- integers outside the range of `[-9007199254740991, 9007199254740991]`, see
|
||||
[Number.MAX_SAFE_INTEGER](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)
|
||||
- native output to JSON
|
||||
- does not support generic objects, only `Map`s
|
||||
|
||||
This implementation has the following constraints:
|
||||
|
||||
- Map keys may only be strings or numbers
|
||||
- Tags are not interpreted
|
||||
|
||||
## Behavior
|
||||
|
||||
Maps that have duplicate keys will throw an error during decoding. Decoding data
|
||||
that is incomplete will throw an error during decoding.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
// NPM
|
||||
// import { decodeCBOR } from "@levischuck/tiny-cbor";
|
||||
// or JSR
|
||||
// import { decodeCBOR } from "jsr:@levischuck/tiny-cbor";
|
||||
import { decodeCBOR } from "./index.ts";
|
||||
// Get your bytes somehow, directly or with decodeBase64 / decodeHex (available through @levischuck/tiny-encodings)
|
||||
const HELLO_WORLD_BYTES = new Uint8Array([
|
||||
107, // String wih length 11
|
||||
104, // h
|
||||
101, // e
|
||||
108, // l
|
||||
108, // l
|
||||
111, // o
|
||||
32, // Space
|
||||
119, // w
|
||||
111, // o
|
||||
114, // r
|
||||
108, // l
|
||||
100, // d
|
||||
]);
|
||||
const helloWorld = decodeCBOR(HELLO_WORLD_BYTES);
|
||||
if ("hello world" == helloWorld) {
|
||||
console.log("Success!");
|
||||
}
|
||||
```
|
||||
|
||||
## Where to get it
|
||||
|
||||
This library is available on
|
||||
[NPM](https://www.npmjs.com/package/@levischuck/tiny-cbor) and
|
||||
[JSR](https://jsr.io/@levischuck/tiny-cbor).
|
||||
|
||||
This library is no longer automatically published to Deno's Third Party Modules.
|
||||
Newer versions may appear on deno.land/x, but do not work.
|
||||
101
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor.d.ts
generated
vendored
101
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor.d.ts
generated
vendored
@@ -1,101 +0,0 @@
|
||||
/**
|
||||
* A value which is wrapped with a CBOR Tag.
|
||||
* Several tags are registered with defined meanings like 0 for a date string.
|
||||
* These meanings are **not interpreted** when decoded or encoded.
|
||||
*
|
||||
* This class is an immutable record.
|
||||
* If the tag number or value needs to change, then construct a new tag
|
||||
*/
|
||||
export declare class CBORTag {
|
||||
private tagId;
|
||||
private tagValue;
|
||||
/**
|
||||
* Wrap a value with a tag number.
|
||||
* When encoded, this tag will be attached to the value.
|
||||
*
|
||||
* @param tag Tag number
|
||||
* @param value Wrapped value
|
||||
*/
|
||||
constructor(tag: number, value: CBORType);
|
||||
/**
|
||||
* Read the tag number
|
||||
*/
|
||||
get tag(): number;
|
||||
/**
|
||||
* Read the value
|
||||
*/
|
||||
get value(): CBORType;
|
||||
}
|
||||
/**
|
||||
* Supported types which are encodable and decodable with tiny CBOR.
|
||||
* Note that plain javascript objects are omitted.
|
||||
*/
|
||||
export type CBORType = number | bigint | string | Uint8Array | boolean | null | undefined | CBORType[] | CBORTag | Map<string | number, CBORType>;
|
||||
/**
|
||||
* Like {decodeCBOR}, but the length of the data is unknown and there is likely
|
||||
* more -- possibly unrelated non-CBOR -- data afterwards.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* ```ts
|
||||
* import {decodePartialCBOR} from './cbor.ts'
|
||||
* decodePartialCBOR(new Uint8Array([1, 2, 245, 3, 4]), 2)
|
||||
* // returns [true, 1]
|
||||
* // It did not decode the leading [1, 2] or trailing [3, 4]
|
||||
* ```
|
||||
*
|
||||
* @param data a data stream to read data from
|
||||
* @param index where to start reading in the data stream
|
||||
* @returns a tuple of the value followed by bytes read.
|
||||
* @throws {Error}
|
||||
* When the data stream ends early or the CBOR data is not well formed
|
||||
*/
|
||||
export declare function decodePartialCBOR(data: DataView | Uint8Array | ArrayBuffer, index: number): [CBORType, number];
|
||||
/**
|
||||
* Decode CBOR data from a binary stream
|
||||
*
|
||||
* The entire data stream from [0, length) will be consumed.
|
||||
* If you require a partial decoding, see {decodePartialCBOR}.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* ```ts
|
||||
* import {decodeCBOR, CBORTag, CBORType} from './cbor.ts'
|
||||
* decodeCBOR(new Uint8Array([162, 99, 107, 101, 121, 101, 118, 97, 108, 117, 101, 1, 109, 97, 110, 111, 116, 104, 101, 114, 32, 118, 97, 108, 117, 101]));
|
||||
* // returns new Map<string | number, CBORType>([
|
||||
* // ["key", "value"],
|
||||
* // [1, "another value"]
|
||||
* // ]);
|
||||
*
|
||||
* const taggedItem = new Uint8Array([217, 4, 210, 101, 104, 101, 108, 108, 111]);
|
||||
* decodeCBOR(new DataView(taggedItem.buffer))
|
||||
* // returns new CBORTag(1234, "hello")
|
||||
* ```
|
||||
*
|
||||
* @param data a data stream, multiple types are supported
|
||||
* @returns
|
||||
*/
|
||||
export declare function decodeCBOR(data: DataView | Uint8Array | ArrayBuffer): CBORType;
|
||||
/**
|
||||
* Encode a supported structure to a CBOR byte string.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```ts
|
||||
* import {encodeCBOR, CBORType, CBORTag} from './cbor.ts'
|
||||
* encodeCBOR(new Map<string | number, CBORType>([
|
||||
* ["key", "value"],
|
||||
* [1, "another value"]
|
||||
* ]));
|
||||
* // returns new Uint8Array([162, 99, 107, 101, 121, 101, 118, 97, 108, 117, 101, 1, 109, 97, 110, 111, 116, 104, 101, 114, 32 118, 97, 108, 117, 101])
|
||||
*
|
||||
* encodeCBOR(new CBORTag(1234, "hello"))
|
||||
* // returns new UInt8Array([217, 4, 210, 101, 104, 101, 108, 108, 111])
|
||||
* ```
|
||||
*
|
||||
* @param data Data to encode
|
||||
* @returns A byte string as a Uint8Array
|
||||
* @throws Error
|
||||
* if unsupported data is found during encoding
|
||||
*/
|
||||
export declare function encodeCBOR(data: CBORType): Uint8Array;
|
||||
440
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor.js
generated
vendored
440
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor.js
generated
vendored
@@ -1,440 +0,0 @@
|
||||
import { decodeLength, encodeLength, MAJOR_TYPE_ARRAY, MAJOR_TYPE_BYTE_STRING, MAJOR_TYPE_MAP, MAJOR_TYPE_NEGATIVE_INTEGER, MAJOR_TYPE_SIMPLE_OR_FLOAT, MAJOR_TYPE_TAG, MAJOR_TYPE_TEXT_STRING, MAJOR_TYPE_UNSIGNED_INTEGER, } from "./cbor_internal.js";
|
||||
/**
|
||||
* A value which is wrapped with a CBOR Tag.
|
||||
* Several tags are registered with defined meanings like 0 for a date string.
|
||||
* These meanings are **not interpreted** when decoded or encoded.
|
||||
*
|
||||
* This class is an immutable record.
|
||||
* If the tag number or value needs to change, then construct a new tag
|
||||
*/
|
||||
export class CBORTag {
|
||||
/**
|
||||
* Wrap a value with a tag number.
|
||||
* When encoded, this tag will be attached to the value.
|
||||
*
|
||||
* @param tag Tag number
|
||||
* @param value Wrapped value
|
||||
*/
|
||||
constructor(tag, value) {
|
||||
Object.defineProperty(this, "tagId", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
Object.defineProperty(this, "tagValue", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
this.tagId = tag;
|
||||
this.tagValue = value;
|
||||
}
|
||||
/**
|
||||
* Read the tag number
|
||||
*/
|
||||
get tag() {
|
||||
return this.tagId;
|
||||
}
|
||||
/**
|
||||
* Read the value
|
||||
*/
|
||||
get value() {
|
||||
return this.tagValue;
|
||||
}
|
||||
}
|
||||
function decodeUnsignedInteger(data, argument, index) {
|
||||
return decodeLength(data, argument, index);
|
||||
}
|
||||
function decodeNegativeInteger(data, argument, index) {
|
||||
const [value, length] = decodeUnsignedInteger(data, argument, index);
|
||||
return [-value - 1, length];
|
||||
}
|
||||
function decodeByteString(data, argument, index) {
|
||||
const [lengthValue, lengthConsumed] = decodeLength(data, argument, index);
|
||||
const dataStartIndex = index + lengthConsumed;
|
||||
return [
|
||||
new Uint8Array(data.buffer.slice(dataStartIndex, dataStartIndex + lengthValue)),
|
||||
lengthConsumed + lengthValue,
|
||||
];
|
||||
}
|
||||
const TEXT_DECODER = new TextDecoder();
|
||||
function decodeString(data, argument, index) {
|
||||
const [value, length] = decodeByteString(data, argument, index);
|
||||
return [TEXT_DECODER.decode(value), length];
|
||||
}
|
||||
function decodeArray(data, argument, index) {
|
||||
if (argument === 0) {
|
||||
return [[], 1];
|
||||
}
|
||||
const [length, lengthConsumed] = decodeLength(data, argument, index);
|
||||
let consumedLength = lengthConsumed;
|
||||
const value = [];
|
||||
for (let i = 0; i < length; i++) {
|
||||
const remainingDataLength = data.byteLength - index - consumedLength;
|
||||
if (remainingDataLength <= 0) {
|
||||
throw new Error("array is not supported or well formed");
|
||||
}
|
||||
const [decodedValue, consumed] = decodeNext(data, index + consumedLength);
|
||||
value.push(decodedValue);
|
||||
consumedLength += consumed;
|
||||
}
|
||||
return [value, consumedLength];
|
||||
}
|
||||
const MAP_ERROR = "Map is not supported or well formed";
|
||||
function decodeMap(data, argument, index) {
|
||||
if (argument === 0) {
|
||||
return [new Map(), 1];
|
||||
}
|
||||
const [length, lengthConsumed] = decodeLength(data, argument, index);
|
||||
let consumedLength = lengthConsumed;
|
||||
const result = new Map();
|
||||
for (let i = 0; i < length; i++) {
|
||||
let remainingDataLength = data.byteLength - index - consumedLength;
|
||||
if (remainingDataLength <= 0) {
|
||||
throw new Error(MAP_ERROR);
|
||||
}
|
||||
// Load key
|
||||
const [key, keyConsumed] = decodeNext(data, index + consumedLength);
|
||||
consumedLength += keyConsumed;
|
||||
remainingDataLength -= keyConsumed;
|
||||
// Check that there's enough to have a value
|
||||
if (remainingDataLength <= 0) {
|
||||
throw new Error(MAP_ERROR);
|
||||
}
|
||||
// Technically CBOR maps can have any type as the key, and so can JS Maps
|
||||
// However, JS Maps can only reference such keys as references which would
|
||||
// require key iteration and pattern matching.
|
||||
// For simplicity, since such keys are not in use with WebAuthn, this
|
||||
// capability is not implemented and the types are restricted to strings
|
||||
// and numbers.
|
||||
if (typeof key !== "string" && typeof key !== "number") {
|
||||
throw new Error(MAP_ERROR);
|
||||
}
|
||||
// CBOR Maps are not well formed if there are duplicate keys
|
||||
if (result.has(key)) {
|
||||
throw new Error(MAP_ERROR);
|
||||
}
|
||||
// Load value
|
||||
const [value, valueConsumed] = decodeNext(data, index + consumedLength);
|
||||
consumedLength += valueConsumed;
|
||||
result.set(key, value);
|
||||
}
|
||||
return [result, consumedLength];
|
||||
}
|
||||
function decodeFloat16(data, index) {
|
||||
if (index + 3 > data.byteLength) {
|
||||
throw new Error("CBOR stream ended before end of Float 16");
|
||||
}
|
||||
// Skip the first byte
|
||||
const result = data.getUint16(index + 1, false);
|
||||
// A minimal selection of supported values
|
||||
if (result == 0x7c00) {
|
||||
return [Infinity, 3];
|
||||
}
|
||||
else if (result == 0x7e00) {
|
||||
return [NaN, 3];
|
||||
}
|
||||
else if (result == 0xfc00) {
|
||||
return [-Infinity, 3];
|
||||
}
|
||||
throw new Error("Float16 data is unsupported");
|
||||
}
|
||||
function decodeFloat32(data, index) {
|
||||
if (index + 5 > data.byteLength) {
|
||||
throw new Error("CBOR stream ended before end of Float 32");
|
||||
}
|
||||
// Skip the first byte
|
||||
const result = data.getFloat32(index + 1, false);
|
||||
// First byte + 4 byte float
|
||||
return [result, 5];
|
||||
}
|
||||
function decodeFloat64(data, index) {
|
||||
if (index + 9 > data.byteLength) {
|
||||
throw new Error("CBOR stream ended before end of Float 64");
|
||||
}
|
||||
// Skip the first byte
|
||||
const result = data.getFloat64(index + 1, false);
|
||||
// First byte + 8 byte float
|
||||
return [result, 9];
|
||||
}
|
||||
function decodeTag(data, argument, index) {
|
||||
const [tag, tagBytes] = decodeLength(data, argument, index);
|
||||
const [value, valueBytes] = decodeNext(data, index + tagBytes);
|
||||
return [new CBORTag(tag, value), tagBytes + valueBytes];
|
||||
}
|
||||
function decodeNext(data, index) {
|
||||
if (index >= data.byteLength) {
|
||||
throw new Error("CBOR stream ended before tag value");
|
||||
}
|
||||
const byte = data.getUint8(index);
|
||||
const majorType = byte >> 5;
|
||||
const argument = byte & 0x1f;
|
||||
switch (majorType) {
|
||||
case MAJOR_TYPE_UNSIGNED_INTEGER: {
|
||||
return decodeUnsignedInteger(data, argument, index);
|
||||
}
|
||||
case MAJOR_TYPE_NEGATIVE_INTEGER: {
|
||||
return decodeNegativeInteger(data, argument, index);
|
||||
}
|
||||
case MAJOR_TYPE_BYTE_STRING: {
|
||||
return decodeByteString(data, argument, index);
|
||||
}
|
||||
case MAJOR_TYPE_TEXT_STRING: {
|
||||
return decodeString(data, argument, index);
|
||||
}
|
||||
case MAJOR_TYPE_ARRAY: {
|
||||
return decodeArray(data, argument, index);
|
||||
}
|
||||
case MAJOR_TYPE_MAP: {
|
||||
return decodeMap(data, argument, index);
|
||||
}
|
||||
case MAJOR_TYPE_TAG: {
|
||||
return decodeTag(data, argument, index);
|
||||
}
|
||||
case MAJOR_TYPE_SIMPLE_OR_FLOAT: {
|
||||
switch (argument) {
|
||||
case 20:
|
||||
return [false, 1];
|
||||
case 21:
|
||||
return [true, 1];
|
||||
case 22:
|
||||
return [null, 1];
|
||||
case 23:
|
||||
return [undefined, 1];
|
||||
// 24: Simple value (value 32..255 in following byte)
|
||||
case 25: // IEEE 754 Half-Precision Float (16 bits follow)
|
||||
return decodeFloat16(data, index);
|
||||
case 26: // IEEE 754 Single-Precision Float (32 bits follow)
|
||||
return decodeFloat32(data, index);
|
||||
case 27: // IEEE 754 Double-Precision Float (64 bits follow)
|
||||
return decodeFloat64(data, index);
|
||||
// 28-30: Reserved, not well-formed in the present document
|
||||
// 31: "break" stop code for indefinite-length items
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new Error(`Unsupported or not well formed at ${index}`);
|
||||
}
|
||||
function encodeSimple(data) {
|
||||
if (data === true) {
|
||||
return 0xf5;
|
||||
}
|
||||
else if (data === false) {
|
||||
return 0xf4;
|
||||
}
|
||||
else if (data === null) {
|
||||
return 0xf6;
|
||||
}
|
||||
// Else undefined
|
||||
return 0xf7;
|
||||
}
|
||||
function encodeFloat(data) {
|
||||
if (Math.fround(data) == data || !Number.isFinite(data) || Number.isNaN(data)) {
|
||||
// Float32
|
||||
const output = new Uint8Array(5);
|
||||
output[0] = 0xfa;
|
||||
const view = new DataView(output.buffer);
|
||||
view.setFloat32(1, data, false);
|
||||
return output;
|
||||
}
|
||||
else {
|
||||
// Float64
|
||||
const output = new Uint8Array(9);
|
||||
output[0] = 0xfb;
|
||||
const view = new DataView(output.buffer);
|
||||
view.setFloat64(1, data, false);
|
||||
return output;
|
||||
}
|
||||
}
|
||||
function encodeNumber(data) {
|
||||
if (typeof data == "number") {
|
||||
if (Number.isSafeInteger(data)) {
|
||||
// Encode integer
|
||||
if (data < 0) {
|
||||
return encodeLength(MAJOR_TYPE_NEGATIVE_INTEGER, Math.abs(data));
|
||||
}
|
||||
else {
|
||||
return encodeLength(MAJOR_TYPE_UNSIGNED_INTEGER, data);
|
||||
}
|
||||
}
|
||||
return [encodeFloat(data)];
|
||||
}
|
||||
else {
|
||||
if (data < 0n) {
|
||||
return encodeLength(MAJOR_TYPE_NEGATIVE_INTEGER, data * -1n);
|
||||
}
|
||||
else {
|
||||
return encodeLength(MAJOR_TYPE_UNSIGNED_INTEGER, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
const ENCODER = new TextEncoder();
|
||||
function encodeString(data, output) {
|
||||
output.push(...encodeLength(MAJOR_TYPE_TEXT_STRING, data.length));
|
||||
output.push(ENCODER.encode(data));
|
||||
}
|
||||
function encodeBytes(data, output) {
|
||||
output.push(...encodeLength(MAJOR_TYPE_BYTE_STRING, data.length));
|
||||
output.push(data);
|
||||
}
|
||||
function encodeArray(data, output) {
|
||||
output.push(...encodeLength(MAJOR_TYPE_ARRAY, data.length));
|
||||
for (const element of data) {
|
||||
encodePartialCBOR(element, output);
|
||||
}
|
||||
}
|
||||
function encodeMap(data, output) {
|
||||
output.push(new Uint8Array(encodeLength(MAJOR_TYPE_MAP, data.size)));
|
||||
for (const [key, value] of data.entries()) {
|
||||
encodePartialCBOR(key, output);
|
||||
encodePartialCBOR(value, output);
|
||||
}
|
||||
}
|
||||
function encodeTag(tag, output) {
|
||||
output.push(...encodeLength(MAJOR_TYPE_TAG, tag.tag));
|
||||
encodePartialCBOR(tag.value, output);
|
||||
}
|
||||
function encodePartialCBOR(data, output) {
|
||||
if (typeof data == "boolean" || data === null || data == undefined) {
|
||||
output.push(encodeSimple(data));
|
||||
return;
|
||||
}
|
||||
if (typeof data == "number" || typeof data == "bigint") {
|
||||
output.push(...encodeNumber(data));
|
||||
return;
|
||||
}
|
||||
if (typeof data == "string") {
|
||||
encodeString(data, output);
|
||||
return;
|
||||
}
|
||||
if (data instanceof Uint8Array) {
|
||||
encodeBytes(data, output);
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(data)) {
|
||||
encodeArray(data, output);
|
||||
return;
|
||||
}
|
||||
if (data instanceof Map) {
|
||||
encodeMap(data, output);
|
||||
return;
|
||||
}
|
||||
if (data instanceof CBORTag) {
|
||||
encodeTag(data, output);
|
||||
return;
|
||||
}
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
/**
|
||||
* Like {decodeCBOR}, but the length of the data is unknown and there is likely
|
||||
* more -- possibly unrelated non-CBOR -- data afterwards.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* ```ts
|
||||
* import {decodePartialCBOR} from './cbor.ts'
|
||||
* decodePartialCBOR(new Uint8Array([1, 2, 245, 3, 4]), 2)
|
||||
* // returns [true, 1]
|
||||
* // It did not decode the leading [1, 2] or trailing [3, 4]
|
||||
* ```
|
||||
*
|
||||
* @param data a data stream to read data from
|
||||
* @param index where to start reading in the data stream
|
||||
* @returns a tuple of the value followed by bytes read.
|
||||
* @throws {Error}
|
||||
* When the data stream ends early or the CBOR data is not well formed
|
||||
*/
|
||||
export function decodePartialCBOR(data, index) {
|
||||
if (data.byteLength === 0 || data.byteLength <= index || index < 0) {
|
||||
throw new Error("No data");
|
||||
}
|
||||
if (data instanceof Uint8Array) {
|
||||
return decodeNext(new DataView(data.buffer), index);
|
||||
}
|
||||
else if (data instanceof ArrayBuffer) {
|
||||
return decodeNext(new DataView(data), index);
|
||||
}
|
||||
// otherwise, it is a data view
|
||||
return decodeNext(data, index);
|
||||
}
|
||||
/**
|
||||
* Decode CBOR data from a binary stream
|
||||
*
|
||||
* The entire data stream from [0, length) will be consumed.
|
||||
* If you require a partial decoding, see {decodePartialCBOR}.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* ```ts
|
||||
* import {decodeCBOR, CBORTag, CBORType} from './cbor.ts'
|
||||
* decodeCBOR(new Uint8Array([162, 99, 107, 101, 121, 101, 118, 97, 108, 117, 101, 1, 109, 97, 110, 111, 116, 104, 101, 114, 32, 118, 97, 108, 117, 101]));
|
||||
* // returns new Map<string | number, CBORType>([
|
||||
* // ["key", "value"],
|
||||
* // [1, "another value"]
|
||||
* // ]);
|
||||
*
|
||||
* const taggedItem = new Uint8Array([217, 4, 210, 101, 104, 101, 108, 108, 111]);
|
||||
* decodeCBOR(new DataView(taggedItem.buffer))
|
||||
* // returns new CBORTag(1234, "hello")
|
||||
* ```
|
||||
*
|
||||
* @param data a data stream, multiple types are supported
|
||||
* @returns
|
||||
*/
|
||||
export function decodeCBOR(data) {
|
||||
const [value, length] = decodePartialCBOR(data, 0);
|
||||
if (length !== data.byteLength) {
|
||||
throw new Error(`Data was decoded, but the whole stream was not processed ${length} != ${data.byteLength}`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* Encode a supported structure to a CBOR byte string.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```ts
|
||||
* import {encodeCBOR, CBORType, CBORTag} from './cbor.ts'
|
||||
* encodeCBOR(new Map<string | number, CBORType>([
|
||||
* ["key", "value"],
|
||||
* [1, "another value"]
|
||||
* ]));
|
||||
* // returns new Uint8Array([162, 99, 107, 101, 121, 101, 118, 97, 108, 117, 101, 1, 109, 97, 110, 111, 116, 104, 101, 114, 32 118, 97, 108, 117, 101])
|
||||
*
|
||||
* encodeCBOR(new CBORTag(1234, "hello"))
|
||||
* // returns new UInt8Array([217, 4, 210, 101, 104, 101, 108, 108, 111])
|
||||
* ```
|
||||
*
|
||||
* @param data Data to encode
|
||||
* @returns A byte string as a Uint8Array
|
||||
* @throws Error
|
||||
* if unsupported data is found during encoding
|
||||
*/
|
||||
export function encodeCBOR(data) {
|
||||
const results = [];
|
||||
encodePartialCBOR(data, results);
|
||||
let length = 0;
|
||||
for (const result of results) {
|
||||
if (typeof result == "number") {
|
||||
length += 1;
|
||||
}
|
||||
else {
|
||||
length += result.length;
|
||||
}
|
||||
}
|
||||
const output = new Uint8Array(length);
|
||||
let index = 0;
|
||||
for (const result of results) {
|
||||
if (typeof result == "number") {
|
||||
output[index] = result;
|
||||
index += 1;
|
||||
}
|
||||
else {
|
||||
output.set(result, index);
|
||||
index += result.length;
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
11
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor_internal.d.ts
generated
vendored
11
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor_internal.d.ts
generated
vendored
@@ -1,11 +0,0 @@
|
||||
export declare function decodeLength(data: DataView, argument: number, index: number): [number, number];
|
||||
export type MajorType = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
||||
export declare const MAJOR_TYPE_UNSIGNED_INTEGER: MajorType;
|
||||
export declare const MAJOR_TYPE_NEGATIVE_INTEGER: MajorType;
|
||||
export declare const MAJOR_TYPE_BYTE_STRING: MajorType;
|
||||
export declare const MAJOR_TYPE_TEXT_STRING: MajorType;
|
||||
export declare const MAJOR_TYPE_ARRAY: MajorType;
|
||||
export declare const MAJOR_TYPE_MAP: MajorType;
|
||||
export declare const MAJOR_TYPE_TAG: MajorType;
|
||||
export declare const MAJOR_TYPE_SIMPLE_OR_FLOAT: MajorType;
|
||||
export declare function encodeLength(major: MajorType, argument: number | bigint): number[];
|
||||
111
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor_internal.js
generated
vendored
111
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor_internal.js
generated
vendored
@@ -1,111 +0,0 @@
|
||||
export function decodeLength(data, argument, index) {
|
||||
if (argument < 24) {
|
||||
return [argument, 1];
|
||||
}
|
||||
const remainingDataLength = data.byteLength - index - 1;
|
||||
const view = new DataView(data.buffer, index + 1);
|
||||
let output;
|
||||
let bytes = 0;
|
||||
switch (argument) {
|
||||
case 24: {
|
||||
if (remainingDataLength > 0) {
|
||||
output = view.getUint8(0);
|
||||
bytes = 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 25: {
|
||||
if (remainingDataLength > 1) {
|
||||
output = view.getUint16(0, false);
|
||||
bytes = 3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
if (remainingDataLength > 3) {
|
||||
output = view.getUint32(0, false);
|
||||
bytes = 5;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 27: {
|
||||
if (remainingDataLength > 7) {
|
||||
const bigOutput = view.getBigUint64(0, false);
|
||||
// Bound it to [24, MAX_SAFE_INTEGER], where it is safe
|
||||
// to encode as a javascript number
|
||||
if (bigOutput >= 24n && bigOutput <= Number.MAX_SAFE_INTEGER) {
|
||||
return [Number(bigOutput), 9];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (output && output >= 24) {
|
||||
return [output, bytes];
|
||||
}
|
||||
throw new Error("Length not supported or not well formed");
|
||||
}
|
||||
export const MAJOR_TYPE_UNSIGNED_INTEGER = 0;
|
||||
export const MAJOR_TYPE_NEGATIVE_INTEGER = 1;
|
||||
export const MAJOR_TYPE_BYTE_STRING = 2;
|
||||
export const MAJOR_TYPE_TEXT_STRING = 3;
|
||||
export const MAJOR_TYPE_ARRAY = 4;
|
||||
export const MAJOR_TYPE_MAP = 5;
|
||||
export const MAJOR_TYPE_TAG = 6;
|
||||
export const MAJOR_TYPE_SIMPLE_OR_FLOAT = 7;
|
||||
export function encodeLength(major, argument) {
|
||||
const majorEncoded = major << 5;
|
||||
if (argument < 0) {
|
||||
throw new Error("CBOR Data Item argument must not be negative");
|
||||
}
|
||||
// Convert to bigint first.
|
||||
// Encode integers around and above 32 bits in big endian / network byte order
|
||||
// is unreliable in javascript.
|
||||
// https://tc39.es/ecma262/#sec-bitwise-shift-operators
|
||||
// Bit shifting operations result in 32 bit signed numbers
|
||||
let bigintArgument;
|
||||
if (typeof argument == "number") {
|
||||
if (!Number.isInteger(argument)) {
|
||||
throw new Error("CBOR Data Item argument must be an integer");
|
||||
}
|
||||
bigintArgument = BigInt(argument);
|
||||
}
|
||||
else {
|
||||
bigintArgument = argument;
|
||||
}
|
||||
// Negative 0 is not a thing
|
||||
if (major == MAJOR_TYPE_NEGATIVE_INTEGER) {
|
||||
if (bigintArgument == 0n) {
|
||||
throw new Error("CBOR Data Item argument cannot be zero when negative");
|
||||
}
|
||||
bigintArgument = bigintArgument - 1n;
|
||||
}
|
||||
if (bigintArgument > 18446744073709551615n) {
|
||||
throw new Error("CBOR number out of range");
|
||||
}
|
||||
// Encode into 64 bits and extract the tail
|
||||
const buffer = new Uint8Array(8);
|
||||
const view = new DataView(buffer.buffer);
|
||||
view.setBigUint64(0, bigintArgument, false);
|
||||
if (bigintArgument <= 23) {
|
||||
return [majorEncoded | buffer[7]];
|
||||
}
|
||||
else if (bigintArgument <= 255) {
|
||||
return [majorEncoded | 24, buffer[7]];
|
||||
}
|
||||
else if (bigintArgument <= 65535) {
|
||||
return [majorEncoded | 25, ...buffer.slice(6)];
|
||||
}
|
||||
else if (bigintArgument <= 4294967295) {
|
||||
return [
|
||||
majorEncoded | 26,
|
||||
...buffer.slice(4),
|
||||
];
|
||||
}
|
||||
else {
|
||||
return [
|
||||
majorEncoded | 27,
|
||||
...buffer,
|
||||
];
|
||||
}
|
||||
}
|
||||
2
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/index.d.ts
generated
vendored
2
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/index.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
export { CBORTag, decodeCBOR, decodePartialCBOR, encodeCBOR, } from "./cbor/cbor.js";
|
||||
export type { CBORType } from "./cbor/cbor.js";
|
||||
1
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/index.js
generated
vendored
1
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/index.js
generated
vendored
@@ -1 +0,0 @@
|
||||
export { CBORTag, decodeCBOR, decodePartialCBOR, encodeCBOR, } from "./cbor/cbor.js";
|
||||
3
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/package.json
generated
vendored
3
api.hyungi.net/node_modules/@levischuck/tiny-cbor/esm/package.json
generated
vendored
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
25
api.hyungi.net/node_modules/@levischuck/tiny-cbor/package.json
generated
vendored
25
api.hyungi.net/node_modules/@levischuck/tiny-cbor/package.json
generated
vendored
@@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "@levischuck/tiny-cbor",
|
||||
"version": "0.2.11",
|
||||
"description": "Tiny CBOR library",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/levischuck/tiny-cbor.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/levischuck/tiny-cbor/issues"
|
||||
},
|
||||
"main": "./script/index.js",
|
||||
"module": "./esm/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./esm/index.js",
|
||||
"require": "./script/index.js"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.9.0"
|
||||
},
|
||||
"_generatedBy": "dnt@0.40.0"
|
||||
}
|
||||
101
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/cbor/cbor.d.ts
generated
vendored
101
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/cbor/cbor.d.ts
generated
vendored
@@ -1,101 +0,0 @@
|
||||
/**
|
||||
* A value which is wrapped with a CBOR Tag.
|
||||
* Several tags are registered with defined meanings like 0 for a date string.
|
||||
* These meanings are **not interpreted** when decoded or encoded.
|
||||
*
|
||||
* This class is an immutable record.
|
||||
* If the tag number or value needs to change, then construct a new tag
|
||||
*/
|
||||
export declare class CBORTag {
|
||||
private tagId;
|
||||
private tagValue;
|
||||
/**
|
||||
* Wrap a value with a tag number.
|
||||
* When encoded, this tag will be attached to the value.
|
||||
*
|
||||
* @param tag Tag number
|
||||
* @param value Wrapped value
|
||||
*/
|
||||
constructor(tag: number, value: CBORType);
|
||||
/**
|
||||
* Read the tag number
|
||||
*/
|
||||
get tag(): number;
|
||||
/**
|
||||
* Read the value
|
||||
*/
|
||||
get value(): CBORType;
|
||||
}
|
||||
/**
|
||||
* Supported types which are encodable and decodable with tiny CBOR.
|
||||
* Note that plain javascript objects are omitted.
|
||||
*/
|
||||
export type CBORType = number | bigint | string | Uint8Array | boolean | null | undefined | CBORType[] | CBORTag | Map<string | number, CBORType>;
|
||||
/**
|
||||
* Like {decodeCBOR}, but the length of the data is unknown and there is likely
|
||||
* more -- possibly unrelated non-CBOR -- data afterwards.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* ```ts
|
||||
* import {decodePartialCBOR} from './cbor.ts'
|
||||
* decodePartialCBOR(new Uint8Array([1, 2, 245, 3, 4]), 2)
|
||||
* // returns [true, 1]
|
||||
* // It did not decode the leading [1, 2] or trailing [3, 4]
|
||||
* ```
|
||||
*
|
||||
* @param data a data stream to read data from
|
||||
* @param index where to start reading in the data stream
|
||||
* @returns a tuple of the value followed by bytes read.
|
||||
* @throws {Error}
|
||||
* When the data stream ends early or the CBOR data is not well formed
|
||||
*/
|
||||
export declare function decodePartialCBOR(data: DataView | Uint8Array | ArrayBuffer, index: number): [CBORType, number];
|
||||
/**
|
||||
* Decode CBOR data from a binary stream
|
||||
*
|
||||
* The entire data stream from [0, length) will be consumed.
|
||||
* If you require a partial decoding, see {decodePartialCBOR}.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* ```ts
|
||||
* import {decodeCBOR, CBORTag, CBORType} from './cbor.ts'
|
||||
* decodeCBOR(new Uint8Array([162, 99, 107, 101, 121, 101, 118, 97, 108, 117, 101, 1, 109, 97, 110, 111, 116, 104, 101, 114, 32, 118, 97, 108, 117, 101]));
|
||||
* // returns new Map<string | number, CBORType>([
|
||||
* // ["key", "value"],
|
||||
* // [1, "another value"]
|
||||
* // ]);
|
||||
*
|
||||
* const taggedItem = new Uint8Array([217, 4, 210, 101, 104, 101, 108, 108, 111]);
|
||||
* decodeCBOR(new DataView(taggedItem.buffer))
|
||||
* // returns new CBORTag(1234, "hello")
|
||||
* ```
|
||||
*
|
||||
* @param data a data stream, multiple types are supported
|
||||
* @returns
|
||||
*/
|
||||
export declare function decodeCBOR(data: DataView | Uint8Array | ArrayBuffer): CBORType;
|
||||
/**
|
||||
* Encode a supported structure to a CBOR byte string.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```ts
|
||||
* import {encodeCBOR, CBORType, CBORTag} from './cbor.ts'
|
||||
* encodeCBOR(new Map<string | number, CBORType>([
|
||||
* ["key", "value"],
|
||||
* [1, "another value"]
|
||||
* ]));
|
||||
* // returns new Uint8Array([162, 99, 107, 101, 121, 101, 118, 97, 108, 117, 101, 1, 109, 97, 110, 111, 116, 104, 101, 114, 32 118, 97, 108, 117, 101])
|
||||
*
|
||||
* encodeCBOR(new CBORTag(1234, "hello"))
|
||||
* // returns new UInt8Array([217, 4, 210, 101, 104, 101, 108, 108, 111])
|
||||
* ```
|
||||
*
|
||||
* @param data Data to encode
|
||||
* @returns A byte string as a Uint8Array
|
||||
* @throws Error
|
||||
* if unsupported data is found during encoding
|
||||
*/
|
||||
export declare function encodeCBOR(data: CBORType): Uint8Array;
|
||||
447
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/cbor/cbor.js
generated
vendored
447
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/cbor/cbor.js
generated
vendored
@@ -1,447 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.encodeCBOR = exports.decodeCBOR = exports.decodePartialCBOR = exports.CBORTag = void 0;
|
||||
const cbor_internal_js_1 = require("./cbor_internal.js");
|
||||
/**
|
||||
* A value which is wrapped with a CBOR Tag.
|
||||
* Several tags are registered with defined meanings like 0 for a date string.
|
||||
* These meanings are **not interpreted** when decoded or encoded.
|
||||
*
|
||||
* This class is an immutable record.
|
||||
* If the tag number or value needs to change, then construct a new tag
|
||||
*/
|
||||
class CBORTag {
|
||||
/**
|
||||
* Wrap a value with a tag number.
|
||||
* When encoded, this tag will be attached to the value.
|
||||
*
|
||||
* @param tag Tag number
|
||||
* @param value Wrapped value
|
||||
*/
|
||||
constructor(tag, value) {
|
||||
Object.defineProperty(this, "tagId", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
Object.defineProperty(this, "tagValue", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
this.tagId = tag;
|
||||
this.tagValue = value;
|
||||
}
|
||||
/**
|
||||
* Read the tag number
|
||||
*/
|
||||
get tag() {
|
||||
return this.tagId;
|
||||
}
|
||||
/**
|
||||
* Read the value
|
||||
*/
|
||||
get value() {
|
||||
return this.tagValue;
|
||||
}
|
||||
}
|
||||
exports.CBORTag = CBORTag;
|
||||
function decodeUnsignedInteger(data, argument, index) {
|
||||
return (0, cbor_internal_js_1.decodeLength)(data, argument, index);
|
||||
}
|
||||
function decodeNegativeInteger(data, argument, index) {
|
||||
const [value, length] = decodeUnsignedInteger(data, argument, index);
|
||||
return [-value - 1, length];
|
||||
}
|
||||
function decodeByteString(data, argument, index) {
|
||||
const [lengthValue, lengthConsumed] = (0, cbor_internal_js_1.decodeLength)(data, argument, index);
|
||||
const dataStartIndex = index + lengthConsumed;
|
||||
return [
|
||||
new Uint8Array(data.buffer.slice(dataStartIndex, dataStartIndex + lengthValue)),
|
||||
lengthConsumed + lengthValue,
|
||||
];
|
||||
}
|
||||
const TEXT_DECODER = new TextDecoder();
|
||||
function decodeString(data, argument, index) {
|
||||
const [value, length] = decodeByteString(data, argument, index);
|
||||
return [TEXT_DECODER.decode(value), length];
|
||||
}
|
||||
function decodeArray(data, argument, index) {
|
||||
if (argument === 0) {
|
||||
return [[], 1];
|
||||
}
|
||||
const [length, lengthConsumed] = (0, cbor_internal_js_1.decodeLength)(data, argument, index);
|
||||
let consumedLength = lengthConsumed;
|
||||
const value = [];
|
||||
for (let i = 0; i < length; i++) {
|
||||
const remainingDataLength = data.byteLength - index - consumedLength;
|
||||
if (remainingDataLength <= 0) {
|
||||
throw new Error("array is not supported or well formed");
|
||||
}
|
||||
const [decodedValue, consumed] = decodeNext(data, index + consumedLength);
|
||||
value.push(decodedValue);
|
||||
consumedLength += consumed;
|
||||
}
|
||||
return [value, consumedLength];
|
||||
}
|
||||
const MAP_ERROR = "Map is not supported or well formed";
|
||||
function decodeMap(data, argument, index) {
|
||||
if (argument === 0) {
|
||||
return [new Map(), 1];
|
||||
}
|
||||
const [length, lengthConsumed] = (0, cbor_internal_js_1.decodeLength)(data, argument, index);
|
||||
let consumedLength = lengthConsumed;
|
||||
const result = new Map();
|
||||
for (let i = 0; i < length; i++) {
|
||||
let remainingDataLength = data.byteLength - index - consumedLength;
|
||||
if (remainingDataLength <= 0) {
|
||||
throw new Error(MAP_ERROR);
|
||||
}
|
||||
// Load key
|
||||
const [key, keyConsumed] = decodeNext(data, index + consumedLength);
|
||||
consumedLength += keyConsumed;
|
||||
remainingDataLength -= keyConsumed;
|
||||
// Check that there's enough to have a value
|
||||
if (remainingDataLength <= 0) {
|
||||
throw new Error(MAP_ERROR);
|
||||
}
|
||||
// Technically CBOR maps can have any type as the key, and so can JS Maps
|
||||
// However, JS Maps can only reference such keys as references which would
|
||||
// require key iteration and pattern matching.
|
||||
// For simplicity, since such keys are not in use with WebAuthn, this
|
||||
// capability is not implemented and the types are restricted to strings
|
||||
// and numbers.
|
||||
if (typeof key !== "string" && typeof key !== "number") {
|
||||
throw new Error(MAP_ERROR);
|
||||
}
|
||||
// CBOR Maps are not well formed if there are duplicate keys
|
||||
if (result.has(key)) {
|
||||
throw new Error(MAP_ERROR);
|
||||
}
|
||||
// Load value
|
||||
const [value, valueConsumed] = decodeNext(data, index + consumedLength);
|
||||
consumedLength += valueConsumed;
|
||||
result.set(key, value);
|
||||
}
|
||||
return [result, consumedLength];
|
||||
}
|
||||
function decodeFloat16(data, index) {
|
||||
if (index + 3 > data.byteLength) {
|
||||
throw new Error("CBOR stream ended before end of Float 16");
|
||||
}
|
||||
// Skip the first byte
|
||||
const result = data.getUint16(index + 1, false);
|
||||
// A minimal selection of supported values
|
||||
if (result == 0x7c00) {
|
||||
return [Infinity, 3];
|
||||
}
|
||||
else if (result == 0x7e00) {
|
||||
return [NaN, 3];
|
||||
}
|
||||
else if (result == 0xfc00) {
|
||||
return [-Infinity, 3];
|
||||
}
|
||||
throw new Error("Float16 data is unsupported");
|
||||
}
|
||||
function decodeFloat32(data, index) {
|
||||
if (index + 5 > data.byteLength) {
|
||||
throw new Error("CBOR stream ended before end of Float 32");
|
||||
}
|
||||
// Skip the first byte
|
||||
const result = data.getFloat32(index + 1, false);
|
||||
// First byte + 4 byte float
|
||||
return [result, 5];
|
||||
}
|
||||
function decodeFloat64(data, index) {
|
||||
if (index + 9 > data.byteLength) {
|
||||
throw new Error("CBOR stream ended before end of Float 64");
|
||||
}
|
||||
// Skip the first byte
|
||||
const result = data.getFloat64(index + 1, false);
|
||||
// First byte + 8 byte float
|
||||
return [result, 9];
|
||||
}
|
||||
function decodeTag(data, argument, index) {
|
||||
const [tag, tagBytes] = (0, cbor_internal_js_1.decodeLength)(data, argument, index);
|
||||
const [value, valueBytes] = decodeNext(data, index + tagBytes);
|
||||
return [new CBORTag(tag, value), tagBytes + valueBytes];
|
||||
}
|
||||
function decodeNext(data, index) {
|
||||
if (index >= data.byteLength) {
|
||||
throw new Error("CBOR stream ended before tag value");
|
||||
}
|
||||
const byte = data.getUint8(index);
|
||||
const majorType = byte >> 5;
|
||||
const argument = byte & 0x1f;
|
||||
switch (majorType) {
|
||||
case cbor_internal_js_1.MAJOR_TYPE_UNSIGNED_INTEGER: {
|
||||
return decodeUnsignedInteger(data, argument, index);
|
||||
}
|
||||
case cbor_internal_js_1.MAJOR_TYPE_NEGATIVE_INTEGER: {
|
||||
return decodeNegativeInteger(data, argument, index);
|
||||
}
|
||||
case cbor_internal_js_1.MAJOR_TYPE_BYTE_STRING: {
|
||||
return decodeByteString(data, argument, index);
|
||||
}
|
||||
case cbor_internal_js_1.MAJOR_TYPE_TEXT_STRING: {
|
||||
return decodeString(data, argument, index);
|
||||
}
|
||||
case cbor_internal_js_1.MAJOR_TYPE_ARRAY: {
|
||||
return decodeArray(data, argument, index);
|
||||
}
|
||||
case cbor_internal_js_1.MAJOR_TYPE_MAP: {
|
||||
return decodeMap(data, argument, index);
|
||||
}
|
||||
case cbor_internal_js_1.MAJOR_TYPE_TAG: {
|
||||
return decodeTag(data, argument, index);
|
||||
}
|
||||
case cbor_internal_js_1.MAJOR_TYPE_SIMPLE_OR_FLOAT: {
|
||||
switch (argument) {
|
||||
case 20:
|
||||
return [false, 1];
|
||||
case 21:
|
||||
return [true, 1];
|
||||
case 22:
|
||||
return [null, 1];
|
||||
case 23:
|
||||
return [undefined, 1];
|
||||
// 24: Simple value (value 32..255 in following byte)
|
||||
case 25: // IEEE 754 Half-Precision Float (16 bits follow)
|
||||
return decodeFloat16(data, index);
|
||||
case 26: // IEEE 754 Single-Precision Float (32 bits follow)
|
||||
return decodeFloat32(data, index);
|
||||
case 27: // IEEE 754 Double-Precision Float (64 bits follow)
|
||||
return decodeFloat64(data, index);
|
||||
// 28-30: Reserved, not well-formed in the present document
|
||||
// 31: "break" stop code for indefinite-length items
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new Error(`Unsupported or not well formed at ${index}`);
|
||||
}
|
||||
function encodeSimple(data) {
|
||||
if (data === true) {
|
||||
return 0xf5;
|
||||
}
|
||||
else if (data === false) {
|
||||
return 0xf4;
|
||||
}
|
||||
else if (data === null) {
|
||||
return 0xf6;
|
||||
}
|
||||
// Else undefined
|
||||
return 0xf7;
|
||||
}
|
||||
function encodeFloat(data) {
|
||||
if (Math.fround(data) == data || !Number.isFinite(data) || Number.isNaN(data)) {
|
||||
// Float32
|
||||
const output = new Uint8Array(5);
|
||||
output[0] = 0xfa;
|
||||
const view = new DataView(output.buffer);
|
||||
view.setFloat32(1, data, false);
|
||||
return output;
|
||||
}
|
||||
else {
|
||||
// Float64
|
||||
const output = new Uint8Array(9);
|
||||
output[0] = 0xfb;
|
||||
const view = new DataView(output.buffer);
|
||||
view.setFloat64(1, data, false);
|
||||
return output;
|
||||
}
|
||||
}
|
||||
function encodeNumber(data) {
|
||||
if (typeof data == "number") {
|
||||
if (Number.isSafeInteger(data)) {
|
||||
// Encode integer
|
||||
if (data < 0) {
|
||||
return (0, cbor_internal_js_1.encodeLength)(cbor_internal_js_1.MAJOR_TYPE_NEGATIVE_INTEGER, Math.abs(data));
|
||||
}
|
||||
else {
|
||||
return (0, cbor_internal_js_1.encodeLength)(cbor_internal_js_1.MAJOR_TYPE_UNSIGNED_INTEGER, data);
|
||||
}
|
||||
}
|
||||
return [encodeFloat(data)];
|
||||
}
|
||||
else {
|
||||
if (data < 0n) {
|
||||
return (0, cbor_internal_js_1.encodeLength)(cbor_internal_js_1.MAJOR_TYPE_NEGATIVE_INTEGER, data * -1n);
|
||||
}
|
||||
else {
|
||||
return (0, cbor_internal_js_1.encodeLength)(cbor_internal_js_1.MAJOR_TYPE_UNSIGNED_INTEGER, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
const ENCODER = new TextEncoder();
|
||||
function encodeString(data, output) {
|
||||
output.push(...(0, cbor_internal_js_1.encodeLength)(cbor_internal_js_1.MAJOR_TYPE_TEXT_STRING, data.length));
|
||||
output.push(ENCODER.encode(data));
|
||||
}
|
||||
function encodeBytes(data, output) {
|
||||
output.push(...(0, cbor_internal_js_1.encodeLength)(cbor_internal_js_1.MAJOR_TYPE_BYTE_STRING, data.length));
|
||||
output.push(data);
|
||||
}
|
||||
function encodeArray(data, output) {
|
||||
output.push(...(0, cbor_internal_js_1.encodeLength)(cbor_internal_js_1.MAJOR_TYPE_ARRAY, data.length));
|
||||
for (const element of data) {
|
||||
encodePartialCBOR(element, output);
|
||||
}
|
||||
}
|
||||
function encodeMap(data, output) {
|
||||
output.push(new Uint8Array((0, cbor_internal_js_1.encodeLength)(cbor_internal_js_1.MAJOR_TYPE_MAP, data.size)));
|
||||
for (const [key, value] of data.entries()) {
|
||||
encodePartialCBOR(key, output);
|
||||
encodePartialCBOR(value, output);
|
||||
}
|
||||
}
|
||||
function encodeTag(tag, output) {
|
||||
output.push(...(0, cbor_internal_js_1.encodeLength)(cbor_internal_js_1.MAJOR_TYPE_TAG, tag.tag));
|
||||
encodePartialCBOR(tag.value, output);
|
||||
}
|
||||
function encodePartialCBOR(data, output) {
|
||||
if (typeof data == "boolean" || data === null || data == undefined) {
|
||||
output.push(encodeSimple(data));
|
||||
return;
|
||||
}
|
||||
if (typeof data == "number" || typeof data == "bigint") {
|
||||
output.push(...encodeNumber(data));
|
||||
return;
|
||||
}
|
||||
if (typeof data == "string") {
|
||||
encodeString(data, output);
|
||||
return;
|
||||
}
|
||||
if (data instanceof Uint8Array) {
|
||||
encodeBytes(data, output);
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(data)) {
|
||||
encodeArray(data, output);
|
||||
return;
|
||||
}
|
||||
if (data instanceof Map) {
|
||||
encodeMap(data, output);
|
||||
return;
|
||||
}
|
||||
if (data instanceof CBORTag) {
|
||||
encodeTag(data, output);
|
||||
return;
|
||||
}
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
/**
|
||||
* Like {decodeCBOR}, but the length of the data is unknown and there is likely
|
||||
* more -- possibly unrelated non-CBOR -- data afterwards.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* ```ts
|
||||
* import {decodePartialCBOR} from './cbor.ts'
|
||||
* decodePartialCBOR(new Uint8Array([1, 2, 245, 3, 4]), 2)
|
||||
* // returns [true, 1]
|
||||
* // It did not decode the leading [1, 2] or trailing [3, 4]
|
||||
* ```
|
||||
*
|
||||
* @param data a data stream to read data from
|
||||
* @param index where to start reading in the data stream
|
||||
* @returns a tuple of the value followed by bytes read.
|
||||
* @throws {Error}
|
||||
* When the data stream ends early or the CBOR data is not well formed
|
||||
*/
|
||||
function decodePartialCBOR(data, index) {
|
||||
if (data.byteLength === 0 || data.byteLength <= index || index < 0) {
|
||||
throw new Error("No data");
|
||||
}
|
||||
if (data instanceof Uint8Array) {
|
||||
return decodeNext(new DataView(data.buffer), index);
|
||||
}
|
||||
else if (data instanceof ArrayBuffer) {
|
||||
return decodeNext(new DataView(data), index);
|
||||
}
|
||||
// otherwise, it is a data view
|
||||
return decodeNext(data, index);
|
||||
}
|
||||
exports.decodePartialCBOR = decodePartialCBOR;
|
||||
/**
|
||||
* Decode CBOR data from a binary stream
|
||||
*
|
||||
* The entire data stream from [0, length) will be consumed.
|
||||
* If you require a partial decoding, see {decodePartialCBOR}.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* ```ts
|
||||
* import {decodeCBOR, CBORTag, CBORType} from './cbor.ts'
|
||||
* decodeCBOR(new Uint8Array([162, 99, 107, 101, 121, 101, 118, 97, 108, 117, 101, 1, 109, 97, 110, 111, 116, 104, 101, 114, 32, 118, 97, 108, 117, 101]));
|
||||
* // returns new Map<string | number, CBORType>([
|
||||
* // ["key", "value"],
|
||||
* // [1, "another value"]
|
||||
* // ]);
|
||||
*
|
||||
* const taggedItem = new Uint8Array([217, 4, 210, 101, 104, 101, 108, 108, 111]);
|
||||
* decodeCBOR(new DataView(taggedItem.buffer))
|
||||
* // returns new CBORTag(1234, "hello")
|
||||
* ```
|
||||
*
|
||||
* @param data a data stream, multiple types are supported
|
||||
* @returns
|
||||
*/
|
||||
function decodeCBOR(data) {
|
||||
const [value, length] = decodePartialCBOR(data, 0);
|
||||
if (length !== data.byteLength) {
|
||||
throw new Error(`Data was decoded, but the whole stream was not processed ${length} != ${data.byteLength}`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
exports.decodeCBOR = decodeCBOR;
|
||||
/**
|
||||
* Encode a supported structure to a CBOR byte string.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```ts
|
||||
* import {encodeCBOR, CBORType, CBORTag} from './cbor.ts'
|
||||
* encodeCBOR(new Map<string | number, CBORType>([
|
||||
* ["key", "value"],
|
||||
* [1, "another value"]
|
||||
* ]));
|
||||
* // returns new Uint8Array([162, 99, 107, 101, 121, 101, 118, 97, 108, 117, 101, 1, 109, 97, 110, 111, 116, 104, 101, 114, 32 118, 97, 108, 117, 101])
|
||||
*
|
||||
* encodeCBOR(new CBORTag(1234, "hello"))
|
||||
* // returns new UInt8Array([217, 4, 210, 101, 104, 101, 108, 108, 111])
|
||||
* ```
|
||||
*
|
||||
* @param data Data to encode
|
||||
* @returns A byte string as a Uint8Array
|
||||
* @throws Error
|
||||
* if unsupported data is found during encoding
|
||||
*/
|
||||
function encodeCBOR(data) {
|
||||
const results = [];
|
||||
encodePartialCBOR(data, results);
|
||||
let length = 0;
|
||||
for (const result of results) {
|
||||
if (typeof result == "number") {
|
||||
length += 1;
|
||||
}
|
||||
else {
|
||||
length += result.length;
|
||||
}
|
||||
}
|
||||
const output = new Uint8Array(length);
|
||||
let index = 0;
|
||||
for (const result of results) {
|
||||
if (typeof result == "number") {
|
||||
output[index] = result;
|
||||
index += 1;
|
||||
}
|
||||
else {
|
||||
output.set(result, index);
|
||||
index += result.length;
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
exports.encodeCBOR = encodeCBOR;
|
||||
11
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/cbor/cbor_internal.d.ts
generated
vendored
11
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/cbor/cbor_internal.d.ts
generated
vendored
@@ -1,11 +0,0 @@
|
||||
export declare function decodeLength(data: DataView, argument: number, index: number): [number, number];
|
||||
export type MajorType = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
||||
export declare const MAJOR_TYPE_UNSIGNED_INTEGER: MajorType;
|
||||
export declare const MAJOR_TYPE_NEGATIVE_INTEGER: MajorType;
|
||||
export declare const MAJOR_TYPE_BYTE_STRING: MajorType;
|
||||
export declare const MAJOR_TYPE_TEXT_STRING: MajorType;
|
||||
export declare const MAJOR_TYPE_ARRAY: MajorType;
|
||||
export declare const MAJOR_TYPE_MAP: MajorType;
|
||||
export declare const MAJOR_TYPE_TAG: MajorType;
|
||||
export declare const MAJOR_TYPE_SIMPLE_OR_FLOAT: MajorType;
|
||||
export declare function encodeLength(major: MajorType, argument: number | bigint): number[];
|
||||
116
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/cbor/cbor_internal.js
generated
vendored
116
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/cbor/cbor_internal.js
generated
vendored
@@ -1,116 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.encodeLength = exports.MAJOR_TYPE_SIMPLE_OR_FLOAT = exports.MAJOR_TYPE_TAG = exports.MAJOR_TYPE_MAP = exports.MAJOR_TYPE_ARRAY = exports.MAJOR_TYPE_TEXT_STRING = exports.MAJOR_TYPE_BYTE_STRING = exports.MAJOR_TYPE_NEGATIVE_INTEGER = exports.MAJOR_TYPE_UNSIGNED_INTEGER = exports.decodeLength = void 0;
|
||||
function decodeLength(data, argument, index) {
|
||||
if (argument < 24) {
|
||||
return [argument, 1];
|
||||
}
|
||||
const remainingDataLength = data.byteLength - index - 1;
|
||||
const view = new DataView(data.buffer, index + 1);
|
||||
let output;
|
||||
let bytes = 0;
|
||||
switch (argument) {
|
||||
case 24: {
|
||||
if (remainingDataLength > 0) {
|
||||
output = view.getUint8(0);
|
||||
bytes = 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 25: {
|
||||
if (remainingDataLength > 1) {
|
||||
output = view.getUint16(0, false);
|
||||
bytes = 3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
if (remainingDataLength > 3) {
|
||||
output = view.getUint32(0, false);
|
||||
bytes = 5;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 27: {
|
||||
if (remainingDataLength > 7) {
|
||||
const bigOutput = view.getBigUint64(0, false);
|
||||
// Bound it to [24, MAX_SAFE_INTEGER], where it is safe
|
||||
// to encode as a javascript number
|
||||
if (bigOutput >= 24n && bigOutput <= Number.MAX_SAFE_INTEGER) {
|
||||
return [Number(bigOutput), 9];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (output && output >= 24) {
|
||||
return [output, bytes];
|
||||
}
|
||||
throw new Error("Length not supported or not well formed");
|
||||
}
|
||||
exports.decodeLength = decodeLength;
|
||||
exports.MAJOR_TYPE_UNSIGNED_INTEGER = 0;
|
||||
exports.MAJOR_TYPE_NEGATIVE_INTEGER = 1;
|
||||
exports.MAJOR_TYPE_BYTE_STRING = 2;
|
||||
exports.MAJOR_TYPE_TEXT_STRING = 3;
|
||||
exports.MAJOR_TYPE_ARRAY = 4;
|
||||
exports.MAJOR_TYPE_MAP = 5;
|
||||
exports.MAJOR_TYPE_TAG = 6;
|
||||
exports.MAJOR_TYPE_SIMPLE_OR_FLOAT = 7;
|
||||
function encodeLength(major, argument) {
|
||||
const majorEncoded = major << 5;
|
||||
if (argument < 0) {
|
||||
throw new Error("CBOR Data Item argument must not be negative");
|
||||
}
|
||||
// Convert to bigint first.
|
||||
// Encode integers around and above 32 bits in big endian / network byte order
|
||||
// is unreliable in javascript.
|
||||
// https://tc39.es/ecma262/#sec-bitwise-shift-operators
|
||||
// Bit shifting operations result in 32 bit signed numbers
|
||||
let bigintArgument;
|
||||
if (typeof argument == "number") {
|
||||
if (!Number.isInteger(argument)) {
|
||||
throw new Error("CBOR Data Item argument must be an integer");
|
||||
}
|
||||
bigintArgument = BigInt(argument);
|
||||
}
|
||||
else {
|
||||
bigintArgument = argument;
|
||||
}
|
||||
// Negative 0 is not a thing
|
||||
if (major == exports.MAJOR_TYPE_NEGATIVE_INTEGER) {
|
||||
if (bigintArgument == 0n) {
|
||||
throw new Error("CBOR Data Item argument cannot be zero when negative");
|
||||
}
|
||||
bigintArgument = bigintArgument - 1n;
|
||||
}
|
||||
if (bigintArgument > 18446744073709551615n) {
|
||||
throw new Error("CBOR number out of range");
|
||||
}
|
||||
// Encode into 64 bits and extract the tail
|
||||
const buffer = new Uint8Array(8);
|
||||
const view = new DataView(buffer.buffer);
|
||||
view.setBigUint64(0, bigintArgument, false);
|
||||
if (bigintArgument <= 23) {
|
||||
return [majorEncoded | buffer[7]];
|
||||
}
|
||||
else if (bigintArgument <= 255) {
|
||||
return [majorEncoded | 24, buffer[7]];
|
||||
}
|
||||
else if (bigintArgument <= 65535) {
|
||||
return [majorEncoded | 25, ...buffer.slice(6)];
|
||||
}
|
||||
else if (bigintArgument <= 4294967295) {
|
||||
return [
|
||||
majorEncoded | 26,
|
||||
...buffer.slice(4),
|
||||
];
|
||||
}
|
||||
else {
|
||||
return [
|
||||
majorEncoded | 27,
|
||||
...buffer,
|
||||
];
|
||||
}
|
||||
}
|
||||
exports.encodeLength = encodeLength;
|
||||
2
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/index.d.ts
generated
vendored
2
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/index.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
export { CBORTag, decodeCBOR, decodePartialCBOR, encodeCBOR, } from "./cbor/cbor.js";
|
||||
export type { CBORType } from "./cbor/cbor.js";
|
||||
8
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/index.js
generated
vendored
8
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/index.js
generated
vendored
@@ -1,8 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.encodeCBOR = exports.decodePartialCBOR = exports.decodeCBOR = exports.CBORTag = void 0;
|
||||
var cbor_js_1 = require("./cbor/cbor.js");
|
||||
Object.defineProperty(exports, "CBORTag", { enumerable: true, get: function () { return cbor_js_1.CBORTag; } });
|
||||
Object.defineProperty(exports, "decodeCBOR", { enumerable: true, get: function () { return cbor_js_1.decodeCBOR; } });
|
||||
Object.defineProperty(exports, "decodePartialCBOR", { enumerable: true, get: function () { return cbor_js_1.decodePartialCBOR; } });
|
||||
Object.defineProperty(exports, "encodeCBOR", { enumerable: true, get: function () { return cbor_js_1.encodeCBOR; } });
|
||||
3
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/package.json
generated
vendored
3
api.hyungi.net/node_modules/@levischuck/tiny-cbor/script/package.json
generated
vendored
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
20
api.hyungi.net/node_modules/@npmcli/fs/LICENSE.md
generated
vendored
20
api.hyungi.net/node_modules/@npmcli/fs/LICENSE.md
generated
vendored
@@ -1,20 +0,0 @@
|
||||
<!-- This file is automatically added by @npmcli/template-oss. Do not edit. -->
|
||||
|
||||
ISC License
|
||||
|
||||
Copyright npm, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this
|
||||
software for any purpose with or without fee is hereby
|
||||
granted, provided that the above copyright notice and this
|
||||
permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
|
||||
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
60
api.hyungi.net/node_modules/@npmcli/fs/README.md
generated
vendored
60
api.hyungi.net/node_modules/@npmcli/fs/README.md
generated
vendored
@@ -1,60 +0,0 @@
|
||||
# @npmcli/fs
|
||||
|
||||
polyfills, and extensions, of the core `fs` module.
|
||||
|
||||
## Features
|
||||
|
||||
- all exposed functions return promises
|
||||
- `fs.rm` polyfill for node versions < 14.14.0
|
||||
- `fs.mkdir` polyfill adding support for the `recursive` and `force` options in node versions < 10.12.0
|
||||
- `fs.copyFile` extended to accept an `owner` option
|
||||
- `fs.mkdir` extended to accept an `owner` option
|
||||
- `fs.mkdtemp` extended to accept an `owner` option
|
||||
- `fs.writeFile` extended to accept an `owner` option
|
||||
- `fs.withTempDir` added
|
||||
- `fs.cp` polyfill for node < 16.7.0
|
||||
|
||||
## The `owner` option
|
||||
|
||||
The `copyFile`, `mkdir`, `mkdtemp`, `writeFile`, and `withTempDir` functions
|
||||
all accept a new `owner` property in their options. It can be used in two ways:
|
||||
|
||||
- `{ owner: { uid: 100, gid: 100 } }` - set the `uid` and `gid` explicitly
|
||||
- `{ owner: 100 }` - use one value, will set both `uid` and `gid` the same
|
||||
|
||||
The special string `'inherit'` may be passed instead of a number, which will
|
||||
cause this module to automatically determine the correct `uid` and/or `gid`
|
||||
from the nearest existing parent directory of the target.
|
||||
|
||||
## `fs.withTempDir(root, fn, options) -> Promise`
|
||||
|
||||
### Parameters
|
||||
|
||||
- `root`: the directory in which to create the temporary directory
|
||||
- `fn`: a function that will be called with the path to the temporary directory
|
||||
- `options`
|
||||
- `tmpPrefix`: a prefix to be used in the generated directory name
|
||||
|
||||
### Usage
|
||||
|
||||
The `withTempDir` function creates a temporary directory, runs the provided
|
||||
function (`fn`), then removes the temporary directory and resolves or rejects
|
||||
based on the result of `fn`.
|
||||
|
||||
```js
|
||||
const fs = require('@npmcli/fs')
|
||||
const os = require('os')
|
||||
|
||||
// this function will be called with the full path to the temporary directory
|
||||
// it is called with `await` behind the scenes, so can be async if desired.
|
||||
const myFunction = async (tempPath) => {
|
||||
return 'done!'
|
||||
}
|
||||
|
||||
const main = async () => {
|
||||
const result = await fs.withTempDir(os.tmpdir(), myFunction)
|
||||
// result === 'done!'
|
||||
}
|
||||
|
||||
main()
|
||||
```
|
||||
17
api.hyungi.net/node_modules/@npmcli/fs/lib/common/file-url-to-path/index.js
generated
vendored
17
api.hyungi.net/node_modules/@npmcli/fs/lib/common/file-url-to-path/index.js
generated
vendored
@@ -1,17 +0,0 @@
|
||||
const url = require('url')
|
||||
|
||||
const node = require('../node.js')
|
||||
const polyfill = require('./polyfill.js')
|
||||
|
||||
const useNative = node.satisfies('>=10.12.0')
|
||||
|
||||
const fileURLToPath = (path) => {
|
||||
// the polyfill is tested separately from this module, no need to hack
|
||||
// process.version to try to trigger it just for coverage
|
||||
// istanbul ignore next
|
||||
return useNative
|
||||
? url.fileURLToPath(path)
|
||||
: polyfill(path)
|
||||
}
|
||||
|
||||
module.exports = fileURLToPath
|
||||
121
api.hyungi.net/node_modules/@npmcli/fs/lib/common/file-url-to-path/polyfill.js
generated
vendored
121
api.hyungi.net/node_modules/@npmcli/fs/lib/common/file-url-to-path/polyfill.js
generated
vendored
@@ -1,121 +0,0 @@
|
||||
const { URL, domainToUnicode } = require('url')
|
||||
|
||||
const CHAR_LOWERCASE_A = 97
|
||||
const CHAR_LOWERCASE_Z = 122
|
||||
|
||||
const isWindows = process.platform === 'win32'
|
||||
|
||||
class ERR_INVALID_FILE_URL_HOST extends TypeError {
|
||||
constructor (platform) {
|
||||
super(`File URL host must be "localhost" or empty on ${platform}`)
|
||||
this.code = 'ERR_INVALID_FILE_URL_HOST'
|
||||
}
|
||||
|
||||
toString () {
|
||||
return `${this.name} [${this.code}]: ${this.message}`
|
||||
}
|
||||
}
|
||||
|
||||
class ERR_INVALID_FILE_URL_PATH extends TypeError {
|
||||
constructor (msg) {
|
||||
super(`File URL path ${msg}`)
|
||||
this.code = 'ERR_INVALID_FILE_URL_PATH'
|
||||
}
|
||||
|
||||
toString () {
|
||||
return `${this.name} [${this.code}]: ${this.message}`
|
||||
}
|
||||
}
|
||||
|
||||
class ERR_INVALID_ARG_TYPE extends TypeError {
|
||||
constructor (name, actual) {
|
||||
super(`The "${name}" argument must be one of type string or an instance ` +
|
||||
`of URL. Received type ${typeof actual} ${actual}`)
|
||||
this.code = 'ERR_INVALID_ARG_TYPE'
|
||||
}
|
||||
|
||||
toString () {
|
||||
return `${this.name} [${this.code}]: ${this.message}`
|
||||
}
|
||||
}
|
||||
|
||||
class ERR_INVALID_URL_SCHEME extends TypeError {
|
||||
constructor (expected) {
|
||||
super(`The URL must be of scheme ${expected}`)
|
||||
this.code = 'ERR_INVALID_URL_SCHEME'
|
||||
}
|
||||
|
||||
toString () {
|
||||
return `${this.name} [${this.code}]: ${this.message}`
|
||||
}
|
||||
}
|
||||
|
||||
const isURLInstance = (input) => {
|
||||
return input != null && input.href && input.origin
|
||||
}
|
||||
|
||||
const getPathFromURLWin32 = (url) => {
|
||||
const hostname = url.hostname
|
||||
let pathname = url.pathname
|
||||
for (let n = 0; n < pathname.length; n++) {
|
||||
if (pathname[n] === '%') {
|
||||
const third = pathname.codePointAt(n + 2) | 0x20
|
||||
if ((pathname[n + 1] === '2' && third === 102) ||
|
||||
(pathname[n + 1] === '5' && third === 99)) {
|
||||
throw new ERR_INVALID_FILE_URL_PATH('must not include encoded \\ or / characters')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pathname = pathname.replace(/\//g, '\\')
|
||||
pathname = decodeURIComponent(pathname)
|
||||
if (hostname !== '') {
|
||||
return `\\\\${domainToUnicode(hostname)}${pathname}`
|
||||
}
|
||||
|
||||
const letter = pathname.codePointAt(1) | 0x20
|
||||
const sep = pathname[2]
|
||||
if (letter < CHAR_LOWERCASE_A || letter > CHAR_LOWERCASE_Z ||
|
||||
(sep !== ':')) {
|
||||
throw new ERR_INVALID_FILE_URL_PATH('must be absolute')
|
||||
}
|
||||
|
||||
return pathname.slice(1)
|
||||
}
|
||||
|
||||
const getPathFromURLPosix = (url) => {
|
||||
if (url.hostname !== '') {
|
||||
throw new ERR_INVALID_FILE_URL_HOST(process.platform)
|
||||
}
|
||||
|
||||
const pathname = url.pathname
|
||||
|
||||
for (let n = 0; n < pathname.length; n++) {
|
||||
if (pathname[n] === '%') {
|
||||
const third = pathname.codePointAt(n + 2) | 0x20
|
||||
if (pathname[n + 1] === '2' && third === 102) {
|
||||
throw new ERR_INVALID_FILE_URL_PATH('must not include encoded / characters')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return decodeURIComponent(pathname)
|
||||
}
|
||||
|
||||
const fileURLToPath = (path) => {
|
||||
if (typeof path === 'string') {
|
||||
path = new URL(path)
|
||||
} else if (!isURLInstance(path)) {
|
||||
throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path)
|
||||
}
|
||||
|
||||
if (path.protocol !== 'file:') {
|
||||
throw new ERR_INVALID_URL_SCHEME('file')
|
||||
}
|
||||
|
||||
return isWindows
|
||||
? getPathFromURLWin32(path)
|
||||
: getPathFromURLPosix(path)
|
||||
}
|
||||
|
||||
module.exports = fileURLToPath
|
||||
20
api.hyungi.net/node_modules/@npmcli/fs/lib/common/get-options.js
generated
vendored
20
api.hyungi.net/node_modules/@npmcli/fs/lib/common/get-options.js
generated
vendored
@@ -1,20 +0,0 @@
|
||||
// given an input that may or may not be an object, return an object that has
|
||||
// a copy of every defined property listed in 'copy'. if the input is not an
|
||||
// object, assign it to the property named by 'wrap'
|
||||
const getOptions = (input, { copy, wrap }) => {
|
||||
const result = {}
|
||||
|
||||
if (input && typeof input === 'object') {
|
||||
for (const prop of copy) {
|
||||
if (input[prop] !== undefined) {
|
||||
result[prop] = input[prop]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result[wrap] = input
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
module.exports = getOptions
|
||||
9
api.hyungi.net/node_modules/@npmcli/fs/lib/common/node.js
generated
vendored
9
api.hyungi.net/node_modules/@npmcli/fs/lib/common/node.js
generated
vendored
@@ -1,9 +0,0 @@
|
||||
const semver = require('semver')
|
||||
|
||||
const satisfies = (range) => {
|
||||
return semver.satisfies(process.version, range, { includePrerelease: true })
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
satisfies,
|
||||
}
|
||||
92
api.hyungi.net/node_modules/@npmcli/fs/lib/common/owner.js
generated
vendored
92
api.hyungi.net/node_modules/@npmcli/fs/lib/common/owner.js
generated
vendored
@@ -1,92 +0,0 @@
|
||||
const { dirname, resolve } = require('path')
|
||||
|
||||
const fileURLToPath = require('./file-url-to-path/index.js')
|
||||
const fs = require('../fs.js')
|
||||
|
||||
// given a path, find the owner of the nearest parent
|
||||
const find = async (path) => {
|
||||
// if we have no getuid, permissions are irrelevant on this platform
|
||||
if (!process.getuid) {
|
||||
return {}
|
||||
}
|
||||
|
||||
// fs methods accept URL objects with a scheme of file: so we need to unwrap
|
||||
// those into an actual path string before we can resolve it
|
||||
const resolved = path != null && path.href && path.origin
|
||||
? resolve(fileURLToPath(path))
|
||||
: resolve(path)
|
||||
|
||||
let stat
|
||||
|
||||
try {
|
||||
stat = await fs.lstat(resolved)
|
||||
} finally {
|
||||
// if we got a stat, return its contents
|
||||
if (stat) {
|
||||
return { uid: stat.uid, gid: stat.gid }
|
||||
}
|
||||
|
||||
// try the parent directory
|
||||
if (resolved !== dirname(resolved)) {
|
||||
return find(dirname(resolved))
|
||||
}
|
||||
|
||||
// no more parents, never got a stat, just return an empty object
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
// given a path, uid, and gid update the ownership of the path if necessary
|
||||
const update = async (path, uid, gid) => {
|
||||
// nothing to update, just exit
|
||||
if (uid === undefined && gid === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
// see if the permissions are already the same, if they are we don't
|
||||
// need to do anything, so return early
|
||||
const stat = await fs.stat(path)
|
||||
if (uid === stat.uid && gid === stat.gid) {
|
||||
return
|
||||
}
|
||||
} catch (err) {}
|
||||
|
||||
try {
|
||||
await fs.chown(path, uid, gid)
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
// accepts a `path` and the `owner` property of an options object and normalizes
|
||||
// it into an object with numerical `uid` and `gid`
|
||||
const validate = async (path, input) => {
|
||||
let uid
|
||||
let gid
|
||||
|
||||
if (typeof input === 'string' || typeof input === 'number') {
|
||||
uid = input
|
||||
gid = input
|
||||
} else if (input && typeof input === 'object') {
|
||||
uid = input.uid
|
||||
gid = input.gid
|
||||
}
|
||||
|
||||
if (uid === 'inherit' || gid === 'inherit') {
|
||||
const owner = await find(path)
|
||||
if (uid === 'inherit') {
|
||||
uid = owner.uid
|
||||
}
|
||||
|
||||
if (gid === 'inherit') {
|
||||
gid = owner.gid
|
||||
}
|
||||
}
|
||||
|
||||
return { uid, gid }
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
find,
|
||||
update,
|
||||
validate,
|
||||
}
|
||||
22
api.hyungi.net/node_modules/@npmcli/fs/lib/copy-file.js
generated
vendored
22
api.hyungi.net/node_modules/@npmcli/fs/lib/copy-file.js
generated
vendored
@@ -1,22 +0,0 @@
|
||||
const fs = require('./fs.js')
|
||||
const getOptions = require('./common/get-options.js')
|
||||
const owner = require('./common/owner.js')
|
||||
|
||||
const copyFile = async (src, dest, opts) => {
|
||||
const options = getOptions(opts, {
|
||||
copy: ['mode', 'owner'],
|
||||
wrap: 'mode',
|
||||
})
|
||||
|
||||
const { uid, gid } = await owner.validate(dest, options.owner)
|
||||
|
||||
// the node core method as of 16.5.0 does not support the mode being in an
|
||||
// object, so we have to pass the mode value directly
|
||||
const result = await fs.copyFile(src, dest, options.mode)
|
||||
|
||||
await owner.update(dest, uid, gid)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
module.exports = copyFile
|
||||
15
api.hyungi.net/node_modules/@npmcli/fs/lib/cp/LICENSE
generated
vendored
15
api.hyungi.net/node_modules/@npmcli/fs/lib/cp/LICENSE
generated
vendored
@@ -1,15 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011-2017 JP Richardson
|
||||
|
||||
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.
|
||||
22
api.hyungi.net/node_modules/@npmcli/fs/lib/cp/index.js
generated
vendored
22
api.hyungi.net/node_modules/@npmcli/fs/lib/cp/index.js
generated
vendored
@@ -1,22 +0,0 @@
|
||||
const fs = require('../fs.js')
|
||||
const getOptions = require('../common/get-options.js')
|
||||
const node = require('../common/node.js')
|
||||
const polyfill = require('./polyfill.js')
|
||||
|
||||
// node 16.7.0 added fs.cp
|
||||
const useNative = node.satisfies('>=16.7.0')
|
||||
|
||||
const cp = async (src, dest, opts) => {
|
||||
const options = getOptions(opts, {
|
||||
copy: ['dereference', 'errorOnExist', 'filter', 'force', 'preserveTimestamps', 'recursive'],
|
||||
})
|
||||
|
||||
// the polyfill is tested separately from this module, no need to hack
|
||||
// process.version to try to trigger it just for coverage
|
||||
// istanbul ignore next
|
||||
return useNative
|
||||
? fs.cp(src, dest, options)
|
||||
: polyfill(src, dest, options)
|
||||
}
|
||||
|
||||
module.exports = cp
|
||||
428
api.hyungi.net/node_modules/@npmcli/fs/lib/cp/polyfill.js
generated
vendored
428
api.hyungi.net/node_modules/@npmcli/fs/lib/cp/polyfill.js
generated
vendored
@@ -1,428 +0,0 @@
|
||||
// this file is a modified version of the code in node 17.2.0
|
||||
// which is, in turn, a modified version of the fs-extra module on npm
|
||||
// node core changes:
|
||||
// - Use of the assert module has been replaced with core's error system.
|
||||
// - All code related to the glob dependency has been removed.
|
||||
// - Bring your own custom fs module is not currently supported.
|
||||
// - Some basic code cleanup.
|
||||
// changes here:
|
||||
// - remove all callback related code
|
||||
// - drop sync support
|
||||
// - change assertions back to non-internal methods (see options.js)
|
||||
// - throws ENOTDIR when rmdir gets an ENOENT for a path that exists in Windows
|
||||
'use strict'
|
||||
|
||||
const {
|
||||
ERR_FS_CP_DIR_TO_NON_DIR,
|
||||
ERR_FS_CP_EEXIST,
|
||||
ERR_FS_CP_EINVAL,
|
||||
ERR_FS_CP_FIFO_PIPE,
|
||||
ERR_FS_CP_NON_DIR_TO_DIR,
|
||||
ERR_FS_CP_SOCKET,
|
||||
ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY,
|
||||
ERR_FS_CP_UNKNOWN,
|
||||
ERR_FS_EISDIR,
|
||||
ERR_INVALID_ARG_TYPE,
|
||||
} = require('../errors.js')
|
||||
const {
|
||||
constants: {
|
||||
errno: {
|
||||
EEXIST,
|
||||
EISDIR,
|
||||
EINVAL,
|
||||
ENOTDIR,
|
||||
},
|
||||
},
|
||||
} = require('os')
|
||||
const {
|
||||
chmod,
|
||||
copyFile,
|
||||
lstat,
|
||||
mkdir,
|
||||
readdir,
|
||||
readlink,
|
||||
stat,
|
||||
symlink,
|
||||
unlink,
|
||||
utimes,
|
||||
} = require('../fs.js')
|
||||
const {
|
||||
dirname,
|
||||
isAbsolute,
|
||||
join,
|
||||
parse,
|
||||
resolve,
|
||||
sep,
|
||||
toNamespacedPath,
|
||||
} = require('path')
|
||||
const { fileURLToPath } = require('url')
|
||||
|
||||
const defaultOptions = {
|
||||
dereference: false,
|
||||
errorOnExist: false,
|
||||
filter: undefined,
|
||||
force: true,
|
||||
preserveTimestamps: false,
|
||||
recursive: false,
|
||||
}
|
||||
|
||||
async function cp (src, dest, opts) {
|
||||
if (opts != null && typeof opts !== 'object') {
|
||||
throw new ERR_INVALID_ARG_TYPE('options', ['Object'], opts)
|
||||
}
|
||||
return cpFn(
|
||||
toNamespacedPath(getValidatedPath(src)),
|
||||
toNamespacedPath(getValidatedPath(dest)),
|
||||
{ ...defaultOptions, ...opts })
|
||||
}
|
||||
|
||||
function getValidatedPath (fileURLOrPath) {
|
||||
const path = fileURLOrPath != null && fileURLOrPath.href
|
||||
&& fileURLOrPath.origin
|
||||
? fileURLToPath(fileURLOrPath)
|
||||
: fileURLOrPath
|
||||
return path
|
||||
}
|
||||
|
||||
async function cpFn (src, dest, opts) {
|
||||
// Warn about using preserveTimestamps on 32-bit node
|
||||
// istanbul ignore next
|
||||
if (opts.preserveTimestamps && process.arch === 'ia32') {
|
||||
const warning = 'Using the preserveTimestamps option in 32-bit ' +
|
||||
'node is not recommended'
|
||||
process.emitWarning(warning, 'TimestampPrecisionWarning')
|
||||
}
|
||||
const stats = await checkPaths(src, dest, opts)
|
||||
const { srcStat, destStat } = stats
|
||||
await checkParentPaths(src, srcStat, dest)
|
||||
if (opts.filter) {
|
||||
return handleFilter(checkParentDir, destStat, src, dest, opts)
|
||||
}
|
||||
return checkParentDir(destStat, src, dest, opts)
|
||||
}
|
||||
|
||||
async function checkPaths (src, dest, opts) {
|
||||
const { 0: srcStat, 1: destStat } = await getStats(src, dest, opts)
|
||||
if (destStat) {
|
||||
if (areIdentical(srcStat, destStat)) {
|
||||
throw new ERR_FS_CP_EINVAL({
|
||||
message: 'src and dest cannot be the same',
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EINVAL,
|
||||
})
|
||||
}
|
||||
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
||||
throw new ERR_FS_CP_DIR_TO_NON_DIR({
|
||||
message: `cannot overwrite directory ${src} ` +
|
||||
`with non-directory ${dest}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EISDIR,
|
||||
})
|
||||
}
|
||||
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
||||
throw new ERR_FS_CP_NON_DIR_TO_DIR({
|
||||
message: `cannot overwrite non-directory ${src} ` +
|
||||
`with directory ${dest}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: ENOTDIR,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
||||
throw new ERR_FS_CP_EINVAL({
|
||||
message: `cannot copy ${src} to a subdirectory of self ${dest}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EINVAL,
|
||||
})
|
||||
}
|
||||
return { srcStat, destStat }
|
||||
}
|
||||
|
||||
function areIdentical (srcStat, destStat) {
|
||||
return destStat.ino && destStat.dev && destStat.ino === srcStat.ino &&
|
||||
destStat.dev === srcStat.dev
|
||||
}
|
||||
|
||||
function getStats (src, dest, opts) {
|
||||
const statFunc = opts.dereference ?
|
||||
(file) => stat(file, { bigint: true }) :
|
||||
(file) => lstat(file, { bigint: true })
|
||||
return Promise.all([
|
||||
statFunc(src),
|
||||
statFunc(dest).catch((err) => {
|
||||
// istanbul ignore next: unsure how to cover.
|
||||
if (err.code === 'ENOENT') {
|
||||
return null
|
||||
}
|
||||
// istanbul ignore next: unsure how to cover.
|
||||
throw err
|
||||
}),
|
||||
])
|
||||
}
|
||||
|
||||
async function checkParentDir (destStat, src, dest, opts) {
|
||||
const destParent = dirname(dest)
|
||||
const dirExists = await pathExists(destParent)
|
||||
if (dirExists) {
|
||||
return getStatsForCopy(destStat, src, dest, opts)
|
||||
}
|
||||
await mkdir(destParent, { recursive: true })
|
||||
return getStatsForCopy(destStat, src, dest, opts)
|
||||
}
|
||||
|
||||
function pathExists (dest) {
|
||||
return stat(dest).then(
|
||||
() => true,
|
||||
// istanbul ignore next: not sure when this would occur
|
||||
(err) => (err.code === 'ENOENT' ? false : Promise.reject(err)))
|
||||
}
|
||||
|
||||
// Recursively check if dest parent is a subdirectory of src.
|
||||
// It works for all file types including symlinks since it
|
||||
// checks the src and dest inodes. It starts from the deepest
|
||||
// parent and stops once it reaches the src parent or the root path.
|
||||
async function checkParentPaths (src, srcStat, dest) {
|
||||
const srcParent = resolve(dirname(src))
|
||||
const destParent = resolve(dirname(dest))
|
||||
if (destParent === srcParent || destParent === parse(destParent).root) {
|
||||
return
|
||||
}
|
||||
let destStat
|
||||
try {
|
||||
destStat = await stat(destParent, { bigint: true })
|
||||
} catch (err) {
|
||||
// istanbul ignore else: not sure when this would occur
|
||||
if (err.code === 'ENOENT') {
|
||||
return
|
||||
}
|
||||
// istanbul ignore next: not sure when this would occur
|
||||
throw err
|
||||
}
|
||||
if (areIdentical(srcStat, destStat)) {
|
||||
throw new ERR_FS_CP_EINVAL({
|
||||
message: `cannot copy ${src} to a subdirectory of self ${dest}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EINVAL,
|
||||
})
|
||||
}
|
||||
return checkParentPaths(src, srcStat, destParent)
|
||||
}
|
||||
|
||||
const normalizePathToArray = (path) =>
|
||||
resolve(path).split(sep).filter(Boolean)
|
||||
|
||||
// Return true if dest is a subdir of src, otherwise false.
|
||||
// It only checks the path strings.
|
||||
function isSrcSubdir (src, dest) {
|
||||
const srcArr = normalizePathToArray(src)
|
||||
const destArr = normalizePathToArray(dest)
|
||||
return srcArr.every((cur, i) => destArr[i] === cur)
|
||||
}
|
||||
|
||||
async function handleFilter (onInclude, destStat, src, dest, opts, cb) {
|
||||
const include = await opts.filter(src, dest)
|
||||
if (include) {
|
||||
return onInclude(destStat, src, dest, opts, cb)
|
||||
}
|
||||
}
|
||||
|
||||
function startCopy (destStat, src, dest, opts) {
|
||||
if (opts.filter) {
|
||||
return handleFilter(getStatsForCopy, destStat, src, dest, opts)
|
||||
}
|
||||
return getStatsForCopy(destStat, src, dest, opts)
|
||||
}
|
||||
|
||||
async function getStatsForCopy (destStat, src, dest, opts) {
|
||||
const statFn = opts.dereference ? stat : lstat
|
||||
const srcStat = await statFn(src)
|
||||
// istanbul ignore else: can't portably test FIFO
|
||||
if (srcStat.isDirectory() && opts.recursive) {
|
||||
return onDir(srcStat, destStat, src, dest, opts)
|
||||
} else if (srcStat.isDirectory()) {
|
||||
throw new ERR_FS_EISDIR({
|
||||
message: `${src} is a directory (not copied)`,
|
||||
path: src,
|
||||
syscall: 'cp',
|
||||
errno: EINVAL,
|
||||
})
|
||||
} else if (srcStat.isFile() ||
|
||||
srcStat.isCharacterDevice() ||
|
||||
srcStat.isBlockDevice()) {
|
||||
return onFile(srcStat, destStat, src, dest, opts)
|
||||
} else if (srcStat.isSymbolicLink()) {
|
||||
return onLink(destStat, src, dest)
|
||||
} else if (srcStat.isSocket()) {
|
||||
throw new ERR_FS_CP_SOCKET({
|
||||
message: `cannot copy a socket file: ${dest}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EINVAL,
|
||||
})
|
||||
} else if (srcStat.isFIFO()) {
|
||||
throw new ERR_FS_CP_FIFO_PIPE({
|
||||
message: `cannot copy a FIFO pipe: ${dest}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EINVAL,
|
||||
})
|
||||
}
|
||||
// istanbul ignore next: should be unreachable
|
||||
throw new ERR_FS_CP_UNKNOWN({
|
||||
message: `cannot copy an unknown file type: ${dest}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EINVAL,
|
||||
})
|
||||
}
|
||||
|
||||
function onFile (srcStat, destStat, src, dest, opts) {
|
||||
if (!destStat) {
|
||||
return _copyFile(srcStat, src, dest, opts)
|
||||
}
|
||||
return mayCopyFile(srcStat, src, dest, opts)
|
||||
}
|
||||
|
||||
async function mayCopyFile (srcStat, src, dest, opts) {
|
||||
if (opts.force) {
|
||||
await unlink(dest)
|
||||
return _copyFile(srcStat, src, dest, opts)
|
||||
} else if (opts.errorOnExist) {
|
||||
throw new ERR_FS_CP_EEXIST({
|
||||
message: `${dest} already exists`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EEXIST,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function _copyFile (srcStat, src, dest, opts) {
|
||||
await copyFile(src, dest)
|
||||
if (opts.preserveTimestamps) {
|
||||
return handleTimestampsAndMode(srcStat.mode, src, dest)
|
||||
}
|
||||
return setDestMode(dest, srcStat.mode)
|
||||
}
|
||||
|
||||
async function handleTimestampsAndMode (srcMode, src, dest) {
|
||||
// Make sure the file is writable before setting the timestamp
|
||||
// otherwise open fails with EPERM when invoked with 'r+'
|
||||
// (through utimes call)
|
||||
if (fileIsNotWritable(srcMode)) {
|
||||
await makeFileWritable(dest, srcMode)
|
||||
return setDestTimestampsAndMode(srcMode, src, dest)
|
||||
}
|
||||
return setDestTimestampsAndMode(srcMode, src, dest)
|
||||
}
|
||||
|
||||
function fileIsNotWritable (srcMode) {
|
||||
return (srcMode & 0o200) === 0
|
||||
}
|
||||
|
||||
function makeFileWritable (dest, srcMode) {
|
||||
return setDestMode(dest, srcMode | 0o200)
|
||||
}
|
||||
|
||||
async function setDestTimestampsAndMode (srcMode, src, dest) {
|
||||
await setDestTimestamps(src, dest)
|
||||
return setDestMode(dest, srcMode)
|
||||
}
|
||||
|
||||
function setDestMode (dest, srcMode) {
|
||||
return chmod(dest, srcMode)
|
||||
}
|
||||
|
||||
async function setDestTimestamps (src, dest) {
|
||||
// The initial srcStat.atime cannot be trusted
|
||||
// because it is modified by the read(2) system call
|
||||
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
|
||||
const updatedSrcStat = await stat(src)
|
||||
return utimes(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
|
||||
}
|
||||
|
||||
function onDir (srcStat, destStat, src, dest, opts) {
|
||||
if (!destStat) {
|
||||
return mkDirAndCopy(srcStat.mode, src, dest, opts)
|
||||
}
|
||||
return copyDir(src, dest, opts)
|
||||
}
|
||||
|
||||
async function mkDirAndCopy (srcMode, src, dest, opts) {
|
||||
await mkdir(dest)
|
||||
await copyDir(src, dest, opts)
|
||||
return setDestMode(dest, srcMode)
|
||||
}
|
||||
|
||||
async function copyDir (src, dest, opts) {
|
||||
const dir = await readdir(src)
|
||||
for (let i = 0; i < dir.length; i++) {
|
||||
const item = dir[i]
|
||||
const srcItem = join(src, item)
|
||||
const destItem = join(dest, item)
|
||||
const { destStat } = await checkPaths(srcItem, destItem, opts)
|
||||
await startCopy(destStat, srcItem, destItem, opts)
|
||||
}
|
||||
}
|
||||
|
||||
async function onLink (destStat, src, dest) {
|
||||
let resolvedSrc = await readlink(src)
|
||||
if (!isAbsolute(resolvedSrc)) {
|
||||
resolvedSrc = resolve(dirname(src), resolvedSrc)
|
||||
}
|
||||
if (!destStat) {
|
||||
return symlink(resolvedSrc, dest)
|
||||
}
|
||||
let resolvedDest
|
||||
try {
|
||||
resolvedDest = await readlink(dest)
|
||||
} catch (err) {
|
||||
// Dest exists and is a regular file or directory,
|
||||
// Windows may throw UNKNOWN error. If dest already exists,
|
||||
// fs throws error anyway, so no need to guard against it here.
|
||||
// istanbul ignore next: can only test on windows
|
||||
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') {
|
||||
return symlink(resolvedSrc, dest)
|
||||
}
|
||||
// istanbul ignore next: should not be possible
|
||||
throw err
|
||||
}
|
||||
if (!isAbsolute(resolvedDest)) {
|
||||
resolvedDest = resolve(dirname(dest), resolvedDest)
|
||||
}
|
||||
if (isSrcSubdir(resolvedSrc, resolvedDest)) {
|
||||
throw new ERR_FS_CP_EINVAL({
|
||||
message: `cannot copy ${resolvedSrc} to a subdirectory of self ` +
|
||||
`${resolvedDest}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EINVAL,
|
||||
})
|
||||
}
|
||||
// Do not copy if src is a subdir of dest since unlinking
|
||||
// dest in this case would result in removing src contents
|
||||
// and therefore a broken symlink would be created.
|
||||
const srcStat = await stat(src)
|
||||
if (srcStat.isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
|
||||
throw new ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY({
|
||||
message: `cannot overwrite ${resolvedDest} with ${resolvedSrc}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EINVAL,
|
||||
})
|
||||
}
|
||||
return copyLink(resolvedSrc, dest)
|
||||
}
|
||||
|
||||
async function copyLink (resolvedSrc, dest) {
|
||||
await unlink(dest)
|
||||
return symlink(resolvedSrc, dest)
|
||||
}
|
||||
|
||||
module.exports = cp
|
||||
129
api.hyungi.net/node_modules/@npmcli/fs/lib/errors.js
generated
vendored
129
api.hyungi.net/node_modules/@npmcli/fs/lib/errors.js
generated
vendored
@@ -1,129 +0,0 @@
|
||||
'use strict'
|
||||
const { inspect } = require('util')
|
||||
|
||||
// adapted from node's internal/errors
|
||||
// https://github.com/nodejs/node/blob/c8a04049/lib/internal/errors.js
|
||||
|
||||
// close copy of node's internal SystemError class.
|
||||
class SystemError {
|
||||
constructor (code, prefix, context) {
|
||||
// XXX context.code is undefined in all constructors used in cp/polyfill
|
||||
// that may be a bug copied from node, maybe the constructor should use
|
||||
// `code` not `errno`? nodejs/node#41104
|
||||
let message = `${prefix}: ${context.syscall} returned ` +
|
||||
`${context.code} (${context.message})`
|
||||
|
||||
if (context.path !== undefined) {
|
||||
message += ` ${context.path}`
|
||||
}
|
||||
if (context.dest !== undefined) {
|
||||
message += ` => ${context.dest}`
|
||||
}
|
||||
|
||||
this.code = code
|
||||
Object.defineProperties(this, {
|
||||
name: {
|
||||
value: 'SystemError',
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
},
|
||||
message: {
|
||||
value: message,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
},
|
||||
info: {
|
||||
value: context,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: false,
|
||||
},
|
||||
errno: {
|
||||
get () {
|
||||
return context.errno
|
||||
},
|
||||
set (value) {
|
||||
context.errno = value
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
},
|
||||
syscall: {
|
||||
get () {
|
||||
return context.syscall
|
||||
},
|
||||
set (value) {
|
||||
context.syscall = value
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
},
|
||||
})
|
||||
|
||||
if (context.path !== undefined) {
|
||||
Object.defineProperty(this, 'path', {
|
||||
get () {
|
||||
return context.path
|
||||
},
|
||||
set (value) {
|
||||
context.path = value
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
})
|
||||
}
|
||||
|
||||
if (context.dest !== undefined) {
|
||||
Object.defineProperty(this, 'dest', {
|
||||
get () {
|
||||
return context.dest
|
||||
},
|
||||
set (value) {
|
||||
context.dest = value
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
toString () {
|
||||
return `${this.name} [${this.code}]: ${this.message}`
|
||||
}
|
||||
|
||||
[Symbol.for('nodejs.util.inspect.custom')] (_recurseTimes, ctx) {
|
||||
return inspect(this, {
|
||||
...ctx,
|
||||
getters: true,
|
||||
customInspect: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function E (code, message) {
|
||||
module.exports[code] = class NodeError extends SystemError {
|
||||
constructor (ctx) {
|
||||
super(code, message, ctx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
E('ERR_FS_CP_DIR_TO_NON_DIR', 'Cannot overwrite directory with non-directory')
|
||||
E('ERR_FS_CP_EEXIST', 'Target already exists')
|
||||
E('ERR_FS_CP_EINVAL', 'Invalid src or dest')
|
||||
E('ERR_FS_CP_FIFO_PIPE', 'Cannot copy a FIFO pipe')
|
||||
E('ERR_FS_CP_NON_DIR_TO_DIR', 'Cannot overwrite non-directory with directory')
|
||||
E('ERR_FS_CP_SOCKET', 'Cannot copy a socket file')
|
||||
E('ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY', 'Cannot overwrite symlink in subdirectory of self')
|
||||
E('ERR_FS_CP_UNKNOWN', 'Cannot copy an unknown file type')
|
||||
E('ERR_FS_EISDIR', 'Path is a directory')
|
||||
|
||||
module.exports.ERR_INVALID_ARG_TYPE = class ERR_INVALID_ARG_TYPE extends Error {
|
||||
constructor (name, expected, actual) {
|
||||
super()
|
||||
this.code = 'ERR_INVALID_ARG_TYPE'
|
||||
this.message = `The ${name} argument must be ${expected}. Received ${typeof actual}`
|
||||
}
|
||||
}
|
||||
8
api.hyungi.net/node_modules/@npmcli/fs/lib/fs.js
generated
vendored
8
api.hyungi.net/node_modules/@npmcli/fs/lib/fs.js
generated
vendored
@@ -1,8 +0,0 @@
|
||||
const fs = require('fs')
|
||||
const promisify = require('@gar/promisify')
|
||||
|
||||
// this module returns the core fs module wrapped in a proxy that promisifies
|
||||
// method calls within the getter. we keep it in a separate module so that the
|
||||
// overridden methods have a consistent way to get to promisified fs methods
|
||||
// without creating a circular dependency
|
||||
module.exports = promisify(fs)
|
||||
10
api.hyungi.net/node_modules/@npmcli/fs/lib/index.js
generated
vendored
10
api.hyungi.net/node_modules/@npmcli/fs/lib/index.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
module.exports = {
|
||||
...require('./fs.js'),
|
||||
copyFile: require('./copy-file.js'),
|
||||
cp: require('./cp/index.js'),
|
||||
mkdir: require('./mkdir/index.js'),
|
||||
mkdtemp: require('./mkdtemp.js'),
|
||||
rm: require('./rm/index.js'),
|
||||
withTempDir: require('./with-temp-dir.js'),
|
||||
writeFile: require('./write-file.js'),
|
||||
}
|
||||
32
api.hyungi.net/node_modules/@npmcli/fs/lib/mkdir/index.js
generated
vendored
32
api.hyungi.net/node_modules/@npmcli/fs/lib/mkdir/index.js
generated
vendored
@@ -1,32 +0,0 @@
|
||||
const fs = require('../fs.js')
|
||||
const getOptions = require('../common/get-options.js')
|
||||
const node = require('../common/node.js')
|
||||
const owner = require('../common/owner.js')
|
||||
|
||||
const polyfill = require('./polyfill.js')
|
||||
|
||||
// node 10.12.0 added the options parameter, which allows recursive and mode
|
||||
// properties to be passed
|
||||
const useNative = node.satisfies('>=10.12.0')
|
||||
|
||||
// extends mkdir with the ability to specify an owner of the new dir
|
||||
const mkdir = async (path, opts) => {
|
||||
const options = getOptions(opts, {
|
||||
copy: ['mode', 'recursive', 'owner'],
|
||||
wrap: 'mode',
|
||||
})
|
||||
const { uid, gid } = await owner.validate(path, options.owner)
|
||||
|
||||
// the polyfill is tested separately from this module, no need to hack
|
||||
// process.version to try to trigger it just for coverage
|
||||
// istanbul ignore next
|
||||
const result = useNative
|
||||
? await fs.mkdir(path, options)
|
||||
: await polyfill(path, options)
|
||||
|
||||
await owner.update(path, uid, gid)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
module.exports = mkdir
|
||||
81
api.hyungi.net/node_modules/@npmcli/fs/lib/mkdir/polyfill.js
generated
vendored
81
api.hyungi.net/node_modules/@npmcli/fs/lib/mkdir/polyfill.js
generated
vendored
@@ -1,81 +0,0 @@
|
||||
const { dirname } = require('path')
|
||||
|
||||
const fileURLToPath = require('../common/file-url-to-path/index.js')
|
||||
const fs = require('../fs.js')
|
||||
|
||||
const defaultOptions = {
|
||||
mode: 0o777,
|
||||
recursive: false,
|
||||
}
|
||||
|
||||
const mkdir = async (path, opts) => {
|
||||
const options = { ...defaultOptions, ...opts }
|
||||
|
||||
// if we're not in recursive mode, just call the real mkdir with the path and
|
||||
// the mode option only
|
||||
if (!options.recursive) {
|
||||
return fs.mkdir(path, options.mode)
|
||||
}
|
||||
|
||||
const makeDirectory = async (dir, mode) => {
|
||||
// we can't use dirname directly since these functions support URL
|
||||
// objects with the file: protocol as the path input, so first we get a
|
||||
// string path, then we can call dirname on that
|
||||
const parent = dir != null && dir.href && dir.origin
|
||||
? dirname(fileURLToPath(dir))
|
||||
: dirname(dir)
|
||||
|
||||
// if the parent is the dir itself, try to create it. anything but EISDIR
|
||||
// should be rethrown
|
||||
if (parent === dir) {
|
||||
try {
|
||||
await fs.mkdir(dir, opts)
|
||||
} catch (err) {
|
||||
if (err.code !== 'EISDIR') {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
try {
|
||||
await fs.mkdir(dir, mode)
|
||||
return dir
|
||||
} catch (err) {
|
||||
// ENOENT means the parent wasn't there, so create that
|
||||
if (err.code === 'ENOENT') {
|
||||
const made = await makeDirectory(parent, mode)
|
||||
await makeDirectory(dir, mode)
|
||||
// return the shallowest path we created, i.e. the result of creating
|
||||
// the parent
|
||||
return made
|
||||
}
|
||||
|
||||
// an EEXIST means there's already something there
|
||||
// an EROFS means we have a read-only filesystem and can't create a dir
|
||||
// any other error is fatal and we should give up now
|
||||
if (err.code !== 'EEXIST' && err.code !== 'EROFS') {
|
||||
throw err
|
||||
}
|
||||
|
||||
// stat the directory, if the result is a directory, then we successfully
|
||||
// created this one so return its path. otherwise, we reject with the
|
||||
// original error by ignoring the error in the catch
|
||||
try {
|
||||
const stat = await fs.stat(dir)
|
||||
if (stat.isDirectory()) {
|
||||
// if it already existed, we didn't create anything so return
|
||||
// undefined
|
||||
return undefined
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
// if the thing that's there isn't a directory, then just re-throw
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
return makeDirectory(path, options.mode)
|
||||
}
|
||||
|
||||
module.exports = mkdir
|
||||
28
api.hyungi.net/node_modules/@npmcli/fs/lib/mkdtemp.js
generated
vendored
28
api.hyungi.net/node_modules/@npmcli/fs/lib/mkdtemp.js
generated
vendored
@@ -1,28 +0,0 @@
|
||||
const { dirname, sep } = require('path')
|
||||
|
||||
const fs = require('./fs.js')
|
||||
const getOptions = require('./common/get-options.js')
|
||||
const owner = require('./common/owner.js')
|
||||
|
||||
const mkdtemp = async (prefix, opts) => {
|
||||
const options = getOptions(opts, {
|
||||
copy: ['encoding', 'owner'],
|
||||
wrap: 'encoding',
|
||||
})
|
||||
|
||||
// mkdtemp relies on the trailing path separator to indicate if it should
|
||||
// create a directory inside of the prefix. if that's the case then the root
|
||||
// we infer ownership from is the prefix itself, otherwise it's the dirname
|
||||
// /tmp -> /tmpABCDEF, infers from /
|
||||
// /tmp/ -> /tmp/ABCDEF, infers from /tmp
|
||||
const root = prefix.endsWith(sep) ? prefix : dirname(prefix)
|
||||
const { uid, gid } = await owner.validate(root, options.owner)
|
||||
|
||||
const result = await fs.mkdtemp(prefix, options)
|
||||
|
||||
await owner.update(result, uid, gid)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
module.exports = mkdtemp
|
||||
22
api.hyungi.net/node_modules/@npmcli/fs/lib/rm/index.js
generated
vendored
22
api.hyungi.net/node_modules/@npmcli/fs/lib/rm/index.js
generated
vendored
@@ -1,22 +0,0 @@
|
||||
const fs = require('../fs.js')
|
||||
const getOptions = require('../common/get-options.js')
|
||||
const node = require('../common/node.js')
|
||||
const polyfill = require('./polyfill.js')
|
||||
|
||||
// node 14.14.0 added fs.rm, which allows both the force and recursive options
|
||||
const useNative = node.satisfies('>=14.14.0')
|
||||
|
||||
const rm = async (path, opts) => {
|
||||
const options = getOptions(opts, {
|
||||
copy: ['retryDelay', 'maxRetries', 'recursive', 'force'],
|
||||
})
|
||||
|
||||
// the polyfill is tested separately from this module, no need to hack
|
||||
// process.version to try to trigger it just for coverage
|
||||
// istanbul ignore next
|
||||
return useNative
|
||||
? fs.rm(path, options)
|
||||
: polyfill(path, options)
|
||||
}
|
||||
|
||||
module.exports = rm
|
||||
239
api.hyungi.net/node_modules/@npmcli/fs/lib/rm/polyfill.js
generated
vendored
239
api.hyungi.net/node_modules/@npmcli/fs/lib/rm/polyfill.js
generated
vendored
@@ -1,239 +0,0 @@
|
||||
// this file is a modified version of the code in node core >=14.14.0
|
||||
// which is, in turn, a modified version of the rimraf module on npm
|
||||
// node core changes:
|
||||
// - Use of the assert module has been replaced with core's error system.
|
||||
// - All code related to the glob dependency has been removed.
|
||||
// - Bring your own custom fs module is not currently supported.
|
||||
// - Some basic code cleanup.
|
||||
// changes here:
|
||||
// - remove all callback related code
|
||||
// - drop sync support
|
||||
// - change assertions back to non-internal methods (see options.js)
|
||||
// - throws ENOTDIR when rmdir gets an ENOENT for a path that exists in Windows
|
||||
const errnos = require('os').constants.errno
|
||||
const { join } = require('path')
|
||||
const fs = require('../fs.js')
|
||||
|
||||
// error codes that mean we need to remove contents
|
||||
const notEmptyCodes = new Set([
|
||||
'ENOTEMPTY',
|
||||
'EEXIST',
|
||||
'EPERM',
|
||||
])
|
||||
|
||||
// error codes we can retry later
|
||||
const retryCodes = new Set([
|
||||
'EBUSY',
|
||||
'EMFILE',
|
||||
'ENFILE',
|
||||
'ENOTEMPTY',
|
||||
'EPERM',
|
||||
])
|
||||
|
||||
const isWindows = process.platform === 'win32'
|
||||
|
||||
const defaultOptions = {
|
||||
retryDelay: 100,
|
||||
maxRetries: 0,
|
||||
recursive: false,
|
||||
force: false,
|
||||
}
|
||||
|
||||
// this is drastically simplified, but should be roughly equivalent to what
|
||||
// node core throws
|
||||
class ERR_FS_EISDIR extends Error {
|
||||
constructor (path) {
|
||||
super()
|
||||
this.info = {
|
||||
code: 'EISDIR',
|
||||
message: 'is a directory',
|
||||
path,
|
||||
syscall: 'rm',
|
||||
errno: errnos.EISDIR,
|
||||
}
|
||||
this.name = 'SystemError'
|
||||
this.code = 'ERR_FS_EISDIR'
|
||||
this.errno = errnos.EISDIR
|
||||
this.syscall = 'rm'
|
||||
this.path = path
|
||||
this.message = `Path is a directory: ${this.syscall} returned ` +
|
||||
`${this.info.code} (is a directory) ${path}`
|
||||
}
|
||||
|
||||
toString () {
|
||||
return `${this.name} [${this.code}]: ${this.message}`
|
||||
}
|
||||
}
|
||||
|
||||
class ENOTDIR extends Error {
|
||||
constructor (path) {
|
||||
super()
|
||||
this.name = 'Error'
|
||||
this.code = 'ENOTDIR'
|
||||
this.errno = errnos.ENOTDIR
|
||||
this.syscall = 'rmdir'
|
||||
this.path = path
|
||||
this.message = `not a directory, ${this.syscall} '${this.path}'`
|
||||
}
|
||||
|
||||
toString () {
|
||||
return `${this.name}: ${this.code}: ${this.message}`
|
||||
}
|
||||
}
|
||||
|
||||
// force is passed separately here because we respect it for the first entry
|
||||
// into rimraf only, any further calls that are spawned as a result (i.e. to
|
||||
// delete content within the target) will ignore ENOENT errors
|
||||
const rimraf = async (path, options, isTop = false) => {
|
||||
const force = isTop ? options.force : true
|
||||
const stat = await fs.lstat(path)
|
||||
.catch((err) => {
|
||||
// we only ignore ENOENT if we're forcing this call
|
||||
if (err.code === 'ENOENT' && force) {
|
||||
return
|
||||
}
|
||||
|
||||
if (isWindows && err.code === 'EPERM') {
|
||||
return fixEPERM(path, options, err, isTop)
|
||||
}
|
||||
|
||||
throw err
|
||||
})
|
||||
|
||||
// no stat object here means either lstat threw an ENOENT, or lstat threw
|
||||
// an EPERM and the fixPERM function took care of things. either way, we're
|
||||
// already done, so return early
|
||||
if (!stat) {
|
||||
return
|
||||
}
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
return rmdir(path, options, null, isTop)
|
||||
}
|
||||
|
||||
return fs.unlink(path)
|
||||
.catch((err) => {
|
||||
if (err.code === 'ENOENT' && force) {
|
||||
return
|
||||
}
|
||||
|
||||
if (err.code === 'EISDIR') {
|
||||
return rmdir(path, options, err, isTop)
|
||||
}
|
||||
|
||||
if (err.code === 'EPERM') {
|
||||
// in windows, we handle this through fixEPERM which will also try to
|
||||
// delete things again. everywhere else since deleting the target as a
|
||||
// file didn't work we go ahead and try to delete it as a directory
|
||||
return isWindows
|
||||
? fixEPERM(path, options, err, isTop)
|
||||
: rmdir(path, options, err, isTop)
|
||||
}
|
||||
|
||||
throw err
|
||||
})
|
||||
}
|
||||
|
||||
const fixEPERM = async (path, options, originalErr, isTop) => {
|
||||
const force = isTop ? options.force : true
|
||||
const targetMissing = await fs.chmod(path, 0o666)
|
||||
.catch((err) => {
|
||||
if (err.code === 'ENOENT' && force) {
|
||||
return true
|
||||
}
|
||||
|
||||
throw originalErr
|
||||
})
|
||||
|
||||
// got an ENOENT above, return now. no file = no problem
|
||||
if (targetMissing) {
|
||||
return
|
||||
}
|
||||
|
||||
// this function does its own lstat rather than calling rimraf again to avoid
|
||||
// infinite recursion for a repeating EPERM
|
||||
const stat = await fs.lstat(path)
|
||||
.catch((err) => {
|
||||
if (err.code === 'ENOENT' && force) {
|
||||
return
|
||||
}
|
||||
|
||||
throw originalErr
|
||||
})
|
||||
|
||||
if (!stat) {
|
||||
return
|
||||
}
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
return rmdir(path, options, originalErr, isTop)
|
||||
}
|
||||
|
||||
return fs.unlink(path)
|
||||
}
|
||||
|
||||
const rmdir = async (path, options, originalErr, isTop) => {
|
||||
if (!options.recursive && isTop) {
|
||||
throw originalErr || new ERR_FS_EISDIR(path)
|
||||
}
|
||||
const force = isTop ? options.force : true
|
||||
|
||||
return fs.rmdir(path)
|
||||
.catch(async (err) => {
|
||||
// in Windows, calling rmdir on a file path will fail with ENOENT rather
|
||||
// than ENOTDIR. to determine if that's what happened, we have to do
|
||||
// another lstat on the path. if the path isn't actually gone, we throw
|
||||
// away the ENOENT and replace it with our own ENOTDIR
|
||||
if (isWindows && err.code === 'ENOENT') {
|
||||
const stillExists = await fs.lstat(path).then(() => true, () => false)
|
||||
if (stillExists) {
|
||||
err = new ENOTDIR(path)
|
||||
}
|
||||
}
|
||||
|
||||
// not there, not a problem
|
||||
if (err.code === 'ENOENT' && force) {
|
||||
return
|
||||
}
|
||||
|
||||
// we may not have originalErr if lstat tells us our target is a
|
||||
// directory but that changes before we actually remove it, so
|
||||
// only throw it here if it's set
|
||||
if (originalErr && err.code === 'ENOTDIR') {
|
||||
throw originalErr
|
||||
}
|
||||
|
||||
// the directory isn't empty, remove the contents and try again
|
||||
if (notEmptyCodes.has(err.code)) {
|
||||
const files = await fs.readdir(path)
|
||||
await Promise.all(files.map((file) => {
|
||||
const target = join(path, file)
|
||||
return rimraf(target, options)
|
||||
}))
|
||||
return fs.rmdir(path)
|
||||
}
|
||||
|
||||
throw err
|
||||
})
|
||||
}
|
||||
|
||||
const rm = async (path, opts) => {
|
||||
const options = { ...defaultOptions, ...opts }
|
||||
let retries = 0
|
||||
|
||||
const errHandler = async (err) => {
|
||||
if (retryCodes.has(err.code) && ++retries < options.maxRetries) {
|
||||
const delay = retries * options.retryDelay
|
||||
await promiseTimeout(delay)
|
||||
return rimraf(path, options, true).catch(errHandler)
|
||||
}
|
||||
|
||||
throw err
|
||||
}
|
||||
|
||||
return rimraf(path, options, true).catch(errHandler)
|
||||
}
|
||||
|
||||
const promiseTimeout = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
|
||||
module.exports = rm
|
||||
39
api.hyungi.net/node_modules/@npmcli/fs/lib/with-temp-dir.js
generated
vendored
39
api.hyungi.net/node_modules/@npmcli/fs/lib/with-temp-dir.js
generated
vendored
@@ -1,39 +0,0 @@
|
||||
const { join, sep } = require('path')
|
||||
|
||||
const getOptions = require('./common/get-options.js')
|
||||
const mkdir = require('./mkdir/index.js')
|
||||
const mkdtemp = require('./mkdtemp.js')
|
||||
const rm = require('./rm/index.js')
|
||||
|
||||
// create a temp directory, ensure its permissions match its parent, then call
|
||||
// the supplied function passing it the path to the directory. clean up after
|
||||
// the function finishes, whether it throws or not
|
||||
const withTempDir = async (root, fn, opts) => {
|
||||
const options = getOptions(opts, {
|
||||
copy: ['tmpPrefix'],
|
||||
})
|
||||
// create the directory, and fix its ownership
|
||||
await mkdir(root, { recursive: true, owner: 'inherit' })
|
||||
|
||||
const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || ''), { owner: 'inherit' })
|
||||
let err
|
||||
let result
|
||||
|
||||
try {
|
||||
result = await fn(target)
|
||||
} catch (_err) {
|
||||
err = _err
|
||||
}
|
||||
|
||||
try {
|
||||
await rm(target, { force: true, recursive: true })
|
||||
} catch (err) {}
|
||||
|
||||
if (err) {
|
||||
throw err
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
module.exports = withTempDir
|
||||
19
api.hyungi.net/node_modules/@npmcli/fs/lib/write-file.js
generated
vendored
19
api.hyungi.net/node_modules/@npmcli/fs/lib/write-file.js
generated
vendored
@@ -1,19 +0,0 @@
|
||||
const fs = require('./fs.js')
|
||||
const getOptions = require('./common/get-options.js')
|
||||
const owner = require('./common/owner.js')
|
||||
|
||||
const writeFile = async (file, data, opts) => {
|
||||
const options = getOptions(opts, {
|
||||
copy: ['encoding', 'mode', 'flag', 'signal', 'owner'],
|
||||
wrap: 'encoding',
|
||||
})
|
||||
const { uid, gid } = await owner.validate(file, options.owner)
|
||||
|
||||
const result = await fs.writeFile(file, data, options)
|
||||
|
||||
await owner.update(file, uid, gid)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
module.exports = writeFile
|
||||
38
api.hyungi.net/node_modules/@npmcli/fs/package.json
generated
vendored
38
api.hyungi.net/node_modules/@npmcli/fs/package.json
generated
vendored
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"name": "@npmcli/fs",
|
||||
"version": "1.1.1",
|
||||
"description": "filesystem utilities for the npm cli",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"bin",
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"prepublishOnly": "git push origin --follow-tags",
|
||||
"snap": "tap",
|
||||
"test": "tap",
|
||||
"npmclilint": "npmcli-lint",
|
||||
"lint": "eslint '**/*.js'",
|
||||
"lintfix": "npm run lint -- --fix",
|
||||
"posttest": "npm run lint",
|
||||
"postsnap": "npm run lintfix --",
|
||||
"postlint": "npm-template-check"
|
||||
},
|
||||
"keywords": [
|
||||
"npm",
|
||||
"oss"
|
||||
],
|
||||
"author": "GitHub Inc.",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@npmcli/template-oss": "^2.3.1",
|
||||
"tap": "^15.0.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"@gar/promisify": "^1.0.1",
|
||||
"semver": "^7.3.5"
|
||||
},
|
||||
"templateVersion": "2.3.1"
|
||||
}
|
||||
22
api.hyungi.net/node_modules/@npmcli/move-file/LICENSE.md
generated
vendored
22
api.hyungi.net/node_modules/@npmcli/move-file/LICENSE.md
generated
vendored
@@ -1,22 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
Copyright (c) npm, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
69
api.hyungi.net/node_modules/@npmcli/move-file/README.md
generated
vendored
69
api.hyungi.net/node_modules/@npmcli/move-file/README.md
generated
vendored
@@ -1,69 +0,0 @@
|
||||
# @npmcli/move-file
|
||||
|
||||
A fork of [move-file](https://github.com/sindresorhus/move-file) with
|
||||
compatibility with all node 10.x versions.
|
||||
|
||||
> Move a file (or directory)
|
||||
|
||||
The built-in
|
||||
[`fs.rename()`](https://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback)
|
||||
is just a JavaScript wrapper for the C `rename(2)` function, which doesn't
|
||||
support moving files across partitions or devices. This module is what you
|
||||
would have expected `fs.rename()` to be.
|
||||
|
||||
## Highlights
|
||||
|
||||
- Promise API.
|
||||
- Supports moving a file across partitions and devices.
|
||||
- Optionally prevent overwriting an existing file.
|
||||
- Creates non-existent destination directories for you.
|
||||
- Support for Node versions that lack built-in recursive `fs.mkdir()`
|
||||
- Automatically recurses when source is a directory.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install @npmcli/move-file
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const moveFile = require('@npmcli/move-file');
|
||||
|
||||
(async () => {
|
||||
await moveFile('source/unicorn.png', 'destination/unicorn.png');
|
||||
console.log('The file has been moved');
|
||||
})();
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### moveFile(source, destination, options?)
|
||||
|
||||
Returns a `Promise` that resolves when the file has been moved.
|
||||
|
||||
### moveFile.sync(source, destination, options?)
|
||||
|
||||
#### source
|
||||
|
||||
Type: `string`
|
||||
|
||||
File, or directory, you want to move.
|
||||
|
||||
#### destination
|
||||
|
||||
Type: `string`
|
||||
|
||||
Where you want the file or directory moved.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### overwrite
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Overwrite existing destination file(s).
|
||||
162
api.hyungi.net/node_modules/@npmcli/move-file/index.js
generated
vendored
162
api.hyungi.net/node_modules/@npmcli/move-file/index.js
generated
vendored
@@ -1,162 +0,0 @@
|
||||
const { dirname, join, resolve, relative, isAbsolute } = require('path')
|
||||
const rimraf_ = require('rimraf')
|
||||
const { promisify } = require('util')
|
||||
const {
|
||||
access: access_,
|
||||
accessSync,
|
||||
copyFile: copyFile_,
|
||||
copyFileSync,
|
||||
unlink: unlink_,
|
||||
unlinkSync,
|
||||
readdir: readdir_,
|
||||
readdirSync,
|
||||
rename: rename_,
|
||||
renameSync,
|
||||
stat: stat_,
|
||||
statSync,
|
||||
lstat: lstat_,
|
||||
lstatSync,
|
||||
symlink: symlink_,
|
||||
symlinkSync,
|
||||
readlink: readlink_,
|
||||
readlinkSync
|
||||
} = require('fs')
|
||||
|
||||
const access = promisify(access_)
|
||||
const copyFile = promisify(copyFile_)
|
||||
const unlink = promisify(unlink_)
|
||||
const readdir = promisify(readdir_)
|
||||
const rename = promisify(rename_)
|
||||
const stat = promisify(stat_)
|
||||
const lstat = promisify(lstat_)
|
||||
const symlink = promisify(symlink_)
|
||||
const readlink = promisify(readlink_)
|
||||
const rimraf = promisify(rimraf_)
|
||||
const rimrafSync = rimraf_.sync
|
||||
|
||||
const mkdirp = require('mkdirp')
|
||||
|
||||
const pathExists = async path => {
|
||||
try {
|
||||
await access(path)
|
||||
return true
|
||||
} catch (er) {
|
||||
return er.code !== 'ENOENT'
|
||||
}
|
||||
}
|
||||
|
||||
const pathExistsSync = path => {
|
||||
try {
|
||||
accessSync(path)
|
||||
return true
|
||||
} catch (er) {
|
||||
return er.code !== 'ENOENT'
|
||||
}
|
||||
}
|
||||
|
||||
const moveFile = async (source, destination, options = {}, root = true, symlinks = []) => {
|
||||
if (!source || !destination) {
|
||||
throw new TypeError('`source` and `destination` file required')
|
||||
}
|
||||
|
||||
options = {
|
||||
overwrite: true,
|
||||
...options
|
||||
}
|
||||
|
||||
if (!options.overwrite && await pathExists(destination)) {
|
||||
throw new Error(`The destination file exists: ${destination}`)
|
||||
}
|
||||
|
||||
await mkdirp(dirname(destination))
|
||||
|
||||
try {
|
||||
await rename(source, destination)
|
||||
} catch (error) {
|
||||
if (error.code === 'EXDEV' || error.code === 'EPERM') {
|
||||
const sourceStat = await lstat(source)
|
||||
if (sourceStat.isDirectory()) {
|
||||
const files = await readdir(source)
|
||||
await Promise.all(files.map((file) => moveFile(join(source, file), join(destination, file), options, false, symlinks)))
|
||||
} else if (sourceStat.isSymbolicLink()) {
|
||||
symlinks.push({ source, destination })
|
||||
} else {
|
||||
await copyFile(source, destination)
|
||||
}
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
if (root) {
|
||||
await Promise.all(symlinks.map(async ({ source, destination }) => {
|
||||
let target = await readlink(source)
|
||||
// junction symlinks in windows will be absolute paths, so we need to make sure they point to the destination
|
||||
if (isAbsolute(target))
|
||||
target = resolve(destination, relative(source, target))
|
||||
// try to determine what the actual file is so we can create the correct type of symlink in windows
|
||||
let targetStat
|
||||
try {
|
||||
targetStat = await stat(resolve(dirname(source), target))
|
||||
} catch (err) {}
|
||||
await symlink(target, destination, targetStat && targetStat.isDirectory() ? 'junction' : 'file')
|
||||
}))
|
||||
await rimraf(source)
|
||||
}
|
||||
}
|
||||
|
||||
const moveFileSync = (source, destination, options = {}, root = true, symlinks = []) => {
|
||||
if (!source || !destination) {
|
||||
throw new TypeError('`source` and `destination` file required')
|
||||
}
|
||||
|
||||
options = {
|
||||
overwrite: true,
|
||||
...options
|
||||
}
|
||||
|
||||
if (!options.overwrite && pathExistsSync(destination)) {
|
||||
throw new Error(`The destination file exists: ${destination}`)
|
||||
}
|
||||
|
||||
mkdirp.sync(dirname(destination))
|
||||
|
||||
try {
|
||||
renameSync(source, destination)
|
||||
} catch (error) {
|
||||
if (error.code === 'EXDEV' || error.code === 'EPERM') {
|
||||
const sourceStat = lstatSync(source)
|
||||
if (sourceStat.isDirectory()) {
|
||||
const files = readdirSync(source)
|
||||
for (const file of files) {
|
||||
moveFileSync(join(source, file), join(destination, file), options, false, symlinks)
|
||||
}
|
||||
} else if (sourceStat.isSymbolicLink()) {
|
||||
symlinks.push({ source, destination })
|
||||
} else {
|
||||
copyFileSync(source, destination)
|
||||
}
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
if (root) {
|
||||
for (const { source, destination } of symlinks) {
|
||||
let target = readlinkSync(source)
|
||||
// junction symlinks in windows will be absolute paths, so we need to make sure they point to the destination
|
||||
if (isAbsolute(target))
|
||||
target = resolve(destination, relative(source, target))
|
||||
// try to determine what the actual file is so we can create the correct type of symlink in windows
|
||||
let targetStat
|
||||
try {
|
||||
targetStat = statSync(resolve(dirname(source), target))
|
||||
} catch (err) {}
|
||||
symlinkSync(target, destination, targetStat && targetStat.isDirectory() ? 'junction' : 'file')
|
||||
}
|
||||
rimrafSync(source)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = moveFile
|
||||
module.exports.sync = moveFileSync
|
||||
15
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md
generated
vendored
15
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md
generated
vendored
@@ -1,15 +0,0 @@
|
||||
# Changers Lorgs!
|
||||
|
||||
## 1.0
|
||||
|
||||
Full rewrite. Essentially a brand new module.
|
||||
|
||||
- Return a promise instead of taking a callback.
|
||||
- Use native `fs.mkdir(path, { recursive: true })` when available.
|
||||
- Drop support for outdated Node.js versions. (Technically still works on
|
||||
Node.js v8, but only 10 and above are officially supported.)
|
||||
|
||||
## 0.x
|
||||
|
||||
Original and most widely used recursive directory creation implementation
|
||||
in JavaScript, dating back to 2010.
|
||||
21
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/LICENSE
generated
vendored
21
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
Copyright James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me)
|
||||
|
||||
This project is free software released under the MIT license:
|
||||
|
||||
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.
|
||||
68
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/bin/cmd.js
generated
vendored
68
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/bin/cmd.js
generated
vendored
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const usage = () => `
|
||||
usage: mkdirp [DIR1,DIR2..] {OPTIONS}
|
||||
|
||||
Create each supplied directory including any necessary parent directories
|
||||
that don't yet exist.
|
||||
|
||||
If the directory already exists, do nothing.
|
||||
|
||||
OPTIONS are:
|
||||
|
||||
-m<mode> If a directory needs to be created, set the mode as an octal
|
||||
--mode=<mode> permission string.
|
||||
|
||||
-v --version Print the mkdirp version number
|
||||
|
||||
-h --help Print this helpful banner
|
||||
|
||||
-p --print Print the first directories created for each path provided
|
||||
|
||||
--manual Use manual implementation, even if native is available
|
||||
`
|
||||
|
||||
const dirs = []
|
||||
const opts = {}
|
||||
let print = false
|
||||
let dashdash = false
|
||||
let manual = false
|
||||
for (const arg of process.argv.slice(2)) {
|
||||
if (dashdash)
|
||||
dirs.push(arg)
|
||||
else if (arg === '--')
|
||||
dashdash = true
|
||||
else if (arg === '--manual')
|
||||
manual = true
|
||||
else if (/^-h/.test(arg) || /^--help/.test(arg)) {
|
||||
console.log(usage())
|
||||
process.exit(0)
|
||||
} else if (arg === '-v' || arg === '--version') {
|
||||
console.log(require('../package.json').version)
|
||||
process.exit(0)
|
||||
} else if (arg === '-p' || arg === '--print') {
|
||||
print = true
|
||||
} else if (/^-m/.test(arg) || /^--mode=/.test(arg)) {
|
||||
const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8)
|
||||
if (isNaN(mode)) {
|
||||
console.error(`invalid mode argument: ${arg}\nMust be an octal number.`)
|
||||
process.exit(1)
|
||||
}
|
||||
opts.mode = mode
|
||||
} else
|
||||
dirs.push(arg)
|
||||
}
|
||||
|
||||
const mkdirp = require('../')
|
||||
const impl = manual ? mkdirp.manual : mkdirp
|
||||
if (dirs.length === 0)
|
||||
console.error(usage())
|
||||
|
||||
Promise.all(dirs.map(dir => impl(dir, opts)))
|
||||
.then(made => print ? made.forEach(m => m && console.log(m)) : null)
|
||||
.catch(er => {
|
||||
console.error(er.message)
|
||||
if (er.code)
|
||||
console.error(' code: ' + er.code)
|
||||
process.exit(1)
|
||||
})
|
||||
31
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/index.js
generated
vendored
31
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/index.js
generated
vendored
@@ -1,31 +0,0 @@
|
||||
const optsArg = require('./lib/opts-arg.js')
|
||||
const pathArg = require('./lib/path-arg.js')
|
||||
|
||||
const {mkdirpNative, mkdirpNativeSync} = require('./lib/mkdirp-native.js')
|
||||
const {mkdirpManual, mkdirpManualSync} = require('./lib/mkdirp-manual.js')
|
||||
const {useNative, useNativeSync} = require('./lib/use-native.js')
|
||||
|
||||
|
||||
const mkdirp = (path, opts) => {
|
||||
path = pathArg(path)
|
||||
opts = optsArg(opts)
|
||||
return useNative(opts)
|
||||
? mkdirpNative(path, opts)
|
||||
: mkdirpManual(path, opts)
|
||||
}
|
||||
|
||||
const mkdirpSync = (path, opts) => {
|
||||
path = pathArg(path)
|
||||
opts = optsArg(opts)
|
||||
return useNativeSync(opts)
|
||||
? mkdirpNativeSync(path, opts)
|
||||
: mkdirpManualSync(path, opts)
|
||||
}
|
||||
|
||||
mkdirp.sync = mkdirpSync
|
||||
mkdirp.native = (path, opts) => mkdirpNative(pathArg(path), optsArg(opts))
|
||||
mkdirp.manual = (path, opts) => mkdirpManual(pathArg(path), optsArg(opts))
|
||||
mkdirp.nativeSync = (path, opts) => mkdirpNativeSync(pathArg(path), optsArg(opts))
|
||||
mkdirp.manualSync = (path, opts) => mkdirpManualSync(pathArg(path), optsArg(opts))
|
||||
|
||||
module.exports = mkdirp
|
||||
29
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/find-made.js
generated
vendored
29
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/find-made.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
const {dirname} = require('path')
|
||||
|
||||
const findMade = (opts, parent, path = undefined) => {
|
||||
// we never want the 'made' return value to be a root directory
|
||||
if (path === parent)
|
||||
return Promise.resolve()
|
||||
|
||||
return opts.statAsync(parent).then(
|
||||
st => st.isDirectory() ? path : undefined, // will fail later
|
||||
er => er.code === 'ENOENT'
|
||||
? findMade(opts, dirname(parent), parent)
|
||||
: undefined
|
||||
)
|
||||
}
|
||||
|
||||
const findMadeSync = (opts, parent, path = undefined) => {
|
||||
if (path === parent)
|
||||
return undefined
|
||||
|
||||
try {
|
||||
return opts.statSync(parent).isDirectory() ? path : undefined
|
||||
} catch (er) {
|
||||
return er.code === 'ENOENT'
|
||||
? findMadeSync(opts, dirname(parent), parent)
|
||||
: undefined
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {findMade, findMadeSync}
|
||||
64
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-manual.js
generated
vendored
64
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-manual.js
generated
vendored
@@ -1,64 +0,0 @@
|
||||
const {dirname} = require('path')
|
||||
|
||||
const mkdirpManual = (path, opts, made) => {
|
||||
opts.recursive = false
|
||||
const parent = dirname(path)
|
||||
if (parent === path) {
|
||||
return opts.mkdirAsync(path, opts).catch(er => {
|
||||
// swallowed by recursive implementation on posix systems
|
||||
// any other error is a failure
|
||||
if (er.code !== 'EISDIR')
|
||||
throw er
|
||||
})
|
||||
}
|
||||
|
||||
return opts.mkdirAsync(path, opts).then(() => made || path, er => {
|
||||
if (er.code === 'ENOENT')
|
||||
return mkdirpManual(parent, opts)
|
||||
.then(made => mkdirpManual(path, opts, made))
|
||||
if (er.code !== 'EEXIST' && er.code !== 'EROFS')
|
||||
throw er
|
||||
return opts.statAsync(path).then(st => {
|
||||
if (st.isDirectory())
|
||||
return made
|
||||
else
|
||||
throw er
|
||||
}, () => { throw er })
|
||||
})
|
||||
}
|
||||
|
||||
const mkdirpManualSync = (path, opts, made) => {
|
||||
const parent = dirname(path)
|
||||
opts.recursive = false
|
||||
|
||||
if (parent === path) {
|
||||
try {
|
||||
return opts.mkdirSync(path, opts)
|
||||
} catch (er) {
|
||||
// swallowed by recursive implementation on posix systems
|
||||
// any other error is a failure
|
||||
if (er.code !== 'EISDIR')
|
||||
throw er
|
||||
else
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
opts.mkdirSync(path, opts)
|
||||
return made || path
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOENT')
|
||||
return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))
|
||||
if (er.code !== 'EEXIST' && er.code !== 'EROFS')
|
||||
throw er
|
||||
try {
|
||||
if (!opts.statSync(path).isDirectory())
|
||||
throw er
|
||||
} catch (_) {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {mkdirpManual, mkdirpManualSync}
|
||||
39
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-native.js
generated
vendored
39
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-native.js
generated
vendored
@@ -1,39 +0,0 @@
|
||||
const {dirname} = require('path')
|
||||
const {findMade, findMadeSync} = require('./find-made.js')
|
||||
const {mkdirpManual, mkdirpManualSync} = require('./mkdirp-manual.js')
|
||||
|
||||
const mkdirpNative = (path, opts) => {
|
||||
opts.recursive = true
|
||||
const parent = dirname(path)
|
||||
if (parent === path)
|
||||
return opts.mkdirAsync(path, opts)
|
||||
|
||||
return findMade(opts, path).then(made =>
|
||||
opts.mkdirAsync(path, opts).then(() => made)
|
||||
.catch(er => {
|
||||
if (er.code === 'ENOENT')
|
||||
return mkdirpManual(path, opts)
|
||||
else
|
||||
throw er
|
||||
}))
|
||||
}
|
||||
|
||||
const mkdirpNativeSync = (path, opts) => {
|
||||
opts.recursive = true
|
||||
const parent = dirname(path)
|
||||
if (parent === path)
|
||||
return opts.mkdirSync(path, opts)
|
||||
|
||||
const made = findMadeSync(opts, path)
|
||||
try {
|
||||
opts.mkdirSync(path, opts)
|
||||
return made
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOENT')
|
||||
return mkdirpManualSync(path, opts)
|
||||
else
|
||||
throw er
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {mkdirpNative, mkdirpNativeSync}
|
||||
23
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/opts-arg.js
generated
vendored
23
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/opts-arg.js
generated
vendored
@@ -1,23 +0,0 @@
|
||||
const { promisify } = require('util')
|
||||
const fs = require('fs')
|
||||
const optsArg = opts => {
|
||||
if (!opts)
|
||||
opts = { mode: 0o777, fs }
|
||||
else if (typeof opts === 'object')
|
||||
opts = { mode: 0o777, fs, ...opts }
|
||||
else if (typeof opts === 'number')
|
||||
opts = { mode: opts, fs }
|
||||
else if (typeof opts === 'string')
|
||||
opts = { mode: parseInt(opts, 8), fs }
|
||||
else
|
||||
throw new TypeError('invalid options argument')
|
||||
|
||||
opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir
|
||||
opts.mkdirAsync = promisify(opts.mkdir)
|
||||
opts.stat = opts.stat || opts.fs.stat || fs.stat
|
||||
opts.statAsync = promisify(opts.stat)
|
||||
opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync
|
||||
opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync
|
||||
return opts
|
||||
}
|
||||
module.exports = optsArg
|
||||
29
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/path-arg.js
generated
vendored
29
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/path-arg.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform
|
||||
const { resolve, parse } = require('path')
|
||||
const pathArg = path => {
|
||||
if (/\0/.test(path)) {
|
||||
// simulate same failure that node raises
|
||||
throw Object.assign(
|
||||
new TypeError('path must be a string without null bytes'),
|
||||
{
|
||||
path,
|
||||
code: 'ERR_INVALID_ARG_VALUE',
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
path = resolve(path)
|
||||
if (platform === 'win32') {
|
||||
const badWinChars = /[*|"<>?:]/
|
||||
const {root} = parse(path)
|
||||
if (badWinChars.test(path.substr(root.length))) {
|
||||
throw Object.assign(new Error('Illegal characters in path.'), {
|
||||
path,
|
||||
code: 'EINVAL',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
||||
module.exports = pathArg
|
||||
10
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/use-native.js
generated
vendored
10
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/use-native.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
const fs = require('fs')
|
||||
|
||||
const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version
|
||||
const versArr = version.replace(/^v/, '').split('.')
|
||||
const hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12
|
||||
|
||||
const useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir
|
||||
const useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync
|
||||
|
||||
module.exports = {useNative, useNativeSync}
|
||||
44
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/package.json
generated
vendored
44
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/package.json
generated
vendored
@@ -1,44 +0,0 @@
|
||||
{
|
||||
"name": "mkdirp",
|
||||
"description": "Recursively mkdir, like `mkdir -p`",
|
||||
"version": "1.0.4",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
"mkdir",
|
||||
"directory",
|
||||
"make dir",
|
||||
"make",
|
||||
"dir",
|
||||
"recursive",
|
||||
"native"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/isaacs/node-mkdirp.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"snap": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --follow-tags"
|
||||
},
|
||||
"tap": {
|
||||
"check-coverage": true,
|
||||
"coverage-map": "map.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"require-inject": "^1.4.4",
|
||||
"tap": "^14.10.7"
|
||||
},
|
||||
"bin": "bin/cmd.js",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"lib",
|
||||
"index.js"
|
||||
]
|
||||
}
|
||||
266
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/readme.markdown
generated
vendored
266
api.hyungi.net/node_modules/@npmcli/move-file/node_modules/mkdirp/readme.markdown
generated
vendored
@@ -1,266 +0,0 @@
|
||||
# mkdirp
|
||||
|
||||
Like `mkdir -p`, but in Node.js!
|
||||
|
||||
Now with a modern API and no\* bugs!
|
||||
|
||||
<small>\* may contain some bugs</small>
|
||||
|
||||
# example
|
||||
|
||||
## pow.js
|
||||
|
||||
```js
|
||||
const mkdirp = require('mkdirp')
|
||||
|
||||
// return value is a Promise resolving to the first directory created
|
||||
mkdirp('/tmp/foo/bar/baz').then(made =>
|
||||
console.log(`made directories, starting with ${made}`))
|
||||
```
|
||||
|
||||
Output (where `/tmp/foo` already exists)
|
||||
|
||||
```
|
||||
made directories, starting with /tmp/foo/bar
|
||||
```
|
||||
|
||||
Or, if you don't have time to wait around for promises:
|
||||
|
||||
```js
|
||||
const mkdirp = require('mkdirp')
|
||||
|
||||
// return value is the first directory created
|
||||
const made = mkdirp.sync('/tmp/foo/bar/baz')
|
||||
console.log(`made directories, starting with ${made}`)
|
||||
```
|
||||
|
||||
And now /tmp/foo/bar/baz exists, huzzah!
|
||||
|
||||
# methods
|
||||
|
||||
```js
|
||||
const mkdirp = require('mkdirp')
|
||||
```
|
||||
|
||||
## mkdirp(dir, [opts]) -> Promise<String | undefined>
|
||||
|
||||
Create a new directory and any necessary subdirectories at `dir` with octal
|
||||
permission string `opts.mode`. If `opts` is a string or number, it will be
|
||||
treated as the `opts.mode`.
|
||||
|
||||
If `opts.mode` isn't specified, it defaults to `0o777 &
|
||||
(~process.umask())`.
|
||||
|
||||
Promise resolves to first directory `made` that had to be created, or
|
||||
`undefined` if everything already exists. Promise rejects if any errors
|
||||
are encountered. Note that, in the case of promise rejection, some
|
||||
directories _may_ have been created, as recursive directory creation is not
|
||||
an atomic operation.
|
||||
|
||||
You can optionally pass in an alternate `fs` implementation by passing in
|
||||
`opts.fs`. Your implementation should have `opts.fs.mkdir(path, opts, cb)`
|
||||
and `opts.fs.stat(path, cb)`.
|
||||
|
||||
You can also override just one or the other of `mkdir` and `stat` by
|
||||
passing in `opts.stat` or `opts.mkdir`, or providing an `fs` option that
|
||||
only overrides one of these.
|
||||
|
||||
## mkdirp.sync(dir, opts) -> String|null
|
||||
|
||||
Synchronously create a new directory and any necessary subdirectories at
|
||||
`dir` with octal permission string `opts.mode`. If `opts` is a string or
|
||||
number, it will be treated as the `opts.mode`.
|
||||
|
||||
If `opts.mode` isn't specified, it defaults to `0o777 &
|
||||
(~process.umask())`.
|
||||
|
||||
Returns the first directory that had to be created, or undefined if
|
||||
everything already exists.
|
||||
|
||||
You can optionally pass in an alternate `fs` implementation by passing in
|
||||
`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)`
|
||||
and `opts.fs.statSync(path)`.
|
||||
|
||||
You can also override just one or the other of `mkdirSync` and `statSync`
|
||||
by passing in `opts.statSync` or `opts.mkdirSync`, or providing an `fs`
|
||||
option that only overrides one of these.
|
||||
|
||||
## mkdirp.manual, mkdirp.manualSync
|
||||
|
||||
Use the manual implementation (not the native one). This is the default
|
||||
when the native implementation is not available or the stat/mkdir
|
||||
implementation is overridden.
|
||||
|
||||
## mkdirp.native, mkdirp.nativeSync
|
||||
|
||||
Use the native implementation (not the manual one). This is the default
|
||||
when the native implementation is available and stat/mkdir are not
|
||||
overridden.
|
||||
|
||||
# implementation
|
||||
|
||||
On Node.js v10.12.0 and above, use the native `fs.mkdir(p,
|
||||
{recursive:true})` option, unless `fs.mkdir`/`fs.mkdirSync` has been
|
||||
overridden by an option.
|
||||
|
||||
## native implementation
|
||||
|
||||
- If the path is a root directory, then pass it to the underlying
|
||||
implementation and return the result/error. (In this case, it'll either
|
||||
succeed or fail, but we aren't actually creating any dirs.)
|
||||
- Walk up the path statting each directory, to find the first path that
|
||||
will be created, `made`.
|
||||
- Call `fs.mkdir(path, { recursive: true })` (or `fs.mkdirSync`)
|
||||
- If error, raise it to the caller.
|
||||
- Return `made`.
|
||||
|
||||
## manual implementation
|
||||
|
||||
- Call underlying `fs.mkdir` implementation, with `recursive: false`
|
||||
- If error:
|
||||
- If path is a root directory, raise to the caller and do not handle it
|
||||
- If ENOENT, mkdirp parent dir, store result as `made`
|
||||
- stat(path)
|
||||
- If error, raise original `mkdir` error
|
||||
- If directory, return `made`
|
||||
- Else, raise original `mkdir` error
|
||||
- else
|
||||
- return `undefined` if a root dir, or `made` if set, or `path`
|
||||
|
||||
## windows vs unix caveat
|
||||
|
||||
On Windows file systems, attempts to create a root directory (ie, a drive
|
||||
letter or root UNC path) will fail. If the root directory exists, then it
|
||||
will fail with `EPERM`. If the root directory does not exist, then it will
|
||||
fail with `ENOENT`.
|
||||
|
||||
On posix file systems, attempts to create a root directory (in recursive
|
||||
mode) will succeed silently, as it is treated like just another directory
|
||||
that already exists. (In non-recursive mode, of course, it fails with
|
||||
`EEXIST`.)
|
||||
|
||||
In order to preserve this system-specific behavior (and because it's not as
|
||||
if we can create the parent of a root directory anyway), attempts to create
|
||||
a root directory are passed directly to the `fs` implementation, and any
|
||||
errors encountered are not handled.
|
||||
|
||||
## native error caveat
|
||||
|
||||
The native implementation (as of at least Node.js v13.4.0) does not provide
|
||||
appropriate errors in some cases (see
|
||||
[nodejs/node#31481](https://github.com/nodejs/node/issues/31481) and
|
||||
[nodejs/node#28015](https://github.com/nodejs/node/issues/28015)).
|
||||
|
||||
In order to work around this issue, the native implementation will fall
|
||||
back to the manual implementation if an `ENOENT` error is encountered.
|
||||
|
||||
# choosing a recursive mkdir implementation
|
||||
|
||||
There are a few to choose from! Use the one that suits your needs best :D
|
||||
|
||||
## use `fs.mkdir(path, {recursive: true}, cb)` if:
|
||||
|
||||
- You wish to optimize performance even at the expense of other factors.
|
||||
- You don't need to know the first dir created.
|
||||
- You are ok with getting `ENOENT` as the error when some other problem is
|
||||
the actual cause.
|
||||
- You can limit your platforms to Node.js v10.12 and above.
|
||||
- You're ok with using callbacks instead of promises.
|
||||
- You don't need/want a CLI.
|
||||
- You don't need to override the `fs` methods in use.
|
||||
|
||||
## use this module (mkdirp 1.x) if:
|
||||
|
||||
- You need to know the first directory that was created.
|
||||
- You wish to use the native implementation if available, but fall back
|
||||
when it's not.
|
||||
- You prefer promise-returning APIs to callback-taking APIs.
|
||||
- You want more useful error messages than the native recursive mkdir
|
||||
provides (at least as of Node.js v13.4), and are ok with re-trying on
|
||||
`ENOENT` to achieve this.
|
||||
- You need (or at least, are ok with) a CLI.
|
||||
- You need to override the `fs` methods in use.
|
||||
|
||||
## use [`make-dir`](http://npm.im/make-dir) if:
|
||||
|
||||
- You do not need to know the first dir created (and wish to save a few
|
||||
`stat` calls when using the native implementation for this reason).
|
||||
- You wish to use the native implementation if available, but fall back
|
||||
when it's not.
|
||||
- You prefer promise-returning APIs to callback-taking APIs.
|
||||
- You are ok with occasionally getting `ENOENT` errors for failures that
|
||||
are actually related to something other than a missing file system entry.
|
||||
- You don't need/want a CLI.
|
||||
- You need to override the `fs` methods in use.
|
||||
|
||||
## use mkdirp 0.x if:
|
||||
|
||||
- You need to know the first directory that was created.
|
||||
- You need (or at least, are ok with) a CLI.
|
||||
- You need to override the `fs` methods in use.
|
||||
- You're ok with using callbacks instead of promises.
|
||||
- You are not running on Windows, where the root-level ENOENT errors can
|
||||
lead to infinite regress.
|
||||
- You think vinyl just sounds warmer and richer for some weird reason.
|
||||
- You are supporting truly ancient Node.js versions, before even the advent
|
||||
of a `Promise` language primitive. (Please don't. You deserve better.)
|
||||
|
||||
# cli
|
||||
|
||||
This package also ships with a `mkdirp` command.
|
||||
|
||||
```
|
||||
$ mkdirp -h
|
||||
|
||||
usage: mkdirp [DIR1,DIR2..] {OPTIONS}
|
||||
|
||||
Create each supplied directory including any necessary parent directories
|
||||
that don't yet exist.
|
||||
|
||||
If the directory already exists, do nothing.
|
||||
|
||||
OPTIONS are:
|
||||
|
||||
-m<mode> If a directory needs to be created, set the mode as an octal
|
||||
--mode=<mode> permission string.
|
||||
|
||||
-v --version Print the mkdirp version number
|
||||
|
||||
-h --help Print this helpful banner
|
||||
|
||||
-p --print Print the first directories created for each path provided
|
||||
|
||||
--manual Use manual implementation, even if native is available
|
||||
```
|
||||
|
||||
# install
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install mkdirp
|
||||
```
|
||||
|
||||
to get the library locally, or
|
||||
|
||||
```
|
||||
npm install -g mkdirp
|
||||
```
|
||||
|
||||
to get the command everywhere, or
|
||||
|
||||
```
|
||||
npx mkdirp ...
|
||||
```
|
||||
|
||||
to run the command without installing it globally.
|
||||
|
||||
# platform support
|
||||
|
||||
This module works on node v8, but only v10 and above are officially
|
||||
supported, as Node v8 reached its LTS end of life 2020-01-01, which is in
|
||||
the past, as of this writing.
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
||||
34
api.hyungi.net/node_modules/@npmcli/move-file/package.json
generated
vendored
34
api.hyungi.net/node_modules/@npmcli/move-file/package.json
generated
vendored
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"name": "@npmcli/move-file",
|
||||
"version": "1.1.2",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"description": "move a file (fork of move-file)",
|
||||
"dependencies": {
|
||||
"mkdirp": "^1.0.4",
|
||||
"rimraf": "^3.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"require-inject": "^1.4.4",
|
||||
"tap": "^14.10.7"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"snap": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"prepublishOnly": "git push origin --follow-tags"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/move-file"
|
||||
},
|
||||
"tap": {
|
||||
"check-coverage": true
|
||||
},
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
}
|
||||
21
api.hyungi.net/node_modules/@peculiar/asn1-android/LICENSE
generated
vendored
21
api.hyungi.net/node_modules/@peculiar/asn1-android/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020
|
||||
|
||||
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.
|
||||
108
api.hyungi.net/node_modules/@peculiar/asn1-android/README.md
generated
vendored
108
api.hyungi.net/node_modules/@peculiar/asn1-android/README.md
generated
vendored
@@ -1,108 +0,0 @@
|
||||
# `@peculiar/asn1-android`
|
||||
|
||||
[](https://raw.githubusercontent.com/PeculiarVentures/asn1-schema/master/packages/android/LICENSE.md)
|
||||
[](https://badge.fury.io/js/%40peculiar%2Fasn1-android)
|
||||
|
||||
[](https://nodei.co/npm/@peculiar/asn1-android/)
|
||||
|
||||
- [Android key attestation schema](https://source.android.com/security/keystore/attestation#schema)
|
||||
- [Key attestation extension data schema](https://developer.android.com/privacy-and-security/security-key-attestation#key_attestation_ext_schema)
|
||||
- [AttestationApplicationId](https://developer.android.com/privacy-and-security/security-key-attestation#key_attestation_ext_schema_attestationid)
|
||||
|
||||
## KeyDescription and NonStandardKeyDescription
|
||||
|
||||
The `KeyDescription` class in this library represents the ASN.1 schema for the Android Keystore Key Description structure. However, in practice, there are cases where the `AuthorizationList` fields in the `softwareEnforced` and `teeEnforced` fields are not strictly ordered, which can lead to ASN.1 structure reading errors.
|
||||
|
||||
Starting with version 300, the schema has been updated to use `keyMintVersion` instead of `keymasterVersion`, `keyMintSecurityLevel` instead of `keymasterSecurityLevel`, and `hardwareEnforced` instead of `teeEnforced`. To support this, we've added the `KeyMintKeyDescription` class which works for both v300 and v400.
|
||||
|
||||
To address the non-strict ordering issue, this library provides `NonStandardKeyDescription` and `NonStandardKeyMintKeyDescription` classes that can read such structures. However, when creating extensions, it is recommended to use `KeyDescription` or `KeyMintKeyDescription`, as they guarantee the order of object fields according to the specification.
|
||||
|
||||
Here are simplified TypeScript examples:
|
||||
|
||||
Example of creating a `KeyDescription` object in TypeScript for the Android Keystore system
|
||||
|
||||
```typescript
|
||||
const attestation = new android.AttestationApplicationId({
|
||||
packageInfos: [
|
||||
new android.AttestationPackageInfo({
|
||||
packageName: new OctetString(Buffer.from("123", "utf8")),
|
||||
version: 1,
|
||||
}),
|
||||
],
|
||||
signatureDigests: [new OctetString(Buffer.from("123", "utf8"))],
|
||||
});
|
||||
|
||||
// Legacy KeyDescription
|
||||
const keyDescription = new KeyDescription({
|
||||
attestationVersion: android.Version.keyMint2,
|
||||
attestationSecurityLevel: android.SecurityLevel.software,
|
||||
keymasterVersion: 1,
|
||||
keymasterSecurityLevel: android.SecurityLevel.software,
|
||||
attestationChallenge: new OctetString(Buffer.from("123", "utf8")),
|
||||
uniqueId: new OctetString(Buffer.from("123", "utf8")),
|
||||
softwareEnforced: new android.AuthorizationList({
|
||||
creationDateTime: 1506793476000,
|
||||
attestationApplicationId: new OctetString(AsnConvert.serialize(attestation)),
|
||||
}),
|
||||
teeEnforced: new android.AuthorizationList({
|
||||
purpose: new android.IntegerSet([1]),
|
||||
algorithm: 1,
|
||||
keySize: 1,
|
||||
digest: new android.IntegerSet([1]),
|
||||
ecCurve: 1,
|
||||
userAuthType: 1,
|
||||
origin: 1,
|
||||
rollbackResistant: null,
|
||||
}),
|
||||
});
|
||||
|
||||
// KeyMint KeyDescription (works for both v300 and v400)
|
||||
const keyMintDescription = new KeyMintKeyDescription({
|
||||
attestationVersion: android.Version.keyMint4, // Use Version.keyMint3 for v300
|
||||
attestationSecurityLevel: android.SecurityLevel.software,
|
||||
keyMintVersion: 1,
|
||||
keyMintSecurityLevel: android.SecurityLevel.trustedEnvironment,
|
||||
attestationChallenge: new OctetString(Buffer.from("challenge-data", "utf8")),
|
||||
uniqueId: new OctetString(Buffer.from("unique-id-data", "utf8")),
|
||||
softwareEnforced: new android.AuthorizationList({
|
||||
creationDateTime: 1684321765000,
|
||||
}),
|
||||
hardwareEnforced: new android.AuthorizationList({
|
||||
purpose: new android.IntegerSet([1, 2]),
|
||||
algorithm: 3, // EC
|
||||
keySize: 256,
|
||||
attestationIdSecondImei: new OctetString(Buffer.from("second-imei", "utf8")),
|
||||
moduleHash: new OctetString(Buffer.from("module-hash-value", "utf8")), // Available in v400
|
||||
rootOfTrust: new android.RootOfTrust({
|
||||
verifiedBootKey: new OctetString(Buffer.from("boot-key-data", "utf8")),
|
||||
deviceLocked: true,
|
||||
verifiedBootState: android.VerifiedBootState.verified,
|
||||
verifiedBootHash: new OctetString(Buffer.from("boot-hash-data", "utf8")), // Required in v300 and above
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
const raw = AsnConvert.serialize(keyDescription);
|
||||
const rawKeyMint = AsnConvert.serialize(keyMintDescription);
|
||||
```
|
||||
|
||||
Example of reading a non-standard KeyDescription:
|
||||
|
||||
```typescript
|
||||
// Parse with appropriate class based on version
|
||||
const keyDescription = AsnConvert.parse(raw, NonStandardKeyDescription);
|
||||
const keyMintDescription = AsnConvert.parse(rawKeyMint, NonStandardKeyMintKeyDescription); // Works for both v300 and v400
|
||||
|
||||
// All versions support both old and new property names
|
||||
console.log(keyMintDescription.keyMintVersion); // 1
|
||||
console.log(keyMintDescription.keymasterVersion); // Same as keyMintVersion (1)
|
||||
console.log(keyMintDescription.hardwareEnforced === keyMintDescription.teeEnforced); // true
|
||||
|
||||
// Check v400 specific fields
|
||||
const moduleHash = keyMintDescription.hardwareEnforced.findProperty("moduleHash");
|
||||
console.log(moduleHash && Buffer.from(moduleHash).toString("utf8")); // "module-hash-value"
|
||||
|
||||
// Converting between versions
|
||||
const legacyFromKeyMint = keyMintDescription.toLegacyKeyDescription();
|
||||
const keyMintFromLegacy = KeyMintKeyDescription.fromLegacyKeyDescription(legacyFromKeyMint);
|
||||
```
|
||||
29
api.hyungi.net/node_modules/@peculiar/asn1-android/build/cjs/attestation.js
generated
vendored
29
api.hyungi.net/node_modules/@peculiar/asn1-android/build/cjs/attestation.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AttestationApplicationId = exports.AttestationPackageInfo = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const asn1_schema_1 = require("@peculiar/asn1-schema");
|
||||
class AttestationPackageInfo {
|
||||
constructor(params = {}) {
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
exports.AttestationPackageInfo = AttestationPackageInfo;
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.OctetString })
|
||||
], AttestationPackageInfo.prototype, "packageName", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
|
||||
], AttestationPackageInfo.prototype, "version", void 0);
|
||||
class AttestationApplicationId {
|
||||
constructor(params = {}) {
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
exports.AttestationApplicationId = AttestationApplicationId;
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: AttestationPackageInfo, repeated: "set" })
|
||||
], AttestationApplicationId.prototype, "packageInfos", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.OctetString, repeated: "set" })
|
||||
], AttestationApplicationId.prototype, "signatureDigests", void 0);
|
||||
6
api.hyungi.net/node_modules/@peculiar/asn1-android/build/cjs/index.js
generated
vendored
6
api.hyungi.net/node_modules/@peculiar/asn1-android/build/cjs/index.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./key_description"), exports);
|
||||
tslib_1.__exportStar(require("./nonstandard"), exports);
|
||||
tslib_1.__exportStar(require("./attestation"), exports);
|
||||
297
api.hyungi.net/node_modules/@peculiar/asn1-android/build/cjs/key_description.js
generated
vendored
297
api.hyungi.net/node_modules/@peculiar/asn1-android/build/cjs/key_description.js
generated
vendored
@@ -1,297 +0,0 @@
|
||||
"use strict";
|
||||
var IntegerSet_1;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.KeyMintKeyDescription = exports.KeyDescription = exports.Version = exports.SecurityLevel = exports.AuthorizationList = exports.IntegerSet = exports.RootOfTrust = exports.VerifiedBootState = exports.id_ce_keyDescription = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const asn1_schema_1 = require("@peculiar/asn1-schema");
|
||||
exports.id_ce_keyDescription = "1.3.6.1.4.1.11129.2.1.17";
|
||||
var VerifiedBootState;
|
||||
(function (VerifiedBootState) {
|
||||
VerifiedBootState[VerifiedBootState["verified"] = 0] = "verified";
|
||||
VerifiedBootState[VerifiedBootState["selfSigned"] = 1] = "selfSigned";
|
||||
VerifiedBootState[VerifiedBootState["unverified"] = 2] = "unverified";
|
||||
VerifiedBootState[VerifiedBootState["failed"] = 3] = "failed";
|
||||
})(VerifiedBootState || (exports.VerifiedBootState = VerifiedBootState = {}));
|
||||
class RootOfTrust {
|
||||
constructor(params = {}) {
|
||||
this.verifiedBootKey = new asn1_schema_1.OctetString();
|
||||
this.deviceLocked = false;
|
||||
this.verifiedBootState = VerifiedBootState.verified;
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
exports.RootOfTrust = RootOfTrust;
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
|
||||
], RootOfTrust.prototype, "verifiedBootKey", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Boolean })
|
||||
], RootOfTrust.prototype, "deviceLocked", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
|
||||
], RootOfTrust.prototype, "verifiedBootState", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString, optional: true })
|
||||
], RootOfTrust.prototype, "verifiedBootHash", void 0);
|
||||
let IntegerSet = IntegerSet_1 = class IntegerSet extends asn1_schema_1.AsnArray {
|
||||
constructor(items) {
|
||||
super(items);
|
||||
Object.setPrototypeOf(this, IntegerSet_1.prototype);
|
||||
}
|
||||
};
|
||||
exports.IntegerSet = IntegerSet;
|
||||
exports.IntegerSet = IntegerSet = IntegerSet_1 = tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Set, itemType: asn1_schema_1.AsnPropTypes.Integer })
|
||||
], IntegerSet);
|
||||
class AuthorizationList {
|
||||
constructor(params = {}) {
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
exports.AuthorizationList = AuthorizationList;
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 1, type: IntegerSet, optional: true })
|
||||
], AuthorizationList.prototype, "purpose", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 2, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "algorithm", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 3, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "keySize", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 5, type: IntegerSet, optional: true })
|
||||
], AuthorizationList.prototype, "digest", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 6, type: IntegerSet, optional: true })
|
||||
], AuthorizationList.prototype, "padding", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 10, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "ecCurve", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 200, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "rsaPublicExponent", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 203, type: IntegerSet, optional: true })
|
||||
], AuthorizationList.prototype, "mgfDigest", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 303, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "rollbackResistance", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 305, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "earlyBootOnly", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 400, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "activeDateTime", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 401, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "originationExpireDateTime", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 402, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "usageExpireDateTime", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 405, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "usageCountLimit", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 503, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "noAuthRequired", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 504, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "userAuthType", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 505, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "authTimeout", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 506, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "allowWhileOnBody", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 507, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "trustedUserPresenceRequired", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 508, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "trustedConfirmationRequired", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 509, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "unlockedDeviceRequired", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 600, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "allApplications", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 601, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "applicationId", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 701, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "creationDateTime", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 702, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "origin", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 703, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "rollbackResistant", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 704, type: RootOfTrust, optional: true })
|
||||
], AuthorizationList.prototype, "rootOfTrust", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 705, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "osVersion", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 706, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "osPatchLevel", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 709, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationApplicationId", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 710, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdBrand", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 711, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdDevice", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 712, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdProduct", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 713, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdSerial", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 714, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdImei", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 715, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdMeid", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 716, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdManufacturer", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 717, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdModel", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 718, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "vendorPatchLevel", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 719, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "bootPatchLevel", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 720, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "deviceUniqueAttestation", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 723, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdSecondImei", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ context: 724, type: asn1_schema_1.OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "moduleHash", void 0);
|
||||
var SecurityLevel;
|
||||
(function (SecurityLevel) {
|
||||
SecurityLevel[SecurityLevel["software"] = 0] = "software";
|
||||
SecurityLevel[SecurityLevel["trustedEnvironment"] = 1] = "trustedEnvironment";
|
||||
SecurityLevel[SecurityLevel["strongBox"] = 2] = "strongBox";
|
||||
})(SecurityLevel || (exports.SecurityLevel = SecurityLevel = {}));
|
||||
var Version;
|
||||
(function (Version) {
|
||||
Version[Version["KM2"] = 1] = "KM2";
|
||||
Version[Version["KM3"] = 2] = "KM3";
|
||||
Version[Version["KM4"] = 3] = "KM4";
|
||||
Version[Version["KM4_1"] = 4] = "KM4_1";
|
||||
Version[Version["keyMint1"] = 100] = "keyMint1";
|
||||
Version[Version["keyMint2"] = 200] = "keyMint2";
|
||||
Version[Version["keyMint3"] = 300] = "keyMint3";
|
||||
Version[Version["keyMint4"] = 400] = "keyMint4";
|
||||
})(Version || (exports.Version = Version = {}));
|
||||
class KeyDescription {
|
||||
constructor(params = {}) {
|
||||
this.attestationVersion = Version.KM4;
|
||||
this.attestationSecurityLevel = SecurityLevel.software;
|
||||
this.keymasterVersion = 0;
|
||||
this.keymasterSecurityLevel = SecurityLevel.software;
|
||||
this.attestationChallenge = new asn1_schema_1.OctetString();
|
||||
this.uniqueId = new asn1_schema_1.OctetString();
|
||||
this.softwareEnforced = new AuthorizationList();
|
||||
this.teeEnforced = new AuthorizationList();
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
exports.KeyDescription = KeyDescription;
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
|
||||
], KeyDescription.prototype, "attestationVersion", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
|
||||
], KeyDescription.prototype, "attestationSecurityLevel", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
|
||||
], KeyDescription.prototype, "keymasterVersion", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
|
||||
], KeyDescription.prototype, "keymasterSecurityLevel", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
|
||||
], KeyDescription.prototype, "attestationChallenge", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
|
||||
], KeyDescription.prototype, "uniqueId", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
|
||||
], KeyDescription.prototype, "softwareEnforced", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
|
||||
], KeyDescription.prototype, "teeEnforced", void 0);
|
||||
class KeyMintKeyDescription {
|
||||
constructor(params = {}) {
|
||||
this.attestationVersion = Version.keyMint4;
|
||||
this.attestationSecurityLevel = SecurityLevel.software;
|
||||
this.keyMintVersion = 0;
|
||||
this.keyMintSecurityLevel = SecurityLevel.software;
|
||||
this.attestationChallenge = new asn1_schema_1.OctetString();
|
||||
this.uniqueId = new asn1_schema_1.OctetString();
|
||||
this.softwareEnforced = new AuthorizationList();
|
||||
this.hardwareEnforced = new AuthorizationList();
|
||||
Object.assign(this, params);
|
||||
}
|
||||
toLegacyKeyDescription() {
|
||||
return new KeyDescription({
|
||||
attestationVersion: this.attestationVersion,
|
||||
attestationSecurityLevel: this.attestationSecurityLevel,
|
||||
keymasterVersion: this.keyMintVersion,
|
||||
keymasterSecurityLevel: this.keyMintSecurityLevel,
|
||||
attestationChallenge: this.attestationChallenge,
|
||||
uniqueId: this.uniqueId,
|
||||
softwareEnforced: this.softwareEnforced,
|
||||
teeEnforced: this.hardwareEnforced,
|
||||
});
|
||||
}
|
||||
static fromLegacyKeyDescription(keyDesc) {
|
||||
return new KeyMintKeyDescription({
|
||||
attestationVersion: keyDesc.attestationVersion,
|
||||
attestationSecurityLevel: keyDesc.attestationSecurityLevel,
|
||||
keyMintVersion: keyDesc.keymasterVersion,
|
||||
keyMintSecurityLevel: keyDesc.keymasterSecurityLevel,
|
||||
attestationChallenge: keyDesc.attestationChallenge,
|
||||
uniqueId: keyDesc.uniqueId,
|
||||
softwareEnforced: keyDesc.softwareEnforced,
|
||||
hardwareEnforced: keyDesc.teeEnforced,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.KeyMintKeyDescription = KeyMintKeyDescription;
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
|
||||
], KeyMintKeyDescription.prototype, "attestationVersion", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
|
||||
], KeyMintKeyDescription.prototype, "attestationSecurityLevel", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
|
||||
], KeyMintKeyDescription.prototype, "keyMintVersion", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
|
||||
], KeyMintKeyDescription.prototype, "keyMintSecurityLevel", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
|
||||
], KeyMintKeyDescription.prototype, "attestationChallenge", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
|
||||
], KeyMintKeyDescription.prototype, "uniqueId", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
|
||||
], KeyMintKeyDescription.prototype, "softwareEnforced", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
|
||||
], KeyMintKeyDescription.prototype, "hardwareEnforced", void 0);
|
||||
104
api.hyungi.net/node_modules/@peculiar/asn1-android/build/cjs/nonstandard.js
generated
vendored
104
api.hyungi.net/node_modules/@peculiar/asn1-android/build/cjs/nonstandard.js
generated
vendored
@@ -1,104 +0,0 @@
|
||||
"use strict";
|
||||
var NonStandardAuthorizationList_1;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NonStandardKeyMintKeyDescription = exports.NonStandardKeyDescription = exports.NonStandardAuthorizationList = exports.NonStandardAuthorization = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const asn1_schema_1 = require("@peculiar/asn1-schema");
|
||||
const key_description_1 = require("./key_description");
|
||||
let NonStandardAuthorization = class NonStandardAuthorization extends key_description_1.AuthorizationList {
|
||||
};
|
||||
exports.NonStandardAuthorization = NonStandardAuthorization;
|
||||
exports.NonStandardAuthorization = NonStandardAuthorization = tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Choice })
|
||||
], NonStandardAuthorization);
|
||||
let NonStandardAuthorizationList = NonStandardAuthorizationList_1 = class NonStandardAuthorizationList extends asn1_schema_1.AsnArray {
|
||||
constructor(items) {
|
||||
super(items);
|
||||
Object.setPrototypeOf(this, NonStandardAuthorizationList_1.prototype);
|
||||
}
|
||||
findProperty(key) {
|
||||
const prop = this.find((o) => key in o);
|
||||
if (prop) {
|
||||
return prop[key];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
exports.NonStandardAuthorizationList = NonStandardAuthorizationList;
|
||||
exports.NonStandardAuthorizationList = NonStandardAuthorizationList = NonStandardAuthorizationList_1 = tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Sequence, itemType: NonStandardAuthorization })
|
||||
], NonStandardAuthorizationList);
|
||||
class NonStandardKeyDescription {
|
||||
get keyMintVersion() {
|
||||
return this.keymasterVersion;
|
||||
}
|
||||
set keyMintVersion(value) {
|
||||
this.keymasterVersion = value;
|
||||
}
|
||||
get keyMintSecurityLevel() {
|
||||
return this.keymasterSecurityLevel;
|
||||
}
|
||||
set keyMintSecurityLevel(value) {
|
||||
this.keymasterSecurityLevel = value;
|
||||
}
|
||||
get hardwareEnforced() {
|
||||
return this.teeEnforced;
|
||||
}
|
||||
set hardwareEnforced(value) {
|
||||
this.teeEnforced = value;
|
||||
}
|
||||
constructor(params = {}) {
|
||||
this.attestationVersion = key_description_1.Version.KM4;
|
||||
this.attestationSecurityLevel = key_description_1.SecurityLevel.software;
|
||||
this.keymasterVersion = 0;
|
||||
this.keymasterSecurityLevel = key_description_1.SecurityLevel.software;
|
||||
this.attestationChallenge = new asn1_schema_1.OctetString();
|
||||
this.uniqueId = new asn1_schema_1.OctetString();
|
||||
this.softwareEnforced = new NonStandardAuthorizationList();
|
||||
this.teeEnforced = new NonStandardAuthorizationList();
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
exports.NonStandardKeyDescription = NonStandardKeyDescription;
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
|
||||
], NonStandardKeyDescription.prototype, "attestationVersion", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
|
||||
], NonStandardKeyDescription.prototype, "attestationSecurityLevel", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
|
||||
], NonStandardKeyDescription.prototype, "keymasterVersion", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
|
||||
], NonStandardKeyDescription.prototype, "keymasterSecurityLevel", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
|
||||
], NonStandardKeyDescription.prototype, "attestationChallenge", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
|
||||
], NonStandardKeyDescription.prototype, "uniqueId", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: NonStandardAuthorizationList })
|
||||
], NonStandardKeyDescription.prototype, "softwareEnforced", void 0);
|
||||
tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnProp)({ type: NonStandardAuthorizationList })
|
||||
], NonStandardKeyDescription.prototype, "teeEnforced", void 0);
|
||||
let NonStandardKeyMintKeyDescription = class NonStandardKeyMintKeyDescription extends NonStandardKeyDescription {
|
||||
constructor(params = {}) {
|
||||
if ("keymasterVersion" in params && !("keyMintVersion" in params)) {
|
||||
params.keyMintVersion = params.keymasterVersion;
|
||||
}
|
||||
if ("keymasterSecurityLevel" in params && !("keyMintSecurityLevel" in params)) {
|
||||
params.keyMintSecurityLevel = params.keymasterSecurityLevel;
|
||||
}
|
||||
if ("teeEnforced" in params && !("hardwareEnforced" in params)) {
|
||||
params.hardwareEnforced = params.teeEnforced;
|
||||
}
|
||||
super(params);
|
||||
}
|
||||
};
|
||||
exports.NonStandardKeyMintKeyDescription = NonStandardKeyMintKeyDescription;
|
||||
exports.NonStandardKeyMintKeyDescription = NonStandardKeyMintKeyDescription = tslib_1.__decorate([
|
||||
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Sequence })
|
||||
], NonStandardKeyMintKeyDescription);
|
||||
24
api.hyungi.net/node_modules/@peculiar/asn1-android/build/es2015/attestation.js
generated
vendored
24
api.hyungi.net/node_modules/@peculiar/asn1-android/build/es2015/attestation.js
generated
vendored
@@ -1,24 +0,0 @@
|
||||
import { __decorate } from "tslib";
|
||||
import { AsnProp, AsnPropTypes } from "@peculiar/asn1-schema";
|
||||
export class AttestationPackageInfo {
|
||||
constructor(params = {}) {
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.OctetString })
|
||||
], AttestationPackageInfo.prototype, "packageName", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Integer })
|
||||
], AttestationPackageInfo.prototype, "version", void 0);
|
||||
export class AttestationApplicationId {
|
||||
constructor(params = {}) {
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
AsnProp({ type: AttestationPackageInfo, repeated: "set" })
|
||||
], AttestationApplicationId.prototype, "packageInfos", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.OctetString, repeated: "set" })
|
||||
], AttestationApplicationId.prototype, "signatureDigests", void 0);
|
||||
3
api.hyungi.net/node_modules/@peculiar/asn1-android/build/es2015/index.js
generated
vendored
3
api.hyungi.net/node_modules/@peculiar/asn1-android/build/es2015/index.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
export * from "./key_description";
|
||||
export * from "./nonstandard";
|
||||
export * from "./attestation";
|
||||
290
api.hyungi.net/node_modules/@peculiar/asn1-android/build/es2015/key_description.js
generated
vendored
290
api.hyungi.net/node_modules/@peculiar/asn1-android/build/es2015/key_description.js
generated
vendored
@@ -1,290 +0,0 @@
|
||||
var IntegerSet_1;
|
||||
import { __decorate } from "tslib";
|
||||
import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from "@peculiar/asn1-schema";
|
||||
export const id_ce_keyDescription = "1.3.6.1.4.1.11129.2.1.17";
|
||||
export var VerifiedBootState;
|
||||
(function (VerifiedBootState) {
|
||||
VerifiedBootState[VerifiedBootState["verified"] = 0] = "verified";
|
||||
VerifiedBootState[VerifiedBootState["selfSigned"] = 1] = "selfSigned";
|
||||
VerifiedBootState[VerifiedBootState["unverified"] = 2] = "unverified";
|
||||
VerifiedBootState[VerifiedBootState["failed"] = 3] = "failed";
|
||||
})(VerifiedBootState || (VerifiedBootState = {}));
|
||||
export class RootOfTrust {
|
||||
constructor(params = {}) {
|
||||
this.verifiedBootKey = new OctetString();
|
||||
this.deviceLocked = false;
|
||||
this.verifiedBootState = VerifiedBootState.verified;
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
AsnProp({ type: OctetString })
|
||||
], RootOfTrust.prototype, "verifiedBootKey", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Boolean })
|
||||
], RootOfTrust.prototype, "deviceLocked", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Enumerated })
|
||||
], RootOfTrust.prototype, "verifiedBootState", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: OctetString, optional: true })
|
||||
], RootOfTrust.prototype, "verifiedBootHash", void 0);
|
||||
let IntegerSet = IntegerSet_1 = class IntegerSet extends AsnArray {
|
||||
constructor(items) {
|
||||
super(items);
|
||||
Object.setPrototypeOf(this, IntegerSet_1.prototype);
|
||||
}
|
||||
};
|
||||
IntegerSet = IntegerSet_1 = __decorate([
|
||||
AsnType({ type: AsnTypeTypes.Set, itemType: AsnPropTypes.Integer })
|
||||
], IntegerSet);
|
||||
export { IntegerSet };
|
||||
export class AuthorizationList {
|
||||
constructor(params = {}) {
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
AsnProp({ context: 1, type: IntegerSet, optional: true })
|
||||
], AuthorizationList.prototype, "purpose", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 2, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "algorithm", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 3, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "keySize", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 5, type: IntegerSet, optional: true })
|
||||
], AuthorizationList.prototype, "digest", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 6, type: IntegerSet, optional: true })
|
||||
], AuthorizationList.prototype, "padding", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 10, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "ecCurve", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 200, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "rsaPublicExponent", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 203, type: IntegerSet, optional: true })
|
||||
], AuthorizationList.prototype, "mgfDigest", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 303, type: AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "rollbackResistance", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 305, type: AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "earlyBootOnly", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 400, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "activeDateTime", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 401, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "originationExpireDateTime", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 402, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "usageExpireDateTime", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 405, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "usageCountLimit", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 503, type: AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "noAuthRequired", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 504, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "userAuthType", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 505, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "authTimeout", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 506, type: AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "allowWhileOnBody", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 507, type: AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "trustedUserPresenceRequired", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 508, type: AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "trustedConfirmationRequired", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 509, type: AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "unlockedDeviceRequired", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 600, type: AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "allApplications", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 601, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "applicationId", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 701, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "creationDateTime", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 702, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "origin", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 703, type: AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "rollbackResistant", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 704, type: RootOfTrust, optional: true })
|
||||
], AuthorizationList.prototype, "rootOfTrust", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 705, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "osVersion", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 706, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "osPatchLevel", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 709, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationApplicationId", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 710, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdBrand", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 711, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdDevice", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 712, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdProduct", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 713, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdSerial", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 714, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdImei", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 715, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdMeid", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 716, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdManufacturer", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 717, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdModel", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 718, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "vendorPatchLevel", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 719, type: AsnPropTypes.Integer, optional: true })
|
||||
], AuthorizationList.prototype, "bootPatchLevel", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 720, type: AsnPropTypes.Null, optional: true })
|
||||
], AuthorizationList.prototype, "deviceUniqueAttestation", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 723, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "attestationIdSecondImei", void 0);
|
||||
__decorate([
|
||||
AsnProp({ context: 724, type: OctetString, optional: true })
|
||||
], AuthorizationList.prototype, "moduleHash", void 0);
|
||||
export var SecurityLevel;
|
||||
(function (SecurityLevel) {
|
||||
SecurityLevel[SecurityLevel["software"] = 0] = "software";
|
||||
SecurityLevel[SecurityLevel["trustedEnvironment"] = 1] = "trustedEnvironment";
|
||||
SecurityLevel[SecurityLevel["strongBox"] = 2] = "strongBox";
|
||||
})(SecurityLevel || (SecurityLevel = {}));
|
||||
export var Version;
|
||||
(function (Version) {
|
||||
Version[Version["KM2"] = 1] = "KM2";
|
||||
Version[Version["KM3"] = 2] = "KM3";
|
||||
Version[Version["KM4"] = 3] = "KM4";
|
||||
Version[Version["KM4_1"] = 4] = "KM4_1";
|
||||
Version[Version["keyMint1"] = 100] = "keyMint1";
|
||||
Version[Version["keyMint2"] = 200] = "keyMint2";
|
||||
Version[Version["keyMint3"] = 300] = "keyMint3";
|
||||
Version[Version["keyMint4"] = 400] = "keyMint4";
|
||||
})(Version || (Version = {}));
|
||||
export class KeyDescription {
|
||||
constructor(params = {}) {
|
||||
this.attestationVersion = Version.KM4;
|
||||
this.attestationSecurityLevel = SecurityLevel.software;
|
||||
this.keymasterVersion = 0;
|
||||
this.keymasterSecurityLevel = SecurityLevel.software;
|
||||
this.attestationChallenge = new OctetString();
|
||||
this.uniqueId = new OctetString();
|
||||
this.softwareEnforced = new AuthorizationList();
|
||||
this.teeEnforced = new AuthorizationList();
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Integer })
|
||||
], KeyDescription.prototype, "attestationVersion", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Enumerated })
|
||||
], KeyDescription.prototype, "attestationSecurityLevel", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Integer })
|
||||
], KeyDescription.prototype, "keymasterVersion", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Enumerated })
|
||||
], KeyDescription.prototype, "keymasterSecurityLevel", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: OctetString })
|
||||
], KeyDescription.prototype, "attestationChallenge", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: OctetString })
|
||||
], KeyDescription.prototype, "uniqueId", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AuthorizationList })
|
||||
], KeyDescription.prototype, "softwareEnforced", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AuthorizationList })
|
||||
], KeyDescription.prototype, "teeEnforced", void 0);
|
||||
export class KeyMintKeyDescription {
|
||||
constructor(params = {}) {
|
||||
this.attestationVersion = Version.keyMint4;
|
||||
this.attestationSecurityLevel = SecurityLevel.software;
|
||||
this.keyMintVersion = 0;
|
||||
this.keyMintSecurityLevel = SecurityLevel.software;
|
||||
this.attestationChallenge = new OctetString();
|
||||
this.uniqueId = new OctetString();
|
||||
this.softwareEnforced = new AuthorizationList();
|
||||
this.hardwareEnforced = new AuthorizationList();
|
||||
Object.assign(this, params);
|
||||
}
|
||||
toLegacyKeyDescription() {
|
||||
return new KeyDescription({
|
||||
attestationVersion: this.attestationVersion,
|
||||
attestationSecurityLevel: this.attestationSecurityLevel,
|
||||
keymasterVersion: this.keyMintVersion,
|
||||
keymasterSecurityLevel: this.keyMintSecurityLevel,
|
||||
attestationChallenge: this.attestationChallenge,
|
||||
uniqueId: this.uniqueId,
|
||||
softwareEnforced: this.softwareEnforced,
|
||||
teeEnforced: this.hardwareEnforced,
|
||||
});
|
||||
}
|
||||
static fromLegacyKeyDescription(keyDesc) {
|
||||
return new KeyMintKeyDescription({
|
||||
attestationVersion: keyDesc.attestationVersion,
|
||||
attestationSecurityLevel: keyDesc.attestationSecurityLevel,
|
||||
keyMintVersion: keyDesc.keymasterVersion,
|
||||
keyMintSecurityLevel: keyDesc.keymasterSecurityLevel,
|
||||
attestationChallenge: keyDesc.attestationChallenge,
|
||||
uniqueId: keyDesc.uniqueId,
|
||||
softwareEnforced: keyDesc.softwareEnforced,
|
||||
hardwareEnforced: keyDesc.teeEnforced,
|
||||
});
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Integer })
|
||||
], KeyMintKeyDescription.prototype, "attestationVersion", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Enumerated })
|
||||
], KeyMintKeyDescription.prototype, "attestationSecurityLevel", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Integer })
|
||||
], KeyMintKeyDescription.prototype, "keyMintVersion", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Enumerated })
|
||||
], KeyMintKeyDescription.prototype, "keyMintSecurityLevel", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: OctetString })
|
||||
], KeyMintKeyDescription.prototype, "attestationChallenge", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: OctetString })
|
||||
], KeyMintKeyDescription.prototype, "uniqueId", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AuthorizationList })
|
||||
], KeyMintKeyDescription.prototype, "softwareEnforced", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AuthorizationList })
|
||||
], KeyMintKeyDescription.prototype, "hardwareEnforced", void 0);
|
||||
100
api.hyungi.net/node_modules/@peculiar/asn1-android/build/es2015/nonstandard.js
generated
vendored
100
api.hyungi.net/node_modules/@peculiar/asn1-android/build/es2015/nonstandard.js
generated
vendored
@@ -1,100 +0,0 @@
|
||||
var NonStandardAuthorizationList_1;
|
||||
import { __decorate } from "tslib";
|
||||
import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from "@peculiar/asn1-schema";
|
||||
import { AuthorizationList, SecurityLevel, Version } from "./key_description";
|
||||
let NonStandardAuthorization = class NonStandardAuthorization extends AuthorizationList {
|
||||
};
|
||||
NonStandardAuthorization = __decorate([
|
||||
AsnType({ type: AsnTypeTypes.Choice })
|
||||
], NonStandardAuthorization);
|
||||
export { NonStandardAuthorization };
|
||||
let NonStandardAuthorizationList = NonStandardAuthorizationList_1 = class NonStandardAuthorizationList extends AsnArray {
|
||||
constructor(items) {
|
||||
super(items);
|
||||
Object.setPrototypeOf(this, NonStandardAuthorizationList_1.prototype);
|
||||
}
|
||||
findProperty(key) {
|
||||
const prop = this.find((o) => key in o);
|
||||
if (prop) {
|
||||
return prop[key];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
NonStandardAuthorizationList = NonStandardAuthorizationList_1 = __decorate([
|
||||
AsnType({ type: AsnTypeTypes.Sequence, itemType: NonStandardAuthorization })
|
||||
], NonStandardAuthorizationList);
|
||||
export { NonStandardAuthorizationList };
|
||||
export class NonStandardKeyDescription {
|
||||
get keyMintVersion() {
|
||||
return this.keymasterVersion;
|
||||
}
|
||||
set keyMintVersion(value) {
|
||||
this.keymasterVersion = value;
|
||||
}
|
||||
get keyMintSecurityLevel() {
|
||||
return this.keymasterSecurityLevel;
|
||||
}
|
||||
set keyMintSecurityLevel(value) {
|
||||
this.keymasterSecurityLevel = value;
|
||||
}
|
||||
get hardwareEnforced() {
|
||||
return this.teeEnforced;
|
||||
}
|
||||
set hardwareEnforced(value) {
|
||||
this.teeEnforced = value;
|
||||
}
|
||||
constructor(params = {}) {
|
||||
this.attestationVersion = Version.KM4;
|
||||
this.attestationSecurityLevel = SecurityLevel.software;
|
||||
this.keymasterVersion = 0;
|
||||
this.keymasterSecurityLevel = SecurityLevel.software;
|
||||
this.attestationChallenge = new OctetString();
|
||||
this.uniqueId = new OctetString();
|
||||
this.softwareEnforced = new NonStandardAuthorizationList();
|
||||
this.teeEnforced = new NonStandardAuthorizationList();
|
||||
Object.assign(this, params);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Integer })
|
||||
], NonStandardKeyDescription.prototype, "attestationVersion", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Enumerated })
|
||||
], NonStandardKeyDescription.prototype, "attestationSecurityLevel", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Integer })
|
||||
], NonStandardKeyDescription.prototype, "keymasterVersion", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: AsnPropTypes.Enumerated })
|
||||
], NonStandardKeyDescription.prototype, "keymasterSecurityLevel", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: OctetString })
|
||||
], NonStandardKeyDescription.prototype, "attestationChallenge", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: OctetString })
|
||||
], NonStandardKeyDescription.prototype, "uniqueId", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: NonStandardAuthorizationList })
|
||||
], NonStandardKeyDescription.prototype, "softwareEnforced", void 0);
|
||||
__decorate([
|
||||
AsnProp({ type: NonStandardAuthorizationList })
|
||||
], NonStandardKeyDescription.prototype, "teeEnforced", void 0);
|
||||
let NonStandardKeyMintKeyDescription = class NonStandardKeyMintKeyDescription extends NonStandardKeyDescription {
|
||||
constructor(params = {}) {
|
||||
if ("keymasterVersion" in params && !("keyMintVersion" in params)) {
|
||||
params.keyMintVersion = params.keymasterVersion;
|
||||
}
|
||||
if ("keymasterSecurityLevel" in params && !("keyMintSecurityLevel" in params)) {
|
||||
params.keyMintSecurityLevel = params.keymasterSecurityLevel;
|
||||
}
|
||||
if ("teeEnforced" in params && !("hardwareEnforced" in params)) {
|
||||
params.hardwareEnforced = params.teeEnforced;
|
||||
}
|
||||
super(params);
|
||||
}
|
||||
};
|
||||
NonStandardKeyMintKeyDescription = __decorate([
|
||||
AsnType({ type: AsnTypeTypes.Sequence })
|
||||
], NonStandardKeyMintKeyDescription);
|
||||
export { NonStandardKeyMintKeyDescription };
|
||||
31
api.hyungi.net/node_modules/@peculiar/asn1-android/build/types/attestation.d.ts
generated
vendored
31
api.hyungi.net/node_modules/@peculiar/asn1-android/build/types/attestation.d.ts
generated
vendored
@@ -1,31 +0,0 @@
|
||||
import { OctetString } from "@peculiar/asn1-schema";
|
||||
/**
|
||||
* Implements ASN.1 structure for attestation package info.
|
||||
*
|
||||
* ```asn
|
||||
* AttestationPackageInfo ::= SEQUENCE {
|
||||
* package_name OCTET_STRING,
|
||||
* version INTEGER,
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare class AttestationPackageInfo {
|
||||
packageName: OctetString;
|
||||
version: number;
|
||||
constructor(params?: Partial<AttestationPackageInfo>);
|
||||
}
|
||||
/**
|
||||
* Implements ASN.1 structure for attestation application id.
|
||||
*
|
||||
* ```asn
|
||||
* AttestationApplicationId ::= SEQUENCE {
|
||||
* package_infos SET OF AttestationPackageInfo,
|
||||
* signature_digests SET OF OCTET_STRING,
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare class AttestationApplicationId {
|
||||
packageInfos: AttestationPackageInfo[];
|
||||
signatureDigests: OctetString[];
|
||||
constructor(params?: Partial<AttestationApplicationId>);
|
||||
}
|
||||
3
api.hyungi.net/node_modules/@peculiar/asn1-android/build/types/index.d.ts
generated
vendored
3
api.hyungi.net/node_modules/@peculiar/asn1-android/build/types/index.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
export * from "./key_description";
|
||||
export * from "./nonstandard";
|
||||
export * from "./attestation";
|
||||
244
api.hyungi.net/node_modules/@peculiar/asn1-android/build/types/key_description.d.ts
generated
vendored
244
api.hyungi.net/node_modules/@peculiar/asn1-android/build/types/key_description.d.ts
generated
vendored
@@ -1,244 +0,0 @@
|
||||
import { AsnArray, OctetString } from "@peculiar/asn1-schema";
|
||||
/**
|
||||
* Extension OID for key description.
|
||||
*
|
||||
* ```asn
|
||||
* id-ce-keyDescription OBJECT IDENTIFIER ::= { 1 3 6 1 4 1 11129 2 1 17 }
|
||||
* ```
|
||||
*/
|
||||
export declare const id_ce_keyDescription = "1.3.6.1.4.1.11129.2.1.17";
|
||||
/**
|
||||
* Implements ASN.1 enumeration for verified boot state.
|
||||
*
|
||||
* ```asn
|
||||
* VerifiedBootState ::= ENUMERATED {
|
||||
* Verified (0),
|
||||
* SelfSigned (1),
|
||||
* Unverified (2),
|
||||
* Failed (3),
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare enum VerifiedBootState {
|
||||
verified = 0,
|
||||
selfSigned = 1,
|
||||
unverified = 2,
|
||||
failed = 3
|
||||
}
|
||||
/**
|
||||
* Implements ASN.1 structure for root of trust.
|
||||
*
|
||||
* ```asn
|
||||
* RootOfTrust ::= SEQUENCE {
|
||||
* verifiedBootKey OCTET_STRING,
|
||||
* deviceLocked BOOLEAN,
|
||||
* verifiedBootState VerifiedBootState,
|
||||
* verifiedBootHash OCTET_STRING, # KM4
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare class RootOfTrust {
|
||||
verifiedBootKey: OctetString;
|
||||
deviceLocked: boolean;
|
||||
verifiedBootState: VerifiedBootState;
|
||||
/**
|
||||
* `verifiedBootHash` must present in `KeyDescription` version 3
|
||||
*/
|
||||
verifiedBootHash?: OctetString;
|
||||
constructor(params?: Partial<RootOfTrust>);
|
||||
}
|
||||
/**
|
||||
* Implements ASN.1 structure for set of integers.
|
||||
*
|
||||
* ```asn
|
||||
* IntegerSet ::= SET OF INTEGER
|
||||
* ```
|
||||
*/
|
||||
export declare class IntegerSet extends AsnArray<number> {
|
||||
constructor(items?: number[]);
|
||||
}
|
||||
/**
|
||||
* Implements ASN.1 structure for authorization list.
|
||||
*
|
||||
* ```asn
|
||||
* AuthorizationList ::= SEQUENCE {
|
||||
* purpose [1] EXPLICIT SET OF INTEGER OPTIONAL,
|
||||
* algorithm [2] EXPLICIT INTEGER OPTIONAL,
|
||||
* keySize [3] EXPLICIT INTEGER OPTIONAL.
|
||||
* digest [5] EXPLICIT SET OF INTEGER OPTIONAL,
|
||||
* padding [6] EXPLICIT SET OF INTEGER OPTIONAL,
|
||||
* ecCurve [10] EXPLICIT INTEGER OPTIONAL,
|
||||
* rsaPublicExponent [200] EXPLICIT INTEGER OPTIONAL,
|
||||
* mgfDigest [203] EXPLICIT SET OF INTEGER OPTIONAL,
|
||||
* rollbackResistance [303] EXPLICIT NULL OPTIONAL, # KM4
|
||||
* earlyBootOnly [305] EXPLICIT NULL OPTIONAL, # version 4
|
||||
* activeDateTime [400] EXPLICIT INTEGER OPTIONAL
|
||||
* originationExpireDateTime [401] EXPLICIT INTEGER OPTIONAL
|
||||
* usageExpireDateTime [402] EXPLICIT INTEGER OPTIONAL
|
||||
* usageCountLimit [405] EXPLICIT INTEGER OPTIONAL,
|
||||
* noAuthRequired [503] EXPLICIT NULL OPTIONAL,
|
||||
* userAuthType [504] EXPLICIT INTEGER OPTIONAL,
|
||||
* authTimeout [505] EXPLICIT INTEGER OPTIONAL,
|
||||
* allowWhileOnBody [506] EXPLICIT NULL OPTIONAL,
|
||||
* trustedUserPresenceRequired [507] EXPLICIT NULL OPTIONAL, # KM4
|
||||
* trustedConfirmationRequired [508] EXPLICIT NULL OPTIONAL, # KM4
|
||||
* unlockedDeviceRequired [509] EXPLICIT NULL OPTIONAL, # KM4
|
||||
* allApplications [600] EXPLICIT NULL OPTIONAL,
|
||||
* applicationId [601] EXPLICIT OCTET_STRING OPTIONAL,
|
||||
* creationDateTime [701] EXPLICIT INTEGER OPTIONAL,
|
||||
* origin [702] EXPLICIT INTEGER OPTIONAL,
|
||||
* rollbackResistant [703] EXPLICIT NULL OPTIONAL, # KM2 and KM3 only.
|
||||
* rootOfTrust [704] EXPLICIT RootOfTrust OPTIONAL,
|
||||
* osVersion [705] EXPLICIT INTEGER OPTIONAL,
|
||||
* osPatchLevel [706] EXPLICIT INTEGER OPTIONAL,
|
||||
* attestationApplicationId [709] EXPLICIT OCTET_STRING OPTIONAL, # KM3
|
||||
* attestationIdBrand [710] EXPLICIT OCTET_STRING OPTIONAL, # KM3
|
||||
* attestationIdDevice [711] EXPLICIT OCTET_STRING OPTIONAL, # KM3
|
||||
* attestationIdProduct [712] EXPLICIT OCTET_STRING OPTIONAL, # KM3
|
||||
* attestationIdSerial [713] EXPLICIT OCTET_STRING OPTIONAL, # KM3
|
||||
* attestationIdImei [714] EXPLICIT OCTET_STRING OPTIONAL, # KM3
|
||||
* attestationIdMeid [715] EXPLICIT OCTET_STRING OPTIONAL, # KM3
|
||||
* attestationIdManufacturer [716] EXPLICIT OCTET_STRING OPTIONAL, # KM3
|
||||
* attestationIdModel [717] EXPLICIT OCTET_STRING OPTIONAL, # KM3
|
||||
* vendorPatchLevel [718] EXPLICIT INTEGER OPTIONAL, # KM4
|
||||
* bootPatchLevel [719] EXPLICIT INTEGER OPTIONAL, # KM4
|
||||
* deviceUniqueAttestation [720] EXPLICIT NULL OPTIONAL, # version 4
|
||||
* attestationIdSecondImei [723] EXPLICIT OCTET_STRING OPTIONAL,
|
||||
* moduleHash [724] EXPLICIT OCTET_STRING OPTIONAL,
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare class AuthorizationList {
|
||||
purpose?: IntegerSet;
|
||||
algorithm?: number;
|
||||
keySize?: number;
|
||||
digest?: IntegerSet;
|
||||
padding?: IntegerSet;
|
||||
ecCurve?: number;
|
||||
rsaPublicExponent?: number;
|
||||
mgfDigest?: IntegerSet;
|
||||
rollbackResistance?: null;
|
||||
earlyBootOnly?: null;
|
||||
activeDateTime?: number;
|
||||
originationExpireDateTime?: number;
|
||||
usageExpireDateTime?: number;
|
||||
usageCountLimit?: number;
|
||||
noAuthRequired?: null;
|
||||
userAuthType?: number;
|
||||
authTimeout?: number;
|
||||
allowWhileOnBody?: null;
|
||||
trustedUserPresenceRequired?: null;
|
||||
trustedConfirmationRequired?: null;
|
||||
unlockedDeviceRequired?: null;
|
||||
allApplications?: null;
|
||||
applicationId?: OctetString;
|
||||
creationDateTime?: number;
|
||||
origin?: number;
|
||||
rollbackResistant?: null;
|
||||
rootOfTrust?: RootOfTrust;
|
||||
osVersion?: number;
|
||||
osPatchLevel?: number;
|
||||
attestationApplicationId?: OctetString;
|
||||
attestationIdBrand?: OctetString;
|
||||
attestationIdDevice?: OctetString;
|
||||
attestationIdProduct?: OctetString;
|
||||
attestationIdSerial?: OctetString;
|
||||
attestationIdImei?: OctetString;
|
||||
attestationIdMeid?: OctetString;
|
||||
attestationIdManufacturer?: OctetString;
|
||||
attestationIdModel?: OctetString;
|
||||
vendorPatchLevel?: number;
|
||||
bootPatchLevel?: number;
|
||||
deviceUniqueAttestation?: null;
|
||||
attestationIdSecondImei?: OctetString;
|
||||
moduleHash?: OctetString;
|
||||
constructor(params?: Partial<AuthorizationList>);
|
||||
}
|
||||
/**
|
||||
* Implements ASN.1 structure for security level.
|
||||
*
|
||||
* ```asn
|
||||
* SecurityLevel ::= ENUMERATED {
|
||||
* Software (0),
|
||||
* TrustedEnvironment (1),
|
||||
* StrongBox (2),
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare enum SecurityLevel {
|
||||
software = 0,
|
||||
trustedEnvironment = 1,
|
||||
strongBox = 2
|
||||
}
|
||||
export declare enum Version {
|
||||
KM2 = 1,
|
||||
KM3 = 2,
|
||||
KM4 = 3,
|
||||
KM4_1 = 4,
|
||||
keyMint1 = 100,
|
||||
keyMint2 = 200,
|
||||
keyMint3 = 300,
|
||||
keyMint4 = 400
|
||||
}
|
||||
/**
|
||||
* Implements ASN.1 structure for key description.
|
||||
*
|
||||
* ```asn
|
||||
* KeyDescription ::= SEQUENCE {
|
||||
* attestationVersion INTEGER, # versions 1, 2, 3, 4, 100, and 200
|
||||
* attestationSecurityLevel SecurityLevel,
|
||||
* keymasterVersion INTEGER,
|
||||
* keymasterSecurityLevel SecurityLevel,
|
||||
* attestationChallenge OCTET_STRING,
|
||||
* uniqueId OCTET_STRING,
|
||||
* softwareEnforced AuthorizationList,
|
||||
* teeEnforced AuthorizationList,
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare class KeyDescription {
|
||||
attestationVersion: number | Version;
|
||||
attestationSecurityLevel: SecurityLevel;
|
||||
keymasterVersion: number;
|
||||
keymasterSecurityLevel: SecurityLevel;
|
||||
attestationChallenge: OctetString;
|
||||
uniqueId: OctetString;
|
||||
softwareEnforced: AuthorizationList;
|
||||
teeEnforced: AuthorizationList;
|
||||
constructor(params?: Partial<KeyDescription>);
|
||||
}
|
||||
/**
|
||||
* Implements ASN.1 structure for KeyMint key description (v300 and v400).
|
||||
*
|
||||
* ```asn
|
||||
* KeyDescription ::= SEQUENCE {
|
||||
* attestationVersion INTEGER, # versions 300 and 400
|
||||
* attestationSecurityLevel SecurityLevel,
|
||||
* keyMintVersion INTEGER,
|
||||
* keyMintSecurityLevel SecurityLevel,
|
||||
* attestationChallenge OCTET_STRING,
|
||||
* uniqueId OCTET_STRING,
|
||||
* softwareEnforced AuthorizationList,
|
||||
* hardwareEnforced AuthorizationList,
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare class KeyMintKeyDescription {
|
||||
attestationVersion: number | Version;
|
||||
attestationSecurityLevel: SecurityLevel;
|
||||
keyMintVersion: number;
|
||||
keyMintSecurityLevel: SecurityLevel;
|
||||
attestationChallenge: OctetString;
|
||||
uniqueId: OctetString;
|
||||
softwareEnforced: AuthorizationList;
|
||||
hardwareEnforced: AuthorizationList;
|
||||
constructor(params?: Partial<KeyMintKeyDescription>);
|
||||
/**
|
||||
* Convert to legacy KeyDescription for backwards compatibility
|
||||
*/
|
||||
toLegacyKeyDescription(): KeyDescription;
|
||||
/**
|
||||
* Create from legacy KeyDescription for backwards compatibility
|
||||
*/
|
||||
static fromLegacyKeyDescription(keyDesc: KeyDescription): KeyMintKeyDescription;
|
||||
}
|
||||
83
api.hyungi.net/node_modules/@peculiar/asn1-android/build/types/nonstandard.d.ts
generated
vendored
83
api.hyungi.net/node_modules/@peculiar/asn1-android/build/types/nonstandard.d.ts
generated
vendored
@@ -1,83 +0,0 @@
|
||||
import { AsnArray, OctetString } from "@peculiar/asn1-schema";
|
||||
import { AuthorizationList, SecurityLevel, Version } from "./key_description";
|
||||
/**
|
||||
* This file contains classes to handle non-standard key descriptions and authorizations.
|
||||
*
|
||||
* Due to an issue with the asn1-schema library, referenced at https://github.com/PeculiarVentures/asn1-schema/issues/98#issuecomment-1764345351,
|
||||
* the standard key description does not allow for a non-strict order of fields in the `softwareEnforced` and `teeEnforced` attributes.
|
||||
*
|
||||
* To address this and provide greater flexibility, the `NonStandardKeyDescription` and
|
||||
* `NonStandardAuthorizationList` classes were created, allowing for the use of non-standard authorizations and a flexible field order.
|
||||
*
|
||||
* The purpose of these modifications is to ensure compatibility with specific requirements and standards, as well as to offer
|
||||
* more convenient tools for working with key descriptions and authorizations.
|
||||
*
|
||||
* Please refer to the documentation and class comments before using or modifying them.
|
||||
*/
|
||||
/**
|
||||
* Represents a non-standard authorization for NonStandardAuthorizationList. It uses the same
|
||||
* structure as AuthorizationList, but it is a CHOICE instead of a SEQUENCE, that allows for
|
||||
* non-strict ordering of fields.
|
||||
*/
|
||||
export declare class NonStandardAuthorization extends AuthorizationList {
|
||||
}
|
||||
/**
|
||||
* Represents a list of non-standard authorizations.
|
||||
* ```asn
|
||||
* NonStandardAuthorizationList ::= SEQUENCE OF NonStandardAuthorization
|
||||
* ```
|
||||
*/
|
||||
export declare class NonStandardAuthorizationList extends AsnArray<NonStandardAuthorization> {
|
||||
constructor(items?: NonStandardAuthorization[]);
|
||||
/**
|
||||
* Finds the first authorization that contains the specified key.
|
||||
* @param key The key to search for.
|
||||
* @returns The first authorization that contains the specified key, or `undefined` if not found.
|
||||
*/
|
||||
findProperty<K extends keyof AuthorizationList>(key: K): AuthorizationList[K] | undefined;
|
||||
}
|
||||
/**
|
||||
* The AuthorizationList class allows for non-strict ordering of fields in the
|
||||
* softwareEnforced and teeEnforced/hardwareEnforced fields.
|
||||
*
|
||||
* This behavior is due to an issue with the asn1-schema library, which is
|
||||
* documented here: https://github.com/PeculiarVentures/asn1-schema/issues/98#issuecomment-1764345351
|
||||
*
|
||||
* ```asn
|
||||
* KeyDescription ::= SEQUENCE {
|
||||
* attestationVersion INTEGER, # versions 1, 2, 3, 4, 100, 200, 300, and 400
|
||||
* attestationSecurityLevel SecurityLevel,
|
||||
* keymasterVersion/keyMintVersion INTEGER,
|
||||
* keymasterSecurityLevel/keyMintSecurityLevel SecurityLevel,
|
||||
* attestationChallenge OCTET_STRING,
|
||||
* uniqueId OCTET_STRING,
|
||||
* softwareEnforced NonStandardAuthorizationList,
|
||||
* teeEnforced/hardwareEnforced NonStandardAuthorizationList,
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare class NonStandardKeyDescription {
|
||||
attestationVersion: number | Version;
|
||||
attestationSecurityLevel: SecurityLevel;
|
||||
keymasterVersion: number;
|
||||
keymasterSecurityLevel: SecurityLevel;
|
||||
attestationChallenge: OctetString;
|
||||
uniqueId: OctetString;
|
||||
softwareEnforced: NonStandardAuthorizationList;
|
||||
teeEnforced: NonStandardAuthorizationList;
|
||||
get keyMintVersion(): number;
|
||||
set keyMintVersion(value: number);
|
||||
get keyMintSecurityLevel(): SecurityLevel;
|
||||
set keyMintSecurityLevel(value: SecurityLevel);
|
||||
get hardwareEnforced(): NonStandardAuthorizationList;
|
||||
set hardwareEnforced(value: NonStandardAuthorizationList);
|
||||
constructor(params?: Partial<NonStandardKeyDescription>);
|
||||
}
|
||||
/**
|
||||
* New class for v300 and v400 KeyMint non-standard key description.
|
||||
* This uses the same underlying structure as NonStandardKeyDescription,
|
||||
* but with renamed properties to match the updated specification.
|
||||
*/
|
||||
export declare class NonStandardKeyMintKeyDescription extends NonStandardKeyDescription {
|
||||
constructor(params?: Partial<NonStandardKeyDescription>);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
12
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/LICENSE.txt
generated
vendored
12
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/LICENSE.txt
generated
vendored
@@ -1,12 +0,0 @@
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
164
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/README.md
generated
vendored
164
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/README.md
generated
vendored
@@ -1,164 +0,0 @@
|
||||
# tslib
|
||||
|
||||
This is a runtime library for [TypeScript](https://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
|
||||
|
||||
This library is primarily used by the `--importHelpers` flag in TypeScript.
|
||||
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
|
||||
|
||||
```ts
|
||||
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.x = {};
|
||||
exports.y = __assign({}, exports.x);
|
||||
|
||||
```
|
||||
|
||||
will instead be emitted as something like the following:
|
||||
|
||||
```ts
|
||||
var tslib_1 = require("tslib");
|
||||
exports.x = {};
|
||||
exports.y = tslib_1.__assign({}, exports.x);
|
||||
```
|
||||
|
||||
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead.
|
||||
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
|
||||
|
||||
# Installing
|
||||
|
||||
For the latest stable version, run:
|
||||
|
||||
## npm
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
npm install tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
npm install tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
npm install tslib@1.6.1
|
||||
```
|
||||
|
||||
## yarn
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
yarn add tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
yarn add tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
yarn add tslib@1.6.1
|
||||
```
|
||||
|
||||
## bower
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
bower install tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
bower install tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
bower install tslib@1.6.1
|
||||
```
|
||||
|
||||
## JSPM
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
jspm install tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
jspm install tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
jspm install tslib@1.6.1
|
||||
```
|
||||
|
||||
# Usage
|
||||
|
||||
Set the `importHelpers` compiler option on the command line:
|
||||
|
||||
```
|
||||
tsc --importHelpers file.ts
|
||||
```
|
||||
|
||||
or in your tsconfig.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"importHelpers": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### For bower and JSPM users
|
||||
|
||||
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "amd",
|
||||
"importHelpers": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"tslib" : ["bower_components/tslib/tslib.d.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For JSPM users:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "system",
|
||||
"importHelpers": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
||||
- Choose your new version number
|
||||
- Set it in `package.json` and `bower.json`
|
||||
- Create a tag: `git tag [version]`
|
||||
- Push the tag: `git push --tags`
|
||||
- Create a [release in GitHub](https://github.com/microsoft/tslib/releases)
|
||||
- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow
|
||||
|
||||
Done.
|
||||
|
||||
# Contribute
|
||||
|
||||
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
|
||||
|
||||
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
|
||||
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
|
||||
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
|
||||
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
|
||||
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
|
||||
|
||||
# Documentation
|
||||
|
||||
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
|
||||
* [Programming handbook](http://www.typescriptlang.org/Handbook)
|
||||
* [Homepage](http://www.typescriptlang.org/)
|
||||
41
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/SECURITY.md
generated
vendored
41
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/SECURITY.md
generated
vendored
@@ -1,41 +0,0 @@
|
||||
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
|
||||
|
||||
## Security
|
||||
|
||||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
||||
|
||||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||
|
||||
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
|
||||
|
||||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
|
||||
|
||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
|
||||
|
||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||
|
||||
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||
* Full paths of source file(s) related to the manifestation of the issue
|
||||
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||
* Any special configuration required to reproduce the issue
|
||||
* Step-by-step instructions to reproduce the issue
|
||||
* Proof-of-concept or exploit code (if possible)
|
||||
* Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
|
||||
|
||||
## Preferred Languages
|
||||
|
||||
We prefer all communications to be in English.
|
||||
|
||||
## Policy
|
||||
|
||||
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
|
||||
|
||||
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
||||
38
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/modules/index.d.ts
generated
vendored
38
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/modules/index.d.ts
generated
vendored
@@ -1,38 +0,0 @@
|
||||
// Note: named reexports are used instead of `export *` because
|
||||
// TypeScript itself doesn't resolve the `export *` when checking
|
||||
// if a particular helper exists.
|
||||
export {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__esDecorate,
|
||||
__runInitializers,
|
||||
__propKey,
|
||||
__setFunctionName,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
__createBinding,
|
||||
__addDisposableResource,
|
||||
__disposeResources,
|
||||
__rewriteRelativeImportExtension,
|
||||
} from '../tslib.js';
|
||||
export * as default from '../tslib.js';
|
||||
70
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/modules/index.js
generated
vendored
70
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/modules/index.js
generated
vendored
@@ -1,70 +0,0 @@
|
||||
import tslib from '../tslib.js';
|
||||
const {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__esDecorate,
|
||||
__runInitializers,
|
||||
__propKey,
|
||||
__setFunctionName,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__createBinding,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
__addDisposableResource,
|
||||
__disposeResources,
|
||||
__rewriteRelativeImportExtension,
|
||||
} = tslib;
|
||||
export {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__esDecorate,
|
||||
__runInitializers,
|
||||
__propKey,
|
||||
__setFunctionName,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__createBinding,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
__addDisposableResource,
|
||||
__disposeResources,
|
||||
__rewriteRelativeImportExtension,
|
||||
};
|
||||
export default tslib;
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
47
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/package.json
generated
vendored
47
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/package.json
generated
vendored
@@ -1,47 +0,0 @@
|
||||
{
|
||||
"name": "tslib",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "https://www.typescriptlang.org/",
|
||||
"version": "2.8.1",
|
||||
"license": "0BSD",
|
||||
"description": "Runtime library for TypeScript helper functions",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
"Microsoft",
|
||||
"compiler",
|
||||
"language",
|
||||
"javascript",
|
||||
"tslib",
|
||||
"runtime"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/TypeScript/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/tslib.git"
|
||||
},
|
||||
"main": "tslib.js",
|
||||
"module": "tslib.es6.js",
|
||||
"jsnext:main": "tslib.es6.js",
|
||||
"typings": "tslib.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"module": {
|
||||
"types": "./modules/index.d.ts",
|
||||
"default": "./tslib.es6.mjs"
|
||||
},
|
||||
"import": {
|
||||
"node": "./modules/index.js",
|
||||
"default": {
|
||||
"types": "./modules/index.d.ts",
|
||||
"default": "./tslib.es6.mjs"
|
||||
}
|
||||
},
|
||||
"default": "./tslib.js"
|
||||
},
|
||||
"./*": "./*",
|
||||
"./": "./"
|
||||
}
|
||||
}
|
||||
460
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/tslib.d.ts
generated
vendored
460
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/tslib.d.ts
generated
vendored
@@ -1,460 +0,0 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/**
|
||||
* Used to shim class extends.
|
||||
*
|
||||
* @param d The derived class.
|
||||
* @param b The base class.
|
||||
*/
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
*
|
||||
* @param t The target object to copy to.
|
||||
* @param sources One or more source objects from which to copy properties
|
||||
*/
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
|
||||
/**
|
||||
* Performs a rest spread on an object.
|
||||
*
|
||||
* @param t The source value.
|
||||
* @param propertyNames The property names excluded from the rest spread.
|
||||
*/
|
||||
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
|
||||
|
||||
/**
|
||||
* Applies decorators to a target object
|
||||
*
|
||||
* @param decorators The set of decorators to apply.
|
||||
* @param target The target object.
|
||||
* @param key If specified, the own property to apply the decorators to.
|
||||
* @param desc The property descriptor, defaults to fetching the descriptor from the target object.
|
||||
* @experimental
|
||||
*/
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
|
||||
/**
|
||||
* Creates an observing function decorator from a parameter decorator.
|
||||
*
|
||||
* @param paramIndex The parameter index to apply the decorator to.
|
||||
* @param decorator The parameter decorator to apply. Note that the return value is ignored.
|
||||
* @experimental
|
||||
*/
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
|
||||
/**
|
||||
* Applies decorators to a class or class member, following the native ECMAScript decorator specification.
|
||||
* @param ctor For non-field class members, the class constructor. Otherwise, `null`.
|
||||
* @param descriptorIn The `PropertyDescriptor` to use when unable to look up the property from `ctor`.
|
||||
* @param decorators The decorators to apply
|
||||
* @param contextIn The `DecoratorContext` to clone for each decorator application.
|
||||
* @param initializers An array of field initializer mutation functions into which new initializers are written.
|
||||
* @param extraInitializers An array of extra initializer functions into which new initializers are written.
|
||||
*/
|
||||
export declare function __esDecorate(ctor: Function | null, descriptorIn: object | null, decorators: Function[], contextIn: object, initializers: Function[] | null, extraInitializers: Function[]): void;
|
||||
|
||||
/**
|
||||
* Runs field initializers or extra initializers generated by `__esDecorate`.
|
||||
* @param thisArg The `this` argument to use.
|
||||
* @param initializers The array of initializers to evaluate.
|
||||
* @param value The initial value to pass to the initializers.
|
||||
*/
|
||||
export declare function __runInitializers(thisArg: unknown, initializers: Function[], value?: any): any;
|
||||
|
||||
/**
|
||||
* Converts a computed property name into a `string` or `symbol` value.
|
||||
*/
|
||||
export declare function __propKey(x: any): string | symbol;
|
||||
|
||||
/**
|
||||
* Assigns the name of a function derived from the left-hand side of an assignment.
|
||||
* @param f The function to rename.
|
||||
* @param name The new name for the function.
|
||||
* @param prefix A prefix (such as `"get"` or `"set"`) to insert before the name.
|
||||
*/
|
||||
export declare function __setFunctionName(f: Function, name: string | symbol, prefix?: string): Function;
|
||||
|
||||
/**
|
||||
* Creates a decorator that sets metadata.
|
||||
*
|
||||
* @param metadataKey The metadata key
|
||||
* @param metadataValue The metadata value
|
||||
* @experimental
|
||||
*/
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
|
||||
/**
|
||||
* Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`.
|
||||
*
|
||||
* @param thisArg The reference to use as the `this` value in the generator function
|
||||
* @param _arguments The optional arguments array
|
||||
* @param P The optional promise constructor argument, defaults to the `Promise` property of the global object.
|
||||
* @param generator The generator function
|
||||
*/
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
|
||||
/**
|
||||
* Creates an Iterator object using the body as the implementation.
|
||||
*
|
||||
* @param thisArg The reference to use as the `this` value in the function
|
||||
* @param body The generator state-machine based implementation.
|
||||
*
|
||||
* @see [./docs/generator.md]
|
||||
*/
|
||||
export declare function __generator(thisArg: any, body: Function): any;
|
||||
|
||||
/**
|
||||
* Creates bindings for all enumerable properties of `m` on `exports`
|
||||
*
|
||||
* @param m The source object
|
||||
* @param o The `exports` object.
|
||||
*/
|
||||
export declare function __exportStar(m: any, o: any): void;
|
||||
|
||||
/**
|
||||
* Creates a value iterator from an `Iterable` or `ArrayLike` object.
|
||||
*
|
||||
* @param o The object.
|
||||
* @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`.
|
||||
*/
|
||||
export declare function __values(o: any): any;
|
||||
|
||||
/**
|
||||
* Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array.
|
||||
*
|
||||
* @param o The object to read from.
|
||||
* @param n The maximum number of arguments to read, defaults to `Infinity`.
|
||||
*/
|
||||
export declare function __read(o: any, n?: number): any[];
|
||||
|
||||
/**
|
||||
* Creates an array from iterable spread.
|
||||
*
|
||||
* @param args The Iterable objects to spread.
|
||||
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
|
||||
*/
|
||||
export declare function __spread(...args: any[][]): any[];
|
||||
|
||||
/**
|
||||
* Creates an array from array spread.
|
||||
*
|
||||
* @param args The ArrayLikes to spread into the resulting array.
|
||||
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
|
||||
*/
|
||||
export declare function __spreadArrays(...args: any[][]): any[];
|
||||
|
||||
/**
|
||||
* Spreads the `from` array into the `to` array.
|
||||
*
|
||||
* @param pack Replace empty elements with `undefined`.
|
||||
*/
|
||||
export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[];
|
||||
|
||||
/**
|
||||
* Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded,
|
||||
* and instead should be awaited and the resulting value passed back to the generator.
|
||||
*
|
||||
* @param v The value to await.
|
||||
*/
|
||||
export declare function __await(v: any): any;
|
||||
|
||||
/**
|
||||
* Converts a generator function into an async generator function, by using `yield __await`
|
||||
* in place of normal `await`.
|
||||
*
|
||||
* @param thisArg The reference to use as the `this` value in the generator function
|
||||
* @param _arguments The optional arguments array
|
||||
* @param generator The generator function
|
||||
*/
|
||||
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
|
||||
|
||||
/**
|
||||
* Used to wrap a potentially async iterator in such a way so that it wraps the result
|
||||
* of calling iterator methods of `o` in `__await` instances, and then yields the awaited values.
|
||||
*
|
||||
* @param o The potentially async iterator.
|
||||
* @returns A synchronous iterator yielding `__await` instances on every odd invocation
|
||||
* and returning the awaited `IteratorResult` passed to `next` every even invocation.
|
||||
*/
|
||||
export declare function __asyncDelegator(o: any): any;
|
||||
|
||||
/**
|
||||
* Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object.
|
||||
*
|
||||
* @param o The object.
|
||||
* @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`.
|
||||
*/
|
||||
export declare function __asyncValues(o: any): any;
|
||||
|
||||
/**
|
||||
* Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays.
|
||||
*
|
||||
* @param cooked The cooked possibly-sparse array.
|
||||
* @param raw The raw string content.
|
||||
*/
|
||||
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
|
||||
|
||||
/**
|
||||
* Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS.
|
||||
*
|
||||
* ```js
|
||||
* import Default, { Named, Other } from "mod";
|
||||
* // or
|
||||
* import { default as Default, Named, Other } from "mod";
|
||||
* ```
|
||||
*
|
||||
* @param mod The CommonJS module exports object.
|
||||
*/
|
||||
export declare function __importStar<T>(mod: T): T;
|
||||
|
||||
/**
|
||||
* Used to shim default imports in ECMAScript Modules transpiled to CommonJS.
|
||||
*
|
||||
* ```js
|
||||
* import Default from "mod";
|
||||
* ```
|
||||
*
|
||||
* @param mod The CommonJS module exports object.
|
||||
*/
|
||||
export declare function __importDefault<T>(mod: T): T | { default: T };
|
||||
|
||||
/**
|
||||
* Emulates reading a private instance field.
|
||||
*
|
||||
* @param receiver The instance from which to read the private field.
|
||||
* @param state A WeakMap containing the private field value for an instance.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean, get(o: T): V | undefined },
|
||||
kind?: "f"
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates reading a private static field.
|
||||
*
|
||||
* @param receiver The object from which to read the private static field.
|
||||
* @param state The class constructor containing the definition of the static field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The descriptor that holds the static field value.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
kind: "f",
|
||||
f: { value: V }
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates evaluating a private instance "get" accessor.
|
||||
*
|
||||
* @param receiver The instance on which to evaluate the private "get" accessor.
|
||||
* @param state A WeakSet used to verify an instance supports the private "get" accessor.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "get" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean },
|
||||
kind: "a",
|
||||
f: () => V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates evaluating a private static "get" accessor.
|
||||
*
|
||||
* @param receiver The object on which to evaluate the private static "get" accessor.
|
||||
* @param state The class constructor containing the definition of the static "get" accessor.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "get" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
kind: "a",
|
||||
f: () => V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates reading a private instance method.
|
||||
*
|
||||
* @param receiver The instance from which to read a private method.
|
||||
* @param state A WeakSet used to verify an instance supports the private method.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The function to return as the private instance method.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends object, V extends (...args: any[]) => unknown>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean },
|
||||
kind: "m",
|
||||
f: V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates reading a private static method.
|
||||
*
|
||||
* @param receiver The object from which to read the private static method.
|
||||
* @param state The class constructor containing the definition of the static method.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The function to return as the private static method.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V extends (...args: any[]) => unknown>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
kind: "m",
|
||||
f: V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private instance field.
|
||||
*
|
||||
* @param receiver The instance on which to set a private field value.
|
||||
* @param state A WeakMap used to store the private field value for an instance.
|
||||
* @param value The value to store in the private field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean, set(o: T, value: V): unknown },
|
||||
value: V,
|
||||
kind?: "f"
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private static field.
|
||||
*
|
||||
* @param receiver The object on which to set the private static field.
|
||||
* @param state The class constructor containing the definition of the private static field.
|
||||
* @param value The value to store in the private field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The descriptor that holds the static field value.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
value: V,
|
||||
kind: "f",
|
||||
f: { value: V }
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private instance "set" accessor.
|
||||
*
|
||||
* @param receiver The instance on which to evaluate the private instance "set" accessor.
|
||||
* @param state A WeakSet used to verify an instance supports the private "set" accessor.
|
||||
* @param value The value to store in the private accessor.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "set" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean },
|
||||
value: V,
|
||||
kind: "a",
|
||||
f: (v: V) => void
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private static "set" accessor.
|
||||
*
|
||||
* @param receiver The object on which to evaluate the private static "set" accessor.
|
||||
* @param state The class constructor containing the definition of the static "set" accessor.
|
||||
* @param value The value to store in the private field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "set" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
value: V,
|
||||
kind: "a",
|
||||
f: (v: V) => void
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Checks for the existence of a private field/method/accessor.
|
||||
*
|
||||
* @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member.
|
||||
* @param receiver The object for which to test the presence of the private member.
|
||||
*/
|
||||
export declare function __classPrivateFieldIn(
|
||||
state: (new (...args: any[]) => unknown) | { has(o: any): boolean },
|
||||
receiver: unknown,
|
||||
): boolean;
|
||||
|
||||
/**
|
||||
* Creates a re-export binding on `object` with key `objectKey` that references `target[key]`.
|
||||
*
|
||||
* @param object The local `exports` object.
|
||||
* @param target The object to re-export from.
|
||||
* @param key The property key of `target` to re-export.
|
||||
* @param objectKey The property key to re-export as. Defaults to `key`.
|
||||
*/
|
||||
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;
|
||||
|
||||
/**
|
||||
* Adds a disposable resource to a resource-tracking environment object.
|
||||
* @param env A resource-tracking environment object.
|
||||
* @param value Either a Disposable or AsyncDisposable object, `null`, or `undefined`.
|
||||
* @param async When `true`, `AsyncDisposable` resources can be added. When `false`, `AsyncDisposable` resources cannot be added.
|
||||
* @returns The {@link value} argument.
|
||||
*
|
||||
* @throws {TypeError} If {@link value} is not an object, or if either `Symbol.dispose` or `Symbol.asyncDispose` are not
|
||||
* defined, or if {@link value} does not have an appropriate `Symbol.dispose` or `Symbol.asyncDispose` method.
|
||||
*/
|
||||
export declare function __addDisposableResource<T>(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }, value: T, async: boolean): T;
|
||||
|
||||
/**
|
||||
* Disposes all resources in a resource-tracking environment object.
|
||||
* @param env A resource-tracking environment object.
|
||||
* @returns A {@link Promise} if any resources in the environment were marked as `async` when added; otherwise, `void`.
|
||||
*
|
||||
* @throws {SuppressedError} if an error thrown during disposal would have suppressed a prior error from disposal or the
|
||||
* error recorded in the resource-tracking environment object.
|
||||
* @seealso {@link __addDisposableResource}
|
||||
*/
|
||||
export declare function __disposeResources(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }): any;
|
||||
|
||||
/**
|
||||
* Transforms a relative import specifier ending in a non-declaration TypeScript file extension to its JavaScript file extension counterpart.
|
||||
* @param path The import specifier.
|
||||
* @param preserveJsx Causes '*.tsx' to transform to '*.jsx' instead of '*.js'. Should be true when `--jsx` is set to `preserve`.
|
||||
*/
|
||||
export declare function __rewriteRelativeImportExtension(path: string, preserveJsx?: boolean): string;
|
||||
1
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/tslib.es6.html
generated
vendored
1
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/tslib.es6.html
generated
vendored
@@ -1 +0,0 @@
|
||||
<script src="tslib.es6.js"></script>
|
||||
402
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/tslib.es6.js
generated
vendored
402
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/tslib.es6.js
generated
vendored
@@ -1,402 +0,0 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
||||
|
||||
var extendStatics = function(d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
|
||||
export function __extends(d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
export var __assign = function() {
|
||||
__assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
return __assign.apply(this, arguments);
|
||||
}
|
||||
|
||||
export function __rest(s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
export function __decorate(decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
}
|
||||
|
||||
export function __param(paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
}
|
||||
|
||||
export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
||||
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
||||
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
||||
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
||||
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
||||
var _, done = false;
|
||||
for (var i = decorators.length - 1; i >= 0; i--) {
|
||||
var context = {};
|
||||
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
||||
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
||||
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
||||
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
||||
if (kind === "accessor") {
|
||||
if (result === void 0) continue;
|
||||
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
||||
if (_ = accept(result.get)) descriptor.get = _;
|
||||
if (_ = accept(result.set)) descriptor.set = _;
|
||||
if (_ = accept(result.init)) initializers.unshift(_);
|
||||
}
|
||||
else if (_ = accept(result)) {
|
||||
if (kind === "field") initializers.unshift(_);
|
||||
else descriptor[key] = _;
|
||||
}
|
||||
}
|
||||
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
||||
done = true;
|
||||
};
|
||||
|
||||
export function __runInitializers(thisArg, initializers, value) {
|
||||
var useValue = arguments.length > 2;
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
||||
}
|
||||
return useValue ? value : void 0;
|
||||
};
|
||||
|
||||
export function __propKey(x) {
|
||||
return typeof x === "symbol" ? x : "".concat(x);
|
||||
};
|
||||
|
||||
export function __setFunctionName(f, name, prefix) {
|
||||
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
||||
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
||||
};
|
||||
|
||||
export function __metadata(metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
}
|
||||
|
||||
export function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
export function __generator(thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
||||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
}
|
||||
|
||||
export var __createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
export function __exportStar(m, o) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
||||
}
|
||||
|
||||
export function __values(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
}
|
||||
|
||||
export function __read(o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export function __spread() {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export function __spreadArrays() {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
}
|
||||
|
||||
export function __spreadArray(to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
}
|
||||
|
||||
export function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
|
||||
export function __asyncGenerator(thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
||||
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
}
|
||||
|
||||
export function __asyncDelegator(o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
||||
}
|
||||
|
||||
export function __asyncValues(o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
}
|
||||
|
||||
export function __makeTemplateObject(cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
|
||||
export function __importStar(mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
}
|
||||
|
||||
export function __importDefault(mod) {
|
||||
return (mod && mod.__esModule) ? mod : { default: mod };
|
||||
}
|
||||
|
||||
export function __classPrivateFieldGet(receiver, state, kind, f) {
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
||||
}
|
||||
|
||||
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
||||
if (kind === "m") throw new TypeError("Private method is not writable");
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
||||
}
|
||||
|
||||
export function __classPrivateFieldIn(state, receiver) {
|
||||
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
||||
return typeof state === "function" ? receiver === state : state.has(receiver);
|
||||
}
|
||||
|
||||
export function __addDisposableResource(env, value, async) {
|
||||
if (value !== null && value !== void 0) {
|
||||
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
||||
var dispose, inner;
|
||||
if (async) {
|
||||
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
||||
dispose = value[Symbol.asyncDispose];
|
||||
}
|
||||
if (dispose === void 0) {
|
||||
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
||||
dispose = value[Symbol.dispose];
|
||||
if (async) inner = dispose;
|
||||
}
|
||||
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
||||
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
||||
env.stack.push({ value: value, dispose: dispose, async: async });
|
||||
}
|
||||
else if (async) {
|
||||
env.stack.push({ async: true });
|
||||
}
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
||||
var e = new Error(message);
|
||||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
||||
};
|
||||
|
||||
export function __disposeResources(env) {
|
||||
function fail(e) {
|
||||
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
||||
env.hasError = true;
|
||||
}
|
||||
var r, s = 0;
|
||||
function next() {
|
||||
while (r = env.stack.pop()) {
|
||||
try {
|
||||
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
||||
if (r.dispose) {
|
||||
var result = r.dispose.call(r.value);
|
||||
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
||||
}
|
||||
else s |= 1;
|
||||
}
|
||||
catch (e) {
|
||||
fail(e);
|
||||
}
|
||||
}
|
||||
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
||||
if (env.hasError) throw env.error;
|
||||
}
|
||||
return next();
|
||||
}
|
||||
|
||||
export function __rewriteRelativeImportExtension(path, preserveJsx) {
|
||||
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
||||
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
||||
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
||||
});
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
export default {
|
||||
__extends: __extends,
|
||||
__assign: __assign,
|
||||
__rest: __rest,
|
||||
__decorate: __decorate,
|
||||
__param: __param,
|
||||
__esDecorate: __esDecorate,
|
||||
__runInitializers: __runInitializers,
|
||||
__propKey: __propKey,
|
||||
__setFunctionName: __setFunctionName,
|
||||
__metadata: __metadata,
|
||||
__awaiter: __awaiter,
|
||||
__generator: __generator,
|
||||
__createBinding: __createBinding,
|
||||
__exportStar: __exportStar,
|
||||
__values: __values,
|
||||
__read: __read,
|
||||
__spread: __spread,
|
||||
__spreadArrays: __spreadArrays,
|
||||
__spreadArray: __spreadArray,
|
||||
__await: __await,
|
||||
__asyncGenerator: __asyncGenerator,
|
||||
__asyncDelegator: __asyncDelegator,
|
||||
__asyncValues: __asyncValues,
|
||||
__makeTemplateObject: __makeTemplateObject,
|
||||
__importStar: __importStar,
|
||||
__importDefault: __importDefault,
|
||||
__classPrivateFieldGet: __classPrivateFieldGet,
|
||||
__classPrivateFieldSet: __classPrivateFieldSet,
|
||||
__classPrivateFieldIn: __classPrivateFieldIn,
|
||||
__addDisposableResource: __addDisposableResource,
|
||||
__disposeResources: __disposeResources,
|
||||
__rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
|
||||
};
|
||||
401
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/tslib.es6.mjs
generated
vendored
401
api.hyungi.net/node_modules/@peculiar/asn1-android/node_modules/tslib/tslib.es6.mjs
generated
vendored
@@ -1,401 +0,0 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
||||
|
||||
var extendStatics = function(d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
|
||||
export function __extends(d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
export var __assign = function() {
|
||||
__assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
return __assign.apply(this, arguments);
|
||||
}
|
||||
|
||||
export function __rest(s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
export function __decorate(decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
}
|
||||
|
||||
export function __param(paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
}
|
||||
|
||||
export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
||||
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
||||
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
||||
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
||||
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
||||
var _, done = false;
|
||||
for (var i = decorators.length - 1; i >= 0; i--) {
|
||||
var context = {};
|
||||
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
||||
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
||||
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
||||
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
||||
if (kind === "accessor") {
|
||||
if (result === void 0) continue;
|
||||
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
||||
if (_ = accept(result.get)) descriptor.get = _;
|
||||
if (_ = accept(result.set)) descriptor.set = _;
|
||||
if (_ = accept(result.init)) initializers.unshift(_);
|
||||
}
|
||||
else if (_ = accept(result)) {
|
||||
if (kind === "field") initializers.unshift(_);
|
||||
else descriptor[key] = _;
|
||||
}
|
||||
}
|
||||
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
||||
done = true;
|
||||
};
|
||||
|
||||
export function __runInitializers(thisArg, initializers, value) {
|
||||
var useValue = arguments.length > 2;
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
||||
}
|
||||
return useValue ? value : void 0;
|
||||
};
|
||||
|
||||
export function __propKey(x) {
|
||||
return typeof x === "symbol" ? x : "".concat(x);
|
||||
};
|
||||
|
||||
export function __setFunctionName(f, name, prefix) {
|
||||
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
||||
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
||||
};
|
||||
|
||||
export function __metadata(metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
}
|
||||
|
||||
export function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
export function __generator(thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
||||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
}
|
||||
|
||||
export var __createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
export function __exportStar(m, o) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
||||
}
|
||||
|
||||
export function __values(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
}
|
||||
|
||||
export function __read(o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export function __spread() {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export function __spreadArrays() {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
}
|
||||
|
||||
export function __spreadArray(to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
}
|
||||
|
||||
export function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
|
||||
export function __asyncGenerator(thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
||||
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
}
|
||||
|
||||
export function __asyncDelegator(o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
||||
}
|
||||
|
||||
export function __asyncValues(o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
}
|
||||
|
||||
export function __makeTemplateObject(cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
|
||||
export function __importStar(mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
}
|
||||
|
||||
export function __importDefault(mod) {
|
||||
return (mod && mod.__esModule) ? mod : { default: mod };
|
||||
}
|
||||
|
||||
export function __classPrivateFieldGet(receiver, state, kind, f) {
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
||||
}
|
||||
|
||||
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
||||
if (kind === "m") throw new TypeError("Private method is not writable");
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
||||
}
|
||||
|
||||
export function __classPrivateFieldIn(state, receiver) {
|
||||
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
||||
return typeof state === "function" ? receiver === state : state.has(receiver);
|
||||
}
|
||||
|
||||
export function __addDisposableResource(env, value, async) {
|
||||
if (value !== null && value !== void 0) {
|
||||
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
||||
var dispose, inner;
|
||||
if (async) {
|
||||
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
||||
dispose = value[Symbol.asyncDispose];
|
||||
}
|
||||
if (dispose === void 0) {
|
||||
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
||||
dispose = value[Symbol.dispose];
|
||||
if (async) inner = dispose;
|
||||
}
|
||||
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
||||
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
||||
env.stack.push({ value: value, dispose: dispose, async: async });
|
||||
}
|
||||
else if (async) {
|
||||
env.stack.push({ async: true });
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
||||
var e = new Error(message);
|
||||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
||||
};
|
||||
|
||||
export function __disposeResources(env) {
|
||||
function fail(e) {
|
||||
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
||||
env.hasError = true;
|
||||
}
|
||||
var r, s = 0;
|
||||
function next() {
|
||||
while (r = env.stack.pop()) {
|
||||
try {
|
||||
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
||||
if (r.dispose) {
|
||||
var result = r.dispose.call(r.value);
|
||||
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
||||
}
|
||||
else s |= 1;
|
||||
}
|
||||
catch (e) {
|
||||
fail(e);
|
||||
}
|
||||
}
|
||||
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
||||
if (env.hasError) throw env.error;
|
||||
}
|
||||
return next();
|
||||
}
|
||||
|
||||
export function __rewriteRelativeImportExtension(path, preserveJsx) {
|
||||
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
||||
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
||||
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
||||
});
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
export default {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__esDecorate,
|
||||
__runInitializers,
|
||||
__propKey,
|
||||
__setFunctionName,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__createBinding,
|
||||
__exportStar,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
__addDisposableResource,
|
||||
__disposeResources,
|
||||
__rewriteRelativeImportExtension,
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user