Socket
Socket
Sign inDemoInstall

@babel/helper-module-imports

Package Overview
Dependencies
4
Maintainers
4
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

@babel/helper-module-imports

Babel helper functions for inserting module loads

    7.22.15latest
    GitHub
    npm

Version published
Maintainers
4
Weekly downloads
40,252,234
increased by5.41%

Weekly downloads

Package description

What is @babel/helper-module-imports?

The @babel/helper-module-imports package is a utility that allows Babel plugins to add module imports to a file in a consistent way. It provides functions to programmatically add import statements or require calls within the code being transformed by Babel.

What are @babel/helper-module-imports's main functionalities?

addDefault

Adds a default import statement to the file. For example, it can add `import lodash from 'lodash';` to the code.

import { addDefault } from '@babel/helper-module-imports';
const path = /* ... */;
const imported = addDefault(path, 'lodash', { nameHint: 'lodash' });

addNamed

Adds a named import statement to the file. For example, it can add `import { map } from 'lodash';` to the code.

import { addNamed } from '@babel/helper-module-imports';
const path = /* ... */;
const imported = addNamed(path, 'map', 'lodash', { nameHint: 'map' });

addNamespace

Adds a namespace import statement to the file. For example, it can add `import * as lodash from 'lodash';` to the code.

import { addNamespace } from '@babel/helper-module-imports';
const path = /* ... */;
const imported = addNamespace(path, 'lodash', { nameHint: 'lodash' });

addSideEffect

Adds an import statement that will include a module for its side effects only, without importing any bindings. For example, it can add `import 'normalize.css';` to the code.

import { addSideEffect } from '@babel/helper-module-imports';
const path = /* ... */;
addSideEffect(path, 'normalize.css');

Other packages similar to @babel/helper-module-imports

Changelog

Source

v7.22.15 (2023-09-04)

:bug: Bug Fix
  • babel-core
    • #15923 Only perform config loading re-entrancy check for cjs (@nicolo-ribaudo)
:house: Internal
  • babel-cli, babel-core, babel-generator, babel-helper-builder-binary-assignment-operator-visitor, babel-helper-compilation-targets, babel-helper-create-class-features-plugin, babel-helper-create-regexp-features-plugin, babel-helper-member-expression-to-functions, babel-helper-module-imports, babel-helper-module-transforms, babel-helper-transform-fixture-test-runner, babel-helper-validator-identifier, babel-helper-validator-option, babel-helpers, babel-node, babel-parser, babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression, babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining, babel-plugin-proposal-decorators, babel-plugin-proposal-destructuring-private, babel-plugin-proposal-pipeline-operator, babel-plugin-transform-async-generator-functions, babel-plugin-transform-block-scoping, babel-plugin-transform-classes, babel-plugin-transform-destructuring, babel-plugin-transform-for-of, babel-plugin-transform-modules-commonjs, babel-plugin-transform-object-rest-spread, babel-plugin-transform-optional-chaining, babel-plugin-transform-parameters, babel-plugin-transform-property-mutators, babel-plugin-transform-react-jsx, babel-plugin-transform-runtime, babel-plugin-transform-typescript, babel-preset-env, babel-preset-flow, babel-preset-react, babel-preset-typescript, babel-register, babel-standalone, babel-template, babel-traverse, babel-types

Readme

Source

@babel/helper-module-imports

Babel helper functions for inserting module loads

See our website @babel/helper-module-imports for more information.

Install

Using npm:

npm install --save @babel/helper-module-imports

or using yarn:

yarn add @babel/helper-module-imports

FAQs

Last updated on 04 Sep 2023

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc