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

@hqjs/babel-plugin-resolve-modules

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hqjs/babel-plugin-resolve-modules

Transform name imports for web browser

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

http://hqjs.org

Resolve module names

Installation

npm install hqjs@babel-plugin-resolve-modules

Usage

{
  "plugins": [[ "hqjs@babel-plugin-resolve-modules", {
      "resolve": {
        "foo": "/packages/foo",
        "bar/*": "/packages/bar/",
        "baz/b": "/packages/baz/b",
        "baz/b/*": "/packages/baz/b/",
        "qux_": "/packages/qux"
      }
    }]]
}

Transformation

Plugin will resolve provided modules according to schema. In the example above foo and baz/b are exact transformations so only exact occurance of this names would be transformed, while bar/* and baz/b/* are wildcards, meaning all pathes started with bar/ and baz/b/ would be transformed. Special character _ mean both exact and wildcard matches.

Plugin is stupid and simple so be careful with backslashes.

So script

require('foo');
require('foo/a');
require('bar');
require('bar/a');
require('baz/b');
require('baz/b/c');
require('qux');
require('qux/a');

import 'foo';
import 'foo/a';
import 'bar';
import 'bar/a';
import 'baz/b';
import 'baz/b/c';
import 'qux';
import 'qux/a';

export * from 'foo';
export * from 'foo/a';
export * from 'bar';
export * from 'bar/a';
export * from 'baz/b';
export * from 'baz/b/c';
export * from 'qux';
export * from 'qux/a';

export {foo} from 'foo';
export {fooA} from 'foo/a';
export {bar} from 'bar';
export {barA} from 'bar/a';
export {bazB} from 'baz/b';
export {bazC} from 'baz/b/c';
export {qux} from 'qux';
export {quxA} from 'qux/a';

will turn into

require("/packages/foo");
require('foo/a');
require('bar');
require("/packages/bar/a");
require("/packages/baz/b");
require("/packages/baz/b/c");
require('/packages/qux');
require('/packages/qux/a');

import "/packages/foo";
import 'foo/a';
import 'bar';
import "/packages/bar/a";
import "/packages/baz/b";
import "/packages/baz/b/c";
import '/packages/qux';
import '/packages/qux/a';

export * from "/packages/foo";
export * from 'foo/a';
export * from 'bar';
export * from "/packages/bar/a";
export * from "/packages/baz/b";
export * from "/packages/baz/b/c";
export * from '/packages/qux';
export * from '/packages/qux/a';

export { foo } from "/packages/foo";
export { fooA } from 'foo/a';
export { bar } from 'bar';
export { barA } from "/packages/bar/a";
export { bazB } from "/packages/baz/b";
export { bazC } from "/packages/baz/b/c";
export {qux} from '/packages/qux';
export {quxA} from '/packages/qux/a';

Keywords

FAQs

Package last updated on 02 Aug 2020

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