-
Notifications
You must be signed in to change notification settings - Fork 634
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
Implement require.unstable_importMaybeSync and use it in JSResource #1296
Conversation
This pull request was exported from Phabricator. Differential Revision: D58873729 |
This pull request was exported from Phabricator. Differential Revision: D58873729 |
…acebook#1296) Summary: Pull Request resolved: facebook#1296 This implements `require.unstable_importMaybeSync`, a new API to avoid having to wait for the next tick when importing a value using dynamic `import()` in bundles that don't use bundle splitting. This API behaves this way: * If the app is using bundle splitting, `require.unstable_importMaybeSync()` behaves exactly like `import()`. It always returns a promise and it marks a split point for the bundle. * If the app isn't using bundle splitting, it behaves like a static import (e.g.: `import * as module from 'module'`) and returns the exports for that module synchronously. This isn't meant to be used by users directly but to build other more specific APIs on top of this. It includes a small refactor to `asyncRequire.js`. Differential Revision: D58873729
8e916ac
to
110fade
Compare
This pull request was exported from Phabricator. Differential Revision: D58873729 |
…acebook#1296) Summary: Pull Request resolved: facebook#1296 This implements `require.unstable_importMaybeSync`, a new API to avoid having to wait for the next tick when importing a value using dynamic `import()` in bundles that don't use bundle splitting. This API behaves this way: * If the app is using bundle splitting, `require.unstable_importMaybeSync()` behaves exactly like `import()`. It always returns a promise and it marks a split point for the bundle. * If the app isn't using bundle splitting, it behaves like a static import (e.g.: `import * as module from 'module'`) and returns the exports for that module synchronously. This isn't meant to be used by users directly but to build other more specific APIs on top of this. It includes a small refactor to `asyncRequire.js`. Differential Revision: D58873729
110fade
to
7a6e57c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1296 +/- ##
==========================================
- Coverage 83.83% 83.83% -0.01%
==========================================
Files 207 207
Lines 10847 10880 +33
Branches 2716 2731 +15
==========================================
+ Hits 9094 9121 +27
- Misses 1753 1759 +6 ☔ View full report in Codecov by Sentry. |
This pull request was exported from Phabricator. Differential Revision: D58873729 |
…acebook#1296) Summary: Pull Request resolved: facebook#1296 This implements `require.unstable_importMaybeSync`, a new API to avoid having to wait for the next tick when importing a value using dynamic `import()` in bundles that don't use bundle splitting. This API behaves this way: * If the app is using bundle splitting, `require.unstable_importMaybeSync()` behaves exactly like `import()`. It always returns a promise and it marks a split point for the bundle. * If the app isn't using bundle splitting, it behaves like a static import (e.g.: `import * as module from 'module'`) and returns the exports for that module synchronously. This isn't meant to be used by users directly but to build other more specific APIs on top of this. It includes a small refactor to `asyncRequire.js`. Differential Revision: D58873729
7a6e57c
to
c2e3f20
Compare
…acebook#1296) Summary: Pull Request resolved: facebook#1296 This implements `require.unstable_importMaybeSync`, a new API to avoid having to wait for the next tick when importing a value using dynamic `import()` in bundles that don't use bundle splitting. This API behaves this way: * If the app is using bundle splitting, `require.unstable_importMaybeSync()` behaves exactly like `import()`. It always returns a promise and it marks a split point for the bundle. * If the app isn't using bundle splitting, it behaves like a static import (e.g.: `import * as module from 'module'`) and returns the exports for that module synchronously. This isn't meant to be used by users directly but to build other more specific APIs on top of this. It includes a small refactor to `asyncRequire.js`. Reviewed By: motiz88 Differential Revision: D58873729
c2e3f20
to
7d8d5e4
Compare
This pull request was exported from Phabricator. Differential Revision: D58873729 |
1 similar comment
This pull request was exported from Phabricator. Differential Revision: D58873729 |
7d8d5e4
to
0f0c6de
Compare
…acebook#1296) Summary: Pull Request resolved: facebook#1296 This implements `require.unstable_importMaybeSync`, a new API to avoid having to wait for the next tick when importing a value using dynamic `import()` in bundles that don't use bundle splitting. This API behaves this way: * If the app is using bundle splitting, `require.unstable_importMaybeSync()` behaves exactly like `import()`. It always returns a promise and it marks a split point for the bundle. * If the app isn't using bundle splitting, it behaves like a static import (e.g.: `import * as module from 'module'`) and returns the exports for that module synchronously. This isn't meant to be used by users directly but to build other more specific APIs on top of this. It includes a small refactor to `asyncRequire.js`. Reviewed By: motiz88 Differential Revision: D58873729
…acebook#1296) Summary: Pull Request resolved: facebook#1296 This implements `require.unstable_importMaybeSync`, a new API to avoid having to wait for the next tick when importing a value using dynamic `import()` in bundles that don't use bundle splitting. This API behaves this way: * If the app is using bundle splitting, `require.unstable_importMaybeSync()` behaves exactly like `import()`. It always returns a promise and it marks a split point for the bundle. * If the app isn't using bundle splitting, it behaves like a static import (e.g.: `import * as module from 'module'`) and returns the exports for that module synchronously. This isn't meant to be used by users directly but to build other more specific APIs on top of this. It includes a small refactor to `asyncRequire.js`. Reviewed By: motiz88 Differential Revision: D58873729
This pull request was exported from Phabricator. Differential Revision: D58873729 |
0f0c6de
to
86ecf52
Compare
This pull request has been merged in 7b2ca5e. |
…e it in JSResource (#30703) # Why - Mirror feature from metro facebook/metro#1296 # Test Plan - Pulled in upstream tests. - Tree shaking tests should also continue to work. --------- Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
…e it in JSResource (#30703) # Why - Mirror feature from metro facebook/metro#1296 # Test Plan - Pulled in upstream tests. - Tree shaking tests should also continue to work. --------- Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
Summary:
This implements
require.unstable_importMaybeSync
, a new API to avoid having to wait for the next tick when importing a value using dynamicimport()
in bundles that don't use bundle splitting.This API behaves this way:
require.unstable_importMaybeSync()
behaves exactly likeimport()
. It always returns a promise and it marks a split point for the bundle.import * as module from 'module'
) and returns the exports for that module synchronously.This isn't meant to be used by users directly but to build other more specific APIs on top of this.
It includes a small refactor to
asyncRequire.js
.Differential Revision: D58873729