Skip to content

Commit

Permalink
Merge branch 'canary' into router-evts-type
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwa authored Apr 7, 2021
2 parents ea4a19f + 23ad3a7 commit 937507e
Show file tree
Hide file tree
Showing 18 changed files with 135 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "10.1.4-canary.1"
"version": "10.1.4-canary.2"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-google-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-google-analytics",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-google-analytics"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-sentry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-sentry",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-sentry"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
4 changes: 4 additions & 0 deletions packages/next/export/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ export default async function exportApp(
hasApiRoutes = true
}

if (filteredPaths.length === 0) {
return
}

if (prerenderManifest && !options.buildExport) {
const fallbackEnabledPages = new Set()

Expand Down
12 changes: 6 additions & 6 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -62,10 +62,10 @@
"dependencies": {
"@babel/runtime": "7.12.5",
"@hapi/accept": "5.0.1",
"@next/env": "10.1.4-canary.1",
"@next/polyfill-module": "10.1.4-canary.1",
"@next/react-dev-overlay": "10.1.4-canary.1",
"@next/react-refresh-utils": "10.1.4-canary.1",
"@next/env": "10.1.4-canary.2",
"@next/polyfill-module": "10.1.4-canary.2",
"@next/react-dev-overlay": "10.1.4-canary.2",
"@next/react-refresh-utils": "10.1.4-canary.2",
"@opentelemetry/api": "0.14.0",
"assert": "2.0.0",
"ast-types": "0.13.2",
Expand Down Expand Up @@ -146,7 +146,7 @@
"@babel/preset-react": "7.12.10",
"@babel/preset-typescript": "7.12.7",
"@babel/types": "7.12.12",
"@next/polyfill-nomodule": "10.1.4-canary.1",
"@next/polyfill-nomodule": "10.1.4-canary.2",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
"@taskr/watch": "1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"description": "A development-only overlay for developing React applications.",
"repository": {
"url": "vercel/next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "10.1.4-canary.1",
"version": "10.1.4-canary.2",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
103 changes: 103 additions & 0 deletions test/integration/no-op-export/test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/* eslint-env jest */

import path from 'path'
import fs from 'fs-extra'
import { join } from 'path'
import { nextBuild, nextExport } from 'next-test-utils'

jest.setTimeout(1000 * 60 * 2)

const appDir = join(__dirname, '../')
const nextConfig = join(appDir, 'next.config.js')

const addPage = async (page, content) => {
const pagePath = join(appDir, 'pages', page)
await fs.ensureDir(path.dirname(pagePath))
await fs.writeFile(pagePath, content)
}

describe('no-op export', () => {
afterEach(async () => {
await Promise.all(
['.next', 'pages', 'next.config.js', 'out'].map((file) =>
fs.remove(join(appDir, file))
)
)
})

it('should not error for all server-side pages build', async () => {
await addPage(
'_error.js',
`
import React from 'react'
export default class Error extends React.Component {
static async getInitialProps() {
return {
props: {
statusCode: 'oops'
}
}
}
render() {
return 'error page'
}
}
`
)
await addPage(
'[slug].js',
`
export const getStaticProps = () => {
return {
props: {}
}
}
export const getStaticPaths = () => {
return {
paths: [],
fallback: false
}
}
export default function Page() {
return 'page'
}
`
)
const result = await nextBuild(appDir, undefined, {
stderr: 'log',
stdout: 'log',
})
expect(result.code).toBe(0)
})

it('should not error for empty exportPathMap', async () => {
await addPage(
'index.js',
`
export default function Index() {
return 'hello world'
}
`
)
await fs.writeFile(
nextConfig,
`
module.exports = {
exportPathMap() {
return {}
}
}
`
)
const buildResult = await nextBuild(appDir, undefined, {
stderr: 'log',
stdout: 'log',
})
expect(buildResult.code).toBe(0)

const exportResult = await nextExport(appDir, {
outdir: join(appDir, 'out'),
})
expect(exportResult.code).toBe(0)
})
})
8 changes: 8 additions & 0 deletions test/lib/next-test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,21 @@ export function runNextCommand(argv, options = {}) {
if (options.stderr) {
instance.stderr.on('data', function (chunk) {
stderrOutput += chunk

if (options.stderr === 'log') {
console.log(chunk.toString())
}
})
}

let stdoutOutput = ''
if (options.stdout) {
instance.stdout.on('data', function (chunk) {
stdoutOutput += chunk

if (options.stdout === 'log') {
console.log(chunk.toString())
}
})
}

Expand Down

0 comments on commit 937507e

Please sign in to comment.