Install
Works with Drupal: ^11 || ^12Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
Web Component Runtime 1.5.0 adds a component migration runner. When a component library generated by [cem_sdc_generator](https://www.drupal.org/project/cem_sdc_generator) changes a component in a breaking way, its own hooks migrate the components already placed on a site, without the generator being installed.
### New
- **A component migration API**, under `Drupal\web_component_runtime\Migration`, for libraries' update and deploy hooks (#3627948: Let a process variable name a user by user ID, username or email address, for Users by variable and the Views user display and filters(https://git.drupalcode.org/project/web_component_runtime/-/work_items/36...)). A hook describes each change as a `ComponentChange`: a renamed or removed prop or slot, or one that needs a person to review it, such as a prop whose type changed. The `web_component_runtime.component_migration_runner` service then finds and migrates the placed instances it affects:
- UI Patterns blocks in Block Layout and Layout Builder, both default layouts and per-entity overrides.
- Canvas component trees in content.
- **Two hooks per migration.** Canvas only registers a component's new version after a normal cache rebuild, never during an update run. So a library migrates blocks in `hook_update_N()` and Canvas content in `hook_deploy_NAME()`, which `drush deploy` runs after rebuilding caches. The deploy hook also works on its own with `drush deploy:hook`.
- **Renamed props and slots survive in Canvas.** Their values and slotted children are moved before Canvas's own updater runs, which would otherwise treat a rename as a removal.
- **Notices when a step is skipped or needs a person:**
- A summary in each hook's message.
- A `web_component_runtime` log entry for each instance that needs manual review, saying where it is and what changed.
- A status report warning while a library's deploy hook is pending, for sites that deploy with update.php and never run deploy hooks.
### Upgrading
Nothing changes for existing sites until a library ships migration hooks. When one does:
- **With `drush deploy`,** everything runs in the right order.
- **With separate commands,** run `drush updatedb`, then `drush cache:rebuild`, then `drush deploy:hook`.
- **With update.php only,** blocks are migrated, but Canvas content waits for `drush deploy:hook`. The status report warns until it has run.
The README's "Component migrations" section explains each path, what to do if a deploy hook stops with an error, and what isn't migrated.
### For library maintainers
The `ComponentChange` constructor, the `ChangeAction`, `KeyType` and `MigrationTarget` enums, both service IDs, the `run()` and `summary()` signatures, and `MigrationDeferredException` are covered by a backward-compatibility promise, because a shipped hook never changes. A library whose hooks use them should require `drupal/web_component_runtime: ^1.5`. cem_sdc_generator 1.4.0 (#3618763: static_suite 1.2.15(https://git.drupalcode.org/project/cem_sdc_generator/-/work_items/3618763)) writes these hooks for generated libraries.