Implement checked workspace integration contracts (WI-01)

This commit is contained in:
Timothy J. Aveni
2026-09-21 11:53:38 -07:00
parent 3c0378358f
commit 884b12f759
22 changed files with 4349 additions and 3089 deletions
+9
View File
@@ -4,6 +4,7 @@ import { loadQxSources, resolveQxSources } from "./source-loader.js";
import { compileRepositoryQuery } from "../query/compile.js";
import { checkQueryTemplate } from "../query/templates.js";
import { readRepositorySource } from "./source-loader.js";
import { parseControllerCatalog } from "../capability-model/controllers.js";
import { linkQueries } from "../query/link.js";
import {
capabilityId,
@@ -249,6 +250,14 @@ const createResourceGraphResolver = (quixosCommit: string, resolveResource: Capa
compileRepositoryQuery(snapshot.directory, query, queryInterfaces),
),
);
let controllerText: string | undefined;
try {
controllerText = await readRepositorySource(snapshot.directory, "quixos.controllers.json");
} catch (error) {
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
}
if (controllerText !== undefined)
compiled.resource.revision.controllers = parseControllerCatalog(controllerText, queryInterfaces);
let catalogText: string | undefined;
try {
catalogText = await readFile(path.join(snapshot.directory, "quixos.migrations.json"), "utf8");
+3 -1
View File
@@ -69,7 +69,9 @@ export async function inspectAuthoringRepository(root: string, historyLimit = 10
declarations: syntax
? [...walkSyntax(syntax.root)]
.filter((node) =>
/^(?:interface|package|atom|state|edge|method|function|event|conformance)\w*Decl$/.test(node.kind),
/^(?:interface|package|atom|state|edge|method|function|event|conformance|component|presentation)\w*Decl$/.test(
node.kind,
),
)
.map((node) => ({ kind: node.kind, source: source.slice(node.start, node.end) }))
: [],
File diff suppressed because one or more lines are too long
@@ -1,289 +1,299 @@
EDIT=1
CREATION=2
INITIALIZE=3
WORKSPACE=4
EXECUTION=5
SNAPSHOT=6
TRANSACTION=7
REMOTE=8
TARGETS=9
PORTABLE=10
REPLICA=11
LOCAL=12
FROM=13
RESULT_BYTES=14
RPC_CALLS=15
DEADLINE_MS=16
QUERY=17
REFLECTION=18
SPECIALIZE=19
ROOT=20
DOCUMENT=21
FRAGMENTS=22
VIEW=23
MAX=24
ALLOW=25
POLL=26
QUERYABLE=27
RPC=28
QUERY_REASON=29
TYPE=30
OBJECT=31
STORABLE=32
IMPLEMENTS=33
REF=34
FRAGMENT=35
IMPORT=36
EXTERNAL=37
ATOM=38
INTERFACE=39
INTERFACES=40
PACKAGE=41
VALUE=42
RELATION=43
OPERATION=44
FUNCTION=45
CONSTRUCTOR=46
CONSTRUCTS=47
INPUT=48
CONFORM=49
AS=50
BIND=51
STATIC=52
TO=53
PRIVATE=54
SHARED=55
STATE=56
EDGE=57
PROJECTION=58
WITH=59
USING=60
ACCEPT=61
VIA=62
MATERIALIZE=63
IF=64
ABSENT=65
ON=66
POLICY=67
DEFAULT=68
SOURCE=69
REPOSITORY=70
COMMIT=71
REVISION=72
SEMANTIC_MAJOR=73
ON_DELETE=74
LIFECYCLE=75
RETAIN_OTHER=76
KEYED=77
PUBLIC_TRAVERSAL=78
ID=79
DOC=80
MODE=81
EMITS=82
RECEIVER=83
REQUIRES=84
ANY=85
GET=86
SET=87
WATCH=88
START=89
STOP=90
READ=91
WRITE=92
RESOLVE=93
CONNECT=94
DISCONNECT=95
CALL=96
WATCH_START=97
WATCH_STOP=98
SUBSCRIBE=99
UNSUBSCRIBE=100
REGISTER=101
CRDT=102
OPTIONAL_ONE=103
EXACTLY_ONE=104
MANY_UNIQUE=105
MANY=106
ORDERED=107
UNIT=108
WATCH_HANDLE=109
MESSAGE=110
ATOM_REF=111
INTERFACE_REF=112
OPTIONAL=113
LIST=114
RECORD=115
BOOL=116
BYTES=117
DOUBLE=118
INT32=119
INT64=120
STRING=121
UINT32=122
UINT64=123
TRUE=124
FALSE=125
NULL=126
ARROW=127
COLON=128
SEMI=129
COMMA=130
DOT=131
LBRACE=132
RBRACE=133
LBRACK=134
RBRACK=135
LPAREN=136
RPAREN=137
LT=138
GT=139
AMP=140
EQUAL=141
INTEGER=142
JSON_NUMBER=143
IDENTIFIER=144
STRING_LITERAL=145
LINE_COMMENT=146
BLOCK_COMMENT=147
WS=148
COMPONENT=2
PRESENTATION=3
SUBJECT=4
RUNTIME=5
FOR=6
CREATION=7
INITIALIZE=8
WORKSPACE=9
EXECUTION=10
SNAPSHOT=11
TRANSACTION=12
REMOTE=13
TARGETS=14
PORTABLE=15
REPLICA=16
LOCAL=17
FROM=18
RESULT_BYTES=19
RPC_CALLS=20
DEADLINE_MS=21
QUERY=22
REFLECTION=23
SPECIALIZE=24
ROOT=25
DOCUMENT=26
FRAGMENTS=27
VIEW=28
MAX=29
ALLOW=30
POLL=31
QUERYABLE=32
RPC=33
QUERY_REASON=34
TYPE=35
OBJECT=36
STORABLE=37
IMPLEMENTS=38
REF=39
FRAGMENT=40
IMPORT=41
EXTERNAL=42
ATOM=43
INTERFACE=44
INTERFACES=45
PACKAGE=46
VALUE=47
RELATION=48
OPERATION=49
FUNCTION=50
CONSTRUCTOR=51
CONSTRUCTS=52
INPUT=53
CONFORM=54
AS=55
BIND=56
STATIC=57
TO=58
PRIVATE=59
SHARED=60
STATE=61
EDGE=62
PROJECTION=63
WITH=64
USING=65
ACCEPT=66
VIA=67
MATERIALIZE=68
IF=69
ABSENT=70
ON=71
POLICY=72
DEFAULT=73
SOURCE=74
REPOSITORY=75
COMMIT=76
REVISION=77
SEMANTIC_MAJOR=78
ON_DELETE=79
LIFECYCLE=80
RETAIN_OTHER=81
KEYED=82
PUBLIC_TRAVERSAL=83
ID=84
DOC=85
MODE=86
EMITS=87
RECEIVER=88
REQUIRES=89
ANY=90
GET=91
SET=92
WATCH=93
START=94
STOP=95
READ=96
WRITE=97
RESOLVE=98
CONNECT=99
DISCONNECT=100
CALL=101
WATCH_START=102
WATCH_STOP=103
SUBSCRIBE=104
UNSUBSCRIBE=105
REGISTER=106
CRDT=107
OPTIONAL_ONE=108
EXACTLY_ONE=109
MANY_UNIQUE=110
MANY=111
ORDERED=112
UNIT=113
WATCH_HANDLE=114
MESSAGE=115
ATOM_REF=116
INTERFACE_REF=117
OPTIONAL=118
LIST=119
RECORD=120
BOOL=121
BYTES=122
DOUBLE=123
INT32=124
INT64=125
STRING=126
UINT32=127
UINT64=128
TRUE=129
FALSE=130
NULL=131
ARROW=132
COLON=133
SEMI=134
COMMA=135
DOT=136
LBRACE=137
RBRACE=138
LBRACK=139
RBRACK=140
LPAREN=141
RPAREN=142
LT=143
GT=144
AMP=145
EQUAL=146
INTEGER=147
JSON_NUMBER=148
IDENTIFIER=149
STRING_LITERAL=150
LINE_COMMENT=151
BLOCK_COMMENT=152
WS=153
'edit'=1
'creation'=2
'initialize'=3
'workspace'=4
'execution'=5
'snapshot'=6
'transaction'=7
'remote'=8
'targets'=9
'portable'=10
'replica'=11
'local'=12
'from'=13
'result-bytes'=14
'rpc-calls'=15
'deadline-ms'=16
'query'=17
'reflection'=18
'specialize'=19
'root'=20
'document'=21
'fragments'=22
'view'=23
'max'=24
'allow'=25
'poll'=26
'queryable'=27
'rpc'=28
'query-reason'=29
'type'=30
'object'=31
'storable'=32
'implements'=33
'ref'=34
'fragment'=35
'import'=36
'external'=37
'atom'=38
'interface'=39
'interfaces'=40
'package'=41
'value'=42
'relation'=43
'operation'=44
'function'=45
'constructor'=46
'constructs'=47
'input'=48
'conform'=49
'as'=50
'bind'=51
'static'=52
'to'=53
'private'=54
'shared'=55
'state'=56
'edge'=57
'projection'=58
'with'=59
'using'=60
'accept'=61
'via'=62
'materialize'=63
'if'=64
'absent'=65
'on'=66
'policy'=67
'default'=68
'source'=69
'repository'=70
'commit'=71
'revision'=72
'semantic-major'=73
'on-delete'=74
'lifecycle'=75
'retain-other'=76
'keyed'=77
'public-traversal'=78
'id'=79
'doc'=80
'mode'=81
'emits'=82
'receiver'=83
'requires'=84
'any'=85
'get'=86
'set'=87
'watch'=88
'start'=89
'stop'=90
'read'=91
'write'=92
'resolve'=93
'connect'=94
'disconnect'=95
'call'=96
'watch-start'=97
'watch-stop'=98
'subscribe'=99
'unsubscribe'=100
'register'=101
'crdt'=102
'optional-one'=103
'exactly-one'=104
'many-unique'=105
'many'=106
'ordered'=107
'unit'=108
'watch-handle'=109
'message'=110
'atom-ref'=111
'interface-ref'=112
'optional'=113
'list'=114
'record'=115
'bool'=116
'bytes'=117
'double'=118
'int32'=119
'int64'=120
'string'=121
'uint32'=122
'uint64'=123
'true'=124
'false'=125
'null'=126
'->'=127
':'=128
';'=129
','=130
'.'=131
'{'=132
'}'=133
'['=134
']'=135
'('=136
')'=137
'<'=138
'>'=139
'&'=140
'='=141
'component'=2
'presentation'=3
'subject'=4
'runtime'=5
'for'=6
'creation'=7
'initialize'=8
'workspace'=9
'execution'=10
'snapshot'=11
'transaction'=12
'remote'=13
'targets'=14
'portable'=15
'replica'=16
'local'=17
'from'=18
'result-bytes'=19
'rpc-calls'=20
'deadline-ms'=21
'query'=22
'reflection'=23
'specialize'=24
'root'=25
'document'=26
'fragments'=27
'view'=28
'max'=29
'allow'=30
'poll'=31
'queryable'=32
'rpc'=33
'query-reason'=34
'type'=35
'object'=36
'storable'=37
'implements'=38
'ref'=39
'fragment'=40
'import'=41
'external'=42
'atom'=43
'interface'=44
'interfaces'=45
'package'=46
'value'=47
'relation'=48
'operation'=49
'function'=50
'constructor'=51
'constructs'=52
'input'=53
'conform'=54
'as'=55
'bind'=56
'static'=57
'to'=58
'private'=59
'shared'=60
'state'=61
'edge'=62
'projection'=63
'with'=64
'using'=65
'accept'=66
'via'=67
'materialize'=68
'if'=69
'absent'=70
'on'=71
'policy'=72
'default'=73
'source'=74
'repository'=75
'commit'=76
'revision'=77
'semantic-major'=78
'on-delete'=79
'lifecycle'=80
'retain-other'=81
'keyed'=82
'public-traversal'=83
'id'=84
'doc'=85
'mode'=86
'emits'=87
'receiver'=88
'requires'=89
'any'=90
'get'=91
'set'=92
'watch'=93
'start'=94
'stop'=95
'read'=96
'write'=97
'resolve'=98
'connect'=99
'disconnect'=100
'call'=101
'watch-start'=102
'watch-stop'=103
'subscribe'=104
'unsubscribe'=105
'register'=106
'crdt'=107
'optional-one'=108
'exactly-one'=109
'many-unique'=110
'many'=111
'ordered'=112
'unit'=113
'watch-handle'=114
'message'=115
'atom-ref'=116
'interface-ref'=117
'optional'=118
'list'=119
'record'=120
'bool'=121
'bytes'=122
'double'=123
'int32'=124
'int64'=125
'string'=126
'uint32'=127
'uint64'=128
'true'=129
'false'=130
'null'=131
'->'=132
':'=133
';'=134
','=135
'.'=136
'{'=137
'}'=138
'['=139
']'=140
'('=141
')'=142
'<'=143
'>'=144
'&'=145
'='=146
File diff suppressed because one or more lines are too long
@@ -1,289 +1,299 @@
EDIT=1
CREATION=2
INITIALIZE=3
WORKSPACE=4
EXECUTION=5
SNAPSHOT=6
TRANSACTION=7
REMOTE=8
TARGETS=9
PORTABLE=10
REPLICA=11
LOCAL=12
FROM=13
RESULT_BYTES=14
RPC_CALLS=15
DEADLINE_MS=16
QUERY=17
REFLECTION=18
SPECIALIZE=19
ROOT=20
DOCUMENT=21
FRAGMENTS=22
VIEW=23
MAX=24
ALLOW=25
POLL=26
QUERYABLE=27
RPC=28
QUERY_REASON=29
TYPE=30
OBJECT=31
STORABLE=32
IMPLEMENTS=33
REF=34
FRAGMENT=35
IMPORT=36
EXTERNAL=37
ATOM=38
INTERFACE=39
INTERFACES=40
PACKAGE=41
VALUE=42
RELATION=43
OPERATION=44
FUNCTION=45
CONSTRUCTOR=46
CONSTRUCTS=47
INPUT=48
CONFORM=49
AS=50
BIND=51
STATIC=52
TO=53
PRIVATE=54
SHARED=55
STATE=56
EDGE=57
PROJECTION=58
WITH=59
USING=60
ACCEPT=61
VIA=62
MATERIALIZE=63
IF=64
ABSENT=65
ON=66
POLICY=67
DEFAULT=68
SOURCE=69
REPOSITORY=70
COMMIT=71
REVISION=72
SEMANTIC_MAJOR=73
ON_DELETE=74
LIFECYCLE=75
RETAIN_OTHER=76
KEYED=77
PUBLIC_TRAVERSAL=78
ID=79
DOC=80
MODE=81
EMITS=82
RECEIVER=83
REQUIRES=84
ANY=85
GET=86
SET=87
WATCH=88
START=89
STOP=90
READ=91
WRITE=92
RESOLVE=93
CONNECT=94
DISCONNECT=95
CALL=96
WATCH_START=97
WATCH_STOP=98
SUBSCRIBE=99
UNSUBSCRIBE=100
REGISTER=101
CRDT=102
OPTIONAL_ONE=103
EXACTLY_ONE=104
MANY_UNIQUE=105
MANY=106
ORDERED=107
UNIT=108
WATCH_HANDLE=109
MESSAGE=110
ATOM_REF=111
INTERFACE_REF=112
OPTIONAL=113
LIST=114
RECORD=115
BOOL=116
BYTES=117
DOUBLE=118
INT32=119
INT64=120
STRING=121
UINT32=122
UINT64=123
TRUE=124
FALSE=125
NULL=126
ARROW=127
COLON=128
SEMI=129
COMMA=130
DOT=131
LBRACE=132
RBRACE=133
LBRACK=134
RBRACK=135
LPAREN=136
RPAREN=137
LT=138
GT=139
AMP=140
EQUAL=141
INTEGER=142
JSON_NUMBER=143
IDENTIFIER=144
STRING_LITERAL=145
LINE_COMMENT=146
BLOCK_COMMENT=147
WS=148
COMPONENT=2
PRESENTATION=3
SUBJECT=4
RUNTIME=5
FOR=6
CREATION=7
INITIALIZE=8
WORKSPACE=9
EXECUTION=10
SNAPSHOT=11
TRANSACTION=12
REMOTE=13
TARGETS=14
PORTABLE=15
REPLICA=16
LOCAL=17
FROM=18
RESULT_BYTES=19
RPC_CALLS=20
DEADLINE_MS=21
QUERY=22
REFLECTION=23
SPECIALIZE=24
ROOT=25
DOCUMENT=26
FRAGMENTS=27
VIEW=28
MAX=29
ALLOW=30
POLL=31
QUERYABLE=32
RPC=33
QUERY_REASON=34
TYPE=35
OBJECT=36
STORABLE=37
IMPLEMENTS=38
REF=39
FRAGMENT=40
IMPORT=41
EXTERNAL=42
ATOM=43
INTERFACE=44
INTERFACES=45
PACKAGE=46
VALUE=47
RELATION=48
OPERATION=49
FUNCTION=50
CONSTRUCTOR=51
CONSTRUCTS=52
INPUT=53
CONFORM=54
AS=55
BIND=56
STATIC=57
TO=58
PRIVATE=59
SHARED=60
STATE=61
EDGE=62
PROJECTION=63
WITH=64
USING=65
ACCEPT=66
VIA=67
MATERIALIZE=68
IF=69
ABSENT=70
ON=71
POLICY=72
DEFAULT=73
SOURCE=74
REPOSITORY=75
COMMIT=76
REVISION=77
SEMANTIC_MAJOR=78
ON_DELETE=79
LIFECYCLE=80
RETAIN_OTHER=81
KEYED=82
PUBLIC_TRAVERSAL=83
ID=84
DOC=85
MODE=86
EMITS=87
RECEIVER=88
REQUIRES=89
ANY=90
GET=91
SET=92
WATCH=93
START=94
STOP=95
READ=96
WRITE=97
RESOLVE=98
CONNECT=99
DISCONNECT=100
CALL=101
WATCH_START=102
WATCH_STOP=103
SUBSCRIBE=104
UNSUBSCRIBE=105
REGISTER=106
CRDT=107
OPTIONAL_ONE=108
EXACTLY_ONE=109
MANY_UNIQUE=110
MANY=111
ORDERED=112
UNIT=113
WATCH_HANDLE=114
MESSAGE=115
ATOM_REF=116
INTERFACE_REF=117
OPTIONAL=118
LIST=119
RECORD=120
BOOL=121
BYTES=122
DOUBLE=123
INT32=124
INT64=125
STRING=126
UINT32=127
UINT64=128
TRUE=129
FALSE=130
NULL=131
ARROW=132
COLON=133
SEMI=134
COMMA=135
DOT=136
LBRACE=137
RBRACE=138
LBRACK=139
RBRACK=140
LPAREN=141
RPAREN=142
LT=143
GT=144
AMP=145
EQUAL=146
INTEGER=147
JSON_NUMBER=148
IDENTIFIER=149
STRING_LITERAL=150
LINE_COMMENT=151
BLOCK_COMMENT=152
WS=153
'edit'=1
'creation'=2
'initialize'=3
'workspace'=4
'execution'=5
'snapshot'=6
'transaction'=7
'remote'=8
'targets'=9
'portable'=10
'replica'=11
'local'=12
'from'=13
'result-bytes'=14
'rpc-calls'=15
'deadline-ms'=16
'query'=17
'reflection'=18
'specialize'=19
'root'=20
'document'=21
'fragments'=22
'view'=23
'max'=24
'allow'=25
'poll'=26
'queryable'=27
'rpc'=28
'query-reason'=29
'type'=30
'object'=31
'storable'=32
'implements'=33
'ref'=34
'fragment'=35
'import'=36
'external'=37
'atom'=38
'interface'=39
'interfaces'=40
'package'=41
'value'=42
'relation'=43
'operation'=44
'function'=45
'constructor'=46
'constructs'=47
'input'=48
'conform'=49
'as'=50
'bind'=51
'static'=52
'to'=53
'private'=54
'shared'=55
'state'=56
'edge'=57
'projection'=58
'with'=59
'using'=60
'accept'=61
'via'=62
'materialize'=63
'if'=64
'absent'=65
'on'=66
'policy'=67
'default'=68
'source'=69
'repository'=70
'commit'=71
'revision'=72
'semantic-major'=73
'on-delete'=74
'lifecycle'=75
'retain-other'=76
'keyed'=77
'public-traversal'=78
'id'=79
'doc'=80
'mode'=81
'emits'=82
'receiver'=83
'requires'=84
'any'=85
'get'=86
'set'=87
'watch'=88
'start'=89
'stop'=90
'read'=91
'write'=92
'resolve'=93
'connect'=94
'disconnect'=95
'call'=96
'watch-start'=97
'watch-stop'=98
'subscribe'=99
'unsubscribe'=100
'register'=101
'crdt'=102
'optional-one'=103
'exactly-one'=104
'many-unique'=105
'many'=106
'ordered'=107
'unit'=108
'watch-handle'=109
'message'=110
'atom-ref'=111
'interface-ref'=112
'optional'=113
'list'=114
'record'=115
'bool'=116
'bytes'=117
'double'=118
'int32'=119
'int64'=120
'string'=121
'uint32'=122
'uint64'=123
'true'=124
'false'=125
'null'=126
'->'=127
':'=128
';'=129
','=130
'.'=131
'{'=132
'}'=133
'['=134
']'=135
'('=136
')'=137
'<'=138
'>'=139
'&'=140
'='=141
'component'=2
'presentation'=3
'subject'=4
'runtime'=5
'for'=6
'creation'=7
'initialize'=8
'workspace'=9
'execution'=10
'snapshot'=11
'transaction'=12
'remote'=13
'targets'=14
'portable'=15
'replica'=16
'local'=17
'from'=18
'result-bytes'=19
'rpc-calls'=20
'deadline-ms'=21
'query'=22
'reflection'=23
'specialize'=24
'root'=25
'document'=26
'fragments'=27
'view'=28
'max'=29
'allow'=30
'poll'=31
'queryable'=32
'rpc'=33
'query-reason'=34
'type'=35
'object'=36
'storable'=37
'implements'=38
'ref'=39
'fragment'=40
'import'=41
'external'=42
'atom'=43
'interface'=44
'interfaces'=45
'package'=46
'value'=47
'relation'=48
'operation'=49
'function'=50
'constructor'=51
'constructs'=52
'input'=53
'conform'=54
'as'=55
'bind'=56
'static'=57
'to'=58
'private'=59
'shared'=60
'state'=61
'edge'=62
'projection'=63
'with'=64
'using'=65
'accept'=66
'via'=67
'materialize'=68
'if'=69
'absent'=70
'on'=71
'policy'=72
'default'=73
'source'=74
'repository'=75
'commit'=76
'revision'=77
'semantic-major'=78
'on-delete'=79
'lifecycle'=80
'retain-other'=81
'keyed'=82
'public-traversal'=83
'id'=84
'doc'=85
'mode'=86
'emits'=87
'receiver'=88
'requires'=89
'any'=90
'get'=91
'set'=92
'watch'=93
'start'=94
'stop'=95
'read'=96
'write'=97
'resolve'=98
'connect'=99
'disconnect'=100
'call'=101
'watch-start'=102
'watch-stop'=103
'subscribe'=104
'unsubscribe'=105
'register'=106
'crdt'=107
'optional-one'=108
'exactly-one'=109
'many-unique'=110
'many'=111
'ordered'=112
'unit'=113
'watch-handle'=114
'message'=115
'atom-ref'=116
'interface-ref'=117
'optional'=118
'list'=119
'record'=120
'bool'=121
'bytes'=122
'double'=123
'int32'=124
'int64'=125
'string'=126
'uint32'=127
'uint64'=128
'true'=129
'false'=130
'null'=131
'->'=132
':'=133
';'=134
','=135
'.'=136
'{'=137
'}'=138
'['=139
']'=140
'('=141
')'=142
'<'=143
'>'=144
'&'=145
'='=146
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -29,6 +29,8 @@ import { RelationshipOperationContext } from "./QuixosCapabilityParser.js";
import { TargetConstraintContext } from "./QuixosCapabilityParser.js";
import { PackageResourceDeclContext } from "./QuixosCapabilityParser.js";
import { PackageExportContext } from "./QuixosCapabilityParser.js";
import { ComponentDeclContext } from "./QuixosCapabilityParser.js";
import { PresentationDeclContext } from "./QuixosCapabilityParser.js";
import { PackageQueryContext } from "./QuixosCapabilityParser.js";
import { PackageQuerySpecializationContext } from "./QuixosCapabilityParser.js";
import { QueryClauseContext } from "./QuixosCapabilityParser.js";
@@ -251,6 +253,18 @@ export class QuixosCapabilityVisitor<Result> extends AbstractParseTreeVisitor<Re
* @return the visitor result
*/
visitPackageExport?: (ctx: PackageExportContext) => Result;
/**
* Visit a parse tree produced by `QuixosCapabilityParser.componentDecl`.
* @param ctx the parse tree
* @return the visitor result
*/
visitComponentDecl?: (ctx: ComponentDeclContext) => Result;
/**
* Visit a parse tree produced by `QuixosCapabilityParser.presentationDecl`.
* @param ctx the parse tree
* @return the visitor result
*/
visitPresentationDecl?: (ctx: PresentationDeclContext) => Result;
/**
* Visit a parse tree produced by `QuixosCapabilityParser.packageQuery`.
* @param ctx the parse tree
+42
View File
@@ -1333,9 +1333,25 @@ const lowerPackage = (
}),
);
const genericExports: GenericPackageExport[] = [];
const components: NonNullable<PackageRevision["components"]> = [];
const queries: QueryDeclaration[] = [];
const queryTemplates: QueryTemplate[] = [];
const exports = context.packageExport().flatMap((exportContext): PackageExport[] => {
const component = exportContext.componentDecl();
if (component) {
const runtime = identifier(component.identifier(1));
if (runtime !== "react")
loweringIssue(state, component, "unsupported-component-runtime", `Unsupported component runtime ${runtime}`);
components.push({
id: stringValue(component.stringLiteral()),
displayName: identifier(component.identifier(0)),
subject: new TypeSubstitution(state.types.environment()).application(
state.types.interface(component.interfaceType()),
),
runtime: "react",
});
return [];
}
if (exportContext.packageQuerySpecialization()) return [];
const query = exportContext.packageQuery();
if (query) {
@@ -1595,6 +1611,7 @@ const lowerPackage = (
displayName: alias,
source,
exports,
...(components.length ? { components } : {}),
...(queries.length ? { queries } : {}),
...(queryTemplates.length ? { queryTemplates } : {}),
...(queries.some((query) => query.argumentRequirements?.length)
@@ -2397,6 +2414,30 @@ const lowerWorkspace = (
: [];
});
const presentations: NonNullable<WorkspaceRevision["presentations"]> = items.flatMap((item) => {
const presentation = item.presentationDecl();
if (!presentation) return [];
const packageName = identifier(presentation.identifier(1));
const componentName = identifier(presentation.identifier(2));
const pkg = requireSymbol(state, state.packages, packageName, presentation, "package");
const component = pkg?.definition?.components?.find((entry) => entry.displayName === componentName);
if (!component) {
loweringIssue(state, presentation, "unknown-component", `Unknown component ${packageName}.${componentName}`);
return [];
}
return [
{
id: stringValue(presentation.stringLiteral()),
displayName: identifier(presentation.identifier(0)),
subject: new TypeSubstitution(state.types.environment()).application(
state.types.interface(presentation.interfaceType()),
),
packageRevisionId: pkg!.revisionId,
componentId: component.id,
},
];
});
return {
imports,
workspace: {
@@ -2417,6 +2458,7 @@ const lowerWorkspace = (
),
conformances,
constructors,
...(presentations.length ? { presentations } : {}),
},
};
};