Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@putout/engine-loader
Advanced tools
Readme
🐊Putout loader for plugins
and processors
.
npm i @putout/engine-loader
Loader supports two kinds of plugins:
Simplest type of plugin support by @putout/engine-runner
, contains one rule.
Nested contains one or more rules:
module.exports.rules = {
'remove-unused-variables': require('@putout/plugin-remove-unused-variables'),
};
When you want to make it disabled by default, use:
module.exports.rules = {
'remove-unused-variables': ['off', require('@putout/plugin-remove-unused-variables')],
};
So when someone using your plugin, he needs to enable it:
{
"rules": {
"nested/remove-unused-variables": "on"
},
"plugins": ["nested"]
}
When you need to get things working with Yarn PnP, and using custom plugins
formatters
or processors
, add env variable
PUTOUT_YARN_PNP
with name of a package that contains dependencies you need.
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,
});
import
You can also use schema like this one:
import:escover/plugin
const plugins = loadPlugins({
pluginNames: [
'import:commonjs-putout-plugin',
],
});
Load ESM plugins:
const {loadPluginsAsync} = require('@putout/engine-loader');
const pluginNames = [
'remove-unusede-variables',
];
const rules = {
'remove-unused-variables': 'on',
};
const plugins = await loadPluginsAsync({
cache: true, //default
pluginNames,
rules,
});
import
You can also use schema like this one:
import:escover/plugin
const plugins = await loadPluginsAsync({
pluginNames: [
'import:escover/plugin',
],
});
Or when used putoutAsync
:
import {putoutAsync} from 'putout';
await putoutAsync(`module.exports.hello = 'world'`, {
plugins: [
'import:escover/plugin',
],
});
Which is the same as:
import {putoutAsync} from 'putout';
import * as plugin from 'escover/plugin';
await putoutAsync(`module.exports.hello = 'world'`, {
plugins: [
['escover/plugin', plugin],
],
});
Or used inside .putout.json
:
{
"plugins": [
"import:escover/plugin"
]
}
const {loadProcessors} = require('@putout/engine-loader');
const optionalLoad = async (a) => await import(a);
const plugins = await loadProcessorsAsync({
processors: [
['javascript', 'on'],
['markdown', 'off'],
],
}, optionalLoad);
Gives ability to create loader for processor
or formatter
.
const {createAsyncLoader} = require('@putout/engine-loader');
const {loadProcessor} = createAsyncLoader('processor');
// load @putout/processor-markdown
await loadProcessors('markdown');
// load @putout/processor-json using custom loader
await loadProcess('json', () => {
return Promise.resolve(`will be called instead of 'import'`);
});
MIT
FAQs
load plugins and prepare them to run
The npm package @putout/engine-loader receives a total of 16,141 weekly downloads. As such, @putout/engine-loader popularity was classified as popular.
We found that @putout/engine-loader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.