Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
$ npm install --save-dev esbuild-coffeescript
```

## Compatibility

This plugin is tested against Node.js versions 20.x, 22.x, and 24.x.

## Getting Started

`main.coffee`
Expand All @@ -22,19 +26,20 @@ console.log("the answer is #{answer}")
`build.js`

```js
const coffeeScriptPlugin = require('esbuild-coffeescript');
import coffeeScriptPlugin from 'esbuild-coffeescript';
import esbuild from 'esbuild';

require('esbuild').build({
esbuild.build({
entryPoints: ['main.coffee'],
bundle: true,
outfile: 'out.js',
plugins: [coffeeScriptPlugin()],
});
}).catch(() => process.exit(1));
```

## Configuration

An object containing configuration options may be passed into the plugin constructor `coffeeScriptPlugin`
An object containing configuration options may be passed into the plugin constructor `coffeeScriptPlugin`.

```js
coffeeScriptPlugin({
Expand All @@ -44,12 +49,13 @@ coffeeScriptPlugin({

The following options are available:

- `options.inlineMap`, `boolean`: if true, output the source map as a base64-encoded string in a comment at the bottom.
- `options.filename`, `string`: the filename to use for the source map. It can include a path (relative or absolute).
- `options.bare`, `boolean`: if true, output without the top-level function safety wrapper.
- `options.header`, `boolean`: if true, output the Generated by CoffeeScript header.
- `options.transpile`, `object`: if set, this must be an object with the options to pass to Babel. See [Transpilation](https://coffeescript.org/#transpilation).
- `options.ast`, `boolean`: if true, return an abstract syntax tree of the input CoffeeScript source code.
* `options.inlineMap`, `boolean`: if true, output the source map as a base64-encoded string in a comment at the bottom.
* `options.filename`, `string`: the filename to use for the source map. It can include a path (relative or absolute).
* `options.bare`, `boolean`: if true, output without the top-level function safety wrapper.
* `options.header`, `boolean`: if true, output the Generated by CoffeeScript header.
* `options.transpile`, `object`: if set, this must be an object with the options to pass to Babel. See [Transpilation](https://coffeescript.org/#transpilation).
* `options.ast`, `boolean`: if true, return an abstract syntax tree of the input CoffeeScript source code.
* `options.literate`, `boolean`: if true, parses the code as Literate CoffeeScript. This allows you to write CoffeeScript embedded in Markdown, where indented blocks are treated as executable code.

### But CoffeeScript is dead?

Expand Down