Commit graph

587 commits

Author SHA1 Message Date
Joe Haddad
cc4e57e7fc
Stabilize TypeScript HMR Test (#9562) 2019-11-27 14:38:01 -05:00
JJ Kasper
d9e8b8678f Simplify src-dir test suite (#9533) 2019-11-26 14:29:39 -05:00
Adam Stankiewicz
9c9f0609a0 Fix deduplicating dynamic (array) meta tags (#9315) 2019-11-26 12:27:33 -05:00
JJ Kasper
cd8e72d5e3 Add custom routes to build output (#9517)
* Add custom routes to build output

* De-dupe code a bit
2019-11-26 10:33:47 +01:00
Janicklas Ralph
04a7f1e85d Replace url polyfill with self.URL (#9200)
* 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
2019-11-25 23:10:02 -05:00
Joe Haddad
302407486e
Specify Invalid Dynamic Route Values (#9525) 2019-11-25 17:15:23 -05:00
Joe Haddad
4656f52d15
CSS Support Customization (#9502)
* CSS Support Customization

* Sort imports

* Correct PostCSS plugin loading

* Add css customization test

* Test "bad" css configuration

* Add load config test

* adjust spacing

* adjust spacing 2x

* Only allow config through JSON

* Support excluding false plugins

* Test tailwind css behavior

* Test plugin exclusion

* Fix unit test

* Fix config file

* Remove more variants

* Update test cases
2019-11-25 16:52:29 -05:00
JJ Kasper
409f20a9ca
Fix AMP HTML content emit (#9468)
* Add failing test

* Escape dollar signs in AMP HTML

* Update to not use replace for updating AMP_RENDER_TARGET
2019-11-25 14:05:52 -06:00
JJ Kasper
b058427b76 Update CI/test set up (#9499)
* Disable concurrency for tests

* Add browser instance sharing

* Bump concurrency and install chromedriver smoother

* Fix config typo

* Fix local test

* Limit azure concurrency again

* Add delay for empty-object-test

* Make sure to use open port for chromedriver

* Move browser closing to jest-environment

* Re-enable concurrency for Azure

* bump

* Disable concurrency for Azure again

* Re-enable concurrency for Azure

* bump
2019-11-25 13:19:45 -05:00
JJ Kasper
ff2d28c4ff Add err.sh for invalid multi-match usage (#9498)
* Adds err.sh for multi-match error

* Fix missing apostrophe

* Update regex to catch other param names

* Add test for multi-match error

* Update test/integration/invalid-multi-match/test/index.test.js
2019-11-23 02:23:01 +01:00
Joe Haddad
8a087d50b7
next export should skip iSSG fallback page (#9491)
* `next export` should skip iSSG fallback page

* Move config to correct place
2019-11-21 20:20:19 -05:00
Joe Haddad
8e7ddeb6ca
Ensure CSS Is Preloaded First (#9486)
* Ensure CSS Is Preloaded First

* add test polyfills
2019-11-21 13:24:10 -05:00
Joe Haddad
7ff9595100 Error on Size Reduction (#9485) 2019-11-21 10:14:29 -06:00
Joe Haddad
61f4e70135
Upgrade Babel Dependencies (#9478)
* Upgrade Babel Dependencies

* Update test for new size
2019-11-20 21:53:12 -05:00
JJ Kasper
29d267a1dc
Add handling for rewriting to /_next with catchall (#9466)
* Add handling for rewriting to /_next with catchall

* bump
2019-11-20 09:53:31 -06:00
JJ Kasper
792f2f8ce3 Add test for forward nav after reload (#9452) 2019-11-18 21:39:03 -05:00
Tim Neutkens
6a2c16a945
Update router to have only one route traverse pass (#9435)
* Fix next-news inconsistent return type

* Add failing test for static file rewrite

* Revert "Fix next-news inconsistent return type"

This reverts commit b66e76fb86061e45741c3c4bb9296a0874900f76.

* Add failing test for double redirect

* Fix bug in matcher when having multiple redirects

* Remove custom traversal in favor of router handling it

* Update next-server.ts

* Update router.ts

* Temporarily disable test

* Don't deeply resolve redirects

* Support combined parameters + query passing

* Make sure params are correctly passed in

* Add test for hash in route
2019-11-17 16:12:48 -08:00
JJ Kasper
09cab2df5e Fix typo in serverless loader (#9431)
* Fix typo in serverless loader

* Add test for top level error in API route

* Fix type error
2019-11-15 18:00:24 -08:00
Joe Haddad
2f16a860f2
Adjust Client Nav Test (#9422)
This adjusts a test added in #8960 to render the correct page.
2019-11-15 09:08:33 -08:00
Joe Haddad
d90c853111
Clean up old flag (#9421) 2019-11-14 23:48:12 -08:00
Joe Haddad
ba5e6943fa
[Experimental] Catch-all Route Support (#9416)
* Catch-all Route Support

* Add SSR tests

* Add additional test

* Add unit tests

* Put the feature behind a flag

* Apply suggestions from code review

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

* Fix test
2019-11-14 23:19:41 -08:00
Janicklas Ralph
332852bf01 Integration test case for fetch alias (#9391)
* Polyfilling fetch and object-assign

* Polyfilling corejs object-assign

* Adding object-assign in polyfills.js. IE11 does not support Object.assign

* Fixing failing test

* Updating object.assign polyfill to fix aliasing

* Updating test case value to match new build stats

* Increasing the size of default build to 225kb

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

* Revert README.md

* Re-design the polyfill approach based on PR feedback

* Adding comment and fixing test case

* Rename polyfills chunk

* Extract aliases into helper

* Remove extra new line

* Fix TypeScript typings

* Adding _internal_fetch alias

* Adjust build manifest plugin

* Build manifest plugin changes - adding a separate entry for polyfills

* Rename polyfills entry in build-manifest.json

* Remove old comment

* Fix TS

* Set key

* Polyfills already added

* Filtring polyfill.module.js

* Fix test

* Add __internal_fetch to alias rule

* Adjust name

* bump size

* ignore polyfills

* sigh

* Aliasing Object.assign

* Mergin latest changes

* Integration test for polyfilling fetch

* Remove comment

* Fix prettier error

* Fix review comments

* Fix review comments

* Update fetch.js

* Fix tests
2019-11-14 22:47:08 -08:00
JJ Kasper
e28de80d6c Fix up errors in tests (#9407)
* Fix up errors in tests

* Fix test

* Apply suggestions from code review

* Update require-page.test.js

* Update require-page.test.js
2019-11-13 14:18:06 -08:00
Joe Haddad
803659a83e
Test static folder (#9395)
* Test for infinite loop

* remove focus
2019-11-12 21:00:51 -08:00
JJ Kasper
8dd8fb8f2a Add test for internal url handling in render (#9396) 2019-11-12 19:52:58 -08:00
Joe Haddad
6387d9b5bc
Fix Dynamic next export Page Hydration Mismatch (#9388)
* Fix `next export` Hydration Mismatch

* Lower timeout to 1 minute
2019-11-12 18:34:12 -08:00
JJ Kasper
154d78461c Replace historyId with initial page tracking (#9380)
* Replace historyId with initial page tracking

* Apply suggestions from code review

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

* Apply suggestions from code review
2019-11-12 13:37:47 -08:00
Joe Haddad
00badd4d58
Initialize Git repo on app creation (#9376)
* Initialize Git repo on app creation
This PR initializes a Git repository after Create Next App runs.

We ensure the app was not created in an already-existing Git or Mercurial repo.

Failures of setup (no Git installed) do not fail the application bootstrapping.

Closes #9077 (replaces)

* Add test

* Update index.test.js
2019-11-10 21:42:51 -08:00
Joe Haddad
18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00
JJ Kasper
b6af38d235 Add routes-manifest test (#9365) 2019-11-09 23:02:07 -08:00
Joe Haddad
64a9ae9142
Test CJS Import of isomorphic-unfetch (#9363) 2019-11-09 21:35:46 -08:00
JJ Kasper
4e3b5ae20c
Update routes-manifest and add tests (#9361)
* Test custom-routes serverless

* Make sure we add default statusCode to routes-manifest

* Update routes-manifest

* Add DEFAULT_REDIRECT_STATUS constant
2019-11-09 20:00:54 -08:00
JJ Kasper
d19e825daa Implement custom routes RFC (#9157)
* add initial custom-routes handling

* Add tests for custom-routes

* Handle chained redirects, separate dev custom
routes reading, and add version to routes manifest

* Handle no routes manifest

* Swap build custom routes calling

* Add flatten-routes

* Add flattening of custom routes

* Re-work implementation to follow routes top-down

* Add regex field to routes-manifest

* Fix path-to-regexp match breaking after upgrade

* Fix duplicate const from merge

* Add some changes from review

* Don't make path-match strict

* add default custom route values

* Update routes-manifest

* Update options for path-match

* Remove todo

* Add test for rewrite with params

* Only use strict mode for custom routes

* Update dynamic-routing test

* Move getCustomRoutes to prepare

* Remove extra change

* Update handling for error-in-error test

* Apply suggestions from code review

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

* Apply suggestions from review

* Update slice change

* Apply suggestions from code review

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

* Apply suggestions from review

* Fix TypeScript error

* Fix getCustomRoutes in dev mode

* Apply suggestions from code review

* Update slice

* Apply suggestions from code review

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

* Delete un-used test page

* Add test for param overwriting

* Apply suggestions from code review

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

* Add extra check to param test
2019-11-09 14:34:52 -08:00
JJ Kasper
820a9790ba Add a routes manifest with the dynamic routes (#9347)
* Add a routes manifest with the dynamic routes

* Update to use pageKeys for windows compat

* Update routes-manifest test
2019-11-08 16:51:19 -08:00
JJ Kasper
354de28422 Only add static files route if folder exists (#9305)
* Only add static files route if folder exists

* Remove extra import
2019-11-05 06:55:35 +01:00
Joe Haddad
bbf705f262
Simplify Build Output (#9281)
* Simplify Build Output

* Remove noop tests

* Drop 

* Remove bolding
2019-11-04 11:14:04 -05:00
Tim Neutkens
21f0db8181 Call getInitialProps on Component when it’s not defined on App (#9287)
Fixes #9284
2019-11-02 11:00:55 -04:00
Janicklas Ralph
ff2d3fd87d Polyfill window.fetch by Default (#9168)
* Polyfilling fetch and object-assign

* Polyfilling corejs object-assign

* Adding object-assign in polyfills.js. IE11 does not support Object.assign

* Fixing failing test

* Updating object.assign polyfill to fix aliasing

* Updating test case value to match new build stats

* Increasing the size of default build to 225kb

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

* Revert README.md

* Re-design the polyfill approach based on PR feedback

* Adding comment and fixing test case

* Rename polyfills chunk

* Extract aliases into helper

* Remove extra new line

* Fix TypeScript typings

* Adding _internal_fetch alias

* Adjust build manifest plugin

* Build manifest plugin changes - adding a separate entry for polyfills

* Rename polyfills entry in build-manifest.json

* Remove old comment

* Fix TS

* Set key

* Polyfills already added

* Filtring polyfill.module.js

* Fix test

* Add __internal_fetch to alias rule

* Adjust name

* bump size

* ignore polyfills

* sigh
2019-11-01 21:00:56 -04:00
Joe Haddad
aef927d576
Disallow iSSG revalidation period of zero (#9280)
* Disallow iSSG revalidation period of zero

* Fix revalidation period in test
2019-11-01 15:38:02 -04:00
Tim Neutkens
7c80febcf7 Initial plugins implementation (#9139)
* Add initial bit for plugins

* Add checks for needed metadata values

* Add test

* Initial plugins changes

* Add handling for _app middleware

* Add loading of _document middleware and
handling of multiple default export syntaxes

* Fix insert order for middleware member expression

* Remove early return from middleware plugin from testing

* Add tests for current plugin middlewares

* Update test plugin package.json

* Update handling for class default export

* Update to use webpack loader instead of babel
plugin, remove redundant middleware naming, and add field for required env for plugins

* Add middleware to support material-ui use case
and example material-ui plugin

* Update tests and remove tests stuff from google analytics plugin

* Remove old plugin suite

* Add init-server middleware

* Exit hard without stack trace when error in collecting plugins

* Add on-error-client and on-error-server and update
to run init-server with next-start in serverless mode

* Update init-client for google analytics plugin

* Add example Sentry plugin and update with-sentry-simple

* Remove middleware field/folder and use src dir for plugins

* Add post-hydration middleware and update
material-ui plugin

* Put plugins code behind flag

* Update chromedriver

* Revert "Update chromedriver"

This reverts commit 1461e978e677f7da05e29e0415ec614a04bf65f9.

* Update lock file

* Remove un-needed _app for sentry example

* Add auto loading of scoped packages, add plugins
config for manually listing plugins, and update
to only collect plugins once

* Update example plugins

* Expose plugins' config

* Rename plugin lifecycles and add babel-preset-build

* Rename other methods with unstable

* Update log when plugin config overrides auto-detecting
2019-11-01 14:13:13 -05:00
JJ Kasper
b320f5bd59 Add handling for exportTrailingSlash for iSSG pages (#9258)
* Add handling for exportTrailingSlash for iSSG pages

* Update index.test.js
2019-10-31 16:26:47 -04:00
JJ Kasper
aafbd53cbf Remove dead code elimination for when iSSG isn't used (#9267)
* Don't rely on page-config plugin to detect iSSG usage

* Make sure to only update sprStatus if page file

* Remove dead-code elimination for iSSG code

* Revert next-page-config.ts

* Update index.js

* Update index.test.js
2019-10-31 16:07:35 -04:00
JJ Kasper
f16f868ea1
Make sure to handle paths with dot in name for SPR (#9227) 2019-10-30 11:29:23 -05:00
Joe Haddad
6b54e9ed66 Fix Prettier Commit Hook (#9245)
* Apply format to webpack config

* hit all files
2019-10-30 12:35:51 +01:00
Joe Haddad
636be2466e
Add test for #8924 (#9243)
This adds a test for PR #8924.
2019-10-30 00:01:56 -04:00
Janicklas Ralph
d3293f7cd6 Dynamic granular chunking (#9090)
* Enable granular chunks config for all chunk types

Adding comment

Bug fix

* Update index.test.js

* Update index.test.js

* Fix test cases. Adding next/link to not trigger a different bug

* Removing obsolete comment
2019-10-29 21:27:41 -04:00
Christoph Tavan
14ed867537 Disable worker_threads by default for firebase compatibility (#9199)
* Pass config.experimental.cpus to export during build

Currently, there is no way of specifying the number of worker threads of
`next export` when run as part of `next build`.

I suggest a sane default should be to just use the same amount of
workers that were used during the build process which currently seems to
be configured through `config.experimental.cpus`.

This setting is already respected in the two other places where
jest-workers are in use: The TerserPlugin and the staticCheckWorkers in
`next build`.

* Only enable worker threads if there is more than 1 worker

Multiple worker threads can cause problems when certain dependencies are
being used, see e.g. https://github.com/zeit/next.js/issues/7894

This patch allows disabling of worker threads by setting
`config.experimental.cpus = 1`.

The benefit of spawning 1 worker thread, if there is any at all, should
very limited anyways, so the workload can just as well be processed in
the main thread.

* Disable parallel build for firebase authentication example

* Add integration test to cover #7894

* Rename test suite and add worker_threads config

* Disable worker_threads by default

* Update index.test.js

* Use workerThreads config for TerserPlugin

* Update to use workerThreads config in
TerserPlugin for consistency

* Disable node 12 specific test
2019-10-28 20:01:24 -04:00
Alexander Kachkaev
ad2a3d65fd Add configuration flags to disable integrated type checker (#9138)
* Add a configuration flag to disable integrated type checker

* Add tests for typescript-transpileonly

* Restore removed argument

* Make output more coherent

* Split transpileOnly into ignoreDevErrors and ignoreBuildErrors

* Minor stylistic change
2019-10-28 11:02:03 -07:00
JJ Kasper
2d9f199105 Add warning for getStaticParams without getStaticProps (#9226)
* Add warning for getStaticParams without getStaticProps

* Throw error instead of logging to make sure it's noticed

* Lower default concurrency for tests
2019-10-28 10:24:29 -07:00
Jan Potoms
ab0a8647dc API: Take multiple values into account for the query (#9196)
* Take multiple values into account

* make typescript happy
2019-10-26 20:10:06 +02:00