@types/insert-module-globals
TypeScript definitions for insert-module-globals
Last updated 3 years ago by types .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @types/insert-module-globals 
SYNC missed versions from official npm registry.

Installation

npm install --save @types/insert-module-globals

Summary

This package contains type definitions for insert-module-globals (https://github.com/browserify/insert-module-globals).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/insert-module-globals.

index.d.ts

/// <reference types="node" />

import * as stream from "stream";

export = InsertModuleGlobals;

interface InsertModuleGlobals {
    /**
     * Return a transform stream inserter for the filename file that will accept a javascript file as input and
     * will output the file with a closure around the contents as necessary to define extra builtins.
     */
    (file: string, opts?: InsertModuleGlobals.Options): stream.Transform;

    /**
     * Defaults
     */
    readonly vars: {
        process(file: string): string;
        global(): string;
        "Buffer.isBuffer"(file: string): string;
        Buffer(): string;
        __filename(file: string, basedir: string): string;
        __dirname(file: string, basedir: string): string;
    };
}

declare const InsertModuleGlobals: InsertModuleGlobals;

declare namespace InsertModuleGlobals {
    interface Options {
        /**
         * When opts.always is true, wrap every file with all the global variables without parsing.
         * This is handy because parsing the scope can take a long time, so you can prioritize fast builds over saving bytes in the final output.
         * When opts.always is truthy but not true, avoid parsing but perform a quick test to determine if wrapping should be skipped.
         */
        always?: boolean | undefined;
        /**
         * Use opts.vars to override the default inserted variables, or set opts.vars[name] to undefined to not insert a variable which would otherwise be inserted.
         *
         * opts.vars properties with a . in their name will be executed instead of the parent object if ONLY that property is used.
         * For example, "Buffer.isBuffer" will mask "Buffer" only when there is a Buffer.isBuffer() call in a file and no other references to Buffer.
         */
        vars?: VarsOption | undefined;
        /**
         * If opts.debug is true, an inline source map will be generated to compensate for the extra lines.
         */
        debug?: boolean | undefined;
        basedir?: string | undefined;
    }

    interface VarsOption {
        [name: string]: InsertFunction | undefined;
    }

    type InsertFunction = (file: string, basedir: string) => VariableConfig | string;

    interface VariableConfig {
        id: string;
        source: string;
        suffix?: string | undefined;
    }
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Leonard Thieu.

Current Tags

  • 7.0.5                                ...           latest (2 years ago)
  • 7.0.1                                ...           ts2.0 (7 years ago)
  • 7.0.1                                ...           ts2.1 (7 years ago)
  • 7.0.1                                ...           ts2.2 (7 years ago)
  • 7.0.1                                ...           ts2.3 (7 years ago)
  • 7.0.1                                ...           ts2.4 (7 years ago)
  • 7.0.1                                ...           ts2.5 (7 years ago)
  • 7.0.1                                ...           ts2.6 (7 years ago)
  • 7.0.1                                ...           ts2.7 (7 years ago)
  • 7.0.1                                ...           ts2.8 (7 years ago)
  • 7.0.1                                ...           ts2.9 (7 years ago)
  • 7.0.1                                ...           ts3.0 (7 years ago)
  • 7.0.1                                ...           ts3.1 (7 years ago)
  • 7.0.1                                ...           ts3.2 (7 years ago)
  • 7.0.1                                ...           ts3.3 (7 years ago)
  • 7.0.1                                ...           ts3.4 (7 years ago)
  • 7.0.1                                ...           ts3.5 (7 years ago)
  • 7.0.2                                ...           ts3.6 (5 years ago)
  • 7.0.2                                ...           ts3.7 (5 years ago)
  • 7.0.2                                ...           ts3.8 (5 years ago)
  • 7.0.2                                ...           ts3.9 (5 years ago)
  • 7.0.2                                ...           ts4.0 (5 years ago)
  • 7.0.2                                ...           ts4.1 (5 years ago)
  • 7.0.2                                ...           ts4.2 (5 years ago)
  • 7.0.2                                ...           ts4.3 (5 years ago)
  • 7.0.2                                ...           ts4.4 (5 years ago)
  • 7.0.5                                ...           ts4.5 (2 years ago)
  • 7.0.5                                ...           ts4.6 (2 years ago)
  • 7.0.5                                ...           ts4.7 (2 years ago)
  • 7.0.5                                ...           ts4.8 (2 years ago)
  • 7.0.5                                ...           ts4.9 (2 years ago)
  • 7.0.5                                ...           ts5.0 (2 years ago)
  • 7.0.5                                ...           ts5.1 (2 years ago)
  • 7.0.5                                ...           ts5.2 (2 years ago)
  • 7.0.5                                ...           ts5.3 (2 years ago)
  • 7.0.5                                ...           ts5.4 (2 years ago)
  • 7.0.5                                ...           ts5.5 (2 years ago)
  • 7.0.5                                ...           ts5.6 (2 years ago)
  • 7.0.5                                ...           ts5.7 (2 years ago)
  • 7.0.5                                ...           ts5.8 (2 years ago)
  • 7.0.5                                ...           ts5.9 (2 years ago)

6 Versions

  • 7.0.5                                ...           2 years ago
  • 7.0.4                                ...           2 years ago
  • 7.0.3                                ...           3 years ago
  • 7.0.2                                ...           5 years ago
  • 7.0.1                                ...           7 years ago
  • 7.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (1)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |