Repository navigation
perf(cli): theme build keeps the JavaScript it compiles from a theme's local modules - #11954
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec aa2a96c |
There was a problem hiding this comment.
Changes requested: the kept compile is a clear speed-up and its tests pass, but two things need fixing first.
self-contained.mjsstamps Babel's files after the compile (lines 379-387), so a process that loaded Babel and outlives a Babel reinstall keeps JavaScript from the old Babel under the new files' stamps and later builds read it back until the module changes; stamp the compiler files once when the process first loads them and keep a later compile only while its stamps still match those.- The changeset says a repeat build "loads no Babel", but every build still loads
@babel/parserto read the module's imports, so say it loads neither@babel/corenor its TypeScript and JSX plugins.
The per-user cache additions to the global-mode and CLI-surface records are approved for this head. While you are in there, the header of self-contained.mjs still says it reads files only through the adapter's reader, and the gather-cache.mjs header does not list this new user of persistedSummary.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
- A repeat build of an unchanged module is about 200 ms faster: consistent; a one-module probe read back in about 22 ms against about 143 ms for a first compile (the description's benchmark was not re-run).
- The compiled JavaScript is read back while the source, options, rewritten imports and Babel's files are unchanged: verified in a fresh process (new tests; mutations); false in a process that loaded Babel before a reinstall (first finding).
- Such a build loads no Babel: false;
@babel/parserstill loads (second finding). - A first build and a build after an edit compile as before: verified (the source is in the key; test).
- The written files do not change: verified (tests compare with a fresh compile; the seven published themes build to identical
theme.csson base and head). - The key holds the file name,
babelrc: false,configFile: false, source type, plugin paths and options, the rewrites and the rewriting plugin's code: verified (compileOptions,compileModule). - Babel's environment (
BABEL_ENV, elseNODE_ENV) is in the key: verified; removing it fails the environment row. - The CLI build id is part of the entry: verified (
summaryAt). - Every file of the compiling code is stamped and a reinstall compiles again: verified for a new process; false for a process that loaded Babel before the reinstall (first finding).
- A module that fails to compile keeps nothing: verified (test).
- A project Babel config or
.babelrchas no effect: verified (test). - Kept only where the private per-user catalogs folder exists: verified (
gatherCacheDir). - The two records and doctor's cache row name the new entry: verified (diff; doctor row test passes).
- The tests' rows fail with no stamps kept and with the environment left out of the key: verified by mutation.
- The stamps include
@babel/core,@babel/generator,@babel/traverse,@babel/parserand the TypeScript plugin: verified (test passes). - The doc-loads registry lists the
require.cacheread: verified (test passes). - Read-back takes about 4 ms for 614 stamps: not reproduced exactly; 279 stamps per TSX-only entry here.
- The theme-edit suite's 14 local failures also fail on main: not checked; two node test shards were still running at the last CI read.
Files:
.changeset/theme-build-compiled-modules-kept.md: second finding.docs/architecture/cli-surface.md: clear.docs/specs/AST-081-global-mode/spec.md: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/api/theme/build/self-contained.kept.test.mjs: clear; all five tests fail with the base module and pass on the head.packages/cli/api/theme/build/self-contained.mjs: first finding; stale header line.packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.packages/cli/test/packed-gather-cache.records.test.mjs: clear.
# Conflicts: # docs/architecture/cli-surface.md # packages/cli/api/doctor/doctor.mjs
… while they match; headers; changeset wording
|
/approve-spec 08c0112 |
There was a problem hiding this comment.
Changes requested: the kept compile works, its tests pass, and the changeset wording is fixed, but one stamping gap remains.
self-contained.mjs(lines 397-401) takes each Babel file's stamp when a compile first finds it loaded, so a long-lived process that loaded Babel another way before a reinstall (the template source traversal, the example preview, or the import scan's@babel/parser) stores its first theme compile from the old Babel under the new files' stamps and later runs read it back; keep a compile only when no stamped file changed after the process started, or stamp Babel's modules when they are first required, and add a test that loads Babel, simulates the reinstall, and expects the first compile to keep nothing.
The per-user cache entries in the global-mode and CLI-surface records are approved for this head, and the case where an earlier theme compile loaded Babel is now covered by the new reinstall test.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- A repeat build of an unchanged local module finishes about 200 ms sooner: consistent; in the test harness a two-module registry builds in about 180 ms with a compile and about 27 ms read back (the end-to-end benchmark was not re-run).
- The compiled JavaScript is read back while the source, options, rewrites and Babel's files are unchanged: verified in a new process and when an earlier theme compile loaded Babel; false when Babel was loaded another way before a reinstall (finding above).
- Such a build loads neither
@babel/corenor its TypeScript and JSX plugins, and still uses@babel/parser: verified (no core or plugin module loaded on a read-back). - A first build and a build after an edit compile as before: verified (tests).
- The written files do not change: verified (tests compare with a fresh compile; the seven published themes build identical
theme.csson base and head). - The key holds the file name,
babelrc: false,configFile: false, the source type, the plugins' paths and options, the rewrites and the rewriting plugin's code: verified (compileOptions,compileModule). - Babel's environment (
BABEL_ENV, elseNODE_ENV) is in the key: verified; removing it fails the environment row. - The CLI's build id is part of the entry: verified (entries are keyed on it).
- Every file of the compiling code is stamped as the process first found it: verified as stated.
- A process that loaded Babel before a reinstall keeps nothing: false when another path loaded Babel first (finding above); verified when an earlier theme compile loaded it.
- A reinstall that resolves another version compiles again: verified for a new process (a changed stamp misses).
- A module that fails to compile keeps nothing: verified (test).
- A project Babel config or
.babelrchas no effect: verified (test). - Kept only where the per-user catalogs folder exists: verified (the compile never creates the folder).
- The two records and doctor's cache row name the entry: verified (diff; doctor row test passes).
- The reinstall test fails when stamps are taken after each compile: verified (it fails with the previous head's code).
- The rows fail with no stamps kept and with the environment left out of the key: verified (both mutations fail rows).
- The stamps include
@babel/core,@babel/generator,@babel/traverse,@babel/parserand the TypeScript plugin: verified (test passes). - The doc-loads registry lists the
require.cacheread: verified (test passes). - Read-back takes about 4 ms for 614 stamps: not reproduced as stated; two entries of 279 stamps read back in about 27 ms in the test harness.
- The theme, file-system, records and lazy-dependency tests pass: the records, lazy-dependency, doc-loads and self-contained build tests pass here (163 passed, 1 skipped); the full theme and file-system suites were still running.
- The 14 theme-edit failures on the author's machine also fail on main: not checked; the theme-edit suite was still running.
- No output, flag or JSON shape changes: verified for theme build's files, flags and JSON; doctor's row gains the entry, as the description says.
Files:
.changeset/theme-build-compiled-modules-kept.md: the stamp sentence is false in the case of the finding; the rest clear.docs/architecture/cli-surface.md: clear.docs/specs/AST-081-global-mode/spec.md: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/api/theme/build/self-contained.kept.test.mjs: clear; five of six tests fail with the base module and all pass on this head; the reinstall test does not cover Babel loaded another way.packages/cli/api/theme/build/self-contained.mjs: finding above.packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.packages/cli/foundation/fs/gather-cache.mjs: clear.packages/cli/test/packed-gather-cache.records.test.mjs: clear.
…t changed before the process started
|
/approve-spec cef2cb3 |
|
/approve-spec 93ad257 |
|
/approve-spec 04fe094 |
|
/approve-spec 931c3f9 |
|
/approve-spec 4bf05c1 |
# Conflicts: # docs/architecture/cli-surface.md # docs/specs/AST-081-global-mode/spec.md # packages/cli/api/doctor/doctor.mjs # packages/cli/foundation/fs/gather-cache.mjs # packages/cli/test/packed-gather-cache.records.test.mjs
…eed/theme-module-kept
|
/approve-spec 0b949ec |
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested: the reinstall gap from the last review is closed and the kept compile's tests pass, but two things remain.
- Miss: the kept compile is checked against the files of Babel's code but not against where
@babel/coreresolves its modules, so after a reinstall that points core at another copy of@babel/generator,@babel/parseror@babel/typeswhile the old copy stays on disk (as the CLI's exact7.29.8pins on parser and types leave it after a Babel patch release), the nexttheme buildreads back JavaScript a fresh compile no longer writes; please record those resolutions too (for examplereal:stamps, whichpersistedSummaryalready checks) and add a test that moves one dependency link and expects a compile. - The description lists
foundation/fs/loaded-files.mjsas new and adoc-loads.test.mjschange, but both are already onmain(from #11961) and neither is part of this diff, so please update those two bullets.
The global-mode and CLI-surface record entries are approved for this head, the public API is unchanged, and the seven published themes build identical CSS.
Claims and files checked
Review mode: full; reason: spec-record
Claims (description):
- Each local TypeScript or JSX module is compiled on every build, about 300 ms with an icon registry: consistent; a two-module registry compiles in about 230 ms in the test harness.
- The compiled JavaScript is kept beside the kept gathers and read back while its inputs are unchanged: verified (new tests; a read-back in a fresh process).
- The key covers the source text: verified (the edit row).
- The key covers the compile options, including both plugins' paths and options and the switched-off config files: verified (
compileOptions; the renamed-module row). - The key covers the rewritten imports and the rewriting plugin's code: verified (the rewrites row).
- The key covers Babel's environment name: verified (leaving it out fails the environment row).
- Entries are tied to the CLI's build id: verified (entries are keyed on it).
- Every file of the compiling code is stamped, and a compile is kept only when all of them predate the process start by 2 s: verified (both reinstall tests; keeping regardless of times fails them).
- A process that loaded Babel before a reinstall keeps nothing: verified (both reinstall tests).
- A reinstall that resolves another version of any of those modules compiles again: false when the old copy stays on disk (first finding).
- The stamping module is new in this change: false; it is already on
main(second finding). - A build of an unchanged theme loads neither
@babel/corenor its plugins and still parses imports with@babel/parser: verified (no core or plugin module loaded on a read-back; the parser loaded). - A module that fails to compile keeps nothing: verified (test).
- A first build and a build after an edit compile as before: verified (tests).
- A project Babel config or
.babelrcbeside the theme has no effect: verified (test). - Kept only where the per-user catalogs folder exists: verified (the store lookup answers nothing without a private folder, and the compile never creates it).
- The two records and doctor's cache row name the new entry: verified (diff; the records test).
- The measured runs print the same output and write byte-identical folders: consistent; a read-back equals a fresh compile in the tests, and the seven published themes build identical CSS (the end-to-end runs were not repeated).
- A read-back costs about 4 ms for 614 stamps: not reproduced as stated; two entries of 279 stamps read back in about 35 ms in the test harness, import scan included.
Claims (tests in the description):
- A second build asks for Babel 0 times and matches a fresh compile: verified.
- A project Babel config beside the theme changes nothing: verified.
- Each listed change compiles again and is read back next: verified.
- A failed compile keeps nothing and fails again: verified.
- After a reinstall during a run nothing compiled is kept, also when Babel was loaded another way first, and both tests fail when compiles are kept whatever the times: verified (mutation).
- The stamps include core, generator, traverse, parser and the TypeScript plugin: verified.
- The rows fail with no stamps kept and with the environment left out of the key: verified (mutations).
- Doctor's cache row names the entry: verified (the records test).
- The doc-loads test lists the module's require-cache read: false for this change; that row came with the module on
main(second finding). - The theme, file-system, records and lazy-dependency tests pass: verified, apart from one temp-folder test that fails the same way on the base in this environment; the theme-edit tests pass here.
- No theme build output, flag or JSON shape changes beyond doctor's row: verified.
Claims (changeset):
- A repeat build of an unchanged module finishes about 200 ms sooner: consistent (about 230 ms to about 35 ms in the test harness).
- The JavaScript is read back while the source, options, rewritten imports and every file of the Babel that compiled it are unchanged: verified as written; a moved module is the first finding.
- Such a build loads neither
@babel/corenor its TypeScript and JSX plugins: verified. - A first build and a build after an edit compile as before, and the written files do not change: verified.
Files:
.changeset/theme-build-compiled-modules-kept.md: clear.docs/architecture/cli-surface.md: clear.docs/specs/AST-081-global-mode/spec.md: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/api/theme/build/self-contained.kept.test.mjs: clear; five of seven tests fail against the base module; no test moves a dependency link.packages/cli/api/theme/build/self-contained.mjs: first finding.packages/cli/foundation/fs/gather-cache.mjs: clear.packages/cli/test/packed-gather-cache.records.test.mjs: clear.
|
/approve-spec 3059e3f |
There was a problem hiding this comment.
Changes requested: this head changes no file, so both findings below still apply.
- Miss: the kept compile is checked against the files of Babel's code but not against where
@babel/coreresolves its modules, so after a reinstall that points core at another copy of@babel/generator,@babel/parseror@babel/typeswhile the old copy stays on disk (as the CLI's exact7.29.8pins on parser and types leave it after a Babel patch release), the nexttheme buildreads back JavaScript a fresh compile no longer writes; please record those resolutions too (for examplereal:stamps, whichpersistedSummaryalready checks) and add a test that moves one dependency link and expects a compile. - The description lists
foundation/fs/loaded-files.mjsas new and adoc-loads.test.mjschange, but both are already onmain(from #11961) and neither is part of this diff, so please update those two bullets.
The global-mode and CLI-surface record entries are approved for this head, CI passes, the public API is unchanged, and the seven published themes build identical CSS.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims (description):
- Each local TypeScript or JSX module is compiled on every build, about 300 ms with an icon registry: consistent with the code; the end-to-end timing was not re-run.
- The compiled JavaScript is kept beside the kept gathers and read back while its inputs are unchanged: verified (new tests; a read-back in a fresh process).
- The key covers the source text: verified (the edit row).
- The key covers the compile options, including both plugins' paths and options and the switched-off config files: verified (
compileOptions; the renamed-module row). - The key covers the rewritten imports and the rewriting plugin's code: verified (the rewrites row).
- The key covers Babel's environment name: verified (leaving it out fails the environment row).
- Entries are tied to the CLI's build id: verified (entries are keyed on it).
- Every file of the compiling code is stamped, and a compile is kept only when all of them predate the process start by 2 s: verified (both reinstall tests; keeping regardless of times fails them).
- A process that loaded Babel before a reinstall keeps nothing: verified (both reinstall tests).
- A reinstall that resolves another version of any of those modules compiles again: false when the old copy stays on disk (first finding).
- The stamping module is new in this change: false; it is already on
main(second finding). - A build of an unchanged theme loads neither
@babel/corenor its plugins and still parses imports with@babel/parser: verified (no Babel request on a read-back; the plugins are passed as paths Babel loads only during a compile). - A module that fails to compile keeps nothing: verified (test).
- A first build and a build after an edit compile as before: verified (tests).
- A project Babel config or
.babelrcbeside the theme has no effect: verified (test). - Kept only where the per-user catalogs folder exists: verified (the store lookup answers nothing without a private folder, and the compile never creates it).
- The two records and doctor's cache row name the new entry: verified (diff; the records test).
- The measured runs print the same output and write byte-identical folders: consistent; a read-back equals a fresh compile in the tests, and the seven published themes build identical CSS.
- A read-back costs about 4 ms for 614 stamps: not re-measured; each kept entry here holds 279 stamps.
Claims (tests in the description):
- A second build asks for Babel 0 times and matches a fresh compile: verified.
- A project Babel config beside the theme changes nothing: verified.
- Each listed change compiles again and is read back next: verified.
- A failed compile keeps nothing and fails again: verified.
- After a reinstall during a run nothing compiled is kept, also when Babel was loaded another way first, and both tests fail when compiles are kept whatever the times: verified (mutation).
- The stamps include core, generator, traverse, parser and the TypeScript plugin: verified.
- The rows fail with no stamps kept and with the environment left out of the key: verified (mutations).
- Doctor's cache row names the entry: verified (the records test).
- The doc-loads test lists the module's require-cache read: false for this change; that row came with the module on
main(second finding). - The theme, file-system, records and lazy-dependency tests pass: verified for the theme build folder and the records test; CI's test jobs pass at this head.
- No theme build output, flag or JSON shape changes beyond doctor's row: verified.
Claims (changeset):
- A repeat build of an unchanged module finishes about 200 ms sooner: consistent with the skipped compile; not re-timed.
- The JavaScript is read back while the source, options, rewritten imports and every file of the Babel that compiled it are unchanged: verified as written; a moved module is the first finding.
- Such a build loads neither
@babel/corenor its TypeScript and JSX plugins: verified. - A first build and a build after an edit compile as before, and the written files do not change: verified.
Files:
.changeset/theme-build-compiled-modules-kept.md: clear.docs/architecture/cli-surface.md: clear.docs/specs/AST-081-global-mode/spec.md: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/api/theme/build/self-contained.kept.test.mjs: clear; no test moves a dependency link.packages/cli/api/theme/build/self-contained.mjs: first finding.packages/cli/foundation/fs/gather-cache.mjs: clear.packages/cli/test/packed-gather-cache.records.test.mjs: clear.
|
/approve-spec c01bb2b |
There was a problem hiding this comment.
Approved pending CI: the required checks have not finished on this head yet.
Both findings from the last review are fixed: a reinstall that points @babel/core at another copy of one of its packages now compiles again (the new relink tests fail without the folder stamps, and a real relink of @babel/generator recompiles and writes what the installed Babel writes), and the description no longer credits this change with files already on main. The global-mode and CLI-surface record entries are approved for this head, the public API is unchanged, and the seven published themes build identical CSS.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims (description):
- Each local TypeScript or JSX module is compiled with Babel on every build, about 300 ms with an icon registry: consistent with the code on
main; the timing was not re-run. - The compiled JavaScript is kept beside the kept gathers and read back while its inputs are unchanged: verified (kept test; a read-back in a fresh process).
- The key covers the source text, the compile options (file name, both config switches, source type, plugin paths and options), the rewritten imports with the rewriting plugin's code, and Babel's environment name: verified (the compile key; the compiles-again rows).
- Entries are tied to the CLI's build id: verified (entries are keyed on it).
- Every file of the compiling code, wherever it is installed, is stamped by its full stamp: verified (stamps test; dropping the stamps fails four tests).
- Every package folder Node's lookup took is stamped by the real path it resolves to, so a reinstall that points a lookup at another copy and leaves the old one compiles again: verified (relink tests; leaving the folders out fails both; a real relink of core's
@babel/generatorrecompiles). - A compile is kept only when every stamped file and folder last changed at least 2 s before the process started, so a process that loaded Babel before a reinstall keeps nothing: verified for files (both reinstall tests; keeping regardless of times fails them); the folder half is in the code, with no test.
- The shared stamping helper now also stamps lookup folders, replacing its two old functions, and css-tree's kept answers stamp their folders the same way: verified (diff; the css-tree relink test).
- A build of an unchanged theme loads neither
@babel/corenor its plugins and still parses imports with@babel/parser: verified (no Babel request on a read-back). - A module that fails to compile keeps nothing, and a first build or a build after an edit compiles as before: verified (tests).
- A project Babel config or
.babelrcbeside the theme has no effect: verified (test). - Entries are kept only where the per-user catalogs folder exists: verified (the store lookup answers nothing without a private folder).
- The two records and doctor's cache row name the new entry: verified (diff; records test).
- The measured runs print the same output and write byte-identical folders: consistent (a read-back equals a fresh compile; the seven published themes build identical CSS); timings not re-run.
- A read-back costs about 4 ms for 614 stamps: not re-measured; each kept entry here holds about 360 stamps.
Claims (tests in the description):
- A second build asks for Babel 0 times and matches a fresh compile: verified.
- A project Babel config beside the theme changes nothing: verified.
- Each listed change compiles again and is read back next: verified.
- A failed compile keeps nothing and fails again: verified.
- A reinstall during a run keeps nothing, also when Babel was loaded another way first, and both tests fail when compiles are kept whatever the times: verified (mutation).
- Relinking core's
@babel/generator, or css-tree'smdn-data, compiles again, and both tests fail without the folder stamps: verified (mutation). - The stamps include core, generator, traverse, parser and the TypeScript plugin: verified.
- The rows fail with no stamps kept and with the environment left out of the key: verified (mutations).
- Doctor's cache row names the entry: verified (records test).
- The theme, file-system, records and lazy-dependency tests pass: verified for the theme build folder, the file-system and runtime folders, the records and lazy-dependency tests (one temp-folder test in an unchanged file fails only in the review sandbox); the theme-edit failures on the author's machine were not checked.
- No theme build output, flag or JSON shape changes beyond doctor's row: verified (no public API rows; identical theme CSS).
Claims (changeset):
- A repeat build of an unchanged module finishes about 200 ms sooner: consistent with the skipped compile; not re-timed.
- The JavaScript is read back while the source, options, rewritten imports and every file of the Babel that compiled it are unchanged: verified.
- Such a build loads neither
@babel/corenor its TypeScript and JSX plugins: verified. - A first build and a build after an edit compile as before, and the written files do not change: verified.
Files:
.changeset/theme-build-compiled-modules-kept.md: clear.docs/architecture/cli-surface.md: clear.docs/specs/AST-081-global-mode/spec.md: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/api/theme/build/css-checks.kept.test.mjs: clear.packages/cli/api/theme/build/self-contained.kept.test.mjs: clear.packages/cli/api/theme/build/self-contained.mjs: clear.packages/cli/foundation/fs/gather-cache.mjs: clear.packages/cli/foundation/fs/loaded-files.mjs: clear.packages/cli/foundation/runtime/css-tree.mjs: clear.packages/cli/test/packed-gather-cache.records.test.mjs: clear.
|
/approve-spec 35b671e |
There was a problem hiding this comment.
Approved pending CI: the CI run on this head was refused for lack of room under the CI ceiling and ran no tests, so the required checks still need a re-run of all jobs.
The new commit changes no file, so the kept compile is the code reviewed before, and each of its guards is still pinned by a test that fails without it: the compile key, Babel's file stamps, the process-start rule and the stamped lookup folders. The global-mode and CLI-surface record entries are approved for this head, the public API is unchanged, and the seven published themes build identical CSS.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims (description):
- Each local TypeScript or JSX module was compiled with Babel on every build, about 300 ms with an icon registry: consistent with the code on
main, where the compile is unconditional; the timing was not re-run. - The compiled JavaScript is kept beside the kept gathers and read back while its inputs are unchanged: verified (kept test).
- The key covers the source text, the compile options (file name, both config switches, source type, plugin paths and options), the rewritten imports with the rewriting plugin's code, and Babel's environment name: verified (the compile key; the compiles-again test; leaving the environment out fails it).
- Entries are tied to the CLI's build id: verified (entries are keyed on it).
- Every file of the compiling code, wherever it is installed, is stamped by its full stamp: verified (stamps test; dropping the stamps fails four tests).
- Every package folder Node's lookup took is stamped by the real path it resolves to, so a reinstall that points a lookup at another copy and leaves the old one compiles again: verified (both relink tests; leaving the folders out fails both).
- A compile is kept only when every stamped file and folder last changed at least 2 s before the process started, so a process that loaded Babel before a reinstall keeps nothing: verified for files (both reinstall tests; keeping regardless of times fails both); the folder half is in the code, with no test.
- The shared stamping helper now also stamps lookup folders, replacing its two old functions, and css-tree's kept answers stamp their module and data folders the same way: verified (no caller of the old functions remains; the css-tree relink test).
- A build of an unchanged theme loads neither
@babel/corenor its plugins and still parses imports with@babel/parser: verified (no Babel request on a read-back; a whole build with nothing to compile loads no Babel core or plugin module). - A module that fails to compile keeps nothing, and a first build or a build after an edit compiles as before: verified (tests).
- A project Babel config or
.babelrcbeside the theme has no effect: verified (test; the compile options are those ofmain). - Entries are kept only where the per-user catalogs folder exists: verified (no private folder, no entry; the compile never creates it).
- The two records and doctor's cache row name the new entry: verified (diff; records test).
- The measured runs print the same output and write byte-identical folders: consistent (a read-back equals a fresh compile; the seven published themes build identical CSS); timings not re-run.
- A read-back costs about 4 ms for 614 stamps: not re-measured.
Claims (tests in the description):
- A second build asks for Babel 0 times and matches a fresh compile: verified.
- A project Babel config beside the theme changes nothing: verified.
- Each listed change compiles again and is read back next: verified.
- A failed compile keeps nothing and fails again: verified.
- A reinstall during a run keeps nothing, also when Babel was loaded another way first, and both tests fail when compiles are kept whatever the times: verified (mutation).
- Relinking core's
@babel/generator, or css-tree'smdn-data, compiles again, and both tests fail without the folder stamps: verified (mutation). - The stamps include core, generator, traverse, parser and the TypeScript plugin: verified.
- The rows fail with no stamps kept and with the environment left out of the key: verified (mutations).
- Doctor's cache row names the entry: verified (records test).
- The theme, file-system, records and lazy-dependency tests pass: verified for the theme, file-system and runtime folders and the records and lazy-dependency tests (one temp-folder test in an unchanged file fails the same way on
mainin the review sandbox); the theme-edit failures on the author's machine were not checked.
Claims (spec changes, rubric, scope):
- FR7, INV10 and doctor's row add the entry and need an engineering owner's approval: verified (diff; owner approval for this head).
- The added record phrase carries no narration, research, evidence, alternatives, references, open questions or status: verified (diff).
- No theme build output, flag or JSON shape changes beyond doctor's row: verified (no public API rows; identical theme CSS; no command doc change).
Claims (changeset):
- A repeat build of an unchanged module finishes about 200 ms sooner: consistent with the skipped compile; not re-timed.
- The JavaScript is read back while the source, options, rewritten imports and every file of the Babel that compiled it are unchanged: verified.
- Such a build loads neither
@babel/corenor its TypeScript and JSX plugins: verified. - A first build and a build after an edit compile as before, and the written files do not change: verified.
Files:
.changeset/theme-build-compiled-modules-kept.md: clear.docs/architecture/cli-surface.md: clear.docs/specs/AST-081-global-mode/spec.md: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/api/theme/build/css-checks.kept.test.mjs: clear.packages/cli/api/theme/build/self-contained.kept.test.mjs: clear.packages/cli/api/theme/build/self-contained.mjs: clear.packages/cli/foundation/fs/gather-cache.mjs: clear.packages/cli/foundation/fs/loaded-files.mjs: clear.packages/cli/foundation/runtime/css-tree.mjs: clear.packages/cli/test/packed-gather-cache.records.test.mjs: clear.
Summary
Since a theme build writes a self-contained module, it compiles each local TypeScript or JSX module the theme imports (an icon registry, a slot value, their helpers) with Babel on every build. That loads
@babel/coreand the TypeScript and JSX plugins and warms them up: about 300 ms per build for a theme with an icon registry, even when nothing changed since the last build.api/theme/build/self-contained.mjs: the compiled JavaScript is kept as a summary beside the kept gathers (persistedSummary) and read back while all of these are unchanged:babelrc: false,configFile: false, the source type, the plugins' paths and options;envblocks (BABEL_ENV, elseNODE_ENV);@babel/coreand of the plugins, and each module they required in turn, wherever they are installed, each by its full stamp;node_modules/<name>nearest above a module that required another package's module, such as the folder@babel/corefinds@babel/generatorin), by the real path it resolves to. A reinstall that points a lookup at another copy of a package, and leaves the old copy on disk, compiles again.foundation/fs/loaded-files.mjs(shared with css-tree's kept answers) now stamps the lookup folders too:loadedCodeStamps(from, roots)replacesloadedFilesandloadedFileStamps, and css-tree's kept answers stamp the folders their modules and MDN data were found in the same way.@babel/corenor its plugins (it still reads each module's imports with@babel/parser, as before). A module that fails to compile keeps nothing. A first build, and a build after an edit to the module, compile as before.babelrc: false,configFile: false, as before), so ababel.config.*or.babelrcbeside the theme has no effect either way.spec:AST-081FR7,architecture:cli-surfaceINV10 and doctor's cache row name the new entry.Evidence
A build of a theme with an icon registry (
icons.tsx) beside it, in a project with one integration, a fresh process per call, warm, interleaved, n=11, median paired difference (95% CI):--check@babel/coreand about 240 ms for the first transform, which loads and warms up the plugins; a second transform in the same process takes about 12 ms.Tests
api/theme/build/self-contained.kept.test.mjs(new), on a registry that renders JSX, imports a compiled helper and imports a plain module:babel.config.jsonand.babelrcbeside the theme change nothing;BABEL_ENV, a changed stamp of one of Babel's files, and a module renamed to another kind;@babel/coreat another copy of@babel/generator, the next build compiles again; the same for css-tree andmdn-dataincss-checks.kept.test.mjs(both fail when the lookup folders are not stamped);@babel/core,@babel/generator,@babel/traverse,@babel/parserand the TypeScript plugin.test/packed-gather-cache.records.test.mjs: doctor's cache row names the entry.api/theme,foundation/fs, the records tests and the lazy-dependency tests pass. The 14api/theme-editfailures on the test machine fail the same way on main.Spec changes
spec:AST-081FR7,architecture:cli-surfaceINV10 and doctor's cache row add "the JavaScripttheme buildcompiles from a theme's local TypeScript or JSX modules" to the per-user cache's entries. This needs an engineering owner's/approve-spec.Writing rubric results
For the FR7 and INV10 additions:
Scope
No
theme buildoutput, flag or JSON shape changes;doctor's cache row names the new entry.