0.7.2 • Published 5 years ago

archaize-js v0.7.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

logo

About

**This is Archaize JS:**

* ...a ES6 to ES5 transpiler (main part)
    * Feature list include the core of ES6
    *  Theory.  How a  transpiler  works  and why  they  are
important
* ...a NPM package
* ...a CLI to transpile JavaScript files
* ...a Minimalistic Web Solution 
    * Front-end (React)
    * Back-end (Node.js, Express & Socket.io)

*Archaize JS  is a transpiler  and is my web  developer exam
project (2019).*

Installation

npm install

npm test

Usage

CLI

Saves Abstract Syntax Tree (AST) to file:

./archaize.js -i someCode.js -o code-analysis --ast

Prints AST to standard output:

./archaize.js -i someCode.js --ast

Transpiles inputted JavaScript code (file) to another file:

./archaize -i someES6Code.js -o someES5Code.js --transpile

NPM package

const { transpile } = require('archaize-js/index.js');

// to avoid issues, it's recommended to firstly develop
// a read file function that returns the source code.

const transpiledCode = transpile(someExpression);
console.log(transpiledCode);

Web

cd web && npm install && npm run start 

visit localhost:3000

Folder structure

  • /assets (images)
  • /examples (transpiled code snippets - before/after)
  • /src >>> /helpers, /utils, /transpiler <<<
  • /tests (Jest - main functionality)
  • /text (essay on transpilers)

Features

  • template literals
  • variable declarations
  • arrow functions
  • string method: repeat
  • string method: includes
  • string method: startsWith
  • string method: endsWith
  • array method: findIndex
  • array method: find
  • array method: includes
  • implement polyfills in AST
  • operator: rest
  • operator: spread (array)
  • strict/type equality (===)
  • default parameter
  • property shorthand

Issues

1) Check npm test

2) Check 'issues'