deepwoken 0.1.4 → 0.1.5

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/generated.ts ADDED
@@ -0,0 +1,7 @@
1
+ // AUTO-GENERATED by build.rs do not edit thanks
2
+
3
+ export type Stat = "Strength" | "Fortitude" | "Agility" | "Intelligence" | "Willpower" | "Charisma" | "Heavy" | "Medium" | "Light" | "Frostdraw" | "Flamecharm" | "Thundercall" | "Galebreathe" | "Shadowcast" | "Ironsing" | "Bloodrend";
4
+
5
+ export const CORE_STATS: Stat[] = ["Strength", "Fortitude", "Agility", "Intelligence", "Willpower", "Charisma"];
6
+ export const WEAPON_STATS: Stat[] = ["Heavy", "Medium", "Light"];
7
+ export const ATTUNEMENT_STATS: Stat[] = ["Flamecharm", "Frostdraw", "Thundercall", "Galebreathe", "Shadowcast", "Ironsing", "Bloodrend"];
package/index.ts CHANGED
@@ -1,22 +1,21 @@
1
- export type { Talent, Weapon, Mantra, Outfit, Aspect, Stat } from './types.js';
1
+ export { ATTUNEMENT_STATS, CORE_STATS, WEAPON_STATS } from './types.js';
2
+ export type { Aspect, Mantra, Outfit, Stat, Talent, Weapon } from './types.js';
2
3
 
3
- import wasmInit, { DeepData as WasmDeepData } from './pkg/deepwoken.js';
4
- import type { Talent, Weapon, Mantra, Outfit, Aspect, Stat } from './types.js';
4
+ import type { Aspect, Mantra, Outfit, Talent, Weapon } from './types.js';
5
+
6
+ // dynamically import wasm bc the server will try to load wasm regardless man
7
+ let WasmDeepData: typeof import('./pkg/deepwoken.js').DeepData;
5
8
 
6
9
  if (typeof window !== 'undefined') {
7
- await wasmInit();
10
+ const wasm = await import('./pkg/deepwoken.js');
11
+ await wasm.default();
12
+ WasmDeepData = wasm.DeepData;
8
13
  }
9
14
 
10
- import { coreStats, weaponStats, attunementStats } from './pkg/deepwoken.js';
11
-
12
- export const CORE_STATS: Stat[] = coreStats();
13
- export const WEAPON_STATS: Stat[] = weaponStats();
14
- export const ATTUNEMENT_STATS: Stat[] = attunementStats();
15
-
16
15
  export class DeepData {
17
- private _wasm: WasmDeepData;
16
+ private _wasm: any;
18
17
 
19
- private constructor(wasm: WasmDeepData) {
18
+ private constructor(wasm: any) {
20
19
  this._wasm = wasm;
21
20
  }
22
21
 
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "deepwoken",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
7
7
  "files": [
8
8
  "index.ts",
9
9
  "types.ts",
10
+ "generated.ts",
10
11
  "pkg/deepwoken_bg.wasm",
11
12
  "pkg/deepwoken.js",
12
13
  "pkg/deepwoken.d.ts"
@@ -29,19 +29,11 @@ export class DeepData {
29
29
  weapons(): any;
30
30
  }
31
31
 
32
- export function attunementStats(): any;
33
-
34
- export function coreStats(): any;
35
-
36
- export function weaponStats(): any;
37
-
38
32
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
39
33
 
40
34
  export interface InitOutput {
41
35
  readonly memory: WebAssembly.Memory;
42
36
  readonly __wbg_deepdata_free: (a: number, b: number) => void;
43
- readonly attunementStats: () => [number, number, number];
44
- readonly coreStats: () => [number, number, number];
45
37
  readonly deepdata_aspects: (a: number) => [number, number, number];
46
38
  readonly deepdata_fetchLatest: () => any;
47
39
  readonly deepdata_fetchLatestFrom: (a: number, b: number, c: number, d: number) => any;
@@ -55,7 +47,6 @@ export interface InitOutput {
55
47
  readonly deepdata_outfits: (a: number) => [number, number, number];
56
48
  readonly deepdata_talents: (a: number) => [number, number, number];
57
49
  readonly deepdata_weapons: (a: number) => [number, number, number];
58
- readonly weaponStats: () => [number, number, number];
59
50
  readonly wasm_bindgen__closure__destroy__hf10da1d08ed9fc18: (a: number, b: number) => void;
60
51
  readonly wasm_bindgen__closure__destroy__he46194fcf4899997: (a: number, b: number) => void;
61
52
  readonly wasm_bindgen__convert__closures_____invoke__h71bc5879fd2abe15: (a: number, b: number, c: any) => [number, number];
package/pkg/deepwoken.js CHANGED
@@ -172,39 +172,6 @@ export class DeepData {
172
172
  }
173
173
  if (Symbol.dispose) DeepData.prototype[Symbol.dispose] = DeepData.prototype.free;
174
174
 
175
- /**
176
- * @returns {any}
177
- */
178
- export function attunementStats() {
179
- const ret = wasm.attunementStats();
180
- if (ret[2]) {
181
- throw takeFromExternrefTable0(ret[1]);
182
- }
183
- return takeFromExternrefTable0(ret[0]);
184
- }
185
-
186
- /**
187
- * @returns {any}
188
- */
189
- export function coreStats() {
190
- const ret = wasm.coreStats();
191
- if (ret[2]) {
192
- throw takeFromExternrefTable0(ret[1]);
193
- }
194
- return takeFromExternrefTable0(ret[0]);
195
- }
196
-
197
- /**
198
- * @returns {any}
199
- */
200
- export function weaponStats() {
201
- const ret = wasm.weaponStats();
202
- if (ret[2]) {
203
- throw takeFromExternrefTable0(ret[1]);
204
- }
205
- return takeFromExternrefTable0(ret[0]);
206
- }
207
-
208
175
  function __wbg_get_imports() {
209
176
  const import0 = {
210
177
  __proto__: null,
Binary file
package/types.ts CHANGED
@@ -1,10 +1,7 @@
1
- // copy the rust provided types (is there a better way to mirror types? man)
1
+ export type { Stat } from './generated.js';
2
+ export { CORE_STATS, WEAPON_STATS, ATTUNEMENT_STATS } from './generated.js';
2
3
 
3
- export type Stat =
4
- | "Strength" | "Fortitude" | "Agility" | "Intelligence" | "Willpower" | "Charisma"
5
- | "Heavy" | "Medium" | "Light"
6
- | "Frostdraw" | "Flamecharm" | "Thundercall" | "Galebreathe" | "Shadowcast" | "Ironsing" | "Bloodrend"
7
- | "Total";
4
+ import type { Stat } from './generated.js';
8
5
 
9
6
  export interface Talent {
10
7
  name: string;