@enhance-eng/sandbox 0.3.8 → 0.3.10

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 DELETED
@@ -1,59 +0,0 @@
1
- # @enhance-eng/sandbox
2
-
3
- `@enhance-eng/sandbox` delivers the Enhance permissive preview runtime, service worker, and overlay. Install it in a production app to opt-in to sandboxed front-end previews without touching your routing or deploy process.
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm install @enhance-eng/sandbox
9
- # or pnpm add @enhance-eng/sandbox
10
- ```
11
-
12
- To keep the bundled assets current automatically, add an `enhance.config.json` at your project root and reinstall:
13
-
14
- ```json
15
- {
16
- "publicDir": "./public",
17
- "swFilename": "sw-enhance.js"
18
- }
19
- ```
20
-
21
- The postinstall hook reads this file and copies the service worker (`sw-enhance.js`) plus overlay bundle (`assets/overlay.js`) into the configured directory. Rerunning `npm install` or bumping `@enhance-eng/sandbox` keeps both files up to date without any extra steps.
22
-
23
- Prefer to run the sync manually? You can still call the CLI directly:
24
-
25
- ```bash
26
- npx enhance-sandbox prepare-sw --public-dir ./public --filename sw-enhance.js
27
- ```
28
-
29
- Both paths write the service worker and overlay bundle into your public directory.
30
-
31
- ## Initialise
32
-
33
- Load the runtime at the top of your client entry point:
34
-
35
- ```ts
36
- import { Enhance } from '@enhance-eng/sandbox';
37
-
38
- Enhance.init({
39
- sandboxBaseURL: 'https://sandbox.example.com/project/branch',
40
- projectId: 'project',
41
- branchId: 'branch',
42
- callbackBypass: ['/auth/callback']
43
- });
44
- ```
45
-
46
- When the page loads with `?enhance=1`, the runtime registers the service worker, triggers a one-time reload, and swaps document and asset requests to the sandbox host. OAuth callbacks, APIs, and third-party origins bypass the worker untouched.
47
-
48
- ## CLI
49
-
50
- The package exposes an `enhance-sandbox` binary:
51
-
52
- - `prepare-sw` – copy bundled assets into a public directory.
53
- - `manifest` – print the packaged asset metadata for templating or deploy verification.
54
-
55
- Run `npx enhance-sandbox --help` to view all commands and options.
56
-
57
- ## License
58
-
59
- Released under the [MIT License](./LICENSE).