@volter/twin-world 0.1.1 → 0.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/twin-world",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "World configs for twins: boot named local runtimes, allocate ports, generate world.env/instance.json, and run apps against fake-key twin worlds.",
5
5
  "keywords": [
6
6
  "twin",
@@ -59,7 +59,7 @@
59
59
  "bun": ">=1.2.0"
60
60
  },
61
61
  "peerDependencies": {
62
- "@volter/twin": "0.1.1"
62
+ "@volter/twin": "^0.1.2"
63
63
  },
64
64
  "dependencies": {
65
65
  "@electric-sql/pglite": "0.5.8",
package/src/cli.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env bun
2
+ import { fileURLToPath } from 'node:url';
2
3
  import { spawnSync } from 'node:child_process';
3
4
  import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
4
5
  import { tmpdir } from 'node:os';
@@ -588,7 +589,8 @@ async function main(): Promise<void> {
588
589
  caFile = join(mkdtempSync(join(tmpdir(), 'volter-attach-')), 'ca.pem');
589
590
  writeFileSync(caFile, manifest.ca);
590
591
  }
591
- const injectPath = resolvePath(import.meta.dir, '../../control-plane/inject.cjs');
592
+ // The injector ships with @volter/twin (installed or workspace-linked); the sibling path is the bare checkout's.
593
+ const injectPath = (() => { try { return fileURLToPath(import.meta.resolve('@volter/twin/inject')); } catch { return resolvePath(import.meta.dir, '../../control-plane/inject.cjs'); } })();
592
594
  const env = remoteAttachEnv(manifest, { injectPath, ...(caFile === undefined ? {} : { caFile }) });
593
595
  const result = spawnSync(command[0]!, command.slice(1), { env: { ...process.env, ...env }, stdio: 'inherit' });
594
596
  process.exit(result.status ?? 1);
package/src/pack-facts.ts CHANGED
@@ -10,6 +10,7 @@
10
10
 
11
11
  import { readFileSync } from 'node:fs';
12
12
  import { join } from 'node:path';
13
+ import { fileURLToPath } from 'node:url';
13
14
 
14
15
  export type PackAdoption = { sdks?: string[]; pypi?: string[]; scopes?: string[]; envStems?: string[]; worldIds?: string[] };
15
16
  export type PackFacts = {
@@ -24,9 +25,13 @@ export type PackFacts = {
24
25
  serveExport?: string;
25
26
  };
26
27
 
27
- // world-runtime and control-plane are sibling workspace packages; the artifact is committed,
28
- // so a missing file is a broken checkout (or an unbuilt generator change), never a soft state.
29
- const FACTS_PATH = join(import.meta.dir, '..', '..', 'control-plane', 'generated', 'pack-facts.json');
28
+ // The artifact is committed in the control plane and shipped with it: resolved through the package (@volter/twin,
29
+ // installed or workspace-linked), else the sibling workspace path. A missing file is a broken checkout (or an
30
+ // unbuilt generator change), never a soft state.
31
+ const FACTS_PATH = (() => {
32
+ try { return fileURLToPath(import.meta.resolve('@volter/twin/generated/pack-facts.json')); } catch { /* not resolvable: a checkout without node_modules */ }
33
+ return join(import.meta.dir, '..', '..', 'control-plane', 'generated', 'pack-facts.json');
34
+ })();
30
35
 
31
36
  let cached: Record<string, PackFacts> | null = null;
32
37
  export function packFacts(): Record<string, PackFacts> {