Skip to content

Commit

Permalink
Merge branch 'canary' into fix/image-blur-placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
styfle committed Jul 25, 2023
2 parents f8cbf8e + d0cbf35 commit ce55dfd
Show file tree
Hide file tree
Showing 28 changed files with 161 additions and 189 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ import { useState, useEffect } from 'react'

function Profile() {
const [data, setData] = useState(null)
const [isLoading, setLoading] = useState(false)
const [isLoading, setLoading] = useState(true)

useEffect(() => {
setLoading(true)
fetch('/api/profile-data')
.then((res) => res.json())
.then((data) => {
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "13.4.13-canary.0"
"version": "13.4.13-canary.2"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"keywords": [
"react",
"next",
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"description": "ESLint configuration used by NextJS.",
"main": "index.js",
"license": "MIT",
Expand All @@ -10,9 +10,9 @@
},
"homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config",
"dependencies": {
"@next/eslint-plugin-next": "13.4.13-canary.0",
"@next/eslint-plugin-next": "13.4.13-canary.2",
"@rushstack/eslint-patch": "^1.1.3",
"@typescript-eslint/parser": "^5.42.0",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"description": "ESLint plugin for NextJS.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/font",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
Expand Down
14 changes: 7 additions & 7 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "13.4.13-canary.0",
"version": "13.4.13-canary.2",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -83,7 +83,7 @@
]
},
"dependencies": {
"@next/env": "13.4.13-canary.0",
"@next/env": "13.4.13-canary.2",
"@swc/helpers": "0.5.1",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406",
Expand Down Expand Up @@ -141,11 +141,11 @@
"@jest/types": "29.5.0",
"@napi-rs/cli": "2.14.7",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "13.4.13-canary.0",
"@next/polyfill-nomodule": "13.4.13-canary.0",
"@next/react-dev-overlay": "13.4.13-canary.0",
"@next/react-refresh-utils": "13.4.13-canary.0",
"@next/swc": "13.4.13-canary.0",
"@next/polyfill-module": "13.4.13-canary.2",
"@next/polyfill-nomodule": "13.4.13-canary.2",
"@next/react-dev-overlay": "13.4.13-canary.2",
"@next/react-refresh-utils": "13.4.13-canary.2",
"@next/swc": "13.4.13-canary.2",
"@opentelemetry/api": "1.4.1",
"@segment/ajv-human-errors": "2.1.2",
"@taskr/clear": "1.1.0",
Expand Down
12 changes: 3 additions & 9 deletions packages/next/src/cli/next-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import build from '../build'
import { printAndExit } from '../server/lib/utils'
import isError from '../lib/is-error'
import { getProjectDir } from '../lib/get-project-dir'
import { getValidatedArgs } from '../lib/get-validated-args'

const nextBuild: CliCommand = (argv) => {
const validArgs: arg.Spec = {
Expand All @@ -25,15 +26,8 @@ const nextBuild: CliCommand = (argv) => {
'-d': '--debug',
}

let args: arg.Result<arg.Spec>
try {
args = arg(validArgs, { argv })
} catch (error) {
if (isError(error) && error.code === 'ARG_UNKNOWN_OPTION') {
return printAndExit(error.message, 1)
}
throw error
}
const args = getValidatedArgs(validArgs, argv)

if (args['--help']) {
printAndExit(
`
Expand Down
12 changes: 2 additions & 10 deletions packages/next/src/cli/next-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { startServer, StartServerOptions } from '../server/lib/start-server'
import { getPort, printAndExit } from '../server/lib/utils'
import * as Log from '../build/output/log'
import { CliCommand } from '../lib/commands'
import isError from '../lib/is-error'
import { getProjectDir } from '../lib/get-project-dir'
import { CONFIG_FILES, PHASE_DEVELOPMENT_SERVER } from '../shared/lib/constants'
import path from 'path'
Expand All @@ -20,6 +19,7 @@ import Watchpack from 'watchpack'
import stripAnsi from 'next/dist/compiled/strip-ansi'
import { getPossibleInstrumentationHookFilenames } from '../build/worker'
import { resetEnv } from '@next/env'
import { getValidatedArgs } from '../lib/get-validated-args'

let dir: string
let config: NextConfigComplete
Expand Down Expand Up @@ -131,15 +131,7 @@ const nextDev: CliCommand = async (argv) => {
'-p': '--port',
'-H': '--hostname',
}
let args: arg.Result<arg.Spec>
try {
args = arg(validArgs, { argv })
} catch (error) {
if (isError(error) && error.code === 'ARG_UNKNOWN_OPTION') {
return printAndExit(error.message, 1)
}
throw error
}
const args = getValidatedArgs(validArgs, argv)
if (args['--help']) {
console.log(`
Description
Expand Down
12 changes: 2 additions & 10 deletions packages/next/src/cli/next-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import * as Log from '../build/output/log'
import { printAndExit } from '../server/lib/utils'
import { CliCommand } from '../lib/commands'
import { trace } from '../trace'
import isError from '../lib/is-error'
import { getProjectDir } from '../lib/get-project-dir'
import { getValidatedArgs } from '../lib/get-validated-args'

const nextExport: CliCommand = (argv) => {
const nextExportCliSpan = trace('next-export-cli')
Expand All @@ -25,15 +25,7 @@ const nextExport: CliCommand = (argv) => {
'-o': '--outdir',
'-s': '--silent',
}
let args: arg.Result<arg.Spec>
try {
args = arg(validArgs, { argv })
} catch (error) {
if (isError(error) && error.code === 'ARG_UNKNOWN_OPTION') {
return printAndExit(error.message, 1)
}
throw error
}
const args = getValidatedArgs(validArgs, argv)
if (args['--help']) {
console.log(`
Description
Expand Down
13 changes: 2 additions & 11 deletions packages/next/src/cli/next-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import arg from 'next/dist/compiled/arg/index.js'
const { fetch } = require('next/dist/compiled/undici') as {
fetch: typeof global.fetch
}
import { printAndExit } from '../server/lib/utils'
import { CliCommand } from '../lib/commands'
import isError from '../lib/is-error'
import { PHASE_INFO } from '../shared/lib/constants'
import loadConfig from '../server/config'
import { getValidatedArgs } from '../lib/get-validated-args'

const dir = process.cwd()

Expand Down Expand Up @@ -50,15 +49,7 @@ const nextInfo: CliCommand = async (argv) => {
// Aliases
'-h': '--help',
}
let args: arg.Result<arg.Spec>
try {
args = arg(validArgs, { argv })
} catch (error) {
if (isError(error) && error.code === 'ARG_UNKNOWN_OPTION') {
return printAndExit(error.message, 1)
}
throw error
}
const args = getValidatedArgs(validArgs, argv)

if (args['--help']) {
console.log(
Expand Down
13 changes: 3 additions & 10 deletions packages/next/src/cli/next-lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import loadConfig from '../server/config'
import { PHASE_PRODUCTION_BUILD } from '../shared/lib/constants'
import { eventLintCheckCompleted } from '../telemetry/events'
import { CompileError } from '../lib/compile-error'
import isError from '../lib/is-error'
import { getProjectDir } from '../lib/get-project-dir'
import { findPagesDir } from '../lib/find-pages-dir'
import { verifyTypeScriptSetup } from '../lib/verifyTypeScriptSetup'
import { getValidatedArgs } from '../lib/get-validated-args'

const eslintOptions = (args: arg.Spec, defaultCacheLocation: string) => ({
overrideConfigFile: args['--config'] || null,
Expand Down Expand Up @@ -93,15 +93,8 @@ const nextLint: CliCommand = async (argv) => {
'-o': '--output-file',
}

let args: arg.Result<arg.Spec>
try {
args = arg({ ...validArgs, ...validEslintArgs }, { argv })
} catch (error) {
if (isError(error) && error.code === 'ARG_UNKNOWN_OPTION') {
return printAndExit(error.message, 1)
}
throw error
}
const args = getValidatedArgs({ ...validArgs, ...validEslintArgs }, argv)

if (args['--help']) {
printAndExit(
`
Expand Down
12 changes: 2 additions & 10 deletions packages/next/src/cli/next-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import arg from 'next/dist/compiled/arg/index.js'
import { startServer } from '../server/lib/start-server'
import { getPort, printAndExit } from '../server/lib/utils'
import isError from '../lib/is-error'
import { getProjectDir } from '../lib/get-project-dir'
import { CliCommand } from '../lib/commands'
import { resolve } from 'path'
import { PHASE_PRODUCTION_SERVER } from '../shared/lib/constants'
import loadConfig from '../server/config'
import { getValidatedArgs } from '../lib/get-validated-args'

const nextStart: CliCommand = async (argv) => {
const validArgs: arg.Spec = {
Expand All @@ -23,15 +23,7 @@ const nextStart: CliCommand = async (argv) => {
'-p': '--port',
'-H': '--hostname',
}
let args: arg.Result<arg.Spec>
try {
args = arg(validArgs, { argv })
} catch (error) {
if (isError(error) && error.code === 'ARG_UNKNOWN_OPTION') {
return printAndExit(error.message, 1)
}
throw error
}
const args = getValidatedArgs(validArgs, argv)
if (args['--help']) {
console.log(`
Description
Expand Down
13 changes: 2 additions & 11 deletions packages/next/src/cli/next-telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/usr/bin/env node
import chalk from 'next/dist/compiled/chalk'
import arg from 'next/dist/compiled/arg/index.js'
import { printAndExit } from '../server/lib/utils'
import { CliCommand } from '../lib/commands'
import { Telemetry } from '../telemetry/storage'
import isError from '../lib/is-error'
import { getValidatedArgs } from '../lib/get-validated-args'

const nextTelemetry: CliCommand = (argv) => {
const validArgs: arg.Spec = {
Expand All @@ -15,15 +14,7 @@ const nextTelemetry: CliCommand = (argv) => {
// Aliases
'-h': '--help',
}
let args: arg.Result<arg.Spec>
try {
args = arg(validArgs, { argv })
} catch (error) {
if (isError(error) && error.code === 'ARG_UNKNOWN_OPTION') {
return printAndExit(error.message, 1)
}
throw error
}
const args = getValidatedArgs(validArgs, argv)

if (args['--help']) {
console.log(
Expand Down
16 changes: 16 additions & 0 deletions packages/next/src/lib/get-validated-args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import arg from 'next/dist/compiled/arg/index.js'
import { printAndExit } from '../server/lib/utils'
import isError from './is-error'

export function getValidatedArgs(validArgs: arg.Spec, argv?: string[]) {
let args: arg.Result<arg.Spec>
try {
args = arg(validArgs, { argv })
} catch (error) {
if (isError(error) && error.code === 'ARG_UNKNOWN_OPTION') {
printAndExit(error.message, 1)
}
throw error
}
return args
}
4 changes: 1 addition & 3 deletions packages/next/src/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -930,9 +930,7 @@ export default abstract class Server<ServerOptions extends Options = Options> {
for (const key of routeParamKeys) {
delete parsedUrl.query[key]
}
parsedUrl.pathname = `${this.nextConfig.basePath || ''}${
matchedPath === '/' && this.nextConfig.basePath ? '' : matchedPath
}`
parsedUrl.pathname = matchedPath
url.pathname = parsedUrl.pathname
} catch (err) {
if (err instanceof DecodeError || err instanceof NormalizeError) {
Expand Down

0 comments on commit ce55dfd

Please sign in to comment.