@pkmn/engine 0.1.0-dev.6195e056 → 0.1.0-dev.6e63f5e4

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.
Files changed (57) hide show
  1. package/README.md +101 -62
  2. package/build/pkg/addon.d.ts +7 -0
  3. package/build/pkg/addon.js +112 -0
  4. package/build/pkg/addon.js.map +1 -0
  5. package/build/pkg/data/layout.json +25 -3
  6. package/build/pkg/data/protocol.json +22 -4
  7. package/build/pkg/data.d.ts +1 -2
  8. package/build/pkg/data.js +3 -5
  9. package/build/pkg/data.js.map +1 -1
  10. package/build/pkg/gen1.d.ts +5 -4
  11. package/build/pkg/gen1.js +47 -31
  12. package/build/pkg/gen1.js.map +1 -1
  13. package/build/pkg/index.d.ts +16 -13
  14. package/build/pkg/index.js +1 -1
  15. package/build/pkg/index.js.map +1 -1
  16. package/build/pkg/protocol.d.ts +4 -2
  17. package/build/pkg/protocol.js +5 -3
  18. package/build/pkg/protocol.js.map +1 -1
  19. package/build/test/display.js +400 -0
  20. package/build/test/display.js.map +1 -0
  21. package/build/tools/debug.js +133 -0
  22. package/build/tools/debug.js.map +1 -0
  23. package/build.zig +104 -90
  24. package/package.json +57 -36
  25. package/src/bin/install-pkmn-engine +68 -36
  26. package/src/bin/pkmn-debug +62 -0
  27. package/src/lib/binding/node.zig +47 -142
  28. package/src/lib/binding/wasm.zig +6 -4
  29. package/src/lib/common/battle.zig +17 -0
  30. package/src/lib/common/data.zig +15 -27
  31. package/src/lib/common/debug.zig +74 -0
  32. package/src/lib/common/js.zig +118 -0
  33. package/src/lib/common/optional.zig +60 -0
  34. package/src/lib/common/options.zig +12 -3
  35. package/src/lib/common/protocol.zig +416 -198
  36. package/src/lib/common/rational.zig +353 -0
  37. package/src/lib/common/rng.zig +15 -15
  38. package/src/lib/common/util.zig +12 -0
  39. package/src/lib/gen1/README.md +282 -165
  40. package/src/lib/gen1/calc.zig +426 -0
  41. package/src/lib/gen1/chance.zig +1058 -0
  42. package/src/lib/gen1/data/moves.zig +178 -180
  43. package/src/lib/gen1/data/species.zig +2 -2
  44. package/src/lib/gen1/data/types.zig +4 -4
  45. package/src/lib/gen1/data.zig +79 -65
  46. package/src/lib/gen1/helpers.zig +592 -36
  47. package/src/lib/gen1/mechanics.zig +1097 -662
  48. package/src/lib/gen2/README.md +87 -13
  49. package/src/lib/gen2/data/items.zig +3 -3
  50. package/src/lib/gen2/data/moves.zig +635 -563
  51. package/src/lib/gen2/data/species.zig +1 -1
  52. package/src/lib/gen2/data/types.zig +4 -4
  53. package/src/lib/gen2/data.zig +109 -77
  54. package/src/lib/gen2/helpers.zig +16 -22
  55. package/src/lib/gen2/mechanics.zig +1160 -11
  56. package/src/lib/pkmn.zig +68 -9
  57. 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 NativeTargetInfo = std.zig.system.NativeTargetInfo;
5
-
6
- pub const Options = struct { showdown: ?bool = null, trace: ?bool = null };
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, "trace", options.trace);
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(&[_][]const u8{"strip"}, &[_][]const u8{}) catch null;
40
+ const cmd = b.findProgram(&.{"strip"}, &.{}) catch null;
34
41
 
35
- var parser = std.json.Parser.init(b.allocator, false);
36
- defer parser.deinit();
37
- var tree = try parser.parse(@embedFile("package.json"));
38
- defer tree.deinit();
39
- const version = tree.root.Object.get("version").?.String;
40
- const description = tree.root.Object.get("description").?.String;
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 trace = b.option(bool, "trace", "Enable trace logs") orelse false;
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, "trace", trace);
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
 
@@ -56,17 +66,17 @@ pub fn build(b: *std.Build) !void {
56
66
  const addon = b.fmt("{s}.node", .{name});
57
67
  const lib = b.addSharedLibrary(.{
58
68
  .name = addon,
69
+ .main_pkg_path = .{ .path = "." },
59
70
  .root_source_file = .{ .path = "src/lib/binding/node.zig" },
60
71
  .optimize = optimize,
61
72
  .target = target,
62
73
  });
63
74
  lib.addOptions("build_options", options);
64
- lib.setMainPkgPath("./");
65
- lib.addSystemIncludePath(headers);
75
+ lib.addSystemIncludePath(.{ .path = headers });
66
76
  lib.linkLibC();
67
77
  if (node_import_lib) |il| {
68
- lib.addObjectFile(il);
69
- } else if ((try NativeTargetInfo.detect(target)).target.os.tag == .windows) {
78
+ lib.addObjectFile(.{ .path = il });
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,17 +84,18 @@ 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 be hacky):
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
- lib.install();
94
+ b.installArtifact(lib);
85
95
  } else if (wasm) {
86
96
  const lib = b.addSharedLibrary(.{
87
97
  .name = name,
98
+ .main_pkg_path = .{ .path = "." },
88
99
  .root_source_file = .{ .path = "src/lib/binding/wasm.zig" },
89
100
  .optimize = switch (optimize) {
90
101
  .ReleaseFast, .ReleaseSafe => .ReleaseSmall,
@@ -93,53 +104,63 @@ pub fn build(b: *std.Build) !void {
93
104
  .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
94
105
  });
95
106
  lib.addOptions("build_options", options);
96
- lib.setMainPkgPath("./");
97
107
  lib.stack_size = wasm_stack_size;
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(&[_][]const u8{ opt.?, "-O4" });
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
- lib.install();
120
+ b.installArtifact(lib);
114
121
  } else if (dynamic) {
115
122
  const lib = b.addSharedLibrary(.{
116
123
  .name = name,
124
+ .main_pkg_path = .{ .path = "." },
117
125
  .root_source_file = .{ .path = "src/lib/binding/c.zig" },
118
- .version = try std.builtin.Version.parse(version),
126
+ .version = try std.SemanticVersion.parse(version),
119
127
  .optimize = optimize,
120
128
  .target = target,
121
129
  });
122
130
  lib.addOptions("build_options", options);
123
- lib.setMainPkgPath("./");
124
- lib.addIncludePath("src/include");
131
+ lib.addIncludePath(.{ .path = "src/include" });
125
132
  maybeStrip(b, lib, b.getInstallStep(), strip, cmd);
126
133
  if (pic) lib.force_pic = pic;
127
- lib.install();
134
+ b.installArtifact(lib);
128
135
  c = true;
129
136
  } else {
130
137
  const lib = b.addStaticLibrary(.{
131
138
  .name = name,
139
+ .main_pkg_path = .{ .path = "." },
132
140
  .root_source_file = .{ .path = "src/lib/binding/c.zig" },
133
141
  .optimize = optimize,
134
142
  .target = target,
135
143
  });
136
144
  lib.addOptions("build_options", options);
137
- lib.setMainPkgPath("./");
138
- lib.addIncludePath("src/include");
145
+ lib.addIncludePath(.{ .path = "src/include" });
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.install();
149
+ if (emit_asm) {
150
+ b.getInstallStep().dependOn(&b.addInstallFileWithDir(
151
+ lib.getEmittedAsm(),
152
+ .prefix,
153
+ b.fmt("{s}.s", .{name}),
154
+ ).step);
155
+ }
156
+ if (emit_ll) {
157
+ b.getInstallStep().dependOn(&b.addInstallFileWithDir(
158
+ lib.getEmittedLlvmIr(),
159
+ .prefix,
160
+ b.fmt("{s}.ll", .{name}),
161
+ ).step);
162
+ }
163
+ b.installArtifact(lib);
143
164
  c = true;
144
165
  }
145
166
 
@@ -181,14 +202,20 @@ pub fn build(b: *std.Build) !void {
181
202
  .strip = strip,
182
203
  .cmd = cmd,
183
204
  };
205
+
206
+ // TODO: tests can be run multiple times due to @imports
184
207
  const tests = TestStep.create(b, options, config);
185
208
 
186
209
  var exes = std.ArrayList(*std.Build.CompileStep).init(b.allocator);
187
210
  const tools: ToolConfig = .{
211
+ .options = .{
212
+ .showdown = showdown,
213
+ .log = log,
214
+ .chance = chance,
215
+ .calc = calc,
216
+ },
188
217
  .general = config,
189
218
  .tool = .{
190
- .showdown = showdown,
191
- .trace = trace,
192
219
  .tests = if (tests.build) tests else null,
193
220
  .exes = &exes,
194
221
  },
@@ -202,23 +229,25 @@ pub fn build(b: *std.Build) !void {
202
229
  var fuzz_config = tools;
203
230
  fuzz_config.general.strip = false;
204
231
  fuzz_config.tool.name = "fuzz";
205
- const fuzz = tool(b, "src/test/benchmark.zig", fuzz_config);
232
+ const fuzz = tool(b, "src/test/fuzz.zig", fuzz_config);
206
233
 
207
- const serde = tool(b, "src/tools/serde.zig", tools);
208
- const protocol = tool(b, "src/tools/protocol.zig", tools);
234
+ const analyze = tool(b, "src/tools/analyze.zig", tools);
235
+ const dump = tool(b, "src/tools/dump.zig", tools);
236
+ const transitions = tool(b, "src/tools/transitions.zig", tools);
209
237
 
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();
238
+ // FIXME: serde randomly fails to build in some release configurations
239
+ var hack = tools;
240
+ if (optimize != .Debug) hack.tool.tests = null;
241
+ const serde = tool(b, "src/tools/serde.zig", hack);
214
242
 
243
+ b.step("analyze", "Run LLVM analysis tool").dependOn(&analyze.step);
215
244
  b.step("benchmark", "Run benchmark code").dependOn(&benchmark.step);
245
+ b.step("dump", "Run protocol dump tool").dependOn(&dump.step);
216
246
  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
247
  b.step("serde", "Run serialization/deserialization tool").dependOn(&serde.step);
220
248
  b.step("test", "Run all tests").dependOn(&tests.step);
221
249
  b.step("tools", "Install tools").dependOn(&ToolsStep.create(b, &exes).step);
250
+ b.step("transitions", "Visualize transitions algorithm search").dependOn(&transitions.step);
222
251
  }
223
252
 
224
253
  fn maybeStrip(
@@ -235,7 +264,7 @@ fn maybeStrip(
235
264
  if (mac and artifact.isDynamicLibrary()) return;
236
265
  // Assuming GNU strip, which complains "illegal pathname found in archive member"...
237
266
  if (!mac and artifact.isStaticLibrary()) return;
238
- const sh = b.addSystemCommand(&[_][]const u8{ cmd.?, if (mac) "-x" else "-s" });
267
+ const sh = b.addSystemCommand(&.{ cmd.?, if (mac) "-x" else "-s" });
239
268
  sh.addArtifactArg(artifact);
240
269
  step.dependOn(&sh.step);
241
270
  }
@@ -248,12 +277,6 @@ const Config = struct {
248
277
  cmd: ?[]const u8,
249
278
  };
250
279
 
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
280
  const TestStep = struct {
258
281
  step: std.Build.Step,
259
282
  build: bool,
@@ -261,49 +284,42 @@ const TestStep = struct {
261
284
  pub fn create(b: *std.Build, options: *std.Build.OptionsStep, config: Config) *TestStep {
262
285
  const coverage = b.option([]const u8, "test-coverage", "Generate test coverage");
263
286
  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
287
  const test_filter =
266
288
  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
289
 
270
290
  const self = b.allocator.create(TestStep) catch @panic("OOM");
271
291
  const step = std.Build.Step.init(.{ .id = .custom, .name = "Run all tests", .owner = b });
272
- self.* = TestStep{ .step = step, .build = test_filter == null };
273
-
274
- const paths: []const []const u8 =
275
- if (test_file) |t| &.{t} else if (coverage != null) &.{"src/lib/test.zig"} else &TESTS;
276
- for (paths) |path| {
277
- const tests = b.addTest(.{
278
- .name = std.fs.path.basename(std.fs.path.dirname(path).?),
279
- .root_source_file = .{ .path = path },
280
- .optimize = config.optimize,
281
- .target = config.target,
282
- });
283
- tests.setMainPkgPath("./");
284
- tests.setFilter(test_filter);
285
- tests.addOptions("build_options", options);
286
- tests.single_threaded = true;
287
- maybeStrip(b, tests, &tests.step, config.strip, config.cmd);
288
- if (config.pic) tests.force_pic = config.pic;
289
- if (test_bin) |bin| {
290
- tests.name = std.fs.path.basename(bin);
291
- if (std.fs.path.dirname(bin)) |dir| tests.setOutputDir(dir);
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);
292
+ self.* = .{ .step = step, .build = test_filter == null };
293
+
294
+ const path = test_file orelse "src/lib/test.zig";
295
+ const tests = b.addTest(.{
296
+ .name = b.fmt("{s}-{s}", .{
297
+ std.fs.path.basename(std.fs.path.dirname(path).?),
298
+ std.fs.path.stem(std.fs.path.basename(path)),
299
+ }),
300
+ .main_pkg_path = .{ .path = "." },
301
+ .root_source_file = .{ .path = path },
302
+ .optimize = config.optimize,
303
+ .target = config.target,
304
+ .filter = test_filter,
305
+ });
306
+ tests.addOptions("build_options", options);
307
+ tests.single_threaded = true;
308
+ maybeStrip(b, tests, &tests.step, config.strip, config.cmd);
309
+ if (config.pic) tests.force_pic = config.pic;
310
+ if (coverage) |c| {
311
+ tests.setExecCmd(&.{ "kcov", "--include-pattern=src/lib", c, null });
297
312
  }
313
+ self.step.dependOn(&b.addRunArtifact(tests).step);
314
+
298
315
  return self;
299
316
  }
300
317
  };
301
318
 
302
319
  const ToolConfig = struct {
320
+ options: Options,
303
321
  general: Config,
304
322
  tool: struct {
305
- showdown: bool,
306
- trace: bool,
307
323
  tests: ?*TestStep,
308
324
  name: ?[]const u8 = null,
309
325
  exes: *std.ArrayList(*std.Build.CompileStep),
@@ -314,7 +330,7 @@ fn tool(b: *std.Build, path: []const u8, config: ToolConfig) *std.Build.RunStep
314
330
  var name = config.tool.name orelse std.fs.path.basename(path);
315
331
  const index = std.mem.lastIndexOfScalar(u8, name, '.');
316
332
  if (index) |i| name = name[0..i];
317
- if (config.tool.showdown) name = b.fmt("{s}-showdown", .{name});
333
+ if (config.options.showdown orelse false) name = b.fmt("{s}-showdown", .{name});
318
334
 
319
335
  const exe = b.addExecutable(.{
320
336
  .name = name,
@@ -322,16 +338,14 @@ fn tool(b: *std.Build, path: []const u8, config: ToolConfig) *std.Build.RunStep
322
338
  .target = config.general.target,
323
339
  .optimize = config.general.optimize,
324
340
  });
325
- exe.addModule("pkmn", module(b, .{
326
- .showdown = config.tool.showdown,
327
- .trace = config.tool.trace,
328
- }));
341
+ exe.addModule("pkmn", module(b, config.options));
342
+
329
343
  exe.single_threaded = true;
330
344
  if (config.general.pic) exe.force_pic = config.general.pic;
331
345
  if (config.tool.tests) |ts| ts.step.dependOn(&exe.step);
332
346
  config.tool.exes.append(exe) catch @panic("OOM");
333
347
 
334
- const run = exe.run();
348
+ const run = b.addRunArtifact(exe);
335
349
  maybeStrip(b, exe, &run.step, config.general.strip, config.general.cmd);
336
350
  if (b.args) |args| run.addArgs(args);
337
351
 
@@ -344,8 +358,8 @@ const ToolsStep = struct {
344
358
  pub fn create(b: *std.Build, exes: *std.ArrayList(*std.Build.CompileStep)) *ToolsStep {
345
359
  const self = b.allocator.create(ToolsStep) catch @panic("OOM");
346
360
  const step = std.Build.Step.init(.{ .id = .custom, .name = "Install tools", .owner = b });
347
- self.* = ToolsStep{ .step = step };
348
- for (exes.items) |t| self.step.dependOn(&b.addInstallArtifact(t).step);
361
+ self.* = .{ .step = step };
362
+ for (exes.items) |t| self.step.dependOn(&b.addInstallArtifact(t, .{}).step);
349
363
  return self;
350
364
  }
351
365
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkmn/engine",
3
- "version": "0.1.0-dev.6195e056",
3
+ "version": "0.1.0-dev.6e63f5e4",
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
- "build/pkg/data/ids.json",
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.33",
60
- "@pkmn/protocol": "^0.6.11"
76
+ "@pkmn/data": "^0.7.50",
77
+ "@pkmn/protocol": "^0.6.13"
61
78
  },
62
79
  "devDependencies": {
63
- "@pkmn/eslint-config": "^3.0.0-alpha.0",
64
- "@pkmn/img": "^0.2.8",
80
+ "@pkmn/eslint-config": "^5.2.0",
81
+ "@pkmn/img": "^0.2.15",
65
82
  "@pkmn/sets": "^5.0.4",
66
- "@pkmn/sim": "0.7.33",
83
+ "@pkmn/sim": "0.7.50",
67
84
  "@types/html-minifier": "^4.0.2",
68
- "@types/jest": "^29.5.0",
85
+ "@types/jest": "^29.5.4",
69
86
  "@types/minimist": "^1.2.2",
70
87
  "@types/mustache": "^4.2.2",
71
- "@types/node": "^18.15.11",
72
- "@vitest/coverage-c8": "^0.29.8",
73
- "binaryen": "^112.0.0",
74
- "eslint": "^8.37.0",
88
+ "@types/node": "^20.5.9",
89
+ "@vitest/coverage-c8": "^0.33.0",
90
+ "binaryen": "^114.0.0",
91
+ "eslint": "^8.48.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.0.2",
82
- "vitest": "^0.29.8"
98
+ "typescript": "^5.2.2",
99
+ "vitest": "^0.34.4"
83
100
  },
84
101
  "scripts": {
85
- "lint": "eslint --cache src --ext ts,js && eslint src/bin/install-pkmn-engine",
86
- "fix": "eslint --fix src --ext ts,js && eslint --fix src/bin/install-pkmn-engine",
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"