Repository navigation
fix(metadata-core,service-cluster,create-objectstack): ESM-only subpaths declare their types under import - #26321
Conversation
…ire driver-memory's default export metadata-core/testing, service-cluster/testing and create-objectstack/created-summary already refused require() at runtime; their unconditional `types` still let TypeScript resolve them for a CommonJS caller. Nest `types` inside `import` so both agree, and say ESM-only in each README. driver-memory's default export was the legacy onEnable plugin object no kernel calls, and sat on `.default` under require(); nothing imports it, so it retires (ADR-0087 runtime-export-retired). Claude-Session: https://claude.ai/code/session_01WTCPNVkuDk7DNaZSdM3DZv Co-authored-by: Claude <noreply@anthropic.com>
The ADR-0087 runtime-export-retired disposition cannot certify an operand named `default` (its no-metadata-surface word scan hits every `default:` key in an object definition), so the retirement waits on that gate. This change keeps only the three ESM-only subpath declarations, which are non-breaking. Claude-Session: https://claude.ai/code/session_01WTCPNVkuDk7DNaZSdM3DZv Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check
What this run could not see
Coarse fallback — 20 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
席位核对 · ACCEPT · devx seat 2 · 2026-10-26T21:04ZSeat
Generated by Claude Code |
|
devx seat 2 · CI note on head Generated by Claude Code |
Requested by Steve · project thread
Part of #26206
Clause-②: no. Amended 20:45Z: split. This PR lands the three ESM-only subpath groups (
Part of #26206, non-breaking, types-only map changes plus README lines). The driver-memorydefaultretirement waits on an ADR-0087 gate card (predicate 2 word-scansdefaultacross metadata surfaces and can never certify that operand)Metadata-protocol: none
What changes
Three subpaths are ESM-only, and their export maps now say so. Each subpath's
typesmoved inside itsimportcondition ({ import: { types, default } }, the conditional shape #26198 / #26279 use). Each package's README gets one paragraph saying the subpath is ESM-only.node16-cjs)@objectstack/metadata-core/testingCJSResolvesToESMvitest, whose ownrequire()entry throws ("Vitest cannot be imported in a CommonJS module using require()"), so a CJS build could not load. Itsrequirecondition was already removed on purpose (the tsup config's split-by-format comment).@objectstack/service-cluster/testingCJSResolvesToESMvitest.create-objectstack/created-summaryCJSResolvesToESM@objectstack/cli'sinit(ESM). A CJS build would add arequirecondition, which widens the accept set and doesn't fitClause-②: no.@objectstack/cli.CJSResolvesToESM@objectstack/cli/consoleCJSResolvesToESM@objectstack/cli/hook-bodyCJSResolvesToESMFor the first three, runtime behaviour does not change.
require()of each subpath already failed withERR_PACKAGE_PATH_NOT_EXPORTED, because the map carriedtypes+importand norequireordefault. The unconditionaltypeswas the inconsistency: TypeScript undernode16/nodenextstill resolved the declarations for a CommonJS caller, and attw reported that asCJSResolvesToESM. Now TypeScript resolves them forimportonly, which is what Node does.@objectstack/cli: ESM-only, documented here (README follow-up)The cli's three library entries (
.,./console,./hook-body) map{ types, default }to ESM files, and they stay that way. Measured on Node 22.22.0,require()of all three works today through Node'srequire(esm). The.barrel loads every oclif command class.import-only condition, or arequirestub that throws) would break those workingrequire()callers. That's a narrowing, and this card isClause-②: no..barrel means a second build of the whole oclif program, which is out of proportion for a p3.So the attw
CJSResolvesToESMitems on these three stay, as intended ESM-only entries: the files are ESM, and CommonJS callers reach them throughimport()or Node'srequire(esm). This card's claim keptpackages/cli/README.mdout of scope while #26215 held it, so this paragraph is the written declaration for now. Follow-up: add one line topackages/cli/README.mdsaying.,./consoleand./hook-bodyare ESM entries. #26215 has since merged, so nothing blocks that line.Not in this PR:
@objectstack/driver-memory's default exportThe card's driver-memory half (
FalseExportDefault) is split out. Nothing in this repository imports the default, which is the legacy{ id, version, onEnable }object the kernel never calls, so retiring it is the right fix. But it retires a published export, and ADR-0087'sruntime-export-retireddisposition cannot currently certify an operand nameddefault. Predicate 2 (no-metadata-surface) scans metadata surfaces for the export's name and hits everydefault:key, starting withexamples/app-crm/src/objects/account.object.ts. The retirement waits on that gate, so #26206 stays open for it.Evidence
attw 0.18.5 on
npm pack --ignore-scriptsof each package, built at6633075b(before) and at this head (after):@objectstack/cliCJSResolvesToESMon.,./console,./hook-bodycreate-objectstackCJSResolvesToESMon./created-summaryCJSResolvesToESM(./created-summaryanswersNoResolutionundernode16-cjs, matching Node)@objectstack/metadata-coreCJSResolvesToESMon./testingCJSResolvesToESM(NoResolutionundernode16-cjs)@objectstack/service-clusterCJSResolvesToESMon./testingCJSResolvesToESM(NoResolutionundernode16-cjs)NoResolutionundernode10on every subpath is unchanged and outside the contract (legacynode10has noexportssupport).Runtime probes, at this head:
import()of all three subpaths resolves and loads.require()of all three still answersERR_PACKAGE_PATH_NOT_EXPORTED.require()of the three cli entries still loads.Acceptance notes
fbc38f81. That commit carries this head's three map changes, plus the driver-memory half that64128263then restored byte-for-byte tomain.pnpm --filter … run test): metadata-core 823/823, service-cluster 105/105, create-objectstack 269/269.run typecheck), green on 12 packages: the three changed packages, plus every in-repo consumer of these subpaths. metadata-fs, metadata-protocol, rest, runtime, service-cluster-redis and cli (init.ts) are all ESM (nodenext, orbundlerfor test configs). driver-memory, service-datasource and plugin-dev were covered for the dropped half.node scripts/check-adr-0087-registration.mjs --base origin/mainexit 0, with 1 non-breaking changeset seen.node scripts/check-changeset-no-major.mjsexit 0.64128263, all 71dispatch-gates --commandsfamilies were run locally, each exit captured before any pipe.--ranreconciliation: 71 derived, 71 run, 0 NOT-MEASURED. The list is in the report comment on packages: 4 ESM-only subpaths answer require() with ESM, and driver-memory's default export is lost under CJS (attw CJSResolvesToESM / FalseExportDefault) #26206.🤖 Generated with Claude Code
https://claude.ai/code/session_01WTCPNVkuDk7DNaZSdM3DZv
Generated by Claude Code