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

196 commits

Author SHA1 Message Date
Joe Haddad 56b1f81ace Fix development mode output (#6312)
* Remove usage of WebpackBar and Friendly Errors

* Add new clearConsole helper

* Add new simplified output for development mode

* Add an explicit bootstrapping mode

* Add missing returns

* Use existing output style

* Adjust first output to say Waiting on

* Only print URL if present
2019-02-16 17:09:49 +01:00
Tim Neutkens 4051ffcb01 [experimental] Rendering to AMP (#6218)
* Add initial AMP implementation

* Implement experimental feature flag

* Implement feedback from sbenz

* Add next/amp and `useAmp` hook

* Use /:path*/amp instead

* Add canonical

* Add amphtml tag

* Add ampEnabled for rel=“amphtml”

* Remove extra type
2019-02-14 10:22:57 -05:00
Connor Davis e1056e32cf Add yarn check to test (#6257) 2019-02-11 23:26:42 +01:00
Tim Neutkens c9f4a956d4 Update yarn.lock 2019-02-11 08:28:22 +01:00
Tim Neutkens 377e43b6e2 Update yarn.lock 2019-02-10 05:09:22 +01:00
Alexander Nanberg cc0b3ef451 Remove extraneous benchmark dependency (#6222)
AFAIK this dependency isn't being used anywhere so it should be safe to remove it.
2019-02-07 21:50:35 +01:00
Tim Neutkens b3045cc7a9
Implement circular JSON err.sh link (#6149)
* Implement circular JSON err.sh link

* Add test for getInitialProps returning circular json

* Make test warn less

* Fix tests

* Add reference to original tests
2019-01-27 16:12:17 +01:00
Connor Davis f28833c594 Upgrade Webpack to 4.29.0 with FutureEmitAssets for Massive Memory Optimizations (#6114)
We want our new memory optimizations (https://github.com/webpack/webpack/pull/8609)
2019-01-24 10:25:58 +01:00
Connor Davis b20b371a41
Add release cli to prepublish 2019-01-21 09:24:39 -06:00
Connor Davis 41f66508a0
Update yarn.lock 2019-01-21 09:08:52 -06:00
Tim Neutkens 9ffd23eeef
Replace pages-plugin with loader (#5994)
* Remove unused argument

* Replace pages-plugin with loader

* Add loader-utils types

* Remove logs

* Bring back previous deposal behavior

* Remove console.log

* Remove webpack/utils as it’s no longer in use

* Remove hot-self-accept-loader

* Error Recovery tests

* Make hotSelfAccept a noop default loader

* Fix windows deleted/added

* Remove logging

* Remove unused variables

* Remove log

* Simplify entrypoint generation

* Don’t return the function

* Fix _app test

* Remove code that’s always true

* Move aliases to constants

* Use alias

* Join pages alias in reduce

* Default pages differently

* Loop over pages instead of manually defining

* Move entry generation into common function

* Update packages/next/build/webpack/loaders/next-client-pages-loader.ts

Co-Authored-By: timneutkens <tim@timneutkens.nl>

* Update packages/next/build/webpack/loaders/next-client-pages-loader.ts
2019-01-08 23:10:32 +01:00
Tim Neutkens 56a780c633 Update yarn.lock 2019-01-02 15:06:57 +01:00
Tim Neutkens 0f23faf81f
Serverless Next.js (#5927)
**This does not change existing behavior.**

building to serverless is completely opt-in.

- Implements `target: 'serverless'` in `next.config.js`
- Removes `next build --lambdas` (was only available on next@canary so far)

This implements the concept of build targets. Currently there will be 2 build targets:

- server (This is the target that already existed / the default, no changes here)
- serverless (New target aimed at compiling pages to serverless handlers)

The serverless target will output a single file per `page` in the `pages` directory:

- `pages/index.js` => `.next/serverless/index.js`
- `pages/about.js` => `.next/serverless/about.js`

So what is inside `.next/serverless/about.js`? All the code needed to render that specific page. It has the Node.js `http.Server` request handler function signature:

```ts
(req: http.IncomingMessage, res: http.ServerResponse) => void
```

So how do you use it? Generally you **don't** want to use the below example, but for illustration purposes it's shown how the handler is called using a plain `http.Server`:

```js
const http = require('http')
// Note that `.default` is needed because the exported module is an esmodule
const handler = require('./.next/serverless/about.js').default
const server = new http.Server((req, res) => handler(req, res))
server.listen(3000, () => console.log('Listening on http://localhost:3000'))
```

Generally you'll upload this handler function to an external service like [Now v2](https://zeit.co/now-2), the `@now/next` builder will be updated to reflect these changes. This means that it'll be no longer neccesary for `@now/next` to do some of the guesswork in creating smaller handler functions. As Next.js will output the smallest possible serverless handler function automatically.

The function has 0 dependencies so no node_modules are required to run it, and is generally very small. 45Kb zipped is the baseline, but I'm sure we can make it even smaller in the future.

One important thing to note is that the function won't try to load `next.config.js`, so `publicRuntimeConfig` / `serverRuntimeConfig` are not supported. Reasons are outlined here: #5846

So to summarize:

- every page becomes a serverless function
- the serverless function has 0 dependencies (they're all inlined)
- "just" uses the `req` and `res` coming from Node.js
- opt-in using `target: 'serverless'` in `next.config.js`
- Does not load next.config.js when executing the function

TODO:

- [x] Compile next/dynamic / `import()` into the function file, so that no extra files have to be uploaded.
- [x] Setting `assetPrefix` at build time for serverless target
- [x] Support custom /_app
- [x] Support custom /_document
- [x] Support custom /_error
- [x] Add `next.config.js` property for `target`

Need discussion:
- [ ] Since the serverless target won't support `publicRuntimeConfig` / `serverRuntimeConfig` as they're runtime values. I think we should support build-time env var replacement with webpack.DefinePlugin or similar.
- [ ] Serving static files with the correct cache-control, as there is no static file serving in the serverless target
2018-12-28 11:39:12 +01:00
Jeroen Knoops 46c9deb064 Upgrades webpack related libraries (#5949)
Upgrades webpack from 4.26.0 -> 4.28.2

Adds webpackbar for build. Fixes #5777
2018-12-26 12:06:58 +01:00
Tim Neutkens 9c4eefcdbf
Add prettier for examples directory (#5909)
* Add prettier for examples directory

* Fix files

* Fix linting

* Add prettier script in case it has to be ran again
2018-12-17 17:34:32 +01:00
Kyle Holmberg 72e7929242 Change page export validity check on client and server in development (#5857)
Resolves #4055 

Credit: https://github.com/zeit/next.js/pull/5095

I didn't use the ignore webpack plugin from the original PR and tested bundle size with https://github.com/zeit/next.js/pull/5339 - seems to be safe on that front.

Was able to get tests to pass locally, unsure of what goes wrong in CI 🤷‍♂️ 

**Questions**
1) The initial PR didn't include changes to `next-server/lib/router` in `getRouteInfo()`. Should the same changes be made within?

2) Should we add a test for rendering a component created via `forwardRef()`?

`component-with-forwardedRef`:
```javascript
export default React.forwardRef((props, ref) => <span {...props} forwardedRef={ref}>This is a component with a forwarded ref</span>);
```

some test:
```javascript
test('renders from forwardRef', async () => {
  const $ = await get$('/component-with-forwardedRef')
  const span = $('span')
  expect(span.text()).toMatch(/This is a component with a forwarded ref/)
})
```
2018-12-17 16:09:23 +01:00
Tim Neutkens b5b0c743b3 Add ws dependency 2018-12-16 14:28:11 +01:00
DevSide ebf217cb16 add --node-args option (#5858)
This message is from @timneutkens after making changes:
- Convert executables to Typescript
- Remove `minimist` in favor of `arg` 
- Implement `--node-args` usage: `--node-args="--throw-deprecation"`
- Adds tests for usage of the `next` cli
2018-12-15 22:55:59 +01:00
Tim Neutkens 620b426903
Remove baseurl/paths option (#5878)
For some reason the canary branch is failing on Typescript while the PR was not.
2018-12-13 16:56:48 +01:00
Tim Neutkens f9cd204c99 Remove yarn.lock 2018-09-02 15:17:37 +02:00
Tim Neutkens 3b35e5be14
Upgrade to styled-jsx@canary (#5067)
This fixes an issue with styles jumping around when using `transition: all`
2018-08-31 21:10:20 +02:00
Tim Neutkens e1c544cd75
Fix loading... issue (#5058)
This fixes intermittent `loading...` on some requests which surfaced on zeit.co when upgrading
2018-08-30 14:02:18 +02:00
Tim Neutkens 4c891a7e8a
Upgrade to Babel 7 stable (#5042) (major)
🎉 https://twitter.com/left_pad/status/1034204330352500736
2018-08-28 12:44:15 +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 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
HaNdTriX bb13e941e5
Fix polyfills (#5013) 2018-08-24 01:57:04 +02:00
Tim Neutkens 918e0a6e32
Replace uuid with nanoid (#4987)
* Replace uuid with nanoid

Same functionality in a smaller package:

https://bundlephobia.com/result?p=nanoid@1.2.1
https://bundlephobia.com/result?p=uuid@3.3.2

* Add comment
2018-08-23 17:02:47 +02:00
HaNdTriX 24386b93dc Remove babel-plugin-transform-remove-strict-mode (#5003)
This plugin wasn’t in use anyway.

Related: https://github.com/zeit/next.js/pull/414

Maybe we can remove the [`"strict_mode"`](https://github.com/zeit/next.js/search?q=%27use+strict%27&type=Code) statements as well.
2018-08-22 08:32:57 +02:00
HaNdTriX eb00bc23e5 Remove babel-plugin-istanbul (#5004)
This plugin is not in use.

https://github.com/zeit/next.js/search?q=istanbul&unscoped_q=istanbul
2018-08-22 08:31:49 +02:00
Tim Neutkens 1fe1f7fc49
Implement autodllplugin (#4951)
* Implement autodllplugin

* Add flow-typed for autodll-webpack-plugin
2018-08-13 15:09:05 -07:00
Tim Neutkens cf5dd4a0b9 Update yarn.lock 2018-08-13 13:05:09 -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
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 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
Tim Neutkens 475b426ed1
Compile pages to .next/static directory (#4828)
* Compile pages to .next/static/<buildid>/pages/<page>

* Fix test

* Export class instead of using exports

* Use constant for static directory

* Add comment about what the middleware does
2018-07-25 13:45:42 +02:00
Tim Neutkens 75476a9136
[WIP] Webpack 4, react-error-overlay, react-loadable (#4639)
Webpack 4, react-error-overlay, react-loadable (major)
2018-07-24 11:24:40 +02:00
Luc 71fe4984bf Upgrade styled-jsx to 2.2.7 (#4714)
Fixes #4713

I ran into this issue, when re-installing :
```
error upath@1.0.4: The engine "node" is incompatible with this module. Expected version ">=4 <=9".
error Found incompatible module
```

I used `yarn install --ignore-engines` as a workaround.
2018-07-02 23:00:18 +02:00
Tim Neutkens 17e410a1d0
Fix Typescript HMR (#4689)
Fixes #4686

Adds tests for @zeit/next-typescript so that we don't regress on this again.

I've fixed an issue in the `next` CLI too which caused lingering processes when the process gets force killed, which is what we do in the test suite, so it kept running if there was no manual quit.
2018-06-28 20:07:41 +02:00
Tim Neutkens e2beadd960
Upgrade update-check (#4585)
Fixes #4581
2018-06-11 13:23:28 +02:00
Tim Neutkens f11d3487f6
Remove react-hot-loader dependency (#4550)
React hot loader was removed already, the dependency still had to be removed.
2018-06-07 13:37:48 +02:00
Tim Neutkens 86d01706a6
Remove react-hot-loader (#4500)
Fixes #4494
2018-05-31 11:47:29 +02:00
Logan Smyth 2495316235 Use custom Babel loader to avoid using separate Babel copies for loader and loader options (#4417)
This resolves the

> .value is not a valid Plugin property

error showing up for people in https://github.com/zeit/next.js/issues/4227

cc @timneutkens
2018-05-23 20:26:57 +02:00
Tim Neutkens 1dda50cbc5
Upgrade react-hot-loader (#4317) 2018-05-09 11:23:53 +02:00
Tim Neutkens aaa15ebddd
Add source-map dependency (#4281) 2018-05-06 10:56:25 +02:00
Tim Neutkens e21ccad33a Revert "Add source-map module to dependencies"
This reverts commit b970e25e6f.
2018-05-06 07:02:38 +02:00
Tim Neutkens b970e25e6f Add source-map module to dependencies
Fixes #4268
2018-05-05 17:43:22 +02:00
Tim Neutkens 22005080bc
Upgrade react-hot-loader (#4277)
Fixes zeit/styled-jsx#425
Fixes #4246
Fixes #4273
2018-05-05 05:34:28 -07:00
Tim Neutkens 2435798479
Upgrade update-check (#4247) 2018-05-01 14:43:20 -07:00
Tim Neutkens bc03c59f57
Upgrade react hot loader (#4171)
* Upgrade react hot loader

* Upgrade to 4.1.1
2018-04-22 16:11:17 -07:00
Tim Neutkens f373d25c0d
Replaced update checker (#4192)
* Use update-check

* Check for tty
2018-04-22 15:43:24 -07:00