@vercel/nft
Advanced tools
Comparing version 0.27.1 to 0.27.2
@@ -27,3 +27,5 @@ /// <reference types="node" /> | ||
private cachedFileSystem; | ||
private remappings; | ||
constructor({ base, processCwd, exports, conditions, exportsOnly, paths, ignore, log, mixedModules, ts, analysis, cache, fileIOConcurrency, }: NodeFileTraceOptions); | ||
addRemapping(path: string, dep: string): void; | ||
readlink(path: string): Promise<string | null>; | ||
@@ -30,0 +32,0 @@ isFile(path: string): Promise<boolean>; |
@@ -35,6 +35,5 @@ "use strict"; | ||
const sharedlib_emit_1 = require("./utils/sharedlib-emit"); | ||
const path_2 = require("path"); | ||
const fs_1 = require("./fs"); | ||
function inPath(path, parent) { | ||
const pathWithSep = (0, path_2.join)(parent, path_1.sep); | ||
const pathWithSep = (0, path_1.join)(parent, path_1.sep); | ||
return path.startsWith(pathWithSep) && path !== pathWithSep; | ||
@@ -73,2 +72,3 @@ } | ||
this.reasons = new Map(); | ||
this.remappings = new Map(); | ||
this.maybeEmitDep = async (dep, path, cjsResolve) => { | ||
@@ -180,2 +180,12 @@ let resolved = ''; | ||
} | ||
addRemapping(path, dep) { | ||
if (path === dep) | ||
return; | ||
let deps = this.remappings.get(path); | ||
if (!deps) { | ||
deps = new Set(); | ||
this.remappings.set(path, deps); | ||
} | ||
deps.add(dep); | ||
} | ||
async readlink(path) { | ||
@@ -222,3 +232,3 @@ return this.cachedFileSystem.readlink(path); | ||
return path; | ||
return (0, path_2.join)(await this.realpath((0, path_1.dirname)(path), parent, seen), (0, path_1.basename)(path)); | ||
return (0, path_1.join)(await this.realpath((0, path_1.dirname)(path), parent, seen), (0, path_1.basename)(path)); | ||
} | ||
@@ -275,2 +285,7 @@ async emitFile(path, reasonType, parent, isRealpath = false) { | ||
this.processed.add(path); | ||
// Additional dependencies. | ||
const additionalDeps = this.remappings.get(path); | ||
if (additionalDeps) { | ||
await Promise.all([...additionalDeps].map(async (dep) => this.emitDependency(dep, path))); | ||
} | ||
const emitted = await this.emitFile(path, 'dependency', parent); | ||
@@ -277,0 +292,0 @@ if (!emitted) |
@@ -179,2 +179,19 @@ "use strict"; | ||
} | ||
async function resolveRemappings(pkgPath, pkgCfg, parent, job) { | ||
if (job.conditions?.includes('browser')) { | ||
const { browser: pkgBrowser } = pkgCfg; | ||
if (typeof pkgBrowser === 'object') { | ||
for (const [key, value] of Object.entries(pkgBrowser)) { | ||
if (!key.startsWith('./') || !value.startsWith('./')) { | ||
continue; | ||
} | ||
const keyResolved = await resolveFile(pkgPath + path_1.sep + key, parent, job); | ||
const valueResolved = await resolveFile(pkgPath + path_1.sep + value, parent, job); | ||
if (keyResolved && valueResolved) { | ||
job.addRemapping(keyResolved, valueResolved); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
async function packageImportsResolve(name, parent, job, cjsResolve) { | ||
@@ -248,2 +265,5 @@ if (name !== '#' && !name.startsWith('#/') && job.conditions) { | ||
const { exports: pkgExports } = pkgCfg || {}; | ||
if (pkgCfg) { | ||
await resolveRemappings(nodeModulesDir + path_1.sep + pkgName, pkgCfg, parent, job); | ||
} | ||
if (job.conditions && | ||
@@ -250,0 +270,0 @@ pkgExports !== undefined && |
{ | ||
"name": "@vercel/nft", | ||
"version": "0.27.1", | ||
"version": "0.27.2", | ||
"repository": "vercel/nft", | ||
@@ -45,2 +45,3 @@ "license": "MIT", | ||
"@google-cloud/firestore": "^7.6.0", | ||
"@opentelemetry/api": "^1.7.0", | ||
"@sentry/node": "^5.5.0", | ||
@@ -47,0 +48,0 @@ "@tpluscode/sparql-builder": "^0.3.12", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
319872
3837
103