Commit graph

887 commits

Author SHA1 Message Date
Richard van der Dys
103e82260d
Fixed pathname check in router (#10547)
* Fixed pathname check in router

Remove the query portion of the URL when checking paths

* Updated change and added trial test

* Update test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-02-19 12:00:27 -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
Joe Haddad
a30e94f21a
Fix Nested Index Dynamic Routes in Development (#10595)
* Fix Nested Index Dynamic Routes in Development

* add missing
2020-02-19 11:13:04 -05:00
Joe Haddad
c58f45f42d
Add Failing CSS Test Case (#10590)
* Add Failing CSS Test Case

* update tests
2020-02-19 08:46:58 -05:00
JJ Kasper
9e8f173319
Update to latest watchpack with dynamic route rename fix (#10351)
* Fix dynamic route rename failing for case change

* Update normalizing curPageFiles

* Remove using webpacks file info since its inaccurate

* Revert changes in favor of fixing upstream

* Update to latest watchpack with case rename fix
2020-02-19 11:05:59 +01:00
JJ Kasper
db04cc57c1
Make sure to handle rejection when prefetching pages (#10579)
* Make sure to handle rejection when prefetching pages

* Update comment

* Make sure to show prefetch error in development still
2020-02-18 15:28:29 -06:00
JJ Kasper
c66f2f757c
Decrease number of expected preloads in safari (#10578) 2020-02-18 14:11:52 -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
Tim Neutkens
743bf5d345
Enable scss/sass support (#10571)
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-18 08:35:12 -05:00
Tim Neutkens
162f11c0c0
Add extra profiling app (#10568)
Just another app that I’ve been using for analysis
2020-02-18 10:30:34 +01:00
Joe Haddad
41e24a516a
Speculate Navigations for Client-Side JS (#10560)
* Speculate Navigations for Client-Side JS

* add tests

* avoid desctructure
2020-02-17 14:46:15 -06:00
Joe Haddad
6d5c48742b
Implement isFallback Router Property (#10539)
This adds a `isFallback` property to detect if the page is being rendered in "fallback" mode or normal mode.
Accessed via the `useRouter()` hook.

---

Closes #10527
2020-02-15 13:01:10 -05:00
Sebastian Benz
ae9b13e0be
Migrate to AMP Optimizer 2.0 (#10535)
* Migrate to AMP Optimizer 2.0

Most notable changes:

* Automatically import all missing AMP component scripts.
* Automatically add any missing mandatary AMP tags.
* 40% faster

I've updated the docs to mention component auto import and added a corresponding
test case.

* change validator tests which now pass validation

* Improve wording

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

* Update adding-amp-components.md

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-14 16:01:43 -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
JJ Kasper
a7337a9b38
Make sure to encode pathname for custom-route destination (#10536)
* Make sure to encode pathname for custom-route destination

* Add tests to security test suite
2020-02-14 16:53:08 +01: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
66273807a5
Retry Static Data Fetch on Hydration (#10513) 2020-02-12 23:06:41 -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
JJ Kasper
4def88c398
Update next-server routes order for expected priority (#10326)
* Update next-server routes order for expected priority

* Update router to allow disabling page routes

* Fix headers having check: true behavior when they should not

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-10 18:06:38 -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
cbb9c2ca92
Add error message when rewriting to dynamic SSG page (#10458)
* Add error message when rewriting to dynamic SSG page

* Update comment

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-07 22:23:15 -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
JJ Kasper
3099f0881a
Add initial SSG fallback handling (#10424)
* Add initial SSG fallback handling

* Remove extra changes and update fallback handling

* Remove extra timeout for testing

* Update SSG tests in dynamic-routing suite

* Add racing to decide between rendering fallback and data

* Update size-limit test

* Update comment

* Make sure to follow correct route change order

* Make comment more verbose for racing

* Revert getStaticData to only return Promise

* Make sure to update URL on fallback

* Add retrying for data, de-dupe initial fallback request, and merge fallback replace

* Update to add preload for fallback pages data

* Add test for data preload link

* Use pre-built fallback in production mode

* Remove preload link for fallback from _document

* Update to make sure fallback is rendered correctly for serverless
2020-02-07 14:09:06 +01:00
JJ Kasper
5dfc20dcc7
Update size-limit test to be more fine grained (#10434)
* Update size-limit test to be more fine grained

* Decrease default build expected size

* Update failing diff amount to be 1kb
2020-02-05 22:40:08 +01:00
JJ Kasper
238202ec11
Make missing param error message more specific (#10433) 2020-02-05 15:27:22 -06:00
JJ Kasper
5ae7fe534e
De-dupe paths returned in getStaticPaths (#10423)
* De-dupe paths returned in getStaticPaths

* Remove warning
2020-02-04 21:55:11 -05:00
JJ Kasper
ec39aa46dc
Update optimize event with static 404 status (#10420)
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-04 15:10:40 -05:00
Joe Haddad
ecd628b7e0
Re-enable native-url (#10419)
* Re-enable `native-url`

* update sizes
2020-02-04 14:58:22 -05:00
JJ Kasper
e3d298dc62
Add support for rewriting to external resources (#10041)
* Add support for rewriting to external resources

* Update rewrite proxying test

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-04 14:08:03 -05:00
Joe Haddad
bc81379618
Detect Invalid Pages Before Optimize (#10418) 2020-02-04 13:55:43 -05:00
Luis Alvarez D
909ab3b179
Check for invalid pages (#10403)
* Updated event

* adjust regex

* adjust regexp more

* Better test file regex

* add tests

* Update index.test.js

* Rename test file

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-04 10:46:22 -05:00
JJ Kasper
89b2dfc502
Make sure runtime config works in dev mode for serverless targ… (#10402) 2020-02-03 23:34:23 +01:00
Lachlan Campbell
c480c37c8e
Skip undefined attribute in Head (#9856)
* Fix #8655, skip rendering meta tags with undefined props

* Filter all tags, not just meta

* Only render defined props

* Remove filtering of undefined strings

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

* Replace Object.entries

* Remove filtering code

* Simplify code

* Add test

* Add tests for undefined head prop value and tweak check

* Update to strip undefined prop values to match react

* Update head.js

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-02-03 14:55:14 -05:00
Joe Haddad
683486da63
Add TypeScript Definitions for Sass (#10363)
* Add TypeScript Definitions for Sass

* fix test
2020-02-03 00:03:42 -05:00
JJ Kasper
65de050017
Update to not show API not ended warning when response is piped to (#10342)
* Update to not show API not ended warning when response is piped to

* Update to use res.once

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-02 21:48:00 -06:00
JJ Kasper
c01534c92e
Make sure runtime config is set before any imports for serverless (#10386)
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-02 22:33:53 -05:00
Luis Durão
a433b9be6a
Fix bug in catch-all routes with SSG (#10379)
* Fix bug in catch-all routes with SSG

* fix slash

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-02 22:07:45 -05:00
Matt Snider
d715c13f41
Custom AMP Validator Variable Name Collision Fix (#10371)
* Changing variable name internally

* Add tests for custom AMP validator

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-02-02 12:02:56 -06:00
JJ Kasper
db90ffe1ea
Implement experimental pages/404.js for custom 404 page (#10329)
* Implement experimental pages/404.js for custom 404 page

* Make sure to show error for getInitialProps in pages/404 in dev mode also

* Update routes-manifest tests for new value

* Make sure page404 is boolean in routes-manifest

* Rename variables for consistency

* Make sure to only use 404 page for 404 error
2020-02-01 15:47:42 +01:00
JJ Kasper
1674f2de1e
Add check that dynamic route is API route in handleApiRequest (#10360)
* Add failing test case

* Add check that dynamic route is API route in handleApiRequest
2020-02-01 15:14:50 +01:00
JJ Kasper
afc278f567
Add support for runtimeConfigs in serverless mode (#10365)
* Add support for runtimeConfigs in serverless mode

* Update test
2020-02-01 14:24:22 +01:00
JJ Kasper
e63d822161
Make sure to not override initial navigation when refreshing static page's query (#10353)
* Add failing case

* Make sure to only refresh query if still on initial page

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-31 20:19:59 -05:00
Tim Neutkens
e35005c214
[Experimental] Nomodule polyfills chunk (#10212)
* Polyfill Promise in polyfills chunk

* Override promise polyfill to use built-in

* Update sizes

* Update polyfills

* Test

* Add dep

* Use iife

* Unscope

* Revert "Unscope"

This reverts commit ab26bcefd551c544d5b3c577b7ce91e5ecfb9bb9.

* trigger

* Remove unused code

* Set helpers to true

* Update yarn.lock

* Fix test

* Update polyfills size

* Add comment

* Add back comment

* Put polyfills optimization under experimental flag

* Fix filename

* bring back promise for backwards compat until experimental feature is landed

* fix resolve alias check

* correct loader

* fix logic branches

* adjust !!

* adjust cache key

* Conditionally branch polyfill

* fix promise polyfill branching

* Re-add runtime

* fix base object

* fix yarn lock

* Add cache key

* correctly set caller

* add basic test

* Increment h=>i

* increment to j just in case

Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-01-30 01:04:29 -05:00
Dmitry Rybin
41d1757b4e
fix: 9919 Add warning when no config is exported from next.con… (#10228)
* fix: 9919 no exported config found

* fix: 9919 remove isolated test, add integration

* fix: 9919 add check for successfull compilation and fix warnin check

* Add test for development output

* fix: 9919 add error page and link to it in warning

* Update empty-configuration.md

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-01-29 09:12:30 +01:00
JJ Kasper
f711b77b90 Enable static 404 config to allow static 404 page when availab… (#10290)
* Enable static 404 config to allow static 404 page when available

* Update static 404 suite

* Fix invalid params test case
2020-01-28 22:39:53 +01:00