1.0.3 • Published 3 months ago

babel-plugin-tiny-import v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
3 months ago

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
        resolvePackageAsAbsolute, // boolean | https://www.npmjs.com/package/resolve options, false by default
    },
}

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');
1.0.3

3 months ago

1.0.2

3 months ago

1.0.1

3 months ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago