1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
Commit graph

224 commits

Author SHA1 Message Date
Tim Neutkens f01457e8fc
Take full advantage of caching between builds (#5597)
Takes advantage of caching between builds for Terser, also makes writing caches for babel-loader faster by disabling compression.

Results for zeit.co (350 pages):

Without cache:
[4:16:22 PM] Compiled server in 1m
[4:16:57 PM] Compiled client in 2m
  Done in 125.83s.

With cache:
[4:19:38 PM] Compiled client in 17s
[4:19:50 PM] Compiled server in 29s
  Done in 31.79s.

Note: these results are from my multi-core Macbook Pro 2017, exact specs:
MacBook Pro (13-inch, 2017, Four Thunderbolt 3 Ports)
- 3,3 GHz Intel Core i5
- 16 GB 2133 MHz LPDDR3
- Intel Iris Plus Graphics 650 1536 MB

The `without cache` build runs uglify in parallel, so without cache is likely to take longer on environments where you have only 1 core available.

The `with cache` build however runs in a single thread, so the results should be similar.
2018-11-05 17:51:56 +01:00
Tim Neutkens 54b9df535d
Handle decoding errors correctly (#5589)
Fixes #4887
Fixes #3612

Also removes http-errors dependency from next-server, leaving a smaller install size
2018-11-04 01:22:33 +01:00
Corentin.Andre 1496ad6299 fix: update correct path to use when exporting 404 page (#5470)
When exporting error page, next defaults it to 404/index.html which is not recognized as a default 404 page.

This should fix https://github.com/zeit/next.js/issues/5035
2018-11-03 01:19:41 +01:00
Ben James 1770efad63 Fix typo in router error message (#5515)
Tiny typo fix 🙂
2018-10-26 19:28:10 +02:00
Henrik Wenz d40f27239a Add size-limit test (#5339) 2018-10-20 17:03:19 +02:00
Henrik Wenz 18488f47b0 Fix linter (#5350)
* Fix linter

* Add test env

* Fix lint errors
2018-10-20 17:00:01 +02:00
Henrik Wenz 95a6a872b6 Refactor test setup (#5391)
- [x] Move jest config from npm scripts to `jest.config.js`
- [x] Remove obsolete cross-env package (we don't need it anymore 🎉)
- [x] Fix bug where tests are not waiting for webdriver to be ready.
2018-10-12 15:32:17 +02:00
Tim Neutkens 965f50beb2
Remove pathname (#5424) 2018-10-10 21:58:15 +02:00
Henrik Wenz ef01f13e5d Improve test setup (#5388)
* Update jest

* Let jest start chromedriver

This makes sure chromedriver always ends even if the test was canceled by the user.

* Properly close browser in production-config test

* Properly close browser in production/security test

* Properly close browser in export test

* Properly close browser in app-aspath test

* Remove taskr from project root

This isn’t needed anymore

* Readd taskr to project root (temporary)

* Improve global setup/teardown

* Properly close browser in basic/client-navigation test

Clicking an target=_blank link will open a second browser window. We can only close this by using broser.quit()
2018-10-07 15:04:43 +02:00
Andy b041fa4782 Support for wasm (#5316)
* Set a default path for wasm modules

* Added the mimetype "application/wasm" for wasm files

* Upgrade write-file-webpack-plugin to 4.4.1

* Made dynamic(import()) in test to dynamic(() => import())
2018-10-02 13:10:07 +02:00
Tim Neutkens 82d56e063a
next-server (#5357) 2018-10-02 00:55:31 +02:00
Tim Neutkens 3d94ae0a7d
Drop prepare requirement from production server (#5351)
As prepare is only needed to boot up the hot reloader + exportPathMap routes in development, it's not longer a requirement in the production server.
2018-10-01 16:31:47 +02:00
Tim Neutkens b1c4f3aec4
Monorepo (#5341)
- Implements Lerna
- Moves all source code into `packages/next`
- Keeps integration tests in the root directory
2018-10-01 01:02:10 +02:00
Tim Neutkens 1c328a8450
Make sure dynamicIds are added when using function as importer (#5308) 2018-09-27 16:40:54 +02:00
Tim Neutkens 6e4f0d8e70
Use getBrowserBodyText for HMR test (#5290) 2018-09-26 01:41:39 +02:00
Tim Neutkens db216e0086
Even more reliable error-recovery tests (#5284) 2018-09-26 01:04:15 +02:00
Tim Neutkens 139bc40fb5
More reliable error-recovery tests (#5281)
As they were failing intermittently, this PR tries to solve that.
2018-09-25 16:54:03 +02:00
Tim Neutkens 42736c061a
Introduce dynamic(() => import()) (#5249)
* Add failing tests

* Upgrade wd module

* Pass dynamic import webpack ids to the client side

* Pass through webpack ids to initalializer and only use those

* Compile dynamic(import()) to dynamic(() => import())

* Default dynamicIds

* Use forked hard-source-plugin

* Possibly fix test

* Make tests fail less intermittently

* Temporarily disable hard-source in production

* Make sure dynamic import chunks are unique

* Disable hard-source

* Log html if error is thrown

* Fix test
2018-09-25 15:27:09 +02:00
Henrik Wenz 7ebcc5bec9 Eliminate context code based on process.browser (#5159)
* Allow deadCodeElemination when using process.browser

* Add process.browser test
2018-09-23 16:02:28 +02:00
Tim Neutkens 3dae7cf9a6 Fix test intermittently failing 2018-09-16 18:05:36 +02:00
Henrik Wenz 34cb05a860 Remove obsolete webpack plugins (#5158)
Since we are now using webpacks `mode` flag we can get rid of:

* `webpack.optimize.ModuleConcatenationPlugin`
* `webpack.DefinePlugin` (`process.env.NODE_ENV`)

https://webpack.js.org/concepts/mode/
2018-09-14 15:45:48 +02:00
Lin Qiu 3f650e1549 Update 404 static cache header to not cache (#5146) 2018-09-12 14:44:15 +02:00
Tim Neutkens 873ac5dba8 Add test for cache-control in development 2018-09-12 14:42:50 +02:00
Tim Neutkens 3582496913
Trigger page register when module is executed (#5115)
Solves inconsistent loading issues when one bundle is loaded faster than the other

Fixes zeit/next-plugins#244
Fixes #4997
Fixes #4620
2018-09-11 20:03:20 +02:00
Tim Neutkens 3ece48b603
Make exportPathMap / _next routes work with useFileSystemPublicRoutes disabled (#5131)
* Add test for /_next/development route

* Make sure useFileSystemPublicRoute: false only disables filesystem routing

* Bring back comment

* Add useFileSystemPublicRoutes tests
2018-09-09 22:32:23 +02:00
Tim Neutkens 8d304ed7ef
Make non-existent routes under /_next return 404 (#5120)
Fixes #5114

Also adds a test for it.
2018-09-07 14:38:01 +02:00
Tim Neutkens 625288796f
Move next export into it's own directory (#5084)
* Rename static to export in integration tests

* Move export functionality into it’s own directory

* Fix path
2018-09-04 11:21:00 +02:00
Tim Neutkens b97fc82aa1
Use preset-react's development option + enable modules transform in test env (#5081)
## Minor changes

When `NODE_ENV=test` is used we'll now apply the `'auto'` configuration for modules transformation. Which causes Babel to check if the current environment needs to be transformed or not. In practice this means that the following `.babelrc` is not needed anymore:

**OLD**:

```json
{
  "env": {
    "development": {
      "presets": ["next/babel"]
    },
    "production": {
      "presets": ["next/babel"]
    },
    "test": {
      "presets": [["next/babel", { "preset-env": { "modules": "commonjs" } }]]
    }
  }
}
```

**NEW**:

```
{
  "presets": ["next/babel"]
}
```

## Patches

`@babel/preset-react` has a `development` option that automatically applies a development-time plugin we manually applied before (`@babel/plugin-transform-react-jsx-source`). It also adds another development-time plugin that is said to make debugging/errors clearer: `@babel/plugin-transform-react-jsx-self` which we didn't apply before. Overall this means we can take advantage of preset-react to provide these plugins.
2018-09-03 16:41:52 +02:00
George Pantazis 56ad5121a1 Use as instead of url to determine URL newness (#4153)
Currently, using `as` will cause the router to think the URL is not changing in the case where you're re-rendering the same page with a different route. This would most likely be an issue for custom servers
which are using shallow routing.

This should be an invisible change for non-custom-server users, since `as` is defaulted to `url` if not set.

This should resolve #3065.
2018-09-03 15:26:34 +02:00
Bertrand Marron 2eeebacb4c Keep chunks filenames in production mode (#5029)
* Keep chunks filenames in production mode

* Add test for new `[name]` behavior

* Rename static/dll to static/development/dll
2018-09-03 01:40:21 +02:00
Tim Neutkens a0aaa933de
Apply sideEffect at DidMount on the client side (#5068)
Fixes #5038

The problem with `constructor` is that it doesn't have `context` yet when being called. It's also considered unsafe to add a side-effect on constructor except when server-rendering
2018-09-02 19:18:20 +02:00
Tim Neutkens 33067a5862
Fix inconsistency in dynamic tests (#5071) 2018-09-02 17:22:29 +02:00
Kyle Holmberg b7fe234005 404 routing for static export without exportPathMap (#5036)
Resolves #5035 

Thanks a billion to @timneutkens for holding my hand
2018-08-27 12:28:54 +02:00
Tim Neutkens dfafad488a
Remove UNSAFE_ lifecycles from tests (#5031)
* Remove UNSAFE_componentWillMount

* Remove UNSAFE_componentWillReceiveProps from lifecycle
2018-08-25 20:09:20 +02:00
Michael Fix 9532cc1256 Remove old UNSAFE_ lifecycle methods (#5020)
~I am not sure if this is a valid fix yet, but I was going to let CI run the tests for me. I'll close and look into it if the build fails.~

Let me know if this will cause issues, but I don't think it should. The React docs recommends moving `componentWillMount` logic into the constructor
2018-08-25 17:26:11 +02:00
HaNdTriX 4c6ec18d89
Remove dublicate className from head (followup) (#5027)
* Add test of default head.

* Remove duplicate next-head (followup #5026)
2018-08-25 10:00:57 +02:00
HaNdTriX 11816537c3 Open editor from error-overlay (minor) (#4979)
This PR adds links to the [react-error-overlay](https://www.npmjs.com/package/react-error-overlay).
This allows a developer to open a stack trace in its own editor.

![codelinking](https://user-images.githubusercontent.com/1265681/44278860-a63e0a80-a24f-11e8-9c69-c5365c026c58.gif)

Closes #4813
2018-08-24 16:30:41 +02:00
Tim Neutkens 0dd2b2aa74
Add warning for broken popstate (#5000)
* Add warning for undefined url and as coming from popstate

* Use consistent url

* Fix err.sh link in test

* Rename `inital` => `initial`
2018-08-24 12:30:27 +02:00
Tim Neutkens bd5ee26841
Scroll to name when hash is provided (#5019)
Fixes #5008 

Apparently, browser behavior is to scroll to `name="something"` too.
2018-08-23 20:20:45 +02:00
Tim Neutkens b7e256ba01
Make onClick Link tests more consistent (#4954) 2018-08-15 12:42:56 -07:00
ǝlzlǝoq lǝᴉuɐp ツ 87f5df2454 Factor out NextScript inline source (#4934) (#4939)
This PR factors out the inline script into an own static method; fixes #4934.
2018-08-14 11:05:25 -07:00
HaNdTriX 4d8e9cacdd Improve getDisplayName util (#4944)
- [x] Add unit test
- [x] Allow to get the display name of a native component (e.g.: `div`) without throwing
- [ ] Remove displayName in production mode
2018-08-13 11:03:59 -07:00
Gary Meehan 0f4e9feafa Allow Duplicate Open Graph Image Tags (#4851)
* allow og:image duplicates

* add tests

* update tests

* fix spacing
2018-08-12 12:51:17 -07:00
Olivier Tassinari b02fff63d0 Fix broken hash scroll logic (#4766)
`<Container>` does not receive any property. There is no way the *scrollToHash* logic can work right now. I believe it's a regression. It was working fine at some point. I'm sorry, I'm too lazy to add a test.

This fix was tested on Material-UI 👌.

This bug reproduction is the following:
As soon as you want to transition to a new page with a hash. The scroll doesn't change.
- start on pageA
- you scrollTop to 100
- you move to pageB#hash
- you stay at scrollTop 100, but #hash is at scrollTop 400.
2018-08-11 13:04:16 -07:00
HaNdTriX d1b67623f6 Throw error if getInitialProps is defined as as instance method (#4922)
* Throw error if getInitialProps is defined as as instance method

Omitting the static keyword happens pretty often. Therefore we should trigger a warning in devmode.

Closes: #4782

* Document getInitialProps error

* Add unit tests for loadGetInitialProps
2018-08-09 10:13:44 -07:00
Tim Neutkens f3f939dde4
Run method sorting codemod (#4909)
react-codemod recommended way of having methods defined
2018-08-06 20:53:06 -07:00
Tim Neutkens b20b80adf0
Run rename-unsafe-lifecycles as preparation for React 17 (#4907)
https://github.com/reactjs/react-codemod#rename-unsafe-lifecycles
2018-08-06 20:23:28 -07:00
Tim Neutkens 4c602ff395
Run manual-bind-to-arrow codemod (#4906)
https://github.com/reactjs/react-codemod#manual-bind-to-arrow
2018-08-06 20:20:01 -07:00
Jacob Page b492e6703d Make EventEmitter more Node-like (#4865)
Add behaviors to make `EventEmitter` a bit more like its NodeJS counterpart. This should make using it a bit less surprising.
2018-08-01 14:43:25 +02:00
Tim Neutkens 9240cf7855
Make .events work even when router is not initialized (#4874)
Followup of https://github.com/zeit/next.js/issues/4863#issuecomment-408920755
2018-07-31 21:04:14 +02:00