0.0.46 • Published 1 year ago

@espruino-tools/transpiler v0.0.46

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

@espruino-tools/transpiler

A micro-compiler utilising esprima and escodegen to convert espruino tools syntax into espruino native code. This package was built for usage in the @espruino-tools/core package and the online espruino tools IDE.

Installing the package

CDN

To use the package in a standard HTML file simply import the script with the following tags

<script src="https://unpkg.com/@espruino-tools/transpiler@latest/min/main.min.js"></script>

NPM

To use the package in a node project simply run the npm command:

npm i @espruino-tools/transpiler

Using the package

using the package is simple:

import { transpile } from '@espruino-tools/transpiler';

let code = `import { Puck } from '@espruino-tools/core
let p = new Puck();

p.LED.on('red')
`;

console.log(transpile(code));
> LED2.set();

or through the script tags like so:

<script src="https://unpkg.com/@espruino-tools/transpiler@latest/min/main.min.js"></script>

<script>

  let code = `import { Puck } from '@espruino-tools/core
  let p = new Puck();

  p.LED.on('red')
  `

  console.log(ESPT_Transpiler.transpile(code)))
</script>
0.0.46

1 year ago

0.0.30

1 year ago

0.0.26

1 year ago

0.0.25

1 year ago

0.0.22

1 year ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago