-
Notifications
You must be signed in to change notification settings - Fork 124
feat(react): fetchBundle-based lazy bundle loader #2584
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
Draft
upupming
wants to merge
47
commits into
main
Choose a base branch
from
feat/lazy-bundle-with-fetchBundle
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
d460139
feat: allow with.mode attr in swc dynamic import plugin
upupming 41fcbf2
feat(swc-dynamic-import): wrap import() with withLazyBundleMode for m…
upupming e0fb546
feat(react): add withLazyBundleMode runtime helper
upupming 7c318ca
feat(react): add fetchBundle-based loadLazyBundle path
upupming f7a79ee
feat(template-plugin): emit FetchBundle-mode customSections for lazy …
upupming 453d054
chore: move @lynx-js/types override from package.json to pnpm-workspa…
upupming 6ea297b
feat(react-webpack-plugin): gate FetchBundle default on engineVersion…
upupming f91bf50
chore: regenerate api report + dedupe lockfile
upupming 25edde6
fix(swc-plugin-dynamic-import): drop unused enumerate index
upupming e0275d3
chore: regenerate template-webpack-plugin api report
upupming 4e8aeaa
chore: add empty changeset for in-flight FetchBundle work
upupming 6bf0dc1
fix(web-core): add ^build to turbo build deps
upupming 370fad7
chore(vendor): refresh @lynx-js/types tarball with optional loadScrip…
upupming f6d3891
fix(plugin-react): gate lazy-bundle build output on resolved fetcher
upupming a02fb76
fix(react-webpack-plugin): self-invoke main-thread wrapper for FetchB…
upupming 2519670
chore: dev/build/preview commands for FetchBundle in lazy-bundle exam…
upupming 754ab38
Merge remote-tracking branch 'origin/main' into feat/lazy-bundle-with…
upupming ad06fd9
chore(examples): split lazy bundles into Sync + Async demos
upupming 6d1ca60
Merge remote-tracking branch 'origin/main' into feat/lazy-bundle-with…
upupming 1a8cf3c
feat(react): coordinate MT prep on FetchBundle BG-triggered async load
upupming 0c1d610
feat(react): throw on lazy bundle mode used with QueryComponent in dev
upupming 4a12527
feat(template-plugin): default to bytecode for FetchBundle lazy main-…
upupming b1d9b44
chore(examples): branch lazy-bundle demos on __LAZY_BUNDLE_FETCHER__
upupming bc70e16
chore(examples): use bracket access for env vars in entry-url
upupming a99d88f
chore(changeset): convert lazy-bundle-fetch-bundle to a release entry
upupming 036d48e
chore(changeset): bump lazy-bundle FetchBundle entry to minor
upupming ccdafb8
chore(changeset): satisfy peer ranges for FetchBundle minor bumps
upupming 51eac2a
test(plugin-react): add lazyBundleFetcher to default options snapshot
upupming f1781d7
Merge branch 'main' into feat/lazy-bundle-with-fetchBundle
upupming bc0229e
chore: refresh lockfile after merging origin/main
upupming d7126e1
test(react): cover FetchBundle runtime path
upupming f54614e
test(react): cover remaining FetchBundle branches and unreachable
upupming 5c266dc
test(template-plugin): cover FetchBundle output shape and bytecode ga…
upupming c464392
test(plugin-react): cover resolveLazyBundleFetcher decision matrix
upupming ffdbea3
test(react-webpack-plugin): cover FetchBundle MT wrapper + define inj…
upupming 82cbb45
test(template-plugin): cover WebEncodePlugin lepusCode-undefined safety
upupming 662fb77
fix(lazy-bundle): address review nits
upupming 06d6697
refactor(lazy-bundle): merge MT loadScript+CSS into one try block
upupming 4c4333d
chore(codecov): ignore examples/
upupming c126bbd
chore(codecov): ignore generated snapshot fixtures
upupming f6bc1e3
test(template-plugin): migrate FetchBundle shape tests to cases frame…
upupming d2e3c2e
Merge branch 'main' into feat/lazy-bundle-with-fetchBundle
upupming c75de42
chore: pnpm dedupe after merge
upupming db3c74c
chore(deps): bump @lynx-js/types to 3.10.2-alpha.0
upupming 1828a25
fix(swc-dynamic-import): declare \`once_cell\` workspace dep
upupming 00ed617
refactor(swc-dynamic-import): drop redundant atoms::once_cell import
upupming 9ea2105
chore: pnpm dedupe after types bump
upupming File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| "@lynx-js/react": minor | ||
| "@lynx-js/react-rsbuild-plugin": minor | ||
| "@lynx-js/react-webpack-plugin": minor | ||
| "@lynx-js/template-webpack-plugin": minor | ||
| --- | ||
|
|
||
| feat(lazy-bundle): add `lynx.fetchBundle`-based loader | ||
|
|
||
| Opt in by setting `engineVersion: '3.8'` (or higher) in `pluginReactLynx`. | ||
| Use `import('./X', { with: { mode: 'sync' | 'async' } })` to control whether | ||
| the first screen blocks on a sync fetch. The lazy bundle's main-thread | ||
| section is bytecoded by default (skipped in dev or when `DEBUG` includes | ||
| `rspeedy`). |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
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
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
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
4 changes: 4 additions & 0 deletions
4
examples/react-lazy-bundle-standalone/src/LazyComponentAsync.css
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .LazyComponentAsync { | ||
| font-weight: 700; | ||
| color: cyan; | ||
| } |
9 changes: 9 additions & 0 deletions
9
examples/react-lazy-bundle-standalone/src/LazyComponentAsync.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import './LazyComponentAsync.css'; | ||
|
|
||
| export default function LazyComponentAsync() { | ||
| return ( | ||
| <view> | ||
| <text className='LazyComponentAsync'>LazyComponentAsync</text> | ||
| </view> | ||
| ); | ||
| } |
4 changes: 4 additions & 0 deletions
4
examples/react-lazy-bundle-standalone/src/LazyComponentSync.css
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .LazyComponentSync { | ||
| font-weight: 700; | ||
| color: yellow; | ||
| } |
9 changes: 9 additions & 0 deletions
9
examples/react-lazy-bundle-standalone/src/LazyComponentSync.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import './LazyComponentSync.css'; | ||
|
|
||
| export default function LazyComponentSync() { | ||
| return ( | ||
| <view> | ||
| <text className='LazyComponentSync'>LazyComponentSync</text> | ||
| </view> | ||
| ); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| export function createProducerBundleUrl(bundleFileName: string): string { | ||
| if (process.env.NODE_ENV === 'production') { | ||
| return `http://${process.env.LYNX_STANDALONE_PRODUCER_HOST}:${process.env.LYNX_STANDALONE_PRODUCER_PORT}/${bundleFileName}`; | ||
| if (process.env['NODE_ENV'] === 'production') { | ||
| return `http://${process.env['LYNX_STANDALONE_PRODUCER_HOST']}:${ | ||
| process.env['LYNX_STANDALONE_PRODUCER_PORT'] | ||
| }/${bundleFileName}`; | ||
| } | ||
| return `${__webpack_public_path__}producer/${bundleFileName}`; | ||
| } |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .LazyComponentAsync { | ||
| font-weight: 700; | ||
| color: cyan; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import './LazyComponentAsync.css'; | ||
|
|
||
| export default function LazyComponentAsync() { | ||
| return ( | ||
| <view> | ||
| <text className='LazyComponentAsync'>LazyComponentAsync</text> | ||
| </view> | ||
| ); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .LazyComponentSync { | ||
| font-weight: 700; | ||
| color: yellow; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.