combine-source

Overview
combine-source is a TypeScript library designed to combine multiple source files and their corresponding source maps into a single file and source map. This is particularly useful for bundling JavaScript/TypeScript projects where maintaining accurate source maps is crucial for debugging.
Features
- Combine multiple source files into one.
- Merge source maps to maintain accurate mappings.
- Supports both CommonJS and ES Module formats.
Installation
To install the dependencies, use yarn:
yarn install combine-source
Or use npm:
npm install combine-source
Usage
Here's an example of how to use the combineSource function:
import { combineSource, CombineFile } from 'combine-source';
const files: CombineFile[] = [
{
code: 'console.log("File 1");',
map: { },
path: 'file1.js',
},
{
code: 'console.log("File 2");',
map: { },
path: 'file2.js',
},
];
const result = combineSource(files);
console.log(result.code);
console.log(result.map);
Scripts
test: Run tests using Vitest.
build: Build the project using tsup.
prepublishOnly: Build the project before publishing.
License
This project is licensed under the MIT License.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Contact
For any questions or issues, please open an issue on this repository.