fix(core): make @ambarltd/core/tracing resolve — promote facade to file-module - #64
Merged
Merged
Conversation
tracing is the package's first directory module. The wildcard exports
entry ("./*" -> "./dist/*.js") substitutes the subpath literally with
no directory-index fallback, so '@ambarltd/core/tracing' resolved to the
non-existent dist/tracing.js and failed with MODULE_NOT_FOUND in
consumers — while './tracing/opentelemetry' happened to work. Caught
before 0.1.17 was published.
Verified against the built package: with the explicit entry,
require.resolve('@ambarltd/core/tracing') -> dist/tracing/index.js and
existing wildcard subpaths (e.g. ./router) still resolve.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Drop the special-case exports entry and instead match the package's module convention: every public module is a top-level file resolved by the single "./*" wildcard (future, router, json/schema, ...). The facade moves from src/tracing/index.ts to src/tracing.ts and the tracing/ directory keeps the implementations (opentelemetry, proxy, simple) — the same shape as the json/ namespace. Public import paths are unchanged: '@ambarltd/core/tracing' and '@ambarltd/core/tracing/opentelemetry' both resolve. Verified: tsc build clean, require.resolve OK for tracing, tracing/opentelemetry and router against the built package, typecheck clean, 123/123 core tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
@ambarltd/core/tracingdoes not resolve from the built package — caught while preparing the 0.1.17 release (0.1.17 is not yet published, so nothing shipped broken).tracingwas the package's first directory-index module (src/tracing/index.ts→dist/tracing/index.js). The exports wildcard substitutes subpaths literally with no index fallback:So
import { setTracer } from "@ambarltd/core/tracing"failed withMODULE_NOT_FOUND, while…/tracing/opentelemetryhappened to work. HartAgency#173 imports both.Fix — follow the package's own module convention
Every public module in core is a top-level file resolved by the single wildcard (
future,router,maybe,json/schema,json/decoder, …; consumer base has zero directory-index imports). So instead of adding a special-case exports entry (first version of this PR), the facade moves to where the convention puts it:src/tracing/index.ts→src/tracing.ts(file-module facade, likefuture.ts)src/tracing/keeps the implementations (opentelemetry,proxy,simple) — the same namespace shape asjson/package.jsonuntouched — the wildcard stays the only export rulePublic import paths are exactly as intended and unchanged:
@ambarltd/core/tracingand@ambarltd/core/tracing/opentelemetry.Validation (against the built artifact)
Release note
No version bump needed — 0.1.17 (already on main, unpublished) ships this. After merge:
cd core && pnpm publish(manual — the ambar-core workflow is CI-only).