Commit 295f9da
Client directive (#40415)
## Feature
Change server components convention from using `.server.js` / `.client.js` file extension to determine it's a server or client component to using `'client'` js literal as a directive for determine client components boundary.
React RFC: reactjs/rfcs#189
New behavior doesn't consume `.server.js` as server components any more, if you're enabling `serverComponents` flag, every `page.js` in app dir will become server components by default. If you adding a `'client'` directive to the page, then that page will become a client component. This rule also applies to the normal js components, client components will require a `'client'` directive to indicate its identity, instead of having a `.client.js` extension.
- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`
Co-authored-by: Shu Ding <[email protected]>1 parent f0ed328 commit 295f9da
File tree
181 files changed
+282
-334
lines changed- packages/next
- build
- analysis
- webpack
- config/blocks/css
- loaders
- next-edge-ssr-loader
- next-flight-client-loader
- next-flight-loader
- plugins
- server
- dev
- test
- e2e/app-dir
- app-prefetch
- app
- dashboard
- [id]
- pages
- app-rendering/app
- getserversideprops-only
- nested
- slow
- getstaticprops-getserversideprops-combined
- nested
- slow
- getstaticprops-isr-multiple
- nested
- getstaticprops-only
- nested
- slow
- app
- app
- (newroot)
- dashboard/another
- (rootonly)/dashboard
- changelog
- hello
- catch-all/[...slug]
- client-component-route
- client-nested
- client-with-errors
- get-server-side-props
- get-static-props
- css
- css-client
- css-nested
- css-page
- dashboard
- (custom)
- deployments/breakdown
- deployments
- [id]
- info
- index
- dynamic-imports
- integrations
- dynamic
- [category]
- [id]
- error
- clientcomponent
- ssr-error-client-component
- hooks
- use-cookies
- client
- use-headers
- client
- use-layout-segments/server
- use-params/server
- use-pathname
- server
- use-preview-data
- client
- use-router
- server
- sub-page
- use-search-params
- server
- use-selected-layout-segment/server
- internal
- failure
- success
- link-hard-push/[id]
- link-hard-replace
- [id]
- subpage
- link-soft-push
- link-soft-replace
- subpage
- loading-bug/[categorySlug]
- old-router
- optional-catch-all/[[...slug]]
- pages-linking
- parallel
- (new)
- @baz/nested-2
- @bar
- nested
- @a
- @b
- @foo
- nested
- @a
- @b
- nested
- param-and-query/[slug]
- partial-match-[id]
- same-layout
- first
- second
- should-not-serve-client
- should-not-serve-server
- slow-layout-and-page-with-loading/slow
- slow-layout-with-loading/slow
- slow-page-with-loading
- template
- clientcomponent
- other
- servercomponent
- other
- test-page
- with-id
- pages/api
- rsc-basic
- app
- css-in-js
- css-modules
- edge/dynamic
- [id]
- escaping-rsc
- external-imports
- global-styles-rsc
- multi
- native-module
- next-api
- image
- link
- partial-hydration
- root
- routes/[dynamic]
- streaming-rsc
- various-exports
- components
- trailingslash/app
- a
- production/emit-decorator-metadata
- app/pages/api
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
181 files changed
+282
-334
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
35 | 45 | | |
36 | 46 | | |
37 | 47 | | |
| |||
252 | 262 | | |
253 | 263 | | |
254 | 264 | | |
| 265 | + | |
255 | 266 | | |
256 | 267 | | |
257 | 268 | | |
| |||
303 | 314 | | |
304 | 315 | | |
305 | 316 | | |
| 317 | + | |
306 | 318 | | |
307 | 319 | | |
308 | 320 | | |
309 | 321 | | |
310 | 322 | | |
311 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
312 | 329 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | | - | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
| |||
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
69 | | - | |
70 | 68 | | |
71 | 69 | | |
72 | 70 | | |
73 | 71 | | |
74 | 72 | | |
75 | 73 | | |
76 | | - | |
77 | 74 | | |
78 | 75 | | |
79 | 76 | | |
| |||
90 | 87 | | |
91 | 88 | | |
92 | 89 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 90 | | |
101 | 91 | | |
102 | 92 | | |
| |||
208 | 198 | | |
209 | 199 | | |
210 | 200 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
| 201 | + | |
215 | 202 | | |
216 | 203 | | |
217 | 204 | | |
| |||
418 | 405 | | |
419 | 406 | | |
420 | 407 | | |
421 | | - | |
422 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
423 | 412 | | |
424 | 413 | | |
425 | 414 | | |
| |||
428 | 417 | | |
429 | 418 | | |
430 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
431 | 423 | | |
432 | 424 | | |
433 | 425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
99 | | - | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
492 | | - | |
493 | 492 | | |
494 | 493 | | |
495 | 494 | | |
| |||
506 | 505 | | |
507 | 506 | | |
508 | 507 | | |
509 | | - | |
510 | 508 | | |
511 | 509 | | |
512 | 510 | | |
| |||
518 | 516 | | |
519 | 517 | | |
520 | 518 | | |
521 | | - | |
522 | 519 | | |
523 | 520 | | |
524 | 521 | | |
| |||
1267 | 1264 | | |
1268 | 1265 | | |
1269 | 1266 | | |
1270 | | - | |
| 1267 | + | |
1271 | 1268 | | |
1272 | | - | |
1273 | | - | |
1274 | | - | |
1275 | | - | |
1276 | | - | |
1277 | | - | |
1278 | | - | |
1279 | | - | |
1280 | | - | |
1281 | | - | |
1282 | | - | |
1283 | | - | |
1284 | | - | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
1285 | 1278 | | |
1286 | 1279 | | |
1287 | 1280 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1327 | 1327 | | |
1328 | 1328 | | |
1329 | 1329 | | |
1330 | | - | |
1331 | | - | |
1332 | | - | |
1333 | | - | |
1334 | | - | |
1335 | | - | |
1336 | | - | |
1337 | | - | |
1338 | | - | |
1339 | | - | |
1340 | | - | |
1341 | | - | |
1342 | | - | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
1347 | | - | |
1348 | | - | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
1352 | | - | |
1353 | | - | |
1354 | | - | |
1355 | | - | |
1356 | | - | |
1357 | 1330 | | |
1358 | 1331 | | |
1359 | 1332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
| |||
687 | 686 | | |
688 | 687 | | |
689 | 688 | | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
| 689 | + | |
697 | 690 | | |
698 | 691 | | |
699 | 692 | | |
| |||
801 | 794 | | |
802 | 795 | | |
803 | 796 | | |
804 | | - | |
| 797 | + | |
805 | 798 | | |
806 | 799 | | |
807 | 800 | | |
| |||
810 | 803 | | |
811 | 804 | | |
812 | 805 | | |
813 | | - | |
| 806 | + | |
814 | 807 | | |
815 | 808 | | |
816 | 809 | | |
| |||
819 | 812 | | |
820 | 813 | | |
821 | 814 | | |
822 | | - | |
| 815 | + | |
823 | 816 | | |
824 | 817 | | |
825 | 818 | | |
| |||
874 | 867 | | |
875 | 868 | | |
876 | 869 | | |
877 | | - | |
| 870 | + | |
878 | 871 | | |
879 | 872 | | |
880 | 873 | | |
| |||
1151 | 1144 | | |
1152 | 1145 | | |
1153 | 1146 | | |
1154 | | - | |
1155 | | - | |
1156 | | - | |
1157 | | - | |
1158 | | - | |
1159 | 1147 | | |
1160 | 1148 | | |
1161 | 1149 | | |
| |||
1451 | 1439 | | |
1452 | 1440 | | |
1453 | 1441 | | |
1454 | | - | |
1455 | | - | |
| 1442 | + | |
1456 | 1443 | | |
1457 | 1444 | | |
1458 | 1445 | | |
| |||
1492 | 1479 | | |
1493 | 1480 | | |
1494 | 1481 | | |
1495 | | - | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
1496 | 1488 | | |
1497 | 1489 | | |
1498 | | - | |
| 1490 | + | |
1499 | 1491 | | |
1500 | 1492 | | |
1501 | | - | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
1505 | | - | |
1506 | | - | |
1507 | | - | |
1508 | | - | |
1509 | | - | |
1510 | | - | |
1511 | | - | |
1512 | | - | |
1513 | 1493 | | |
1514 | 1494 | | |
1515 | 1495 | | |
| |||
1841 | 1821 | | |
1842 | 1822 | | |
1843 | 1823 | | |
| 1824 | + | |
1844 | 1825 | | |
1845 | 1826 | | |
1846 | 1827 | | |
1847 | | - | |
1848 | | - | |
1849 | 1828 | | |
1850 | 1829 | | |
1851 | 1830 | | |
| |||
1995 | 1974 | | |
1996 | 1975 | | |
1997 | 1976 | | |
1998 | | - | |
| 1977 | + | |
1999 | 1978 | | |
2000 | 1979 | | |
2001 | 1980 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
504 | | - | |
| 504 | + | |
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
| |||
0 commit comments