@@ -177,21 +177,6 @@ function createStubPlugin(stubMap = STUB_MAP) {
177177 }
178178}
179179
180- // Shared dependencies that exist as standalone bundle files in dist/external/.
181- // These must be marked external in bundles that would otherwise inline them,
182- // so that at runtime they resolve to the existing bundle wrappers.
183- const SHARED_EXTERNAL_DEPS = [
184- 'debug' ,
185- 'has-flag' ,
186- 'p-map' ,
187- 'signal-exit' ,
188- 'spdx-correct' ,
189- 'spdx-expression-parse' ,
190- 'supports-color' ,
191- 'which' ,
192- 'yoctocolors-cjs' ,
193- ]
194-
195180/**
196181 * Get package-specific esbuild options.
197182 *
@@ -209,12 +194,6 @@ export function getPackageSpecificOptions(packageName) {
209194 } else if ( packageName === 'zod' ) {
210195 // Zod has localization files we don't need.
211196 opts . external = [ ...( opts . external || [ ] ) , './locales/*' ]
212- } else if ( packageName === 'debug' ) {
213- // Mark supports-color as external - it exists as a standalone bundle wrapper.
214- opts . external = [ ...( opts . external || [ ] ) , 'supports-color' ]
215- } else if ( packageName === 'pico-pack' ) {
216- // Mark p-map as external - it has its own standalone bundle.
217- opts . external = [ ...( opts . external || [ ] ) , 'p-map' ]
218197 } else if ( packageName === 'external-pack' ) {
219198 // Inquirer packages have heavy dependencies we can exclude.
220199 opts . external = [ ...( opts . external || [ ] ) , 'rxjs/operators' ]
@@ -223,10 +202,6 @@ export function getPackageSpecificOptions(packageName) {
223202 opts . footer = {
224203 js : 'if (module.exports && module.exports.default && Object.keys(module.exports).length === 1) { module.exports = module.exports.default; }' ,
225204 }
226- } else if ( packageName === 'npm-pack' ) {
227- // Mark shared deps as external - they exist as standalone bundle wrappers.
228- // This eliminates ~100KB of duplication in the npm-pack bundle.
229- opts . external = [ ...( opts . external || [ ] ) , ...SHARED_EXTERNAL_DEPS ]
230205 } else if ( packageName === '@socketregistry/packageurl-js' ) {
231206 // packageurl-js imports from socket-lib, creating a circular dependency.
232207 // Mark socket-lib imports as external to avoid bundling issues.
@@ -256,6 +231,8 @@ export function getEsbuildConfig(entryPoint, outfile, packageOpts = {}) {
256231 entryPoints : [ entryPoint ] ,
257232 bundle : true ,
258233 platform : 'node' ,
234+ // Intentionally conservative: node18 ensures maximum compatibility
235+ // for bundled externals consumed by downstream packages.
259236 target : 'node18' ,
260237 format : 'cjs' ,
261238 outfile,
@@ -296,7 +273,7 @@ export function getEsbuildConfig(entryPoint, outfile, packageOpts = {}) {
296273 keepNames : true ,
297274 // Additional optimizations:
298275 pure : [ 'console.log' , 'console.debug' , 'console.warn' ] ,
299- drop : [ 'debugger' , 'console' ] ,
276+ drop : [ 'debugger' ] ,
300277 ignoreAnnotations : false ,
301278 // Define compile-time constants for dead code elimination.
302279 define : {
0 commit comments