Skip to content

fix(cli): export loads and gives back a page whose modules import TypeScript files by .js names - #12635

Closed
josephfarina wants to merge 6 commits into
mainfrom
josephfarina/export-page-ts-js-imports
Closed

josephfarina wants to merge 6 commits into
mainfrom
josephfarina/export-page-ts-js-imports

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A page whose modules import a .tsx file by its .js name (import {Kpi} from './parts/Kpi.js' for Kpi.tsx) fails astryx experimental export with ERR_FILE_NOT_FOUND: The page imports ./parts/Kpi.js, which does not exist. A page whose modules import a .ts file by its .js name (or .tsx by .jsx, .mts by .mjs) already exports, but --reverse refuses the file as damaged (ERR_RENDER_SOURCE_DAMAGED). TypeScript (with moduleResolution: "nodenext" or "bundler") and Vite accept both pages.

Problem and solution fit

  • Why does it fail? The page's module loader follows a .js name to a .ts file, but not to a .tsx file. The reverse's resolution order follows neither, so it cannot reach the carried TypeScript files and calls the file damaged.
  • Why does it harm the task? The page builds and runs in the project, so the export refuses a correct page, or writes a file that cannot come back.
  • Why does that matter? .js names for TypeScript files are the standard style under TypeScript's NodeNext resolution, which many projects use.

Expected behavior and authority

The page renders as it builds, and --reverse gives back exactly the files it carries.

Smallest restoration

  • The import rewrite the export already applies to every module it compiles now points a relative .js, .jsx, .mjs or .cjs name that names no file at the TypeScript source it stands for, through existingFile, the same lookup the import walk and the browser bundle use. A file that has the name as written is used as is. This covers static imports, re-exports, import() and require, for the server render and the page's script.
  • ts-paths.mjs exports typeScriptSourcesOf, the TypeScript files a .js-family path stands for, from the one shared table (.js → .ts, .tsx; .jsx → .tsx, .ts; .mjs → .mts; .cjs → .cts). existingFile, resolutionCandidates and the format check below all use it, so the loader, the walk and the format check follow one rule.
  • resolutionCandidates, the order the reverse resolves a relative import by, tries that TypeScript source right after the name as written, so --reverse finds the files and reports the page as exact.
  • The carried source keeps the imports as written.
  • A file in which a carried module is reached only by the JavaScript name of its TypeScript source, through a relative import, says render format 3 (the newest this CLI reads). Format 1 and 2 readers cannot follow such an import, so without it they call the file damaged; with it, they decline it by naming the CLI that reads it, as the format rule in source-block.mjs requires. Every other file keeps the format it had (1, or 2 for the module kinds format 1 refuses); an import through a path alias (@/lib/rows.js) keeps format 1.

Evidence

  • Reproduction before the change: the new export test (a .tsx part imported by .js) fails with ERR_FILE_NOT_FOUND; a page that imports a .ts file by .js exports but --reverse refuses it as damaged.
  • Result after the change: the page exports with its three modules carried (parts/Kpi.tsx, parts/fmt.ts, parts/later.tsx reached by import()), shows its text, and --reverse reports exact: true and writes each file back byte for byte.
  • Representative unchanged path: an extensionless import, and a .json import, resolve as before (unit test); a .js file present under its written name is used instead of the TypeScript file beside it, and the file stays format 1 (export test).
  • Earlier CLIs: before this, every earlier CLI given such a file answered ERR_RENDER_SOURCE_DAMAGED; the file now says format 3, which they refuse by naming the CLI that wrote it.
  • Regression tests: render.notes.test.mjs "says render format 2 or 3 only for a file that carries what earlier CLIs cannot read" (a .js-named import says 3, an extensionless one stays 1); render.test.mjs "loads the page's own modules imported TypeScript-style by .js names, and gives them back exactly"; embedded-imports.test.mjs "resolutionCandidates".

Scope

Components: CLI experimental export

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • CI=1 pnpm exec vitest run --project node packages/cli/api/render packages/cli/foundation/render packages/cli/foundation/doc-compiler/doc-loads.test.mjs packages/cli/test/export-name.test.mjs packages/cli/foundation/discovery packages/cli/api/theme/build packages/cli/api/doctor/icon-sets.test.mjs (2310 passed, 5 skipped)
  • pnpm -F @astryxdesign/cli run typecheck:strict and typecheck:json-api
  • ESLint on the changed files
  • Prettier with the repository's config: export-pages.doc.mjs and the changeset pass. page-worker.mjs, render.test.mjs, render.notes.test.mjs, source-block.mjs, ts-paths.mjs, embedded-imports.mjs and embedded-imports.test.mjs fail Prettier on main as well; this change leaves their existing formatting as it is.

@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 18, 2026 8:48pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 18, 2026
@astracat-bot

astracat-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 9:06 PM UTC

@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): astryx experimental export loads a page whose own modules import each other by a TypeScript-style name (./parts/Kpi.js for Kpi.tsx), for the server render and the page's script, using the one extension table the walk of modules outside the carried folder already uses. A file that exists under the name as written is used as is, and --reverse gives back exactly the files the export carries.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec ca841c3

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 45ab71e

@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision update (engineering owner, covering this pull request at its current head): a file whose carried module is reached only by a TypeScript-style name says render format 3, so a reader that knows only formats 1 and 2 refuses it as written by a newer version instead of calling it damaged. Every other file keeps its format 1 or 2. The rest of the decision stands.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 0792f17

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. The fix works: the new tests fail on main and pass on this branch, and the listed test command, typechecks and ESLint pass. Three things need correcting before it lands.

  • The changeset, the title and the description say a page that imports a .ts file by its .js name used to fail to export with ERR_FILE_NOT_FOUND, but on main only a .js name for a .tsx file fails, while .js for .ts, .jsx for .tsx and .mjs for .mts already export and only --reverse refused them as damaged, so please reword the note to say exactly that.
  • typeScriptSourceOf in page-worker.mjs re-implements the TypeScript step of existingFile from ts-paths.mjs, which the same file already uses for the import walk and the browser bundle, so please call existingFile(written, []) there, and build importsTypeScriptByJsName and resolutionCandidates from one helper, so the loader, the walk and the format check cannot drift apart again.
  • The shipped export doc (export-pages.doc.mjs, "Across CLI versions") still says every file that is not format 2 says format 1, so please add that a file whose modules import a TypeScript file by its JavaScript name says format 3, and fix the same sentence in the comment above the format rules in source-block.mjs.
Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: export loads a page whose modules import .ts or .tsx files by .js-family names. Verified: the new export test, and a probe of .js, .jsx, .mjs and nested imports.
  • Claim: such a page used to fail with ERR_FILE_NOT_FOUND. False for .ts targets, which already exported on main; true for .tsx targets (the new test fails on main).
  • Claim: --reverse gives those files back exactly. Verified: the export test asserts exact: true and a byte-for-byte restore.
  • Claim: such a file says render format 3, and an earlier CLI names the newer CLI instead of calling it damaged. Verified: the export test, and the older reader's newer-format refusal compared with its unreached-file refusal.
  • Claim: TypeScript (nodenext, bundler) and Vite accept such a page. Consistent with their documented resolution; not run.
  • Claim: the loader looked for the name as written, and only the walk of outside modules knew the mapping. False in part: the loader already followed .js to .ts, and the same mapping served the walk of carried modules and the browser bundle.
  • Claim: the rewrite covers imports, re-exports, import() and require, for the server render and the page's script. Verified: page-worker.mjs:665-675, and both compiles use the plugin.
  • Claim: a file that exists under the written name is used as is. Verified in code (page-worker.mjs:691, embedded-imports.mjs:294); no test covers it.
  • Claim: the reverse tries the TypeScript source right after the written name. Verified: the resolutionCandidates tests.
  • Claim: the carried source keeps its imports as written. Verified: the byte-for-byte restore.
  • Claim: extensionless and .json imports resolve as before. Verified: the unit test, and an extensionless page stays format 1.
  • Claim: the listed test command gives 489 passed and 3 skipped. Verified: same command, same counts.
  • Claim: the strict and JSON-API typechecks and ESLint pass. Verified.
  • Claim: the three named files pass Prettier, and page-worker.mjs and render.test.mjs fail it on main too. Verified; source-block.mjs and render.notes.test.mjs also fail Prettier, as they do on main.
  • Claim: no new public API is hidden under the fix label. Verified: no export, command or option changes.
  • Claim: public text carries no internal context. Verified.
  • File .changeset/export-page-ts-js-imports.md: finding (overbroad claim).
  • File packages/cli/api/render/render.notes.test.mjs: clear.
  • File packages/cli/api/render/render.test.mjs: clear.
  • File packages/cli/foundation/render/embedded-imports.mjs: clear (its new step is the one the format check re-derives).
  • File packages/cli/foundation/render/embedded-imports.test.mjs: clear.
  • File packages/cli/foundation/render/page-worker.mjs: finding (copies the TypeScript step of existingFile).
  • File packages/cli/foundation/render/source-block.mjs: finding (stale format comment; the format check re-derives the reverse's step).

Automated review (maintainer link)

Comment thread .changeset/export-page-ts-js-imports.md Resolved
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · ef9ae4f

Storybook · Sandbox · built from this PR's head

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@josephfarina josephfarina changed the title fix(cli): export loads a page whose own modules import TypeScript-style .js names fix(cli): export loads and gives back a page whose modules import TypeScript files by .js names Nov 18, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec cf3c3fd

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the code is ready (the new tests fail on main and pass here, the earlier code and doc findings are fixed, and the listed test command, typechecks and ESLint pass), and one description edit remains, with no new commit needed.

  • The title, User impact and Problem and solution fit still say that a page importing a .ts file by its .js name failed to export with ERR_FILE_NOT_FOUND because the loader looked for the name as written, but on main only a .js name for a .tsx file fails that way, while .js for .ts, .jsx for .tsx and .mjs for .mts already export and only --reverse refused them as damaged, so please say what the changeset now says and update the test count to 490.

Not blocking: the branch now conflicts with main in export-pages.doc.mjs, where the same paragraph names experimental import, so keep that wording and add the format-3 sentence. The format-3 sentences in the changeset and that doc cover relative imports only (an alias import such as @/lib/rows.js keeps format 1), so saying "a relative import" makes them exact.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Description, User impact: a .js name for a .ts or .tsx file fails the export with ERR_FILE_NOT_FOUND. False for .ts, which exports on main (only --reverse failed); true for .tsx (the new export test fails on main).
  • Description: TypeScript (nodenext, bundler) and Vite accept such a page. Consistent with their documented resolution; not run.
  • Description: the loader looked for the name as written, and only the walk of modules outside the carried folder knew the mapping. False: the loader already loaded .js as .ts, and the carried-module walk and the browser bundle already used the mapping.
  • Description: the page builds in the project, so the export refused a correct page. True for .tsx targets.
  • Description: the page renders as it builds and --reverse gives back exactly what it carries. Verified: the export test and a probe of .js, .jsx and .mjs imports.
  • Description: the rewrite points a relative .js, .jsx, .mjs or .cjs name with no file at its TypeScript source, from the one shared table. Verified in the code.
  • Description: a file that has the name as written is used as is. Verified: the new test and the probe.
  • Description: static imports, re-exports, import() and require are covered, for the server render and the page's script. Verified in the code; the export test covers import().
  • Description: the reverse tries the TypeScript source right after the written name and reports exact. Verified: the unit and export tests.
  • Description: the carried source keeps its imports as written. Verified: the byte-for-byte restore.
  • Description: such a file says render format 3, older CLIs decline it by naming the CLI that reads it, and other files keep format 1 or 2. Verified for relative imports with the base CLI; alias imports keep format 1.
  • Description: the new test fails before the change with ERR_FILE_NOT_FOUND, and after it the page exports its three modules and reverses exactly. Verified on both trees.
  • Description: extensionless and .json imports resolve as before. Verified: the unit test, and an extensionless page stays format 1.
  • Description: earlier CLIs answered damaged, and now refuse by naming the newer CLI. Verified with the base CLI.
  • Description: the named regression tests exist. Verified.
  • Description: one defect restored, no hidden public API, no internal context. Verified: no command, option or export changes.
  • Description: the test command gives 489 passed and 3 skipped at this head. Stale: the same command gives 490 passed and 3 skipped.
  • Description: the strict and JSON-API typechecks and ESLint pass. Verified.
  • Description: three named files pass Prettier, and four fail on main too. Verified; ts-paths.mjs also fails Prettier, as it does on main.
  • Changeset: the export loads a .tsx file imported by its .js name, which used to fail with ERR_FILE_NOT_FOUND. Verified.
  • Changeset: --reverse gives back a page that imports a TypeScript file by its JavaScript name, which it used to refuse as damaged. Verified for .js, .jsx and .mjs; .cjs follows the same table.
  • Changeset: such a file says render format 3, so an earlier CLI names the CLI that reads it. Verified for relative imports; alias imports keep format 1 (not blocking).
  • Title: the export loads a page whose own modules import TypeScript-style .js names. True at this head, but the export already loaded .ts targets.
  • File .changeset/export-page-ts-js-imports.md: clear (relative-import wording, not blocking).
  • File packages/cli/api/render/render.notes.test.mjs: clear.
  • File packages/cli/api/render/render.test.mjs: clear.
  • File packages/cli/assets/docs/tree/export-pages.doc.mjs: clear (relative-import wording, not blocking; conflicts with main).
  • File packages/cli/foundation/render/embedded-imports.mjs: clear.
  • File packages/cli/foundation/render/embedded-imports.test.mjs: clear.
  • File packages/cli/foundation/render/page-worker.mjs: clear (the plugin's doc comment still says unplaced imports are left alone, not blocking).
  • File packages/cli/foundation/render/source-block.mjs: clear.
  • File packages/cli/foundation/render/ts-paths.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/export-page-ts-js-imports branch from cf3c3fd to 434ae53 Compare November 18, 2026 16:29
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 434ae53

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI could not run on this head because its jobs were refused while CI was full, so re-run all jobs; the merge guard still waits for the required checks.

The fix works: a page whose modules import TypeScript files by their .js-family names now exports and comes back exactly with --reverse, the new tests fail on main and pass here, the earlier description, changeset and doc findings are fixed, and the listed test command, typechecks and ESLint pass.

Not blocking: the aliasPlugin JSDoc in page-worker.mjs still says an import the aliases do not place is left alone, but the plugin now also points a relative .js-family import at its TypeScript source.

Claims and files checked

Review mode: full; reason: rebase

  • Changeset: export now loads a page that imports a .tsx file by its .js name, which failed with ERR_FILE_NOT_FOUND. Verified: the new round-trip test (render.test.mjs:2475-2504) fails on main with that error and passes here.
  • Changeset: --reverse gives back a page that imports any TypeScript file by its .js, .jsx, .mjs or .cjs name, which it refused as damaged. Verified: on main each case exports but reverses with ERR_RENDER_SOURCE_DAMAGED; here each reverses exactly.
  • Changeset: such a file says render format 3 when the import is relative, so an earlier CLI names the CLI that reads it; an alias import keeps format 1. Verified: render.notes.test.mjs:453-479, source-block.mjs:77, and main's CLI answers ERR_RENDER_NEWER_FORMAT naming the writer.
  • Description: a .js import of a .tsx file fails the export, while .ts by .js, .tsx by .jsx and .mts by .mjs export but fail --reverse. Verified on main.
  • Description: TypeScript with NodeNext or bundler resolution, and Vite, accept both pages. Verified: those resolvers map a .js name to its TypeScript source.
  • Description: the loader follows .js to .ts but not .tsx, and the reverse order followed neither. Verified on main.
  • Description: the rewrite covers static imports, re-exports, import() and require, for the server render and the page's script, through existingFile, and a file with the written name is used as is. Verified: page-worker.mjs:643-693, render.test.mjs:2458-2473.
  • Description: one shared table drives existingFile, resolutionCandidates and the format check. Verified: ts-paths.mjs:408-412 and its three callers.
  • Description: the reverse tries the TypeScript source right after the written name and reports the page as exact, and the carried source keeps its imports as written. Verified: embedded-imports.test.mjs:54-80, restored files byte for byte.
  • Description: every other file keeps format 1 or 2, and earlier CLIs now decline a format-3 file by naming the CLI instead of calling it damaged. Verified by tests and a cross-version run.
  • Description: the named regression tests exist, and the test command gives 2286 passed and 5 skipped. Verified by running it.
  • Description: strict and JSON-API typechecks and ESLint pass, and Prettier passes on four files, with five others failing on main too. Verified.
  • Description: no new public API, default or interaction model, and no internal context in public text. Verified: no command, option or export changes.
  • .changeset/export-page-ts-js-imports.md: clear.
  • packages/cli/api/render/render.notes.test.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear.
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.
  • packages/cli/foundation/render/embedded-imports.mjs: clear.
  • packages/cli/foundation/render/embedded-imports.test.mjs: clear.
  • packages/cli/foundation/render/page-worker.mjs: non-blocking, stale aliasPlugin JSDoc.
  • packages/cli/foundation/render/source-block.mjs: clear.
  • packages/cli/foundation/render/ts-paths.mjs: clear.

Automated review (maintainer link)

…le .js names

A page that imports ./parts/Kpi.js for Kpi.tsx, as TypeScript and
bundlers accept, failed with ERR_FILE_NOT_FOUND: the page's own module
loader looked for the name as written. The import rewrite now points a
relative .js-family name that names no file at the TypeScript source the
shared table maps it to, and the reverse's resolution order tries that
source right after the name as written, so --reverse gives the files
back exactly.
… render format 3

Format 1 and 2 readers cannot follow ./fmt.js to fmt.ts, so they called
such a file damaged. A file in which a carried module is reached only by
the JavaScript name of its TypeScript source now says render format 3,
which they decline by naming the CLI that reads it; every other file
keeps the format it had.
…d the format check

ts-paths.mjs exports typeScriptSourcesOf, the TypeScript files a .js-family
path stands for. existingFile, resolutionCandidates and the format 3 check
use it, and the page's import rewrite calls existingFile, so the loader,
the import walk and the format check follow one rule. The export doc and
the format comment say a file whose modules import a TypeScript file by
its JavaScript name says format 3; the changeset says exactly what used
to fail. A test pins that a .js file present under its written name wins.
@josephfarina
josephfarina force-pushed the josephfarina/export-page-ts-js-imports branch from 434ae53 to 8917314 Compare November 18, 2026 18:45
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 8917314

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the code is ready, but the description's Testing section no longer matches this head after the rebase onto main.

  • Regression: after the rebase, the listed vitest command gives 2310 passed and 5 skipped (not 2286), and embedded-imports.mjs and embedded-imports.test.mjs now fail Prettier as they do on main, so update the count and name both files among those that fail on main as well, or wrap the import at embedded-imports.test.mjs:10 again.

The fix itself works: the new tests fail on main and pass here, every TypeScript-style page exports and comes back exactly with --reverse, an older CLI refuses a format-3 file by naming the CLI that wrote it, and the typechecks and ESLint pass.

Not blocking: the aliasPlugin JSDoc in page-worker.mjs still says an import the aliases do not place is left alone, but the plugin now also points a relative .js-family import at its TypeScript source.

Claims and files checked

Review mode: full; reason: rebase

  • Changeset: export now loads a page that imports a .tsx file by its .js name, which failed with ERR_FILE_NOT_FOUND. Verified: the new round-trip test (render.test.mjs:2484-2513) fails on main with that error and passes here.
  • Changeset: --reverse gives back a page that imports any TypeScript file by its .js, .jsx, .mjs or .cjs name, which it refused as damaged. Verified: on main each case exports but reverses with ERR_RENDER_SOURCE_DAMAGED; here each reverses exactly.
  • Changeset: such a file says render format 3 when the import is relative, so an earlier CLI names the CLI that reads it, and an alias import keeps format 1. Verified: render.notes.test.mjs:453-479, source-block.mjs:77, and main's CLI answers ERR_RENDER_NEWER_FORMAT naming the writer.
  • Description: a .js import of a .tsx file fails the export, while .ts by .js, .tsx by .jsx and .mts by .mjs export but fail --reverse. Verified on main.
  • Description: TypeScript with NodeNext or bundler resolution, and Vite, accept both pages. Verified: those resolvers map a .js name to its TypeScript source.
  • Description: the loader follows .js to .ts but not .tsx, and the reverse order followed neither. Verified on main.
  • Description: the rewrite covers static imports, re-exports, import() and require, for the server render and the page's script, through existingFile, and a file with the written name is used as is. Verified: page-worker.mjs:653-693, :1163, :1202, render.test.mjs:2467-2482.
  • Description: one shared table drives existingFile, resolutionCandidates and the format check. Verified: ts-paths.mjs:401-412 and its three callers.
  • Description: the reverse tries the TypeScript source right after the written name and reports the page as exact, and the carried source keeps its imports as written. Verified: embedded-imports.test.mjs:94-120, restored files byte for byte.
  • Description: every other file keeps format 1 or 2, and earlier CLIs now decline a format-3 file by naming the CLI instead of calling it damaged. Verified by tests and a cross-version run.
  • Description: the named regression tests exist. Verified.
  • Description: the test command gives 2286 passed and 5 skipped. False: 2310 passed and 5 skipped at this head.
  • Description: the strict and JSON-API typechecks and ESLint pass. Verified.
  • Description: Prettier passes on embedded-imports.mjs, embedded-imports.test.mjs, the doc and the changeset, and five other files fail on main too. False for embedded-imports.mjs and embedded-imports.test.mjs, which fail here and on main; the rest verified.
  • Description: no new public API, default or interaction model, and no internal context in public text. Verified: no command, option or export changes.
  • .changeset/export-page-ts-js-imports.md: clear.
  • packages/cli/api/render/render.notes.test.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear.
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.
  • packages/cli/foundation/render/embedded-imports.mjs: clear; its Prettier failure comes from lines main added.
  • packages/cli/foundation/render/embedded-imports.test.mjs: the import at line 10 fails Prettier (the Testing finding).
  • packages/cli/foundation/render/page-worker.mjs: non-blocking, stale aliasPlugin JSDoc.
  • packages/cli/foundation/render/source-block.mjs: clear.
  • packages/cli/foundation/render/ts-paths.mjs: clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec b1280bb

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner: the current spec records could not be checked for this head, so the spec check is held. The code and the description need no further change.

  • An engineering owner confirms in a comment that this head still conforms to the current export records (docs/architecture/cli-surface.md, its export entry, and the experimental release rule in docs/specs/AST-017/spec.md), or a re-review runs once that check can complete.

Both earlier findings are fixed: the Testing section now matches the listed results, and the alias plugin's JSDoc names the TypeScript-source step.

Claims and files checked

Review mode: full; reason: history

Claims:

  • The export now loads and gives back a page whose modules import TypeScript files by .js names: verified (render.test.mjs:2484-2513).
  • A .js name for a .tsx file used to fail with a file-not-found error: verified (the round-trip test fails on the base).
  • A .js name for a .ts file (and .jsx, .mjs, .cjs for their TypeScript twins) already exported, but --reverse called the file damaged: verified (base probe).
  • The import rewrite goes through the shared file lookup and covers static imports, re-exports, import() and require: verified (page-worker.mjs:655-695).
  • One extension table serves the lookup, the reverse order and the format check: verified (ts-paths.mjs:408-412, :431; embedded-imports.mjs:294; source-block.mjs:80).
  • --reverse tries the TypeScript source right after the name as written: verified (embedded-imports.mjs:294, embedded-imports.test.mjs:94-120).
  • The carried source keeps its imports as written and comes back byte for byte: verified (render.test.mjs:2510-2512).
  • Only a file with a relative TypeScript-style import says format 3; a path-alias import and every other file keep their format: verified (source-block.mjs:70-95, render.notes.test.mjs:463-474).
  • Earlier CLIs refuse a format 3 file by naming the CLI that wrote it instead of calling it damaged: verified (cross-version probe on identical code).
  • A .js file present under its written name is used and the file stays format 1: verified (render.test.mjs:2467-2482).
  • The listed test command gives 2310 passed, 5 skipped: verified (run on identical code; only a comment changed since).
  • The strict and JSON-API typechecks and ESLint pass: verified (run on identical code; the typecheck and lint jobs pass on this head).
  • Prettier passes for the release note and the export doc, and the other seven files fail on main as well: verified (per-file check on head and base).
  • The release note is an experimental patch entry for the CLI: verified (.changeset/export-page-ts-js-imports.md:2, :5).

Files:

  • .changeset/export-page-ts-js-imports.md: clear
  • packages/cli/api/render/render.notes.test.mjs: clear
  • packages/cli/api/render/render.test.mjs: clear
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear
  • packages/cli/foundation/render/embedded-imports.mjs: clear
  • packages/cli/foundation/render/embedded-imports.test.mjs: clear
  • packages/cli/foundation/render/page-worker.mjs: clear
  • packages/cli/foundation/render/source-block.mjs: clear
  • packages/cli/foundation/render/ts-paths.mjs: clear

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision update (engineering owner, covering this pull request at its current head): this head conforms to the current export records, the architecture:cli-surface export entry and the experimental release rule in spec:AST-017. It changes no record, and its code is unchanged since the earlier approved head apart from the rebase onto main and one doc comment. The render format 3 decision above stands.

@astracat-bot

astracat-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

In reply to @josephfarina

I'll run a full review to re-check this with your note.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec ef9ae4f

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI's test jobs have not run on this head, because the CI run was refused for lack of room and cancelled, so all jobs need a re-run before merge.

The .tsx export fix, the --reverse order for relative .js-family names of TypeScript files, and render format 3 behave as the description says, and the new tests fail on main and pass here. No code or description change is needed.

Claims and files checked

Review mode: full; reason: other:last review read no source

  • A page whose modules import a .tsx file by its .js name fails to export on main with a file-not-found error: verified, the new round-trip test in render.test.mjs:2484 fails that way on main.
  • A page that imports a .ts file by its .js name (or .tsx by .jsx, .mts by .mjs) already exports on main, but --reverse refuses it as damaged: verified by running each case with the CLI on main.
  • TypeScript under NodeNext or bundler resolution, and Vite, accept both pages: verified against their documented resolution of a .js name to its TypeScript source (not reproduced here).
  • The loader on main follows a .js name to a .ts file but not to a .tsx one, and the reverse order follows neither: verified, main exports the .ts case and fails the .tsx one, and the new resolutionCandidates test fails on main.
  • The import rewrite covers static imports, re-exports, import() and require, for the server render and the page's script, through existingFile, and a file under the name as written is used as is: verified, page-worker.mjs:655-695, :1150-1209, :1466-1472, and render.test.mjs:2467.
  • typeScriptSourcesOf gives one table to existingFile, resolutionCandidates and the format check: verified, ts-paths.mjs:408-431, embedded-imports.mjs:294, source-block.mjs:80.
  • --reverse tries the TypeScript source right after the name as written and reports the page as exact: verified, embedded-imports.mjs:291-298, embedded-imports.test.mjs:94, render.test.mjs:2508.
  • The carried source keeps its imports as written: verified, the round-trip test compares every restored file byte for byte.
  • A file with such a relative import says render format 3, earlier CLIs name the CLI that reads it, other files keep format 1 or 2, and a path-alias import keeps format 1: verified, source-block.mjs:70-96, render.notes.test.mjs:463-474, and the CLI on main answering the newer-format error for each format-3 file.
  • The reproduction and the result (three modules carried, one through import(), the text shown, an exact reverse): verified, the tests fail on main and pass here.
  • Unchanged paths (extensionless and .json imports; a .js file present under its name is used and stays format 1): verified, embedded-imports.test.mjs:116 and render.test.mjs:2467 pass on both.
  • Earlier CLIs called such a file damaged and now refuse it by naming the CLI that wrote it: verified for the CLI on main; older releases were not run.
  • The three named regression tests exist and cover what they say: verified.
  • The listed test command gives 2310 passed, 5 skipped: verified.
  • typecheck:strict, typecheck:json-api and ESLint on the changed files pass: verified.
  • Prettier passes the export doc and the changeset, and the other seven files fail on main as well: verified on both trees.
  • Scope: one defect, no tagalong, no hidden public API, default or interaction model, no internal context: verified.
  • Changeset: a patch for @astryxdesign/cli marked [experimental] that names the command: verified, as the experimental release rule requires.
  • Changeset: the export now loads a page that imports a .tsx file by its .js name, which used to fail: verified.
  • Changeset: --reverse gives back a page that imports TypeScript files by .js, .jsx, .mjs or .cjs names, which it used to refuse as damaged: verified for each extension.
  • Changeset: such a relative-import file says format 3 so an earlier CLI names the newer one, and a path-alias import keeps format 1: verified.
  • The export doc's format paragraph matches formatFor: verified.
  • .changeset/export-page-ts-js-imports.md: clear
  • packages/cli/api/render/render.notes.test.mjs: clear
  • packages/cli/api/render/render.test.mjs: clear
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear
  • packages/cli/foundation/render/embedded-imports.mjs: clear
  • packages/cli/foundation/render/embedded-imports.test.mjs: clear
  • packages/cli/foundation/render/page-worker.mjs: clear
  • packages/cli/foundation/render/source-block.mjs: clear
  • packages/cli/foundation/render/ts-paths.mjs: clear

Automated review (maintainer link)

josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12635 fix(cli): export loads and gives back a page whose modules import TypeScript files by .js names
  Author: @josephfarina
- #12727 fix(cli): export loads a served package's subpath exported only to imports
  Author: @josephfarina
- #12224 fix(cli): a {@link} in a template description resolves as astryx docs resolves it
  Author: @josephfarina
- #12278 fix(core): a Theme given a value that is not a theme keeps the page running
  Author: @josephfarina
- #12751 feat(Layout): LayoutContent names its container, so a theme styles a dialog's body apart from its header and footer
  Author: @josephfarina
- #12168 fix(templates): header, footer and toolbar rows wrap for longer translated labels
  Author: @josephfarina
- #12399 [experimental] export: the dropped-text warning checks Core's docs, and text not drawn yet inside Core components that take children no longer warns
  Author: @josephfarina
- #12541 [docs] Core: list the props ComplexSelector, Selector, Toast and ContextMenuItem take
  Author: @josephfarina
- #12676 docs(cli): a short form keeps its own 640 column inside a wide template frame
  Author: @josephfarina
- #12458 fix(core): Field labels use the primary text colour
  Author: @josephfarina
- #12373 [experimental] export: a link to a place in the page stays in the file in a srcdoc viewer frame
  Author: @josephfarina
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12827.

@github-actions
github-actions Bot deleted the josephfarina/export-page-ts-js-imports branch November 20, 2026 06:06

This branch was successfully deployed

1 active deployment
Preview — ef9ae4f7 Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant