Files
pnpm/modules-mounter/daemon/src/cli.ts
Zoltan Kochan 5d5818e44f style: enforce node: protocol for builtin imports (#10951)
Add n/prefer-node-protocol rule and autofix all bare builtin imports
to use the node: prefix. Simplify the simple-import-sort builtins
pattern to just ^node: since all imports now use the prefix.
2026-03-13 07:59:51 +01:00

36 lines
1.1 KiB
TypeScript

import { promises as fs } from 'node:fs'
import path from 'node:path'
import { getConfig } from '@pnpm/config'
import { getStorePath } from '@pnpm/store-path'
import Fuse from 'fuse-native'
import { createFuseHandlers } from './createFuseHandlers.js'
(async () => {
const mnt = path.join(process.cwd(), 'node_modules')
await fs.mkdir(mnt, { recursive: true })
const { config } = await getConfig({
cliOptions: {},
packageManager: { name: '', version: '' },
})
const storeDir = await getStorePath({
pkgRoot: process.cwd(),
storePath: config.storeDir,
pnpmHomeDir: config.pnpmHomeDir,
})
const fuse = new Fuse(mnt, await createFuseHandlers(process.cwd(), storeDir), { debug: true })
fuse.mount(function (err?: Error) {
if (err != null) console.error(err)
})
process.once('SIGINT', function () {
fuse.unmount((err?: Error) => {
if (err != null) {
console.log(`filesystem at ${fuse.mnt as string} not unmounted`, err)
} else {
console.log(`filesystem at ${fuse.mnt as string} unmounted`)
}
})
})
})()