0.0.4 • Published 3 months ago

esbuild-plugin-dsv v0.0.4

Weekly downloads
73
License
MIT
Repository
github
Last release
3 months ago

esbuild-plugin-dsv

Use .tsv and .csv files as ES6 modules.

Install

yarn add -D esbuild-plugin-dsv

or

npm i -D esbuild-plugin-dsv

Usage

Add to your esbuild plugins list:

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:

dsvPlugin({
  // options
});

transform

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

  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;
  }
0.0.3

3 months ago

0.0.4

3 months ago

0.0.2

3 years ago

0.0.1

3 years ago