rayzee 7.20.0 → 7.20.2

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.
@@ -1,35 +0,0 @@
1
- /**
2
- * Cross-origin Worker fallback.
3
- *
4
- * Browsers enforce same-origin policy on `new Worker(url)`. When the
5
- * library's JS is served from a CDN (different origin to the page),
6
- * the standard constructor throws `SecurityError`.
7
- *
8
- * This helper fetches the script over the network (CORS-allowed) and
9
- * re-hosts it as a same-origin Blob URL.
10
- *
11
- * The Blob URL is intentionally **not** revoked — workers may reference
12
- * `self.location.href` to spawn sub-workers (e.g. BVHWorker).
13
- *
14
- * Always spawns the worker as a module. In bundled builds Vite inlines
15
- * the fallback URL as a `data:` containing the original ESM source
16
- * (with top-level `import` statements), which requires `type: 'module'`.
17
- * IIFE-bundled assets also load correctly as module workers.
18
- *
19
- * @param {URL|string} url Worker script URL (may be cross-origin)
20
- * @returns {Promise<Worker>}
21
- */
22
- export async function fetchAsWorker( url ) {
23
-
24
- const href = url instanceof URL ? url.href : url;
25
- const response = await fetch( href );
26
- if ( ! response.ok ) {
27
-
28
- throw new Error( `Failed to fetch worker script: ${response.status}` );
29
-
30
- }
31
-
32
- const blob = new Blob( [ await response.text() ], { type: 'application/javascript' } );
33
- return new Worker( URL.createObjectURL( blob ), { type: 'module' } );
34
-
35
- }