@types/parcel-bundler

  • Version 1.12.4
  • Published
  • 9.41 kB
  • 1 dependency
  • MIT license

Install

npm i @types/parcel-bundler
yarn add @types/parcel-bundler
pnpm add @types/parcel-bundler

Overview

TypeScript definitions for parcel-bundler

Index

Classes

class ParcelBundler

class ParcelBundler {}

    constructor

    constructor(
    entryFiles?: string | string[],
    options?: ParcelBundler.ParcelOptions
    );

      method addAssetType

      addAssetType: (extension: string, path: string) => void;

        method addPackager

        addPackager: (type: string, packager: string) => void;

          method bundle

          bundle: () => Promise<ParcelBundler.ParcelBundle>;

            method middleware

            middleware: () => (
            req: express.Request,
            res: express.Response,
            next: express.NextFunction
            ) => any;

              method off

              off: (
              name: 'buildEnd' | 'bundled' | 'buildStart' | 'buildError',
              cb: (...any: any[]) => void
              ) => void;

                method on

                on: {
                (name: 'buildEnd', cb: () => void): void;
                (name: 'bundled', cb: (bundle: ParcelBundler.ParcelBundle) => void): void;
                (name: 'buildStart', cb: (entryPoints: string[]) => void): void;
                (name: 'buildError', cb: (error: Error) => void): void;
                };

                  method serve

                  serve: (
                  port?: number,
                  https?: true | false | ParcelBundler.HttpsOptions,
                  host?: string
                  ) => Promise<any>;

                    Interfaces

                    interface HttpsOptions

                    interface HttpsOptions {}

                      property cert

                      cert?: string | undefined;
                      • Path to custom certificate

                        "./ssl/c.crt"

                      property key

                      key?: string | undefined;
                      • Path to custom key

                        "./ssl/k.key"

                      interface ParcelBundle

                      interface ParcelBundle {}

                        property assets

                        assets: Set<any>;
                        • A Set of all assets inside the bundle

                        property childBundles

                        childBundles: Set<any>;
                        • A Set of all child bundles

                        property entryAsset

                        entryAsset: any;
                        • The entryPoint of the bundle, used for generating the name and gathering assets.

                        property name

                        name: string;
                        • The name of the bundle (generated using Asset.generateBundleName() of entryAsset)

                        property offsets

                        offsets: Map<ParcelAsset, number>;
                        • A Map<Asset, number(line number inside the bundle)> of all the locations of the assets inside the bundle, used to generate accurate source maps

                        property parentBundle

                        parentBundle?: any;
                        • The parent bundle, is null in case of the entry bundleany

                        property siblingBundles

                        siblingBundles: Set<any>;
                        • A Set of all sibling bundles

                        property siblingBundlesMap

                        siblingBundlesMap: Map<string, ParcelBundle>;
                        • A Map<String(Type: js, css, map, ...), Bundle> of all sibling bundles

                        property type

                        type: string;
                        • The type of assets it contains (e.g. js, css, map, ...)

                        interface ParcelOptions

                        interface ParcelOptions {}

                          property autoInstall

                          autoInstall?: boolean | undefined;
                          • Enable or disable auto install of missing dependencies found during bundling

                            true

                          property bundleNodeModules

                          bundleNodeModules?: true | false | undefined;
                          • By default, package.json dependencies are not included when using 'node' or 'electron' with the 'target' option.

                            Set to true to add them to the bundle.

                            false

                          property cache

                          cache?: boolean | undefined;
                          • Enabled or disables caching

                            true

                          property cacheDir

                          cacheDir?: string | undefined;
                          • The directory cache gets put in

                            ".cache"

                          property contentHash

                          contentHash?: boolean | undefined;
                          • Disable content hash from being included on the filename

                            false

                          property detailedReport

                          detailedReport?: boolean | undefined;
                          • Prints a detailed report of the bundles, assets, filesizes and times

                            Reports are only printed if watch is disabled

                            false

                          property global

                          global?: string | undefined;
                          • Expose modules as UMD under this name, disabled by default

                          property hmr

                          hmr?: true | false | undefined;
                          • Enable or disable HMR while watching

                            false

                          property hmrHostname

                          hmrHostname?: string | undefined;
                          • A hostname for hot module reload

                            ""

                          property hmrPort

                          hmrPort?: 0 | number | undefined;
                          • The port the HMR socket runs on

                            Defaults to a random free port (0 in node.js resolves to a random free port)

                            0

                          property https

                          https?: true | false | HttpsOptions | undefined;
                          • Define a custom {key, cert} pair

                            Use true to generate one or false to use http

                          property logLevel

                          logLevel?: 3 | 2 | 1 | undefined;
                          • 3 = log everything, 2 = log warnings & errors, 1 = log errors

                            3

                          property minify

                          minify?: boolean | undefined;
                          • Minify files

                            process.env.NODE_ENV === 'production'

                          property outDir

                          outDir?: string | undefined;
                          • The out directory to put the build files in

                            "./dist"

                          property outFile

                          outFile?: string | undefined;
                          • The name of the outputFile

                            "index.html"

                          property publicUrl

                          publicUrl?: string | undefined;
                          • The url to server on

                            "./"

                          property scopeHoist

                          scopeHoist?: boolean | undefined;
                          • Turn on experimental scope hoisting/tree shaking flag, for smaller production bundles

                            false

                          property sourceMaps

                          sourceMaps?: boolean | undefined;
                          • Enable or disable sourcemaps

                            Defaults to enabled (not supported in minified builds yet)

                            true

                          property target

                          target?: 'browser' | 'node' | 'electron' | undefined;
                          • "browser"

                          property watch

                          watch?: boolean | undefined;
                          • Whether to watch the files and rebuild them on change

                            process.env.NODE_ENV !== 'production'

                          Type Aliases

                          type ParcelAsset

                          type ParcelAsset = any;

                            Package Files (1)

                            Dependencies (1)

                            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/parcel-bundler.

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