@types/deps-sort
TypeScript icon, indicating that this package has built-in type declarations

2.0.4 • Public • Published

Installation

npm install --save @types/deps-sort

Summary

This package contains type definitions for deps-sort (https://github.com/browserify/deps-sort).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/deps-sort.

index.d.ts

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

import * as stream from "stream";

/**
 * Return a new through stream that should get written module-deps objects and will output sorted objects.
 */
declare function depsSort(opts?: depsSort.Options): stream.Transform;

/**
 * Sort module-deps output for deterministic browserify bundles.
 */
declare namespace depsSort {
    /**
     * module-deps constructor options
     */
    interface Options {
        /**
         * When true, for each module-deps row, insert 'row.index' with the numeric index and
         * 'row.indexDeps' like 'row.deps' but mapping require strings to row indices
         */
        index?: boolean | undefined;

        /**
         * array of names or object mapping names to true not to mangle with integer indexes when 'index' is turned on.
         * If 'expose' maps names to strings, those strings will be used to resolve the indexed references.
         */
        expose?: string[] | { [name: string]: boolean | string } | undefined;

        /**
         * Set 'row.dedupe' for files that match existing contents. Sets 'row.dedupeIndex' when 'index' is enabled.
         * When 'row.dedupe' is set, 'row.sameDeps' will be set to a boolean of whether the dependencies at the dedupe target match (true) or just the source content (false).
         */
        dedupe?: boolean | undefined;

        [prop: string]: any;
    }

    /**
     * Input objects are file objects in the module-deps shape. They must at least have these properties:
     */
    interface InputRow {
        /**
         * a unique identifier for the file
         */
        id: string;
        /**
         * the file contents
         */
        source: string;
        /**
         * dependencies for this file, mapping strings as used in require() to row IDs
         */
        deps: string[];
    }

    /**
     * All the input properties, and:
     */
    interface OutputRow {
        /**
         * when 'opts.index' is true, the sorted numeric index of the row
         */
        index: number;
        /**
         * like 'row.deps', but mapping to 'row.index' instead of 'row.id'
         */
        indexDeps: { [id: string]: number };
        /**
         * when 'opts.dedupe' is true, contains the row ID of a file with identical contents
         */
        dedupe: string;
        /**
         * like 'row.dedupe', but contains the 'row.index' instead of 'row.id'
         */
        dedupeIndex: number;
    }
}

export = depsSort;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: @types/node

Credits

These definitions were written by TeamworkGuy2.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/deps-sort

Weekly Downloads

592

Version

2.0.4

License

MIT

Unpacked Size

7.62 kB

Total Files

5

Last publish

Collaborators

  • types