Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (typeof targetDist === 'string' || pkgTargets[targetName]) {
let distDir;
let distEntry;
let loc;
invariant(typeof pkgFilePath === 'string');
invariant(pkgMap != null);
let _descriptor: mixed = pkgTargets[targetName] || {};
if (typeof targetDist === 'string') {
distDir = path.resolve(pkgDir, path.dirname(targetDist));
distEntry = path.basename(targetDist);
loc = {
filePath: pkgFilePath,
...getJSONSourceLocation(pkgMap.pointers[pointer], 'value'),
};
} else {
distDir = path.resolve(pkgDir, DEFAULT_DIST_DIRNAME, targetName);
}
let descriptor = parseDescriptor(
targetName,
_descriptor,
pkgFilePath,
pkgContents,
);
let isLibrary =
typeof distEntry === 'string'
? path.extname(distEntry) === '.js'
: false;
targets.set(targetName, {
type: 'value',
message: 'Expected type string',
},
]),
},
},
});
}
distDir = path.resolve(pkgDir, path.dirname(distPath));
distEntry = path.basename(distPath);
invariant(typeof pkgFilePath === 'string');
invariant(pkgMap != null);
loc = {
filePath: pkgFilePath,
...getJSONSourceLocation(pkgMap.pointers[`/${targetName}`], 'value'),
};
}
if (_descriptor) {
let descriptor = parseDescriptor(
targetName,
_descriptor,
pkgFilePath,
pkgContents,
);
targets.set(targetName, {
name: targetName,
distDir,
distEntry,
publicUrl: descriptor.publicUrl ?? '/',
env: createEnvironment({