1.2.8 • Published 6 years ago

esdown v1.2.8

Weekly downloads
286
License
-
Repository
-
Last release
6 years ago

Overview

esdown is an ES6+ to ES5 compiler, written in ES6. It will allow you to write programs using next-generation Javascript features without having to wait for Node or browsers to fully implement them.

esdown can also be used as a runtime environment for executing ES6+ programs on top of Node.

You can demo esdown by using the browser REPL.

For more information:

  • The Feature Guide describes the ES6+ features that you can use with esdown.
  • The Module Guide describes the ES6 module system implemented in esdown.
  • Limitations describes some limitations and caveats regarding code produced by esdown.

Instructions

Install globally with NPM (you may need to sudo this):

npm install -g esdown

Start a REPL by running it without any arguments:

esdown

Execute a module by adding a path:

esdown main.js

Translate a module by using a hyphen:

esdown - src/main.js build/esdown.js -b -r

--input, -i  (1)    The file to translate.
--output, -o (2)    The file to write to. If not set, then the output
                    will be written to the console.
--bundle, -b        If present, module dependencies will be bundled
                    together in the output.
--global, -g        If specified, the name of the global variable to
                    dump this module's exports into, if the resulting
                    script is not executed within any module system.

API

esdown can also be used as a library. First, install locally with NPM:

npm install esdown

translate(input, options = {})

Translates ES6+ code to ES5. The following options are defined:

  • module: (Boolean) If true, parse the input as a module. Otherwise, parse the input as a script. The default is false.
  • global: (String) If specified, the name of the global variable which will be used to expose the module if it is loaded as a plain script in the browser.

Example:

var esdown = require("esdown");

var output = esdown.translate("class C { foo() {} }", {
    module: true
});
1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.1.21

7 years ago

1.1.20

7 years ago

1.1.19

7 years ago

1.1.18

7 years ago

1.1.17

7 years ago

1.1.16

8 years ago

1.1.15

8 years ago

1.1.14

8 years ago

1.1.13

8 years ago

1.1.12

8 years ago

1.1.11

8 years ago

1.1.10

8 years ago

1.1.9

8 years ago

1.1.8

8 years ago

1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.1

9 years ago

0.9.16

9 years ago

0.9.15

9 years ago

0.9.14

9 years ago

0.9.13

9 years ago

0.9.12

9 years ago

0.9.11

9 years ago

0.9.10

9 years ago

0.9.9

9 years ago

0.9.8

9 years ago

0.9.7

9 years ago

0.9.6

9 years ago

0.9.5

9 years ago

0.9.4

9 years ago

0.9.3

10 years ago

0.9.2

10 years ago

0.9.1

10 years ago