@vercel/node 2.5.10 → 2.5.11

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.
Files changed (2) hide show
  1. package/dist/index.js +33 -23
  2. package/package.json +4 -4
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
@@ -227794,12 +227806,15 @@ class Job {
227794
227806
  return;
227795
227807
  if (path.endsWith('.node'))
227796
227808
  return await sharedlib_emit_1.sharedLibEmit(path, this);
227797
- // js files require the "type": "module" lookup, so always emit the package.json
227798
- if (path.endsWith('.js')) {
227799
- const pjsonBoundary = await this.getPjsonBoundary(path);
227800
- if (pjsonBoundary)
227801
- await this.emitFile(pjsonBoundary + path_1.sep + 'package.json', 'resolve', path);
227802
- }
227809
+ const handlePjsonBoundary = async (item) => {
227810
+ // js files require the "type": "module" lookup, so always emit the package.json
227811
+ if (item.endsWith(".js")) {
227812
+ const pjsonBoundary = await this.getPjsonBoundary(item);
227813
+ if (pjsonBoundary)
227814
+ await this.emitFile(pjsonBoundary + path_1.sep + "package.json", "resolve", item);
227815
+ }
227816
+ };
227817
+ await handlePjsonBoundary(path);
227803
227818
  let analyzeResult;
227804
227819
  const cachedAnalysis = this.analysisCache.get(path);
227805
227820
  if (cachedAnalysis) {
@@ -227809,6 +227824,9 @@ class Job {
227809
227824
  const source = await this.readFile(path);
227810
227825
  if (source === null)
227811
227826
  throw new Error('File ' + path + ' does not exist.');
227827
+ // analyze should not have any side-effects e.g. calling `job.emitFile`
227828
+ // directly as this will not be included in the cachedAnalysis and won't
227829
+ // be emit for successive runs that leverage the cache
227812
227830
  analyzeResult = await analyze_1.default(path, source.toString(), this);
227813
227831
  this.analysisCache.set(path, analyzeResult);
227814
227832
  }
@@ -227817,12 +227835,8 @@ class Job {
227817
227835
  this.esmFileList.add(path_1.relative(this.base, path));
227818
227836
  await Promise.all([
227819
227837
  ...[...assets].map(async (asset) => {
227820
- const ext = path_1.extname(asset);
227821
- if (ext === '.js' || ext === '.mjs' || ext === '.node' || ext === '' ||
227822
- this.ts && (ext === '.ts' || ext === '.tsx') && asset.startsWith(this.base) && asset.slice(this.base.length).indexOf(path_1.sep + 'node_modules' + path_1.sep) === -1)
227823
- await this.emitDependency(asset, path);
227824
- else
227825
- await this.emitFile(asset, 'asset', path);
227838
+ await handlePjsonBoundary(asset);
227839
+ await this.emitFile(asset, 'asset', path);
227826
227840
  }),
227827
227841
  ...[...deps].map(async (dep) => {
227828
227842
  try {
@@ -228653,18 +228667,18 @@ const specialCases = {
228653
228667
  emitAsset(path_1.resolve(path_1.dirname(id), '../data/geo.dat'));
228654
228668
  }
228655
228669
  },
228656
- 'pixelmatch'({ id, emitAsset }) {
228670
+ 'pixelmatch'({ id, emitDependency }) {
228657
228671
  if (id.endsWith('pixelmatch/index.js')) {
228658
- emitAsset(path_1.resolve(path_1.dirname(id), 'bin/pixelmatch'));
228672
+ emitDependency(path_1.resolve(path_1.dirname(id), 'bin/pixelmatch'));
228659
228673
  }
228660
228674
  }
228661
228675
  };
228662
- async function handleSpecialCases({ id, ast, emitAsset, emitAssetDirectory, job }) {
228676
+ async function handleSpecialCases({ id, ast, emitDependency, emitAsset, emitAssetDirectory, job }) {
228663
228677
  const pkgName = get_package_base_1.getPackageName(id);
228664
228678
  const specialCase = specialCases[pkgName || ''];
228665
228679
  id = id.replace(/\\/g, '/');
228666
228680
  if (specialCase)
228667
- await specialCase({ id, ast, emitAsset, emitAssetDirectory, job });
228681
+ await specialCase({ id, ast, emitDependency, emitAsset, emitAssetDirectory, job });
228668
228682
  }
228669
228683
  exports.default = handleSpecialCases;
228670
228684
  ;
@@ -304763,8 +304777,6 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
304763
304777
  }));
304764
304778
  }
304765
304779
  }
304766
- build_utils_1.debug('Tracing input files: ' +
304767
- [...inputFiles].map(p => path_1.relative(workPath, p)).join(', '));
304768
304780
  let tsCompile;
304769
304781
  function compileTypeScript(path, source) {
304770
304782
  const relPath = path_1.relative(baseDir, path);
@@ -304848,9 +304860,7 @@ async function compile(workPath, baseDir, entrypointPath, config, nodeVersion, i
304848
304860
  },
304849
304861
  });
304850
304862
  for (const warning of warnings) {
304851
- if (warning?.stack) {
304852
- build_utils_1.debug(warning.stack.replace('Error: ', 'Warning: '));
304853
- }
304863
+ build_utils_1.debug(`Warning from trace: ${warning.message}`);
304854
304864
  }
304855
304865
  for (const path of fileList) {
304856
304866
  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.11",
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.0",
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.0",
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": "e7e0a55b72bc73c26661f7b2a3caa0884a5d1764"
65
65
  }