Skip to content

template: dist/ is the whole output; #/ is the one import root; pkg/<name>-<version>-<arch>.tar.gz - #41

Merged
julian-goldstein merged 1 commit into
masterfrom
bpf-object-in-dist
Oct 29, 2026
Merged

julian-goldstein merged 1 commit into
masterfrom
bpf-object-in-dist

Conversation

@julian-goldstein

@julian-goldstein julian-goldstein commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

dist/ is the whole output. The linked BPF object now lands at dist/bin/probe.bpf.o beside the bundle; bin/ at the project root is gone. A copied dist/ (index.js + bin/) runs on its own, and a final tarball step packs it into pkg/<name>-<version>-<arch>.tar.gz (name and version from package.json, arch from the toolchain). pkg/ is gitignored, removed by make clean, and holds one package per version and arch built.

✔ link       dist/bin/probe.bpf.o
✔ bundle     dist/index.js
✔ tarball    pkg/myproject-0.1.0-x86_64.tar.gz
✔ done       myproject (0.72s)

==> dist/bin/probe.bpf.o (7.9kb)
==> dist/index.js (15.4kb)
==> pkg/myproject-0.1.0-x86_64.tar.gz (7.7kb)

#/ is the one import root, replacing @/. It means src/: tsconfig maps it there for esbuild, package.json imports maps it there for the runtime, so every module also runs standalone with yeet run src/probes/x.js (the old @/ was bundle-time only, and the docs carried a caveat for it). The one exception is the #/bin/ prefix, the built-object dir, which package.json maps to dist/bin/. Nothing needs the bundle to run: make bpf then yeet run . runs the sources directly.

The object is imported, not located. import probe from "#/bin/probe.bpf.o" evaluates to a ready BpfObject (the daemon's BpfObjectRule wraps the file in new BpfObject({ exe })). In the bundle the import stays external and one esbuild alias rewrites the #/bin prefix to ./bin, so it points beside the bundle; any further object is just another #/bin/<name>.bpf.o import. This replaces the old exe: "../bin/probe.bpf.o", base: import.meta.dirname path, which only resolved from the bundle's location.

Kernel matrix stages veristat in .kmatrix/ (its own workspace) instead of bin/, locally and in CI, and the object path follows. README and AGENTS.md examples and alias notes updated throughout; clean prints one row per path; the step macro treats an empty exit status as failure (it previously let a broken command through).

Test plan

  • Fresh scaffold: build, bundle contains ./bin/probe.bpf.o and no #/ reference, sources inlined.
  • yeet run . in the tree; a copy of dist/ alone; the package unpacked into an empty dir — all start the TUI.
  • make bpf alone, then yeet run . and yeet run src/main.jsx unbundled.
  • yeet run src/probes/probe.js and src/probes/runqlat.js standalone (#/bin/* beats #/* at runtime, #/probes/… resolves).
  • Bogus object path fails loudly with the resolved absolute path.
  • Version bump in package.json yields a second package beside the first.
  • make clean leaves no dist/, .build/ or pkg/; clean git status after build + clean; make -j4 from clean.
  • esbuild prefix alias checked with two objects plus a #/lib source import.
  • make veristat-matrix / CI kernel-matrix (boot VMs; not run).

…name>-<version>-<arch>.tar.gz

The linked BPF object now lands at dist/bin/probe.bpf.o beside the bundle,
and bin/ at the project root is gone. A copied dist/ (index.js + bin/)
runs on its own, and a final `tarball` step packs it into
pkg/<name>-<version>-<arch>.tar.gz (name and version from package.json,
arch from the toolchain), listed with the artifacts; pkg/ is gitignored
and removed by `make clean`, and holds one package per version and arch.

`#/` replaces `@/` as the one import root and means src/: tsconfig maps
it there for esbuild, package.json `imports` maps it there for the
runtime, so every module also runs standalone with `yeet run` (the old
`@/` was bundle-time only). The one exception is the `#/bin/` prefix, the
built-object dir, mapped to dist/bin/ in the tree. Nothing needs the
bundle to run: `make bpf` then `yeet run .` runs the sources directly.

The object is imported, not located: `import probe from
"#/bin/probe.bpf.o"` evaluates to a ready BpfObject (the loader's
BpfObjectRule). In the bundle it stays external and one esbuild alias
rewrites the `#/bin` prefix to ./bin, so it points beside the bundle and
any further object is just another import. This replaces the old
`exe: "../bin/probe.bpf.o", base: import.meta.dirname` path, which only
resolved from the bundle's location.

Also: the kernel matrix stages veristat in .kmatrix/ instead of bin/,
locally and in CI; `clean` prints one row per path; the step macro
treats an empty exit status as failure; README and AGENTS.md follow.
@julian-goldstein julian-goldstein changed the title template: dist/ is the whole output; #/ is the one import root; <name>.tar.gz template: dist/ is the whole output; #/ is the one import root; pkg/<name>-<version>-<arch>.tar.gz Oct 29, 2026
@julian-goldstein
julian-goldstein merged commit 43c3637 into master Oct 29, 2026
2 checks passed
@julian-goldstein
julian-goldstein deleted the bpf-object-in-dist branch October 29, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant