@miden-sdk/vite-plugin 0.13.3

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/README.md +81 -0
  2. package/package.json +52 -0
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # @miden-sdk/vite-plugin
2
+
3
+ Vite plugin for Miden dApps. Automates WASM deduplication, cross-origin isolation headers, and gRPC-web proxy configuration.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @miden-sdk/vite-plugin --save-dev
9
+ # or
10
+ yarn add @miden-sdk/vite-plugin --dev
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```typescript
16
+ // vite.config.ts
17
+ import { defineConfig } from "vite";
18
+ import react from "@vitejs/plugin-react";
19
+ import { midenVitePlugin } from "@miden-sdk/vite-plugin";
20
+
21
+ export default defineConfig({
22
+ plugins: [
23
+ midenVitePlugin(), // zero-config: all defaults
24
+ react(),
25
+ ],
26
+ });
27
+ ```
28
+
29
+ ### With Options
30
+
31
+ ```typescript
32
+ midenVitePlugin({
33
+ rpcProxyTarget: "https://rpc.testnet.miden.io", // default
34
+ rpcProxyPath: "/rpc.Api", // default
35
+ crossOriginIsolation: true, // default
36
+ wasmPackages: ["@miden-sdk/miden-sdk"], // default
37
+ });
38
+ ```
39
+
40
+ ## What It Does
41
+
42
+ | Config | Purpose |
43
+ |--------|---------|
44
+ | `resolve.alias` | Force single copy of WASM module (avoids class identity issues) |
45
+ | `resolve.dedupe` | Vite deduplication hint |
46
+ | `resolve.preserveSymlinks` | Monorepo/symlink support |
47
+ | `optimizeDeps.exclude` | Don't pre-bundle WASM packages |
48
+ | `server.headers` (COOP/COEP) | SharedArrayBuffer for WASM workers |
49
+ | `server.proxy` | gRPC-web CORS bypass in dev |
50
+ | `build.target: "esnext"` | Top-level await for WASM |
51
+ | `worker.format: "es"` | ES module workers for WASM |
52
+
53
+ ## Options
54
+
55
+ ### `wasmPackages`
56
+ - **Type:** `string[]`
57
+ - **Default:** `["@miden-sdk/miden-sdk"]`
58
+ - Packages to deduplicate and exclude from pre-bundling.
59
+
60
+ ### `crossOriginIsolation`
61
+ - **Type:** `boolean`
62
+ - **Default:** `true`
63
+ - Adds `Cross-Origin-Opener-Policy` and `Cross-Origin-Embedder-Policy` headers to the dev server. Required for `SharedArrayBuffer` (used by WASM workers).
64
+
65
+ ### `rpcProxyTarget`
66
+ - **Type:** `string | false`
67
+ - **Default:** `"https://rpc.testnet.miden.io"`
68
+ - gRPC-web proxy target URL for the dev server. Set to `false` to disable.
69
+
70
+ ### `rpcProxyPath`
71
+ - **Type:** `string`
72
+ - **Default:** `"/rpc.Api"`
73
+ - Path prefix for gRPC-web proxy requests.
74
+
75
+ ## Requirements
76
+
77
+ - Vite 5.x or 6.x
78
+
79
+ ## License
80
+
81
+ MIT
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@miden-sdk/vite-plugin",
3
+ "version": "0.13.3",
4
+ "description": "Vite plugin for Miden dApps — WASM dedup, COOP/COEP headers, and gRPC-web proxy",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean",
21
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
22
+ "lint": "eslint src",
23
+ "typecheck": "tsc --noEmit"
24
+ },
25
+ "peerDependencies": {
26
+ "vite": "^5.0.0 || ^6.0.0"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "^20.0.0",
30
+ "tsup": "^8.0.0",
31
+ "typescript": "^5.0.0",
32
+ "vite": "^5.0.0"
33
+ },
34
+ "keywords": [
35
+ "miden",
36
+ "vite",
37
+ "plugin",
38
+ "wasm",
39
+ "blockchain",
40
+ "rollup",
41
+ "zk"
42
+ ],
43
+ "author": "Miden Contributors",
44
+ "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/0xMiden/miden-client"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/0xMiden/miden-client/issues"
51
+ }
52
+ }