@arcote.tech/arc-cli 0.7.0 → 0.7.2

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": "@arcote.tech/arc-cli",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "CLI tool for Arc framework",
5
5
  "module": "index.ts",
6
6
  "main": "dist/index.js",
@@ -12,12 +12,12 @@
12
12
  "build": "bun build --target=bun ./src/index.ts --outdir=dist --external @arcote.tech/arc --external @arcote.tech/arc-ds --external @arcote.tech/arc-react --external @arcote.tech/platform && chmod +x dist/index.js"
13
13
  },
14
14
  "dependencies": {
15
- "@arcote.tech/arc": "^0.7.0",
16
- "@arcote.tech/arc-ds": "^0.7.0",
17
- "@arcote.tech/arc-react": "^0.7.0",
18
- "@arcote.tech/arc-host": "^0.7.0",
19
- "@arcote.tech/arc-adapter-db-sqlite": "^0.7.0",
20
- "@arcote.tech/platform": "^0.7.0",
15
+ "@arcote.tech/arc": "^0.7.2",
16
+ "@arcote.tech/arc-ds": "^0.7.2",
17
+ "@arcote.tech/arc-react": "^0.7.2",
18
+ "@arcote.tech/arc-host": "^0.7.2",
19
+ "@arcote.tech/arc-adapter-db-sqlite": "^0.7.2",
20
+ "@arcote.tech/platform": "^0.7.2",
21
21
  "@clack/prompts": "^0.9.0",
22
22
  "commander": "^11.1.0",
23
23
  "chokidar": "^3.5.3",
@@ -3,27 +3,12 @@ import {
3
3
  existsSync,
4
4
  mkdirSync,
5
5
  readFileSync,
6
- realpathSync,
7
6
  unlinkSync,
8
7
  writeFileSync,
9
8
  } from "fs";
10
- import { dirname, join } from "path";
11
- import { fileURLToPath } from "url";
9
+ import { join } from "path";
12
10
  import { isContextPackage, type WorkspacePackage } from "./module-builder";
13
11
 
14
- // Locate platform's server entry by walking up from the CLI bundle location.
15
- // `import.meta.url` at runtime points to the bundled `dist/index.js` (the CLI
16
- // is shipped as a single Bun.build artifact), so the path is:
17
- // <arcRoot>/packages/cli/dist/index.js
18
- // Four `dirname` applications reach <arcRoot>. This works regardless of how
19
- // the user invoked the CLI — symlink, npm install, or direct path — as long
20
- // as the CLI binary lives at packages/cli/dist/ inside the arc workspace.
21
- function locatePlatformServerEntry(): string {
22
- const here = fileURLToPath(import.meta.url);
23
- const arcRoot = realpathSync(dirname(dirname(dirname(dirname(here)))));
24
- return join(arcRoot, "packages", "platform", "src", "index.server.ts");
25
- }
26
-
27
12
  // ---------------------------------------------------------------------------
28
13
  // access-extractor — discovers per-module access rules (`protectedBy(...)`)
29
14
  // from already-built server bundles, in an ISOLATED subprocess.
@@ -64,8 +49,7 @@ export async function extractAccessMap(
64
49
  // Each entry: a context-package server bundle path that the worker will
65
50
  // dynamically import. Bun resolves the bundle's internal external imports
66
51
  // (`@arcote.tech/platform` etc.) via node_modules walking from the bundle
67
- // location — workspace symlinks point back to source, conditional exports
68
- // pick the server entry.
52
+ // location — workspace symlinks point back to source.
69
53
  const serverBundles = packages
70
54
  .filter((p) => isContextPackage(p.packageJson))
71
55
  .map((p) => ({
@@ -75,8 +59,9 @@ export async function extractAccessMap(
75
59
  .filter((b) => existsSync(b.path));
76
60
 
77
61
  // Worker must live INSIDE the workspace tree so Bun's module resolver can
78
- // walk up to <rootDir>/node_modules and find @arcote.tech/platform/server.
79
- // A tmpfile in /tmp/ would fail bare-specifier resolution.
62
+ // walk up to <rootDir>/node_modules and find @arcote.tech/platform via the
63
+ // bare specifier `@arcote.tech/platform`. A tmpfile in /tmp/ would fail
64
+ // bare-specifier resolution.
80
65
  const workerDir = join(rootDir, ".arc", ".tmp");
81
66
  mkdirSync(workerDir, { recursive: true });
82
67
  const workerPath = join(workerDir, `access-extractor-${Date.now()}.mjs`);
@@ -91,7 +76,6 @@ export async function extractAccessMap(
91
76
  ...process.env,
92
77
  ARC_ACCESS_BUNDLES: JSON.stringify(serverBundles),
93
78
  ARC_ACCESS_OUT: outPath,
94
- ARC_PLATFORM_ENTRY: locatePlatformServerEntry(),
95
79
  },
96
80
  stdout: "pipe",
97
81
  stderr: "inherit",
@@ -131,9 +115,11 @@ if (!out) {
131
115
  process.exit(2);
132
116
  }
133
117
 
134
- // Direct file-path import — bypasses node_modules resolution entirely.
135
- // Avoids quirks with bun-link snapshots holding stale package.json exports.
136
- const platform = await import(process.env.ARC_PLATFORM_ENTRY);
118
+ // Bare-specifier import — Bun walks up from this worker's location
119
+ // (<rootDir>/.arc/.tmp/) to <rootDir>/node_modules and finds the package.
120
+ // Single entry (./src/index.ts) — React imports on top level are benign
121
+ // (createContext, function defs); no DOM access until actual render.
122
+ const platform = await import("@arcote.tech/platform");
137
123
 
138
124
  for (const { name, path } of bundles) {
139
125
  try {