@types/browserify

  • Version 12.0.40
  • Published
  • 13.8 kB
  • 2 dependencies
  • MIT license

Install

npm i @types/browserify
yarn add @types/browserify
pnpm add @types/browserify

Overview

TypeScript definitions for browserify

Index

Variables

variable browserify

var browserify: browserify.BrowserifyConstructor;

    Interfaces

    interface BrowserifyConstructor

    interface BrowserifyConstructor {}

      construct signature

      new (files: InputFile[], opts?: Options): BrowserifyObject;

        construct signature

        new (file: InputFile, opts?: Options): BrowserifyObject;

          construct signature

          new (opts?: Options): BrowserifyObject;

            call signature

            (files: InputFile[], opts?: Options): BrowserifyObject;

              call signature

              (file: InputFile, opts?: Options): BrowserifyObject;

                call signature

                (opts?: Options): BrowserifyObject;

                  interface BrowserifyObject

                  interface BrowserifyObject extends NodeJS.EventEmitter {}

                    property pipeline

                    pipeline: any;
                    • Set to any until substack/labeled-stream-splicer is defined

                    method add

                    add: (file: InputFile | InputFile[], opts?: FileOptions) => BrowserifyObject;
                    • Add an entry file from file that will be executed when the bundle loads. If file is an array, each item in file will be added as an entry file.

                    method bundle

                    bundle: (cb?: (err: any, src: Buffer) => any) => NodeJS.ReadableStream;
                    • Bundle the files and their dependencies into a single javascript file. Return a readable stream with the javascript file contents or optionally specify a cb(err, buf) to get the buffered results.

                    method exclude

                    exclude: (file: string, opts?: CustomOptions) => BrowserifyObject;
                    • Prevent the module name or file at file from showing up in the output bundle. If your code tries to require() that file it will throw unless you've provided another mechanism for loading it.

                    method external

                    external: {
                    (file: string[], opts?: CustomOptions): BrowserifyObject;
                    (file: string, opts?: CustomOptions): BrowserifyObject;
                    (file: BrowserifyObject): BrowserifyObject;
                    };
                    • Prevent file from being loaded into the current bundle, instead referencing from another bundle. If file is an array, each item in file will be externalized. If file is another bundle, that bundle's contents will be read and excluded from the current bundle as the bundle in file gets bundled.

                    method ignore

                    ignore: (file: string, opts?: CustomOptions) => BrowserifyObject;
                    • Prevent the module name or file at file from showing up in the output bundle. Instead you will get a file with module.exports = {}.

                    method on

                    on: {
                    (
                    event: 'file',
                    listener: (file: string, id: string, parent: any) => any
                    ): this;
                    (event: 'package', listener: (pkg: any) => any): this;
                    (event: 'bundle', listener: (bundle: NodeJS.ReadableStream) => any): this;
                    (event: 'reset', listener: () => any): this;
                    (
                    event: 'transform',
                    listener: (tr: NodeJS.ReadWriteStream, file: string) => any
                    ): this;
                    (event: string, listener: Function): this;
                    };
                    • When a file is resolved for the bundle, the bundle emits a 'file' event with the full file path, the id string passed to require(), and the parent object used by browser-resolve. You could use the file event to implement a file watcher to regenerate bundles when files change.

                    • When a package.json file is read, this event fires with the contents. The package directory is available at pkg.__dirname.

                    • When .bundle() is called, this event fires with the bundle output stream.

                    • When the .reset() method is called or implicitly called by another call to .bundle(), this event fires.

                    • When a transform is applied to a file, the 'transform' event fires on the bundle stream with the transform stream tr and the file that the transform is being applied to.

                    method plugin

                    plugin: {
                    <T extends CustomOptions>(plugin: string, opts?: T): BrowserifyObject;
                    <T extends CustomOptions>(
                    plugin: (b: BrowserifyObject, opts: T) => any,
                    opts?: T
                    ): BrowserifyObject;
                    };
                    • Register a plugin with opts. Plugins can be a string module name or a function the same as transforms. plugin(b, opts) is called with the Browserify instance b.

                    method require

                    require: (file: InputFile, opts?: FileOptions) => BrowserifyObject;
                    • Make file available from outside the bundle with require(file). The file param is anything that can be resolved by require.resolve(). file can also be a stream, but you should also use opts.basedir so that relative requires will be resolvable. If file is an array, each item in file will be required. In file array form, you can use a string or object for each item. Object items should have a file property and the rest of the parameters will be used for the opts. Use the expose property of opts to specify a custom dependency name. require('./vendor/angular/angular.js', {expose: 'angular'}) enables require('angular')

                    method reset

                    reset: (opts?: Options) => void;
                    • Reset the pipeline back to a normal state. This function is called automatically when bundle() is called multiple times. This function triggers a 'reset' event.

                    method transform

                    transform: {
                    <T extends CustomOptions>(tr: string, opts?: T): BrowserifyObject;
                    <T extends CustomOptions>(
                    tr: (file: string, opts: T) => NodeJS.ReadWriteStream,
                    opts?: T
                    ): BrowserifyObject;
                    };
                    • Transform source code before parsing it for require() calls with the transform function or module name tr. If tr is a function, it will be called with tr(file) and it should return a through-stream that takes the raw file contents and produces the transformed source. If tr is a string, it should be a module name or file path of a transform module

                    interface CustomOptions

                    interface CustomOptions {}
                    • Core options pertaining to a Browserify instance, extended by user options

                    property basedir

                    basedir?: string | undefined;
                    • the directory that Browserify starts bundling from for filenames that start with ..

                    index signature

                    [propName: string]: any;
                    • Custom properties can be defined on Options. These options are forwarded along to module-deps and browser-pack directly.

                    interface FileOptions

                    interface FileOptions {}
                    • Options pertaining to an individual file.

                    property basedir

                    basedir?: string | undefined;

                      property entry

                      entry?: boolean | undefined;

                        property expose

                        expose?: string | undefined;

                          property external

                          external?: boolean | undefined;

                            property file

                            file?: string | undefined;

                              property id

                              id?: string | undefined;

                                property transform

                                transform?: boolean | undefined;

                                  interface Options

                                  interface Options extends CustomOptions {}
                                  • Options pertaining to a Browserify instance.

                                  property builtins

                                  builtins?: string[] | { [builtinName: string]: string } | boolean | undefined;

                                    property bundleExternal

                                    bundleExternal?: boolean | undefined;

                                      property commondir

                                      commondir?: boolean | undefined;

                                        property debug

                                        debug?: boolean | undefined;

                                          property detectGlobals

                                          detectGlobals?: boolean | undefined;

                                            property entries

                                            entries?: InputFile | InputFile[] | undefined;

                                              property extensions

                                              extensions?: string[] | undefined;

                                                property externalRequireName

                                                externalRequireName?: string | undefined;

                                                  property fullPaths

                                                  fullPaths?: boolean | undefined;

                                                    property insertGlobals

                                                    insertGlobals?: boolean | undefined;

                                                      property insertGlobalVars

                                                      insertGlobalVars?: insertGlobals.VarsOption | undefined;

                                                        property noParse

                                                        noParse?: string[] | undefined;

                                                          property paths

                                                          paths?: string[] | undefined;

                                                            property standalone

                                                            standalone?: string | undefined;

                                                              Type Aliases

                                                              type InputFile

                                                              type InputFile = string | NodeJS.ReadableStream | FileOptions;

                                                                Package Files (1)

                                                                Dependencies (2)

                                                                Dev Dependencies (0)

                                                                No dev dependencies.

                                                                Peer Dependencies (0)

                                                                No peer dependencies.

                                                                Badge

                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/browserify.

                                                                • Markdown
                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/browserify)
                                                                • HTML
                                                                  <a href="https://www.jsdocs.io/package/@types/browserify"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>