hyperchess-core 0.1.0
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/LICENSE +674 -0
- package/README.md +83 -0
- package/dist/board/create.d.ts +13 -0
- package/dist/board/create.d.ts.map +1 -0
- package/dist/board/create.js +21 -0
- package/dist/board/create.js.map +1 -0
- package/dist/board/hfen.d.ts +31 -0
- package/dist/board/hfen.d.ts.map +1 -0
- package/dist/board/hfen.js +181 -0
- package/dist/board/hfen.js.map +1 -0
- package/dist/board/index.d.ts +6 -0
- package/dist/board/index.d.ts.map +1 -0
- package/dist/board/index.js +11 -0
- package/dist/board/index.js.map +1 -0
- package/dist/board/move.d.ts +16 -0
- package/dist/board/move.d.ts.map +1 -0
- package/dist/board/move.js +43 -0
- package/dist/board/move.js.map +1 -0
- package/dist/board/undo.d.ts +4 -0
- package/dist/board/undo.d.ts.map +1 -0
- package/dist/board/undo.js +22 -0
- package/dist/board/undo.js.map +1 -0
- package/dist/board/validate.d.ts +7 -0
- package/dist/board/validate.d.ts.map +1 -0
- package/dist/board/validate.js +14 -0
- package/dist/board/validate.js.map +1 -0
- package/dist/game/add-move.d.ts +7 -0
- package/dist/game/add-move.d.ts.map +1 -0
- package/dist/game/add-move.js +78 -0
- package/dist/game/add-move.js.map +1 -0
- package/dist/game/index.d.ts +21 -0
- package/dist/game/index.d.ts.map +1 -0
- package/dist/game/index.js +58 -0
- package/dist/game/index.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/io/hsan-exporter.d.ts +10 -0
- package/dist/io/hsan-exporter.d.ts.map +1 -0
- package/dist/io/hsan-exporter.js +70 -0
- package/dist/io/hsan-exporter.js.map +1 -0
- package/dist/io/hsan-parser.d.ts +12 -0
- package/dist/io/hsan-parser.d.ts.map +1 -0
- package/dist/io/hsan-parser.js +118 -0
- package/dist/io/hsan-parser.js.map +1 -0
- package/dist/io/index.d.ts +3 -0
- package/dist/io/index.d.ts.map +1 -0
- package/dist/io/index.js +8 -0
- package/dist/io/index.js.map +1 -0
- package/dist/moves/index.d.ts +22 -0
- package/dist/moves/index.d.ts.map +1 -0
- package/dist/moves/index.js +39 -0
- package/dist/moves/index.js.map +1 -0
- package/dist/standalone.d.ts +64 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/standalone.js +323 -0
- package/dist/standalone.js.map +1 -0
- package/dist/types/board.d.ts +38 -0
- package/dist/types/board.d.ts.map +1 -0
- package/dist/types/board.js +7 -0
- package/dist/types/board.js.map +1 -0
- package/dist/types/game.d.ts +45 -0
- package/dist/types/game.d.ts.map +1 -0
- package/dist/types/game.js +7 -0
- package/dist/types/game.js.map +1 -0
- package/dist/types/move.d.ts +24 -0
- package/dist/types/move.d.ts.map +1 -0
- package/dist/types/move.js +7 -0
- package/dist/types/move.js.map +1 -0
- package/dist/types/piece.d.ts +50 -0
- package/dist/types/piece.d.ts.map +1 -0
- package/dist/types/piece.js +29 -0
- package/dist/types/piece.js.map +1 -0
- package/dist/utils/square-notation.d.ts +14 -0
- package/dist/utils/square-notation.d.ts.map +1 -0
- package/dist/utils/square-notation.js +27 -0
- package/dist/utils/square-notation.js.map +1 -0
- package/dist/wasm/engine.d.ts +23 -0
- package/dist/wasm/engine.d.ts.map +1 -0
- package/dist/wasm/engine.js +37 -0
- package/dist/wasm/engine.js.map +1 -0
- package/dist/wasm/snapshot.d.ts +47 -0
- package/dist/wasm/snapshot.d.ts.map +1 -0
- package/dist/wasm/snapshot.js +125 -0
- package/dist/wasm/snapshot.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
// HyperChess Core — hyperchess-core
|
|
3
|
+
// File: packages/core/src/wasm/engine.ts
|
|
4
|
+
// Version: 1.0.0
|
|
5
|
+
// Copyright (c) 2026 HyperChess Developer Team
|
|
6
|
+
import { WasmBoard } from 'hyperchess-wasm';
|
|
7
|
+
export { snapshotFromWasmBoard, moveToUci, uciToMove } from './snapshot';
|
|
8
|
+
/**
|
|
9
|
+
* Loads a `WasmBoard` from the Rust engine — starting position if `hfen` is
|
|
10
|
+
* omitted, or parses `hfen` (throws via wasm-pack's `Option::None` → JS
|
|
11
|
+
* `undefined` if it's invalid; callers should check).
|
|
12
|
+
*
|
|
13
|
+
* Imports from the package root, not a specific wasm-pack target subpath:
|
|
14
|
+
* `hyperchess-wasm`'s package.json resolves this to the `nodejs` target
|
|
15
|
+
* under Node (loads synchronously via `fs`) and the `bundler` target
|
|
16
|
+
* everywhere else (a real bundler's module graph resolution is already
|
|
17
|
+
* async, so no explicit init call is needed here either — see
|
|
18
|
+
* docs/sdk-plan/WASM-MIGRATION-PLAN.md Phase 5).
|
|
19
|
+
*
|
|
20
|
+
* NOT usable for a bundler-free browser deployment (a bare
|
|
21
|
+
* `<script type="module">` import with no build step) — the `bundler`
|
|
22
|
+
* target this resolves to there fails to even load (it does a raw
|
|
23
|
+
* `import ... from "./x.wasm"`, which needs a bundler to handle). See
|
|
24
|
+
* `../standalone.ts` for that case instead, which uses the `web` target
|
|
25
|
+
* with an explicit async init and deliberately does NOT import this module.
|
|
26
|
+
*/
|
|
27
|
+
export function loadWasmBoard(hfen) {
|
|
28
|
+
if (!hfen) {
|
|
29
|
+
return new WasmBoard();
|
|
30
|
+
}
|
|
31
|
+
const board = WasmBoard.from_hfen(hfen);
|
|
32
|
+
if (!board) {
|
|
33
|
+
throw new Error(`Invalid HFEN: ${hfen}`);
|
|
34
|
+
}
|
|
35
|
+
return board;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/wasm/engine.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,oCAAoC;AACpC,yCAAyC;AACzC,iBAAiB;AACjB,+CAA+C;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEzE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,aAAa,CAAC,IAAa;IACzC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,SAAS,EAAE,CAAC;IACzB,CAAC;IACD,MAAM,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Board } from '../types/board';
|
|
2
|
+
import { Move } from '../types/move';
|
|
3
|
+
/**
|
|
4
|
+
* The subset of `WasmBoard`'s instance API these helpers need, expressed as
|
|
5
|
+
* a minimal structural interface rather than importing `hyperchess-wasm`'s
|
|
6
|
+
* own type. That keeps this module free of any dependency on a specific
|
|
7
|
+
* wasm-pack target, so both `wasm/engine.ts` (the main, Node/bundler-backed
|
|
8
|
+
* synchronous API) and `standalone.ts` (the no-bundler-browser async API)
|
|
9
|
+
* can share it without either pulling in the other's WASM loading strategy.
|
|
10
|
+
*/
|
|
11
|
+
export interface WasmBoardLike {
|
|
12
|
+
/** Pack the piece placement into one byte per square, where 0 means empty
|
|
13
|
+
* and the remaining values encode colour and piece type. */
|
|
14
|
+
encode(): Uint8Array;
|
|
15
|
+
/** Render the position as a HFEN string, the source of the fields
|
|
16
|
+
* (side to move, castling, en passant, clocks) that `encode()` omits. */
|
|
17
|
+
hfen(): string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Build a plain-JS `Board` snapshot from a `WasmBoard`-like instance.
|
|
21
|
+
*
|
|
22
|
+
* `Board` stays a plain data object (not the opaque WASM handle) so existing
|
|
23
|
+
* direct property access across the SDK (`board.pieces[i]`, `board.toMove`,
|
|
24
|
+
* etc. — used throughout `hyperchess-board`'s hooks and elsewhere) keeps
|
|
25
|
+
* working unchanged. The HFEN's own metadata fields (side to move, castling,
|
|
26
|
+
* en passant, clocks) are re-derived from `wasmBoard.hfen()` — the engine's
|
|
27
|
+
* own canonical output — rather than trusting whatever HFEN the caller passed
|
|
28
|
+
* in, so the snapshot always reflects what Rust actually parsed.
|
|
29
|
+
*/
|
|
30
|
+
export declare function snapshotFromWasmBoard(wasmBoard: WasmBoardLike, history?: Board['history']): Board;
|
|
31
|
+
/**
|
|
32
|
+
* Convert a structured `Move` to the UCI string `WasmBoard.apply_move`
|
|
33
|
+
* expects (source + destination algebraic squares, plus a lowercase
|
|
34
|
+
* promotion letter — matching `HyperMove::stringify()` in the Rust engine;
|
|
35
|
+
* no `=` separator, unlike this SDK's own algebraic/HSAN notation).
|
|
36
|
+
*/
|
|
37
|
+
export declare function moveToUci(move: Move): string;
|
|
38
|
+
/**
|
|
39
|
+
* Parse a UCI move string (as returned by `WasmBoard.legal_moves()`) into a
|
|
40
|
+
* structured `Move`, inferring `isCastling`/`isEnPassant` from board context
|
|
41
|
+
* — the UCI string alone doesn't flag these (it's just src+dst+promo), so
|
|
42
|
+
* they're derived the same way the old hand-written move generator did: a
|
|
43
|
+
* king moving 2 files is always castling (its only 2-file move), and a pawn
|
|
44
|
+
* capturing onto the recorded en passant square is always en passant.
|
|
45
|
+
*/
|
|
46
|
+
export declare function uciToMove(uci: string, board: Board): Move;
|
|
47
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/wasm/snapshot.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAkB,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAkB,MAAM,eAAe,CAAC;AAKrD;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B;gEAC4D;IAC5D,MAAM,IAAI,UAAU,CAAC;IAErB;6EACyE;IACzE,IAAI,IAAI,MAAM,CAAC;CAChB;AA6BD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,aAAa,EAAE,OAAO,GAAE,KAAK,CAAC,SAAS,CAAM,GAAG,KAAK,CA4CrG;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAG5C;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAqBzD"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
// HyperChess Core — hyperchess-core
|
|
3
|
+
// File: packages/core/src/wasm/snapshot.ts
|
|
4
|
+
// Version: 1.0.0
|
|
5
|
+
// Copyright (c) 2026 HyperChess Developer Team
|
|
6
|
+
import { algebraicToSquare, squareToAlgebraic } from '../utils/square-notation';
|
|
7
|
+
import { parseHfenPosition } from '../board/hfen';
|
|
8
|
+
/** Piece type in `WasmBoard.encode()`'s byte order (index 0 unused — 0 means empty). */
|
|
9
|
+
const ENCODE_PIECE_ORDER = ['P', 'N', 'B', 'R', 'Q', 'K', 'E', 'H'];
|
|
10
|
+
function decodePieceByte(byte) {
|
|
11
|
+
if (byte === 0)
|
|
12
|
+
return undefined;
|
|
13
|
+
const color = byte <= 8 ? 'white' : 'black';
|
|
14
|
+
const type = ENCODE_PIECE_ORDER[(byte <= 8 ? byte : byte - 8) - 1];
|
|
15
|
+
return { type, color };
|
|
16
|
+
}
|
|
17
|
+
function parseCastlingRights(castlingStr) {
|
|
18
|
+
return {
|
|
19
|
+
whiteKingSide: castlingStr.includes('K'),
|
|
20
|
+
whiteQueenSide: castlingStr.includes('Q'),
|
|
21
|
+
blackKingSide: castlingStr.includes('k'),
|
|
22
|
+
blackQueenSide: castlingStr.includes('q'),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Parse an en passant square (e.g. "e3", "-" for none) from a HFEN field. */
|
|
26
|
+
function parseEnPassant(enPassantStr) {
|
|
27
|
+
if (enPassantStr === '-')
|
|
28
|
+
return -1;
|
|
29
|
+
const match = enPassantStr.match(/^([a-l])(1[0-2]|[1-9])$/);
|
|
30
|
+
if (!match)
|
|
31
|
+
return -1;
|
|
32
|
+
return algebraicToSquare(match[1] + match[2]);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Build a plain-JS `Board` snapshot from a `WasmBoard`-like instance.
|
|
36
|
+
*
|
|
37
|
+
* `Board` stays a plain data object (not the opaque WASM handle) so existing
|
|
38
|
+
* direct property access across the SDK (`board.pieces[i]`, `board.toMove`,
|
|
39
|
+
* etc. — used throughout `hyperchess-board`'s hooks and elsewhere) keeps
|
|
40
|
+
* working unchanged. The HFEN's own metadata fields (side to move, castling,
|
|
41
|
+
* en passant, clocks) are re-derived from `wasmBoard.hfen()` — the engine's
|
|
42
|
+
* own canonical output — rather than trusting whatever HFEN the caller passed
|
|
43
|
+
* in, so the snapshot always reflects what Rust actually parsed.
|
|
44
|
+
*/
|
|
45
|
+
export function snapshotFromWasmBoard(wasmBoard, history = []) {
|
|
46
|
+
const hfen = wasmBoard.hfen();
|
|
47
|
+
const hfenParts = hfen.split(' ');
|
|
48
|
+
const [positionStr, toMoveStr, castlingStr, enPassantStr, halfmoveStr, fullmoveStr] = hfenParts;
|
|
49
|
+
// Piece placement comes from `encode()` (one byte per square: colour +
|
|
50
|
+
// current type), which is authoritative for *what* each piece is but knows
|
|
51
|
+
// nothing about *which* piece it is. Identity is recovered from the
|
|
52
|
+
// engine's own HFEN-I position field and merged in, so the snapshot — and
|
|
53
|
+
// therefore everything `getBoardHfen` later re-serializes — keeps it.
|
|
54
|
+
//
|
|
55
|
+
// `encode()` stays the source of truth for type and colour; the parsed
|
|
56
|
+
// position only contributes the identity character. That way a disagreement
|
|
57
|
+
// between the two cannot change the position, and a legacy type-only HFEN
|
|
58
|
+
// simply contributes no identity at all.
|
|
59
|
+
const pieces = Array.from(wasmBoard.encode()).map(decodePieceByte);
|
|
60
|
+
let identities;
|
|
61
|
+
try {
|
|
62
|
+
identities = parseHfenPosition(positionStr);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// A position field the engine emitted but this parser cannot read is not
|
|
66
|
+
// worth failing the snapshot over — the board is still correct, it just
|
|
67
|
+
// carries no identity. (The Rust side is the canonical parser.)
|
|
68
|
+
identities = undefined;
|
|
69
|
+
}
|
|
70
|
+
if (identities) {
|
|
71
|
+
for (let sq = 0; sq < pieces.length; sq++) {
|
|
72
|
+
const identity = identities[sq]?.identity;
|
|
73
|
+
const piece = pieces[sq];
|
|
74
|
+
if (piece && identity) {
|
|
75
|
+
pieces[sq] = { ...piece, identity };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
pieces,
|
|
81
|
+
toMove: toMoveStr === 'w' ? 'white' : 'black',
|
|
82
|
+
enPassantSquare: parseEnPassant(enPassantStr),
|
|
83
|
+
castlingRights: parseCastlingRights(castlingStr),
|
|
84
|
+
halfmoveClock: parseInt(halfmoveStr, 10),
|
|
85
|
+
fullmoveNumber: parseInt(fullmoveStr || '1', 10),
|
|
86
|
+
history,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Convert a structured `Move` to the UCI string `WasmBoard.apply_move`
|
|
91
|
+
* expects (source + destination algebraic squares, plus a lowercase
|
|
92
|
+
* promotion letter — matching `HyperMove::stringify()` in the Rust engine;
|
|
93
|
+
* no `=` separator, unlike this SDK's own algebraic/HSAN notation).
|
|
94
|
+
*/
|
|
95
|
+
export function moveToUci(move) {
|
|
96
|
+
const promo = move.promotion ? move.promotion.toLowerCase() : '';
|
|
97
|
+
return `${squareToAlgebraic(move.from)}${squareToAlgebraic(move.to)}${promo}`;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Parse a UCI move string (as returned by `WasmBoard.legal_moves()`) into a
|
|
101
|
+
* structured `Move`, inferring `isCastling`/`isEnPassant` from board context
|
|
102
|
+
* — the UCI string alone doesn't flag these (it's just src+dst+promo), so
|
|
103
|
+
* they're derived the same way the old hand-written move generator did: a
|
|
104
|
+
* king moving 2 files is always castling (its only 2-file move), and a pawn
|
|
105
|
+
* capturing onto the recorded en passant square is always en passant.
|
|
106
|
+
*/
|
|
107
|
+
export function uciToMove(uci, board) {
|
|
108
|
+
const match = uci.match(/^([a-l](?:1[0-2]|[1-9]))([a-l](?:1[0-2]|[1-9]))([qrbneh])?$/);
|
|
109
|
+
if (!match) {
|
|
110
|
+
throw new Error(`Invalid UCI move string: ${uci}`);
|
|
111
|
+
}
|
|
112
|
+
const from = algebraicToSquare(match[1]);
|
|
113
|
+
const to = algebraicToSquare(match[2]);
|
|
114
|
+
const promotion = match[3] ? match[3].toUpperCase() : undefined;
|
|
115
|
+
const piece = board.pieces[from];
|
|
116
|
+
const move = { from, to, promotion };
|
|
117
|
+
if (piece?.type === 'K' && Math.abs((from % 12) - (to % 12)) === 2) {
|
|
118
|
+
move.isCastling = true;
|
|
119
|
+
}
|
|
120
|
+
if (piece?.type === 'P' && to === board.enPassantSquare && board.pieces[to] === undefined) {
|
|
121
|
+
move.isEnPassant = true;
|
|
122
|
+
}
|
|
123
|
+
return move;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../src/wasm/snapshot.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,oCAAoC;AACpC,2CAA2C;AAC3C,iBAAiB;AACjB,+CAA+C;AAM/C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,0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jC,MAAM,IAAI,GAAS,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAE3C,IAAI,KAAK,EAAE,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACnE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,CAAC;IACD,IAAI,KAAK,EAAE,IAAI,KAAK,GAAG,IAAI,EAAE,KAAK,KAAK,CAAC,eAAe,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,SAAS,EAAE,CAAC;QAC1F,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hyperchess-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "HyperChess core game logic - framework agnostic",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./board": {
|
|
14
|
+
"import": "./dist/board/index.js",
|
|
15
|
+
"types": "./dist/board/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./moves": {
|
|
18
|
+
"import": "./dist/moves/index.js",
|
|
19
|
+
"types": "./dist/moves/index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./game": {
|
|
22
|
+
"import": "./dist/game/index.js",
|
|
23
|
+
"types": "./dist/game/index.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./standalone": {
|
|
26
|
+
"import": "./dist/standalone.js",
|
|
27
|
+
"types": "./dist/standalone.d.ts"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"keywords": [
|
|
35
|
+
"hyperchess",
|
|
36
|
+
"chess",
|
|
37
|
+
"chess-variant",
|
|
38
|
+
"board",
|
|
39
|
+
"game",
|
|
40
|
+
"logic",
|
|
41
|
+
"engine"
|
|
42
|
+
],
|
|
43
|
+
"author": "HyperChess Contributors",
|
|
44
|
+
"license": "GPL-3.0-or-later",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/KyrpyDev/hyperchess-core.git",
|
|
48
|
+
"directory": "packages/core"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/KyrpyDev/hyperchess-core#readme",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/KyrpyDev/hyperchess-core/issues"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=18"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"hyperchess-wasm": "0.1.0"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"esbuild": "^0.28.0",
|
|
65
|
+
"typescript": "^5.2.0",
|
|
66
|
+
"vitest": "^0.34.0"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build": "tsc && npm run build:standalone-bundle",
|
|
70
|
+
"build:standalone-bundle": "esbuild src/standalone.ts --bundle --format=esm --platform=browser --target=es2022 --external:hyperchess-wasm/web --outfile=dist/standalone.js",
|
|
71
|
+
"test": "vitest run",
|
|
72
|
+
"test:watch": "vitest"
|
|
73
|
+
}
|
|
74
|
+
}
|