Commit graph

4443 commits

Author SHA1 Message Date
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
Joe Haddad
683903785a
Require Node 8.10 (#9278) 2019-11-01 13:43:29 -04:00
Joe Haddad
1a436535ce
v9.1.3-canary.1 2019-10-31 16:28:00 -04: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
Martin Grubinger
81066a396c Fix example active-class-anme: Add support for children of ActiveLink without a className. (#9271)
* Fix example active-class-anme: Add support for children of ActiveLink without a className.

* Update examples/active-class-name/components/ActiveLink.js

Co-Authored-By: Luis Alvarez D. <luis@zeit.co>
2019-10-31 14:05:12 -05:00
Tim Neutkens
37ee8fc9e7 Update _app documentation to reflect no longer needing next/app (#9268)
* Update _app documentation to reflect no longer needing next/app

* Remove lint-staged
2019-10-31 10:53:55 -04:00
Henrik Wenz
e09eb8d415 Update with-apollo-and-redux example (#9270)
close #8830
2019-10-31 10:40:34 -04:00
Petra Jaros
1e9407459d Fix import next from "next" (#9216) 2019-10-31 13:20:05 +01:00
JJ Kasper
fa5fb97ce8 Make sure to pipe output from staticCheckWorkers (#9256) 2019-10-31 12:38:09 +01:00
Jason Miller
c966900768 Bugfix/Performance: Start the modern child compiler earlier (#9257)
* Start the modern Child Compiler earlier during builds

* fix child compiler errors not bubbling
2019-10-31 12:37:07 +01:00
Joe Haddad
c2a2417e0c
v9.1.3-canary.0 2019-10-30 13:50:18 -04:00
JJ Kasper
cbb846bed6 Update default chromedriver version (#9252) 2019-10-30 12:51:36 -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
Ilya
8dd394a055 Load granular chunks with correct asset prefix (#8993)
* closes #8989

fix

closes #8989

* test

* Update next.config.js

* Revert page1.js

* Revert page2.js

* Delete page4.js

* Delete page3.js

* Update index.test.js

* Revert index.test.js

* Revert next.config.js
2019-10-30 10:25:11 -04:00
Gerald Monaco
f632567bcf Add experimental config for React Mode (#9207)
* Add experimental config for React Mode

* Use latest types

* Use latest types
2019-10-30 09:39:58 -04:00
Tim Neutkens
4c6e294ca2 Add experimental example of next-news (#9249)
* Add next-news example

* Update components

* Use getStaticProps

* Move directory
2019-10-30 09:05:45 -04:00
sagar talla
6707909690 Error when user tries to use uncompiled next.config.ts (#9223)
* Throw Error for next.config.ts

Ref: https://github.com/zeit/next-plugins/issues/555

* Check for .js else .ts

* Update Error Message

Co-Authored-By: Alexander Kachkaev <alexander@kachkaev.ru>

* Add test case when both next.config.js and next.config.ts exist.

* Remove extra constant CONFIG_FILE_TS and Add check for ts/tsx/json

* Rename test config parameter and add tsx and json files

* Change messege

* change value

* Update next.config.json

* Update next.config.json

* Change message  and add jsx filter

* Adjust

* Simplify test

* adjust
2019-10-30 08:18:33 -04: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
Jan Karres
3b3d20f729 Check if 'formatAmpMessages' returns a none empty string in Next.js build process (#8924) 2019-10-29 23:49:40 -04:00
Jason Miller
5f203b8342 Improve serverless build performance (#9155)
* Improve serverless build performance

Next's serverless build uses a custom resolver, injected the via Webpack's `externals` option that delegates out to `resolve-request` to more aggressively pull node modules into the serverless bundles.

When profiling a large Next.js application, I noticed an excessive number of filesystem calls near the end of the build. I narrowed this down to the serverless compiler pass, and eventually the custom resolver function that is the subject of this PR.  As it turns out, around half of the calls to the `externals` custom resolver function are for a `request` path that is a relative import. Next doesn't have any specific logic to apply to relative imports - it only needs to special-case bare module resolution.

Adding a simple bypass for relative module resolution reduces the number of blocking filesystem-bound `resolveRequest()` calls by 50% on a certain well-known Next.js website. This also results in a 30% reduction in production build times for incremental builds.

* Explain more in the comment
2019-10-29 23:36:22 -04:00
Nate Moore
61a9cfb317 Add Framer Motion example (#9185)
* Add example for Framer Motion

* Prevent scroll on route change

* Replace hook with more robust useId hook

* Improve scroll behavior

* Remove custom hook in favor of gitInitialProps

* Update framer-motion, react

* Update readme

* Fix lint errors
2019-10-29 23:21:03 -04:00
Christoph Tavan
17d7544f45 Remove concurrency option from next export (#9197)
Usage of this option was removed in
61b8b7323e but the cli was not updated.
2019-10-29 23:07:42 -04:00
JJ Kasper
c4bef164ce Add unique identifier to router instance (#9015)
* Update to use a historyId to track invalid popstates

* Remove log from debugging

* Use Math.random instead of Date.getTime to avoid mocks
2019-10-29 22:50:16 -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
Nataliya Karatkova
a25085f37e Update static export example: clean up an extra query param (#9239) 2019-10-29 16:36:04 -05:00
Joe Haddad
acf7d0ad3b
v9.1.2 2019-10-29 16:56:45 -04:00
Nataliya Karatkova
07b46d7f9a Update examples: static export using dynamic routes instead exp… (#9237) 2019-10-29 17:17:48 +01:00
Joe Haddad
cb7a184cd9
v9.1.2-canary.10 2019-10-29 11:14:39 -04:00
Juan Miguel
d40f010df3 Delete _document.js (#9236)
After https://github.com/zeit/next.js/pull/5887, _document.js file is not needed anymore
2019-10-29 15:36:18 +01:00
Joe Haddad
4dbd267c6a
Split TypeScript Flag Docs (#9231)
* Split TypeScript Flag Docs

* reword
2019-10-28 22:44:10 -04:00
JJ Kasper
f5969d29a6 Restore package.json and yarn.lock to allow deploy (#9230) 2019-10-28 21:57:49 -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
Joe Haddad
34e0ce6f05
Remove react-ssr-prepass from Next Deps (#9224) 2019-10-28 06:49:07 -07:00
Nataliya Karatkova
4584ea47f6 Fix examples #9064: bumps next-redux-wrapper package version that contains babel runtime fix (#9214) 2019-10-27 22:31:39 +01:00
Brandon Bayer
1c11ffd1f7 Fix react-native-web example by adding babel plugin (#9078)
* fix react-native-web example by adding babel plugin

* changes
2019-10-27 11:52:52 +01: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
Tim Neutkens
20978af0b0 v9.1.2-canary.9 2019-10-26 19:44:44 +02:00
htbvo
211c84e1c9 allow NextScript to optionally defer javascript (#8980)
* allow NextScript to optionally defer javascript

* move defer options to experimental feature

* combine defer flags into a single option

* Update deferScripts to work with serverless target

* Add test for defer and async property

* Read the async property

* Check versions of chrome and chromedriver

* Update to chromedriver 76

* Fix test
2019-10-26 19:27:22 +02:00
LadiesMan217
94e81c02b9 Update with-react-intl example (#9180) 2019-10-26 16:11:30 +02:00
Tim Neutkens
2fcff3de49
Update Babel dependencies (#9203)
* Update Babel dependencies

* Update sizes
2019-10-26 15:59:15 +02:00
Christoph Tavan
e506c41e8c Ensure that all <link> elements have a key prop (#9204)
Before this patch users would see the following warning during initial
compilation:

```
Warning: Each child in a list should have a unique "key" prop. See https://fb.me/react-warning-keys for more information.
    in link
    in Head
    in html
    in Html
    in Document
    in Context.Provider
    in Context.Provider
```
2019-10-26 14:46:17 +02:00
Gerald Monaco
4421448f03 Add StrictMode toggle (#9161)
* Add StrictMode toggle

* Rename option to reactStrictMode

* Default to false initially
2019-10-26 00:20:38 +02:00
JJ Kasper
be42300e1f Ensure directory before flushing cache file (#9187)
* Ensure directory before flushing cache iSSG file

* Add test for prerender cache flush

* Nest the dynamic route test one more level

* update fetch for test

* Update error check
2019-10-25 13:56:00 -07:00
Jason Dreyzehner
a964dc825e update with-mdx example to latest packages (#9186) 2019-10-24 08:52:30 +02:00
Miguel Ángel Durán
8227baf42c docs(api-routes): fix micro-cors example (#9184)
The correct option to use with `micro-cors` package is `allowMethods` instead `allowedMethods`. This PR fixes the example.
2019-10-23 17:14:51 -04:00
Joe Haddad
e42fdd824a
Reenable AMP Tests (#9162) 2019-10-23 16:05:57 -04:00