Commit graph

27 commits

Author SHA1 Message Date
JJ Kasper
85e720a092 Add experimental SPR support (#8832)
* initial commit for SPRv2

* Add initial SPR cache handling

* update SPR handling

* Implement SPR handling in render

* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating

* Handle no prerender-manifest from not being used

* Fix url.parse error

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Replace set with constants in next-page-config

* simplify sprStatus.used

* Add error if getStaticProps is used with getInitialProps

* Remove stale TODO

* Update revalidate values in SPR cache for non-seeded routes

* Apply suggestions from code review

* Remove concurrency type

* Rename variable for clarity

* Add copying prerender files during export

* Add comment for clarity

* Fix exporting

* Update comment

* Add additional note

* Rename variable

* Update to not re-export SPR pages from build

* Hard navigate when fetching data fails

* Remove default extension

* Add brackets

* Add checking output files to prerender tests

* Adjust export move logic

* Clarify behavior of export aggregation

* Update variable names for clarity

* Update tests

* Add comment

* s/an oxymoron/contradictory/

* rename

* Extract error case

* Add tests for exporting SPR pages and update
/_next/data endpoint to end with .json

* Relocate variable

* Adjust route building

* Rename to unstable

* Rename unstable_getStaticParams

* Fix linting

* Only add this when a data request

* Update prerender data tests

* s/isServerless/isLikeServerless/

* Don't rely on query for `next start` in serverless mode

* Rename var

* Update renderedDuringBuild check

* Add test for dynamic param with bracket

* Fix serverless next start handling

* remove todo

* Adjust comment

* Update calculateRevalidate

* Remove cache logic from render.tsx

* Remove extra imports

* Move SPR cache logic to next-server

* Remove old isDynamic prop

* Add calling App getInitialProps for SPR pages

* Update revalidate logic

* Add isStale to SprCacheValue

* Update headers for SPR

* add awaiting pendingRevalidation

* Dont return null for revalidation render

* Adjust logic

* Be sure to remove coalesced render

* Fix data for serverless

* Create a method coalescing utility

* Remove TODO

* Extract send payload helper

* Wrap in-line

* Move around some code

* Add tests for de-duping and revalidating

* Update prerender manifest test
2019-09-24 10:50:04 +02:00
Janicklas Ralph
deeaa9230f Update page sizes displayed on build (#8777)
* Fixing page sizes displayed during build

* Adding comments

* Update variable name

* Fixed support for modern mode

* Remove braces

* Memoize fs.stat result

* Memoize fs.stat result
2019-09-19 11:16:51 -05:00
Tim Neutkens
2ba352da39 Move next-server back into next package (#8613)
* Initial move

* Make emitting work

* Update paths

* Remove leftover files

* Add correct externals configuration

* Import correct path

* Update path to work with ts-server test

* Update lib directory

* Compile next-server/lib
2019-09-04 10:00:54 -04:00
Joe Haddad
847e892d71
Remove Flying Shuttle experiment (#8433)
* Remove Flying Shuttle experiment

* Remove more old tests

* Remove minify loader
2019-08-20 11:07:57 -04:00
JJ Kasper
fc7e235f2c Followup optimizations for new experimentalPrerender (#8287)
* Add checking for hybrid AMP during static check

* Update to always hit server for prerender data

* Add removing of SPR code when not used

* Add checking for hybrid AMP during static check

* Update to always hit server for prerender data

* Add removing of SPR code when not used

* Update dead code elimination
2019-08-11 21:56:57 -04:00
JJ Kasper
ca13752e24
Implement experimentalPrerender option (#7983)
* Revert "Remove Old Prerender Implementation (#8218)"

This reverts commit 2ab300dd81.

* Add contentHandler for page config

* Rename config from contentHandler to re-use
experimentalPrerender

* Remove un-needed changes

* Replace backslashes for manifest

* Update manifest output format

* Make prerender: true enable SPR behavior and update
to merge prerender-manifest for flying-shuttle

* Fix output path for / prerender file

* Add dynamic routes to test suite

* Add generating and previewing of skeletons
for prerendered dynamic routes

* remove inline prerender option

* update to not replace getInitialProps which allows
nested getInitialProps and add query when fetching prerender

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Remove legacy prerender option

* Apply suggestions from review

* Apply more suggestions from review

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Add handling of error when parsing json

* Update handling of moving exported pages

* Rename nextPreviewSkeleton to _nextPreviewSkeleton

* bump
2019-08-06 15:26:01 -05:00
Joe Haddad
2ab300dd81
Remove Old Prerender Implementation (#8218)
* Remove Prerender Implementation

* Fix PageConfig

* Fix next server

* Fix two more files

* Fix render

* Fix render

* Try to fix up page config

* Correct build file

* Switch back static checker

* Turn stuff back

* Add missing newline

* Revert changes

* Add missing newline

* Fix types
2019-08-02 10:28:03 -04:00
Xinzi Zhou
9609fe453d Replace fs.exists with fs.access (#7742)
* Replace deprecated fs.exists with fs.access.

* Update packages/next/lib/file-exists.ts

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Update packages/next/lib/file-exists.ts

Co-Authored-By: Joe Haddad <timer150@gmail.com>
2019-07-16 23:01:21 -07:00
Joe Haddad
ab0b2cf3da
Add a test for module.exports from a page (#7842)
Closes https://github.com/zeit/next.js/issues/7835
2019-07-09 13:23:38 -04:00
JJ Kasper
30da9e075e Update to always require next/config when setting config (#7822) 2019-07-09 13:23:51 +02:00
Joe Haddad
7439a773b0 Nit: Change Pre-render to Prerender (#7733) 2019-07-02 22:51:12 +02:00
JJ Kasper
0ca8087565
Add prerender PageConfig option (#7699)
* Add prerender PageConfig option

* Update PageConfig type

* Add inlining of data when pre-render is set and add tests

* Update types import

* Add check for props

* Rename prerender to experimentalPrerender for now
2019-07-01 14:13:52 -07:00
Lukáš Huvar
4ad934c148 Serverless build for API routes (#7649)
* Fixes serverless target in development

* Fix serverless build

* Fix serverless build

* Add manifest test

* Better output

* Fix manifest test

* Update snapshot

* Remove snapshots
2019-07-01 12:47:11 -04:00
JJ Kasper
9781510839
Parallelize requiring pages for static check (#7671) 2019-06-25 19:54:28 -07:00
JJ Kasper
6a2e8cd81f
Fix memory leak from requiring pages (#7659) 2019-06-25 13:36:21 -07:00
Joe Haddad
ee2bdb896c
Avoid lambda nomenclature when target != 'serverless' (#7650) 2019-06-24 14:59:51 -04:00
JJ Kasper
090a06bb2c
Add handling for invalid pages during autoExport (#7574)
* Add handling for invalid pages during autoExport

* Add err.sh link for invalid page export

* Fix typo

* Apply suggestions from code review

Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>
2019-06-13 17:08:19 -07:00
Joe Haddad
5e66656d21
Mark whether page is a lambda or static file in build output (#7553) 2019-06-10 14:59:36 -04:00
Tim Neutkens
3e51ddb8af
Move syntax formatting to prettier (#7454)
* Run prettier over packages/**/*.js

* Run prettier over packages/**/*.ts

* Run prettier over examples

* Remove tslint

* Run prettier over examples

* Run prettier over all markdown files

* Run prettier over json files
2019-05-29 13:57:26 +02:00
JJ Kasper
cdd54afb0d Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps

* Add support for exporting serverless to static
and serving the html files during next start

* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests

* Update flying-shuttle test

* revert un-used pagesManifest change

* remove query.amp RegExp test

* Fix windows backslashes not being replaced

* Re-enable serverless support for next start

* bump

* Fix getInitialProps check

* Fix incorrect error check

* Re-add check for reserved pages

* Fix static check

* Update to ignore /api pages and clean up some tests

* Re-add needed next.config for test and correct behavior

* Update RegExp for ignored pages for auto-static

* Add checking for custom getInitialProps in pages/_app

* Update isPageStatic logic to only use default export

* Re-add retrying to CircleCi

* Update query during dev to only have values
available during export for static pages

* Fix test

* Add warning when page without default export is
found and make sure to update pages-manifest
correctly in flying-shuttle mode

* Fix backslashes not being replaced

* Integrate auto-static with flying-shuttle
and make sure AMP is handled in flying-shuttle

* Add autoExport for opting in
2019-05-22 09:36:53 -07:00
Joe Haddad
5ea721ea56
Redesigned page output (#7324)
* Redesigned page output

* Remove old commented out code

* right align files
2019-05-14 11:11:22 -04:00
JJ Kasper
2e8088e447
Add stats to build tree (#7194)
* Copy pretty-bytes instead of installing
2019-05-01 15:31:08 -05:00
JJ Kasper
a320dc10f6 Add AMP label to AMP only pages in build tree (#7123) 2019-04-24 10:48:43 +02:00
JJ Kasper
711d45b698 Use next.config env and packages to calculate hashes (#7001)
* Use next.config env and packages to calculate
hashes for chunk-graph

* Remove example from testing

* remove left over import

* Tweak behavior
2019-04-10 15:19:50 -04:00
Joe Haddad
65fcf351c3
Add new getFileForPage helper to build utils (#6999) 2019-04-10 12:37:30 -04:00
Joe Haddad
59fb471bc6
Correct page search order (#6996)
This fixes a case where a user has a page named `next.js.js` and `next.js`.
2019-04-10 12:22:10 -04:00
Joe Haddad
94b8bf75e2
Move build utils to their own file (#6990)
* Move build utils to their own file

* Tweak feature detection
2019-04-09 23:15:35 -04:00