@@ -1075,21 +1075,23 @@ function moduleText(moduleFile, title, movers, scope, leafNames) {
10751075 * export and something outside the leaf now imports.
10761076 */
10771077function leafText ( scope , top , leafExports ) {
1078+ // The header is `//` lines, not a `/** */` docblock: the bundled `.d.ts`
1079+ // keeps a JSDoc block that leads a module's first statement, and this module
1080+ // is bundled FIRST, so a docblock here would be published text the base did
1081+ // not carry (measured: 14 added lines in dist/index.d.ts).
10781082 const out = [ ] ;
10791083 out . push ( '// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.' ) ;
10801084 out . push ( '' ) ;
1081- out . push ( '/**' ) ;
10821085 out . push ( ...wrapComment ( [ MARK , 'The' , 'top-level' , 'declarations' , 'ahead' , 'of' , '`SqlDriver`' , 'in' , '`sql-driver.ts`' ,
10831086 'that' , 'moved' , 'out' , 'whole' , 'by' , '`scripts/codemod-split-sql-driver.mjs`' , '(lever' , '(b)' , 'of' , 'ruling' ,
1084- '6591753301).' ] ) ) ;
1085- out . push ( ' *' ) ;
1086- out . push ( ' * A MOVE, not a redesign: each declaration below is its `sql-driver.ts` text' ) ;
1087- out . push ( ' * exactly, with the comments above it, in the order it stood there. A LEAF:' ) ;
1088- out . push ( ' * it imports neither `sql-driver.ts` nor any `sql-driver-*` module, so it is' ) ;
1089- out . push ( ' * evaluated before the class and forms no cycle with it. `sql-driver.ts`' ) ;
1090- out . push ( ' * re-exports, by name, every declaration here it exported before, so every' ) ;
1091- out . push ( ' * importer of `./sql-driver.js` reads what it read.' ) ;
1092- out . push ( ' */' ) ;
1087+ '6591753301).' ] ) . map ( ( l ) => l . replace ( / ^ \* / , '//' ) ) ) ;
1088+ out . push ( '//' ) ;
1089+ out . push ( '// A MOVE, not a redesign: each declaration below is its `sql-driver.ts` text' ) ;
1090+ out . push ( '// exactly, with the comments above it, in the order it stood there. A LEAF:' ) ;
1091+ out . push ( '// it imports neither `sql-driver.ts` nor any `sql-driver-*` module, so it is' ) ;
1092+ out . push ( '// evaluated before the class and forms no cycle with it. `sql-driver.ts`' ) ;
1093+ out . push ( '// re-exports, by name, every declaration here it exported before, so every' ) ;
1094+ out . push ( '// importer of `./sql-driver.js` reads what it read.' ) ;
10931095 out . push ( '' ) ;
10941096 out . push ( ...importLines ( scope , top . movers ) ) ;
10951097 let text = out . join ( '\n' ) ;
@@ -1236,7 +1238,7 @@ function verify(tm, baseText, headText, moduleTexts, { readSibling = null } = {}
12361238 const stmts = sf . getStatements ( ) ;
12371239 // The generated header is leading trivia of the first statement when no
12381240 // import precedes it; a moved statement's text starts after it.
1239- const headerEnd = text . indexOf ( ' */\n ' , text . indexOf ( MARK ) ) + ' */\n' . length ;
1241+ const headerEnd = text . indexOf ( '\n\n ' , text . indexOf ( MARK ) ) + 1 ;
12401242 stmts . forEach ( ( st , i ) => {
12411243 if ( Node . isImportDeclaration ( st ) ) {
12421244 if ( / ^ \. \/ s q l - d r i v e r / . test ( st . getModuleSpecifierValue ( ) ) ) {
@@ -1627,7 +1629,7 @@ let selfTestReachedVerdict = false;
16271629const SELF_TEST_BATTERIES = Object . freeze ( {
16281630 'declaration bar' : 6 ,
16291631 'stay rules' : 11 ,
1630- 'top-level moves' : 9 ,
1632+ 'top-level moves' : 10 ,
16311633 'byte-identity proof' : 10 ,
16321634 'refusals' : 3 ,
16331635} ) ;
@@ -1823,6 +1825,8 @@ async function selfTest() {
18231825 check ( 'a declaration after the class is not in the region' , ! top ( 'needleInMethod' ) ) ;
18241826 const out = generate ( tm , input , planned ) ;
18251827 const leaf = out . modules . get ( LEAF_MODULE ) ?? '' ;
1828+ check ( 'the leaf header is line comments, never a docblock the bundled .d.ts would publish' ,
1829+ leaf . includes ( MARK ) && ! leaf . slice ( 0 , leaf . indexOf ( '\n\n' , leaf . indexOf ( MARK ) ) ) . includes ( '/*' ) ) ;
18261830 check ( 'the leaf imports neither sql-driver.ts nor a seam module' , leaf . length > 0 && ! / f r o m ' \. \/ s q l - d r i v e r / . test ( leaf ) , leaf . slice ( 0 , 200 ) ) ;
18271831 check ( 'sql-driver.ts re-exports the exported movers by name, the interface as a type' ,
18281832 / e x p o r t \{ D E R I V E D , t y p e E x p o r t e d S h a p e \} f r o m ' \. \/ s q l - d r i v e r - t o p - l e v e l \. j s ' ; / . test ( out . host ) ) ;
0 commit comments