File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,14 +39,25 @@ check(
3939) ;
4040
4141const composition = registrySource . match (
42- / e x p o r t c o n s t P r o t o c o l S c h e m a s = c o m p o s e P r o t o c o l S c h e m a F r a g m e n t s \( \[ ( [ \s \S ] * ?) \] \s + a s c o n s t \) ; / u,
42+ / e x p o r t c o n s t P r o t o c o l S c h e m a s : \s * ( [ \s \S ] * ? ) \s * = c o m p o s e P r o t o c o l S c h e m a F r a g m e n t s \( \[ ( [ \s \S ] * ?) \] \s + a s c o n s t \) ; / u,
4343) ;
44- const composedBindings = ( composition ?. [ 1 ] ?? "" )
44+ const composedBindings = ( composition ?. [ 2 ] ?? "" )
4545 . split ( "\n" )
4646 . map ( ( line ) => line . trim ( ) . replace ( / , $ / u, "" ) )
4747 . filter ( Boolean ) ;
48+ const annotatedBindings = ( composition ?. [ 1 ] ?? "" )
49+ . split ( "&" )
50+ . map ( ( type ) => / ^ t y p e o f ( [ A - Z a - z 0 - 9 _ ] + ) $ / u. exec ( type . trim ( ) ) ?. [ 1 ] ) ;
4851const importedBindings = fragmentImports . map ( ( { binding } ) => binding ) ;
49- check ( Boolean ( composition ) , `${ registryPath } must explicitly compose an ordered fragment array` ) ;
52+ check (
53+ Boolean ( composition ) ,
54+ `${ registryPath } must explicitly type and compose an ordered fragment array` ,
55+ ) ;
56+ check (
57+ annotatedBindings . length === composedBindings . length &&
58+ annotatedBindings . every ( ( binding , index ) => binding === composedBindings [ index ] ) ,
59+ `${ registryPath } must annotate the composed fragments with their exact ordered typeof intersection` ,
60+ ) ;
5061check (
5162 composedBindings . length === importedBindings . length &&
5263 new Set ( composedBindings ) . size === composedBindings . length &&
You can’t perform that action at this time.
0 commit comments