@crossworks/app-build 0.232.112 → 0.232.122

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": "@crossworks/app-build",
3
- "version": "0.232.112",
3
+ "version": "0.232.122",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -8,13 +8,15 @@
8
8
  ".": "./src/index.ts"
9
9
  },
10
10
  "dependencies": {
11
+ "@mantle/share-ui": "npm:@crossworks/share-ui@0.232.122",
11
12
  "@tailwindcss/oxide": "^4.3.3",
12
13
  "esbuild": "^0.28.1",
13
- "tailwindcss": "^4.3.3",
14
14
  "lucide-react": "^1.25.0",
15
15
  "react": "^19.2.7",
16
16
  "react-dom": "^19.2.7",
17
- "@mantle/share-ui": "npm:@crossworks/share-ui@0.232.112"
17
+ "tailwindcss": "^4.3.3",
18
+ "@mantle/config": "0.0.1",
19
+ "@mantle/std": "0.0.1"
18
20
  },
19
21
  "devDependencies": {
20
22
  "@types/node": "^22.20.1",
@@ -8,6 +8,7 @@
8
8
  import { existsSync } from 'node:fs';
9
9
  import * as path from 'node:path';
10
10
  import { buildRuntime } from '../src/build-runtime.ts';
11
+ import { env } from '@mantle/config';
11
12
 
12
13
  /**
13
14
  * Where to write. Each Next app serves its own copy — the ACAO:* runtime has
@@ -36,8 +37,8 @@ import { buildRuntime } from '../src/build-runtime.ts';
36
37
  */
37
38
  const appArg = process.argv[2]?.trim();
38
39
  const appDir = path.resolve(process.cwd(), appArg ?? '.');
39
- const outDir = process.env.APP_RUNTIME_OUT
40
- ? path.resolve(process.env.APP_RUNTIME_OUT)
40
+ const outDir = env('APP_RUNTIME_OUT')
41
+ ? path.resolve(env('APP_RUNTIME_OUT'))
41
42
  : path.join(appDir, 'public/app-runtime');
42
43
 
43
44
  // Tripwire for the failure above: a Next app always has a `public/`, so its
@@ -45,7 +46,7 @@ const outDir = process.env.APP_RUNTIME_OUT
45
46
  // about to be written somewhere nothing serves. Fail loudly here rather than
46
47
  // print a cheerful success line pointing into node_modules. Skipped when
47
48
  // APP_RUNTIME_OUT names the destination outright.
48
- if (!process.env.APP_RUNTIME_OUT && !existsSync(path.join(appDir, 'public'))) {
49
+ if (!env('APP_RUNTIME_OUT') && !existsSync(path.join(appDir, 'public'))) {
49
50
  console.error(
50
51
  `app-runtime: ${appDir} has no public/ directory, so it is not an app.\n` +
51
52
  `Run this from the app directory (paths resolve from the cwd), or pass an ` +
@@ -126,7 +126,7 @@ export type RuntimeManifest = {
126
126
 
127
127
  /**
128
128
  * Build the shared runtime into `outDir` and return the manifest. The caller is
129
- * responsible for where `outDir` lives (apps/web/public/app-runtime) and for the
129
+ * responsible for where `outDir` lives (server/web/public/app-runtime) and for the
130
130
  * public URL prefix (`/app-runtime/`).
131
131
  */
132
132
  export async function buildRuntime(
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ import { fileURLToPath } from 'node:url';
15
15
  import esbuild, { type BuildOptions, type Message, type Plugin } from 'esbuild';
16
16
  import { buildAppCss } from './css';
17
17
  import { KIT } from './kit';
18
+ import { errorMessage } from '@mantle/std';
18
19
 
19
20
  /** Specifiers provided by the shared runtime via the iframe import map — marked
20
21
  * external so they stay as bare imports in the app bundle. The react family is
@@ -330,7 +331,7 @@ export async function buildApp(
330
331
  warnings: [
331
332
  ...result.warnings,
332
333
  {
333
- text: `app CSS compile failed (${err instanceof Error ? err.message : String(err)}); the app will rely on the host stylesheet`,
334
+ text: `app CSS compile failed (${errorMessage(err)}); the app will rely on the host stylesheet`,
334
335
  location: null,
335
336
  },
336
337
  ],
@@ -392,7 +393,7 @@ async function buildAppInner(source: AppSource): Promise<BuildResult> {
392
393
  }
393
394
  return {
394
395
  ok: false,
395
- errors: [{ text: err instanceof Error ? err.message : String(err), location: null }],
396
+ errors: [{ text: errorMessage(err), location: null }],
396
397
  warnings: [],
397
398
  esbuildVersion: ESBUILD_VERSION,
398
399
  };
package/src/kit.test.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
  import { KIT } from './kit';
3
3
 
4
- // The @host kit module is a string mirror of packages/web-ui/src/app-bridge/protocol.ts (formerly apps/web/lib/app-bridge)
4
+ // The @host kit module is a string mirror of packages/web-ui/src/app-bridge/protocol.ts (formerly server/web/lib/app-bridge)
5
5
  // (the sandbox can't import host code, so the shapes are duplicated by design).
6
6
  // These are drift tripwires: if a bridge kind is renamed or dropped on either
7
7
  // side, the app-facing API silently stops matching what the host answers.
package/src/kit.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * app's `@/components/ui/*`, `@/lib/utils`, and `@host` imports to these sources
4
4
  * (served from memory by kitPlugin), so generated apps look native (same theme
5
5
  * tokens) and talk to the host over the bridge — with NO dependency on the
6
- * apps/web source tree or its node_modules at build time. React is bundled into
6
+ * server/web source tree or its node_modules at build time. React is bundled into
7
7
  * each app (each iframe is its own isolated document).
8
8
  *
9
9
  * These are SOURCE STRINGS (TSX/TS), not live modules. They are compiled ONCE
@@ -11,7 +11,7 @@
11
11
  * via the iframe import map — apps mark `react`/`@host`/`@/components/ui/*`
12
12
  * external rather than re-bundling them. Keep them dependency-light (only `react`
13
13
  * + `react-dom/client` in @host) and theme-token-only (never hardcode colours),
14
- * matching apps/web/CLAUDE.md.
14
+ * matching server/web/CLAUDE.md.
15
15
  */
16
16
 
17
17
  /** `cn` — minimal class joiner (no clsx/tailwind-merge dep). Generated apps
@@ -148,7 +148,7 @@ export function Separator({ className, orientation = 'horizontal', ...p }) {
148
148
  * host resolves them server-side. `__mount` (used by the generated entry) wires
149
149
  * the React root, an error boundary, the ready signal, and auto-resize.
150
150
  *
151
- * Mirrors apps/web/lib/app-bridge/protocol.ts — keep the message shapes in sync.
151
+ * Mirrors server/web/lib/app-bridge/protocol.ts — keep the message shapes in sync.
152
152
  */
153
153
  const HOST = `
154
154
  import * as React from 'react';
@@ -24,12 +24,13 @@
24
24
  import { readFile } from 'node:fs/promises';
25
25
  import * as path from 'node:path';
26
26
  import { fileURLToPath } from 'node:url';
27
+ import { env } from '@mantle/config';
27
28
 
28
29
  const HERE = path.dirname(fileURLToPath(import.meta.url));
29
30
 
30
31
  /** In order of trust: explicit override, package-relative, cwd convention. */
31
32
  export function manifestCandidates(): string[] {
32
- const override = process.env.MANTLE_APP_RUNTIME_MANIFEST;
33
+ const override = env('MANTLE_APP_RUNTIME_MANIFEST');
33
34
  return [
34
35
  ...(override ? [override] : []),
35
36
  // packages/app-build/src → <root>/server/web/public/app-runtime/manifest.json