packitup
v0.4.0
Published
A JavaScript packager with a complete module system. Currently supports CommonJS modules and can export to ES modules.
Maintainers
Readme
PackItUp 📦
(这个文档用AI写的 说实话这个文档我自己都看不懂 我也不确定用的对不对 所以不会用最好还是直接找我)
"Pack it up!" - A simple and straightforward JavaScript packager
✨ Features
- 🔄 Self-contained - Can pack itself, truly zero-dependency
- 🚀 Single file output - All code bundled into one file (or two files, a umd export, a esm export)
- ⚙️ Virtual module system - Built-in core module simulation
- 📁 Zero configuration - Works out of the box
🚀 Quick Start
install
npm install packitup
cd node_modules/packitup
node install
cd ../..packitup build ./src ./dist📖 Usage
# Basic usage
packitup build <input-directory> [output-directory]
# With options
packitup build ./src ./dist --name my-app --umd bundle.js
# Show help
packitup --help⚙️ Options
· --name - Specify project name (If not specified, it will be automatically specified according to the file) · --umd - UMD output filename (default: [project name].js) · --esm - ESM output filename (default: [project name].esm.js) · --help - Show help message
🔧 API Usage
const { buildDirectory } = require('packitup');
const result = buildDirectory('./src', {
projectName: 'my-app',
extensions: ['.js', '.json']
});
console.log(result.umd); // UMD bundle size
console.log(result.esm); // ESM bundle sizeor esm import
impory { buildDirectory } from 'packitup';
const result = buildDirectory('./src', {
projectName: 'my-app',
extensions: ['.js', '.json']
});
console.log(result.umd); // UMD bundle size
console.log(result.esm); // ESM bundle sizeor from global import
const { buildDirectory } = PackItUp;
const result = buildDirectory('./src', {
projectName: 'my-app',
extensions: ['.js', '.json']
});
console.log(result.umd); // UMD bundle size
console.log(result.esm); // ESM bundle size🤔 FAQ
Q: Why is there no packitup command?
A: PackItUp is designed to work without global installation. Use npx packitup or install locally in your project.
Q: Which module systems are supported?
A: Currently supports CommonJS, and can export to both UMD and ESM formats.
📄 License
ISC License - See LICENSE file
