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

2414 commits

Author SHA1 Message Date
Tim Neutkens b9533c318d 7.0.0-canary.0 2018-08-15 16:45:42 -07:00
Tim Neutkens 85c6a12eb5
Fix DLL for Windows (#4959)
* Implement autodllplugin

* Add flow-typed for autodll-webpack-plugin

* Improve onClick tests

* Make third test pass

* Make sure DLL bundle is loaded without async

* Add nonce

* Fix windows DLL path
2018-08-15 16:24:56 -07:00
Giuseppe 9ae27b20b4 upgrade styled-jsx to v3 (#4936)
Upgrade styled-jsx to v3 (major)
2018-08-15 12:44:01 -07: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
Tim Neutkens 1fe1f7fc49
Implement autodllplugin (#4951)
* Implement autodllplugin

* Add flow-typed for autodll-webpack-plugin
2018-08-13 15:09:05 -07:00
Luc fcf9625ed0 Replace deprecated props.url in readme (#4952)
Following https://github.com/zeit/next.js/pull/4950

Fix https://github.com/zeit/next.js/issues/4716

I'm not sure to understand this part, though :
> Note: in order to programmatically change the route without triggering navigation and component-fetching, use `props.url.push` and `props.url.replace` within a component

Is there a difference between :
```jsx
export default () => <a onClick={() => Router.push('/about')}>About</a>
```

and
 
```jsx
export default withRouter(
  () => <a onClick={() => props.router.push('/about')}>About</a>
)
```
?
2018-08-13 14:38:02 -07:00
Jacob Page 1889c80472 Update routing samples (#4864)
Updated router samples to use the EventEmitter
2018-08-13 14:17:39 -07:00
Luc b9081a5115 Replace deprecated props.url in examples (#4953)
Following https://github.com/zeit/next.js/pull/4952

I found two examples with the deprecated`props.url` :
- `with-ioc`
- `with-next-routes`
2018-08-13 14:12:03 -07:00
Tim Neutkens cf5dd4a0b9 Update yarn.lock 2018-08-13 13:05:09 -07:00
Luc b516d094a4 Fix shallow routing examples using old React lifecycle and deprecated props.url (#4950)
* replace componentWillReceiveProps by componentDidUpdate

* replace props.url by withRouter HOC

* fix deprecated `props.url` in with-shallow-routing example
2018-08-13 11:09:45 -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
Alexander Kachkaev 9319c158a5 Upgrade Babel to 7.0.0-rc.1 (major) (#4937)
Fixes #4691
Fixes #4614

This PR gives path to https://github.com/zeit/next-plugins/pull/242

I did not add or remove `^` near dependency versions in package.json files. However, I don't exclude that some changes can be made given that rc is more stable than beta.
2018-08-13 10:34:08 -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
Tomek e8c1eaec83 update with-loading example (#4836)
Changes:

* Split `Header` component trough `_document.js` and `_app.js`
* Attached Router events with a way described in the [documentation](https://github.com/zeit/next.js#router-events) (though in the documentation is says it should be `Router.events.on` while I managed to get it working only by `Router.router.events.on` and I had to place it inside `componentDidMount`)
2018-08-11 19:39:48 -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
Tim Neutkens 3eda0c09cd 6.1.1-canary.5 2018-08-10 09:38:05 -07:00
Tim Neutkens 2e62b87fff
Make wasm files load on ssr (#4942)
* Make wasm files load on ssr

* Upgrade React for tests
2018-08-10 09:37:27 -07:00
Tim Phillips b990b29d2d Update Apollo links in examples (#4933) 2018-08-09 14:00:08 -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
Sahal Sajjad 136585e296 Added example: with-typestyle (#4926)
* Added example: with-typestyle

* Fixed bug: Rendering the DOM tree twice
2018-08-08 21:36:34 -07:00
HaNdTriX 06b02e2c62 Update with-custom-babel-config example (#4923)
## Issue

Running [examples/with-custom-babel-config](https://github.com/zeit/next.js/tree/canary/examples/with-custom-babel-config) will result in the following error message:

```
./pages/index.js
Module build failed (from /some_path/next.js/dist/build/webpack/loaders/next-babel-loader.js):
Error: [BABEL] /some_path/next.js/examples/with-custom-babel-config/pages/index.js: 
As of v7.0.0-beta.55, we've removed Babel's Stage presets.
Please consider reading our blog post on this decision at
https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets
for more details. TL;DR is that it's more beneficial in the
  long run to explicitly add which proposals to use.

...
```

## Explanation

Babel removed Babel's Stage presets on July 27, 2018.

More info: https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets

## Solution

I've updated the example so ist just uses the babel plugin it actually needs.

## Related 

Closes: #4772
2018-08-08 09:02:46 -07:00
HaNdTriX d3f1fa630e Rewrite with-dotenv example (#4924)
## Issue

I decided to rewrite the [with-dotenv](https://github.com/zeit/next.js/tree/canary/examples/with-dotenv) using [dotenv-webpack](https://github.com/mrsteele/dotenv-webpack) example because:

- changes doesn't get applied  (#4748, brysgo/babel-plugin-inline-dotenv#13)
- the production mode doesn't work at all
- this approach has already been used in the [examples/relay-modern](9320d9f006/examples/with-relay-modern/next.config.js)
- it is [documented](https://webpack.js.org/plugins/environment-plugin/#dotenvplugin) by webpack

## Alternatives

* remove/deprecate example
* fix babel-plugin-inline-dotenv

## Related

Closes: #4748
2018-08-08 09:01:00 -07:00
HaNdTriX 9018da11ca Remove with-global-stylesheet example (#4913)
* Deprecate with-global-stylesheet example

Use @zeit/next-css instead

https://github.com/zeit/next-plugins/tree/master/packages/next-css

RELATED ISSUE: #4902

* Deprecate with-global-stylesheet-simple example

Use @zeit/next-css instead

https://github.com/zeit/next-plugins/tree/master/packages/next-css

RELATED ISSUE: #4902
2018-08-07 18:36:28 -07:00
Connor Bär b50bad56be [BUG] Fix emit-file-loader compatibility with Webpack 4 (#4918)
## Context

When upgrading to Next.js 6.1.1-canary.4 and using the `emit-file-loader` included in Next.js, the following error is thrown:

```bash
 error  in ./src/graveyard/pages/_app.scss
Module build failed (from ../node_modules/next/dist/build/webpack/loaders/emit-file-loader.js):
TypeError: Cannot read property 'context' of undefined
    at Object.module.exports (~/project-root/node_modules/next/dist/build/webpack/load
ers/emit-file-loader.js:27:68)

 @ ./src/pages/_app.js 35:0-53 156:17-26 157:13-22
 @ multi ./pages/_app.js
```

`next.config.js` (shortened):
```js
module.exports = {
  webpack: (config, { dev }) => {
    config.module.rules.push({
      test: /\.scss$/,
      use: [
        {
          loader: 'emit-file-loader',
          options: {
            name: 'dist/[path][name].[ext].js'
          }
        },
        {
          loader: 'babel-loader',
          options: {
            babelrc: false,
            extends: path.resolve(__dirname, './src/.babelrc')
          }
        },
        'styled-jsx-css-loader',
        { loader: 'postcss-loader', options: { sourceMap: dev } },
        {
          loader: 'sass-loader',
          options: {
            sourceMap: dev
          }
        }
      ]
    });

    return config;
  }
};
```

## Suggested Fix

A quick Google search brought me to a [related issue in `webpack-loader`](https://github.com/webpack-contrib/worker-loader/issues/125). As pointed out in the [Webpack docs](https://webpack.js.org/api/loaders/#this-rootcontext):

> Starting with webpack 4, the formerly `this.options.context` is provided as `this.rootContext`.

This PR makes this change while maintaining backward compatibility.

## System information

Next.js: 6.1.1-canary.4
Node: v9.3.0
2018-08-07 13:49:30 -07:00
Tim Neutkens 6de99ebc4a
Set correct status for sigint (#4917)
Fixes #4916
2018-08-07 11:50:26 -07:00
Tim Neutkens a528565c69
Make next/link async safe (#4911)
Removes componentWillMount and uses memoize instead as recommended here: https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html
2018-08-06 22:44:18 -07:00
HaNdTriX 3286ecb3fc Add slate.js example (#4899) 2018-08-06 21:00:31 -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 80fdfec088
Fix decorator warnings (#4910) 2018-08-06 20:47:27 -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
Thomas Hermann 83970c908d Add with-strict-csp example (#4858) 2018-08-06 20:19:16 -07:00
Hugo Heyman e8aa78204a Improve glamor example (#4893)
Changes:
- Use css prop on the element to style it
- Add webpack + babelrc configuration to remove otherwise needed import boilerplate [according to glamor docs](https://github.com/threepointone/glamor/blob/master/docs/createElement.md)

Rationale: The killer feature of glamor that makes it so great is that it relieves you from naming classes/styles if you use the custom css prop. Together with the babel plugin you also don't need any extra import wherever the css prop is used.

All the real world uses I've seen of glamor has used the css props so I think the example should reflect this. As an example here is docs how to use glamor with gatsby (using the css prop):
https://www.gatsbyjs.org/docs/glamor/
2018-08-05 16:13:28 -07:00
Tim Neutkens a41e3c102e
Await preloading right before rendering the page (#4896) 2018-08-05 15:53:34 -07:00
Kate 05b6891620 Fixed server status message in with-redux-observable-example. (#4900)
**Changes:**
- Fixed "was character fetched on server" message by properly passing `isServer`.
- Stop fetching if there was an error (currently it keeps sending requests to the same endpoint every 3 sec)

**Related:**
- https://github.com/zeit/next.js/pull/4818
- https://github.com/zeit/next.js/issues/4724
2018-08-05 10:56:04 -07:00
Sayuti Daniel 919b88509c Let webpack handle contenthash (#4895) 2018-08-04 11:18:20 -07:00
Tomek b1459bfd60 update with-sentry example (#4859)
Changes:

* moved the configuration from HOC to `_app.js`
* fixed the example, as `componentDidCatch` catches errors during rendering phase, but not within event handlers.
2018-08-04 10:51:35 -07:00
Sayuti Daniel bd3f65b37f Use contenthash instead of chunkhash (#4894)
https://github.com/webpack/webpack.js.org/issues/2096
2018-08-04 10:00:13 -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
Max Stoiber 80202069cf Note babel-plugin-styled-components (#4882)
Otherwise folks might miss that part and get checksum mismatches!
2018-08-01 13:57:30 +02:00
Tim Neutkens 59c7d42d36 6.1.1-canary.4 2018-07-31 21:24:46 +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
Tim Neutkens b65d2dff30 6.1.1-canary.3 2018-07-30 21:35:19 +02:00
Tim Neutkens 183866a96d
Add support for rendering .css chunks (#4861)
Depends on https://github.com/zeit/next-plugins/pull/228

Failing tests are expected as `@zeit/next-css` has to be updated/released first.

This implements rendering of `.css` chunks. Effectively removing the custom document requirement when adding next-css/sass/less/stylus.
2018-07-30 15:48:02 +02:00
José Manuel Aguirre 7282f43f7b Missing babel configuration in sw-precache example (#4856)
Missing configuration in package.json and .babelrc causes this example to be broken after installing and running the example.
2018-07-27 22:54:01 +02:00
Tomek 88610694c2 update with-prefetching example (#4850) 2018-07-27 22:08:09 +02:00
Tim Neutkens 283e9afe70
Upgrade serve (#4857) 2018-07-27 21:13:55 +02:00
Tim Neutkens 6a087c6a5d
Rename commons directory to runtime (#4853) 2018-07-27 19:29:25 +02:00
Stefan Ivic fc05c9c273 Update readme with alternative hostname option (#4829)
Tackles the issue in #4025.
2018-07-26 12:42:35 +02:00