Skip to content

Repository files navigation

combine-source

npm package Build Status Downloads Issues Code Coverage Commitizen Friendly

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 { CombineFile, combineSource } from 'combine-source';

const files: CombineFile[] = [
  {
    code: 'console.log("File 1");',
    map: {
      /* source map object for file 1 */
    },
  },
  {
    code: 'console.log("File 2");',
    map: {
      /* source map object for file 2 */
    },
  },
];

const result = combineSource(files);

console.log(result.code); // Combined code
console.log(result.map); // Combined source 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.

About

`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.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages