0.0.5 • Published 6 months ago

@adityals/bundlechecker v0.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

bundlechecker

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

Usage

const { checkBundlerSync } = require("@adityals/bundlechecker");

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

Config Example

{
  "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

namedescriptionrequireddefault
configPathWhere to look config filetruenull
compressionCompression methodtrueNoCompression
silentWether to write to stdout or notfalsefalse

Result

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

{
  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.

0.0.5

6 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago