Skip to content

Replace deprecated asset-loader enqueue_asset calls - #356

Draft
svandragt wants to merge 1 commit into
mainfrom
svandragt/asset-loader-deprecations
Draft

Replace deprecated asset-loader enqueue_asset calls#356
svandragt wants to merge 1 commit into
mainfrom
svandragt/asset-loader-deprecations

Conversation

@svandragt

@svandragt svandragt commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Blocked — do not merge. See comment below. Kept as a draft for reference.

asset-loader 0.8.0 deprecated enqueue_asset() for enqueue_manifest_asset(). Old name works through 1.x, removed in 2.x. Surfaced by wpcomvip/wikimediafoundation-org#1088.

Changes

  • functions.php:129, inc/editor/namespace.php:333,342 — renamed to enqueue_manifest_asset().
  • functions.php:87 — guard now probes the new name, so it doubles as the version check; trigger_error message names 0.8.0.

Compatibility

  • Drop-in signature: first param only widens, ?stringmixed (also accepts an array of candidate paths).
  • null still safe: get_manifest_path() returns null implicitly; register_manifest_asset() keeps the empty() guard and early return.
  • ⚠️ Raises Shiro's effective floor to asset-loader 0.8.0, unenforced — Shiro declares no Composer requirement. This is the blocker: Shiro runs on other sites.

Testing

  • phpcs (repo ruleset) and php -l clean on both files.
  • Signature and null parity confirmed by reflection against installed v1.0.1.
  • Not exercised in a running WP install — editor CSS paths worth an eyeball, LTR and RTL.
  • Pre-push npm run lint not run locally (no JS changed); CI covers it.

Deploymentrelease is 21 commits ahead of main; the site pins dev-release. Targets main per convention, so it needs a release landing plus a pin update to reach the site.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VMHr2xBUqLe6SuhHdpu7ow

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VMHr2xBUqLe6SuhHdpu7ow
@svandragt

Copy link
Copy Markdown
Collaborator Author

Blocked: do not merge as-is

Shiro is deployed on sites other than wikimediafoundation.org, so the floor raise flagged in the description is a real breakage, not a theoretical one.

Because Shiro declares no Composer requirement on asset-loader — the host site provides it — merging this would silently break asset loading on any site still on asset-loader < 0.8.0. Those sites would hit the function_exists guard, log the warning, and lose shiro.js plus the editor stylesheets. Nothing in this repo prevents that.

Leaving this as a draft for reference. Options, roughly cheapest first:

  1. Wait. Confirm every Shiro site is on asset-loader >= 0.8.0, then merge this unchanged. Cleanest end state, needs an audit of the consuming sites first.
  2. Version-safe shim. Call enqueue_manifest_asset() when it exists and fall back to enqueue_asset() when it doesn't. Works everywhere, but adds a branch at three call sites and keeps the deprecated path alive — worth it only if the sites can't be upgraded together.
  3. Declare the dependency. Add asset-loader to Shiro's composer.json so the requirement is enforced rather than implied. Bigger change to how the theme is provisioned, but it's the reason this ambiguity exists in the first place.

Note that nothing here is urgent: the deprecated names still work through asset-loader 1.x. This only becomes blocking for a 2.x bump, where enqueue_asset() is removed outright.

The related site-side bump is wpcomvip/wikimediafoundation-org#1088. That one is independent and safe to ship without this — it just logs deprecation notices until this lands.

@svandragt svandragt changed the title Replace deprecated asset-loader enqueue_asset calls 1088 Replace deprecated asset-loader enqueue_asset calls Aug 20, 2026
@svandragt svandragt changed the title 1088 Replace deprecated asset-loader enqueue_asset calls Replace deprecated asset-loader enqueue_asset calls Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant