From f0dda896dd6742fd95695960d0247c6dc1bb6484 Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Fri, 12 Jun 2026 12:57:55 +0100 Subject: [PATCH 1/2] fix(core): map ./tracing subpath to dist/tracing/index explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- core/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/package.json b/core/package.json index 1ae016c..2dd0ebf 100644 --- a/core/package.json +++ b/core/package.json @@ -10,6 +10,10 @@ "dist" ], "exports": { + "./tracing": { + "types": "./dist/tracing/index.d.ts", + "default": "./dist/tracing/index.js" + }, "./*": { "types": "./dist/*.d.ts", "default": "./dist/*.js" From 70bfef755857ef43ef93c2522b9e36d36b824530 Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Fri, 12 Jun 2026 13:27:18 +0100 Subject: [PATCH 2/2] rework: promote tracing facade to file-module instead of exports entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- core/package.json | 4 ---- core/src/{tracing/index.ts => tracing.ts} | 2 +- core/src/tracing/opentelemetry.ts | 2 +- core/src/tracing/proxy.ts | 2 +- core/src/tracing/simple.ts | 2 +- 5 files changed, 4 insertions(+), 8 deletions(-) rename core/src/{tracing/index.ts => tracing.ts} (98%) diff --git a/core/package.json b/core/package.json index 2dd0ebf..1ae016c 100644 --- a/core/package.json +++ b/core/package.json @@ -10,10 +10,6 @@ "dist" ], "exports": { - "./tracing": { - "types": "./dist/tracing/index.d.ts", - "default": "./dist/tracing/index.js" - }, "./*": { "types": "./dist/*.d.ts", "default": "./dist/*.js" diff --git a/core/src/tracing/index.ts b/core/src/tracing.ts similarity index 98% rename from core/src/tracing/index.ts rename to core/src/tracing.ts index 14ef7b4..5b8290f 100644 --- a/core/src/tracing/index.ts +++ b/core/src/tracing.ts @@ -8,7 +8,7 @@ // export { type Tracer, type Attributes, type Name, setTracer, trace, traceP, traceF, event }; -import type { Future } from "../future"; +import type { Future } from "./future"; // A flat bag of primitive values attached to a trace or event. type Attributes = Record; diff --git a/core/src/tracing/opentelemetry.ts b/core/src/tracing/opentelemetry.ts index 6855968..355adcc 100644 --- a/core/src/tracing/opentelemetry.ts +++ b/core/src/tracing/opentelemetry.ts @@ -15,7 +15,7 @@ // OTLP trace viewer such as https://tracekit.dev/tools/trace-visualizer. export { OpenTelemetryTracer, OtlpJsonStdoutProcessor }; -import { type Tracer, type Attributes } from "./index"; +import { type Tracer, type Attributes } from "../tracing"; import { Future } from "../future"; import { context, diff --git a/core/src/tracing/proxy.ts b/core/src/tracing/proxy.ts index 419a5c1..591e73a 100644 --- a/core/src/tracing/proxy.ts +++ b/core/src/tracing/proxy.ts @@ -16,7 +16,7 @@ // })); export { ProxyTracer, type Config }; -import { type Tracer, type Attributes } from "./index"; +import { type Tracer, type Attributes } from "../tracing"; import type { Future } from "../future"; import { fileURLToPath } from "node:url"; import { dirname, sep } from "node:path"; diff --git a/core/src/tracing/simple.ts b/core/src/tracing/simple.ts index b21f207..ee0f685 100644 --- a/core/src/tracing/simple.ts +++ b/core/src/tracing/simple.ts @@ -11,7 +11,7 @@ // $ docker logs event-sourcing-backend | grep "\"ph\"" | jq -s '.' >events.json export { SimpleTracer }; -import type { Tracer, Attributes } from "./index"; +import type { Tracer, Attributes } from "../tracing"; import { Future } from "../future"; import { AsyncLocalStorage } from "node:async_hooks";