@ultimat3/cli 31.2.0 → 31.3.0
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/CLAUDE.md +2 -2
- package/package.json +29 -29
- package/src/app-load.ts +3 -2
- package/src/dev-boot.ts +4 -5
- package/src/dev-rebuild.ts +38 -5
- package/src/island-build-pool.ts +35 -0
- package/src/island-bundle.ts +137 -176
- package/src/island-cache-inputs.ts +141 -0
- package/src/island-duplicates.ts +36 -0
- package/src/island-group-cache.ts +289 -0
- package/src/island-groups.ts +117 -0
- package/src/island-outputs.ts +153 -0
- package/src/island-runtime.ts +5 -0
- package/src/island-styles.ts +68 -19
- package/src/verify-e2e.ts +17 -5
- package/wiki/Client-Data.md +14 -8
- package/wiki/Configuration.md +1 -1
- package/wiki/Deployment.md +1 -1
- package/wiki/Entities-And-Migrations.md +15 -10
- package/wiki/Storage-And-Uploads.md +1 -1
- package/wiki/Testing.md +1 -0
package/CLAUDE.md
CHANGED
|
@@ -116,7 +116,7 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
116
116
|
| `generate-refresh.ts` | `x g` refreshes the manifest only when a written file needs it |
|
|
117
117
|
| `role-load.ts` / `document-graph.ts` / `serve-web.ts` | a role imports what it runs: `ROLE_LOADS` (`X_ROLE_LOAD_INCOMPLETE`) † |
|
|
118
118
|
| `module-imports.ts` | a module's imports, resolved once for both graphs: `referenced` (reload), `evaluated` (document) |
|
|
119
|
-
| `cmd-dev.ts` / `dev-boot.ts` / `dev-rebuild.ts` / `dev-route-table.ts` | `x dev`: every role in one process, `/_x`, the watcher; one save = one generation † |
|
|
119
|
+
| `cmd-dev.ts` / `dev-boot.ts` / `dev-rebuild.ts` / `dev-route-table.ts` | `x dev`: every role in one process, `/_x`, the watcher; one save = one generation, and the boot is the first: `buildGeneration` builds the manifest and the islands at once † |
|
|
120
120
|
| `runtime-bindings.ts` | which service each binding points at (embedded or external); events follow `NATS_URL` |
|
|
121
121
|
| `runtime-queue.ts` / `runtime-services.ts` / `runtime-bus.ts` | db + queue; every other accessor; the bus |
|
|
122
122
|
| `framework-schema-apply.ts` / `framework-schema-stamp.ts` | the framework tables, applied in one locked transaction † |
|
|
@@ -141,7 +141,7 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
141
141
|
| `page-navigation.ts` | the client router for `navigation.client` surfaces — built, routed and named ONCE for `x dev`, the container and the static export; none opted in builds nothing |
|
|
142
142
|
| `page-speculation.ts` | Speculation Rules for documents WITHOUT the router (`navigation.speculation`): an allow-list of pure-read pages ‡ |
|
|
143
143
|
| `static-document.ts` | a served `static` page: `304` on `If-None-Match`; container keeps the document (never `x dev`) † |
|
|
144
|
-
| `island-{bundle,store,sources,runtime}.ts` / `island-realtime*.ts` / `solid-loader.ts` | islands: one `Bun.build`
|
|
144
|
+
| `island-{bundle,groups,outputs,build-pool,group-cache,cache-inputs,store,sources,runtime}.ts` / `island-realtime*.ts` / `solid-loader.ts` | islands, source-addressed: one `Bun.build` per route group — islands on exactly the same routes split together, every other alone; groups read from `page.tsx` sources, the one input every caller has before rendering (`islands.sharedChunks` = one group). A group's output is reused from `.x/cache/islands/` while every file it read (Sass partials included), every directory listing it resolved in and the lockfile/tsconfig/`package.json` environment hash the same (`reuse: false` for a determinism test) † |
|
|
145
145
|
| `local-cli.ts` / `local-cli-handoff.ts` | a global `x` hands over to the app's own CLI (`local-cli.ts` decides whether; `x upgrade` alone stays when the app's is strictly older — `upgrade-handover.test.ts`) |
|
|
146
146
|
| `serve-prebuilt.ts` / `serve-prebuilt-paths.ts` | the image's prebuilt store; a boot that built anything logs `X_IMAGE_NOT_PREBUILT` † |
|
|
147
147
|
| `dev-*.ts` | `x dev` only: dashboard sources, traces, the N+1 ledger, watcher, reload, lock, port |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/cli",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.3.0",
|
|
4
4
|
"description": "The `x` binary: new, dev, build, verify, generate, db, mcp, doctor, deploy",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -53,34 +53,34 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@babel/core": "^8.0.9",
|
|
56
|
-
"@ultimat3/action": "31.
|
|
57
|
-
"@ultimat3/admin": "31.
|
|
58
|
-
"@ultimat3/ai": "31.
|
|
59
|
-
"@ultimat3/auth": "31.
|
|
60
|
-
"@ultimat3/cache": "31.
|
|
61
|
-
"@ultimat3/core": "31.
|
|
62
|
-
"@ultimat3/db": "31.
|
|
63
|
-
"@ultimat3/entity": "31.
|
|
64
|
-
"@ultimat3/flags": "31.
|
|
65
|
-
"@ultimat3/http": "31.
|
|
66
|
-
"@ultimat3/i18n": "31.
|
|
67
|
-
"@ultimat3/jobs": "31.
|
|
68
|
-
"@ultimat3/mail": "31.
|
|
69
|
-
"@ultimat3/manifest": "31.
|
|
70
|
-
"@ultimat3/mcp": "31.
|
|
71
|
-
"@ultimat3/money": "31.
|
|
72
|
-
"@ultimat3/notify": "31.
|
|
73
|
-
"@ultimat3/policy": "31.
|
|
74
|
-
"@ultimat3/pwa": "31.
|
|
75
|
-
"@ultimat3/query": "31.
|
|
76
|
-
"@ultimat3/realtime": "31.
|
|
77
|
-
"@ultimat3/render": "31.
|
|
78
|
-
"@ultimat3/schema": "31.
|
|
79
|
-
"@ultimat3/scraping": "31.
|
|
80
|
-
"@ultimat3/seo": "31.
|
|
81
|
-
"@ultimat3/storage": "31.
|
|
82
|
-
"@ultimat3/testing": "31.
|
|
83
|
-
"@ultimat3/time": "31.
|
|
56
|
+
"@ultimat3/action": "31.3.0",
|
|
57
|
+
"@ultimat3/admin": "31.3.0",
|
|
58
|
+
"@ultimat3/ai": "31.3.0",
|
|
59
|
+
"@ultimat3/auth": "31.3.0",
|
|
60
|
+
"@ultimat3/cache": "31.3.0",
|
|
61
|
+
"@ultimat3/core": "31.3.0",
|
|
62
|
+
"@ultimat3/db": "31.3.0",
|
|
63
|
+
"@ultimat3/entity": "31.3.0",
|
|
64
|
+
"@ultimat3/flags": "31.3.0",
|
|
65
|
+
"@ultimat3/http": "31.3.0",
|
|
66
|
+
"@ultimat3/i18n": "31.3.0",
|
|
67
|
+
"@ultimat3/jobs": "31.3.0",
|
|
68
|
+
"@ultimat3/mail": "31.3.0",
|
|
69
|
+
"@ultimat3/manifest": "31.3.0",
|
|
70
|
+
"@ultimat3/mcp": "31.3.0",
|
|
71
|
+
"@ultimat3/money": "31.3.0",
|
|
72
|
+
"@ultimat3/notify": "31.3.0",
|
|
73
|
+
"@ultimat3/policy": "31.3.0",
|
|
74
|
+
"@ultimat3/pwa": "31.3.0",
|
|
75
|
+
"@ultimat3/query": "31.3.0",
|
|
76
|
+
"@ultimat3/realtime": "31.3.0",
|
|
77
|
+
"@ultimat3/render": "31.3.0",
|
|
78
|
+
"@ultimat3/schema": "31.3.0",
|
|
79
|
+
"@ultimat3/scraping": "31.3.0",
|
|
80
|
+
"@ultimat3/seo": "31.3.0",
|
|
81
|
+
"@ultimat3/storage": "31.3.0",
|
|
82
|
+
"@ultimat3/testing": "31.3.0",
|
|
83
|
+
"@ultimat3/time": "31.3.0",
|
|
84
84
|
"babel-preset-solid": "^1.9.16"
|
|
85
85
|
}
|
|
86
86
|
}
|
package/src/app-load.ts
CHANGED
|
@@ -209,9 +209,10 @@ export function isScannedModule(root: string, absolute: string): boolean {
|
|
|
209
209
|
// `~/dev/node_modules-experiments/myapp` answered `includes('node_modules')` for every
|
|
210
210
|
// file it holds, so this loop imported none of them and the app registered nothing.
|
|
211
211
|
// The ROOT-RELATIVE path is tested, never the absolute one: an app checked out under
|
|
212
|
-
// `~/work/my.test.app` matched `.test.` on every file and loaded none of them
|
|
212
|
+
// `~/work/my.test.app` matched `.test.` on every file and loaded none of them, and one under
|
|
213
|
+
// `<anything>/node_modules/<app>` matched the segment on every file the same way.
|
|
213
214
|
const file = posixRelative(root, absolute);
|
|
214
|
-
if (hasPathSegment(
|
|
215
|
+
if (hasPathSegment(file, 'node_modules') || isTest(file)) return false;
|
|
215
216
|
return !(
|
|
216
217
|
ENTRY_POINT.test(file) ||
|
|
217
218
|
EXERCISE_FILE.test(file) ||
|
package/src/dev-boot.ts
CHANGED
|
@@ -10,7 +10,6 @@ import type { OverlayNotice, RequestContext } from '@ultimat3/http';
|
|
|
10
10
|
import { asCtx } from '@ultimat3/http';
|
|
11
11
|
import { loadSignInPath } from './app-auth';
|
|
12
12
|
import { loadAppConfig } from './app-config-load';
|
|
13
|
-
import { appManifest } from './app-manifest';
|
|
14
13
|
import type { StalePin } from './app-reload-graph';
|
|
15
14
|
import { enableReloadTracking } from './app-reload-graph';
|
|
16
15
|
import { loadAppRuntime } from './app-runtime';
|
|
@@ -20,12 +19,11 @@ import { createInvalidationLog } from './dev-dashboard-invalidations';
|
|
|
20
19
|
import { declareDevEnvironment, needsDevEnvironmentDeclaration } from './dev-environment';
|
|
21
20
|
import { createStatementLedger } from './dev-n-plus-one';
|
|
22
21
|
import type { DevState } from './dev-rebuild';
|
|
23
|
-
import { devRebuilder } from './dev-rebuild';
|
|
22
|
+
import { buildGeneration, devRebuilder } from './dev-rebuild';
|
|
24
23
|
import { devRouteTable } from './dev-route-table';
|
|
25
24
|
import { createTraceRecorder } from './dev-traces';
|
|
26
25
|
import { watchTree } from './dev-watch-tree';
|
|
27
26
|
import { armFailureCapture } from './failure-capture-boot';
|
|
28
|
-
import { buildIslands } from './island-bundle';
|
|
29
27
|
import { FRAME_STYLE } from './island-harness';
|
|
30
28
|
import type { Finding } from './output';
|
|
31
29
|
import { plainRoutes } from './plain-routes';
|
|
@@ -184,13 +182,14 @@ async function bootDev(
|
|
|
184
182
|
// two projections of one scan. Until 2026-09-07 this was `loadApp` for the findings and then
|
|
185
183
|
// `appManifest` — which loads again — for the manifest, so a save landing between the two put
|
|
186
184
|
// `/_x`'s findings and its manifest on different registration states.
|
|
187
|
-
|
|
185
|
+
// The islands are built beside that load, never after it: `buildGeneration`, as every save does.
|
|
186
|
+
const app = await buildGeneration(options.root);
|
|
188
187
|
const state: DevState = {
|
|
189
188
|
manifest: app.manifest,
|
|
190
189
|
reloads: 0,
|
|
191
190
|
reloadFinding: undefined,
|
|
192
191
|
appFindings: app.findings,
|
|
193
|
-
islands:
|
|
192
|
+
islands: app.islands,
|
|
194
193
|
};
|
|
195
194
|
// `serve-boot.ts`'s guard, at its point: after the app's modules, before any role serves. On
|
|
196
195
|
// PGlite the boot serves as `x_app`; on an external database a role that bypasses is refused.
|
package/src/dev-rebuild.ts
CHANGED
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
import type { Manifest } from '@ultimat3/manifest';
|
|
6
6
|
import { beginDeviceSocketGeneration } from '@ultimat3/realtime/server';
|
|
7
7
|
import type { IsrController } from '@ultimat3/render/server';
|
|
8
|
+
import type { AppManifest } from './app-manifest';
|
|
8
9
|
import { appManifest } from './app-manifest';
|
|
9
10
|
import type { StalePin } from './app-reload-graph';
|
|
10
11
|
import { takeStalePins } from './app-reload-graph';
|
|
11
12
|
import type { ReloadTrigger } from './dev-reload';
|
|
12
13
|
import { coalesceReloads } from './dev-reload';
|
|
13
14
|
import { restartFinding } from './dev-supervisor';
|
|
14
|
-
import type { IslandBundle } from './island-bundle';
|
|
15
|
+
import type { BuildIslandsOptions, IslandBundle } from './island-bundle';
|
|
15
16
|
import { buildIslands } from './island-bundle';
|
|
17
|
+
import { appPersistsRecords } from './island-realtime-state';
|
|
16
18
|
import type { Finding } from './output';
|
|
17
19
|
import { findingFrom } from './output';
|
|
18
20
|
|
|
@@ -36,6 +38,40 @@ export interface DevState {
|
|
|
36
38
|
islands: IslandBundle;
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
/** The two builders of one generation — the seam a test times them through. */
|
|
42
|
+
export interface GenerationBuilders {
|
|
43
|
+
readonly manifest: (root: string) => Promise<AppManifest>;
|
|
44
|
+
readonly islands: (root: string, options: BuildIslandsOptions) => Promise<IslandBundle>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const BUILDERS: GenerationBuilders = { manifest: appManifest, islands: buildIslands };
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* One generation — the app's manifest and its island bundle — both builders started at once, at
|
|
51
|
+
* the boot as on every save. The island build is Bun's bundler, off the JS thread, and the app
|
|
52
|
+
* load is imports on it: one after the other, a 5,000-file app's boot paid ~4 s and ~12 s in sum
|
|
53
|
+
* before its first 200 (`scripts/bench/results/boot-large-app.json`).
|
|
54
|
+
*/
|
|
55
|
+
export async function buildGeneration(
|
|
56
|
+
root: string,
|
|
57
|
+
build: GenerationBuilders = BUILDERS,
|
|
58
|
+
): Promise<AppManifest & { readonly islands: IslandBundle }> {
|
|
59
|
+
const loaded = build.manifest(root);
|
|
60
|
+
// The one answer the island build takes from the app — whether it persists records — read only
|
|
61
|
+
// once the load has settled: before it the registry is empty, and every reader island would be
|
|
62
|
+
// built as one that restores (`island-realtime.ts`). Only realtime groups wait for it.
|
|
63
|
+
const persists = (): Promise<boolean | undefined> =>
|
|
64
|
+
loaded.then(
|
|
65
|
+
() => appPersistsRecords(),
|
|
66
|
+
() => undefined,
|
|
67
|
+
);
|
|
68
|
+
const [{ manifest, findings }, islands] = await Promise.all([
|
|
69
|
+
loaded,
|
|
70
|
+
build.islands(root, { persists }),
|
|
71
|
+
]);
|
|
72
|
+
return { manifest, findings, islands };
|
|
73
|
+
}
|
|
74
|
+
|
|
39
75
|
/** What a rebuild reports to, read off `StartDevOptions`. */
|
|
40
76
|
export interface DevRebuildOptions {
|
|
41
77
|
readonly root: string;
|
|
@@ -73,10 +109,7 @@ export function devRebuilder(
|
|
|
73
109
|
async (file) => {
|
|
74
110
|
const started = performance.now();
|
|
75
111
|
beginDeviceSocketGeneration();
|
|
76
|
-
const
|
|
77
|
-
appManifest(options.root),
|
|
78
|
-
buildIslands(options.root),
|
|
79
|
-
]);
|
|
112
|
+
const { manifest, findings, islands } = await buildGeneration(options.root);
|
|
80
113
|
state.manifest = manifest;
|
|
81
114
|
state.appFindings = findings;
|
|
82
115
|
state.islands = islands;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// The pool the island build runs its groups through: at most `width` at once, answers in item
|
|
2
|
+
// order, and stopped by its first failure.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `run` over `items`, at most `width` at a time, answers in `items` order. 159 builds at once (the
|
|
6
|
+
* bench app) bought nothing over twelve — the plugins' callbacks share one JS thread — and held
|
|
7
|
+
* every build's graph in memory together.
|
|
8
|
+
*/
|
|
9
|
+
export async function boundedMap<T, R>(
|
|
10
|
+
items: readonly T[],
|
|
11
|
+
width: number,
|
|
12
|
+
run: (item: T) => Promise<R>,
|
|
13
|
+
): Promise<R[]> {
|
|
14
|
+
const results: R[] = new Array(items.length);
|
|
15
|
+
let next = 0;
|
|
16
|
+
// Set by the first rejection and read before every start: the builds already in flight finish
|
|
17
|
+
// (a `Bun.build` cannot be cancelled), but no idle worker takes another group — in `x dev` one
|
|
18
|
+
// island's syntax error left every remaining group bundling, ~12 s, into the next generation.
|
|
19
|
+
// And the call answers only once those in flight HAVE finished: each registers stylesheets and
|
|
20
|
+
// pins chunk bytes process-wide, so one outliving the call would write into the next generation.
|
|
21
|
+
let failure: { readonly error: unknown } | undefined;
|
|
22
|
+
const worker = async (): Promise<void> => {
|
|
23
|
+
for (let index = next++; failure === undefined && index < items.length; index = next++) {
|
|
24
|
+
try {
|
|
25
|
+
results[index] = await run(items[index] as T);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if (failure === undefined) failure = { error };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const workers = Math.max(1, Math.min(width, items.length));
|
|
32
|
+
await Promise.all(Array.from({ length: items.length === 0 ? 0 : workers }, worker));
|
|
33
|
+
if (failure !== undefined) throw failure.error;
|
|
34
|
+
return results;
|
|
35
|
+
}
|