From edabb95f3aa9d9d6b666b30d6046de51d20458cf Mon Sep 17 00:00:00 2001 From: Janicklas Ralph James Date: Sat, 4 Apr 2020 14:36:29 -0700 Subject: [PATCH 1/5] Updating native-url version --- packages/next/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/package.json b/packages/next/package.json index a72c2e1e6af4bc7..3f0e8fd3f508ca1 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -83,7 +83,7 @@ "jest-worker": "24.9.0", "loader-utils": "2.0.0", "mini-css-extract-plugin": "0.8.0", - "native-url": "0.2.6", + "native-url": "0.3.0", "pnp-webpack-plugin": "1.5.0", "postcss": "7.0.27", "prop-types": "15.7.2", From c1470991c1efb7b995961e0d743d6029768ade6a Mon Sep 17 00:00:00 2001 From: Janicklas Ralph James Date: Sat, 4 Apr 2020 17:32:37 -0700 Subject: [PATCH 2/5] Bump version --- packages/next/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/package.json b/packages/next/package.json index 3f0e8fd3f508ca1..8cb0f1dd11d3dd2 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -83,7 +83,7 @@ "jest-worker": "24.9.0", "loader-utils": "2.0.0", "mini-css-extract-plugin": "0.8.0", - "native-url": "0.3.0", + "native-url": "0.3.1", "pnp-webpack-plugin": "1.5.0", "postcss": "7.0.27", "prop-types": "15.7.2", From 9fd0e72d7a95ab2bbe6841a06135c124a02e96aa Mon Sep 17 00:00:00 2001 From: Janicklas Ralph James Date: Thu, 7 Jan 2021 13:12:44 -0800 Subject: [PATCH 3/5] Remove warning message from postprocess step --- packages/next/next-server/lib/post-process.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/next/next-server/lib/post-process.ts b/packages/next/next-server/lib/post-process.ts index 8570c04e1955eb8..aa29fb89ce5da67 100644 --- a/packages/next/next-server/lib/post-process.ts +++ b/packages/next/next-server/lib/post-process.ts @@ -67,21 +67,14 @@ async function processHTML( const root: HTMLElement = parse(html) let document = html // Calls the middleware, with some instrumentation and logging - async function callMiddleWare( - middleware: PostProcessMiddleware, - name: string - ) { + async function callMiddleWare(middleware: PostProcessMiddleware) { let timer = Date.now() middleware.inspect(root, postProcessData, data) - const inspectTime = Date.now() - timer document = await middleware.mutate(document, postProcessData, data) timer = Date.now() - timer if (timer > MIDDLEWARE_TIME_BUDGET) { - console.warn( - `The postprocess middleware "${name}" took ${timer}ms(${inspectTime}, ${ - timer - inspectTime - }) to complete. This is longer than the ${MIDDLEWARE_TIME_BUDGET} limit.` - ) + // TODO: Identify a correct upper limit for the postprocess step + // and add a warning to disable the optimization } return } From eefc0fe75c7536b3174331091b421bb43ce0c880 Mon Sep 17 00:00:00 2001 From: Janicklas Ralph James Date: Fri, 8 Jan 2021 11:52:50 -0800 Subject: [PATCH 4/5] Fix lint --- packages/next/next-server/lib/post-process.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/next/next-server/lib/post-process.ts b/packages/next/next-server/lib/post-process.ts index aa29fb89ce5da67..e14329c30ca2abd 100644 --- a/packages/next/next-server/lib/post-process.ts +++ b/packages/next/next-server/lib/post-process.ts @@ -82,10 +82,7 @@ async function processHTML( for (let i = 0; i < middlewareRegistry.length; i++) { let middleware = middlewareRegistry[i] if (!middleware.condition || middleware.condition(options)) { - await callMiddleWare( - middlewareRegistry[i].middleware, - middlewareRegistry[i].name - ) + await callMiddleWare(middlewareRegistry[i].middleware) } } From 9bec1435488a57a1e172cab9ccef025291781517 Mon Sep 17 00:00:00 2001 From: Janicklas Ralph James Date: Mon, 11 Jan 2021 11:13:42 -0800 Subject: [PATCH 5/5] Remove unwanted code --- packages/next/next-server/lib/post-process.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/next/next-server/lib/post-process.ts b/packages/next/next-server/lib/post-process.ts index e14329c30ca2abd..0565b34591785c3 100644 --- a/packages/next/next-server/lib/post-process.ts +++ b/packages/next/next-server/lib/post-process.ts @@ -1,8 +1,7 @@ import { parse, HTMLElement } from 'node-html-parser' import { OPTIMIZED_FONT_PROVIDERS } from './constants' -const MIDDLEWARE_TIME_BUDGET = - parseInt(process.env.__POST_PROCESS_MIDDLEWARE_TIME_BUDGET || '', 10) || 10 +// const MIDDLEWARE_TIME_BUDGET = parseInt(process.env.__POST_PROCESS_MIDDLEWARE_TIME_BUDGET || '', 10) || 10 const MAXIMUM_IMAGE_PRELOADS = 2 const IMAGE_PRELOAD_SIZE_THRESHOLD = 2500 @@ -68,14 +67,14 @@ async function processHTML( let document = html // Calls the middleware, with some instrumentation and logging async function callMiddleWare(middleware: PostProcessMiddleware) { - let timer = Date.now() + // let timer = Date.now() middleware.inspect(root, postProcessData, data) document = await middleware.mutate(document, postProcessData, data) - timer = Date.now() - timer - if (timer > MIDDLEWARE_TIME_BUDGET) { - // TODO: Identify a correct upper limit for the postprocess step - // and add a warning to disable the optimization - } + // timer = Date.now() - timer + // if (timer > MIDDLEWARE_TIME_BUDGET) { + // TODO: Identify a correct upper limit for the postprocess step + // and add a warning to disable the optimization + // } return }