@@ -76,6 +76,7 @@ hashTree(fingerprint, aiDir, { skip: ['test', 'node_modules', 'scripts', '.DS_St
7676hashTree ( fingerprint , path . join ( WEB , 'ai-extension' ) , { skip : [ 'assets.generated.js' , 'node_modules' , '.DS_Store' ] } ) ;
7777hashTree ( fingerprint , path . join ( WEB , 'workspace' ) , { skip : [ 'node_modules' , '.DS_Store' ] } ) ;
7878hashTree ( fingerprint , path . join ( WEB , 'theme' ) , { skip : [ '.DS_Store' ] } ) ;
79+ hashTree ( fingerprint , path . join ( WEB , 'shell' ) , { skip : [ 'node_modules' , '.DS_Store' ] } ) ;
7980hashTree ( fingerprint , path . join ( WEB , 'lib' ) , { skip : [ '.DS_Store' ] } ) ;
8081// The declarative built-ins are staged from the checkout's extensions/ (grammars, language configurations, the desktop's
8182// themes — whose manifest this build rewrites): a changed grammar is a changed build, and so is the fallback copy of
@@ -84,7 +85,7 @@ hashTree(fingerprint, path.join(WEB, 'lib'), { skip: ['.DS_Store'] });
8485 const baked = fs . existsSync ( path . join ( staticDir , 'extensions' ) ) ? fs . readdirSync ( path . join ( staticDir , 'extensions' ) ) : [ ] ;
8586 const source = path . join ( vscodeDir , 'extensions' ) ;
8687 if ( fs . existsSync ( source ) ) {
87- for ( const name of declarativeExtensionNames ( source , [ ...baked , 'levelcode-ai' , 'levelcode-web' ] ) ) {
88+ for ( const name of declarativeExtensionNames ( source , [ ...baked , 'levelcode-ai' , 'levelcode-web' , 'levelcode-shell' ] ) ) {
8889 fingerprint . update ( '\0ext\0' + name ) ;
8990 hashTree ( fingerprint , path . join ( source , name ) , { skip : [ ...COPY_SKIP , '.DS_Store' ] } ) ;
9091 }
@@ -114,13 +115,17 @@ log('bundling levelcode-ai for the web worker extension host');
114115const r = spawnSync ( process . execPath , [ path . join ( WEB , 'ai-extension' , 'build.mjs' ) , '--out' , extOut , '--vscode' , vscodeDir , '--minify' ] , { stdio : 'inherit' } ) ;
115116if ( r . status !== 0 ) { die ( 'the levelcode-ai browser build failed' ) ; }
116117
118+ log ( 'bundling levelcode-shell (the shell extension and its engine worker)' ) ;
119+ const rShell = spawnSync ( process . execPath , [ path . join ( WEB , 'shell' , 'build.mjs' ) , '--out' , extOut , '--vscode' , vscodeDir , '--minify' ] , { stdio : 'inherit' } ) ;
120+ if ( rShell . status !== 0 ) { die ( 'the levelcode-shell build failed' ) ; }
121+
117122log ( 'staging the scratch workspace and the declarative built-ins' ) ;
118123const scratchOut = path . join ( extOut , 'levelcode-web' ) ;
119124copyExtension ( path . join ( WEB , 'workspace' ) , scratchOut ) ;
120125fs . writeFileSync ( path . join ( scratchOut , 'package.nls.json' ) , '{}\n' ) ;
121126const extensionsSource = path . join ( vscodeDir , 'extensions' ) ;
122127if ( ! fs . existsSync ( extensionsSource ) ) { die ( 'no extensions/ in ' + vscodeDir + ' to take the declarative built-ins from' ) ; }
123- const declarative = stageDeclarativeExtensions ( extensionsSource , extOut , { exclude : [ ...baked , 'levelcode-ai' , 'levelcode-web' ] } ) ;
128+ const declarative = stageDeclarativeExtensions ( extensionsSource , extOut , { exclude : [ ...baked , 'levelcode-ai' , 'levelcode-web' , 'levelcode-shell' ] } ) ;
124129// A checkout that has not had LevelCode's extensions copied in still builds; the themes are then absent.
125130if ( ! declarative . includes ( 'levelcode-themes' ) ) {
126131 const themes = path . join ( REPO , 'extensions' , 'levelcode-themes' ) ;
@@ -133,8 +138,8 @@ copyExtension(path.join(WEB, 'theme', 'levelcode-web-theme'), themeOut);
133138fs . writeFileSync ( path . join ( themeOut , 'package.nls.json' ) , '{}\n' ) ;
134139const desktopThemes = path . join ( extOut , 'levelcode-themes' , 'package.json' ) ;
135140if ( fs . existsSync ( desktopThemes ) ) { withoutConfigurationDefaults ( desktopThemes ) ; }
136- const extensions = [ 'levelcode-ai' , 'levelcode-web' , 'levelcode-web-theme' , ...declarative . sort ( ) ] ;
137- log ( `${ extensions . length } extensions: levelcode-ai, levelcode-web, levelcode-web-theme and ${ declarative . length } declarative (${ declarative . slice ( 0 , 6 ) . join ( ', ' ) } , ...)` ) ;
141+ const extensions = [ 'levelcode-ai' , 'levelcode-web' , 'levelcode-web-theme' , 'levelcode-shell' , ...declarative . sort ( ) ] ;
142+ log ( `${ extensions . length } extensions: levelcode-ai, levelcode-web, levelcode-web-theme, levelcode-shell and ${ declarative . length } declarative (${ declarative . slice ( 0 , 6 ) . join ( ', ' ) } , ...)` ) ;
138143
139144log ( 'writing the page' ) ;
140145// main.js and boot.css are addressed by the build id like everything else; the page names them.
@@ -190,7 +195,8 @@ JSON.parse(m[1]);
190195if ( / \{ \{ [ A - Z ] + \} \} / . test ( html ) ) { die ( 'index.html still has an unfilled placeholder' ) ; }
191196for ( const must of [ `${ prefix } /main.js` , `${ prefix } /boot.css` , `${ prefix } /static/out/nls.messages.js` , `${ prefix } /extensions/levelcode-ai/extension.web.js` ,
192197 `${ prefix } /extensions/levelcode-ai/package.json` , `${ prefix } /extensions/levelcode-web/extension.js` ,
193- `${ prefix } /chrome.css` , `${ prefix } /extensions/levelcode-web-theme/package.json` ] ) {
198+ `${ prefix } /chrome.css` , `${ prefix } /extensions/levelcode-web-theme/package.json` ,
199+ `${ prefix } /extensions/levelcode-shell/package.json` , `${ prefix } /extensions/levelcode-shell/extension.js` , `${ prefix } /extensions/levelcode-shell/engine.worker.js` ] ) {
194200 if ( ! fs . existsSync ( path . join ( outDir , must ) ) ) { die ( 'missing ' + must ) ; }
195201}
196202log ( `done: ${ outDir } ${ mb ( sizeOf ( outDir ) ) } (client ${ mb ( sizeOf ( path . join ( root , 'static' ) ) ) } , extensions ${ mb ( sizeOf ( extOut ) ) } )` ) ;
0 commit comments