1 | // Type definitions for babelify v7.3.0
|
2 | // Project: https://github.com/babel/babelify
|
3 | // Definitions by: TeamworkGuy2 <https://github.com/TeamworkGuy2>
|
4 | // Marvin Hagemeister <https://github.com/marvinhagemeister>
|
5 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
6 | // TypeScript Version: 2.8
|
7 |
|
8 | /// <reference types="node" />
|
9 |
|
10 | /** Browserify transform for Babel
|
11 | */
|
12 | import stream = require("stream");
|
13 | import babel = require("babel-core");
|
14 |
|
15 | declare function Babelify(filename: string, opts?: Babelify.BabelifyOptions): Babelify.BabelifyObject;
|
16 |
|
17 | declare namespace Babelify {
|
18 | export interface BabelifyConstructor {
|
19 | (filename: string, opts: Babelify.BabelifyOptions): Babelify.BabelifyObject;
|
20 | }
|
21 |
|
22 | /** In addition to the various purposes documented here, all of the babelify options are passed to babel which passes them on to babel.transform() when each file is transformed */
|
23 | export interface BabelifyOptions extends babel.TransformOptions {
|
24 | /** These are passed to babel.util.canCompile() for each filename
|
25 | * default: null
|
26 | */
|
27 | extensions?: string | string[] | undefined;
|
28 |
|
29 | /** if true, a 'sourceFileName' property with a value equal to the current file being transformed is included with the options passed to babel.transform()
|
30 | * default: false
|
31 | */
|
32 | sourceMapsAbsolute?: boolean | undefined;
|
33 | }
|
34 |
|
35 | export class BabelifyObject extends stream.Transform {
|
36 | _transform(buf: string | Buffer, encoding: string, callback: () => void): void;
|
37 | _flush(callback: () => void): void;
|
38 | }
|
39 |
|
40 | export function configure(opts: Babelify.BabelifyOptions): (filename: string) => Babelify.BabelifyObject;
|
41 | }
|
42 |
|
43 | export = Babelify;
|