feat(page-compiler): improve Transform API for dual-mode usage#64
Merged
YusukeHirao merged 10 commits intomainfrom Jan 29, 2026
Merged
feat(page-compiler): improve Transform API for dual-mode usage#64YusukeHirao merged 10 commits intomainfrom
YusukeHirao merged 10 commits intomainfrom
Conversation
Renames dev-transform/ to transform/ to reflect that transform utilities can be used in both dev and build modes. Maintains backward compatibility by keeping old paths in package.json exports. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Restores the serve-only mode guard in applyTransforms to maintain the original behavior where transforms only apply during development. Transform utilities remain usable in both modes when called manually. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…tions Removes the incorrectly added transforms option and reverts beforeSerialize signature to original form. Transform utilities should be called manually within beforeSerialize hook, not applied automatically via options. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Extends beforeSerialize hook to receive TransformContext as third parameter, enabling users to call transform utilities manually within the hook. Transform utilities can now be used in both dev and build contexts. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds comprehensive tests verifying that beforeSerialize receives TransformContext as third parameter with correct path, inputPath, outputPath, isServe, and context values. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…sage Updates JSDoc comments in inject-to-head and ssi-shim to reflect that transform utilities can be used in both development and build contexts. Updates import paths in examples from dev-transform to transform. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds comprehensive examples showing how to use transform utilities (injectToHead, createSSIShim) in the beforeSerialize hook for build-time transformations. Updates description to reflect dual-mode usage. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Extends afterSerialize hook to receive TransformContext as fourth parameter for consistency with beforeSerialize. Adds comprehensive tests verifying the context is passed correctly with path, inputPath, outputPath, isServe values. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Comprehensively updates all documentation to reflect TransformContext implementation: page-compiler/README.md: - Update beforeSerialize/afterSerialize signatures in Options section - Add dedicated TransformContext section with all properties explained - Add note that devServer.transforms only applies in serve mode - Add advanced examples using TransformContext properties - Update FormatHtmlOptions section with correct signatures kamado/README.md: - Update afterSerialize example to include context parameter - Add full signature in options list kamado/ARCHITECTURE.md & ARCHITECTURE.ja.md: - Remove outdated contentType property from TransformContext - Update comments to reflect actual implementation - Remove Content-Type filtering from execution flow - Add note about dual-mode usage of transform utilities Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replaces try-catch block with existsSync check in file operations example for clearer code style. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on February 26. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves the Transform API to support both development and build modes by adding
TransformContextto compiler hooks and renaming the directory structure to reflect dual-mode capabilities.Key Changes
1. Directory Rename
dev-transform/→transform/to reflect dual-mode usagepackage.jsonexports2. TransformContext Integration
TransformContextas 3rd parameter tobeforeSerializehookTransformContextas 4th parameter toafterSerializehookpath,inputPath,outputPath,isServe, and fullcontext3. Dual-Mode Support
injectToHead,createSSIShim) can now be used in both dev and build contextsdevServer.transformscontinues to apply only in serve mode (unchanged)beforeSerializefor build-time transformations4. Comprehensive Documentation
devServer.transformsis serve-mode onlyTest Coverage
Breaking Changes
Before:
After:
Existing code that doesn't use the new parameter will continue to work (JavaScript ignores extra parameters).
Migration Guide
Using Transform Utilities in Build Time
Conditional Processing Based on Path
🤖 Generated with Claude Code