moi-computer 0.1.2 → 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": "moi-computer",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Local AI workspace powered by the Claude Agent SDK, Bun, React, and Tailwind. Requires Bun.",
5
5
  "license": "Elastic-2.0",
6
6
  "type": "module",
package/server/applets.ts CHANGED
@@ -62,7 +62,9 @@ async function resolveSource(sourceDir: string, name: string): Promise<string |
62
62
 
63
63
  // A bundle is stale if its entry `index.js` is missing, or the source — or any
64
64
  // `.server.ts` it imports (RPC stubs are inlined) or asset it imports (emitted
65
- // into the bundle dir) — is newer than the built entry.
65
+ // into the bundle dir) — is newer than the built entry. The bundle itself is
66
+ // React-mode-agnostic (see buildApplet), so it needs no rebuild when the server
67
+ // switches between the development and production React.
66
68
  async function needsRebuild(buildDir: string, name: string, srcPath: string): Promise<boolean> {
67
69
  const built = Bun.file(join(buildDir, name, 'index.js'))
68
70
  if (!(await built.exists())) return true
@@ -10,8 +10,6 @@ import { basename, dirname, join, relative, sep } from 'path'
10
10
 
11
11
  import type { ViewConfig, WidgetConfig } from '@/lib/types'
12
12
 
13
- import { prebuilt } from './static'
14
-
15
13
  // An **applet** is any custom UI unit embedded in a workspace; `widget` and
16
14
  // `view` are its kinds (more may follow). All compile through this pipeline —
17
15
  // `kind` only diverges at the edges: which `config` schema is parsed, the
@@ -521,14 +519,20 @@ export async function buildApplet(
521
519
  target: 'browser',
522
520
  sourcemap: 'inline',
523
521
  external: EXTERNAL_MODULES,
524
- // Pin the JSX runtime to match the React build the vendor route serves
525
- // (server/vendor.ts keys off the same `prebuilt` flag): production emits
526
- // `jsx`/`jsxs` (react/jsx-runtime), development emits `jsxDEV`
527
- // (react/jsx-dev-runtime). Without this, Bun defaults to `jsxDEV` (the
528
- // widget `root` dir has no tsconfig to say otherwise), which crashes in a
529
- // prebuilt/global install where the production React has `jsxDEV === undefined`.
522
+ // Always compile to the PRODUCTION automatic JSX runtime (`jsx`/`jsxs`
523
+ // from react/jsx-runtime), making the on-disk bundle mode-agnostic: it
524
+ // runs under both the development and production servers without a rebuild.
525
+ // Both vendored React builds export working `jsx`/`jsxs` — only `jsxDEV`
526
+ // is production-undefined, so the dev transform (Bun's default here, since
527
+ // the widget `root` has no tsconfig) crashes against the production React a
528
+ // prebuilt/global install serves ("jsxDEV is not a function"). This matters
529
+ // because widgets built in one mode (e.g. `bun run dev`) are served as-is
530
+ // in the other (`moi start`) — no source change, so no rebuild is triggered.
531
+ // Dev still gets React's runtime warnings: the vendor route serves the
532
+ // development React, whose `jsx()` validates; only jsxDEV's extra
533
+ // source-location detail is forgone.
530
534
  define: {
531
- 'process.env.NODE_ENV': JSON.stringify(prebuilt ? 'production' : 'development')
535
+ 'process.env.NODE_ENV': JSON.stringify('production')
532
536
  },
533
537
  // The bundle is a directory: a fixed `index.js` entry (the client
534
538
  // dynamic-imports it) plus content-hashed `chunk-*.js` for any dynamic