xp-forge / frontend

Web frontends
1 stars 1 forks source link

Extend AssetsFrom handler from web.handlers.FilesFrom #18

Closed thekid closed 3 years ago

thekid commented 3 years ago

This enables asynchronous handling as well as being able to use extended headers, see https://github.com/xp-forge/web/pull/74#issuecomment-817117750

⚠️ This pull request will bump the dependency on xp-forge/web to ^2.9 (and drop support for version 1). Because BC is broken anyway, the with() function is changed at the same time in backwards-incompatible way! However, because we also widen the parameter types for immutable(), code such as the following will continue to work:

$assets= new AssetsFrom($this->environment->path('src/main/webapp'))->with(fn($path) => [
  'Cache-Control' => $manifest->immutable($path) ?? 'max-age=2419200, must-revalidate'
]);

Previously, $path was a File instance, now it's a URI...

thekid commented 3 years ago

Released in https://github.com/xp-forge/frontend/releases/tag/v3.0.0 :shipit: