Skip to content

Commit 7d3ff05

Browse files
committed
Add coffeeify
1 parent fa8d968 commit 7d3ff05

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

coffeeify/coffeeify-tests.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// <reference path="coffeeify.d.ts" />
2+
3+
import coffeeify = require('coffeeify');
4+
5+
coffeeify.sourceMap = false;
6+
7+
var isCoffee = coffeeify.isCoffee('foo.coffee');
8+
var isLiterate = coffeeify.isLiterate('bar.coffee');
9+
coffeeify.compile('out.js', 'console.log 42', (err, compiled) => {
10+
console.log(err);
11+
console.log(compiled);
12+
});
13+
14+
coffeeify('test.coffee').end();
15+

coffeeify/coffeeify.d.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Type definitions for coffeeify
2+
// Project: https://github.com/jnordberg/coffeeify
3+
// Definitions by: Qubo <https://github.com/tkQubo>
4+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5+
6+
/// <reference path="../through/through.d.ts" />
7+
8+
declare module "coffeeify" {
9+
import through = require('through');
10+
11+
namespace coffeeify {
12+
interface Coffeeify {
13+
isCoffee(file: string): boolean;
14+
isLiterate(file: string): boolean;
15+
sourceMap: boolean;
16+
compile(file: string, data: string, callback: Callback): void;
17+
(file: string): through.ThroughStream;
18+
}
19+
20+
interface Callback {
21+
(error: ParseError, compiled: string): void;
22+
}
23+
24+
interface ParseError extends SyntaxError {
25+
new(error: any, src: string, file: string): ParseError;
26+
message: string;
27+
line: number;
28+
column: number;
29+
annotated: string;
30+
}
31+
}
32+
33+
var coffeeify: coffeeify.Coffeeify;
34+
35+
export = coffeeify;
36+
}
37+

through/through.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
declare module "through" {
99
import stream = require("stream");
1010

11-
function through(write?: (data) => void,
11+
function through(write?: (data: any) => void,
1212
end?: () => void,
1313
opts?: {
1414
autoDestroy: boolean;
@@ -21,4 +21,4 @@ declare module "through" {
2121
}
2222

2323
export = through;
24-
}
24+
}

0 commit comments

Comments
 (0)