@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/dist/index.d.cts CHANGED
@@ -1,7 +1,105 @@
1
- import * as _enhance_sandbox_runtime from '@enhance-sandbox/runtime';
2
- import { Enhance as Enhance$1 } from '@enhance-sandbox/runtime';
3
- export { EnhanceController, EnhanceOptions, EnhanceStatus } from '@enhance-sandbox/runtime';
1
+ import { z } from 'zod';
4
2
 
3
+ interface WorkerHmrConfiguration {
4
+ protocols?: string[];
5
+ pathHints?: string[];
6
+ }
7
+
8
+ declare const optionsSchema: z.ZodObject<{
9
+ sandboxBaseURL: z.ZodOptional<z.ZodString>;
10
+ callbackBypass: z.ZodArray<z.ZodString, "many">;
11
+ assetHosts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
12
+ overlay: z.ZodOptional<z.ZodObject<{
13
+ enabled: z.ZodOptional<z.ZodBoolean>;
14
+ position: z.ZodOptional<z.ZodEnum<["top-left", "top-right", "bottom-left", "bottom-right"]>>;
15
+ enableViteHmr: z.ZodOptional<z.ZodBoolean>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ enabled?: boolean | undefined;
18
+ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
19
+ enableViteHmr?: boolean | undefined;
20
+ }, {
21
+ enabled?: boolean | undefined;
22
+ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
23
+ enableViteHmr?: boolean | undefined;
24
+ }>>;
25
+ hmr: z.ZodOptional<z.ZodObject<{
26
+ protocols: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
27
+ pathHints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ protocols?: string[] | undefined;
30
+ pathHints?: string[] | undefined;
31
+ }, {
32
+ protocols?: string[] | undefined;
33
+ pathHints?: string[] | undefined;
34
+ }>>;
35
+ logLevel: z.ZodOptional<z.ZodEnum<["silent", "info", "debug"]>>;
36
+ swPath: z.ZodOptional<z.ZodString>;
37
+ overlayPath: z.ZodOptional<z.ZodString>;
38
+ runtimeScriptPath: z.ZodOptional<z.ZodString>;
39
+ storageKeysOverride: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
40
+ security: z.ZodOptional<z.ZodEnum<["permissive", "custom"]>>;
41
+ }, "strip", z.ZodTypeAny, {
42
+ callbackBypass: string[];
43
+ sandboxBaseURL?: string | undefined;
44
+ assetHosts?: string[] | undefined;
45
+ overlay?: {
46
+ enabled?: boolean | undefined;
47
+ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
48
+ enableViteHmr?: boolean | undefined;
49
+ } | undefined;
50
+ hmr?: {
51
+ protocols?: string[] | undefined;
52
+ pathHints?: string[] | undefined;
53
+ } | undefined;
54
+ logLevel?: "silent" | "info" | "debug" | undefined;
55
+ swPath?: string | undefined;
56
+ overlayPath?: string | undefined;
57
+ runtimeScriptPath?: string | undefined;
58
+ storageKeysOverride?: Record<string, string> | undefined;
59
+ security?: "custom" | "permissive" | undefined;
60
+ }, {
61
+ callbackBypass: string[];
62
+ sandboxBaseURL?: string | undefined;
63
+ assetHosts?: string[] | undefined;
64
+ overlay?: {
65
+ enabled?: boolean | undefined;
66
+ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
67
+ enableViteHmr?: boolean | undefined;
68
+ } | undefined;
69
+ hmr?: {
70
+ protocols?: string[] | undefined;
71
+ pathHints?: string[] | undefined;
72
+ } | undefined;
73
+ logLevel?: "silent" | "info" | "debug" | undefined;
74
+ swPath?: string | undefined;
75
+ overlayPath?: string | undefined;
76
+ runtimeScriptPath?: string | undefined;
77
+ storageKeysOverride?: Record<string, string> | undefined;
78
+ security?: "custom" | "permissive" | undefined;
79
+ }>;
80
+ type RawOptions = z.input<typeof optionsSchema>;
81
+ declare global {
82
+ interface Window {
83
+ __enhanceSandboxHmr?: WorkerHmrConfiguration | (() => WorkerHmrConfiguration | undefined);
84
+ }
85
+ }
86
+
87
+ interface EnhanceInitOptions extends RawOptions {
88
+ }
89
+ interface EnhanceStatus {
90
+ enabled: boolean;
91
+ controlled: boolean;
92
+ version: string;
93
+ sandboxHits: number;
94
+ sandboxFallbacks: number;
95
+ }
96
+ interface EnhanceController {
97
+ enable(token?: string): void;
98
+ disable(): void;
99
+ status(): EnhanceStatus;
100
+ }
101
+
102
+ type EnhanceOptions = EnhanceInitOptions;
5
103
  interface EnhanceAssetManifest {
6
104
  serviceWorker: string;
7
105
  runtime: string;
@@ -10,7 +108,7 @@ interface EnhanceAssetManifest {
10
108
  runtimeDigest: string | null;
11
109
  }
12
110
  declare const Enhance: {
13
- init(options: Parameters<typeof Enhance$1.init>[0]): _enhance_sandbox_runtime.EnhanceController;
111
+ init(options: EnhanceInitOptions): EnhanceController;
14
112
  serviceWorkerURL(): string;
15
113
  runtimeURL(): string;
16
114
  assetManifest(): EnhanceAssetManifest;
@@ -20,4 +118,4 @@ declare function resolveServiceWorkerPath(): string;
20
118
  declare function serviceWorkerURL(): string;
21
119
  declare function runtimeURL(): string;
22
120
 
23
- export { Enhance, type EnhanceAssetManifest, getAssetManifest, resolveServiceWorkerPath, runtimeURL, serviceWorkerURL };
121
+ export { Enhance, type EnhanceAssetManifest, type EnhanceController, type EnhanceOptions, type EnhanceStatus, getAssetManifest, resolveServiceWorkerPath, runtimeURL, serviceWorkerURL };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,105 @@
1
- import * as _enhance_sandbox_runtime from '@enhance-sandbox/runtime';
2
- import { Enhance as Enhance$1 } from '@enhance-sandbox/runtime';
3
- export { EnhanceController, EnhanceOptions, EnhanceStatus } from '@enhance-sandbox/runtime';
1
+ import { z } from 'zod';
4
2
 
3
+ interface WorkerHmrConfiguration {
4
+ protocols?: string[];
5
+ pathHints?: string[];
6
+ }
7
+
8
+ declare const optionsSchema: z.ZodObject<{
9
+ sandboxBaseURL: z.ZodOptional<z.ZodString>;
10
+ callbackBypass: z.ZodArray<z.ZodString, "many">;
11
+ assetHosts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
12
+ overlay: z.ZodOptional<z.ZodObject<{
13
+ enabled: z.ZodOptional<z.ZodBoolean>;
14
+ position: z.ZodOptional<z.ZodEnum<["top-left", "top-right", "bottom-left", "bottom-right"]>>;
15
+ enableViteHmr: z.ZodOptional<z.ZodBoolean>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ enabled?: boolean | undefined;
18
+ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
19
+ enableViteHmr?: boolean | undefined;
20
+ }, {
21
+ enabled?: boolean | undefined;
22
+ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
23
+ enableViteHmr?: boolean | undefined;
24
+ }>>;
25
+ hmr: z.ZodOptional<z.ZodObject<{
26
+ protocols: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
27
+ pathHints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ protocols?: string[] | undefined;
30
+ pathHints?: string[] | undefined;
31
+ }, {
32
+ protocols?: string[] | undefined;
33
+ pathHints?: string[] | undefined;
34
+ }>>;
35
+ logLevel: z.ZodOptional<z.ZodEnum<["silent", "info", "debug"]>>;
36
+ swPath: z.ZodOptional<z.ZodString>;
37
+ overlayPath: z.ZodOptional<z.ZodString>;
38
+ runtimeScriptPath: z.ZodOptional<z.ZodString>;
39
+ storageKeysOverride: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
40
+ security: z.ZodOptional<z.ZodEnum<["permissive", "custom"]>>;
41
+ }, "strip", z.ZodTypeAny, {
42
+ callbackBypass: string[];
43
+ sandboxBaseURL?: string | undefined;
44
+ assetHosts?: string[] | undefined;
45
+ overlay?: {
46
+ enabled?: boolean | undefined;
47
+ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
48
+ enableViteHmr?: boolean | undefined;
49
+ } | undefined;
50
+ hmr?: {
51
+ protocols?: string[] | undefined;
52
+ pathHints?: string[] | undefined;
53
+ } | undefined;
54
+ logLevel?: "silent" | "info" | "debug" | undefined;
55
+ swPath?: string | undefined;
56
+ overlayPath?: string | undefined;
57
+ runtimeScriptPath?: string | undefined;
58
+ storageKeysOverride?: Record<string, string> | undefined;
59
+ security?: "custom" | "permissive" | undefined;
60
+ }, {
61
+ callbackBypass: string[];
62
+ sandboxBaseURL?: string | undefined;
63
+ assetHosts?: string[] | undefined;
64
+ overlay?: {
65
+ enabled?: boolean | undefined;
66
+ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
67
+ enableViteHmr?: boolean | undefined;
68
+ } | undefined;
69
+ hmr?: {
70
+ protocols?: string[] | undefined;
71
+ pathHints?: string[] | undefined;
72
+ } | undefined;
73
+ logLevel?: "silent" | "info" | "debug" | undefined;
74
+ swPath?: string | undefined;
75
+ overlayPath?: string | undefined;
76
+ runtimeScriptPath?: string | undefined;
77
+ storageKeysOverride?: Record<string, string> | undefined;
78
+ security?: "custom" | "permissive" | undefined;
79
+ }>;
80
+ type RawOptions = z.input<typeof optionsSchema>;
81
+ declare global {
82
+ interface Window {
83
+ __enhanceSandboxHmr?: WorkerHmrConfiguration | (() => WorkerHmrConfiguration | undefined);
84
+ }
85
+ }
86
+
87
+ interface EnhanceInitOptions extends RawOptions {
88
+ }
89
+ interface EnhanceStatus {
90
+ enabled: boolean;
91
+ controlled: boolean;
92
+ version: string;
93
+ sandboxHits: number;
94
+ sandboxFallbacks: number;
95
+ }
96
+ interface EnhanceController {
97
+ enable(token?: string): void;
98
+ disable(): void;
99
+ status(): EnhanceStatus;
100
+ }
101
+
102
+ type EnhanceOptions = EnhanceInitOptions;
5
103
  interface EnhanceAssetManifest {
6
104
  serviceWorker: string;
7
105
  runtime: string;
@@ -10,7 +108,7 @@ interface EnhanceAssetManifest {
10
108
  runtimeDigest: string | null;
11
109
  }
12
110
  declare const Enhance: {
13
- init(options: Parameters<typeof Enhance$1.init>[0]): _enhance_sandbox_runtime.EnhanceController;
111
+ init(options: EnhanceInitOptions): EnhanceController;
14
112
  serviceWorkerURL(): string;
15
113
  runtimeURL(): string;
16
114
  assetManifest(): EnhanceAssetManifest;
@@ -20,4 +118,4 @@ declare function resolveServiceWorkerPath(): string;
20
118
  declare function serviceWorkerURL(): string;
21
119
  declare function runtimeURL(): string;
22
120
 
23
- export { Enhance, type EnhanceAssetManifest, getAssetManifest, resolveServiceWorkerPath, runtimeURL, serviceWorkerURL };
121
+ export { Enhance, type EnhanceAssetManifest, type EnhanceController, type EnhanceOptions, type EnhanceStatus, getAssetManifest, resolveServiceWorkerPath, runtimeURL, serviceWorkerURL };