GithubHelp home page GithubHelp logo

web-logs2 / babel-plugin-tiny-import Goto Github PK

View Code? Open in Web Editor NEW

This project forked from imcuttle/babel-plugin-tiny-import

0.0 0.0 0.0 70 KB

split import from wrap package

License: MIT License

JavaScript 80.46% TypeScript 19.54%

babel-plugin-tiny-import's Introduction

babel-plugin-tiny-import

Feature

  • wrap.js
export {default as Tool, toolFunction as outerToolFunction} from 'lib/tool';
export * from 'lib/utils';
export {resolve as rlv} from 'lib/path';

exports.join = require('lib/path/join');
module.exports.join = require('lib/path/extname');
module.exports.extname = require('lib/path-2/extname');

export {default as default} from 'index/join';

Input:

import {rlv, join as Join} from 'wrap'
const {outerToolFunction: $outerToolFunction} = require('wrap')

Output:

import { resolve as rlv } from "lib/path";
import Join from "lib/path/extname";
const $outerToolFunction = require("lib/tool").toolFunction;

Options

{
    test: /^wrap$/, // RegExp | Function | String
    moduleMapper: {} // {} | string | (imported, moduleName) => moduleName | {moduleName: string, ref: string},
    easyModuleMapper: {
        // `true` means that opt.moduleMapper will be regarded as filename
        enable: true,
        // watch the opt.moduleMapper file's change.
        watch: true,
        // the basename of opt.moduleMapper file's *Relative Module*.
        basename: false, // true | false | string
    },
}

Note!!!

the syntax of require is not supported yet, which are as follow.

  • wrap.js
exports.supported = require('lib/total/support');
// MemberExpression
exports.notSupported = require('lib/total').notSupported;
  • Input
// MemberExpression
const notSupported = require('wrap').supported;
const {notSupported: alsoNotSupported} = require('wrap');

let {supported} = require('@befe/wrap');
  • Output
const notSupported = require('wrap').supported;
const {notSupported: alsoNotSupported} = require('wrap');

let supported = require('lib/total/support');

babel-plugin-tiny-import's People

Contributors

imcuttle 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.