# metalsmith-tracer

> A Metalsmith plugin to find related files within collections.

Latest version **2.1.7** (published 2026-10-01) · GPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install metalsmith-tracer
pnpm add metalsmith-tracer
yarn add metalsmith-tracer
bun add metalsmith-tracer
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.1.7 |
| Published | 2026-10-01 |
| First published | 2020-02-22 |
| Weekly downloads | 0 |
| License | GPL-3.0-or-later |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 4 |
| Unpacked size | 52.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1 |
| Author | Christian Emmer |
| Maintainers | emmercm |
| Keywords | metalsmith, metalsmith-plugin, plugin |

## Links

- npm: https://www.npmjs.com/package/metalsmith-tracer
- Repository: https://github.com/emmercm/metalsmith-plugins
- Homepage: https://github.com/emmercm/metalsmith-plugins/tree/main/packages/metalsmith-tracer#readme
- Issues: https://github.com/emmercm/metalsmith-plugins/issues
- npm.io page: https://npm.io/package/metalsmith-tracer

## Dependencies (4)

- [ora](https://npm.io/package/ora.md) ^9.4.1
- [chalk](https://npm.io/package/chalk.md) ^6.0.1
- [callsites](https://npm.io/package/callsites.md) ^4.2.0
- [deepmerge](https://npm.io/package/deepmerge.md) ^4.3.1

## Recent versions

- 2.1.7 (latest) — 2026-10-01
- 2.1.6 — 2026-08-02
- 2.1.5 — 2026-07-02
- 2.1.4 — 2026-05-06
- 2.1.3 — 2026-03-17
- 2.1.1 — 2025-10-04
- 2.1.0 — 2025-03-29
- 2.0.7 — 2025-03-25
- 2.0.6 — 2025-03-21
- 2.0.5 — 2024-12-06
- 2.0.4 — 2024-09-10
- 2.0.3 — 2024-07-05
- 2.0.2 — 2024-01-04
- 2.0.1 — 2023-12-06
- 2.0.0 — 2023-11-07
- … 23 more at https://npm.io/package/metalsmith-tracer/versions

## README

# metalsmith-tracer

[![npm: version](https://img.shields.io/npm/v/metalsmith-tracer?color=%23cc3534&label=version&logo=npm&logoColor=white)](https://www.npmjs.com/package/metalsmith-tracer)
[![npm: downloads](https://img.shields.io/npm/dw/metalsmith-tracer?color=%23cc3534&logo=npm&logoColor=white)](https://www.npmjs.com/package/metalsmith-tracer)

[![Snyk: vulnerabilities](https://snyk.io/test/npm/metalsmith-tracer/badge.svg)](https://snyk.io/test/npm/metalsmith-tracer)
[![codecov: coverage](https://img.shields.io/codecov/c/github/emmercm/metalsmith-plugins?flag=metalsmith-tracer&logo=codecov&logoColor=white)](https://codecov.io/gh/emmercm/metalsmith-tracer)
[![license](https://img.shields.io/github/license/emmercm/metalsmith-plugins?color=blue)](https://github.com/emmercm/metalsmith-plugins/blob/main/LICENSE)

A tool to automatically trace and measure Metalsmith build time.

The Metalsmith build process has no progress output to indicate how many plugins have been processed and how many more are left. Build pipelines with a lot of plugins can take a long time to finish, and it's very difficult to know which plugins take the most time. This package is a wrapper around Metalsmith that outputs meaningful build progress.

Here is an example console output when wrapped around the [metalsmith/startbootstrap-clean-blog](https://github.com/metalsmith/startbootstrap-clean-blog) example:

```text
------- Build process started -------

  4.7ms (unnamed)
 32.5ms (unnamed)
  2.3ms @metalsmith/collections
  0.4ms metalsmith.js
511.9ms @metalsmith/layouts
   1.8s @metalsmith/sass
  0.3ms metalsmith.js

   2.4s Total build time

Build finished
```

## Installation

```shell
npm install --save metalsmith-tracer
```

## JavaScript Usage

`metalsmith-tracer` wraps the root `metalsmith` call:

```javascript
import Metalsmith from 'metalsmith';
import tracer from 'metalsmith-tracer';

tracer(Metalsmith(__dirname), {
        // options here
    })
    // .use() every build plugin
    .build((err) => {
        if (err) {
            throw err;
        }
    });
```

## Options

### `log` (optional)

Type: `(...data: unknown[]) => void` Default: `console.log`

The logger function.

## Limitations

- `setImmediate()`

  Plugins that use `setImmediate()` to call their `done` callback will not print their real name due to how `metalsmith-tracer` uses the call stack.

- `metalsmith-if`

  Using `metalsmith-if` will mask the name of the plugin actually being used.

## Changelog

[Changelog](./CHANGELOG.md)

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