@dcl-regenesislabs/bevy-explorer-web 0.1.0-21846179162.commit-0fdfc23 → 0.1.0-21879339486.commit-193570d
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 +1 -1
- package/engine.js +16 -6
- package/index.html +2 -2
- package/package.json +3 -3
- package/pkg/manifest.json +1 -0
- package/pkg/webgpu_build_bg.wasm +0 -0
package/.env
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
PUBLIC_URL="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-
|
|
1
|
+
PUBLIC_URL="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21879339486.commit-193570d"
|
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 (!
|
|
21
|
-
// Fallback if
|
|
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
|
package/index.html
CHANGED
|
@@ -270,7 +270,7 @@
|
|
|
270
270
|
}
|
|
271
271
|
</style>
|
|
272
272
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
|
|
273
|
-
<script>window.PUBLIC_URL = "https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-
|
|
273
|
+
<script>window.PUBLIC_URL = "https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21879339486.commit-193570d";</script>
|
|
274
274
|
</head>
|
|
275
275
|
<body>
|
|
276
276
|
<div id="header" class="container">
|
|
@@ -398,6 +398,6 @@
|
|
|
398
398
|
<!-- ui.js first (NOT module, executes immediately to populate inputs) -->
|
|
399
399
|
<script src="ui.js"></script>
|
|
400
400
|
<!-- main.js after (module, may fail if no WASM build available) -->
|
|
401
|
-
<script type="module" src="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-
|
|
401
|
+
<script type="module" src="https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21879339486.commit-193570d/main.js"></script>
|
|
402
402
|
</body>
|
|
403
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-
|
|
3
|
+
"version": "0.1.0-21879339486.commit-193570d",
|
|
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-
|
|
12
|
-
"commit": "
|
|
11
|
+
"homepage": "https://cdn.decentraland.org/@dcl-regenesislabs/bevy-explorer-web/0.1.0-21879339486.commit-193570d",
|
|
12
|
+
"commit": "193570d34abe72bc151d74ec97717365f3a3fca2"
|
|
13
13
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"wasmSize":115472267}
|
package/pkg/webgpu_build_bg.wasm
CHANGED
|
Binary file
|