@vercel/nft 0.18.2 → 0.20.0

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.
package/out/analyze.js CHANGED
@@ -257,7 +257,7 @@ async function analyze(id, code, job) {
257
257
  value: {
258
258
  [static_eval_1.FUNCTION](specifier) {
259
259
  deps.add(specifier);
260
- const m = staticModules[specifier];
260
+ const m = staticModules[specifier.startsWith('node:') ? specifier.slice(5) : specifier];
261
261
  return m.default;
262
262
  },
263
263
  resolve(specifier) {
@@ -296,7 +296,7 @@ async function analyze(id, code, job) {
296
296
  if (decl.type === 'ImportDeclaration') {
297
297
  const source = String(decl.source.value);
298
298
  deps.add(source);
299
- const staticModule = staticModules[source];
299
+ const staticModule = staticModules[source.startsWith('node:') ? source.slice(5) : source];
300
300
  if (staticModule) {
301
301
  for (const impt of decl.specifiers) {
302
302
  if (impt.type === 'ImportNamespaceSpecifier')
@@ -531,9 +531,17 @@ async function analyze(id, code, job) {
531
531
  node.arguments[0].name === '__dirname' && knownBindings.__dirname.shadowDepth === 0) {
532
532
  let resolved;
533
533
  try {
534
- resolved = node_gyp_build_1.default.path(dir);
534
+ // use installed version of node-gyp-build since resolving
535
+ // binaries can differ among versions
536
+ const nodeGypBuildPath = resolve_from_1.default(dir, 'node-gyp-build');
537
+ resolved = require(nodeGypBuildPath).path(dir);
538
+ }
539
+ catch (e) {
540
+ try {
541
+ resolved = node_gyp_build_1.default.path(dir);
542
+ }
543
+ catch (e) { }
535
544
  }
536
- catch (e) { }
537
545
  if (resolved) {
538
546
  staticChildValue = { value: resolved };
539
547
  staticChildNode = node;
@@ -32,10 +32,7 @@ async function nodeFileTrace(files, opts = {}) {
32
32
  await Promise.all(files.map(async (file) => {
33
33
  const path = path_1.resolve(file);
34
34
  await job.emitFile(path, 'initial');
35
- if (path.endsWith('.js') || path.endsWith('.cjs') || path.endsWith('.mjs') || path.endsWith('.node') || job.ts && (path.endsWith('.ts') || path.endsWith('.tsx'))) {
36
- return job.emitDependency(path);
37
- }
38
- return undefined;
35
+ return job.emitDependency(path);
39
36
  }));
40
37
  const result = {
41
38
  fileList: job.fileList,
@@ -181,6 +181,8 @@ async function resolvePackage(name, parent, job, cjsResolve) {
181
181
  let packageParent = parent;
182
182
  if (nodeBuiltins.has(name))
183
183
  return 'node:' + name;
184
+ if (name.startsWith('node:'))
185
+ return name;
184
186
  const pkgName = getPkgName(name) || '';
185
187
  // package own name resolution
186
188
  let selfResolved;
@@ -467,6 +467,13 @@ const visitors = {
467
467
  }
468
468
  return { value: obj };
469
469
  },
470
+ 'SequenceExpression': async function SequenceExpression(node, walk) {
471
+ if ('expressions' in node && node.expressions.length === 2 && node.expressions[0].type === 'Literal' && node.expressions[0].value === 0 && node.expressions[1].type === 'MemberExpression') {
472
+ const arg = await walk(node.expressions[1]);
473
+ return arg;
474
+ }
475
+ return undefined;
476
+ },
470
477
  'TemplateLiteral': async function TemplateLiteral(node, walk) {
471
478
  let val = { value: '' };
472
479
  for (var i = 0; i < node.expressions.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/nft",
3
- "version": "0.18.2",
3
+ "version": "0.20.0",
4
4
  "repository": "vercel/nft",
5
5
  "license": "MIT",
6
6
  "main": "./out/index.js",
@@ -88,6 +88,7 @@
88
88
  "mailgun": "^0.5.0",
89
89
  "mariadb": "^2.0.5",
90
90
  "memcached": "^2.2.2",
91
+ "microtime": "^3.0.0",
91
92
  "mongoose": "^5.7.5",
92
93
  "mysql": "^2.17.1",
93
94
  "npm": "^6.14.6",
@@ -116,7 +117,7 @@
116
117
  "saslprep": "^1.0.3",
117
118
  "semver": "^7.1.1",
118
119
  "sequelize": "^5.9.3",
119
- "sharp": "^0.30.0",
120
+ "sharp": "^0.30.5",
120
121
  "socket.io": "^2.4.0",
121
122
  "socket.io-client": "^2.2.0",
122
123
  "stripe": "^7.4.0",