@vmz/test 0.1.9 → 0.1.10

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/browser.js CHANGED
@@ -16,6 +16,7 @@ import http from 'node:http';
16
16
  import net from 'node:net';
17
17
  import os from 'node:os';
18
18
  import path from 'node:path';
19
+ import { resolveComponentEntries } from '@vmz/core/component-registry';
19
20
  import { resolveChunkArtifacts } from './compile.js';
20
21
  import { createArtifactsDir, writeFailureEvidence, writeTimingOnly } from './browser-evidence.js';
21
22
  import { isServeHostManifest, resolveRoutePath, startServeHost } from './browser-serve.js';
@@ -327,13 +328,18 @@ export async function runBrowserManifest(manifest, ctx) {
327
328
  }
328
329
  else {
329
330
  await page.goto(`${origin}/__vmz/harness`, { waitUntil: 'domcontentloaded' });
330
- const components = program.components && typeof program.components === 'object' ? program.components : {};
331
+ const explicitComponents = program.components && typeof program.components === 'object' ? program.components : undefined;
332
+ const registryStrict = process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true';
333
+ const registryEntries = await resolveComponentEntries(ctx.outDir, explicitComponents, {
334
+ strict: registryStrict,
335
+ closureRoots: [chunkId.replace(/\\/g, '/')],
336
+ });
331
337
  const boot = await page.evaluate(async (cfg) => {
332
338
  const dom = await import(/* @vite-ignore */ `${cfg.origin}/vmz-dom.js`);
333
339
  const Comp = (await import(/* @vite-ignore */ `${cfg.origin}/${cfg.chunkPath}.client.js`)).default;
334
340
  const map = {};
335
- for (const [name, chunk] of Object.entries(cfg.components)) {
336
- map[name] = (await import(/* @vite-ignore */ `${cfg.origin}/${chunk}.client.js`)).default;
341
+ for (const { name, entry } of cfg.registry) {
342
+ map[name] = (await import(/* @vite-ignore */ `${cfg.origin}/${entry}`)).default;
337
343
  }
338
344
  if (Object.keys(map).length && typeof dom.registerComponents === 'function') {
339
345
  dom.registerComponents(map);
@@ -357,7 +363,7 @@ export async function runBrowserManifest(manifest, ctx) {
357
363
  }, {
358
364
  origin,
359
365
  chunkPath: chunkId.replace(/\\/g, '/'),
360
- components,
366
+ registry: registryEntries,
361
367
  });
362
368
  if (!boot?.ok) {
363
369
  fail(`browser boot: ${boot?.error || 'unknown'}`);
package/dist/logic.js CHANGED
@@ -5,6 +5,7 @@ import fs from 'node:fs';
5
5
  import path from 'node:path';
6
6
  import { pathToFileURL } from 'node:url';
7
7
  import { createRequire } from 'node:module';
8
+ import { bootstrapComponentRegistry } from '@vmz/core/component-registry';
8
9
  import { resolveChunkArtifacts } from './compile.js';
9
10
  const require = createRequire(import.meta.url);
10
11
  function loadLinkedom() {
@@ -41,15 +42,13 @@ export async function createLogicHost(opts) {
41
42
  if (!Component?.__vmzDirect || typeof Component.__vmzCreate !== 'function') {
42
43
  throw new Error('logic host requires Direct __vmzCreate (rebuild with current compiler)');
43
44
  }
44
- if (opts.components && typeof dom.registerComponents === 'function') {
45
- const map = {};
46
- for (const [name, chunk] of Object.entries(opts.components)) {
47
- const cArts = resolveChunkArtifacts(opts.outDir, chunk);
48
- if (!cArts.clientPath)
49
- throw new Error(`registerComponents: missing ${chunk}.client.js`);
50
- map[name] = (await import(pathToFileURL(cArts.clientPath).href)).default;
51
- }
52
- dom.registerComponents(map);
45
+ if (typeof dom.registerComponents === 'function') {
46
+ await bootstrapComponentRegistry(opts.outDir, dom.registerComponents, {
47
+ strict: process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true',
48
+ closureRoots: [opts.chunkId.replace(/\\/g, '/')],
49
+ explicit: opts.components,
50
+ preload: 'closure',
51
+ });
53
52
  }
54
53
  if (typeof dom.__vmzPrecisionEnable === 'function') {
55
54
  dom.__vmzPrecisionEnable(true);
package/dist/resume.js CHANGED
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import path from 'node:path';
6
6
  import { pathToFileURL } from 'node:url';
7
+ import { bootstrapComponentRegistry } from '@vmz/core/component-registry';
7
8
  import { resolveChunkArtifacts } from './compile.js';
8
9
  import { installHeadlessDocument } from './logic.js';
9
10
  export async function runResumeManifest(manifest, ctx) {
@@ -37,16 +38,19 @@ export async function runResumeManifest(manifest, ctx) {
37
38
  }
38
39
  const components = program.components && typeof program.components === 'object' ? program.components : undefined;
39
40
  const loaded = {};
40
- if (components) {
41
- for (const [name, chunk] of Object.entries(components)) {
42
- const cArts = resolveChunkArtifacts(ctx.outDir, chunk);
43
- if (!cArts.clientPath) {
44
- fail(`missing component ${chunk}`);
45
- continue;
46
- }
47
- loaded[name] = (await import(pathToFileURL(cArts.clientPath).href)).default;
41
+ if (typeof dom.registerComponents === 'function') {
42
+ try {
43
+ Object.assign(loaded, await bootstrapComponentRegistry(ctx.outDir, dom.registerComponents, {
44
+ strict: process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true',
45
+ closureRoots: [chunkId.replace(/\\/g, '/')],
46
+ explicit: components,
47
+ preload: 'closure',
48
+ }));
49
+ }
50
+ catch (e) {
51
+ fail(`bootstrap component registry: ${e instanceof Error ? e.message : String(e)}`);
52
+ return { status: 'error', diagnostics, planId: null, programId };
48
53
  }
49
- dom.registerComponents(loaded);
50
54
  }
51
55
  let html = '';
52
56
  let island = null;
package/dist/ssr.js CHANGED
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import path from 'node:path';
6
6
  import { pathToFileURL } from 'node:url';
7
+ import { bootstrapComponentRegistry } from '@vmz/core/component-registry';
7
8
  import { resolveChunkArtifacts } from './compile.js';
8
9
  import { installHeadlessDocument } from './logic.js';
9
10
  export async function runSsrManifest(manifest, ctx) {
@@ -35,17 +36,19 @@ export async function runSsrManifest(manifest, ctx) {
35
36
  return { status: 'error', diagnostics, planId: null, programId };
36
37
  }
37
38
  const components = program.components && typeof program.components === 'object' ? program.components : undefined;
38
- if (components) {
39
- const map = {};
40
- for (const [name, chunk] of Object.entries(components)) {
41
- const cArts = resolveChunkArtifacts(ctx.outDir, chunk);
42
- if (!cArts.clientPath) {
43
- fail(`missing component ${chunk}`);
44
- continue;
45
- }
46
- map[name] = (await import(pathToFileURL(cArts.clientPath).href)).default;
39
+ if (typeof dom.registerComponents === 'function') {
40
+ try {
41
+ await bootstrapComponentRegistry(ctx.outDir, dom.registerComponents, {
42
+ strict: process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true',
43
+ closureRoots: [chunkId.replace(/\\/g, '/')],
44
+ explicit: components,
45
+ preload: 'closure',
46
+ });
47
+ }
48
+ catch (e) {
49
+ fail(`bootstrap component registry: ${e instanceof Error ? e.message : String(e)}`);
50
+ return { status: 'error', diagnostics, planId: null, programId };
47
51
  }
48
- dom.registerComponents(map);
49
52
  }
50
53
  let html = '';
51
54
  let streamChunks = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vmz/test",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "description": "VMZ native test protocol + Compile/Logic/Browser/SSR/Resume/Deployment hosts",
6
6
  "main": "./dist/index.js",
@@ -27,8 +27,8 @@
27
27
  "build": "tsc -p tsconfig.json"
28
28
  },
29
29
  "dependencies": {
30
- "@vmz/core": "0.1.9",
31
- "@vmz/protocol": "0.1.9",
30
+ "@vmz/core": "0.1.10",
31
+ "@vmz/protocol": "0.1.10",
32
32
  "linkedom": "^0.18.13",
33
33
  "puppeteer-core": "^24.11.2"
34
34
  },