From cd6a310c873f680f3aaedf05ad827afeac835754 Mon Sep 17 00:00:00 2001 From: Andrea De Masi Date: Mon, 19 Dec 2022 12:27:58 +0100 Subject: [PATCH 1/2] fix traced warnings from unexpected token --- .changeset/lazy-tomatoes-call.md | 5 +++++ packages/integrations/vercel/src/lib/nft.ts | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .changeset/lazy-tomatoes-call.md diff --git a/.changeset/lazy-tomatoes-call.md b/.changeset/lazy-tomatoes-call.md new file mode 100644 index 000000000000..e36f95d01de9 --- /dev/null +++ b/.changeset/lazy-tomatoes-call.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vercel': minor +--- + +Ignore warnings when traced file fails to parse diff --git a/packages/integrations/vercel/src/lib/nft.ts b/packages/integrations/vercel/src/lib/nft.ts index 6a9ac116eeeb..fed2595a35c2 100644 --- a/packages/integrations/vercel/src/lib/nft.ts +++ b/packages/integrations/vercel/src/lib/nft.ts @@ -1,8 +1,7 @@ +import { copyFilesToFunction } from './fs.js'; +import { fileURLToPath } from 'node:url'; import { nodeFileTrace } from '@vercel/nft'; import { relative as relativePath } from 'node:path'; -import { fileURLToPath } from 'node:url'; - -import { copyFilesToFunction } from './fs.js'; export async function copyDependenciesToFunction({ entry, @@ -43,6 +42,12 @@ export async function copyDependenciesToFunction({ `[@astrojs/vercel] The module "${module}" inside the file "${file}" couldn't be resolved. This may not be a problem, but it's worth checking.` ); } + } + // parse errors are likely not js and can safely be ignored, + // such as this html file in "main" meant for nw instead of node: + // https://github.com/vercel/nft/issues/311 + else if (error.message.startsWith('Failed to parse')) { + continue; } else { throw error; } From e3e390ff027c41f874b36bd22c2223eb2d6c7719 Mon Sep 17 00:00:00 2001 From: Andrea De Masi Date: Mon, 19 Dec 2022 19:06:19 +0100 Subject: [PATCH 2/2] Fixed styling --- packages/integrations/vercel/src/lib/nft.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/integrations/vercel/src/lib/nft.ts b/packages/integrations/vercel/src/lib/nft.ts index fed2595a35c2..46604db902ac 100644 --- a/packages/integrations/vercel/src/lib/nft.ts +++ b/packages/integrations/vercel/src/lib/nft.ts @@ -1,7 +1,8 @@ -import { copyFilesToFunction } from './fs.js'; -import { fileURLToPath } from 'node:url'; import { nodeFileTrace } from '@vercel/nft'; import { relative as relativePath } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { copyFilesToFunction } from './fs.js'; export async function copyDependenciesToFunction({ entry,