motely-wasm 5.6.0 → 5.6.1

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 (2) hide show
  1. package/package.json +37 -33
  2. package/postinstall.mjs +31 -0
package/package.json CHANGED
@@ -1,33 +1,37 @@
1
- {
2
- "name": "motely-wasm",
3
- "version": "5.6.0",
4
- "description": "Motely seed search engine - Bootsharp WASM (browser)",
5
- "type": "module",
6
- "main": "./index.mjs",
7
- "types": "./types/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./types/index.d.ts",
11
- "import": "./index.mjs",
12
- "default": "./index.mjs"
13
- }
14
- },
15
- "files": [
16
- "index.mjs",
17
- "types/"
18
- ],
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/OptimusPi/MotelyJAML.git",
22
- "directory": "Motely.BrowserWasm"
23
- },
24
- "license": "MIT",
25
- "keywords": [
26
- "balatro",
27
- "seed",
28
- "wasm",
29
- "bootsharp",
30
- "browser",
31
- "jaml"
32
- ]
33
- }
1
+ {
2
+ "name": "motely-wasm",
3
+ "version": "5.6.1",
4
+ "description": "Motely seed search engine - Bootsharp WASM (browser)",
5
+ "type": "module",
6
+ "main": "./index.mjs",
7
+ "types": "./types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./types/index.d.ts",
11
+ "import": "./index.mjs",
12
+ "default": "./index.mjs"
13
+ }
14
+ },
15
+ "files": [
16
+ "index.mjs",
17
+ "types/",
18
+ "postinstall.mjs"
19
+ ],
20
+ "scripts": {
21
+ "postinstall": "node postinstall.mjs"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/OptimusPi/MotelyJAML.git",
26
+ "directory": "Motely.BrowserWasm"
27
+ },
28
+ "license": "MIT",
29
+ "keywords": [
30
+ "balatro",
31
+ "seed",
32
+ "wasm",
33
+ "bootsharp",
34
+ "browser",
35
+ "jaml"
36
+ ]
37
+ }
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * motely-wasm postinstall — copies index.mjs + types to the consumer's
4
+ * public/motely-wasm/ so the browser can load the ES module at runtime.
5
+ *
6
+ * Uses INIT_CWD (set by npm/pnpm/yarn) to find the project root.
7
+ * For pnpm: run `pnpm approve-builds` to allow this script.
8
+ */
9
+ import { cpSync, existsSync, mkdirSync, rmSync, statSync } from "node:fs";
10
+ import { dirname, join } from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+
13
+ const pkgDir = dirname(fileURLToPath(import.meta.url));
14
+ const projectRoot = process.env.INIT_CWD;
15
+
16
+ if (!projectRoot) {
17
+ console.warn("[motely-wasm] INIT_CWD not set — skipping postinstall.");
18
+ process.exit(0);
19
+ }
20
+
21
+ const dest = join(projectRoot, "public", "motely-wasm");
22
+
23
+ // Clean previous copy
24
+ if (existsSync(dest)) rmSync(dest, { recursive: true });
25
+ mkdirSync(dest, { recursive: true });
26
+
27
+ // Copy package contents (dereference symlinks for pnpm)
28
+ cpSync(pkgDir, dest, { recursive: true, dereference: true });
29
+
30
+ const bytes = statSync(join(dest, "index.mjs")).size;
31
+ console.log(`[motely-wasm] Installed → public/motely-wasm (${(bytes / 1e6).toFixed(1)} MB)`);