Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/insert-module-globals

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/insert-module-globals

TypeScript definitions for insert-module-globals

  • 7.0.5
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18K
decreased by-15.17%
Maintainers
1
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc