UNPKG

2.19 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/// <reference types="node" />
12
13/** Browserify transform for Babel
14 */
15import stream = require("stream");
16import babel = require("babel-core");
17
18declare function Babelify(filename: string, opts?: Babelify.BabelifyOptions): Babelify.BabelifyObject;
19
20declare namespace Babelify {
21 export interface BabelifyConstructor {
22 (filename: string, opts: Babelify.BabelifyOptions): Babelify.BabelifyObject;
23 }
24
25 /** 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 */
26 export interface BabelifyOptions extends babel.TransformOptions {
27 /** These are passed to babel.util.canCompile() for each filename
28 * default: null
29 */
30 extensions?: string | string[] | undefined;
31
32 /** if true, a 'sourceFileName' property with a value equal to the current file being transformed is included with the options passed to babel.transform()
33 * default: false
34 */
35 sourceMapsAbsolute?: boolean | undefined;
36 }
37
38 export class BabelifyObject extends stream.Transform {
39 _transform(buf: string | Buffer, encoding: string, callback: () => void): void;
40 _flush(callback: () => void): void;
41 }
42
43 export function configure(opts: Babelify.BabelifyOptions): (filename: string) => Babelify.BabelifyObject;
44}
45
46export = Babelify;
47
48````
49
50### Additional Details
51 * Last updated: Mon, 06 Nov 2023 22:41:04 GMT
52 * Dependencies: [@types/babel-core](https://npmjs.com/package/@types/babel-core), [@types/node](https://npmjs.com/package/@types/node)
53
54# Credits
55These definitions were written by [TeamworkGuy2](https://github.com/TeamworkGuy2), and [Marvin Hagemeister](https://github.com/marvinhagemeister).
56
\No newline at end of file