diff --git a/CHANGELOG.md b/CHANGELOG.md index 51c149dcca5..84a8cfdebaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ This serves two purposes: - Pages with non-HTML output paths are now excluded from automatic navigation by default. Explicit navigation front matter now takes precedence over automatic navigation exclusions. - Fenced code blocks are now rendered through the publishable `components/markdown/code-block.blade.php` view, which changes the generated markup around the code. Syntax highlighting is unaffected, and the `hyde-code-block` and `hyde-code-block-label` classes are stable hooks for your own CSS. - Code block labels are now set with a `title="…"` modifier on the fence, replacing the `// filepath:` comment syntax, which is no longer recognized and must be replaced. +- The `_media` directory is now a passthrough: files are published to the built site regardless of file type, not just those with a recognized extension. Review `_media` before upgrading, as anything stored there is now public. ### Deprecated - for changes that will be removed in upcoming releases. @@ -38,6 +39,7 @@ This serves two purposes: - Removed the `rebuild` command. It had no remaining internal consumers now that the realtime compiler renders pages in-memory, and single-page builds can silently leave aggregate outputs (sitemap, RSS, search index, navigation) stale. Use `Hyde\Framework\Actions\StaticPageBuilder::handle()` instead if you need to build a single page programmatically. - Removed the `InMemoryPage` instance macro API. Use a contents closure for dynamic output, or extend `InMemoryPage` to add custom methods and behavior. - Removed the `components/filepath-label.blade.php` view, as the label markup now lives in the code block view. If this was published, port any customizations into `components/markdown/code-block.blade.php`. +- Removed the `hyde.media_extensions` config option and the `MediaFile::EXTENSIONS` constant, now that the media directory discovers files of every type. ### Fixed - Fixed Markdown-to-plain-text conversion consuming unrelated content after ATX headings and stripping literal trailing hashes in https://github.com/hydephp/develop/pull/2590 diff --git a/HYDEPHP_V3_PLANNING.md b/HYDEPHP_V3_PLANNING.md index eed8207afc1..de67eab4e25 100644 --- a/HYDEPHP_V3_PLANNING.md +++ b/HYDEPHP_V3_PLANNING.md @@ -74,6 +74,8 @@ Having this document in code lets us know the devlopment state at any given poin The undocumented `hyde.empty_output_directory` option is removed too. It was never present in the shipped `config/hyde.php` and never documented, so no upgrade step is needed for it. +- The `_media` directory is now a passthrough for every file it contains, rather than only files matching the `hyde.media_extensions` allow-list. That option is removed, along with `MediaFile::EXTENSIONS`, with no deprecated compatibility constant. `Thumbs.db` and `desktop.ini` are still skipped regardless of case, since Symfony Finder's dotfile and VCS exclusions were already relied on and remain unchanged. This lets media types Hyde never had an opinion about — PDFs, fonts, archives — pass through without a config change, at the cost of also copying files a project may have parked in `_media` for other reasons. The publication rule lives in `MediaFile::isPublishable()`, which the build, `hyde serve`, and `Hyde::asset()` all use, so the preview server no longer serves `_media` files the build skips, such as `Thumbs.db` or dotfiles, and `Hyde::asset()` refuses to link to them. + ### Upgrade guide Please fill in UPGRADE.md as you make changes. @@ -92,6 +94,7 @@ Please fill in UPGRADE.md as you make changes. - Compare a few pages against your old site if you have custom CSS for code blocks or their labels, since the generated markup changed. The `hyde-code-block` and `hyde-code-block-label` classes are stable hooks to target instead of the markup structure. - Port any customizations from a published `filepath-label.blade.php` to `markdown/code-block.blade.php`. The old file is ignored after upgrading, so the site renders with the shipped label until they are moved. - Move manually maintained files out of the output directory and into `_static`, since the whole output directory is now emptied before every build. Remove `safe_output_directories` from a published `config/hyde.php`. +- Remove `media_extensions` from a published `config/hyde.php` before updating Composer dependencies, since it references the removed `MediaFile::EXTENSIONS` constant, and move any non-asset files out of `_media` that you were relying on the extension allow-list to keep out of the build. ## `InMemoryPage` content-source motivation diff --git a/UPGRADE.md b/UPGRADE.md index d81d138ffe6..8ca84170d74 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -47,6 +47,8 @@ git commit -m "Pre-upgrade backup before HydePHP v3.0" // +>warning If your published `config/hyde.php` has a `media_extensions` entry, delete it **before** updating your Composer dependencies. The entry references the removed `MediaFile::EXTENSIONS` constant, so the application fails to load, including during `composer update`, until it is gone. Files in `_media` are no longer filtered by extension, so the option has no replacement. See [Step 13](#step-13-review-the-contents-of-your-media-directory). + ### Update Node Dependencies HydePHP v3 upgrades the bundled `vite` dependency from v7 to v8. Update your `package.json` `devDependencies` to require the new major version: @@ -439,10 +441,17 @@ Move those files into the `_static` directory, which is copied verbatim to the s The `hyde.safe_output_directories` option no longer exists, and the build no longer asks for confirmation before emptying an unfamiliar output directory. Delete the entry from your `config/hyde.php`. Take the chance to double-check your `hyde.output_directory` if you build somewhere other than `_site`, since everything in that directory is now removed on every build. +## Step 13: Review the Contents of Your Media Directory + +`_media` is now a passthrough directory: files are no longer filtered by extension, and are published to `_site/media` regardless of their type. + +>warning This changes what you deploy. **Review the contents of `_media` before upgrading.** Any normal file stored there, such as design source files, notes, exports, or source maps, will now be publicly accessible on your built site. Move anything that should not be public out of `_media`. + ## Migration Checklist Use this checklist to track your upgrade progress: +- [ ] Removed any `media_extensions` entry from `config/hyde.php` before updating Composer dependencies - [ ] Reviewed `markdown.allow_html` and `markdown.enable_blade` and explicitly selected the appropriate trust policy - [ ] Replaced any `php hyde rebuild ` usage with `StaticPageBuilder::handle()` or a full `php hyde build` - [ ] Moved calls to `Redirect::create()` or `Redirect::store()` into the `hyde.redirects` configuration array @@ -456,6 +465,7 @@ Use this checklist to track your upgrade progress: - [ ] Compared pages against your old site if you have custom CSS for code blocks or their labels - [ ] Checked `_posts` for drafts and blog posts dated in the future, and set up recurring builds if scheduling posts - [ ] Moved manually maintained files out of the output directory and into `_static` +- [ ] Reviewed `_media` and moved out anything that shouldn't be public ## Troubleshooting diff --git a/config/hyde.php b/config/hyde.php index b667610c7f5..c2b33122046 100644 --- a/config/hyde.php +++ b/config/hyde.php @@ -483,10 +483,6 @@ | */ - // Change the file extensions to be considered as media files and are copied to the output directory. - // If you want to add more extensions, add it to the empty merge array, or just override the entire array. - 'media_extensions' => array_merge([], \Hyde\Support\Filesystem\MediaFile::EXTENSIONS), - // Should a JSON build manifest with metadata about the build be generated? 'generate_build_manifest' => true, diff --git a/docs/_data/partials/hyde-pages-api/hyde-kernel-hyperlink-methods.md b/docs/_data/partials/hyde-pages-api/hyde-kernel-hyperlink-methods.md index d3d7e31ab61..f7b415b277f 100644 --- a/docs/_data/partials/hyde-pages-api/hyde-kernel-hyperlink-methods.md +++ b/docs/_data/partials/hyde-pages-api/hyde-kernel-hyperlink-methods.md @@ -1,7 +1,7 @@