33 *
44 * This script:
55 * 1. Ensures @socketsecurity/bootstrap package is built
6- * 2. Builds bootstrap.js for SEA builds
7- * 3. Builds bootstrap-smol.js for smol builds
8- * 4. Copies LICENSE, CHANGELOG.md, and logo images from repo root
6+ * 2. Builds bootstrap.js for npm package
7+ * 3. Copies LICENSE, CHANGELOG.md, and logo images from repo root
8+ *
9+ * Note: bootstrap-smol.js is built by @socketsecurity/bootstrap package
10+ * and used directly by the smol+node builder. It is NOT part of this package.
911 */
1012
11- import { existsSync , mkdirSync , writeFileSync } from 'node:fs'
13+ import { existsSync , mkdirSync } from 'node:fs'
1214import { promises as fs } from 'node:fs'
1315import path from 'node:path'
1416import { fileURLToPath } from 'node:url'
@@ -21,7 +23,6 @@ import { Spinner, withSpinner } from '@socketsecurity/lib/spinner'
2123import { spawn } from '@socketsecurity/lib/spawn'
2224
2325import seaConfig from './esbuild.bootstrap.config.mjs'
24- import smolConfig from './esbuild.bootstrap-smol.config.mjs'
2526
2627const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
2728const packageRoot = path . resolve ( __dirname , '..' )
@@ -118,16 +119,16 @@ async function copyFilesFromRepoRoot() {
118119}
119120
120121async function buildBootstrap ( ) {
121- logger . group ( 'Building bootstrap bundles ' )
122+ logger . group ( 'Building bootstrap bundle ' )
122123
123124 try {
124125 // Create dist directory.
125126 logger . substep ( 'Creating dist directory' )
126127 mkdirSync ( path . join ( packageRoot , 'dist' ) , { recursive : true } )
127128
128- // Build standard version for SEA .
129+ // Build bootstrap.js for npm package .
129130 const seaResult = await withSpinner ( {
130- message : 'Building standard bootstrap (SEA) ' ,
131+ message : 'Building bootstrap.js ' ,
131132 spinner : Spinner ( { shimmer : { dir : 'ltr' } } ) ,
132133 operation : async ( ) => {
133134 const result = await build ( seaConfig )
@@ -138,32 +139,7 @@ async function buildBootstrap() {
138139 if ( seaResult . metafile ) {
139140 const outputSize = Object . values ( seaResult . metafile . outputs ) [ 0 ] ?. bytes
140141 if ( outputSize ) {
141- logger . substep ( `SEA bundle: ${ ( outputSize / 1024 ) . toFixed ( 2 ) } KB` )
142- }
143- }
144-
145- // Build transformed version for smol.
146- const smolResult = await withSpinner ( {
147- message : 'Building transformed bootstrap (smol)' ,
148- spinner : Spinner ( { shimmer : { dir : 'ltr' } } ) ,
149- operation : async ( ) => {
150- const result = await build ( smolConfig )
151-
152- // Write the transformed output (build had write: false).
153- if ( result . outputFiles && result . outputFiles . length > 0 ) {
154- for ( const output of result . outputFiles ) {
155- writeFileSync ( output . path , output . contents )
156- }
157- }
158-
159- return result
160- } ,
161- } )
162-
163- if ( smolResult . metafile ) {
164- const outputSize = Object . values ( smolResult . metafile . outputs ) [ 0 ] ?. bytes
165- if ( outputSize ) {
166- logger . substep ( `Smol bundle: ${ ( outputSize / 1024 ) . toFixed ( 2 ) } KB` )
142+ logger . substep ( `Bundle size: ${ ( outputSize / 1024 ) . toFixed ( 2 ) } KB` )
167143 }
168144 }
169145
0 commit comments