Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const baseFs = new ZipOpenFS({
baseFs: nodeFs,
maxOpenFiles: 80,
readOnlyArchives: true,
});
const defaultFsLayer: FakeFS = new VirtualFS({baseFs});
const rootPath = this.opts.project.cwd;
let prevLocatorMap: NodeModulesLocatorMap;
try {
prevLocatorMap = await readLocatorState(ppath.join(rootPath, NODE_MODULES, LOCATOR_STATE_FILE));
} catch (e) {
prevLocatorMap = new Map();
}
const pnp = makeRuntimeApi(pnpSettings, rootPath, defaultFsLayer);
const nmTree = buildNodeModulesTree(pnp, {
optimizeSizeOnDisk: true,
knownLocatorWeights: new Map(Array.from(prevLocatorMap).map(([key, val]) => [key, val.size])),
pnpifyFs: false,
});
const locatorMap = buildLocatorMap(rootPath, nmTree);
await persistNodeModules(rootPath, prevLocatorMap, locatorMap, baseFs, this.opts.report);
}