Changeset 0.37.14 (#226)
Co-authored-by: gobha <jasafpro@gmail.com> Co-committed-by: gobha <jasafpro@gmail.com>
This commit is contained in:
@@ -19,17 +19,41 @@
|
||||
* 12. ui.js — Render functions, export, provider setup panel
|
||||
* 11. (this file) — Boot
|
||||
*/
|
||||
(function () {
|
||||
(async function () {
|
||||
'use strict';
|
||||
|
||||
var mount = document.getElementById('extension-mount');
|
||||
if (!mount) return;
|
||||
|
||||
// ─── Boot Preact SDK (v0.37.14) ───────────────────────────
|
||||
// Extension surfaces don't load Preact vendors or the SDK.
|
||||
// Load vendors first, then boot SDK so window.sw is available.
|
||||
try {
|
||||
var base = window.__BASE__ || '';
|
||||
var ver = window.__VERSION__ || '0';
|
||||
|
||||
// Load Preact vendor modules (required by SDK)
|
||||
if (!window.preact) {
|
||||
var { h, render } = await import(base + '/js/sw/vendor/preact.module.js');
|
||||
var hooksModule = await import(base + '/js/sw/vendor/hooks.module.js');
|
||||
var htmModule = await import(base + '/js/sw/vendor/htm.module.js');
|
||||
window.preact = { h, render };
|
||||
window.hooks = hooksModule;
|
||||
window.html = htmModule.default.bind(h);
|
||||
}
|
||||
|
||||
var sdk = await import(base + '/js/sw/sdk/index.js?v=' + ver);
|
||||
await sdk.boot();
|
||||
console.log('[ICD] SDK booted — window.sw ready');
|
||||
} catch (e) {
|
||||
console.warn('[ICD] SDK boot failed:', e.message);
|
||||
}
|
||||
|
||||
// ─── Shared Namespace ───────────────────────────────────────
|
||||
window.ICD = {
|
||||
mount: mount,
|
||||
manifest: window.__MANIFEST__ || {},
|
||||
user: window.__USER__ || {},
|
||||
user: window.sw?.auth?.user || window.__USER__ || {},
|
||||
base: window.__BASE__ || '',
|
||||
|
||||
// State (populated by framework.js)
|
||||
@@ -101,7 +125,7 @@
|
||||
return;
|
||||
}
|
||||
var script = document.createElement('script');
|
||||
script.src = assetBase + modules[loaded] + '?v=' + (window.__VERSION__ || '0');
|
||||
script.src = assetBase + modules[loaded] + '?v=' + (window.__VERSION__ || '0') + '.' + Date.now();
|
||||
script.onload = function () { loaded++; loadNext(); };
|
||||
script.onerror = function () {
|
||||
console.error('[ICD] Failed to load: ' + modules[loaded]);
|
||||
|
||||
Reference in New Issue
Block a user