Optionalcompiler?: typeof tsTypeScript 6 compiler API for wiring an existing sanity.blueprint.ts.
Pass it when the installed typescript package is absent or does not
expose that API.
Report which generated files beside a project's sanity.workflow.ts no
longer match its definitions. A gate that also refuses the plan's unsettled
entries reads them from plan.
import {dirname} from 'node:path'
import {generatedRuntimeAlignment} from '@sanity/workflow-blueprint/generate'
// `configPath` is the absolute path of the project's sanity.workflow.ts, and
// `config` the validated config it exports.
const {divergences} = generatedRuntimeAlignment({
root: dirname(configPath),
config,
configFile: 'sanity.workflow.ts',
})
for (const divergence of divergences) {
console.log(`${divergence.reason}: ${divergence.path}`)
}
Compare the generated runtime under
rootwith the runtimeconfigrequires, readingrootand writing nothing.rootis the directory holding the config file, which is where a generated tree lives; nothing is read outside it and the working directory is never consulted.configFileis that file's name as found there, because every generated module imports its deployment from it.GeneratedRuntimeAlignment.divergences is what a regeneration settles. A complete gate reports the returned plan's own unsettled entries as well, because regenerating settles none of those: its orphaned stubs, its case collisions, its orphaned registry, and the blueprint wiring it could not insert.
A complete gate verifies separately that the config module exports each deployment under the name deploymentExportIdentifier returns. An empty divergence list and a settled plan do not mean the tree compiles: without those exports the generated modules cannot resolve their deployment, and every file on disk still matches.
Throws when the definitions cannot produce a runtime at all, and when they produce one this root cannot hold: an effect name or deployment name that cannot be embedded in generated code, or a dependency a generated function imports for which the root's
package.jsondeclares no version.