Commit graph

505 commits

Author SHA1 Message Date
Joe Haddad
afa73ae46b
Update Prerender Manifest (#8918)
* Update Prerender Manifest

* Fix typescript
2019-09-30 22:08:01 -04:00
JJ Kasper
1a6a6c99c1 Add test case to prevent regression for page config (#8890) 2019-09-28 14:43:38 +02:00
Joe Haddad
d9c6f20023 Remove React Suspense from Client Runtime (#8887) 2019-09-28 12:44:07 +02:00
Joe Haddad
296cfacd12
Add SPR Dynamic Routes to Manifest (#8885)
* Add SPR Dynamic Routes to Manifest
This adds dynamic routes for SPR pages to the prerender manifest so we can configure the Now Builder to handle these routes as SPR routes. Otherwise, they're treated like normal `getInitialProps` pages.

* Fix types
2019-09-27 16:34:37 -04:00
Joe Haddad
2aa1203171
Configure the Default Revalidate (#8880)
* Configure the Default Revalidate
The default revalidate behavior should be configured by Next.js. Otherwise, the behavior might drift or change in non-semver compliant ways between Next.js and the builder (or other 3rd party setups).

* Add additional comment
2019-09-27 13:36:00 -04:00
Joe Haddad
9152a2a00d
Better test case for serverless export (#8865)
This checks that the program output actually claims there was a build error.
2019-09-26 13:58:42 -04:00
JJ Kasper
2ae475e07c SPR follow ups (#8846)
* Add revalidate header and error when invalid
object from getStaticProps

* Make sprCache no-op in dev mode

* Update packages/next/next-server/server/next-server.ts

* Update tests for fixes

* Update getStaticProps error and add test

* Update manifest test

* Add validating revalidate value

* Apply suggestions from code review

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

* Change from error to warning high revalidate value
2019-09-25 11:29:21 -04:00
JJ Kasper
a8e3b02236 Add src directory support (#8735)
* Add find-pages-dir

* Add support for src directory

* Add test for pages dir preference

* Update comment
2019-09-24 17:15:14 +02:00
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
Joe Haddad
ed84bee503
Fix Experimental CSS Ordering (#8790)
* Fix CSS Ordering
This fixes CSS ordering between development and production.

Before this change, globally imported CSS would come _after_ `<style jsx global>` in development, but _before_ in production.

After this change, it'll always be applied before.

* Move to correct element

* Add tests

* Fix obnoxious indents

* Update test/integration/css/fixtures/with-styled-jsx/pages/index.js

Co-Authored-By: JJ Kasper <jj@jjsweb.site>
2019-09-18 20:18:41 -04:00
Joe Haddad
b4d349e6c1
Reduce Install Size (#8788)
* Reduce Install Size
This should shave a decent amount off our install size.

* Fix CSS source map emitting

* Fix generation

* Enable source maps for testing purposes

* Disable double comment

* Fix test regex
2019-09-18 13:59:46 -04:00
Joe Haddad
a9c8261392
Test CSS Source Map generation (#8785)
Ensure CSS Source maps are emitted correctly.
2019-09-18 12:03:12 -04:00
JJ Kasper
cc177561e4 Run all Azure tests with node v10 (#8782)
* Run all Azure tests with node v10

* Update job names

* Update CSS test
2019-09-18 11:42:59 -04:00
Joe Haddad
65358b7a33
Global CSS Support (#8710)
* Global CSS Support

* Fix webpack configuration

* oneOf rule isn't necessary yet

* Adjust CSS chunk naming

* Begin testing CSS behavior

* Add another test TODO

* Replace null-loader with ignore-loader

* Turn on chunks for new CSS feature

* Fix multi test suite

* Test CSS import order

* Test style HMR

* Test CSS compilation

* Test compilation and prefixing together

* Verify CSS styling works for Development and Production

* Add missing TODO

* Remove unnecessary test

* Adjust TODO message

* Hide page until React hydrates

* Revert "Hide page until React hydrates"

This reverts commit 898d4e0ee547b003d5790e2b11476740d645b907.

* Hide FOUC during development

* Test CSS imports

* Update tests TODO

* Add fixture for url() test

* Test `file-loader` support in CSS files

* Use a simple variant of cssnano

* Self-import

* Undo bundling

* Implement suggestion
2019-09-17 16:05:20 -04:00
JJ Kasper
4e9e51035e Match public files priority in dev (#8641)
* Match public files priority in dev

* Remove un-needed old public file handling

* Run public file priority test for non-dev also

* Make sure to enable publicDirectory

* Add checking for conflicting pages in dev and during build

* Add error for public dir middleware conflict

* Add err.sh for _next conflict

* Move up public dir conflict checking

* Only run _next conflict check in dev when path contains it
2019-09-16 23:06:30 +02:00
JJ Kasper
583b4677ae Prevent URL from being updated while asPath is delayed (#8756)
* Prevent updating URL when delaying asPath

* Ignore TypeScript not liking __NEXT_DATA__

* Update another global to fix standard check
2019-09-16 12:15:18 -04:00
Lukáš Huvar
7863b60ef6 Prettier fix (#8754) 2019-09-16 15:24:42 +02:00
JJ Kasper
fe7c7342c7 Add link to docs for prerender indicator and allow disabling (#8610)
* Add link to docs for prerender indicator and allow disabling

* Fix lint error from example

* Disable by default when electron is detected

* Add button to dismiss indicator for session

* Update disabling indicator in electron
2019-09-15 23:18:11 +02:00
JJ Kasper
ed5dc2107f Add autoExport to __NEXT_DATA__ (#8746)
* Add autoExport to __NEXT_DATA__

* Update render variable
2019-09-15 20:35:14 +02:00
JJ Kasper
b5d61579c8 Make sure to fail export when prerender fails with serverless bundle (#8738)
* Make sure to error on serverless prerender failure

* Add test case

* Update index.test.js
2019-09-13 19:02:15 -04:00
JJ Kasper
2139f66ac3 Add test for duplicate scripts and add extra de-duping (#8709) 2019-09-11 17:20:47 -04:00
Joe Haddad
55369051f5
Warn build on duplicate pages (#8646)
* Fail build on duplicate pages
This will fail the `next build` command when a duplicate page is found.
In development, we'll emit a warning instead of crashing the dev server.

* Add test for warning in development

* Only issue a warning

* Fix production test

* Fix development test

* Remove useless arg

* Warn in development, too
2019-09-11 14:26:10 -04:00
Joe Haddad
fcadad9960
TypeScript report on active pages only (#8703)
* TypeScript report on active pages only
The TypeScript integration needs to report on active pages only.
When inactive pages are reported, they block the compilation and prevent the user from fixing the error (because the file isn't watched).

We cannot add the file to the webpack watcher because the compilation has already been sealed.

* Remove TODO message

* Test that inactive pages are not type checked
2019-09-11 13:06:48 -04:00
JJ Kasper
a5ebe41a9a Delay updating asPath for auto exported pages (#8681)
* Delay updating asPath for auto exported pages

* Add additional test ensuring asPath is updated
2019-09-10 13:30:25 -04:00
Joe Haddad
79090718da
Test non-flag and re-runs of telemetry cmds (#8697) 2019-09-10 13:21:10 -04:00
Joe Haddad
4c6c9cc882
Add telemetry CLI tests (#8696)
* Add telemetry CLI tests

* Apply suggestions from code review

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

* Update index.test.js
2019-09-10 12:45:37 -04:00
Filip Wojciechowski
92e26ce1b1 better type for AppTree in NextPageContext (#8662)
* better type for AppTree in NextPageContext

* updated tests

* new AppTreeType type and updated tests

* removed a commented out line

* another take on the type of AppTree, with updated tests

* allow passing additional props to AppType

* Update suite name
2019-09-09 11:23:34 -05:00
JJ Kasper
e9ffb41462
Revert "Remove extra pages from export test" (#8658)
* Revert "Remove extra pages (#8651)"

This reverts commit 9546f9c3ac.

* Rename export error pages
2019-09-06 11:18:00 -05:00
Lukáš Huvar
9546f9c3ac Remove extra pages (#8651) 2019-09-06 13:05:38 +02:00
JJ Kasper
61b8b7323e Update workers for next export (#8623)
* Add failing test

* Add jest-worker to export
2019-09-04 19:56:11 -04: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
JJ Kasper
56501aeb82 Fix production test failing in ie11 (#8612) 2019-09-03 12:13:50 -04:00
JJ Kasper
fbf784d76f Add data-ampdevmode attribute for AMP scripts (#8524)
* Add data-ampdevmode attribute

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>
2019-09-03 11:11:22 -04:00
Joe Haddad
ffc205ba8c
Use URL-friendly chunk names (#8609)
* Use URL-friendly chunk names

* Fix example linting
2019-09-03 10:55:48 -04:00
Houssein Djirdeh
689b1319b6 Update performance marking (#8527)
* creates perf marks object constant

* updates clearmarks to only clear core marks

* adds test + fixes object constqnt reference

* hardcodes perf marks and removes constant

* adds test to check custom marks are not cleared
2019-08-30 22:40:05 -04:00
Joe Haddad
67e7753c85
Fix serverless chunking (#8569)
* Fix Serverless Chunking

* Remove old test & environment variable

* Update serverless trace test case
2019-08-30 07:26:30 -04:00
JJ Kasper
340594398e
Make sure to 404 for /_next/static (#8564) 2019-08-29 15:00:54 -05:00
JJ Kasper
5e4d7f2f27 Fix backslashes in stats causing tests to fail on windows (#8505) 2019-08-24 16:06:21 -04:00
Houssein Djirdeh
010059915d Add version property to Next.js instance (#8499)
* adds global for next version

* updates to use env variable and keeps it local

* Test Next.js version presence

* Unfocus test
2019-08-24 00:49:24 -04:00
JJ Kasper
1dbacda576
Remove extension from err.sh link (#8500)
* Remove extensions from err.sh link

* Remove .md from test also
2019-08-23 17:00:57 -05:00
JJ Kasper
674ba17211
Update prerender-manifest structure (#8497) 2019-08-23 16:17:40 -05:00
Alex Castle
3970a26b92 Tweaks and test for library chunks fixes (#8482)
* Adjust lib chunk naming algorithm and prevent duplicate react-dom

* Remove alias for react-dom and update separator replacement logic

* Add comment to webpack-config

* Add integration test for react-dom duplication

* Switch to using hash for lib chunk names

* remove extra file from PR

* Remove another extraneous change

* Remove test based on lib chunk name

* Update index.test.js
2019-08-23 10:28:48 -04:00
Joe Haddad
f890482871
Check for TypeScript files for auto setup (#8479)
* Check for TypeScript files for auto setup
This re-adds the behavior and only checks the `pages` directory for speed reasons.

* Adjust logic

* Handle not found too
2019-08-22 22:01:12 -04:00
JJ Kasper
56a134409c Debug TypeScript test suite (#8476)
* Tweak typescript test suite

* Revert "Tweak typescript test suite"

This reverts commit 9e0108da7c70e7ae45b412b60c07162383de65f3.

* Make sure HMR connection isn't being closed
while testing

* Update to not re-use NODE_ENV

* Break up/rework TypeScript test suite

* bump
2019-08-22 16:34:24 -04:00
JJ Kasper
bf11421992 Add deprecation warning for App Container (#8475)
* Add deprecation warning for App Container

* Apply suggestions from code review

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

* Tweak for more dead-code elimination
2019-08-22 16:19:15 -04:00
JJ Kasper
be850d0353
Add warning when empty object is returned from getInitialProps (#8474)
* Add warning when empty object is returned
from getInitialProps

* Apply suggestions from code review

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

* Apply suggestions from code review

Co-Authored-By: Jan Potoms <potoms.jan@gmail.com>
2019-08-22 12:06:30 -05:00
Ran Yitzhaki
c3b18fdeaa Fix a broken link in webpack config (#8456)
* Fix a broken link in webpack config

* Update test
2019-08-21 11:58:31 -04:00
JJ Kasper
9c8aaf9d4b Fix build-manifest not removing _app files for modern (#8447) 2019-08-20 15:32:03 -04:00
Jason Miller
8bd2e433de Initial optimizeLibraries experimental flag (#8345)
* Add experimental optimizeLibraries flag, currently prunes Moment.js locales

* expose moment for use in assertion

* try with the same setup as the production integration test

* Apply optimiztaions in dev and on server so they're consistent.

* fix build (oh dear)

* Update index.test.js

* Rename flag to future.excludeDefaultMomentLocales

* Adjust impl
2019-08-20 15:19:45 -04:00
Lukáš Huvar
f0b6d0a1e2 Fix custom page extension in development (#8446)
* Fix page extension in development

* Remove un-used file

* Fix standard
2019-08-20 13:38:30 -04:00