@ohtaman/washi 0.1.0 → 0.1.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.
- package/README.ja.md +42 -2
- package/README.md +42 -2
- package/README.zh-CN.md +42 -2
- package/dist/lib/assets/{highs-worker-D57nd9KC.js → highs-worker-DeDWU6KI.js} +1 -1
- package/dist/lib/demo/highs.wasm +0 -0
- package/dist/lib/solvers/z3.js +1 -1
- package/dist/lib/washi-logo.png +0 -0
- package/dist/lib/washi-logo.svg +70 -0
- package/dist/lib/washi.js +78 -78
- package/dist/lib/{z3-C5DfllfD.js → z3-C8g-PtmP.js} +79 -59
- package/dist/types/highs-loader.d.ts +17 -1
- package/dist/types/highs-loader.d.ts.map +1 -1
- package/dist/types/highs-worker-client.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -2
package/README.ja.md
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
<a href="./README.zh-CN.md">简体中文</a>
|
|
15
15
|
</p>
|
|
16
16
|
<p>
|
|
17
|
-
<a href="https://ohtaman.github.io/washi/"><img src="https://img.shields.io/badge/
|
|
17
|
+
<a href="https://ohtaman.github.io/washi/"><img src="https://img.shields.io/badge/docs-online-blue" alt="docs" /></a>
|
|
18
|
+
<a href="https://ohtaman.github.io/washi/demo/"><img src="https://img.shields.io/badge/demo-playground-brightgreen" alt="live demo" /></a>
|
|
18
19
|
<a href="https://www.npmjs.com/package/@ohtaman/washi"><img src="https://img.shields.io/npm/v/@ohtaman/washi?color=crimson&label=npm" alt="npm version" /></a>
|
|
19
20
|
<a href="https://bundlephobia.com/package/@ohtaman/washi"><img src="https://img.shields.io/badge/bundle%20size-7.2%20kB%20(gzip)-blue" alt="bundle size" /></a>
|
|
20
21
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="license" /></a>
|
|
@@ -297,6 +298,44 @@ console.log(`x = ${value(x)}, y = ${value(y)}`);
|
|
|
297
298
|
|
|
298
299
|
---
|
|
299
300
|
|
|
301
|
+
## 🌐 ブラウザ & Web Worker での利用方法
|
|
302
|
+
|
|
303
|
+
WaSHI は、モダンなブラウザ、フロントエンドフレームワーク(Vite, Next.js, React, Vue, Svelte)、および Web Worker 上でゼロコンフィグで動作するように設計されています。
|
|
304
|
+
|
|
305
|
+
### 1. ゼロコンフィグ動作(公式 CDN 自動フォールバック)
|
|
306
|
+
ブラウザ環境において、オリジンルートに `highs.wasm` が配置されていない場合、WaSHI は自動的に公式 jsDelivr CDN から安全にバイナリを取得します。追加の設定コードやファイルコピーは一切不要です:
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
import { Model } from "@ohtaman/washi";
|
|
310
|
+
|
|
311
|
+
const model = new Model();
|
|
312
|
+
// ... 変数・制約の定義
|
|
313
|
+
await model.solve(); // 設定なしで即座に動作!
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### 2. モダンバンドラーでの自前アセット管理(Vite / Webpack / Rollup)
|
|
317
|
+
`highs.wasm` を自分のアプリケーションの静的アセット(ハッシュ付き配信)として自前ホストしたい場合:
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
import wasmUrl from "@ohtaman/washi/highs.wasm?url";
|
|
321
|
+
import { setHighsWasmUrl } from "@ohtaman/washi";
|
|
322
|
+
|
|
323
|
+
// アプリ起動時に一度だけ設定
|
|
324
|
+
setHighsWasmUrl(wasmUrl);
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### 3. 社内イントラ・完全オフライン(Air-gapped)環境での利用
|
|
328
|
+
外部 CDN への通信が禁止されている社内イントラやオフライン環境の場合:
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
import { setHighsWasmUrl } from "@ohtaman/washi";
|
|
332
|
+
|
|
333
|
+
// 自前の静的ファイル配信パスを指定(外部 CDN へのフォールバックは完全無効化されます)
|
|
334
|
+
setHighsWasmUrl("/static/highs.wasm");
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
300
339
|
## 💻 サンプルスクリプト & インタラクティブ Web デモ
|
|
301
340
|
|
|
302
341
|
`examples/node/` 配下に実行可能なスタンドアロンスクリプトを用意しています:
|
|
@@ -314,7 +353,8 @@ npx tsx examples/node/06-pulp-compatibility.ts
|
|
|
314
353
|
|
|
315
354
|
```bash
|
|
316
355
|
npm run dev
|
|
317
|
-
#
|
|
356
|
+
# ドキュメント: http://localhost:5173/
|
|
357
|
+
# インタラクティブデモ: http://localhost:5173/demo/
|
|
318
358
|
```
|
|
319
359
|
|
|
320
360
|
---
|
package/README.md
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
<a href="./README.zh-CN.md">简体中文</a>
|
|
15
15
|
</p>
|
|
16
16
|
<p>
|
|
17
|
-
<a href="https://ohtaman.github.io/washi/"><img src="https://img.shields.io/badge/
|
|
17
|
+
<a href="https://ohtaman.github.io/washi/"><img src="https://img.shields.io/badge/docs-online-blue" alt="docs" /></a>
|
|
18
|
+
<a href="https://ohtaman.github.io/washi/demo/"><img src="https://img.shields.io/badge/demo-playground-brightgreen" alt="live demo" /></a>
|
|
18
19
|
<a href="https://www.npmjs.com/package/@ohtaman/washi"><img src="https://img.shields.io/npm/v/@ohtaman/washi?color=crimson&label=npm" alt="npm version" /></a>
|
|
19
20
|
<a href="https://bundlephobia.com/package/@ohtaman/washi"><img src="https://img.shields.io/badge/bundle%20size-7.2%20kB%20(gzip)-blue" alt="bundle size" /></a>
|
|
20
21
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="license" /></a>
|
|
@@ -297,6 +298,44 @@ console.log(`x = ${value(x)}, y = ${value(y)}`);
|
|
|
297
298
|
|
|
298
299
|
---
|
|
299
300
|
|
|
301
|
+
## 🌐 Browser & Web Worker Usage
|
|
302
|
+
|
|
303
|
+
WaSHI is engineered for seamless execution in modern browsers, frontend frameworks (Vite, Next.js, React, Vue, Svelte), and Web Workers.
|
|
304
|
+
|
|
305
|
+
### 1. Zero-Config Mode (Automatic CDN Fallback)
|
|
306
|
+
In browser environments, if `highs.wasm` is not found on your local origin, WaSHI automatically falls back to the official jsDelivr CDN. You can optimize without copying files or writing boilerplate:
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
import { Model } from "@ohtaman/washi";
|
|
310
|
+
|
|
311
|
+
const model = new Model();
|
|
312
|
+
// ... define variables & constraints
|
|
313
|
+
await model.solve(); // Works instantly with zero setup!
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### 2. Bundler-Native Asset Hosting (Vite / Webpack / Rollup)
|
|
317
|
+
To bundle and self-host `highs.wasm` as a versioned, hashed static asset with your application:
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
import wasmUrl from "@ohtaman/washi/highs.wasm?url";
|
|
321
|
+
import { setHighsWasmUrl } from "@ohtaman/washi";
|
|
322
|
+
|
|
323
|
+
// Configure once at app startup
|
|
324
|
+
setHighsWasmUrl(wasmUrl);
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### 3. Air-Gapped & Enterprise Offline Environments
|
|
328
|
+
In strict enterprise intranet or air-gapped environments where external CDN network access is disallowed:
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
import { setHighsWasmUrl } from "@ohtaman/washi";
|
|
332
|
+
|
|
333
|
+
// Point strictly to your internal assets (completely disables CDN fallback)
|
|
334
|
+
setHighsWasmUrl("/static/highs.wasm");
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
300
339
|
## 💻 CLI & Interactive Demos
|
|
301
340
|
|
|
302
341
|
Ready-to-run standalone examples are available in `examples/node/`:
|
|
@@ -314,7 +353,8 @@ To run the interactive browser showcase (`examples/web-demo`):
|
|
|
314
353
|
|
|
315
354
|
```bash
|
|
316
355
|
npm run dev
|
|
317
|
-
#
|
|
356
|
+
# Documentation: http://localhost:5173/
|
|
357
|
+
# Interactive Demo: http://localhost:5173/demo/
|
|
318
358
|
```
|
|
319
359
|
|
|
320
360
|
---
|
package/README.zh-CN.md
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
<a href="./README.zh-CN.md">简体中文</a>
|
|
15
15
|
</p>
|
|
16
16
|
<p>
|
|
17
|
-
<a href="https://ohtaman.github.io/washi/"><img src="https://img.shields.io/badge/
|
|
17
|
+
<a href="https://ohtaman.github.io/washi/"><img src="https://img.shields.io/badge/docs-online-blue" alt="docs" /></a>
|
|
18
|
+
<a href="https://ohtaman.github.io/washi/demo/"><img src="https://img.shields.io/badge/demo-playground-brightgreen" alt="live demo" /></a>
|
|
18
19
|
<a href="https://www.npmjs.com/package/@ohtaman/washi"><img src="https://img.shields.io/npm/v/@ohtaman/washi?color=crimson&label=npm" alt="npm version" /></a>
|
|
19
20
|
<a href="https://bundlephobia.com/package/@ohtaman/washi"><img src="https://img.shields.io/badge/bundle%20size-7.2%20kB%20(gzip)-blue" alt="bundle size" /></a>
|
|
20
21
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="license" /></a>
|
|
@@ -297,6 +298,44 @@ console.log(`x = ${value(x)}, y = ${value(y)}`);
|
|
|
297
298
|
|
|
298
299
|
---
|
|
299
300
|
|
|
301
|
+
## 🌐 浏览器与 Web Worker 使用指南
|
|
302
|
+
|
|
303
|
+
WaSHI 原生支持在现代网页浏览器、前端主流框架(Vite、Next.js、React、Vue、Svelte)以及 Web Worker 中运行。
|
|
304
|
+
|
|
305
|
+
### 1. 零配置模式(官方 CDN 智能回退)
|
|
306
|
+
在浏览器环境下,若当前域名根路径未部署 `highs.wasm`,WaSHI 会自动从官方 jsDelivr 高速 CDN 安全拉取二进制文件。您无需任何额外配置或文件复制:
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
import { Model } from "@ohtaman/washi";
|
|
310
|
+
|
|
311
|
+
const model = new Model();
|
|
312
|
+
// ... 定义变量与约束
|
|
313
|
+
await model.solve(); // 零配置即可直接运行!
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### 2. 现代打包工具自托管(Vite / Webpack / Rollup)
|
|
317
|
+
如果您希望将 `highs.wasm` 作为项目打包产物的一部分进行自托管与版本哈希管理:
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
import wasmUrl from "@ohtaman/washi/highs.wasm?url";
|
|
321
|
+
import { setHighsWasmUrl } from "@ohtaman/washi";
|
|
322
|
+
|
|
323
|
+
// 在应用入口处配置一次
|
|
324
|
+
setHighsWasmUrl(wasmUrl);
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### 3. 企业内网与完全离线(Air-gapped)环境
|
|
328
|
+
针对严禁外部 CDN 请求的企业内网或纯离线环境:
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
import { setHighsWasmUrl } from "@ohtaman/washi";
|
|
332
|
+
|
|
333
|
+
// 指定内部静态资源路径(将完全禁用外部 CDN 回退)
|
|
334
|
+
setHighsWasmUrl("/static/highs.wasm");
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
300
339
|
## 💻 本地脚本与交互式 Web 演示
|
|
301
340
|
|
|
302
341
|
在 `examples/node/` 中提供了即开即用的独立脚本:
|
|
@@ -314,7 +353,8 @@ npx tsx examples/node/06-pulp-compatibility.ts
|
|
|
314
353
|
|
|
315
354
|
```bash
|
|
316
355
|
npm run dev
|
|
317
|
-
#
|
|
356
|
+
# 文档主页: http://localhost:5173/
|
|
357
|
+
# 交互式 Demo: http://localhost:5173/demo/
|
|
318
358
|
```
|
|
319
359
|
|
|
320
360
|
---
|