dprint-node

A node API for the dprint TypeScript and JavaScript code formatter

MIT 9 个版本
安装
npm install dprint-node
yarn add dprint-node
pnpm add dprint-node
bun add dprint-node
README

dprint-node

A node API for the dprint TypeScript and JavaScript code formatter. It's written in Rust for blazing fast speed.

Usage

Pass a file path and the code to format to dprint.format.

const dprint = require('dprint-node');

dprint.format(filePath, code);

You can also optionally pass some configuration options as an object to the third parameter. All of the options listed here are supported.

dprint.format(filePath, code, {
  lineWidth: 100
});

Benchmark

$ node bench.js
#1 dprint: 12,173 opts/sec, ±17% (mean: 0.082ms, stddev: 0.051ms, 50 samples)
#2 prettier: 450 opts/sec, ±53% (mean: 2.222ms, stddev: 4.229ms, 50 samples)
版本列表
1.0.8 2023-09-15
1.0.7 2022-08-25
1.0.6 2022-08-15
1.0.5 2021-12-23
1.0.4 2021-12-22
1.0.3 2021-12-20
1.0.2 2021-06-02
1.0.1 2021-06-02
1.0.0 2021-06-02