@abide/abide 0.100.0 → 0.102.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/CHANGELOG.md +31 -0
- package/bin/abide.ts +227 -163
- package/docs/REGISTRY.md +726 -0
- package/docs/RULEBOOK.md +2753 -0
- package/docs/abide.md +12878 -0
- package/package.json +10 -3
- package/scaffold/AGENTS.md +31 -0
- package/scaffold/CLAUDE.md +1 -0
- package/scaffold/src/layout.abide +18 -0
- package/src/compiler/Lowering.ts +78 -9
- package/src/compiler/ShadowMap.ts +2 -2
- package/src/compiler/TypeSession.ts +262 -67
- package/src/compiler/argsSchemaOf.ts +1 -1
- package/src/compiler/checkApp.ts +43 -15
- package/src/compiler/checkedShadow.ts +39 -5
- package/src/compiler/classifyRead.ts +6 -4
- package/src/compiler/classifyTemplate.ts +1 -1
- package/src/compiler/compileApp.ts +433 -193
- package/src/compiler/compiledEntry.ts +43 -39
- package/src/compiler/componentGraph.ts +58 -71
- package/src/compiler/declaredExports.ts +24 -7
- package/src/compiler/emitClient.ts +141 -71
- package/src/compiler/emitComponent.ts +37 -8
- package/src/compiler/emitSource.ts +106 -13
- package/src/compiler/handlersUnder.ts +106 -56
- package/src/compiler/index.ts +7 -0
- package/src/compiler/mountsOf.ts +138 -0
- package/src/compiler/nearest.ts +14 -0
- package/src/compiler/parseAbide.ts +157 -20
- package/src/compiler/projectShadow.ts +213 -7
- package/src/compiler/reactiveTypes.ts +20 -7
- package/src/compiler/readSources.ts +15 -2
- package/src/compiler/readsIn.ts +61 -7
- package/src/compiler/renderMarkup.ts +3 -3
- package/src/compiler/scaffold.ts +30 -11
- package/src/compiler/serveLanguage.ts +125 -34
- package/src/compiler/sourceMapOf.ts +193 -0
- package/src/compiler/splitImports.ts +205 -83
- package/src/compiler/syncTypes.ts +32 -0
- package/src/compiler/tokenize.ts +14 -0
- package/src/compiler/writeDefaultProject.ts +1 -1
- package/src/compiler/writeTypes.ts +82 -0
- package/src/server/CLIENT_BUILD.ts +11 -13
- package/src/server/DEFAULT_PORT.ts +1 -1
- package/src/server/LAUNCHER_FILES.ts +9 -0
- package/src/server/MODULE_QUERIES.ts +18 -0
- package/src/server/TABLES.ts +7 -0
- package/src/server/VIRTUAL_DIRECTORY.ts +4 -5
- package/src/server/abideModules.ts +391 -0
- package/src/server/answerFailure.ts +16 -6
- package/src/server/answerRequest.ts +235 -106
- package/src/server/answerRpc.ts +124 -39
- package/src/server/answerSocket.ts +141 -48
- package/src/server/answerValue.ts +22 -9
- package/src/server/appDirectories.ts +1 -1
- package/src/server/appPlugins.ts +1 -1
- package/src/server/appTree.ts +179 -0
- package/src/server/argsFor.ts +2 -2
- package/src/server/assistant.ts +2 -2
- package/src/server/bridgeRelay.ts +6 -8
- package/src/server/claudeCode.ts +0 -6
- package/src/server/clientBuildOptions.ts +8 -3
- package/src/server/coerceArgs.ts +1 -1
- package/src/server/commands.ts +37 -37
- package/src/server/componentModules.d.ts +3 -1
- package/src/server/compressAnswer.ts +48 -14
- package/src/server/config.ts +25 -29
- package/src/server/configFields.ts +31 -25
- package/src/server/createApp.ts +59 -73
- package/src/server/devWorker.ts +144 -183
- package/src/server/executableName.ts +4 -0
- package/src/server/fenceServer.ts +37 -35
- package/src/server/generatedSurfaces.ts +99 -66
- package/src/server/hooks.ts +124 -52
- package/src/server/iconAccent.ts +191 -0
- package/src/server/index.ts +11 -7
- package/src/server/installSourceMaps.ts +88 -0
- package/src/server/launcherOptions.ts +34 -31
- package/src/server/launcherPage.ts +107 -64
- package/src/server/manifestOf.ts +16 -13
- package/src/server/namesUnder.ts +2 -2
- package/src/server/nativeMenu.ts +5 -5
- package/src/server/negotiateEncoding.ts +1 -1
- package/src/server/principal.ts +10 -5
- package/src/server/realOrAsGiven.ts +10 -0
- package/src/server/refuseAddressCollision.ts +21 -14
- package/src/server/remote.ts +49 -52
- package/src/server/render.ts +65 -94
- package/src/server/renderComponent.ts +5 -0
- package/src/server/reportHealth.ts +2 -2
- package/src/server/requestScope.ts +12 -1
- package/src/server/runBuild.ts +24 -0
- package/src/server/runCompiled.ts +5 -5
- package/src/server/runDesktop.ts +52 -27
- package/src/server/serveBuild.ts +43 -52
- package/src/server/serveDev.ts +81 -39
- package/src/server/shell.ts +7 -22
- package/src/server/sourceMappings.ts +139 -0
- package/src/server/surfaceOf.ts +18 -3
- package/src/server/testBuild.ts +1 -19
- package/src/server/withAbideSources.ts +117 -0
- package/src/shared/ADDRESSES.ts +7 -18
- package/src/shared/APP_META.ts +7 -0
- package/src/shared/CopyOptions.ts +1 -1
- package/src/shared/DEBUG_META.ts +1 -1
- package/src/shared/GLOBAL_GETS.ts +9 -3
- package/src/shared/RESERVED_DIRECTORIES.ts +15 -0
- package/src/shared/RPC_SERVER.ts +2 -2
- package/src/shared/cookies.ts +2 -2
- package/src/shared/csp.ts +1 -1
- package/src/shared/escapeText.ts +1 -1
- package/src/shared/filledPath.ts +85 -0
- package/src/shared/framing.ts +79 -6
- package/src/shared/headKeyOf.ts +2 -0
- package/src/shared/index.ts +1 -1
- package/src/shared/log.ts +27 -13
- package/src/shared/matchRoute.ts +23 -4
- package/src/shared/menuItem.ts +3 -3
- package/src/shared/reactive/Cursor.ts +3 -9
- package/src/shared/reactive/Keyed.ts +4 -3
- package/src/shared/reactive/NotLanded.ts +1 -1
- package/src/shared/reactive/Reactive.ts +81 -60
- package/src/shared/reactive/argsContract.ts +4 -4
- package/src/shared/reactive/canonicalKey.ts +4 -4
- package/src/shared/reactive/chunksOfStream.ts +6 -0
- package/src/shared/reactive/index.ts +1 -1
- package/src/shared/reactive/recordWrites.ts +103 -5
- package/src/shared/reactive/structural.ts +1 -1
- package/src/shared/reactive/tracking.ts +155 -21
- package/src/shared/reactive/watch.ts +10 -6
- package/src/shared/refuse.ts +1 -1
- package/src/shared/routePattern.ts +82 -46
- package/src/shared/rpc.ts +47 -13
- package/src/shared/rpcRequest.ts +27 -3
- package/src/shared/url.ts +4 -44
- package/src/shared/writePath.ts +1 -1
- package/src/ui/LAYER_NAMES.ts +1 -1
- package/src/ui/List.ts +3 -3
- package/src/ui/MOUNTING_LEVEL.ts +18 -0
- package/src/ui/Mismatch.ts +1 -1
- package/src/ui/RawRun.ts +1 -1
- package/src/ui/Router.ts +38 -31
- package/src/ui/Scope.ts +1 -1
- package/src/ui/TryRegion.ts +2 -2
- package/src/ui/applyHead.ts +33 -0
- package/src/ui/index.ts +1 -1
- package/src/ui/menuBridge.ts +1 -1
- package/src/ui/moveNode.ts +1 -1
- package/src/ui/reconcile.ts +2 -2
- package/src/ui/reportMenu.ts +2 -2
- package/src/ui/routing.ts +2 -2
- package/src/ui/setAttribute.ts +1 -1
- package/src/ui/setText.ts +1 -1
- package/src/ui/socketWire.ts +9 -7
- package/src/ui/wire.ts +1 -1
- package/scaffold/src/server/app.ts +0 -6
- package/scaffold/src/shared/.gitkeep +0 -0
- package/scaffold/src/ui/app.html +0 -8
- package/src/server/componentImports.ts +0 -56
- /package/scaffold/src/{ui/pages/page.abide → page.abide} +0 -0
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { CheckerAnswer } from './CheckerAnswer.ts'
|
|
2
2
|
import type { Finding } from './Finding.ts'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
CHECKED_CONFIG,
|
|
5
|
+
CHECKED_CONFIG_OF,
|
|
6
|
+
CHECKED_VALUES,
|
|
7
|
+
CHECKED_WRITE,
|
|
8
|
+
Lowering,
|
|
9
|
+
} from './Lowering.ts'
|
|
4
10
|
import { holdsReactive } from './PositionTable.ts'
|
|
5
11
|
import type { AbideFile } from './parseAbide.ts'
|
|
6
12
|
import { NO_PROPS, type Origin, type Span } from './projectShadow.ts'
|
|
7
13
|
import { CHECKED_SUFFIX } from './ShadowMap.ts'
|
|
14
|
+
import { SERVER_SPECIFIER } from './SPECIFIERS.ts'
|
|
8
15
|
import { abideImports } from './splitImports.ts'
|
|
9
16
|
|
|
10
17
|
// 38.3 — A `.abide` FILE AS THE PROGRAM IT RUNS AS, for the checker to report on. The projection
|
|
@@ -18,7 +25,7 @@ import { abideImports } from './splitImports.ts'
|
|
|
18
25
|
//
|
|
19
26
|
// A `.abide` IMPORT NAMES ITS CHECKED MODULE, so a component a page imports resolves to something
|
|
20
27
|
// the checker can read rather than to a file it cannot parse. What a checked module exports as its
|
|
21
|
-
// default is a component taking what its `props` call declares, so a tag is held to it (38.
|
|
28
|
+
// default is a component taking what its `props` call declares, so a tag is held to it (38.40).
|
|
22
29
|
|
|
23
30
|
/** A `.abide` lowered as the program it runs as, with its runs mapped back to the projection. */
|
|
24
31
|
export type CheckedShadow = {
|
|
@@ -35,15 +42,16 @@ export type CheckedShadow = {
|
|
|
35
42
|
export const COMPONENT_STAND_IN = '__component'
|
|
36
43
|
|
|
37
44
|
/**
|
|
38
|
-
* The
|
|
39
|
-
*
|
|
45
|
+
* The component a checked module exports as its default: called with the record its tag passes
|
|
46
|
+
* (`projectShadow`'s `invocation`), and answering the `Component` a server module's call of it
|
|
47
|
+
* renders (34.16). What its blocks export by name is beside it.
|
|
40
48
|
*/
|
|
41
49
|
function componentModule(props: string, generics?: string): string {
|
|
42
50
|
// 34.13 — generic over what the file's `<script>` declares, so a caller's props infer it, the
|
|
43
51
|
// signature's own parameters shadowing the opaque stand-ins the body was checked against.
|
|
44
52
|
const parameters = generics === undefined ? '' : `<${generics}>`
|
|
45
53
|
return `
|
|
46
|
-
declare const ${COMPONENT_STAND_IN}: ${parameters}(record: ${props}) =>
|
|
54
|
+
declare const ${COMPONENT_STAND_IN}: ${parameters}(record: ${props}) => import('${SERVER_SPECIFIER}').Component
|
|
47
55
|
export default ${COMPONENT_STAND_IN}
|
|
48
56
|
`
|
|
49
57
|
}
|
|
@@ -61,6 +69,7 @@ export function checkedShadow(
|
|
|
61
69
|
// Every span the emitters lower, with whether it holds the `Reactive` rather than reading it.
|
|
62
70
|
const units: { span: Span; holds: boolean }[] = [
|
|
63
71
|
{ span: projection.modules, holds: false },
|
|
72
|
+
{ span: projection.servers, holds: false },
|
|
64
73
|
{ span: projection.scripts, holds: false },
|
|
65
74
|
]
|
|
66
75
|
for (const span of projection.slots.values())
|
|
@@ -101,6 +110,7 @@ export function checkedShadow(
|
|
|
101
110
|
}\n`
|
|
102
111
|
text += `declare const ${CHECKED_VALUES}: {\n${values}}\n`
|
|
103
112
|
text += `declare function ${CHECKED_WRITE}<Cell extends { (): unknown; set(value: never): unknown }, Value extends Parameters<Cell['set']>[0]>(cell: Cell, value: Value): Value extends ReturnType<Cell> ? Value : ReturnType<Cell>\n`
|
|
113
|
+
text += configDeclarations(lowering)
|
|
104
114
|
return {
|
|
105
115
|
...pointAtCheckedModules(text, origins, scriptsEnd),
|
|
106
116
|
refusals: lowering.refusals,
|
|
@@ -123,6 +133,30 @@ function propsOf(lowering: Lowering): string {
|
|
|
123
133
|
.replace(/\(\s*\)$/, '')}>`
|
|
124
134
|
}
|
|
125
135
|
|
|
136
|
+
/**
|
|
137
|
+
* 27.13 — WHAT EACH `onConfig` DEFAULTS IS DECLARED INTO `Config`, so `config().RETRIES` is the
|
|
138
|
+
* `number` its defaults return rather than the index's `unknown`. Each call is bound by the lowering
|
|
139
|
+
* (`CHECKED_CONFIG`) and typed by `CHECKED_CONFIG_OF` as what its defaults return; an interface can
|
|
140
|
+
* only extend a name, so each is aliased, and a union is narrowed to the keys every member has.
|
|
141
|
+
* Nothing where the file files none.
|
|
142
|
+
*/
|
|
143
|
+
function configDeclarations(lowering: Lowering): string {
|
|
144
|
+
let aliases = ''
|
|
145
|
+
let names = ''
|
|
146
|
+
for (const read of lowering.answer.reads) {
|
|
147
|
+
if (read.shape !== 'config') continue
|
|
148
|
+
const name = `${CHECKED_CONFIG}${read.start}`
|
|
149
|
+
aliases += `type ${name}Type = typeof ${name}\n`
|
|
150
|
+
names += names === '' ? `${name}Type` : `, ${name}Type`
|
|
151
|
+
}
|
|
152
|
+
if (names === '') return ''
|
|
153
|
+
return `declare function ${CHECKED_CONFIG_OF}<Options>(on: (defaults: never, options?: Options) => () => void): <Defaults>(defaults: ((env: import('${SERVER_SPECIFIER}').Env) => Defaults) | null, options?: Options) => [Defaults] extends [object] ? Pick<Defaults, keyof Defaults> : {}
|
|
154
|
+
${aliases}declare module '${SERVER_SPECIFIER}' {
|
|
155
|
+
interface Config extends ${names} {}
|
|
156
|
+
}
|
|
157
|
+
`
|
|
158
|
+
}
|
|
159
|
+
|
|
126
160
|
/**
|
|
127
161
|
* Points each `.abide` import in the script blocks at its checked module, and moves `origins` to
|
|
128
162
|
* match.
|
|
@@ -27,10 +27,11 @@ import { REACTIVE_MEMBERS } from './REACTIVE_MEMBERS.ts'
|
|
|
27
27
|
* statement ends and whether `{ n }` is a literal are TypeScript's answers rather than a token
|
|
28
28
|
* walk's guess at them. Every offset is into the file's projection (`projectShadow`).
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
* (32.25), which lowers to the framework's own `raw`; a `<script>`'s is left as written.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
30
|
+
* TWO SHAPES ARE NOT A REACTIVE NAME: `raw` is the callee of a template expression's bare `raw(…)`
|
|
31
|
+
* (32.25), which lowers to the framework's own `raw`; a `<script>`'s is left as written. `config`
|
|
32
|
+
* is the callee of an `onConfig(…)` statement in a `<script server>` (27.13), which only a checked
|
|
33
|
+
* lowering rewrites. They ride this list because each is a rewrite at an occurrence, which is what
|
|
34
|
+
* the splice walks; what the checker proved about a whole position is `CheckerAnswer`'s.
|
|
34
35
|
*
|
|
35
36
|
* THE SHAPE IS FIXED: every field on every read, so `Lowering`'s splice sees one hidden class.
|
|
36
37
|
*/
|
|
@@ -69,6 +70,7 @@ export type Read = {
|
|
|
69
70
|
| 'restMember'
|
|
70
71
|
| 'restWhole'
|
|
71
72
|
| 'raw'
|
|
73
|
+
| 'config'
|
|
72
74
|
/** What the rewrite replaces: the name, or a whole write or update from its first token. */
|
|
73
75
|
from: number
|
|
74
76
|
to: number
|
|
@@ -132,7 +132,7 @@ export function classifyAttributes(
|
|
|
132
132
|
// 32.10, 32.19 — THE PLAIN `style={expr}` OR `class={expr}` BESIDE A DIRECTIVE IS LEFT
|
|
133
133
|
// UNBOUND. `setAttribute` replaces the whole merged value and takes the directives'
|
|
134
134
|
// halves with it, and the two bindings then overwrite each other in whichever order
|
|
135
|
-
// they
|
|
135
|
+
// they reran.
|
|
136
136
|
//
|
|
137
137
|
// ALLOWED, rather than refused. The page still RENDERS right — the server writes both
|
|
138
138
|
// halves into the one merged attribute — so the only thing a build error would buy is
|