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

babel-plugin-replace-exports

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

babel-plugin-replace-exports

Babel plugin for replace all exports with dynamic values.

  • 0.1.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-replace-exports

Babel plugin for replace all exports with dynamic values.

Input:

// server/serverApi.js
export function someServerApi(params) {
  // server side logic...
}

Output:

import { createAjaxApi as _factory } from '@/lib/createAjaxApi'
var _filename = 'server/serverApi.js'
export var someServerApi = /*#__PURE__*/_factory(_filename, 'someServerApi')

Plugin will remove anything except re-exports.

Options

factory

required, string.

Factory module name.

Example:

// { factory: 'foo' }
import { default as _factory } from 'foo';

basepath

string, defaults to cwd.

Specify basepath for resolving file name.

includes

Array<string>, defaults to null.

If specified, plugin will only transpile specific files. It uses micromatch for matching file names.

factoryImportName

string, defaults to 'default'.

Import name of the factory function.

Example:

// { factoryImportName: 'myCustomImport' }
import { myCustomImport as _factory } from '@/lib/createAjaxApi';

mapFilename

function, defaults to v => v.

Transform filename passed to the factory.

Example:

// { mapFilename: (filename, state) => filename.replace(/\.js$/, '') }
var _filename = 'server/serverApi'

FAQs

Package last updated on 03 May 2021

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