# cokescript

> CokeScript is a whitespace sensitive language that compile to JavaScript

Latest version **0.0.10** (published 2022-09-01) · BSD license · 0 weekly downloads

## Install

```sh
npm install cokescript
pnpm add cokescript
yarn add cokescript
bun add cokescript
```

Provides the command `coke`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2022-09-01 |
| First published | 2015-01-21 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 785.3 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 43 |
| Author | Batiste Bieler |
| Maintainers | batiste |
| Keywords | language, javascript, compiler |

## Links

- npm: https://www.npmjs.com/package/cokescript
- Repository: https://github.com/batiste/CokeScript
- Homepage: https://github.com/batiste/CokeScript#readme
- Issues: https://github.com/batiste/CokeScript/issues
- npm.io page: https://npm.io/package/cokescript

## Dependencies (5)

- [gulp](https://npm.io/package/gulp.md) ^3.9.1
- [colors](https://npm.io/package/colors.md) ^1.0.3
- [epegjs](https://npm.io/package/epegjs.md) ^0.0.55
- [minimist](https://npm.io/package/minimist.md) ~1.1.0
- [virtual-dom](https://npm.io/package/virtual-dom.md) ^1.3.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.10 (latest) — 2022-09-01
- 0.0.9 — 2018-07-05
- 0.0.8 — 2018-03-03
- 0.0.7 — 2018-02-12
- 0.0.6 — 2015-02-27
- 0.0.5 — 2015-02-07
- 0.0.4 — 2015-01-30
- 0.0.3 — 2015-01-26
- 0.0.2 — 2015-01-21
- 0.0.1 — 2015-01-21

## README

# CokeScript

CokeScript is a whitespace sensitive language inspired by Python and Ruby that compile to JavaScript. This project is still at an early stage. The CokeScript compiler is written in CokeScript. 

How does it compare against CoffeeScript:

  - Scoping is not broken (https://donatstudios.com/CoffeeScript-Madness)
  - Multiline string don't necessitate backslashes
  - Virtual Dom support within the language
  - The source code of the language is rather simple and short
  - [Language specification](/doc/spec.md)
  - [Interactive demo](http://batiste.github.io/CokeScript)

![Style matters](https://raw.githubusercontent.com/batiste/CokeScript/master/css/eg-coke.png)

## Examples

 - Consuming a REST API, build with webpack https://github.com/batiste/cokescript-pets
 - Simple frontend consuming a CRUD REST API https://github.com/batiste/cokescript-frontend

## Atom support

 - Syntax highlighting for Atom https://atom.io/packages/language-cokescript 
 - A linter for Atom https://atom.io/packages/linter-cokescript

## API

### Import CokeScript

    <script src='dist/cokescript.js'></script>

or

    var cokescript = require('cokescript');

## Usage

### cokescript.generateModule(input)

Return object of form

    {
      ast:  Abstract syntax trees,
      code: JavaScript code,
      ns:   Namespace of the module
    }

### cokescript.generateExports(keys)

Return a commonJs module export statement with the keys provided. If none are provided
the module level keys of the last compiled module will be used.

## Command line tool

    $ lib/coke.js
    Usage of the coke command
    
      coke <filename> <filename N> <options>
    
    Options
      -m or --commonjs  generate a commonJs module
      -o or --output    write the output to a single file
      -e or --execute   execute the generated javascript
      -g or --glob      select all files matched by a glob expression
      -c or --convert   convert each input file to JavaScript
      
### Grammar parser

CokeScript use EPEG.js https://github.com/batiste/EPEG.js/

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