Coder Social home page Coder Social logo

babel-plugin-transform-module-imports's Introduction

babel-plugin-transform-module-imports

Build Status codecov.io

Fork of babel-plugin-transform-modules to Support babel7

Installation

npm install --save-dev babel-plugin-transform-module-imports

Usage

In .babelrc:

{
    "plugins": [
        ["transform-module-imports", {
            "typed-is": {
                "transform": "typed-is/lib/${member}",
                "preventFullImport": true
            },
               "@roseys/futils": {
                "transform": "@roseys/futils/lib/${member}",
                "preventFullImport": true
            },
        }
        ]
    ]
}

Transforms member style imports:

import { isFunction, isString} from 'typed-is';
import { reduce, pipe} from '@roseys/futils';

...into default style imports:

import isFunction from 'typed-is/lib/isFunction';
import isString from 'typed-is/lib/isString';
import reduce from '@roseys/futils/lib/reduce';
import pipe from '@roseys/futils/lib/pipe';

Options

Name Type Required Default Description
transform string yes undefined The library name to use instead of the one specified in the import statement. ${member} will be replaced with the member, aka Grid/Row/Col/etc. Alternatively, pass a path to a .js file which exports a function to process the transform (see Advanced Transformations)
style boolean,string,object no false Whether or not auto add css style import, if set to true, it will be same as set to 'style'. If set to {name:'sty',ignore:['x', 'y']}, it means all member modules except ['x', 'y'] will be auto add css import with name 'sty.css'
preventFullImport boolean no false Whether or not to throw when an import is encountered which would cause the entire module to be imported.
camelCase boolean no false When set to true, runs ${member} through _.camelCase.
kebabCase boolean no false When set to true, runs ${member} through _.kebabCase.
snakeCase boolean no false When set to true, runs ${member} through _.snakeCase.
skipDefaultConversion boolean no false When set to true, will preserve import { X } syntax instead of converting to import X.

babel-plugin-transform-module-imports's People

Contributors

joshrosenstein avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.