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

126 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 036f5bf11b v8.0.2-canary.0 2019-02-16 16:41:30 +01:00
Tim Neutkens 708c537fc6 Merge branch 'master' into canary 2019-02-16 16:38:42 +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
Tim Neutkens 7fd9cb440d v8.0.1 2019-02-13 09:31:49 +01:00
Tim Neutkens 77a5a6f91a v8.0.1-canary.0 2019-02-13 07:20:54 +01:00
Tim Neutkens e4f96e65d3 v8.0.0 2019-02-11 09:02:37 +01:00
Tim Neutkens 8ddf9c7f27 v8.0.0-canary.23 2019-02-11 08:28:49 +01:00
Tim Neutkens 100b733960 v8.0.0-canary.22 2019-02-11 08:17:22 +01:00
Giuseppe ac0976affe Update styled-jsx (#6236)
Changelog https://github.com/zeit/styled-jsx/releases/tag/v3.2.1
2019-02-10 22:19:38 +01:00
Tim Neutkens bfd2d08ff2 v8.0.0-canary.21 2019-02-10 05:10:24 +01:00
Tim Neutkens 2ecb2489ce v8.0.0-canary.20 2019-02-10 04:56:14 +01:00
Tim Neutkens 45f5663558
Bring in terser-webpack-plugin (#6231)
* Bring in terser-webpack-plugin

* Ignore terser from linting
2019-02-10 04:55:09 +01:00
Tim Neutkens c0701e948f v8.0.0-canary.19 2019-02-08 16:04:44 +01:00
Konstantin Grushetsky 2f304bd10e Remove 'acorn' dependency (#6193) 2019-02-03 14:36:29 +01:00
Tim Neutkens b2b2041e39 v8.0.0-canary.18 2019-02-01 13:23:56 +00:00
Tim Neutkens 0e21615245 v8.0.0-canary.17 2019-01-27 22:03:13 +01:00
Tim Neutkens 136c37eca9 v8.0.0-canary.16 2019-01-27 17:20:24 +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 e46fdd6546 Add arcorn to fix webpack/npm bug (#6137) 2019-01-26 02:28:44 +01:00
Tim Neutkens f05d339dcf v8.0.0-canary.15 2019-01-26 02:02:48 +01:00
Tim Neutkens 024323b6d8 v8.0.0-canary.14 2019-01-25 19:14:11 +01:00
Connor Davis 97bf2679aa
v8.0.0-canary.13 2019-01-24 16:27:05 -06:00
Tim Neutkens 1191843e17 v8.0.0-canary.12 2019-01-24 10:51:13 +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
Tim Neutkens c5d5148bad v8.0.0-canary.11 2019-01-22 13:12:50 +01:00
Connor Davis 43b0b95e1d
v8.0.0-canary.10 2019-01-21 09:13:26 -06:00
Tim Neutkens 862e0a39b9 Update package.json description 2019-01-21 13:46:01 +01:00
Tim Neutkens 0949b4dd1a Make lerna always use exact version when updating packages 2019-01-21 12:20:05 +01:00
Tim Neutkens 0714300b8c v8.0.0-canary.9 2019-01-19 13:40:53 +01:00
Tim Neutkens bbc346869e
Remove Typescript helpers in favor of babel helpers (#6087)
There's still a few Typescript helpers in use, but regenerator is added by Babel after this change, as it was already in the bundle it'll drop bundle sizes by quite a bit, eg _app.js becomes half the size.
2019-01-18 22:00:15 +01:00
Tim Neutkens b52c416713 v8.0.0-canary.8 2019-01-18 12:15:56 +01:00
Giuseppe b4e6ded289 Upgrade styled-jsx (#6069)
Introduces full support for Babel 7 including JSX Fragments shorthand. 
Switched to visiting the `Program` path and then start a traversal manually to solve conflicts with other Babel plugins.
2019-01-16 11:37:01 +01:00
Tim Neutkens 9ab8714f38 v8.0.0-canary.7 2019-01-14 16:19:20 +01:00
Alexander Nanberg ff5cf6d4de Migrate next/head to use React.createContext (#6038)
Continuation of #5945
2019-01-14 01:59:26 +01:00
Tim Neutkens 02ab732096
Remove next/asset (#6046)
* Remove next/asset

Reasoning described in #5970

* Remove next/asset tests

* Bring back asset-page
2019-01-14 01:32:20 +01:00
Tim Neutkens 4939583c65 Move @types to devDependencies 2019-01-12 15:22:15 +01:00
Tim Neutkens f94d24bffc v8.0.0-canary.6 2019-01-12 00:45:34 +01:00
Tim Neutkens 0607638e8f v8.0.0-canary.5 2019-01-11 22:29:15 +01:00
Alexander Nanberg 25fb3f9c2e Migrate next/router to use React.createContext (#6030)
Fixes parts of #5716. I had some issues with the test suite but I'm fairly certain that I got it working correctly.
2019-01-11 16:04:56 +01:00
Tim Neutkens 2a9b733715 v8.0.0-canary.4 2019-01-10 23:03:25 +01:00
Tim Neutkens a9f71e449d v8.0.0-canary.3 2019-01-09 00:09:15 +01: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 7d080760a8 v8.0.0-canary.2 2019-01-02 16:29:19 +01:00
Tim Neutkens fd3cb2a190 v8.0.0-canary.1 2019-01-02 15:07:33 +01:00
Tim Neutkens 672a87d981 v8.0.0-canary.0 2019-01-02 13:59:52 +01:00
Tim Neutkens aabc72015c v7.0.2-canary.50 2018-12-28 11:41:47 +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
Giuseppe 56744253c6 Upgrade styled-jsx (#5953)
The latest version includes a fix to resolve conflicts with other libraries that use the `css` prop. Details https://github.com/zeit/styled-jsx/releases/tag/v3.1.3
2018-12-27 11:50:19 +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