language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | vercel | next.js | 9b62f208bb9686180f3fd395d863439f9778828d.json | Remove cacheKeys option and improve filtering (#6559)
More cleanup of terser-plugin. | packages/next/build/webpack-config.ts | @@ -67,13 +67,7 @@ export default function getBaseWebpackConfig (dir: string, {dev = false, isServe
const terserPluginConfig = {
parallel: true,
sourceMap: false,
- cache: true,
- cacheKeys: (keys: any) => {
- // path changes per build because we add buildId
- // because the input is alread... | true |
Other | vercel | next.js | 9b62f208bb9686180f3fd395d863439f9778828d.json | Remove cacheKeys option and improve filtering (#6559)
More cleanup of terser-plugin. | packages/next/build/webpack/plugins/terser-webpack-plugin/src/index.js | @@ -2,42 +2,32 @@
no-param-reassign
*/
import crypto from 'crypto';
-import path from 'path';
import { SourceMapConsumer } from 'source-map';
-import { SourceMapSource, RawSource, ConcatSource } from 'webpack-sources';
+import { SourceMapSource, RawSource } from 'webpack-sources';
import RequestShortener from ... | true |
Other | vercel | next.js | 9b62f208bb9686180f3fd395d863439f9778828d.json | Remove cacheKeys option and improve filtering (#6559)
More cleanup of terser-plugin. | packages/next/package.json | @@ -75,7 +75,7 @@
"react-is": "16.6.3",
"recursive-copy": "2.0.6",
"resolve": "1.5.0",
- "serialize-javascript": "1.4.0",
+ "serialize-javascript": "1.6.1",
"source-map": "0.6.1",
"strip-ansi": "3.0.1",
"styled-jsx": "3.2.1", | true |
Other | vercel | next.js | 9b62f208bb9686180f3fd395d863439f9778828d.json | Remove cacheKeys option and improve filtering (#6559)
More cleanup of terser-plugin. | yarn.lock | @@ -11040,12 +11040,7 @@ sentence-case@^2.1.0:
no-case "^2.2.0"
upper-case-first "^1.1.2"
-serialize-javascript@1.4.0:
- version "1.4.0"
- resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.4.0.tgz#7c958514db6ac2443a8abc062dc9f7886a7f6005"
- integrity sha1-fJWFFNtqwkQ6ir... | true |
Other | vercel | next.js | fb08e8a1fc452ed4d9d7bda747964cd5c4a7e661.json | Add workflow with next-stats-action (#6535) | .github/main.workflow | @@ -0,0 +1,9 @@
+workflow "Generate pull request stats" {
+ on = "pull_request"
+ resolves = ["PR Stats"]
+}
+
+action "PR Stats" {
+ uses = "zeit/next-stats-action@master"
+ secrets = ["GITHUB_TOKEN"]
+} | false |
Other | vercel | next.js | e10096cd0c693f19ff27225ae0a5039a6d1870dc.json | Add preload notice (#6532)
Fixes #6517 | packages/next/README.md | @@ -828,6 +828,8 @@ Since Next.js server-renders your pages, this allows all the future interaction
> With prefetching Next.js only downloads JS code. When the page is getting rendered, you may need to wait for the data.
+> `<link rel="preload">` is used for prefetching. Sometimes browsers will show a warning if t... | false |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | bench/recursive-delete/.gitignore | @@ -0,0 +1 @@
+fixtures-* | true |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | bench/recursive-delete/recursive-delete.js | @@ -0,0 +1,15 @@
+const { join } = require('path')
+const { recursiveDelete } = require('next/dist/lib/recursive-delete')
+const resolveDataDir = join(__dirname, `fixtures-${process.argv[2]}`)
+
+async function test () {
+ const time = process.hrtime()
+ await recursiveDelete(resolveDataDir)
+
+ const hrtime = proce... | true |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | bench/recursive-delete/rimraf.js | @@ -0,0 +1,17 @@
+const { join } = require('path')
+const { promisify } = require('util')
+const rimrafMod = require('rimraf')
+const resolveDataDir = join(__dirname, `fixtures-${process.argv[2]}`, '**/*')
+const rimraf = promisify(rimrafMod)
+
+async function test () {
+ const time = process.hrtime()
+ await rimraf(... | true |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | bench/recursive-delete/run.sh | @@ -0,0 +1,69 @@
+# Uses https://github.com/divmain/fuzzponent
+mkdir fixtures-1
+cd fixtures-1
+fuzzponent -d 2 -s 20 > output.txt
+cd ..
+echo "rimraf 1"
+node rimraf.js 1
+
+mkdir fixtures-2
+cd fixtures-2
+fuzzponent -d 2 -s 20 > output.txt
+cd ..
+echo "rimraf 2"
+node rimraf.js 2
+
+mkdir fixtures-3
+cd fixtures-... | true |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | packages/next/export/index.js | @@ -1,4 +1,3 @@
-import rimrafModule from 'rimraf'
import { cpus } from 'os'
import { fork } from 'child_process'
import cp from 'recursive-copy'
@@ -9,9 +8,9 @@ import loadConfig from 'next-server/next-config'
import { PHASE_EXPORT, SERVER_DIRECTORY, PAGES_MANIFEST, CONFIG_FILE, BUILD_ID_FILE, CLIENT_STATIC_FILES_... | true |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | packages/next/lib/recursive-delete.ts | @@ -0,0 +1,61 @@
+import fs from 'fs'
+import { join } from 'path'
+import { promisify } from 'util'
+
+const readdir = promisify(fs.readdir)
+const stat = promisify(fs.stat)
+const rmdir = promisify(fs.rmdir)
+const unlink = promisify(fs.unlink)
+const sleep = promisify(setTimeout)
+
+const unlinkFile = async (p: stri... | true |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | packages/next/package.json | @@ -75,7 +75,6 @@
"react-is": "16.6.3",
"recursive-copy": "2.0.6",
"resolve": "1.5.0",
- "rimraf": "2.6.3",
"serialize-javascript": "1.4.0",
"source-map": "0.6.1",
"strip-ansi": "3.0.1",
@@ -113,7 +112,6 @@
"@types/nanoid": "1.2.0",
"@types/node-fetch": "2.1.4",
"@types/r... | true |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | packages/next/server/hot-reloader.js | @@ -2,19 +2,16 @@ import { join, normalize } from 'path'
import WebpackDevMiddleware from 'webpack-dev-middleware'
import WebpackHotMiddleware from 'webpack-hot-middleware'
import errorOverlayMiddleware from './lib/error-overlay-middleware'
-import rimrafModule from 'rimraf'
import onDemandEntryHandler, { normalize... | true |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | test/integration/export/test/index.test.js | @@ -15,14 +15,35 @@ import {
import ssr from './ssr'
import browser from './browser'
import dev from './dev'
+import { promisify } from 'util'
+import fs from 'fs'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
+const writeFile = promisify(fs.writeFile)
+const mkdir = promisify(fs.mkdir)
+const access = promi... | true |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | test/isolated/.gitignore | @@ -0,0 +1 @@
+test_resolvedata
\ No newline at end of file | true |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | test/unit/recursive-delete.test.js | @@ -0,0 +1,22 @@
+/* eslint-env jest */
+import { recursiveDelete } from 'next/dist/lib/recursive-delete'
+import { recursiveReadDir } from 'next/dist/lib/recursive-readdir'
+import cp from 'recursive-copy'
+import { join } from 'path'
+
+const resolveDataDir = join(__dirname, '..', 'isolated', '_resolvedata')
+const t... | true |
Other | vercel | next.js | 861edad459a3f39b5aa463507d8d53ae42b4319c.json | Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib
Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
re... | yarn.lock | @@ -1579,25 +1579,11 @@
dependencies:
"@types/node" "*"
-"@types/events@*":
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
- integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwy... | true |
Other | vercel | next.js | 068dd825f3a06f1bc90f1bbfd0fadf22d9fdf6ae.json | Add Grommet example (#6529)
Adds a new example showing how to use the [Grommet UI library](https://grommet.io/) with Next.js. | examples/with-grommet/.babelrc | @@ -0,0 +1,4 @@
+{
+ "presets": ["next/babel"],
+ "plugins": [["styled-components", { "ssr": true }]]
+} | true |
Other | vercel | next.js | 068dd825f3a06f1bc90f1bbfd0fadf22d9fdf6ae.json | Add Grommet example (#6529)
Adds a new example showing how to use the [Grommet UI library](https://grommet.io/) with Next.js. | examples/with-grommet/README.md | @@ -0,0 +1,50 @@
+[](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-grommet)
+
+# Example app with Grommet
+
+## How to use
+
+### Using `create-next-app`
+
+Execute [`create-next-app`](https://github.com/segmentio/create-ne... | true |
Other | vercel | next.js | 068dd825f3a06f1bc90f1bbfd0fadf22d9fdf6ae.json | Add Grommet example (#6529)
Adds a new example showing how to use the [Grommet UI library](https://grommet.io/) with Next.js. | examples/with-grommet/package.json | @@ -0,0 +1,20 @@
+{
+ "name": "with-grommet",
+ "version": "1.0.0",
+ "scripts": {
+ "dev": "next",
+ "build": "next build",
+ "start": "next start"
+ },
+ "dependencies": {
+ "grommet": "^2.5.5",
+ "next": "latest",
+ "react": "^16.7.0",
+ "react-dom": "^16.7.0",
+ "styled-components": "^4... | true |
Other | vercel | next.js | 068dd825f3a06f1bc90f1bbfd0fadf22d9fdf6ae.json | Add Grommet example (#6529)
Adds a new example showing how to use the [Grommet UI library](https://grommet.io/) with Next.js. | examples/with-grommet/pages/_app.js | @@ -0,0 +1,16 @@
+import React from 'react'
+import App, { Container } from 'next/app'
+import { Grommet, grommet as grommetTheme } from 'grommet'
+
+export default class MyApp extends App {
+ render () {
+ const { Component, pageProps } = this.props
+ return (
+ <Container>
+ <Grommet theme={grommet... | true |
Other | vercel | next.js | 068dd825f3a06f1bc90f1bbfd0fadf22d9fdf6ae.json | Add Grommet example (#6529)
Adds a new example showing how to use the [Grommet UI library](https://grommet.io/) with Next.js. | examples/with-grommet/pages/_document.js | @@ -0,0 +1,24 @@
+import Document from 'next/document'
+import { ServerStyleSheet } from 'styled-components'
+
+export default class MyDocument extends Document {
+ static async getInitialProps (ctx) {
+ const sheet = new ServerStyleSheet()
+ const originalRenderPage = ctx.renderPage
+
+ try {
+ ctx.rend... | true |
Other | vercel | next.js | 068dd825f3a06f1bc90f1bbfd0fadf22d9fdf6ae.json | Add Grommet example (#6529)
Adds a new example showing how to use the [Grommet UI library](https://grommet.io/) with Next.js. | examples/with-grommet/pages/index.js | @@ -0,0 +1,11 @@
+import React from 'react'
+import { Anchor, Box, Heading, Paragraph } from 'grommet'
+
+export default () => (
+ <Box align='center' margin='large'>
+ <Heading>Grommet is awesome!</Heading>
+ <Paragraph>
+ Find out more at <Anchor href='https://v2.grommet.io/'>https://v2.grommet.io/</Ancho... | true |
Other | vercel | next.js | d9c462bf379709db8070ff19217b12149f97b63f.json | Update timeout for plugin-mdx test (#6528) | test/integration/plugin-mdx/test/index.test.js | @@ -1,4 +1,5 @@
/* eslint-env jest */
+/* global jasmine */
import { join } from 'path'
import {
renderViaHTTP,
@@ -8,6 +9,7 @@ import {
} from 'next-test-utils'
const context = {}
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
describe('Configuration', () => {
beforeAll(async () => { | false |
Other | vercel | next.js | a271ab363314d7fff340da7d72c5e71783540675.json | Add a fallback CODEOWNER | .github/CODEOWNERS | @@ -1,9 +1,9 @@
# Learn how to add code owners here:
# https://help.github.com/en/articles/about-code-owners
+* @Timer
/packages/ @timneutkens @Timer @ijjk @lfades
-/examples/ @lfades
+/examples/ @lfades @Timer
/test/ @timneut... | false |
Other | vercel | next.js | 2ddf05a55bc1e653b1b0c3e1cf3e6c4290f136b3.json | Add myself as CODEOWNER | .github/CODEOWNERS | @@ -6,3 +6,4 @@
/test/ @timneutkens @Timer @ijjk @lfades
/bench/ @timneutkens
/errors/ @Timer
+* @Timer | false |
Other | vercel | next.js | 144eecd185f7083a112d7bbc178c6f59e4e34252.json | Add example with forwardRef to readme (#8428) | packages/next/README.md | @@ -585,6 +585,29 @@ export default About
Note: if passing a functional component as a child of `<Link>` you will need to wrap it in [`React.forwardRef`](https://reactjs.org/docs/react-api.html#reactforwardref)
+**Example with `React.forwardRef`**
+
+```jsx
+import React from 'react'
+import Link from 'next/link'
... | false |
Other | vercel | next.js | ec95927e14c4e25cf7c52e8bf17368867e5cfa57.json | Fix dynamic APIs with query params (#8386)
* Fix dynamic APIs with query params
If you define a dynamic API such as
```
pages/
api/
[id].js
```
This api becomes available at `/api/[id]`. If you send a request with
a query parameter the value of `req.query.id` will include the query
string as well as the path ... | packages/next/build/webpack/loaders/next-serverless-loader.ts | @@ -50,12 +50,13 @@ const nextServerlessLoader: loader.Loader = function() {
`
: ``
}
+ import { parse } from 'url'
import { apiResolver } from 'next-server/dist/server/api-utils'
export default (req, res) => {
const params = ${
isDynamicRoute(page)
- ... | true |
Other | vercel | next.js | ec95927e14c4e25cf7c52e8bf17368867e5cfa57.json | Fix dynamic APIs with query params (#8386)
* Fix dynamic APIs with query params
If you define a dynamic API such as
```
pages/
api/
[id].js
```
This api becomes available at `/api/[id]`. If you send a request with
a query parameter the value of `req.query.id` will include the query
string as well as the path ... | test/integration/api-support/test/index.test.js | @@ -220,6 +220,36 @@ function runTests (serverless = false) {
expect(data).toEqual({ post: 'post-1' })
})
+ it('should work with dynamic params and search string', async () => {
+ const data = await fetchViaHTTP(
+ appPort,
+ '/api/post-1?val=1',
+ null,
+ {}
+ ).then(res => res.ok ... | true |
Other | vercel | next.js | ec95927e14c4e25cf7c52e8bf17368867e5cfa57.json | Fix dynamic APIs with query params (#8386)
* Fix dynamic APIs with query params
If you define a dynamic API such as
```
pages/
api/
[id].js
```
This api becomes available at `/api/[id]`. If you send a request with
a query parameter the value of `req.query.id` will include the query
string as well as the path ... | test/integration/production/pages/api/[post]/index.js | @@ -0,0 +1,3 @@
+export default ({ query }, res) => {
+ res.status(200).json(query)
+} | true |
Other | vercel | next.js | ec95927e14c4e25cf7c52e8bf17368867e5cfa57.json | Fix dynamic APIs with query params (#8386)
* Fix dynamic APIs with query params
If you define a dynamic API such as
```
pages/
api/
[id].js
```
This api becomes available at `/api/[id]`. If you send a request with
a query parameter the value of `req.query.id` will include the query
string as well as the path ... | test/integration/production/test/index.test.js | @@ -233,6 +233,14 @@ describe('Production Usage', () => {
const body = await res.text()
expect(body).toEqual('API hello works')
})
+
+ it('should work with dynamic params and search string', async () => {
+ const url = `http://localhost:${appPort}/api/post-1?val=1`
+ const res = await fe... | true |
Other | vercel | next.js | ec95927e14c4e25cf7c52e8bf17368867e5cfa57.json | Fix dynamic APIs with query params (#8386)
* Fix dynamic APIs with query params
If you define a dynamic API such as
```
pages/
api/
[id].js
```
This api becomes available at `/api/[id]`. If you send a request with
a query parameter the value of `req.query.id` will include the query
string as well as the path ... | test/integration/serverless/pages/api/dynamic/[path]/index.js | @@ -0,0 +1,3 @@
+export default ({ query }, res) => {
+ res.json(query)
+} | true |
Other | vercel | next.js | ec95927e14c4e25cf7c52e8bf17368867e5cfa57.json | Fix dynamic APIs with query params (#8386)
* Fix dynamic APIs with query params
If you define a dynamic API such as
```
pages/
api/
[id].js
```
This api becomes available at `/api/[id]`. If you send a request with
a query parameter the value of `req.query.id` will include the query
string as well as the path ... | test/integration/serverless/pages/api/posts/[id].js | @@ -1,3 +1,3 @@
-export default (req, res) => {
- res.json({ post: req.query.id })
+export default ({ query }, res) => {
+ res.json(query)
} | true |
Other | vercel | next.js | ec95927e14c4e25cf7c52e8bf17368867e5cfa57.json | Fix dynamic APIs with query params (#8386)
* Fix dynamic APIs with query params
If you define a dynamic API such as
```
pages/
api/
[id].js
```
This api becomes available at `/api/[id]`. If you send a request with
a query parameter the value of `req.query.id` will include the query
string as well as the path ... | test/integration/serverless/test/index.test.js | @@ -121,8 +121,28 @@ describe('Serverless', () => {
it('should reply on dynamic API request successfully', async () => {
const result = await renderViaHTTP(appPort, '/api/posts/post-1')
- const { post } = JSON.parse(result)
- expect(post).toBe('post-1')
+ const { id } = JSON.parse(result)
+ expect... | true |
Other | vercel | next.js | 1e1eae2f257d73fcaa92ed7e0a5b77ef3e78bf99.json | Upgrade `send` dep (#8424)
This upgrade adds native support for wasm.
---
Closes https://github.com/zeit/next.js/issues/8208 | packages/next-server/package.json | @@ -50,7 +50,7 @@
"prop-types": "15.7.2",
"raw-body": "2.4.0",
"react-is": "16.8.6",
- "send": "0.16.1",
+ "send": "0.17.1",
"styled-jsx": "3.2.1",
"url": "0.11.0"
}, | true |
Other | vercel | next.js | 1e1eae2f257d73fcaa92ed7e0a5b77ef3e78bf99.json | Upgrade `send` dep (#8424)
This upgrade adds native support for wasm.
---
Closes https://github.com/zeit/next.js/issues/8208 | packages/next-server/server/serve-static.ts | @@ -1,9 +1,6 @@
import { IncomingMessage, ServerResponse } from 'http'
import send from 'send'
-// since send doesn't support wasm yet
-send.mime.define({ 'application/wasm': ['wasm'] })
-
export function serveStatic(
req: IncomingMessage,
res: ServerResponse, | true |
Other | vercel | next.js | 1e1eae2f257d73fcaa92ed7e0a5b77ef3e78bf99.json | Upgrade `send` dep (#8424)
This upgrade adds native support for wasm.
---
Closes https://github.com/zeit/next.js/issues/8208 | yarn.lock | @@ -5091,7 +5091,7 @@ delegates@^1.0.0:
resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a"
integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=
-depd@~1.1.1, depd@~1.1.2:
+depd@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/depd/-/depd-1... | true |
Other | vercel | next.js | c13d1bca27087512adb491b661e8df6fa726f686.json | Fix a typo in with-reasonml-todo example (#8420)
Noticed a minor typo | examples/with-reasonml-todo/README.md | @@ -1,6 +1,6 @@
# Example app using ReasonML & ReasonReact components
-This example builds upon the original `with-reasonml` example to sho how a
+This example builds upon the original `with-reasonml` example to show how a
global state object can be used to track state across page within the application.
It is i... | false |
Other | vercel | next.js | cfd60804354431a36b40c1ba564e5d665cfec4f1.json | Feature: Add transparent JSX optimization (#8350)
* Add transparent JSX optimization.
* fix duplicate React import
* fix React not being imported when only a single Fragment node is present in a source module
* remove babel-plugin-react-require
* Fix JSX optimization for CommonJS source files. | packages/next/build/babel/plugins/jsx-pragma.ts | @@ -0,0 +1,94 @@
+import { PluginObj } from '@babel/core'
+import { NodePath } from '@babel/traverse'
+import * as BabelTypes from '@babel/types'
+
+export default function({
+ types: t,
+}: {
+ types: typeof BabelTypes
+}): PluginObj<any> {
+ return {
+ inherits: require('babel-plugin-syntax-jsx'),
+ visitor:... | true |
Other | vercel | next.js | cfd60804354431a36b40c1ba564e5d665cfec4f1.json | Feature: Add transparent JSX optimization (#8350)
* Add transparent JSX optimization.
* fix duplicate React import
* fix React not being imported when only a single Fragment node is present in a source module
* remove babel-plugin-react-require
* Fix JSX optimization for CommonJS source files. | packages/next/build/babel/preset.ts | @@ -97,13 +97,25 @@ module.exports = (
// This adds @babel/plugin-transform-react-jsx-source and
// @babel/plugin-transform-react-jsx-self automatically in development
development: isDevelopment || isTest,
+ pragma: '__jsx',
...options['preset-react'],
},
... | true |
Other | vercel | next.js | cfd60804354431a36b40c1ba564e5d665cfec4f1.json | Feature: Add transparent JSX optimization (#8350)
* Add transparent JSX optimization.
* fix duplicate React import
* fix React not being imported when only a single Fragment node is present in a source module
* remove babel-plugin-react-require
* Fix JSX optimization for CommonJS source files. | packages/next/package.json | @@ -72,7 +72,6 @@
"autodll-webpack-plugin": "0.4.2",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "8.0.6",
- "babel-plugin-react-require": "3.0.0",
"babel-plugin-transform-define": "1.3.1",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"chalk": "2.4.2", | true |
Other | vercel | next.js | cfd60804354431a36b40c1ba564e5d665cfec4f1.json | Feature: Add transparent JSX optimization (#8350)
* Add transparent JSX optimization.
* fix duplicate React import
* fix React not being imported when only a single Fragment node is present in a source module
* remove babel-plugin-react-require
* Fix JSX optimization for CommonJS source files. | test/unit/next-babel.test.js | @@ -0,0 +1,98 @@
+/* eslint-env jest */
+import { transform } from '@babel/core'
+
+const trim = s =>
+ s
+ .join('\n')
+ .trim()
+ .replace(/^\s+/gm, '')
+
+// avoid generating __source annotations in JSX during testing:
+const NODE_ENV = process.env.NODE_ENV
+process.env.NODE_ENV = 'production'
+const prese... | true |
Other | vercel | next.js | cfd60804354431a36b40c1ba564e5d665cfec4f1.json | Feature: Add transparent JSX optimization (#8350)
* Add transparent JSX optimization.
* fix duplicate React import
* fix React not being imported when only a single Fragment node is present in a source module
* remove babel-plugin-react-require
* Fix JSX optimization for CommonJS source files. | yarn.lock | @@ -3204,11 +3204,6 @@ babel-plugin-jest-hoist@^24.6.0:
dependencies:
"@types/babel__traverse" "^7.0.6"
-babel-plugin-react-require@3.0.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/babel-plugin-react-require/-/babel-plugin-react-require-3.0.0.tgz#2e4e7b4496b93a654a1c80042276de4e4eeb20e3"
- ... | true |
Other | vercel | next.js | b47348bdf8e3fbf136ea6d8780d976f6d5db6aa1.json | Change componentWillMount to UNSAFE (#8357)
* Change to unsafe
* Ignore | packages/next-server/lib/loadable.js | @@ -170,8 +170,9 @@ function createLoadableComponent (loadFn, options) {
}
static contextType = LoadableContext
-
- componentWillMount () {
+ // TODO: change it before next major React release
+ // eslint-disable-next-line
+ UNSAFE_componentWillMount() {
this._mounted = true
this._... | false |
Other | vercel | next.js | a7baeb045e854597db610f6976251c5093560a87.json | fix(examples): correct the path in with-electron (#8370)
* fix(examples): correct path in with-electron
* Update index.js | examples/with-electron/main/index.js | @@ -23,7 +23,7 @@ app.on('ready', async () => {
const url = isDev
? 'http://localhost:8000/start'
: format({
- pathname: join(__dirname, '../renderer/start/index.html'),
+ pathname: join(__dirname, '../renderer/start.html'),
protocol: 'file:',
slashes: true
}) | false |
Other | vercel | next.js | 3c611822abd9388a44dc6576c36f964368b75af7.json | Create a unique instance of transform-define (#8371) | packages/next/build/webpack/loaders/next-babel-loader.js | @@ -164,7 +164,8 @@ module.exports = babelLoader.custom(babel => {
options.plugins.push([
'transform-define',
- { 'typeof window': isServer ? 'undefined' : 'object' }
+ { 'typeof window': isServer ? 'undefined' : 'object' },
+ 'next-js-transform-define-instance'
])
... | true |
Other | vercel | next.js | 3c611822abd9388a44dc6576c36f964368b75af7.json | Create a unique instance of transform-define (#8371) | test/integration/babel/.babelrc | @@ -1,6 +1,4 @@
{
- "presets": [
- "next/babel",
- "@babel/preset-flow"
- ]
-}
\ No newline at end of file
+ "presets": ["next/babel", "@babel/preset-flow"],
+ "plugins": [["transform-define", { "TEST_VAR": "hello" }]]
+} | true |
Other | vercel | next.js | 874b5338d28555b12d137b1787bafdbf451c930a.json | Add tests for typeof window replacing (#8361)
* Add tests for typeof window replacing
* Update test for typeof window replace from a node_module | test/integration/typeof-window-replace/app/node_modules/comps/index.js | @@ -0,0 +1,5 @@
+const react = require('react')
+
+module.exports = function() {
+ return react.createElement('p', null, 'MyComp:', typeof window)
+} | true |
Other | vercel | next.js | 874b5338d28555b12d137b1787bafdbf451c930a.json | Add tests for typeof window replacing (#8361)
* Add tests for typeof window replacing
* Update test for typeof window replace from a node_module | test/integration/typeof-window-replace/app/node_modules/comps/package.json | @@ -0,0 +1,6 @@
+{
+ "name": "comps",
+ "version": "1.0.0",
+ "main": "index.js",
+ "license": "MIT"
+} | true |
Other | vercel | next.js | 874b5338d28555b12d137b1787bafdbf451c930a.json | Add tests for typeof window replacing (#8361)
* Add tests for typeof window replacing
* Update test for typeof window replace from a node_module | test/integration/typeof-window-replace/app/package.json | @@ -0,0 +1,6 @@
+{
+ "name": "app",
+ "version": "1.0.0",
+ "main": "index.js",
+ "license": "MIT"
+} | true |
Other | vercel | next.js | 874b5338d28555b12d137b1787bafdbf451c930a.json | Add tests for typeof window replacing (#8361)
* Add tests for typeof window replacing
* Update test for typeof window replace from a node_module | test/integration/typeof-window-replace/app/pages/index.js | @@ -0,0 +1,12 @@
+import MyComp from 'comps'
+
+const Page = () => (
+ <>
+ <p>Hello {typeof window}</p>
+ <MyComp />
+ </>
+)
+
+Page.getInitialProps = () => ({})
+
+export default Page | true |
Other | vercel | next.js | 874b5338d28555b12d137b1787bafdbf451c930a.json | Add tests for typeof window replacing (#8361)
* Add tests for typeof window replacing
* Update test for typeof window replace from a node_module | test/integration/typeof-window-replace/test/index.test.js | @@ -0,0 +1,41 @@
+/* eslint-env jest */
+/* global jasmine */
+import fs from 'fs-extra'
+import path from 'path'
+import { nextBuild } from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
+
+const appDir = path.join(__dirname, '../app')
+let buildId
+
+describe('typeof window replace', () => {
+ ... | true |
Other | vercel | next.js | 99f2d2a1099964aaa389d4a488f0ec1a96ed3100.json | Add a note for multiple dynamic route segments (#8359)
* Update README.md
* Update README.md
* Update README.md
* Update README.md | packages/next/README.md | @@ -331,6 +331,11 @@ The matched path parameter will be sent as a query parameter to the page.
For example, the route `/post/abc` will have the following `query` object: `{ pid: 'abc' }`.
Similarly, the route `/post/abc?foo=bar` will have the `query` object: `{ foo: 'bar', pid: 'abc' }`.
+> Note: Multiple dynamic r... | false |
Other | vercel | next.js | 57d91f7d38001ab0970409673952a170af63f523.json | Fix AppTree type not allowing extra props (#8352) | packages/next-server/lib/utils.ts | @@ -99,12 +99,12 @@ export interface NextPageContext {
/**
* `Component` the tree of the App to use if needing to render separately
*/
- AppTree: NextComponentType
+ AppTree: AppType
}
export type AppContextType<R extends NextRouter = NextRouter> = {
Component: NextComponentType<NextPageContext>
- ... | true |
Other | vercel | next.js | 57d91f7d38001ab0970409673952a170af63f523.json | Fix AppTree type not allowing extra props (#8352) | test/integration/app-tree/pages/_app.tsx | @@ -1,11 +1,16 @@
import React from 'react'
import Link from 'next/link'
import { render } from 'react-dom'
-import App, { Container } from 'next/app'
+import App, { Container, AppContext } from 'next/app'
import { renderToString } from 'react-dom/server'
-class MyApp extends App {
- static async getInitialProps... | true |
Other | vercel | next.js | 57d91f7d38001ab0970409673952a170af63f523.json | Fix AppTree type not allowing extra props (#8352) | test/integration/app-tree/tsconfig.json | @@ -0,0 +1,29 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "lib": [
+ "dom",
+ "dom.iterable",
+ "esnext"
+ ],
+ "allowJs": true,
+ "skipLibCheck": true,
+ "strict": false,
+ "forceConsistentCasingInFileNames": true,
+ "noEmit": true,
+ "esModuleInterop": true,
+ "modu... | true |
Other | vercel | next.js | bc9f2b6139b26d45203a4cd71b7b6a56588a37fd.json | Minify ncc'd packages for download speed (#8341) | packages/next/taskfile-ncc.js | @@ -9,6 +9,7 @@ module.exports = function (task) {
return ncc(join(__dirname, file.dir, file.base), {
// cannot bundle
externals: ['chokidar'],
+ minify: true,
...options
}).then(({ code, assets }) => {
Object.keys(assets).forEach(key => | false |
Other | vercel | next.js | 9993092ddd82a8892c112dd1b06c3f0532ec3c83.json | Add test for AMP errors during auto prerendering (#8335)
* Add test for AMP errors during auto-prerendering
* bump
* Add stats-app config for dynamic port
* bump
* bump | test/integration/amp-export-validation/test/index.test.js | @@ -13,10 +13,28 @@ const appDir = join(__dirname, '../')
const outDir = join(appDir, 'out')
const nextConfig = new File(join(appDir, 'next.config.js'))
+let buildOutput
+
describe('AMP Validation on Export', () => {
beforeAll(async () => {
- await nextBuild(appDir)
+ const { stdout = '', stderr = '' } = ... | false |
Other | vercel | next.js | 8d219c23712441f5d5abae580e8c7924151a2806.json | Detect @types/ package for compiled packages (#8340) | packages/next/taskfile-ncc.js | @@ -41,6 +41,22 @@ function writePackageManifest (packageName) {
let typesFile = types || typings
if (typesFile) {
typesFile = require.resolve(join(packageName, typesFile))
+ } else {
+ try {
+ const typesPackage = `@types/${packageName}`
+
+ const { types, typings } = require(join(typesPackage... | false |
Other | vercel | next.js | ab0384deeffff7e3b3d1715bd8601a6f9be62e15.json | Fix TypeScript setup with empty file (#8332)
New versions of TypeScript now throw an error when no matching TypeScript files are found. We still want to setup in this case.
-----
Closes #8324 | packages/next/lib/verifyTypeScriptSetup.ts | @@ -192,6 +192,14 @@ export async function verifyTypeScriptSetup(dir: string): Promise<void> {
path.dirname(tsConfigPath)
)
+ if (result.errors) {
+ result.errors = result.errors.filter(
+ ({ code }) =>
+ // No inputs were found in config file
+ code !== 18003
+ )
+ ... | true |
Other | vercel | next.js | ab0384deeffff7e3b3d1715bd8601a6f9be62e15.json | Fix TypeScript setup with empty file (#8332)
New versions of TypeScript now throw an error when no matching TypeScript files are found. We still want to setup in this case.
-----
Closes #8324 | test/integration/tsconfig-verifier/test/index.test.js | @@ -1,7 +1,14 @@
/* eslint-env jest */
/* global jasmine */
import path from 'path'
-import { exists, remove, readFile, readJSON, writeJSON } from 'fs-extra'
+import {
+ exists,
+ remove,
+ readFile,
+ readJSON,
+ writeJSON,
+ createFile
+} from 'fs-extra'
import { launchApp, findPort, killApp, renderViaHTT... | true |
Other | vercel | next.js | 6b516f6c8482fbf3312fadc010999fec26334591.json | Remove accidental support for invalid JavaScript (#8077)
* Remove accidental support for invalid JavaScript
Next.js inadvertently supported users mixing ES Modules and CommonJS due to a Babel bug that was fixed in v7.
This removes the hack in favor of the new Babel `sourceType` feature.
**This will result in broken c... | packages/next/build/babel/preset.ts | @@ -47,6 +47,7 @@ type NextBabelPresetOptions = {
type BabelPreset = {
presets?: PluginItem[] | null
plugins?: PluginItem[] | null
+ sourceType?: 'script' | 'module' | 'unambiguous'
overrides?: any[]
}
@@ -87,6 +88,7 @@ module.exports = (
}
return {
+ sourceType: 'unambiguous',
presets: [
... | true |
Other | vercel | next.js | 6b516f6c8482fbf3312fadc010999fec26334591.json | Remove accidental support for invalid JavaScript (#8077)
* Remove accidental support for invalid JavaScript
Next.js inadvertently supported users mixing ES Modules and CommonJS due to a Babel bug that was fixed in v7.
This removes the hack in favor of the new Babel `sourceType` feature.
**This will result in broken c... | packages/next/build/webpack-config.ts | @@ -69,6 +69,7 @@ export default async function getBaseWebpackConfig(
loader: 'next-babel-loader',
options: {
isServer,
+ hasModern: !!config.experimental.modern,
distDir,
cwd: dir,
cache: !selectivePageBuilding, | true |
Other | vercel | next.js | 6b516f6c8482fbf3312fadc010999fec26334591.json | Remove accidental support for invalid JavaScript (#8077)
* Remove accidental support for invalid JavaScript
Next.js inadvertently supported users mixing ES Modules and CommonJS due to a Babel bug that was fixed in v7.
This removes the hack in favor of the new Babel `sourceType` feature.
**This will result in broken c... | packages/next/build/webpack/loaders/next-babel-loader.js | @@ -2,8 +2,8 @@ import hash from 'string-hash'
import { join, basename } from 'path'
import babelLoader from 'babel-loader'
-// increment 'c' to invalidate cache
-const cacheKey = 'babel-cache-' + 'c' + '-'
+// increment 'd' to invalidate cache
+const cacheKey = 'babel-cache-' + 'd' + '-'
const nextBabelPreset = r... | true |
Other | vercel | next.js | 3eca88609a7e85d155c6d3efe712745e46c5d65a.json | Prevent false positive experimental warning (#8284)
* Prevent false positive experimental warning
* Add tests for experimental warning | packages/next-server/server/config.ts | @@ -56,7 +56,11 @@ const experimentalWarning = execOnce(() => {
function assignDefaults(userConfig: { [key: string]: any }) {
Object.keys(userConfig).forEach((key: string) => {
- if (key === 'experimental' && userConfig[key]) {
+ if (
+ key === 'experimental' &&
+ userConfig[key] &&
+ userCon... | true |
Other | vercel | next.js | 3eca88609a7e85d155c6d3efe712745e46c5d65a.json | Prevent false positive experimental warning (#8284)
* Prevent false positive experimental warning
* Add tests for experimental warning | test/integration/config-experimental-warning/pages/index.js | @@ -0,0 +1 @@
+export default () => 'hi' | true |
Other | vercel | next.js | 3eca88609a7e85d155c6d3efe712745e46c5d65a.json | Prevent false positive experimental warning (#8284)
* Prevent false positive experimental warning
* Add tests for experimental warning | test/integration/config-experimental-warning/test/index.test.js | @@ -0,0 +1,62 @@
+/* eslint-env jest */
+/* global jasmine */
+import { join } from 'path'
+import { nextBuild, File } from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 30
+const appDir = join(__dirname, '..')
+const configFile = new File(join(appDir, '/next.config.js'))
+
+describe('Promise in next c... | true |
Other | vercel | next.js | 35e7b21df1b0df8f1fbe9863b29a4f5f734d86dc.json | Remove extra variable (#8329) | packages/next-server/lib/amp.ts | @@ -10,7 +10,6 @@ export function isInAmpMode({
}
export function useAmp() {
- const ampState = React.useContext(AmpStateContext)
- // un-comment below to not be considered AMP in dirty mode
- return isInAmpMode(ampState) // && ampMode.hasQuery
+ // Don't assign the context value to a variable to save bytes
+ ... | false |
Other | vercel | next.js | 36aabe05a2396c5a1f17b790ebc2abda4b8a4136.json | Show warning if next export detects an API route (#8257)
* Throw error if next export detects an api route
* Moved the test to the export tests
* Added missing comma
* Move the API route comment
* Add comma after replace
* Show a warning instead | errors/api-routes-static-export.md | @@ -0,0 +1,13 @@
+# API routes in Static export
+
+#### Why This Warning Occurred
+
+An `exportPathMap` path was matched to an API route. `next export` will not prerender API routes to HTML.
+
+#### Possible Ways to Fix It
+
+Remove any paths using API routes from your `exportPathMap` in `next.config.js`.
+
+### Useful... | true |
Other | vercel | next.js | 36aabe05a2396c5a1f17b790ebc2abda4b8a4136.json | Show warning if next export detects an API route (#8257)
* Throw error if next export detects an api route
* Moved the test to the export tests
* Added missing comma
* Move the API route comment
* Add comma after replace
* Show a warning instead | packages/next/export/index.js | @@ -4,6 +4,7 @@ import { recursiveCopy } from '../lib/recursive-copy'
import mkdirpModule from 'mkdirp'
import { resolve, join } from 'path'
import { existsSync, readFileSync } from 'fs'
+import chalk from 'chalk'
import loadConfig, {
isTargetLikeServerless
} from 'next-server/dist/server/config'
@@ -36,7 +37,6... | true |
Other | vercel | next.js | 36aabe05a2396c5a1f17b790ebc2abda4b8a4136.json | Show warning if next export detects an API route (#8257)
* Throw error if next export detects an api route
* Moved the test to the export tests
* Added missing comma
* Move the API route comment
* Add comma after replace
* Show a warning instead | test/integration/api-support/test/index.test.js | @@ -10,7 +10,6 @@ import {
renderViaHTTP,
nextBuild,
nextStart,
- runNextCommand,
File
} from 'next-test-utils'
import json from '../big.json'
@@ -286,17 +285,6 @@ function runTests (serverless = false) {
}
})
- if (!serverless) {
- it('should warn about API export', async () => {
- co... | true |
Other | vercel | next.js | 36aabe05a2396c5a1f17b790ebc2abda4b8a4136.json | Show warning if next export detects an API route (#8257)
* Throw error if next export detects an api route
* Moved the test to the export tests
* Added missing comma
* Move the API route comment
* Add comma after replace
* Show a warning instead | test/integration/export/next.config.js | @@ -37,6 +37,7 @@ module.exports = phase => {
query: { text: 'this file has an extension' }
},
'/query': { page: '/query', query: { a: 'blue' } },
+ // API route
'/blog/nextjs/comment/test': { page: '/blog/[post]/comment/[id]' }
}
} // end exportPathMap | true |
Other | vercel | next.js | 36aabe05a2396c5a1f17b790ebc2abda4b8a4136.json | Show warning if next export detects an API route (#8257)
* Throw error if next export detects an api route
* Moved the test to the export tests
* Added missing comma
* Move the API route comment
* Add comma after replace
* Show a warning instead | test/integration/export/pages/api/data.js | @@ -0,0 +1,3 @@
+export default (req, res) => {
+ res.send('Hello World')
+} | true |
Other | vercel | next.js | 36aabe05a2396c5a1f17b790ebc2abda4b8a4136.json | Show warning if next export detects an API route (#8257)
* Throw error if next export detects an api route
* Moved the test to the export tests
* Added missing comma
* Move the API route comment
* Add comma after replace
* Show a warning instead | test/integration/export/test/api-routes.js | @@ -0,0 +1,28 @@
+/* eslint-env jest */
+import { join } from 'path'
+import { File, runNextCommand } from 'next-test-utils'
+
+export default function (context) {
+ describe('API routes export', () => {
+ const nextConfig = new File(join(context.appDir, 'next.config.js'))
+
+ beforeEach(() => {
+ nextConfi... | true |
Other | vercel | next.js | 36aabe05a2396c5a1f17b790ebc2abda4b8a4136.json | Show warning if next export detects an API route (#8257)
* Throw error if next export detects an api route
* Moved the test to the export tests
* Added missing comma
* Move the API route comment
* Add comma after replace
* Show a warning instead | test/integration/export/test/index.test.js | @@ -19,6 +19,7 @@ import dev from './dev'
import { promisify } from 'util'
import fs from 'fs'
import dynamic from './dynamic'
+import apiRoutes from './api-routes'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
@@ -96,4 +97,5 @@ describe('Static Export', () => {
browser(context)
dev(devContext)
dyna... | true |
Other | vercel | next.js | f01af7cefb47ce347c78238ca0a5513701183107.json | Add config/test app for new PR stats set-up (#8317)
* Add config/test app for new PR stats set-up
* Move config/test app to test folder | test/.stats-app/package.json | @@ -0,0 +1,11 @@
+{
+ "name": "stats-app",
+ "version": "1.0.0",
+ "main": "index.js",
+ "license": "MIT",
+ "dependencies": {
+ "next": "latest",
+ "react": "16.9.0",
+ "react-dom": "16.9.0"
+ }
+} | true |
Other | vercel | next.js | f01af7cefb47ce347c78238ca0a5513701183107.json | Add config/test app for new PR stats set-up (#8317)
* Add config/test app for new PR stats set-up
* Move config/test app to test folder | test/.stats-app/pages/index.js | @@ -0,0 +1,5 @@
+const Page = () => 'Hello world 👋'
+
+Page.getInitialProps = () => ({})
+
+export default Page | true |
Other | vercel | next.js | f01af7cefb47ce347c78238ca0a5513701183107.json | Add config/test app for new PR stats set-up (#8317)
* Add config/test app for new PR stats set-up
* Move config/test app to test folder | test/.stats-app/pages/link.js | @@ -0,0 +1,14 @@
+import Link from 'next/link'
+
+function aLink (props) {
+ return (
+ <div>
+ <h3>A Link page!</h3>
+ <Link href='/'>Go to /</Link>
+ </div>
+ )
+}
+
+aLink.getInitialProps = () => ({})
+
+export default aLink | true |
Other | vercel | next.js | f01af7cefb47ce347c78238ca0a5513701183107.json | Add config/test app for new PR stats set-up (#8317)
* Add config/test app for new PR stats set-up
* Move config/test app to test folder | test/.stats-app/pages/routerDirect.js | @@ -0,0 +1,10 @@
+/* eslint-disable-next-line */
+import Router from 'next/router'
+
+function routerDirect (props) {
+ return <div>I import the router directly</div>
+}
+
+routerDirect.getInitialProps = () => ({})
+
+export default routerDirect | true |
Other | vercel | next.js | f01af7cefb47ce347c78238ca0a5513701183107.json | Add config/test app for new PR stats set-up (#8317)
* Add config/test app for new PR stats set-up
* Move config/test app to test folder | test/.stats-app/pages/withRouter.js | @@ -0,0 +1,9 @@
+import { withRouter } from 'next/router'
+
+function useWithRouter (props) {
+ return <div>I use withRouter</div>
+}
+
+useWithRouter.getInitialProps = () => ({})
+
+export default withRouter(useWithRouter) | true |
Other | vercel | next.js | f01af7cefb47ce347c78238ca0a5513701183107.json | Add config/test app for new PR stats set-up (#8317)
* Add config/test app for new PR stats set-up
* Move config/test app to test folder | test/.stats-app/stats-config.js | @@ -0,0 +1,134 @@
+const clientGlobs = [
+ {
+ name: 'Client Bundles (main, webpack, commons)',
+ globs: [
+ '.next/static/runtime/+(main|webpack)-!(*.module.js)',
+ '.next/static/chunks/commons!(*.module.js)'
+ ]
+ },
+ {
+ name: 'Client Bundles (main, webpack, commons) Modern',
+ globs: [
... | true |
Other | vercel | next.js | 869bf0f16ce59ff8e044bbf5ab320271f7f206f8.json | Remove 405 from render method (#8323)
* Revert 405 on pages
* Modify tests | packages/next-server/server/next-server.ts | @@ -524,12 +524,6 @@ export default class Server {
return this.findPageComponents(pathname, query)
.then(
result => {
- if (!(req.method === 'GET' || req.method === 'HEAD')) {
- res.statusCode = 405
- res.setHeader('Allow', ['GET', 'HEAD'])
- return this.re... | true |
Other | vercel | next.js | 869bf0f16ce59ff8e044bbf5ab320271f7f206f8.json | Remove 405 from render method (#8323)
* Revert 405 on pages
* Modify tests | test/integration/api-support/test/index.test.js | @@ -197,12 +197,12 @@ function runTests (serverless = false) {
expect(data).toEqual({ nextjs: 'cool' })
})
- it('should return 405 on POST on pages', async () => {
+ it('should return 200 on POST on pages', async () => {
const res = await fetchViaHTTP(appPort, '/user', null, {
method: 'POST'
... | true |
Other | vercel | next.js | 869bf0f16ce59ff8e044bbf5ab320271f7f206f8.json | Remove 405 from render method (#8323)
* Revert 405 on pages
* Modify tests | test/integration/production/test/index.test.js | @@ -80,11 +80,11 @@ describe('Production Usage', () => {
expect(res.status).toBe(404)
})
- it('should render 405 for POST on page', async () => {
+ it('should render 200 for POST on page', async () => {
const res = await fetch(`http://localhost:${appPort}/about`, {
method: 'POST'
... | true |
Other | vercel | next.js | b4db0421ff40e79bbe9b610af884bc4655d0ab36.json | Rewrite SSG Transform for Recursive Cleanup (#9652) | packages/next/build/babel/plugins/next-ssg-transform.ts | @@ -1,4 +1,4 @@
-import { PluginObj } from '@babel/core'
+import { NodePath, PluginObj } from '@babel/core'
import * as BabelTypes from '@babel/types'
const pageComponentVar = '__NEXT_COMP'
@@ -7,144 +7,242 @@ const prerenderId = '__NEXT_SPR'
export const EXPORT_NAME_GET_STATIC_PROPS = 'unstable_getStaticProps'
e... | true |
Other | vercel | next.js | b4db0421ff40e79bbe9b610af884bc4655d0ab36.json | Rewrite SSG Transform for Recursive Cleanup (#9652) | test/unit/babel-plugin-next-ssg-transform.test.js | @@ -261,5 +261,39 @@ describe('babel plugin (next-ssg-transform)', () => {
`"export class MyClass{}const __NEXT_COMP=function Test(){return __jsx(\\"div\\",null);};__NEXT_COMP.__NEXT_SPR=true export default __NEXT_COMP;"`
)
})
+
+ it(`should remove re-exported function declarations' dependents (... | true |
Other | vercel | next.js | 05ba91d3ba50d097a5c3ec59c971778e6b8d0fc0.json | Add Additional SSG Transform Test | test/unit/babel-plugin-next-ssg-transform.test.js | @@ -206,6 +206,24 @@ describe('babel plugin (next-ssg-transform)', () => {
)
})
+ it('should remove re-exported variable declarations (safe)', () => {
+ const output = babel(trim`
+ const unstable_getStaticPaths = () => {
+ return []
+ }, a = 2
+
+ export { unstable_g... | false |
Other | vercel | next.js | e76fc1867503c9cc321ba926ae2a10af80b8a550.json | Remove Scope Bindings for SSG (#9642) | packages/next/build/babel/plugins/next-ssg-transform.ts | @@ -55,16 +55,27 @@ export default function nextTransformSsg({
name === EXPORT_NAME_GET_STATIC_PROPS ||
name === EXPORT_NAME_GET_STATIC_PATHS
) {
- path.remove()
state.isPrerender = true
- if (path.parent.type !== 'ExportN... | true |
Other | vercel | next.js | e76fc1867503c9cc321ba926ae2a10af80b8a550.json | Remove Scope Bindings for SSG (#9642) | test/unit/babel-plugin-next-ssg-transform.test.js | @@ -187,5 +187,41 @@ describe('babel plugin (next-ssg-transform)', () => {
`"export const foo=2;const __NEXT_COMP=function Test(){return __jsx(\\"div\\",null);};__NEXT_COMP.__NEXT_SPR=true export default __NEXT_COMP;"`
)
})
+
+ it('should remove re-exported variable declarations', () => {
+ ... | true |
Other | vercel | next.js | 7a51b888c59d23ee96eedd030e7f1d559904b157.json | Add SSG Support for VariableDeclarations (#9641) | packages/next/build/babel/plugins/next-ssg-transform.ts | @@ -69,6 +69,30 @@ export default function nextTransformSsg({
}
}
},
+ // export const unstable_getStaticPaths = () => {}
+ VariableDeclaration(path) {
+ if (path.parent.type !== 'ExportNamedDeclaration') {
+ return
+ ... | true |
Other | vercel | next.js | 7a51b888c59d23ee96eedd030e7f1d559904b157.json | Add SSG Support for VariableDeclarations (#9641) | test/unit/babel-plugin-next-ssg-transform.test.js | @@ -127,5 +127,65 @@ describe('babel plugin (next-ssg-transform)', () => {
`"export function Noop(){}const __NEXT_COMP=function Test(){return __jsx(\\"div\\",null);};__NEXT_COMP.__NEXT_SPR=true export default __NEXT_COMP;"`
)
})
+
+ it('should remove named export variable declarations', () => {
... | true |
Other | vercel | next.js | a718df5f56e156e31896bce3ad025d2594a3306b.json | Rewrite SSG Transform (#9640)
* Rewrite SSG Transform
* Add Named Declaration Support
* more adjustments
* Re-crawl scope | packages/next/build/babel/plugins/next-ssg-transform.ts | @@ -1,123 +1,119 @@
-import { NodePath, PluginObj } from '@babel/core'
+import { PluginObj } from '@babel/core'
import * as BabelTypes from '@babel/types'
const pageComponentVar = '__NEXT_COMP'
const prerenderId = '__NEXT_SPR'
-export const EXPORT_NAME_GET_STATIC_PROPS = 'unstable_getStaticProps'
-const EXPORT_NAM... | true |
Other | vercel | next.js | a718df5f56e156e31896bce3ad025d2594a3306b.json | Rewrite SSG Transform (#9640)
* Rewrite SSG Transform
* Add Named Declaration Support
* more adjustments
* Re-crawl scope | test/unit/babel-plugin-next-ssg-transform.test.js | @@ -70,7 +70,7 @@ describe('babel plugin (next-ssg-transform)', () => {
)
})
- it('should remove named export declarations', () => {
+ it('should remove named export function declarations', () => {
const output = babel(trim`
export function unstable_getStaticPaths() {
retu... | true |
Other | vercel | next.js | 926a4e5abc67b9ef605a097a6d16e86876fe5781.json | Fix instructions for with-netlify-cms example (#9637)
Looks like the directory name was missed after a copy/paste from another example. | examples/with-netlify-cms/readme.md | @@ -18,7 +18,7 @@ Download the example:
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-netlify-cms
-cd nested-components
+cd with-netlify-cms
```
Install it and run: | false |
Other | vercel | next.js | 30ff9a339f2aab01acac1c7b884b1bbf522c49cd.json | Remove Extraneous Imports in Pages (#9627)
* Remove Extraneous Imports in Pages
* Add test
* bump cache key | packages/next/build/babel/plugins/dangerously-remove-unused-imports.ts | @@ -0,0 +1,35 @@
+import { NodePath, PluginObj } from '@babel/core'
+import * as BabelTypes from '@babel/types'
+
+export default function(): PluginObj<any> {
+ return {
+ name: 'dangerously-remove-unused-imports',
+ visitor: {
+ Program: {
+ exit(path: NodePath<BabelTypes.Program>) {
+ Obje... | true |
Other | vercel | next.js | 30ff9a339f2aab01acac1c7b884b1bbf522c49cd.json | Remove Extraneous Imports in Pages (#9627)
* Remove Extraneous Imports in Pages
* Add test
* bump cache key | packages/next/build/babel/plugins/next-page-config.ts | @@ -7,7 +7,7 @@ const configKeys = new Set(['amp'])
const pageComponentVar = '__NEXT_COMP'
// this value can't be optimized by terser so the shorter the better
const prerenderId = '__NEXT_SPR'
-const EXPORT_NAME_GET_STATIC_PROPS = 'unstable_getStaticProps'
+export const EXPORT_NAME_GET_STATIC_PROPS = 'unstable_getSt... | true |
Other | vercel | next.js | 30ff9a339f2aab01acac1c7b884b1bbf522c49cd.json | Remove Extraneous Imports in Pages (#9627)
* Remove Extraneous Imports in Pages
* Add test
* bump cache key | packages/next/build/webpack/loaders/next-babel-loader.js | @@ -1,10 +1,11 @@
import hash from 'string-hash'
import { join, basename } from 'path'
import babelLoader from 'babel-loader'
+import { EXPORT_NAME_GET_STATIC_PROPS } from '../../babel/plugins/next-page-config'
// increment 'e' to invalidate cache
// eslint-disable-next-line no-useless-concat
-const cacheKey = '... | true |
Other | vercel | next.js | 30ff9a339f2aab01acac1c7b884b1bbf522c49cd.json | Remove Extraneous Imports in Pages (#9627)
* Remove Extraneous Imports in Pages
* Add test
* bump cache key | test/integration/prerender/pages/another/index.js | @@ -1,10 +1,22 @@
import Link from 'next/link'
+import fs from 'fs'
+import findUp from 'find-up'
// eslint-disable-next-line camelcase
export async function unstable_getStaticProps() {
+ const text = fs
+ .readFileSync(
+ findUp.sync('world.txt', {
+ // prevent webpack from intercepting
+ /... | true |
Other | vercel | next.js | 30ff9a339f2aab01acac1c7b884b1bbf522c49cd.json | Remove Extraneous Imports in Pages (#9627)
* Remove Extraneous Imports in Pages
* Add test
* bump cache key | test/integration/prerender/world.txt | @@ -0,0 +1 @@
+world | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.