mirror of
https://github.com/asphyxia-core/core.git
synced 2026-12-04 14:36:58 -06:00
asphyxia-core
This commit is contained in:
39
.eslintrc.js
Normal file
39
.eslintrc.js
Normal file
@@ -0,0 +1,39 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
es6: true,
|
||||
node: true,
|
||||
},
|
||||
ignorePatterns: ['dist/', 'min/', 'build/', 'node_modules/'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:import/errors',
|
||||
'plugin:import/warnings',
|
||||
'plugin:import/typescript',
|
||||
'prettier',
|
||||
'prettier/@typescript-eslint',
|
||||
],
|
||||
globals: {
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly',
|
||||
},
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['import', '@typescript-eslint'],
|
||||
rules: {
|
||||
'@typescript-eslint/object-literal-sort-keys': 0,
|
||||
'@typescript-eslint/max-classes-per-file': 0,
|
||||
'@typescript-eslint/no-console': 0,
|
||||
'@typescript-eslint/no-bitwise': 0,
|
||||
'@typescript-eslint/explicit-function-return-type': 0,
|
||||
'@typescript-eslint/no-explicit-any': 0,
|
||||
'@typescript-eslint/': 0,
|
||||
'@typescript-eslint/prefer-for-of': 1,
|
||||
'@typescript-eslint/camelcase': ['error', { properties: 'never' }],
|
||||
'no-tabs': 'error',
|
||||
'import/no-cycle': 0,
|
||||
},
|
||||
};
|
||||
12
.gitignore
vendored
Normal file
12
.gitignore
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
node_modules/
|
||||
|
||||
dist/*
|
||||
build/*
|
||||
dev/*
|
||||
|
||||
build-env/package-lock.json
|
||||
build-env/index.js
|
||||
|
||||
.vscode
|
||||
.vs
|
||||
.env
|
||||
12
.prettierrc
Normal file
12
.prettierrc
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"trailingComma": "es5",
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"endOfLine": "lf",
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": true,
|
||||
"arrowParens": "avoid",
|
||||
"quoteProps": "consistent",
|
||||
"printWidth": 100
|
||||
}
|
||||
19
build-env/package.json
Normal file
19
build-env/package.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "asphyxia-core",
|
||||
"version": "0.0.1",
|
||||
"description": "KONMAI FUN TIME",
|
||||
"main": "./index.js",
|
||||
"scripts": {
|
||||
"start": "node ./index.js"
|
||||
},
|
||||
"bin": {
|
||||
"axphyxia": "./index.js"
|
||||
},
|
||||
"pkg": {
|
||||
"assets": "./node_modules/typescript"
|
||||
},
|
||||
"dependencies": {
|
||||
"ts-node": "^8.10.1",
|
||||
"uglify-js": "^3.9.2"
|
||||
}
|
||||
}
|
||||
24
build-env/typescript/lib/lib.d.ts
vendored
Normal file
24
build-env/typescript/lib/lib.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es5" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="webworker.importscripts" />
|
||||
/// <reference lib="scripthost" />
|
||||
20227
build-env/typescript/lib/lib.dom.d.ts
vendored
Normal file
20227
build-env/typescript/lib/lib.dom.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
352
build-env/typescript/lib/lib.dom.iterable.d.ts
vendored
Normal file
352
build-env/typescript/lib/lib.dom.iterable.d.ts
vendored
Normal file
@@ -0,0 +1,352 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
/// DOM Iterable APIs
|
||||
/////////////////////////////
|
||||
|
||||
interface AudioParam {
|
||||
setValueCurveAtTime(values: Iterable<number>, startTime: number, duration: number): AudioParam;
|
||||
}
|
||||
|
||||
interface AudioParamMap extends ReadonlyMap<string, AudioParam> {
|
||||
}
|
||||
|
||||
interface AudioTrackList {
|
||||
[Symbol.iterator](): IterableIterator<AudioTrack>;
|
||||
}
|
||||
|
||||
interface BaseAudioContext {
|
||||
createIIRFilter(feedforward: Iterable<number>, feedback: Iterable<number>): IIRFilterNode;
|
||||
createPeriodicWave(real: Iterable<number>, imag: Iterable<number>, constraints?: PeriodicWaveConstraints): PeriodicWave;
|
||||
}
|
||||
|
||||
interface CSSRuleList {
|
||||
[Symbol.iterator](): IterableIterator<CSSRule>;
|
||||
}
|
||||
|
||||
interface CSSStyleDeclaration {
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface Cache {
|
||||
addAll(requests: Iterable<RequestInfo>): Promise<void>;
|
||||
}
|
||||
|
||||
interface CanvasPathDrawingStyles {
|
||||
setLineDash(segments: Iterable<number>): void;
|
||||
}
|
||||
|
||||
interface ClientRectList {
|
||||
[Symbol.iterator](): IterableIterator<ClientRect>;
|
||||
}
|
||||
|
||||
interface DOMRectList {
|
||||
[Symbol.iterator](): IterableIterator<DOMRect>;
|
||||
}
|
||||
|
||||
interface DOMStringList {
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface DOMTokenList {
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
entries(): IterableIterator<[number, string]>;
|
||||
keys(): IterableIterator<number>;
|
||||
values(): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface DataTransferItemList {
|
||||
[Symbol.iterator](): IterableIterator<DataTransferItem>;
|
||||
}
|
||||
|
||||
interface FileList {
|
||||
[Symbol.iterator](): IterableIterator<File>;
|
||||
}
|
||||
|
||||
interface FormData {
|
||||
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the list.
|
||||
*/
|
||||
entries(): IterableIterator<[string, FormDataEntryValue]>;
|
||||
/**
|
||||
* Returns a list of keys in the list.
|
||||
*/
|
||||
keys(): IterableIterator<string>;
|
||||
/**
|
||||
* Returns a list of values in the list.
|
||||
*/
|
||||
values(): IterableIterator<FormDataEntryValue>;
|
||||
}
|
||||
|
||||
interface HTMLAllCollection {
|
||||
[Symbol.iterator](): IterableIterator<Element>;
|
||||
}
|
||||
|
||||
interface HTMLCollectionBase {
|
||||
[Symbol.iterator](): IterableIterator<Element>;
|
||||
}
|
||||
|
||||
interface HTMLCollectionOf<T extends Element> {
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface HTMLFormElement {
|
||||
[Symbol.iterator](): IterableIterator<Element>;
|
||||
}
|
||||
|
||||
interface HTMLSelectElement {
|
||||
[Symbol.iterator](): IterableIterator<Element>;
|
||||
}
|
||||
|
||||
interface Headers {
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all key/value pairs contained in this object.
|
||||
*/
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object.
|
||||
*/
|
||||
keys(): IterableIterator<string>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all values of the key/value pairs contained in this object.
|
||||
*/
|
||||
values(): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface IDBObjectStore {
|
||||
/**
|
||||
* Creates a new index in store with the given name, keyPath and options and returns a new IDBIndex. If the keyPath and options define constraints that cannot be satisfied with the data already in store the upgrade transaction will abort with a "ConstraintError" DOMException.
|
||||
*
|
||||
* Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
|
||||
*/
|
||||
createIndex(name: string, keyPath: string | Iterable<string>, options?: IDBIndexParameters): IDBIndex;
|
||||
}
|
||||
|
||||
interface MediaKeyStatusMap {
|
||||
[Symbol.iterator](): IterableIterator<[BufferSource, MediaKeyStatus]>;
|
||||
entries(): IterableIterator<[BufferSource, MediaKeyStatus]>;
|
||||
keys(): IterableIterator<BufferSource>;
|
||||
values(): IterableIterator<MediaKeyStatus>;
|
||||
}
|
||||
|
||||
interface MediaList {
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface MimeTypeArray {
|
||||
[Symbol.iterator](): IterableIterator<MimeType>;
|
||||
}
|
||||
|
||||
interface NamedNodeMap {
|
||||
[Symbol.iterator](): IterableIterator<Attr>;
|
||||
}
|
||||
|
||||
interface Navigator {
|
||||
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: Iterable<MediaKeySystemConfiguration>): Promise<MediaKeySystemAccess>;
|
||||
}
|
||||
|
||||
interface NodeList {
|
||||
[Symbol.iterator](): IterableIterator<Node>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the list.
|
||||
*/
|
||||
entries(): IterableIterator<[number, Node]>;
|
||||
/**
|
||||
* Returns an list of keys in the list.
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the list.
|
||||
*/
|
||||
values(): IterableIterator<Node>;
|
||||
}
|
||||
|
||||
interface NodeListOf<TNode extends Node> {
|
||||
[Symbol.iterator](): IterableIterator<TNode>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the list.
|
||||
*/
|
||||
entries(): IterableIterator<[number, TNode]>;
|
||||
/**
|
||||
* Returns an list of keys in the list.
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the list.
|
||||
*/
|
||||
values(): IterableIterator<TNode>;
|
||||
}
|
||||
|
||||
interface Plugin {
|
||||
[Symbol.iterator](): IterableIterator<MimeType>;
|
||||
}
|
||||
|
||||
interface PluginArray {
|
||||
[Symbol.iterator](): IterableIterator<Plugin>;
|
||||
}
|
||||
|
||||
interface RTCRtpTransceiver {
|
||||
setCodecPreferences(codecs: Iterable<RTCRtpCodecCapability>): void;
|
||||
}
|
||||
|
||||
interface RTCStatsReport extends ReadonlyMap<string, any> {
|
||||
}
|
||||
|
||||
interface SVGLengthList {
|
||||
[Symbol.iterator](): IterableIterator<SVGLength>;
|
||||
}
|
||||
|
||||
interface SVGNumberList {
|
||||
[Symbol.iterator](): IterableIterator<SVGNumber>;
|
||||
}
|
||||
|
||||
interface SVGPointList {
|
||||
[Symbol.iterator](): IterableIterator<DOMPoint>;
|
||||
}
|
||||
|
||||
interface SVGStringList {
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface SourceBufferList {
|
||||
[Symbol.iterator](): IterableIterator<SourceBuffer>;
|
||||
}
|
||||
|
||||
interface SpeechGrammarList {
|
||||
[Symbol.iterator](): IterableIterator<SpeechGrammar>;
|
||||
}
|
||||
|
||||
interface SpeechRecognitionResult {
|
||||
[Symbol.iterator](): IterableIterator<SpeechRecognitionAlternative>;
|
||||
}
|
||||
|
||||
interface SpeechRecognitionResultList {
|
||||
[Symbol.iterator](): IterableIterator<SpeechRecognitionResult>;
|
||||
}
|
||||
|
||||
interface StyleSheetList {
|
||||
[Symbol.iterator](): IterableIterator<StyleSheet>;
|
||||
}
|
||||
|
||||
interface TextTrackCueList {
|
||||
[Symbol.iterator](): IterableIterator<TextTrackCue>;
|
||||
}
|
||||
|
||||
interface TextTrackList {
|
||||
[Symbol.iterator](): IterableIterator<TextTrack>;
|
||||
}
|
||||
|
||||
interface TouchList {
|
||||
[Symbol.iterator](): IterableIterator<Touch>;
|
||||
}
|
||||
|
||||
interface URLSearchParams {
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the search params.
|
||||
*/
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns a list of keys in the search params.
|
||||
*/
|
||||
keys(): IterableIterator<string>;
|
||||
/**
|
||||
* Returns a list of values in the search params.
|
||||
*/
|
||||
values(): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface VRDisplay {
|
||||
requestPresent(layers: Iterable<VRLayer>): Promise<void>;
|
||||
}
|
||||
|
||||
interface VideoTrackList {
|
||||
[Symbol.iterator](): IterableIterator<VideoTrack>;
|
||||
}
|
||||
|
||||
interface WEBGL_draw_buffers {
|
||||
drawBuffersWEBGL(buffers: Iterable<GLenum>): void;
|
||||
}
|
||||
|
||||
interface WebAuthentication {
|
||||
makeCredential(accountInformation: Account, cryptoParameters: Iterable<ScopedCredentialParameters>, attestationChallenge: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null, options?: ScopedCredentialOptions): Promise<ScopedCredentialInfo>;
|
||||
}
|
||||
|
||||
interface WebGL2RenderingContextBase {
|
||||
clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Iterable<GLfloat>, srcOffset?: GLuint): void;
|
||||
clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Iterable<GLint>, srcOffset?: GLuint): void;
|
||||
clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Iterable<GLuint>, srcOffset?: GLuint): void;
|
||||
drawBuffers(buffers: Iterable<GLenum>): void;
|
||||
getActiveUniforms(program: WebGLProgram, uniformIndices: Iterable<GLuint>, pname: GLenum): any;
|
||||
getUniformIndices(program: WebGLProgram, uniformNames: Iterable<string>): Iterable<GLuint> | null;
|
||||
invalidateFramebuffer(target: GLenum, attachments: Iterable<GLenum>): void;
|
||||
invalidateSubFramebuffer(target: GLenum, attachments: Iterable<GLenum>, x: GLint, y: GLint, width: GLsizei, height: GLsizei): void;
|
||||
transformFeedbackVaryings(program: WebGLProgram, varyings: Iterable<string>, bufferMode: GLenum): void;
|
||||
uniform1uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniform2uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniform3uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniform4uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniformMatrix2x3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniformMatrix2x4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniformMatrix3x2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniformMatrix3x4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniformMatrix4x2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniformMatrix4x3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
vertexAttribI4iv(index: GLuint, values: Iterable<GLint>): void;
|
||||
vertexAttribI4uiv(index: GLuint, values: Iterable<GLuint>): void;
|
||||
}
|
||||
|
||||
interface WebGL2RenderingContextOverloads {
|
||||
uniform1fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniform1iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniform2fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniform2iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniform3fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniform3iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniform4fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniform4iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: GLuint, srcLength?: GLuint): void;
|
||||
}
|
||||
|
||||
interface WebGLRenderingContextBase {
|
||||
vertexAttrib1fv(index: GLuint, values: Iterable<GLfloat>): void;
|
||||
vertexAttrib2fv(index: GLuint, values: Iterable<GLfloat>): void;
|
||||
vertexAttrib3fv(index: GLuint, values: Iterable<GLfloat>): void;
|
||||
vertexAttrib4fv(index: GLuint, values: Iterable<GLfloat>): void;
|
||||
}
|
||||
|
||||
interface WebGLRenderingContextOverloads {
|
||||
uniform1fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
|
||||
uniform1iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
|
||||
uniform2fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
|
||||
uniform2iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
|
||||
uniform3fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
|
||||
uniform3iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
|
||||
uniform4fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
|
||||
uniform4iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
|
||||
uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable<GLfloat>): void;
|
||||
uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable<GLfloat>): void;
|
||||
uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable<GLfloat>): void;
|
||||
}
|
||||
89
build-env/typescript/lib/lib.es2015.collection.d.ts
vendored
Normal file
89
build-env/typescript/lib/lib.es2015.collection.d.ts
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface Map<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value: V): this;
|
||||
readonly size: number;
|
||||
}
|
||||
|
||||
interface MapConstructor {
|
||||
new(): Map<any, any>;
|
||||
new<K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
|
||||
readonly prototype: Map<any, any>;
|
||||
}
|
||||
declare var Map: MapConstructor;
|
||||
|
||||
interface ReadonlyMap<K, V> {
|
||||
forEach(callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void, thisArg?: any): void;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
readonly size: number;
|
||||
}
|
||||
|
||||
interface WeakMap<K extends object, V> {
|
||||
delete(key: K): boolean;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value: V): this;
|
||||
}
|
||||
|
||||
interface WeakMapConstructor {
|
||||
new <K extends object = object, V = any>(entries?: readonly [K, V][] | null): WeakMap<K, V>;
|
||||
readonly prototype: WeakMap<object, any>;
|
||||
}
|
||||
declare var WeakMap: WeakMapConstructor;
|
||||
|
||||
interface Set<T> {
|
||||
add(value: T): this;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;
|
||||
has(value: T): boolean;
|
||||
readonly size: number;
|
||||
}
|
||||
|
||||
interface SetConstructor {
|
||||
new <T = any>(values?: readonly T[] | null): Set<T>;
|
||||
readonly prototype: Set<any>;
|
||||
}
|
||||
declare var Set: SetConstructor;
|
||||
|
||||
interface ReadonlySet<T> {
|
||||
forEach(callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void, thisArg?: any): void;
|
||||
has(value: T): boolean;
|
||||
readonly size: number;
|
||||
}
|
||||
|
||||
interface WeakSet<T extends object> {
|
||||
add(value: T): this;
|
||||
delete(value: T): boolean;
|
||||
has(value: T): boolean;
|
||||
}
|
||||
|
||||
interface WeakSetConstructor {
|
||||
new <T extends object = object>(values?: readonly T[] | null): WeakSet<T>;
|
||||
readonly prototype: WeakSet<object>;
|
||||
}
|
||||
declare var WeakSet: WeakSetConstructor;
|
||||
517
build-env/typescript/lib/lib.es2015.core.d.ts
vendored
Normal file
517
build-env/typescript/lib/lib.es2015.core.d.ts
vendored
Normal file
@@ -0,0 +1,517 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find<S extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;
|
||||
find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and -1
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found,
|
||||
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill(value: T, start?: number, end?: number): this;
|
||||
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin(target: number, start: number, end?: number): this;
|
||||
}
|
||||
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Creates an array from an array-like object.
|
||||
* @param arrayLike An array-like object to convert to an array.
|
||||
*/
|
||||
from<T>(arrayLike: ArrayLike<T>): T[];
|
||||
|
||||
/**
|
||||
* Creates an array from an iterable object.
|
||||
* @param arrayLike An array-like object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
*/
|
||||
of<T>(...items: T[]): T[];
|
||||
}
|
||||
|
||||
interface DateConstructor {
|
||||
new (value: number | string | Date): Date;
|
||||
}
|
||||
|
||||
interface Function {
|
||||
/**
|
||||
* Returns the name of the function. Function names are read-only and can not be changed.
|
||||
*/
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
interface Math {
|
||||
/**
|
||||
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
clz32(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the result of 32-bit multiplication of two numbers.
|
||||
* @param x First number
|
||||
* @param y Second number
|
||||
*/
|
||||
imul(x: number, y: number): number;
|
||||
|
||||
/**
|
||||
* Returns the sign of the x, indicating whether x is positive, negative or zero.
|
||||
* @param x The numeric expression to test
|
||||
*/
|
||||
sign(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the base 10 logarithm of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
log10(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the base 2 logarithm of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
log2(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the natural logarithm of 1 + x.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
log1p(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the result of (e^x - 1), which is an implementation-dependent approximation to
|
||||
* subtracting 1 from the exponential function of x (e raised to the power of x, where e
|
||||
* is the base of the natural logarithms).
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
expm1(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the hyperbolic cosine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
cosh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the hyperbolic sine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
sinh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the hyperbolic tangent of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
tanh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the inverse hyperbolic cosine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
acosh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the inverse hyperbolic sine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
asinh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the inverse hyperbolic tangent of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
atanh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the square root of the sum of squares of its arguments.
|
||||
* @param values Values to compute the square root for.
|
||||
* If no arguments are passed, the result is +0.
|
||||
* If there is only one argument, the result is the absolute value.
|
||||
* If any argument is +Infinity or -Infinity, the result is +Infinity.
|
||||
* If any argument is NaN, the result is NaN.
|
||||
* If all arguments are either +0 or −0, the result is +0.
|
||||
*/
|
||||
hypot(...values: number[]): number;
|
||||
|
||||
/**
|
||||
* Returns the integral part of the a numeric expression, x, removing any fractional digits.
|
||||
* If x is already an integer, the result is x.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
trunc(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the nearest single precision float representation of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
fround(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns an implementation-dependent approximation to the cube root of number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
cbrt(x: number): number;
|
||||
}
|
||||
|
||||
interface NumberConstructor {
|
||||
/**
|
||||
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* 2.2204460492503130808472633361816 x 10−16.
|
||||
*/
|
||||
readonly EPSILON: number;
|
||||
|
||||
/**
|
||||
* Returns true if passed value is finite.
|
||||
* Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* number. Only finite values of the type number, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isFinite(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the value passed is an integer, false otherwise.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
|
||||
* to a number. Only values of the type number, that are also NaN, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isNaN(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the value passed is a safe integer.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isSafeInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
*/
|
||||
readonly MAX_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).
|
||||
*/
|
||||
readonly MIN_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
*/
|
||||
parseFloat(string: string): number;
|
||||
|
||||
/**
|
||||
* Converts A string to an integer.
|
||||
* @param s A string to convert into a number.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
|
||||
* All other strings are considered decimal.
|
||||
*/
|
||||
parseInt(string: string, radix?: number): number;
|
||||
}
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* 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 target The target object to copy to.
|
||||
* @param source The source object from which to copy properties.
|
||||
*/
|
||||
assign<T, U>(target: T, source: U): T & U;
|
||||
|
||||
/**
|
||||
* 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 target The target object to copy to.
|
||||
* @param source1 The first source object from which to copy properties.
|
||||
* @param source2 The second source object from which to copy properties.
|
||||
*/
|
||||
assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
|
||||
|
||||
/**
|
||||
* 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 target The target object to copy to.
|
||||
* @param source1 The first source object from which to copy properties.
|
||||
* @param source2 The second source object from which to copy properties.
|
||||
* @param source3 The third source object from which to copy properties.
|
||||
*/
|
||||
assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
||||
|
||||
/**
|
||||
* 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 target The target object to copy to.
|
||||
* @param sources One or more source objects from which to copy properties
|
||||
*/
|
||||
assign(target: object, ...sources: any[]): any;
|
||||
|
||||
/**
|
||||
* Returns an array of all symbol properties found directly on object o.
|
||||
* @param o Object to retrieve the symbols from.
|
||||
*/
|
||||
getOwnPropertySymbols(o: any): symbol[];
|
||||
|
||||
/**
|
||||
* Returns the names of the enumerable string properties and methods of an object.
|
||||
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
||||
*/
|
||||
keys(o: {}): string[];
|
||||
|
||||
/**
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* @param value1 The first value.
|
||||
* @param value2 The second value.
|
||||
*/
|
||||
is(value1: any, value2: any): boolean;
|
||||
|
||||
/**
|
||||
* Sets the prototype of a specified object o to object proto or null. Returns the object o.
|
||||
* @param o The object to change its prototype.
|
||||
* @param proto The value of the new prototype or null.
|
||||
*/
|
||||
setPrototypeOf(o: any, proto: object | null): any;
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find<S extends T>(predicate: (this: void, value: T, index: number, obj: readonly T[]) => value is S, thisArg?: any): S | undefined;
|
||||
find(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): T | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and -1
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found,
|
||||
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number;
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
/**
|
||||
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
|
||||
* The characters in this string are sequenced and concatenated in the following order:
|
||||
*
|
||||
* - "g" for global
|
||||
* - "i" for ignoreCase
|
||||
* - "m" for multiline
|
||||
* - "u" for unicode
|
||||
* - "y" for sticky
|
||||
*
|
||||
* If no flags are set, the value is the empty string.
|
||||
*/
|
||||
readonly flags: string;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value indicating the state of the sticky flag (y) used with a regular
|
||||
* expression. Default is false. Read-only.
|
||||
*/
|
||||
readonly sticky: boolean;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular
|
||||
* expression. Default is false. Read-only.
|
||||
*/
|
||||
readonly unicode: boolean;
|
||||
}
|
||||
|
||||
interface RegExpConstructor {
|
||||
new (pattern: RegExp | string, flags?: string): RegExp;
|
||||
(pattern: RegExp | string, flags?: string): RegExp;
|
||||
}
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
|
||||
*/
|
||||
codePointAt(pos: number): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* greater than or equal to position; otherwise, returns false.
|
||||
* @param searchString search string
|
||||
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
|
||||
*/
|
||||
includes(searchString: string, position?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* endPosition – length(this). Otherwise returns false.
|
||||
*/
|
||||
endsWith(searchString: string, endPosition?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns the String value result of normalizing the string into the normalization form
|
||||
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
|
||||
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
|
||||
* is "NFC"
|
||||
*/
|
||||
normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string;
|
||||
|
||||
/**
|
||||
* Returns the String value result of normalizing the string into the normalization form
|
||||
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
|
||||
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
|
||||
* is "NFC"
|
||||
*/
|
||||
normalize(form?: string): string;
|
||||
|
||||
/**
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* the empty string is returned.
|
||||
* @param count number of copies to append
|
||||
*/
|
||||
repeat(count: number): string;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* position. Otherwise returns false.
|
||||
*/
|
||||
startsWith(searchString: string, position?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns an <a> HTML anchor element and sets the name attribute to the text value
|
||||
* @param name
|
||||
*/
|
||||
anchor(name: string): string;
|
||||
|
||||
/** Returns a <big> HTML element */
|
||||
big(): string;
|
||||
|
||||
/** Returns a <blink> HTML element */
|
||||
blink(): string;
|
||||
|
||||
/** Returns a <b> HTML element */
|
||||
bold(): string;
|
||||
|
||||
/** Returns a <tt> HTML element */
|
||||
fixed(): string;
|
||||
|
||||
/** Returns a <font> HTML element and sets the color attribute value */
|
||||
fontcolor(color: string): string;
|
||||
|
||||
/** Returns a <font> HTML element and sets the size attribute value */
|
||||
fontsize(size: number): string;
|
||||
|
||||
/** Returns a <font> HTML element and sets the size attribute value */
|
||||
fontsize(size: string): string;
|
||||
|
||||
/** Returns an <i> HTML element */
|
||||
italics(): string;
|
||||
|
||||
/** Returns an <a> HTML element and sets the href attribute value */
|
||||
link(url: string): string;
|
||||
|
||||
/** Returns a <small> HTML element */
|
||||
small(): string;
|
||||
|
||||
/** Returns a <strike> HTML element */
|
||||
strike(): string;
|
||||
|
||||
/** Returns a <sub> HTML element */
|
||||
sub(): string;
|
||||
|
||||
/** Returns a <sup> HTML element */
|
||||
sup(): string;
|
||||
}
|
||||
|
||||
interface StringConstructor {
|
||||
/**
|
||||
* Return the String value whose elements are, in order, the elements in the List elements.
|
||||
* If length is 0, the empty string is returned.
|
||||
*/
|
||||
fromCodePoint(...codePoints: number[]): string;
|
||||
|
||||
/**
|
||||
* String.raw is intended for use as a tag function of a Tagged Template String. When called
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* parameter will contain the substitution values.
|
||||
* @param template A well-formed template string call site representation.
|
||||
* @param substitutions A set of substitution values.
|
||||
*/
|
||||
raw(template: TemplateStringsArray, ...substitutions: any[]): string;
|
||||
}
|
||||
30
build-env/typescript/lib/lib.es2015.d.ts
vendored
Normal file
30
build-env/typescript/lib/lib.es2015.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es5" />
|
||||
/// <reference lib="es2015.core" />
|
||||
/// <reference lib="es2015.collection" />
|
||||
/// <reference lib="es2015.generator" />
|
||||
/// <reference lib="es2015.promise" />
|
||||
/// <reference lib="es2015.iterable" />
|
||||
/// <reference lib="es2015.proxy" />
|
||||
/// <reference lib="es2015.reflect" />
|
||||
/// <reference lib="es2015.symbol" />
|
||||
/// <reference lib="es2015.symbol.wellknown" />
|
||||
79
build-env/typescript/lib/lib.es2015.generator.d.ts
vendored
Normal file
79
build-env/typescript/lib/lib.es2015.generator.d.ts
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2015.iterable" />
|
||||
|
||||
interface Generator<T = unknown, TReturn = any, TNext = unknown> extends Iterator<T, TReturn, TNext> {
|
||||
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
|
||||
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
||||
return(value: TReturn): IteratorResult<T, TReturn>;
|
||||
throw(e: any): IteratorResult<T, TReturn>;
|
||||
[Symbol.iterator](): Generator<T, TReturn, TNext>;
|
||||
}
|
||||
|
||||
interface GeneratorFunction {
|
||||
/**
|
||||
* Creates a new Generator object.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
new (...args: any[]): Generator;
|
||||
/**
|
||||
* Creates a new Generator object.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
(...args: any[]): Generator;
|
||||
/**
|
||||
* The length of the arguments.
|
||||
*/
|
||||
readonly length: number;
|
||||
/**
|
||||
* Returns the name of the function.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: Generator;
|
||||
}
|
||||
|
||||
interface GeneratorFunctionConstructor {
|
||||
/**
|
||||
* Creates a new Generator function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
new (...args: string[]): GeneratorFunction;
|
||||
/**
|
||||
* Creates a new Generator function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
(...args: string[]): GeneratorFunction;
|
||||
/**
|
||||
* The length of the arguments.
|
||||
*/
|
||||
readonly length: number;
|
||||
/**
|
||||
* Returns the name of the function.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: GeneratorFunction;
|
||||
}
|
||||
501
build-env/typescript/lib/lib.es2015.iterable.d.ts
vendored
Normal file
501
build-env/typescript/lib/lib.es2015.iterable.d.ts
vendored
Normal file
@@ -0,0 +1,501 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2015.symbol" />
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
* for-of statement.
|
||||
*/
|
||||
readonly iterator: symbol;
|
||||
}
|
||||
|
||||
interface IteratorYieldResult<TYield> {
|
||||
done?: false;
|
||||
value: TYield;
|
||||
}
|
||||
|
||||
interface IteratorReturnResult<TReturn> {
|
||||
done: true;
|
||||
value: TReturn;
|
||||
}
|
||||
|
||||
type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
|
||||
|
||||
interface Iterator<T, TReturn = any, TNext = undefined> {
|
||||
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
|
||||
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
||||
return?(value?: TReturn): IteratorResult<T, TReturn>;
|
||||
throw?(e?: any): IteratorResult<T, TReturn>;
|
||||
}
|
||||
|
||||
interface Iterable<T> {
|
||||
[Symbol.iterator](): Iterator<T>;
|
||||
}
|
||||
|
||||
interface IterableIterator<T> extends Iterator<T> {
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, T]>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of values in the array
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Creates an array from an iterable object.
|
||||
* @param iterable An iterable object to convert to an array.
|
||||
*/
|
||||
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
||||
|
||||
/**
|
||||
* Creates an array from an iterable object.
|
||||
* @param iterable An iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
/** Iterator of values in the array. */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, T]>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of values in the array
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface IArguments {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<any>;
|
||||
}
|
||||
|
||||
interface Map<K, V> {
|
||||
/** Returns an iterable of entries in the map. */
|
||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of key, value pairs for every entry in the map.
|
||||
*/
|
||||
entries(): IterableIterator<[K, V]>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of keys in the map
|
||||
*/
|
||||
keys(): IterableIterator<K>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of values in the map
|
||||
*/
|
||||
values(): IterableIterator<V>;
|
||||
}
|
||||
|
||||
interface ReadonlyMap<K, V> {
|
||||
/** Returns an iterable of entries in the map. */
|
||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of key, value pairs for every entry in the map.
|
||||
*/
|
||||
entries(): IterableIterator<[K, V]>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of keys in the map
|
||||
*/
|
||||
keys(): IterableIterator<K>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of values in the map
|
||||
*/
|
||||
values(): IterableIterator<V>;
|
||||
}
|
||||
|
||||
interface MapConstructor {
|
||||
new <K, V>(iterable: Iterable<readonly [K, V]>): Map<K, V>;
|
||||
}
|
||||
|
||||
interface WeakMap<K extends object, V> { }
|
||||
|
||||
interface WeakMapConstructor {
|
||||
new <K extends object, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
|
||||
}
|
||||
|
||||
interface Set<T> {
|
||||
/** Iterates over values in the set. */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
/**
|
||||
* Returns an iterable of [v,v] pairs for every value `v` in the set.
|
||||
*/
|
||||
entries(): IterableIterator<[T, T]>;
|
||||
/**
|
||||
* Despite its name, returns an iterable of the values in the set,
|
||||
*/
|
||||
keys(): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of values in the set.
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface ReadonlySet<T> {
|
||||
/** Iterates over values in the set. */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of [v,v] pairs for every value `v` in the set.
|
||||
*/
|
||||
entries(): IterableIterator<[T, T]>;
|
||||
|
||||
/**
|
||||
* Despite its name, returns an iterable of the values in the set,
|
||||
*/
|
||||
keys(): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns an iterable of values in the set.
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface SetConstructor {
|
||||
new <T>(iterable?: Iterable<T> | null): Set<T>;
|
||||
}
|
||||
|
||||
interface WeakSet<T extends object> { }
|
||||
|
||||
interface WeakSetConstructor {
|
||||
new <T extends object = object>(iterable: Iterable<T>): WeakSet<T>;
|
||||
}
|
||||
|
||||
interface Promise<T> { }
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;
|
||||
}
|
||||
|
||||
declare namespace Reflect {
|
||||
function enumerate(target: object): IterableIterator<any>;
|
||||
}
|
||||
|
||||
interface String {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface Int8Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
interface Int8ArrayConstructor {
|
||||
new (elements: Iterable<number>): Int8Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;
|
||||
}
|
||||
|
||||
interface Uint8Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
interface Uint8ArrayConstructor {
|
||||
new (elements: Iterable<number>): Uint8Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;
|
||||
}
|
||||
|
||||
interface Uint8ClampedArray {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
interface Uint8ClampedArrayConstructor {
|
||||
new (elements: Iterable<number>): Uint8ClampedArray;
|
||||
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;
|
||||
}
|
||||
|
||||
interface Int16Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
interface Int16ArrayConstructor {
|
||||
new (elements: Iterable<number>): Int16Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;
|
||||
}
|
||||
|
||||
interface Uint16Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
interface Uint16ArrayConstructor {
|
||||
new (elements: Iterable<number>): Uint16Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;
|
||||
}
|
||||
|
||||
interface Int32Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
interface Int32ArrayConstructor {
|
||||
new (elements: Iterable<number>): Int32Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;
|
||||
}
|
||||
|
||||
interface Uint32Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
interface Uint32ArrayConstructor {
|
||||
new (elements: Iterable<number>): Uint32Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;
|
||||
}
|
||||
|
||||
interface Float32Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
interface Float32ArrayConstructor {
|
||||
new (elements: Iterable<number>): Float32Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;
|
||||
}
|
||||
|
||||
interface Float64Array {
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, number]>;
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<number>;
|
||||
}
|
||||
|
||||
interface Float64ArrayConstructor {
|
||||
new (elements: Iterable<number>): Float64Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;
|
||||
}
|
||||
152
build-env/typescript/lib/lib.es2015.promise.d.ts
vendored
Normal file
152
build-env/typescript/lib/lib.es2015.promise.d.ts
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: Promise<any>;
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used to resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3, T4>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2, T3>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T>(values: readonly (T | PromiseLike<T>)[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: readonly T[]): Promise<T extends PromiseLike<infer U> ? U : T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An iterable of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: Iterable<T>): Promise<T extends PromiseLike<infer U> ? U : T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
* @param reason The reason the promise was rejected.
|
||||
* @returns A new rejected Promise.
|
||||
*/
|
||||
reject<T = never>(reason?: any): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise for the provided value.
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise .
|
||||
* @returns A resolved promise.
|
||||
*/
|
||||
resolve(): Promise<void>;
|
||||
}
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
||||
42
build-env/typescript/lib/lib.es2015.proxy.d.ts
vendored
Normal file
42
build-env/typescript/lib/lib.es2015.proxy.d.ts
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface ProxyHandler<T extends object> {
|
||||
getPrototypeOf? (target: T): object | null;
|
||||
setPrototypeOf? (target: T, v: any): boolean;
|
||||
isExtensible? (target: T): boolean;
|
||||
preventExtensions? (target: T): boolean;
|
||||
getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor | undefined;
|
||||
has? (target: T, p: PropertyKey): boolean;
|
||||
get? (target: T, p: PropertyKey, receiver: any): any;
|
||||
set? (target: T, p: PropertyKey, value: any, receiver: any): boolean;
|
||||
deleteProperty? (target: T, p: PropertyKey): boolean;
|
||||
defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
enumerate? (target: T): PropertyKey[];
|
||||
ownKeys? (target: T): PropertyKey[];
|
||||
apply? (target: T, thisArg: any, argArray?: any): any;
|
||||
construct? (target: T, argArray: any, newTarget?: any): object;
|
||||
}
|
||||
|
||||
interface ProxyConstructor {
|
||||
revocable<T extends object>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
|
||||
new <T extends object>(target: T, handler: ProxyHandler<T>): T;
|
||||
}
|
||||
declare var Proxy: ProxyConstructor;
|
||||
35
build-env/typescript/lib/lib.es2015.reflect.d.ts
vendored
Normal file
35
build-env/typescript/lib/lib.es2015.reflect.d.ts
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
declare namespace Reflect {
|
||||
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
|
||||
function construct(target: Function, argumentsList: ArrayLike<any>, newTarget?: any): any;
|
||||
function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
function deleteProperty(target: object, propertyKey: PropertyKey): boolean;
|
||||
function get(target: object, propertyKey: PropertyKey, receiver?: any): any;
|
||||
function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor | undefined;
|
||||
function getPrototypeOf(target: object): object;
|
||||
function has(target: object, propertyKey: PropertyKey): boolean;
|
||||
function isExtensible(target: object): boolean;
|
||||
function ownKeys(target: object): PropertyKey[];
|
||||
function preventExtensions(target: object): boolean;
|
||||
function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
|
||||
function setPrototypeOf(target: object, proto: any): boolean;
|
||||
}
|
||||
48
build-env/typescript/lib/lib.es2015.symbol.d.ts
vendored
Normal file
48
build-env/typescript/lib/lib.es2015.symbol.d.ts
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: Symbol;
|
||||
|
||||
/**
|
||||
* Returns a new unique Symbol value.
|
||||
* @param description Description of the new Symbol object.
|
||||
*/
|
||||
(description?: string | number): symbol;
|
||||
|
||||
/**
|
||||
* Returns a Symbol object from the global symbol registry matching the given key if found.
|
||||
* Otherwise, returns a new symbol with this key.
|
||||
* @param key key to search for.
|
||||
*/
|
||||
for(key: string): symbol;
|
||||
|
||||
/**
|
||||
* Returns a key from the global symbol registry matching the given Symbol if found.
|
||||
* Otherwise, returns a undefined.
|
||||
* @param sym Symbol to find the key for.
|
||||
*/
|
||||
keyFor(sym: symbol): string | undefined;
|
||||
}
|
||||
|
||||
declare var Symbol: SymbolConstructor;
|
||||
318
build-env/typescript/lib/lib.es2015.symbol.wellknown.d.ts
vendored
Normal file
318
build-env/typescript/lib/lib.es2015.symbol.wellknown.d.ts
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2015.symbol" />
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A method that determines if a constructor object recognizes an object as one of the
|
||||
* constructor’s instances. Called by the semantics of the instanceof operator.
|
||||
*/
|
||||
readonly hasInstance: symbol;
|
||||
|
||||
/**
|
||||
* A Boolean value that if true indicates that an object should flatten to its array elements
|
||||
* by Array.prototype.concat.
|
||||
*/
|
||||
readonly isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
*/
|
||||
readonly match: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
* String.prototype.replace method.
|
||||
*/
|
||||
readonly replace: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* regular expression. Called by the String.prototype.search method.
|
||||
*/
|
||||
readonly search: symbol;
|
||||
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
* derived objects.
|
||||
*/
|
||||
readonly species: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* expression. Called by the String.prototype.split method.
|
||||
*/
|
||||
readonly split: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.
|
||||
* Called by the ToPrimitive abstract operation.
|
||||
*/
|
||||
readonly toPrimitive: symbol;
|
||||
|
||||
/**
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built-in method Object.prototype.toString.
|
||||
*/
|
||||
readonly toStringTag: symbol;
|
||||
|
||||
/**
|
||||
* An Object whose own property names are property names that are excluded from the 'with'
|
||||
* environment bindings of the associated objects.
|
||||
*/
|
||||
readonly unscopables: symbol;
|
||||
}
|
||||
|
||||
interface Symbol {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Returns an object whose properties have the value 'true'
|
||||
* when they will be absent when used in a 'with' statement.
|
||||
*/
|
||||
[Symbol.unscopables](): {
|
||||
copyWithin: boolean;
|
||||
entries: boolean;
|
||||
fill: boolean;
|
||||
find: boolean;
|
||||
findIndex: boolean;
|
||||
keys: boolean;
|
||||
values: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Converts a Date object to a string.
|
||||
*/
|
||||
[Symbol.toPrimitive](hint: "default"): string;
|
||||
/**
|
||||
* Converts a Date object to a string.
|
||||
*/
|
||||
[Symbol.toPrimitive](hint: "string"): string;
|
||||
/**
|
||||
* Converts a Date object to a number.
|
||||
*/
|
||||
[Symbol.toPrimitive](hint: "number"): number;
|
||||
/**
|
||||
* Converts a Date object to a string or number.
|
||||
*
|
||||
* @param hint The strings "number", "string", or "default" to specify what primitive to return.
|
||||
*
|
||||
* @throws {TypeError} If 'hint' was given something other than "number", "string", or "default".
|
||||
* @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default".
|
||||
*/
|
||||
[Symbol.toPrimitive](hint: string): string | number;
|
||||
}
|
||||
|
||||
interface Map<K, V> {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface WeakMap<K extends object, V> {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface Set<T> {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface WeakSet<T extends object> {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface JSON {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface Function {
|
||||
/**
|
||||
* Determines whether the given value inherits from this function if this function was used
|
||||
* as a constructor function.
|
||||
*
|
||||
* A constructor function can control which objects are recognized as its instances by
|
||||
* 'instanceof' by overriding this method.
|
||||
*/
|
||||
[Symbol.hasInstance](value: any): boolean;
|
||||
}
|
||||
|
||||
interface GeneratorFunction {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface Math {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface Promise<T> {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
readonly [Symbol.species]: PromiseConstructor;
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
/**
|
||||
* Matches a string with this regular expression, and returns an array containing the results of
|
||||
* that search.
|
||||
* @param string A string to search within.
|
||||
*/
|
||||
[Symbol.match](string: string): RegExpMatchArray | null;
|
||||
|
||||
/**
|
||||
* Replaces text in a string, using this regular expression.
|
||||
* @param string A String object or string literal whose contents matching against
|
||||
* this regular expression will be replaced
|
||||
* @param replaceValue A String object or string literal containing the text to replace for every
|
||||
* successful match of this regular expression.
|
||||
*/
|
||||
[Symbol.replace](string: string, replaceValue: string): string;
|
||||
|
||||
/**
|
||||
* Replaces text in a string, using this regular expression.
|
||||
* @param string A String object or string literal whose contents matching against
|
||||
* this regular expression will be replaced
|
||||
* @param replacer A function that returns the replacement text.
|
||||
*/
|
||||
[Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;
|
||||
|
||||
/**
|
||||
* Finds the position beginning first substring match in a regular expression search
|
||||
* using this regular expression.
|
||||
*
|
||||
* @param string The string to search within.
|
||||
*/
|
||||
[Symbol.search](string: string): number;
|
||||
|
||||
/**
|
||||
* Returns an array of substrings that were delimited by strings in the original input that
|
||||
* match against this regular expression.
|
||||
*
|
||||
* If the regular expression contains capturing parentheses, then each time this
|
||||
* regular expression matches, the results (including any undefined results) of the
|
||||
* capturing parentheses are spliced.
|
||||
*
|
||||
* @param string string value to split
|
||||
* @param limit if not undefined, the output array is truncated so that it contains no more
|
||||
* than 'limit' elements.
|
||||
*/
|
||||
[Symbol.split](string: string, limit?: number): string[];
|
||||
}
|
||||
|
||||
interface RegExpConstructor {
|
||||
readonly [Symbol.species]: RegExpConstructor;
|
||||
}
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Matches a string an object that supports being matched against, and returns an array containing the results of that search.
|
||||
* @param matcher An object that supports being matched against.
|
||||
*/
|
||||
match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;
|
||||
|
||||
/**
|
||||
* Replaces text in a string, using an object that supports replacement within a string.
|
||||
* @param searchValue A object can search for and replace matches within a string.
|
||||
* @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
|
||||
*/
|
||||
replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;
|
||||
|
||||
/**
|
||||
* Replaces text in a string, using an object that supports replacement within a string.
|
||||
* @param searchValue A object can search for and replace matches within a string.
|
||||
* @param replacer A function that returns the replacement text.
|
||||
*/
|
||||
replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string;
|
||||
|
||||
/**
|
||||
* Finds the first substring match in a regular expression search.
|
||||
* @param searcher An object which supports searching within a string.
|
||||
*/
|
||||
search(searcher: { [Symbol.search](string: string): number; }): number;
|
||||
|
||||
/**
|
||||
* Split a string into substrings using the specified separator and return them as an array.
|
||||
* @param splitter An object that can split a string.
|
||||
* @param limit A value used to limit the number of elements returned in the array.
|
||||
*/
|
||||
split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[];
|
||||
}
|
||||
|
||||
interface ArrayBuffer {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface DataView {
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface Int8Array {
|
||||
readonly [Symbol.toStringTag]: "Int8Array";
|
||||
}
|
||||
|
||||
interface Uint8Array {
|
||||
readonly [Symbol.toStringTag]: "UInt8Array";
|
||||
}
|
||||
|
||||
interface Uint8ClampedArray {
|
||||
readonly [Symbol.toStringTag]: "Uint8ClampedArray";
|
||||
}
|
||||
|
||||
interface Int16Array {
|
||||
readonly [Symbol.toStringTag]: "Int16Array";
|
||||
}
|
||||
|
||||
interface Uint16Array {
|
||||
readonly [Symbol.toStringTag]: "Uint16Array";
|
||||
}
|
||||
|
||||
interface Int32Array {
|
||||
readonly [Symbol.toStringTag]: "Int32Array";
|
||||
}
|
||||
|
||||
interface Uint32Array {
|
||||
readonly [Symbol.toStringTag]: "Uint32Array";
|
||||
}
|
||||
|
||||
interface Float32Array {
|
||||
readonly [Symbol.toStringTag]: "Float32Array";
|
||||
}
|
||||
|
||||
interface Float64Array {
|
||||
readonly [Symbol.toStringTag]: "Float64Array";
|
||||
}
|
||||
|
||||
interface ArrayConstructor {
|
||||
readonly [Symbol.species]: ArrayConstructor;
|
||||
}
|
||||
interface MapConstructor {
|
||||
readonly [Symbol.species]: MapConstructor;
|
||||
}
|
||||
interface SetConstructor {
|
||||
readonly [Symbol.species]: SetConstructor;
|
||||
}
|
||||
interface ArrayBufferConstructor {
|
||||
readonly [Symbol.species]: ArrayBufferConstructor;
|
||||
}
|
||||
118
build-env/typescript/lib/lib.es2016.array.include.d.ts
vendored
Normal file
118
build-env/typescript/lib/lib.es2016.array.include.d.ts
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: T, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: T, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int8Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint8Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint8ClampedArray {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int16Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint16Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int32Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint32Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Float32Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Float64Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
22
build-env/typescript/lib/lib.es2016.d.ts
vendored
Normal file
22
build-env/typescript/lib/lib.es2016.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2015" />
|
||||
/// <reference lib="es2016.array.include" />
|
||||
25
build-env/typescript/lib/lib.es2016.full.d.ts
vendored
Normal file
25
build-env/typescript/lib/lib.es2016.full.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2016" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="webworker.importscripts" />
|
||||
/// <reference lib="scripthost" />
|
||||
/// <reference lib="dom.iterable" />
|
||||
26
build-env/typescript/lib/lib.es2017.d.ts
vendored
Normal file
26
build-env/typescript/lib/lib.es2017.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2016" />
|
||||
/// <reference lib="es2017.object" />
|
||||
/// <reference lib="es2017.sharedmemory" />
|
||||
/// <reference lib="es2017.string" />
|
||||
/// <reference lib="es2017.intl" />
|
||||
/// <reference lib="es2017.typedarrays" />
|
||||
25
build-env/typescript/lib/lib.es2017.full.d.ts
vendored
Normal file
25
build-env/typescript/lib/lib.es2017.full.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2017" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="webworker.importscripts" />
|
||||
/// <reference lib="scripthost" />
|
||||
/// <reference lib="dom.iterable" />
|
||||
32
build-env/typescript/lib/lib.es2017.intl.d.ts
vendored
Normal file
32
build-env/typescript/lib/lib.es2017.intl.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
declare namespace Intl {
|
||||
type DateTimeFormatPartTypes = "day" | "dayPeriod" | "era" | "hour" | "literal" | "minute" | "month" | "second" | "timeZoneName" | "weekday" | "year";
|
||||
|
||||
interface DateTimeFormatPart {
|
||||
type: DateTimeFormatPartTypes;
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface DateTimeFormat {
|
||||
formatToParts(date?: Date | number): DateTimeFormatPart[];
|
||||
}
|
||||
}
|
||||
51
build-env/typescript/lib/lib.es2017.object.d.ts
vendored
Normal file
51
build-env/typescript/lib/lib.es2017.object.d.ts
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Returns an array of values of the enumerable properties of an object
|
||||
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
||||
*/
|
||||
values<T>(o: { [s: string]: T } | ArrayLike<T>): T[];
|
||||
|
||||
/**
|
||||
* Returns an array of values of the enumerable properties of an object
|
||||
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
||||
*/
|
||||
values(o: {}): any[];
|
||||
|
||||
/**
|
||||
* Returns an array of key/values of the enumerable properties of an object
|
||||
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
||||
*/
|
||||
entries<T>(o: { [s: string]: T } | ArrayLike<T>): [string, T][];
|
||||
|
||||
/**
|
||||
* Returns an array of key/values of the enumerable properties of an object
|
||||
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
||||
*/
|
||||
entries(o: {}): [string, any][];
|
||||
|
||||
/**
|
||||
* Returns an object containing all own property descriptors of an object
|
||||
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
||||
*/
|
||||
getOwnPropertyDescriptors<T>(o: T): {[P in keyof T]: TypedPropertyDescriptor<T[P]>} & { [x: string]: PropertyDescriptor };
|
||||
}
|
||||
138
build-env/typescript/lib/lib.es2017.sharedmemory.d.ts
vendored
Normal file
138
build-env/typescript/lib/lib.es2017.sharedmemory.d.ts
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2015.symbol" />
|
||||
/// <reference lib="es2015.symbol.wellknown" />
|
||||
|
||||
interface SharedArrayBuffer {
|
||||
/**
|
||||
* Read-only. The length of the ArrayBuffer (in bytes).
|
||||
*/
|
||||
readonly byteLength: number;
|
||||
|
||||
/*
|
||||
* The SharedArrayBuffer constructor's length property whose value is 1.
|
||||
*/
|
||||
length: number;
|
||||
/**
|
||||
* Returns a section of an SharedArrayBuffer.
|
||||
*/
|
||||
slice(begin: number, end?: number): SharedArrayBuffer;
|
||||
readonly [Symbol.species]: SharedArrayBuffer;
|
||||
readonly [Symbol.toStringTag]: "SharedArrayBuffer";
|
||||
}
|
||||
|
||||
interface SharedArrayBufferConstructor {
|
||||
readonly prototype: SharedArrayBuffer;
|
||||
new (byteLength: number): SharedArrayBuffer;
|
||||
}
|
||||
declare var SharedArrayBuffer: SharedArrayBufferConstructor;
|
||||
|
||||
interface ArrayBufferTypes {
|
||||
SharedArrayBuffer: SharedArrayBuffer;
|
||||
}
|
||||
|
||||
interface Atomics {
|
||||
/**
|
||||
* Adds a value to the value at the given position in the array, returning the original value.
|
||||
* Until this atomic operation completes, any other read or write operation against the array
|
||||
* will block.
|
||||
*/
|
||||
add(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
|
||||
|
||||
/**
|
||||
* Stores the bitwise AND of a value with the value at the given position in the array,
|
||||
* returning the original value. Until this atomic operation completes, any other read or
|
||||
* write operation against the array will block.
|
||||
*/
|
||||
and(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
|
||||
|
||||
/**
|
||||
* Replaces the value at the given position in the array if the original value equals the given
|
||||
* expected value, returning the original value. Until this atomic operation completes, any
|
||||
* other read or write operation against the array will block.
|
||||
*/
|
||||
compareExchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, expectedValue: number, replacementValue: number): number;
|
||||
|
||||
/**
|
||||
* Replaces the value at the given position in the array, returning the original value. Until
|
||||
* this atomic operation completes, any other read or write operation against the array will
|
||||
* block.
|
||||
*/
|
||||
exchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
|
||||
|
||||
/**
|
||||
* Returns a value indicating whether high-performance algorithms can use atomic operations
|
||||
* (`true`) or must use locks (`false`) for the given number of bytes-per-element of a typed
|
||||
* array.
|
||||
*/
|
||||
isLockFree(size: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns the value at the given position in the array. Until this atomic operation completes,
|
||||
* any other read or write operation against the array will block.
|
||||
*/
|
||||
load(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number): number;
|
||||
|
||||
/**
|
||||
* Stores the bitwise OR of a value with the value at the given position in the array,
|
||||
* returning the original value. Until this atomic operation completes, any other read or write
|
||||
* operation against the array will block.
|
||||
*/
|
||||
or(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
|
||||
|
||||
/**
|
||||
* Stores a value at the given position in the array, returning the new value. Until this
|
||||
* atomic operation completes, any other read or write operation against the array will block.
|
||||
*/
|
||||
store(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
|
||||
|
||||
/**
|
||||
* Subtracts a value from the value at the given position in the array, returning the original
|
||||
* value. Until this atomic operation completes, any other read or write operation against the
|
||||
* array will block.
|
||||
*/
|
||||
sub(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
|
||||
|
||||
/**
|
||||
* If the value at the given position in the array is equal to the provided value, the current
|
||||
* agent is put to sleep causing execution to suspend until the timeout expires (returning
|
||||
* `"timed-out"`) or until the agent is awoken (returning `"ok"`); otherwise, returns
|
||||
* `"not-equal"`.
|
||||
*/
|
||||
wait(typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out";
|
||||
|
||||
/**
|
||||
* Wakes up sleeping agents that are waiting on the given index of the array, returning the
|
||||
* number of agents that were awoken.
|
||||
*/
|
||||
notify(typedArray: Int32Array, index: number, count: number): number;
|
||||
|
||||
/**
|
||||
* Stores the bitwise XOR of a value with the value at the given position in the array,
|
||||
* returning the original value. Until this atomic operation completes, any other read or write
|
||||
* operation against the array will block.
|
||||
*/
|
||||
xor(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
|
||||
|
||||
readonly [Symbol.toStringTag]: "Atomics";
|
||||
}
|
||||
|
||||
declare var Atomics: Atomics;
|
||||
47
build-env/typescript/lib/lib.es2017.string.d.ts
vendored
Normal file
47
build-env/typescript/lib/lib.es2017.string.d.ts
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
|
||||
* The padding is applied from the start (left) of the current string.
|
||||
*
|
||||
* @param maxLength The length of the resulting string once the current string has been padded.
|
||||
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
|
||||
*
|
||||
* @param fillString The string to pad the current string with.
|
||||
* If this string is too long, it will be truncated and the left-most part will be applied.
|
||||
* The default value for this parameter is " " (U+0020).
|
||||
*/
|
||||
padStart(maxLength: number, fillString?: string): string;
|
||||
|
||||
/**
|
||||
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
|
||||
* The padding is applied from the end (right) of the current string.
|
||||
*
|
||||
* @param maxLength The length of the resulting string once the current string has been padded.
|
||||
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
|
||||
*
|
||||
* @param fillString The string to pad the current string with.
|
||||
* If this string is too long, it will be truncated and the left-most part will be applied.
|
||||
* The default value for this parameter is " " (U+0020).
|
||||
*/
|
||||
padEnd(maxLength: number, fillString?: string): string;
|
||||
}
|
||||
55
build-env/typescript/lib/lib.es2017.typedarrays.d.ts
vendored
Normal file
55
build-env/typescript/lib/lib.es2017.typedarrays.d.ts
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface Int8ArrayConstructor {
|
||||
new (): Int8Array;
|
||||
}
|
||||
|
||||
interface Uint8ArrayConstructor {
|
||||
new (): Uint8Array;
|
||||
}
|
||||
|
||||
interface Uint8ClampedArrayConstructor {
|
||||
new (): Uint8ClampedArray;
|
||||
}
|
||||
|
||||
interface Int16ArrayConstructor {
|
||||
new (): Int16Array;
|
||||
}
|
||||
|
||||
interface Uint16ArrayConstructor {
|
||||
new (): Uint16Array;
|
||||
}
|
||||
|
||||
interface Int32ArrayConstructor {
|
||||
new (): Int32Array;
|
||||
}
|
||||
|
||||
interface Uint32ArrayConstructor {
|
||||
new (): Uint32Array;
|
||||
}
|
||||
|
||||
interface Float32ArrayConstructor {
|
||||
new (): Float32Array;
|
||||
}
|
||||
|
||||
interface Float64ArrayConstructor {
|
||||
new (): Float64Array;
|
||||
}
|
||||
79
build-env/typescript/lib/lib.es2018.asyncgenerator.d.ts
vendored
Normal file
79
build-env/typescript/lib/lib.es2018.asyncgenerator.d.ts
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2018.asynciterable" />
|
||||
|
||||
interface AsyncGenerator<T = unknown, TReturn = any, TNext = unknown> extends AsyncIterator<T, TReturn, TNext> {
|
||||
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
|
||||
next(...args: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
|
||||
return(value: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>;
|
||||
throw(e: any): Promise<IteratorResult<T, TReturn>>;
|
||||
[Symbol.asyncIterator](): AsyncGenerator<T, TReturn, TNext>;
|
||||
}
|
||||
|
||||
interface AsyncGeneratorFunction {
|
||||
/**
|
||||
* Creates a new AsyncGenerator object.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
new (...args: any[]): AsyncGenerator;
|
||||
/**
|
||||
* Creates a new AsyncGenerator object.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
(...args: any[]): AsyncGenerator;
|
||||
/**
|
||||
* The length of the arguments.
|
||||
*/
|
||||
readonly length: number;
|
||||
/**
|
||||
* Returns the name of the function.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: AsyncGenerator;
|
||||
}
|
||||
|
||||
interface AsyncGeneratorFunctionConstructor {
|
||||
/**
|
||||
* Creates a new AsyncGenerator function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
new (...args: string[]): AsyncGeneratorFunction;
|
||||
/**
|
||||
* Creates a new AsyncGenerator function.
|
||||
* @param args A list of arguments the function accepts.
|
||||
*/
|
||||
(...args: string[]): AsyncGeneratorFunction;
|
||||
/**
|
||||
* The length of the arguments.
|
||||
*/
|
||||
readonly length: number;
|
||||
/**
|
||||
* Returns the name of the function.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
readonly prototype: AsyncGeneratorFunction;
|
||||
}
|
||||
45
build-env/typescript/lib/lib.es2018.asynciterable.d.ts
vendored
Normal file
45
build-env/typescript/lib/lib.es2018.asynciterable.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2015.symbol" />
|
||||
/// <reference lib="es2015.iterable" />
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A method that returns the default async iterator for an object. Called by the semantics of
|
||||
* the for-await-of statement.
|
||||
*/
|
||||
readonly asyncIterator: symbol;
|
||||
}
|
||||
|
||||
interface AsyncIterator<T, TReturn = any, TNext = undefined> {
|
||||
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
|
||||
next(...args: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
|
||||
return?(value?: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>;
|
||||
throw?(e?: any): Promise<IteratorResult<T, TReturn>>;
|
||||
}
|
||||
|
||||
interface AsyncIterable<T> {
|
||||
[Symbol.asyncIterator](): AsyncIterator<T>;
|
||||
}
|
||||
|
||||
interface AsyncIterableIterator<T> extends AsyncIterator<T> {
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
||||
}
|
||||
26
build-env/typescript/lib/lib.es2018.d.ts
vendored
Normal file
26
build-env/typescript/lib/lib.es2018.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2017" />
|
||||
/// <reference lib="es2018.asyncgenerator" />
|
||||
/// <reference lib="es2018.asynciterable" />
|
||||
/// <reference lib="es2018.promise" />
|
||||
/// <reference lib="es2018.regexp" />
|
||||
/// <reference lib="es2018.intl" />
|
||||
25
build-env/typescript/lib/lib.es2018.full.d.ts
vendored
Normal file
25
build-env/typescript/lib/lib.es2018.full.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2018" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="webworker.importscripts" />
|
||||
/// <reference lib="scripthost" />
|
||||
/// <reference lib="dom.iterable" />
|
||||
51
build-env/typescript/lib/lib.es2018.intl.d.ts
vendored
Normal file
51
build-env/typescript/lib/lib.es2018.intl.d.ts
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
declare namespace Intl {
|
||||
interface PluralRulesOptions {
|
||||
localeMatcher?: "lookup" | "best fit";
|
||||
type?: "cardinal" | "ordinal";
|
||||
}
|
||||
|
||||
interface ResolvedPluralRulesOptions {
|
||||
locale: string;
|
||||
pluralCategories: string[];
|
||||
type: "cardinal" | "ordinal";
|
||||
minimumIntegerDigits: number;
|
||||
minimumFractionDigits: number;
|
||||
maximumFractionDigits: number;
|
||||
minimumSignificantDigits: number;
|
||||
maximumSignificantDigits: number;
|
||||
}
|
||||
|
||||
interface PluralRules {
|
||||
resolvedOptions(): ResolvedPluralRulesOptions;
|
||||
select(n: number): string;
|
||||
}
|
||||
|
||||
const PluralRules: {
|
||||
new (locales?: string | string[], options?: PluralRulesOptions): PluralRules;
|
||||
(locales?: string | string[], options?: PluralRulesOptions): PluralRules;
|
||||
supportedLocalesOf(
|
||||
locales: string | string[],
|
||||
options?: PluralRulesOptions,
|
||||
): string[];
|
||||
};
|
||||
}
|
||||
32
build-env/typescript/lib/lib.es2018.promise.d.ts
vendored
Normal file
32
build-env/typescript/lib/lib.es2018.promise.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
*/
|
||||
interface Promise<T> {
|
||||
/**
|
||||
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
|
||||
* resolved value cannot be modified from the callback.
|
||||
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
finally(onfinally?: (() => void) | undefined | null): Promise<T>
|
||||
}
|
||||
39
build-env/typescript/lib/lib.es2018.regexp.d.ts
vendored
Normal file
39
build-env/typescript/lib/lib.es2018.regexp.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface RegExpMatchArray {
|
||||
groups?: {
|
||||
[key: string]: string
|
||||
}
|
||||
}
|
||||
|
||||
interface RegExpExecArray {
|
||||
groups?: {
|
||||
[key: string]: string
|
||||
}
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
/**
|
||||
* Returns a Boolean value indicating the state of the dotAll flag (s) used with a regular expression.
|
||||
* Default is false. Read-only.
|
||||
*/
|
||||
readonly dotAll: boolean;
|
||||
}
|
||||
223
build-env/typescript/lib/lib.es2019.array.d.ts
vendored
Normal file
223
build-env/typescript/lib/lib.es2019.array.d.ts
vendored
Normal file
@@ -0,0 +1,223 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array. Then, flattens the result into
|
||||
* a new array.
|
||||
* This is identical to a map followed by flat with depth 1.
|
||||
*
|
||||
* @param callback A function that accepts up to three arguments. The flatMap method calls the
|
||||
* callback function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callback function. If
|
||||
* thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
flatMap<U, This = undefined> (
|
||||
callback: (this: This, value: T, index: number, array: T[]) => U | ReadonlyArray<U>,
|
||||
thisArg?: This
|
||||
): U[]
|
||||
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this:
|
||||
ReadonlyArray<U[][][][]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<U[][][]>> |
|
||||
ReadonlyArray<ReadonlyArray<U[][]>[]> |
|
||||
ReadonlyArray<ReadonlyArray<U[]>[][]> |
|
||||
ReadonlyArray<ReadonlyArray<U>[][][]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[][]>>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[][]>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>[][]> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[]>[]> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>>[]> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>[]>> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>>>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[]>>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>[]>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>[]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>>>,
|
||||
depth: 4): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this:
|
||||
ReadonlyArray<U[][][]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<U>[][]> |
|
||||
ReadonlyArray<ReadonlyArray<U[]>[]> |
|
||||
ReadonlyArray<ReadonlyArray<U[][]>> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[]>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>[]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>>,
|
||||
depth: 3): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this:
|
||||
ReadonlyArray<U[][]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<U[]>> |
|
||||
ReadonlyArray<ReadonlyArray<U>[]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>,
|
||||
depth: 2): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this:
|
||||
ReadonlyArray<U[]> |
|
||||
ReadonlyArray<ReadonlyArray<U>>,
|
||||
depth?: 1
|
||||
): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this:
|
||||
ReadonlyArray<U>,
|
||||
depth: 0
|
||||
): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth. If no depth is provided, flat method defaults to the depth of 1.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(depth?: number): any[];
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array. Then, flattens the result into
|
||||
* a new array.
|
||||
* This is identical to a map followed by flat with depth 1.
|
||||
*
|
||||
* @param callback A function that accepts up to three arguments. The flatMap method calls the
|
||||
* callback function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callback function. If
|
||||
* thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
flatMap<U, This = undefined> (
|
||||
callback: (this: This, value: T, index: number, array: T[]) => U | ReadonlyArray<U>,
|
||||
thisArg?: This
|
||||
): U[]
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][][][][][][], depth: 7): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][][][][][], depth: 6): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][][][][], depth: 5): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][][][], depth: 4): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][][], depth: 3): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][], depth: 2): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][], depth?: 1): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[], depth: 0): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth. If no depth is provided, flat method defaults to the depth of 1.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(depth?: number): any[];
|
||||
}
|
||||
25
build-env/typescript/lib/lib.es2019.d.ts
vendored
Normal file
25
build-env/typescript/lib/lib.es2019.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2018" />
|
||||
/// <reference lib="es2019.array" />
|
||||
/// <reference lib="es2019.object" />
|
||||
/// <reference lib="es2019.string" />
|
||||
/// <reference lib="es2019.symbol" />
|
||||
25
build-env/typescript/lib/lib.es2019.full.d.ts
vendored
Normal file
25
build-env/typescript/lib/lib.es2019.full.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2019" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="webworker.importscripts" />
|
||||
/// <reference lib="scripthost" />
|
||||
/// <reference lib="dom.iterable" />
|
||||
35
build-env/typescript/lib/lib.es2019.object.d.ts
vendored
Normal file
35
build-env/typescript/lib/lib.es2019.object.d.ts
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2015.iterable" />
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Returns an object created by key-value entries for properties and methods
|
||||
* @param entries An iterable object that contains key-value entries for properties and methods.
|
||||
*/
|
||||
fromEntries<T = any>(entries: Iterable<readonly [PropertyKey, T]>): { [k in PropertyKey]: T };
|
||||
|
||||
/**
|
||||
* Returns an object created by key-value entries for properties and methods
|
||||
* @param entries An iterable object that contains key-value entries for properties and methods.
|
||||
*/
|
||||
fromEntries(entries: Iterable<readonly any[]>): any;
|
||||
}
|
||||
33
build-env/typescript/lib/lib.es2019.string.d.ts
vendored
Normal file
33
build-env/typescript/lib/lib.es2019.string.d.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface String {
|
||||
/** Removes the trailing white space and line terminator characters from a string. */
|
||||
trimEnd(): string;
|
||||
|
||||
/** Removes the leading white space and line terminator characters from a string. */
|
||||
trimStart(): string;
|
||||
|
||||
/** Removes the leading white space and line terminator characters from a string. */
|
||||
trimLeft(): string;
|
||||
|
||||
/** Removes the trailing white space and line terminator characters from a string. */
|
||||
trimRight(): string;
|
||||
}
|
||||
26
build-env/typescript/lib/lib.es2019.symbol.d.ts
vendored
Normal file
26
build-env/typescript/lib/lib.es2019.symbol.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface Symbol {
|
||||
/**
|
||||
* Expose the [[Description]] internal slot of a symbol directly.
|
||||
*/
|
||||
readonly description: string | undefined;
|
||||
}
|
||||
629
build-env/typescript/lib/lib.es2020.bigint.d.ts
vendored
Normal file
629
build-env/typescript/lib/lib.es2020.bigint.d.ts
vendored
Normal file
@@ -0,0 +1,629 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface BigInt {
|
||||
/**
|
||||
* Returns a string representation of an object.
|
||||
* @param radix Specifies a radix for converting numeric values to strings.
|
||||
*/
|
||||
toString(radix?: number): string;
|
||||
|
||||
/** Returns a string representation appropriate to the host environment's current locale. */
|
||||
toLocaleString(): string;
|
||||
|
||||
/** Returns the primitive value of the specified object. */
|
||||
valueOf(): bigint;
|
||||
|
||||
readonly [Symbol.toStringTag]: "BigInt";
|
||||
}
|
||||
|
||||
interface BigIntConstructor {
|
||||
(value?: any): bigint;
|
||||
readonly prototype: BigInt;
|
||||
|
||||
/**
|
||||
* Interprets the low bits of a BigInt as a 2's-complement signed integer.
|
||||
* All higher bits are discarded.
|
||||
* @param bits The number of low bits to use
|
||||
* @param int The BigInt whose bits to extract
|
||||
*/
|
||||
asIntN(bits: number, int: bigint): bigint;
|
||||
/**
|
||||
* Interprets the low bits of a BigInt as an unsigned integer.
|
||||
* All higher bits are discarded.
|
||||
* @param bits The number of low bits to use
|
||||
* @param int The BigInt whose bits to extract
|
||||
*/
|
||||
asUintN(bits: number, int: bigint): bigint;
|
||||
}
|
||||
|
||||
declare var BigInt: BigIntConstructor;
|
||||
|
||||
/**
|
||||
* A typed array of 64-bit signed integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated, an exception is raised.
|
||||
*/
|
||||
interface BigInt64Array {
|
||||
/** The size in bytes of each element in the array. */
|
||||
readonly BYTES_PER_ELEMENT: number;
|
||||
|
||||
/** The ArrayBuffer instance referenced by the array. */
|
||||
readonly buffer: ArrayBufferLike;
|
||||
|
||||
/** The length in bytes of the array. */
|
||||
readonly byteLength: number;
|
||||
|
||||
/** The offset in bytes of the array. */
|
||||
readonly byteOffset: number;
|
||||
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin(target: number, start: number, end?: number): this;
|
||||
|
||||
/** Yields index, value pairs for every entry in the array. */
|
||||
entries(): IterableIterator<[number, bigint]>;
|
||||
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
* the callbackfn function for each element in the array until the callbackfn returns false,
|
||||
* or until the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
every(callbackfn: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
|
||||
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill(value: bigint, start?: number, end?: number): this;
|
||||
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
filter(callbackfn: (value: bigint, index: number, array: BigInt64Array) => any, thisArg?: any): BigInt64Array;
|
||||
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): bigint | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and -1
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found,
|
||||
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
forEach(callbackfn: (value: bigint, index: number, array: BigInt64Array) => void, thisArg?: any): void;
|
||||
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: bigint, fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns the index of the first occurrence of a value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
indexOf(searchElement: bigint, fromIndex?: number): number;
|
||||
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
* resulting String. If omitted, the array elements are separated with a comma.
|
||||
*/
|
||||
join(separator?: string): string;
|
||||
|
||||
/** Yields each index in the array. */
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns the index of the last occurrence of a value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
|
||||
|
||||
/** The length of the array. */
|
||||
readonly length: number;
|
||||
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
* @param callbackfn A function that accepts up to three arguments. The map method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
map(callbackfn: (value: bigint, index: number, array: BigInt64Array) => bigint, thisArg?: any): BigInt64Array;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array. The return value of
|
||||
* the callback function is the accumulated result, and is provided as an argument in the next
|
||||
* call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array. The return value of
|
||||
* the callback function is the accumulated result, and is provided as an argument in the next
|
||||
* call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an
|
||||
* argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an
|
||||
* argument instead of an array value.
|
||||
*/
|
||||
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an
|
||||
* argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U;
|
||||
|
||||
/** Reverses the elements in the array. */
|
||||
reverse(): this;
|
||||
|
||||
/**
|
||||
* Sets a value or an array of values.
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
set(array: ArrayLike<bigint>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
slice(start?: number, end?: number): BigInt64Array;
|
||||
|
||||
/**
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The some method calls the
|
||||
* callbackfn function for each element in the array until the callbackfn returns true, or until
|
||||
* the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
some(callbackfn: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
|
||||
|
||||
/**
|
||||
* Sorts the array.
|
||||
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
|
||||
*/
|
||||
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
|
||||
|
||||
/**
|
||||
* Gets a new BigInt64Array view of the ArrayBuffer store for this array, referencing the elements
|
||||
* at begin, inclusive, up to end, exclusive.
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin?: number, end?: number): BigInt64Array;
|
||||
|
||||
/** Converts the array to a string by using the current locale. */
|
||||
toLocaleString(): string;
|
||||
|
||||
/** Returns a string representation of the array. */
|
||||
toString(): string;
|
||||
|
||||
/** Yields each value in the array. */
|
||||
values(): IterableIterator<bigint>;
|
||||
|
||||
[Symbol.iterator](): IterableIterator<bigint>;
|
||||
|
||||
readonly [Symbol.toStringTag]: "BigInt64Array";
|
||||
|
||||
[index: number]: bigint;
|
||||
}
|
||||
|
||||
interface BigInt64ArrayConstructor {
|
||||
readonly prototype: BigInt64Array;
|
||||
new(length?: number): BigInt64Array;
|
||||
new(array: Iterable<bigint>): BigInt64Array;
|
||||
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigInt64Array;
|
||||
|
||||
/** The size in bytes of each element in the array. */
|
||||
readonly BYTES_PER_ELEMENT: number;
|
||||
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
*/
|
||||
of(...items: bigint[]): BigInt64Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: ArrayLike<bigint>): BigInt64Array;
|
||||
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigInt64Array;
|
||||
}
|
||||
|
||||
declare var BigInt64Array: BigInt64ArrayConstructor;
|
||||
|
||||
/**
|
||||
* A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated, an exception is raised.
|
||||
*/
|
||||
interface BigUint64Array {
|
||||
/** The size in bytes of each element in the array. */
|
||||
readonly BYTES_PER_ELEMENT: number;
|
||||
|
||||
/** The ArrayBuffer instance referenced by the array. */
|
||||
readonly buffer: ArrayBufferLike;
|
||||
|
||||
/** The length in bytes of the array. */
|
||||
readonly byteLength: number;
|
||||
|
||||
/** The offset in bytes of the array. */
|
||||
readonly byteOffset: number;
|
||||
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin(target: number, start: number, end?: number): this;
|
||||
|
||||
/** Yields index, value pairs for every entry in the array. */
|
||||
entries(): IterableIterator<[number, bigint]>;
|
||||
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
* the callbackfn function for each element in the array until the callbackfn returns false,
|
||||
* or until the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
every(callbackfn: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
|
||||
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill(value: bigint, start?: number, end?: number): this;
|
||||
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
filter(callbackfn: (value: bigint, index: number, array: BigUint64Array) => any, thisArg?: any): BigUint64Array;
|
||||
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): bigint | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and -1
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found,
|
||||
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
forEach(callbackfn: (value: bigint, index: number, array: BigUint64Array) => void, thisArg?: any): void;
|
||||
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: bigint, fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns the index of the first occurrence of a value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
indexOf(searchElement: bigint, fromIndex?: number): number;
|
||||
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
* resulting String. If omitted, the array elements are separated with a comma.
|
||||
*/
|
||||
join(separator?: string): string;
|
||||
|
||||
/** Yields each index in the array. */
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns the index of the last occurrence of a value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
|
||||
|
||||
/** The length of the array. */
|
||||
readonly length: number;
|
||||
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
* @param callbackfn A function that accepts up to three arguments. The map method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
map(callbackfn: (value: bigint, index: number, array: BigUint64Array) => bigint, thisArg?: any): BigUint64Array;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array. The return value of
|
||||
* the callback function is the accumulated result, and is provided as an argument in the next
|
||||
* call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array. The return value of
|
||||
* the callback function is the accumulated result, and is provided as an argument in the next
|
||||
* call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an
|
||||
* argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an
|
||||
* argument instead of an array value.
|
||||
*/
|
||||
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an
|
||||
* argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U;
|
||||
|
||||
/** Reverses the elements in the array. */
|
||||
reverse(): this;
|
||||
|
||||
/**
|
||||
* Sets a value or an array of values.
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
set(array: ArrayLike<bigint>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
slice(start?: number, end?: number): BigUint64Array;
|
||||
|
||||
/**
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The some method calls the
|
||||
* callbackfn function for each element in the array until the callbackfn returns true, or until
|
||||
* the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
some(callbackfn: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
|
||||
|
||||
/**
|
||||
* Sorts the array.
|
||||
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
|
||||
*/
|
||||
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
|
||||
|
||||
/**
|
||||
* Gets a new BigUint64Array view of the ArrayBuffer store for this array, referencing the elements
|
||||
* at begin, inclusive, up to end, exclusive.
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin?: number, end?: number): BigUint64Array;
|
||||
|
||||
/** Converts the array to a string by using the current locale. */
|
||||
toLocaleString(): string;
|
||||
|
||||
/** Returns a string representation of the array. */
|
||||
toString(): string;
|
||||
|
||||
/** Yields each value in the array. */
|
||||
values(): IterableIterator<bigint>;
|
||||
|
||||
[Symbol.iterator](): IterableIterator<bigint>;
|
||||
|
||||
readonly [Symbol.toStringTag]: "BigUint64Array";
|
||||
|
||||
[index: number]: bigint;
|
||||
}
|
||||
|
||||
interface BigUint64ArrayConstructor {
|
||||
readonly prototype: BigUint64Array;
|
||||
new(length?: number): BigUint64Array;
|
||||
new(array: Iterable<bigint>): BigUint64Array;
|
||||
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array;
|
||||
|
||||
/** The size in bytes of each element in the array. */
|
||||
readonly BYTES_PER_ELEMENT: number;
|
||||
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
*/
|
||||
of(...items: bigint[]): BigUint64Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: ArrayLike<bigint>): BigUint64Array;
|
||||
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigUint64Array;
|
||||
}
|
||||
|
||||
declare var BigUint64Array: BigUint64ArrayConstructor;
|
||||
|
||||
interface DataView {
|
||||
/**
|
||||
* Gets the BigInt64 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getBigInt64(byteOffset: number, littleEndian?: boolean): bigint;
|
||||
|
||||
/**
|
||||
* Gets the BigUint64 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getBigUint64(byteOffset: number, littleEndian?: boolean): bigint;
|
||||
|
||||
/**
|
||||
* Stores a BigInt64 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores a BigUint64 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
|
||||
}
|
||||
25
build-env/typescript/lib/lib.es2020.d.ts
vendored
Normal file
25
build-env/typescript/lib/lib.es2020.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2019" />
|
||||
/// <reference lib="es2020.bigint" />
|
||||
/// <reference lib="es2020.promise" />
|
||||
/// <reference lib="es2020.string" />
|
||||
/// <reference lib="es2020.symbol.wellknown" />
|
||||
25
build-env/typescript/lib/lib.es2020.full.d.ts
vendored
Normal file
25
build-env/typescript/lib/lib.es2020.full.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2020" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="webworker.importscripts" />
|
||||
/// <reference lib="scripthost" />
|
||||
/// <reference lib="dom.iterable" />
|
||||
50
build-env/typescript/lib/lib.es2020.promise.d.ts
vendored
Normal file
50
build-env/typescript/lib/lib.es2020.promise.d.ts
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface PromiseFulfilledResult<T> {
|
||||
status: "fulfilled";
|
||||
value: T;
|
||||
}
|
||||
|
||||
interface PromiseRejectedResult {
|
||||
status: "rejected";
|
||||
reason: any;
|
||||
}
|
||||
|
||||
type PromiseSettledResult<T> = PromiseFulfilledResult<T> | PromiseRejectedResult;
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all
|
||||
* of the provided Promises resolve or reject.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
allSettled<T extends readonly unknown[] | readonly [unknown]>(values: T):
|
||||
Promise<{ -readonly [P in keyof T]: PromiseSettledResult<T[P] extends PromiseLike<infer U> ? U : T[P]> }>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all
|
||||
* of the provided Promises resolve or reject.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
allSettled<T>(values: Iterable<T>): Promise<PromiseSettledResult<T extends PromiseLike<infer U> ? U : T>[]>;
|
||||
}
|
||||
30
build-env/typescript/lib/lib.es2020.string.d.ts
vendored
Normal file
30
build-env/typescript/lib/lib.es2020.string.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2015.iterable" />
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Matches a string with a regular expression, and returns an iterable of matches
|
||||
* containing the results of that search.
|
||||
* @param regexp A variable name or string literal containing the regular expression pattern and flags.
|
||||
*/
|
||||
matchAll(regexp: RegExp): IterableIterator<RegExpMatchArray>;
|
||||
}
|
||||
39
build-env/typescript/lib/lib.es2020.symbol.wellknown.d.ts
vendored
Normal file
39
build-env/typescript/lib/lib.es2020.symbol.wellknown.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2015.iterable" />
|
||||
/// <reference lib="es2015.symbol" />
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.matchAll method.
|
||||
*/
|
||||
readonly matchAll: symbol;
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
/**
|
||||
* Matches a string with this regular expression, and returns an iterable of matches
|
||||
* containing the results of that search.
|
||||
* @param string A string to search within.
|
||||
*/
|
||||
[Symbol.matchAll](str: string): IterableIterator<RegExpMatchArray>;
|
||||
}
|
||||
4356
build-env/typescript/lib/lib.es5.d.ts
vendored
Normal file
4356
build-env/typescript/lib/lib.es5.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
25
build-env/typescript/lib/lib.es6.d.ts
vendored
Normal file
25
build-env/typescript/lib/lib.es6.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2015" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="dom.iterable" />
|
||||
/// <reference lib="webworker.importscripts" />
|
||||
/// <reference lib="scripthost" />
|
||||
223
build-env/typescript/lib/lib.esnext.array.d.ts
vendored
Normal file
223
build-env/typescript/lib/lib.esnext.array.d.ts
vendored
Normal file
@@ -0,0 +1,223 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array. Then, flattens the result into
|
||||
* a new array.
|
||||
* This is identical to a map followed by flat with depth 1.
|
||||
*
|
||||
* @param callback A function that accepts up to three arguments. The flatMap method calls the
|
||||
* callback function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callback function. If
|
||||
* thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
flatMap<U, This = undefined> (
|
||||
callback: (this: This, value: T, index: number, array: T[]) => U|ReadonlyArray<U>,
|
||||
thisArg?: This
|
||||
): U[]
|
||||
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this:
|
||||
ReadonlyArray<U[][][][]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<U[][][]>> |
|
||||
ReadonlyArray<ReadonlyArray<U[][]>[]> |
|
||||
ReadonlyArray<ReadonlyArray<U[]>[][]> |
|
||||
ReadonlyArray<ReadonlyArray<U>[][][]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[][]>>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[][]>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>[][]> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[]>[]> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>>[]> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>[]>> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>>>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[]>>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>[]>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>[]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>>>,
|
||||
depth: 4): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this:
|
||||
ReadonlyArray<U[][][]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<U>[][]> |
|
||||
ReadonlyArray<ReadonlyArray<U[]>[]> |
|
||||
ReadonlyArray<ReadonlyArray<U[][]>> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[]>> |
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>[]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>>,
|
||||
depth: 3): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this:
|
||||
ReadonlyArray<U[][]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<U[]>> |
|
||||
ReadonlyArray<ReadonlyArray<U>[]> |
|
||||
|
||||
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>,
|
||||
depth: 2): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this:
|
||||
ReadonlyArray<U[]> |
|
||||
ReadonlyArray<ReadonlyArray<U>>,
|
||||
depth?: 1
|
||||
): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this:
|
||||
ReadonlyArray<U>,
|
||||
depth: 0
|
||||
): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth. If no depth is provided, flat method defaults to the depth of 1.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(depth?: number): any[];
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array. Then, flattens the result into
|
||||
* a new array.
|
||||
* This is identical to a map followed by flat with depth 1.
|
||||
*
|
||||
* @param callback A function that accepts up to three arguments. The flatMap method calls the
|
||||
* callback function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callback function. If
|
||||
* thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
flatMap<U, This = undefined> (
|
||||
callback: (this: This, value: T, index: number, array: T[]) => U|ReadonlyArray<U>,
|
||||
thisArg?: This
|
||||
): U[]
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][][][][][][], depth: 7): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][][][][][], depth: 6): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][][][][], depth: 5): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][][][], depth: 4): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][][], depth: 3): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][][], depth: 2): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[][], depth?: 1): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(this: U[], depth: 0): U[];
|
||||
|
||||
/**
|
||||
* Returns a new array with all sub-array elements concatenated into it recursively up to the
|
||||
* specified depth. If no depth is provided, flat method defaults to the depth of 1.
|
||||
*
|
||||
* @param depth The maximum recursion depth
|
||||
*/
|
||||
flat<U>(depth?: number): any[];
|
||||
}
|
||||
44
build-env/typescript/lib/lib.esnext.asynciterable.d.ts
vendored
Normal file
44
build-env/typescript/lib/lib.esnext.asynciterable.d.ts
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2015.symbol" />
|
||||
/// <reference lib="es2015.iterable" />
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A method that returns the default async iterator for an object. Called by the semantics of
|
||||
* the for-await-of statement.
|
||||
*/
|
||||
readonly asyncIterator: symbol;
|
||||
}
|
||||
|
||||
interface AsyncIterator<T> {
|
||||
next(value?: any): Promise<IteratorResult<T>>;
|
||||
return?(value?: any): Promise<IteratorResult<T>>;
|
||||
throw?(e?: any): Promise<IteratorResult<T>>;
|
||||
}
|
||||
|
||||
interface AsyncIterable<T> {
|
||||
[Symbol.asyncIterator](): AsyncIterator<T>;
|
||||
}
|
||||
|
||||
interface AsyncIterableIterator<T> extends AsyncIterator<T> {
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
||||
}
|
||||
629
build-env/typescript/lib/lib.esnext.bigint.d.ts
vendored
Normal file
629
build-env/typescript/lib/lib.esnext.bigint.d.ts
vendored
Normal file
@@ -0,0 +1,629 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface BigInt {
|
||||
/**
|
||||
* Returns a string representation of an object.
|
||||
* @param radix Specifies a radix for converting numeric values to strings.
|
||||
*/
|
||||
toString(radix?: number): string;
|
||||
|
||||
/** Returns a string representation appropriate to the host environment's current locale. */
|
||||
toLocaleString(): string;
|
||||
|
||||
/** Returns the primitive value of the specified object. */
|
||||
valueOf(): bigint;
|
||||
|
||||
readonly [Symbol.toStringTag]: "BigInt";
|
||||
}
|
||||
|
||||
interface BigIntConstructor {
|
||||
(value?: any): bigint;
|
||||
readonly prototype: BigInt;
|
||||
|
||||
/**
|
||||
* Interprets the low bits of a BigInt as a 2's-complement signed integer.
|
||||
* All higher bits are discarded.
|
||||
* @param bits The number of low bits to use
|
||||
* @param int The BigInt whose bits to extract
|
||||
*/
|
||||
asIntN(bits: number, int: bigint): bigint;
|
||||
/**
|
||||
* Interprets the low bits of a BigInt as an unsigned integer.
|
||||
* All higher bits are discarded.
|
||||
* @param bits The number of low bits to use
|
||||
* @param int The BigInt whose bits to extract
|
||||
*/
|
||||
asUintN(bits: number, int: bigint): bigint;
|
||||
}
|
||||
|
||||
declare var BigInt: BigIntConstructor;
|
||||
|
||||
/**
|
||||
* A typed array of 64-bit signed integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated, an exception is raised.
|
||||
*/
|
||||
interface BigInt64Array {
|
||||
/** The size in bytes of each element in the array. */
|
||||
readonly BYTES_PER_ELEMENT: number;
|
||||
|
||||
/** The ArrayBuffer instance referenced by the array. */
|
||||
readonly buffer: ArrayBufferLike;
|
||||
|
||||
/** The length in bytes of the array. */
|
||||
readonly byteLength: number;
|
||||
|
||||
/** The offset in bytes of the array. */
|
||||
readonly byteOffset: number;
|
||||
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin(target: number, start: number, end?: number): this;
|
||||
|
||||
/** Yields index, value pairs for every entry in the array. */
|
||||
entries(): IterableIterator<[number, bigint]>;
|
||||
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
* the callbackfn function for each element in the array until the callbackfn returns false,
|
||||
* or until the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
every(callbackfn: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
|
||||
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill(value: bigint, start?: number, end?: number): this;
|
||||
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
filter(callbackfn: (value: bigint, index: number, array: BigInt64Array) => any, thisArg?: any): BigInt64Array;
|
||||
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): bigint | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and -1
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found,
|
||||
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
forEach(callbackfn: (value: bigint, index: number, array: BigInt64Array) => void, thisArg?: any): void;
|
||||
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: bigint, fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns the index of the first occurrence of a value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
indexOf(searchElement: bigint, fromIndex?: number): number;
|
||||
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
* resulting String. If omitted, the array elements are separated with a comma.
|
||||
*/
|
||||
join(separator?: string): string;
|
||||
|
||||
/** Yields each index in the array. */
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns the index of the last occurrence of a value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
|
||||
|
||||
/** The length of the array. */
|
||||
readonly length: number;
|
||||
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
* @param callbackfn A function that accepts up to three arguments. The map method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
map(callbackfn: (value: bigint, index: number, array: BigInt64Array) => bigint, thisArg?: any): BigInt64Array;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array. The return value of
|
||||
* the callback function is the accumulated result, and is provided as an argument in the next
|
||||
* call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array. The return value of
|
||||
* the callback function is the accumulated result, and is provided as an argument in the next
|
||||
* call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an
|
||||
* argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an
|
||||
* argument instead of an array value.
|
||||
*/
|
||||
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an
|
||||
* argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U;
|
||||
|
||||
/** Reverses the elements in the array. */
|
||||
reverse(): this;
|
||||
|
||||
/**
|
||||
* Sets a value or an array of values.
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
set(array: ArrayLike<bigint>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
slice(start?: number, end?: number): BigInt64Array;
|
||||
|
||||
/**
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The some method calls the
|
||||
* callbackfn function for each element in the array until the callbackfn returns true, or until
|
||||
* the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
some(callbackfn: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
|
||||
|
||||
/**
|
||||
* Sorts the array.
|
||||
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
|
||||
*/
|
||||
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
|
||||
|
||||
/**
|
||||
* Gets a new BigInt64Array view of the ArrayBuffer store for this array, referencing the elements
|
||||
* at begin, inclusive, up to end, exclusive.
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin?: number, end?: number): BigInt64Array;
|
||||
|
||||
/** Converts the array to a string by using the current locale. */
|
||||
toLocaleString(): string;
|
||||
|
||||
/** Returns a string representation of the array. */
|
||||
toString(): string;
|
||||
|
||||
/** Yields each value in the array. */
|
||||
values(): IterableIterator<bigint>;
|
||||
|
||||
[Symbol.iterator](): IterableIterator<bigint>;
|
||||
|
||||
readonly [Symbol.toStringTag]: "BigInt64Array";
|
||||
|
||||
[index: number]: bigint;
|
||||
}
|
||||
|
||||
interface BigInt64ArrayConstructor {
|
||||
readonly prototype: BigInt64Array;
|
||||
new(length?: number): BigInt64Array;
|
||||
new(array: Iterable<bigint>): BigInt64Array;
|
||||
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigInt64Array;
|
||||
|
||||
/** The size in bytes of each element in the array. */
|
||||
readonly BYTES_PER_ELEMENT: number;
|
||||
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
*/
|
||||
of(...items: bigint[]): BigInt64Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: ArrayLike<bigint>): BigInt64Array;
|
||||
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigInt64Array;
|
||||
}
|
||||
|
||||
declare var BigInt64Array: BigInt64ArrayConstructor;
|
||||
|
||||
/**
|
||||
* A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the
|
||||
* requested number of bytes could not be allocated, an exception is raised.
|
||||
*/
|
||||
interface BigUint64Array {
|
||||
/** The size in bytes of each element in the array. */
|
||||
readonly BYTES_PER_ELEMENT: number;
|
||||
|
||||
/** The ArrayBuffer instance referenced by the array. */
|
||||
readonly buffer: ArrayBufferLike;
|
||||
|
||||
/** The length in bytes of the array. */
|
||||
readonly byteLength: number;
|
||||
|
||||
/** The offset in bytes of the array. */
|
||||
readonly byteOffset: number;
|
||||
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin(target: number, start: number, end?: number): this;
|
||||
|
||||
/** Yields index, value pairs for every entry in the array. */
|
||||
entries(): IterableIterator<[number, bigint]>;
|
||||
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
||||
* the callbackfn function for each element in the array until the callbackfn returns false,
|
||||
* or until the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
every(callbackfn: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
|
||||
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill(value: bigint, start?: number, end?: number): this;
|
||||
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
filter(callbackfn: (value: bigint, index: number, array: BigUint64Array) => any, thisArg?: any): BigUint64Array;
|
||||
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): bigint | undefined;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and -1
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found,
|
||||
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
forEach(callbackfn: (value: bigint, index: number, array: BigUint64Array) => void, thisArg?: any): void;
|
||||
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: bigint, fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns the index of the first occurrence of a value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
indexOf(searchElement: bigint, fromIndex?: number): number;
|
||||
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the
|
||||
* resulting String. If omitted, the array elements are separated with a comma.
|
||||
*/
|
||||
join(separator?: string): string;
|
||||
|
||||
/** Yields each index in the array. */
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns the index of the last occurrence of a value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
||||
* search starts at index 0.
|
||||
*/
|
||||
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
|
||||
|
||||
/** The length of the array. */
|
||||
readonly length: number;
|
||||
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that
|
||||
* contains the results.
|
||||
* @param callbackfn A function that accepts up to three arguments. The map method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
map(callbackfn: (value: bigint, index: number, array: BigUint64Array) => bigint, thisArg?: any): BigUint64Array;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array. The return value of
|
||||
* the callback function is the accumulated result, and is provided as an argument in the next
|
||||
* call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array. The return value of
|
||||
* the callback function is the accumulated result, and is provided as an argument in the next
|
||||
* call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
||||
* callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an
|
||||
* argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an
|
||||
* argument instead of an array value.
|
||||
*/
|
||||
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an
|
||||
* argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
||||
* the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
||||
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
||||
* instead of an array value.
|
||||
*/
|
||||
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U;
|
||||
|
||||
/** Reverses the elements in the array. */
|
||||
reverse(): this;
|
||||
|
||||
/**
|
||||
* Sets a value or an array of values.
|
||||
* @param array A typed or untyped array of values to set.
|
||||
* @param offset The index in the current array at which the values are to be written.
|
||||
*/
|
||||
set(array: ArrayLike<bigint>, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
slice(start?: number, end?: number): BigUint64Array;
|
||||
|
||||
/**
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The some method calls the
|
||||
* callbackfn function for each element in the array until the callbackfn returns true, or until
|
||||
* the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
||||
* If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
some(callbackfn: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
|
||||
|
||||
/**
|
||||
* Sorts the array.
|
||||
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
|
||||
*/
|
||||
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
|
||||
|
||||
/**
|
||||
* Gets a new BigUint64Array view of the ArrayBuffer store for this array, referencing the elements
|
||||
* at begin, inclusive, up to end, exclusive.
|
||||
* @param begin The index of the beginning of the array.
|
||||
* @param end The index of the end of the array.
|
||||
*/
|
||||
subarray(begin?: number, end?: number): BigUint64Array;
|
||||
|
||||
/** Converts the array to a string by using the current locale. */
|
||||
toLocaleString(): string;
|
||||
|
||||
/** Returns a string representation of the array. */
|
||||
toString(): string;
|
||||
|
||||
/** Yields each value in the array. */
|
||||
values(): IterableIterator<bigint>;
|
||||
|
||||
[Symbol.iterator](): IterableIterator<bigint>;
|
||||
|
||||
readonly [Symbol.toStringTag]: "BigUint64Array";
|
||||
|
||||
[index: number]: bigint;
|
||||
}
|
||||
|
||||
interface BigUint64ArrayConstructor {
|
||||
readonly prototype: BigUint64Array;
|
||||
new(length?: number): BigUint64Array;
|
||||
new(array: Iterable<bigint>): BigUint64Array;
|
||||
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array;
|
||||
|
||||
/** The size in bytes of each element in the array. */
|
||||
readonly BYTES_PER_ELEMENT: number;
|
||||
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
*/
|
||||
of(...items: bigint[]): BigUint64Array;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param arrayLike An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from(arrayLike: ArrayLike<bigint>): BigUint64Array;
|
||||
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigUint64Array;
|
||||
}
|
||||
|
||||
declare var BigUint64Array: BigUint64ArrayConstructor;
|
||||
|
||||
interface DataView {
|
||||
/**
|
||||
* Gets the BigInt64 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getBigInt64(byteOffset: number, littleEndian?: boolean): bigint;
|
||||
|
||||
/**
|
||||
* Gets the BigUint64 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getBigUint64(byteOffset: number, littleEndian?: boolean): bigint;
|
||||
|
||||
/**
|
||||
* Stores a BigInt64 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores a BigUint64 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
|
||||
}
|
||||
22
build-env/typescript/lib/lib.esnext.d.ts
vendored
Normal file
22
build-env/typescript/lib/lib.esnext.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="es2020" />
|
||||
/// <reference lib="esnext.intl" />
|
||||
25
build-env/typescript/lib/lib.esnext.full.d.ts
vendored
Normal file
25
build-env/typescript/lib/lib.esnext.full.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
/// <reference lib="esnext" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="webworker.importscripts" />
|
||||
/// <reference lib="scripthost" />
|
||||
/// <reference lib="dom.iterable" />
|
||||
32
build-env/typescript/lib/lib.esnext.intl.d.ts
vendored
Normal file
32
build-env/typescript/lib/lib.esnext.intl.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
declare namespace Intl {
|
||||
type NumberFormatPartTypes = "currency" | "decimal" | "fraction" | "group" | "infinity" | "integer" | "literal" | "minusSign" | "nan" | "plusSign" | "percentSign";
|
||||
|
||||
interface NumberFormatPart {
|
||||
type: NumberFormatPartTypes;
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface NumberFormat {
|
||||
formatToParts(number?: number): NumberFormatPart[];
|
||||
}
|
||||
}
|
||||
26
build-env/typescript/lib/lib.esnext.symbol.d.ts
vendored
Normal file
26
build-env/typescript/lib/lib.esnext.symbol.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
interface Symbol {
|
||||
/**
|
||||
* expose the [[Description]] internal slot of a symbol directly
|
||||
*/
|
||||
readonly description: string;
|
||||
}
|
||||
327
build-env/typescript/lib/lib.scripthost.d.ts
vendored
Normal file
327
build-env/typescript/lib/lib.scripthost.d.ts
vendored
Normal file
@@ -0,0 +1,327 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
/// Windows Script Host APIS
|
||||
/////////////////////////////
|
||||
|
||||
|
||||
interface ActiveXObject {
|
||||
new (s: string): any;
|
||||
}
|
||||
declare var ActiveXObject: ActiveXObject;
|
||||
|
||||
interface ITextWriter {
|
||||
Write(s: string): void;
|
||||
WriteLine(s: string): void;
|
||||
Close(): void;
|
||||
}
|
||||
|
||||
interface TextStreamBase {
|
||||
/**
|
||||
* The column number of the current character position in an input stream.
|
||||
*/
|
||||
Column: number;
|
||||
|
||||
/**
|
||||
* The current line number in an input stream.
|
||||
*/
|
||||
Line: number;
|
||||
|
||||
/**
|
||||
* Closes a text stream.
|
||||
* It is not necessary to close standard streams; they close automatically when the process ends. If
|
||||
* you close a standard stream, be aware that any other pointers to that standard stream become invalid.
|
||||
*/
|
||||
Close(): void;
|
||||
}
|
||||
|
||||
interface TextStreamWriter extends TextStreamBase {
|
||||
/**
|
||||
* Sends a string to an output stream.
|
||||
*/
|
||||
Write(s: string): void;
|
||||
|
||||
/**
|
||||
* Sends a specified number of blank lines (newline characters) to an output stream.
|
||||
*/
|
||||
WriteBlankLines(intLines: number): void;
|
||||
|
||||
/**
|
||||
* Sends a string followed by a newline character to an output stream.
|
||||
*/
|
||||
WriteLine(s: string): void;
|
||||
}
|
||||
|
||||
interface TextStreamReader extends TextStreamBase {
|
||||
/**
|
||||
* Returns a specified number of characters from an input stream, starting at the current pointer position.
|
||||
* Does not return until the ENTER key is pressed.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
Read(characters: number): string;
|
||||
|
||||
/**
|
||||
* Returns all characters from an input stream.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
ReadAll(): string;
|
||||
|
||||
/**
|
||||
* Returns an entire line from an input stream.
|
||||
* Although this method extracts the newline character, it does not add it to the returned string.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
ReadLine(): string;
|
||||
|
||||
/**
|
||||
* Skips a specified number of characters when reading from an input text stream.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
* @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
|
||||
*/
|
||||
Skip(characters: number): void;
|
||||
|
||||
/**
|
||||
* Skips the next line when reading from an input text stream.
|
||||
* Can only be used on a stream in reading mode, not writing or appending mode.
|
||||
*/
|
||||
SkipLine(): void;
|
||||
|
||||
/**
|
||||
* Indicates whether the stream pointer position is at the end of a line.
|
||||
*/
|
||||
AtEndOfLine: boolean;
|
||||
|
||||
/**
|
||||
* Indicates whether the stream pointer position is at the end of a stream.
|
||||
*/
|
||||
AtEndOfStream: boolean;
|
||||
}
|
||||
|
||||
declare var WScript: {
|
||||
/**
|
||||
* Outputs text to either a message box (under WScript.exe) or the command console window followed by
|
||||
* a newline (under CScript.exe).
|
||||
*/
|
||||
Echo(s: any): void;
|
||||
|
||||
/**
|
||||
* Exposes the write-only error output stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdErr: TextStreamWriter;
|
||||
|
||||
/**
|
||||
* Exposes the write-only output stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdOut: TextStreamWriter;
|
||||
Arguments: { length: number; Item(n: number): string; };
|
||||
|
||||
/**
|
||||
* The full path of the currently running script.
|
||||
*/
|
||||
ScriptFullName: string;
|
||||
|
||||
/**
|
||||
* Forces the script to stop immediately, with an optional exit code.
|
||||
*/
|
||||
Quit(exitCode?: number): number;
|
||||
|
||||
/**
|
||||
* The Windows Script Host build version number.
|
||||
*/
|
||||
BuildVersion: number;
|
||||
|
||||
/**
|
||||
* Fully qualified path of the host executable.
|
||||
*/
|
||||
FullName: string;
|
||||
|
||||
/**
|
||||
* Gets/sets the script mode - interactive(true) or batch(false).
|
||||
*/
|
||||
Interactive: boolean;
|
||||
|
||||
/**
|
||||
* The name of the host executable (WScript.exe or CScript.exe).
|
||||
*/
|
||||
Name: string;
|
||||
|
||||
/**
|
||||
* Path of the directory containing the host executable.
|
||||
*/
|
||||
Path: string;
|
||||
|
||||
/**
|
||||
* The filename of the currently running script.
|
||||
*/
|
||||
ScriptName: string;
|
||||
|
||||
/**
|
||||
* Exposes the read-only input stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdIn: TextStreamReader;
|
||||
|
||||
/**
|
||||
* Windows Script Host version
|
||||
*/
|
||||
Version: string;
|
||||
|
||||
/**
|
||||
* Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
|
||||
*/
|
||||
ConnectObject(objEventSource: any, strPrefix: string): void;
|
||||
|
||||
/**
|
||||
* Creates a COM object.
|
||||
* @param strProgiID
|
||||
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
|
||||
*/
|
||||
CreateObject(strProgID: string, strPrefix?: string): any;
|
||||
|
||||
/**
|
||||
* Disconnects a COM object from its event sources.
|
||||
*/
|
||||
DisconnectObject(obj: any): void;
|
||||
|
||||
/**
|
||||
* Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
|
||||
* @param strPathname Fully qualified path to the file containing the object persisted to disk.
|
||||
* For objects in memory, pass a zero-length string.
|
||||
* @param strProgID
|
||||
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
|
||||
*/
|
||||
GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;
|
||||
|
||||
/**
|
||||
* Suspends script execution for a specified length of time, then continues execution.
|
||||
* @param intTime Interval (in milliseconds) to suspend script execution.
|
||||
*/
|
||||
Sleep(intTime: number): void;
|
||||
};
|
||||
|
||||
/**
|
||||
* WSH is an alias for WScript under Windows Script Host
|
||||
*/
|
||||
declare var WSH: typeof WScript;
|
||||
|
||||
/**
|
||||
* Represents an Automation SAFEARRAY
|
||||
*/
|
||||
declare class SafeArray<T = any> {
|
||||
private constructor();
|
||||
private SafeArray_typekey: SafeArray<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows enumerating over a COM collection, which may not have indexed item access.
|
||||
*/
|
||||
interface Enumerator<T = any> {
|
||||
/**
|
||||
* Returns true if the current item is the last one in the collection, or the collection is empty,
|
||||
* or the current item is undefined.
|
||||
*/
|
||||
atEnd(): boolean;
|
||||
|
||||
/**
|
||||
* Returns the current item in the collection
|
||||
*/
|
||||
item(): T;
|
||||
|
||||
/**
|
||||
* Resets the current item in the collection to the first item. If there are no items in the collection,
|
||||
* the current item is set to undefined.
|
||||
*/
|
||||
moveFirst(): void;
|
||||
|
||||
/**
|
||||
* Moves the current item to the next item in the collection. If the enumerator is at the end of
|
||||
* the collection or the collection is empty, the current item is set to undefined.
|
||||
*/
|
||||
moveNext(): void;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new <T = any>(safearray: SafeArray<T>): Enumerator<T>;
|
||||
new <T = any>(collection: { Item(index: any): T }): Enumerator<T>;
|
||||
new <T = any>(collection: any): Enumerator<T>;
|
||||
}
|
||||
|
||||
declare var Enumerator: EnumeratorConstructor;
|
||||
|
||||
/**
|
||||
* Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.
|
||||
*/
|
||||
interface VBArray<T = any> {
|
||||
/**
|
||||
* Returns the number of dimensions (1-based).
|
||||
*/
|
||||
dimensions(): number;
|
||||
|
||||
/**
|
||||
* Takes an index for each dimension in the array, and returns the item at the corresponding location.
|
||||
*/
|
||||
getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;
|
||||
|
||||
/**
|
||||
* Returns the smallest available index for a given dimension.
|
||||
* @param dimension 1-based dimension (defaults to 1)
|
||||
*/
|
||||
lbound(dimension?: number): number;
|
||||
|
||||
/**
|
||||
* Returns the largest available index for a given dimension.
|
||||
* @param dimension 1-based dimension (defaults to 1)
|
||||
*/
|
||||
ubound(dimension?: number): number;
|
||||
|
||||
/**
|
||||
* Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,
|
||||
* each successive dimension is appended to the end of the array.
|
||||
* Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]
|
||||
*/
|
||||
toArray(): T[];
|
||||
}
|
||||
|
||||
interface VBArrayConstructor {
|
||||
new <T = any>(safeArray: SafeArray<T>): VBArray<T>;
|
||||
}
|
||||
|
||||
declare var VBArray: VBArrayConstructor;
|
||||
|
||||
/**
|
||||
* Automation date (VT_DATE)
|
||||
*/
|
||||
declare class VarDate {
|
||||
private constructor();
|
||||
private VarDate_typekey: VarDate;
|
||||
}
|
||||
|
||||
interface DateConstructor {
|
||||
new (vd: VarDate): Date;
|
||||
}
|
||||
|
||||
interface Date {
|
||||
getVarDate: () => VarDate;
|
||||
}
|
||||
5948
build-env/typescript/lib/lib.webworker.d.ts
vendored
Normal file
5948
build-env/typescript/lib/lib.webworker.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
26
build-env/typescript/lib/lib.webworker.importscripts.d.ts
vendored
Normal file
26
build-env/typescript/lib/lib.webworker.importscripts.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
/// WorkerGlobalScope APIs
|
||||
/////////////////////////////
|
||||
// These are only available in a Web Worker
|
||||
declare function importScripts(...urls: string[]): void;
|
||||
2705
build-env/typescript/lib/protocol.d.ts
vendored
Normal file
2705
build-env/typescript/lib/protocol.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
build-env/typescript/lib/typescript.js
Normal file
1
build-env/typescript/lib/typescript.js
Normal file
File diff suppressed because one or more lines are too long
160
build-env/typescript/package.json
Normal file
160
build-env/typescript/package.json
Normal file
@@ -0,0 +1,160 @@
|
||||
{
|
||||
"_from": "typescript",
|
||||
"_id": "typescript@3.8.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
|
||||
"_location": "/typescript",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "typescript",
|
||||
"name": "typescript",
|
||||
"escapedName": "typescript",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
|
||||
"_shasum": "409eb8544ea0335711205869ec458ab109ee1061",
|
||||
"_spec": "typescript",
|
||||
"_where": "D:\\Projects\\build",
|
||||
"author": {
|
||||
"name": "Microsoft Corp."
|
||||
},
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"browser": {
|
||||
"fs": false,
|
||||
"os": false,
|
||||
"path": false,
|
||||
"crypto": false,
|
||||
"buffer": false,
|
||||
"@microsoft/typescript-etw": false,
|
||||
"source-map-support": false,
|
||||
"inspector": false
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/TypeScript/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"devDependencies": {
|
||||
"@octokit/rest": "latest",
|
||||
"@types/browserify": "latest",
|
||||
"@types/chai": "latest",
|
||||
"@types/convert-source-map": "latest",
|
||||
"@types/glob": "latest",
|
||||
"@types/gulp": "^4.0.5",
|
||||
"@types/gulp-concat": "latest",
|
||||
"@types/gulp-newer": "latest",
|
||||
"@types/gulp-rename": "0.0.33",
|
||||
"@types/gulp-sourcemaps": "0.0.32",
|
||||
"@types/jake": "latest",
|
||||
"@types/merge2": "latest",
|
||||
"@types/microsoft__typescript-etw": "latest",
|
||||
"@types/minimatch": "latest",
|
||||
"@types/minimist": "latest",
|
||||
"@types/mkdirp": "latest",
|
||||
"@types/mocha": "latest",
|
||||
"@types/ms": "latest",
|
||||
"@types/node": "latest",
|
||||
"@types/node-fetch": "^2.3.4",
|
||||
"@types/q": "latest",
|
||||
"@types/source-map-support": "latest",
|
||||
"@types/through2": "latest",
|
||||
"@types/travis-fold": "latest",
|
||||
"@types/xml2js": "^0.4.0",
|
||||
"@typescript-eslint/eslint-plugin": "2.3.2",
|
||||
"@typescript-eslint/experimental-utils": "2.3.2",
|
||||
"@typescript-eslint/parser": "2.3.2",
|
||||
"async": "latest",
|
||||
"azure-devops-node-api": "^8.0.0",
|
||||
"browser-resolve": "^1.11.2",
|
||||
"browserify": "latest",
|
||||
"chai": "latest",
|
||||
"chalk": "latest",
|
||||
"convert-source-map": "latest",
|
||||
"del": "5.1.0",
|
||||
"eslint": "6.5.1",
|
||||
"eslint-formatter-autolinkable-stylish": "1.0.3",
|
||||
"eslint-plugin-import": "2.18.2",
|
||||
"eslint-plugin-jsdoc": "15.9.9",
|
||||
"eslint-plugin-no-null": "1.0.2",
|
||||
"fancy-log": "latest",
|
||||
"fs-extra": "^6.0.1",
|
||||
"glob": "latest",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-concat": "latest",
|
||||
"gulp-insert": "latest",
|
||||
"gulp-newer": "latest",
|
||||
"gulp-rename": "latest",
|
||||
"gulp-sourcemaps": "latest",
|
||||
"istanbul": "latest",
|
||||
"merge2": "latest",
|
||||
"minimist": "latest",
|
||||
"mkdirp": "latest",
|
||||
"mocha": "latest",
|
||||
"mocha-fivemat-progress-reporter": "latest",
|
||||
"ms": "latest",
|
||||
"node-fetch": "^2.6.0",
|
||||
"plugin-error": "latest",
|
||||
"pretty-hrtime": "^1.0.3",
|
||||
"prex": "^0.4.3",
|
||||
"q": "latest",
|
||||
"remove-internal": "^2.9.2",
|
||||
"source-map-support": "latest",
|
||||
"through2": "latest",
|
||||
"travis-fold": "latest",
|
||||
"typescript": "next",
|
||||
"vinyl": "latest",
|
||||
"vinyl-sourcemaps-apply": "latest",
|
||||
"xml2js": "^0.4.19"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
},
|
||||
"homepage": "https://www.typescriptlang.org/",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
"Microsoft",
|
||||
"compiler",
|
||||
"language",
|
||||
"javascript"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/typescript.js",
|
||||
"name": "typescript",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Microsoft/TypeScript.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build:compiler && npm run build:tests",
|
||||
"build:compiler": "gulp local",
|
||||
"build:tests": "gulp tests",
|
||||
"clean": "gulp clean",
|
||||
"gulp": "gulp",
|
||||
"jake": "gulp",
|
||||
"lint": "gulp lint",
|
||||
"lint:ci": "gulp lint --ci",
|
||||
"lint:compiler": "gulp lint-compiler",
|
||||
"lint:scripts": "gulp lint-scripts",
|
||||
"prepare": "gulp build-eslint-rules",
|
||||
"pretest": "gulp tests",
|
||||
"setup-hooks": "node scripts/link-hooks.js",
|
||||
"start": "node lib/tsc",
|
||||
"test": "gulp runtests-parallel --light=false",
|
||||
"test:eslint-rules": "gulp run-eslint-rules-tests"
|
||||
},
|
||||
"typings": "./lib/typescript.d.ts",
|
||||
"version": "3.8.3"
|
||||
}
|
||||
27
build.ps1
Normal file
27
build.ps1
Normal file
@@ -0,0 +1,27 @@
|
||||
# Getting version
|
||||
$VER_CODE = Select-String -Path ".\src\utils\Consts.ts" -Pattern "VERSION = '(.*)'"
|
||||
$VERSION = $VER_CODE.Matches.Groups[1].Value;
|
||||
|
||||
Write-Output "Building Version $VERSION"
|
||||
|
||||
# Building
|
||||
Write-Output "Building Typescripts"
|
||||
npx tsc
|
||||
|
||||
# Prepare directories
|
||||
New-Item -Path "." -Name "build" -ItemType "directory" -Force | Out-Null
|
||||
|
||||
# Packing index.js
|
||||
Write-Output "Packing index.js"
|
||||
npx ncc build .\dist\AsphyxiaCore.js -o .\build-env --external uglify-js --external ts-node
|
||||
|
||||
# Packing
|
||||
Write-Output "Packing exe"
|
||||
npx pkg .\build-env -t "node12-win-x64,node12-win-x86" -o .\build\asphyxia-core
|
||||
|
||||
# Renaming 64bit versions
|
||||
# Move-Item -Path ".\build\asphyxia-x64.exe" -Destination ".\build\asphyxia.exe" -Force | Out-Null
|
||||
|
||||
# Packing zips
|
||||
# Compress-Archive -Path ".\build\asphyxia.exe" -DestinationPath ".\build\asphyxia-$VERSION.zip" -Force
|
||||
# Compress-Archive -Path ".\build\asphyxia-x86.exe" -DestinationPath ".\build\asphyxia-$VERSION-x86.zip" -Force
|
||||
2276
package-lock.json
generated
Normal file
2276
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
33
package.json
Normal file
33
package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "asphyxia-core",
|
||||
"version": "0.0.1",
|
||||
"description": "KONMAI FUN TIME",
|
||||
"main": "./build/index.js",
|
||||
"devDependencies": {
|
||||
"@types/argparse": "^1.0.38",
|
||||
"@types/ejs": "^3.0.3",
|
||||
"@types/encoding-japanese": "^1.0.15",
|
||||
"@types/express": "^4.17.6",
|
||||
"@types/get-caller-file": "^1.0.0",
|
||||
"@types/lodash": "^4.14.150",
|
||||
"@types/node": "^13.13.4",
|
||||
"@types/pug": "^2.0.4",
|
||||
"prettier": "^2.0.5",
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@zeit/ncc": "^0.22.1",
|
||||
"argparse": "^1.0.10",
|
||||
"chalk": "^4.0.0",
|
||||
"ejs": "^3.1.2",
|
||||
"encoding-japanese": "^1.0.30",
|
||||
"express": "^4.17.1",
|
||||
"fast-xml-parser": "^3.16.0",
|
||||
"get-caller-file": "^2.0.5",
|
||||
"lodash": "^4.17.15",
|
||||
"pkg": "^4.4.8",
|
||||
"pug": "^2.0.4",
|
||||
"ts-node": "^8.10.1",
|
||||
"winston": "^3.2.1"
|
||||
}
|
||||
}
|
||||
61
src/AsphyxiaCore.ts
Normal file
61
src/AsphyxiaCore.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { Logger } from './utils/Logger';
|
||||
import { ARGS } from './utils/ArgParser';
|
||||
import { services } from './eamuse/Services';
|
||||
import { VERSION } from './utils/Consts';
|
||||
import { pad } from 'lodash';
|
||||
import express from 'express';
|
||||
import chalk from 'chalk';
|
||||
import { LoadExternalModules } from './eamuse/ExternalModuleLoader';
|
||||
|
||||
process.title = `Asphyxia CORE ${VERSION}`;
|
||||
|
||||
Logger.info(' _ _ ');
|
||||
Logger.info(' /\\ | | (_) ');
|
||||
Logger.info(' / \\ ___ _ __ | |__ _ ___ ___ __ _ ');
|
||||
Logger.info(" / /\\ \\ / __| '_ \\| '_ \\| | | \\ \\/ / |/ _` |");
|
||||
Logger.info(' / ____ \\\\__ \\ |_) | | | | |_| |> <| | (_| |');
|
||||
Logger.info(' /_/ \\_\\___/ .__/|_| |_|\\__, /_/\\_\\_|\\__,_|');
|
||||
Logger.info(' | | __/ | __ __ __ ___ ');
|
||||
Logger.info(' |_| |___/ / ` / \\ |__) |__ ');
|
||||
Logger.info(' \\__, \\__/ | \\ |___ ');
|
||||
Logger.info('');
|
||||
Logger.info(chalk.cyanBright(pad(`Asphyxia ${VERSION}`, 60)));
|
||||
Logger.info(pad(`Brought you by TsFreddie`, 60));
|
||||
Logger.info(` `);
|
||||
Logger.info(chalk.redBright(pad(`FREE SOFTWARE. BEWARE OF SCAMMERS.`, 60)));
|
||||
Logger.info(pad(`If you bought this software, request refund immediately.`, 60));
|
||||
Logger.info(` `);
|
||||
|
||||
const EAMUSE = express();
|
||||
|
||||
EAMUSE.disable('etag');
|
||||
EAMUSE.disable('x-powered-by');
|
||||
|
||||
const external = LoadExternalModules();
|
||||
process.title = `Asphyxia CORE ${VERSION} | Modules: ${external.modules.length}`;
|
||||
if (external.modules.length <= 0) {
|
||||
Logger.warn(chalk.yellowBright('no modules are installed.'));
|
||||
Logger.info('');
|
||||
}
|
||||
|
||||
EAMUSE.use('*', services(`http://${ARGS.bind}:${ARGS.port}`, external.router));
|
||||
|
||||
const server = EAMUSE.listen(ARGS.port, ARGS.bind, () => {
|
||||
const serverInfo = `http://${ARGS.bind}:${ARGS.port}`;
|
||||
Logger.info(` +==========================================+`);
|
||||
Logger.info(` |${pad(serverInfo, 42)}|`);
|
||||
Logger.info(` +==========================================+`);
|
||||
});
|
||||
|
||||
server.on('error', (err: any) => {
|
||||
if (err && err.code == 'EADDRINUSE') {
|
||||
Logger.info('Server failed to start: port might be in use.');
|
||||
Logger.info('Use -p argument to change port.');
|
||||
}
|
||||
Logger.info(' ');
|
||||
Logger.error(` ${err.message}`);
|
||||
Logger.info(' ');
|
||||
Logger.info('Press any key to exit.');
|
||||
process.stdin.resume();
|
||||
process.stdin.on('data', process.exit.bind(process, 0));
|
||||
});
|
||||
26
src/Playground.ts
Normal file
26
src/Playground.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { xmlToData, dataToXML, kencode, kitem } from './utils/KBinJSON';
|
||||
import ejs from 'ejs';
|
||||
import pug from 'pug';
|
||||
|
||||
const data = {
|
||||
attr: 0,
|
||||
text: 'text',
|
||||
};
|
||||
|
||||
const xmlData = {
|
||||
root: { '@attr': { test: data.attr }, 'test': kitem('str', data.text) },
|
||||
};
|
||||
const ejsData = xmlToData(
|
||||
ejs.render('<root test="<%= attr %>"><test><%= text %></test></root>', data)
|
||||
);
|
||||
const pugData = xmlToData(pug.render('root(test=attr)\n test #{text}', data));
|
||||
|
||||
console.log(JSON.stringify(xmlData, null, 4));
|
||||
console.log(JSON.stringify(ejsData, null, 4));
|
||||
console.log(JSON.stringify(pugData, null, 4));
|
||||
|
||||
console.log(kencode(xmlData).compare(kencode(ejsData)));
|
||||
console.log(kencode(xmlData).compare(kencode(pugData)));
|
||||
console.log(kencode(xmlData));
|
||||
console.log(kencode(ejsData));
|
||||
console.log(kencode(pugData));
|
||||
40
src/eamuse/Core/CardManager.ts
Normal file
40
src/eamuse/Core/CardManager.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { getAttr } from '../../utils/KBinJSON';
|
||||
import { EamuseModuleContainer } from '../EamuseModuleContainer';
|
||||
|
||||
export const cardmng = new EamuseModuleContainer();
|
||||
|
||||
const ProfileCheck: {
|
||||
[key: string]: () => boolean;
|
||||
} = {};
|
||||
|
||||
cardmng.add('*', 'cardmng.inquire', async (info, data, send) => {
|
||||
const model: string = info.model;
|
||||
const modelCode = model.split(':')[0] || 'NUL';
|
||||
await send.object({
|
||||
'@attr': {
|
||||
binded: (ProfileCheck[modelCode] || (() => false))() ? 1 : 0, // Has profile in game
|
||||
dataid: 'DEADC0DEFEEDBEEF', // Player.dataID
|
||||
ecflag: 1, // Is currency card
|
||||
expired: 0, // Is expired, if true will treat as new card
|
||||
newflag: 0,
|
||||
refid: 'DEADC0DEFEEDBEEF', // Player.dataID as well
|
||||
},
|
||||
});
|
||||
|
||||
return;
|
||||
});
|
||||
|
||||
cardmng.add('*', 'cardmng.getrefid', async (info, data, send) => {
|
||||
await send.object({ '@attr': { dataid: 'DEADC0DEFEEDBEEF', refid: 'DEADC0DEFEEDBEEF' } });
|
||||
return;
|
||||
});
|
||||
|
||||
cardmng.add('*', 'cardmng.authpass', async (info, data, send) => {
|
||||
// Right password
|
||||
await send.success();
|
||||
});
|
||||
|
||||
cardmng.add('*', 'cardmng.bindmodel', async (info, data, send) => {
|
||||
const dataID: string = getAttr(data, 'refid', 'DEADC0DEFEEDBEEF');
|
||||
await send.object({ '@attr': { dataid: dataID } });
|
||||
});
|
||||
36
src/eamuse/Core/EamuseCoin.ts
Normal file
36
src/eamuse/Core/EamuseCoin.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { set } from 'lodash';
|
||||
|
||||
import { kitem } from '../../utils/KBinJSON';
|
||||
import { EamuseModuleContainer } from '../EamuseModuleContainer';
|
||||
|
||||
export const eacoin = new EamuseModuleContainer();
|
||||
|
||||
eacoin.add('*', 'eacoin.checkout', async (info, data, send) => {
|
||||
await send.success();
|
||||
return;
|
||||
});
|
||||
|
||||
eacoin.add('*', 'eacoin.checkin', async (info, data, send) => {
|
||||
const result = {};
|
||||
|
||||
set(result, 'balance', kitem('s32', 10086));
|
||||
set(result, 'sessid', kitem('str', 'DEADC0DEFEEDBEEF'));
|
||||
set(result, 'acstatus', kitem('u8', 0));
|
||||
set(result, 'sequence', kitem('s16', 1));
|
||||
set(result, 'acid', kitem('str', 'DEADC0DEFEEDBEEF'));
|
||||
set(result, 'acname', kitem('str', 'DEADC0DEFEEDBEEF'));
|
||||
|
||||
await send.object(result);
|
||||
return;
|
||||
});
|
||||
|
||||
eacoin.add('*', 'eacoin.consume', async (info, data, send) => {
|
||||
const result = {};
|
||||
|
||||
set(result, 'autocharge', kitem('u8', 0));
|
||||
set(result, 'acstatus', kitem('u8', 0));
|
||||
set(result, 'balance', kitem('s32', 10086));
|
||||
|
||||
await send.object(result);
|
||||
return;
|
||||
});
|
||||
60
src/eamuse/Core/Facility.ts
Normal file
60
src/eamuse/Core/Facility.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { ip2int, kitem } from '../../utils/KBinJSON';
|
||||
import { VERSION } from '../../utils/Consts';
|
||||
import { ARGS } from '../../utils/ArgParser';
|
||||
import { EamuseModuleContainer } from '../EamuseModuleContainer';
|
||||
|
||||
export const facility = new EamuseModuleContainer();
|
||||
|
||||
facility.add('*', 'facility.get', async (info, data, send) => {
|
||||
const port = ARGS.mport;
|
||||
|
||||
const result = {
|
||||
location: {
|
||||
id: kitem('str', 'ea'),
|
||||
country: kitem('str', 'AX'),
|
||||
region: kitem('str', '1'),
|
||||
name: kitem('str', 'Asphyxia'),
|
||||
type: kitem('u8', 0),
|
||||
countryname: kitem('str', 'UNKNOWN'),
|
||||
countryjname: kitem('str', '不明'),
|
||||
regionname: kitem('str', 'Asphyxia'),
|
||||
regionjname: kitem('str', 'Asphyxia'),
|
||||
customercode: kitem('str', 'AXUSR'),
|
||||
companycode: kitem('str', 'AXCPY'),
|
||||
latitude: kitem('s32', 6666),
|
||||
longitude: kitem('s32', 6666),
|
||||
accuracy: kitem('u8', 0),
|
||||
},
|
||||
line: {
|
||||
id: kitem('str', '.'),
|
||||
class: kitem('u8', 0),
|
||||
},
|
||||
portfw: {
|
||||
globalip: kitem('ip4', ip2int('127.0.0.1')),
|
||||
globalport: kitem('u16', port),
|
||||
privateport: kitem('u16', port),
|
||||
},
|
||||
public: {
|
||||
flag: kitem('u8', 1),
|
||||
name: kitem('str', 'UNKNOWN'),
|
||||
latitude: kitem('str', '0'),
|
||||
longitude: kitem('str', '0'),
|
||||
},
|
||||
share: {
|
||||
eacoin: {
|
||||
notchamount: kitem('s32', 0),
|
||||
notchcount: kitem('s32', 0),
|
||||
supplylimit: kitem('s32', 100000),
|
||||
},
|
||||
url: {
|
||||
eapass: kitem('str', `AsphyxiaCore ${VERSION}`),
|
||||
arcadefan: kitem('str', `AsphyxiaCore ${VERSION}`),
|
||||
konaminetdx: kitem('str', `AsphyxiaCore ${VERSION}`),
|
||||
konamiid: kitem('str', `AsphyxiaCore ${VERSION}`),
|
||||
eagate: kitem('str', `AsphyxiaCore ${VERSION}`),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
await send.object(result);
|
||||
});
|
||||
17
src/eamuse/Core/PCBTracker.ts
Normal file
17
src/eamuse/Core/PCBTracker.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { EamuseModuleContainer } from '../EamuseModuleContainer';
|
||||
|
||||
export const pcbtracker = new EamuseModuleContainer();
|
||||
|
||||
pcbtracker.add('*', 'pcbtracker.alive', async (info, data, send) => {
|
||||
const result = {
|
||||
'@attr': {
|
||||
ecenable: 1,
|
||||
eclimit: 0,
|
||||
expire: 1200,
|
||||
limit: 0,
|
||||
time: Math.floor(Date.now() / 1000),
|
||||
},
|
||||
};
|
||||
|
||||
await send.object(result);
|
||||
});
|
||||
35
src/eamuse/Core/index.ts
Normal file
35
src/eamuse/Core/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { cardmng } from './CardManager';
|
||||
import { eacoin } from './EamuseCoin';
|
||||
import { facility } from './Facility';
|
||||
import { pcbtracker } from './PCBTracker';
|
||||
import { kitem } from '../../utils/KBinJSON';
|
||||
import { EamuseModuleContainer } from '../EamuseModuleContainer';
|
||||
|
||||
export const core = new EamuseModuleContainer();
|
||||
|
||||
core.add('*', 'message.get', async (info, data, send) => {
|
||||
await send.object({
|
||||
'@attr': { expire: 1200 },
|
||||
});
|
||||
});
|
||||
|
||||
core.add('*', 'package.list', async (info, data, send) => {
|
||||
await send.object({
|
||||
'@attr': { expire: 1200 },
|
||||
});
|
||||
});
|
||||
|
||||
core.add('*', 'pcbevent.put', async (info, data, send) => {
|
||||
await send.success();
|
||||
});
|
||||
|
||||
core.add('*', 'tax.get_phase', async (info, data, send) => {
|
||||
await send.object({
|
||||
phase: kitem('s32', 0),
|
||||
});
|
||||
});
|
||||
|
||||
core.add(eacoin);
|
||||
core.add(facility);
|
||||
core.add(cardmng);
|
||||
core.add(pcbtracker);
|
||||
39
src/eamuse/EamuseModule.ts
Normal file
39
src/eamuse/EamuseModule.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Logger } from '../utils/Logger';
|
||||
import path from 'path';
|
||||
|
||||
export class EamuseModule {
|
||||
private instance: any;
|
||||
private dir: string;
|
||||
|
||||
constructor(moduleDir: string) {
|
||||
var localPath = process.cwd();
|
||||
if ((process as any).pkg) {
|
||||
localPath = path.dirname(process.argv0);
|
||||
}
|
||||
this.dir = moduleDir;
|
||||
|
||||
try {
|
||||
const modulePath = path.join(localPath, 'modules', moduleDir);
|
||||
|
||||
this.instance = require(modulePath);
|
||||
if (this.instance && this.instance.default != null) {
|
||||
this.instance = this.instance.default;
|
||||
}
|
||||
} catch (err) {
|
||||
Logger.error(`Failed to load module "${this.dir}"`);
|
||||
Logger.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
moduleDirname() {
|
||||
return this.dir;
|
||||
}
|
||||
|
||||
register() {
|
||||
if (this.instance && typeof this.instance.register === 'function') {
|
||||
this.instance.register();
|
||||
} else {
|
||||
Logger.warning(`register() in module "${this.dir}" is not implemented`);
|
||||
}
|
||||
}
|
||||
}
|
||||
85
src/eamuse/EamuseModuleContainer.ts
Normal file
85
src/eamuse/EamuseModuleContainer.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import { isNil } from 'lodash';
|
||||
|
||||
import { KBinEncoding } from '../utils/KBinJSON';
|
||||
import { EamuseInfo } from '../middlewares/EamuseMiddleware';
|
||||
|
||||
export interface EamuseSendOption {
|
||||
status?: number;
|
||||
encoding?: KBinEncoding;
|
||||
rootName?: string;
|
||||
attr?: any;
|
||||
}
|
||||
|
||||
export interface EamuseSend {
|
||||
success: (options?: EamuseSendOption) => Promise<void>;
|
||||
deny: (options?: EamuseSendOption) => Promise<void>;
|
||||
status: (code: number, options?: EamuseSendOption) => Promise<void>;
|
||||
object: (res: any, options?: EamuseSendOption) => Promise<void>;
|
||||
xml: (res: string, data?: any, options?: EamuseSendOption) => Promise<void>;
|
||||
pug: (res: string, data?: any, options?: EamuseSendOption) => Promise<void>;
|
||||
xmlFile: (file: string, data?: any, options?: EamuseSendOption) => Promise<void>;
|
||||
pugFile: (file: string, data?: any, options?: EamuseSendOption) => Promise<void>;
|
||||
}
|
||||
|
||||
export type EamuseModuleRoute = (req: EamuseInfo, data: any, send: EamuseSend) => Promise<any>;
|
||||
|
||||
export class EamuseModuleContainer {
|
||||
private modules: {
|
||||
[key: string]: boolean | EamuseModuleRoute;
|
||||
};
|
||||
|
||||
constructor() {
|
||||
this.modules = {};
|
||||
}
|
||||
|
||||
public add(gameCode: string, method: string): void;
|
||||
public add(gameCode: string, method: string, handler: EamuseModuleRoute | boolean): void;
|
||||
public add(gameCode: EamuseModuleContainer): void;
|
||||
public add(
|
||||
gameCode: string | EamuseModuleContainer,
|
||||
method?: string,
|
||||
handler?: EamuseModuleRoute | boolean
|
||||
): void {
|
||||
if (typeof gameCode === 'string' && method !== null && typeof method === 'string') {
|
||||
let key = `${gameCode}:${method}`;
|
||||
if (gameCode === '*') {
|
||||
key = `${method}`;
|
||||
}
|
||||
if (handler) {
|
||||
this.modules[key] = handler;
|
||||
} else {
|
||||
this.modules[key] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (gameCode instanceof EamuseModuleContainer) {
|
||||
this.modules = { ...this.modules, ...gameCode.modules };
|
||||
}
|
||||
}
|
||||
|
||||
public async run(
|
||||
gameCode: string,
|
||||
moduleName: string,
|
||||
method: string,
|
||||
info: EamuseInfo,
|
||||
data: any,
|
||||
send: EamuseSend
|
||||
): Promise<void> {
|
||||
let handler = this.modules[`${moduleName}.${method}`];
|
||||
if (isNil(handler)) handler = this.modules[`${gameCode}:${moduleName}.${method}`];
|
||||
if (isNil(handler)) {
|
||||
return await send.deny();
|
||||
}
|
||||
|
||||
if (typeof handler === 'boolean') {
|
||||
if (handler) {
|
||||
return await send.success();
|
||||
} else {
|
||||
return await send.deny();
|
||||
}
|
||||
}
|
||||
|
||||
await handler(info, data, send);
|
||||
return;
|
||||
}
|
||||
}
|
||||
110
src/eamuse/ExternalModuleLoader.ts
Normal file
110
src/eamuse/ExternalModuleLoader.ts
Normal file
@@ -0,0 +1,110 @@
|
||||
import { EamuseModuleContainer, EamuseModuleRoute } from './EamuseModuleContainer';
|
||||
import { kitem, karray, kattr } from '../utils/KBinJSON';
|
||||
import path from 'path';
|
||||
import {
|
||||
getAttr,
|
||||
getBigInt,
|
||||
getBigInts,
|
||||
getBool,
|
||||
getBuffer,
|
||||
getContent,
|
||||
getElement,
|
||||
getElements,
|
||||
getFirst,
|
||||
getNumber,
|
||||
getNumbers,
|
||||
getStr,
|
||||
} from '../utils/KBinJSON';
|
||||
import fs from 'fs';
|
||||
import { Logger } from '../utils/Logger';
|
||||
import { ARGS } from '../utils/ArgParser';
|
||||
|
||||
var localPath = process.cwd();
|
||||
if ((process as any).pkg) {
|
||||
localPath = path.dirname(process.argv0);
|
||||
}
|
||||
|
||||
/* Exposing API */
|
||||
const $: any = global;
|
||||
const MODULE_ROUTER = new EamuseModuleContainer();
|
||||
$.MODULE_PATH = path.join(localPath, 'modules');
|
||||
|
||||
const tsconfig = path.join($.MODULE_PATH, 'tsconfig.json');
|
||||
/* ncc/pkg hack */
|
||||
// require('typescript');
|
||||
const ts_node = require('ts-node');
|
||||
if (fs.existsSync(tsconfig)) {
|
||||
/* Inject ts-node */
|
||||
ts_node.register({ project: tsconfig });
|
||||
} else {
|
||||
ts_node.register();
|
||||
}
|
||||
|
||||
$.RegisterRoute = (gameCode: string, method: string, handler: EamuseModuleRoute | boolean) => {
|
||||
if (gameCode === '*') return;
|
||||
MODULE_ROUTER.add(gameCode, method, handler);
|
||||
};
|
||||
$.$ = {
|
||||
ATTR: getAttr,
|
||||
BIGINT: getBigInt,
|
||||
BIGINTS: getBigInts,
|
||||
BOOL: getBool,
|
||||
BUFFER: getBuffer,
|
||||
CONTENT: getContent,
|
||||
ELEMENT: getElement,
|
||||
ELEMENTS: getElements,
|
||||
FIRST: getFirst,
|
||||
NUMBER: getNumber,
|
||||
NUMBERS: getNumbers,
|
||||
STR: getStr,
|
||||
};
|
||||
|
||||
$.K = {
|
||||
ATTR: kattr,
|
||||
ITEM: kitem,
|
||||
ARRAY: karray,
|
||||
};
|
||||
|
||||
if (!ARGS.dev) {
|
||||
$.console.log = () => {};
|
||||
$.console.warn = () => {};
|
||||
$.console.error = () => {};
|
||||
}
|
||||
|
||||
export function LoadExternalModules() {
|
||||
const loadedModules = [];
|
||||
try {
|
||||
const modules = fs.readdirSync($.MODULE_PATH);
|
||||
for (const mod of modules) {
|
||||
const modulePath = path.join(localPath, 'modules', mod);
|
||||
const moduleExt = path.extname(modulePath);
|
||||
|
||||
if (
|
||||
modulePath.endsWith('.d.ts') ||
|
||||
mod == 'node_modules' ||
|
||||
(moduleExt !== '' && moduleExt !== '.ts' && moduleExt !== '.js')
|
||||
)
|
||||
continue;
|
||||
|
||||
try {
|
||||
this.instance = require(modulePath);
|
||||
if (this.instance && this.instance.default != null) {
|
||||
this.instance = this.instance.default;
|
||||
}
|
||||
|
||||
this.instance.register();
|
||||
loadedModules.push(path.basename(mod));
|
||||
} catch (err) {
|
||||
Logger.error(`failed to load module "${mod}"`);
|
||||
Logger.error(err);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Logger.warn(`can not find "modules" directory.`);
|
||||
Logger.warn(`make sure your modules are installed under: ${path.join(localPath, 'modules')}`);
|
||||
}
|
||||
return {
|
||||
modules: loadedModules,
|
||||
router: MODULE_ROUTER,
|
||||
};
|
||||
}
|
||||
72
src/eamuse/Services.ts
Normal file
72
src/eamuse/Services.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { Router } from 'express';
|
||||
|
||||
import { EamuseMiddleware, EamuseRoute } from '../middlewares/EamuseMiddleware';
|
||||
import { core } from './Core';
|
||||
import { EamuseModuleContainer } from './EamuseModuleContainer';
|
||||
|
||||
export const services = (url: string, modules: EamuseModuleContainer) => {
|
||||
const routeEamuse = Router();
|
||||
const rootEA = new EamuseModuleContainer();
|
||||
|
||||
const coreModules = [
|
||||
'cardmng',
|
||||
'facility',
|
||||
'message',
|
||||
'numbering',
|
||||
'package',
|
||||
'pcbevent',
|
||||
'pcbtracker',
|
||||
'pkglist',
|
||||
'posevent',
|
||||
'userdata',
|
||||
'userid',
|
||||
'eacoin',
|
||||
'local',
|
||||
'local2',
|
||||
'lobby',
|
||||
'lobby2',
|
||||
'dlstatus',
|
||||
'netlog',
|
||||
];
|
||||
|
||||
/* General Information */
|
||||
routeEamuse.use(EamuseMiddleware).all('/', EamuseRoute(rootEA));
|
||||
|
||||
/* - Service */
|
||||
rootEA.add('*', 'services.get', async (info, data, send) => {
|
||||
const services = {
|
||||
'@attr': {
|
||||
expire: 10800,
|
||||
method: 'get',
|
||||
mode: 'operation',
|
||||
},
|
||||
'item': [
|
||||
{
|
||||
'@attr': {
|
||||
name: 'ntp',
|
||||
url: 'ntp://pool.ntp.org/',
|
||||
},
|
||||
},
|
||||
{
|
||||
'@attr': {
|
||||
name: 'keepalive',
|
||||
url: `http://127.0.0.1/keepalive?pa=127.0.0.1&ia=127.0.0.1&ga=127.0.0.1&ma=127.0.0.1&t1=2&t2=10`,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
for (const moduleName of coreModules) {
|
||||
services.item.push({ '@attr': { name: moduleName, url } });
|
||||
}
|
||||
|
||||
await send.object(services);
|
||||
return;
|
||||
});
|
||||
|
||||
/* Core */
|
||||
rootEA.add(core);
|
||||
rootEA.add(modules);
|
||||
|
||||
return routeEamuse;
|
||||
};
|
||||
218
src/middlewares/EamuseMiddleware.ts
Normal file
218
src/middlewares/EamuseMiddleware.ts
Normal file
@@ -0,0 +1,218 @@
|
||||
import path from 'path';
|
||||
import { render as ejs, renderFile as ejsFile } from 'ejs';
|
||||
import { render as pug, renderFile as pugFile } from 'pug';
|
||||
import getCallerFile from 'get-caller-file';
|
||||
|
||||
import { RequestHandler } from 'express';
|
||||
import { findKey, get, has, defaultTo, set } from 'lodash';
|
||||
|
||||
import { isKBin, kdecode, kencode, xmlToData } from '../utils/KBinJSON';
|
||||
import { KonmaiEncrypt } from '../utils/KonmaiEncrypt';
|
||||
import LzKN from '../utils/LzKN';
|
||||
import { Logger } from '../utils/Logger';
|
||||
import { EamuseSendOption, EamuseModuleContainer } from '../eamuse/EamuseModuleContainer';
|
||||
|
||||
const ACCEPT_AGENTS = ['EAMUSE.XRPC/1.0', 'EAMUSE.Httpac/1.0'];
|
||||
|
||||
export interface EABody {
|
||||
data: object;
|
||||
buffer: Buffer;
|
||||
module: string;
|
||||
method: string;
|
||||
encrypted: boolean;
|
||||
compress: 'none' | 'lz77' | 'forcenone';
|
||||
model: string;
|
||||
}
|
||||
|
||||
export interface EamuseInfo {
|
||||
module: string;
|
||||
method: string;
|
||||
model: string;
|
||||
}
|
||||
|
||||
export const EamuseMiddleware: RequestHandler = async (req, res, next) => {
|
||||
res.set('X-Powered-By', 'Asphyxia');
|
||||
|
||||
const agent = req.headers['user-agent'];
|
||||
if (ACCEPT_AGENTS.indexOf(agent) < 0) {
|
||||
Logger.debug(`EAM: Unsupported agent: ${agent}`);
|
||||
res.sendStatus(404);
|
||||
return;
|
||||
}
|
||||
|
||||
const eamuseInfo = req.headers['x-eamuse-info'];
|
||||
|
||||
let compress = req.headers['x-compress'];
|
||||
|
||||
if (!compress) {
|
||||
compress = 'none';
|
||||
}
|
||||
|
||||
const chunks: Buffer[] = [];
|
||||
|
||||
req.on('data', chunk => {
|
||||
chunks.push(Buffer.from(chunk));
|
||||
});
|
||||
|
||||
req.on('end', () => {
|
||||
Logger.debug(req.url);
|
||||
const data = Buffer.concat(chunks);
|
||||
if (!data) {
|
||||
Logger.debug(`EAM: No Data`);
|
||||
res.sendStatus(404);
|
||||
return;
|
||||
}
|
||||
|
||||
let body = data;
|
||||
let encrypted = false;
|
||||
|
||||
if (eamuseInfo) {
|
||||
encrypted = true;
|
||||
const key = new KonmaiEncrypt(eamuseInfo.toString());
|
||||
const decrypted = key.encrypt(body);
|
||||
body = decrypted;
|
||||
}
|
||||
|
||||
if (body && compress === 'lz77') {
|
||||
body = LzKN.inflate(body);
|
||||
}
|
||||
|
||||
if (!body) {
|
||||
Logger.debug(`EAM: Failed Data Processing`);
|
||||
res.sendStatus(404);
|
||||
return;
|
||||
}
|
||||
|
||||
let xml;
|
||||
if (!isKBin(body)) {
|
||||
xml = xmlToData(body);
|
||||
} else {
|
||||
xml = kdecode(body);
|
||||
}
|
||||
|
||||
const eaModule = findKey(get(xml, 'call'), x => has(x, '@attr.method'));
|
||||
const eaMethod = get(xml, `call.${eaModule}.@attr.method`);
|
||||
const model = get(xml, 'call.@attr.model');
|
||||
|
||||
if (!eaModule || !eaMethod) {
|
||||
res.sendStatus(404);
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.debug(`${eaModule}.${eaMethod}`);
|
||||
|
||||
req.body = {
|
||||
data: xml,
|
||||
buffer: data,
|
||||
module: eaModule as string,
|
||||
method: eaMethod as string,
|
||||
compress,
|
||||
encrypted,
|
||||
model,
|
||||
} as EABody;
|
||||
next();
|
||||
});
|
||||
};
|
||||
|
||||
export const EamuseRoute = (container: EamuseModuleContainer): RequestHandler => {
|
||||
const route: RequestHandler = async (req, res) => {
|
||||
const body = req.body as EABody;
|
||||
|
||||
const sendObject = async (content: any = {}, options: EamuseSendOption = {}) => {
|
||||
const encoding = defaultTo(options.encoding, 'SHIFT_JIS');
|
||||
const attr = defaultTo(options.attr, {});
|
||||
const status = defaultTo(options.status, 0);
|
||||
const rootName = defaultTo(options.rootName, req.body.module);
|
||||
|
||||
const resAttr = {
|
||||
...attr,
|
||||
};
|
||||
const result = { response: { '@attr': resAttr } };
|
||||
if (!has(content, '@attr')) {
|
||||
content['@attr'] = { status };
|
||||
} else {
|
||||
set(content, '@attr.status', status);
|
||||
}
|
||||
|
||||
set(result, `response.${rootName}`, content);
|
||||
|
||||
let kBin = kencode(result, encoding, true);
|
||||
const key = new KonmaiEncrypt();
|
||||
const pubKey = key.getPublicKey();
|
||||
let compress = 'none';
|
||||
|
||||
const kBinLen = kBin.length;
|
||||
if (body.compress !== 'none' && kBinLen > 500) {
|
||||
compress = 'lz77';
|
||||
kBin = LzKN.deflate(kBin);
|
||||
}
|
||||
|
||||
res.setHeader('X-Compress', compress);
|
||||
if (body.encrypted) {
|
||||
res.setHeader('X-Eamuse-Info', pubKey);
|
||||
kBin = key.encrypt(kBin);
|
||||
}
|
||||
|
||||
res.send(kBin);
|
||||
};
|
||||
|
||||
const sendXml = async (template: string, data?: any, options?: EamuseSendOption) => {
|
||||
return sendObject(xmlToData(ejs(template, data)), options);
|
||||
};
|
||||
|
||||
const sendPug = async (template: string, data?: any, options?: EamuseSendOption) => {
|
||||
return sendObject(xmlToData(pug(template, data)), options);
|
||||
};
|
||||
|
||||
const sendXmlFile = async (template: string, data?: any, options?: EamuseSendOption) => {
|
||||
const caller = getCallerFile();
|
||||
const callerPath = path.dirname(caller);
|
||||
const callerFile = path.basename(caller);
|
||||
if (callerPath.endsWith('modules')) {
|
||||
Logger.error(`[${callerFile}] Cannot render file templates from single-file modules`);
|
||||
return sendObject({}, { status: 1 });
|
||||
} else {
|
||||
return sendObject(xmlToData(ejsFile(path.join(callerPath, template), data)), options);
|
||||
}
|
||||
};
|
||||
|
||||
const sendPugFile = async (template: string, data?: any, options?: EamuseSendOption) => {
|
||||
const caller = getCallerFile();
|
||||
const callerPath = path.dirname(caller);
|
||||
const callerFile = path.basename(caller);
|
||||
if (callerPath.endsWith('modules')) {
|
||||
Logger.error(`[${callerFile}] Cannot render file templates from single-file modules`);
|
||||
return sendObject({}, { status: 1 });
|
||||
} else {
|
||||
return sendObject(xmlToData(pugFile(path.join(callerPath, template), data)), options);
|
||||
}
|
||||
};
|
||||
const gameCode = body.model.split(':')[0];
|
||||
try {
|
||||
await container.run(
|
||||
gameCode,
|
||||
body.module,
|
||||
body.method,
|
||||
{ module: body.module, method: body.method, model: body.model },
|
||||
get(body.data, `call.${body.module}`),
|
||||
{
|
||||
success: options => sendObject(options),
|
||||
deny: options => sendObject({}, { ...options, status: 1 }),
|
||||
status: (status, options) => sendObject({}, { ...options, status }),
|
||||
object: sendObject,
|
||||
xml: sendXml,
|
||||
pug: sendPug,
|
||||
xmlFile: sendXmlFile,
|
||||
pugFile: sendPugFile,
|
||||
}
|
||||
);
|
||||
} catch (err) {
|
||||
if ((process as any).pkg == null) {
|
||||
throw err;
|
||||
}
|
||||
await sendObject({}, { status: 1 });
|
||||
}
|
||||
};
|
||||
|
||||
return route;
|
||||
};
|
||||
39
src/utils/ArgParser.ts
Normal file
39
src/utils/ArgParser.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { ArgumentParser } from 'argparse';
|
||||
import { VERSION } from './Consts';
|
||||
|
||||
const parser = new ArgumentParser({
|
||||
version: VERSION,
|
||||
addHelp: true,
|
||||
description: 'AsphyxiaCore: A Rhythm Game Helper',
|
||||
prog: 'asphyxia_core',
|
||||
});
|
||||
|
||||
parser.addArgument(['-p', '--port'], {
|
||||
help: 'Set listening port. (default: 8083)',
|
||||
defaultValue: 8083,
|
||||
type: 'int',
|
||||
metavar: 'PORT',
|
||||
});
|
||||
|
||||
parser.addArgument(['-b', '--bind'], {
|
||||
help: 'Hostname binding. In case you need to access it through LAN. (default: "localhost")',
|
||||
defaultValue: 'localhost',
|
||||
metavar: 'HOST',
|
||||
});
|
||||
|
||||
parser.addArgument(['-m', '--matching-port'], {
|
||||
help: 'Set matching port. (default: 5700)',
|
||||
defaultValue: 5700,
|
||||
type: 'int',
|
||||
dest: 'mport',
|
||||
metavar: 'PORT',
|
||||
});
|
||||
|
||||
parser.addArgument(['--console'], {
|
||||
help: 'Enable console for modules.',
|
||||
defaultValue: false,
|
||||
dest: 'dev',
|
||||
action: 'storeTrue',
|
||||
});
|
||||
|
||||
export const ARGS = parser.parseArgs();
|
||||
410
src/utils/AutoBuffer.ts
Normal file
410
src/utils/AutoBuffer.ts
Normal file
@@ -0,0 +1,410 @@
|
||||
import { Logger } from './Logger';
|
||||
|
||||
export type BinaryLengthType = BinaryBigIntType | BinaryNumberType;
|
||||
|
||||
type BinaryNumberType = 's8' | 's16' | 's32' | 'u8' | 'u16' | 'u32';
|
||||
|
||||
type BinaryBigIntType = 's64' | 'u64';
|
||||
|
||||
type BufferMethodType =
|
||||
| 'readInt8'
|
||||
| 'readInt16BE'
|
||||
| 'readInt32BE'
|
||||
| 'readUInt8'
|
||||
| 'readUInt16BE'
|
||||
| 'readUInt32BE'
|
||||
| 'readBigUInt64BE'
|
||||
| 'readBigInt64BE'
|
||||
| 'readFloatBE'
|
||||
| 'readDoubleBE';
|
||||
|
||||
type BufferWriteType =
|
||||
| 'writeInt8'
|
||||
| 'writeInt16BE'
|
||||
| 'writeInt32BE'
|
||||
| 'writeUInt8'
|
||||
| 'writeUInt16BE'
|
||||
| 'writeUInt32BE'
|
||||
| 'writeFloatBE'
|
||||
| 'writeDoubleBE';
|
||||
|
||||
const BUFFER_METHOD_MAP: { [key: string]: BufferMethodType } = {
|
||||
s8: 'readInt8',
|
||||
s16: 'readInt16BE',
|
||||
s32: 'readInt32BE',
|
||||
s64: 'readBigInt64BE',
|
||||
u8: 'readUInt8',
|
||||
u16: 'readUInt16BE',
|
||||
u32: 'readUInt32BE',
|
||||
u64: 'readBigUInt64BE',
|
||||
f: 'readFloatBE',
|
||||
d: 'readDoubleBE',
|
||||
};
|
||||
|
||||
// 64bit is handled by special case
|
||||
const BUFFER_WRITE_MAP: { [key: string]: BufferWriteType } = {
|
||||
s8: 'writeInt8',
|
||||
s16: 'writeInt16BE',
|
||||
s32: 'writeInt32BE',
|
||||
u8: 'writeUInt8',
|
||||
u16: 'writeUInt16BE',
|
||||
u32: 'writeUInt32BE',
|
||||
f: 'writeFloatBE',
|
||||
d: 'writeDoubleBE',
|
||||
};
|
||||
|
||||
const NUMBER_CLAMP_MAP: { [key: string]: (x: number) => number } = {
|
||||
s8: x => Number(BigInt.asIntN(8, BigInt(~~x))),
|
||||
s16: x => Number(BigInt.asIntN(16, BigInt(~~x))),
|
||||
s32: x => Number(BigInt.asIntN(32, BigInt(~~x))),
|
||||
u8: x => Number(BigInt.asUintN(8, BigInt(~~x))),
|
||||
u16: x => Number(BigInt.asUintN(16, BigInt(~~x))),
|
||||
u32: x => Number(BigInt.asUintN(32, BigInt(~~x))),
|
||||
f: x => x,
|
||||
d: x => x,
|
||||
};
|
||||
|
||||
const BINARY_LENGTH_MAP: { [key: string]: number } = {
|
||||
s8: 1,
|
||||
s16: 2,
|
||||
s32: 4,
|
||||
s64: 8,
|
||||
u8: 1,
|
||||
u16: 2,
|
||||
u32: 4,
|
||||
u64: 8,
|
||||
f: 4,
|
||||
d: 8,
|
||||
};
|
||||
|
||||
// Buffer polyfill
|
||||
if (process.version.startsWith('v10')) {
|
||||
Logger.debug('Polyfill: Bigint Buffer');
|
||||
function writeBigU_Int64BE(buf: Buffer, value: bigint, offset: number) {
|
||||
let lo = Number(value & BigInt(0xffffffff));
|
||||
buf[offset + 7] = lo;
|
||||
lo = lo >> 8;
|
||||
buf[offset + 6] = lo;
|
||||
lo = lo >> 8;
|
||||
buf[offset + 5] = lo;
|
||||
lo = lo >> 8;
|
||||
buf[offset + 4] = lo;
|
||||
let hi = Number((value >> BigInt(32)) & BigInt(0xffffffff));
|
||||
buf[offset + 3] = hi;
|
||||
hi = hi >> 8;
|
||||
buf[offset + 2] = hi;
|
||||
hi = hi >> 8;
|
||||
buf[offset + 1] = hi;
|
||||
hi = hi >> 8;
|
||||
buf[offset] = hi;
|
||||
return offset + 8;
|
||||
}
|
||||
|
||||
Buffer.prototype.readBigUInt64BE = function(offset = 0) {
|
||||
const first = this[offset];
|
||||
const last = this[offset + 7];
|
||||
if (first === undefined || last === undefined) return;
|
||||
|
||||
const hi =
|
||||
first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
|
||||
|
||||
const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
|
||||
|
||||
return (BigInt(hi) << BigInt(32)) + BigInt(lo);
|
||||
};
|
||||
|
||||
Buffer.prototype.readBigInt64BE = function(offset = 0) {
|
||||
const first = this[offset];
|
||||
const last = this[offset + 7];
|
||||
if (first === undefined || last === undefined) return;
|
||||
|
||||
const val =
|
||||
(first << 24) + // Overflow
|
||||
this[++offset] * 2 ** 16 +
|
||||
this[++offset] * 2 ** 8 +
|
||||
this[++offset];
|
||||
|
||||
return (
|
||||
(BigInt(val) << BigInt(32)) +
|
||||
BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last)
|
||||
);
|
||||
};
|
||||
|
||||
Buffer.prototype.writeBigInt64BE = function(value: bigint, offset = 0) {
|
||||
return writeBigU_Int64BE(this, value, offset);
|
||||
};
|
||||
|
||||
Buffer.prototype.writeBigUInt64BE = function(value: bigint, offset = 0) {
|
||||
return writeBigU_Int64BE(this, value, offset);
|
||||
};
|
||||
}
|
||||
|
||||
export class WriteBuffer {
|
||||
private buffer: Buffer;
|
||||
private capacity: number;
|
||||
private offset: number;
|
||||
private byte: number;
|
||||
private word: number;
|
||||
|
||||
constructor(capacity = 32) {
|
||||
this.capacity = capacity;
|
||||
this.buffer = Buffer.alloc(this.capacity);
|
||||
this.offset = 0;
|
||||
this.byte = 0;
|
||||
this.word = 0;
|
||||
}
|
||||
|
||||
public autoGrow(increment: number): void {
|
||||
let grow = false;
|
||||
while (this.offset + increment >= this.capacity) {
|
||||
this.capacity *= 2;
|
||||
grow = true;
|
||||
}
|
||||
|
||||
if (grow) {
|
||||
const newBuffer = Buffer.alloc(this.capacity);
|
||||
newBuffer.set(this.buffer);
|
||||
this.buffer = newBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
get length(): number {
|
||||
return this.offset;
|
||||
}
|
||||
|
||||
public writeByte(value: number): void {
|
||||
this.autoGrow(1);
|
||||
this.buffer.writeUInt8(value & 0xff, this.offset);
|
||||
this.offset += 1;
|
||||
}
|
||||
|
||||
public skip(len: number): void {
|
||||
this.autoGrow(len);
|
||||
this.offset += len;
|
||||
}
|
||||
|
||||
public get(index: number): number {
|
||||
return this.buffer[index];
|
||||
}
|
||||
|
||||
public subarray(begin = 0, end?: number): Buffer {
|
||||
if (end === undefined) {
|
||||
end = this.length;
|
||||
}
|
||||
return this.buffer.subarray(begin, end);
|
||||
}
|
||||
|
||||
public write(type: BinaryLengthType, value: number | bigint): void {
|
||||
const bytes = BINARY_LENGTH_MAP[type];
|
||||
this.autoGrow(bytes);
|
||||
|
||||
if (type !== 'u64' && type !== 's64' && typeof value == 'number') {
|
||||
this.buffer[BUFFER_WRITE_MAP[type]](NUMBER_CLAMP_MAP[type](value), this.offset);
|
||||
} else if (typeof value == 'bigint') {
|
||||
if (type[0] === 's') {
|
||||
this.buffer.writeBigInt64BE(BigInt.asIntN(64, value), this.offset);
|
||||
} else {
|
||||
this.buffer.writeBigUInt64BE(BigInt.asUintN(64, value), this.offset);
|
||||
}
|
||||
}
|
||||
this.offset += bytes;
|
||||
}
|
||||
|
||||
public writeBytes(data: string | Buffer): void {
|
||||
const len = data.length;
|
||||
this.autoGrow(len);
|
||||
|
||||
if (typeof data === 'string') {
|
||||
this.buffer.write(data, this.offset);
|
||||
} else {
|
||||
this.buffer.set(data, this.offset);
|
||||
}
|
||||
|
||||
this.offset += len;
|
||||
}
|
||||
|
||||
public writeStream(data: string | Buffer): void {
|
||||
const len = data.length;
|
||||
this.write('u32', len);
|
||||
this.writeBytes(data);
|
||||
this.realign();
|
||||
}
|
||||
|
||||
public writeArray(type: BinaryLengthType, data: (number | bigint)[]): void {
|
||||
const size = data.length * BINARY_LENGTH_MAP[type];
|
||||
this.write('u32', size);
|
||||
|
||||
for (const value of data) {
|
||||
this.write(type, value);
|
||||
}
|
||||
this.realign();
|
||||
}
|
||||
|
||||
public writeNumberData(type: BinaryLengthType, data: (number | bigint)[]): void {
|
||||
if (this.byte % 4 === 0) {
|
||||
this.byte = this.offset;
|
||||
}
|
||||
if (this.word % 4 === 0) {
|
||||
this.word = this.offset;
|
||||
}
|
||||
|
||||
// const isBig = type === 's64' || type === 'u64';
|
||||
const dataSize = BINARY_LENGTH_MAP[type];
|
||||
const size = BINARY_LENGTH_MAP[type] * data.length;
|
||||
|
||||
if (size === 1) {
|
||||
if (this.byte % 4 === 0) {
|
||||
this.write('u32', 0);
|
||||
}
|
||||
|
||||
for (const value of data) {
|
||||
if (typeof value == 'number') {
|
||||
this.buffer[BUFFER_WRITE_MAP[type]](NUMBER_CLAMP_MAP[type](value), this.byte);
|
||||
}
|
||||
|
||||
this.byte += dataSize;
|
||||
}
|
||||
} else if (size === 2) {
|
||||
if (this.word % 4 === 0) {
|
||||
this.write('u32', 0);
|
||||
}
|
||||
|
||||
for (const value of data) {
|
||||
if (typeof value == 'number') {
|
||||
this.buffer[BUFFER_WRITE_MAP[type]](NUMBER_CLAMP_MAP[type](value), this.word);
|
||||
}
|
||||
|
||||
this.word += dataSize;
|
||||
}
|
||||
} else {
|
||||
for (const value of data) {
|
||||
this.write(type, value);
|
||||
}
|
||||
this.realign();
|
||||
}
|
||||
}
|
||||
|
||||
public realign(size = 4): void {
|
||||
const padding = this.offset % size;
|
||||
if (padding !== 0) {
|
||||
this.autoGrow(size - padding);
|
||||
this.offset += size - padding;
|
||||
}
|
||||
}
|
||||
|
||||
public getBuffer(): Buffer {
|
||||
return this.buffer.subarray(0, this.offset);
|
||||
}
|
||||
}
|
||||
|
||||
export class ReadBuffer {
|
||||
public data: Buffer;
|
||||
private start: number;
|
||||
private byte: number;
|
||||
private word: number;
|
||||
private offset: number;
|
||||
|
||||
constructor(data: Buffer, offset = 0) {
|
||||
this.data = data;
|
||||
this.start = offset;
|
||||
this.offset = 0;
|
||||
this.byte = 0;
|
||||
this.word = 0;
|
||||
}
|
||||
|
||||
public peek(type: BinaryLengthType): number | bigint {
|
||||
const res = this.data[BUFFER_METHOD_MAP[type]](this.start + this.offset);
|
||||
return res;
|
||||
}
|
||||
|
||||
public get(type: BinaryLengthType): bigint | number {
|
||||
const res = this.peek(type);
|
||||
this.offset += BINARY_LENGTH_MAP[type];
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public peekBytes(len: number): Buffer {
|
||||
return this.data.subarray(this.start + this.offset, this.start + this.offset + len);
|
||||
}
|
||||
|
||||
public getBytes(len: number): Buffer {
|
||||
const res = this.peekBytes(len);
|
||||
this.offset += len;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public hasData(): boolean {
|
||||
return this.start + this.offset < this.data.length;
|
||||
}
|
||||
|
||||
public realign(size = 4): void {
|
||||
if (this.offset % size !== 0) {
|
||||
this.offset += size - (this.offset % size);
|
||||
}
|
||||
}
|
||||
|
||||
public getStream(): Buffer {
|
||||
const size = Number(this.get('s32'));
|
||||
let res = null;
|
||||
if (size > 0) {
|
||||
res = this.getBytes(size);
|
||||
}
|
||||
this.realign();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public getArray(type: BinaryLengthType): (number | bigint)[] {
|
||||
const size = Number(this.get('u32'));
|
||||
|
||||
const len = size / BINARY_LENGTH_MAP[type];
|
||||
|
||||
const res = [];
|
||||
for (let i = 0; i < len; ++i) {
|
||||
res.push(this.get(type));
|
||||
}
|
||||
this.realign();
|
||||
return res;
|
||||
}
|
||||
|
||||
public getNumberData(type: BinaryLengthType, count = 1): (number | bigint)[] {
|
||||
if (this.byte % 4 === 0) {
|
||||
this.byte = this.offset;
|
||||
}
|
||||
|
||||
if (this.word % 4 === 0) {
|
||||
this.word = this.offset;
|
||||
}
|
||||
|
||||
const dataSize = BINARY_LENGTH_MAP[type];
|
||||
const size = dataSize * count;
|
||||
const res = [];
|
||||
|
||||
if (size === 1) {
|
||||
for (let i = 0; i < count; ++i) {
|
||||
res.push(this.data[BUFFER_METHOD_MAP[type]](this.start + this.byte));
|
||||
this.byte += dataSize;
|
||||
}
|
||||
} else if (size === 2) {
|
||||
for (let i = 0; i < count; ++i) {
|
||||
res.push(this.data[BUFFER_METHOD_MAP[type]](this.start + this.word));
|
||||
this.word += dataSize;
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < count; ++i) {
|
||||
res.push(this.get(type));
|
||||
}
|
||||
this.realign();
|
||||
}
|
||||
|
||||
const trailing = Math.max(this.byte, this.word);
|
||||
if (this.offset < trailing) {
|
||||
this.offset = trailing;
|
||||
this.realign();
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
1
src/utils/Consts.ts
Normal file
1
src/utils/Consts.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const VERSION = 'v1.0 beta';
|
||||
90
src/utils/EamuseIO.ts
Normal file
90
src/utils/EamuseIO.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
||||
import { Logger } from './Logger';
|
||||
import { xmlToData, dataToXML } from './KBinJSON';
|
||||
import getCallerFile from 'get-caller-file';
|
||||
|
||||
export function ExistsFile(file: string): boolean {
|
||||
try {
|
||||
return existsSync(`${file}.json`);
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function ReadFile(file: string): any {
|
||||
try {
|
||||
if (!existsSync(`${file}.json`)) {
|
||||
return null;
|
||||
}
|
||||
const data = JSON.parse(
|
||||
readFileSync(`${file}.json`, {
|
||||
encoding: 'UTF-8',
|
||||
})
|
||||
);
|
||||
return data;
|
||||
} catch (err) {
|
||||
Logger.error(err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function WriteFile(file: string, data: any, formated = false) {
|
||||
try {
|
||||
if (formated) {
|
||||
writeFileSync(`${file}.json`, JSON.stringify(data, null, 4));
|
||||
} else {
|
||||
writeFileSync(`${file}.json`, JSON.stringify(data));
|
||||
}
|
||||
Logger.info(`${file}.json Saved`);
|
||||
} catch (err) {
|
||||
Logger.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
// export function WriteDebugFile(file: string, data: any) {
|
||||
// if (process.env.ASPHYXIA_PRINT_LOG !== 'print') return;
|
||||
// try {
|
||||
// let output = JSON.stringify(data, null, 2);
|
||||
// const kitemReplace = /\{\s*\n\s*['"]@attr['"]: \{\s*\n\s*['"]?__type['"]?: ['"](.*)['"],?\s*\n\s*\},\s*\n\s*['"]@content['"]: \[\s*\n*\s*(.*)\s*\n*\s*\],?\s*\n\s*\}/g;
|
||||
// const strReplace = /\{\s*\n\s*['"]@attr['"]: \{\s*\n\s*['"]?__type['"]?: ['"](str)['"],?\s*\n\s*\},\s*\n\s*['"]@content['"]: (['"].*['"]),?\s*\n\s*\}/g;
|
||||
// const karrayReplace = /\{\s*\n\s*['"]@attr['"]: \{\s*\n\s*['"]?__type['"]?: ['"](.*)['"],\s*\n\s*['"]?__count['"]?: .*\s*\n\s*\},?\s*\n\s*['"]@content['"]: (\[(?:[^\]]|\n)*\]),?\s*\n\s*\}/g;
|
||||
|
||||
// output = output.replace(kitemReplace, "kitem('$1', $2)");
|
||||
// output = output.replace(strReplace, "kitem('$1', $2)");
|
||||
// output = output.replace(karrayReplace, "karray('$1', $2)");
|
||||
// writeFileSync(`${file}.js`, `const debug = ${output};`);
|
||||
// Logger.debug(`Debug File ${file}.js Saved`);
|
||||
// } catch (err) {
|
||||
// Logger.debug(`Debug File ${file}.js Saving Failed`);
|
||||
// }
|
||||
// }
|
||||
|
||||
export function ReadXML(file: string): any {
|
||||
try {
|
||||
if (!existsSync(`${file}.xml`)) {
|
||||
return null;
|
||||
}
|
||||
const data = xmlToData(readFileSync(`${file}.xml`));
|
||||
return data;
|
||||
} catch (err) {
|
||||
Logger.error(err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function WriteXML(file: string, data: any) {
|
||||
try {
|
||||
writeFileSync(`${file}.xml`, dataToXML(data));
|
||||
Logger.info(`${file}.xml Saved`);
|
||||
} catch (err) {
|
||||
Logger.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
export function PrintXML(data: any) {
|
||||
try {
|
||||
Logger.info(dataToXML(data));
|
||||
} catch (err) {
|
||||
Logger.error(err);
|
||||
}
|
||||
}
|
||||
971
src/utils/KBinJSON.ts
Normal file
971
src/utils/KBinJSON.ts
Normal file
@@ -0,0 +1,971 @@
|
||||
import { Encoding, codeToString, convert, stringToCode } from 'encoding-japanese';
|
||||
import xml2json from 'fast-xml-parser';
|
||||
import { toSafeInteger, isArrayLike, get, isArray, isEmpty, toString, isNil } from 'lodash';
|
||||
import json2xml = xml2json.j2xParser;
|
||||
|
||||
import { BinaryLengthType, ReadBuffer, WriteBuffer } from './AutoBuffer';
|
||||
|
||||
export type KBinAttrMap = { [key: string]: number | string };
|
||||
export type KBinNumberType =
|
||||
| 's8'
|
||||
| 'u8'
|
||||
| 's16'
|
||||
| 'u16'
|
||||
| 's32'
|
||||
| 'u32'
|
||||
| 'time'
|
||||
| 'ip4'
|
||||
| 'float'
|
||||
| 'double'
|
||||
| 'bool';
|
||||
export type KBinBigIntType = 's64' | 'u64';
|
||||
export type KBinNumberGroupType =
|
||||
| '2s8'
|
||||
| '2u8'
|
||||
| '2s16'
|
||||
| '2u16'
|
||||
| '2s32'
|
||||
| '2u32'
|
||||
| '2f'
|
||||
| '2d'
|
||||
| '3s8'
|
||||
| '3u8'
|
||||
| '3s16'
|
||||
| '3u16'
|
||||
| '3s32'
|
||||
| '3u32'
|
||||
| '3f'
|
||||
| '3d'
|
||||
| '4s8'
|
||||
| '4u8'
|
||||
| '4s16'
|
||||
| '4u16'
|
||||
| '4s32'
|
||||
| '4u32'
|
||||
| '4f'
|
||||
| '4d'
|
||||
| '2b'
|
||||
| '3b'
|
||||
| '4b'
|
||||
| 'vb';
|
||||
export type KBinBigIntGroupType =
|
||||
| '2s64'
|
||||
| '2u64'
|
||||
| '3s64'
|
||||
| '3u64'
|
||||
| '4s64'
|
||||
| '4u64'
|
||||
| 'vs8'
|
||||
| 'vu8'
|
||||
| 'vs16'
|
||||
| 'vu16';
|
||||
|
||||
export type KBinControlIdentifier = 'invalid' | 'attr' | 'array' | 'void';
|
||||
|
||||
export type KBinWriteableType =
|
||||
| 'bin'
|
||||
| 'str'
|
||||
| KBinNumberType
|
||||
| KBinNumberGroupType
|
||||
| KBinBigIntType
|
||||
| KBinBigIntGroupType;
|
||||
|
||||
export type KBinAllType =
|
||||
| 'bin'
|
||||
| 'str'
|
||||
| KBinNumberType
|
||||
| KBinNumberGroupType
|
||||
| KBinBigIntType
|
||||
| KBinBigIntGroupType
|
||||
| KBinControlIdentifier;
|
||||
|
||||
(BigInt.prototype as any).toJSON = function (this: bigint): string {
|
||||
return this.toString() + 'n';
|
||||
};
|
||||
|
||||
const SIGNATURE = 0xa0;
|
||||
const SIG_COMPRESSED = 0x42;
|
||||
const SIG_UNCOMPRESSED = 0x45;
|
||||
|
||||
const XML_FORMATS: KBinAllType[] = [
|
||||
'invalid',
|
||||
'void',
|
||||
's8',
|
||||
'u8',
|
||||
's16',
|
||||
'u16',
|
||||
's32',
|
||||
'u32',
|
||||
's64',
|
||||
'u64',
|
||||
'bin',
|
||||
'str',
|
||||
'ip4',
|
||||
'time',
|
||||
'float',
|
||||
'double',
|
||||
'2s8',
|
||||
'2u8',
|
||||
'2s16',
|
||||
'2u16',
|
||||
'2s32',
|
||||
'2u32',
|
||||
'2s64',
|
||||
'2u64',
|
||||
'2f',
|
||||
'2d',
|
||||
'3s8',
|
||||
'3u8',
|
||||
'3s16',
|
||||
'3u16',
|
||||
'3s32',
|
||||
'3u32',
|
||||
'3s64',
|
||||
'3u64',
|
||||
'3f',
|
||||
'3d',
|
||||
'4s8',
|
||||
'4u8',
|
||||
'4s16',
|
||||
'4u16',
|
||||
'4s32',
|
||||
'4u32',
|
||||
'4s64',
|
||||
'4u64',
|
||||
'4f',
|
||||
'4d',
|
||||
'attr',
|
||||
'array',
|
||||
'vs8',
|
||||
'vu8',
|
||||
'vs16',
|
||||
'vu16',
|
||||
'bool',
|
||||
'2b',
|
||||
'3b',
|
||||
'4b',
|
||||
'vb',
|
||||
];
|
||||
|
||||
function dataSizeOf(str: string): number {
|
||||
if (str[0] === '2') {
|
||||
return 2;
|
||||
} else if (str[0] === '3') {
|
||||
return 3;
|
||||
} else if (str[0] === '4') {
|
||||
return 4;
|
||||
} else if (str === 'vs64' || str === 'vu64' || str === 'vd') {
|
||||
return 2;
|
||||
} else if (str === 'vs32' || str === 'vu32' || str === 'vf') {
|
||||
return 4;
|
||||
} else if (str === 'vs16' || str === 'vu16') {
|
||||
return 8;
|
||||
} else if (str === 'vs8' || str === 'vu8' || str === 'vb') {
|
||||
return 16;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
const XML_TYPES: { [key: string]: number } = {
|
||||
'void': 1,
|
||||
's8': 2,
|
||||
'u8': 3,
|
||||
's16': 4,
|
||||
'u16': 5,
|
||||
's32': 6,
|
||||
'u32': 7,
|
||||
's64': 8,
|
||||
'u64': 9,
|
||||
'bin': 10,
|
||||
'str': 11,
|
||||
'ip4': 12,
|
||||
'time': 13,
|
||||
'float': 14,
|
||||
'double': 15,
|
||||
'2s8': 16,
|
||||
'2u8': 17,
|
||||
'2s16': 18,
|
||||
'2u16': 19,
|
||||
'2s32': 20,
|
||||
'2u32': 21,
|
||||
'2s64': 22,
|
||||
'2u64': 23,
|
||||
'2f': 24,
|
||||
'2d': 25,
|
||||
'3s8': 26,
|
||||
'3u8': 27,
|
||||
'3s16': 28,
|
||||
'3u16': 29,
|
||||
'3s32': 30,
|
||||
'3u32': 31,
|
||||
'3s64': 32,
|
||||
'3u64': 33,
|
||||
'3f': 34,
|
||||
'3d': 35,
|
||||
'4s8': 36,
|
||||
'4u8': 37,
|
||||
'4s16': 38,
|
||||
'4u16': 39,
|
||||
'4s32': 40,
|
||||
'4u32': 41,
|
||||
'4s64': 42,
|
||||
'4u64': 43,
|
||||
'4f': 44,
|
||||
'4d': 45,
|
||||
'attr': 46,
|
||||
'array': 47,
|
||||
'vs8': 48,
|
||||
'vu8': 49,
|
||||
'vs16': 50,
|
||||
'vu16': 51,
|
||||
'bool': 52,
|
||||
'2b': 53,
|
||||
'3b': 54,
|
||||
'4b': 55,
|
||||
'vb': 56,
|
||||
'binary': 10,
|
||||
'string': 11,
|
||||
'f': 14,
|
||||
'd': 15,
|
||||
'vs64': 22,
|
||||
'vu64': 23,
|
||||
'vs32': 40,
|
||||
'vu32': 41,
|
||||
'vf': 44,
|
||||
'b': 52,
|
||||
'nodeEnd': 190,
|
||||
'endSection': 191,
|
||||
'nodeStart': 1,
|
||||
};
|
||||
|
||||
const BIN_ENCODING = 'SHIFT_JIS';
|
||||
const JOBJ_ENCODING = 'UNICODE';
|
||||
|
||||
const CHARMAP = '0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
|
||||
const BYTEMAP: { [key: string]: number } = {
|
||||
'0': 0,
|
||||
'1': 1,
|
||||
'2': 2,
|
||||
'3': 3,
|
||||
'4': 4,
|
||||
'5': 5,
|
||||
'6': 6,
|
||||
'7': 7,
|
||||
'8': 8,
|
||||
'9': 9,
|
||||
':': 10,
|
||||
'A': 11,
|
||||
'B': 12,
|
||||
'C': 13,
|
||||
'D': 14,
|
||||
'E': 15,
|
||||
'F': 16,
|
||||
'G': 17,
|
||||
'H': 18,
|
||||
'I': 19,
|
||||
'J': 20,
|
||||
'K': 21,
|
||||
'L': 22,
|
||||
'M': 23,
|
||||
'N': 24,
|
||||
'O': 25,
|
||||
'P': 26,
|
||||
'Q': 27,
|
||||
'R': 28,
|
||||
'S': 29,
|
||||
'T': 30,
|
||||
'U': 31,
|
||||
'V': 32,
|
||||
'W': 33,
|
||||
'X': 34,
|
||||
'Y': 35,
|
||||
'Z': 36,
|
||||
'_': 37,
|
||||
'a': 38,
|
||||
'b': 39,
|
||||
'c': 40,
|
||||
'd': 41,
|
||||
'e': 42,
|
||||
'f': 43,
|
||||
'g': 44,
|
||||
'h': 45,
|
||||
'i': 46,
|
||||
'j': 47,
|
||||
'k': 48,
|
||||
'l': 49,
|
||||
'm': 50,
|
||||
'n': 51,
|
||||
'o': 52,
|
||||
'p': 53,
|
||||
'q': 54,
|
||||
'r': 55,
|
||||
's': 56,
|
||||
't': 57,
|
||||
'u': 58,
|
||||
'v': 59,
|
||||
'w': 60,
|
||||
'x': 61,
|
||||
'y': 62,
|
||||
'z': 63,
|
||||
};
|
||||
|
||||
const ENCODING_STRINGS: { [key: number]: KBinEncoding } = {
|
||||
0x00: 'SHIFT_JIS',
|
||||
0x20: 'ASCII',
|
||||
0x40: 'ISO-8859-1',
|
||||
0x60: 'EUC-JP',
|
||||
0x80: 'SHIFT_JIS',
|
||||
0xa0: 'UTF-8',
|
||||
};
|
||||
|
||||
const ENCODING_VALS: { [key: string]: number } = {
|
||||
'SHIFT_JIS': 0x80,
|
||||
'UTF-8': 0xa0,
|
||||
'EUC-JP': 0x60,
|
||||
'ASCII': 0x20,
|
||||
'ISO-8859-1': 0x40,
|
||||
};
|
||||
|
||||
const ENC_JP_MAP: { [key: string]: Encoding } = {
|
||||
'SHIFT_JIS': 'SJIS',
|
||||
'UTF-8': 'UTF8',
|
||||
'EUC-JP': 'EUCJP',
|
||||
'ASCII': 'UTF8',
|
||||
'ISO-8859-1': 'UTF8',
|
||||
};
|
||||
|
||||
export type KBinEncoding = 'SHIFT_JIS' | 'UTF-8' | 'EUC-JP' | 'ASCII' | 'ISO-8859-1';
|
||||
|
||||
export function isKBin(input: Buffer): boolean {
|
||||
const firstByte = input.readUInt8(0);
|
||||
const secondByte = input.readUInt8(1);
|
||||
return (
|
||||
firstByte === SIGNATURE && (secondByte === SIG_COMPRESSED || secondByte === SIG_UNCOMPRESSED)
|
||||
);
|
||||
}
|
||||
|
||||
export function unpackSixbit(byteBuf: ReadBuffer | Buffer): string {
|
||||
if (byteBuf instanceof Buffer) {
|
||||
byteBuf = new ReadBuffer(byteBuf);
|
||||
}
|
||||
const length = Number(byteBuf.get('u8'));
|
||||
|
||||
let value = 0;
|
||||
let valueBits = 0;
|
||||
let result = '';
|
||||
for (let i = 0; i < length; ++i) {
|
||||
if (valueBits < 6) {
|
||||
value = (value << 8) + Number(byteBuf.get('u8'));
|
||||
valueBits += 8;
|
||||
}
|
||||
|
||||
const offset = valueBits - 6;
|
||||
const index = value >> offset;
|
||||
result += CHARMAP[index];
|
||||
valueBits -= 6;
|
||||
value = value - (index << offset);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export function packSixbit(str: string): Buffer {
|
||||
let padding = 8 - ((str.length * 6) % 8);
|
||||
if (padding === 8) {
|
||||
padding = 0;
|
||||
}
|
||||
|
||||
const lengthBytes = Math.floor((str.length * 6 + padding) / 8);
|
||||
const result = Buffer.alloc(lengthBytes + 1);
|
||||
|
||||
let value = 0;
|
||||
let valueBits = 0;
|
||||
let byteIndex = 0;
|
||||
|
||||
result.writeUInt8(str.length, byteIndex);
|
||||
++byteIndex;
|
||||
|
||||
for (const char of str) {
|
||||
value = (value << 6) + BYTEMAP[char];
|
||||
valueBits += 6;
|
||||
|
||||
if (valueBits >= 8) {
|
||||
valueBits -= 8;
|
||||
const byte = value >> valueBits;
|
||||
value = value - (byte << valueBits);
|
||||
result.writeUInt8(byte, byteIndex);
|
||||
++byteIndex;
|
||||
}
|
||||
}
|
||||
|
||||
if (valueBits > 0) {
|
||||
result.writeUInt8(value << (8 - valueBits), byteIndex);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function bufferToString(data: Buffer, encoding: string): string {
|
||||
if (data == null) {
|
||||
return '';
|
||||
}
|
||||
const str = codeToString(convert(data, JOBJ_ENCODING, ENC_JP_MAP[encoding]));
|
||||
return str.substr(0, str.length - 1);
|
||||
}
|
||||
|
||||
function nodeToBinary(
|
||||
node: any,
|
||||
name: string,
|
||||
nodeBuf: WriteBuffer,
|
||||
dataBuf: WriteBuffer,
|
||||
encoding: KBinEncoding,
|
||||
compressed: boolean
|
||||
): void {
|
||||
const jpEncoding = ENC_JP_MAP[encoding];
|
||||
|
||||
function appendNodeName(nodeName: string): void {
|
||||
if (compressed) {
|
||||
nodeBuf.writeBytes(packSixbit(nodeName));
|
||||
} else {
|
||||
const enc = convert(nodeName, jpEncoding, JOBJ_ENCODING);
|
||||
nodeBuf.writeBytes(Buffer.from([(enc.length - 1) | 64, ...enc]));
|
||||
}
|
||||
}
|
||||
|
||||
const attrs = node['@attr'];
|
||||
|
||||
let nodeType = attrs !== undefined ? attrs.__type : undefined;
|
||||
|
||||
if (!nodeType) {
|
||||
if (node['@content'] && typeof node['@content'] === 'string') {
|
||||
nodeType = 'str';
|
||||
} else {
|
||||
nodeType = 'void';
|
||||
}
|
||||
}
|
||||
|
||||
const nodeTypeID = XML_TYPES[nodeType];
|
||||
|
||||
const count = attrs !== undefined ? attrs.__count : undefined;
|
||||
const isArray = count === undefined ? 0 : 64;
|
||||
|
||||
nodeBuf.write('u8', nodeTypeID | isArray);
|
||||
appendNodeName(name);
|
||||
|
||||
if (nodeType !== 'void') {
|
||||
const nodeFormat = XML_FORMATS[nodeTypeID];
|
||||
const dataCount = dataSizeOf(nodeFormat);
|
||||
const dataType = dataCount === 1 ? nodeFormat : nodeFormat.substr(1);
|
||||
|
||||
let value = node['@content'];
|
||||
|
||||
if (nodeFormat === 'str') {
|
||||
if (value === null || value === undefined) {
|
||||
value = '';
|
||||
}
|
||||
const dataStr = convert(stringToCode(value as string), jpEncoding, JOBJ_ENCODING).concat([0]);
|
||||
dataBuf.writeStream(Buffer.from(dataStr));
|
||||
} else if (nodeFormat === 'bin') {
|
||||
dataBuf.writeStream(value as Buffer);
|
||||
} else {
|
||||
let binaryType = dataType;
|
||||
if (binaryType === 'ip4' || binaryType === 'time') {
|
||||
binaryType = 'u32';
|
||||
} else if (binaryType === 'float') {
|
||||
binaryType = 'f';
|
||||
} else if (binaryType === 'double') {
|
||||
binaryType = 'd';
|
||||
} else if (binaryType === 'bool' || binaryType === 'b') {
|
||||
binaryType = 'u8';
|
||||
}
|
||||
|
||||
if (isArray) {
|
||||
dataBuf.writeArray(binaryType as BinaryLengthType, value as (number | bigint)[]);
|
||||
} else {
|
||||
dataBuf.writeNumberData(binaryType as BinaryLengthType, value as (number | bigint)[]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (node['@attr']) {
|
||||
const sortedAttrs = Object.entries(node['@attr']).sort();
|
||||
for (const attr of sortedAttrs) {
|
||||
const k = attr[0];
|
||||
let v = attr[1] as any;
|
||||
|
||||
switch (typeof v) {
|
||||
case 'number':
|
||||
case 'bigint':
|
||||
case 'boolean':
|
||||
case 'object':
|
||||
v = v.toString();
|
||||
break;
|
||||
case 'string':
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
if (k.startsWith('__')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const dataStr = convert(stringToCode(v), jpEncoding, JOBJ_ENCODING).concat([0]);
|
||||
const vData = Buffer.from(dataStr);
|
||||
dataBuf.writeStream(vData);
|
||||
nodeBuf.write('u8', XML_TYPES.attr);
|
||||
appendNodeName(k);
|
||||
}
|
||||
}
|
||||
|
||||
for (const child in node) {
|
||||
if (child === '@attr' || child === '@content') {
|
||||
continue;
|
||||
}
|
||||
const childNode = node[child];
|
||||
if (Array.isArray(childNode)) {
|
||||
for (const entry of childNode) {
|
||||
nodeToBinary(entry, child, nodeBuf, dataBuf, encoding, compressed);
|
||||
}
|
||||
} else {
|
||||
nodeToBinary(childNode, child, nodeBuf, dataBuf, encoding, compressed);
|
||||
}
|
||||
}
|
||||
|
||||
nodeBuf.write('u8', XML_TYPES.nodeEnd | 64);
|
||||
}
|
||||
|
||||
export function kencode(
|
||||
data: any,
|
||||
encoding: KBinEncoding = BIN_ENCODING,
|
||||
compressed = true
|
||||
): Buffer {
|
||||
const header = Buffer.from([
|
||||
SIGNATURE,
|
||||
compressed ? SIG_COMPRESSED : SIG_UNCOMPRESSED,
|
||||
ENCODING_VALS[encoding],
|
||||
0xff ^ ENCODING_VALS[encoding],
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
]);
|
||||
|
||||
const nodeBuf = new WriteBuffer();
|
||||
const dataBuf = new WriteBuffer();
|
||||
|
||||
const rootKey = Object.keys(data)[0];
|
||||
nodeToBinary(data[rootKey], rootKey, nodeBuf, dataBuf, encoding, compressed);
|
||||
|
||||
nodeBuf.write('u8', XML_TYPES.endSection | 64);
|
||||
nodeBuf.realign();
|
||||
|
||||
header.writeUInt32BE(nodeBuf.length, 4);
|
||||
|
||||
nodeBuf.write('u32', dataBuf.length);
|
||||
|
||||
return Buffer.concat([header, nodeBuf.getBuffer(), dataBuf.getBuffer()]);
|
||||
}
|
||||
|
||||
export function kdecode(input: Buffer): any {
|
||||
const data = {};
|
||||
|
||||
const nodeStack = [];
|
||||
let curNode: any = data;
|
||||
|
||||
const nodeBuf = new ReadBuffer(input);
|
||||
if (Number(nodeBuf.get('u8')) !== SIGNATURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
const compress = Number(nodeBuf.get('u8'));
|
||||
if (compress !== SIG_COMPRESSED && compress !== SIG_UNCOMPRESSED) {
|
||||
return;
|
||||
}
|
||||
|
||||
const compressed = compress === SIG_COMPRESSED;
|
||||
|
||||
const encodingKey = Number(nodeBuf.get('u8'));
|
||||
if (
|
||||
Number(nodeBuf.get('u8')) !== (0xff ^ encodingKey) ||
|
||||
ENCODING_STRINGS[encodingKey] === undefined
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const encoding = ENCODING_STRINGS[encodingKey];
|
||||
|
||||
const nodeEnd = Number(nodeBuf.get('u32')) + 8;
|
||||
|
||||
const dataBuf = new ReadBuffer(input, nodeEnd);
|
||||
dataBuf.get('u32'); // Skip dataSize
|
||||
|
||||
const hasNodesLeft = true;
|
||||
while (hasNodesLeft && nodeBuf.hasData()) {
|
||||
let nodeType = Number(nodeBuf.get('u8'));
|
||||
if (nodeType === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const isArray = nodeType & 64;
|
||||
nodeType &= ~64;
|
||||
|
||||
const nodeFormat = XML_FORMATS[nodeType];
|
||||
|
||||
let name = '';
|
||||
if (nodeType !== XML_TYPES.nodeEnd && nodeType !== XML_TYPES.endSection) {
|
||||
if (compressed) {
|
||||
name = unpackSixbit(nodeBuf);
|
||||
} else {
|
||||
const length = (Number(nodeBuf.get('u8')) & ~64) + 1;
|
||||
name = bufferToString(nodeBuf.getBytes(length), encoding);
|
||||
}
|
||||
}
|
||||
|
||||
let value = '';
|
||||
|
||||
if (nodeType === XML_TYPES.attr) {
|
||||
const stream = dataBuf.getStream();
|
||||
value = bufferToString(stream, encoding);
|
||||
if (curNode['@attr'] === undefined) {
|
||||
curNode['@attr'] = {};
|
||||
}
|
||||
curNode['@attr'][name] = value;
|
||||
|
||||
continue;
|
||||
} else if (nodeType === XML_TYPES.nodeEnd) {
|
||||
curNode = nodeStack.pop();
|
||||
continue;
|
||||
} else if (nodeType === XML_TYPES.endSection) {
|
||||
break;
|
||||
} else if (nodeFormat === undefined) {
|
||||
break;
|
||||
}
|
||||
|
||||
const parentNode = curNode;
|
||||
nodeStack.push(parentNode);
|
||||
|
||||
curNode = {};
|
||||
if (parentNode[name] !== undefined) {
|
||||
const thisParent = parentNode[name];
|
||||
if (Array.isArray(thisParent)) {
|
||||
const nodeList = thisParent;
|
||||
nodeList.push(curNode);
|
||||
} else {
|
||||
parentNode[name] = [thisParent, curNode];
|
||||
}
|
||||
} else {
|
||||
parentNode[name] = curNode;
|
||||
}
|
||||
|
||||
if (nodeType === XML_TYPES.nodeStart) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (curNode['@attr'] === undefined) {
|
||||
curNode['@attr'] = {};
|
||||
}
|
||||
curNode['@attr'].__type = nodeFormat;
|
||||
|
||||
const dataCount = dataSizeOf(nodeFormat);
|
||||
const dataType = dataCount === 1 ? nodeFormat : nodeFormat.substr(1);
|
||||
|
||||
if (nodeFormat === 'str') {
|
||||
const stream = dataBuf.getStream();
|
||||
curNode['@content'] = bufferToString(stream, encoding);
|
||||
} else if (nodeFormat === 'bin') {
|
||||
const stream = dataBuf.getStream();
|
||||
curNode['@content'] = stream;
|
||||
} else {
|
||||
let binaryType = dataType;
|
||||
if (binaryType === 'ip4' || binaryType === 'time') {
|
||||
binaryType = 'u32';
|
||||
} else if (binaryType === 'float') {
|
||||
binaryType = 'f';
|
||||
} else if (binaryType === 'double') {
|
||||
binaryType = 'd';
|
||||
} else if (binaryType === 'bool' || binaryType === 'b') {
|
||||
binaryType = 'u8';
|
||||
}
|
||||
|
||||
if (isArray) {
|
||||
curNode['@content'] = dataBuf.getArray(binaryType as BinaryLengthType);
|
||||
curNode['@attr'].__count = Math.floor(curNode['@content'].length / dataCount);
|
||||
} else {
|
||||
curNode['@content'] = dataBuf.getNumberData(binaryType as BinaryLengthType, dataCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
export function int2ip(valve: number): string {
|
||||
return (
|
||||
(valve >>> 24) + '.' + ((valve >> 16) & 255) + '.' + ((valve >> 8) & 255) + '.' + (valve & 255)
|
||||
);
|
||||
}
|
||||
|
||||
export function ip2int(ip: string): number {
|
||||
const parts = ip.split('.');
|
||||
return (
|
||||
((toSafeInteger(parts[0]) << 24) >>> 0) +
|
||||
(toSafeInteger(parts[1]) << 16) +
|
||||
(toSafeInteger(parts[2]) << 8) +
|
||||
toSafeInteger(parts[3])
|
||||
);
|
||||
}
|
||||
|
||||
function transformJObj(obj: any, toStr = true): void {
|
||||
if (obj !== null && obj !== undefined) {
|
||||
const data = obj['@content'];
|
||||
if (data !== undefined) {
|
||||
let vType = 'void';
|
||||
if (obj['@attr'] && obj['@attr'].__type) {
|
||||
vType = obj['@attr'].__type;
|
||||
}
|
||||
if (obj['@attr'] && obj['@attr'].__count) {
|
||||
obj['@attr'].__count = toSafeInteger(obj['@attr'].__count);
|
||||
}
|
||||
if (toStr) {
|
||||
if (typeof data !== 'object') {
|
||||
obj['@content'] = data.toString();
|
||||
} else {
|
||||
if (Buffer.isBuffer(data)) {
|
||||
obj['@content'] = data.toString('hex');
|
||||
} else if (Array.isArray(data)) {
|
||||
if (vType === 'ip4') {
|
||||
obj['@content'] = data.map(v => int2ip(v)).join(' ');
|
||||
} else {
|
||||
obj['@content'] = data.join(' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (typeof data === 'string') {
|
||||
if (vType === 'bin') {
|
||||
obj['@content'] = Buffer.from(data, 'hex');
|
||||
} else if (vType === 'ip4') {
|
||||
const parts = data.split(' ');
|
||||
obj['@content'] = parts.map(ip2int);
|
||||
} else if (vType !== 'str') {
|
||||
const parts = data.split(' ');
|
||||
if (vType.endsWith('64')) {
|
||||
obj['@content'] = parts.map(v => BigInt(v));
|
||||
} else {
|
||||
obj['@content'] = parts.map(v => parseFloat(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (const child in obj) {
|
||||
if (typeof obj[child] == 'string' && !toStr) {
|
||||
if (obj[child] === '') {
|
||||
obj[child] = {};
|
||||
} else {
|
||||
obj[child] = {
|
||||
'@attr': {
|
||||
__type: 'str',
|
||||
},
|
||||
'@content': obj[child],
|
||||
};
|
||||
}
|
||||
} else if (child !== '@attr') {
|
||||
transformJObj(obj[child], toStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function dataToXML(data: any): string {
|
||||
const options = {
|
||||
attributeNamePrefix: '',
|
||||
attrNodeName: '@attr',
|
||||
textNodeName: '@content',
|
||||
ignoreAttributes: false,
|
||||
ignoreNameSpace: false,
|
||||
allowBooleanAttributes: false,
|
||||
parseNodeValue: true,
|
||||
parseAttributeValue: false,
|
||||
format: true,
|
||||
supressEmptyNode: true,
|
||||
};
|
||||
|
||||
transformJObj(data);
|
||||
|
||||
const parser = new json2xml(options);
|
||||
const xml = parser.parse(data);
|
||||
|
||||
transformJObj(data, false);
|
||||
|
||||
return "<?xml version='1.0' encoding='UTF-8'?>\n" + xml;
|
||||
}
|
||||
|
||||
export function xmlToData(xml: string | Buffer): any {
|
||||
let xmlStr = xml;
|
||||
if (typeof xmlStr !== 'string') {
|
||||
xmlStr = codeToString(convert(xml, 'UNICODE', 'AUTO'));
|
||||
}
|
||||
|
||||
const options = {
|
||||
attributeNamePrefix: '',
|
||||
attrNodeName: '@attr',
|
||||
textNodeName: '@content',
|
||||
ignoreAttributes: false,
|
||||
ignoreNameSpace: false,
|
||||
allowBooleanAttributes: false,
|
||||
parseNodeValue: false,
|
||||
parseAttributeValue: false,
|
||||
trimValues: true,
|
||||
};
|
||||
|
||||
const data = xml2json.parse(xmlStr, options);
|
||||
transformJObj(data, false);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
export function kitem(type: 'str', content: string, attr?: KBinAttrMap): any;
|
||||
export function kitem(type: 'bin', content: Buffer, attr?: KBinAttrMap): any;
|
||||
export function kitem(type: 'ip4', content: string, attr?: KBinAttrMap): any;
|
||||
export function kitem(type: KBinNumberType, content: number, attr?: KBinAttrMap): any;
|
||||
export function kitem(type: KBinBigIntType, content: bigint, attr?: KBinAttrMap): any;
|
||||
export function kitem(type: KBinNumberGroupType, content: number[], attr?: KBinAttrMap): any;
|
||||
export function kitem(type: KBinBigIntGroupType, content: bigint[], attr?: KBinAttrMap): any;
|
||||
export function kitem(
|
||||
type: KBinWriteableType,
|
||||
content: string | number | bigint | object,
|
||||
attr?: KBinAttrMap
|
||||
): any {
|
||||
if (!attr) {
|
||||
attr = {};
|
||||
}
|
||||
|
||||
let contentObj = content;
|
||||
|
||||
if (type === 'ip4' && typeof contentObj === 'string') {
|
||||
contentObj = [ip2int(contentObj)];
|
||||
}
|
||||
|
||||
if (typeof contentObj === 'number' || typeof contentObj === 'bigint') {
|
||||
contentObj = [contentObj];
|
||||
}
|
||||
|
||||
const attrObj = {
|
||||
__type: type,
|
||||
...attr,
|
||||
};
|
||||
|
||||
return {
|
||||
'@attr': attrObj,
|
||||
'@content': contentObj,
|
||||
};
|
||||
}
|
||||
|
||||
export function kattr(attr: KBinAttrMap) {
|
||||
return {
|
||||
'@attr': attr,
|
||||
};
|
||||
}
|
||||
|
||||
export function karray(type: 'u8' | 's8', content: Buffer, attr?: KBinAttrMap): any;
|
||||
export function karray(type: KBinNumberType, content: number[], attr?: KBinAttrMap): any;
|
||||
export function karray(type: KBinBigIntType, content: bigint[], attr?: KBinAttrMap): any;
|
||||
export function karray(
|
||||
type: KBinNumberType | KBinBigIntType,
|
||||
content: number[] | bigint[] | Buffer,
|
||||
attr?: KBinAttrMap
|
||||
): any {
|
||||
let value = content as any;
|
||||
if (typeof value == 'bigint' || typeof value == 'number') {
|
||||
value = [content] as any;
|
||||
}
|
||||
|
||||
const item = kitem(type as any, value, attr);
|
||||
|
||||
const countObj: any = {};
|
||||
if (isArrayLike(item['@content'])) {
|
||||
const dataSize = dataSizeOf(type);
|
||||
countObj.__count = Math.ceil(item['@content'].length / dataSize);
|
||||
}
|
||||
|
||||
item['@attr'] = {
|
||||
...item['@attr'],
|
||||
...countObj,
|
||||
};
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
export function simplify(data: any) {}
|
||||
|
||||
export const getFirst = (data: any, path: string, def?: any): any => {
|
||||
return get(data, `${path}.@content.0`, def);
|
||||
};
|
||||
|
||||
export const getNumber = (data: any, path: string, def?: number): number => {
|
||||
let value = get(data, `${path}.@content`);
|
||||
let result = NaN;
|
||||
if (typeof value == 'string') {
|
||||
result = Number(value);
|
||||
} else {
|
||||
result = Number(get(data, `${path}.@content.0`, def));
|
||||
}
|
||||
|
||||
if (result == NaN) {
|
||||
return def;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
export const getBool = (data: any, path: string): boolean => {
|
||||
return getNumber(data, `${path}.@content.0`, 0) > 0;
|
||||
};
|
||||
|
||||
export const getBigInt = (data: any, path: string, def?: bigint): bigint => {
|
||||
let value = get(data, `${path}.@content`, def);
|
||||
try {
|
||||
if (typeof value == 'string') {
|
||||
return BigInt(value);
|
||||
}
|
||||
return BigInt(get(data, `${path}.@content.0`, def));
|
||||
} catch (_) {
|
||||
return def;
|
||||
}
|
||||
};
|
||||
|
||||
export const getContent = (data: any, path: string, def?: any): any => {
|
||||
return get(data, `${path}.@content`, def);
|
||||
};
|
||||
|
||||
export const getNumbers: (data: any, path: string, def?: number[]) => number[] = getContent;
|
||||
export const getBigInts: (data: any, path: string, def?: bigint[]) => bigint[] = getContent;
|
||||
export const getStr: (data: any, path: string, def?: string) => string = getContent;
|
||||
export const getBuffer: (data: any, path: string, def?: Buffer) => Buffer = getContent;
|
||||
|
||||
export const getAttr = (data: any, field: string, def?: string | number): string => {
|
||||
return toString(get(data, `@attr.${field}`, def));
|
||||
};
|
||||
|
||||
export const getElement = (data: any, path: string): any[] => {
|
||||
const item: any = get(data, `${path}`, {});
|
||||
if (isArray(item)) {
|
||||
return item[0];
|
||||
}
|
||||
return item;
|
||||
};
|
||||
|
||||
export const getElements = (data: any, path: string): any[] => {
|
||||
const item: any = get(data, `${path}`, []);
|
||||
if (isEmpty(item)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (isArray(item)) {
|
||||
return item;
|
||||
} else {
|
||||
return [item];
|
||||
}
|
||||
};
|
||||
99
src/utils/KonmaiEncrypt.ts
Normal file
99
src/utils/KonmaiEncrypt.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
import { createHash, randomFillSync } from 'crypto';
|
||||
|
||||
export class KonmaiEncrypt {
|
||||
private konmaiKey: Buffer;
|
||||
private realKey?: Buffer;
|
||||
|
||||
constructor(publicKey?: string) {
|
||||
this.konmaiKey = Buffer.from([
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x69,
|
||||
0xd7,
|
||||
0x46,
|
||||
0x27,
|
||||
0xd9,
|
||||
0x85,
|
||||
0xee,
|
||||
0x21,
|
||||
0x87,
|
||||
0x16,
|
||||
0x15,
|
||||
0x70,
|
||||
0xd0,
|
||||
0x8d,
|
||||
0x93,
|
||||
0xb1,
|
||||
0x24,
|
||||
0x55,
|
||||
0x03,
|
||||
0x5b,
|
||||
0x6d,
|
||||
0xf0,
|
||||
0xd8,
|
||||
0x20,
|
||||
0x5d,
|
||||
0xf5,
|
||||
]);
|
||||
|
||||
if (publicKey) {
|
||||
// 1-5cfb8b00-a8b3
|
||||
const keyPart = publicKey.split('-');
|
||||
const keys = keyPart[1] + keyPart[2];
|
||||
for (let i = 0; i < 6; ++i) {
|
||||
const result = parseInt(keys.substr(i * 2, 2), 16);
|
||||
if (isNaN(result)) {
|
||||
return;
|
||||
}
|
||||
this.konmaiKey[i] = result;
|
||||
}
|
||||
} else {
|
||||
randomFillSync(this.konmaiKey, 0, 6);
|
||||
}
|
||||
|
||||
this.realKey = createHash('md5')
|
||||
.update(this.konmaiKey)
|
||||
.digest();
|
||||
}
|
||||
|
||||
public getPublicKey(): string {
|
||||
return (
|
||||
'1-' +
|
||||
this.konmaiKey.subarray(0, 4).toString('hex') +
|
||||
'-' +
|
||||
this.konmaiKey.subarray(4, 6).toString('hex')
|
||||
);
|
||||
}
|
||||
|
||||
public encrypt(data: Buffer): Buffer {
|
||||
if (!this.realKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
const s = [...Array(256).keys()];
|
||||
let t = 0;
|
||||
for (let b = 0; b < 256; ++b) {
|
||||
t = (t + s[b] + this.realKey[b % this.realKey.length]) % 256;
|
||||
const tmp = s[b];
|
||||
s[b] = s[t];
|
||||
s[t] = tmp;
|
||||
}
|
||||
|
||||
let i = 0;
|
||||
let j = 0;
|
||||
const res = Buffer.alloc(data.length);
|
||||
for (let y = 0; y < data.length; ++y) {
|
||||
i = (i + 1) % 256;
|
||||
j = (j + s[i]) % 256;
|
||||
const tmp = s[i];
|
||||
s[i] = s[j];
|
||||
s[j] = tmp;
|
||||
res[y] = data[y] ^ s[(s[i] + s[j]) % 256];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
21
src/utils/Logger.ts
Normal file
21
src/utils/Logger.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import winston from 'winston';
|
||||
|
||||
const isDebug = (process as any).pkg == null;
|
||||
|
||||
export const Logger = winston.createLogger({
|
||||
level: isDebug ? 'debug' : 'info',
|
||||
format: winston.format.printf(info => {
|
||||
if (info.level !== 'info') {
|
||||
return `${info.level}: ${info.message}`;
|
||||
} else {
|
||||
return `${info.message}`;
|
||||
}
|
||||
}),
|
||||
defaultMeta: { service: 'eamuse' },
|
||||
transports: [
|
||||
new winston.transports.Console({
|
||||
stderrLevels: ['error'],
|
||||
debugStdout: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
181
src/utils/LzKN.ts
Normal file
181
src/utils/LzKN.ts
Normal file
@@ -0,0 +1,181 @@
|
||||
import { WriteBuffer } from './AutoBuffer';
|
||||
|
||||
const WINDOW_SIZE = 0x1000;
|
||||
const WINDOW_MASK = WINDOW_SIZE - 1;
|
||||
const THRESHOLD = 3;
|
||||
const INPLACE_THRESHOLD = 0xa;
|
||||
const LOOK_RANGE = 0x200;
|
||||
const MAX_LEN = 0xf + THRESHOLD;
|
||||
const MAX_BUFFER = 0x10 + 1;
|
||||
|
||||
function matchCurrent(
|
||||
window: Buffer,
|
||||
pos: number,
|
||||
maxLen: number,
|
||||
data: Buffer,
|
||||
dpos: number
|
||||
): number {
|
||||
let len = 0;
|
||||
while (
|
||||
dpos + len < data.length &&
|
||||
len < maxLen &&
|
||||
window[(pos + len) & WINDOW_MASK] === data[dpos + len] &&
|
||||
len < MAX_LEN
|
||||
) {
|
||||
++len;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
function matchWindow(
|
||||
window: Buffer,
|
||||
pos: number,
|
||||
data: Buffer,
|
||||
dpos: number
|
||||
): {
|
||||
pos: number;
|
||||
len: number;
|
||||
} {
|
||||
let maxPos = 0;
|
||||
let maxLen = 0;
|
||||
for (let i = THRESHOLD; i < LOOK_RANGE; ++i) {
|
||||
const len = matchCurrent(window, (pos - i) & WINDOW_MASK, i, data, dpos);
|
||||
if (len >= INPLACE_THRESHOLD) {
|
||||
return { pos: i, len };
|
||||
}
|
||||
if (len >= THRESHOLD) {
|
||||
maxPos = i;
|
||||
maxLen = len;
|
||||
}
|
||||
}
|
||||
if (maxLen >= THRESHOLD) {
|
||||
return { pos: maxPos, len: maxLen };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function deflate(input: Buffer): Buffer {
|
||||
const output = new WriteBuffer(input.length);
|
||||
const window = Buffer.alloc(WINDOW_SIZE);
|
||||
const buffer = Buffer.alloc(MAX_BUFFER);
|
||||
|
||||
let currentPos = 0;
|
||||
let currentWindow = 0;
|
||||
let currentBuffer = 0;
|
||||
let flagByte = 0;
|
||||
let bit = 0;
|
||||
let pad = 3;
|
||||
|
||||
while (currentPos < input.length) {
|
||||
flagByte = 0;
|
||||
currentBuffer = 0;
|
||||
for (let bitPos = 0; bitPos < 8; ++bitPos) {
|
||||
if (currentPos >= input.length) {
|
||||
pad = 0;
|
||||
flagByte = flagByte >> (8 - bitPos);
|
||||
buffer[currentBuffer] = 0;
|
||||
buffer[currentBuffer + 1] = 0;
|
||||
currentBuffer += 2;
|
||||
break;
|
||||
} else {
|
||||
const match = matchWindow(window, currentWindow, input, currentPos);
|
||||
if (match && match.len >= THRESHOLD) {
|
||||
const byte1 = (match.pos >> 4) & 0xff;
|
||||
const byte2 = (((match.pos & 0x0f) << 4) + ((match.len - THRESHOLD) & 0x0f)) & 0xff;
|
||||
buffer[currentBuffer] = byte1;
|
||||
buffer[currentBuffer + 1] = byte2;
|
||||
currentBuffer += 2;
|
||||
bit = 0;
|
||||
|
||||
for (let _ = 0; _ < match.len; ++_) {
|
||||
window[currentWindow & WINDOW_MASK] = input[currentPos];
|
||||
++currentPos;
|
||||
++currentWindow;
|
||||
}
|
||||
} else {
|
||||
buffer[currentBuffer] = input[currentPos];
|
||||
window[currentWindow] = input[currentPos];
|
||||
++currentPos;
|
||||
++currentWindow;
|
||||
++currentBuffer;
|
||||
bit = 1;
|
||||
}
|
||||
}
|
||||
flagByte = (flagByte >> 1) | ((bit & 0x1) << 7);
|
||||
currentWindow = currentWindow & WINDOW_MASK;
|
||||
}
|
||||
output.writeByte(flagByte);
|
||||
output.writeBytes(buffer.subarray(0, currentBuffer));
|
||||
// for (let i = 0; i < currentBuffer; ++i) {
|
||||
// output.writeByte(buffer[i]);
|
||||
// }
|
||||
}
|
||||
output.skip(pad);
|
||||
|
||||
return output.getBuffer();
|
||||
}
|
||||
|
||||
function inflate(data: Buffer): Buffer {
|
||||
const result = new WriteBuffer(Math.floor(data.length));
|
||||
let cur = 0;
|
||||
let byte = 1;
|
||||
while (true) {
|
||||
if (byte === 1) {
|
||||
byte = data[cur++];
|
||||
byte |= 0x100;
|
||||
}
|
||||
const flag = (byte & 0x1) === 1;
|
||||
byte >>= 1;
|
||||
if (flag) {
|
||||
result.writeByte(data[cur++]);
|
||||
} else {
|
||||
const byte1 = data[cur++];
|
||||
const byte2 = data[cur++];
|
||||
let len = (byte2 & 0xf) + 3;
|
||||
const dist = ((byte1 << 4) & 0x0ff0) | ((byte2 >> 4) & 0x000f);
|
||||
if (dist === 0) {
|
||||
break;
|
||||
}
|
||||
while (len > 0) {
|
||||
if (result.length - dist < 0) {
|
||||
result.writeByte(0);
|
||||
} else {
|
||||
result.writeByte(result.get(result.length - dist));
|
||||
}
|
||||
--len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result.getBuffer();
|
||||
}
|
||||
|
||||
function deflateDummy(input: Buffer): Buffer {
|
||||
const output = new WriteBuffer(input.length * 2);
|
||||
const inputLen = input.length;
|
||||
for (let i = 0; i < ~~(inputLen / 8); ++i) {
|
||||
output.writeByte(0xff);
|
||||
for (let j = 0; j < 8; ++j) {
|
||||
output.writeByte(input[8 * i + j]);
|
||||
}
|
||||
}
|
||||
|
||||
if (inputLen % 8 === 0) {
|
||||
output.skip(8);
|
||||
} else {
|
||||
const extra = inputLen % 8;
|
||||
output.writeByte(0xff >> (8 - extra));
|
||||
for (let i = inputLen - extra; i < inputLen; ++i) {
|
||||
output.writeByte(input[i]);
|
||||
}
|
||||
output.skip(4);
|
||||
}
|
||||
|
||||
return output.getBuffer();
|
||||
}
|
||||
|
||||
export default {
|
||||
inflate,
|
||||
deflate,
|
||||
deflateDummy,
|
||||
};
|
||||
16
tsconfig.json
Normal file
16
tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"target": "esnext",
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "node",
|
||||
"sourceMap": true,
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user