oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.12k stars 2.76k forks source link

Expose `bun pm pack` to JavaScript #14155

Open dszymon opened 1 month ago

dszymon commented 1 month ago

What is the problem this feature would solve?

Preparing npm tarball without spawning a new process or using libnpmpack

What is the feature you are proposing to solve the problem?

Expose bun pm pack to the userland code

import { pack } from 'bun:pm';
const { pack } = require('bun:pm');
Bun.PackageManager.pack(path: string): Promise<Uint8Array>

What alternatives have you considered?

spawning a new process or libnpmpack

kravetsone commented 1 month ago

bun:pm is interesting idea it can helps for example with bumps/publishing and access to package.json file