@vercel/node 2.5.10 → 2.5.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -182,7 +182,10 @@ async function compileUserCode(entrypointPath, entrypointLabel) {
182
182
  } catch (error) {
183
183
  // we can't easily show a meaningful stack trace
184
184
  // so, stick to just the error message for now
185
- event.respondWith(new Response(error.message, {
185
+ const msg = error.cause
186
+ ? (error.message + ': ' + (error.cause.message || error.cause))
187
+ : error.message;
188
+ event.respondWith(new Response(msg, {
186
189
  status: 500,
187
190
  headers: {
188
191
  'x-vercel-failed': 'edge-wrapper'
package/dist/index.js CHANGED
@@ -226990,7 +226990,7 @@ async function analyze(id, code, job) {
226990
226990
  .filter(name => !excludeAssetExtensions.has(path_1.default.extname(name)) &&
226991
226991
  !excludeAssetFiles.has(path_1.default.basename(name)) &&
226992
226992
  !name.endsWith('/'))
226993
- .forEach(file => assets.add(file));
226993
+ .forEach(file => deps.add(file));
226994
226994
  });
226995
226995
  }
226996
226996
  async function processRequireArg(expression, isImport = false) {
@@ -227023,7 +227023,7 @@ async function analyze(id, code, job) {
227023
227023
  let scope = rollup_pluginutils_1.attachScopes(ast, 'scope');
227024
227024
  if (isAst(ast)) {
227025
227025
  wrappers_1.handleWrappers(ast);
227026
- await special_cases_1.default({ id, ast, emitAsset: path => assets.add(path), emitAssetDirectory, job });
227026
+ await special_cases_1.default({ id, ast, emitDependency: path => deps.add(path), emitAsset: path => assets.add(path), emitAssetDirectory, job });
227027
227027
  }
227028
227028
  async function backtrack(parent, context) {
227029
227029
  // computing a static expression outward
@@ -227110,6 +227110,18 @@ async function analyze(id, code, job) {
227110
227110
  await processRequireArg(node.arguments[0]);
227111
227111
  return;
227112
227112
  }
227113
+ else if ((!isESM || job.mixedModules) &&
227114
+ node.callee.type === 'MemberExpression' &&
227115
+ node.callee.object.type === 'Identifier' &&
227116
+ node.callee.object.name === 'require' &&
227117
+ knownBindings.require.shadowDepth === 0 &&
227118
+ node.callee.property.type === 'Identifier' &&
227119
+ !node.callee.computed &&
227120
+ node.callee.property.name === 'resolve' &&
227121
+ node.arguments.length) {
227122
+ await processRequireArg(node.arguments[0]);
227123
+ return;
227124
+ }
227113
227125
  const calleeValue = job.analysis.evaluatePureExpressions && await computePureStaticValue(node.callee, false);
227114
227126
  // if we have a direct pure static function,
227115
227127
  // and that function has a [TRIGGER] symbol -> trigger asset emission from it
@@ -227809,6 +227821,9 @@ class Job {
227809
227821
  const source = await this.readFile(path);
227810
227822
  if (source === null)
227811
227823
  throw new Error('File ' + path + ' does not exist.');
227824
+ // analyze should not have any side-effects e.g. calling `job.emitFile`
227825
+ // directly as this will not be included in the cachedAnalysis and won't
227826
+ // be emit for successive runs that leverage the cache
227812
227827
  analyzeResult = await analyze_1.default(path, source.toString(), this);
227813
227828
  this.analysisCache.set(path, analyzeResult);
227814
227829
  }
@@ -228653,18 +228668,18 @@ const specialCases = {
228653
228668
  emitAsset(path_1.resolve(path_1.dirname(id), '../data/geo.dat'));
228654
228669
  }
228655
228670
  },
228656
- 'pixelmatch'({ id, emitAsset }) {
228671
+ 'pixelmatch'({ id, emitDependency }) {
228657
228672
  if (id.endsWith('pixelmatch/index.js')) {
228658
- emitAsset(path_1.resolve(path_1.dirname(id), 'bin/pixelmatch'));
228673
+ emitDependency(path_1.resolve(path_1.dirname(id), 'bin/pixelmatch'));
228659
228674
  }
228660
228675
  }
228661
228676
  };
228662
- async function handleSpecialCases({ id, ast, emitAsset, emitAssetDirectory, job }) {
228677
+ async function handleSpecialCases({ id, ast, emitDependency, emitAsset, emitAssetDirectory, job }) {
228663
228678
  const pkgName = get_package_base_1.getPackageName(id);
228664
228679
  const specialCase = specialCases[pkgName || ''];
228665
228680
  id = id.replace(/\\/g, '/');
228666
228681
  if (specialCase)
228667
- await specialCase({ id, ast, emitAsset, emitAssetDirectory, job });
228682
+ await specialCase({ id, ast, emitDependency, emitAsset, emitAssetDirectory, job });
228668
228683
  }
228669
228684
  exports.default = handleSpecialCases;
228670
228685
  ;
@@ -304763,8 +304778,6 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
304763
304778
  }));
304764
304779
  }
304765
304780
  }
304766
- build_utils_1.debug('Tracing input files: ' +
304767
- [...inputFiles].map(p => path_1.relative(workPath, p)).join(', '));
304768
304781
  let tsCompile;
304769
304782
  function compileTypeScript(path, source) {
304770
304783
  const relPath = path_1.relative(baseDir, path);
@@ -304848,9 +304861,7 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
304848
304861
  },
304849
304862
  });
304850
304863
  for (const warning of warnings) {
304851
- if (warning?.stack) {
304852
- build_utils_1.debug(warning.stack.replace('Error: ', 'Warning: '));
304853
- }
304864
+ build_utils_1.debug(`Warning from trace: ${warning.message}`);
304854
304865
  }
304855
304866
  for (const path of fileList) {
304856
304867
  let entry = fsCache.get(path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/node",
3
- "version": "2.5.10",
3
+ "version": "2.5.13",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@edge-runtime/vm": "1.1.0-beta.23",
33
33
  "@types/node": "*",
34
- "@vercel/build-utils": "5.3.2",
34
+ "@vercel/build-utils": "5.4.1",
35
35
  "@vercel/node-bridge": "3.0.0",
36
36
  "@vercel/static-config": "2.0.3",
37
37
  "edge-runtime": "1.1.0-beta.23",
@@ -53,7 +53,7 @@
53
53
  "@types/node-fetch": "^2.6.1",
54
54
  "@types/test-listen": "1.1.0",
55
55
  "@vercel/ncc": "0.24.0",
56
- "@vercel/nft": "0.21.0",
56
+ "@vercel/nft": "0.22.1",
57
57
  "content-type": "1.0.4",
58
58
  "cookie": "0.4.0",
59
59
  "etag": "1.8.1",
@@ -61,5 +61,5 @@
61
61
  "source-map-support": "0.5.12",
62
62
  "test-listen": "1.1.0"
63
63
  },
64
- "gitHead": "6700630feb23bdb4e94ea727911a9e10aa546361"
64
+ "gitHead": "3ff93279cd53bbfb620d27c93ca59d28917a5598"
65
65
  }