Skip to content

Commit

Permalink
Updated browserify.d.ts to allow require without import.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff May committed Oct 4, 2014
1 parent 4598e7d commit 405be51
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 45 deletions.
19 changes: 12 additions & 7 deletions browserify/browserify-tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import browserify = require("browserify");
import fs = require("fs");

var b = browserify();
b.add('./browser/main.js');
b.transform('deamdify');
b.bundle().pipe(fs.createWriteStream('bundle.js'));
/// <reference path="browserify.d.ts"/>

import browserify = require("browserify");
import fs = require("fs");

var b: BrowserifyObject = browserify();
b.add('./browser/main.js');
b.transform('deamdify');
b.bundle().pipe(fs.createWriteStream('bundle.js'));

var customBrowsify: Browserify = require("browserify");
customBrowsify({entries: []});
79 changes: 41 additions & 38 deletions browserify/browserify.d.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
// Type definitions for Browserify
// Project: http://browserify.org/
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference path="../node/node.d.ts" />

interface BrowserifyObject extends NodeJS.EventEmitter {
add(file: string): BrowserifyObject;
require(file: string, opts?: {
expose: string;
}): BrowserifyObject;
bundle(opts?: {
insertGlobals?: boolean;
detectGlobals?: boolean;
debug?: boolean;
standalone?: string;
insertGlobalVars?: any;
}, cb?: (err: any, src: any) => void): NodeJS.ReadableStream;

external(file: string): BrowserifyObject;
ignore(file: string): BrowserifyObject;
transform(tr: string): BrowserifyObject;
transform(tr: Function): BrowserifyObject;
plugin(plugin: string, opts?: any): BrowserifyObject;
plugin(plugin: Function, opts?: any): BrowserifyObject;
}

declare module "browserify" {
function browserify(): BrowserifyObject;
function browserify(files: string[]): BrowserifyObject;
function browserify(opts: {
entries?: string[];
noParse?: string[];
}): BrowserifyObject;

export = browserify;
}
// Type definitions for Browserify
// Project: http://browserify.org/
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference path="../node/node.d.ts" />

interface BrowserifyObject extends NodeJS.EventEmitter {
add(file:string): BrowserifyObject;
require(file:string, opts?:{
expose: string;
}): BrowserifyObject;
bundle(opts?:{
insertGlobals?: boolean;
detectGlobals?: boolean;
debug?: boolean;
standalone?: string;
insertGlobalVars?: any;
}, cb?:(err:any, src:any) => void): NodeJS.ReadableStream;

external(file:string): BrowserifyObject;
ignore(file:string): BrowserifyObject;
transform(tr:string): BrowserifyObject;
transform(tr:Function): BrowserifyObject;
plugin(plugin:string, opts?:any): BrowserifyObject;
plugin(plugin:Function, opts?:any): BrowserifyObject;
}

interface Browserify {
(): BrowserifyObject;
(files:string[]): BrowserifyObject;
(opts:{
entries?: string[];
noParse?: string[];
}): BrowserifyObject;
}

declare module "browserify" {
var browserify: Browserify;
export = browserify;
}

0 comments on commit 405be51

Please sign in to comment.