Function: ownPackageRoot()
ownPackageRoot(
options):string|undefined
Defined in: packages/aiui-util/src/provenance.ts:107
Package root for a module asking about ITSELF — the resolution-robust variant of packageRoot, which anchors at THIS package (aiui-util) and so answers by-name questions from a vantage the asker never chose. That vantage broke live (2026-08-24): under pnpm's strict layout a workspace package is invisible to a sibling's node_modules chain, and whether the lookup still landed turned on an incidental NODE_PATH.
Two probes, in order:
- By name, anchored at the calling module — covers installed layouts (the pnpm virtual store places siblings adjacent) and config-bundle vantages (a Vite config bundle sits in the consuming app, whose
node_modulescan see the package). - Upward walk from the calling module's path to the nearest
package.jsonwhosenameMATCHES — covers the source checkout, where a workspace package cannot see itself by name at all. The name guard is what keeps a bundled vantage honest: the consumer's own manifest doesn't match, so the walk keeps going instead of lying.
Returns undefined when neither lands — the caller picks its safe default rather than crashing (the failure that motivated this was a dev server 500ing every page load).
Parameters
options
Returns
string | undefined