Skip to content

Commit

Permalink
Bump version to 0.0.5 and update readme and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
BYVoid committed Oct 10, 2012
1 parent a2c4933 commit 7e70f80
Show file tree
Hide file tree
Showing 26 changed files with 134 additions and 63 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
#Change Log

## 0.0.5

2012-10-10

* Compile source code only if needed
* Add 'explicit' and 'verbose' options for compilation and loading
* Implemented script loading cache
* Supported LogicalExpression,RegExp, etc
* Fixed a bug if no 'catch' clause found in try statement
* Fixed a bug about nested try and if statements

## 0.0.4

2012-10-02

* Loading and automatically compiling by require() is working
* Support Coffee Script
* Supported Coffee Script
* Implemented 'defer' statement
* Added browser and node.js examples

Expand Down
29 changes: 29 additions & 0 deletions License
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD License

Copyright 2012 (c) Carbo KUO

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
53 changes: 13 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Continuation.js

Continuation.js is a compiler for asynchronous [Continuation-Passing Style](http://en.wikipedia.org/wiki/Continuation-passing_style) transformation, which simplifies asynchronous programming.
Continuation.js is a compiler for asynchronous [Continuation-Passing Style](http://en.wikipedia.org/wiki/Continuation-passing_style) transformation, which simplifies asynchronous JavaScript programming.

Typically writing with asynchronous control flow is a pain because you will easily write nested callbacks like below:
Typically, writing with asynchronous control flow is a pain because you will easily write nested callbacks like below:

```javascript
function textProcessing(callback) {
Expand All @@ -26,7 +26,7 @@ textProcessing(function (err, contents) {
});
```

While using Continuation.js, you write:
This kind of coding style is called 'callback hells' or 'callback pyramids'. While using Continuation.js, you directly write:

```javascript
function textProcessing(ret) {
Expand Down Expand Up @@ -71,29 +71,34 @@ try {
* Flexible coding style
* Readable and debuggable compiled code
* Compatible with CoffeeScript
* Supports both Node.js and browser JavaScript
* Supports both Node.js and browser-side JavaScript
* Parallel execution supported

## Installation

Install Continuation.js with [NPM](https://npmjs.org/package/continuation):

npm install -g continuation

## Usage

continuation [options] <file.js/file.coffee> [arguments]
Usage: continuation [options] <file.js/file.coffee> [arguments]

Options:

-h, --help output usage information
-V, --version output the version number
-c, --compile only compile script file and print it
-o, --output <filename> compile script file and save as <filename>, implies --compile
-p, --print compile script file and print it
-o, --output <filename> compile script file and save as <filename>
-e, --explicit compile only if "use continuation" is explicitly declared
-c, --cache [directory] run and cache compiled sources to [directory], by default [directory] is /tmp/continuation
-v, --verbose print verbosal information to stderr

## Documentation

Continuation.js is still under development. Most functionalities are not fully implemented or tested.

More details are to be written. See examples below.
More details are to be written.

## Examples

Expand Down Expand Up @@ -127,35 +132,3 @@ console.log('Done');
```

More examples are available in 'examples' directory.

## License

BSD License

Copyright 2012 (c) Carbo KUO

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "continuation",
"version": "0.0.4",
"version": "0.0.5",
"description": "Continuation.js is a compiler for asynchronous JavaScript Continuation-Passing style transformation",
"author": "BYVoid",
"license": "BSD",
Expand All @@ -27,8 +27,9 @@
"keywords": [
"compiler",
"continuation",
"coffeescript",
"monad"
"monad",
"cps",
"coffeescript"
],
"dependencies": {
"esprima": "0.9.9",
Expand Down
14 changes: 14 additions & 0 deletions test/cases/try_if.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
try {
if (true) {
setTimeout(cont(), 100);
console.log('throw err');
throw 'Err';
} else {throw 'Else Err';}
console.log('after if');
} catch (err) {
console.error(err);
return;
}

console.log('Done');

2 changes: 1 addition & 1 deletion test/results/continue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var i;
i = 0;
function loop_0(loop_0_cont) {
Expand Down
2 changes: 1 addition & 1 deletion test/results/defer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var fs, err, text, util;
fs = require('fs');
(function (cont) {
Expand Down
2 changes: 1 addition & 1 deletion test/results/diskusage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var fs, path, err, totalSize, totalBlockSize;
fs = require('fs');
function calcDirSize(path, callback) {
Expand Down
2 changes: 1 addition & 1 deletion test/results/factor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var factor;
factor = function (n, callback) {
var rest;
Expand Down
2 changes: 1 addition & 1 deletion test/results/fib.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var fib;
fib = function () {
var a, current, b;
Expand Down
2 changes: 1 addition & 1 deletion test/results/for.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var e, list, _i, _len;
list = [
1,
Expand Down
2 changes: 1 addition & 1 deletion test/results/forin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
for (var key in [1, 2, 3]) {
console.log(key);
}
2 changes: 1 addition & 1 deletion test/results/if.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var err, text, a;
(function (cont) {
if (bool) {
Expand Down
2 changes: 1 addition & 1 deletion test/results/ifvar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var b, c, i, j, k, p;
(function (cont) {
if (true) {
Expand Down
2 changes: 1 addition & 1 deletion test/results/list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var list, i;
function delay(num, callback) {
setTimeout(function () {
Expand Down
2 changes: 1 addition & 1 deletion test/results/loop.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var fs, i, err, text;
fs = require('fs');
i = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/results/pi.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var calcPi, pi;
calcPi = function (callback) {
var f;
Expand Down
2 changes: 1 addition & 1 deletion test/results/readfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var fs, a, err, text;
fs = require('fs');
a = 1;
Expand Down
2 changes: 1 addition & 1 deletion test/results/switch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var err, text, end;
(function (cont) {
function case_0(cont) {
Expand Down
2 changes: 1 addition & 1 deletion test/results/switchbreak.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var val, num;
val = 'a';
num = 1;
Expand Down
2 changes: 1 addition & 1 deletion test/results/try_body.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var a, err;
(function (cont) {
try {
Expand Down
2 changes: 1 addition & 1 deletion test/results/try_both.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
(function (cont) {
(function (cont) {
try {
Expand Down
2 changes: 1 addition & 1 deletion test/results/try_catch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
(function (cont) {
try {
throw new Error('my error');
Expand Down
42 changes: 42 additions & 0 deletions test/results/try_if.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* Generated by Continuation.js v0.0.5 */
(function (cont) {
try {
(function (cont) {
try {
if (true) {
setTimeout(function () {
try {
console.log('throw err');
throw 'Err';
cont();
} catch (err) {
cont(err);
}
}, 100);
} else {
throw 'Else Err';
cont();
}
} catch (err) {
cont(err);
}
}(function (err) {
try {
if (err !== undefined)
return cont(err);
console.log('after if');
cont();
} catch (err) {
cont(err);
}
}));
} catch (err) {
cont(err);
}
}(function (err) {
if (err !== undefined) {
console.error(err);
return;
}
console.log('Done');
}));
2 changes: 1 addition & 1 deletion test/results/whilebreak.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by Continuation.js v0.0.4 */
/* Generated by Continuation.js v0.0.5 */
var i;
i = 0;
function loop_0(loop_0_cont) {
Expand Down
1 change: 1 addition & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var files = [
'defer.js',
'for.js',
'forin.js',
'try_if.js',
];

var test = function(filename, done) {
Expand Down

0 comments on commit 7e70f80

Please sign in to comment.