@@ -42,6 +42,7 @@ type UpstreamVersions = {
4242type PnpmWorkspaceVersions = {
4343 vitest : string ;
4444 tsdown : string ;
45+ lightningcss : string ;
4546 oxcNodeCli : string ;
4647 oxcNodeCore : string ;
4748 oxfmt : string ;
@@ -145,6 +146,25 @@ async function getLatestNpmVersion(packageName: string): Promise<string> {
145146 return data . version ;
146147}
147148
149+ // Read a dependency range from the latest published version of `packageName`,
150+ // e.g. the `lightningcss` range that the bundled `@tsdown/css` depends on.
151+ async function getNpmDependencyRange ( packageName : string , dependencyName : string ) : Promise < string > {
152+ const res = await fetch ( `https://registry.npmjs.org/${ packageName } /latest` ) ;
153+ if ( ! res . ok ) {
154+ throw new Error (
155+ `Failed to fetch npm metadata for ${ packageName } : ${ res . status } ${ res . statusText } ` ,
156+ ) ;
157+ }
158+ const data = ( await res . json ( ) ) as { dependencies ?: Record < string , string > } ;
159+ const range = data . dependencies ?. [ dependencyName ] ;
160+ if ( typeof range !== 'string' ) {
161+ throw new Error (
162+ `Invalid npm response for ${ packageName } : missing dependencies.${ dependencyName } ` ,
163+ ) ;
164+ }
165+ return range ;
166+ }
167+
148168// ============ Update .upstream-versions.json ============
149169async function updateUpstreamVersions ( ) : Promise < void > {
150170 const filePath = path . join ( ROOT , 'packages/tools/.upstream-versions.json' ) ;
@@ -227,6 +247,15 @@ async function updatePnpmWorkspace(versions: PnpmWorkspaceVersions): Promise<voi
227247 replacement : `'@tsdown/exe': ^${ versions . tsdown } ` ,
228248 newVersion : versions . tsdown ,
229249 } ,
250+ // `lightningcss` is a core dependency consumed by the bundled `@tsdown/css`.
251+ // Track exactly what `@tsdown/css` requires (already an `^x.y.z` range) so a
252+ // tsdown upgrade that bumps lightningcss is mirrored here.
253+ {
254+ name : 'lightningcss' ,
255+ pattern : / \n { 2 } l i g h t n i n g c s s : ( \^ ? [ \d . ] + (?: - [ \w . ] + ) ? ) \n / ,
256+ replacement : `\n lightningcss: ${ versions . lightningcss } \n` ,
257+ newVersion : versions . lightningcss ,
258+ } ,
230259 {
231260 name : '@oxc-node/cli' ,
232261 pattern : / ' @ o x c - n o d e \/ c l i ' : \^ ( [ \d . ] + (?: - [ \w . ] + ) ? ) / ,
@@ -531,6 +560,7 @@ console.log('Fetching latest versions…');
531560const [
532561 vitestVersion ,
533562 tsdownVersion ,
563+ lightningcssVersion ,
534564 devtoolsVersion ,
535565 oxcNodeCliVersion ,
536566 oxcNodeCoreVersion ,
@@ -545,6 +575,8 @@ const [
545575] = await Promise . all ( [
546576 getLatestNpmVersion ( 'vitest' ) ,
547577 getLatestNpmVersion ( 'tsdown' ) ,
578+ // Mirror exactly what the bundled @tsdown /css depends on.
579+ getNpmDependencyRange ( '@tsdown/css' , 'lightningcss' ) ,
548580 getLatestNpmVersion ( '@vitejs/devtools' ) ,
549581 getLatestNpmVersion ( '@oxc-node/cli' ) ,
550582 getLatestNpmVersion ( '@oxc-node/core' ) ,
@@ -560,6 +592,7 @@ const [
560592
561593console . log ( `vitest: ${ vitestVersion } ` ) ;
562594console . log ( `tsdown: ${ tsdownVersion } ` ) ;
595+ console . log ( `lightningcss (from @tsdown/css): ${ lightningcssVersion } ` ) ;
563596console . log ( `@vitejs/devtools: ${ devtoolsVersion } ` ) ;
564597console . log ( `@oxc-node/cli: ${ oxcNodeCliVersion } ` ) ;
565598console . log ( `@oxc-node/core: ${ oxcNodeCoreVersion } ` ) ;
@@ -576,6 +609,7 @@ await updateUpstreamVersions();
576609await updatePnpmWorkspace ( {
577610 vitest : vitestVersion ,
578611 tsdown : tsdownVersion ,
612+ lightningcss : lightningcssVersion ,
579613 oxcNodeCli : oxcNodeCliVersion ,
580614 oxcNodeCore : oxcNodeCoreVersion ,
581615 oxfmt : oxfmtVersion ,
0 commit comments