2018-09-30 23:02:10 +00:00
|
|
|
{
|
|
|
|
"name": "next",
|
2019-02-13 06:20:54 +00:00
|
|
|
"version": "8.0.1-canary.0",
|
2019-01-21 12:46:01 +00:00
|
|
|
"description": "The React Framework",
|
2018-09-30 23:02:10 +00:00
|
|
|
"main": "./dist/server/next.js",
|
|
|
|
"license": "MIT",
|
|
|
|
"repository": "zeit/next.js",
|
|
|
|
"bugs": "https://github.com/zeit/next.js/issues",
|
2018-09-30 23:34:54 +00:00
|
|
|
"homepage": "https://nextjs.org",
|
2018-09-30 23:02:10 +00:00
|
|
|
"files": [
|
|
|
|
"dist",
|
|
|
|
"app.js",
|
|
|
|
"babel.js",
|
|
|
|
"client.js",
|
|
|
|
"config.js",
|
|
|
|
"constants.js",
|
|
|
|
"document.js",
|
|
|
|
"dynamic.js",
|
|
|
|
"error.js",
|
|
|
|
"head.js",
|
|
|
|
"link.js",
|
2019-02-14 15:22:57 +00:00
|
|
|
"router.js",
|
|
|
|
"amp.js"
|
2018-09-30 23:02:10 +00:00
|
|
|
],
|
|
|
|
"bin": {
|
|
|
|
"next": "./dist/bin/next"
|
|
|
|
},
|
|
|
|
"scripts": {
|
|
|
|
"build": "taskr",
|
|
|
|
"release": "taskr release",
|
2018-12-05 20:45:50 +00:00
|
|
|
"prepublish": "npm run release",
|
|
|
|
"typescript": "tsc --noEmit"
|
2018-09-30 23:02:10 +00:00
|
|
|
},
|
|
|
|
"taskr": {
|
|
|
|
"requires": [
|
2019-01-18 21:00:15 +00:00
|
|
|
"./taskfile-typescript.js",
|
|
|
|
"./taskfile-babel.js"
|
2018-09-30 23:02:10 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
"dependencies": {
|
|
|
|
"@babel/core": "7.1.2",
|
|
|
|
"@babel/plugin-proposal-class-properties": "7.1.0",
|
|
|
|
"@babel/plugin-proposal-object-rest-spread": "7.0.0",
|
|
|
|
"@babel/plugin-syntax-dynamic-import": "7.0.0",
|
2018-11-28 16:53:49 +00:00
|
|
|
"@babel/plugin-transform-modules-commonjs": "7.1.0",
|
2018-09-30 23:02:10 +00:00
|
|
|
"@babel/plugin-transform-runtime": "7.1.0",
|
|
|
|
"@babel/preset-env": "7.1.0",
|
|
|
|
"@babel/preset-react": "7.0.0",
|
|
|
|
"@babel/runtime": "7.1.2",
|
|
|
|
"@babel/runtime-corejs2": "7.1.2",
|
|
|
|
"@babel/template": "7.1.2",
|
|
|
|
"ansi-html": "0.0.7",
|
2018-12-15 21:55:59 +00:00
|
|
|
"arg": "3.0.0",
|
2019-01-21 11:20:05 +00:00
|
|
|
"async-sema": "2.1.4",
|
2018-09-30 23:02:10 +00:00
|
|
|
"autodll-webpack-plugin": "0.4.2",
|
|
|
|
"babel-core": "7.0.0-bridge.0",
|
|
|
|
"babel-loader": "8.0.2",
|
2018-11-24 23:47:39 +00:00
|
|
|
"babel-plugin-react-require": "3.0.0",
|
2018-09-30 23:02:10 +00:00
|
|
|
"babel-plugin-transform-react-remove-prop-types": "0.4.15",
|
2019-02-10 03:56:14 +00:00
|
|
|
"cacache": "^11.0.2",
|
2018-09-30 23:02:10 +00:00
|
|
|
"case-sensitive-paths-webpack-plugin": "2.1.2",
|
|
|
|
"cross-spawn": "5.1.0",
|
|
|
|
"del": "3.0.0",
|
|
|
|
"event-source-polyfill": "0.0.12",
|
2019-02-10 03:56:14 +00:00
|
|
|
"find-cache-dir": "2.0.0",
|
2018-09-30 23:02:10 +00:00
|
|
|
"find-up": "2.1.0",
|
|
|
|
"fresh": "0.5.2",
|
|
|
|
"friendly-errors-webpack-plugin": "1.7.0",
|
|
|
|
"glob": "7.1.2",
|
2018-11-28 14:03:02 +00:00
|
|
|
"hoist-non-react-statics": "3.2.0",
|
2018-09-30 23:02:10 +00:00
|
|
|
"http-status": "1.0.1",
|
|
|
|
"launch-editor": "2.2.1",
|
|
|
|
"loader-utils": "1.1.0",
|
|
|
|
"mkdirp-then": "1.2.0",
|
|
|
|
"nanoid": "1.2.1",
|
2019-02-13 06:20:54 +00:00
|
|
|
"next-server": "8.0.1-canary.0",
|
2018-09-30 23:02:10 +00:00
|
|
|
"prop-types": "15.6.2",
|
|
|
|
"prop-types-exact": "1.2.0",
|
|
|
|
"react-error-overlay": "4.0.0",
|
2018-12-17 15:09:23 +00:00
|
|
|
"react-is": "16.6.3",
|
2018-09-30 23:02:10 +00:00
|
|
|
"recursive-copy": "2.0.6",
|
|
|
|
"resolve": "1.5.0",
|
2019-02-10 03:56:14 +00:00
|
|
|
"schema-utils": "1.0.0",
|
|
|
|
"serialize-javascript": "1.4.0",
|
|
|
|
"source-map": "0.6.1",
|
2018-09-30 23:02:10 +00:00
|
|
|
"strip-ansi": "3.0.1",
|
2019-02-10 21:19:38 +00:00
|
|
|
"styled-jsx": "3.2.1",
|
2019-02-10 03:56:14 +00:00
|
|
|
"terser": "3.16.1",
|
2018-12-12 12:59:11 +00:00
|
|
|
"tty-aware-progress": "1.0.3",
|
2018-09-30 23:02:10 +00:00
|
|
|
"unfetch": "3.0.0",
|
|
|
|
"url": "0.11.0",
|
2019-01-24 09:25:58 +00:00
|
|
|
"webpack": "4.29.0",
|
2018-09-30 23:02:10 +00:00
|
|
|
"webpack-dev-middleware": "3.4.0",
|
2018-12-26 11:06:58 +00:00
|
|
|
"webpack-hot-middleware": "2.24.3",
|
|
|
|
"webpack-sources": "1.3.0",
|
|
|
|
"webpackbar": "3.1.4 ",
|
2019-02-10 03:56:14 +00:00
|
|
|
"worker-farm": "1.5.2",
|
2018-12-16 13:28:11 +00:00
|
|
|
"ws": "6.1.2"
|
2018-09-30 23:02:10 +00:00
|
|
|
},
|
|
|
|
"peerDependencies": {
|
2019-01-14 00:59:26 +00:00
|
|
|
"react": "^16.6.0",
|
|
|
|
"react-dom": "^16.6.0"
|
2018-09-30 23:02:10 +00:00
|
|
|
},
|
|
|
|
"devDependencies": {
|
2018-12-05 20:45:50 +00:00
|
|
|
"@babel/parser": "7.2.0",
|
2018-09-30 23:02:10 +00:00
|
|
|
"@taskr/clear": "1.1.0",
|
2018-10-07 13:04:43 +00:00
|
|
|
"@taskr/esnext": "1.1.0",
|
|
|
|
"@taskr/watch": "1.1.0",
|
2018-12-02 17:30:00 +00:00
|
|
|
"@types/babel-types": "7.0.4",
|
2018-12-03 13:18:52 +00:00
|
|
|
"@types/babel__core": "7.0.4",
|
2018-12-02 17:30:00 +00:00
|
|
|
"@types/babel__generator": "7.0.1",
|
|
|
|
"@types/babel__template": "7.0.1",
|
2018-12-03 13:18:52 +00:00
|
|
|
"@types/babel__traverse": "7.0.3",
|
2018-12-15 21:55:59 +00:00
|
|
|
"@types/cross-spawn": "6.0.0",
|
2018-12-07 14:52:29 +00:00
|
|
|
"@types/etag": "1.8.0",
|
|
|
|
"@types/fresh": "0.5.0",
|
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 10:39:12 +00:00
|
|
|
"@types/glob": "7.1.1",
|
2019-01-14 15:19:20 +00:00
|
|
|
"@types/loader-utils": "1.1.3",
|
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 10:39:12 +00:00
|
|
|
"@types/mkdirp": "0.5.2",
|
2018-12-03 13:18:52 +00:00
|
|
|
"@types/nanoid": "1.2.0",
|
2018-12-05 20:45:50 +00:00
|
|
|
"@types/node-fetch": "2.1.4",
|
2019-01-14 15:19:20 +00:00
|
|
|
"@types/rimraf": "2.0.2",
|
2018-12-26 11:06:58 +00:00
|
|
|
"@types/webpack": "4.4.22",
|
2018-11-28 14:03:02 +00:00
|
|
|
"taskr": "1.1.0",
|
|
|
|
"typescript": "3.1.6"
|
2018-11-21 20:56:24 +00:00
|
|
|
},
|
|
|
|
"engines": {
|
|
|
|
"node": ">= 8.0.0"
|
2018-09-30 23:02:10 +00:00
|
|
|
}
|
|
|
|
}
|