@@ -71,6 +71,9 @@ const BINDINGS_FILE = 'protocol-package-bindings.ts';
7171const BINDINGS = readFileSync ( fileURLToPath ( new URL ( `./${ BINDINGS_FILE } ` , import . meta. url ) ) , 'utf8' ) ;
7272/** [#25467 E2 cut 1a] The module the list read's body (`readFlattenedMetaItems`) moved to. */
7373const LIST_READS_FILE = 'protocol-meta-list-reads.ts' ;
74+ /** [#25467 E2 cut 1b] The modules the item read's body (`readMetaItem`) and the layered read's body (`getMetaItemLayered`) moved to. */
75+ const ITEM_READS_FILE = 'protocol-meta-item-reads.ts' ;
76+ const LAYERED_READS_FILE = 'protocol-meta-layered-reads.ts' ;
7477
7578/** A class member's header in `protocol.ts`: four spaces, optional modifiers, its name, its parameter list. */
7679const MEMBER_HEADER = / ^ { 4 } (?: (?: p r i v a t e | p u b l i c | p r o t e c t e d | s t a t i c | a s y n c | o v e r r i d e | r e a d o n l y ) \s + ) * ( [ A - Z a - z _ $ ] [ \w $ ] * ) \s * (?: < [ ^ > ] * > ) ? \( | ^ { 4 } ( s t a t i c ) \{ $ / ;
@@ -121,15 +124,15 @@ const SITES: ReadonlyArray<Site & { readonly noPackage: boolean; readonly dispos
121124 why : 'the definition itself: the class member\'s declared signature (its body delegates to the seam function below)' } ,
122125 { file : SEAM_FILE , member : 'lookupArtifactItem' , args : 'this: Pick<ArtifactLookupHost, \'engine\'>, type: string, name: string, currentPackageId?: string, member?: string' , noPackage : false , disposition : 'definition' ,
123126 why : '[#25467 cut 15] the definition\'s body, the function the class member delegates to' } ,
124- { member : 'readMetaItem' , args : 'request.type, request.name, envelopePackageId(request.packageId, item), bundleMemberOf(request.type, item)' , noPackage : true , disposition : 'served-package envelope' ,
127+ { file : ITEM_READS_FILE , member : 'readMetaItem' , args : 'request.type, request.name, envelopePackageId(request.packageId, item), bundleMemberOf(request.type, item)' , noPackage : true , disposition : 'served-package envelope' ,
125128 why : 'the by-name read\'s envelope: naming no package, the package of the item it serves (the list\'s rule); [#23074] at the served item\'s own bundle member' } ,
126129 { file : LIST_READS_FILE , member : 'readFlattenedMetaItems' , args : 'request.type, itemName, itemPackageId, bundleMemberOf(request.type, it)' , noPackage : true , disposition : 'served-package envelope' ,
127130 why : 'the list\'s envelope: each item\'s own package, the rule the by-name read shares; [#23074] at each item\'s own bundle member' } ,
128- { member : 'readMetaItem' , args : 'request.type, request.name, request.packageId' , noPackage : true , disposition : 'no' ,
131+ { file : ITEM_READS_FILE , member : 'readMetaItem' , args : 'request.type, request.name, request.packageId' , noPackage : true , disposition : 'no' ,
129132 why : 'the shipped-flow arm: the served body IS this artifact, and the envelope is looked up at its own package' } ,
130- { member : 'readMetaItem' , args : 'request.type, request.name, request.packageId, wantedMember' , noPackage : true , disposition : 'no' ,
133+ { file : ITEM_READS_FILE , member : 'readMetaItem' , args : 'request.type, request.name, request.packageId, wantedMember' , noPackage : true , disposition : 'no' ,
131134 why : '[#22877] a bundled type\'s addressed member (the selector\'s, else the canonical one) when no stored row of it exists: the served body IS this artifact, and the envelope is looked up at its own package' } ,
132- { member : 'getMetaItemLayered' , args : 'request.type, request.name, request.packageId, wantedMember' , noPackage : true , disposition : 'no' ,
135+ { file : LAYERED_READS_FILE , member : 'getMetaItemLayered' , args : 'request.type, request.name, request.packageId, wantedMember' , noPackage : true , disposition : 'no' ,
133136 why : 'the layered read\'s code LAYER: body and envelope are one artifact, and its provenance fields are read off that layer; [#26699] at the addressed member (the selector\'s, else the canonical one)' } ,
134137 { member : 'packagedArtifactBase' , args : 'type, name' , noPackage : true , disposition : 'no' ,
135138 why : 'the packaged base the translators compare a served body against: nothing of it is grafted onto the body' } ,
@@ -230,7 +233,11 @@ describe('[#22024] every lookupArtifactItem( in protocol.ts has a recorded dispo
230233 // imports that definition rather than carrying a copy of its own.
231234 expect ( BINDINGS ) . toMatch ( / \n f u n c t i o n e n v e l o p e P a c k a g e I d \( r e q u e s t e d P a c k a g e I d : s t r i n g \| u n d e f i n e d , s e r v e d : u n k n o w n \) : s t r i n g \| u n d e f i n e d \{ / ) ;
232235 expect ( SOURCE ) . not . toMatch ( / \n f u n c t i o n e n v e l o p e P a c k a g e I d \( / ) ;
233- expect ( SOURCE ) . toMatch ( / \n i m p o r t \{ [ ^ } ] * \b e n v e l o p e P a c k a g e I d , [ ^ } ] * \} f r o m ' \. \/ p r o t o c o l - p a c k a g e - b i n d i n g s \. j s ' ; / ) ;
236+ // [#25467 E2 cut 1b] The item read's body moved too, so neither door stands in
237+ // protocol.ts any more: its module imports the same one definition.
238+ const itemReads = MODULE_SOURCES . get ( ITEM_READS_FILE ) ! ;
239+ expect ( itemReads ) . not . toMatch ( / \n f u n c t i o n e n v e l o p e P a c k a g e I d \( / ) ;
240+ expect ( itemReads ) . toMatch ( / \n i m p o r t \{ [ ^ } ] * \b e n v e l o p e P a c k a g e I d , [ ^ } ] * \} f r o m ' \. \/ p r o t o c o l - p a c k a g e - b i n d i n g s \. j s ' ; / ) ;
234241 // [#25467 E2 cut 1a] The list read's body moved: its envelope line is read
235242 // where it now stands, and that module imports the same one definition.
236243 const listReads = MODULE_SOURCES . get ( LIST_READS_FILE ) ! ;
0 commit comments