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 | ea7c1e1dcf5b4019365e1ab3ff989801c958f0e9.json | Add support for SCSS options (#11063)
* Add support for SCSS includePaths
* Support sassOptions instead of just includePaths
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/scss-fixtures/basic-module-include-paths/styles/_vars.scss | @@ -0,0 +1 @@
+$var: red; | true |
Other | vercel | next.js | ea7c1e1dcf5b4019365e1ab3ff989801c958f0e9.json | Add support for SCSS options (#11063)
* Add support for SCSS includePaths
* Support sassOptions instead of just includePaths
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/scss/test/index.test.js | @@ -78,6 +78,34 @@ describe('SCSS Support', () => {
})
})
+ describe('Basic Module Include Paths Support', () => {
+ const appDir = join(fixturesDir, 'basic-module-include-paths')
+
+ beforeAll(async () => {
+ await remove(join(appDir, '.next'))
+ })
+
+ it('should compile successfully', asy... | true |
Other | vercel | next.js | a231315bf49f13ed51094c0ba5b138ba2339f404.json | Fix prettier linting | docs/advanced-features/amp-support/introduction.md | @@ -11,7 +11,6 @@ description: With minimal config, and without leaving React, you can start addin
</ul>
</details>
-
With Next.js you can turn any React page into an AMP page, with minimal config, and without leaving React.
You can read more about AMP in the official [amp.dev](https://amp.dev/) site. | false |
Other | vercel | next.js | 85e9ce1b0b83b59e352dd23cd04274921f2c4dec.json | Update preset.ts: Remove any and use updated Node.js types (#11075)
Remove any and use updated Node.js types | packages/next/build/babel/preset.ts | @@ -157,9 +157,7 @@ module.exports = (
helpers: true,
regenerator: true,
useESModules: supportsESM && presetEnvConfig.modules !== 'commonjs',
- absoluteRuntime: (process.versions as any).pnp
- ? __dirname
- : undefined,
+ absoluteRuntime: process.... | false |
Other | vercel | next.js | b092ff72b9be4812cfd4a80b63478076170f6c6f.json | Update amp-first example to use GSSP (#11028) | examples/amp-first/pages/index.js | @@ -234,10 +234,10 @@ const Home = props => (
)
// amp-script requires absolute URLs, so we create a property `host` which we can use to calculate the script URL.
-Home.getInitialProps = async ({ req }) => {
+export async function getServerSideProps({ req }) {
// WARNING: This is a generally unsafe application u... | false |
Other | vercel | next.js | 20c546710d758a17ecb7abac64208d2fa09186e4.json | Add Array.flat polyfill to nomodule-polyfills (#11004)
* Add Array.flat polyfill to nomodule-polyfills
* Fix code style issue | packages/next-polyfill-nomodule/src/index.js | @@ -3,6 +3,7 @@ import 'core-js/features/array/fill'
import 'core-js/features/array/find'
import 'core-js/features/array/find-index'
import 'core-js/features/array/flat-map'
+import 'core-js/features/array/flat'
import 'core-js/features/array/from'
import 'core-js/features/array/includes'
import 'core-js/features... | false |
Other | vercel | next.js | ccb6ce7ed40ab22ceb1005921e4b26f3dcfb56b0.json | Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP
* Add error for getStaticProps in pages/404 too
* Add support for getStaticProps in pages/404
* Update test | packages/next/build/index.ts | @@ -549,12 +549,12 @@ export default async function build(dir: string, conf = null): Promise<void> {
}
if (hasPages404 && page === '/404') {
- if (!result.isStatic) {
+ if (!result.isStatic && !result.hasStaticProps) {
throw new Error(PAGES_404_GET_INITIAL_PR... | true |
Other | vercel | next.js | ccb6ce7ed40ab22ceb1005921e4b26f3dcfb56b0.json | Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP
* Add error for getStaticProps in pages/404 too
* Add support for getStaticProps in pages/404
* Update test | packages/next/lib/constants.ts | @@ -30,4 +30,4 @@ export const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = `You can not use getInitialP
export const SERVER_PROPS_SSG_CONFLICT = `You can not use getStaticProps with getServerSideProps. To use SSG, please remove getServerSideProps`
-export const PAGES_404_GET_INITIAL_PROPS_ERROR = `\`pages/404\` can not... | true |
Other | vercel | next.js | ccb6ce7ed40ab22ceb1005921e4b26f3dcfb56b0.json | Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP
* Add error for getStaticProps in pages/404 too
* Add support for getStaticProps in pages/404
* Update test | packages/next/next-server/server/render.tsx | @@ -418,10 +418,7 @@ export async function renderToHTML(
renderOpts.nextExport = true
}
- if (
- pathname === '/404' &&
- (hasPageGetInitialProps || getServerSideProps || isSSG)
- ) {
+ if (pathname === '/404' && (hasPageGetInitialProps || getServerSideProps)) {
throw new Error(P... | true |
Other | vercel | next.js | ccb6ce7ed40ab22ceb1005921e4b26f3dcfb56b0.json | Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP
* Add error for getStaticProps in pages/404 too
* Add support for getStaticProps in pages/404
* Update test | test/integration/404-page-ssg/next.config.js | @@ -0,0 +1 @@
+module.exports = {} | true |
Other | vercel | next.js | ccb6ce7ed40ab22ceb1005921e4b26f3dcfb56b0.json | Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP
* Add error for getStaticProps in pages/404 too
* Add support for getStaticProps in pages/404
* Update test | test/integration/404-page-ssg/pages/404.js | @@ -0,0 +1,6 @@
+export const getStaticProps = () => ({
+ props: { hello: 'world', random: Math.random() },
+})
+
+const page = ({ random }) => `custom 404 page ${random}`
+export default page | true |
Other | vercel | next.js | ccb6ce7ed40ab22ceb1005921e4b26f3dcfb56b0.json | Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP
* Add error for getStaticProps in pages/404 too
* Add support for getStaticProps in pages/404
* Update test | test/integration/404-page-ssg/pages/_app.js | @@ -0,0 +1,12 @@
+const App = ({ Component, pageProps }) => <Component {...pageProps} />
+
+App.getInitialProps = async ({ Component, ctx }) => {
+ if (Component.getInitialProps) {
+ await Component.getInitialProps(ctx)
+ }
+ return {
+ pageProps: {},
+ }
+}
+
+export default App | true |
Other | vercel | next.js | ccb6ce7ed40ab22ceb1005921e4b26f3dcfb56b0.json | Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP
* Add error for getStaticProps in pages/404 too
* Add support for getStaticProps in pages/404
* Update test | test/integration/404-page-ssg/pages/err.js | @@ -0,0 +1,5 @@
+const page = () => 'err page'
+page.getInitialProps = () => {
+ throw new Error('oops')
+}
+export default page | true |
Other | vercel | next.js | ccb6ce7ed40ab22ceb1005921e4b26f3dcfb56b0.json | Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP
* Add error for getStaticProps in pages/404 too
* Add support for getStaticProps in pages/404
* Update test | test/integration/404-page-ssg/pages/index.js | @@ -0,0 +1 @@
+export default () => 'hello from index' | true |
Other | vercel | next.js | ccb6ce7ed40ab22ceb1005921e4b26f3dcfb56b0.json | Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP
* Add error for getStaticProps in pages/404 too
* Add support for getStaticProps in pages/404
* Update test | test/integration/404-page-ssg/test/index.test.js | @@ -0,0 +1,180 @@
+/* eslint-env jest */
+/* global jasmine */
+import fs from 'fs-extra'
+import { join } from 'path'
+import {
+ killApp,
+ findPort,
+ launchApp,
+ nextStart,
+ nextBuild,
+ renderViaHTTP,
+ fetchViaHTTP,
+} from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
+
+const ap... | true |
Other | vercel | next.js | ccb6ce7ed40ab22ceb1005921e4b26f3dcfb56b0.json | Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP
* Add error for getStaticProps in pages/404 too
* Add support for getStaticProps in pages/404
* Update test | test/integration/404-page/test/index.test.js | @@ -182,7 +182,7 @@ describe('404 Page Support', () => {
expect(stderr).toMatch(gip404Err)
})
- it('shows error with getStaticProps in pages/404 build', async () => {
+ it('does not show error with getStaticProps in pages/404 build', async () => {
await fs.move(pages404, `${pages404}.bak`)
await f... | true |
Other | vercel | next.js | 9d9f7a587330329cdf1c36bde76740f06545bba4.json | Improve Sass Error (#10982)
* Improve Sass Error
* test sass error massage
* use quotes
Co-authored-by: JJ Kasper <jj@jjsweb.site> | errors/install-sass.md | @@ -0,0 +1,19 @@
+# Install `sass` to Use Built-In Sass Support
+
+#### Why This Error Occurred
+
+Using Next.js' [built-in Sass support](https://nextjs.org/docs/basic-features/built-in-css-support#sass-support) requires that you bring your own version of Sass.
+
+#### Possible Ways to Fix It
+
+Please install the `sas... | true |
Other | vercel | next.js | 9d9f7a587330329cdf1c36bde76740f06545bba4.json | Improve Sass Error (#10982)
* Improve Sass Error
* test sass error massage
* use quotes
Co-authored-by: JJ Kasper <jj@jjsweb.site> | packages/next/client/dev/error-overlay/format-webpack-messages.js | @@ -31,8 +31,7 @@ function isLikelyASyntaxError(message) {
}
// Cleans up webpack error messages.
-// eslint-disable-next-line no-unused-vars
-function formatMessage(message, isError) {
+function formatMessage(message) {
let lines = message.split('\n')
// Strip Webpack-added headers off errors/warnings
@@ -... | true |
Other | vercel | next.js | 9d9f7a587330329cdf1c36bde76740f06545bba4.json | Improve Sass Error (#10982)
* Improve Sass Error
* test sass error massage
* use quotes
Co-authored-by: JJ Kasper <jj@jjsweb.site> | test/integration/scss-fixtures/webpack-error/mock.js | @@ -0,0 +1,7 @@
+let originalLoader
+const M = require('module')
+originalLoader = M._load
+M._load = function hookedLoader(request, parent, isMain) {
+ if (request === 'node-sass') request = 'node-sass-begone'
+ return originalLoader(request, parent, isMain)
+} | true |
Other | vercel | next.js | 9d9f7a587330329cdf1c36bde76740f06545bba4.json | Improve Sass Error (#10982)
* Improve Sass Error
* test sass error massage
* use quotes
Co-authored-by: JJ Kasper <jj@jjsweb.site> | test/integration/scss-fixtures/webpack-error/pages/_app.js | @@ -0,0 +1,12 @@
+import React from 'react'
+import App from 'next/app'
+import '../styles/global.scss'
+
+class MyApp extends App {
+ render() {
+ const { Component, pageProps } = this.props
+ return <Component {...pageProps} />
+ }
+}
+
+export default MyApp | true |
Other | vercel | next.js | 9d9f7a587330329cdf1c36bde76740f06545bba4.json | Improve Sass Error (#10982)
* Improve Sass Error
* test sass error massage
* use quotes
Co-authored-by: JJ Kasper <jj@jjsweb.site> | test/integration/scss-fixtures/webpack-error/pages/index.js | @@ -0,0 +1,3 @@
+export default function Home() {
+ return <div className="red-text">This text should be red.</div>
+} | true |
Other | vercel | next.js | 9d9f7a587330329cdf1c36bde76740f06545bba4.json | Improve Sass Error (#10982)
* Improve Sass Error
* test sass error massage
* use quotes
Co-authored-by: JJ Kasper <jj@jjsweb.site> | test/integration/scss-fixtures/webpack-error/styles/global.scss | @@ -0,0 +1,4 @@
+$var: red;
+.red-text {
+ color: $var;
+} | true |
Other | vercel | next.js | 9d9f7a587330329cdf1c36bde76740f06545bba4.json | Improve Sass Error (#10982)
* Improve Sass Error
* test sass error massage
* use quotes
Co-authored-by: JJ Kasper <jj@jjsweb.site> | test/integration/scss/test/index.test.js | @@ -1,26 +1,55 @@
/* eslint-env jest */
/* global jasmine */
+import cheerio from 'cheerio'
import 'flat-map-polyfill'
-import { join } from 'path'
import { readdir, readFile, remove } from 'fs-extra'
import {
+ File,
findPort,
+ killApp,
+ launchApp,
nextBuild,
nextStart,
- launchApp,
- killApp,
- ... | true |
Other | vercel | next.js | 76a08c9671f3eb822adbf8d8a83b004a34cad7c1.json | Fix examples with relay-compiler (#10976)
* Example with-react-relay-network-modern: update dependencies
* Example with-react-relay-network-modern: move relay __generated__ out of pages dir
* Example with-react-relay-network-modern: fix some errors
- Without checking if props.allBlogPosts exists it fails some... | examples/with-react-relay-network-modern/.babelrc | @@ -3,6 +3,6 @@
"next/babel"
],
"plugins": [
- "relay"
+ ["relay", { artifactDirectory: "__generated__" }]
]
-}
\ No newline at end of file
+} | true |
Other | vercel | next.js | 76a08c9671f3eb822adbf8d8a83b004a34cad7c1.json | Fix examples with relay-compiler (#10976)
* Example with-react-relay-network-modern: update dependencies
* Example with-react-relay-network-modern: move relay __generated__ out of pages dir
* Example with-react-relay-network-modern: fix some errors
- Without checking if props.allBlogPosts exists it fails some... | examples/with-react-relay-network-modern/components/BlogPosts.js | @@ -6,9 +6,10 @@ const BlogPosts = props => {
return (
<div>
<h1>Blog posts</h1>
- {props.viewer.allBlogPosts.edges.map(({ node }) => (
- <BlogPostPreview key={node.id} post={node} />
- ))}
+ {props.viewer.allBlogPosts &&
+ props.viewer.allBlogPosts.edges.map(({ node }) => (
... | true |
Other | vercel | next.js | 76a08c9671f3eb822adbf8d8a83b004a34cad7c1.json | Fix examples with relay-compiler (#10976)
* Example with-react-relay-network-modern: update dependencies
* Example with-react-relay-network-modern: move relay __generated__ out of pages dir
* Example with-react-relay-network-modern: fix some errors
- Without checking if props.allBlogPosts exists it fails some... | examples/with-react-relay-network-modern/package.json | @@ -7,27 +7,27 @@
"dev": "next",
"build": "next build",
"start": "next start",
- "relay": "relay-compiler --src ./ --exclude '**/.next/**' '**/node_modules/**' '**/test/**' '**/__generated__/**' --exclude '**/schema/**' --schema ./schema/schema.graphql",
+ "relay": "relay-compiler --src ./ --exclu... | true |
Other | vercel | next.js | 76a08c9671f3eb822adbf8d8a83b004a34cad7c1.json | Fix examples with relay-compiler (#10976)
* Example with-react-relay-network-modern: update dependencies
* Example with-react-relay-network-modern: move relay __generated__ out of pages dir
* Example with-react-relay-network-modern: fix some errors
- Without checking if props.allBlogPosts exists it fails some... | examples/with-react-relay-network-modern/pages/_app.js | @@ -35,7 +35,7 @@ export default class App extends NextApp {
const environment = createEnvironment(
relayData,
JSON.stringify({
- queryID: Component.query ? Component.query().params.name : undefined,
+ queryID: Component.query ? Component.query.params.name : undefined,
variable... | true |
Other | vercel | next.js | 76a08c9671f3eb822adbf8d8a83b004a34cad7c1.json | Fix examples with relay-compiler (#10976)
* Example with-react-relay-network-modern: update dependencies
* Example with-react-relay-network-modern: move relay __generated__ out of pages dir
* Example with-react-relay-network-modern: fix some errors
- Without checking if props.allBlogPosts exists it fails some... | examples/with-relay-modern-server-express/.babelrc | @@ -3,6 +3,6 @@
"next/babel"
],
"plugins": [
- "relay"
+ ["relay", { artifactDirectory: "__generated__" }]
]
}
\ No newline at end of file | true |
Other | vercel | next.js | 76a08c9671f3eb822adbf8d8a83b004a34cad7c1.json | Fix examples with relay-compiler (#10976)
* Example with-react-relay-network-modern: update dependencies
* Example with-react-relay-network-modern: move relay __generated__ out of pages dir
* Example with-react-relay-network-modern: fix some errors
- Without checking if props.allBlogPosts exists it fails some... | examples/with-relay-modern-server-express/package.json | @@ -8,25 +8,25 @@
"build": "next build",
"prestart": "npm run build",
"start": "NODE_ENV=production node server",
- "relay": "relay-compiler --src ./ --exclude '**/.next/**' '**/node_modules/**' '**/test/**' '**/__generated__/**' '**/server/**' --schema ./server/schema.graphql --verbose"
+ "relay"... | true |
Other | vercel | next.js | 76a08c9671f3eb822adbf8d8a83b004a34cad7c1.json | Fix examples with relay-compiler (#10976)
* Example with-react-relay-network-modern: update dependencies
* Example with-react-relay-network-modern: move relay __generated__ out of pages dir
* Example with-react-relay-network-modern: fix some errors
- Without checking if props.allBlogPosts exists it fails some... | examples/with-relay-modern/package.json | @@ -15,17 +15,17 @@
"dependencies": {
"dotenv": "^8.2.0",
"dotenv-webpack": "^1.7.0",
- "graphql": "^14.5.8",
+ "graphql": "^14.6.0",
"isomorphic-unfetch": "^3.0.0",
"next": "latest",
- "react": "^16.12.0",
- "react-dom": "^16.12.0",
- "react-relay": "^8.0.0"
+ "react": "^16.13.... | true |
Other | vercel | next.js | 905f0ce21489af1c75979fc27318484884bef464.json | Check SSG Page via Route Lookup (#10971) | packages/next/next-server/server/spr-cache.ts | @@ -11,6 +11,10 @@ const mkdirp = promisify(mkdirpOrig)
const readFile = promisify(fs.readFile)
const writeFile = promisify(fs.writeFile)
+function toRoute(pathname: string): string {
+ return pathname.replace(/\/$/, '').replace(/\/index$/, '') || '/'
+}
+
type SprCacheValue = {
html: string
pageData: any
@... | true |
Other | vercel | next.js | 905f0ce21489af1c75979fc27318484884bef464.json | Check SSG Page via Route Lookup (#10971) | test/integration/prerender-no-revalidate/pages/index.js | @@ -0,0 +1,27 @@
+let runs = 0
+
+export async function getStaticProps() {
+ if (runs++) {
+ throw new Error('GSP was re-run.')
+ }
+
+ return {
+ props: {
+ world: 'world',
+ time: new Date().getTime(),
+ other: Math.random(),
+ },
+ }
+}
+
+const Page = ({ world, time, other }) => {
+ ret... | true |
Other | vercel | next.js | 905f0ce21489af1c75979fc27318484884bef464.json | Check SSG Page via Route Lookup (#10971) | test/integration/prerender-no-revalidate/pages/named.js | @@ -0,0 +1,27 @@
+let runs = 0
+
+export async function getStaticProps() {
+ if (runs++) {
+ throw new Error('GSP was re-run.')
+ }
+
+ return {
+ props: {
+ world: 'world',
+ time: new Date().getTime(),
+ other: Math.random(),
+ },
+ }
+}
+
+const Page = ({ world, time, other }) => {
+ ret... | true |
Other | vercel | next.js | 905f0ce21489af1c75979fc27318484884bef464.json | Check SSG Page via Route Lookup (#10971) | test/integration/prerender-no-revalidate/pages/nested/index.js | @@ -0,0 +1,27 @@
+let runs = 0
+
+export async function getStaticProps() {
+ if (runs++) {
+ throw new Error('GSP was re-run.')
+ }
+
+ return {
+ props: {
+ world: 'world',
+ time: new Date().getTime(),
+ other: Math.random(),
+ },
+ }
+}
+
+const Page = ({ world, time, other }) => {
+ ret... | true |
Other | vercel | next.js | 905f0ce21489af1c75979fc27318484884bef464.json | Check SSG Page via Route Lookup (#10971) | test/integration/prerender-no-revalidate/pages/nested/named.js | @@ -0,0 +1,27 @@
+let runs = 0
+
+export async function getStaticProps() {
+ if (runs++) {
+ throw new Error('GSP was re-run.')
+ }
+
+ return {
+ props: {
+ world: 'world',
+ time: new Date().getTime(),
+ other: Math.random(),
+ },
+ }
+}
+
+const Page = ({ world, time, other }) => {
+ ret... | true |
Other | vercel | next.js | 905f0ce21489af1c75979fc27318484884bef464.json | Check SSG Page via Route Lookup (#10971) | test/integration/prerender-no-revalidate/test/index.test.js | @@ -0,0 +1,129 @@
+/* eslint-env jest */
+/* global jasmine */
+import fs from 'fs-extra'
+import {
+ findPort,
+ killApp,
+ nextBuild,
+ nextStart,
+ renderViaHTTP,
+ waitFor,
+} from 'next-test-utils'
+import { join } from 'path'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
+const appDir = join(__dirname... | true |
Other | vercel | next.js | 1edc1a9481cd6fca7d44f64404b8557fa8f520d0.json | fix paths.params.type in getStaticPaths(document) (#10959) | docs/basic-features/data-fetching.md | @@ -152,8 +152,8 @@ The `paths` key determines which paths will be pre-rendered. For example, suppos
```js
return {
paths: [
- { params: { id: 1 } },
- { params: { id: 2 } }
+ { params: { id: '1' } },
+ { params: { id: '2' } }
],
fallback: ...
} | false |
Other | vercel | next.js | f1cb4ea8674cd09397d1e7837b529a4a0a4cd4aa.json | Remove extra closing parenthesis (#10948)
* fix missing open parenthesis
* Apply suggestions from code review
Co-Authored-By: JJ Kasper <jj@jjsweb.site>
Co-authored-by: JJ Kasper <jj@jjsweb.site> | docs/basic-features/data-fetching.md | @@ -229,7 +229,7 @@ If `fallback` is `true`, then the behavior of `getStaticProps` changes:
In the “fallback” version of a page:
- The page’s props will be empty.
-- Using the [router](/docs/api-reference/next/router.md)), you can detect if the fallback is being rendered, `router.isFallback` will be `true`.
+- Usin... | false |
Other | vercel | next.js | dffde48472efd368351d98ae7be21037aaf6403d.json | Add missing words in docs (#10941)
* Add missing words
* Update docs/basic-features/data-fetching.md
Co-Authored-By: JJ Kasper <jj@jjsweb.site>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | docs/basic-features/data-fetching.md | @@ -366,7 +366,7 @@ export default Page
### When should I use `getServerSideProps`?
-You should use `getServerSideProps` only if you need to pre-render a page whose data must be fetched at request time. Time to first byte (TTFB) will be slower than `getStaticProps` because the server must compute the result on eve... | false |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | packages/next/build/webpack/loaders/next-serverless-loader.ts | @@ -232,7 +232,8 @@ const nextServerlessLoader: loader.Loader = function() {
export const config = ComponentInfo['confi' + 'g'] || {}
export const _app = App
- export async function renderReqToHTML(req, res, fromExport, _renderOpts, _params) {
+ export async function renderReqToHTML(req, res, renderMo... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | packages/next/export/worker.js | @@ -154,7 +154,13 @@ export default async function({
}
renderMethod = mod.renderReqToHTML
- const result = await renderMethod(req, res, true, { ampPath }, params)
+ const result = await renderMethod(
+ req,
+ res,
+ 'export',
+ { ampPath },
+ ... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | packages/next/lib/is-serializable-props.ts | @@ -0,0 +1,138 @@
+const regexpPlainIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/
+
+function isPlainObject(value: any): boolean {
+ if (Object.prototype.toString.call(value) !== '[object Object]') {
+ return false
+ }
+
+ const prototype = Object.getPrototypeOf(value)
+ return prototype === null || prototype === Ob... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | packages/next/next-server/server/next-server.ts | @@ -925,7 +925,7 @@ export default class Server {
const renderResult = await (components.Component as any).renderReqToHTML(
req,
res,
- true
+ 'passthrough'
)
sendPayload(
@@ -1028,7 +1028,7 @@ export default class Server {
rend... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | packages/next/next-server/server/render.tsx | @@ -8,6 +8,7 @@ import {
SERVER_PROPS_SSG_CONFLICT,
SSG_GET_INITIAL_PROPS_CONFLICT,
} from '../../lib/constants'
+import { isSerializableProps } from '../../lib/is-serializable-props'
import { isInAmpMode } from '../lib/amp'
import { AmpStateContext } from '../lib/amp-context'
import {
@@ -329,6 +330,7 @@ exp... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | test/integration/getserversideprops-preview/pages/index.js | @@ -1,5 +1,11 @@
export function getServerSideProps({ preview, previewData }) {
- return { props: { hasProps: true, preview, previewData } }
+ return {
+ props: {
+ hasProps: true,
+ preview: !!preview,
+ previewData: previewData || null,
+ },
+ }
}
export default function({ hasProps, previ... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | test/integration/getserversideprops-preview/test/index.test.js | @@ -53,14 +53,14 @@ function runTests(startServer = nextStart) {
const html = await renderViaHTTP(appPort, '/')
const { nextData, pre } = getData(html)
expect(nextData).toMatchObject({ isFallback: false })
- expect(pre).toBe('undefined and undefined')
+ expect(pre).toBe('false and null')
})
... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | test/integration/getserversideprops/pages/index.js | @@ -14,6 +14,10 @@ const Page = ({ world, time }) => {
<>
<p>hello {world}</p>
<span>time: {time}</span>
+ <Link href="/non-json">
+ <a id="non-json">to non-json</a>
+ </Link>
+ <br />
<Link href="/another">
<a id="another">to another</a>
</Link> | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | test/integration/getserversideprops/pages/non-json.js | @@ -0,0 +1,11 @@
+export async function getServerSideProps() {
+ return {
+ props: { time: new Date() },
+ }
+}
+
+const Page = ({ time }) => {
+ return <p>hello {time.toString()}</p>
+}
+
+export default Page | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | test/integration/getserversideprops/test/index.test.js | @@ -1,21 +1,23 @@
/* eslint-env jest */
/* global jasmine */
-import fs from 'fs-extra'
-import { join } from 'path'
-import webdriver from 'next-webdriver'
import cheerio from 'cheerio'
import escapeRegex from 'escape-string-regexp'
+import fs from 'fs-extra'
import {
- renderViaHTTP,
+ check,
fetchViaHTTP,
... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | test/integration/prerender-preview/pages/index.js | @@ -1,5 +1,11 @@
export function getStaticProps({ preview, previewData }) {
- return { props: { hasProps: true, preview, previewData } }
+ return {
+ props: {
+ hasProps: true,
+ preview: !!preview,
+ previewData: previewData || null,
+ },
+ }
}
export default function({ hasProps, preview, ... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | test/integration/prerender-preview/test/index.test.js | @@ -53,14 +53,14 @@ function runTests(startServer = nextStart) {
const html = await renderViaHTTP(appPort, '/')
const { nextData, pre } = getData(html)
expect(nextData).toMatchObject({ isFallback: false })
- expect(pre).toBe('undefined and undefined')
+ expect(pre).toBe('false and null')
})
... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | test/integration/prerender/pages/index.js | @@ -15,6 +15,10 @@ const Page = ({ world, time }) => {
{/* <div id='after-change'>idk</div> */}
<p>hello {world}</p>
<span>time: {time}</span>
+ <Link href="/non-json/[p]" as="/non-json/1">
+ <a id="non-json">to non-json</a>
+ </Link>
+ <br />
<Link href="/another?hello... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | test/integration/prerender/pages/non-json/[p].js | @@ -0,0 +1,21 @@
+import { useRouter } from 'next/router'
+
+export async function getStaticProps() {
+ return {
+ props: { time: new Date() },
+ }
+}
+
+export async function getStaticPaths() {
+ return { paths: [], fallback: true }
+}
+
+const Page = ({ time }) => {
+ const { isFallback } = useRouter()
+
+ if... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | test/integration/prerender/test/index.test.js | @@ -6,7 +6,9 @@ import fs from 'fs-extra'
import {
check,
fetchViaHTTP,
+ File,
findPort,
+ getBrowserBodyText,
getReactErrorOverlayContent,
initNextServerScript,
killApp,
@@ -682,6 +684,40 @@ const runTests = (dev = false, looseMode = false) => {
const curRandom = await browser.elementByCss... | true |
Other | vercel | next.js | 8443a809f3ff2b2a2707550f8accc8b53c87181a.json | Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability
* Add support for cyclic refs
* Add unit tests
* Test for error in development mode
* Fix prerender preview tests
* Fix gssp preview tests
* fix 2x test cases
* Add desired test
* fix some more tests
* Fix route manifest ... | test/unit/is-serializable-props.test.js | @@ -0,0 +1,190 @@
+/* eslint-env jest */
+import { isSerializableProps } from 'next/dist/lib/is-serializable-props'
+
+describe('isSerializableProps', () => {
+ it('handles null and undefined props', () => {
+ expect(() => isSerializableProps('/', 'test', null))
+ .toThrowErrorMatchingInlineSnapshot(`
+"Error ... | true |
Other | vercel | next.js | 745494a9a3ef630a87d6ee2fca602b222d1f3ba9.json | Add demo URL for the DatoCMS example (#10901) | docs/advanced-features/preview-mode.md | @@ -153,7 +153,7 @@ https://<your-site>/api/preview?secret=<token>&slug=<path>
Take a look at the following examples to learn more:
-- [DatoCMS Example](https://github.com/zeit/next.js/tree/canary/examples/cms-datocms)
+- [DatoCMS Example](https://github.com/zeit/next.js/tree/canary/examples/cms-datocms) ([Demo](h... | true |
Other | vercel | next.js | 745494a9a3ef630a87d6ee2fca602b222d1f3ba9.json | Add demo URL for the DatoCMS example (#10901) | docs/basic-features/data-fetching.md | @@ -428,7 +428,7 @@ function Profile() {
Take a look at the following examples to learn more:
-- [DatoCMS Example](https://github.com/zeit/next.js/tree/canary/examples/cms-datocms)
+- [DatoCMS Example](https://github.com/zeit/next.js/tree/canary/examples/cms-datocms) ([Demo](https://next-blog-datocms.now.sh/))
... | true |
Other | vercel | next.js | 745494a9a3ef630a87d6ee2fca602b222d1f3ba9.json | Add demo URL for the DatoCMS example (#10901) | docs/basic-features/pages.md | @@ -246,7 +246,7 @@ We've discussed two forms of pre-rendering for Next.js.
Take a look at the following examples to learn more:
-- [DatoCMS Example](https://github.com/zeit/next.js/tree/canary/examples/cms-datocms)
+- [DatoCMS Example](https://github.com/zeit/next.js/tree/canary/examples/cms-datocms) ([Demo](http... | true |
Other | vercel | next.js | 745494a9a3ef630a87d6ee2fca602b222d1f3ba9.json | Add demo URL for the DatoCMS example (#10901) | examples/cms-datocms/README.md | @@ -2,6 +2,10 @@
This example showcases Next.js's [Static Generation](/docs/basic-features/pages.md) feature using [DatoCMS](https://www.datocms.com/) as the data source.
+## Demo
+
+### [https://next-blog-datocms.now.sh/](https://next-blog-datocms.now.sh/)
+
## How to use
### Using `create-next-app` | true |
Other | vercel | next.js | fd3256f47e402c8f283a287ecce94593e329cb91.json | Fix Azure Pipelines (#10896)
Co-authored-by: JJ Kasper <jj@jjsweb.site> | test/integration/api-support/pages/api/child-process.js | @@ -1,7 +1,7 @@
import { execSync } from 'child_process'
export default (req, res) => {
- const output = execSync('echo "hi"')
+ const output = execSync('echo hi')
.toString()
.trim()
res.end(output) | false |
Other | vercel | next.js | d166840e5a2d10ec10dc40105f79f2de80a30c42.json | Fix shadowing of apolloClient (#9917)
* Remove redefinition of apolloClient
It seems that the definition of `apolloClient` on line 47 seems to be a intended to be defining the `apolloClient` defined in global scope. That re-declaration of the `apolloClient` variable is removed in favor of assigning the return of `i... | examples/with-apollo/lib/apollo.js | @@ -6,7 +6,7 @@ import { InMemoryCache } from 'apollo-cache-inmemory'
import { HttpLink } from 'apollo-link-http'
import fetch from 'isomorphic-unfetch'
-let apolloClient = null
+let globalApolloClient = null
/**
* Creates and provides the apolloContext
@@ -44,7 +44,7 @@ export function withApollo(PageComponen... | false |
Other | vercel | next.js | 2a70b268c8184918bd217e78cc9449edaccb4224.json | Remove dynamic assetPrefix from docs (#9912) | docs/advanced-features/custom-server.md | @@ -93,39 +93,3 @@ module.exports = {
> Note that `useFileSystemPublicRoutes` simply disables filename routes from SSR; client-side routing may still access those paths. When using this option, you should guard against navigation to routes you do not want programmatically.
> You may also wish to configure the clien... | false |
Other | vercel | next.js | 00179adcaa3140f74786d4cd07c0adc7ad6ae01d.json | Fix User Error in Async API Endpoint (#9911) | packages/next/next-server/server/api-utils.ts | @@ -54,7 +54,7 @@ export async function apiResolver(
apiRes.json = data => sendJson(apiRes, data)
const resolver = interopDefault(resolverModule)
- resolver(req, res)
+ await resolver(req, res)
} catch (err) {
if (err instanceof ApiError) {
sendError(apiRes, err.statusCode, err.message) | true |
Other | vercel | next.js | 00179adcaa3140f74786d4cd07c0adc7ad6ae01d.json | Fix User Error in Async API Endpoint (#9911) | test/integration/api-support/pages/api/user-error-async.js | @@ -0,0 +1,3 @@
+export default async (req, res) => {
+ throw new Error('User error')
+} | true |
Other | vercel | next.js | 00179adcaa3140f74786d4cd07c0adc7ad6ae01d.json | Fix User Error in Async API Endpoint (#9911) | test/integration/api-support/test/index.test.js | @@ -63,6 +63,13 @@ function runTests(dev = false) {
expect(text).toBe('Internal Server Error')
})
+ it('should throw Internal Server Error (async)', async () => {
+ const res = await fetchViaHTTP(appPort, '/api/user-error-async', null, {})
+ const text = await res.text()
+ expect(res.status).toBe(50... | true |
Other | vercel | next.js | ad7bb4e3521d601954c8e3c8a9d12c2b396277bd.json | Add headers support to custom-routes (#9879)
* Add headers support to custom-routes
* Update manifest version test
* Add headers field for dynamic routes test
* Update test | packages/next/build/index.ts | @@ -9,7 +9,12 @@ import path from 'path'
import { pathToRegexp } from 'path-to-regexp'
import { promisify } from 'util'
import formatWebpackMessages from '../client/dev/error-overlay/format-webpack-messages'
-import checkCustomRoutes from '../lib/check-custom-routes'
+import checkCustomRoutes, {
+ RouteType,
+ Red... | true |
Other | vercel | next.js | ad7bb4e3521d601954c8e3c8a9d12c2b396277bd.json | Add headers support to custom-routes (#9879)
* Add headers support to custom-routes
* Update manifest version test
* Add headers field for dynamic routes test
* Update test | packages/next/lib/check-custom-routes.ts | @@ -9,27 +9,80 @@ export type Redirect = Rewrite & {
statusCode?: number
}
+export type Header = {
+ source: string
+ headers: Array<{ key: string; value: string }>
+}
+
const allowedStatusCodes = new Set([301, 302, 303, 307, 308])
+function checkRedirect(route: Redirect) {
+ const invalidParts: string[] = ... | true |
Other | vercel | next.js | ad7bb4e3521d601954c8e3c8a9d12c2b396277bd.json | Add headers support to custom-routes (#9879)
* Add headers support to custom-routes
* Update manifest version test
* Add headers field for dynamic routes test
* Update test | packages/next/next-server/server/next-server.ts | @@ -45,7 +45,12 @@ import { sendHTML } from './send-html'
import { serveStatic } from './serve-static'
import { getSprCache, initializeSprCache, setSprCache } from './spr-cache'
import { isBlockedPage } from './utils'
-import { Redirect, Rewrite } from '../../lib/check-custom-routes'
+import {
+ Redirect,
+ Rewrit... | true |
Other | vercel | next.js | ad7bb4e3521d601954c8e3c8a9d12c2b396277bd.json | Add headers support to custom-routes (#9879)
* Add headers support to custom-routes
* Update manifest version test
* Add headers field for dynamic routes test
* Update test | packages/next/server/next-dev-server.ts | @@ -315,8 +315,9 @@ export default class DevServer extends Server {
const result = {
redirects: [],
rewrites: [],
+ headers: [],
}
- const { redirects, rewrites } = this.nextConfig.experimental
+ const { redirects, rewrites, headers } = this.nextConfig.experimental
if (typeof r... | true |
Other | vercel | next.js | ad7bb4e3521d601954c8e3c8a9d12c2b396277bd.json | Add headers support to custom-routes (#9879)
* Add headers support to custom-routes
* Update manifest version test
* Add headers field for dynamic routes test
* Update test | test/integration/custom-routes/next.config.js | @@ -122,5 +122,36 @@ module.exports = {
},
]
},
+
+ async headers() {
+ return [
+ {
+ source: '/add-header',
+ headers: [
+ {
+ key: 'x-custom-header',
+ value: 'hello world',
+ },
+ {
+ key: '... | true |
Other | vercel | next.js | ad7bb4e3521d601954c8e3c8a9d12c2b396277bd.json | Add headers support to custom-routes (#9879)
* Add headers support to custom-routes
* Update manifest version test
* Add headers field for dynamic routes test
* Update test | test/integration/custom-routes/test/index.test.js | @@ -217,6 +217,18 @@ const runTests = (isDev = false) => {
expect(location).toBe('https://google.com/')
})
+ it('should apply headers for exact match', async () => {
+ const res = await fetchViaHTTP(appPort, '/add-header')
+ expect(res.headers.get('x-custom-header')).toBe('hello world')
+ expect(res... | true |
Other | vercel | next.js | ad7bb4e3521d601954c8e3c8a9d12c2b396277bd.json | Add headers support to custom-routes (#9879)
* Add headers support to custom-routes
* Update manifest version test
* Add headers field for dynamic routes test
* Update test | test/integration/dynamic-routing/test/index.test.js | @@ -392,6 +392,7 @@ function runTests(dev) {
expect(manifest).toEqual({
version: 1,
basePath: '',
+ headers: [],
rewrites: [],
redirects: [],
dynamicRoutes: [ | true |
Other | vercel | next.js | ad7bb4e3521d601954c8e3c8a9d12c2b396277bd.json | Add headers support to custom-routes (#9879)
* Add headers support to custom-routes
* Update manifest version test
* Add headers field for dynamic routes test
* Update test | test/integration/invalid-custom-routes/test/index.test.js | @@ -134,6 +134,91 @@ const invalidRewriteAssertions = (stderr = '') => {
expect(stderr).toContain('Invalid rewrites found')
}
+const invalidHeaders = [
+ {
+ // missing source
+ headers: [
+ {
+ 'x-first': 'first',
+ },
+ ],
+ },
+ {
+ // invalid headers value
+ source: '/hello'... | true |
Other | vercel | next.js | 4f0c74c543a15ec101e3489bb35b3920c773e7a2.json | Fix Potential Duplication of Page Loading (#9894) | packages/next/client/page-loader.js | @@ -110,6 +110,7 @@ export default class PageLoader {
}
if (!this.loadingRoutes[route]) {
+ this.loadingRoutes[route] = true
if (process.env.__NEXT_GRANULAR_CHUNKS) {
this.getDependencies(route).then(deps => {
deps.forEach(d => {
@@ -130,11 +131,9 @@ export defaul... | false |
Other | vercel | next.js | 8247f19f10e80d93a678ef6f727ef9ffcdcb09c5.json | Defer Loading CSS Configuration (#9889) | packages/next/build/webpack-config.ts | @@ -28,6 +28,7 @@ import {
VALID_MIDDLEWARE,
} from './plugins/collect-plugins'
import { build as buildConfiguration } from './webpack/config'
+import { __overrideCssConfiguration } from './webpack/config/blocks/css'
// @ts-ignore: JS file
import { pluginLoaderOptions } from './webpack/loaders/next-plugin-loader... | true |
Other | vercel | next.js | 8247f19f10e80d93a678ef6f727ef9ffcdcb09c5.json | Defer Loading CSS Configuration (#9889) | packages/next/build/webpack/config/blocks/css/index.ts | @@ -1,6 +1,6 @@
import curry from 'lodash.curry'
import path from 'path'
-import webpack, { Configuration } from 'webpack'
+import webpack, { Configuration, RuleSetRule } from 'webpack'
import MiniCssExtractPlugin from '../../../plugins/mini-css-extract-plugin'
import { loader } from '../../helpers'
import { Confi... | true |
Other | vercel | next.js | 8247f19f10e80d93a678ef6f727ef9ffcdcb09c5.json | Defer Loading CSS Configuration (#9889) | packages/next/build/webpack/config/blocks/css/plugins.ts | @@ -88,12 +88,12 @@ function getDefaultPlugins(): CssPluginCollection {
}
export async function getPostCssPlugins(
- dir: string
+ dir: string,
+ defaults: boolean = false
): Promise<import('postcss').AcceptedPlugin[]> {
- let config = await findConfig<{ plugins: CssPluginCollection }>(
- dir,
- 'postcss... | true |
Other | vercel | next.js | 8247f19f10e80d93a678ef6f727ef9ffcdcb09c5.json | Defer Loading CSS Configuration (#9889) | test/integration/css-customization/test/index.test.js | @@ -71,6 +71,31 @@ describe('CSS Customization', () => {
})
})
+describe('Legacy Next-CSS Customization', () => {
+ const appDir = join(fixturesDir, 'custom-configuration-legacy')
+
+ beforeAll(async () => {
+ await remove(join(appDir, '.next'))
+ })
+
+ it('should build successfully', async () => {
+ a... | true |
Other | vercel | next.js | 8247f19f10e80d93a678ef6f727ef9ffcdcb09c5.json | Defer Loading CSS Configuration (#9889) | test/integration/css-fixtures/custom-configuration-legacy/next.config.js | @@ -0,0 +1,15 @@
+const withCSS = require('@zeit/next-css')
+
+module.exports = withCSS({
+ onDemandEntries: {
+ // Make sure entries are not getting disposed.
+ maxInactiveAge: 1000 * 60 * 60,
+ },
+ experimental: {
+ css: true,
+ },
+ webpack(cfg) {
+ cfg.devtool = 'source-map'
+ return cfg
+ },
... | true |
Other | vercel | next.js | 8247f19f10e80d93a678ef6f727ef9ffcdcb09c5.json | Defer Loading CSS Configuration (#9889) | test/integration/css-fixtures/custom-configuration-legacy/pages/_app.js | @@ -0,0 +1,12 @@
+import React from 'react'
+import App from 'next/app'
+import '../styles/global.css'
+
+class MyApp extends App {
+ render() {
+ const { Component, pageProps } = this.props
+ return <Component {...pageProps} />
+ }
+}
+
+export default MyApp | true |
Other | vercel | next.js | 8247f19f10e80d93a678ef6f727ef9ffcdcb09c5.json | Defer Loading CSS Configuration (#9889) | test/integration/css-fixtures/custom-configuration-legacy/pages/index.js | @@ -0,0 +1,3 @@
+export default function Home() {
+ return <div />
+} | true |
Other | vercel | next.js | 8247f19f10e80d93a678ef6f727ef9ffcdcb09c5.json | Defer Loading CSS Configuration (#9889) | test/integration/css-fixtures/custom-configuration-legacy/postcss.config.js | @@ -0,0 +1,10 @@
+module.exports = {
+ // Use comments to test JSON5 support
+ plugins: [
+ // Test a non-standard feature that wouldn't be normally enabled
+ require('postcss-short-size')({
+ // Add a prefix to test that configuration is passed
+ prefix: 'xyz',
+ }),
+ ],
+} | true |
Other | vercel | next.js | 8247f19f10e80d93a678ef6f727ef9ffcdcb09c5.json | Defer Loading CSS Configuration (#9889) | test/integration/css-fixtures/custom-configuration-legacy/styles/global.css | @@ -0,0 +1,11 @@
+/* this should pass through untransformed */
+@media (480px <= width < 768px) {
+ ::placeholder {
+ color: green;
+ }
+}
+
+/* this should be transformed to width/height */
+.video {
+ -xyz-max-size: 400px 300px;
+} | true |
Other | vercel | next.js | df97f2d93c8fc408f71c6d3ad951708740f122b2.json | Update native-url for peerdep (#9882)
Fixes https://github.com/zeit/next.js/issues/9687#issuecomment-569632942 | packages/next/package.json | @@ -108,7 +108,7 @@
"lru-cache": "5.1.1",
"mini-css-extract-plugin": "0.8.0",
"mkdirp": "0.5.1",
- "native-url": "0.2.3",
+ "native-url": "0.2.4",
"node-fetch": "2.6.0",
"object-assign": "4.1.1",
"ora": "3.4.0", | true |
Other | vercel | next.js | df97f2d93c8fc408f71c6d3ad951708740f122b2.json | Update native-url for peerdep (#9882)
Fixes https://github.com/zeit/next.js/issues/9687#issuecomment-569632942 | yarn.lock | @@ -4120,7 +4120,7 @@ browserify-zlib@^0.2.0:
dependencies:
pako "~1.0.5"
-browserslist@^4.0.0, browserslist@^4.3.6, browserslist@^4.6.0, browserslist@^4.6.3, browserslist@^4.6.4, browserslist@^4.7.1, browserslist@^4.7.3:
+browserslist@^4.0.0, browserslist@^4.3.6, browserslist@^4.6.0, browserslist@^4.6.3, bro... | true |
Other | vercel | next.js | 148084006a8879c978765517758541fdaa294099.json | Add basePath to routes-manifest (#9875)
* Add basePath to routes-manifest
* Bump routes-manifest version
* Update tests for version bump | packages/next/build/index.ts | @@ -248,7 +248,8 @@ export default async function build(dir: string, conf = null): Promise<void> {
await fsWriteFile(
path.join(distDir, ROUTES_MANIFEST),
JSON.stringify({
- version: 1,
+ version: 2,
+ basePath: config.experimental.basePath,
redirects: redirects.map(r => buildCustomRo... | true |
Other | vercel | next.js | 148084006a8879c978765517758541fdaa294099.json | Add basePath to routes-manifest (#9875)
* Add basePath to routes-manifest
* Bump routes-manifest version
* Update tests for version bump | test/integration/custom-routes/test/index.test.js | @@ -198,7 +198,8 @@ const runTests = (isDev = false) => {
}
expect(manifest).toEqual({
- version: 1,
+ version: 2,
+ basePath: '',
redirects: [
{
source: '/docs/router-status/:code', | true |
Other | vercel | next.js | 148084006a8879c978765517758541fdaa294099.json | Add basePath to routes-manifest (#9875)
* Add basePath to routes-manifest
* Bump routes-manifest version
* Update tests for version bump | test/integration/dynamic-routing/test/index.test.js | @@ -390,7 +390,8 @@ function runTests(dev) {
)
expect(manifest).toEqual({
- version: 1,
+ version: 2,
+ basePath: '',
rewrites: [],
redirects: [],
dynamicRoutes: [ | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | packages/next/build/entries.ts | @@ -77,6 +77,7 @@ export function createEntrypoints(
generateEtags: config.generateEtags,
ampBindInitData: config.experimental.ampBindInitData,
canonicalBase: config.canonicalBase,
+ basePath: config.experimental.basePath,
}
Object.keys(pages).forEach(page => { | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | packages/next/build/webpack-config.ts | @@ -724,6 +724,9 @@ export default async function getBaseWebpackConfig(
'process.env.__NEXT_REACT_MODE': JSON.stringify(
config.experimental.reactMode
),
+ 'process.env.__NEXT_ROUTER_BASEPATH': JSON.stringify(
+ config.experimental.basePath
+ ),
...(isServer
... | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | packages/next/build/webpack/loaders/next-serverless-loader.ts | @@ -21,6 +21,7 @@ export type ServerlessLoaderQuery = {
ampBindInitData: boolean | string
generateEtags: string
canonicalBase: string
+ basePath: string
}
const nextServerlessLoader: loader.Loader = function() {
@@ -36,8 +37,10 @@ const nextServerlessLoader: loader.Loader = function() {
absoluteDocum... | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | packages/next/next-server/lib/router/router.ts | @@ -18,6 +18,12 @@ import { isDynamicRoute } from './utils/is-dynamic'
import { getRouteMatcher } from './utils/route-matcher'
import { getRouteRegex } from './utils/route-regex'
+function addBasePath(path: string): string {
+ // @ts-ignore variable is always a string
+ const p: string = process.env.__NEXT_ROUTER... | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | packages/next/next-server/server/config.ts | @@ -53,6 +53,7 @@ const defaultConfig: { [key: string]: any } = {
deferScripts: false,
reactMode: 'legacy',
workerThreads: false,
+ basePath: '',
},
future: {
excludeDefaultMomentLocales: false,
@@ -106,9 +107,44 @@ function assignDefaults(userConfig: { [key: string]: any }) {
`Speci... | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | packages/next/next-server/server/next-server.ts | @@ -232,6 +232,16 @@ export default class Server {
parsedUrl.query = parseQs(parsedUrl.query)
}
+ if (parsedUrl.pathname!.startsWith(this.nextConfig.experimental.basePath)) {
+ // If replace ends up replacing the full url it'll be `undefined`, meaning we have to default it to `/`
+ parsedUrl.... | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | test/integration/basepath/components/hello-chunkfilename.js | @@ -0,0 +1 @@
+export default () => <div>test chunkfilename</div> | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | test/integration/basepath/components/hello-context.js | @@ -0,0 +1,13 @@
+import React from 'react'
+import PropTypes from 'prop-types'
+
+export default class extends React.Component {
+ static contextTypes = {
+ data: PropTypes.object,
+ }
+
+ render() {
+ const { data } = this.context
+ return <div>{data.title}</div>
+ }
+} | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | test/integration/basepath/components/hello1.js | @@ -0,0 +1 @@
+export default () => <p>Hello World 1</p> | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | test/integration/basepath/components/hello2.js | @@ -0,0 +1 @@
+export default () => <p>Hello World 2</p> | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | test/integration/basepath/components/hello3.js | @@ -0,0 +1 @@
+export default () => <p>Hello World 1</p> | true |
Other | vercel | next.js | 86808bbce295e46b1ff36100de8215fcaac01a00.json | Add basePath support (#9872)
* Add basePath support
* Add tests including copy of HMR tests
* Add production tests
* Add tests for serverless target
* Add missing quotes | test/integration/basepath/components/hello4.js | @@ -0,0 +1 @@
+export default () => <p>Hello World 2</p> | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.