@@ -30,6 +30,7 @@ import {
3030 fixtureMatrixGateConfig ,
3131 fixtureMatrixRecipeInput ,
3232 fixtureMatrixRunConfigFromEnv ,
33+ normalizeFixtureMatrixDependencyOverlays ,
3334 normalizeFixtureMatrixRunConfig ,
3435} from '../lib/fixture-matrix.mjs' ;
3536
@@ -256,6 +257,7 @@ export async function runFixtureMatrix(options) {
256257 outputDirectory,
257258 staticSiteImporterPath,
258259 options,
260+ dependencyOverrides,
259261 progress,
260262 } ) ) ;
261263 performance . batch_execution_ms = elapsedMs ( batchExecutionStartedAt ) ;
@@ -393,7 +395,7 @@ function executionEvidenceMetadata(executionRequested) {
393395// per-fixture artifact subdirectories, all keyed by the unique batch suffix), so
394396// many of these can run concurrently without colliding. Returns a stable outcome
395397// the caller folds back together in batch order.
396- export async function runFixtureMatrixBatch ( { fixtures, batchIndex, matrix, outputDirectory, staticSiteImporterPath, options, recovery = false , progress } ) {
398+ export async function runFixtureMatrixBatch ( { fixtures, batchIndex, matrix, outputDirectory, staticSiteImporterPath, options, dependencyOverrides = prepareDependencyOverrides ( options ) , recovery = false , progress } ) {
397399 const batchNumber = batchIndex + 1 ;
398400 const batchSuffix = recovery
399401 ? `${ String ( batchNumber ) . padStart ( 3 , '0' ) } -recovery-${ fixtures [ 0 ] . id } `
@@ -407,7 +409,13 @@ export async function runFixtureMatrixBatch({ fixtures, batchIndex, matrix, outp
407409 // Discovery is deliberately a separate, short-lived Codebox runtime. It only
408410 // asks SSI for its registry-derived plan; package resolution happens on the
409411 // host while assembling the following fresh import runtime.
410- const dependencyPlan = await discoverFixtureDependencyPlan ( { fixtures, outputDirectory, staticSiteImporterPath, options, batchSuffix } ) ;
412+ const dependencyOverlays = normalizeFixtureMatrixDependencyOverlays ( {
413+ staticSiteImporterPath,
414+ staticSiteImporterPlugin : options . staticSiteImporterPlugin ,
415+ staticSiteImporterSlug : options . staticSiteImporterSlug ,
416+ dependencyOverrides,
417+ } ) ;
418+ const dependencyPlan = await discoverFixtureDependencyPlan ( { fixtures, outputDirectory, staticSiteImporterPath, options, dependencyOverlays, batchSuffix } ) ;
411419 const resolvedDependencyPlan = await resolveHostDependencyPlan ( dependencyPlan , path . join ( outputDirectory , 'dependency-cache' ) ) ;
412420 const batchRecipe = buildFixtureMatrixRecipe ( {
413421 matrix : batchMatrix ,
@@ -420,7 +428,8 @@ export async function runFixtureMatrixBatch({ fixtures, batchIndex, matrix, outp
420428 staticSiteImporterPlugin : options . staticSiteImporterPlugin ,
421429 staticSiteImporterSlug : options . staticSiteImporterSlug ,
422430 dependencyPlan : resolvedDependencyPlan ,
423- dependencyOverrides : prepareDependencyOverrides ( options ) ,
431+ dependencyOverrides,
432+ dependencyOverlays,
424433 svgFontEvidence : true ,
425434 ...fixtureMatrixRecipeInput ( normalizeFixtureMatrixRunConfig ( Object . fromEntries ( Object . keys ( FIXTURE_MATRIX_RUN_FIELDS ) . map ( ( key ) => [ key , options [ key ] ] ) ) ) ) ,
426435 ...visualParityRecipeInput ( options ) ,
@@ -503,7 +512,8 @@ export async function runFixtureMatrixBatch({ fixtures, batchIndex, matrix, outp
503512 sidecarAttemptId : batchSuffix ,
504513 visualParity : fixtureMatrixGateConfig ( normalizeFixtureMatrixRunConfig ( Object . fromEntries ( Object . keys ( FIXTURE_MATRIX_RUN_FIELDS ) . map ( ( key ) => [ key , options [ key ] ] ) ) ) ) . visualParity ,
505514 liveWpParity : liveWpParityCollectorInput ( options ) ,
506- dependencyOverrides : prepareDependencyOverrides ( options ) ,
515+ dependencyOverrides,
516+ dependencyOverlays : batchRecipe . inputs . dependency_overlays || [ ] ,
507517 } ) ;
508518 const visualCompare = materializeVisualCompareArtifacts ( {
509519 result : batchResult ,
@@ -547,6 +557,7 @@ export async function runFixtureMatrixBatch({ fixtures, batchIndex, matrix, outp
547557 outputDirectory,
548558 staticSiteImporterPath,
549559 options,
560+ dependencyOverrides,
550561 recovery : true ,
551562 progress,
552563 } ) ) ;
@@ -600,7 +611,7 @@ export async function resolveHostDependencyPlan(plan, cacheDirectory, fetcher =
600611 return { ...plan , entries } ;
601612}
602613
603- async function discoverFixtureDependencyPlan ( { fixtures, outputDirectory, staticSiteImporterPath, options, batchSuffix } ) {
614+ async function discoverFixtureDependencyPlan ( { fixtures, outputDirectory, staticSiteImporterPath, options, dependencyOverlays = [ ] , batchSuffix } ) {
604615 const plans = [ ] ;
605616 for ( const fixture of fixtures ) {
606617 const fixtureDirectory = path . join ( outputDirectory , fixture . id ) ;
@@ -616,6 +627,7 @@ async function discoverFixtureDependencyPlan({ fixtures, outputDirectory, static
616627 inputs : {
617628 stagedFiles : [ { source : path . join ( fixtureDirectory , 'artifact.json' ) , target : path . join ( runtimeDirectory , 'artifact.json' ) } ] ,
618629 extra_plugins : [ { source : staticSiteImporterPath , slug : options . staticSiteImporterSlug || 'static-site-importer' , activate : true } ] ,
630+ ...( dependencyOverlays . length ? { dependency_overlays : dependencyOverlays } : { } ) ,
619631 } ,
620632 workflow : { steps : [
621633 { command : 'wordpress.wp-cli' , args : [ `command=plugin activate ${ ( options . staticSiteImporterPlugin || 'static-site-importer/static-site-importer.php' ) } ` ] } ,
@@ -627,10 +639,10 @@ async function discoverFixtureDependencyPlan({ fixtures, outputDirectory, static
627639 const discovery = await runWpCodeboxRecipe ( { recipeFile, artifactsDir, outputFile, wpCodeboxBin : options . wpCodeboxBin , inactivityTimeoutMs : batchInactivityTimeoutMs ( options ) } ) ;
628640 const plan = findDependencyPlan ( artifactsDir ) ;
629641 if ( ! plan ) throw new Error ( `Dependency discovery did not persist a valid plan for fixture ${ fixture . id } .` ) ;
630- // Discovery only mounts SSI. Provider packages are resolved and activated by
631- // the final recipe's extra_plugins setup, before its workflow begins; asking
632- // this runtime for a provider receipt would incorrectly require Jetpack/Woo
633- // to be installed during planning.
642+ // Discovery only mounts SSI and its declared transformer overlays. Provider
643+ // packages are resolved and activated by the final recipe's extra_plugins
644+ // setup, before its workflow begins; asking this runtime for a provider
645+ // receipt would incorrectly require Jetpack/Woo during planning.
634646 plans . push ( plan ) ;
635647 }
636648 const entries = new Map ( ) ;
0 commit comments