Commit d98efc1
feat: split up API Routes + use .nft.json files to make builds fast (#2058)
* feat: split up API Routes
Brings back the functionality that was reverted in
#1731, but under a flag.
This will be utterly slow in building,
so let's try to speed that up in the next step!
* feat: load includedFiles for every page
* refactor: extract function config logic
* refactor: extract flag into own definition
* feat: use "none" bundler for split-up api routes
* feat: list some more dependencies
* feat: use NFT to trace common required files
* refactor: clean up a wee bit
* fix: please don't include /sh
* feat: enable flag by default, so tests use it
* feat: add a naïve packing algo
* feat: write rough sketch for packing lambdas
* refactor: add constructor for APILambda
* feat: pack handlers together into bundles
* fix: linter
* feat: exclude some heavy unneeded files
* fix: trigger CI again, now that it supports `none` bundler
* feat: remove code for old mechanism
If we'll be doing a staged rollout,
and our test suite covers most of the cases,
we should be able to roll this out
without a self-serve opt-out mechanism.
* fix: remove test for deleted code
* fix: ensure that react doesn't try to load development build
* fix: move test directory into repo, so node_modules can be read
* fix: snapshot with API redirects
* fix: remove .only
* fix: don't assert on _api_*
* fix: another test
* fix: apply NODE_ENV=prod to right generated handler
* feat: remove nft tracing
* feat: put change behind flag again
* feat: source flag from plugin input
* fix: add default value for featureflags
* fix: default flag to true for testing
* fix: revert changes to lockfiles
* fix: eslint it/test
* fix: lint
* fix: revert distracting change
* fix: now that we don't use nft anymore, we don't have to copy over node_modules
* fix: swallow require.resolve errors for unit tests
* fix: remove timing logs
* fix: lint name
* fix: lint
* fix: isr needs _document.js
* fix: add _app for ISR
* fix: correct wrong output of some npm versions
* fix: integration test
For some reason,
ZISI doesn't like relative paths in this integration test.
We can fix it by using absolute paths.
Since this PR moves API routes out of __netlify_handler,
we can no longer make the assertion on x-nf-render-mode.
* fix: assemble npm package path correctly, also for monorepos
* fix: try what happens if we use next-netlify server
* fix: check what happens when we skip revalidation
* fix: dont let revalidate request time out
* fix: send x-nextjs-cache header to prevent error
* fix: update error message in test
* fix: resolve relative paths based on data in required-server-files
* fix: test
* fix: keep manually-added `included_files`
* fix: try something
* fix: don't include unneeded _app pages in ISR
* fix: finalize includedFiles before writing it onto netlifyConfig
* chore: update comment
* fix: exclude sass file in monorepos
* Update packages/runtime/src/helpers/functions.ts
* chore: remove comment
* fix: update flag impl
* refactor: use getRequiredServerFiles
* chore: add comment on route[0]
* fix: set NEXT_SPLIT_API_ROUTES in netlify.toml
* fix: put updated revalidate behaviour behind flag
* fix: supply splitApiRoutes in getHandler
* fix: better run your code before committing it and embarrassing yourself
---------
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>1 parent 5ee2fce commit d98efc1
File tree
27 files changed
+547
-101
lines changed- .github/workflows
- cypress/e2e/default
- demos
- default
- middleware
- nx-next-monorepo-demo
- static-root
- packages/runtime/src
- helpers
- templates
- test
- __snapshots__
- helpers
- integration
- templates
27 files changed
+547
-101
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
0 commit comments