From 7d3ff05c2d12bb3708bdb09383d4832939cda487 Mon Sep 17 00:00:00 2001 From: tkQubo Date: Wed, 26 Aug 2015 21:46:42 +0900 Subject: [PATCH] Add coffeeify --- coffeeify/coffeeify-tests.ts | 15 +++++++++++++++ coffeeify/coffeeify.d.ts | 37 ++++++++++++++++++++++++++++++++++++ through/through.d.ts | 4 ++-- 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 coffeeify/coffeeify-tests.ts create mode 100644 coffeeify/coffeeify.d.ts diff --git a/coffeeify/coffeeify-tests.ts b/coffeeify/coffeeify-tests.ts new file mode 100644 index 0000000000..753f68e79c --- /dev/null +++ b/coffeeify/coffeeify-tests.ts @@ -0,0 +1,15 @@ +/// + +import coffeeify = require('coffeeify'); + +coffeeify.sourceMap = false; + +var isCoffee = coffeeify.isCoffee('foo.coffee'); +var isLiterate = coffeeify.isLiterate('bar.coffee'); +coffeeify.compile('out.js', 'console.log 42', (err, compiled) => { + console.log(err); + console.log(compiled); +}); + +coffeeify('test.coffee').end(); + diff --git a/coffeeify/coffeeify.d.ts b/coffeeify/coffeeify.d.ts new file mode 100644 index 0000000000..9651cdb15f --- /dev/null +++ b/coffeeify/coffeeify.d.ts @@ -0,0 +1,37 @@ +// Type definitions for coffeeify +// Project: https://github.com/jnordberg/coffeeify +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "coffeeify" { + import through = require('through'); + + namespace coffeeify { + interface Coffeeify { + isCoffee(file: string): boolean; + isLiterate(file: string): boolean; + sourceMap: boolean; + compile(file: string, data: string, callback: Callback): void; + (file: string): through.ThroughStream; + } + + interface Callback { + (error: ParseError, compiled: string): void; + } + + interface ParseError extends SyntaxError { + new(error: any, src: string, file: string): ParseError; + message: string; + line: number; + column: number; + annotated: string; + } + } + + var coffeeify: coffeeify.Coffeeify; + + export = coffeeify; +} + diff --git a/through/through.d.ts b/through/through.d.ts index 1491085a2f..6e13e4d623 100644 --- a/through/through.d.ts +++ b/through/through.d.ts @@ -8,7 +8,7 @@ declare module "through" { import stream = require("stream"); - function through(write?: (data) => void, + function through(write?: (data: any) => void, end?: () => void, opts?: { autoDestroy: boolean; @@ -21,4 +21,4 @@ declare module "through" { } export = through; -} \ No newline at end of file +}