@abide/abide 0.123.2 → 0.124.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/ABIDE.md +8 -5
- package/CHANGELOG.md +58 -0
- package/bin/abide.ts +36 -65
- package/docs/REGISTRY.md +45 -12
- package/docs/RULEBOOK.md +24 -14
- package/docs/abide.md +999 -459
- package/package.json +1 -1
- package/src/compiler/ARRAY_MUTATORS.ts +20 -0
- package/src/compiler/Diagnostics.ts +198 -0
- package/src/compiler/KeptChecker.ts +97 -0
- package/src/compiler/LoweredFile.ts +609 -0
- package/src/compiler/Lowering.ts +18 -1
- package/src/compiler/PositionedRefusal.ts +1 -1
- package/src/compiler/SHARED_NAMES.ts +2 -0
- package/src/compiler/ShadowHost.ts +670 -0
- package/src/compiler/ShadowMap.ts +1 -1
- package/src/compiler/TypeSession.ts +76 -1743
- package/src/compiler/appLayout.ts +28 -20
- package/src/compiler/appLints.ts +109 -0
- package/src/compiler/argsDefaultsIn.ts +1 -1
- package/src/compiler/checkApp.ts +64 -68
- package/src/compiler/checkedShadow.ts +2 -2
- package/src/compiler/classifyRead.ts +16 -1
- package/src/compiler/compileApp.ts +102 -71
- package/src/compiler/declaredExports.ts +46 -21
- package/src/compiler/diagnoseSources.ts +232 -0
- package/src/compiler/emitClient.ts +1 -1
- package/src/compiler/formatAbide.ts +7 -8
- package/src/compiler/handlersUnder.ts +32 -63
- package/src/compiler/lineOf.ts +0 -19
- package/src/compiler/matchersOf.ts +3 -3
- package/src/compiler/mountsOf.ts +3 -3
- package/src/compiler/reactiveReads.ts +235 -0
- package/src/compiler/reactiveTypes.ts +13 -0
- package/src/compiler/readSources.ts +16 -18
- package/src/compiler/readsIn.ts +181 -82
- package/src/compiler/routesDeclaration.ts +46 -0
- package/src/compiler/scaffold.ts +7 -2
- package/src/compiler/serveLanguage.ts +46 -74
- package/src/compiler/sharedModuleWrites.ts +1 -1
- package/src/compiler/splitImports.ts +2 -2
- package/src/compiler/templateWarnings.ts +1 -2
- package/src/compiler/trackingWarnings.ts +1 -1
- package/src/server/CLIENT_BUILD.ts +4 -32
- package/src/server/DesktopSession.ts +213 -0
- package/src/server/Followers.ts +399 -0
- package/src/server/MODULE_QUERIES.ts +6 -2
- package/src/server/PageRender.ts +201 -0
- package/src/server/RESUME_MILLISECONDS.ts +2 -0
- package/src/server/abideModules.ts +7 -7
- package/src/server/answerFailure.ts +3 -2
- package/src/server/answerRequest.ts +16 -369
- package/src/server/answerRpc.ts +48 -302
- package/src/server/answerSocket.ts +41 -490
- package/src/server/appBuild.ts +377 -0
- package/src/server/appKit.ts +1 -1
- package/src/server/appPlugins.ts +15 -17
- package/src/server/appTree.ts +6 -5
- package/src/server/argsContract.ts +209 -0
- package/src/server/bridgeRelay.ts +153 -65
- package/src/server/claudeCode.ts +30 -127
- package/src/server/config.ts +6 -7
- package/src/server/createApp.ts +38 -66
- package/src/server/csp.ts +1 -1
- package/src/server/deferredBuilds.ts +3 -16
- package/src/server/devWorker.ts +11 -15
- package/src/server/faceOf.ts +1 -1
- package/src/server/generatedSurfaces.ts +2 -1
- package/src/server/handlerFileMount.ts +40 -0
- package/src/server/index.ts +3 -3
- package/src/server/installServer.ts +5 -9
- package/src/server/invokeHandler.ts +230 -0
- package/src/server/mountHandlers.ts +184 -0
- package/src/server/openDesktopWindow.ts +308 -0
- package/src/server/packageDirectory.ts +14 -0
- package/src/server/preload.ts +21 -2
- package/src/server/principal.ts +5 -4
- package/src/server/remote.ts +2 -2
- package/src/server/render.ts +31 -59
- package/src/server/requestScope.ts +5 -36
- package/src/server/runCompiled.ts +1 -1
- package/src/server/runDesktop.ts +20 -448
- package/src/server/seedBuffer.ts +12 -12
- package/src/server/serveDev.ts +24 -58
- package/src/server/servedApp.ts +390 -0
- package/src/server/shell.ts +1 -1
- package/src/server/signInChanged.ts +20 -0
- package/src/server/surfaceOf.ts +3 -2
- package/src/server/versionOf.ts +7 -16
- package/src/shared/RPC_SERVER.ts +27 -31
- package/src/shared/Schema.ts +1 -2
- package/src/shared/applyPatch.ts +1 -1
- package/src/shared/index.ts +1 -1
- package/src/shared/{note.ts → issueReport.ts} +22 -0
- package/src/shared/loadCall.ts +66 -0
- package/src/shared/muxFrames.ts +1 -1
- package/src/shared/reactive/Keyed.ts +24 -16
- package/src/shared/reactive/Reactive.ts +37 -991
- package/src/shared/reactive/argsContract.ts +131 -4
- package/src/shared/reactive/byOf.ts +2 -5
- package/src/shared/reactive/callLoad.ts +8 -14
- package/src/shared/reactive/cellShape.ts +734 -0
- package/src/shared/reactive/index.ts +12 -23
- package/src/shared/reactive/pairReactive.ts +5 -3
- package/src/shared/reactive/patchLog.ts +79 -0
- package/src/shared/reactive/patchMarks.ts +34 -0
- package/src/shared/reactive/producer.ts +121 -0
- package/src/shared/reactive/recordWrites.ts +11 -14
- package/src/shared/reactive/scoped.ts +3 -2
- package/src/shared/reactive/selections.ts +209 -0
- package/src/shared/reactive/share.ts +4 -3
- package/src/shared/reactive/watch.ts +3 -4
- package/src/shared/rpc.ts +20 -24
- package/src/shared/validateJson.ts +1 -2
- package/src/shared/writePath.ts +29 -0
- package/src/ui/ArmRegion.ts +10 -4
- package/src/ui/Level.ts +11 -20
- package/src/ui/LevelChain.ts +272 -0
- package/src/ui/Router.ts +106 -313
- package/src/ui/Scope.ts +17 -3
- package/src/ui/TryRegion.ts +22 -23
- package/src/ui/bindSpread.ts +2 -4
- package/src/ui/listenForRoutes.ts +3 -10
- package/src/ui/outboxQueue.ts +23 -11
- package/src/ui/outcomeOf.ts +120 -0
- package/src/ui/reconcile.ts +4 -6
- package/src/ui/routing.ts +2 -1
- package/src/ui/rows.ts +2 -2
- package/src/ui/setAttribute.ts +12 -3
- package/src/ui/socketWire.ts +28 -13
- package/src/ui/wire.ts +9 -10
- package/src/compiler/Finding.ts +0 -2
- package/src/compiler/Refusals.ts +0 -65
- package/src/compiler/formatDiagnosis.ts +0 -20
- package/src/server/appDirectories.ts +0 -9
- package/src/server/argsFor.ts +0 -39
- package/src/server/buildDirectory.ts +0 -10
- package/src/server/coerceArgs.ts +0 -109
- package/src/server/derivedArgs.ts +0 -26
- package/src/server/runBuild.ts +0 -24
- package/src/server/serveBuild.ts +0 -144
- package/src/server/testBuild.ts +0 -220
- package/src/shared/LOAD_OFFLINE.ts +0 -15
- package/src/shared/LOAD_SIGNAL.ts +0 -10
- package/src/shared/issuesOf.ts +0 -18
- package/src/shared/reactive/ENTRY_LIVES.ts +0 -7
- package/src/shared/reactive/FOLLOWED.ts +0 -8
- package/src/shared/reactive/PATCHES.ts +0 -11
- package/src/shared/reactive/PATCH_SINKS.ts +0 -26
- package/src/shared/reactive/canonicalKey.ts +0 -95
package/src/server/createApp.ts
CHANGED
|
@@ -16,14 +16,16 @@ import { MOUNT, unmounted } from '#shared/mount.ts'
|
|
|
16
16
|
import { PRINCIPAL_HEADER } from '#shared/PRINCIPAL_HEADER.ts'
|
|
17
17
|
import { RPC_SERVER } from '#shared/RPC_SERVER.ts'
|
|
18
18
|
|
|
19
|
-
import { servedTable } from './abideModules.ts'
|
|
20
19
|
import { laneFailure } from './answerFailure.ts'
|
|
21
20
|
import { answerRequest, type AppSources } from './answerRequest.ts'
|
|
22
|
-
import type { Mount } from './answerRpc.ts'
|
|
23
21
|
import { Mux, type MuxConnection } from './answerSocket.ts'
|
|
24
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
type Builder,
|
|
24
|
+
processBuild,
|
|
25
|
+
servedBuild,
|
|
26
|
+
spawnedBuild,
|
|
27
|
+
} from './appBuild.ts'
|
|
25
28
|
import { holdsApp } from './appTree.ts'
|
|
26
|
-
import { buildDirectory } from './buildDirectory.ts'
|
|
27
29
|
import {
|
|
28
30
|
APP_PACKAGE,
|
|
29
31
|
type AppPackage,
|
|
@@ -31,11 +33,14 @@ import {
|
|
|
31
33
|
packageUnder,
|
|
32
34
|
positiveSetting,
|
|
33
35
|
} from './config.ts'
|
|
36
|
+
import { Followers } from './Followers.ts'
|
|
34
37
|
import { McpSurface } from './generatedSurfaces.ts'
|
|
35
38
|
import { HOOKS, inOrder, reportUnexpected, rootRungs } from './hooks.ts'
|
|
36
39
|
import { IDLE_TIMEOUT_SECONDS } from './IDLE_TIMEOUT_SECONDS.ts'
|
|
37
40
|
import { installServer } from './installServer.ts'
|
|
41
|
+
import { followedIn, type Mount } from './mountHandlers.ts'
|
|
38
42
|
import { admitsMux, muxSocketOptions, upgraded } from './muxUpgrade.ts'
|
|
43
|
+
import { packageDirectory } from './packageDirectory.ts'
|
|
39
44
|
import { plainAnswer } from './plainAnswer.ts'
|
|
40
45
|
import { presumePrincipal } from './principal.ts'
|
|
41
46
|
import { realOrAsGiven } from './realOrAsGiven.ts'
|
|
@@ -50,7 +55,6 @@ import {
|
|
|
50
55
|
serverTiming,
|
|
51
56
|
} from './requestScope.ts'
|
|
52
57
|
import { heldBody } from './streamEvent.ts'
|
|
53
|
-
import { testBuild } from './testBuild.ts'
|
|
54
58
|
import { traceResponse } from './trace.ts'
|
|
55
59
|
|
|
56
60
|
// 28.8 — one line per request.
|
|
@@ -80,13 +84,16 @@ export interface App {
|
|
|
80
84
|
/**
|
|
81
85
|
* The app this process was started in, booted off what `abide build` left beside it.
|
|
82
86
|
*
|
|
83
|
-
* 42.1 — found where the CLI finds it (38.25), and booted off the build (38.27)
|
|
87
|
+
* 42.1 — found where the CLI finds it (38.25), and booted off the build (38.27) — under `bun test`,
|
|
88
|
+
* the build of its sources as they stand (42.16), which the test preload served already (38.109).
|
|
84
89
|
*/
|
|
85
90
|
export async function createApp(): Promise<App> {
|
|
86
91
|
const root = appRoot(undefined)
|
|
87
92
|
const app = await appOnDisk(
|
|
88
|
-
root === undefined
|
|
89
|
-
|
|
93
|
+
root === undefined
|
|
94
|
+
? undefined
|
|
95
|
+
: { root, out: await processBuild(root) },
|
|
96
|
+
spawnedBuild,
|
|
90
97
|
).boot()
|
|
91
98
|
if (typeof app === 'string')
|
|
92
99
|
throw new Error(`abide: createApp found ${app}`)
|
|
@@ -117,13 +124,11 @@ export function noAppHere(): string {
|
|
|
117
124
|
|
|
118
125
|
/**
|
|
119
126
|
* The app on disk at `found` — its source root and build directory, both absolute — or the
|
|
120
|
-
* refusal where nothing was found.
|
|
121
|
-
* builds one nobody built — 38.100) and answers the directory it is in, or `undefined` where
|
|
122
|
-
* nothing under the root builds.
|
|
127
|
+
* refusal where nothing was found. Its boot builds it with `build` where nobody has (38.100).
|
|
123
128
|
*/
|
|
124
129
|
export function appOnDisk(
|
|
125
130
|
found: { root: string; out: string } | undefined,
|
|
126
|
-
|
|
131
|
+
build: Builder,
|
|
127
132
|
): AppHandle {
|
|
128
133
|
if (found === undefined)
|
|
129
134
|
return {
|
|
@@ -132,49 +137,25 @@ export function appOnDisk(
|
|
|
132
137
|
boot: async () => noAppHere(),
|
|
133
138
|
}
|
|
134
139
|
const { root, out } = found
|
|
135
|
-
const origin = originUnder(root)
|
|
136
140
|
return {
|
|
137
|
-
package:
|
|
138
|
-
handlers: async () =>
|
|
139
|
-
|
|
140
|
-
if (!(await serveBuild(root, out, async () => undefined))) return []
|
|
141
|
-
return (await servedTable(root)).handlers
|
|
142
|
-
},
|
|
141
|
+
package: packageUnder(root),
|
|
142
|
+
handlers: async () =>
|
|
143
|
+
(await servedBuild(root, out, undefined))?.table.handlers ?? [],
|
|
143
144
|
boot: async () => {
|
|
144
|
-
const served = await
|
|
145
|
+
const served = await servedBuild(root, out, build)
|
|
145
146
|
if (served === undefined) return `nothing under ${root} to build.`
|
|
146
|
-
|
|
147
|
-
return bootApp(origin, () => loadBuild({ root, out: served }))
|
|
147
|
+
return bootApp(served.origin, served.load)
|
|
148
148
|
},
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
/**
|
|
153
|
-
* The build of the app under `root`, served to this process's imports — or `undefined` where
|
|
154
|
-
* nothing under it builds. `fresh` builds it for its sources as they stand.
|
|
155
|
-
*
|
|
156
|
-
* 42.16 — under `bun test` the app is built for its sources as they stand rather than read off
|
|
157
|
-
* whatever `abide build` last left, which a test run would otherwise need first and could find
|
|
158
|
-
* stale. One answer for `createApp` and the test preload (38.109), so a test that boots the app
|
|
159
|
-
* reuses the build its imports were served from.
|
|
160
|
-
*/
|
|
161
|
-
export async function servedBuild(
|
|
162
|
-
root: string,
|
|
163
|
-
fresh = process.env.NODE_ENV === 'test',
|
|
164
|
-
): Promise<string | undefined> {
|
|
165
|
-
const out = fresh ? await testBuild(root) : buildDirectory(root)
|
|
166
|
-
const { serveBuild } = await import('./serveBuild.ts')
|
|
167
|
-
return (await serveBuild(root, out)) ? out : undefined
|
|
168
|
-
}
|
|
169
|
-
|
|
170
152
|
/**
|
|
171
153
|
* The app's root — `--root`, else `src` where the working directory holds one, else the working
|
|
172
154
|
* directory — or `undefined` where it is no app's.
|
|
173
155
|
*
|
|
174
|
-
* 38.25 and 38.26 — `undefined` is a refusal and not a guess. An app's root is in a package
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
* walking the disk.
|
|
156
|
+
* 38.25 and 38.26 — `undefined` is a refusal and not a guess. An app's root is in a package
|
|
157
|
+
* (`packageDirectory`) and holds a `.abide` file; the package is asked first, so a command run from
|
|
158
|
+
* `/` answers at once rather than walking the disk.
|
|
178
159
|
*
|
|
179
160
|
* ITS REAL PATH, as the bundler and the resolver name every file under it: an app under `/tmp` is
|
|
180
161
|
* `/private/tmp` to both, and one spelling here is one fewer at every reader downstream.
|
|
@@ -183,18 +164,18 @@ export function appRoot(given: string | undefined): string | undefined {
|
|
|
183
164
|
if (given !== undefined) return realOrAsGiven(resolve(given))
|
|
184
165
|
const under = resolve('src')
|
|
185
166
|
const root = realOrAsGiven(existsSync(under) ? under : process.cwd())
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
167
|
+
return existsSync(`${packageDirectory(root)}/package.json`) &&
|
|
168
|
+
holdsApp(root)
|
|
169
|
+
? root
|
|
170
|
+
: undefined
|
|
190
171
|
}
|
|
191
172
|
|
|
192
173
|
/**
|
|
193
174
|
* What an app is booted as besides its sources: its hooks module and its `package.json`.
|
|
194
175
|
*
|
|
195
|
-
* The two things `bootApp` reads before the boot and not through it
|
|
196
|
-
*
|
|
197
|
-
*
|
|
176
|
+
* The two things `bootApp` reads before the boot and not through it — off the server's table of
|
|
177
|
+
* the compilation this process serves (`serveApp`), or handed over by a compiled app's entry, which
|
|
178
|
+
* holds the table itself.
|
|
198
179
|
*/
|
|
199
180
|
export type AppOrigin = {
|
|
200
181
|
/**
|
|
@@ -207,20 +188,6 @@ export type AppOrigin = {
|
|
|
207
188
|
package: AppPackage
|
|
208
189
|
}
|
|
209
190
|
|
|
210
|
-
/**
|
|
211
|
-
* The `AppOrigin` of an app on disk: its package under `root`, and its server blocks, out of the
|
|
212
|
-
* compilation this process serves (`serveCompilation`) — the build's, or `abide dev`'s.
|
|
213
|
-
*/
|
|
214
|
-
export function originUnder(root: string): AppOrigin {
|
|
215
|
-
return {
|
|
216
|
-
hooks: async () => {
|
|
217
|
-
const table = await servedTable(root)
|
|
218
|
-
await Promise.all(table.servers.map((load) => load()))
|
|
219
|
-
},
|
|
220
|
-
package: packageUnder(root),
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
191
|
/**
|
|
225
192
|
* An `App` as a command boots it: with the mux over its tables, which `listen` opens and `abide dev`'s
|
|
226
193
|
* worker opens in its stead — one `AnsweringApp`, and one MCP surface, per app either way.
|
|
@@ -361,6 +328,7 @@ export async function bootEntered(
|
|
|
361
328
|
answer: fetch,
|
|
362
329
|
mcp: new McpSurface(booted.handlers, fetch),
|
|
363
330
|
held: new Set(),
|
|
331
|
+
followers: new Followers(),
|
|
364
332
|
}
|
|
365
333
|
|
|
366
334
|
// 16.42, 42.12 — A `raw` CALL MADE ON THIS SERVER IS ANSWERED IN PROCESS, by the app answering the
|
|
@@ -370,7 +338,11 @@ export async function bootEntered(
|
|
|
370
338
|
RPC_SERVER.raw = answerRaw
|
|
371
339
|
|
|
372
340
|
const openMux = (): Mux => {
|
|
373
|
-
mux = new Mux(
|
|
341
|
+
mux = new Mux(
|
|
342
|
+
followedIn(booted.handlers),
|
|
343
|
+
answering.followers,
|
|
344
|
+
answering,
|
|
345
|
+
)
|
|
374
346
|
return mux
|
|
375
347
|
}
|
|
376
348
|
|
package/src/server/csp.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import type { Rung } from '#shared/Middleware.ts'
|
|
9
9
|
|
|
10
|
+
import { EARLY_CALL_HASH } from './PageRender.ts'
|
|
10
11
|
import { randomToken } from './randomToken.ts'
|
|
11
|
-
import { EARLY_CALL_HASH } from './render.ts'
|
|
12
12
|
import { within } from './requestScope.ts'
|
|
13
13
|
|
|
14
14
|
// 29.5.
|
|
@@ -9,24 +9,11 @@
|
|
|
9
9
|
// nonce is never written anywhere, so no text an author or a caller supplies can stand in for one.
|
|
10
10
|
|
|
11
11
|
import { regionMarkup } from '#shared/anchorMarkup.ts'
|
|
12
|
-
import { isReactive
|
|
12
|
+
import { isReactive } from '#shared/reactive/index.ts'
|
|
13
|
+
import { isStreaming, loadOf } from '#shared/reactive/producer.ts'
|
|
13
14
|
|
|
15
|
+
import type { PageCall } from './PageRender.ts'
|
|
14
16
|
import type { Rendered } from './render.ts'
|
|
15
|
-
import type { PageCall } from './requestScope.ts'
|
|
16
|
-
|
|
17
|
-
// SYNCHRONOUS SETUP IS WHAT MAKES ONE COUNTER ENOUGH. 34.3 keeps a setup from awaiting, so no other
|
|
18
|
-
// request's render runs between a component's two reads, however many renders are in flight.
|
|
19
|
-
let callsInRenders = 0
|
|
20
|
-
|
|
21
|
-
/** How many calls renders have made, read on either side of a component's setup. */
|
|
22
|
-
export function callsInRender(): number {
|
|
23
|
-
return callsInRenders
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Counts a call a page's render made (`reachedInRender`). */
|
|
27
|
-
export function noteCallInRender(): void {
|
|
28
|
-
callsInRenders += 1
|
|
29
|
-
}
|
|
30
17
|
|
|
31
18
|
/** A deferred child: its record, and the page's calls its setup made, marked with its build. */
|
|
32
19
|
type Deferred = { rendered: Rendered; callsFrom: number; callsTo: number }
|
package/src/server/devWorker.ts
CHANGED
|
@@ -21,12 +21,8 @@
|
|
|
21
21
|
import { DEV_ADDRESS } from '#shared/ADDRESSES.ts'
|
|
22
22
|
import { escapeText } from '#shared/escapeText.ts'
|
|
23
23
|
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
serveCompilation,
|
|
27
|
-
servedTable,
|
|
28
|
-
} from './abideModules.ts'
|
|
29
|
-
import { type AppSources, appSources } from './answerRequest.ts'
|
|
24
|
+
import type { Compilation } from './abideModules.ts'
|
|
25
|
+
import type { AppSources } from './answerRequest.ts'
|
|
30
26
|
import type { Mux, MuxConnection } from './answerSocket.ts'
|
|
31
27
|
import { publishedUnder } from './appTree.ts'
|
|
32
28
|
import {
|
|
@@ -35,7 +31,7 @@ import {
|
|
|
35
31
|
clientBundle,
|
|
36
32
|
type ServedFile,
|
|
37
33
|
} from './clientBundle.ts'
|
|
38
|
-
import { bootApp, type BootedApp
|
|
34
|
+
import { bootApp, type BootedApp } from './createApp.ts'
|
|
39
35
|
import { keepServing } from './faultPolicy.ts'
|
|
40
36
|
import { type Manifest, NO_MANIFEST } from './manifestOf.ts'
|
|
41
37
|
import { admitsMux, muxSocketOptions } from './muxUpgrade.ts'
|
|
@@ -46,6 +42,7 @@ import {
|
|
|
46
42
|
serveOver,
|
|
47
43
|
type ToRelay,
|
|
48
44
|
} from './responseRelay.ts'
|
|
45
|
+
import { appSources, serveApp } from './servedApp.ts'
|
|
49
46
|
import { withAbideSources } from './withAbideSources.ts'
|
|
50
47
|
|
|
51
48
|
// The reload client, which the worker serves and every document it answers loads.
|
|
@@ -211,31 +208,30 @@ async function open(
|
|
|
211
208
|
// the bundler resolves the browser's graph through it, so the two lanes cannot disagree
|
|
212
209
|
// about what a specifier means. Registering it is process-wide — which is a worker rather
|
|
213
210
|
// than the command, so a reload is a new registry rather than a cache to bust.
|
|
214
|
-
|
|
211
|
+
const serving = serveApp(root, compilation)
|
|
215
212
|
|
|
216
213
|
// ASKED FOR TOGETHER. The bundle, the public directory and the server's own
|
|
217
|
-
// tables depend on none of each other — the plugin
|
|
218
|
-
// them asks it anything — and on a reload every one of them is latency the
|
|
219
|
-
// so the bundle is handed over still building (`SourceParts.client`).
|
|
214
|
+
// tables depend on none of each other — `serveApp` registered the plugin as it was called,
|
|
215
|
+
// before any of them asks it anything — and on a reload every one of them is latency the
|
|
216
|
+
// author waits on, so the bundle is handed over still building (`SourceParts.client`).
|
|
220
217
|
//
|
|
221
218
|
// ONE LISTING of the public directories — the compile's — for the bundle's externals and for
|
|
222
219
|
// what is served. 38.19 — OUT OF THE SOURCE TREE. `abide build` copies these into its output
|
|
223
220
|
// and dev has no output, so the address answers where the author's file actually is.
|
|
224
221
|
const published = publishedUnder(root, start.published)
|
|
225
222
|
const bundling = bundleInMemory(root, compilation, start.published)
|
|
226
|
-
const table = await
|
|
227
|
-
const handlers = table.handlers
|
|
223
|
+
const { origin, table } = await serving
|
|
228
224
|
|
|
229
225
|
// THE SAME `App` `abide start` boots, so an app's hooks and middleware run in dev too — and its
|
|
230
226
|
// sources are read INSIDE the boot, as `abide start` reads them: a document's head carries
|
|
231
227
|
// what the resolved configuration says (28.4's app name), which is not resolved before it.
|
|
232
|
-
app = await bootApp(
|
|
228
|
+
app = await bootApp(origin, async () => {
|
|
233
229
|
// 38.17 — THE RELOAD CLIENT IS THIS WORKER'S, not the bundle's, and it goes in whether or
|
|
234
230
|
// not there is an entry beside it: a bundle that failed is exactly when a reader needs the
|
|
235
231
|
// next save to reach them. `clientTags` writes nothing for a manifest with no entry.
|
|
236
232
|
const sources = await appSources({
|
|
237
233
|
table,
|
|
238
|
-
handlers,
|
|
234
|
+
handlers: table.handlers,
|
|
239
235
|
published,
|
|
240
236
|
client: bundling.then((bundle) => ({
|
|
241
237
|
manifest: bundle.manifest,
|
package/src/server/faceOf.ts
CHANGED
|
@@ -34,7 +34,7 @@ export type Lane = { bundling: boolean; browser: boolean }
|
|
|
34
34
|
export type Face = { path: string; namespace: string }
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* What an import asks of a file, by its spelling: its text (
|
|
37
|
+
* What an import asks of a file, by its spelling: its text (`.abide-text`), a component's stylesheet
|
|
38
38
|
* (`?style`), the module it compiles to (`?component`), its browser module (`?client`), its server
|
|
39
39
|
* module (`?server`), a `.abide` named bare, or a module that may be a handler file.
|
|
40
40
|
*/
|
|
@@ -22,12 +22,13 @@ import { parseRoutePattern, type Segment } from '#shared/routePattern.ts'
|
|
|
22
22
|
import { argsInURL, rpcRequest } from '#shared/rpcRequest.ts'
|
|
23
23
|
|
|
24
24
|
import { answered } from './answerFailure.ts'
|
|
25
|
-
import { bodyWithin
|
|
25
|
+
import { bodyWithin } from './answerRpc.ts'
|
|
26
26
|
import type { ToolAnswer, ToolDefinition } from './assistant.ts'
|
|
27
27
|
import { appIdentity } from './config.ts'
|
|
28
28
|
import { crossingOrigin, crossingRefusal } from './crossingOrigin.ts'
|
|
29
29
|
import { IMAGE_TYPES } from './IMAGE_TYPES.ts'
|
|
30
30
|
import { MCP_PROTOCOL_VERSION } from './MCP_PROTOCOL_VERSION.ts'
|
|
31
|
+
import type { Mounted } from './mountHandlers.ts'
|
|
31
32
|
import { type Listed, surfaceOf } from './surfaceOf.ts'
|
|
32
33
|
|
|
33
34
|
const OPENAPI_LOG = namedLogger('abide:openapi')
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Mount } from './mountHandlers.ts'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The row of a handler file (16.73): its default, answered at the route the file is placed at and
|
|
5
|
+
* named for the file — what its declaration says of it laid over that.
|
|
6
|
+
*/
|
|
7
|
+
export function handlerFileMount(
|
|
8
|
+
file: Pick<Mount, 'address' | 'source' | 'scope' | 'matchers'>,
|
|
9
|
+
declared: Pick<
|
|
10
|
+
Mount,
|
|
11
|
+
| 'method'
|
|
12
|
+
| 'ui'
|
|
13
|
+
| 'cli'
|
|
14
|
+
| 'mcp'
|
|
15
|
+
| 'description'
|
|
16
|
+
| 'copy'
|
|
17
|
+
| 'defaults'
|
|
18
|
+
| 'args'
|
|
19
|
+
| 'result'
|
|
20
|
+
>,
|
|
21
|
+
): Mount {
|
|
22
|
+
return {
|
|
23
|
+
address: file.address,
|
|
24
|
+
method: declared.method,
|
|
25
|
+
source: file.source,
|
|
26
|
+
name: file.address.slice(file.address.lastIndexOf('/') + 1),
|
|
27
|
+
export: 'default',
|
|
28
|
+
scope: file.scope,
|
|
29
|
+
matchers: file.matchers,
|
|
30
|
+
private: false,
|
|
31
|
+
ui: declared.ui,
|
|
32
|
+
cli: declared.cli,
|
|
33
|
+
mcp: declared.mcp,
|
|
34
|
+
description: declared.description,
|
|
35
|
+
copy: declared.copy,
|
|
36
|
+
defaults: declared.defaults,
|
|
37
|
+
args: declared.args,
|
|
38
|
+
result: declared.result,
|
|
39
|
+
}
|
|
40
|
+
}
|
package/src/server/index.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { installServer } from './installServer.ts'
|
|
|
14
14
|
// markup with, 32.20's `safeUrl`, and 31.8's `writePath`.
|
|
15
15
|
export * from '#shared'
|
|
16
16
|
// 18.11 — one write a patch made, as a followed `GET`'s `patch` carries it.
|
|
17
|
-
export type { PatchOp } from '#shared/reactive/
|
|
17
|
+
export type { PatchOp } from '#shared/reactive/patchLog.ts'
|
|
18
18
|
export {
|
|
19
19
|
type Clients,
|
|
20
20
|
DELETE,
|
|
@@ -51,10 +51,10 @@ export type { ConfigField } from './configFields.ts'
|
|
|
51
51
|
export { type App, createApp } from './createApp.ts'
|
|
52
52
|
// 41.28's run-time half: an emitted component reads it on either side of its setup, and one whose
|
|
53
53
|
// setup made a call answers as a page does. Not an app's name.
|
|
54
|
-
export { callsInRender } from './
|
|
54
|
+
export { callsInRender } from './PageRender.ts'
|
|
55
55
|
// 19.9's run-time half: what the module a handler is loaded through calls to hold it to the schema
|
|
56
56
|
// its annotation derives (15.8). Not an app's name.
|
|
57
|
-
export { derivedArgs } from './
|
|
57
|
+
export { derivedArgs } from './argsContract.ts'
|
|
58
58
|
// 37.1's run-time half: what a compiled server module calls around its `<script server>`, so the
|
|
59
59
|
// hooks it makes are filed at its route.
|
|
60
60
|
export {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// whichever server module a process happened to import — a compiler or a test that reaches one of
|
|
3
3
|
// them for a function is not made a server by it. Called where a server is entered: `bootApp`,
|
|
4
4
|
// `abide run`, and `@abide/abide/server`, which an app imports to be one. Filling the same functions again
|
|
5
|
-
// changes nothing, so each entry calls it.
|
|
6
|
-
// `requestScope.ts`'s import (its comment says why), `RPC_SERVER.raw` per boot,
|
|
7
|
-
// `LISTENING.timeout` by the dev worker alone.
|
|
5
|
+
// changes nothing, so each entry calls it. Four are filled elsewhere: `SCOPING.provider` at
|
|
6
|
+
// `requestScope.ts`'s import (its comment says why), `RPC_SERVER.raw` per boot,
|
|
7
|
+
// `RPC_SERVER.following` by each app's followers, and `LISTENING.timeout` by the dev worker alone.
|
|
8
8
|
|
|
9
9
|
import { COOKIES } from '#shared/cookies.ts'
|
|
10
10
|
import { CSP } from '#shared/csp.ts'
|
|
@@ -15,12 +15,11 @@ import { PRINCIPAL } from '#shared/principal.ts'
|
|
|
15
15
|
import { RPC_SERVER } from '#shared/RPC_SERVER.ts'
|
|
16
16
|
import { UNEXPECTED } from '#shared/UNEXPECTED.ts'
|
|
17
17
|
|
|
18
|
-
import { reachedInRender } from './answerRequest.ts'
|
|
19
18
|
import { environmentTimeout } from './answerRpc.ts'
|
|
20
|
-
import { broadcast, feedFromServed, swept } from './answerSocket.ts'
|
|
21
19
|
import { configuredMount, derivedAppName } from './config.ts'
|
|
22
20
|
import { cspRung, nonce } from './csp.ts'
|
|
23
21
|
import { handOnError } from './hooks.ts'
|
|
22
|
+
import { recordInRender } from './PageRender.ts'
|
|
24
23
|
import { SERVER_PRINCIPAL } from './principal.ts'
|
|
25
24
|
import { reportHealth } from './reportHealth.ts'
|
|
26
25
|
import { handlerTook, request, requestCookies } from './requestScope.ts'
|
|
@@ -40,9 +39,6 @@ export function installServer(): void {
|
|
|
40
39
|
// 16.11 — the request a handler's rung is handed.
|
|
41
40
|
RPC_SERVER.request = request
|
|
42
41
|
RPC_SERVER.timeout = environmentTimeout
|
|
43
|
-
RPC_SERVER.reached =
|
|
44
|
-
RPC_SERVER.broadcast = broadcast
|
|
45
|
-
RPC_SERVER.swept = swept
|
|
46
|
-
RPC_SERVER.served = feedFromServed
|
|
42
|
+
RPC_SERVER.reached = recordInRender
|
|
47
43
|
RPC_SERVER.handled = handlerTook
|
|
48
44
|
}
|