Repository navigation
fix(cli): export loads and gives back a page whose modules import TypeScript files by .js names - #12635
fix(cli): export loads and gives back a page whose modules import TypeScript files by .js names#12635josephfarina wants to merge 6 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
Owner decision (engineering owner, covering this pull request): |
|
/approve-spec ca841c3 |
|
/approve-spec 45ab71e |
|
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. |
|
/approve-spec 0792f17 |
There was a problem hiding this comment.
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
.tsfile by its.jsname used to fail to export withERR_FILE_NOT_FOUND, but onmainonly a.jsname for a.tsxfile fails, while.jsfor.ts,.jsxfor.tsxand.mjsfor.mtsalready export and only--reverserefused them as damaged, so please reword the note to say exactly that. typeScriptSourceOfinpage-worker.mjsre-implements the TypeScript step ofexistingFilefromts-paths.mjs, which the same file already uses for the import walk and the browser bundle, so please callexistingFile(written, [])there, and buildimportsTypeScriptByJsNameandresolutionCandidatesfrom 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 insource-block.mjs.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: export loads a page whose modules import
.tsor.tsxfiles by.js-family names. Verified: the new export test, and a probe of.js,.jsx,.mjsand nested imports. - Claim: such a page used to fail with
ERR_FILE_NOT_FOUND. False for.tstargets, which already exported onmain; true for.tsxtargets (the new test fails onmain). - Claim:
--reversegives those files back exactly. Verified: the export test assertsexact: trueand 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
.jsto.ts, and the same mapping served the walk of carried modules and the browser bundle. - Claim: the rewrite covers imports, re-exports,
import()andrequire, 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
resolutionCandidatestests. - Claim: the carried source keeps its imports as written. Verified: the byte-for-byte restore.
- Claim: extensionless and
.jsonimports 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.mjsandrender.test.mjsfail it onmaintoo. Verified;source-block.mjsandrender.notes.test.mjsalso fail Prettier, as they do onmain. - 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 ofexistingFile). - File
packages/cli/foundation/render/source-block.mjs: finding (stale format comment; the format check re-derives the reverse's step).
PR Analysis Report🔎 Preview ·
|
|
/approve-spec cf3c3fd |
There was a problem hiding this comment.
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
.tsfile by its.jsname failed to export withERR_FILE_NOT_FOUNDbecause the loader looked for the name as written, but onmainonly a.jsname for a.tsxfile fails that way, while.jsfor.ts,.jsxfor.tsxand.mjsfor.mtsalready export and only--reverserefused 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
.jsname for a.tsor.tsxfile fails the export withERR_FILE_NOT_FOUND. False for.ts, which exports onmain(only--reversefailed); true for.tsx(the new export test fails onmain). - 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
.jsas.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
.tsxtargets. - Description: the page renders as it builds and
--reversegives back exactly what it carries. Verified: the export test and a probe of.js,.jsxand.mjsimports. - Description: the rewrite points a relative
.js,.jsx,.mjsor.cjsname 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()andrequireare covered, for the server render and the page's script. Verified in the code; the export test coversimport(). - 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
.jsonimports 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
maintoo. Verified;ts-paths.mjsalso fails Prettier, as it does onmain. - Changeset: the export loads a
.tsxfile imported by its.jsname, which used to fail withERR_FILE_NOT_FOUND. Verified. - Changeset:
--reversegives back a page that imports a TypeScript file by its JavaScript name, which it used to refuse as damaged. Verified for.js,.jsxand.mjs;.cjsfollows 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
.jsnames. True at this head, but the export already loaded.tstargets. - 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 withmain). - 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.
cf3c3fd to
434ae53
Compare
|
/approve-spec 434ae53 |
There was a problem hiding this comment.
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
.tsxfile by its.jsname, which failed withERR_FILE_NOT_FOUND. Verified: the new round-trip test (render.test.mjs:2475-2504) fails onmainwith that error and passes here. - Changeset:
--reversegives back a page that imports any TypeScript file by its.js,.jsx,.mjsor.cjsname, which it refused as damaged. Verified: onmaineach case exports but reverses withERR_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, andmain's CLI answersERR_RENDER_NEWER_FORMATnaming the writer. - Description: a
.jsimport of a.tsxfile fails the export, while.tsby.js,.tsxby.jsxand.mtsby.mjsexport but fail--reverse. Verified onmain. - Description: TypeScript with NodeNext or bundler resolution, and Vite, accept both pages. Verified: those resolvers map a
.jsname to its TypeScript source. - Description: the loader follows
.jsto.tsbut not.tsx, and the reverse order followed neither. Verified onmain. - Description: the rewrite covers static imports, re-exports,
import()andrequire, for the server render and the page's script, throughexistingFile, 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,resolutionCandidatesand the format check. Verified:ts-paths.mjs:408-412and 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
maintoo. 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, stalealiasPluginJSDoc.packages/cli/foundation/render/source-block.mjs: clear.packages/cli/foundation/render/ts-paths.mjs: clear.
…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.
434ae53 to
8917314
Compare
|
/approve-spec 8917314 |
There was a problem hiding this comment.
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.mjsandembedded-imports.test.mjsnow fail Prettier as they do onmain, so update the count and name both files among those that fail onmainas well, or wrap the import atembedded-imports.test.mjs:10again.
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
.tsxfile by its.jsname, which failed withERR_FILE_NOT_FOUND. Verified: the new round-trip test (render.test.mjs:2484-2513) fails onmainwith that error and passes here. - Changeset:
--reversegives back a page that imports any TypeScript file by its.js,.jsx,.mjsor.cjsname, which it refused as damaged. Verified: onmaineach case exports but reverses withERR_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, andmain's CLI answersERR_RENDER_NEWER_FORMATnaming the writer. - Description: a
.jsimport of a.tsxfile fails the export, while.tsby.js,.tsxby.jsxand.mtsby.mjsexport but fail--reverse. Verified onmain. - Description: TypeScript with NodeNext or bundler resolution, and Vite, accept both pages. Verified: those resolvers map a
.jsname to its TypeScript source. - Description: the loader follows
.jsto.tsbut not.tsx, and the reverse order followed neither. Verified onmain. - Description: the rewrite covers static imports, re-exports,
import()andrequire, for the server render and the page's script, throughexistingFile, 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,resolutionCandidatesand the format check. Verified:ts-paths.mjs:401-412and 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 onmaintoo. False forembedded-imports.mjsandembedded-imports.test.mjs, which fail here and onmain; 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 linesmainadded.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, stalealiasPluginJSDoc.packages/cli/foundation/render/source-block.mjs: clear.packages/cli/foundation/render/ts-paths.mjs: clear.
|
/approve-spec b1280bb |
There was a problem hiding this comment.
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 indocs/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
.jsnames: verified (render.test.mjs:2484-2513). - A
.jsname for a.tsxfile used to fail with a file-not-found error: verified (the round-trip test fails on the base). - A
.jsname for a.tsfile (and.jsx,.mjs,.cjsfor their TypeScript twins) already exported, but--reversecalled the file damaged: verified (base probe). - The import rewrite goes through the shared file lookup and covers static imports, re-exports,
import()andrequire: 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). --reversetries 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
.jsfile 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
mainas 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: clearpackages/cli/api/render/render.notes.test.mjs: clearpackages/cli/api/render/render.test.mjs: clearpackages/cli/assets/docs/tree/export-pages.doc.mjs: clearpackages/cli/foundation/render/embedded-imports.mjs: clearpackages/cli/foundation/render/embedded-imports.test.mjs: clearpackages/cli/foundation/render/page-worker.mjs: clearpackages/cli/foundation/render/source-block.mjs: clearpackages/cli/foundation/render/ts-paths.mjs: clear
|
Owner decision update (engineering owner, covering this pull request at its current head): this head conforms to the current export records, the |
|
I'll run a full review to re-check this with your note. |
|
/approve-spec ef9ae4f |
There was a problem hiding this comment.
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
.tsxfile by its.jsname fails to export onmainwith a file-not-found error: verified, the new round-trip test inrender.test.mjs:2484fails that way onmain. - A page that imports a
.tsfile by its.jsname (or.tsxby.jsx,.mtsby.mjs) already exports onmain, but--reverserefuses it as damaged: verified by running each case with the CLI onmain. - TypeScript under NodeNext or bundler resolution, and Vite, accept both pages: verified against their documented resolution of a
.jsname to its TypeScript source (not reproduced here). - The loader on
mainfollows a.jsname to a.tsfile but not to a.tsxone, and the reverse order follows neither: verified,mainexports the.tscase and fails the.tsxone, and the newresolutionCandidatestest fails onmain. - The import rewrite covers static imports, re-exports,
import()andrequire, for the server render and the page's script, throughexistingFile, and a file under the name as written is used as is: verified,page-worker.mjs:655-695,:1150-1209,:1466-1472, andrender.test.mjs:2467. typeScriptSourcesOfgives one table toexistingFile,resolutionCandidatesand the format check: verified,ts-paths.mjs:408-431,embedded-imports.mjs:294,source-block.mjs:80.--reversetries 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 onmainanswering 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 onmainand pass here. - Unchanged paths (extensionless and
.jsonimports; a.jsfile present under its name is used and stays format 1): verified,embedded-imports.test.mjs:116andrender.test.mjs:2467pass 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-apiand ESLint on the changed files pass: verified.- Prettier passes the export doc and the changeset, and the other seven files fail on
mainas well: verified on both trees. - Scope: one defect, no tagalong, no hidden public API, default or interaction model, no internal context: verified.
- Changeset: a
patchfor@astryxdesign/climarked[experimental]that names the command: verified, as the experimental release rule requires. - Changeset: the export now loads a page that imports a
.tsxfile by its.jsname, which used to fail: verified. - Changeset:
--reversegives back a page that imports TypeScript files by.js,.jsx,.mjsor.cjsnames, 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: clearpackages/cli/api/render/render.notes.test.mjs: clearpackages/cli/api/render/render.test.mjs: clearpackages/cli/assets/docs/tree/export-pages.doc.mjs: clearpackages/cli/foundation/render/embedded-imports.mjs: clearpackages/cli/foundation/render/embedded-imports.test.mjs: clearpackages/cli/foundation/render/page-worker.mjs: clearpackages/cli/foundation/render/source-block.mjs: clearpackages/cli/foundation/render/ts-paths.mjs: clear
- #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
|
Landed in #12827. |
User impact
A page whose modules import a
.tsxfile by its.jsname (import {Kpi} from './parts/Kpi.js'forKpi.tsx) failsastryx experimental exportwithERR_FILE_NOT_FOUND: The page imports ./parts/Kpi.js, which does not exist. A page whose modules import a.tsfile by its.jsname (or.tsxby.jsx,.mtsby.mjs) already exports, but--reverserefuses the file as damaged (ERR_RENDER_SOURCE_DAMAGED). TypeScript (withmoduleResolution: "nodenext"or"bundler") and Vite accept both pages.Problem and solution fit
.jsname to a.tsfile, but not to a.tsxfile. The reverse's resolution order follows neither, so it cannot reach the carried TypeScript files and calls the file damaged..jsnames 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
--reversegives back exactly the files it carries.Smallest restoration
.js,.jsx,.mjsor.cjsname that names no file at the TypeScript source it stands for, throughexistingFile, 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()andrequire, for the server render and the page's script.ts-paths.mjsexportstypeScriptSourcesOf, 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,resolutionCandidatesand 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--reversefinds the files and reports the page as exact.source-block.mjsrequires. 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
.tsxpart imported by.js) fails withERR_FILE_NOT_FOUND; a page that imports a.tsfile by.jsexports but--reverserefuses it as damaged.parts/Kpi.tsx,parts/fmt.ts,parts/later.tsxreached byimport()), shows its text, and--reversereportsexact: trueand writes each file back byte for byte..jsonimport, resolve as before (unit test); a.jsfile present under its written name is used instead of the TypeScript file beside it, and the file stays format 1 (export test).ERR_RENDER_SOURCE_DAMAGED; the file now says format 3, which they refuse by naming the CLI that wrote it.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 exportTesting
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:strictandtypecheck:json-apiexport-pages.doc.mjsand the changeset pass.page-worker.mjs,render.test.mjs,render.notes.test.mjs,source-block.mjs,ts-paths.mjs,embedded-imports.mjsandembedded-imports.test.mjsfail Prettier on main as well; this change leaves their existing formatting as it is.