@@ -3,6 +3,7 @@ import { mkdir, writeFile } from "node:fs/promises"
33import { join } from "node:path"
44
55import { parseWorkspaceRecipeJson , validateWorkspaceRecipeShape } from "../packages/cli/src/recipe-validation.js"
6+ import { prepareRecipeRuntimeOverlays } from "../packages/cli/src/recipe-sources.js"
67import { loadConfiguredRuntimeOverlayDescriptors , registeredRuntimeOverlayDescriptors , runtimeOverlayDescriptor } from "../packages/cli/src/runtime-overlay-registry.js"
78import { discoverRuntimeOverlayDescriptorManifests , runtimeOverlayDescriptorManifest } from "../packages/runtime-core/src/index.js"
89import { withTempDir } from "../scripts/test-kit.js"
@@ -31,12 +32,21 @@ await withTempDir("wp-codebox-runtime-overlay-descriptors-", async (root) => {
3132 loadConfiguredRuntimeOverlayDescriptors ( descriptorDirectory )
3233 assert . ok ( registeredRuntimeOverlayDescriptors ( ) . some ( ( descriptor ) => descriptor . library === "example-provider" ) )
3334
35+ await mkdir ( join ( root , "overlays" , "example" ) , { recursive : true } )
36+ await writeFile ( join ( root , "overlays" , "example" , "runtime.php" ) , "<?php\n" )
37+
3438 const recipe = parseWorkspaceRecipeJson ( JSON . stringify ( {
3539 schema : "wp-codebox/workspace-recipe/v1" ,
3640 runtime : { overlays : [ { kind : "provider-runtime" , library : "example-provider" , strategy : "provider-owned-bundle" , source : "overlays/example" } ] } ,
3741 workflow : { steps : [ { command : "noop" } ] } ,
3842 } ) )
3943 validateWorkspaceRecipeShape ( recipe , join ( root , "recipe.json" ) )
44+ const [ prepared ] = await prepareRecipeRuntimeOverlays ( recipe , root )
45+ assert . equal ( prepared . source , join ( root , "overlays" , "example" ) )
46+ assert . equal ( prepared . target , "/wordpress/wp-content/mu-plugins/example-provider-runtime" )
47+ assert . equal ( prepared . mode , "readonly" )
48+ assert . equal ( prepared . metadata . preparedPathKind , "local" )
49+ assert . equal ( typeof ( prepared . metadata . digest as { sha256 ?: unknown } ) . sha256 , "string" )
4050
4151 await writeFile ( join ( descriptorDirectory , "wp-codebox-runtime-overlays.json" ) , JSON . stringify ( {
4252 schema : "wp-codebox/runtime-overlay-descriptors/v1" ,
0 commit comments