INNER CODE UNIT · TypeScript

remapPath

nodejs/corepack · mkshims.ts:62

  const remapPath = (p: string) => path.resolve(import.meta.dirname, path.relative(virtualNodewinDir, p));

  const easyStatFs = Object.assign(Object.create(fs), {
    readFile: (p: string, encoding: BufferEncoding, cb: (err: any, str: string) => void) => fs.readFile(remapPath(p), encoding, cb),
    stat: (p: string, cb: () => void) => fs.stat(remapPath(p), cb),
  });

  for (const entry of fs.readdirSync(distDir, {withFileTypes: true})) {
    if (entry.isDirectory())
      continue;

    await cmdShim(path.join(virtualNodewinDir, `dist/${entry.name}`), path.join(physicalNodewinDir, path.basename(entry.name, `.js`)), {createCmdFile: true, fs: easyStatFs});
  }

  console.log(`All shims have been generated.`);
}

main().catch(err => {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…