@pkmn/sim 0.4.21 → 0.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/config/formats.js +198 -136
- package/build/config/formats.js.map +1 -1
- package/build/data/aliases.js +5 -3
- package/build/data/aliases.js.map +1 -1
- package/build/data/conditions.js +5 -1
- package/build/data/conditions.js.map +1 -1
- package/build/data/formats-data.js +16 -16
- package/build/data/formats-data.js.map +1 -1
- package/build/data/mods/gen1/scripts.js +17 -20
- package/build/data/mods/gen1/scripts.js.map +1 -1
- package/build/data/mods/gen2/scripts.js +15 -21
- package/build/data/mods/gen2/scripts.js.map +1 -1
- package/build/data/mods/gen4/conditions.js +6 -0
- package/build/data/mods/gen4/conditions.js.map +1 -1
- package/build/data/mods/gen6/conditions.js +4 -1
- package/build/data/mods/gen6/conditions.js.map +1 -1
- package/build/data/mods/gen6/pokedex.js +17 -17
- package/build/data/mods/gen6/pokedex.js.map +1 -1
- package/build/data/mods/gen7/formats-data.js +2 -2
- package/build/data/mods/gen7/formats-data.js.map +1 -1
- package/build/data/moves.js +22 -9
- package/build/data/moves.js.map +1 -1
- package/build/data/rulesets.js +3 -1
- package/build/data/rulesets.js.map +1 -1
- package/build/lib/streams.d.ts +1 -199
- package/build/lib/streams.js +11 -772
- package/build/lib/streams.js.map +1 -1
- package/build/sim/battle-actions.d.ts +1 -1
- package/build/sim/battle-actions.js +19 -43
- package/build/sim/battle-actions.js.map +1 -1
- package/build/sim/battle.d.ts +1 -0
- package/build/sim/battle.js +5 -0
- package/build/sim/battle.js.map +1 -1
- package/build/sim/dex-moves.d.ts +31 -11
- package/build/sim/dex-moves.js +4 -3
- package/build/sim/dex-moves.js.map +1 -1
- package/build/sim/dex-species.js +11 -1
- package/build/sim/dex-species.js.map +1 -1
- package/build/sim/exported-global-types.d.ts +1 -0
- package/build/sim/global-types.d.ts +1 -0
- package/build/sim/side.js +2 -2
- package/build/sim/side.js.map +1 -1
- package/build/sim/team-validator.js +1 -1
- package/build/sim/team-validator.js.map +1 -1
- package/build/sim/tools/runner.d.ts +1 -6
- package/build/sim/tools/runner.js +6 -6
- package/build/sim/tools/runner.js.map +1 -1
- package/config/formats.ts +210 -141
- package/data/aliases.ts +5 -3
- package/data/conditions.ts +5 -1
- package/data/formats-data.ts +16 -16
- package/data/mods/gen1/scripts.ts +22 -18
- package/data/mods/gen2/scripts.ts +19 -18
- package/data/mods/gen4/conditions.ts +6 -0
- package/data/mods/gen6/conditions.ts +4 -1
- package/data/mods/gen6/pokedex.ts +17 -17
- package/data/mods/gen7/formats-data.ts +2 -2
- package/data/moves.ts +19 -9
- package/data/rulesets.ts +3 -1
- package/lib/streams.ts +1 -874
- package/package.json +3 -2
- package/sim/battle-actions.ts +20 -41
- package/sim/battle.ts +6 -0
- package/sim/dex-moves.ts +35 -13
- package/sim/dex-species.ts +10 -1
- package/sim/exported-global-types.ts +1 -0
- package/sim/global-types.ts +1 -0
- package/sim/side.ts +2 -2
- package/sim/team-validator.ts +1 -1
- package/sim/tools/runner.ts +2 -0
package/build/lib/streams.d.ts
CHANGED
|
@@ -1,199 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { AnyObject } from '../sim/exported-global-types';
|
|
3
|
-
declare type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'latin1' | 'binary' | 'hex';
|
|
4
|
-
export declare class ReadStream {
|
|
5
|
-
buf: Buffer;
|
|
6
|
-
bufStart: number;
|
|
7
|
-
bufEnd: number;
|
|
8
|
-
bufCapacity: number;
|
|
9
|
-
readSize: number;
|
|
10
|
-
atEOF: boolean;
|
|
11
|
-
errorBuf: Error[] | null;
|
|
12
|
-
encoding: BufferEncoding;
|
|
13
|
-
isReadable: boolean;
|
|
14
|
-
isWritable: boolean;
|
|
15
|
-
nodeReadableStream: NodeJS.ReadableStream | null;
|
|
16
|
-
nextPushResolver: (() => void) | null;
|
|
17
|
-
nextPush: Promise<void>;
|
|
18
|
-
awaitingPush: boolean;
|
|
19
|
-
constructor(optionsOrStreamLike?: {
|
|
20
|
-
[k: string]: any;
|
|
21
|
-
} | NodeJS.ReadableStream | string | Buffer);
|
|
22
|
-
get bufSize(): number;
|
|
23
|
-
moveBuf(): void;
|
|
24
|
-
expandBuf(newCapacity?: number): void;
|
|
25
|
-
ensureCapacity(additionalCapacity: number): void;
|
|
26
|
-
push(buf: Buffer | string, encoding?: BufferEncoding): void;
|
|
27
|
-
pushEnd(): void;
|
|
28
|
-
pushError(err: Error, recoverable?: boolean): void;
|
|
29
|
-
readError(): void;
|
|
30
|
-
peekError(): void;
|
|
31
|
-
resolvePush(): void;
|
|
32
|
-
_read(size?: number): void | Promise<void>;
|
|
33
|
-
_destroy(): void | Promise<void>;
|
|
34
|
-
_pause(): void;
|
|
35
|
-
/**
|
|
36
|
-
* Reads until the internal buffer is non-empty. Does nothing if the
|
|
37
|
-
* internal buffer is already non-empty.
|
|
38
|
-
*
|
|
39
|
-
* If `byteCount` is a number, instead read until the internal buffer
|
|
40
|
-
* contains at least `byteCount` bytes.
|
|
41
|
-
*
|
|
42
|
-
* If `byteCount` is `true`, reads even if the internal buffer is
|
|
43
|
-
* non-empty.
|
|
44
|
-
*/
|
|
45
|
-
loadIntoBuffer(byteCount?: number | null | true, readError?: boolean): Promise<void> | undefined;
|
|
46
|
-
doLoad(chunkSize?: number | null, readError?: boolean): Promise<void>;
|
|
47
|
-
peek(byteCount?: number | null, encoding?: BufferEncoding): string | null | Promise<string | null>;
|
|
48
|
-
peek(encoding: BufferEncoding): string | null | Promise<string | null>;
|
|
49
|
-
peekBuffer(byteCount?: number | null): Buffer | null | Promise<Buffer | null>;
|
|
50
|
-
read(byteCount?: number | null, encoding?: BufferEncoding): Promise<string | null>;
|
|
51
|
-
read(encoding: BufferEncoding): Promise<string | null>;
|
|
52
|
-
byChunk(byteCount?: number | null): ObjectReadStream<string>;
|
|
53
|
-
byLine(): ObjectReadStream<string>;
|
|
54
|
-
delimitedBy(delimiter: string): ObjectReadStream<string>;
|
|
55
|
-
readBuffer(byteCount?: number | null): Promise<Buffer | null>;
|
|
56
|
-
indexOf(symbol: string, encoding?: BufferEncoding): Promise<number>;
|
|
57
|
-
readAll(encoding?: BufferEncoding): Promise<string>;
|
|
58
|
-
peekAll(encoding?: BufferEncoding): string | Promise<string | null> | null;
|
|
59
|
-
readDelimitedBy(symbol: string, encoding?: BufferEncoding): Promise<string | null>;
|
|
60
|
-
readLine(encoding?: BufferEncoding): Promise<string | null>;
|
|
61
|
-
destroy(): void | Promise<void>;
|
|
62
|
-
next(byteCount?: number | null): Promise<{
|
|
63
|
-
value: string | null;
|
|
64
|
-
done: boolean;
|
|
65
|
-
}>;
|
|
66
|
-
pipeTo(outStream: WriteStream, options?: {
|
|
67
|
-
noEnd?: boolean;
|
|
68
|
-
}): Promise<void>;
|
|
69
|
-
}
|
|
70
|
-
interface WriteStreamOptions {
|
|
71
|
-
nodeStream?: NodeJS.WritableStream;
|
|
72
|
-
write?: (this: WriteStream, data: string | Buffer) => (Promise<undefined> | undefined);
|
|
73
|
-
writeEnd?: (this: WriteStream) => Promise<any>;
|
|
74
|
-
}
|
|
75
|
-
export declare class WriteStream {
|
|
76
|
-
isReadable: boolean;
|
|
77
|
-
isWritable: true;
|
|
78
|
-
encoding: BufferEncoding;
|
|
79
|
-
nodeWritableStream: NodeJS.WritableStream | null;
|
|
80
|
-
drainListeners: (() => void)[];
|
|
81
|
-
constructor(optionsOrStream?: WriteStreamOptions | NodeJS.WritableStream);
|
|
82
|
-
write(chunk: Buffer | string): void | Promise<void>;
|
|
83
|
-
writeLine(chunk: string): void | Promise<void>;
|
|
84
|
-
_write(chunk: Buffer | string): void | Promise<void>;
|
|
85
|
-
_writeEnd(): void | Promise<void>;
|
|
86
|
-
writeEnd(chunk?: string): Promise<void>;
|
|
87
|
-
}
|
|
88
|
-
export declare class ReadWriteStream extends ReadStream implements WriteStream {
|
|
89
|
-
isReadable: true;
|
|
90
|
-
isWritable: true;
|
|
91
|
-
nodeWritableStream: NodeJS.WritableStream | null;
|
|
92
|
-
drainListeners: (() => void)[];
|
|
93
|
-
constructor(options?: AnyObject);
|
|
94
|
-
write(chunk: Buffer | string): Promise<void> | void;
|
|
95
|
-
writeLine(chunk: string): Promise<void> | void;
|
|
96
|
-
_write(chunk: Buffer | string): Promise<void> | void;
|
|
97
|
-
/**
|
|
98
|
-
* In a ReadWriteStream, `_read` does not need to be implemented,
|
|
99
|
-
* because it's valid for the read stream buffer to be filled only by
|
|
100
|
-
* `_write`.
|
|
101
|
-
*/
|
|
102
|
-
_read(size?: number): void;
|
|
103
|
-
_writeEnd(): void | Promise<void>;
|
|
104
|
-
writeEnd(): Promise<void>;
|
|
105
|
-
}
|
|
106
|
-
declare type ObjectReadStreamOptions<T> = {
|
|
107
|
-
buffer?: T[];
|
|
108
|
-
read?: (this: ObjectReadStream<T>) => void | Promise<void>;
|
|
109
|
-
pause?: (this: ObjectReadStream<T>) => void | Promise<void>;
|
|
110
|
-
destroy?: (this: ObjectReadStream<T>) => void | Promise<void>;
|
|
111
|
-
nodeStream?: undefined;
|
|
112
|
-
} | {
|
|
113
|
-
buffer?: undefined;
|
|
114
|
-
read?: undefined;
|
|
115
|
-
pause?: undefined;
|
|
116
|
-
destroy?: undefined;
|
|
117
|
-
nodeStream: NodeJS.ReadableStream;
|
|
118
|
-
};
|
|
119
|
-
export declare class ObjectReadStream<T> {
|
|
120
|
-
buf: T[];
|
|
121
|
-
readSize: number;
|
|
122
|
-
atEOF: boolean;
|
|
123
|
-
errorBuf: Error[] | null;
|
|
124
|
-
isReadable: boolean;
|
|
125
|
-
isWritable: boolean;
|
|
126
|
-
nodeReadableStream: NodeJS.ReadableStream | null;
|
|
127
|
-
nextPushResolver: (() => void) | null;
|
|
128
|
-
nextPush: Promise<void>;
|
|
129
|
-
awaitingPush: boolean;
|
|
130
|
-
constructor(optionsOrStreamLike?: ObjectReadStreamOptions<T> | NodeJS.ReadableStream | T[]);
|
|
131
|
-
push(elem: T): void;
|
|
132
|
-
pushEnd(): void;
|
|
133
|
-
pushError(err: Error, recoverable?: boolean): void;
|
|
134
|
-
readError(): void;
|
|
135
|
-
peekError(): void;
|
|
136
|
-
resolvePush(): void;
|
|
137
|
-
_read(size?: number): void | Promise<void>;
|
|
138
|
-
_destroy(): void;
|
|
139
|
-
_pause(): void;
|
|
140
|
-
loadIntoBuffer(count?: number | true, readError?: boolean): Promise<void>;
|
|
141
|
-
peek(): Promise<T>;
|
|
142
|
-
read(): Promise<T | null | undefined>;
|
|
143
|
-
peekArray(count?: number | null): Promise<T[]>;
|
|
144
|
-
readArray(count?: number | null): Promise<T[]>;
|
|
145
|
-
readAll(): Promise<T[]>;
|
|
146
|
-
peekAll(): Promise<T[]>;
|
|
147
|
-
destroy(): void;
|
|
148
|
-
[Symbol.asyncIterator](): this;
|
|
149
|
-
next(): Promise<{
|
|
150
|
-
value: T;
|
|
151
|
-
done: false;
|
|
152
|
-
} | {
|
|
153
|
-
value: undefined;
|
|
154
|
-
done: true;
|
|
155
|
-
}>;
|
|
156
|
-
pipeTo(outStream: ObjectWriteStream<T>, options?: {
|
|
157
|
-
noEnd?: boolean;
|
|
158
|
-
}): Promise<void>;
|
|
159
|
-
}
|
|
160
|
-
interface ObjectWriteStreamOptions<T> {
|
|
161
|
-
_writableState?: any;
|
|
162
|
-
nodeStream?: NodeJS.WritableStream;
|
|
163
|
-
write?: (this: ObjectWriteStream<T>, data: T) => Promise<any> | undefined;
|
|
164
|
-
writeEnd?: (this: ObjectWriteStream<T>) => Promise<any>;
|
|
165
|
-
}
|
|
166
|
-
export declare class ObjectWriteStream<T> {
|
|
167
|
-
isReadable: boolean;
|
|
168
|
-
isWritable: true;
|
|
169
|
-
nodeWritableStream: NodeJS.WritableStream | null;
|
|
170
|
-
constructor(optionsOrStream?: ObjectWriteStreamOptions<T> | NodeJS.WritableStream);
|
|
171
|
-
write(elem: T | null): void | Promise<void>;
|
|
172
|
-
_write(elem: T): void | Promise<void>;
|
|
173
|
-
_writeEnd(): void | Promise<void>;
|
|
174
|
-
writeEnd(elem?: T): Promise<void>;
|
|
175
|
-
}
|
|
176
|
-
interface ObjectReadWriteStreamOptions<T> {
|
|
177
|
-
read?: (this: ObjectReadStream<T>) => void | Promise<void>;
|
|
178
|
-
pause?: (this: ObjectReadStream<T>) => void | Promise<void>;
|
|
179
|
-
destroy?: (this: ObjectReadStream<T>) => void | Promise<void>;
|
|
180
|
-
write?: (this: ObjectWriteStream<T>, elem: T) => Promise<any> | undefined | void;
|
|
181
|
-
writeEnd?: () => Promise<any> | undefined | void;
|
|
182
|
-
}
|
|
183
|
-
export declare class ObjectReadWriteStream<T> extends ObjectReadStream<T> implements ObjectWriteStream<T> {
|
|
184
|
-
isReadable: true;
|
|
185
|
-
isWritable: true;
|
|
186
|
-
nodeWritableStream: NodeJS.WritableStream | null;
|
|
187
|
-
constructor(options?: ObjectReadWriteStreamOptions<T>);
|
|
188
|
-
write(elem: T): void | Promise<void>;
|
|
189
|
-
_write(elem: T): void | Promise<void>;
|
|
190
|
-
/** In a ReadWriteStream, _read does not need to be implemented. */
|
|
191
|
-
_read(): void;
|
|
192
|
-
_writeEnd(): void | Promise<void>;
|
|
193
|
-
writeEnd(): Promise<void>;
|
|
194
|
-
}
|
|
195
|
-
export declare function readAll(nodeStream: NodeJS.ReadableStream, encoding?: any): Promise<string>;
|
|
196
|
-
export declare function stdin(): ReadStream;
|
|
197
|
-
export declare function stdout(): WriteStream;
|
|
198
|
-
export declare function stdpipe(stream: WriteStream | ReadStream | ReadWriteStream): Promise<void[]>;
|
|
199
|
-
export {};
|
|
1
|
+
export * from "@pkmn/streams";
|