@vercel/nft
Advanced tools
Comparing version 0.9.6 to 0.10.0
@@ -22,4 +22,5 @@ "use strict"; | ||
const node_gyp_build_1 = __importDefault(require("node-gyp-build")); | ||
const url_1 = require("url"); | ||
// Note: these should be deprecated over time as they ship in Acorn core | ||
const acorn = acorn_1.Parser.extend(require("acorn-class-fields"), require("acorn-export-ns-from"), require("acorn-import-meta"), require("acorn-numeric-separator"), require("acorn-static-class-features")); | ||
const acorn = acorn_1.Parser.extend(require("acorn-class-fields"), require("acorn-static-class-features")); | ||
const os_1 = __importDefault(require("os")); | ||
@@ -76,10 +77,4 @@ const wrappers_1 = require("./utils/wrappers"); | ||
}, | ||
fs: { | ||
default: fsSymbols, | ||
...fsSymbols | ||
}, | ||
process: { | ||
default: staticProcess, | ||
...staticProcess | ||
}, | ||
fs: Object.assign({ default: fsSymbols }, fsSymbols), | ||
process: Object.assign({ default: staticProcess }, staticProcess), | ||
// populated below | ||
@@ -89,6 +84,3 @@ path: { | ||
}, | ||
os: { | ||
default: os_1.default, | ||
...os_1.default | ||
}, | ||
os: Object.assign({ default: os_1.default }, os_1.default), | ||
'node-pre-gyp': binary_locators_1.pregyp, | ||
@@ -126,3 +118,4 @@ 'node-pre-gyp/lib/pre-binding': binary_locators_1.pregyp, | ||
__importStar: interop_require_1.normalizeWildcardRequire, | ||
MONGOOSE_DRIVER_PATH: undefined | ||
MONGOOSE_DRIVER_PATH: undefined, | ||
URL: url_1.URL, | ||
}; | ||
@@ -156,4 +149,18 @@ globalBindings.global = globalBindings.GLOBAL = globalBindings.globalThis = globalBindings; | ||
const absoluteRegEx = /^\/[^\/]+|^[a-z]:[\\/][^\\/]+/i; | ||
function isAbsolutePathStr(str) { | ||
return typeof str === 'string' && absoluteRegEx.test(str); | ||
function isAbsolutePathOrUrl(str) { | ||
if (str instanceof url_1.URL) | ||
return str.protocol === 'file:'; | ||
if (typeof str === 'string') { | ||
if (str.startsWith('file:')) { | ||
try { | ||
new url_1.URL(str); | ||
return true; | ||
} | ||
catch (_a) { | ||
return false; | ||
} | ||
} | ||
return absoluteRegEx.test(str); | ||
} | ||
return false; | ||
} | ||
@@ -222,14 +229,15 @@ const BOUND_REQUIRE = Symbol(); | ||
} | ||
const importMetaUrl = url_1.pathToFileURL(id).href; | ||
const knownBindings = Object.assign(Object.create(null), { | ||
__dirname: { | ||
shadowDepth: 0, | ||
value: path_1.default.resolve(id, '..') | ||
value: { value: path_1.default.resolve(id, '..') } | ||
}, | ||
__filename: { | ||
shadowDepth: 0, | ||
value: id | ||
value: { value: id } | ||
}, | ||
process: { | ||
shadowDepth: 0, | ||
value: staticProcess | ||
value: { value: staticProcess } | ||
} | ||
@@ -241,13 +249,15 @@ }); | ||
value: { | ||
[static_eval_1.FUNCTION](specifier) { | ||
deps.add(specifier); | ||
const m = staticModules[specifier]; | ||
return m.default; | ||
}, | ||
resolve(specifier) { | ||
return resolve_dependency_js_1.default(specifier, id, job); | ||
value: { | ||
[static_eval_1.FUNCTION](specifier) { | ||
deps.add(specifier); | ||
const m = staticModules[specifier]; | ||
return m.default; | ||
}, | ||
resolve(specifier) { | ||
return resolve_dependency_js_1.default(specifier, id, job); | ||
} | ||
} | ||
} | ||
}; | ||
knownBindings.require.value.resolve[TRIGGER] = true; | ||
knownBindings.require.value.value.resolve[TRIGGER] = true; | ||
} | ||
@@ -271,2 +281,3 @@ function setKnownBinding(name, value) { | ||
} | ||
return undefined; | ||
} | ||
@@ -286,7 +297,7 @@ function hasKnownBindingValue(name) { | ||
if (impt.type === 'ImportNamespaceSpecifier') | ||
setKnownBinding(impt.local.name, staticModule); | ||
setKnownBinding(impt.local.name, { value: staticModule }); | ||
else if (impt.type === 'ImportDefaultSpecifier' && 'default' in staticModule) | ||
setKnownBinding(impt.local.name, staticModule.default); | ||
setKnownBinding(impt.local.name, { value: staticModule.default }); | ||
else if (impt.type === 'ImportSpecifier' && impt.imported.name in staticModule) | ||
setKnownBinding(impt.local.name, staticModule[impt.imported.name]); | ||
setKnownBinding(impt.local.name, { value: staticModule[impt.imported.name] }); | ||
} | ||
@@ -307,4 +318,5 @@ } | ||
Object.keys(globalBindings).forEach(name => { | ||
vars[name] = globalBindings[name]; | ||
vars[name] = { value: globalBindings[name] }; | ||
}); | ||
vars['import.meta'] = { url: importMetaUrl }; | ||
// evaluate returns undefined for non-statically-analyzable | ||
@@ -398,2 +410,3 @@ const result = static_eval_1.evaluate(expr, vars, computeBranches); | ||
enter(node, parent) { | ||
var _a; | ||
if (node.scope) { | ||
@@ -409,2 +422,4 @@ scope = node.scope; | ||
return; | ||
if (!parent) | ||
return; | ||
if (node.type === 'Identifier') { | ||
@@ -415,4 +430,3 @@ if (ast_helpers_1.isIdentifierRead(node, parent) && job.analysis.computeFileReferences) { | ||
// __dirname, __filename | ||
// Could add import.meta.url, even path-like environment variables | ||
if (typeof (binding = getKnownBinding(node.name)) === 'string' && binding.match(absoluteRegEx) || | ||
if (typeof (binding = (_a = getKnownBinding(node.name)) === null || _a === void 0 ? void 0 : _a.value) === 'string' && binding.match(absoluteRegEx) || | ||
binding && (typeof binding === 'function' || typeof binding === 'object') && binding[TRIGGER]) { | ||
@@ -425,2 +439,8 @@ staticChildValue = { value: typeof binding === 'string' ? binding : undefined }; | ||
} | ||
else if (job.analysis.computeFileReferences && node.type === 'MemberExpression' && node.object.type === 'MetaProperty' && node.object.meta.name === 'import' && node.object.property.name === 'meta' && (node.property.computed ? node.property.value : node.property.name) === 'url') { | ||
// import.meta.url leaf trigger | ||
staticChildValue = { value: importMetaUrl }; | ||
staticChildNode = node; | ||
backtrack(parent, this); | ||
} | ||
else if (node.type === 'ImportExpression') { | ||
@@ -584,10 +604,10 @@ processRequireArg(node.source, true); | ||
continue; | ||
const computed = computePureStaticValue(decl.init, false); | ||
if (computed && 'value' in computed) { | ||
const computed = computePureStaticValue(decl.init, true); | ||
if (computed) { | ||
// var known = ...; | ||
if (decl.id.type === 'Identifier') { | ||
setKnownBinding(decl.id.name, computed.value); | ||
setKnownBinding(decl.id.name, computed); | ||
} | ||
// var { known } = ...; | ||
else if (decl.id.type === 'ObjectPattern') { | ||
else if (decl.id.type === 'ObjectPattern' && 'value' in computed) { | ||
for (const prop of decl.id.properties) { | ||
@@ -601,6 +621,6 @@ if (prop.type !== 'Property' || | ||
continue; | ||
setKnownBinding(prop.value.name, computed.value[prop.key.name]); | ||
setKnownBinding(prop.value.name, { value: computed.value[prop.key.name] }); | ||
} | ||
} | ||
if (isAbsolutePathStr(computed.value)) { | ||
if (!('value' in computed) && isAbsolutePathOrUrl(computed.then) && isAbsolutePathOrUrl(computed.else)) { | ||
staticChildValue = computed; | ||
@@ -619,3 +639,3 @@ staticChildNode = decl.init; | ||
if (node.left.type === 'Identifier') { | ||
setKnownBinding(node.left.name, computed.value); | ||
setKnownBinding(node.left.name, computed); | ||
} | ||
@@ -632,6 +652,6 @@ // var { known } = ... | ||
continue; | ||
setKnownBinding(prop.value.name, computed.value[prop.key.name]); | ||
setKnownBinding(prop.value.name, { value: computed.value[prop.key.name] }); | ||
} | ||
} | ||
if (isAbsolutePathStr(computed.value)) { | ||
if (isAbsolutePathOrUrl(computed.value)) { | ||
staticChildValue = computed; | ||
@@ -687,3 +707,3 @@ staticChildNode = node.right; | ||
if (returned) | ||
setKnownBinding(fnName.name, BOUND_REQUIRE); | ||
setKnownBinding(fnName.name, { value: BOUND_REQUIRE }); | ||
} | ||
@@ -764,2 +784,5 @@ } | ||
} | ||
function resolveAbsolutePathOrUrl(value) { | ||
return value instanceof url_1.URL ? url_1.fileURLToPath(value) : value.startsWith('file:') ? url_1.fileURLToPath(new url_1.URL(value)) : path_1.default.resolve(value); | ||
} | ||
function emitStaticChildAsset() { | ||
@@ -769,5 +792,5 @@ if (!staticChildValue) { | ||
} | ||
if ('value' in staticChildValue && isAbsolutePathStr(staticChildValue.value)) { | ||
if ('value' in staticChildValue && isAbsolutePathOrUrl(staticChildValue.value)) { | ||
try { | ||
const resolved = path_1.default.resolve(staticChildValue.value); | ||
const resolved = resolveAbsolutePathOrUrl(staticChildValue.value); | ||
emitAssetPath(resolved); | ||
@@ -777,6 +800,6 @@ } | ||
} | ||
else if ('then' in staticChildValue && 'else' in staticChildValue && isAbsolutePathStr(staticChildValue.then) && isAbsolutePathStr(staticChildValue.else)) { | ||
else if ('then' in staticChildValue && 'else' in staticChildValue && isAbsolutePathOrUrl(staticChildValue.then) && isAbsolutePathOrUrl(staticChildValue.else)) { | ||
let resolvedThen; | ||
try { | ||
resolvedThen = path_1.default.resolve(staticChildValue.then); | ||
resolvedThen = resolveAbsolutePathOrUrl(staticChildValue.then); | ||
} | ||
@@ -786,3 +809,3 @@ catch (e) { } | ||
try { | ||
resolvedElse = path_1.default.resolve(staticChildValue.else); | ||
resolvedElse = resolveAbsolutePathOrUrl(staticChildValue.else); | ||
} | ||
@@ -798,3 +821,3 @@ catch (e) { } | ||
try { | ||
const resolved = path_1.default.resolve(value); | ||
const resolved = resolveAbsolutePathOrUrl(value); | ||
emitAssetPath(resolved); | ||
@@ -801,0 +824,0 @@ } |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
cwd: string; | ||
exports: string[]; | ||
conditions: string[]; | ||
exportsOnly: boolean; | ||
@@ -29,3 +29,3 @@ paths: Record<string, string>; | ||
reasons: NodeFileTraceReasons; | ||
constructor({ base, processCwd, exports, exportsOnly, paths, ignore, log, mixedModules, ts, analysis, cache, }: NodeFileTraceOptions); | ||
constructor({ base, processCwd, exports, conditions, exportsOnly, paths, ignore, log, mixedModules, ts, analysis, cache, }: NodeFileTraceOptions); | ||
readlink(path: string): string | null; | ||
@@ -32,0 +32,0 @@ isFile(path: string): boolean; |
@@ -50,3 +50,3 @@ "use strict"; | ||
class Job { | ||
constructor({ base = process.cwd(), processCwd, exports = ['node'], exportsOnly = false, paths = {}, ignore, log = false, mixedModules = false, ts = true, analysis = {}, cache, }) { | ||
constructor({ base = process.cwd(), processCwd, exports, conditions = exports || ['node'], exportsOnly = false, paths = {}, ignore, log = false, mixedModules = false, ts = true, analysis = {}, cache, }) { | ||
this.reasons = Object.create(null); | ||
@@ -84,3 +84,3 @@ this.ts = ts; | ||
this.cwd = path_1.resolve(processCwd || base); | ||
this.exports = exports; | ||
this.conditions = conditions; | ||
this.exportsOnly = exportsOnly; | ||
@@ -87,0 +87,0 @@ const resolvedPaths = {}; |
@@ -13,2 +13,5 @@ "use strict"; | ||
} | ||
else if (specifier[0] === '#') { | ||
resolved = packageImportsResolve(specifier, parent, job, cjsResolve); | ||
} | ||
else { | ||
@@ -120,23 +123,33 @@ resolved = resolvePackage(specifier, parent, job, cjsResolve); | ||
} | ||
function resolveExportsTarget(pkgPath, exp, subpath, job, cjsResolve) { | ||
let exports; | ||
if (typeof exp === 'string' || | ||
typeof exp === 'object' && !Array.isArray(exp) && Object.keys(exp).length && Object.keys(exp)[0][0] !== '.') { | ||
exports = { '.': exp }; | ||
function resolveExportsImports(pkgPath, obj, subpath, job, isImports, cjsResolve) { | ||
let matchObj; | ||
if (isImports) { | ||
if (!(typeof obj === 'object' && !Array.isArray(obj) && obj !== null)) | ||
return undefined; | ||
matchObj = obj; | ||
} | ||
else if (typeof obj === 'string' || Array.isArray(obj) || obj === null || | ||
typeof obj === 'object' && Object.keys(obj).length && Object.keys(obj)[0][0] !== '.') { | ||
matchObj = { '.': obj }; | ||
} | ||
else { | ||
exports = exp; | ||
matchObj = obj; | ||
} | ||
if (subpath in exports) { | ||
const target = getExportsTarget(exports[subpath], job.exports, cjsResolve); | ||
if (subpath in matchObj) { | ||
const target = getExportsTarget(matchObj[subpath], job.conditions, cjsResolve); | ||
if (typeof target === 'string' && target.startsWith('./')) | ||
return pkgPath + target.slice(1); | ||
} | ||
for (const match of Object.keys(exports)) { | ||
for (const match of Object.keys(matchObj).sort((a, b) => b.length - a.length)) { | ||
if (match.endsWith('*') && subpath.startsWith(match.slice(0, -1))) { | ||
const target = getExportsTarget(matchObj[match], job.conditions, cjsResolve); | ||
if (typeof target === 'string' && target.startsWith('./')) | ||
return pkgPath + target.slice(1).replace(/\*/g, subpath.slice(match.length - 1)); | ||
} | ||
if (!match.endsWith('/')) | ||
continue; | ||
if (subpath.startsWith(match)) { | ||
const target = getExportsTarget(exports[match], job.exports, cjsResolve); | ||
const target = getExportsTarget(matchObj[match], job.conditions, cjsResolve); | ||
if (typeof target === 'string' && target.endsWith('/') && target.startsWith('./')) | ||
return pkgPath + match.slice(1) + subpath.slice(match.length); | ||
return pkgPath + target.slice(1) + subpath.slice(match.length); | ||
} | ||
@@ -146,2 +159,25 @@ } | ||
} | ||
function packageImportsResolve(name, parent, job, cjsResolve) { | ||
if (name !== '#' && !name.startsWith('#/') && job.conditions) { | ||
const pjsonBoundary = job.getPjsonBoundary(parent); | ||
if (pjsonBoundary) { | ||
const pkgCfg = getPkgCfg(pjsonBoundary, job); | ||
const { imports: pkgImports } = pkgCfg || {}; | ||
if (pkgCfg && pkgImports !== null && pkgImports !== undefined) { | ||
let importsResolved = resolveExportsImports(pjsonBoundary, pkgImports, name, job, true, cjsResolve); | ||
if (importsResolved) { | ||
if (cjsResolve) | ||
importsResolved = resolveFile(importsResolved, parent, job) || resolveDir(importsResolved, parent, job); | ||
else if (!job.isFile(importsResolved)) | ||
throw new NotFoundError(importsResolved, parent); | ||
if (importsResolved) { | ||
job.emitFile(pjsonBoundary + path_1.sep + 'package.json', 'resolve', parent); | ||
return importsResolved; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
throw new NotFoundError(name, parent); | ||
} | ||
function resolvePackage(name, parent, job, cjsResolve) { | ||
@@ -154,3 +190,3 @@ let packageParent = parent; | ||
let selfResolved; | ||
if (job.exports) { | ||
if (job.conditions) { | ||
const pjsonBoundary = job.getPjsonBoundary(parent); | ||
@@ -161,3 +197,3 @@ if (pjsonBoundary) { | ||
if (pkgCfg && pkgCfg.name && pkgExports !== null && pkgExports !== undefined) { | ||
selfResolved = resolveExportsTarget(pjsonBoundary, pkgExports, '.' + name.slice(pkgName.length), job, cjsResolve); | ||
selfResolved = resolveExportsImports(pjsonBoundary, pkgExports, '.' + name.slice(pkgName.length), job, false, cjsResolve); | ||
if (selfResolved) { | ||
@@ -184,7 +220,7 @@ if (cjsResolve) | ||
const { exports: pkgExports } = pkgCfg || {}; | ||
if (job.exports && pkgExports !== undefined && pkgExports !== null && !selfResolved) { | ||
if (job.conditions && pkgExports !== undefined && pkgExports !== null && !selfResolved) { | ||
let legacyResolved; | ||
if (!job.exportsOnly) | ||
legacyResolved = resolveFile(nodeModulesDir + path_1.sep + name, parent, job) || resolveDir(nodeModulesDir + path_1.sep + name, parent, job); | ||
let resolved = resolveExportsTarget(nodeModulesDir + path_1.sep + pkgName, pkgExports, '.' + name.slice(pkgName.length), job, cjsResolve); | ||
let resolved = resolveExportsImports(nodeModulesDir + path_1.sep + pkgName, pkgExports, '.' + name.slice(pkgName.length), job, false, cjsResolve); | ||
if (resolved) { | ||
@@ -191,0 +227,0 @@ if (cjsResolve) |
@@ -34,2 +34,3 @@ /// <reference types="node" /> | ||
exports?: string[]; | ||
conditions?: string[]; | ||
exportsOnly?: boolean; | ||
@@ -36,0 +37,0 @@ ignore?: string | string[] | ((path: string) => boolean); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.wildcardRegEx = exports.WILDCARD = exports.FUNCTION = exports.UNKNOWN = exports.evaluate = void 0; | ||
const url_1 = require("url"); | ||
function evaluate(ast, vars = {}, computeBranches = true) { | ||
@@ -303,8 +304,4 @@ const state = { | ||
'Identifier': function Identifier(node, _walk) { | ||
if (Object.hasOwnProperty.call(this.vars, node.name)) { | ||
const val = this.vars[node.name]; | ||
if (val === exports.UNKNOWN) | ||
return undefined; | ||
return { value: val }; | ||
} | ||
if (Object.hasOwnProperty.call(this.vars, node.name)) | ||
return this.vars[node.name]; | ||
return undefined; | ||
@@ -373,2 +370,64 @@ }, | ||
}, | ||
'MetaProperty': function MetaProperty(node) { | ||
if (node.meta.name === 'import' && node.property.name === 'meta') | ||
return { value: this.vars['import.meta'] }; | ||
return undefined; | ||
}, | ||
'NewExpression': function NewExpression(node, walk) { | ||
// new URL('./local', parent) | ||
const cls = walk(node.callee); | ||
if (cls && 'value' in cls && cls.value === url_1.URL && node.arguments.length) { | ||
const arg = walk(node.arguments[0]); | ||
if (!arg) | ||
return undefined; | ||
let parent = null; | ||
if (node.arguments[1]) { | ||
parent = walk(node.arguments[1]); | ||
if (!parent || !('value' in parent)) | ||
return undefined; | ||
} | ||
if ('value' in arg) { | ||
if (parent) { | ||
try { | ||
return { value: new url_1.URL(arg.value, parent.value) }; | ||
} | ||
catch (_a) { | ||
return undefined; | ||
} | ||
} | ||
try { | ||
return { value: new url_1.URL(arg.value) }; | ||
} | ||
catch (_b) { | ||
return undefined; | ||
} | ||
} | ||
else { | ||
const test = arg.test; | ||
if (parent) { | ||
try { | ||
return { | ||
test, | ||
then: new url_1.URL(arg.then, parent.value), | ||
else: new url_1.URL(arg.else, parent.value) | ||
}; | ||
} | ||
catch (_c) { | ||
return undefined; | ||
} | ||
} | ||
try { | ||
return { | ||
test, | ||
then: new url_1.URL(arg.then), | ||
else: new url_1.URL(arg.else) | ||
}; | ||
} | ||
catch (_d) { | ||
return undefined; | ||
} | ||
} | ||
} | ||
return undefined; | ||
}, | ||
'ObjectExpression': function ObjectExpression(node, walk) { | ||
@@ -448,3 +507,3 @@ const obj = {}; | ||
if (Object.hasOwnProperty.call(this.vars, 'this')) | ||
return { value: this.vars['this'] }; | ||
return this.vars['this']; | ||
return undefined; | ||
@@ -451,0 +510,0 @@ }, |
@@ -5,2 +5,5 @@ "use strict"; | ||
const estree_walker_1 = require("estree-walker"); | ||
function isUndefinedOrVoid(node) { | ||
return node.type === 'Identifier' && node.name === 'undefined' || node.type === 'UnaryExpression' && node.operator === 'void' && node.argument.type === 'Literal' && node.argument.value === 0; | ||
} | ||
// Wrapper detection pretransforms to enable static analysis | ||
@@ -124,5 +127,6 @@ function handleWrappers(ast) { | ||
wrapper.arguments[0].body.body[wrapper.arguments[0].body.body.length - 1].argument.arguments.every((arg) => arg && arg.type === 'Literal' && typeof arg.value === 'number') && | ||
wrapper.arguments[0].body.body[wrapper.arguments[0].body.body.length - 1].argument.callee.callee.type === 'CallExpression' && | ||
wrapper.arguments[0].body.body[wrapper.arguments[0].body.body.length - 1].argument.callee.callee.callee.type === 'FunctionExpression' && | ||
wrapper.arguments[0].body.body[wrapper.arguments[0].body.body.length - 1].argument.callee.callee.arguments.length === 0 && | ||
(wrapper.arguments[0].body.body[wrapper.arguments[0].body.body.length - 1].argument.callee.callee.type === 'FunctionExpression' || | ||
wrapper.arguments[0].body.body[wrapper.arguments[0].body.body.length - 1].argument.callee.callee.type === 'CallExpression' && | ||
wrapper.arguments[0].body.body[wrapper.arguments[0].body.body.length - 1].argument.callee.callee.callee.type === 'FunctionExpression' && | ||
wrapper.arguments[0].body.body[wrapper.arguments[0].body.body.length - 1].argument.callee.callee.arguments.length === 0) && | ||
// (dont go deeper into browserify loader internals than this) | ||
@@ -145,4 +149,5 @@ wrapper.arguments[0].body.body[wrapper.arguments[0].body.body.length - 1].argument.callee.arguments.length === 3 && | ||
m.value.elements[0].type !== 'FunctionExpression' || | ||
m.value.elements[1].type !== 'ObjectExpression') | ||
m.value.elements[1].type !== 'ObjectExpression') { | ||
return false; | ||
} | ||
// detect externals from undefined moduleMap values | ||
@@ -152,9 +157,20 @@ const moduleMap = m.value.elements[1].properties; | ||
if (prop.type !== 'Property' || | ||
(prop.value.type !== 'Identifier' && prop.value.type !== 'Literal') || | ||
prop.key.type !== 'Literal' || | ||
typeof prop.key.value !== 'string' || | ||
prop.computed) | ||
(prop.value.type !== 'Identifier' && prop.value.type !== 'Literal' && !isUndefinedOrVoid(prop.value)) || | ||
!(prop.key.type === 'Literal' && typeof prop.key.value === 'string' || | ||
prop.key.type === 'Identifier') || | ||
prop.computed) { | ||
return false; | ||
if (prop.value.type === 'Identifier' && prop.value.name === 'undefined') | ||
externals[prop.key.value] = prop.key; | ||
} | ||
if (isUndefinedOrVoid(prop.value)) { | ||
if (prop.key.type === 'Identifier') | ||
externals[prop.key.name] = { | ||
type: 'Literal', | ||
start: prop.key.start, | ||
end: prop.key.end, | ||
value: prop.key.name, | ||
raw: JSON.stringify(prop.key.name) | ||
}; | ||
else if (prop.key.type === 'Literal') | ||
externals[prop.key.value] = prop.key; | ||
} | ||
} | ||
@@ -166,3 +182,3 @@ return true; | ||
if (externalIds.length) { | ||
const cache = wrapper.arguments[0].body.body[1].argument.callee.arguments[1]; | ||
const cache = (wrapper.arguments[0].body.body[1] || wrapper.arguments[0].body.body[0]).argument.callee.arguments[1]; | ||
cache.properties = externalIds.map(ext => { | ||
@@ -169,0 +185,0 @@ return { |
{ | ||
"name": "@vercel/nft", | ||
"version": "0.9.6", | ||
"version": "0.10.0", | ||
"repository": "vercel/nft", | ||
@@ -22,8 +22,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"acorn": "^7.4.1", | ||
"acorn-class-fields": "^0.3.2", | ||
"acorn-export-ns-from": "^0.1.0", | ||
"acorn-import-meta": "^1.1.0", | ||
"acorn-numeric-separator": "^0.3.0", | ||
"acorn-static-class-features": "^0.2.1", | ||
"acorn": "^8.1.0", | ||
"acorn-class-fields": "^1.0.0", | ||
"acorn-static-class-features": "^1.0.0", | ||
"bindings": "^1.4.0", | ||
@@ -51,3 +48,3 @@ "estree-walker": "^0.6.1", | ||
"@types/micromatch": "^4.0.1", | ||
"@types/node": "^14.0.14", | ||
"@types/node": "^14.14.37", | ||
"analytics-node": "^3.4.0-beta.1", | ||
@@ -61,3 +58,3 @@ "apollo-server-express": "^2.14.2", | ||
"bull": "^3.10.0", | ||
"canvas": "^2.5.0", | ||
"canvas": "^2.7.0", | ||
"chromeless": "^1.5.2", | ||
@@ -73,7 +70,7 @@ "codecov": "^3.7.1", | ||
"fetch-h2": "^2.2.0", | ||
"firebase": "^6.2.4", | ||
"firebase": "^7", | ||
"firebase-admin": "^8.2.0", | ||
"fluent-ffmpeg": "^2.1.2", | ||
"graphql": "^14.4.2", | ||
"grpc": "^1.21.1", | ||
"grpc": "^1.24.6", | ||
"highlights": "^3.1.4", | ||
@@ -83,3 +80,3 @@ "hot-shots": "^6.3.0", | ||
"isomorphic-unfetch": "^3.0.0", | ||
"jest": "^24.5.0", | ||
"jest": "^26.6.3", | ||
"jimp": "^0.6.4", | ||
@@ -116,3 +113,3 @@ "jugglingdb": "^2.0.1", | ||
"sequelize": "^5.9.3", | ||
"sharp": "^0.22.1", | ||
"sharp": "^0.27.2", | ||
"socket.io": "^2.4.0", | ||
@@ -119,0 +116,0 @@ "socket.io-client": "^2.2.0", |
@@ -60,11 +60,11 @@ # Node File Trace | ||
#### Exports | ||
#### Exports & Imports | ||
By default tracing of the [Node.js "exports" field](https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_package_entry_points) is supported, with the `"node"`, `"require"`, `"import"` and `"default"` conditions traced as defined. | ||
By default tracing of the [Node.js "exports" and "imports" fields](https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_package_entry_points) is supported, with the `"node"`, `"require"`, `"import"` and `"default"` conditions traced as defined. | ||
Alternatively the explicit list of exports can be provided: | ||
Alternatively the explicit list of conditions can be provided: | ||
```js | ||
const { fileList } = await nodeFileTrace(files, { | ||
exports: ['node', 'production'] | ||
conditions: ['node', 'production'] | ||
}); | ||
@@ -71,0 +71,0 @@ ``` |
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
151652
13
3049
+ Addedacorn@8.14.0(transitive)
+ Addedacorn-class-fields@1.0.0(transitive)
+ Addedacorn-private-class-elements@1.0.0(transitive)
+ Addedacorn-static-class-features@1.0.0(transitive)
- Removedacorn-export-ns-from@^0.1.0
- Removedacorn-import-meta@^1.1.0
- Removedacorn-numeric-separator@^0.3.0
- Removedacorn@6.4.27.4.1(transitive)
- Removedacorn-class-fields@0.3.7(transitive)
- Removedacorn-export-ns-from@0.1.0(transitive)
- Removedacorn-import-meta@1.1.0(transitive)
- Removedacorn-numeric-separator@0.3.6(transitive)
- Removedacorn-private-class-elements@0.2.7(transitive)
- Removedacorn-static-class-features@0.2.4(transitive)
Updatedacorn@^8.1.0
Updatedacorn-class-fields@^1.0.0