@scenarist/nextjs-adapter 0.5.0 → 0.5.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.
Files changed (2) hide show
  1. package/README.md +4 -12
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1630,22 +1630,14 @@ When tree-shaking succeeds, your production bundle has:
1630
1630
  - Next.js: Should work automatically
1631
1631
  - Custom bundlers: Add `conditions: ['production']`
1632
1632
 
1633
- 3. **Check dynamic imports:** Avoid dynamic imports that bypass tree-shaking
1633
+ 3. **Inspect bundle:** Search `.next/` for `__scenarist_shared_msw_server`, a global property name that survives minification
1634
1634
 
1635
- ```typescript
1636
- // ❌ BAD - Bypasses tree-shaking
1637
- const scenarist = await import('@scenarist/nextjs-adapter/app');
1638
-
1639
- // ✅ GOOD - Enables tree-shaking
1640
- import { createScenarist } from '@scenarist/nextjs-adapter/app';
1641
- const scenarist = createScenarist({ ... });
1642
- ```
1643
-
1644
- 4. **Inspect bundle:** Check `.next/` directory for MSW strings
1645
1635
  ```bash
1646
- grep -r "setupWorker\|HttpResponse\.json" .next/
1636
+ grep -rl --exclude-dir=cache "__scenarist_shared_msw_server" $(find .next -mindepth 1 -maxdepth 1 ! -name dev)
1647
1637
  ```
1648
1638
 
1639
+ Any file listed contains Scenarist and MSW code. The command skips the top-level `.next/dev` directory, which `next dev` writes and `next build` keeps, but still scans route folders named `dev` inside the production output. Do not rely on searching for MSW function names such as `setupWorker` or `HttpResponse.json`: minifiers rename them, so the search can miss MSW code.
1640
+
1649
1641
  ### Architecture Details
1650
1642
 
1651
1643
  The adapter uses **package.json conditional exports** to provide different entry points per environment:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scenarist/nextjs-adapter",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Next.js adapter for Scenarist (Pages Router and App Router)",
5
5
  "author": "Paul Hammond (citypaul) <paul@packsoftware.co.uk>",
6
6
  "license": "MIT",
@@ -58,8 +58,8 @@
58
58
  "LICENSE"
59
59
  ],
60
60
  "dependencies": {
61
- "@scenarist/core": "0.5.0",
62
- "@scenarist/msw-adapter": "0.5.0",
61
+ "@scenarist/core": "0.5.1",
62
+ "@scenarist/msw-adapter": "0.5.1",
63
63
  "zod": "^4.6.5"
64
64
  },
65
65
  "peerDependencies": {