@putout/engine-processor
run processors
Last updated 4 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/engine-processor 
SYNC missed versions from official npm registry.

@putout/engine-processor NPM version

🐊Putout processor that runs all engines according to supported file types.

npm i @putout/engine-processor

Code Example

const {
    getProcessorRunners,
    runProcessors,
} = require('@putout/engine-processor');

const processorRunners = await getProcessorRunners(processors);
const optionalLoader = async (a) => await import(a);

await getProcessorRunners(processors, optionalLoader);

await runProcessors({
    name,
    process,
    options,
    rawSource,
    index,
    length,
    processorRunners, // optional
    load, // when you need to override 'import()'
});

// returns
({
    isProcessed,
    places,
    processedSource,
});

Processor Example

Simplest possible processor example can be written in both CommonJS or ESM and look like this:

export const files = ['*.js'];

export const find = (source) => {
    return places;
};

export const fix = (source) => {
    return `modified ${source}`;
};

export const branch = (source) => {
    return [{
        source,
        startLine: 0,
    }];
};

export const merge = (source, list) => {
    return list[0];
};

Instead of find and fix you can export lint:

import eslint from '@putout/eslint';

export const files = ['*.js'];

export const lint = async (source, {fix}) => {
    const [code, places] = await eslint(source, {
        fix,
    });
    
    return [code, places];
};

License

MIT

License

MIT

Current Tags

  • 13.0.0                                ...           latest (a month ago)

48 Versions

  • 13.0.0                                ...           a month ago
  • 12.0.0                                ...           4 months ago
  • 11.4.0                                ...           6 months ago
  • 11.3.0                                ...           6 months ago
  • 11.2.0                                ...           10 months ago
  • 11.1.1                                ...           a year ago
  • 11.1.0                                ...           a year ago
  • 11.0.0                                ...           a year ago
  • 10.0.0                                ...           a year ago
  • 9.0.0                                ...           a year ago
  • 8.0.1                                ...           a year ago
  • 8.0.0                                ...           a year ago
  • 7.0.1                                ...           2 years ago
  • 7.0.0                                ...           2 years ago
  • 6.4.2                                ...           2 years ago
  • 6.4.1                                ...           2 years ago
  • 6.4.0                                ...           2 years ago
  • 6.3.0                                ...           2 years ago
  • 6.2.0                                ...           2 years ago
  • 6.1.0                                ...           3 years ago
  • 6.0.0                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 4.0.1                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.2.0                                ...           4 years ago
  • 3.1.0                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.8.1                                ...           4 years ago
  • 2.8.0                                ...           4 years ago
  • 2.7.0                                ...           4 years ago
  • 2.6.2                                ...           4 years ago
  • 2.6.1                                ...           4 years ago
  • 2.6.0                                ...           4 years ago
  • 2.5.0                                ...           4 years ago
  • 2.4.1                                ...           4 years ago
  • 2.4.0                                ...           4 years ago
  • 2.3.1                                ...           4 years ago
  • 2.3.0                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.3.1                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (13)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE