JSPM

  • Created
  • Published
  • Downloads 19511
  • Score
    100M100P100Q148947F
  • License MIT

load plugins and prepare them to run

Package Exports

  • @putout/engine-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@putout/engine-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@putout/engine-loader NPM version Dependency Status

Load putout plugins, processors.

Install

npm i @putout/engine-loader

Code Example

loadPlugins

const {loadPlugins} = require('@putout/engine-loader');

const pluginNames = [
    'remove-unusede-variables',
];

const rules = {
    'remove-unused-variables': 'on',
};

const plugins = loadPlugins({
    cache: true, //default
    pluginNames,
    rules,
});

JSCodeshift

@putout/engine-loader supports loading transforms written for jscodeshift with help of prefix jscodeshift/.

const pluginNames = [
    'jscodeshift/async-await-codemod',
];

const rules = {
    'jscodeshift/async-await-codemod': ['on', 'any message you like :)'],
};

const plugins = loadPlugins({
    pluginNames,
    rules, // optional
});

Babel Plugins

You can use babel plugins with help of babel/ prefix.

Example Let's use two plugins:

  • babel-plugin-transform-inline-consecutive-adds
  • @babel/plugin-codemod-object-assign-to-object-spread

@putout/engine-loader will gues the prefix of plugin :).

const pluginNames = [
    'babel/transform-inline-consecutive-adds',
    'babel/codemod-object-assign-to-object-spread',
];

const plugins = loadPlugins({
    pluginNames,
});

loadProcessors

const {loadProcessors} = require('@putout/engine-loader');

const plugins = loadProcessors({
    processors: [
        ['javascript', 'on'],
        ['markdown', 'off'],
    ],
});

License

MIT