Skip to content

Commit

Permalink
pnpm build
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbedard committed Feb 4, 2024
1 parent 991f209 commit a8949fe
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 32 deletions.
30 changes: 20 additions & 10 deletions pkg/hexchess.d.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
/* tslint:disable */
/* eslint-disable */
/**
* Execute hexchess notation
* Execute notation on hexchess object
* @param {Hexchess} hexchess
* @param {Notation} notation
* @returns {Hexchess}
*/
export function apply(hexchess: Hexchess, notation: Notation): Hexchess;
export function applyNotation(hexchess: Hexchess, notation: Notation): Hexchess;
/**
* Parse algebraic hexchess notation
* @param {string} str
* @returns {Notation}
* Create empty hexchess object
* @returns {Hexchess}
*/
export function createHexchess(): Hexchess;
/**
* Create hexchess object with initial position
* @returns {Hexchess}
*/
export function notation(str: string): Notation;
export function createHexchessInitial(): Hexchess;
/**
* Parse hexchess FEN string
* Create hexchess object from string
* @param {string} fen
* @returns {Hexchess}
*/
export function parse(fen: string): Hexchess;
export function parseHexchess(fen: string): Hexchess;
/**
* Create hexchess notation object from string
* @param {string} str
* @returns {Notation}
*/
export function parseNotation(str: string): Notation;
/**
* Stringify hexchess object
* @param {Hexchess} hexchess
* @returns {string}
*/
export function stringify(hexchess: Hexchess): string;
export function stringifyHexchess(hexchess: Hexchess): string;
export interface Board {
a1: Piece | null;
a2: Piece | null;
Expand Down Expand Up @@ -142,6 +152,6 @@ export interface Notation {
}


export function targets(hexchess: Hexchess, position: Position): Notation[];
export function getTargets(hexchess: Hexchess, position: Position): Notation[];


52 changes: 35 additions & 17 deletions pkg/hexchess_bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,37 +123,55 @@ function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}
/**
* Execute hexchess notation
* Execute notation on hexchess object
* @param {Hexchess} hexchess
* @param {Notation} notation
* @returns {Hexchess}
*/
export function apply(hexchess, notation) {
const ret = wasm.apply(addHeapObject(hexchess), addHeapObject(notation));
export function applyNotation(hexchess, notation) {
const ret = wasm.applyNotation(addHeapObject(hexchess), addHeapObject(notation));
return takeObject(ret);
}

/**
* Parse algebraic hexchess notation
* @param {string} str
* @returns {Notation}
* Create empty hexchess object
* @returns {Hexchess}
*/
export function notation(str) {
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.notation(ptr0, len0);
export function createHexchess() {
const ret = wasm.createHexchess();
return takeObject(ret);
}

/**
* Create hexchess object with initial position
* @returns {Hexchess}
*/
export function createHexchessInitial() {
const ret = wasm.createHexchessInitial();
return takeObject(ret);
}

/**
* Parse hexchess FEN string
* Create hexchess object from string
* @param {string} fen
* @returns {Hexchess}
*/
export function parse(fen) {
export function parseHexchess(fen) {
const ptr0 = passStringToWasm0(fen, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.parse(ptr0, len0);
const ret = wasm.parseHexchess(ptr0, len0);
return takeObject(ret);
}

/**
* Create hexchess notation object from string
* @param {string} str
* @returns {Notation}
*/
export function parseNotation(str) {
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.parseNotation(ptr0, len0);
return takeObject(ret);
}

Expand All @@ -162,12 +180,12 @@ export function parse(fen) {
* @param {Hexchess} hexchess
* @returns {string}
*/
export function stringify(hexchess) {
export function stringifyHexchess(hexchess) {
let deferred1_0;
let deferred1_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.stringify(retptr, addHeapObject(hexchess));
wasm.stringifyHexchess(retptr, addHeapObject(hexchess));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
deferred1_0 = r0;
Expand All @@ -185,8 +203,8 @@ export function stringify(hexchess) {
* @param {Position} position
* @returns {any}
*/
export function targets(hexchess, position) {
const ret = wasm.targets(addHeapObject(hexchess), addHeapObject(position));
export function getTargets(hexchess, position) {
const ret = wasm.getTargets(addHeapObject(hexchess), addHeapObject(position));
return takeObject(ret);
}

Expand Down
Binary file modified pkg/hexchess_bg.wasm
Binary file not shown.
12 changes: 7 additions & 5 deletions pkg/hexchess_bg.wasm.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export function apply(a: number, b: number): number;
export function notation(a: number, b: number): number;
export function parse(a: number, b: number): number;
export function stringify(a: number, b: number): void;
export function targets(a: number, b: number): number;
export function applyNotation(a: number, b: number): number;
export function createHexchess(): number;
export function createHexchessInitial(): number;
export function parseHexchess(a: number, b: number): number;
export function parseNotation(a: number, b: number): number;
export function stringifyHexchess(a: number, b: number): void;
export function getTargets(a: number, b: number): number;
export function __wbindgen_malloc(a: number, b: number): number;
export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
export function __wbindgen_add_to_stack_pointer(a: number): number;
Expand Down

0 comments on commit a8949fe

Please sign in to comment.