0.1.7 • Published 6 years ago

cjstoes v0.1.7

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

CommonJS to ES6 module

Change the purescript output file to ES6 modules, then we can benefit from ES6 tree shaking.

Example

Control.Alt/index.js:

// Generated by purs version 0.11.7
"use strict";
var Data_Functor = require("../Data.Functor");
var Data_Semigroup = require("../Data.Semigroup");
var Alt = function (Functor0, alt) {
    this.Functor0 = Functor0;
    this.alt = alt;
};
var altArray = new Alt(function () {
    return Data_Functor.functorArray;
}, Data_Semigroup.append(Data_Semigroup.semigroupArray));
var alt = function (dict) {
    return dict.alt;
};
module.exports = {
    Alt: Alt,
    alt: alt,
    altArray: altArray
};

Out goes ES6 js:

'use strict';
import { Data_Functor_functorArray } from '../Data.Functor';
import {
    Data_Semigroup_append,
    Data_Semigroup_semigroupArray
} from '../Data.Semigroup';
var Alt = function (Functor0, alt) {
    this.Functor0 = Functor0;
    this.alt = alt;
};
var altArray = new Alt(function () {
    return Data_Functor_functorArray;
}, Data_Semigroup_append(Data_Semigroup_semigroupArray));
var alt = function (dict) {
    return dict.alt;
};
export var Control_Alt_Alt = Alt;
export var Control_Alt_alt = alt;
export var Control_Alt_altArray = altArray;

Install

yarn add cjstoes --dev

Usage

const cjstoes = require('cjstoes')
const fse = require('fs-extra')
const glob = require('glob')
const { readFileSync, writeFileSync } = require('fs')

fse.copySync(`${process.cwd()}/output`, `${process.cwd()}/outputES6`)
glob.sync(`${process.cwd()}/outputES6/**/*.js`).forEach(file => {
  let f = readFileSync(file, 'utf8')
  let nf = cjstoes(f, file)
  writeFileSync(file, nf)
})
0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago