open-index/open-npm huggingface dataset:
npm package: @putiaweb-org/hyperinstant
Description: HyperInstant: instant-like navigation with hover + idle link crawl prefetch for same-origin links.
Author: Simone Gaglio
Latest version: 2.0.0

# HyperInstant (v2)

HyperInstant is a tiny, dependency-free library inspired by **Instant Page**.

It speeds up navigation by **prefetching internal pages** using:

- **Hover prefetch** (Instant Page style)
- **Idle Crawl Prefetch**: after the current page is fully loaded, HyperInstant scans same-origin links (menu, buttons, etc.) and prefetches the best candidates **one by one**, respecting budgets and network safety.

## Install

```bash
npm i hyperinstant
```

## Usage

### Basic

```js
import { init } from 'hyperinstant';

init();
```

### With options

```js
import { init } from 'hyperinstant';

init({
  maxLinksPerPage: 6,
  maxConcurrent: 1,
  enableHover: true,
  enableIdleCrawl: true,
  method: 'link-prefetch', // or 'fetch'
  ignoreSelector: '[data-hyperinstant="ignore"], .no-prefetch',
  onPrefetch: (url, method) => console.log('prefetch', method, url)
});
```

### Opt-out (per link)

```html
<a href="/checkout" data-hyperinstant="ignore">Checkout</a>
```

## How it decides what to prefetch

During **Idle Crawl Prefetch**, HyperInstant scores internal links:

1. Links **in the viewport** get highest priority
2. Links inside **header/nav** get a boost
3. Links that look like **CTA buttons** get a boost
4. Links with `data-hyperinstant-priority="<number>"` get extra priority

Then it picks up to `maxLinksPerPage` links and prefetches them progressively during idle time.

## Safety rules

- Respects `Save-Data`
- Avoids slow connections via `navigator.connection.effectiveType`
- Stops/aborts when the tab is hidden
- Excludes common action URLs like `?add-to-cart=`, `/cart`, `/checkout`, `/my-account`, `/wp-admin`, etc.

## License

MIT
npm package: @putiikkipalvelu/storefront-sdk
Description: TypeScript SDK for Putiikkipalvelu Storefront API
Author: Putiikkipalvelu
Latest version: 0.7.3

# @putiikkipalvelu/storefront-sdk

> **Alpha (0.x)**: API may change between versions

TypeScript SDK for building headless storefronts with Putiikkipalvelu.

## Installation

```bash
npm install @putiikkipalvelu/storefront-sdk
```

## Quick Start

```typescript
import { createStorefrontClient } from '@putiikkipalvelu/storefront-sdk';

const storefront = createStorefrontClient({
  apiKey: process.env.STOREFRONT_API_KEY!,
  baseUrl: 'https://putiikkipalvelu.fi/api/storefront/v1',
});

// Get store configuration
const config = await storefront.store.getConfig();
console.log(config.store.name);
```

## Next.js Integration

```typescript
// lib/storefront.ts
import { createStorefrontClient } from '@putiikkipalvelu/storefront-sdk';

export const storefront = createStorefrontClient({
  apiKey: process.env.STOREFRONT_API_KEY!,
  baseUrl: process.env.NEXT_PUBLIC_STOREFRONT_API_URL!,
});
```

### With Caching

```typescript
const config = await storefront.store.getConfig({
  next: { revalidate: 300, tags: ['store-config'] }
});
```

## Error Handling

```typescript
import {
  createStorefrontClient,
  AuthError,
  NotFoundError,
  StorefrontError
} from '@putiikkipalvelu/storefront-sdk';

try {
  const config = await storefront.store.getConfig();
} catch (error) {
  if (error instanceof AuthError) {
    // Invalid API key
  } else if (error instanceof NotFoundError) {
    // Resource not found
  } else if (error instanceof StorefrontError) {
    // Other API error
    console.error(error.code, error.message);
  }
}
```

## TypeScript

All types are exported for use in your application:

```typescript
import type {
  StoreConfig,
  StoreInfo,
  Product,
  Campaign
} from '@putiikkipalvelu/storefront-sdk';
```

## Available Resources

- `store.getConfig()` - Store configuration, SEO, payments, campaigns

More resources coming soon.

## License

MIT
npm package: @putout/babel
Description: Babel 8 bundled
Author: coderaiser
Latest version: 5.4.2

# @putout/babel [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/babel.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/babel "npm"

Pre-builts of [Babel 8](https://github.com/babel/babel/releases/tag/v8.0.0-rc.3).
Includes:

- [parseClass typings cleanup ](https://github.com/babel/babel/pull/17901)

Usage

```js
import {
    parse,
    types,
    generate,
    template,
    codeFrameColumns,
} from '@putout/babel';
```

## License

MIT
npm package: @putout/bundle
Description: 🐊Putout bundle suitable for Deno and Browsers
Author: coderaiser
Latest version: 5.4.1

# @putout/bundle [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/bundle.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/bundle "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) bundle to get things working in [**Deno**](https://deno.land) and **Browsers** using amazing [esm.sh](https://esm.sh).

Usage:

```js
import {putout} from 'https://esm.sh/@putout/bundle';
import removeDebugger from 'https://esm.sh/@putout/plugin-remove-debugger?alias=putout:@putout/bundle';
import declare from 'https://esm.sh/@putout/plugin-declare-undefined-variables?alias=putout:@putout/bundle';

console.log(putout('isFn(fn, "hello"); debugger', {
    plugins: [
        ['remove-debugger', removeDebugger],
        ['declare-undefined-variables', declare],
    ],
}));

// returns
({
    code: `const isFn = a => typeof a === 'function';\nisFn(fn, "hello");`,
    places: [],
});
```

When you need to use `@putout/plugin-putout` use:

```js
import {putout} from 'https://esm.sh/@putout/bundle';
import pluginPutout from 'https://esm.sh/@putout/plugin-putout?alias=putout:@putout/bundle';

console.log(putout('compare(a, b)', {
    plugins: [
        ['putout', pluginPutout],
    ],
}));

// returns
({
    code: `const {operator} = require('putout');\nconst {compare} = operator;\ncompare(a, b)`,
    places: [],
});
```

## Slim

When you need super slim bundle without `debug` use:


```js
import {putout} from 'https://esm.sh/@putout/bundle/slim';
```

## License

MIT
npm package: @putout/bundler
Description: Lint Filesystem with 🐊Putout
Author: coderaiser
Latest version: 4.0.2

# Bundler [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]

[NPMURL]: https://npmjs.org/package/@putout/bundler "npm"
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/bundler.svg?style=flat&longCache=true
[BuildStatusURL]: https://github.com/putoutjs/printer/actions/workflows/nodejs.yml "Build Status"
[BuildStatusIMGURL]: https://github.com/putoutjs/printer/actions/workflows/nodejs.yml/badge.svg
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[CoverageURL]: https://coveralls.io/github/putoutjs/printer?branch=master
[CoverageIMGURL]: https://coveralls.io/repos/putoutjs/printer/badge.svg?branch=master&service=github

## Install

```
npm i @putout/bundle
```

## API

```js
import {bundle} from '@putout/bundler';

console.log(bundle(CWD, entry, filesystem));
```

## Internals

### Convert ESM to CommonJS

To Simplify things up all files converted to CommonJS first.
Let's suppose none of them use top-level await to get things simpler.

### Parse filenames

Traverse all files starting from `entry` and get all filenames.

- [`parse-require`](https://putout.cloudcmd.io/#/gist/d973366be6b07ab705b5c9d793369904/ca8b6b15fa953d95f57b42e07136c65791f38ca1);
- [`parse-filenames`](https://putout.cloudcmd.io/#/gist/d973366be6b07ab705b5c9d793369904/3067150ad161029e75b95e9bfff290e03953ef41);
- [`resolve-filenames`](https://putout.cloudcmd.io/#/gist/8ca1ac9b5fb4d1a47d185836c3f0b393/edf99b8064fe0faf4545aa0cc66138a7fa34c557);
- [`resolve-require`](https://putout.cloudcmd.io/#/gist/833539f66cb238fcc3b6ca6cee61ef9e/79a068c96b686bb0eacdf3f570d532981499b114);
- [`bundle-files`](https://putout.cloudcmd.io/#/gist/7dd3bffa8e88f7542c84065f622b63d7/3b1e68e0babc3a72af947076ed9801c0034a096e);

### Bundle all files to object

Traverse filesystem and create object that contains filename and file content:

```js
const __filesystem = {
    '/entry.js': () => {
        const client = require('/client.js');
        console.log(client);
    },
    '/client.js': (exports, require, module) => {
        module.exports = 'hello';
    },
};
```

### IIFE

Most likely we need IIFE so couple bundles can be loaded on page simultaneously.

### Result Example

```js
const __modules = {};
const __filesystem = {
    '/entry.js': () => {
        const client = require('/client.js');
        console.log(client);
    },
    '/client.js': (exports, require, module) => {
        module.exports = 'hello';
    },
};

const require = (name) => {
    const exports = {};
    const module = {
        exports,
    };
    
    if (__modules[name])
        return __modules[name];
    
    __filesystem[name](exports, require, module);
    __modules[name] = module.exports;
    
    return module.exports;
};

require('/entry.js');
```

## License

MIT
npm package: @putout/cli-cache
Description: The cache of Places found by 🐊Putout
Author: coderaiser
Latest version: 6.0.2

# @putout/cli-cache [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/cli-cache.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/cli-cache "npm"

Store to `cache` information about files processed by 🐊[Putout](https://github.com/coderaiser/putout) to nearest `node_modules/.cache` directory.

## Install

```
npm i @putout/cli-cache
```

## Example

```js
import {createCache} from '@putout/cli-cache';

const fileCache = await createCache({
    version,
    cache,
    fresh,
});

const places = fileCache.getPlaces(name);

fileCache.canUseCache(name, options);
fileCache.removeEntry(name);
fileCache.setInfo(name, places, options);
fileCache.reconcile();
```

## License

MIT
npm package: @putout/cli-choose
Description: show select to choose one item from list
Author: coderaiser
Latest version: 4.0.0

# @putout/cli-choose [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/cli-choose.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/cli-choose "npm"

Show ui to choose one item from list.

## Install

```
npm i @putout/cli-choose
```

## Examples

```js
import {choose} from '@putout/cli-choose';

choose('hello?', [
    'one',
    'two',
    'three',
    'four',
]);

// returns
'one';
```

When you need to set focus use `autofocus`:

```js
import {choose} from './lib/choose.js';

const choices = [
    'one',
    'two',
    'three',
    'four',
];

choose('hello?', items, {
    autofocus: 3,
});

// show ui with focus on item 'three'.
```

## License

MIT
npm package: @putout/cli-choose-formatter
Description: Choose formatter from the list
Author: coderaiser
Latest version: 7.0.0

# @putout/cli-choose-formatter [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/cli-choose-formatter.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/cli-choose-formatter "npm"

Show ui to choose-formatter one item from list.

## Install

```
npm i @putout/cli-choose-formatter
```

## Examples

```js
import {chooseFormatter} from '@putout/cli-choose-formatter';

await chooseFormatter('progress-bar', ['dump', 'progress-bar']);
```

## License

MIT
npm package: @putout/cli-filesystem
Description: API to help lint filesystem
Author: coderaiser
Latest version: 3.0.0

# @putout/cli-filesystem [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/cli-filesystem.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/cli-filesystem "npm"

API to lint filesystem.

## Install

```
npm i @putout/cli-filesystem
```

## API

### `renameFile(from: string, to: string)`

```js
renameFile('/hello/world.txt', '/hello/hello.txt');
```

### `removeFile(filename: string)`

```js
removeFile('/hello/world.txt');
```

### `copyFile(from: string, to: string)`

```js
copyFile('/hello/world.txt', '/hello/hello.txt');
```

### `createDirectory(name: string)`

```js
createDirectory('/hello/world');
```

### `readFileContent(name: string)`

```js
readFileContent('/hello/world');
// returns
'hello';
```

### `writeFileContent(name: string, content: string)`

If parent directory not exists - creates it.

```js
writeFileContent('/hello/world', 'hello');
readFileContent('/hello/world');
// returns
'hello';
```

## License

MIT
npm package: @putout/cli-keypress
Description: handle keypress
Author: coderaiser
Latest version: 4.0.0

# @putout/cli-keypress [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/cli-keypress.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/cli-keypress "npm"

`putout` keypress handler.

## Install

```
npm i @putout/cli-keypress
```

## Examples

```js
import {keypress} from 'keypress';

const {isStop} = keypress();

// do some stuff until ctrl+c pressed
async function again() {
    if (isStop())
        return;
    
    await again();
}
```

## Env Variables

`KEYPRESS=1` can be used to force enable `keypress`.

## License

MIT
npm package: @putout/cli-match
Description: convert "rules" section to "match" in .putout.json
Author: coderaiser
Latest version: 3.0.1

# @putout/cli-match [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/cli-match.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/cli-match "npm"

Read `.putout.json` and convert `rules`  into `match`.

## Install

```
npm i @putout/cli-match
```

```diff
{
-   "rules": {
-       "remove-debugger": "on"
+   "match": {
+       "*.md": {
+           "remove-debugger": "on"
+       }
    }
}
```

## Example

```js
import {cwd} from 'node:process';
import {readFile, writeFile} from 'node:fs/promises';
import match from '@putout/cli-match';

const {code, message} = await match({
    pattern,
    cwd: cwd(),
    readFile, // optional
    writeFile, // optional
});

console.log(message);
process.exit(code);
```

## License

MIT
npm package: @putout/cli-process-file
Description: Run all 🐊Putout linters
Author: coderaiser
Latest version: 7.0.0

# @putout/cli-process-file [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/cli-process-file.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/cli-process-file "npm"

Process file using 🐊**Putout**, **Samadhi** and **ESLint**.

## Install

```
npm i @putout/cli-process-file
```

## Example

```js
import {initProcessFile} from '@putout/cli-process-file';

const processFile = initProcessFile({
    fix: true,
});

const {code, places} = await processFile({
    source: `
        const a = b.a
    `,
});

// returns
['const {a} = b;', [{
    rule: 'no-undef (eslint)',
    message: '\'b\' is not defined.',
    position: {
        line: 2,
        column: 13,
    },
}]];
```

## License

MIT
npm package: @putout/cli-ruler
Description: toggle rules in .putout.json
Author: coderaiser
Latest version: 4.0.1

# @putout/cli-ruler [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/cli-ruler.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/cli-ruler "npm"

Ruler toggler for `.putout.json`.

## Install

```
npm i @putout/cli-ruler
```

## API

To create new file `.putout.json` and disable all rules defined by `places` use:

### disableAll

```js
import {readFile, writeFile} from 'node:fs/promises';
import {rule} from '@putout/cli-ruler';

const places = [{
    rule: 'remove-unused-variables',
    message: '"a" is defined but never used',
    position: {
        line: 3,
        column: 6,
    },
}];

const options = {
    disableAll: true,
    readFile,
    writeFile,
};

await ruler(places, options);
```

It will produce `.putout.json`:

```json
{
    "rules": {
        "remove-unused-variables": "off"
    }
}
```

Same with `enableAll`

### enable

To enable one rule with a name `remove-unused-variables` use:

```js
import {readFile, writeFile} from 'node:fs/promises';
import ruler from '@putout/cli-ruler';

const places = [];

const options = {
    enable: 'remove-unused-variables',
    readFile,
    writeFile,
};

await ruler(places, options);
```

It will produce `.putout.json`:

```json
{
    "rules": {
        "remove-unused-variables": "on"
    }
}
```

Same with `disable`.

## License

MIT
npm package: @putout/cli-staged
Description: handle staged
Author: coderaiser
Latest version: 3.0.0

# @putout/cli-staged [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/cli-staged.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/cli-staged "npm"

Get list of staged by `git` files for 🐊[**Putout**](https://github.com/coderaiser/putout).

## Install

```
npm i @putout/cli-staged
```

## Examples

```js
import {get, set} from '@putout/cli-staged';
import {findUp} from 'find-up';
import {tryToCatch} from 'try-to-catch';

const [error, names] = await tryToCatch(get, {
    findUp,
    isSupported: Boolean,
});

const stagedNames = await set({
    findUp,
});
```

## License

MIT
npm package: @putout/cli-validate-args
Description: validate args, sugest closest variant
Author: coderaiser
Latest version: 2.0.0

# @putout/cli-validate-args [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/cli-validate-args.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/cli-validate-args"npm"

Validate args and propose the closes variaint found by [fastest-levenshtein](https://www.npmjs.com/package/fastest-levenshtein):

```
Invalid option '--fi'. Perhaps you meant '--fix'`
```

## Install

```
npm i @putout/cli-validate-args
```

## Examples

```js
// validate-args.js
import {validateArgs} from '@putout/cli-validate-args';
import parse from 'yargs-parser';

const argv = process.argv.slice(2);

const yargsConfig = {
    configuration: {
        'strip-aliased': true,
        'strip-dashed': true,
    },
    number: ['fix-count'],
    boolean: ['fix'],
};

const args = parse(argv, yargsConfig);

const error = await validateArgs(args, [
    ...yargsConfig.boolean,
    ...yargsConfig.number,
]);

if (error) {
    console.error(error.message);
    process.exit(1);
}
```

```sh
$ node validate-args.js --fi
Invalid option '--fi'. Perhaps you meant '--fix'`
```

## License

MIT
npm package: @putout/engine-parser
Description: 🐊Putout parser
Author: coderaiser
Latest version: 15.1.2

# @putout/engine-parser [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/engine-parser.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/engine-parser "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) engine that parses input.

## Install

```
npm i @putout/engine-parser
```

## Supported parsers

- [@babel/parse](https://babeljs.io/docs/en/babel-parser)
- [acorn](https://github.com/acornjs/acorn)
- [espree](https://github.com/eslint/espree)
- [esprima](https://esprima.org/)
- [tenko](https://github.com/pvdz/tenko)

Any parser should be installed before use, but you can be sure that `@babel/parse` always installed.

## API

By default [`@putout/printer`](https://github.com/putoutjs/printer) used. It formats code according to [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#readme) rules but without using **ESLint**.

But you can also use `babel` with:

```js
const ast = parse(source);
const code = print(ast, {
    printer: 'babel',
});
```

When you need to pass options, use:

```js
const code = print(ast, {
    printer: ['putout', {
        format: {
            indent: '    ',
        },
    }],
});

print(ast, {
    printer: ['babel', {
        alignSpaces: false, // when you don't want to add spaces on empty lines
    }],
});
```

### print(ast [, options])

Print code from `ast`

### parse(code, [, options])

You can add `default options` for custom `parser` you use.

### template.fresh(code)

`parse` without `memoization`.

### template.ast(code)

create node using `memoization`.

### template.ast.fresh(code)

create node without `memoization`.

### template.extractExpression(code)

Extract `expression` node from `ExpressionStatement`.

#### Generate sourcemaps using Babel

To generate sourcemap using babel generator, you should use babel parser before.
This is low level transformation, because `Babel` doesn't preserve any formatting.

```js
import {generate} from '@putout/engine-parser';
import {parse} from '@putout/engine-parser/babel';

const ast = parse(source, {
    sourceFilename: 'hello.js',
});

generate(ast, {sourceMaps: true}, {
    'hello.js': source,
});

// returns
({
    code,
    map,
});
```

## Example

```js
import {parse} from '@putout/engine-parser';

const parser = 'acorn';

const code = parse('var t = "hello"', {
    parser,
});
```

## License

MIT
npm package: @putout/engine-processor
Description: 🐊Putout engine processor runner
Author: coderaiser
Latest version: 16.0.0

# @putout/engine-processor [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/engine-loader.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/engine-loader"npm"

🐊[**Putout**](https://github.com/coderaiser/putout) processor that runs all engines according to supported file types.

```
npm i @putout/engine-processor
```

## Code Example

```js
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:

```js
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`:

```js
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
npm package: @putout/engine-reporter
Description: Run 🐊Putout formatters
Author: coderaiser
Latest version: 8.0.8

# @putout/engine-reporter [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/engine-reporter.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/engine-reporter "npm"

Run 🐊[**Putout**](https://github.com/coderaiser/putout) formatters.

## Install

```
npm i @putout/engine-reporter
```

```js
import {initReport} from '@putout/engine-reporter/report';

const report = initReport();
```

## License

MIT
npm package: @putout/eslint-config
Description: 🐊Putout config for ESLint
Author: coderaiser
Latest version: 14.2.0

# @putout/eslint-config [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/eslint-config.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/eslint-config "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) config for **ESLint**. If 🐊**Putout** brakes formatting **ESLint** will fix it back 😉.

## Install

```
npm i @putout/eslint-config eslint madrun -D
```

## Usage

Create file `.eslintrc.json` in root of your project with content:

```json
{
    "extends": ["@putout"]
}
```

Add `scripts` section to `package.json`:

```json
{
    "scripts": {
        "lint": "madrun lint",
        "fix:lint": "madrun fix:lint"
    }
}
```

And create [`.madrun.mjs`](https://github.com/coderaiser/madrun):

```js
import {series} from 'madrun';

export default {
    'lint': () => 'putout lib test',
    'fix:lint': () => run('lint', '--fix'),
};
```

```sh
$ npm run lint
$ npm run fix:lint
```

## License

MIT
npm package: @putout/eslint-flat
Description: Helps dial with ESLint Flat Configs
Author: coderaiser
Latest version: 4.0.0

# @putout/eslint-flat [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/eslint-flat.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/eslint-flat "npm"

Helps deal with **ESLint** FlatConfig.

## Install

```
npm i @putout/eslint-flat
```

## API

### `matchToFlat(match)`

You have ability to write **ESLint** configs in objects instead of lots of arrays, for example instead of this:

```js
export default [
    ...safeAlign, {
        files: ['bin/putout.mjs'],
        rules: {
            'n/hashbang': 'off',
        },
    }, {
        files: ['**/register.mjs'],
        rules: {
            'n/no-unsupported-features/node-builtins': 'off',
        },
    },
];
```

You can use `matchToFlat`:

```js
import {matchToFlat} from '@putout/eslint-flat';
import {safeAlign} from 'eslint-plugin-putout/config';

export const match = {
    'bin/putout.mjs': {
        'n/hashbang': 'off',
    },
    '**/register.mjs': {
        'n/no-unsupported-features/node-builtins': 'off',
    },
};

export default [
    ...safeAlign,
    ...matchToFlat(match),
];
```

This also gives you ability to use new configs in monorepo:

### `matchToFlatDir(cwd: DirName|FileURL, path)`

If your `eslint.config.js` exports `match`, you can use `matchToFlatDir` to build correct `files` arrays:

```js
import {safeAlign} from 'eslint-plugin-putout/config';
import {matchToFlatDir} from '@putout/eslint-flat';

export default [
    ...safeAlign,
    ...matchToFlatDir(__dirname, './packages/putout'),
];
```

or

```js
import {safeAlign} from 'eslint-plugin-putout/config';
import {matchToFlatDir} from '@putout/eslint-flat';

export default [
    ...safeAlign,
    ...matchToFlatDir(import.meta.url, './packages/putout'),
];
```

This is the same as:

```js
export default [
    ...safeAlign, {
        files: ['**/packages/putout/bin/putout.mjs'],
        rules: {
            'n/hashbang': 'off',
        },
    }, {
        files: ['**/packages/putout/**/register.mjs'],
        rules: {
            'n/no-unsupported-features/node-builtins': 'off',
        },
        ignores: [
            ['**/packages/putout/**/fixture'],
        ],
    },
];
```

### `mergeESLintConfigs(cwd, directories)`

When you have monorepo with lots of packages in `./packages` directory:

```js
import {safeAlign} from 'eslint-plugin-putout/config';
import {mergeESLintConfigs} from '@putout/eslint-flat';

const config = await mergeESlintConfigs(import.meta.url, ['./packages']);

export default [
    ...safeAlign,
    ...config,
];
```

### `createESLintConfig(configs)`

Gives ability to avoid lots of spreads (alias to [`defineConfig`](https://eslint.org/blog/2025/03/flat-config-extends-define-config-global-ignores/):

```js
export default createESLintConfig([safeAlign, config]);
```

## License

MIT
npm package: @putout/formatter-codeframe
Description: 🐊Putout formatter shows code frame with an error
Author: coderaiser
Latest version: 10.0.2

# @putout/formatter-codeframe [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/formatter-codeframe.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/formatter-codeframe "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) formatter shows codeframe of file with an errors.

## Install

```
npm i putout @putout/formatter-codeframe
```

## Usage

```
putout --format codeframe lib
```

Possible output:

```sh
/home/coderaiser/putout/packages/putout/lib/putout.js:3:0
  1 | 'use strict';
  2 |
> 3 | debugger;
    | ^ Unexpected "debugger" statement
  4 |
  5 | const recast = require('recast');
  6 | const toBabel = require('estree-to-babel');

✖ 1 errors in 1 files
  fixable with the `--fix` option
```

## License

MIT
npm package: @putout/formatter-dump
Description: 🐊Putout formatter stores output and dump it on end
Author: coderaiser
Latest version: 7.0.0

# @putout/formatter-dump [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/formatter-dump.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/formatter-dump "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) formatter stores output and dump it on end.

## Install

```
npm i putout @putout/formatter-dump
```

## Usage

```
putout --format dump lib
```

## License

MIT
npm package: @putout/formatter-eslint
Description: 🐊Putout formatter for using ESLint formatters
Author: coderaiser
Latest version: 3.0.1

# @putout/formatter-eslint [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/formatter-eslint.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/formatter-eslint "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) formatter for using **ESLint** formatters.

## Install

```
npm i putout @putout/formatter-eslint
```

## Usage

To output results in **ESLint** format use:

```sh
putout --format eslint lib
```

Result example:

```json
{
    "errors": [{
        "name": "/home/coderaiser/putout/packages/putout/lib/putout.js",
        "places": [{
            "rule": "remove-debugger",
            "message": "Unexpected \"debugger\" statement",
            "position": {
                "line": 3,
                "column": 0
            }
        }]
    }],
    "filesCount": 1,
    "errorsCount": 1
}
```

To use `eslint formatter` set it with help of env variable `ESLINT_FORMATTER`.
For example to use `eslint-formatter-pretty` run:

```sh
ESLINT_FORMATTER=pretty putout --format eslint lib
```

## License

MIT
npm package: @putout/formatter-frame
Description: 🐊Putout formatter shows progress and codeframe at the end
Author: coderaiser
Latest version: 9.0.1

# @putout/formatter-frame [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/formatter-frame.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/formatter-frame "npm"

`putout` formatter with `progress` + `codeframe`.

## Install

```
npm i putout @putout/formatter-frame
```

## Usage

```
putout -f frame lib
```

## License

MIT
npm package: @putout/formatter-json
Description: 🐊Putout formatter output json on end
Author: coderaiser
Latest version: 3.0.0

# @putout/formatter-json [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/formatter-json.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/formatter-json "npm"

> **JSON** is a syntax for serializing `objects`, `arrays`, `numbers`, `strings`, `booleans`, and `null`. It is based upon **JavaScript** syntax but is distinct from it: some **JavaScript** is *not* **JSON**.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON)

🐊[**Putout**](https://github.com/coderaiser/putout) formatter outputs **JSON**, when done.

## Install

```
npm i putout @putout/formatter-json
```

## Usage

```sh
putout --format json lib
```

Result example:

```json
{
    "errors": [{
        "name": "/home/coderaiser/putout/packages/putout/lib/putout.js",
        "places": [{
            "rule": "remove-debugger",
            "message": "Unexpected \"debugger\" statement",
            "position": {
                "line": 3,
                "column": 0
            }
        }]
    }],
    "filesCount": 1,
    "errorsCount": 1
}
```

## License

MIT
npm package: @putout/formatter-json-lines
Description: 🐊Putout formatter output json-lines
Author: coderaiser
Latest version: 4.0.0

# @putout/formatter-json-lines [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/formatter-json-lines.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/formatter-json-lines "npm"

> **JSON Lines** is a convenient format for storing structured data that may be processed one record at a time. It works well with unix-style text processing tools and shell pipelines. It's a great format for log files. It's also a flexible format for passing messages between cooperating processes.
>
> (c) [jsonlines.org](https://jsonlines.org/)

🐊[**Putout**](https://github.com/coderaiser/putout) formatter output **JSON Lines**.

## Install

```
npm i putout @putout/formatter-json-lines
```

## Usage

```sh
putout --format json-lines lib
```

Result example:

```
 {"name":"hello.js","source":"const t = 'hello';\n\n","places":[{"rule":"remove-unused-variables","message":"\"t\" is defined but never used","position":{"line":1,"column":6}}],"index":0,"count":2,"filesCount":1,"errorsCount":1}
 {"name":"world.js","source":"const t = 'world';\n\n","places":[{"rule":"remove-unused-variables","message":"\"t\" is defined but never used","position":{"line":1,"column":6}}],"index":1,"count":2,"filesCount":2,"errorsCount":2}
```

## License

MIT
npm package: @putout/formatter-memory
Description: 🐊Putout formatter shows memory usage
Author: coderaiser
Latest version: 6.0.0

# @putout/formatter-memory [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/formatter-memory.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/formatter-memory "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) formatter shows memory used.

## Install

```
npm i putout @putout/formatter-memory
```

## Usage

```
putout --format memory lib
```

## Options

Formatters takes options, that can be set in `.putout.json` with:

```json
{
    "formatter": ["memory", {
        "minCount": 0,
        "color": "#6fbdf1"
    }]
}
```

## Env

- `PUTOUT_PROGRESS_BAR`:
  - `0` - disable
  - `1` - enable

## License

MIT
npm package: @putout/formatter-progress
Description: 🐊Putout formatter shows progress and shows result at the end
Author: coderaiser
Latest version: 7.0.0

# @putout/formatter-progress [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/formatter-progress.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/formatter-progress "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) formatter shows progress, stores output and show it on end.

## Install

```
npm i putout @putout/formatter-progress
```

## Usage

```
putout --format progress lib
```

## License

MIT
npm package: @putout/formatter-progress-bar
Description: 🐊Putout formatter shows progress and shows result at the end
Author: coderaiser
Latest version: 6.0.0

# @putout/formatter-progress-bar [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/formatter-progress-bar.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/formatter-progress-bar "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) formatter shows progress bar.

## Install

```
npm i putout @putout/formatter-progress-bar
```

## Usage

```
putout --format progress-bar lib
```

## Options

Formatters takes options, that can be set in `.putout.json` with:

```json
{
    "formatter": ["progress-bar", {
        "minCount": 0,
        "color": "#6fbdf1"
    }]
}
```

## Env variables

`PUTOUT_PROGRESS_BAR` - could be used to disable or enable `progress bar` using `0` and `1`.

## License

MIT
npm package: @putout/formatter-stream
Description: 🐊Putout formatter streams output
Author: coderaiser
Latest version: 7.0.0

# @putout/formatter-stream [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/formatter-stream.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/formatter-stream "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) formatter stores output and stream it on end.

## Install

```
npm i putout @putout/formatter-stream
```

## Usage

```
putout --format stream lib
```

## License

MIT
npm package: @putout/formatter-time
Description: 🐊Putout formatter shows time
Author: coderaiser
Latest version: 5.0.0

# @putout/formatter-time [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/formatter-time.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/formatter-time "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) formatter shows time used.

## Install

```
npm i putout @putout/formatter-time
```

## Usage

```
putout --format time lib
```

## Options

Formatters takes options, that can be set in `.putout.json` with:

```json
{
    "formatter": ["time", {
        "minCount": 0,
        "color": "#40e0d0",
        "clock": "⏳"
    }]
}
```

## Env

- `PUTOUT_PROGRESS_BAR`:
  - `0` - disable
  - `1` - enable

## License

MIT
npm package: @putout/git-status-porcelain
Description: parse git status --porclain output with a pleasure
Author: coderaiser
Latest version: 3.0.0

# Porcelain [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage][CoverageIMGURL]][CoverageURL]

[NPMURL]: https://npmjs.org/package/@putout/git-status-porcelain "npm"
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/git-status-porcelain.svg?style=flat&longCache=true
[BuildStatusURL]: https://github.com/putoutjs/git-status-porcelain/actions?query=workflow%3A%22Node+CI%22 "Build Status"
[BuildStatusIMGURL]: https://github.com/putoutjs/git-status-porcelain/workflows/Node%20CI/badge.svg
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat&longCache=true
[CoverageURL]: https://coveralls.io/github/coderaiser/git-status-porcelain?branch=master
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/git-status-porcelain/badge.svg?branch=master&service=github

Parse `git status --porcelain` output with a pleasure.

## Install

```
npm i @putout/git-status-porcelain
```

## How to use?

`porcelain` can be used in simpified mode, when you just need names of modified files (`added`, `deleted`, works as well):

```js
const porcelain = require('@putout/git-status-porcelain');

porcelain({
    modified: true,
    untracked: true,
});

// returns
[
    'README.md',
    '1.js',
];
```

But you can get break `porcelain` into pieces as well 😉:

```js
const porcelain = require('@putout/git-status-porcelain');
const {
    run,
    parse,
    pick,
    getNames,
} = porcelain;

// run git status --porcelain
const stdout = run();
// returns
' M README.md\n?? 1.js\n';

const files = parse(stdout);
// returns
[{name: 'README.md', mode: ' M '}, {name: '1.js', mode: '?'}];

const modifiedFiles = pick(files, {
    modified: false,
    untracked: false,
    deleted: false,
    added: false,
    renamed: false,
    unstaged: false,
});
// returns
[{name: 'README.md', mode: ' M '}];

getNames(modifiedFiles);
// returns
['README.md'];
```

## License

MIT
npm package: @putout/keypress
Description: putout plugin helps whith .gitignore
Author: coderaiser
Latest version: 1.2.2

# @putout/keypress [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/keypress.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/keypress"npm"
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/keypress
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/keypress

`putout` keypress handler (renamed to [@putout/cli-keypress](https://www.npmjs.com/package/@putout/cli-keypress)).

## Install

```
npm i @putout/keypress
```

## Examples

```js
const keyPress = require('keypress');
const {isStop} = keyPress();

// do some stuf antil ctrl+c pressed
async function again() {
    if (isStop())
        return;
    
    await again();
}
```

## Env Variables

`KEYPRESS=1` can be used to force enable `keypress`.

## License

MIT
npm package: @putout/operator-add-args
Description: 🐊Putout operator adds ability to add args to referenced variables that was not defined
Author: coderaiser
Latest version: 15.2.0

# @putout/operator-add-args [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-add-args.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-add-args "npm"

🐊**Putout** operator adds ability to add argument that was not defined before.

## Install

```
npm i putout @putout/operator-add-args
```

## API

If you want to create 🐊**Putout** `plugin` that will add `args` according to your needs just:

```js
const {operator} = require('putout');
const {addArgs} = operator;

export const {
    report,
    fix,
    traverse,
} = addArgs({
    comparePlaces: ['{comparePlaces}', 'test("__a", (__args) => __body)'],
    t: ['{comparePlaces}', [
        'test("__a", (__args) => __body)',
        'test.only("__a", (__args) => __body)',
    ]],
    maybe: ['{maybe}', [
        'module.exports.__a = (__args) => __body',
    ]],
});
```

For couple args it will look this way:

```
export const {
    report,
    fix,
    traverse,
} = addArgs({
    path: ['vars, path', [
        '(__a) => __body',
        '() => __body',
    ]],
});
```

It will set `vars` if absent, or keep used name.
If you have a file `index.spec.js`:

```diff
-test('', () => {
+test('', ({comparePlaces}) => {
    comparePlaces();
});
```

Plugin supports options, so you can pass it in `.putout.json`:

```json
{
    "rules": {
        "tape/add-args": ["on", {
            "args": {
                "comparePlaces": ["{comparePlaces}", "test('__a', (__args) => __body)"]
            }
        }]
    }
}
```

### Exclude

If you want exclude `index.spec.js`:

```diff
test('', (path, printer, semantics, {printComment} => {
    comparePlaces();
});
```

You can use `exclude` list:

```json
{
    "rules": {
        "tape/add-args": ["on", {
            "args": {
                "comparePlaces": ["{comparePlaces}", {
                    "include": "test('__a', (__args) => __body)",
                    "exclude": [
                        "(__a, __b, __c, __object) => __object"
                    ]
                }]
            }
        }]
    }
}
```

### `type`

If you want include only calls, and exclude all other types of nodes, use `type`:

```json
{
    "rules": {
        "tape/add-args": ["on", {
            "args": {
                "process": ["{process}", {
                    "include": "test('__a', (__args) => __body)",
                    "type": "call"
                }]
            }
        }]
    }
}
```

And nodes like:

```js
process.hello;
```

Will be ignored.

## License

MIT
npm package: @putout/operator-add-argument
Description: putout operator adds ability to add argument to referenced variables that wan not defined
Author: coderaiser
Latest version: 1.3.5

# @putout/operator-add-argument [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-add-argument.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-add-argument "npm"

`putout` operator adds ability to add-argument variable that was not defined before. Renamed to [@putout/operator-add-args](https://github.com/coderaiser/putout/tree/v20.13.0/packages/operator-add-args).

## Install

```
npm i putout @putout/operator-add-argument
```

## API

If you want to create `putout plugin` that will add-argument variables according to your needs just:

```js
const {operator} = require('putout');

const {addArgument} = operator;

module.exports = addArgument({
    comparePlaces: ['{comparePlaces}', 'test("__a", (__args) => __body)'],
});
```

If you have a file `index.spec.js`:

```diff
-test('', () => {
+test('', ({comparePlaces}) => {
    comparePlaces();
});
```

Plugin supports options, so you can pass it in `.putout.json`:

```json
{
    "rules": {
        "tape/declare-t": ["on", {
            "declarations": {
                "comparePlaces": ["{comparePlaces}", "test('__a', (__args) => __body)"]
            }
        }]
    }
}
```

## License

MIT
npm package: @putout/operator-find-file-up
Description: 🐊Putout operator adds ability to find file up
Author: coderaiser
Latest version: 2.0.2

# @putout/operator-find-file-up [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-find-file-up.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-find-file-up "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to find file up.

## Install

```
npm i putout @putout/operator-find-file-up
```

## API

```js
import {operator} from 'putout';

const {findFileUp} = operator;
const filePath = findFileUp(filePath, 'package.json');
```

## License

MIT
npm package: @putout/operator-ignore
Description: 🐊Putout operator adds ability to add files to ignore
Author: coderaiser
Latest version: 6.1.0

# @putout/operator-ignore [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-ignore.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/operator-ignore "npm"

> A `.gitignore` file specifies intentionally untracked files that Git should ignore.
>
> (c) [git-scm.com](https://git-scm.com/docs/gitignore)

🐊[**Putout**](https://github.com/coderaiser/putout) operator simplifies creating `ignore`-plugins.

## Install

```
npm i putout @putout/operator-ignore
```

## API

### `ignore`

```js
import {operator} from 'putout';

const {ignore} = operator;

export const {
    report,
    fix,
    traverse,
} = ignore({
    name: '.npmignore',
    list: [
        '.*',
        'yarn-error.log',
        'coverage',
        '*.config.*',
    ],
});
```

### `type`

```js
import {operator} from 'putout';

const {__json, ignore} = operator;

export const {
    report,
    fix,
    traverse,
} = ignore({
    type: __json,
    name: '.nycrc.json',
    field: 'exclude',
    list: ['*.config.*'],
});
```

If file and passed in list mask overlaps, only mask saved, and list name removed:

```
-yarn-error.log
+*.log
```

## License

MIT