feat: add freezeRuntime option to prevent runtime modifications#772
Open
feat: add freezeRuntime option to prevent runtime modifications#772
Conversation
Collaborator
|
邮件已收到~~
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new freezeRuntime configuration option to the icestark package that prevents runtime libraries from being accidentally overwritten after their initial assignment. When enabled, versioned runtime libraries (e.g., React@17.0.0) are locked using JavaScript property descriptors to prevent modifications.
- Adds
freezeRuntimeboolean option to global configuration with default value of false - Implements runtime library freezing mechanism using Object.defineProperty with getter/setter logic
- Integrates the freeze functionality into the asset handling pipeline for runtime libraries
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/icestark/src/util/globalConfiguration.ts | Adds freezeRuntime configuration option with documentation |
| packages/icestark/src/AppRouter.tsx | Passes freezeRuntime prop through to the start configuration |
| packages/icestark/src/util/handleAssets.ts | Implements generateRuntimeLockCode function and integrates freeze logic |
| packages/icestark/tests/handleAssets.spec.tsx | Adds comprehensive test coverage for the freezeRuntime functionality |
| CHANGELOG.md | Documents the new feature in version 2.8.5 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…rk into fix/support-freeze-object
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.
This pull request introduces a new "freeze runtime" feature to the
icestarkpackage, which allows runtime libraries (like React) to be locked to a specific version and prevents them from being accidentally overwritten. The change is integrated into the configuration, asset handling utilities, and is thoroughly tested.