# esbuild-plugin-dsv

> Import .tsv and .csv files as ES6 modules using esbuild

Latest version **0.0.4** (published 2024-02-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install esbuild-plugin-dsv
pnpm add esbuild-plugin-dsv
yarn add esbuild-plugin-dsv
bun add esbuild-plugin-dsv
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2024-02-20 |
| First published | 2021-02-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Marton Lederer |
| Maintainers | martondev |

## Links

- npm: https://www.npmjs.com/package/esbuild-plugin-dsv
- Repository: https://github.com/martonlederer/esbuild-plugin-dsv
- npm.io page: https://npm.io/package/esbuild-plugin-dsv

## Dependencies (3)

- [d3-dsv](https://npm.io/package/d3-dsv.md) ^2.0.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.1.0
- [tosource](https://npm.io/package/tosource.md) ^2.0.0-alpha.2

## Recent versions

- 0.0.4 (latest) — 2024-02-20
- 0.0.3 — 2024-02-20
- 0.0.2 — 2021-02-21
- 0.0.1 — 2021-02-21

## README

# esbuild-plugin-dsv

Use .tsv and .csv files as ES6 modules.

## Install

```sh
yarn add -D esbuild-plugin-dsv
```

or

```sh
npm i -D esbuild-plugin-dsv
```

## Usage

Add to your esbuild plugins list:

```js
const esbuild = require("esbuild");
const { dsvPlugin } = require("esbuild-plugin-dsv");

esbuild.build({
  ...
  plugins: [
    dsvPlugin()
  ]
  ...
});
```

## Options

You can customize how `esbuild-plugin-dsv` parses `.tsv` and `.csv` files the following way:

```js
dsvPlugin({
  // options
});
```

### `transform`

With this function, you can mutate the parsed/resolved `.tsv` and `.csv` files:

```js
  transform(data, extension) {
    // transform the file
    // the data holds a "DSVRowArray" type data
    // parsed from the imported file
    // read more about it here:
    // https://github.com/d3/d3-dsv#csvParse
    // https://github.com/d3/d3-dsv#tsvParse
    // the extension can be "TSV" or "CSV"
    return data;
  }
```

---
_Source: https://npm.io/package/esbuild-plugin-dsv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
