Skip to content

refactor: give the asset classes that will leave the framework their dependencies - #485

Merged
ogorzalka merged 2 commits into
release/v13.36.1from
refactor/assets-ports
Oct 15, 2026
Merged

ogorzalka merged 2 commits into
release/v13.36.1from
refactor/assets-ports

Conversation

@ogorzalka

Copy link
Copy Markdown
Member

Step 1 of pollora/assets (plan: .claude/plans/assets-package.md): the classes that will move into the package no longer reach for Laravel.

What changed

  • New ports in Asset/Domain/Contracts: ViteManagerFactory (builds the Vite resolver of a container), RuntimeContext (command line or not), PublicPath.
  • Their Laravel implementations live in Asset/Infrastructure/Laravel/ (they stay in the framework): LaravelViteManagerFactory, LaravelRuntimeContext, LaravelPublicPath, LaravelAssetFileResolver.
  • AssetEnqueuer: takes AssetManager, Action, Filter, the factory, the runtime and a PSR-3 logger instead of Application, resolve(), Log and new ViteManager. Its enqueue still happens in __destruct.
  • AssetFile: a static resolver (AssetFile::resolveUsing()) set by the provider, since it is built with new wherever a theme names a file.
  • AssetManager: gets a PublicPath (default hot file of a container without one) and an enqueuer factory. AssetContainer, MissingBuilds (PSR-3) and MissingBuildNotice (project root passed in) no longer call public_path(), Log or base_path().
  • AssetServiceProvider binds all of it. ViteManager (Laravel's Vite) and RootAssetManager are untouched and stay in the framework.

How it was checked

  • Contract test of test: pin the URLs each asset container resolves, in build and hot #484: unchanged in what it pins, passes.
  • Full suite: 1912 passed (2 new tests: useVite() asks the factory for the resolver, and says so when none is set).
  • Rendered HTML of pollora-test compared with the golden captures taken before the refactor, in build and in hot (theme :5173, plugin :5174, module :5175 at once): identical, 12 pages each. That comparison caught a bug the unit tests did not (a global instanceof ViteManager replace had turned my own instanceof ViteManagerFactory into a class that does not exist: every useVite() threw, 500 on the whole site).
  • Three existing tests needed the bindings the provider now supplies: AssetEnqueuerTest (RuntimeContext), ViteManagerTest (MissingBuildNotice with the project root), and the contract test (AssetFile resolver and factory).

Known and unrelated: AssetEnqueuerTest run alone ends with a fatal at shutdown (destructors after the container is gone), the same on the base.

@ogorzalka
ogorzalka merged commit 94576da into release/v13.36.1 Oct 15, 2026
18 of 19 checks passed
@ogorzalka
ogorzalka deleted the refactor/assets-ports branch October 15, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant