@dcl-regenesislabs/bevy-explorer-web 0.1.0-21841328189.commit-726f8ec → 0.1.0-21871662586.commit-adcccc5

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/.env CHANGED
@@ -1 +1 @@
1
- PUBLIC_URL="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21841328189.commit-726f8ec"
1
+ PUBLIC_URL="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21871662586.commit-adcccc5"
package/engine.js CHANGED
@@ -11,20 +11,21 @@ export { gpu_cache_hash, initGpuCache };
11
11
  * Fetches a URL with download progress tracking.
12
12
  * @param {string} url - URL to fetch
13
13
  * @param {function} onProgress - Callback with percentage (0-100)
14
+ * @param {number|null} expectedSize - Expected uncompressed size in bytes (fallback when Content-Length is missing due to content-encoding)
14
15
  * @returns {Promise<ArrayBuffer>}
15
16
  */
16
- async function fetchWithProgress(url, onProgress) {
17
+ async function fetchWithProgress(url, onProgress, expectedSize) {
17
18
  const response = await fetch(url);
18
19
  const contentLength = response.headers.get('Content-Length');
20
+ const total = contentLength ? parseInt(contentLength, 10) : expectedSize;
19
21
 
20
- if (!contentLength || !response.body) {
21
- // Fallback if Content-Length is missing or no streaming support
22
+ if (!total || !response.body) {
23
+ // Fallback if no size info available or no streaming support
22
24
  const buffer = await response.arrayBuffer();
23
25
  onProgress(100);
24
26
  return buffer;
25
27
  }
26
28
 
27
- const total = parseInt(contentLength, 10);
28
29
  const reader = response.body.getReader();
29
30
  const chunks = [];
30
31
  let received = 0;
@@ -35,7 +36,7 @@ async function fetchWithProgress(url, onProgress) {
35
36
 
36
37
  chunks.push(value);
37
38
  received += value.length;
38
- onProgress((received / total) * 100);
39
+ onProgress(Math.min((received / total) * 100, 100));
39
40
  }
40
41
 
41
42
  // Combine chunks into single ArrayBuffer
@@ -58,11 +59,20 @@ export async function initEngine() {
58
59
  const publicUrl = window.PUBLIC_URL || ".";
59
60
  const wasmUrl = `${publicUrl}/pkg/webgpu_build_bg.wasm`;
60
61
 
62
+ // Fetch manifest for expected WASM size (used when Content-Length is missing due to CDN compression)
63
+ let expectedWasmSize = null;
64
+ try {
65
+ const manifest = await fetch(`${publicUrl}/pkg/manifest.json`).then(r => r.json());
66
+ expectedWasmSize = manifest.wasmSize;
67
+ } catch (e) {
68
+ console.warn("Could not load manifest.json, progress may not be accurate", e);
69
+ }
70
+
61
71
  // Step 1: Download WASM with progress
62
72
  setLoadingStepActive('download');
63
73
  const wasmBytes = await fetchWithProgress(wasmUrl, (percent) => {
64
74
  setLoadingStepProgress('download', percent);
65
- });
75
+ }, expectedWasmSize);
66
76
  setLoadingStepCompleted('download');
67
77
 
68
78
  // Step 2: Compile WASM
@@ -3,13 +3,13 @@
3
3
  "short_name": "BevyDCL",
4
4
  "icons": [
5
5
  {
6
- "src": "/favicon/web-app-manifest-192x192.png",
6
+ "src": "web-app-manifest-192x192.png",
7
7
  "sizes": "192x192",
8
8
  "type": "image/png",
9
9
  "purpose": "maskable"
10
10
  },
11
11
  {
12
- "src": "/favicon/web-app-manifest-512x512.png",
12
+ "src": "web-app-manifest-512x512.png",
13
13
  "sizes": "512x512",
14
14
  "type": "image/png",
15
15
  "purpose": "maskable"
package/index.html CHANGED
@@ -1,12 +1,21 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <link rel="icon" type="image/png" href="/favicon/favicon-96x96.png" sizes="96x96" />
5
- <link rel="icon" type="image/svg+xml" href="/favicon/favicon.svg" />
6
- <link rel="shortcut icon" href="/favicon/favicon.ico" />
7
- <link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png" />
4
+ <script>
5
+ // Set base href so relative paths work when deployed under a subpath (e.g. /bevy-web)
6
+ (function() {
7
+ var base = document.createElement('base');
8
+ var path = window.location.pathname;
9
+ base.href = path.endsWith('/') ? path : path + '/';
10
+ document.head.appendChild(base);
11
+ })();
12
+ </script>
13
+ <link rel="icon" type="image/png" href="favicon/favicon-96x96.png" sizes="96x96" />
14
+ <link rel="icon" type="image/svg+xml" href="favicon/favicon.svg" />
15
+ <link rel="shortcut icon" href="favicon/favicon.ico" />
16
+ <link rel="apple-touch-icon" sizes="180x180" href="favicon/apple-touch-icon.png" />
8
17
  <meta name="apple-mobile-web-app-title" content="Decentraland (BEVY)" />
9
- <link rel="manifest" href="/favicon/site.webmanifest" />
18
+ <link rel="manifest" href="favicon/site.webmanifest" />
10
19
  <meta charset="UTF-8">
11
20
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
12
21
  <title>Decentraland (BEVY)</title>
@@ -261,7 +270,7 @@
261
270
  }
262
271
  </style>
263
272
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
264
- <script>window.PUBLIC_URL = "https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21841328189.commit-726f8ec";</script>
273
+ <script>window.PUBLIC_URL = "https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21871662586.commit-adcccc5";</script>
265
274
  </head>
266
275
  <body>
267
276
  <div id="header" class="container">
@@ -389,6 +398,6 @@
389
398
  <!-- ui.js first (NOT module, executes immediately to populate inputs) -->
390
399
  <script src="ui.js"></script>
391
400
  <!-- main.js after (module, may fail if no WASM build available) -->
392
- <script type="module" src="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21841328189.commit-726f8ec/main.js"></script>
401
+ <script type="module" src="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21871662586.commit-adcccc5/main.js"></script>
393
402
  </body>
394
403
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcl-regenesislabs/bevy-explorer-web",
3
- "version": "0.1.0-21841328189.commit-726f8ec",
3
+ "version": "0.1.0-21871662586.commit-adcccc5",
4
4
  "scripts": {
5
5
  "postinstall": "node ./scripts/prebuild.js"
6
6
  },
@@ -8,6 +8,6 @@
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/decentraland/bevy-explorer.git"
10
10
  },
11
- "homepage": "https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21841328189.commit-726f8ec",
12
- "commit": "726f8ec8f84bf1bf2d6dc7dc8e7933119649fda2"
11
+ "homepage": "https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21871662586.commit-adcccc5",
12
+ "commit": "adcccc5682f5d3249b70f6e2437ee7abfe1247d5"
13
13
  }
@@ -0,0 +1 @@
1
+ {"wasmSize":115472267}
Binary file