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

WIP: Route chunks #11871

Draft
wants to merge 38 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0f6a1c7
WIP: Route chunks
markdalgleish Aug 5, 2024
df7d79d
Merge branch 'dev' into markdalgleish/route-chunks
markdalgleish Aug 20, 2024
5166d95
Merge branch 'dev' into markdalgleish/route-chunks
markdalgleish Aug 22, 2024
b4c0f70
Migrate playground to routes.ts
markdalgleish Aug 22, 2024
7a4fa89
Separate ctx checks from splitting logic
markdalgleish Aug 22, 2024
f16cada
Add initial `hasChunkableExport` implementation
markdalgleish Aug 23, 2024
e54e8ca
Add initial route chunk generation logic
markdalgleish Aug 26, 2024
3b76b6d
Wire up route chunks logic to Vite plugin
markdalgleish Aug 27, 2024
67b1545
Merge branch 'dev' into markdalgleish/route-chunks
markdalgleish Aug 28, 2024
e93ae9b
Add initial route chunks HMR support
markdalgleish Aug 28, 2024
5b44c36
Handle new route chunks during HMR
markdalgleish Aug 29, 2024
c46b97a
Fix clientAction chunk query string typo
markdalgleish Sep 2, 2024
287a3bf
Add caching to route chunks logic
markdalgleish Sep 3, 2024
359318e
Improve route chunk generation performance
markdalgleish Sep 4, 2024
c6fb80b
Preload route chunks
markdalgleish Sep 4, 2024
885d5e0
Merge branch 'dev' into markdalgleish/route-chunks
markdalgleish Sep 13, 2024
b883bf6
Optimize route chunk import statements
markdalgleish Sep 17, 2024
09d9dfd
Leave side effect imports in main route chunk
markdalgleish Sep 17, 2024
1986eab
Handle shared export statements in route chunks
markdalgleish Sep 23, 2024
90399a3
Split exported variable declarations in route chunks
markdalgleish Sep 24, 2024
e4fcc7c
Merge branch 'dev' into markdalgleish/route-chunks
markdalgleish Sep 24, 2024
825024d
Handle destructured exports in route chunks
markdalgleish Sep 25, 2024
6ade31d
Improve route chunk dependency analysis
markdalgleish Sep 30, 2024
f252822
Add more route chunk unit tests
markdalgleish Sep 30, 2024
61cfbd6
Fix duplicate route chunk code
markdalgleish Oct 1, 2024
6564892
Merge branch 'dev' into markdalgleish/route-chunks
markdalgleish Oct 2, 2024
cb037e6
Support shared imports in route chunks
markdalgleish Oct 2, 2024
9a2ddcf
Add route chunks integration test
markdalgleish Oct 3, 2024
d8697b2
Skip route chunk HMR preloads when disabled
markdalgleish Oct 4, 2024
aa59841
Refactor to reduce diff
markdalgleish Oct 4, 2024
4131c27
Add route chunks playground
markdalgleish Oct 4, 2024
ee63047
Update lockfile
markdalgleish Oct 6, 2024
c6efa78
Merge branch 'dev' into markdalgleish/route-chunks
markdalgleish Oct 7, 2024
43ec44b
Fix import removal for omitted route chunks
markdalgleish Oct 8, 2024
8db4099
Increase precedence of route chunk downloads
markdalgleish Oct 8, 2024
2012d2f
Add option to enforce route chunks
markdalgleish Oct 10, 2024
bf71c19
Merge branch 'dev' into markdalgleish/route-chunks
markdalgleish Nov 4, 2024
e0fb3b4
Fix playground type error
markdalgleish Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion integration/helpers/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ export const viteConfig = {
port: number;
fsAllow?: string[];
spaMode?: boolean;
routeChunks?: NonNullable<
ReactRouterConfig["future"]
>["unstable_routeChunks"];
}) => {
let config: ReactRouterConfig = {
ssr: !args.spaMode,
future: {
unstable_routeChunks: args.routeChunks,
},
};

return dedent`
Expand Down Expand Up @@ -382,10 +388,17 @@ function bufferize(stream: Readable): () => string {
}

export function createEditor(projectDir: string) {
return async (file: string, transform: (contents: string) => string) => {
return async function edit(
file: string,
transform: (contents: string) => string
) {
let filepath = path.join(projectDir, file);
let contents = await fs.readFile(filepath, "utf8");
await fs.writeFile(filepath, transform(contents), "utf8");

return async function revert() {
await fs.writeFile(filepath, contents, "utf8");
};
};
}

Expand Down
Loading
Loading