🚧 This package is in very early development and does not cater for most use cases. 🚧
Fray is a JavaScript module bundler designed to streamline the process of managing and bundling JavaScript files and their dependencies. It leverages Jest Haste Map for efficient file management and dependency resolution, and uses Babel for code transformation. This document outlines the current features of Fray and provides a roadmap for future enhancements.
@babel/plugin-transform-modules-commonjs
plugin to convert ES6 modules to CommonJS.require
function to load and execute bundled modules.Clone the repository and install the dependencies:
git clone https://github.com/your-username/fray.git
cd fray
npm install
To bundle your project, run:
node index --entrypoint path/to/your/entry/file.js --output path/to/output/bundle.js
index.ts
: Main script that handles module resolution, transformation, and bundling.worker.ts
: Worker script that handles code transformation using Babel.require.js
: Custom module loader template used in the output bundle.Assuming your project structure is as follows:
project/
├── src/
│ ├── index.js
│ ├── moduleA.js
│ └── moduleB.js
├── bundler.js
└── require.js
Run the bundler:
node bundler.js --entrypoint ./src/index.js --output ./dist/bundle.js
-minify
Flag:
terser
to minify each individual file in the bundle..map
file for the bundle to improve debugging.-dev
Option (Medium):
watch
function to listen for file changes and automatically re-bundle the project.We welcome contributions to Fray! Please follow the contributing guidelines to get started.
Fray is licensed under the MIT License.