@@ -98,7 +98,7 @@ describe("production build contract", () => {
9898 } ) ;
9999 } ) ;
100100
101- it ( "patches remediable dependencies and bounds the build-only image parser exception " , async ( ) => {
101+ it ( "pins the audited build closure and excludes the vulnerable image parser package " , async ( ) => {
102102 const [ packageJson , packageLock , appFiles ] = await Promise . all ( [
103103 readFile ( join ( process . cwd ( ) , "package.json" ) , "utf8" ) . then ( JSON . parse ) ,
104104 readFile ( join ( process . cwd ( ) , "package-lock.json" ) , "utf8" ) . then (
@@ -107,13 +107,38 @@ describe("production build contract", () => {
107107 authoredFiles ( join ( process . cwd ( ) , "src" , "app" ) ) ,
108108 ] ) ;
109109
110+ expect ( packageJson . dependencies ?. vinext ) . toBe ( "1.0.0-beta.8" ) ;
111+ expect ( packageJson . devDependencies ?. [ "@vitejs/plugin-rsc" ] ) . toBe ( "0.5.34" ) ;
112+ expect ( packageJson . scripts ?. [ "audit:dependencies" ] ) . toBe (
113+ "npm audit --audit-level=high" ,
114+ ) ;
115+ expect ( packageJson . scripts ?. check ) . toContain ( "npm run audit:dependencies" ) ;
110116 expect ( packageJson . overrides ?. next ?. postcss ) . toBe ( "8.5.26" ) ;
117+ expect ( packageLock . packages ?. [ "node_modules/vinext" ] ?. version ) . toBe (
118+ "1.0.0-beta.8" ,
119+ ) ;
120+ expect (
121+ packageLock . packages ?. [ "node_modules/@vitejs/plugin-rsc" ] ?. version ,
122+ ) . toBe ( "0.5.34" ) ;
111123 expect ( packageLock . packages ?. [ "node_modules/postcss" ] ?. version ) . toBe (
112124 "8.5.26" ,
113125 ) ;
114126 expect ( packageLock . packages ?. [ "node_modules/nanoid" ] ?. version ) . toBe (
115127 "3.3.18" ,
116128 ) ;
129+ expect ( packageLock . packages ?. [ "node_modules/image-size" ] ) . toBeUndefined ( ) ;
130+ expect (
131+ (
132+ Object . values ( packageLock . packages ?? { } ) as Array < {
133+ dependencies ?: Record < string , string > ;
134+ optionalDependencies ?: Record < string , string > ;
135+ } >
136+ ) . some (
137+ ( entry ) =>
138+ entry ?. dependencies ?. [ "image-size" ] !== undefined ||
139+ entry ?. optionalDependencies ?. [ "image-size" ] !== undefined ,
140+ ) ,
141+ ) . toBe ( false ) ;
117142
118143 const metadataImageRoute =
119144 / ^ (?: f a v i c o n | i c o n | a p p l e - i c o n | o p e n g r a p h - i m a g e | t w i t t e r - i m a g e ) (?: \. .+ ) ? $ / ;
0 commit comments