File Explorer

/proc/self/root/proc/1/task/1/cwd/node24/lib/node_modules/npm/node_modules/libnpmdiff/lib

This explorer reads the filesystem of the server it runs on, so /workspace/user isn't present here. Browsing and the terminal still work against this server's own disk from /.

tarball.js1.1 KB · 39 lines
const { relative } = require('node:path') const Arborist = require('@npmcli/arborist')const npa = require('npm-package-arg')const pkgContents = require('@npmcli/installed-package-contents')const pacote = require('pacote')const { tarCreateOptions } = pacote.DirFetcherconst tar = require('tar') // returns a simplified tarball when reading files from node_modules folder,// thus avoiding running the prepare scripts and the extra logic from packlistconst nodeModulesTarball = (manifest) =>  pkgContents({ path: manifest._resolved, depth: 1 })    .then(files =>      files.map(file => relative(manifest._resolved, file))    )    .then(files =>      tar.c(tarCreateOptions(manifest), files).concat()    ) const tarball = (manifest, opts) => {  const resolved = manifest._resolved  const where = opts.where || process.cwd()   const fromNodeModules = npa(resolved).type === 'directory'    && /node_modules[\\/](@[^\\/]+\/)?[^\\/]+[\\/]?$/.test(relative(where, resolved))   if (fromNodeModules) {    return nodeModulesTarball(manifest, opts)  }   return pacote.tarball(manifest._resolved, {    ...opts,    Arborist,  })} module.exports = tarball