Commit graph

639 commits

Author SHA1 Message Date
Dulmandakh
d3fb262958
remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise

* fix mkdirp in spr-cache.ts

* bump fs-extra to 9.0.0

* remove mkdirp
2020-03-21 17:02:05 +01:00
JJ Kasper
c14d983d54
Ensure hybrid AMP works correctly with SSG (#11205)
* Ensure hybrid AMP works correctly with SSG

* Strip AMP from query when not needed
2020-03-20 09:46:52 +01:00
Tim Neutkens
38e42cd4bb
Add support for baseUrl option in tsconfig and jsconfig (#11203)
* Add support for baseUrl option in tsconfig and jsconfig

* Move jsconfigPath

* Remove filter
2020-03-19 17:34:24 +01:00
JJ Kasper
e28e8ada98
Group CSS files in shared build output separate from JS files (#11184)
* Group CSS files in shared build output separate from JS files

* Fix buildId not being replaced in shared by all
2020-03-19 09:25:10 +01:00
JJ Kasper
836f68aa67
Add CSS file to build output (#11145)
* Remove filtering CSS from build output

* Add displaying page specific CSS files and including them in page size
2020-03-18 09:47:39 +01:00
JJ Kasper
ea7c1e1dcf
Add support for SCSS options (#11063)
* Add support for SCSS includePaths

* Support sassOptions instead of just includePaths

Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-03-16 10:55:16 +01:00
Aaron Reisman
85e9ce1b0b
Update preset.ts: Remove any and use updated Node.js types (#11075)
Remove any and use updated Node.js types
2020-03-15 12:22:53 +01:00
JJ Kasper
71f97198d1
Add support for static 404 when _error does not have custom GIP (#11062)
* Add support for static 404 when _error does not have custom GIP

* Update tests
2020-03-14 09:58:20 +01:00
Joe Haddad
18036d4e51
Correct Cache-Control Behavior for GS(S)P (#11022)
* Correct Cache-Control Behavior for GS(S)P

* remove old line

* fix test
2020-03-13 10:40:10 +01:00
JJ Kasper
ccb6ce7ed4
Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP

* Add error for getStaticProps in pages/404 too

* Add support for getStaticProps in pages/404

* Update test
2020-03-12 10:48:14 +01:00
JJ Kasper
fde1ce2924
Add warning when built-in CSS/SCSS support is disabled (#10942) 2020-03-10 14:29:40 -04:00
Joe Haddad
8443a809f3
Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability

* Add support for cyclic refs

* Add unit tests

* Test for error in development mode

* Fix prerender preview tests

* Fix gssp preview tests

* fix 2x test cases

* Add desired test

* fix some more tests

* Fix route manifest expect

* Fix test expects

* Test that `getServerSideProps` does not error in production

* Test that getStaticProps is not checked in production

* Test serialization check during build

* Fix export detection for serverless

* Update test/unit/is-serializable-props.test.js

Co-Authored-By: JJ Kasper <jj@jjsweb.site>

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-03-09 13:30:44 -04:00
JJ Kasper
b274fe39d3
Update method for attaching GS(S)P identifier to page (#10859)
* Update to use separate export instead of attaching to Component to identify GS(S)P pages

* Handle initialProps being undefined
2020-03-05 23:15:10 -05:00
Joe Haddad
a5d0cb9d80
Measure getStaticProps, getServerSideProps (#10800)
* Measure `getStaticProps`, `getServerSideProps`

* Test new fields
2020-03-02 19:01:12 -05:00
Prateek Bhatnagar
16672a4353
Adding conformance checks (#10314)
* adding tests  for rect sync conformance check

* adding test for react sync script conformance check

* reverting yarn lock changes

* adding duplicate polyfill conformance

* bug fixes in dulpicate polyfill conformance check

* adding settings capability to conformance plugin

* removing minification check from server build

* bug fix

* settings for react sync script check
2020-03-02 22:53:18 +01:00
JJ Kasper
9ec3dae607
Fix next/config module mismatch in new serverless mode (#10792)
* Add failing test case

* Update serverless-loader require to fix config module mismatch

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-03-02 12:38:16 -05:00
Joe Haddad
990eda2c88
Prefetch SSG Data (#10127)
* Prefetch SSG Data

* Update packages/next/client/page-loader.js

Co-Authored-By: JJ Kasper <jj@jjsweb.site>

* Revert router.ts

* Revert link.tsx

* undo change

* mimmic existing

* simplify

* Prefetch href and asPath

* fix load

* dedupe prefetchAs

* Inject script tag on hover

* comment prefetchAs

* minify code

* introduce lazy files

* Add some breathing room

* correct default type

* Prefetch non-dynamic data

* Prefetch dynamic route data

* Fix size test

* Humanize code

* add tests

* Disable code

* Only generate modern version in modern mode

* Extract function helper

* add comments

* Filter out dynamic route to simplify manifest size

* add test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-03-02 12:14:40 -05:00
Joe Haddad
e608c86b59
Separate Low Priority Files from Main Files (#10756)
* Separate Low Priority Files from Main Files

* Fix tests
2020-02-29 17:09:42 -05:00
Janicklas Ralph
7848615bd6
Fix url-polyfill dep and re-enable native-url (#10726)
* Adding native-url package

* Bumping native-url version

* Upgrading native-url

* Logging stats object for debugging

* Logging stats object for debugging

* Adding try catch to the error lines

* Experimenting with regex

* Experimenting with regex

* Experimenting with regex

* Testing regex changes

* Fixing defer-script test case to not include polyfill.js

* Meging changes with existing polyfill work

* Bumping version

* adjust webpack config

* Reduce size in size test

* Remove 1kb from legacy

* Bumping native-url version, includes fix for IE11

* Update lock file

* Updating native-url, fixes issue on IE11

* Fix sourcemap being added in document

* Adding Router as an app level dep. Fixes Router not being added as a dep to pages without Link when granularChunks is enabled

* Fix typescript error

* Fix modern + granularChunks hydration failing

* Fix TS error

* Update native-url version

* Adding native-url with safari fix

* Update url-polyfill in polyfill-nomodule package

* Remove url-polyfill from next package.json

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-27 22:08:58 -05:00
JJ Kasper
c9d9f1131c
Remove unstable_ prefix from new methods (#10723)
* Rename getServerProps to getServerSideProps

* Remove unstable_ prefix from new methods

* Add error when legacy methods are detected

* Add legacy methods for babel transform

* Add unstable_getServerSideProps also

* Apply suggestions from code review

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

* Update types import

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-27 11:57:39 -06:00
JJ Kasper
2789e7e0c2
Rename getServerProps to getServerSideProps (#10722) 2020-02-27 11:04:30 -06:00
Joe Haddad
663f5c4b6e
Fix Error Message 2020-02-27 09:25:17 -05:00
Joe Haddad
47ff1eb95a
Ability to Disable SSG Fallback (#10701)
* Ability to Disable SSG Fallback

* Throw error when value is missing

* Fix existing tests

* Adjust error message

* Do not render fallback at build time for `fallback: false` page

* Fix existing fallback behavior

* fix build

* fix version

* fix some tests

* Fix last test

* Add docs for get static paths

* Add explicit mode tests

* test for fallback error message
2020-02-27 13:23:28 +01:00
JJ Kasper
6dea45bdc9
Add dataRoutes field to routes-manifest for SSG and serverProps routes (#10622)
* Add dataRoutes field to routes-manifest for SSG and serverProps routes

* Update routes-manifest test
2020-02-26 14:35:02 -05:00
JJ Kasper
395714a475
Update url prop handling for pages with new data methods (#10653)
* Make sure to show error when url prop is returned for a page

* Update test and handle undefined pageProps

* Handle empty props

* Apply suggestions from code review

Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>

* Update tests

* Update to not add url prop for SSG/SSP pages

* Update errsh for reserved prop

* Update errsh wording some more

* Update tests and to warn instead of error

* Update reserved prop warning

* Include page in url prop warning

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-26 13:26:55 -05:00
JJ Kasper
364b4fe797
Make sure rewrites are handled in serverless mode correctly (#10697)
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-26 13:14:34 -05:00
JJ Kasper
40abd708e1
Show better error when non-array is returned from custom-routes (#10670)
* Show better error when non-array is returned from custom-routes

* bump

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-24 17:01:02 -05:00
JJ Kasper
f17e170c3d
Add calling getStaticPaths in development before showing fallback (#10611)
* Add calling getStaticPaths in development before showing fallback

* Move staticPathsWorker to next-dev-server

* Make sure to clear require cache in worker process

* bump

* Remove staticPathsCache member

* Update numWorkers for staticPathsWorker
2020-02-24 16:36:59 -05:00
Joe Haddad
c3d914919a
Fix Double URL Encoding for Serverless (#10663) 2020-02-24 13:06:11 -05:00
Joe Haddad
89c792f67f
Preview Mode Should Not Cache (#10636)
* Preview Mode Should Not Cache

* add import

* fix import

* add tests

* Add real serverless mode tests
2020-02-22 10:26:39 +01:00
Joe Haddad
40217b75b9
Revert "Re-Enable Native url Module (#10530)" (#10623)
This reverts commit b329f6a2d6.
2020-02-21 01:16:07 -05:00
JJ Kasper
f5cb1a69d7
Add error messages for dynamic SSG page without getStaticPaths (#10620)
* Add error messages for dynamic SSG page without getStaticPaths

* Update error check

* Update test file

* Update another test file

* Adjust

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-21 00:57:10 -05:00
Janicklas Ralph
b329f6a2d6
Re-Enable Native url Module (#10530)
* Adding native-url package

* Bumping native-url version

* Upgrading native-url

* Logging stats object for debugging

* Logging stats object for debugging

* Adding try catch to the error lines

* Experimenting with regex

* Experimenting with regex

* Experimenting with regex

* Testing regex changes

* Fixing defer-script test case to not include polyfill.js

* Meging changes with existing polyfill work

* Bumping version

* adjust webpack config

* Reduce size in size test

* Remove 1kb from legacy

* Bumping native-url version, includes fix for IE11

* Update lock file

* Updating native-url, fixes issue on IE11

* Fix sourcemap being added in document

* Adding Router as an app level dep. Fixes Router not being added as a dep to pages without Link when granularChunks is enabled

* Fix typescript error

* Fix modern + granularChunks hydration failing

* Fix TS error

* Update native-url version

* Adding native-url with safari fix

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-21 00:25:49 -05:00
Tim Neutkens
e9e1a2b900
Disable setImmediate polyfill (#10612)
* Disable setImmediate polyfill

* Update size-limit

Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-02-20 12:52:28 -05:00
JJ Kasper
db445db790
Add err.sh for invalid getStaticPaths return value (#10605)
* Add err.sh for invalid getStaticPaths return value

* Update error link

* Apply suggestions from code review

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-02-20 10:05:49 +01:00
Tim Neutkens
9a0d82b4d9
Clean up landed experimental flags (#10593)
* Clean up landed experimental flags

* Remove check for experimental flags from build too

* Remove /_errors/404 in favor of /404

* Remove unneeded check for pathname

* Update test paths

* Fix test

* Update test

* Remove test for disabled config

* Set pages404 always to true

Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-02-19 14:54:38 -05:00
Joe Haddad
5e12e5f56a
Emit ES5 Friendly Code in Program#exit Visitor (#10591)
* Emit ES5 Friendly Code in Program#exit Visitor

* Document reasoning

* updt

* Update next-ssg-transform.ts
2020-02-19 11:29:30 -05:00
JJ Kasper
2a0843349c
Update error message for invalid return value from getStaticPaths (#10580) 2020-02-19 00:20:45 -06:00
Tim Neutkens
0222a09cd0
Enable polyfillsOptimization (#10574)
* Enable polyfillsOptimization

* Update sizes

* Commons is no longer there

* Update test
2020-02-18 19:26:55 +01:00
Jan Potoms
3f691eaa45
Remove ts-ignore where possible (#10541)
* Remove ts-ignore where possible

And replace by typecasts

* More accurate types

* bend cliententries in a correct shape earlier on

* comment becomes unnecessary

* add webpack overload to allow for the next.js use case

* Avoid changing public interface

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-17 16:16:19 -05:00
Joe Haddad
1c247b5cf1
Check next.config.js settings (#10425)
* Check next.config.js settings

* Add tests

* test package.json case too
2020-02-14 15:42:44 -05:00
Joe Haddad
71019e70d3
Remove native-url Again (#10526)
* Remove `native-url` Again

* update comment

* update sizes
2020-02-13 17:54:25 -05:00
JJ Kasper
4617950457
Add handling for default as named export in SSG transform (#10486)
* Add failing SSG syntax

* Add handling for default as named export in SSG transform

* Revert [comment].js

* Revert index.js

* adjust

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-13 00:25:44 -05:00
Jan Potoms
0b12e2e859
Improve error for invalid page configurations (#10441)
* Remove any type and fix edge cases

Removed the "as any" and use the @babel/types typeguards instead. This revealed some edge cases that would just error.

* Remove ts-ignore

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-12 23:39:51 -05:00
Joe Haddad
e38e3dd55a
Adjust SSG Loading Behavior (#10510)
* Adjust SSG Loading Behavior

* Update expected preview behavior

* Rename two corrections

* Only use skeleton in production for now

* Fix "should SSR SPR page correctly" test

* fix tests

* fix trailing comment letter

* disable test for now
2020-02-12 20:06:07 -05:00
Joe Haddad
3cb3498324
SSG Preview Mode (#10459)
* checkpoint: api impl

* Add support for tryGetPreviewData

* snapshot: server(less) support

* Add X-Prerender-Bypass-Mode header support

* Pass preview data to getStaticProps call

* add TODO

* setPreviewData

* 100k iterations

* Handle jwt error

* Write out preview values

* forgot file

* set preview props

* Send preview props

* add preview props

* Pass around more data

* update yarn lock

* Fail on Invalid Prerender Manifest

* Make Missing Prerender Manifest Fatal

* fix ts errors

* fix test

* Fix setting cookies + maxage

* Secure is not needed as we encrypt necessary data

* Set on domain root

* Set cookie max ages

* Render a fallback on-demand for non-dynamic pages

* Test preview mode

* remove old build

* remove snapshots

* Add serverless tests

* use afterAll

* Remove object assigns

* fix cookie spread

* add comment
2020-02-11 20:16:42 -05:00
Joe Haddad
79fb13e587
Builds with Warnings Still Complete (#10498) 2020-02-11 17:09:00 -05:00
Joe Haddad
14f33dd54f
Make Missing Prerender Manifest Fatal (#10485)
* Fail on Invalid Prerender Manifest

* Make Missing Prerender Manifest Fatal

* fix test
2020-02-10 17:43:34 -05:00
JJ Kasper
f6e7a38101
Add paths field for unstable_getStaticPaths (#10454)
* Add paths field for unstable_getStaticPaths

* Make sure to specify page in getStaticPaths errors
2020-02-07 22:09:54 -05:00
JJ Kasper
9dc0afd9b9
Redesign custom-routes output and show headers in output (#10444) 2020-02-07 16:06:02 +01:00