Dependencies that change during packaging

npm dependency whose runtime files are generated by its own prepack hook; the generator never ships

Test case
node-prepack
Ecosystems
npm
Scanned at
source, artefact

The application and how it is built

A Node application with one dependency, trace-route-package. The package's entry point is dist/index.js, but dist/ is not in the package's source. A prepack lifecycle script, scripts/generate-dist.js, writes it when the package is packed, and the script itself is left out of the tarball that gets installed.

What gets hidden, and how

npm runs a package's lifecycle scripts while the distributable is being made. What is installed can therefore differ from what is in the package's repository, and the code that made the difference never ships.

ComponentMechanismIn the artefact?What happens to it
trace-route-package@1.0.0prepack-generatedshipsthe package is visible, but dist/index.js was written by scripts/generate-dist.js at pack time and is not in the package's source

What a true SBOM would say

2 components ship, 1 of them transformed on the way in. 0 are known not to ship. Those influence the build or run during it; a tool may list them, as long as it marks them.

The list was written by hand from the build files, the lockfiles and the listing of the built archive, and the project's own proof-check.sh asserts what ends up in the artefact. It is in expected.json, and the full list of what ships is at the foot of this page.

What the tools reported

Component by component

Ships: Y exact version, v wrong version, p wrong group or namespace, n not named. Does not ship: L listed and marked, X listed unmarked, · not listed. A tool appears under a stage only if it was run there, so an empty column never stands for a miss. Select a cell to see what is behind it.

Select a cell.

sourceartefact
Componentcapyclicdxgencyclonedx-npmsbom-toolsyfttrivycdxgensyfttrivy
Ships. In the artefact, including components that were shaded or bundled on the way in.
node-prepack-trace-lab@1.0.0
trace-route-package@1.0.0 prepack-generated

Every document

Content accuracyBaseline conformance
ToolFormatCompsIn scopeShipped foundWrong verWrong purlLeakedLabelledHashes okNTIA 2021NTIA/CISA 2026BSI v2.1
source
capycli 2.12.0cyclonedx111/200000/08.85.64.7
cdxgen 11.3.2cyclonedx222/200000/09.17.84.5
cyclonedx-npm 6.0.1cyclonedx222/200000/09.16.14.5
sbom-tool 4.1.13spdx222/200000/010.05.53.8
syft 1.51.0cyclonedx222/200000/05.44.63.4
trivy 0.74.0cyclonedx321/200000/04.94.33.5
artefact
cdxgen 11.3.2cyclonedx000/200000/06.78.05.7
syft 1.51.0cyclonedx000/200000/03.14.44.1
trivy 0.74.0cyclonedx110/200000/03.14.44.1

Reading the result

A tool that reads the lockfile can name the package. None can tell that its contents were generated, because an SBOM identifies a package by name and version and says nothing about how its files came to be. Scanned on its own as an installed directory, the package has no lockfile beside it, which leaves a scanner little to go on.

This is our interpretation. The counts above are what the run recorded; why a tool found or missed something is inferred from how the tool works, not established by the data. Limits of the benchmark.

Evidence

Ground truth: what ships

ComponentNote
pkg:npm/node-prepack-trace-lab@1.0.0primary component
pkg:npm/trace-route-package@1.0.0the package is visible, but dist/index.js was written by scripts/generate-dist.js at pack time and is not in the package's source