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 | 230ae52de2141a56bb830b2b34cdfedba5933c91.json | Remove publish test results for azure pipelines | azure-pipelines.yml | @@ -26,15 +26,3 @@ steps:
- script: |
yarn test
displayName: 'Run tests'
-
-- task: PublishTestResults@2
- displayName: 'Publish Test Results'
- inputs:
- testResultsFiles: '**junit*.xml'
- testRunTitle: TestRun ${{ parameters.name }} $(node_version)
-
-- task: PublishCodeCoverageResults@1
- displayNa... | false |
Other | vercel | next.js | 59280f7747b807fa9d1f5810e1d762d4f147124c.json | Compile all next module files (#6155) | packages/next/build/webpack-config.js | @@ -43,7 +43,7 @@ function externalsConfig (isServer, target) {
}
// Default pages have to be transpiled
- if (res.match(/next[/\\]dist[/\\]pages/) || res.match(/next[/\\]dist[/\\]client/) || res.match(/node_modules[/\\]@babel[/\\]runtime[/\\]/) || res.match(/node_modules[/\\]@babel[/\\]runtime-cor... | false |
Other | vercel | next.js | c6d3484a2112abceebf724fbabb80840ec24e6d1.json | Handle SIGTERM with status code 0 (#6143)
Fixes #6140 | packages/next/bin/next.ts | @@ -98,7 +98,7 @@ const startProcess = () => {
}
// tslint:disable-next-line
console.log(`got signal ${signal}, exiting`)
- process.exit(signal === 'SIGINT' ? 0 : 1)
+ process.exit(signal === 'SIGINT' || signal === 'SIGTERM' ? 0 : 1)
}
process.exit(0)
}) | false |
Other | vercel | next.js | 22a57e493afd15f2f95c36a18dfd66d5373efed5.json | Add Unit Tests for Phase Constants (#6139) | test/unit/phaseConstants.test.js | @@ -0,0 +1,11 @@
+/* eslint-env jest */
+import {PHASE_EXPORT, PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER, PHASE_DEVELOPMENT_SERVER} from 'next/constants'
+
+describe('phaseConstants', () => {
+ it('should set phases correctly', () => {
+ expect(PHASE_EXPORT).toBe('phase-export')
+ expect(PHASE_PRODUCTION_B... | false |
Other | vercel | next.js | e46fdd6546c6898aaacf97a6b69b583425a862ab.json | Add arcorn to fix webpack/npm bug (#6137) | packages/next/package.json | @@ -48,6 +48,7 @@
"@babel/runtime": "7.1.2",
"@babel/runtime-corejs2": "7.1.2",
"@babel/template": "7.1.2",
+ "acorn": "^6.0.5",
"ansi-html": "0.0.7",
"arg": "3.0.0",
"async-sema": "2.1.4", | false |
Other | vercel | next.js | 7ecf675834d392e8aeb90824a9f2db8a0a948b12.json | Remove resolve rule (#6133)
Fixes #6117
I'm not entirely sure why we had this rule in the first place. I think for some tests related things when we didn't have a monorepo yet. However it could also be related to bundle sizes. I'll compare that when the build finishes.
The reason for #6117 is that we added `reac... | packages/next/build/webpack-config.js | @@ -181,7 +181,6 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer
// Disable .mjs for node_modules bundling
extensions: isServer ? ['.wasm', '.js', '.mjs', '.jsx', '.json'] : ['.wasm', '.mjs', '.js', '.jsx', '.json'],
modules: [
- NEXT_PROJECT_ROOT_NODE_MODULES,
... | false |
Other | vercel | next.js | adfdc798426f67d222533cf8f248bba12e8b7ecf.json | Move next/head to Typescript (#6131)
Solves a bunch of inconsistencies in handling React elements too. | package.json | @@ -33,7 +33,11 @@
"git add"
],
"*.ts": [
- "tslint -c tslint.json 'packages/**/*.ts'",
+ "tslint -c tslint.json 'packages/**/*.ts' --fix",
+ "git add"
+ ],
+ "*.tsx": [
+ "tslint -c tslint.json 'packages/**/*.ts' --fix",
"git add"
],
"packages/**/bin/*": [ | true |
Other | vercel | next.js | adfdc798426f67d222533cf8f248bba12e8b7ecf.json | Move next/head to Typescript (#6131)
Solves a bunch of inconsistencies in handling React elements too. | packages/next-server/lib/head.js | @@ -1,93 +0,0 @@
-import React from 'react'
-import withSideEffect from './side-effect'
-import { HeadManagerContext } from './head-manager-context'
-
-const NEXT_HEAD_IDENTIFIER = 'next-head'
-
-export function defaultHead (className = NEXT_HEAD_IDENTIFIER) {
- return [
- <meta key='charSet' charSet='utf-8' classN... | true |
Other | vercel | next.js | adfdc798426f67d222533cf8f248bba12e8b7ecf.json | Move next/head to Typescript (#6131)
Solves a bunch of inconsistencies in handling React elements too. | packages/next-server/lib/head.tsx | @@ -0,0 +1,135 @@
+import React from "react";
+import withSideEffect from "./side-effect";
+import { HeadManagerContext } from "./head-manager-context";
+
+export function defaultHead(className = 'next-head') {
+ return [
+ <meta key="charSet" charSet="utf-8" className={className} />,
+ ];
+}
+
+function onlyReact... | true |
Other | vercel | next.js | adfdc798426f67d222533cf8f248bba12e8b7ecf.json | Move next/head to Typescript (#6131)
Solves a bunch of inconsistencies in handling React elements too. | packages/next-server/lib/side-effect.tsx | @@ -2,53 +2,53 @@ import React, { Component } from 'react'
const isServer = typeof window === 'undefined'
-type State = React.DetailedReactHTMLElement<any, any>[] | undefined
+type State = Array<React.ReactElement<any>> | undefined
type SideEffectProps = {
- reduceComponentsToState: (components: React.ReactEle... | true |
Other | vercel | next.js | 6c49bee9591ddf6ee14b35b108bfc9421a16b8b9.json | Make side-effect.js smaller (#6118)
Start at making side-effect.js / head.js smaller. | packages/next-server/lib/head-manager-context.ts | @@ -1,3 +1,3 @@
import * as React from 'react'
-export const HeadManagerContext = React.createContext(null)
+export const HeadManagerContext: React.Context<any> = React.createContext(null) | true |
Other | vercel | next.js | 6c49bee9591ddf6ee14b35b108bfc9421a16b8b9.json | Make side-effect.js smaller (#6118)
Start at making side-effect.js / head.js smaller. | packages/next-server/lib/head.js | @@ -1,16 +1,7 @@
import React from 'react'
-import PropTypes from 'prop-types'
-import sideEffect from './side-effect'
+import withSideEffect from './side-effect'
import { HeadManagerContext } from './head-manager-context'
-class Head extends React.Component {
- static contextType = HeadManagerContext
-
- render ... | true |
Other | vercel | next.js | 6c49bee9591ddf6ee14b35b108bfc9421a16b8b9.json | Make side-effect.js smaller (#6118)
Start at making side-effect.js / head.js smaller. | packages/next-server/lib/side-effect.js | @@ -1,86 +0,0 @@
-import React, { Component } from 'react'
-import { getDisplayName } from './utils'
-
-export default function withSideEffect (reduceComponentsToState, handleStateChangeOnClient, mapStateOnServer) {
- if (typeof reduceComponentsToState !== 'function') {
- throw new Error('Expected reduceComponentsT... | true |
Other | vercel | next.js | 6c49bee9591ddf6ee14b35b108bfc9421a16b8b9.json | Make side-effect.js smaller (#6118)
Start at making side-effect.js / head.js smaller. | packages/next-server/lib/side-effect.tsx | @@ -0,0 +1,57 @@
+import React, { Component } from 'react'
+
+const isServer = typeof window === 'undefined'
+
+type State = React.DetailedReactHTMLElement<any, any>[] | undefined
+
+type SideEffectProps = {
+ reduceComponentsToState: (components: React.ReactElement<any>[]) => State,
+ handleStateChange?: (state: Sta... | true |
Other | vercel | next.js | 6c49bee9591ddf6ee14b35b108bfc9421a16b8b9.json | Make side-effect.js smaller (#6118)
Start at making side-effect.js / head.js smaller. | packages/next/client/head-manager.js | @@ -10,7 +10,7 @@ export default class HeadManager {
this.updatePromise = null
}
- updateHead (head) {
+ updateHead = (head) => {
const promise = this.updatePromise = Promise.resolve().then(() => {
if (promise !== this.updatePromise) return
| true |
Other | vercel | next.js | 6c49bee9591ddf6ee14b35b108bfc9421a16b8b9.json | Make side-effect.js smaller (#6118)
Start at making side-effect.js / head.js smaller. | packages/next/client/index.js | @@ -181,7 +181,7 @@ async function doRender ({ App, Component, props, err, emitter: emitterProp = em
// In development runtime errors are caught by react-error-overlay.
if (process.env.NODE_ENV === 'development') {
renderReactElement((
- <HeadManagerContext.Provider value={headManager}>
+ <HeadMana... | true |
Other | vercel | next.js | 9112f63ebaa3a79e1506e105f4232d177343d2ca.json | Move phases back to next/constants (#6104)
* Move phases back to next/constants
* Fix typescript error | packages/next-server/lib/constants.js | @@ -1,7 +1,3 @@
-export const PHASE_EXPORT = 'phase-export'
-export const PHASE_PRODUCTION_BUILD = 'phase-production-build'
-export const PHASE_PRODUCTION_SERVER = 'phase-production-server'
-export const PHASE_DEVELOPMENT_SERVER = 'phase-development-server'
export const PAGES_MANIFEST = 'pages-manifest.json'
export c... | true |
Other | vercel | next.js | 9112f63ebaa3a79e1506e105f4232d177343d2ca.json | Move phases back to next/constants (#6104)
* Move phases back to next/constants
* Fix typescript error | packages/next-server/server/next-server.ts | @@ -10,7 +10,7 @@ import {serveStatic} from './serve-static'
import Router, {route, Route} from './router'
import { isInternalUrl, isBlockedPage } from './utils'
import loadConfig from 'next-server/next-config'
-import {PHASE_PRODUCTION_SERVER, BUILD_ID_FILE, CLIENT_STATIC_FILES_PATH, CLIENT_STATIC_FILES_RUNTIME} fr... | true |
Other | vercel | next.js | 9112f63ebaa3a79e1506e105f4232d177343d2ca.json | Move phases back to next/constants (#6104)
* Move phases back to next/constants
* Fix typescript error | packages/next/build/babel/plugins/next-to-next-server.ts | @@ -10,9 +10,6 @@ export default function NextToNextServer (): PluginObj {
if (source === 'next/dynamic') {
path.node.source.value = 'next-server/dynamic'
}
- if (source === 'next/constants') {
- path.node.source.value = 'next-server/constants'
- }
if (source... | true |
Other | vercel | next.js | 9112f63ebaa3a79e1506e105f4232d177343d2ca.json | Move phases back to next/constants (#6104)
* Move phases back to next/constants
* Fix typescript error | packages/next/build/index.ts | @@ -1,7 +1,7 @@
import { join } from 'path'
import nanoid from 'nanoid'
import loadConfig from 'next-server/next-config'
-import { PHASE_PRODUCTION_BUILD } from 'next-server/constants'
+import { PHASE_PRODUCTION_BUILD } from '../lib/constants'
import getBaseWebpackConfig from './webpack-config'
import {generateBui... | true |
Other | vercel | next.js | 9112f63ebaa3a79e1506e105f4232d177343d2ca.json | Move phases back to next/constants (#6104)
* Move phases back to next/constants
* Fix typescript error | packages/next/export/index.js | @@ -6,7 +6,8 @@ import mkdirp from 'mkdirp-then'
import { resolve, join } from 'path'
import { existsSync, readFileSync } from 'fs'
import loadConfig from 'next-server/next-config'
-import { PHASE_EXPORT, SERVER_DIRECTORY, PAGES_MANIFEST, CONFIG_FILE, BUILD_ID_FILE, CLIENT_STATIC_FILES_PATH } from 'next-server/const... | true |
Other | vercel | next.js | 9112f63ebaa3a79e1506e105f4232d177343d2ca.json | Move phases back to next/constants (#6104)
* Move phases back to next/constants
* Fix typescript error | packages/next/lib/constants.js | @@ -10,3 +10,8 @@ export const NEXT_PROJECT_ROOT_DIST_SERVER = join(NEXT_PROJECT_ROOT_DIST, 'serve
// we have to use a private alias
export const PAGES_DIR_ALIAS = 'private-next-pages'
export const DOT_NEXT_ALIAS = 'private-dot-next'
+
+export const PHASE_EXPORT = 'phase-export'
+export const PHASE_PRODUCTION_BUILD ... | true |
Other | vercel | next.js | 9112f63ebaa3a79e1506e105f4232d177343d2ca.json | Move phases back to next/constants (#6104)
* Move phases back to next/constants
* Fix typescript error | packages/next/server/next-dev-server.js | @@ -2,7 +2,7 @@ import Server from 'next-server/dist/server/next-server'
import { join } from 'path'
import HotReloader from './hot-reloader'
import {route} from 'next-server/dist/server/router'
-import {PHASE_DEVELOPMENT_SERVER} from 'next-server/constants'
+import {PHASE_DEVELOPMENT_SERVER} from '../lib/constants'... | true |
Other | vercel | next.js | d6ec10a4bfd9d9a71ced2ec9c0c639f753e939a4.json | add new nextjs typings with samples (#6102)
The current `examples/with-typescript` is not using the latest type definitions currently available on DefinitelyTyped project for next.
Added new list page examples that demonstrate how to use the new Types for both stateless functional components and classes. Also modi... | examples/with-typescript/components/Layout.tsx | @@ -3,7 +3,7 @@ import Link from 'next/link'
import Head from 'next/head'
type Props = {
- title?: string
+ title?: string,
}
const Layout: React.FunctionComponent<Props> = ({ children, title = 'This is the default title' }) => (
@@ -16,16 +16,17 @@ const Layout: React.FunctionComponent<Props> = ({ children, ... | true |
Other | vercel | next.js | d6ec10a4bfd9d9a71ced2ec9c0c639f753e939a4.json | add new nextjs typings with samples (#6102)
The current `examples/with-typescript` is not using the latest type definitions currently available on DefinitelyTyped project for next.
Added new list page examples that demonstrate how to use the new Types for both stateless functional components and classes. Also modi... | examples/with-typescript/components/List.tsx | @@ -1,23 +1,19 @@
import * as React from "react"
import ListItem from './ListItem'
+import IDataObject from '../interfaces'
-export interface DataObject {
- id: number,
- name: string
+type Props = {
+ items: IDataObject[],
}
-const List : React.FunctionComponent = () => {
- const dataArray : DataObjec... | true |
Other | vercel | next.js | d6ec10a4bfd9d9a71ced2ec9c0c639f753e939a4.json | add new nextjs typings with samples (#6102)
The current `examples/with-typescript` is not using the latest type definitions currently available on DefinitelyTyped project for next.
Added new list page examples that demonstrate how to use the new Types for both stateless functional components and classes. Also modi... | examples/with-typescript/components/ListItem.tsx | @@ -1,12 +1,12 @@
import * as React from 'react'
-import {DataObject} from "./List";
+import IDataObject from '../interfaces'
-export interface Props {
- data: DataObject
+type Props = {
+ data: IDataObject,
}
const ListItem: React.FunctionComponent<Props> = ({ data }) => (
<React.Fragment>{data.id}:{data... | true |
Other | vercel | next.js | d6ec10a4bfd9d9a71ced2ec9c0c639f753e939a4.json | add new nextjs typings with samples (#6102)
The current `examples/with-typescript` is not using the latest type definitions currently available on DefinitelyTyped project for next.
Added new list page examples that demonstrate how to use the new Types for both stateless functional components and classes. Also modi... | examples/with-typescript/interfaces/index.tsx | @@ -0,0 +1,4 @@
+export default interface IDataObject {
+ id: number,
+ name: string
+} | true |
Other | vercel | next.js | d6ec10a4bfd9d9a71ced2ec9c0c639f753e939a4.json | add new nextjs typings with samples (#6102)
The current `examples/with-typescript` is not using the latest type definitions currently available on DefinitelyTyped project for next.
Added new list page examples that demonstrate how to use the new Types for both stateless functional components and classes. Also modi... | examples/with-typescript/package.json | @@ -15,7 +15,7 @@
"react-dom": "^16.7.0"
},
"devDependencies": {
- "@types/next": "^7.0.2",
+ "@types/next": "^7.0.6",
"@types/react": "^16.4.16",
"@types/react-dom": "16.0.8",
"eslint": "^5.12.0", | true |
Other | vercel | next.js | d6ec10a4bfd9d9a71ced2ec9c0c639f753e939a4.json | add new nextjs typings with samples (#6102)
The current `examples/with-typescript` is not using the latest type definitions currently available on DefinitelyTyped project for next.
Added new list page examples that demonstrate how to use the new Types for both stateless functional components and classes. Also modi... | examples/with-typescript/pages/index.tsx | @@ -2,13 +2,13 @@ import * as React from "react"
import Link from 'next/link'
import Layout from '../components/Layout'
-const index : React.FunctionComponent = () => {
- return (
- <Layout title="Home | Next.js + TypeScript Example">
- <h1>Hello Next.js 👋</h1>
- <p><Link href='/abo... | true |
Other | vercel | next.js | d6ec10a4bfd9d9a71ced2ec9c0c639f753e939a4.json | add new nextjs typings with samples (#6102)
The current `examples/with-typescript` is not using the latest type definitions currently available on DefinitelyTyped project for next.
Added new list page examples that demonstrate how to use the new Types for both stateless functional components and classes. Also modi... | examples/with-typescript/pages/list-class.tsx | @@ -0,0 +1,29 @@
+import React from 'react'
+import { NextContext } from 'next'
+
+import Layout from '../components/Layout'
+import List from '../components/List'
+import IDataObject from '../interfaces'
+
+type Props = {
+ items: IDataObject[],
+}
+
+class ListClass extends React.Component<Props> {
+ static async g... | true |
Other | vercel | next.js | d6ec10a4bfd9d9a71ced2ec9c0c639f753e939a4.json | add new nextjs typings with samples (#6102)
The current `examples/with-typescript` is not using the latest type definitions currently available on DefinitelyTyped project for next.
Added new list page examples that demonstrate how to use the new Types for both stateless functional components and classes. Also modi... | examples/with-typescript/pages/list-fc.tsx | @@ -0,0 +1,23 @@
+import { NextFunctionComponent, NextContext } from 'next'
+import Layout from '../components/Layout'
+import List from '../components/List'
+import IDataObject from '../interfaces'
+
+type Props = {
+ items: IDataObject[],
+}
+
+const list: NextFunctionComponent<Props> = ({ items }) => (
+ <Layout t... | true |
Other | vercel | next.js | d6ec10a4bfd9d9a71ced2ec9c0c639f753e939a4.json | add new nextjs typings with samples (#6102)
The current `examples/with-typescript` is not using the latest type definitions currently available on DefinitelyTyped project for next.
Added new list page examples that demonstrate how to use the new Types for both stateless functional components and classes. Also modi... | examples/with-typescript/pages/list.tsx | @@ -1,11 +0,0 @@
-import * as React from "react"
-import Layout from '../components/Layout'
-import List from '../components/List'
-
-const list : React.FunctionComponent = () => (
- <Layout title="About | Next.js + TypeScript Example">
- <List/>
- </Layout>
-)
-
-export default list;
\ No newline at end o... | true |
Other | vercel | next.js | b20b371a419d32719e5ef7045e417ac900cc0017.json | Add release cli to prepublish | package.json | @@ -18,7 +18,7 @@
"prettier": "prettier --single-quote --no-semi --write examples/**/*.js && yarn lint-fix",
"typescript": "lerna run typescript",
"prepublish": "lerna run prepublish",
- "publish-canary": "lerna version prerelease --preid canary --force-publish",
+ "publish-canary": "lerna version ... | true |
Other | vercel | next.js | b20b371a419d32719e5ef7045e417ac900cc0017.json | Add release cli to prepublish | yarn.lock | @@ -1315,6 +1315,20 @@
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==
+"@octokit/rest@15.2.6":
+ version "15.2.6"
+ resolved "https:/... | true |
Other | vercel | next.js | 862e0a39b93e1356650e459f01e1850a343de197.json | Update package.json description | packages/next/package.json | @@ -1,7 +1,7 @@
{
"name": "next",
"version": "8.0.0-canary.9",
- "description": "Minimalistic framework for server-rendered React applications",
+ "description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
"repository": "zeit/next.js", | false |
Other | vercel | next.js | afa73ae46b44f9c74d4a6308bda0e981aeff2765.json | Update Prerender Manifest (#8918)
* Update Prerender Manifest
* Fix typescript | packages/next/build/index.ts | @@ -1,26 +1,29 @@
import chalk from 'chalk'
import fs from 'fs'
+import Worker from 'jest-worker'
import mkdirpOrig from 'mkdirp'
+import nanoid from 'next/dist/compiled/nanoid/index.js'
+import path from 'path'
+import { promisify } from 'util'
+
+import formatWebpackMessages from '../client/dev/error-overlay/forma... | true |
Other | vercel | next.js | afa73ae46b44f9c74d4a6308bda0e981aeff2765.json | Update Prerender Manifest (#8918)
* Update Prerender Manifest
* Fix typescript | packages/next/next-server/server/spr-cache.ts | @@ -77,7 +77,7 @@ export function initializeSprCache({
fs.readFileSync(path.join(distDir, PRERENDER_MANIFEST), 'utf8')
)
} catch (_) {
- prerenderManifest = { version: 1, routes: {}, dynamicRoutes: [] }
+ prerenderManifest = { version: 1, routes: {}, dynamicRoutes: {} }
}
cache = ne... | true |
Other | vercel | next.js | afa73ae46b44f9c74d4a6308bda0e981aeff2765.json | Update Prerender Manifest (#8918)
* Update Prerender Manifest
* Fix typescript | test/integration/prerender/test/index.test.js | @@ -152,37 +152,55 @@ const runTests = (dev = false) => {
expect(manifest.version).toBe(1)
expect(manifest.routes).toEqual({
'/': {
+ dataRoute: '/_next/data/index.json',
initialRevalidateSeconds: 1
},
'/blog/[post3]': {
+ dataRoute: '/_next/data/blo... | true |
Other | vercel | next.js | d9c6f20023a805604381e7d7a65169dd7ef5cf81.json | Remove React Suspense from Client Runtime (#8887) | packages/next/client/index.js | @@ -1,5 +1,5 @@
/* global location */
-import React, { Suspense } from 'react'
+import React from 'react'
import ReactDOM from 'react-dom'
import HeadManager from './head-manager'
import { createRouter, makePublicRouterInstance } from 'next/router'
@@ -319,15 +319,13 @@ function AppContainer ({ children }) {
... | true |
Other | vercel | next.js | d9c6f20023a805604381e7d7a65169dd7ef5cf81.json | Remove React Suspense from Client Runtime (#8887) | test/integration/data/pages/_app.js | @@ -0,0 +1,19 @@
+import React, { Suspense } from 'react'
+import App from 'next/app'
+
+class MyApp extends App {
+ render () {
+ const { Component, pageProps } = this.props
+ if (typeof window === 'undefined') {
+ return <Component {...pageProps} />
+ }
+
+ return (
+ <Suspense fallback={<div>L... | true |
Other | vercel | next.js | 296cfacd12eb496db7fb35606cf3009ecaca0694.json | Add SPR Dynamic Routes to Manifest (#8885)
* Add SPR Dynamic Routes to Manifest
This adds dynamic routes for SPR pages to the prerender manifest so we can configure the Now Builder to handle these routes as SPR routes. Otherwise, they're treated like normal `getInitialProps` pages.
* Fix types | packages/next/build/index.ts | @@ -63,6 +63,7 @@ export type SprRoute = {
export type PrerenderManifest = {
version: number
routes: { [route: string]: SprRoute }
+ dynamicRoutes: string[]
}
export default async function build(dir: string, conf = null): Promise<void> {
@@ -412,6 +413,7 @@ export default async function build(dir: string, c... | true |
Other | vercel | next.js | 296cfacd12eb496db7fb35606cf3009ecaca0694.json | Add SPR Dynamic Routes to Manifest (#8885)
* Add SPR Dynamic Routes to Manifest
This adds dynamic routes for SPR pages to the prerender manifest so we can configure the Now Builder to handle these routes as SPR routes. Otherwise, they're treated like normal `getInitialProps` pages.
* Fix types | packages/next/next-server/server/spr-cache.ts | @@ -72,12 +72,12 @@ export function initializeSprCache({
try {
prerenderManifest = dev
- ? { routes: {} }
+ ? { routes: {}, dynamicRoutes: [] }
: JSON.parse(
fs.readFileSync(path.join(distDir, PRERENDER_MANIFEST), 'utf8')
)
} catch (_) {
- prerenderManifest = { versi... | true |
Other | vercel | next.js | 296cfacd12eb496db7fb35606cf3009ecaca0694.json | Add SPR Dynamic Routes to Manifest (#8885)
* Add SPR Dynamic Routes to Manifest
This adds dynamic routes for SPR pages to the prerender manifest so we can configure the Now Builder to handle these routes as SPR routes. Otherwise, they're treated like normal `getInitialProps` pages.
* Fix types | test/integration/prerender/test/index.test.js | @@ -179,6 +179,10 @@ const runTests = (dev = false) => {
initialRevalidateSeconds: false
}
})
+ expect(manifest.dynamicRoutes).toEqual([
+ '/blog/[post]',
+ '/blog/[post]/[comment]'
+ ])
})
it('outputs prerendered files correctly', async () => { | true |
Other | vercel | next.js | 2aa1203171e300c0b97e03e1b76307e98b8058bf.json | Configure the Default Revalidate (#8880)
* Configure the Default Revalidate
The default revalidate behavior should be configured by Next.js. Otherwise, the behavior might drift or change in non-semver compliant ways between Next.js and the builder (or other 3rd party setups).
* Add additional comment | packages/next/next-server/server/render.tsx | @@ -415,6 +415,14 @@ export async function renderToHTML(
`\nTo only run getStaticProps at build-time and not revalidate at runtime, you can set \`revalidate\` to \`false\`!`
)
}
+ } else if (data.revalidate === false) {
+ // `false` is an allowed behavior. We'll catch `rev... | true |
Other | vercel | next.js | 2aa1203171e300c0b97e03e1b76307e98b8058bf.json | Configure the Default Revalidate (#8880)
* Configure the Default Revalidate
The default revalidate behavior should be configured by Next.js. Otherwise, the behavior might drift or change in non-semver compliant ways between Next.js and the builder (or other 3rd party setups).
* Add additional comment | test/integration/prerender/pages/default-revalidate.js | @@ -0,0 +1,25 @@
+import Link from 'next/link'
+
+// eslint-disable-next-line camelcase
+export async function unstable_getStaticProps () {
+ return {
+ props: {
+ world: 'world',
+ time: new Date().getTime()
+ }
+ }
+}
+
+export default ({ world, time }) => (
+ <>
+ <p>hello {world}</p>
+ <spa... | true |
Other | vercel | next.js | 2aa1203171e300c0b97e03e1b76307e98b8058bf.json | Configure the Default Revalidate (#8880)
* Configure the Default Revalidate
The default revalidate behavior should be configured by Next.js. Otherwise, the behavior might drift or change in non-semver compliant ways between Next.js and the builder (or other 3rd party setups).
* Add additional comment | test/integration/prerender/test/index.test.js | @@ -172,6 +172,9 @@ const runTests = (dev = false) => {
'/another': {
initialRevalidateSeconds: 0
},
+ '/default-revalidate': {
+ initialRevalidateSeconds: 1
+ },
'/something': {
initialRevalidateSeconds: false
} | true |
Other | vercel | next.js | 01e54718163fac3a60d5243a6b42718f3389b017.json | Enforce natural numbers for SPR (#8882)
Per the HTTP specification, only natural numbers may be used for caching durations. We should enforce this with a really helpful error message. | packages/next/next-server/server/render.tsx | @@ -394,14 +394,25 @@ export async function renderToHTML(
}
if (typeof data.revalidate === 'number') {
- if (data.revalidate < 0) {
+ if (!Number.isInteger(data.revalidate)) {
throw new Error(
- `A page's revalidate option can not be less than zero. A revalidate optio... | false |
Other | vercel | next.js | 297d1466e7dd03dd178778d5c5e5ec8d8d19486a.json | Fix typo and wording in README.md (#8867)
The first corrected sentence did not feel very natural.
The second one contained a typo. | examples/with-dotenv/README.md | @@ -44,6 +44,6 @@ This example shows how to inline env vars.
**Please note**:
- It is a bad practice to commit env vars to a repository. Thats why you should normally [gitignore](https://git-scm.com/docs/gitignore) your `.env` file.
-- In this example, as soon as you reference an env var in your code it will be aut... | false |
Other | vercel | next.js | 37a50cd387ffff824851ca3a53019d0824a3cae6.json | Add support for ZEIT Now CI detection (#8864)
* Add support for ZEIT Now CI detection
* Add isNowDev to meta fields | packages/next/telemetry/anonymous-meta.ts | @@ -1,7 +1,8 @@
-import ciEnvironment from 'ci-info'
import isDockerFunction from 'is-docker'
import os from 'os'
+import * as ciEnvironment from './ci-info'
+
type AnonymousMeta = {
systemPlatform: NodeJS.Platform
systemRelease: string
@@ -11,6 +12,7 @@ type AnonymousMeta = {
cpuSpeed: number | null
m... | true |
Other | vercel | next.js | 37a50cd387ffff824851ca3a53019d0824a3cae6.json | Add support for ZEIT Now CI detection (#8864)
* Add support for ZEIT Now CI detection
* Add isNowDev to meta fields | packages/next/telemetry/ci-info.ts | @@ -0,0 +1,8 @@
+import ciEnvironment from 'ci-info'
+
+const { isCI: _isCI, name: _name } = ciEnvironment
+
+const isZeitNow = !!process.env.NOW_BUILDER
+
+export const isCI = isZeitNow || _isCI
+export const name = isZeitNow ? 'ZEIT Now' : _name | true |
Other | vercel | next.js | 37a50cd387ffff824851ca3a53019d0824a3cae6.json | Add support for ZEIT Now CI detection (#8864)
* Add support for ZEIT Now CI detection
* Add isNowDev to meta fields | packages/next/telemetry/storage.ts | @@ -1,12 +1,12 @@
import chalk from 'chalk'
-import ciEnvironment from 'ci-info'
import Conf from 'conf'
import { BinaryLike, createHash, randomBytes } from 'crypto'
import findUp from 'find-up'
import isDockerFunction from 'is-docker'
import path from 'path'
import { getAnonymousMeta } from './anonymous-meta'... | true |
Other | vercel | next.js | fd50e51e2a8f68898ec9bf013b92f0be3f89cd3f.json | Remove extra build logs (#8839) | packages/next/build/index.ts | @@ -92,9 +92,6 @@ export default async function build(dir: string, conf = null): Promise<void> {
await verifyTypeScriptSetup(dir, pagesDir)
- console.log('Creating an optimized production build ...')
- console.log()
-
if (config.experimental.publicDirectory) {
publicFiles = await recursiveReadDir(publi... | false |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | errors/conflicting-public-file-page.md | @@ -9,6 +9,7 @@ One of your public files has the exact same path as a page file which is not sup
Rename either the public file or page file that is causing the conflict.
Example conflict between public file and page file
+
```
public/
hello
@@ -17,6 +18,7 @@ pages/
```
Non-conflicting public file and page ... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | examples/with-sentry-simple/README.md | @@ -82,7 +82,7 @@ An easy way to disable Sentry while developing is to set its `enabled` flag base
```js
Sentry.init({
dsn: 'PUT_YOUR_SENTRY_DSN_HERE',
- enabled: process.env.NODE_ENV === 'production'
+ enabled: process.env.NODE_ENV === 'production',
})
```
| true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | examples/with-sentry-simple/pages/_error.js | @@ -56,7 +56,9 @@ MyError.getInitialProps = async ({ res, err, asPath }) => {
// If this point is reached, getInitialProps was called without any
// information about what the error might be. This is unexpected and may
// indicate a bug introduced in Next.js, so record it in Sentry
- Sentry.captureException(n... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | examples/with-sentry-simple/pages/client/test5.js | @@ -10,9 +10,7 @@ const isProd = env.NODE_ENV === 'production'
const Test5 = () => (
<React.Fragment>
<h1>Client Test 5</h1>
- <p>
- isProd: {isProd}
- </p>
+ <p>isProd: {isProd}</p>
</React.Fragment>
)
| true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | examples/with-sentry-simple/pages/index.js | @@ -12,43 +12,38 @@ const Index = () => (
<p>
<strong>Important:</strong> exceptions in development mode take a
different path than in production. These tests should be run on a
- production build (i.e. 'next build').
- {' '}
+ production build (i.e. 'next build').{' '}
<a href=... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/README.md | @@ -2675,7 +2675,6 @@ For the production deployment, you can use the same configuration and run `now`
- [Build a SaaS Product with React-Material-UI-Next-MobX-Express-Mongoose-MongoDB-TypeScript](https://github.com/async-labs/saas)
- [Working with Ghost and Next.js](https://ghost.org/docs/api/nextjs/)
-
## FAQ
... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/build/index.ts | @@ -41,6 +41,7 @@ import {
import getBaseWebpackConfig from './webpack-config'
import { getPageChunks } from './webpack/plugins/chunk-graph-plugin'
import { writeBuildId } from './write-build-id'
+import { findPagesDir } from '../lib/find-pages-dir'
import createSpinner from './spinner'
import { PUBLIC_DIR_MIDDLEW... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/build/webpack-config.ts | @@ -50,20 +50,22 @@ const escapePathVariables = (value: any) => {
export default async function getBaseWebpackConfig(
dir: string,
{
- dev = false,
- isServer = false,
buildId,
config,
+ dev = false,
+ isServer = false,
+ pagesDir,
+ tracer,
target = 'server',
entrypoints,
-... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/build/webpack/loaders/next-babel-loader.js | @@ -54,6 +54,7 @@ module.exports = babelLoader.custom(babel => {
const custom = {
isServer: opts.isServer,
isModern: opts.isModern,
+ pagesDir: opts.pagesDir,
hasModern: opts.hasModern
}
const filename = join(opts.cwd, 'noop.js')
@@ -86,19 +87,19 @@ module.exports ... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/cli/next-build.ts | @@ -41,20 +41,6 @@ const nextBuild: cliCommand = argv => {
printAndExit(`> No such directory exists as the project root: ${dir}`)
}
- // Check if the pages directory exists
- if (!existsSync(join(dir, 'pages'))) {
- // Check one level down the tree to see if the pages directory might be there
- if (ex... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/cli/next-dev.ts | @@ -52,18 +52,6 @@ const nextDev: cliCommand = argv => {
printAndExit(`> No such directory exists as the project root: ${dir}`)
}
- if (!existsSync(join(dir, 'pages'))) {
- if (existsSync(join(dir, '..', 'pages'))) {
- printAndExit(
- '> No `pages` directory found. Did you mean to run `next` i... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/cli/next-export.ts | @@ -51,18 +51,6 @@ const nextExport: cliCommand = argv => {
printAndExit(`> No such directory exists as the project root: ${dir}`)
}
- if (!existsSync(join(dir, 'pages'))) {
- if (existsSync(join(dir, '..', 'pages'))) {
- printAndExit(
- '> No `pages` directory found. Did you mean to run `next... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/lib/constants.ts | @@ -5,7 +5,6 @@ export const NEXT_PROJECT_ROOT_NODE_MODULES = join(
NEXT_PROJECT_ROOT,
'node_modules'
)
-export const DEFAULT_PAGES_DIR = join(NEXT_PROJECT_ROOT_DIST, 'pages')
export const NEXT_PROJECT_ROOT_DIST_CLIENT = join(
NEXT_PROJECT_ROOT_DIST,
'client' | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/lib/find-pages-dir.ts | @@ -0,0 +1,31 @@
+import fs from 'fs'
+import path from 'path'
+
+const existsSync = (f: string): boolean => {
+ try {
+ fs.accessSync(f, fs.constants.F_OK)
+ return true
+ } catch (_) {
+ return false
+ }
+}
+
+export function findPagesDir(dir: string): string {
+ // prioritize ./pages over ./src/pages
+ ... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/lib/verifyTypeScriptSetup.ts | @@ -20,7 +20,7 @@ function writeJson(fileName: string, object: object): Promise<void> {
async function hasTypeScript(dir: string): Promise<boolean> {
const typescriptFiles = await recursiveReadDir(
- path.join(dir, 'pages'),
+ dir,
/.*\.(ts|tsx)$/,
/(node_modules|.*\.d\.ts)/
)
@@ -96,7 +96,10 @... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/next-server/server/next-server.ts | @@ -33,6 +33,7 @@ import Router, { Params, route, Route, RouteMatch } from './router'
import { sendHTML } from './send-html'
import { serveStatic } from './serve-static'
import { isBlockedPage, isInternalUrl } from './utils'
+import { findPagesDir } from '../../lib/find-pages-dir'
import { initializeSprCache, getSp... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/server/hot-reloader.js | @@ -110,10 +110,11 @@ function erroredPages (compilation, options = { enhanceName: name => name }) {
}
export default class HotReloader {
- constructor (dir, { config, buildId } = {}) {
+ constructor (dir, { config, pagesDir, buildId } = {}) {
this.buildId = buildId
this.dir = dir
this.middlewares ... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/server/next-dev-server.js | @@ -22,6 +22,7 @@ import React from 'react'
import { findPageFile } from './lib/find-page-file'
import { normalizePagePath } from '../next-server/server/normalize-page-path'
import { PUBLIC_DIR_MIDDLEWARE_CONFLICT } from '../lib/constants'
+import { findPagesDir } from '../lib/find-pages-dir'
if (typeof React.Sus... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | packages/next/server/on-demand-entry-handler.js | @@ -32,9 +32,15 @@ function addEntry (compilation, context, name, entry) {
export default function onDemandEntryHandler (
devMiddleware,
multiCompiler,
- { buildId, dir, reload, pageExtensions, maxInactiveAge, pagesBufferLength }
+ {
+ buildId,
+ pagesDir,
+ reload,
+ pageExtensions,
+ maxInacti... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support-double-dir/next.config.js | @@ -0,0 +1,6 @@
+module.exports = {
+ target: 'serverless',
+ experimental: {
+ modern: true
+ }
+} | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support-double-dir/pages/index.js | @@ -0,0 +1 @@
+export default () => <h1>PAGES</h1> | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support-double-dir/src/pages/hello.js | @@ -0,0 +1 @@
+export default () => <h1>PAGES DIR</h1> | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support-double-dir/src/pages/index.js | @@ -0,0 +1 @@
+export default () => <h1>SRC</h1> | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support-double-dir/test/index.test.js | @@ -0,0 +1,91 @@
+/* eslint-env jest */
+/* global jasmine */
+import { join } from 'path'
+import fs from 'fs-extra'
+import {
+ renderViaHTTP,
+ findPort,
+ launchApp,
+ killApp,
+ nextBuild,
+ nextStart
+} from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
+
+let app
+let appPort
+const... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support/next.config.js | @@ -0,0 +1,5 @@
+module.exports = {
+ experimental: {
+ modern: true
+ }
+} | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support/src/pages/[name]/[comment].js | @@ -0,0 +1,21 @@
+import { useRouter } from 'next/router'
+
+const $comment = ({ gipQuery }) => {
+ const router = useRouter()
+ const { query } = router
+
+ return (
+ <>
+ <p>
+ I am {query.comment} on {query.name}
+ </p>
+ <span>gip {gipQuery && gipQuery.name}</span>
+ </>
+ )
+}
+
+$... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support/src/pages/[name]/comments.js | @@ -0,0 +1,11 @@
+import { useRouter } from 'next/router'
+
+const Page = () => {
+ const router = useRouter()
+ const { query } = router
+ return <p>Show comments for {query.name} here</p>
+}
+
+Page.getInitialProps = () => ({})
+
+export default Page | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support/src/pages/[name]/index.js | @@ -0,0 +1,11 @@
+import { useRouter } from 'next/router'
+
+const Page = () => {
+ const router = useRouter()
+ const { query } = router
+ return <p>This is {query.name}</p>
+}
+
+Page.getInitialProps = () => ({})
+
+export default Page | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support/src/pages/another.js | @@ -0,0 +1 @@
+export default () => 'hello from another!' | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support/src/pages/blog/[name]/comment/[id].js | @@ -0,0 +1,18 @@
+import { useRouter } from 'next/router'
+
+const Page = () => {
+ const router = useRouter()
+ const { name, id } = router.query
+
+ return (
+ <>
+ <p>
+ Blog post {name} comment {id || '(all)'}
+ </p>
+ </>
+ )
+}
+
+Page.getInitialProps = () => ({})
+
+export default Page | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support/src/pages/index.js | @@ -0,0 +1,32 @@
+import Link from 'next/link'
+
+const Page = () => (
+ <div>
+ <h3>My blog</h3>
+ <Link href='/[post]' as='/post-1'>
+ <a id='view-post-1'>View post 1</a>
+ </Link>
+ <br />
+ <Link href='/[post]/comments' as='/post-1/comments'>
+ <a id='view-post-1-comments'>View post 1 comm... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support/src/pages/on-mount/[post].js | @@ -0,0 +1,18 @@
+import { useRouter } from 'next/router'
+
+export default () => {
+ const router = useRouter()
+ const { query } = router
+ return (
+ <>
+ <p>onmpost: {query.post || 'pending'}</p>
+ {Array.from({ length: 500 }, (x, i) => i + 1).map(i => {
+ return (
+ <div key={`item-... | true |
Other | vercel | next.js | a8e3b022366262190ba4c9bd13d76edab7f1f2cb.json | Add `src` directory support (#8735)
* Add find-pages-dir
* Add support for src directory
* Add test for pages dir preference
* Update comment | test/integration/src-dir-support/test/index.test.js | @@ -0,0 +1,287 @@
+/* eslint-env jest */
+/* global jasmine */
+import webdriver from 'next-webdriver'
+import { join } from 'path'
+import fs from 'fs-extra'
+import {
+ renderViaHTTP,
+ findPort,
+ launchApp,
+ killApp,
+ waitFor,
+ nextBuild,
+ nextStart
+} from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_IN... | true |
Other | vercel | next.js | ebb39f1004d1d977405fa7708d81426537ec5bf9.json | Allow only JS files when loading dynamic chunks (#8831) | packages/next/pages/_document.tsx | @@ -152,7 +152,7 @@ export class Head extends Component<
return files.map((file: string) => {
// Only render .css files here
- if (!/\.css$/.exec(file)) {
+ if (!/\.css$/.test(file)) {
return null
}
@@ -516,7 +516,7 @@ export class NextScript extends Component<OriginProps> {
... | false |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/build/babel/plugins/next-page-config.ts | @@ -6,10 +6,12 @@ import { PageConfig } from '../../../types'
export const dropBundleIdentifier = '__NEXT_DROP_CLIENT_FILE__'
export const sprStatus = { used: false }
-const configKeys = new Set(['amp', 'experimentalPrerender'])
+const configKeys = new Set(['amp'])
const pageComponentVar = '__NEXT_COMP'
// this v... | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/build/index.ts | @@ -43,6 +43,7 @@ import { getPageChunks } from './webpack/plugins/chunk-graph-plugin'
import { writeBuildId } from './write-build-id'
import createSpinner from './spinner'
import { PUBLIC_DIR_MIDDLEWARE_CONFLICT } from '../lib/constants'
+import { isDynamicRoute } from '../next-server/lib/router/utils'
const fsU... | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/build/static-checker.ts | @@ -1,9 +0,0 @@
-import { isPageStatic } from './utils'
-
-export default function worker(options: {
- serverBundle: string
- runtimeEnvConfig: any
-}) {
- const { serverBundle, runtimeEnvConfig } = options || ({} as any)
- return isPageStatic(serverBundle, runtimeEnvConfig)
-} | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/build/utils.ts | @@ -9,6 +9,9 @@ import { isValidElementType } from 'react-is'
import prettyBytes from '../lib/pretty-bytes'
import { recursiveReadDir } from '../lib/recursive-readdir'
import { getPageChunks } from './webpack/plugins/chunk-graph-plugin'
+import { isDynamicRoute } from '../next-server/lib/router/utils/is-dynamic'
+im... | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/build/webpack/loaders/next-serverless-loader.ts | @@ -84,19 +84,34 @@ const nextServerlessLoader: loader.Loader = function() {
import * as ComponentInfo from '${absolutePagePath}';
const Component = ComponentInfo.default
export default Component
+ export const unstable_getStaticProps = ComponentInfo['unstable_getStaticProp' + 's']
+ ${
+ isDy... | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/export/index.js | @@ -3,9 +3,9 @@ import chalk from 'chalk'
import Worker from 'jest-worker'
import { promisify } from 'util'
import mkdirpModule from 'mkdirp'
-import { resolve, join } from 'path'
+import { resolve, join, dirname } from 'path'
import { API_ROUTE } from '../lib/constants'
-import { existsSync, readFileSync } from 'f... | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/export/worker.js | @@ -24,7 +24,9 @@ export default async function ({
distDir,
buildId,
outDir,
+ sprDataDir,
renderOpts,
+ buildExport,
serverRuntimeConfig,
subFolders,
serverless
@@ -35,7 +37,7 @@ export default async function ({
try {
let { query = {} } = pathMap
- const { page, sprPage } = pathMap
... | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/lib/coalesced-function.ts | @@ -0,0 +1,41 @@
+type CoalescedInvoke<T> = {
+ isOrigin: boolean
+ value: T
+}
+
+type UnwrapPromise<T> = T extends Promise<infer U> ? U : T
+
+const globalInvokeCache = new Map<string, Promise<CoalescedInvoke<unknown>>>()
+
+export function withCoalescedInvoke<F extends (...args: any) => any>(
+ func: F
+): (
+ k... | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/lib/constants.ts | @@ -24,3 +24,5 @@ export const PAGES_DIR_ALIAS = 'private-next-pages'
export const DOT_NEXT_ALIAS = 'private-dot-next'
export const PUBLIC_DIR_MIDDLEWARE_CONFLICT = `You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://err.sh/zeit/next.js/public-ne... | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/next-server/lib/router/router.ts | @@ -623,28 +623,20 @@ export default class Router implements BaseRouter {
(Component as any).__NEXT_SPR
) {
let status: any
- const url = ctx.asPath
- ? ctx.asPath
- : format({
- pathname: ctx.pathname,
- query: ctx.query,
- })
+ const { pathname... | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/next-server/server/config.ts | @@ -46,6 +46,7 @@ const defaultConfig: { [key: string]: any } = {
modern: false,
profiling: false,
publicDirectory: false,
+ sprFlushToDisk: true,
},
future: {
excludeDefaultMomentLocales: false, | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/next-server/server/load-components.ts | @@ -15,6 +15,12 @@ export function interopDefault(mod: any) {
export type LoadComponentsReturnType = {
Component: any
pageConfig: PageConfig
+ unstable_getStaticProps?: (params: {
+ params: any
+ }) => {
+ props: any
+ revalidate: number | false
+ }
buildManifest?: any
reactLoadableManifest?: a... | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/next-server/server/next-server.ts | @@ -4,7 +4,7 @@ import { IncomingMessage, ServerResponse } from 'http'
import { join, resolve, sep } from 'path'
import { parse as parseQs, ParsedUrlQuery } from 'querystring'
import { parse as parseUrl, UrlWithParsedQuery } from 'url'
-
+import { withCoalescedInvoke } from '../../lib/coalesced-function'
import {
... | true |
Other | vercel | next.js | 85e720a092fd07631fe2264bec206f0b89830805.json | Add experimental SPR support (#8832)
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being us... | packages/next/next-server/server/render.tsx | @@ -29,6 +29,8 @@ import optimizeAmp from './optimize-amp'
import { isInAmpMode } from '../lib/amp'
// Uses a module path because of the compiled output directory location
import { PageConfig } from 'next/types'
+import { isDynamicRoute } from '../lib/router/utils/is-dynamic'
+import { SPR_GET_INITIAL_PROPS_CONFLICT... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.