Repository navigation
typescript: root a package's published API from package.json, and bind an arrow under as (#847) - #1621
Merged
Conversation
…d an arrow under `as` (#847) A library whose index.ts is imported by its own tests had no root for its public API: TypeScript never read package.json, so everything a consumer outside the repository calls read as unreachable, which reads as safe to delete. - parser: new relation ts_package_entry (same shape as js_package_entry). It reads main, module, exports, types and source, maps each build-output target (dist/cjs/index.js, esm/index.mjs, dist/index.d.ts) back to the walked source module, and expands a single-`*` subpath pattern one path segment at a time. Only package.json files at or under the program root are read. - engine: projections/packages.dl and a new entry_point kind `package_export`: named METHOD exports, and exported variables bound to a function, of published modules that are not already entry modules. DEFAULT_INDEX and unresolved entries are declined. - parser: `const f = ((x) => ...) as F` (also satisfies, <T>, !, parentheses) now binds the arrow to `f`, as a bare arrow already did. The compiler oracle's labelOf names it the same way. Golden case 77 covers build-output, subpath and pattern entries, with controls: an imported but unpublished module, a blocked `./internal/*`, a two-segment path under a one-segment pattern, and a value (plain and under `as`) that roots nothing. Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com> Co-Authored-By: Claude <noreply@anthropic.com>
swapnilpaliwal-sd
requested review from
JaredHLZhang,
Whua689 and
suyashpaliwal26
as code owners
September 28, 2026 08:29
This was referenced Sep 28, 2026
Merged
swapnilpaliwal-sd
added a commit
that referenced
this pull request
Sep 28, 2026
The vendored parser keeps its own version and moves once per release, only when parser code changed. dev and main ship it at 0.1.1. On 0.1.4, four merged changes touched parser/: #1592 (a concise arrow body is owned by the arrow), #1616 (generated-output detection), #1621 (a package's published API is rooted from package.json) and #1625 (the Java walk and build directories). So 0.1.2, one bump for the release. (cherry picked from commit 51c5e8e) Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
swapnilpaliwal-sd
added a commit
that referenced
this pull request
Sep 28, 2026
The vendored parser keeps its own version and moves once per release, only when parser code changed. dev and main ship it at 0.1.1. On 0.1.4, four merged changes touched parser/: #1592 (a concise arrow body is owned by the arrow), #1616 (generated-output detection), #1621 (a package's published API is rooted from package.json) and #1625 (the Java walk and build directories). So 0.1.2, one bump for the release. (cherry picked from commit 51c5e8e) Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
This was referenced Sep 28, 2026
qtwang
pushed a commit
to qtwang/axiomcodegraph
that referenced
this pull request
Oct 11, 2026
The vendored parser keeps its own version and moves once per release, only when parser code changed. dev and main ship it at 0.1.1. On 0.1.4, four merged changes touched parser/: AxiomCodeAI#1592 (a concise arrow body is owned by the arrow), AxiomCodeAI#1616 (generated-output detection), AxiomCodeAI#1621 (a package's published API is rooted from package.json) and AxiomCodeAI#1625 (the Java walk and build directories). So 0.1.2, one bump for the release.
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.
Closes #847
What was still broken
Roots for tests, HTTP handlers, decorators and
exported_from_entry_moduleexist on 0.1.4. What remained of cause 1 was that TypeScript never read package.json. A library whoseindex.tsis imported by its own tests is not an "unimported module", so nothing rooted its public API. That API is the code a consumer outside the repository calls, so it read as unreachable, and unreachable reads as safe to delete.A second gap showed up on a real state-management library. Its main API is written
export const createStore = ((createState) => …) as CreateStore. Theasblocked the variable→arrow link, so the arrow was neither a call target ofcreateStore(...)nor the thingcreateStoreexports.Change
ts_package_entry, the same shape asjs_package_entry.packageEntriesOfwalk and addstypesandsource.dist/cjs/index.js,esm/index.mjs,dist/index.d.ts) is mapped back to the walked source module. Outcomes:RESOLVED,RESOLVED_FROM_BUILD_OUTPUT,RESOLVED_FROM_PATTERN.*subpath pattern is expanded one path segment at a time, withsrc/tried first. This is deliberately narrower than Node, where*can span/.projections/packages.dland a newentry_pointkind,package_export, inconfig-resolution/entry-points.dl.var_bound_function), of published modules that are not already entry modules.DEFAULT_INDEXentries and entries with no module hash are declined.const f = ((x) => …) as Fnow binds the arrow tof, as a bare arrow already did. The same holds undersatisfies,<T>,!and parentheses. The compiler oracle'slabelOfnames it the same way.Tests
77-package-published-entriescovers a build-outputmain/exportsentry, a./vanillasubpath, a./plugins/*pattern, an exported arrow and an arrow underas.internal.ts: imported, but named by no entry../internal/*.plugins/deep/tracer.ts: two segments under a one-segment*.DEFAULT_INITIALandcastInitial: values, not functions, including one underas.graph/test/typescript/run-tests.sh --oracle: passed 77, failed 0. Case 77 scores oracle=7, engine=8, agree=7, missing=0.asclause. It is the existing multi-target behaviour for a call through a variable whose declared type is a function type, not a new edge kind.graph/test/javascript/run-tests.sh --oracle: passed 68, failed 0. It is affected through the shared package-json resolver and oracle.npx tsx src/test/{typescript,javascript,csharp,gradle,discovery}-tests.ts): all pass. TypeScript is 47/47, including the column-order gate.Real projects (before → after)
as-wrappedcreateStore/create/createWithEqualityFnarrows. They are calls from its tests that now resolve.