-
Notifications
You must be signed in to change notification settings - Fork 175
feat: add freezeRuntime option to prevent runtime modifications #772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
邮件已收到~~
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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., [email protected]) 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 <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…rk into fix/support-freeze-object
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.