UNPKG

2.54 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/babelify`
3
4# Summary
5This package contains type definitions for babelify (https://github.com/babel/babelify).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babelify.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babelify/index.d.ts)
10````ts
11// Type definitions for babelify v7.3.0
12// Project: https://github.com/babel/babelify
13// Definitions by: TeamworkGuy2 <https://github.com/TeamworkGuy2>
14// Marvin Hagemeister <https://github.com/marvinhagemeister>
15// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
16// TypeScript Version: 2.8
17
18/// <reference types="node" />
19
20/** Browserify transform for Babel
21 */
22import stream = require("stream");
23import babel = require("babel-core");
24
25declare function Babelify(filename: string, opts?: Babelify.BabelifyOptions): Babelify.BabelifyObject;
26
27declare namespace Babelify {
28
29 export interface BabelifyConstructor {
30 (filename: string, opts: Babelify.BabelifyOptions): Babelify.BabelifyObject;
31 }
32
33 /** 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 */
34 export interface BabelifyOptions extends babel.TransformOptions {
35 /** These are passed to babel.util.canCompile() for each filename
36 * default: null
37 */
38 extensions?: string | string[] | undefined;
39
40 /** if true, a 'sourceFileName' property with a value equal to the current file being transformed is included with the options passed to babel.transform()
41 * default: false
42 */
43 sourceMapsAbsolute?: boolean | undefined;
44 }
45
46 export class BabelifyObject extends stream.Transform {
47 _transform(buf: string | Buffer, encoding: string, callback: () => void): void;
48 _flush(callback: () => void): void;
49 }
50
51 export function configure(opts: Babelify.BabelifyOptions): (filename: string) => Babelify.BabelifyObject;
52}
53
54export = Babelify;
55
56
57````
58
59### Additional Details
60 * Last updated: Wed, 07 Jul 2021 21:44:46 GMT
61 * Dependencies: [@types/babel-core](https://npmjs.com/package/@types/babel-core), [@types/node](https://npmjs.com/package/@types/node)
62 * Global values: none
63
64# Credits
65These definitions were written by [TeamworkGuy2](https://github.com/TeamworkGuy2), and [Marvin Hagemeister](https://github.com/marvinhagemeister).
66
\No newline at end of file