@volter/world-runtime 3.0.30 → 3.0.32

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.
@@ -67,7 +67,7 @@ export function siteOfHost(hostname: string, served: Iterable<string>, base = LO
67
67
  const label = worldOriginLabel(name);
68
68
  if (!label || !rest.endsWith(`.${label}`)) continue;
69
69
  const site = rest.slice(0, -(label.length + 1));
70
- if (site.includes('.')) return { world: name, site };
70
+ if (site.includes('.') || site.includes('--')) return { world: name, site };
71
71
  }
72
72
  return undefined;
73
73
  }
package/src/world-view.ts CHANGED
@@ -3,6 +3,8 @@
3
3
  // World"). `volter world view` is this; the runtime's `up` gains no step. A host that serves many
4
4
  // Worlds (world-host) answers the same doors; this serves one, and the branches made of it.
5
5
  import { existsSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
6
+ import { materializeBrowserFiles } from './browsers.ts';
7
+ import { statusWorld } from './runtime.ts';
6
8
  import { loadWorldConfig } from './configs.ts';
7
9
  import { join, resolve } from 'node:path';
8
10
  import { serveHttp, stateDirName } from '@volter/world-core/runtime';
@@ -83,6 +85,8 @@ export async function serveWorldView(name: string, opts: { /** the person signed
83
85
  worlds.set(next.served, next); world = next;
84
86
  const current = join(root, stateDirName(), 'current');
85
87
  if (branch === loadWorldConfig(join(root, stateDirName(), 'world.json'), root).config.id) rmSync(current, { force: true }); else writeFileSync(current, `${branch}\n`);
88
+ const selected = statusWorld(branch, root);
89
+ materializeBrowserFiles(selected.dirs.data, root, branch, selected.config);
86
90
  } finally { switching = false; }
87
91
  };
88
92
  const mountOpts = { root, branches: (served: string) => branches.doorsFor(served), ...(browserOrigin ? { browserOrigin } : {}), ...(sitesTemplate ? { sitesTemplate } : {}), ...(pagesOrigin ? { pagesOrigin } : {}), ...(local ? { localTrust: true, ...(opts.localPerson ? { localPerson: opts.localPerson } : {}) } : {}), serveBranch };
@@ -106,7 +110,7 @@ export async function serveWorldView(name: string, opts: { /** the person signed
106
110
  // a World's own origin serves that World (and the ping and the console) and no other
107
111
  // a site the World's twins answer, under the World's local origin (`<hostname>.<world>--<org>.localhost`)
108
112
  const site = origins && !proxied ? siteOfHost(at.hostname, worlds.keys()) : undefined;
109
- if (site) return worlds.get(site.world)!.site(request, site.site);
113
+ if (site) return !site.site.includes('.') && site.site.includes('--') ? worlds.get(site.world)!.handle(request) : worlds.get(site.world)!.site(request, site.site);
110
114
  // a World's content plane serves that World's twins' pages and nothing else of this view's (no console)
111
115
  const pagesFor = origins && !proxied ? pagesOfHost(at.hostname, worlds.keys()) : undefined;
112
116
  if (pagesFor) return path === '/-/ping' ? Response.json({ ok: true, worlds: [pagesFor] }) : worlds.get(pagesFor)!.handle(request);