Skip to content

Commit

Permalink
Merge pull request #276 from fluture-js/avaq/mjs
Browse files Browse the repository at this point in the history
Migrate to mjs
  • Loading branch information
Avaq authored Aug 29, 2018
2 parents 489afd2 + 0aa28b3 commit 7130b91
Show file tree
Hide file tree
Showing 96 changed files with 222 additions and 107 deletions.
2 changes: 1 addition & 1 deletion index.cjs.js → index.cjs.mjs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import * as Fluture from './index.mjs.js';
import * as Fluture from './index.mjs';
export default Object.assign(Fluture.Future, Fluture);
File renamed without changes.
21 changes: 9 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,27 @@
"name": "fluture",
"version": "9.0.2",
"description": "FantasyLand compliant (monadic) alternative to Promises",
"main": "index.js",
"main": "index",
"types": "index.d.ts",
"module": "index.mjs.js",
"esm": {
"mode": "all",
"cjs": true
},
"module": "index.mjs",
"files": [
"src",
"index.es.js",
"index.js",
"index.mjs",
"index.d.ts"
],
"repository": "https://github.com/fluture-js/Fluture.git",
"scripts": {
"bench": "npm run build && sanctuary-benchmark",
"build": "rollup -c",
"clean": "rimraf npm-debug.log coverage index.js index.test.js .esm-cache .nyc_output node_modules/.cache",
"lint": "eslint src test index.*.js README.md",
"clean": "rimraf npm-debug.log coverage index.js .esm-cache .nyc_output node_modules/.cache",
"lint": "eslint --ext mjs src test index.mjs index.cjs.mjs README.md",
"lint:readme": "remark --no-stdout --frail -u remark-validate-links README.md",
"release": "npm outdated --long; xyz --edit --repo git@github.com:fluture-js/Fluture.git --tag 'X.Y.Z' --script scripts/distribute --increment",
"test": "npm run lint && npm run lint:readme && npm run test:unit && npm run test:types && npm run test:build",
"test:unit": "npm run clean && mocha --require esm --ui bdd --reporter list --full-trace --check-leaks --bail test/**.test.js",
"test:build": "npm run clean && npm run build && es-check es5 index.js && mocha --require esm --ui bdd --reporter dot --bail test/**.buildtest.js",
"test:coverage": "npm run clean && nyc --include src mocha --require esm --ui bdd --reporter dot test/**.test.js || true",
"test:unit": "npm run clean && mocha --require esm --ui bdd --reporter list --full-trace --check-leaks --bail test.js",
"test:build": "npm run clean && npm run build && es-check es5 index.js && mocha --require esm --ui bdd --reporter dot --bail test-build.js",
"test:coverage": "npm run clean && nyc --extension .mjs --include src mocha --require esm --ui bdd --reporter dot test.js || true",
"coverage:upload": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"coverage:report": "nyc report --reporter=html",
"test:types": "tsc --lib es6 index.d.ts"
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var banner = `/**
`;

export default {
input: 'index.cjs.js',
input: 'index.cjs.mjs',
plugins: [node(), commonjs({include: 'node_modules/**'})],
output: {
banner: banner,
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ var dependencies = {
};

export default {
input: 'index.cjs.js',
input: 'index.cjs.mjs',
external: Object.keys(dependencies),
output: {
format: 'umd',
file: pkg.main,
file: pkg.main + '.js',
name: 'Fluture',
globals: dependencies
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions test-build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './test/index.buildtest.mjs';
37 changes: 37 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import './test/0.error.test.mjs';
import './test/0.iteration.test.mjs';
import './test/0.predicates.test.mjs';
import './test/0.utils.test.mjs';
import './test/1.future.test.mjs';
import './test/2.computation.test.mjs';
import './test/2.crashed.test.mjs';
import './test/2.transformation.test.mjs';
import './test/3.after.test.mjs';
import './test/3.of.test.mjs';
import './test/3.reject-after.test.mjs';
import './test/3.reject.test.mjs';
import './test/4.chain-rec.test.mjs';
import './test/5.and.test.mjs';
import './test/5.ap.test.mjs';
import './test/5.bimap.test.mjs';
import './test/5.both.test.mjs';
import './test/5.cache.test.mjs';
import './test/5.chain-rej.test.mjs';
import './test/5.chain.test.mjs';
import './test/5.encase-n.test.mjs';
import './test/5.encase-p.test.mjs';
import './test/5.encase.test.mjs';
import './test/5.finally.test.mjs';
import './test/5.fold.test.mjs';
import './test/5.hook.test.mjs';
import './test/5.map-rej.test.mjs';
import './test/5.map.test.mjs';
import './test/5.never.test.mjs';
import './test/5.or.test.mjs';
import './test/5.parallel-ap.test.mjs';
import './test/5.parallel.test.mjs';
import './test/5.race.test.mjs';
import './test/5.swap.test.mjs';
import './test/6.go.test.mjs';
import './test/6.par.test.mjs';
import './test/7.compliance.test.mjs';
File renamed without changes.
4 changes: 3 additions & 1 deletion test/0.iteration.test.js → test/0.iteration.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {expect} from 'chai';
import chai from 'chai';
import {Next, Done, isIteration} from '../src/internal/iteration';

var expect = chai.expect;

describe('Iteration', function (){

describe('.Next()', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/0.predicates.test.js → test/0.predicates.test.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {expect} from 'chai';
import chai from 'chai';
import * as U from './util';
import Future from '../index.mjs.js';
import Future from '../index.mjs';
import * as util from '../src/internal/predicates';

var expect = chai.expect;

describe('is', function (){

describe('.isThenable()', function (){
Expand Down
4 changes: 3 additions & 1 deletion test/0.utils.test.js → test/0.utils.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {expect} from 'chai';
import chai from 'chai';
import * as fn from '../src/internal/utils';

var expect = chai.expect;

describe('fn', function (){

describe('.padf()', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/1.future.test.js → test/1.future.test.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {expect} from 'chai';
import chai from 'chai';
import * as U from './util';
import * as F from './futures';
import type from 'sanctuary-type-identifiers';
Expand All @@ -16,7 +16,9 @@ import {
extractRight,
never,
isNever,
} from '../index.mjs.js';
} from '../index.mjs';

var expect = chai.expect;

describe('Future', function (){

Expand Down
6 changes: 4 additions & 2 deletions test/2.computation.test.js → test/2.computation.test.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {expect} from 'chai';
import Future from '../index.mjs.js';
import chai from 'chai';
import Future from '../index.mjs';
import * as U from './util';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

describe('Future()', function (){

it('is a unary function', function (){
Expand Down
8 changes: 5 additions & 3 deletions test/2.crashed.test.js → test/2.crashed.test.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {expect} from 'chai';
import {Future, isFuture} from '../index.mjs.js';
import {Crashed} from '../src/future.js';
import chai from 'chai';
import {Future, isFuture} from '../index.mjs';
import {Crashed} from '../src/future';
import show from 'sanctuary-show';

var expect = chai.expect;

describe('Crashed', function (){

it('Creates members of Future', function (){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import {Future, of, after} from '../index.mjs.js';
import {expect} from 'chai';
import {Future, of, after} from '../index.mjs';
import chai from 'chai';
import {add, bang, noop, error, assertResolved, assertRejected, assertCrashed} from './util';
import {resolved, rejected, resolvedSlow} from './futures';
import {Transformation} from '../src/future';
import {nil} from '../src/internal/list';
import {StateT} from 'fantasy-states';
import State from 'fantasy-states';

var expect = chai.expect;
var StateT = State.StateT;

describe('Transformation', function (){

Expand Down
6 changes: 4 additions & 2 deletions test/3.after.test.js → test/3.after.test.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {expect} from 'chai';
import {Future, after, never} from '../index.mjs.js';
import chai from 'chai';
import {Future, after, never} from '../index.mjs';
import * as U from './util';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

describe('after()', function (){

it('is a curried binary function', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/3.of.test.js → test/3.of.test.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {expect} from 'chai';
import chai from 'chai';
import FL from 'fantasy-land';
import {Future, of} from '../index.mjs.js';
import {Future, of} from '../index.mjs';
import * as U from './util';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

describe('of()', function (){

it('is also available as fantasy-land function', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/3.reject-after.test.js → test/3.reject-after.test.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {expect} from 'chai';
import {Future, rejectAfter, never} from '../index.mjs.js';
import chai from 'chai';
import {Future, rejectAfter, never} from '../index.mjs';
import * as U from './util';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

describe('rejectAfter()', function (){

it('is a curried binary function', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/3.reject.test.js → test/3.reject.test.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {expect} from 'chai';
import {Future, reject} from '../index.mjs.js';
import chai from 'chai';
import {Future, reject} from '../index.mjs';
import * as U from './util';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

describe('reject()', function (){

it('returns an instance of Future', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/4.chain-rec.test.js → test/4.chain-rec.test.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {expect} from 'chai';
import {Future, of, after, reject} from '../index.mjs.js';
import chai from 'chai';
import {Future, of, after, reject} from '../index.mjs';
import {isIteration} from '../src/internal/iteration';
import * as U from './util';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

function mockStep (next, done, x){
return of(done(x));
}
Expand Down
6 changes: 4 additions & 2 deletions test/5.and.test.js → test/5.and.test.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {expect} from 'chai';
import {Future, and, of} from '../index.mjs.js';
import chai from 'chai';
import {Future, and, of} from '../index.mjs';
import * as U from './util';
import * as F from './futures';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

var testInstance = function (and){

it('is considered a member of fluture/Fluture', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/5.ap.test.js → test/5.ap.test.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import {expect} from 'chai';
import {Future, ap, of, reject, after} from '../index.mjs.js';
import chai from 'chai';
import {Future, ap, of, reject, after} from '../index.mjs';
import * as U from './util';
import * as F from './futures';
import type from 'sanctuary-type-identifiers';
import R from 'ramda';

var expect = chai.expect;

var testInstance = function (ap){

it('is considered a member of fluture/Fluture', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/5.bimap.test.js → test/5.bimap.test.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {expect} from 'chai';
import {Future, bimap, of, reject} from '../index.mjs.js';
import chai from 'chai';
import {Future, bimap, of, reject} from '../index.mjs';
import * as U from './util';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

var testInstance = function (bimap){

it('is considered a member of fluture/Fluture', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/5.both.test.js → test/5.both.test.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {expect} from 'chai';
import {Future, both, of, node} from '../index.mjs.js';
import chai from 'chai';
import {Future, both, of, node} from '../index.mjs';
import * as U from './util';
import * as F from './futures';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

var testInstance = function (both){

it('is considered a member of fluture/Fluture', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/5.cache.test.js → test/5.cache.test.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import {expect} from 'chai';
import {Future, cache, of, reject, after} from '../index.mjs.js';
import chai from 'chai';
import {Future, cache, of, reject, after} from '../index.mjs';
import {Cached} from '../src/cache';
import * as U from './util';
import * as F from './futures';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

describe('cache()', function (){

it('throws when not given a Future', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/5.chain-rej.test.js → test/5.chain-rej.test.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {expect} from 'chai';
import {Future, chainRej, of} from '../index.mjs.js';
import chai from 'chai';
import {Future, chainRej, of} from '../index.mjs';
import * as U from './util';
import * as F from './futures';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

var testInstance = function (chainRej){

it('is considered a member of fluture/Fluture', function (){
Expand Down
6 changes: 4 additions & 2 deletions test/5.chain.test.js → test/5.chain.test.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {expect} from 'chai';
import {Future, chain, of} from '../index.mjs.js';
import chai from 'chai';
import {Future, chain, of} from '../index.mjs';
import * as U from './util';
import * as F from './futures';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;

var testInstance = function (chain){

it('is considered a member of fluture/Fluture', function (){
Expand Down
5 changes: 3 additions & 2 deletions test/5.encase-n.test.js → test/5.encase-n.test.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {expect} from 'chai';
import {Future, encaseN, encaseN2, encaseN3, node} from '../index.mjs.js';
import chai from 'chai';
import {Future, encaseN, encaseN2, encaseN3, node} from '../index.mjs';
import * as U from './util';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;
var unaryNoop = function (a, f){ return void f };
var binaryNoop = function (a, b, f){ return void f };
var ternaryNoop = function (a, b, c, f){ return void f };
Expand Down
5 changes: 3 additions & 2 deletions test/5.encase-p.test.js → test/5.encase-p.test.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* eslint prefer-promise-reject-errors: 0 */

import {expect} from 'chai';
import {Future, encaseP, encaseP2, encaseP3, tryP} from '../index.mjs.js';
import chai from 'chai';
import {Future, encaseP, encaseP2, encaseP3, tryP} from '../index.mjs';
import * as U from './util';
import type from 'sanctuary-type-identifiers';

var expect = chai.expect;
var unaryNoop = function (a){ return Promise.resolve(a) };
var binaryNoop = function (a, b){ return Promise.resolve(b) };
var ternaryNoop = function (a, b, c){ return Promise.resolve(c) };
Expand Down
Loading

0 comments on commit 7130b91

Please sign in to comment.