@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.
- package/dist/src/branch.js +3 -0
- package/dist/src/browsers.d.ts +29 -0
- package/dist/src/browsers.js +180 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/init.d.ts +1 -1
- package/dist/src/init.js +36 -4
- package/dist/src/local-branches.js +5 -1
- package/dist/src/pack-facts.d.ts +4 -0
- package/dist/src/pack-facts.js +14 -0
- package/dist/src/placeholder.js +16 -2
- package/dist/src/redirect-proxy.js +3 -3
- package/dist/src/reflect.js +1 -2
- package/dist/src/runtime.js +9 -2
- package/dist/src/served-world.d.ts +12 -9
- package/dist/src/served-world.js +406 -189
- package/dist/src/world-origins.js +1 -1
- package/dist/src/world-view.js +5 -1
- package/package.json +4 -4
- package/src/branch.ts +3 -0
- package/src/browsers.ts +146 -0
- package/src/index.ts +2 -0
- package/src/init.ts +36 -4
- package/src/local-branches.ts +5 -1
- package/src/pack-facts.ts +16 -0
- package/src/placeholder.ts +16 -2
- package/src/redirect-proxy.ts +3 -3
- package/src/reflect.ts +1 -2
- package/src/runtime.ts +7 -2
- package/src/served-world.ts +323 -166
- package/src/world-origins.ts +1 -1
- package/src/world-view.ts +5 -1
package/src/world-origins.ts
CHANGED
|
@@ -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);
|