npm.io
13.0.5 • Published 22h ago

@secretlint/profiler

Licence
MIT
Version
13.0.5
Deps
0
Size
26 kB
Vulns
0
Weekly
0
Stars
1.4K

@secretlint/profiler

Profile manager for Secretlint.

Install

Install with npm:

npm install @secretlint/profiler

Usage

@secretlint/profiler exports a shared secretLintProfiler instance. Secretlint packages mark their own timings with it.

Profiling costs performance—performance.mark() is called for each rule and each file—so the profiler should be enabled only when you need the profiling result. The secretlint CLI enables it only when the --profile flag is passed.

import { secretLintProfiler } from "@secretlint/profiler";

// Disable profiling: `mark()` becomes no-op and `PerformanceObserver` is not started
secretLintProfiler.setEnabled(false);

// Enable profiling before running secretlint
secretLintProfiler.setEnabled(true);
// ... run secretlint ...
const measures = await secretLintProfiler.getMeasures();

The profiler is enabled by default. If you use Secretlint as a library and do not need the profiling result, call secretLintProfiler.setEnabled(false) before running secretlint.

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT azu

Keywords