@manybitsbyte/nesplayer-svelte 0.10.0 → 0.14.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 CHANGED
@@ -104,7 +104,7 @@ The state is stored under the key `nesplayer-<romName>.state`, where `romName` i
104
104
 
105
105
  ### Battery save (SRAM)
106
106
 
107
- ROMs with battery-backed RAM (e.g. Zelda, Metroid) automatically save SRAM to `localStorage` on page unload and restore it when the same ROM is loaded again. Keys used:
107
+ ROMs with battery-backed RAM (e.g. Zelda, Crystalis) automatically save SRAM to `localStorage` on page unload and restore it when the same ROM is loaded again. Keys used:
108
108
 
109
109
  | Key | Contents |
110
110
  |-----|----------|
@@ -148,7 +148,13 @@ Cross-Origin-Embedder-Policy: require-corp
148
148
 
149
149
  Without these headers the component still works — the screen renders and input is accepted — but audio is silently disabled and a warning is logged to the console.
150
150
 
151
- **SvelteKit / Vite dev server** add to `vite.config.ts`:
151
+ > **Note:** These headers restrict how your page can interact with cross-origin resources (iframes, popups, etc.). If your site relies on OAuth redirects, embedded third-party iframes, or similar cross-origin communication, audit the impact before enabling them.
152
+
153
+ ---
154
+
155
+ #### `adapter-static` — Vite dev server
156
+
157
+ Add to `vite.config.ts`:
152
158
 
153
159
  ```ts
154
160
  server: {
@@ -159,7 +165,9 @@ server: {
159
165
  },
160
166
  ```
161
167
 
162
- **Netlify**add to `netlify.toml`:
168
+ #### `adapter-static` Netlify
169
+
170
+ Add to `netlify.toml`:
163
171
 
164
172
  ```toml
165
173
  [[headers]]
@@ -169,7 +177,9 @@ server: {
169
177
  Cross-Origin-Embedder-Policy = "require-corp"
170
178
  ```
171
179
 
172
- **Vercel**add to `vercel.json`:
180
+ #### `adapter-static` Vercel
181
+
182
+ Add to `vercel.json`:
173
183
 
174
184
  ```json
175
185
  {
@@ -185,7 +195,32 @@ server: {
185
195
  }
186
196
  ```
187
197
 
188
- > **Note:** These headers restrict how your page can interact with cross-origin resources (iframes, popups, etc.). If your site relies on OAuth redirects, embedded third-party iframes, or similar cross-origin communication, audit the impact before enabling them.
198
+ #### `adapter-node`
199
+
200
+ Set the headers in `src/hooks.server.ts`. This covers every HTML page response and is the only change needed for production:
201
+
202
+ ```ts
203
+ import type { Handle } from '@sveltejs/kit';
204
+
205
+ export const handle: Handle = async ({ event, resolve }) => {
206
+ const response = await resolve(event);
207
+ response.headers.set('Cross-Origin-Opener-Policy', 'same-origin');
208
+ response.headers.set('Cross-Origin-Embedder-Policy', 'require-corp');
209
+ return response;
210
+ };
211
+ ```
212
+
213
+ For the dev server, also add the `server.headers` block to `vite.config.ts` as shown in the static section above.
214
+
215
+ If you offload static assets to a CDN, the CDN-hosted `.js` and `.wasm` files must also send:
216
+
217
+ ```
218
+ Cross-Origin-Resource-Policy: cross-origin
219
+ ```
220
+
221
+ Without it, COEP will block those assets from loading. If you serve statics from the same Node origin (the default), no extra config is needed.
222
+
223
+ If you use a reverse proxy (nginx, Caddy, etc.), make sure it is configured to pass response headers through unchanged.
189
224
 
190
225
  ### WebGL
191
226
 
@@ -2,7 +2,6 @@
2
2
  import { onMount } from 'svelte';
3
3
  import { SvelteSet } from 'svelte/reactivity';
4
4
  import createNESPlayerModule from '../wasm/nes-player.js';
5
- import nesPlayerWasmUrl from '../wasm/nes-player.wasm?url';
6
5
  import { audioWorkletSrc } from '../wasm/audio-worklet-src.js';
7
6
  import ControllerPanel from './ControllerPanel.svelte';
8
7
  import { version } from '../version.js';
@@ -967,9 +966,7 @@
967
966
  window.addEventListener('gamepaddisconnected', onGamepadDisconnected);
968
967
 
969
968
  void (async () => {
970
- const module = await createNESPlayerModule({
971
- locateFile: (f: string) => f.endsWith('.wasm') ? nesPlayerWasmUrl : f,
972
- }) as NESModule;
969
+ const module = await createNESPlayerModule({}) as NESModule;
973
970
  module._init();
974
971
  module._powerOn();
975
972
  await initAudio(module);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export const version: "0.10.0";
1
+ export const version: "0.14.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '0.10.0';
1
+ export const version = '0.14.0';
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@manybitsbyte/nesplayer-svelte",
3
- "version": "0.10.0",
3
+ "version": "0.14.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
- "build": "vite build && npm run prepack",
6
+ "build": "vite build",
7
7
  "preview": "vite preview",
8
8
  "prepare": "svelte-kit sync || echo ''",
9
- "prepack": "svelte-kit sync && svelte-package && publint",
9
+ "package": "node scripts/sync-version.js && svelte-kit sync && svelte-package",
10
+ "prepublishOnly": "bun run package && bunx publint",
10
11
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
11
12
  "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
12
13
  },