cpsat-js 0.1.0-beta.1 → 1.0.0
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.md +15 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -5,9 +5,23 @@ WebAssembly port of Google OR-Tools' CP-SAT constraint programming solver. Runs
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install cpsat-js
|
|
8
|
+
npm install cpsat-js
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Using with Vite
|
|
12
|
+
|
|
13
|
+
Add `cpsat-js` to `optimizeDeps.exclude` in your `vite.config.ts`:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
export default defineConfig({
|
|
17
|
+
optimizeDeps: {
|
|
18
|
+
exclude: ['cpsat-js'],
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Without this, Vite's dep pre-bundler (esbuild) copies the package into `node_modules/.vite/deps/` and breaks the relative `new URL('../../build/cpsat.wasm', import.meta.url)` lookup — the dev server then returns the SPA HTML fallback for the WASM request, and Emscripten fails with `CompileError: expected magic word 00 61 73 6d, found 3c 21 64 6f` (`<!do`... from the HTML). Excluding the package routes it through Vite's main asset pipeline, which rewrites the URL correctly. Production builds (`vite build`) don't use the pre-bundler and work without this flag, but it's harmless to set in both.
|
|
24
|
+
|
|
11
25
|
## Quick Start
|
|
12
26
|
|
|
13
27
|
```typescript
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cpsat-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "WebAssembly port of Google OR-Tools CP-SAT constraint programming solver",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"url": "https://github.com/owen-lacey/ortools-wasm/issues"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@bufbuild/protobuf": "^2.
|
|
49
|
+
"@bufbuild/protobuf": "^2.3.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@bufbuild/buf": "^1.47.0",
|
|
53
|
-
"@bufbuild/protoc-gen-es": "^2.
|
|
53
|
+
"@bufbuild/protoc-gen-es": "^2.3.0",
|
|
54
54
|
"@types/node": "^25.6.0",
|
|
55
55
|
"typescript": "^5.6.0",
|
|
56
56
|
"vitest": "^3.0.0"
|