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 | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/lib/find-pages-dir.ts | @@ -1,7 +1,7 @@
import fs from 'fs'
import path from 'path'
-const existsSync = (f: string): boolean => {
+export const existsSync = (f: string): boolean => {
try {
fs.accessSync(f, fs.constants.F_OK)
return true | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/lib/load-env-config.ts | @@ -0,0 +1,84 @@
+import fs from 'fs'
+import path from 'path'
+import chalk from 'chalk'
+import dotenvExpand from 'next/dist/compiled/dotenv-expand'
+import dotenv, { DotenvConfigOutput } from 'next/dist/compiled/dotenv'
+import findUp from 'find-up'
+
+export type Env = { [key: string]: string }
+
+export function l... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/next-server/lib/utils.ts | @@ -4,6 +4,7 @@ import { ComponentType } from 'react'
import { format, URLFormatOptions, UrlObject } from 'url'
import { ManifestItem } from '../server/load-components'
import { NextRouter } from './router/router'
+import { Env } from '../../lib/load-env-config'
/**
* Types used by both next and next-server
@@ ... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/next-server/server/api-utils.ts | @@ -8,6 +8,8 @@ import { isResSent, NextApiRequest, NextApiResponse } from '../lib/utils'
import { decryptWithSecret, encryptWithSecret } from './crypto-utils'
import { interopDefault } from './load-components'
import { Params } from './router'
+import { collectEnv } from './utils'
+import { Env } from '../../lib/lo... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/next-server/server/config.ts | @@ -54,6 +54,7 @@ const defaultConfig: { [key: string]: any } = {
workerThreads: false,
basePath: '',
sassOptions: {},
+ pageEnv: false,
},
future: {
excludeDefaultMomentLocales: false, | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/next-server/server/next-server.ts | @@ -61,6 +61,7 @@ import {
setSprCache,
} from './spr-cache'
import { isBlockedPage } from './utils'
+import { loadEnvConfig, Env } from '../../lib/load-env-config'
const getCustomRouteMatcher = pathMatch(true)
@@ -117,6 +118,7 @@ export default class Server {
documentMiddlewareEnabled: boolean
hasC... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/next-server/server/render.tsx | @@ -38,6 +38,8 @@ import { tryGetPreviewData, __ApiPreviewProps } from './api-utils'
import { getPageFiles } from './get-page-files'
import { LoadComponentsReturnType, ManifestItem } from './load-components'
import optimizeAmp from './optimize-amp'
+import { collectEnv } from './utils'
+import { Env } from '../../li... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/next-server/server/utils.ts | @@ -1,4 +1,5 @@
import { BLOCKED_PAGES } from '../lib/constants'
+import { Env } from '../../lib/load-env-config'
export function isBlockedPage(pathname: string): boolean {
return BLOCKED_PAGES.indexOf(pathname) !== -1
@@ -14,3 +15,28 @@ export function cleanAmpPath(pathname: string): string {
pathname = path... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/package.json | @@ -166,6 +166,7 @@
"@types/content-type": "1.1.3",
"@types/cookie": "0.3.2",
"@types/cross-spawn": "6.0.0",
+ "@types/dotenv": "8.2.0",
"@types/etag": "1.8.0",
"@types/find-up": "2.1.1",
"@types/fresh": "0.5.0",
@@ -191,6 +192,8 @@
"arg": "4.1.0",
"ast-types": "0.13.2",
... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/taskfile-ncc.js | @@ -40,6 +40,11 @@ function writePackageManifest(packageName) {
let typesFile = types || typings
if (typesFile) {
+ // if they provide a types directory resolve it
+ if (extname(typesFile) === '') {
+ typesFile = join(typesFile, 'index.d.ts')
+ }
+
typesFile = require.resolve(join(packageName... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/taskfile.js | @@ -41,13 +41,31 @@ export async function ncc_text_table(task, opts) {
.target('dist/compiled/text-table')
}
+// eslint-disable-next-line camelcase
+export async function ncc_dotenv(task, opts) {
+ await task
+ .source(opts.src || relative(__dirname, require.resolve('dotenv')))
+ .ncc({ packageName: 'dot... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/types/index.d.ts | @@ -5,6 +5,7 @@
import React from 'react'
import { ParsedUrlQuery } from 'querystring'
import { IncomingMessage, ServerResponse } from 'http'
+import { Env } from '../lib/load-env-config'
import {
NextPageContext,
@@ -54,6 +55,7 @@ export type PageConfig = {
*/
bodyParser?: { sizeLimit?: number | st... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | packages/next/types/misc.d.ts | @@ -43,6 +43,12 @@ declare module 'next/dist/compiled/text-table' {
export = textTable
}
+declare module 'next/dist/compiled/dotenv' {
+ import dotenv from 'dotenv'
+
+ export = dotenv
+}
+
declare module 'next/dist/compiled/arg/index.js' {
function arg<T extends arg.Spec>(
spec: T, | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config-errors/app/package.json | @@ -0,0 +1,3 @@
+{
+ "name": "env-config-errors"
+} | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config-errors/app/pages/api/hello.js | @@ -0,0 +1,5 @@
+export const config = {
+ env: ['NOTION_KEY', 'SENTRY_DSN', 'DATABASE_KEY', 'DATABASE_USER'],
+}
+
+export default (req, res) => res.json(req.env) | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config-errors/app/pages/index.js | @@ -0,0 +1,14 @@
+export const config = {
+ env: ['NOTION_KEY', 'SENTRY_DSN', 'DATABASE_KEY', 'DATABASE_USER'],
+}
+
+export async function getStaticProps({ env }) {
+ return {
+ // Do not pass any sensitive values here as they will
+ // be made PUBLICLY available in `pageProps`
+ props: { env },
+ revali... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config-errors/app/pages/ssp.js | @@ -0,0 +1,13 @@
+export const config = {
+ env: ['NOTION_KEY', 'SENTRY_DSN', 'DATABASE_KEY', 'DATABASE_USER'],
+}
+
+export async function getServerSideProps({ env }) {
+ return {
+ // Do not pass any sensitive values here as they will
+ // be made PUBLICLY available in `pageProps`
+ props: { env },
+ }
+}... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config-errors/test/index.test.js | @@ -0,0 +1,150 @@
+/* eslint-env jest */
+/* global jasmine */
+import fs from 'fs-extra'
+import { join } from 'path'
+import {
+ nextBuild,
+ findPort,
+ launchApp,
+ killApp,
+ nextStart,
+ renderViaHTTP,
+} from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
+
+const appDir = join(__dir... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/.env | @@ -0,0 +1,10 @@
+PROCESS_ENV_KEY=env
+ENV_FILE_KEY=env
+ENV_FILE_LOCAL_OVERRIDE_TEST=env
+ENV_FILE_DEVELOPMENT_OVERRIDE_TEST=env
+ENV_FILE_DEVELOPMENT_LOCAL_OVERRIDEOVERRIDE_TEST=env
+ENV_FILE_PRODUCTION_OVERRIDEOVERRIDE_TEST=env
+ENV_FILE_PRODUCTION_LOCAL_OVERRIDEOVERRIDE_TEST=env
+ENV_FILE_TEST_OVERRIDE_TEST=env
+EN... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/.env.development | @@ -0,0 +1,3 @@
+DEVELOPMENT_ENV_FILE_KEY=development
+ENV_FILE_DEVELOPMENT_OVERRIDE_TEST=development
+ENV_FILE_DEVELOPMENT_LOCAL_OVERRIDEOVERRIDE_TEST=development
\ No newline at end of file | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/.env.development.local | @@ -0,0 +1,2 @@
+LOCAL_DEVELOPMENT_ENV_FILE_KEY=localdevelopment
+ENV_FILE_DEVELOPMENT_LOCAL_OVERRIDEOVERRIDE_TEST=localdevelopment
\ No newline at end of file | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/.env.local | @@ -0,0 +1,2 @@
+LOCAL_ENV_FILE_KEY=localenv
+ENV_FILE_LOCAL_OVERRIDE_TEST=localenv
\ No newline at end of file | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/.env.production | @@ -0,0 +1,3 @@
+PRODUCTION_ENV_FILE_KEY=production
+ENV_FILE_PRODUCTION_OVERRIDEOVERRIDE_TEST=production
+ENV_FILE_PRODUCTION_LOCAL_OVERRIDEOVERRIDE_TEST=production
\ No newline at end of file | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/.env.production.local | @@ -0,0 +1,2 @@
+LOCAL_PRODUCTION_ENV_FILE_KEY=localproduction
+ENV_FILE_PRODUCTION_LOCAL_OVERRIDEOVERRIDE_TEST=localproduction
\ No newline at end of file | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/.env.test | @@ -0,0 +1,3 @@
+TEST_ENV_FILE_KEY=test
+ENV_FILE_TEST_OVERRIDE_TEST=test
+ENV_FILE_TEST_LOCAL_OVERRIDEOVERRIDE_TEST=test
\ No newline at end of file | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/.env.test.local | @@ -0,0 +1,2 @@
+LOCAL_TEST_ENV_FILE_KEY=localtest
+ENV_FILE_TEST_LOCAL_OVERRIDEOVERRIDE_TEST=localtest
\ No newline at end of file | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/package.json | @@ -0,0 +1,4 @@
+{
+ "name": "env-config",
+ "dependencies": {}
+} | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/pages/api/all.js | @@ -0,0 +1,25 @@
+export const config = {
+ env: [
+ 'PROCESS_ENV_KEY',
+ 'ENV_FILE_KEY',
+ 'LOCAL_ENV_FILE_KEY',
+ 'ENV_FILE_LOCAL_OVERRIDE_TEST',
+ 'PRODUCTION_ENV_FILE_KEY',
+ 'LOCAL_PRODUCTION_ENV_FILE_KEY',
+ 'DEVELOPMENT_ENV_FILE_KEY',
+ 'LOCAL_DEVELOPMENT_ENV_FILE_KEY',
+ 'ENV_FILE_DE... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/pages/global.js | @@ -0,0 +1 @@
+export default () => <p>{process.env.NEXT_APP_TEST_DEST}</p> | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/pages/index.js | @@ -0,0 +1,31 @@
+export const config = {
+ env: [
+ 'PROCESS_ENV_KEY',
+ 'ENV_FILE_KEY',
+ 'LOCAL_ENV_FILE_KEY',
+ 'ENV_FILE_LOCAL_OVERRIDE_TEST',
+ 'PRODUCTION_ENV_FILE_KEY',
+ 'LOCAL_PRODUCTION_ENV_FILE_KEY',
+ 'DEVELOPMENT_ENV_FILE_KEY',
+ 'LOCAL_DEVELOPMENT_ENV_FILE_KEY',
+ 'ENV_FILE_DE... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/pages/next-config-loaded-env.js | @@ -0,0 +1,16 @@
+export default () => (
+ <p>
+ {JSON.stringify({
+ LOCAL_ENV_FILE_KEY: process.env.NC_LOCAL_ENV_FILE_KEY,
+ ENV_FILE_KEY: process.env.NC_ENV_FILE_KEY,
+ PRODUCTION_ENV_FILE_KEY: process.env.NC_PRODUCTION_ENV_FILE_KEY,
+ LOCAL_PRODUCTION_ENV_FILE_KEY:
+ process.env.NC_LOC... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/pages/some-ssg.js | @@ -0,0 +1,31 @@
+export const config = {
+ env: [
+ 'PROCESS_ENV_KEY',
+ 'ENV_FILE_KEY',
+ 'LOCAL_ENV_FILE_KEY',
+ 'ENV_FILE_LOCAL_OVERRIDE_TEST',
+ 'PRODUCTION_ENV_FILE_KEY',
+ 'LOCAL_PRODUCTION_ENV_FILE_KEY',
+ 'DEVELOPMENT_ENV_FILE_KEY',
+ 'LOCAL_DEVELOPMENT_ENV_FILE_KEY',
+ 'ENV_FILE_DE... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/pages/some-ssp.js | @@ -0,0 +1,30 @@
+export const config = {
+ env: [
+ 'PROCESS_ENV_KEY',
+ 'ENV_FILE_KEY',
+ 'LOCAL_ENV_FILE_KEY',
+ 'ENV_FILE_LOCAL_OVERRIDE_TEST',
+ 'PRODUCTION_ENV_FILE_KEY',
+ 'LOCAL_PRODUCTION_ENV_FILE_KEY',
+ 'DEVELOPMENT_ENV_FILE_KEY',
+ 'LOCAL_DEVELOPMENT_ENV_FILE_KEY',
+ 'ENV_FILE_DE... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/app/pages/ssp.js | @@ -0,0 +1,30 @@
+export const config = {
+ env: [
+ 'PROCESS_ENV_KEY',
+ 'ENV_FILE_KEY',
+ 'LOCAL_ENV_FILE_KEY',
+ 'ENV_FILE_LOCAL_OVERRIDE_TEST',
+ 'PRODUCTION_ENV_FILE_KEY',
+ 'LOCAL_PRODUCTION_ENV_FILE_KEY',
+ 'DEVELOPMENT_ENV_FILE_KEY',
+ 'LOCAL_DEVELOPMENT_ENV_FILE_KEY',
+ 'ENV_FILE_DE... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | test/integration/env-config/test/index.test.js | @@ -0,0 +1,481 @@
+/* eslint-env jest */
+/* global jasmine */
+import url from 'url'
+import fs from 'fs-extra'
+import { join } from 'path'
+import cheerio from 'cheerio'
+import {
+ nextBuild,
+ nextStart,
+ renderViaHTTP,
+ findPort,
+ launchApp,
+ killApp,
+ fetchViaHTTP,
+} from 'next-test-utils'
+
+jasmin... | true |
Other | vercel | next.js | d8155b22ffbd2e64ca1aca6a7a843481a4f1c913.json | Add initial support for new env handling (#10525)
* Add initial support for new env config file
* Fix serverless processEnv call when no env is provided
* Add missing await for test method
* Update env config to .env.json and add dotenv loading
* ncc dotenv package
* Update type
* Update with new dis... | yarn.lock | @@ -2536,6 +2536,13 @@
dependencies:
"@types/node" "*"
+"@types/dotenv@8.2.0":
+ version "8.2.0"
+ resolved "https://registry.yarnpkg.com/@types/dotenv/-/dotenv-8.2.0.tgz#5cd64710c3c98e82d9d15844375a33bf1b45d053"
+ integrity sha512-ylSC9GhfRH7m1EUXBXofhgx4lUWmFeQDINW5oLuS+gxWdfUeW4zJdeVTYVkexEW+e2VUvlZR2kG... | true |
Other | vercel | next.js | 4801dcdd15132f485f2701101e4c2ee77b8666c3.json | Update AMP docs (#11353)
* Add caveat about css support for amp
* Update docs/advanced-features/amp-support/introduction.md
* Update introduction.md
Co-authored-by: Shu Uesugi <shu@chibicode.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl> | docs/advanced-features/amp-support/introduction.md | @@ -19,6 +19,10 @@ You can read more about AMP in the official [amp.dev](https://amp.dev/) site.
To enable AMP support for a page, and to learn more about the different AMP configs, read the [API documentation for `next/amp`](/docs/api-reference/next/amp.md).
+## Caveats
+
+- Only CSS-in-JS is supported. [CSS Modu... | false |
Other | vercel | next.js | b46abed61bdf6c2ebee414f545838e701d461eeb.json | use records to init store (#11343) | examples/with-react-relay-network-modern/lib/createEnvironment/client.js | @@ -3,16 +3,18 @@ import {
cacheMiddleware,
urlMiddleware,
} from 'react-relay-network-modern/node8'
-import RelaySSR from 'react-relay-network-modern-ssr/node8/client'
import { Environment, RecordSource, Store } from 'relay-runtime'
-const source = new RecordSource()
-const store = new Store(source)
+let sto... | true |
Other | vercel | next.js | b46abed61bdf6c2ebee414f545838e701d461eeb.json | use records to init store (#11343) | examples/with-react-relay-network-modern/lib/createEnvironment/server.js | @@ -2,37 +2,35 @@ import {
RelayNetworkLayer,
urlMiddleware,
} from 'react-relay-network-modern/node8'
-import RelaySSR from 'react-relay-network-modern-ssr/node8/server'
-import { Network, Environment, RecordSource, Store } from 'relay-runtime'
+import { Environment, RecordSource, Store } from 'relay-runtime'
... | true |
Other | vercel | next.js | b46abed61bdf6c2ebee414f545838e701d461eeb.json | use records to init store (#11343) | examples/with-react-relay-network-modern/pages/_app.js | @@ -12,13 +12,18 @@ export default class App extends NextApp {
try {
if (initEnvironment && Component.query) {
- const { environment, relaySSR } = initEnvironment()
+ const { environment } = initEnvironment()
await fetchQuery(environment, Component.query, variables)
+ con... | true |
Other | vercel | next.js | eeea53c04b08e5d6527a99bf0decf6ab767a1d66.json | Fix warning for API routes with next export (#11330)
* Fix warning for API routes with next export
* Update warning copy | errors/api-routes-static-export.md | @@ -2,11 +2,13 @@
#### Why This Warning Occurred
-An `exportPathMap` path was matched to an API route. `next export` will not prerender API routes to HTML.
+An `exportPathMap` path was matched to an API route. Statically exporting a Next.js application via `next export` disables API routes.
+
+This command is mean... | true |
Other | vercel | next.js | eeea53c04b08e5d6527a99bf0decf6ab767a1d66.json | Fix warning for API routes with next export (#11330)
* Fix warning for API routes with next export
* Update warning copy | packages/next/export/index.ts | @@ -149,17 +149,19 @@ export default async function(
const pages = options.pages || Object.keys(pagesManifest)
const defaultPathMap: ExportPathMap = {}
+ let hasApiRoutes = false
for (const page of pages) {
// _document and _app are not real pages
// _error is exported as 404.html later on
... | true |
Other | vercel | next.js | eeea53c04b08e5d6527a99bf0decf6ab767a1d66.json | Fix warning for API routes with next export (#11330)
* Fix warning for API routes with next export
* Update warning copy | test/integration/api-support/test/index.test.js | @@ -11,6 +11,7 @@ import {
renderViaHTTP,
nextBuild,
nextStart,
+ nextExport,
} from 'next-test-utils'
import json from '../big.json'
@@ -377,6 +378,17 @@ function runTests(dev = false) {
)
})
} else {
+ it('should show warning with next export', async () => {
+ const { stdout } = a... | true |
Other | vercel | next.js | eeea53c04b08e5d6527a99bf0decf6ab767a1d66.json | Fix warning for API routes with next export (#11330)
* Fix warning for API routes with next export
* Update warning copy | yarn.lock | @@ -4150,7 +4150,7 @@ browserify-zlib@^0.2.0:
dependencies:
pako "~1.0.5"
-browserslist@4.8.3, browserslist@^4.0.0, browserslist@^4.3.6, browserslist@^4.6.0, browserslist@^4.6.4, browserslist@^4.8.0, browserslist@^4.8.2, browserslist@^4.8.3:
+browserslist@4.8.3, browserslist@^1.3.6, browserslist@^1.5.2, brows... | true |
Other | vercel | next.js | f19dcf9b6e623415eb192694d51b3fdbcb2c8c90.json | Add Numeric Separator Support for TypeScript (#11308)
* Add Numeric Separator Support for TypeScript
* Check for number in render | packages/next/build/babel/preset.ts | @@ -49,7 +49,7 @@ type BabelPreset = {
presets?: PluginItem[] | null
plugins?: PluginItem[] | null
sourceType?: 'script' | 'module' | 'unambiguous'
- overrides?: any[]
+ overrides?: Array<{ test: RegExp } & Omit<BabelPreset, 'overrides'>>
}
// Taken from https://github.com/babel/babel/commit/d60c5e173654... | true |
Other | vercel | next.js | f19dcf9b6e623415eb192694d51b3fdbcb2c8c90.json | Add Numeric Separator Support for TypeScript (#11308)
* Add Numeric Separator Support for TypeScript
* Check for number in render | packages/next/package.json | @@ -61,6 +61,7 @@
"@babel/core": "7.7.2",
"@babel/plugin-proposal-class-properties": "7.7.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.7.4",
+ "@babel/plugin-proposal-numeric-separator": "7.8.3",
"@babel/plugin-proposal-object-rest-spread": "7.6.2",
"@babel/plugin-proposal-op... | true |
Other | vercel | next.js | f19dcf9b6e623415eb192694d51b3fdbcb2c8c90.json | Add Numeric Separator Support for TypeScript (#11308)
* Add Numeric Separator Support for TypeScript
* Check for number in render | test/integration/typescript-numeric-sep-exclusive/pages/index.js | @@ -0,0 +1 @@
+export default () => `hello ${1_000}` | true |
Other | vercel | next.js | f19dcf9b6e623415eb192694d51b3fdbcb2c8c90.json | Add Numeric Separator Support for TypeScript (#11308)
* Add Numeric Separator Support for TypeScript
* Check for number in render | test/integration/typescript-numeric-sep-exclusive/test/index.test.js | @@ -0,0 +1,22 @@
+/* eslint-env jest */
+/* global jasmine */
+import { nextBuild } from 'next-test-utils'
+import { join } from 'path'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
+
+const appDir = join(__dirname, '../')
+
+describe('TypeScript Exclusivity of Numeric Separator', () => {
+ it('should fail to bu... | true |
Other | vercel | next.js | f19dcf9b6e623415eb192694d51b3fdbcb2c8c90.json | Add Numeric Separator Support for TypeScript (#11308)
* Add Numeric Separator Support for TypeScript
* Check for number in render | test/integration/typescript/pages/hello.tsx | @@ -11,6 +11,7 @@ export default function HelloPage(): JSX.Element {
console.log(router.pathname)
return (
<div>
+ <p>One trillion dollars: {1_000_000_000_000}</p>
{hello()} <World />
<Router />
<Link /> | true |
Other | vercel | next.js | f19dcf9b6e623415eb192694d51b3fdbcb2c8c90.json | Add Numeric Separator Support for TypeScript (#11308)
* Add Numeric Separator Support for TypeScript
* Check for number in render | test/integration/typescript/test/index.test.js | @@ -43,6 +43,7 @@ describe('TypeScript Features', () => {
it('should render the page', async () => {
const $ = await get$('/hello')
expect($('body').text()).toMatch(/Hello World/)
+ expect($('body').text()).toMatch(/1000000000000/)
})
it('should report type checking to stdout', async... | true |
Other | vercel | next.js | f19dcf9b6e623415eb192694d51b3fdbcb2c8c90.json | Add Numeric Separator Support for TypeScript (#11308)
* Add Numeric Separator Support for TypeScript
* Check for number in render | yarn.lock | @@ -481,6 +481,14 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-nullish-coalescing-operator" "^7.7.4"
+"@babel/plugin-proposal-numeric-separator@7.8.3":
+ version "7.8.3"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-... | true |
Other | vercel | next.js | 541cd01b228dd01c353a3bb4bcac95fea4adb6e3.json | Add test for single alias (#11296) | test/integration/jsconfig-paths/components/hello.js | @@ -0,0 +1,5 @@
+import React from 'react'
+
+export function Hello() {
+ return <>Hello</>
+} | true |
Other | vercel | next.js | 541cd01b228dd01c353a3bb4bcac95fea4adb6e3.json | Add test for single alias (#11296) | test/integration/jsconfig-paths/jsconfig.json | @@ -3,7 +3,8 @@
"baseUrl": ".",
"paths": {
"@c/*": ["components/*"],
- "@lib/*": ["lib/a/*", "lib/b/*"]
+ "@lib/*": ["lib/a/*", "lib/b/*"],
+ "@mycomponent": ["components/hello.js"]
}
}
} | true |
Other | vercel | next.js | 541cd01b228dd01c353a3bb4bcac95fea4adb6e3.json | Add test for single alias (#11296) | test/integration/jsconfig-paths/pages/single-alias.js | @@ -0,0 +1,9 @@
+import { Hello } from '@mycomponent'
+
+export default function SingleAlias() {
+ return (
+ <div>
+ <Hello />
+ </div>
+ )
+} | true |
Other | vercel | next.js | 541cd01b228dd01c353a3bb4bcac95fea4adb6e3.json | Add test for single alias (#11296) | test/integration/jsconfig-paths/test/index.test.js | @@ -37,5 +37,10 @@ describe('TypeScript Features', () => {
const $ = await get$('/resolve-fallback')
expect($('body').text()).toMatch(/Hello from only b/)
})
+
+ it('should resolve a single matching alias', async () => {
+ const $ = await get$('/single-alias')
+ expect($('body').text()).... | true |
Other | vercel | next.js | 541cd01b228dd01c353a3bb4bcac95fea4adb6e3.json | Add test for single alias (#11296) | test/integration/typescript-paths/components/hello.tsx | @@ -0,0 +1,5 @@
+import React from 'react'
+
+export function Hello() {
+ return <>Hello</>
+} | true |
Other | vercel | next.js | 541cd01b228dd01c353a3bb4bcac95fea4adb6e3.json | Add test for single alias (#11296) | test/integration/typescript-paths/pages/single-alias.tsx | @@ -0,0 +1,9 @@
+import { Hello } from '@mycomponent'
+
+export default function SingleAlias() {
+ return (
+ <div>
+ <Hello />
+ </div>
+ )
+} | true |
Other | vercel | next.js | 541cd01b228dd01c353a3bb4bcac95fea4adb6e3.json | Add test for single alias (#11296) | test/integration/typescript-paths/test/index.test.js | @@ -37,5 +37,10 @@ describe('TypeScript Features', () => {
const $ = await get$('/resolve-fallback')
expect($('body').text()).toMatch(/Hello from only b/)
})
+
+ it('should resolve a single matching alias', async () => {
+ const $ = await get$('/single-alias')
+ expect($('body').text()).... | true |
Other | vercel | next.js | 541cd01b228dd01c353a3bb4bcac95fea4adb6e3.json | Add test for single alias (#11296) | test/integration/typescript-paths/tsconfig.json | @@ -3,7 +3,8 @@
"baseUrl": ".",
"paths": {
"@c/*": ["components/*"],
- "@lib/*": ["lib/a/*", "lib/b/*"]
+ "@lib/*": ["lib/a/*", "lib/b/*"],
+ "@mycomponent": ["components/hello.tsx"]
},
"esModuleInterop": true,
"module": "esnext", | true |
Other | vercel | next.js | d3fb2629585839da2f70eb5bdd88f47848a7d582.json | remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise
* fix mkdirp in spr-cache.ts
* bump fs-extra to 9.0.0
* remove mkdirp | package.json | @@ -72,13 +72,12 @@
"express": "4.17.0",
"faunadb": "2.6.1",
"firebase": "6.3.4",
- "fs-extra": "7.0.1",
+ "fs-extra": "9.0.0",
"get-port": "5.0.0",
"isomorphic-unfetch": "3.0.0",
"jest-cli": "24.9.0",
"lerna": "3.14.1",
"lint-staged": "9.4.2",
- "mkdirp": "0.5.1",
... | true |
Other | vercel | next.js | d3fb2629585839da2f70eb5bdd88f47848a7d582.json | remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise
* fix mkdirp in spr-cache.ts
* bump fs-extra to 9.0.0
* remove mkdirp | packages/next/build/index.ts | @@ -6,7 +6,6 @@ import escapeStringRegexp from 'escape-string-regexp'
import findUp from 'find-up'
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 { pathToRegexp } from 'path-to-regexp'
@@ ... | true |
Other | vercel | next.js | d3fb2629585839da2f70eb5bdd88f47848a7d582.json | remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise
* fix mkdirp in spr-cache.ts
* bump fs-extra to 9.0.0
* remove mkdirp | packages/next/build/profiler/profiler.js | @@ -1,5 +1,4 @@
import path from 'path'
-import mkdirp from 'mkdirp'
import fs from 'fs'
let inspector
@@ -92,7 +91,7 @@ export const createTrace = outputPath => {
const profiler = new Profiler(inspector)
if (/\/|\\/.test(outputPath)) {
const dirPath = path.dirname(outputPath)
- mkdirp.sync(dirPath)
... | true |
Other | vercel | next.js | d3fb2629585839da2f70eb5bdd88f47848a7d582.json | remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise
* fix mkdirp in spr-cache.ts
* bump fs-extra to 9.0.0
* remove mkdirp | packages/next/build/webpack/plugins/terser-webpack-plugin/src/TaskRunner.js | @@ -2,8 +2,7 @@ import { join } from 'path'
import minify from './minify'
import { promisify } from 'util'
import Worker from 'jest-worker'
-import { writeFile, readFile } from 'fs'
-import mkdirp from 'mkdirp'
+import { mkdirSync, writeFile, readFile } from 'fs'
const worker = require.resolve('./minify')
const ... | true |
Other | vercel | next.js | d3fb2629585839da2f70eb5bdd88f47848a7d582.json | remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise
* fix mkdirp in spr-cache.ts
* bump fs-extra to 9.0.0
* remove mkdirp | packages/next/export/index.ts | @@ -3,11 +3,11 @@ import findUp from 'find-up'
import {
copyFile as copyFileOrig,
existsSync,
+ mkdir as mkdirOrig,
readFileSync,
writeFileSync,
} from 'fs'
import Worker from 'jest-worker'
-import mkdirpModule from 'mkdirp'
import { cpus } from 'os'
import { dirname, join, resolve, sep } from 'path'
... | true |
Other | vercel | next.js | d3fb2629585839da2f70eb5bdd88f47848a7d582.json | remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise
* fix mkdirp in spr-cache.ts
* bump fs-extra to 9.0.0
* remove mkdirp | packages/next/export/worker.js | @@ -1,9 +1,8 @@
-import mkdirpModule from 'mkdirp'
import { promisify } from 'util'
import url from 'url'
import { extname, join, dirname, sep } from 'path'
import { renderToHTML } from '../next-server/server/render'
-import { writeFile, access } from 'fs'
+import { access, mkdir as mkdirOrig, writeFile } from 'fs'... | true |
Other | vercel | next.js | d3fb2629585839da2f70eb5bdd88f47848a7d582.json | remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise
* fix mkdirp in spr-cache.ts
* bump fs-extra to 9.0.0
* remove mkdirp | packages/next/next-server/server/spr-cache.ts | @@ -1,13 +1,12 @@
import fs from 'fs'
import LRUCache from 'lru-cache'
-import mkdirpOrig from 'mkdirp'
import path from 'path'
import { promisify } from 'util'
import { PrerenderManifest } from '../../build'
import { PRERENDER_MANIFEST } from '../lib/constants'
import { normalizePagePath } from './normalize-pag... | true |
Other | vercel | next.js | d3fb2629585839da2f70eb5bdd88f47848a7d582.json | remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise
* fix mkdirp in spr-cache.ts
* bump fs-extra to 9.0.0
* remove mkdirp | packages/next/package.json | @@ -114,7 +114,6 @@
"lodash.curry": "4.1.1",
"lru-cache": "5.1.1",
"mini-css-extract-plugin": "0.8.0",
- "mkdirp": "0.5.1",
"native-url": "0.2.6",
"node-fetch": "2.6.0",
"ora": "3.4.0",
@@ -175,7 +174,6 @@
"@types/lodash.curry": "4.1.6",
"@types/lru-cache": "5.1.0",
"@typ... | true |
Other | vercel | next.js | d3fb2629585839da2f70eb5bdd88f47848a7d582.json | remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise
* fix mkdirp in spr-cache.ts
* bump fs-extra to 9.0.0
* remove mkdirp | test/integration/create-next-app/index.test.js | @@ -1,12 +1,8 @@
/* eslint-env jest */
-import mkdirpModule from 'mkdirp'
import path from 'path'
-import fs from 'fs'
+import fs from 'fs-extra'
import execa from 'execa'
import os from 'os'
-import { promisify } from 'util'
-
-const mkdirp = promisify(mkdirpModule)
const cli = require.resolve('create-next-app/... | true |
Other | vercel | next.js | d3fb2629585839da2f70eb5bdd88f47848a7d582.json | remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise
* fix mkdirp in spr-cache.ts
* bump fs-extra to 9.0.0
* remove mkdirp | yarn.lock | @@ -2707,13 +2707,6 @@
dependencies:
"@types/node" "*"
-"@types/mkdirp@0.5.2":
- version "0.5.2"
- resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-0.5.2.tgz#503aacfe5cc2703d5484326b1b27efa67a339c1f"
- integrity sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4k... | true |
Other | vercel | next.js | c14d983d546057254a04203e33685a44429e78fa.json | Ensure hybrid AMP works correctly with SSG (#11205)
* Ensure hybrid AMP works correctly with SSG
* Strip AMP from query when not needed | packages/next/build/webpack/loaders/next-serverless-loader.ts | @@ -327,7 +327,7 @@ const nextServerlessLoader: loader.Loader = function() {
const previewData = tryGetPreviewData(req, res, options.previewProps)
const isPreviewMode = previewData !== false
- let result = await renderToHTML(req, res, "${page}", Object.assign({}, getStaticProps ? {} : parsedU... | true |
Other | vercel | next.js | c14d983d546057254a04203e33685a44429e78fa.json | Ensure hybrid AMP works correctly with SSG (#11205)
* Ensure hybrid AMP works correctly with SSG
* Strip AMP from query when not needed | packages/next/next-server/server/next-server.ts | @@ -818,7 +818,7 @@ export default class Server {
components,
query: {
...(components.getStaticProps
- ? { _nextDataReq: query._nextDataReq }
+ ? { _nextDataReq: query._nextDataReq, amp: query.amp }
: query),
...(params || {}),
... | true |
Other | vercel | next.js | c14d983d546057254a04203e33685a44429e78fa.json | Ensure hybrid AMP works correctly with SSG (#11205)
* Ensure hybrid AMP works correctly with SSG
* Strip AMP from query when not needed | test/integration/amphtml-ssg/pages/amp.js | @@ -0,0 +1,22 @@
+import { useAmp } from 'next/amp'
+
+export const config = {
+ amp: true,
+}
+
+export const getStaticProps = () => {
+ return {
+ props: {
+ hello: 'hello',
+ random: Math.random(),
+ },
+ }
+}
+
+export default ({ hello, random }) => (
+ <>
+ <p id="use-amp">useAmp: {useAmp() ... | true |
Other | vercel | next.js | c14d983d546057254a04203e33685a44429e78fa.json | Ensure hybrid AMP works correctly with SSG (#11205)
* Ensure hybrid AMP works correctly with SSG
* Strip AMP from query when not needed | test/integration/amphtml-ssg/pages/hybrid.js | @@ -0,0 +1,22 @@
+import { useAmp } from 'next/amp'
+
+export const config = {
+ amp: 'hybrid',
+}
+
+export const getStaticProps = () => {
+ return {
+ props: {
+ hello: 'hello',
+ random: Math.random(),
+ },
+ }
+}
+
+export default ({ hello, random }) => (
+ <>
+ <p id="use-amp">useAmp: {useAm... | true |
Other | vercel | next.js | c14d983d546057254a04203e33685a44429e78fa.json | Ensure hybrid AMP works correctly with SSG (#11205)
* Ensure hybrid AMP works correctly with SSG
* Strip AMP from query when not needed | test/integration/amphtml-ssg/pages/index.js | @@ -0,0 +1 @@
+export default () => <p>normal old page</p> | true |
Other | vercel | next.js | c14d983d546057254a04203e33685a44429e78fa.json | Ensure hybrid AMP works correctly with SSG (#11205)
* Ensure hybrid AMP works correctly with SSG
* Strip AMP from query when not needed | test/integration/amphtml-ssg/test/index.test.js | @@ -0,0 +1,124 @@
+/* eslint-env jest */
+/* global jasmine */
+import fs from 'fs-extra'
+import { join } from 'path'
+import cheerio from 'cheerio'
+import { validateAMP } from 'amp-test-utils'
+import {
+ nextBuild,
+ renderViaHTTP,
+ findPort,
+ launchApp,
+ killApp,
+ nextStart,
+} from 'next-test-utils'
+
+... | true |
Other | vercel | next.js | 5ff2deabf784937884dfbf75f13268eff6c4f45a.json | Add Html tag for custom Document (#6372)
This introduces a new `<Html>` tag for a custom `Document` so that we can correctly toggle the `amp` flag (among other things in the future ... maybe).
This is already "tested" through every other test & the AMP validator -- but let me know if we want explicit tests. | packages/next/README.md | @@ -1235,7 +1235,7 @@ Pages in `Next.js` skip the definition of the surrounding document's markup. For
// Event handlers like onClick can't be added to this file
// ./pages/_document.js
-import Document, { Head, Main, NextScript } from 'next/document'
+import Document, { Html, Head, Main, NextScript } from 'next/do... | true |
Other | vercel | next.js | 5ff2deabf784937884dfbf75f13268eff6c4f45a.json | Add Html tag for custom Document (#6372)
This introduces a new `<Html>` tag for a custom `Document` so that we can correctly toggle the `amp` flag (among other things in the future ... maybe).
This is already "tested" through every other test & the AMP validator -- but let me know if we want explicit tests. | packages/next/pages/_document.js | @@ -26,14 +26,31 @@ export default class Document extends Component {
}
}
- render () {
- return <html amp={this.props.amphtml ? '' : null}>
- <Head />
- <body>
- <Main />
- <NextScript />
- </body>
- </html>
+ render() {
+ return (
+ <Html>
+ <Head />
+ ... | true |
Other | vercel | next.js | 9d7385c3d81d7673b68e190e2cc9ba26b3fe161f.json | Add SSR'd Portals example (#6365) | examples/with-portals-ssr/README.md | @@ -0,0 +1,44 @@
+# Example with Server Side Rendered portals
+
+## How to use
+
+### Using `create-next-app`
+
+Execute [`create-next-app`](https://github.com/segmentio/create-next-app) with [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) or [npx](https://github.com/zkat/npx#readme) to bootstrap the example:
+
+`... | true |
Other | vercel | next.js | 9d7385c3d81d7673b68e190e2cc9ba26b3fe161f.json | Add SSR'd Portals example (#6365) | examples/with-portals-ssr/package.json | @@ -0,0 +1,13 @@
+{
+ "scripts": {
+ "dev": "next",
+ "build": "next build",
+ "start": "next start"
+ },
+ "dependencies": {
+ "@jesstelford/react-portal-universal": "1.0.0",
+ "next": "latest",
+ "react": "^16.8.0",
+ "react-dom": "^16.8.0"
+ }
+} | true |
Other | vercel | next.js | 9d7385c3d81d7673b68e190e2cc9ba26b3fe161f.json | Add SSR'd Portals example (#6365) | examples/with-portals-ssr/pages/_app.js | @@ -0,0 +1,25 @@
+import React from 'react'
+import App, { Container } from 'next/app'
+import { prepareClientPortals } from '@jesstelford/react-portal-universal'
+
+if (process.browser) {
+ // On the client, we have to run this once before React attempts a render.
+ // Here in _app is a great place to do it as this ... | true |
Other | vercel | next.js | 9d7385c3d81d7673b68e190e2cc9ba26b3fe161f.json | Add SSR'd Portals example (#6365) | examples/with-portals-ssr/pages/_document.js | @@ -0,0 +1,23 @@
+import Document from 'next/document'
+import { ServerPortal } from '@jesstelford/react-portal-universal/server'
+
+export default class extends Document {
+ static async getInitialProps (ctx) {
+ const portals = new ServerPortal()
+ const originalRenderPage = ctx.renderPage
+
+ ctx.renderPag... | true |
Other | vercel | next.js | 9d7385c3d81d7673b68e190e2cc9ba26b3fe161f.json | Add SSR'd Portals example (#6365) | examples/with-portals-ssr/pages/index.js | @@ -0,0 +1,64 @@
+import * as React from 'react'
+import { UniversalPortal } from '@jesstelford/react-portal-universal'
+
+export default class Index extends React.Component {
+ constructor () {
+ super(...arguments)
+ this.state = { opened: true }
+ }
+
+ open = () => {
+ this.setState({ opened: true })
+ ... | true |
Other | vercel | next.js | 369ac488e09b836d3f83d7f35e3b8a9bf72f74be.json | Assign deep defaults for custom config (#6359)
* assign deep defaults for custom config
* allow for new object type defaults
* fix linting | packages/next-server/server/config.js | @@ -25,6 +25,20 @@ const defaultConfig = {
}
}
+function assignDefaults (userConfig) {
+ Object.keys(userConfig).forEach(key => {
+ const maybeObject = userConfig[key]
+ if ((!!maybeObject) && (maybeObject.constructor === Object)) {
+ userConfig[key] = {
+ ...(defaultConfig[key] || {}),
+ ... | true |
Other | vercel | next.js | 369ac488e09b836d3f83d7f35e3b8a9bf72f74be.json | Assign deep defaults for custom config (#6359)
* assign deep defaults for custom config
* allow for new object type defaults
* fix linting | test/isolated/config.test.js | @@ -23,6 +23,12 @@ describe('config', () => {
expect(config.defaultConfig).toBeDefined()
})
+ it('Should assign object defaults deeply to user config', () => {
+ const config = loadConfig(PHASE_DEVELOPMENT_SERVER, pathToConfigFn)
+ expect(config.distDir).toEqual('.next')
+ expect(config.onDemandEntr... | true |
Other | vercel | next.js | 17ad1eb8aaec9150096868b811200e0da640048a.json | Add --frozen-lockfile to circleci | .circleci/config.yml | @@ -8,7 +8,7 @@ jobs:
- checkout
- run:
name: Installing dependencies
- command: yarn install
+ command: yarn install --frozen-lockfile
- run:
name: Linting
command: yarn lint | false |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | package.json | @@ -69,7 +69,7 @@
"chromedriver": "2.42.0",
"clone": "2.1.1",
"coveralls": "3.0.2",
- "eslint": "5.13.0",
+ "eslint": "5.4.0",
"eslint-plugin-typescript": "0.14.0",
"express": "4.16.3",
"fkill": "5.1.0",
@@ -90,7 +90,7 @@
"release": "5.0.3",
"request-promise-core": "1.1.1",... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next-server/lib/dynamic.js | @@ -25,7 +25,7 @@ export default function dynamic (dynamicOptions, options) {
let loadableFn = Loadable
let loadableOptions = {
// A loading component is not required, so we default it
- loading: ({error, isLoading}) => {
+ loading: ({ error, isLoading }) => {
if (process.env.NODE_ENV === 'devel... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next-server/lib/router/router.js | @@ -412,9 +412,9 @@ export default class Router {
let cancelled = false
const cancel = () => { cancelled = true }
this.componentLoadCancel = cancel
- const {Component: App} = this.components['/_app']
+ const { Component: App } = this.components['/_app']
- const props = await loadGetInitialProp... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next-server/server/config.js | @@ -1,5 +1,5 @@
import findUp from 'find-up'
-import {CONFIG_FILE} from 'next-server/constants'
+import { CONFIG_FILE } from 'next-server/constants'
const targets = ['server', 'serverless']
@@ -27,15 +27,15 @@ const defaultConfig = {
function normalizeConfig (phase, config) {
if (typeof config === 'function... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next-server/taskfile.js | @@ -1,12 +1,12 @@
const notifier = require('node-notifier')
export async function lib (task, opts) {
- await task.source(opts.src || 'lib/**/*.+(js|ts|tsx)').typescript({module: 'commonjs'}).target('dist/lib')
+ await task.source(opts.src || 'lib/**/*.+(js|ts|tsx)').typescript({ module: 'commonjs' }).target('dist... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next/build/webpack-config.js | @@ -10,11 +10,11 @@ import PagesManifestPlugin from './webpack/plugins/pages-manifest-plugin'
import BuildManifestPlugin from './webpack/plugins/build-manifest-plugin'
import ChunkNamesPlugin from './webpack/plugins/chunk-names-plugin'
import { ReactLoadablePlugin } from './webpack/plugins/react-loadable-plugin'
-im... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next/build/webpack/loaders/emit-file-loader.js | @@ -22,7 +22,7 @@ module.exports = function (content, sourceMap) {
const regExp = query.regExp
const opts = { context, content, regExp }
const interpolateName = query.interpolateName || ((name) => name)
- const interpolatedName = interpolateName(loaderUtils.interpolateName(this, name, opts), {name, opts})
+ ... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next/build/webpack/loaders/next-babel-loader.js | @@ -1,9 +1,9 @@
import babelLoader from 'babel-loader'
module.exports = babelLoader.custom(babel => {
- const presetItem = babel.createConfigItem(require('../../babel/preset'), {type: 'preset'})
- const applyCommonJs = babel.createConfigItem(require('../../babel/plugins/commonjs'), {type: 'plugin'})
- const comm... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next/build/webpack/plugins/build-manifest-plugin.js | @@ -1,13 +1,13 @@
import { RawSource } from 'webpack-sources'
-import {BUILD_MANIFEST, ROUTE_NAME_REGEX, IS_BUNDLED_PAGE_REGEX, CLIENT_STATIC_FILES_RUNTIME_MAIN} from 'next-server/constants'
+import { BUILD_MANIFEST, ROUTE_NAME_REGEX, IS_BUNDLED_PAGE_REGEX, CLIENT_STATIC_FILES_RUNTIME_MAIN } from 'next-server/constant... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next/build/webpack/plugins/nextjs-ssr-module-cache.js | @@ -1,7 +1,7 @@
import webpack from 'webpack'
import { RawSource } from 'webpack-sources'
import { join, relative, dirname } from 'path'
-import {IS_BUNDLED_PAGE_REGEX} from 'next-server/constants'
+import { IS_BUNDLED_PAGE_REGEX } from 'next-server/constants'
const SSR_MODULE_CACHE_FILENAME = 'ssr-module-cache.j... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next/build/webpack/plugins/pages-manifest-plugin.js | @@ -1,13 +1,13 @@
import { RawSource } from 'webpack-sources'
-import {PAGES_MANIFEST, ROUTE_NAME_REGEX} from 'next-server/constants'
+import { PAGES_MANIFEST, ROUTE_NAME_REGEX } from 'next-server/constants'
// This plugin creates a pages-manifest.json from page entrypoints.
// This is used for mapping paths like ... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next/client/dev-error-overlay/hot-dev-client.js | @@ -26,11 +26,11 @@ SOFTWARE.
// It's been edited to rely on webpack-hot-middleware and to be more compatible with SSR / Next.js
'use strict'
-import {getEventSourceWrapper} from './eventsource'
+import { getEventSourceWrapper } from './eventsource'
import formatWebpackMessages from './format-webpack-messages'
im... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next/client/error-boundary.js | @@ -2,12 +2,12 @@ import React from 'react'
class ErrorBoundary extends React.Component {
componentDidCatch (error, info) {
- const {onError} = this.props
+ const { onError } = this.props
// onError is required
onError(error, info)
}
render () {
- const {children} = this.props
+ const ... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next/client/index.js | @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom'
import HeadManager from './head-manager'
import { createRouter } from 'next/router'
import mitt from 'next-server/dist/lib/mitt'
-import {loadGetInitialProps, getURL} from 'next-server/dist/lib/utils'
+import { loadGetInitialProps, getURL } from 'next-server/dist/lib/... | true |
Other | vercel | next.js | fcf1167cd4c8604a90d4fb1e28b13e0af8bbe046.json | Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12 | packages/next/client/link.js | @@ -3,8 +3,8 @@
import { resolve, format, parse } from 'url'
import React, { Component, Children } from 'react'
import PropTypes from 'prop-types'
-import Router, {Router as _Router} from 'next/router'
-import {execOnce, getLocationOrigin} from 'next-server/dist/lib/utils'
+import Router, { Router as _Router } from ... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.