# @adityals/bundlechecker

> Bundlecheker that built with rust and using napi.rs for node binding

Latest version **0.0.5** (published 2023-11-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @adityals/bundlechecker
pnpm add @adityals/bundlechecker
yarn add @adityals/bundlechecker
bun add @adityals/bundlechecker
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2023-11-03 |
| First published | 2023-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 0 |
| Unpacked size | 25.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | adityals |

## Links

- npm: https://www.npmjs.com/package/@adityals/bundlechecker
- npm.io page: https://npm.io/package/@adityals/bundlechecker

## Recent versions

- 0.0.5 (latest) — 2023-11-03
- 0.0.4 — 2023-10-27
- 0.0.3 — 2023-10-26
- 0.0.2 — 2023-10-26
- 0.0.1 — 2023-10-26

## README

# bundlechecker

Bundlecheker that built with rust and using napi.rs for node binding

## Usage
```javascript
const { checkBundlerSync } = require("@adityals/bundlechecker");

try {
  const { result, summary } = checkBundlerSync({
    configPath: "./package.json",
    compression: "brotli",
    silent: false,
  });
} catch (err) {
  console.error(err);
}
```

### Config Example
``` json
{
  "name": "my_package",
  "bundlesize": [
    {
      "path": "../index.js",
      "maxSize": "50 kB"
    },
    {
      "path": "../notfound*.js",
      "maxSize": "10 kB"
    }
  ]
}
```
The important thing is provide the `bundlesize` key, you can attach to `package.json` or any JSON file.


### Options
| name | description | required | default |
| --- | --- | --- | --- |
| configPath | Where to look config file | true | null |
| compression | Compression method | true | NoCompression |
| silent | Wether to write to stdout or not | false | false |


### Result
If `checkBundlerSync` is succeed, it'll returns an object with 2 key `result` and `summary`

```javascript
{
  result: {
    'index.js': {
      pass: true,
      actualFileSize: 0.93359375,
      sizeUnit: 'kB',
      compression: 'Brotli',
      budgetSize: 50
    },
    '../notfound*.js': {
      pass: false,
      actualFileSize: 0,
      sizeUnit: '',
      compression: '',
      budgetSize: 0,
      error: 'pattern ../notfound*.js is not getting any match'
    }
  },
  summary: { total: 2, success: 1, fail: 0, error: 1 }
}
```

> I'm new to rust and hopefully this project will help me learn more.

---
_Source: https://npm.io/package/@adityals/bundlechecker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
