Skip to content
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

[0.73] Backport JSC-safe request URLs #994

Merged
merged 2 commits into from
Jun 5, 2023
Merged

Commits on Jun 3, 2023

  1. Accept bundle and symbolication requests in JSC-safe format (//& in…

    … place of `?`)
    
    Summary:
    The first part of implementing react-native-community/discussions-and-proposals#646 to address facebook/react-native#36794.
    
    This allows Metro to respond to bundle and symbolication requests that use URLs with `//&` in place of `?` as a query delimiter.
    
    ```
    **[Feature]**: Support URLs for both bundling and symbolication requests using `//&` instead of `?` as a query string delimiter
    ```
    
    (Note: This does *not* add support for registering HMR entry points in the JSC-safe format - that's not necessary at this point, if at all, and I'm keen to minimise the footprint of this stack for easier backporting.)
    
    Reviewed By: huntie
    
    Differential Revision: D45983877
    
    fbshipit-source-id: e799f76cd26c2ca8026b4d1bf70a582814ae1790
    robhogan committed Jun 3, 2023
    Configuration menu
    Copy the full SHA
    dd09f3c View commit details
    Browse the repository at this point in the history
  2. Emit JSC-safe URLs in HMR, //# sourceURL, Content-Location (#989)

    Summary:
    Pull Request resolved: #989
    
    The remaining Metro part of the implementation of react-native-community/discussions-and-proposals#646, to fix (along with an RN change):
     - facebook/react-native#36794 and
     - expo/expo#22008
    
    This ensures that Metro always and consistently emits "JSC-safe" (i.e., `//&` query-delimited) URLs where they are used as a "source URL" for evaluated JS. This includes:
     - `sourceURL` within the JSON HMR payload (`HmrModule`)
     - `//# sourceURL` comments within the body of a base or HMR bundle
     - The new `Content-Location` header delivered in response to an HTTP bundle request.
    
    Clients will be expected to use these as source URL arguments to JS engines, in preference to the URL on which they might have connected/requested the bundle originally.
    
    ```
    * **[Fix]**: Emit source URLs in a format that will not be stripped by JavaScriptCore
    ```
    
    Reviewed By: GijsWeterings
    
    Differential Revision: D45983876
    
    fbshipit-source-id: 3e7f0118091424b9c1b1d40e4eb7baeb5be1f48f
    robhogan committed Jun 3, 2023
    Configuration menu
    Copy the full SHA
    8147dfd View commit details
    Browse the repository at this point in the history