@babel/helper-module-imports

  • Version 8.0.0
  • Published
  • 66.2 kB
  • 2 dependencies
  • MIT license

Install

npm i @babel/helper-module-imports
yarn add @babel/helper-module-imports
pnpm add @babel/helper-module-imports

Overview

Babel helper functions for inserting module loads

Index

Functions

function addDefault

addDefault: (
path: NodePath,
importedSource: string,
opts?: Partial<ImportOptions>
) => t.Identifier | t.MemberExpression | t.SequenceExpression;

    function addNamed

    addNamed: {
    (
    path: NodePath,
    name: string,
    importedSource: string,
    opts?: Omit<
    Partial<ImportOptions>,
    'ensureLiveReference' | 'ensureNoContext'
    >
    ): t.Identifier;
    (
    path: NodePath,
    name: string,
    importedSource: string,
    opts?: Omit<Partial<ImportOptions>, 'ensureLiveReference'> & {
    ensureLiveReference: true;
    }
    ): t.MemberExpression;
    (
    path: NodePath,
    name: string,
    importedSource: string,
    opts?: Omit<Partial<ImportOptions>, 'ensureNoContext'> & {
    ensureNoContext: true;
    }
    ): t.SequenceExpression;
    };

      function addNamespace

      addNamespace: (
      path: NodePath,
      importedSource: string,
      opts?: Partial<ImportOptions>
      ) => t.Identifier | t.MemberExpression | t.SequenceExpression;

        function addSideEffect

        addSideEffect: (
        path: NodePath,
        importedSource: string,
        opts?: Partial<ImportOptions>
        ) => t.Identifier | t.MemberExpression | t.SequenceExpression;

          function isModule

          isModule: (path: NodePath<t.Program>) => boolean;
          • A small utility to check if a file qualifies as a module.

          Classes

          class ImportInjector

          class ImportInjector {}
          • A general helper classes add imports via transforms. See README for usage.

          constructor

          constructor(
          path: NodePath,
          importedSource?: string,
          opts?: Partial<ImportOptions>
          );

            method addDefault

            addDefault: (
            importedSourceIn: string,
            opts: Partial<ImportOptions> | undefined
            ) => t.Identifier | t.MemberExpression | t.SequenceExpression;

              method addNamed

              addNamed: (
              importName: string,
              importedSourceIn: string,
              opts: Partial<ImportOptions> | undefined
              ) => t.Identifier | t.MemberExpression | t.SequenceExpression;

                method addNamespace

                addNamespace: (
                importedSourceIn: string,
                opts: Partial<ImportOptions> | undefined
                ) => t.Identifier | t.MemberExpression | t.SequenceExpression;

                  method addSideEffect

                  addSideEffect: (
                  importedSourceIn: string,
                  opts: Partial<ImportOptions> | undefined
                  ) => t.Identifier | t.MemberExpression | t.SequenceExpression;

                    Package Files (1)

                    Dependencies (2)

                    Dev Dependencies (1)

                    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/@babel/helper-module-imports.

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