@pkmn/engine 0.1.0-dev.6195e056 → 0.1.0-dev.6ef582f1
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/README.md +91 -60
- package/build/pkg/addon.d.ts +7 -0
- package/build/pkg/addon.js +112 -0
- package/build/pkg/addon.js.map +1 -0
- package/build/pkg/data/layout.json +25 -3
- package/build/pkg/data.d.ts +1 -2
- package/build/pkg/data.js +3 -5
- package/build/pkg/data.js.map +1 -1
- package/build/pkg/gen1.d.ts +5 -4
- package/build/pkg/gen1.js +47 -31
- package/build/pkg/gen1.js.map +1 -1
- package/build/pkg/index.d.ts +16 -13
- package/build/pkg/index.js +1 -1
- package/build/pkg/index.js.map +1 -1
- package/build/pkg/protocol.d.ts +4 -2
- package/build/pkg/protocol.js +5 -3
- package/build/pkg/protocol.js.map +1 -1
- package/build/test/display.js +400 -0
- package/build/test/display.js.map +1 -0
- package/build/tools/debug.js +133 -0
- package/build/tools/debug.js.map +1 -0
- package/build.zig +76 -78
- package/package.json +57 -36
- package/src/bin/install-pkmn-engine +68 -36
- package/src/bin/pkmn-debug +62 -0
- package/src/lib/binding/node.zig +46 -141
- package/src/lib/binding/wasm.zig +6 -4
- package/src/lib/common/battle.zig +17 -0
- package/src/lib/common/data.zig +11 -11
- package/src/lib/common/debug.zig +74 -0
- package/src/lib/common/js.zig +118 -0
- package/src/lib/common/optional.zig +60 -0
- package/src/lib/common/options.zig +12 -3
- package/src/lib/common/protocol.zig +242 -178
- package/src/lib/common/rational.zig +353 -0
- package/src/lib/common/rng.zig +10 -10
- package/src/lib/common/util.zig +12 -0
- package/src/lib/gen1/README.md +197 -162
- package/src/lib/gen1/calc.zig +427 -0
- package/src/lib/gen1/chance.zig +1044 -0
- package/src/lib/gen1/data/moves.zig +10 -10
- package/src/lib/gen1/data/species.zig +2 -2
- package/src/lib/gen1/data/types.zig +3 -3
- package/src/lib/gen1/data.zig +70 -44
- package/src/lib/gen1/helpers.zig +439 -36
- package/src/lib/gen1/mechanics.zig +1073 -641
- package/src/lib/gen2/README.md +12 -13
- package/src/lib/gen2/data/items.zig +3 -3
- package/src/lib/gen2/data/moves.zig +1 -1
- package/src/lib/gen2/data/species.zig +1 -1
- package/src/lib/gen2/data/types.zig +3 -3
- package/src/lib/gen2/data.zig +37 -26
- package/src/lib/gen2/helpers.zig +9 -11
- package/src/lib/gen2/mechanics.zig +5 -4
- package/src/lib/pkmn.zig +68 -9
- package/src/test/display/pkmn.html.tmpl +368 -0
package/build.zig
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
const std = @import("std");
|
|
2
2
|
const builtin = @import("builtin");
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
pub const Options = struct {
|
|
5
|
+
showdown: ?bool = null,
|
|
6
|
+
log: ?bool = null,
|
|
7
|
+
chance: ?bool = null,
|
|
8
|
+
calc: ?bool = null,
|
|
9
|
+
};
|
|
7
10
|
|
|
8
11
|
pub fn module(b: *std.Build, options: Options) *std.Build.Module {
|
|
9
12
|
const dirname = comptime std.fs.path.dirname(@src().file) orelse ".";
|
|
10
13
|
const build_options = b.addOptions();
|
|
11
14
|
build_options.addOption(?bool, "showdown", options.showdown);
|
|
12
|
-
build_options.addOption(?bool, "
|
|
15
|
+
build_options.addOption(?bool, "log", options.log);
|
|
16
|
+
build_options.addOption(?bool, "chance", options.chance);
|
|
17
|
+
build_options.addOption(?bool, "calc", options.calc);
|
|
13
18
|
return b.createModule(.{
|
|
14
19
|
.source_file = .{ .path = dirname ++ "/src/lib/pkmn.zig" },
|
|
15
20
|
.dependencies = &.{.{ .name = "build_options", .module = build_options.createModule() }},
|
|
@@ -29,25 +34,30 @@ pub fn build(b: *std.Build) !void {
|
|
|
29
34
|
const dynamic = b.option(bool, "dynamic", "Build a dynamic library") orelse false;
|
|
30
35
|
const strip = b.option(bool, "strip", "Strip debugging symbols from binary") orelse false;
|
|
31
36
|
const pic = b.option(bool, "pic", "Force position independent code") orelse false;
|
|
37
|
+
const emit_asm = b.option(bool, "emit-asm", "Output .s (assembly code)") orelse false;
|
|
38
|
+
const emit_ll = b.option(bool, "emit-ll", "Output .ll (LLVM IR)") orelse false;
|
|
32
39
|
|
|
33
|
-
const cmd = b.findProgram(
|
|
40
|
+
const cmd = b.findProgram(&.{"strip"}, &.{}) catch null;
|
|
34
41
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
var repository = std.mem.split(u8, tree.root.Object.get("repository").?.String, ":");
|
|
42
|
+
const json = @embedFile("package.json");
|
|
43
|
+
var parsed = try std.json.parseFromSlice(std.json.Value, b.allocator, json, .{});
|
|
44
|
+
defer parsed.deinit();
|
|
45
|
+
const version = parsed.value.object.get("version").?.string;
|
|
46
|
+
const description = parsed.value.object.get("description").?.string;
|
|
47
|
+
var repository = std.mem.split(u8, parsed.value.object.get("repository").?.string, ":");
|
|
42
48
|
std.debug.assert(std.mem.eql(u8, repository.first(), "github"));
|
|
43
49
|
|
|
44
50
|
const showdown =
|
|
45
51
|
b.option(bool, "showdown", "Enable Pokémon Showdown compatibility mode") orelse false;
|
|
46
|
-
const
|
|
52
|
+
const log = b.option(bool, "log", "Enable protocol message logging") orelse false;
|
|
53
|
+
const chance = b.option(bool, "chance", "Enable update probability tracking") orelse false;
|
|
54
|
+
const calc = b.option(bool, "calc", "Enable damage calculator support") orelse false;
|
|
47
55
|
|
|
48
56
|
const options = b.addOptions();
|
|
49
57
|
options.addOption(?bool, "showdown", showdown);
|
|
50
|
-
options.addOption(?bool, "
|
|
58
|
+
options.addOption(?bool, "log", log);
|
|
59
|
+
options.addOption(?bool, "chance", chance);
|
|
60
|
+
options.addOption(?bool, "calc", calc);
|
|
51
61
|
|
|
52
62
|
const name = if (showdown) "pkmn-showdown" else "pkmn";
|
|
53
63
|
|
|
@@ -66,7 +76,7 @@ pub fn build(b: *std.Build) !void {
|
|
|
66
76
|
lib.linkLibC();
|
|
67
77
|
if (node_import_lib) |il| {
|
|
68
78
|
lib.addObjectFile(il);
|
|
69
|
-
} else if ((try NativeTargetInfo.detect(target)).target.os.tag == .windows) {
|
|
79
|
+
} else if ((try std.zig.system.NativeTargetInfo.detect(target)).target.os.tag == .windows) {
|
|
70
80
|
try std.io.getStdErr().writeAll("Must provide --node-import-library path on Windows\n");
|
|
71
81
|
std.process.exit(1);
|
|
72
82
|
}
|
|
@@ -74,14 +84,14 @@ pub fn build(b: *std.Build) !void {
|
|
|
74
84
|
maybeStrip(b, lib, b.getInstallStep(), strip, cmd);
|
|
75
85
|
if (pic) lib.force_pic = pic;
|
|
76
86
|
// Always emit to build/lib because this is where the driver code expects to find it
|
|
77
|
-
// TODO(ziglang/zig#2231): using the following used to work (though
|
|
87
|
+
// TODO(ziglang/zig#2231): using the following used to work (though was hacky):
|
|
78
88
|
//
|
|
79
89
|
// lib.emit_bin = .{ .emit_to = b.fmt("build/lib/{s}", .{addon}) };
|
|
80
90
|
// b.getInstallStep().dependOn(&lib.step);
|
|
81
91
|
//
|
|
82
92
|
// But ziglang/zig#14647 broke this so we now need to do an install() and then manually
|
|
83
93
|
// rename the file ourself in install-pkmn-engine
|
|
84
|
-
|
|
94
|
+
b.installArtifact(lib);
|
|
85
95
|
} else if (wasm) {
|
|
86
96
|
const lib = b.addSharedLibrary(.{
|
|
87
97
|
.name = name,
|
|
@@ -98,24 +108,21 @@ pub fn build(b: *std.Build) !void {
|
|
|
98
108
|
lib.rdynamic = true;
|
|
99
109
|
lib.strip = strip;
|
|
100
110
|
if (pic) lib.force_pic = pic;
|
|
101
|
-
const opt = b.findProgram(
|
|
102
|
-
&[_][]const u8{"wasm-opt"},
|
|
103
|
-
&[_][]const u8{"./node_modules/.bin"},
|
|
104
|
-
) catch null;
|
|
111
|
+
const opt = b.findProgram(&.{"wasm-opt"}, &.{"./node_modules/.bin"}) catch null;
|
|
105
112
|
if (optimize != .Debug and opt != null) {
|
|
106
113
|
const out = b.fmt("build/lib/{s}.wasm", .{name});
|
|
107
|
-
const sh = b.addSystemCommand(
|
|
114
|
+
const sh = b.addSystemCommand(&.{ opt.?, "-O4" });
|
|
108
115
|
sh.addArtifactArg(lib);
|
|
109
116
|
sh.addArg("-o");
|
|
110
117
|
sh.addFileSourceArg(.{ .path = out });
|
|
111
118
|
b.getInstallStep().dependOn(&sh.step);
|
|
112
119
|
}
|
|
113
|
-
|
|
120
|
+
b.installArtifact(lib);
|
|
114
121
|
} else if (dynamic) {
|
|
115
122
|
const lib = b.addSharedLibrary(.{
|
|
116
123
|
.name = name,
|
|
117
124
|
.root_source_file = .{ .path = "src/lib/binding/c.zig" },
|
|
118
|
-
.version = try std.
|
|
125
|
+
.version = try std.SemanticVersion.parse(version),
|
|
119
126
|
.optimize = optimize,
|
|
120
127
|
.target = target,
|
|
121
128
|
});
|
|
@@ -124,7 +131,7 @@ pub fn build(b: *std.Build) !void {
|
|
|
124
131
|
lib.addIncludePath("src/include");
|
|
125
132
|
maybeStrip(b, lib, b.getInstallStep(), strip, cmd);
|
|
126
133
|
if (pic) lib.force_pic = pic;
|
|
127
|
-
|
|
134
|
+
b.installArtifact(lib);
|
|
128
135
|
c = true;
|
|
129
136
|
} else {
|
|
130
137
|
const lib = b.addStaticLibrary(.{
|
|
@@ -139,7 +146,9 @@ pub fn build(b: *std.Build) !void {
|
|
|
139
146
|
lib.bundle_compiler_rt = true;
|
|
140
147
|
maybeStrip(b, lib, b.getInstallStep(), strip, cmd);
|
|
141
148
|
if (pic) lib.force_pic = pic;
|
|
142
|
-
lib.
|
|
149
|
+
if (emit_asm) lib.emit_asm = .emit;
|
|
150
|
+
if (emit_ll) lib.emit_llvm_ir = .emit;
|
|
151
|
+
b.installArtifact(lib);
|
|
143
152
|
c = true;
|
|
144
153
|
}
|
|
145
154
|
|
|
@@ -181,14 +190,20 @@ pub fn build(b: *std.Build) !void {
|
|
|
181
190
|
.strip = strip,
|
|
182
191
|
.cmd = cmd,
|
|
183
192
|
};
|
|
193
|
+
|
|
194
|
+
// TODO: tests can be run multiple times due to @imports
|
|
184
195
|
const tests = TestStep.create(b, options, config);
|
|
185
196
|
|
|
186
197
|
var exes = std.ArrayList(*std.Build.CompileStep).init(b.allocator);
|
|
187
198
|
const tools: ToolConfig = .{
|
|
199
|
+
.options = .{
|
|
200
|
+
.showdown = showdown,
|
|
201
|
+
.log = log,
|
|
202
|
+
.chance = chance,
|
|
203
|
+
.calc = calc,
|
|
204
|
+
},
|
|
188
205
|
.general = config,
|
|
189
206
|
.tool = .{
|
|
190
|
-
.showdown = showdown,
|
|
191
|
-
.trace = trace,
|
|
192
207
|
.tests = if (tests.build) tests else null,
|
|
193
208
|
.exes = &exes,
|
|
194
209
|
},
|
|
@@ -202,23 +217,21 @@ pub fn build(b: *std.Build) !void {
|
|
|
202
217
|
var fuzz_config = tools;
|
|
203
218
|
fuzz_config.general.strip = false;
|
|
204
219
|
fuzz_config.tool.name = "fuzz";
|
|
205
|
-
const fuzz = tool(b, "src/test/
|
|
220
|
+
const fuzz = tool(b, "src/test/fuzz.zig", fuzz_config);
|
|
206
221
|
|
|
222
|
+
const copies = tool(b, "src/tools/copies.zig", tools);
|
|
223
|
+
const dump = tool(b, "src/tools/dump.zig", tools);
|
|
207
224
|
const serde = tool(b, "src/tools/serde.zig", tools);
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
const lint_exe =
|
|
211
|
-
b.addExecutable(.{ .name = "lint", .root_source_file = .{ .path = "src/tools/lint.zig" } });
|
|
212
|
-
if (tests.build) tests.step.dependOn(&lint_exe.step);
|
|
213
|
-
const lint = lint_exe.run();
|
|
225
|
+
const transitions = tool(b, "src/tools/transitions.zig", tools);
|
|
214
226
|
|
|
227
|
+
b.step("copies", "Run copy detector").dependOn(&copies.step);
|
|
215
228
|
b.step("benchmark", "Run benchmark code").dependOn(&benchmark.step);
|
|
229
|
+
b.step("dump", "Run protocol dump tool").dependOn(&dump.step);
|
|
216
230
|
b.step("fuzz", "Run fuzz tester").dependOn(&fuzz.step);
|
|
217
|
-
b.step("lint", "Lint source files").dependOn(&lint.step);
|
|
218
|
-
b.step("protocol", "Run protocol dump tool").dependOn(&protocol.step);
|
|
219
231
|
b.step("serde", "Run serialization/deserialization tool").dependOn(&serde.step);
|
|
220
232
|
b.step("test", "Run all tests").dependOn(&tests.step);
|
|
221
233
|
b.step("tools", "Install tools").dependOn(&ToolsStep.create(b, &exes).step);
|
|
234
|
+
b.step("transitions", "Visualize transitions algorithm search").dependOn(&transitions.step);
|
|
222
235
|
}
|
|
223
236
|
|
|
224
237
|
fn maybeStrip(
|
|
@@ -235,7 +248,7 @@ fn maybeStrip(
|
|
|
235
248
|
if (mac and artifact.isDynamicLibrary()) return;
|
|
236
249
|
// Assuming GNU strip, which complains "illegal pathname found in archive member"...
|
|
237
250
|
if (!mac and artifact.isStaticLibrary()) return;
|
|
238
|
-
const sh = b.addSystemCommand(
|
|
251
|
+
const sh = b.addSystemCommand(&.{ cmd.?, if (mac) "-x" else "-s" });
|
|
239
252
|
sh.addArtifactArg(artifact);
|
|
240
253
|
step.dependOn(&sh.step);
|
|
241
254
|
}
|
|
@@ -248,12 +261,6 @@ const Config = struct {
|
|
|
248
261
|
cmd: ?[]const u8,
|
|
249
262
|
};
|
|
250
263
|
|
|
251
|
-
const TESTS = [_][]const u8{
|
|
252
|
-
"src/lib/common/test.zig",
|
|
253
|
-
"src/lib/gen1/test.zig",
|
|
254
|
-
"src/lib/gen2/test.zig",
|
|
255
|
-
};
|
|
256
|
-
|
|
257
264
|
const TestStep = struct {
|
|
258
265
|
step: std.Build.Step,
|
|
259
266
|
build: bool,
|
|
@@ -261,49 +268,42 @@ const TestStep = struct {
|
|
|
261
268
|
pub fn create(b: *std.Build, options: *std.Build.OptionsStep, config: Config) *TestStep {
|
|
262
269
|
const coverage = b.option([]const u8, "test-coverage", "Generate test coverage");
|
|
263
270
|
const test_file = b.option([]const u8, "test-file", "Input file for test");
|
|
264
|
-
const test_bin = b.option([]const u8, "test-bin", "Emit test binary to");
|
|
265
271
|
const test_filter =
|
|
266
272
|
b.option([]const u8, "test-filter", "Skip tests that do not match filter");
|
|
267
|
-
const test_no_exec =
|
|
268
|
-
b.option(bool, "test-no-exec", "Compiles test binary without running it") orelse false;
|
|
269
273
|
|
|
270
274
|
const self = b.allocator.create(TestStep) catch @panic("OOM");
|
|
271
275
|
const step = std.Build.Step.init(.{ .id = .custom, .name = "Run all tests", .owner = b });
|
|
272
276
|
self.* = TestStep{ .step = step, .build = test_filter == null };
|
|
273
277
|
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
if (coverage) |c| {
|
|
294
|
-
tests.setExecCmd(&.{ "kcov", "--include-pattern=src/lib", c, null });
|
|
295
|
-
}
|
|
296
|
-
self.step.dependOn(if (test_no_exec) &tests.step else &tests.run().step);
|
|
278
|
+
const path = test_file orelse "src/lib/test.zig";
|
|
279
|
+
const tests = b.addTest(.{
|
|
280
|
+
.name = b.fmt("{s}-{s}", .{
|
|
281
|
+
std.fs.path.basename(std.fs.path.dirname(path).?),
|
|
282
|
+
std.fs.path.stem(std.fs.path.basename(path)),
|
|
283
|
+
}),
|
|
284
|
+
.root_source_file = .{ .path = path },
|
|
285
|
+
.optimize = config.optimize,
|
|
286
|
+
.target = config.target,
|
|
287
|
+
.filter = test_filter,
|
|
288
|
+
});
|
|
289
|
+
tests.setMainPkgPath("./");
|
|
290
|
+
tests.addOptions("build_options", options);
|
|
291
|
+
tests.single_threaded = true;
|
|
292
|
+
maybeStrip(b, tests, &tests.step, config.strip, config.cmd);
|
|
293
|
+
if (config.pic) tests.force_pic = config.pic;
|
|
294
|
+
if (coverage) |c| {
|
|
295
|
+
tests.setExecCmd(&.{ "kcov", "--include-pattern=src/lib", c, null });
|
|
297
296
|
}
|
|
297
|
+
self.step.dependOn(&b.addRunArtifact(tests).step);
|
|
298
|
+
|
|
298
299
|
return self;
|
|
299
300
|
}
|
|
300
301
|
};
|
|
301
302
|
|
|
302
303
|
const ToolConfig = struct {
|
|
304
|
+
options: Options,
|
|
303
305
|
general: Config,
|
|
304
306
|
tool: struct {
|
|
305
|
-
showdown: bool,
|
|
306
|
-
trace: bool,
|
|
307
307
|
tests: ?*TestStep,
|
|
308
308
|
name: ?[]const u8 = null,
|
|
309
309
|
exes: *std.ArrayList(*std.Build.CompileStep),
|
|
@@ -314,7 +314,7 @@ fn tool(b: *std.Build, path: []const u8, config: ToolConfig) *std.Build.RunStep
|
|
|
314
314
|
var name = config.tool.name orelse std.fs.path.basename(path);
|
|
315
315
|
const index = std.mem.lastIndexOfScalar(u8, name, '.');
|
|
316
316
|
if (index) |i| name = name[0..i];
|
|
317
|
-
if (config.
|
|
317
|
+
if (config.options.showdown orelse false) name = b.fmt("{s}-showdown", .{name});
|
|
318
318
|
|
|
319
319
|
const exe = b.addExecutable(.{
|
|
320
320
|
.name = name,
|
|
@@ -322,16 +322,14 @@ fn tool(b: *std.Build, path: []const u8, config: ToolConfig) *std.Build.RunStep
|
|
|
322
322
|
.target = config.general.target,
|
|
323
323
|
.optimize = config.general.optimize,
|
|
324
324
|
});
|
|
325
|
-
exe.addModule("pkmn", module(b, .
|
|
326
|
-
|
|
327
|
-
.trace = config.tool.trace,
|
|
328
|
-
}));
|
|
325
|
+
exe.addModule("pkmn", module(b, config.options));
|
|
326
|
+
|
|
329
327
|
exe.single_threaded = true;
|
|
330
328
|
if (config.general.pic) exe.force_pic = config.general.pic;
|
|
331
329
|
if (config.tool.tests) |ts| ts.step.dependOn(&exe.step);
|
|
332
330
|
config.tool.exes.append(exe) catch @panic("OOM");
|
|
333
331
|
|
|
334
|
-
const run =
|
|
332
|
+
const run = b.addRunArtifact(exe);
|
|
335
333
|
maybeStrip(b, exe, &run.step, config.general.strip, config.general.cmd);
|
|
336
334
|
if (b.args) |args| run.addArgs(args);
|
|
337
335
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pkmn/engine",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.6ef582f1",
|
|
4
4
|
"description": "A minimal, complete, Pokémon battle simulation engine optimized for performance",
|
|
5
5
|
"repository": "github:pkmn/engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,85 +9,103 @@
|
|
|
9
9
|
"types": "build/pkg/index.d.ts",
|
|
10
10
|
"files": [
|
|
11
11
|
"build.zig",
|
|
12
|
+
"build/pkg/data.d.ts",
|
|
13
|
+
"build/pkg/data.js.map",
|
|
14
|
+
"build/pkg/addon.d.ts",
|
|
15
|
+
"build/pkg/addon.js.map",
|
|
16
|
+
"build/pkg/addon.js",
|
|
17
|
+
"build/pkg/data.js",
|
|
18
|
+
"build/pkg/data/ids.json",
|
|
19
|
+
"build/pkg/data/layout.json",
|
|
20
|
+
"build/pkg/data/protocol.json",
|
|
21
|
+
"build/pkg/gen1.d.ts",
|
|
22
|
+
"build/pkg/gen1.js.map",
|
|
23
|
+
"build/pkg/gen1.js",
|
|
24
|
+
"build/pkg/index.d.ts",
|
|
25
|
+
"build/pkg/index.js.map",
|
|
26
|
+
"build/pkg/index.js",
|
|
27
|
+
"build/pkg/protocol.d.ts",
|
|
28
|
+
"build/pkg/protocol.js.map",
|
|
29
|
+
"build/pkg/protocol.js",
|
|
30
|
+
"build/test/display.js.map",
|
|
31
|
+
"build/test/display.js",
|
|
32
|
+
"build/tools/debug.js.map",
|
|
33
|
+
"build/tools/debug.js",
|
|
12
34
|
"src/bin/install-pkmn-engine",
|
|
13
35
|
"src/lib/binding/node.zig",
|
|
14
36
|
"src/lib/binding/wasm.zig",
|
|
37
|
+
"src/lib/common/battle.zig",
|
|
15
38
|
"src/lib/common/data.zig",
|
|
39
|
+
"src/lib/common/debug.zig",
|
|
40
|
+
"src/lib/common/js.zig",
|
|
41
|
+
"src/lib/common/optional.zig",
|
|
16
42
|
"src/lib/common/options.zig",
|
|
17
43
|
"src/lib/common/protocol.zig",
|
|
44
|
+
"src/lib/common/rational.zig",
|
|
18
45
|
"src/lib/common/rng.zig",
|
|
46
|
+
"src/lib/common/util.zig",
|
|
47
|
+
"src/lib/gen1/calc.zig",
|
|
48
|
+
"src/lib/gen1/chance.zig",
|
|
49
|
+
"src/lib/gen1/data.zig",
|
|
19
50
|
"src/lib/gen1/data/moves.zig",
|
|
20
51
|
"src/lib/gen1/data/species.zig",
|
|
21
52
|
"src/lib/gen1/data/types.zig",
|
|
22
|
-
"src/lib/gen1/data.zig",
|
|
23
53
|
"src/lib/gen1/helpers.zig",
|
|
24
54
|
"src/lib/gen1/mechanics.zig",
|
|
55
|
+
"src/lib/gen2/data.zig",
|
|
25
56
|
"src/lib/gen2/data/items.zig",
|
|
26
57
|
"src/lib/gen2/data/moves.zig",
|
|
27
58
|
"src/lib/gen2/data/species.zig",
|
|
28
59
|
"src/lib/gen2/data/types.zig",
|
|
29
|
-
"src/lib/gen2/data.zig",
|
|
30
60
|
"src/lib/gen2/helpers.zig",
|
|
31
61
|
"src/lib/gen2/mechanics.zig",
|
|
32
62
|
"src/lib/pkmn.zig",
|
|
33
|
-
"
|
|
34
|
-
"build/pkg/data/layout.json",
|
|
35
|
-
"build/pkg/data/protocol.json",
|
|
36
|
-
"build/pkg/data.d.ts",
|
|
37
|
-
"build/pkg/data.js",
|
|
38
|
-
"build/pkg/data.js.map",
|
|
39
|
-
"build/pkg/gen1.d.ts",
|
|
40
|
-
"build/pkg/gen1.js",
|
|
41
|
-
"build/pkg/gen1.js.map",
|
|
42
|
-
"build/pkg/index.d.ts",
|
|
43
|
-
"build/pkg/index.js",
|
|
44
|
-
"build/pkg/index.js.map",
|
|
45
|
-
"build/pkg/protocol.d.ts",
|
|
46
|
-
"build/pkg/protocol.js",
|
|
47
|
-
"build/pkg/protocol.js.map"
|
|
63
|
+
"src/test/display/pkmn.html.tmpl"
|
|
48
64
|
],
|
|
49
65
|
"engines": {
|
|
50
66
|
"node": ">=16.0.0"
|
|
51
67
|
},
|
|
52
68
|
"bin": {
|
|
53
|
-
"install-pkmn-engine": "src/bin/install-pkmn-engine"
|
|
69
|
+
"install-pkmn-engine": "src/bin/install-pkmn-engine",
|
|
70
|
+
"pkmn-debug": "src/bin/pkmn-debug"
|
|
54
71
|
},
|
|
55
72
|
"publishConfig": {
|
|
56
73
|
"access": "public"
|
|
57
74
|
},
|
|
58
75
|
"dependencies": {
|
|
59
|
-
"@pkmn/data": "^0.7.
|
|
60
|
-
"@pkmn/protocol": "^0.6.
|
|
76
|
+
"@pkmn/data": "^0.7.46",
|
|
77
|
+
"@pkmn/protocol": "^0.6.12"
|
|
61
78
|
},
|
|
62
79
|
"devDependencies": {
|
|
63
|
-
"@pkmn/eslint-config": "^
|
|
64
|
-
"@pkmn/img": "^0.2.
|
|
80
|
+
"@pkmn/eslint-config": "^5.0.0",
|
|
81
|
+
"@pkmn/img": "^0.2.13",
|
|
65
82
|
"@pkmn/sets": "^5.0.4",
|
|
66
|
-
"@pkmn/sim": "0.7.
|
|
83
|
+
"@pkmn/sim": "0.7.46",
|
|
67
84
|
"@types/html-minifier": "^4.0.2",
|
|
68
|
-
"@types/jest": "^29.5.
|
|
85
|
+
"@types/jest": "^29.5.3",
|
|
69
86
|
"@types/minimist": "^1.2.2",
|
|
70
87
|
"@types/mustache": "^4.2.2",
|
|
71
|
-
"@types/node": "^
|
|
72
|
-
"@vitest/coverage-c8": "^0.
|
|
73
|
-
"binaryen": "^
|
|
74
|
-
"eslint": "^8.
|
|
88
|
+
"@types/node": "^20.4.2",
|
|
89
|
+
"@vitest/coverage-c8": "^0.33.0",
|
|
90
|
+
"binaryen": "^114.0.0",
|
|
91
|
+
"eslint": "^8.44.0",
|
|
75
92
|
"html-minifier": "^4.0.0",
|
|
76
93
|
"json-stringify-pretty-compact": "3.0.0",
|
|
77
94
|
"minimist": "^1.2.8",
|
|
78
95
|
"mustache": "^4.2.0",
|
|
79
96
|
"source-map-support": "^0.5.21",
|
|
80
97
|
"trakr": "^0.2.0",
|
|
81
|
-
"typescript": "^5.
|
|
82
|
-
"vitest": "^0.
|
|
98
|
+
"typescript": "^5.1.6",
|
|
99
|
+
"vitest": "^0.33.0"
|
|
83
100
|
},
|
|
84
101
|
"scripts": {
|
|
85
|
-
"lint": "eslint --cache src --ext ts,js && eslint src/bin
|
|
86
|
-
"fix": "eslint --fix src --ext ts,js && eslint --fix src/bin
|
|
102
|
+
"lint": "eslint --cache src --ext ts,js && eslint src/bin/*",
|
|
103
|
+
"fix": "eslint --fix src --ext ts,js && eslint --fix src/bin/*",
|
|
87
104
|
"compile": "tsc -p .",
|
|
88
105
|
"build": "npm run compile",
|
|
89
106
|
"test": "vitest src/pkg",
|
|
90
107
|
"test:integration": "vitest src/test",
|
|
108
|
+
"debug": "npm run compile && node build/tools/debug",
|
|
91
109
|
"fuzz": "npm run compile && node build/test/fuzz",
|
|
92
110
|
"generate": "npm run compile && node build/tools/generate",
|
|
93
111
|
"release": "npm run compile && node build/tools/release",
|
|
@@ -129,7 +147,8 @@
|
|
|
129
147
|
"rules": {
|
|
130
148
|
"no-control-regex": "off",
|
|
131
149
|
"@typescript-eslint/no-empty-interface": "off",
|
|
132
|
-
"@typescript-eslint/no-shadow": "off"
|
|
150
|
+
"@typescript-eslint/no-shadow": "off",
|
|
151
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "off"
|
|
133
152
|
}
|
|
134
153
|
},
|
|
135
154
|
{
|
|
@@ -145,12 +164,14 @@
|
|
|
145
164
|
"src/test/benchmark*.ts"
|
|
146
165
|
],
|
|
147
166
|
"rules": {
|
|
148
|
-
"@typescript-eslint/no-unused-vars": "off"
|
|
167
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
168
|
+
"@typescript-eslint/no-redundant-type-constituents": "off"
|
|
149
169
|
}
|
|
150
170
|
},
|
|
151
171
|
{
|
|
152
172
|
"files": [
|
|
153
|
-
"src/test/*.test.ts"
|
|
173
|
+
"src/test/*.test.ts",
|
|
174
|
+
"src/test/regression/*.test.ts"
|
|
154
175
|
],
|
|
155
176
|
"rules": {
|
|
156
177
|
"jest/no-standalone-expect": "off"
|