@vmz/test 0.1.17 → 0.1.18

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/compile.d.ts CHANGED
@@ -28,7 +28,7 @@ export type BuildResult = {
28
28
  diagnostics: unknown[];
29
29
  error: string;
30
30
  };
31
- /** Build project for compile/logic evidence. Prefers vmz-tools; optional N-API inject. */
31
+ /** Build project for compile/logic evidence. Prefers N-API `createWorkspace`, else Node `@vmz/vmz`. */
32
32
  export declare function buildForCompile(project: string, outDir?: string, options?: BuildOptions): BuildResult;
33
33
  export declare function resolveChunkArtifacts(dist: string, chunkId: string): {
34
34
  programPath: string | null;
package/dist/compile.js CHANGED
@@ -9,22 +9,13 @@ import { spawnSync } from 'node:child_process';
9
9
  import { fileURLToPath } from 'node:url';
10
10
  const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
11
11
  const repoRootGuess = path.resolve(packageRoot, '../../..');
12
- /** Build project for compile/logic evidence. Prefers vmz-tools; optional N-API inject. */
12
+ /** Build project for compile/logic evidence. Prefers N-API `createWorkspace`, else Node `@vmz/vmz`. */
13
13
  export function buildForCompile(project, outDir, options = {}) {
14
14
  const dist = outDir || fs.mkdtempSync(path.join(os.tmpdir(), 'vmz-test-compile-'));
15
15
  if (!fs.existsSync(dist))
16
16
  fs.mkdirSync(dist, { recursive: true });
17
- const preferNapi = process.env.VMZ_TEST_BUILD === 'napi';
18
17
  const repoRoot = options.repoRoot || repoRootGuess;
19
- if (!preferNapi) {
20
- const cargoToml = path.join(repoRoot, 'Cargo.toml');
21
- if (fs.existsSync(cargoToml)) {
22
- const cargo = spawnSync('cargo', ['run', '--quiet', '--manifest-path', cargoToml, '-p', 'vmz-tools', '--', 'build', project, '--out-dir', dist], { cwd: repoRoot, encoding: 'utf8' });
23
- if (cargo.status === 0) {
24
- return { ok: true, outDir: dist, diagnostics: [] };
25
- }
26
- }
27
- }
18
+ const vmzJs = path.join(repoRoot, 'packages', 'runtimes', 'vmz', 'bin', 'vmz.js');
28
19
  if (options.createWorkspace) {
29
20
  try {
30
21
  const ws = options.createWorkspace({ root: project, outDir: dist });
@@ -55,11 +46,26 @@ export function buildForCompile(project, outDir, options = {}) {
55
46
  };
56
47
  }
57
48
  }
49
+ if (fs.existsSync(vmzJs)) {
50
+ const run = spawnSync(process.execPath, [vmzJs, 'build', project, '--out-dir', dist], {
51
+ cwd: repoRoot,
52
+ encoding: 'utf8',
53
+ });
54
+ if (run.status === 0) {
55
+ return { ok: true, outDir: dist, diagnostics: [] };
56
+ }
57
+ return {
58
+ ok: false,
59
+ outDir: dist,
60
+ diagnostics: [],
61
+ error: `build failed via @vmz/vmz (exit ${run.status}): ${run.stderr || run.stdout || ''}`.trim(),
62
+ };
63
+ }
58
64
  return {
59
65
  ok: false,
60
66
  outDir: dist,
61
67
  diagnostics: [],
62
- error: 'build failed: vmz-tools unavailable and no createWorkspace provided',
68
+ error: 'build failed: no createWorkspace provided and packages/runtimes/vmz/bin/vmz.js missing',
63
69
  };
64
70
  }
65
71
  export function resolveChunkArtifacts(dist, chunkId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vmz/test",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
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.17",
31
- "@vmz/protocol": "0.1.17",
30
+ "@vmz/core": "0.1.18",
31
+ "@vmz/protocol": "0.1.18",
32
32
  "linkedom": "^0.18.13",
33
33
  "puppeteer-core": "^24.11.2"
34
34
  },