Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wasm-fmt/dart_fmt
Dart Formatter powered by WASM ported from dart_style
https://github.com/wasm-fmt/dart_fmt
Last synced: 3 days ago
JSON representation
Dart Formatter powered by WASM ported from dart_style
- Host: GitHub
- URL: https://github.com/wasm-fmt/dart_fmt
- Owner: wasm-fmt
- License: mit
- Created: 2023-11-03T16:55:17.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-10T13:17:35.000Z (4 days ago)
- Last Synced: 2024-11-10T14:22:31.318Z (4 days ago)
- Language: Dart
- Homepage:
- Size: 52.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Test](https://github.com/wasm-fmt/dart_fmt/actions/workflows/test.yml/badge.svg)](https://github.com/wasm-fmt/dart_fmt/actions/workflows/test.yml)
# Install
[![npm](https://img.shields.io/npm/v/@wasm-fmt/dart_fmt?color=00B4AB)](https://www.npmjs.com/package/@wasm-fmt/dart_fmt)
```bash
npm install @wasm-fmt/dart_fmt
```[![jsr.io](https://jsr.io/badges/@fmt/dart-fmt?color=00B4AB)](https://jsr.io/@fmt/dart-fmt)
```bash
npx jsr add @fmt/dart-fmt
```# Usage
```javascript
import init, { format } from "@wasm-fmt/dart_fmt";await init();
const input = `void main() { print('Hello, World!'); }`;
const formatted = format(input, "main.dart");
console.log(formatted);
```For Vite users:
Add `"@wasm-fmt/dart_fmt"` to `optimizeDeps.exclude` in your vite config:
```JSON
{
"optimizeDeps": {
"exclude": ["@wasm-fmt/dart_fmt"]
}
}
```If you cannot change the vite config, you can use another import entry
```JavaScript
import init, { format } from "@wasm-fmt/dart_fmt/vite";// ...
```