Elffuss BraidHub

utopia-ia/elffuss-code public

Install: check a theme's manifest without loading level 2

The check before Install reads the result's manifest; when something in
it applies without code (by level 1's own rule), it installs as before
without loading js/ext2/. Only a result that brings nothing declarative
loads the level 2 panel module to offer its code button.

x2_ux X1b checks a theme's Install loads nothing from js/ext2/. The panel
state of x2_bytes is 20,430 bytes over the level 1 tip, within its 20 KB
budget; the README says so.

Changeset5bf78e316b3ccfb589a7c6b08c04c1cf21e94d14d4264c830614a2461735ff67
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-11 22:07 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-12 09:38 +02:00
Parents9a38018bfc74

Browse the files at this changeset

3 files changed

modified README.md +5 −3
@@ -154,9 +154,11 @@
154154 `ide.js`: the palette list, the preview gate and the list of open tabs); with level 1
155155 extensions only, the same files and 4.4 KB more (the hooks in `js/ext/host.js` and
156156 `store.js` that decide when to load `js/ext2/host2.js`); with the Extensions panel open
157- and a search done, the same files and 19.8 KB more (what the panel now tells everyone:
158- what will work, the Works in Code filter, how extensions are isolated, the check before
159- Install). In none of these is anything fetched from `vendor/x2/`, `js/ext2/` or the
157+ and a search done, the same files and 20,430 bytes more, within the suite's 20 KB budget
158+ (what the panel now tells everyone: what will work, the Works in Code filter, how
159+ extensions are isolated, the check before Install, which for a result that applies
160+ without code loads nothing of level 2). In none of these is anything fetched from
161+ `vendor/x2/`, `js/ext2/` or the
160162 sandbox site. Once code is on, the runtime is 2.6 MB gzip (from the manifest), fetched
161163 once and then served from the HTTP cache. `?noext` pauses every extension, `?noext2` only
162164 their code, `"enabled": false` in the manifest is a global kill switch, and the panel can
modified tests/x2_ux.mjs +7 −0
@@ -232,10 +232,17 @@
232232 const { ctx, page } = await profile();
233233 const log = [];
234234 ctx.on('request', r => { if (/open-vsx\.org/.test(r.url())) log.push(r.method() + ' ' + new URL(r.url()).pathname); });
235+ const l2 = [];
236+ page.on('request', r => { if (/\/js\/ext2\//.test(r.url())) l2.push(new URL(r.url()).pathname); });
235237 await openIde(page);
236238 await panel(page);
237239 await search(page, 'elffuss-ux');
238240 await until(async () => (await page.locator('#ext-results .ext-row').count()) === fixtures.length);
241+ // un tema: su manifiesto dice que algo se aplica y se instala sin cargar nada del nivel 2
242+ await row(page, 'elffuss-ux.decl').locator('.ext-install').click();
243+ const declMsg = await until(() => page.evaluate(() => document.getElementById('ext-msg')?.textContent || null));
244+ ok('X1b Install on a theme reads its manifest and goes on to install it, without loading anything of level 2', l2.length === 0 && log.some(l => /elffuss-ux\/decl\/1\.0\.0\/file\/package\.json$/.test(l)) && !!declMsg,
245+ JSON.stringify({ l2, declMsg }));
239246 await row(page, 'elffuss-ux.webok').locator('.ext-install').click();
240247 const after = await until(() => page.evaluate(() => {
241248 const r = [...document.querySelectorAll('#ext-results .ext-row')].find(x => x.dataset.id === 'elffuss-ux.webok');
modified web/js/ext/panel.js +6 −4
@@ -507,15 +507,17 @@
507507 } catch (e) { det.replaceChildren(el('div', 'ext-ignored', textoError(e))); }
508508 }
509509
510-// «Instalar» sin detalle visto: su manifiesto antes que el .vsix; si solo
511-// trae código, la fila enseña su botón de código, con el foco
510+// «Instalar» sin detalle visto: su manifiesto antes que el .vsix (si algo se
511+// aplica, sin cargar el nivel 2); si solo trae código, su botón, con el foco
512512 async function antesDeInstalar(it) {
513513 if (!estado.cls.get(clave(it))) {
514514 try {
515515 const ovsx = await import('./openvsx.js');
516- const manifest = await ovsx.manifest(await ovsx.metadata(it.namespace, it.name, it.version));
516+ const man = await ovsx.manifest(await ovsx.metadata(it.namespace, it.name, it.version));
517+ const a = (await import('./vsix.js')).analyzeManifest(man);
518+ if (resumen({ ...a, themes: a.applies.themes }).any) return true;
517519 m2 ??= await gestor();
518- estado.cls.set(clave(it), (await m2.describe(manifest, { installedIds: new Set(host.list().map(e => e.id)), host })).cls);
520+ estado.cls.set(clave(it), (await m2.describe(man, { installedIds: new Set(host.list().map(e => e.id)), host })).cls);
519521 } catch { return true; }
520522 }
521523 if (estado.cls.get(clave(it)).hasDeclarative) return true;