Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update @types/node to 14.14.31 #41634

Merged
merged 5 commits into from Oct 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -79,7 +79,7 @@
"@types/html-validator": "5.0.3",
"@types/http-proxy": "1.17.3",
"@types/jest": "24.0.13",
"@types/node": "13.11.0",
"@types/node": "14.14.31",
"@types/node-fetch": "2.6.1",
"@types/react": "16.9.17",
"@types/react-dom": "16.9.4",
Expand Down
Expand Up @@ -108,19 +108,19 @@ export function interpolateDynamicPath(

if (paramIdx > -1) {
let paramValue: string
const value = params[param]

if (Array.isArray(params[param])) {
paramValue = (params[param] as string[])
.map((v) => v && encodeURIComponent(v))
.join('/')
if (Array.isArray(value)) {
paramValue = value.map((v) => v && encodeURIComponent(v)).join('/')
} else if (value) {
paramValue = encodeURIComponent(value)
} else {
paramValue =
params[param] && encodeURIComponent(params[param] as string)
paramValue = ''
}

pathname =
pathname.slice(0, paramIdx) +
(paramValue || '') +
paramValue +
pathname.slice(paramIdx + builtParam.length)
}
}
Expand Down Expand Up @@ -293,7 +293,7 @@ export function getUtils({

// favor named matches if available
const routeKeyNames = Object.keys(routeKeys || {})
const filterLocaleItem = (val: string | string[]) => {
const filterLocaleItem = (val: string | string[] | undefined) => {
if (i18n) {
// locale items can be included in route-matches
// for fallback SSG pages so ensure they are
Expand Down Expand Up @@ -604,7 +604,7 @@ export function getUtils({
),
interpolateDynamicPath: (
pathname: string,
params: Record<string, string | string[]>
params: Record<string, undefined | string | string[]>
) => interpolateDynamicPath(pathname, params, defaultRouteRegex),
}
}
2 changes: 1 addition & 1 deletion packages/next/compiled/ora/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/next/export/worker.ts
Expand Up @@ -324,7 +324,7 @@ export default async function exportPage({
results.fromBuildExportRevalidate = revalidate

if (revalidate !== 0) {
await promises.writeFile(htmlFilepath, html, 'utf8')
await promises.writeFile(htmlFilepath, html ?? '', 'utf8')
await promises.writeFile(
htmlFilepath.replace(/\.html$/, '.rsc'),
flightData
Expand Down
2 changes: 1 addition & 1 deletion packages/next/lib/worker.ts
Expand Up @@ -44,7 +44,7 @@ export class Worker {
})
}

let hangingTimer: number | false = false
let hangingTimer: NodeJS.Timeout | false = false

const onActivity = () => {
if (hangingTimer) clearTimeout(hangingTimer)
Expand Down
6 changes: 6 additions & 0 deletions packages/next/server.d.ts
@@ -1,3 +1,9 @@
import type { AsyncLocalStorage as NodeAsyncLocalStorage } from 'async_hooks'

declare global {
var AsyncLocalStorage: typeof NodeAsyncLocalStorage
}

export { NextFetchEvent } from 'next/dist/server/web/spec-extension/fetch-event'
export { NextRequest } from 'next/dist/server/web/spec-extension/request'
export { NextResponse } from 'next/dist/server/web/spec-extension/response'
Expand Down
5 changes: 2 additions & 3 deletions packages/next/server/server-route-utils.ts
Expand Up @@ -103,14 +103,13 @@ export const createHeaderRoute = ({
// values from rewrites/redirects
export const stringifyQuery = (req: BaseNextRequest, query: ParsedUrlQuery) => {
const initialQuery = getRequestMeta(req, '__NEXT_INIT_QUERY') || {}
const initialQueryValues: Array<string | string[]> =
Object.values(initialQuery)
const initialQueryValues = Object.values(initialQuery)

return stringifyQs(query, undefined, undefined, {
encodeURIComponent(value) {
if (
value in initialQuery ||
initialQueryValues.some((initialQueryVal: string | string[]) => {
initialQueryValues.some((initialQueryVal) => {
// `value` always refers to a query value, even if it's nested in an array
return Array.isArray(initialQueryVal)
? initialQueryVal.includes(value)
Expand Down
Expand Up @@ -197,7 +197,7 @@ export function prepareDestination(args: {
destQuery[key] = strOrArray.map((value) =>
compileNonPath(unescapeSegments(value), args.params)
)
} else {
} else if (typeof strOrArray === 'string') {
destQuery[key] = compileNonPath(unescapeSegments(strOrArray), args.params)
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/shared/lib/router/utils/querystring.ts
Expand Up @@ -16,7 +16,7 @@ export function searchParamsToUrlQuery(
return query
}

function stringifyUrlQueryParam(param: string): string {
function stringifyUrlQueryParam(param: unknown): string {
if (
typeof param === 'string' ||
(typeof param === 'number' && !isNaN(param)) ||
Expand Down
2 changes: 1 addition & 1 deletion packages/next/trace/report/to-json.ts
Expand Up @@ -55,7 +55,7 @@ let batch: ReturnType<typeof batcher> | undefined

const writeStreamOptions = {
flags: 'a',
encoding: 'utf8',
encoding: 'utf8' as const,
}
class RotatingWriteStream {
file: string
Expand Down