wllama-service 2.0.3 → 2.0.4

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/package.json CHANGED
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "name": "wllama-service",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Framework-agnostic browser LLM service wrapper with WebGPU and WebAssembly support",
5
5
  "main": "./dist/index.js",
6
- "bin": {
7
- "copy-wllama-wasm": "./scripts/postinstall.js"
8
- },
9
6
  "module": "./dist/index.mjs",
10
7
  "types": "./dist/index.d.ts",
11
8
  "exports": {
@@ -20,7 +17,6 @@
20
17
  "README.md"
21
18
  ],
22
19
  "scripts": {
23
- "postinstall": "node scripts/postinstall.js",
24
20
  "build": "tsup",
25
21
  "dev": "tsup --watch",
26
22
  "typecheck": "tsc --noEmit",
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- const fs = require('fs');
5
- const path = require('path');
6
-
7
- /**
8
- * Resolve @wllama/wllama's wasm file using Node's real module resolution
9
- * instead of a guessed relative path. This works correctly regardless of
10
- * where in the yarn workspaces hoisting tree @wllama/wllama actually
11
- * landed (monorepo root, nested under wllama-service, etc) — Node's own
12
- * require.resolve algorithm finds it the same way `require()` would.
13
- */
14
- function resolveWasmSrc() {
15
- const pkgJsonPath = require.resolve('@wllama/wllama/package.json', {
16
- paths: [process.cwd()],
17
- });
18
- const pkgRoot = path.dirname(pkgJsonPath);
19
-
20
- // Different @wllama/wllama versions ship different layouts:
21
- // older: esm/wasm/wllama.wasm
22
- // newer: esm/single-thread/wllama.wasm (+ esm/multi-thread/wllama.wasm)
23
- const candidates = [
24
- path.join(pkgRoot, 'esm', 'wasm', 'wllama.wasm'),
25
- path.join(pkgRoot, 'esm', 'single-thread', 'wllama.wasm'),
26
- ];
27
- const found = candidates.find((p) => fs.existsSync(p));
28
- if (!found) {
29
- throw new Error(
30
- `wllama.wasm not found in any known location under ${pkgRoot}\n` +
31
- `Checked: ${candidates.join(', ')}`,
32
- );
33
- }
34
- return found;
35
- }
36
-
37
- // Destination: this app's own public folder. Adjust this path if your
38
- // app's public folder lives somewhere other than apps/<this-app>/public
39
- // relative to where this script sits.
40
- const destDir = path.resolve(__dirname, '..', 'public', 'wllama');
41
-
42
- let wasmSrc;
43
- try {
44
- wasmSrc = resolveWasmSrc();
45
- } catch (err) {
46
- console.warn('[copy-wllama-wasm] ' + err.message);
47
- process.exit(0);
48
- }
49
-
50
- fs.mkdirSync(destDir, { recursive: true });
51
- const dest = path.join(destDir, 'wllama.wasm');
52
- fs.copyFileSync(wasmSrc, dest);
53
- console.log(`[copy-wllama-wasm] ✓ Copied ${wasmSrc} -> ${dest}`);