Repository navigation
fix(cli): a theme load on an older supported Node is refused as on Node 24 - #12142
Conversation
… Node Before Node 24, an exception from a microtask reaches uncaughtException outside the async context that queued it, so the theme-load guard did not see its load and the command failed with ERR_UNKNOWN. A microtask a theme module queues while it loads now carries its load to the guard. Without module hooks (before Node 22.15), a theme that imports a stylesheet or an asset cannot load. Its refusal now names the file and the Node it needs, and says nothing was written, in place of Node's unknown-extension error. The build docs say the same. Tests that build such a theme skip without module hooks; refusal tests check each Node's message and that nothing is written.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
…same checkpoint A theme loaded through the CLI's own Core (no Core in its folder, and each member of a --family build) settles in the same microtask checkpoint as a microtask it queued. The load won the guard's race, so an exception from that microtask was dropped and the theme built. A refusal recorded while the load ran now wins over the settled load. Co-authored-by: astracat-bot[bot] <323722387+astracat-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Changes requested: the loader fix works on every Node version tried, but the release note and the new refusal name the wrong Node versions, and the new test gate duplicates an existing one.
- The changeset (line 5), the title and the User impact section scope the microtask fix to Node 22.13 and 22.14 "as on later Node", but before this change Node 22.15.0, 23.4.0 and 23.11.0 also answered
ERR_UNKNOWNand only Node 24 refused, so the note should read "On Node before 24 ... as on Node 24". - On Node 23.0 to 23.4, which
engines.node(>=22.13.0) and the version gate accept but which have nomodule.registerHooks, the new refusal says "needs Node 22.15 or later (this is Node 23.4.0)" (module-loader.mjs:311), andthemeBuild.doc.mjs:103and the changeset name only 22.13 and 22.14, so all three should say "Node 22.15 or later, or 23.5 or later". test-utils/module-hooks.mjsrepeats thehasModuleHooksthattest-utils/packed-gather-cache-fixture.mjs:522already exports, andbuild.test.mjs:60andmodule-loader.test.mjs:24keep their own copies, so keep one definition inmodule-hooks.mjs, re-export it from the fixture, and import it in those two files.
The microtask wrapper, the error mapping and the test gates need no other change.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Changeset: on Node 22.13 and 22.14 a theme module whose microtask throws while it loads is a refused load, as on later Node. False: before this change Node 22.15.0, 23.4.0 and 23.11.0 also answered the unknown-error code; only Node 24 refused.
- Changeset: a theme that imports a stylesheet or asset needs Node 22.15 or later, and on 22.13 and 22.14 its load is refused naming the file and the version it needs. Incomplete: Node 23.0 to 23.4 are refused too, and the message gives them the wrong version.
- Description: on 22.13 or 22.14 the microtask throw ends with the unknown-error code where later Node refuses the load. False for 22.15 to 23.x (same probe).
- Description: a theme importing a stylesheet or asset shows only Node's unknown-extension error on these versions. Verified on 22.13.0 at the base.
- Description: the microtask throw is now the same refused load on every supported Node. Verified on 22.13.0, 22.15.0, 23.4.0, 23.11.0 and 24.20.0.
- Description: the new refusal text for a stylesheet import. Verified word for word on 22.13.0.
- Description: the guard loses the load's async context for a microtask throw before Node 24, and Node 24 already refused. Verified by base probes.
- Description: any other load error is unchanged. Verified: the mapping returns nothing for other errors (module-loader.mjs:300-304).
- Description: the build docs say the same. Verified, with the same Node 23.0 to 23.4 gap (themeBuild.doc.mjs:103).
- Description: the supported Node range does not change. Verified: engines.node is still >=22.13.0.
- Description: one shared hasModuleHooks for tests. False: packed-gather-cache-fixture.mjs:522 already exports one, and build.test.mjs and module-loader.test.mjs keep their own.
- Description: tests that build or copy a stylesheet theme skip without module hooks, and refusal tests still check that nothing is written. Verified in the diff and on 22.13.0.
- Description: 15 theme build and editor tests fail at the base on 22.13.0 and pass or skip here. Partly verified: 14 failures reproduce in the ten affected files, and all pass or skip at the head.
- Description: the same files pass on current Node. Verified on 24.20.0 (196 passed, 2 skipped).
- Description: eslint on the changed files. Verified clean.
- .changeset/cli-minimum-node-theme-loads.md: finding (Node scope of both sentences).
- packages/cli/api/theme-edit/theme-frames-draws-box-width.test.mjs: clear.
- packages/cli/api/theme-edit/theme-starter-styles.test.mjs: clear.
- packages/cli/api/theme-edit/theme-starter-types.test.mjs: clear.
- packages/cli/api/theme/build/build-stable-family-key-replaces-header.test.mjs: clear.
- packages/cli/api/theme/build/build-stable-module-callback-runs-load.test.mjs: clear.
- packages/cli/api/theme/build/build-stable-module-changes-global-file.test.mjs: clear.
- packages/cli/api/theme/build/build-stable-value-refuses-up-file.test.mjs: clear.
- packages/cli/api/theme/build/build.test.mjs: finding (keeps its own hasModuleHooks at line 60).
- packages/cli/api/theme/themeBuild.doc.mjs: finding (names only Node 22.13 and 22.14).
- packages/cli/foundation/fs/module-loader.mjs: finding (version advice at line 311); the microtask wrapper is clear.
- packages/cli/foundation/fs/module-loader.test.mjs: finding (keeps its own hasModuleHooks at line 24).
- packages/cli/test-utils/module-hooks.mjs: finding (duplicates an existing export; header names only 22.15 and Node's own error).
There was a problem hiding this comment.
Changes requested. The new same-checkpoint fix works: a microtask throw while a theme loads is now refused on every Node tried, through either load path. Four points still need fixing:
- The changeset's "Before, Node 22.13 and 22.14 answered
ERR_UNKNOWN" (and "later Node" in the title and description) is too narrow, because Node 22.15 through 23.x also answeredERR_UNKNOWNand only Node 24 refused. - On Node 23.0 to 23.4, which have no
module.registerHooksand which the CLI accepts, the new refusal says "needs Node 22.15 or later (this is Node 23.4.0)", so the message, theERR_THEME_LOADdoc row and the changeset should say "Node 22.15 or later, or 23.5 or later". - Miss: a theme loaded through the CLI's own Core (no Core in its folder, or a
--familymember) that imports a stylesheet or asset on Node 22.13 still fails with "Unexpected token '.'", because onlyERR_UNKNOWN_FILE_EXTENSIONis mapped, so either map that load error too or narrow the changeset and doc row to themes that resolve their own Core. test-utils/module-hooks.mjsrepeats thehasModuleHooksthattest-utils/packed-gather-cache-fixture.mjsalready exports, andbuild.test.mjsandmodule-loader.test.mjskeep their own copies, so keep one definition and import it everywhere this pull request touches.
Claims and files checked
Review mode: incremental; reason: none
Rules changed since the last review: none.
Claims:
- Changeset: a microtask throw while a theme loads is a refused load naming the error on every supported Node: verified (CLI runs on Node 22.13, 22.15, 23.4, 23.5 and 24.20, with and without a Core in the theme's folder).
- Changeset: before, Node 22.13 and 22.14 answered
ERR_UNKNOWN: false as a scope (Node 22.15 through 23.x did too). - Changeset: a theme loaded through the CLI's own Core could build with the exception dropped: verified (the base builds it on Node 24.20; the new test fails there and passes here).
- Changeset and doc row: a theme importing a stylesheet or asset needs Node 22.15 or later: false for Node 23.0 to 23.4, which also lack module hooks.
- Changeset and doc row: on Node 22.13 and 22.14 such a load is refused naming the file and Node version, with nothing written: verified for a theme with its own Core; false through the CLI's own Core and for
--familymembers. - Description: the CLI supports Node 22.13 and later: verified (
engines.node, the preflight gate). - Description: before Node 24 a microtask exception reaches
uncaughtExceptionoutside its async context: verified (Node 22.13 to 23.5 lose the context; 24.20 keeps it). - Description: on these versions the microtask throw ends with
ERR_UNKNOWNwhere later Node refuses: false for 22.15 through 23.x. - Description: the stylesheet problem shows only Node's "Unknown file extension": verified for a theme with its own Core; through the CLI's own Core it is "Unexpected token".
- Description: any other load error is unchanged: verified (the mapping returns nothing for any other code or file).
- Description: one shared
hasModuleHooksfor tests: false (other copies remain, two in files this change edits). - Description: tests that build a stylesheet-importing theme skip without module hooks, and refusal tests check each Node's message: verified (all ten changed test files pass on Node 22.13 and 24.20).
- Description: 15 tests fail at the base on Node 22.13 and pass or skip here: verified (14 of the base's own tests plus the new test).
- Description: the microtask test fails at the base on Node 22.13 and passes here, and the new no-Core test fails at the base on current Node and passes here: verified.
- Description: a
[fix]changeset for the CLI: verified (patch bump).
Files:
.changeset/cli-minimum-node-theme-loads.md: findings (Node scope, 23.0 to 23.4, own-Core path).packages/cli/foundation/fs/module-loader.mjs: findings (23.0 to 23.4 advice, own-Core path); the same-checkpoint fix is clear.packages/cli/api/theme/themeBuild.doc.mjs: findings (23.0 to 23.4, own-Core path).packages/cli/test-utils/module-hooks.mjs: finding (duplicatehasModuleHooks; header names only 22.15 and Node's old error).packages/cli/api/theme/build/build.test.mjs: finding (keeps its ownhasModuleHooks).packages/cli/foundation/fs/module-loader.test.mjs: finding (keeps its ownhasModuleHooks).packages/cli/api/theme/build/build-stable-module-values-throw-refusal.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-callback-runs-load.test.mjs: clear.packages/cli/api/theme/build/build-stable-family-key-replaces-header.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-changes-global-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-value-refuses-up-file.test.mjs: clear.packages/cli/api/theme-edit/theme-frames-draws-box-width.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-styles.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-types.test.mjs: clear.
… covers the CLI's own Core A theme loaded through the CLI's own Core reads an imported stylesheet or asset as a script on a Node without module hooks, and failed with 'Unexpected token'. That syntax error now gives the same refusal, naming the file. The refusal, the build docs and the changeset name Node 22.15 or later, or 23.5 or later, and the changeset says every Node before 24 answered ERR_UNKNOWN for a microtask throw. Tests import the one hasModuleHooks.
There was a problem hiding this comment.
Changes requested. The four points from the last review are fixed: the release note's Node range, the advice for Node 23.0 to 23.4, the refusal through the CLI's own Core and --family builds, and the single hasModuleHooks. One point remains:
- Miss: F44-10 in
build-stable-plain-extends-definetheme-misspelled.test.mjs, a theme that imports a package stylesheet, still fails on Node 22.13.0 (now on the new refusal), so the description's claim that this fixes the theme build test failures of #11183 is false; gate it withit.skipIf(!hasModuleHooks)like the other stylesheet build tests.
Two optional points: the title still names only Node 22.13 and 22.14, and module-loader.test.mjs keeps one inline registerHooks check beside the imported hasModuleHooks.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims:
- Changeset: a microtask throw while a theme loads is a refused load naming the error on every supported Node: verified (CLI runs on Node 22.13, 23.4 and 24.20, with and without a Core in the theme's folder; 22.15 and 23.5 at the previous head, whose microtask code is unchanged).
- Changeset: before, every Node before 24 answered
ERR_UNKNOWN: verified (the base on 22.13, 22.15, 23.4 and 23.5). - Changeset: a theme loaded through the CLI's own Core, or a
--familymember, could build with the exception dropped: verified (the base builds it on 24.20; the head refuses). - Changeset and doc row: a theme importing a stylesheet or asset needs Node 22.15 or later, or 23.5 or later: verified (no module hooks on 22.13 and 23.4; such themes build on 24.20).
- Changeset and doc row: on an older Node that load is refused, naming the file and the Node versions, with nothing written, in place of "Unknown file extension" or "Unexpected token": verified (
.css,.svgand.scss, both load paths and a--familybuild, on 22.13 and 23.4). - Description: the CLI supports Node 22.13 and later: verified (
engines.node). - Description: before Node 24 a microtask exception reaches the guard outside its async context: verified (the fix takes effect on 22.13 and 23.4; the context is kept on 24.20).
- Description: the published 0.7.16 behaves the same on Node 22.13: not run; both failures reproduce at the base.
- Description: a failure recorded during the load wins over a load that settled first: verified (the no-Core microtask test passes on 22.13, 23.4 and 24.20).
- Description: without module hooks any other load error is unchanged: verified (syntax errors in the theme file or an imported helper keep their message).
- Description: one shared
hasModuleHooks, re-exported by the gather-cache fixture and imported by the build and module-loader tests: verified (six untouched test files keep their own check). - Description: tests that build a theme importing a stylesheet or asset skip without module hooks: false for F44-10, which builds a theme importing a package stylesheet and does not skip.
- Description: refusal tests still check on every Node that the load is refused and nothing is written: verified.
- Description: 15 tests fail at the base on Node 22.13 and pass or skip with this change: false (the base fails 15 across the theme build tests and the stylesheet theme editor tests; F44-10 still fails here).
- Description: the microtask, no-Core microtask and no-Core stylesheet tests fail at the base and pass here: verified.
- Description: by-hand runs on Node 22.13 and current Node: verified.
- Description: the changed test files pass on Node 22.13 and current Node, eslint is clean and the knowledge check passes: verified.
- Description: fixes the theme build and theme editor test failures of #11183: false (F44-10).
- Description: carries the microtask fix of #12032 and supersedes it: verified (#12032 is open with the same fix).
- Description and changeset: the supported Node range is unchanged and the change is a
[fix]patch: verified (the changeset check passes).
Files:
.changeset/cli-minimum-node-theme-loads.md: clear.packages/cli/foundation/fs/module-loader.mjs: clear.packages/cli/api/theme/themeBuild.doc.mjs: clear.packages/cli/test-utils/module-hooks.mjs: clear.packages/cli/test-utils/packed-gather-cache-fixture.mjs: clear.packages/cli/api/theme/build/build.test.mjs: clear.packages/cli/foundation/fs/module-loader.test.mjs: note (one inlineregisterHookscheck remains).packages/cli/api/theme/build/build-stable-module-values-throw-refusal.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-callback-runs-load.test.mjs: clear.packages/cli/api/theme/build/build-stable-family-key-replaces-header.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-changes-global-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-value-refuses-up-file.test.mjs: clear.packages/cli/api/theme-edit/theme-frames-draws-box-width.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-styles.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-types.test.mjs: clear.- Unchanged
packages/cli/api/theme/build/build-stable-plain-extends-definetheme-misspelled.test.mjs: finding (F44-10 is not gated).
F44-10 builds a theme that imports a package stylesheet, which needs module hooks. It skips without them, like the other stylesheet build tests, and the module loader test uses the shared hasModuleHooks.
There was a problem hiding this comment.
Changes requested. The last review's remaining point is fixed: the package stylesheet build test (F44-10) now skips without module hooks, and the two optional points, the title and the inline registerHooks check, are fixed too. One point remains:
- Miss:
if (failure) throw failure.error;atpackages/cli/foundation/fs/module-loader.mjs:784fails TypeScript (TS2339:failureis narrowed toneverbecause it is assigned only inside thefailclosure), so the rootpnpm buildstops at the CLI'ssync:api-typesstep and the CLI'stypecheck:strictfails, which matches the Vercel preview failing at every head since that line was added; declaring it at line 742 aslet failure = /** @type {{error: unknown} | null} */ (null);makessync:api-typespass.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims:
- Changeset: a theme module that throws from a microtask while it loads is a refused theme load naming the error on every supported Node: verified (head tests on Node 22.13 and 24.20; the last review's CLI runs on 22.13, 23.4 and 24.20, with the loader unchanged since).
- Changeset: before, every Node before 24 answered
ERR_UNKNOWN: verified (base runs on 22.13, 22.15, 23.4 and 23.5; the microtask refusal test fails at the base on 22.13). - Changeset: a theme loaded through the CLI's own Core, or a
--familymember, could build with the exception dropped: verified (the base builds it on 24.20; the no-Core microtask test passes at the head on 22.13 and 24.20). - Changeset and doc row: a theme importing a stylesheet or asset needs Node 22.15 or later, or 23.5 or later: verified (
module.registerHooksis missing on 22.13 and 23.4). - Changeset and doc row: on an older Node that load is refused, naming the file and the Node versions, with nothing written, in place of "Unknown file extension" or "Unexpected token": verified (the new
.cssand.svgtest on 22.13, and the updated build, module loader and theme editor expectations). - Description: the CLI supports Node 22.13 and later: verified (
engines.node). - Description: before Node 24 a microtask exception reaches the guard outside its async context: verified (the fix takes effect on 22.13 and 23.4; the context is kept on 24.20).
- Description: the published 0.7.16 behaves the same on Node 22.13: verified by reading that release's loader (no theme module guard, and the load runs unchanged without module hooks); not run.
- Description: a refusal recorded during the load wins over a load that settled in the same checkpoint: verified (the no-Core microtask test).
- Description: without module hooks any other load error is unchanged: verified (only stylesheet and asset files are mapped; syntax errors in a theme file or helper keep their message).
- Description: one shared
hasModuleHooks, re-exported by the gather-cache fixture and imported by the build and module loader tests: verified. - Description: tests that build or copy a theme importing a stylesheet or asset, a package stylesheet included, skip without module hooks: verified (the package stylesheet test now skips; no such test fails on 22.13).
- Description: refusal tests still check on every Node that the load is refused and nothing is written, with each Node's message: verified.
- Description: 15 theme build and theme editor tests fail at the base on Node 22.13 and pass or skip with this change: verified (15 at the base, none at the head, over 86 theme test files).
- Description: the microtask, no-Core microtask and no-Core stylesheet tests fail at the base and pass here: verified.
- Description: the same files pass on current Node: verified (202 passed, 3 skipped on 24.20).
- Description: eslint on the changed files and the knowledge check pass: verified.
- Description: fixes the theme build and theme editor test failures of the minimum-Node issue, not its global-mode smoke failure: verified.
- Description: carries the earlier microtask fix with its co-author credit and supersedes it: verified (that pull request is open with the same approach; the commit carries the co-author trailer).
- Description and changeset: the supported Node range is unchanged and the change is a
[fix]patch: verified (the changeset check passes).
Files:
.changeset/cli-minimum-node-theme-loads.md: clear.packages/cli/foundation/fs/module-loader.mjs: finding (line 784 fails TypeScript, so the root build and the CLI typecheck fail).packages/cli/api/theme/themeBuild.doc.mjs: clear.packages/cli/test-utils/module-hooks.mjs: clear.packages/cli/test-utils/packed-gather-cache-fixture.mjs: clear.packages/cli/api/theme/build/build.test.mjs: clear.packages/cli/foundation/fs/module-loader.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-values-throw-refusal.test.mjs: clear.packages/cli/api/theme/build/build-stable-plain-extends-definetheme-misspelled.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-callback-runs-load.test.mjs: clear.packages/cli/api/theme/build/build-stable-family-key-replaces-header.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-changes-global-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-value-refuses-up-file.test.mjs: clear.packages/cli/api/theme-edit/theme-frames-draws-box-width.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-styles.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-types.test.mjs: clear.
TypeScript narrowed the refusal, assigned only inside its closure, to never at the check after the race. It is now held in an object, so the strict type check and the API type sync pass.
There was a problem hiding this comment.
Approved pending CI: CI is running on this head, and its required checks still have to pass before merge. No blocking findings.
- Miss, not blocking and unchanged from the base: on a Node without module hooks, a theme that imports the stylesheet its own build writes still answers "Cannot find module './p.css'. Make sure all imports in the theme file are resolvable." from a clean checkout; mapping a module-not-found error for a stylesheet or asset specifier in
needsModuleHookswould give it the same named refusal.
Claims and files checked
Review mode: same-head; reason: none
changed rules (0): none
Claims:
- Changeset: a theme module that throws from a microtask while it loads is a refused theme load naming the error on every supported Node: verified (the microtask tests in
build-stable-module-values-throw-refusal.test.mjson Node 22.13 and 24.20, and CLI runs with and without a Core in the folder). - Changeset: before, every Node before 24 answered
ERR_UNKNOWN: verified (base CLI runs on 22.13; earlier runs on 22.15, 23.4 and 23.5 with the same loader logic). - Changeset: a theme loaded through the CLI's own Core, or a
--familymember, could build with the exception dropped: verified (the no-Core microtask test passes at the head on 22.13 and 24.20; the base built that theme on 24.20). - Changeset and doc row: a theme importing a stylesheet or asset needs Node 22.15 or later, or 23.5 or later: verified (
module.registerHooksis missing on 22.13 and 23.4; theme build refuses such a theme on 22.13 on both load paths). - Changeset and doc row: on an older Node that load is refused, naming the file and the Node versions, with nothing written, in place of "Unknown file extension" or "Unexpected token": verified (CLI runs on 22.13 on both load paths, and the new
.cssand.svgtest). - Title: a theme load on an older supported Node is refused as on Node 24: verified for the microtask throw (
ERR_THEME_LOADon 22.13 as on 24.20). - Description: the CLI supports Node 22.13 and later: verified (
packages/cli/package.jsonengines.node). - Description: before Node 24 a microtask exception reaches the guard outside its async context: verified (the wrapper makes the refusal take effect on 22.13; the context is kept on 24.20).
- Description: the published 0.7.16 behaves the same on Node 22.13: verified by reading that release's loader in an earlier review; not run.
- Description: a refusal recorded during the load wins over a load that settled in the same checkpoint: verified (
module-loader.mjs:742-784and the no-Core microtask test). - Description: without module hooks any other load error is unchanged: verified (only stylesheet and asset files are mapped at
module-loader.mjs:316-328; a missing file keeps its message). - Description: one shared
hasModuleHooks, re-exported by the gather-cache fixture and imported by the build and module loader tests: verified (module-hooks.mjs:17,packed-gather-cache-fixture.mjs:521,build.test.mjs:39,module-loader.test.mjs:18). - Description: tests that build or copy a theme importing a stylesheet or asset, a package stylesheet included, skip without module hooks: verified (no such test fails on 22.13).
- Description: refusal tests still check on every Node that the load is refused and nothing is written, with each Node's message: verified.
- Description: 15 theme build and theme editor tests fail at the base on Node 22.13 and pass or skip with this change: verified (15 at the base, none at the head for these causes).
- Description: the microtask, no-Core microtask and no-Core stylesheet tests fail at the base and pass here: verified (the microtask test fails at the base on 22.13; the two new tests pass at the head on 22.13).
- Description: the same files pass on current Node: verified (202 passed, 3 skipped on 24.20).
- Description: eslint, the knowledge check, the API type sync and the strict typecheck report nothing in the changed files: verified (the strict check's two remaining errors are template imports of an unbuilt theme package, as at the base; CI's typecheck passes on this head).
- Description: fixes the theme build and theme editor test failures of the minimum-Node issue, not its global-mode smoke failure: verified (the issue's daily run lists exactly these theme failures; the issue stays open).
- Description: carries the earlier microtask fix with co-author credit and supersedes it, and the other overlapping pull requests change other things: verified (that pull request is open with the same approach and a commit here carries the co-author trailer; the others change the theme build's Core facts, the doctor font check and the theme eject doc).
- Description and changeset: the supported Node range is unchanged and the change is a
[fix]patch: verified (pnpm check:changesetspasses).
Files:
.changeset/cli-minimum-node-theme-loads.md: clear.packages/cli/foundation/fs/module-loader.mjs: non-blocking note (own-output stylesheet import on a Node without module hooks, unchanged from the base).packages/cli/api/theme/themeBuild.doc.mjs: clear.packages/cli/test-utils/module-hooks.mjs: clear.packages/cli/test-utils/packed-gather-cache-fixture.mjs: clear.packages/cli/api/theme/build/build.test.mjs: clear.packages/cli/foundation/fs/module-loader.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-values-throw-refusal.test.mjs: clear.packages/cli/api/theme/build/build-stable-plain-extends-definetheme-misspelled.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-callback-runs-load.test.mjs: clear.packages/cli/api/theme/build/build-stable-family-key-replaces-header.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-changes-global-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-value-refuses-up-file.test.mjs: clear.packages/cli/api/theme-edit/theme-frames-draws-box-width.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-styles.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-types.test.mjs: clear.
| * @param {unknown} error | ||
| * @returns {Error | null} | ||
| */ | ||
| function needsModuleHooks(error) { |
There was a problem hiding this comment.
Not blocking, and unchanged from the base: on a Node without module hooks, a theme that imports the stylesheet its own build writes (import './p.css' in a clean checkout) still answers "Cannot find module './p.css'. Make sure all imports in the theme file are resolvable.", which sends the person to fix a correct import. Mapping a module-not-found error for a stylesheet or asset specifier here would give it the same named refusal.
|
/approve-spec bf08f70 |
|
/approve-spec 2191bb8 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because the pull request is a draft; its checks run once it is marked ready for review.
The merge of main leaves the fix as it was: a microtask throw while a theme loads is ERR_THEME_LOAD on every supported Node and both load paths, and a stylesheet or asset import on a Node without module hooks is refused with a message that names the file and the Node versions that load it. The new tests fail on the base and pass at this head on Node 22.13.0 and 24.20.0.
- Not blocking, unchanged from the base: on a Node without module hooks, a theme that imports the stylesheet its own build writes still answers "Cannot find module './p.css'", which sends the person to fix a correct import; the open inline note on
module-loader.mjssuggests mapping that case too.
Claims and files checked
Review mode: incremental; reason: none
Claims:
- Release note: a theme module that throws from a microtask while it loads is a refused load (
ERR_THEME_LOAD) on every supported Node. Verified: CLI runs on Node 22.13.0 and 24.20.0, with and without a Core in the folder; the throw-refusal tests pass on both. - Release note: before, Node before 24 answered
ERR_UNKNOWN, and a theme loaded through the CLI's own Core could build with the exception dropped. Verified: the head's new tests fail on the base withERR_UNKNOWNon Node 22.13.0, and the no-Core case builds on the base on Node 24.20.0. - Release note: a stylesheet or asset import still needs Node 22.15 or 23.5; on an older Node the load is refused, naming the file and those versions, and nothing is written. Verified:
module-loader.mjs:316-329; CLI runs with.css,.scssand.svgimports on Node 22.13.0 give that refusal and write no output. - The supported Node range (
>=22.13.0) does not change. Verified:packages/cli/package.json:29. - Before, the person saw "Unknown file extension" with a Core in the folder and "Unexpected token '.'" through the CLI's own Core. Verified: base test failures on Node 22.13.0.
- Both problems already exist in the published v0.7.16. Verified as consistent: that release's loader has neither the stylesheet hook nor the module-load guards.
- The quoted refusal text. Verified: it matches the CLI output on Node 22.13.0 word for word.
- Any other load error is unchanged. Verified:
module-loader.mjs:364rethrows the original error when the mapping returns null. - One shared
hasModuleHooksfor tests, re-exported by the gather-cache fixture and imported by the build and loader tests. Verified:module-hooks.mjs:17,packed-gather-cache-fixture.mjs:521,build.test.mjs:39,module-loader.test.mjs:18. - 15 theme build and theme editor tests fail on Node 22.13.0 at the base and pass or skip here; the same files pass on current Node. Verified: base 15 failed; head 190 passed and 15 skipped on 22.13.0, 202 passed and 3 skipped on 24.20.0.
- Lint, knowledge check and declaration sync. Verified at this head: eslint (no errors), prettier, the changeset check, the knowledge check and the CLI declaration sync pass.
- This fixes the theme build and theme editor failures of the minimum-Node issue, and not its global-mode smoke failure. Verified: the issue's latest daily run reports the same 15 theme failures, plus the smoke and two failures outside theme loading.
- The earlier community pull request found the microtask cause first and is credited. Verified: the same-checkpoint commit carries a co-author trailer.
Files:
.changeset/cli-minimum-node-theme-loads.md: clear.packages/cli/foundation/fs/module-loader.mjs: non-blocking note (own-stylesheet message, above).packages/cli/api/theme/themeBuild.doc.mjs: clear; merges cleanly beside the updatedERR_FILE_EXISTSrow frommain.packages/cli/test-utils/module-hooks.mjs: clear.packages/cli/test-utils/packed-gather-cache-fixture.mjs: clear.packages/cli/foundation/fs/module-loader.test.mjs: clear.packages/cli/api/theme/build/build.test.mjs: clear;main's changes to other blocks merge cleanly.packages/cli/api/theme/build/build-stable-module-values-throw-refusal.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-callback-runs-load.test.mjs: clear.packages/cli/api/theme/build/build-stable-family-key-replaces-header.test.mjs: clear.packages/cli/api/theme/build/build-stable-value-refuses-up-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-changes-global-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-plain-extends-definetheme-misspelled.test.mjs: clear.packages/cli/api/theme-edit/theme-frames-draws-box-width.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-styles.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-types.test.mjs: clear.
On macOS the temp folder sits behind a link (/var is /private/var). The files a theme imports are listed by real path, so the case that lists a theme's local imports expected /var paths and got /private/var ones. The tests' folder is now its real path, as other CLI tests already do.
There was a problem hiding this comment.
Changes requested: the loader fix works on every Node version tried, and one claim in the description needs correcting.
- Miss: the description calls
packages/cli/test-utils/module-hooks.mjs"the onehasModuleHooksfor tests", butbuild.family.test.mjs,build.core-on-demand.test.mjs,gather-cache.test.mjs,gather-cache.deps.test.mjsandpacked-docs-routes.test.mjsstill compute their own copy, so reword that bullet to name the three files it consolidates, or move those five onto the helper.
A microtask throw while a theme loads is now ERR_THEME_LOAD on Node 22.13, 22.15, 23.4 and 24.20, and a stylesheet or asset import on a Node without module hooks is refused with a message that names the file and the Node versions that load it; the new tests fail on the base and pass here. The open non-blocking note on module-loader.mjs about a theme that imports its own unbuilt stylesheet still applies, and Node 22.15 answers the same way through the CLI's own Core. CI has not run on this head yet, because the pull request is a draft.
Claims and files checked
Review mode: incremental; reason: none
Claims:
- Release note: a theme module that throws from a microtask while it loads is a refused load (
ERR_THEME_LOAD) on every supported Node. Verified: CLI runs on Node 22.13.0, 22.15.0, 23.4.0 and 24.20.0; the throw-refusal tests pass on 22.13.0 and 24.20.0. - Release note: before, Node before 24 answered
ERR_UNKNOWN, and a theme loaded through the CLI's own Core could build with the exception dropped. Verified: base CLI runs answerERR_UNKNOWNon 22.13.0, 22.15.0 and 23.4.0 and build on 24.20.0 with no Core in the folder; the new tests fail on the base. - Release note: a stylesheet or asset import still needs Node 22.15 or 23.5; on an older Node the load is refused, naming the file and those versions and saying nothing was written, in place of "Unknown file extension" or "Unexpected token". Verified:
module-loader.mjs:316-329and:360-366; CLI runs with.cssand.svgimports on 22.13.0 and 23.4.0. - The supported Node range (
>=22.13.0) does not change. Verified:packages/cli/package.json:29. - Before, Node before 24 ended a microtask throw with
ERR_UNKNOWNwhere Node 24 gave a refused load and a theme template to compare with. Verified: base runs; the head's refusal carries the template suggestion. - Before, a stylesheet or asset import failed with "Unknown file extension" natively or "Unexpected token '.'" through the CLI's own Core. Verified: base runs on 22.13.0 and 23.4.0 and the base test expectations.
- Through the CLI's own Core the load settled with the throw, so the theme built on every Node. Verified: the no-Core test fails on the base on 24.20.0 (exit 0) and passes here.
- Both problems already exist in the published 0.7.16. Verified as consistent: that release's loader has neither the stylesheet hook nor the load guards.
- The quoted refusal text. Verified: it matches the CLI output on 22.13.0 word for word.
- Cause and fix: the async context is lost before Node 24, a queued microtask now keeps its load, and a refusal recorded during the load wins. Verified:
module-loader.mjs:617-642,:742-748,:784. - Module hooks exist from 22.15 and 23.5, and without them the load runs unchanged. Verified: 22.15.0 builds the stylesheet theme, 23.4.0 refuses it;
module-loader.mjs:360. - Any other load error is unchanged. Verified:
module-loader.mjs:364. - The
ERR_THEME_LOADdoc row names the Node limit. Verified:themeBuild.doc.mjs:103. module-hooks.mjsis the onehasModuleHooksfor tests, re-exported by the gather-cache fixture and imported by the build and loader tests. False in part: the re-export and imports hold (packed-gather-cache-fixture.mjs:521,build.test.mjs:39,module-loader.test.mjs:18), but five other test files keep their own copy (above).- Stylesheet and asset build tests skip without module hooks, and refusal tests still check on every Node that nothing is written. Verified: the
it.skipIfgates and forked expectations in the changed test files. - A
[fix]patch changeset. Verified: the changeset check passes. build.test.mjsreads its temp folder by its real path so the local-imports case passes on macOS. Verified: with the temp folder behind a link, the case fails with the old line and passes with the new one.- 15 theme build and theme editor tests fail on Node 22.13.0 at the base and pass or skip here; the same files pass on current Node. Verified: base 15 failed; head 190 passed and 15 skipped on 22.13.0, 202 passed and 3 skipped on 24.20.0.
- Lint, knowledge check, declaration sync and strict typecheck. Verified: eslint (no errors), prettier, the changeset and knowledge checks and the declaration sync pass; the strict typecheck reports only the two template imports of an unbuilt theme package.
- The earlier community pull request is credited. Verified: a co-author trailer on the same-checkpoint commit.
- This fixes the theme build and theme editor failures of the minimum-Node issue, not its smoke failure. Verified: every base failure on 22.13.0 is a theme build or theme editor test.
Files:
.changeset/cli-minimum-node-theme-loads.md: clear.packages/cli/foundation/fs/module-loader.mjs: non-blocking note (own unbuilt stylesheet, above).packages/cli/api/theme/themeBuild.doc.mjs: clear.packages/cli/test-utils/module-hooks.mjs: blocking finding (the description's "the one" claim, above).packages/cli/test-utils/packed-gather-cache-fixture.mjs: clear.packages/cli/foundation/fs/module-loader.test.mjs: clear.packages/cli/api/theme/build/build.test.mjs: clear; the real-path change is test-only.packages/cli/api/theme/build/build-stable-module-values-throw-refusal.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-callback-runs-load.test.mjs: clear.packages/cli/api/theme/build/build-stable-family-key-replaces-header.test.mjs: clear.packages/cli/api/theme/build/build-stable-value-refuses-up-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-changes-global-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-plain-extends-definetheme-misspelled.test.mjs: clear.packages/cli/api/theme-edit/theme-frames-draws-box-width.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-styles.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-types.test.mjs: clear.
There was a problem hiding this comment.
Approved pending CI: required CI has not run on this head yet. Its earlier CI runs stopped before their tests because CI was full, and a new run has just started; its required checks must pass before merge.
A microtask throw while a theme loads is now ERR_THEME_LOAD on every supported Node and on both load paths, and a stylesheet or asset import on a Node without module hooks is refused with a message that names the file and the Node versions that load it. Two non-blocking notes stay open: the existing note on module-loader.mjs about a theme that imports its own unbuilt stylesheet, and test/packed-help-imports.test.mjs also keeps its own hasModuleHooks copy, which the description's list leaves out.
Claims and files checked
Review mode: same-head; reason: none
Claims:
- Title: a theme load on an older supported Node is refused as on Node 24. Verified for the microtask throw, now
ERR_THEME_LOADon 22.13.0, 22.15.0, 23.4.0 and 24.20.0; a stylesheet or asset import still needs module hooks and is refused with a named message, as the description says. - Release note: a theme module that throws from a microtask while it loads is a refused load (
ERR_THEME_LOAD, naming the error) on every supported Node. Verified: CLI runs on Node 22.13.0, 22.15.0, 23.4.0 and 24.20.0; the throw-refusal tests pass on 22.13.0 and 24.20.0. - Release note: before, Node before 24 answered
ERR_UNKNOWN, and a theme loaded through the CLI's own Core could build with the exception dropped. Verified: base runs answerERR_UNKNOWNon 22.13.0, 22.15.0 and 23.4.0 and build on 24.20.0 with no Core in the folder; the new tests fail on the base. - Release note: a stylesheet or asset import still needs Node 22.15 or 23.5; on an older Node the load is refused, naming the file and those versions and saying nothing was written, in place of "Unknown file extension" or "Unexpected token". Verified:
module-loader.mjs:316-329and:360-366; CLI runs with.cssand.svgimports on 22.13.0 and 23.4.0. - The supported Node range is
>=22.13.0and does not change. Verified:packages/cli/package.json:29, unchanged. - Before, every Node before 24 ended a microtask throw with
ERR_UNKNOWN, where Node 24 gave a refused load and a theme template to compare with. Verified: base runs; the head's refusal carries the template suggestion. - Before, a stylesheet or asset import on a Node without module hooks failed with "Unknown file extension" natively or "Unexpected token '.'" through the CLI's own Core, naming no file and no next step. Verified: base runs on 22.13.0 and 23.4.0 and the base test expectations in
build.test.mjsandmodule-loader.test.mjs. - Through the CLI's own Core the load settled in the same checkpoint as the throw, so the theme built with the exception dropped. Verified: the no-Core test fails on the base on 24.20.0 (exit 0) and passes here.
- Both problems already exist in the published 0.7.16. Consistent: the base, a later version of the same loader, has neither the microtask guard nor the named refusal.
- Now the microtask throw is the same refused load on every supported Node and load path, and the stylesheet refusal reads as quoted. Verified: the quoted text matches the CLI output on 22.13.0 word for word (
module-loader.mjs:326). - Cause and fix: the async context is lost before Node 24, a queued microtask now keeps its load, and a refusal recorded during the load wins. Verified:
module-loader.mjs:617-642,:742-748,:784. - Module hooks exist from 22.15 and 23.5, and without them the load runs unchanged; either failure for a stylesheet or asset becomes the named refusal and any other error is unchanged. Verified: 22.15.0 builds the stylesheet theme, 23.4.0 refuses it;
module-loader.mjs:300-329,:364. - The
ERR_THEME_LOADdoc row documents a file that cannot be loaded and now names the Node limit. Verified:themeBuild.doc.mjs:102-103. module-hooks.mjsis a sharedhasModuleHooksfor tests; the change moves the gather-cache fixture (a re-export),build.test.mjsandmodule-loader.test.mjsonto it, and five named test files keep their own copy, unchanged. Verified as worded:packed-gather-cache-fixture.mjs:521,build.test.mjs:39,module-loader.test.mjs:18; the five named copies are unchanged. The list is not complete:test/packed-help-imports.test.mjs:117keeps a copy too (non-blocking).- Stylesheet and asset build tests skip without module hooks, and refusal tests still check on every Node that the load is refused and nothing is written, with the message each Node gives. Verified: the
it.skipIfgates and forked expectations in the changed test files. - A
[fix]patch changeset for@astryxdesign/cli. Verified:.changeset/cli-minimum-node-theme-loads.md; the changeset check passes. build.test.mjsreads its temp folder by its real path so the local-imports case passes on macOS, in a separate test-only commit. Verified: with the temp folder behind a link, the case fails with the old line and passes with the new one; the last commit touches only that file.- 15 theme build and theme editor tests fail on Node 22.13.0 at the base and pass or skip here, and the same files pass on current Node. Verified: base 15 failed; head 190 passed and 15 skipped on 22.13.0, 202 passed and 3 skipped on 24.20.0.
- The no-Core microtask test and the no-hooks
.cssand.svgtest fail on the base and pass here. Verified: red-first runs on 22.13.0 and 24.20.0. - By hand on 22.13.0 and current Node, the microtask throw and a
./brand.cssimport behave as described, with and without a Core in the theme's folder. Verified: the CLI runs cover the folder with no Core; the changed in-process build tests cover a theme with its own Core on both Nodes. - Lint, knowledge check, declaration sync and strict typecheck. Verified: eslint reports no errors and the Lint workflow passed on this head; the knowledge check and declaration sync pass; the strict typecheck reports only the two template imports of an unbuilt theme package.
- The earlier community pull request is credited and superseded. Verified: a co-author trailer on the same-checkpoint commit, and that pull request is closed unmerged.
- The other overlapping pull requests change the theme build's Core facts, doctor's font check and theme ejection, not how a theme module load fails. Verified: their changed files touch the theme build, doctor's theme checks, and served-set templates with the eject docs; none touches the module loader.
- This fixes the theme build and theme editor failures of the minimum-Node issue, not its smoke failure. Verified: every base failure on 22.13.0 is a theme build or theme editor test.
- The land path (review, CI, a minimum-Node workflow run, then merge) is a process statement with nothing in the code to check.
Files:
.changeset/cli-minimum-node-theme-loads.md: clear.packages/cli/foundation/fs/module-loader.mjs: non-blocking note (own unbuilt stylesheet, above).packages/cli/api/theme/themeBuild.doc.mjs: clear.packages/cli/test-utils/module-hooks.mjs: clear; the description's list of other copies leaves outtest/packed-help-imports.test.mjs(non-blocking).packages/cli/test-utils/packed-gather-cache-fixture.mjs: clear.packages/cli/foundation/fs/module-loader.test.mjs: clear.packages/cli/api/theme/build/build.test.mjs: clear; the real-path change is test-only.packages/cli/api/theme/build/build-stable-module-values-throw-refusal.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-callback-runs-load.test.mjs: clear.packages/cli/api/theme/build/build-stable-family-key-replaces-header.test.mjs: clear.packages/cli/api/theme/build/build-stable-value-refuses-up-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-changes-global-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-plain-extends-definetheme-misspelled.test.mjs: clear.packages/cli/api/theme-edit/theme-frames-draws-box-width.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-styles.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-types.test.mjs: clear.
|
/approve-spec 1cc0470 |
There was a problem hiding this comment.
Changes requested: one release-note claim is broader than what the change does.
- Miss: the release note says a theme that imports a stylesheet or an asset cannot load on Node before 22.15 (or 23.0 to 23.4) and is now refused, but a recorded theme whose own module imports its
.cssstill loads there (astryx componentexits 0 on Node 22.13.0 before and after this change, and theimportThemeArtifactstylesheet tests run and pass on 22.13.0), so scope that sentence totheme build, the theme editor and a recorded theme's asset or misplaced stylesheet, and make the same change in the description and thetest-utils/module-hooks.mjsheader.
The microtask fix and the named refusal check out on Node 22.13.0 and 24.20.0, and required CI has not finished on this head yet. Two non-blocking notes stay open: the existing inline note on module-loader.mjs about a theme that imports its own unbuilt stylesheet, and test/packed-help-imports.test.mjs also keeps its own hasModuleHooks copy, which the description's list leaves out.
Claims and files checked
Review mode: same-head; reason: none
Claims:
- Title: a theme load on an older supported Node is refused as on Node 24. Verified for the microtask throw (
ERR_THEME_LOADon 22.13.0, 22.15.0, 23.4.0 and 24.20.0); for stylesheet and asset imports it describes the theme build. - Release note: a theme module that throws from a microtask while it loads is a refused load (
ERR_THEME_LOAD, naming the error) on every supported Node. Verified: CLI runs on 22.13.0, 22.15.0, 23.4.0 and 24.20.0; the throw-refusal tests pass on 22.13.0 and 24.20.0. - Release note: before, Node before 24 answered
ERR_UNKNOWN, and a theme loaded through the CLI's own Core could build with the exception dropped. Verified: base runs answerERR_UNKNOWNon 22.13.0, 22.15.0 and 23.4.0 and build on 24.20.0 with no Core in the folder. - Release note: a theme that imports a stylesheet or an asset still needs Node 22.15 or 23.5 to load, and on an older Node its load is now refused with a named message. False as worded: a recorded theme that imports its own
.cssstill loads on Node 22.13.0 at the base and the head (blocking finding above); true for theme build, the theme editor, and a recorded theme's asset or a stylesheet another folder's module imports. - The supported Node range is
>=22.13.0and does not change. Verified:packages/cli/package.json, unchanged. - Before, every Node before 24 ended a microtask throw with
ERR_UNKNOWN, where Node 24 gave a refused load and a theme template to compare with. Verified: base runs; the head's refusal carries the template suggestion. - Before, a theme importing a stylesheet or asset could not load on a Node without module hooks and showed only Node's own error. Verified for theme build and for a recorded theme's asset; a recorded theme's own
.cssloaded at the base. - Through the CLI's own Core the load settled in the same checkpoint as the throw, so the theme built with the exception dropped. Verified: the no-Core test fails on the base on 24.20.0 and passes here.
- Both problems already exist in the published 0.7.16. Consistent: the base has neither the microtask guard nor the named refusal.
- Now the stylesheet refusal reads as quoted, and it is said on every load path. The text matches the CLI output on 22.13.0; 'every load path' is false for a recorded theme's own
.css, which loads (blocking finding above). - Cause and fix: the async context is lost before Node 24, a queued microtask now keeps its load, and a refusal recorded during the load wins. Verified:
module-loader.mjs:617-642,:742-748,:784. - Module hooks exist from 22.15 and 23.5; without them the load runs unchanged, either failure for a stylesheet or asset becomes the named refusal, and any other error is unchanged. Verified: 22.15.0 builds the stylesheet theme and 23.4.0 refuses it;
module-loader.mjs:300-329,:364. - The
ERR_THEME_LOADdoc row documents a file that cannot be loaded and now names the Node limit. Verified fortheme build:themeBuild.doc.mjs:103. - A shared test helper for module hooks; the gather-cache fixture re-exports it,
build.test.mjsandmodule-loader.test.mjsimport it, and five named test files keep their own copy. Verified as worded;test/packed-help-imports.test.mjs:117-119also keeps a copy (non-blocking). - Stylesheet and asset build tests skip without module hooks, and refusal tests check on every Node that the load is refused and nothing is written. Verified: the
it.skipIfgates and forked expectations in the changed test files. - A
[fix]patch changeset for the CLI package. Verified: the changeset front matter. build.test.mjsreads its temp folder by its real path so a case passes on macOS, in a separate test-only commit. Verified: the last commit touches only that file.- 15 theme build and theme editor tests fail on Node 22.13.0 at the base and pass or skip here, and the same files pass on current Node. Verified: base 15 failed; head 190 passed and 15 skipped on 22.13.0, 202 passed and 3 skipped on 24.20.0.
- The new no-Core microtask test and the no-hooks
.cssand.svgtest fail on the base and pass here. Verified: red-first runs on 22.13.0 and 24.20.0. - By hand on 22.13.0 and current Node, the microtask throw and a
./brand.cssimport behave as described, with and without a Core in the theme's folder. Verified for theme build. - Lint, knowledge check, declaration sync and strict typecheck. Verified: Lint passes in CI on this head; the knowledge check and declaration sync pass; the strict typecheck reports only two template imports of an unbuilt theme package.
- The earlier community pull request is credited and superseded. Verified: a co-author trailer, and that pull request is closed unmerged.
- The other overlapping pull requests change other parts of the theme build, doctor and ejection, not how a theme module load fails. Verified: none touches the module loader.
- This fixes the theme build and theme editor failures of the minimum-Node issue, not its smoke failure. Verified: every base failure on 22.13.0 is a theme build or theme editor test.
- The land path is a process statement with nothing in the code to check.
Files:
.changeset/cli-minimum-node-theme-loads.md: blocking (the stylesheet sentence, above).packages/cli/test-utils/module-hooks.mjs: the header repeats the stylesheet sentence (same finding).packages/cli/foundation/fs/module-loader.mjs: non-blocking note (own unbuilt stylesheet).packages/cli/api/theme/themeBuild.doc.mjs: clear.packages/cli/test-utils/packed-gather-cache-fixture.mjs: clear.packages/cli/foundation/fs/module-loader.test.mjs: clear.packages/cli/api/theme/build/build.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-values-throw-refusal.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-callback-runs-load.test.mjs: clear.packages/cli/api/theme/build/build-stable-family-key-replaces-header.test.mjs: clear.packages/cli/api/theme/build/build-stable-value-refuses-up-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-module-changes-global-file.test.mjs: clear.packages/cli/api/theme/build/build-stable-plain-extends-definetheme-misspelled.test.mjs: clear.packages/cli/api/theme-edit/theme-frames-draws-box-width.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-styles.test.mjs: clear.packages/cli/api/theme-edit/theme-starter-types.test.mjs: clear.
Theme build and the theme editor need Node 22.15 or 23.5 for a theme that imports a stylesheet or an asset, and so does a recorded theme that imports an asset or a stylesheet other than its own. A recorded theme that imports its own stylesheet loads on an older Node.
|
/approve-spec c6efeae |
There was a problem hiding this comment.
Changes requested: the release note still says more of a recorded theme's stylesheet imports are refused on an older Node than really are.
- The release note says a recorded theme that imports a stylesheet other than its own is refused on Node before 22.15 (or 23.0 to 23.4), but on Node 22.13.0 a recorded theme still loads another
.cssor Sass file beside it, a package's stylesheet and a stylesheet a sibling module imports, before and after this change (the unskippedimportThemeArtifacttests atmodule-loader.test.mjs:287and:317load two of these there), so scope the clause to an asset or a stylesheet that a module in another folder imports by a relative path, and make the same change in the description and thetest-utils/module-hooks.mjsheader.
The microtask fix and the named refusal check out on Node 22.13.0 and 24.20.0. CI has not run on this head because the pull request is a draft. Two non-blocking notes stay open: the inline note on module-loader.mjs about a theme that imports its own unbuilt stylesheet, and test/packed-help-imports.test.mjs also keeps its own hasModuleHooks copy.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (0): none
Claims:
- Title: a theme load on an older supported Node is refused as on Node 24. Verified for the microtask throw (
ERR_THEME_LOADon 22.13.0, 22.15.0, 23.4.0 and 24.20.0); for stylesheet and asset imports it describes theme build and the theme editor. - Release note: a theme module that throws from a microtask while it loads is a refused load (
ERR_THEME_LOAD, naming the error) on every supported Node. Verified: CLI runs on 22.13.0, 22.15.0, 23.4.0 and 24.20.0; the throw-refusal tests pass on 22.13.0 and 24.20.0. - Release note: before, Node before 24 answered
ERR_UNKNOWN, and a theme loaded through the CLI's own Core could build with the exception dropped. Verified: base runs answerERR_UNKNOWNon 22.13.0, 22.15.0 and 23.4.0 and build on 24.20.0 with no Core in the folder. - Release note: theme build and the theme editor still need Node 22.15 or 23.5 to load a theme that imports a stylesheet or an asset. Verified: the gated build and editor tests, and the theme build refusal on 22.13.0 and 23.4.0.
- Release note: so does a recorded theme that imports an asset or a stylesheet other than its own, and on an older Node those loads are now refused. True for an asset and for a stylesheet a module in another folder imports by a relative path; false for any other stylesheet, which loads on 22.13.0 before and after (blocking finding above).
- Release note: the refusal names the file and the Node versions and says nothing was written, in place of Node's own error. Verified: CLI and probe output on 22.13.0.
- Release note: a recorded theme whose module imports its own stylesheet still loads there. Verified on 22.13.0.
- The supported Node range is
>=22.13.0and does not change. Verified:packages/cli/package.json, unchanged. - Before, every Node before 24 ended a microtask throw with
ERR_UNKNOWN, where Node 24 gave a refused load and a theme template to compare with. Verified: base runs; the head's refusal carries the template suggestion. - Before, theme build and the theme editor could not load a stylesheet or asset import without module hooks and showed only Node's error, and neither could a recorded theme that imports an asset or a stylesheet other than its own. Verified for theme build, the editor and a recorded theme's asset; false for a recorded theme's other stylesheets (same finding).
- Through the CLI's own Core the load settled in the same checkpoint as the throw, so the theme built with the exception dropped. Verified: the no-Core test fails on the base on 24.20.0 and passes here.
- Both problems already exist in the published 0.7.16. Consistent: the base has neither the microtask guard nor the named refusal.
- Now the microtask throw is the same refused load on every supported Node and load path, and the stylesheet refusal reads as quoted wherever a load is refused. Verified on 22.13.0 and 24.20.0.
- Cause and fix: the async context is lost before Node 24, a queued microtask now keeps its load, and a refusal recorded during the load wins. Verified:
module-loader.mjs:620,:629-642,:746,:784. - Module hooks exist from 22.15 and 23.5; without them the load runs unchanged, either failure for a stylesheet or asset becomes the named refusal, and any other error is unchanged. Verified: 22.15.0 builds the stylesheet theme and 23.4.0 refuses it;
module-loader.mjs:300-329,:364. - The
ERR_THEME_LOADdoc row documents a file that cannot be loaded and now names the Node limit. Verified fortheme build:themeBuild.doc.mjs:103. - A shared test helper for module hooks; the gather-cache fixture re-exports it,
build.test.mjsandmodule-loader.test.mjsimport it, and five named test files keep their own copy. Verified as worded;test/packed-help-imports.test.mjs:117-119also keeps a copy (non-blocking). - Stylesheet and asset build tests skip without module hooks, and refusal tests check on every Node that the load is refused and nothing is written. Verified: the
it.skipIfgates and forked expectations. - A
[fix]patch changeset for the CLI package. Verified: the changeset front matter. build.test.mjsreads its temp folder by its real path so a case passes on macOS, in a separate test-only commit. Verified: that commit touches only that file.- 15 theme build and theme editor tests fail on Node 22.13.0 at the base and pass or skip here, and the same files pass on current Node. Verified at an earlier head with the same code and tests.
- The new no-Core microtask test and the no-hooks
.cssand.svgtest fail on the base and pass here. Verified: red-first runs on 22.13.0 and 24.20.0, and the test file passes on 22.13.0 at this head. - By hand on 22.13.0 and current Node, the microtask throw and a
./brand.cssimport behave as described, with and without a Core in the theme's folder. Verified for theme build. - Lint, knowledge check, declaration sync and strict typecheck. Verified at an earlier head with the same code; CI has not run on this head (draft).
- The earlier community pull request is credited and superseded. Verified: a co-author trailer, and that pull request is closed unmerged.
- The other overlapping pull requests change other parts of the theme build, doctor and ejection. Verified: none touches the module loader.
- This fixes the theme build and theme editor failures of the minimum-Node issue, not its smoke failure. Verified: every base failure on 22.13.0 is a theme build or theme editor test.
- The land path is a process statement with nothing in the code to check.
Files:
.changeset/cli-minimum-node-theme-loads.md: blocking (the recorded-theme clause, above)packages/cli/test-utils/module-hooks.mjs: the header repeats the recorded-theme clause (same finding)packages/cli/foundation/fs/module-loader.mjs: non-blocking note (own unbuilt stylesheet)packages/cli/api/theme/themeBuild.doc.mjs: clearpackages/cli/test-utils/packed-gather-cache-fixture.mjs: clearpackages/cli/foundation/fs/module-loader.test.mjs: clearpackages/cli/api/theme/build/build.test.mjs: clearpackages/cli/api/theme/build/build-stable-module-values-throw-refusal.test.mjs: clearpackages/cli/api/theme/build/build-stable-module-callback-runs-load.test.mjs: clearpackages/cli/api/theme/build/build-stable-family-key-replaces-header.test.mjs: clearpackages/cli/api/theme/build/build-stable-value-refuses-up-file.test.mjs: clearpackages/cli/api/theme/build/build-stable-module-changes-global-file.test.mjs: clearpackages/cli/api/theme/build/build-stable-plain-extends-definetheme-misspelled.test.mjs: clearpackages/cli/api/theme-edit/theme-frames-draws-box-width.test.mjs: clearpackages/cli/api/theme-edit/theme-starter-styles.test.mjs: clearpackages/cli/api/theme-edit/theme-starter-types.test.mjs: clear
… a stylesheet another folder's module imports On a Node before 22.15 a recorded theme still loads a stylesheet beside it, a package's stylesheet, and one a sibling module imports. Only an asset, or a stylesheet that a module in another folder imports by a relative path, needs Node 22.15 or 23.5.
|
/approve-spec bc4cad5 |
There was a problem hiding this comment.
Approved pending CI: CI's required checks are still running on this head and have to pass before merge.
The microtask refusal, the refusal of a load that settles in the same checkpoint, and the named Node-version refusal for stylesheet and asset imports behave as the release note says on Node 22.13, 22.15, 23.4 and 24.20. Two non-blocking notes stay open: the inline note on module-loader.mjs about a theme that imports its own unbuilt stylesheet, and test/packed-help-imports.test.mjs also keeps its own hasModuleHooks copy beside the five test files the description lists.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (0): none
Claims:
- Title: a theme load on an older supported Node is refused as on Node 24. Verified: a microtask throw while loading answers
ERR_THEME_LOADon Node 22.13.0, 23.4.0, 22.15.0 and 24.20.0 at the head, againstERR_UNKNOWNon 22.13.0 at the base; aprocess.nextTickthrow behaves the same on 22.13.0 and 24.20.0. - Release note: a theme module that throws from a microtask while it loads is a refused load naming the error on every supported Node. Verified: CLI runs with no Core in the theme's folder, and the existing Core-in-folder microtask test, pass on 22.13.0 and 24.20.0.
- Release note: before, Node before 24 answered
ERR_UNKNOWN, and a theme loaded through the CLI's own Core could build with the exception dropped. Verified: the base answersERR_UNKNOWNon 22.13.0 and builds on 24.20.0 with no Core in the folder. - Release note: theme build and the theme editor still need Node 22.15 or 23.5 to load a theme that imports a stylesheet or an asset. Verified:
.cssand.svgimports are refused on 22.13.0 and 23.4.0 and build on 22.15.0 and 24.20.0; the gated build and editor tests skip without module hooks. - Release note: so does a recorded theme that imports an asset, or a stylesheet that a module in another folder imports by a relative path, and its other stylesheets still load there. Verified: on 22.13.0 a recorded theme's
.svgimport and a stylesheet that a module in a subfolder imports are refused with the named message (the base says "Unknown file extension"), while a.cssbeside the theme loads at the base and the head; the fallback ismodule-loader.mjs:807-832. - Release note: those loads are now refused naming the file and the Node versions and saying nothing was written, in place of "Unknown file extension" or "Unexpected token". Verified: the base shows "Unexpected token" (theme build) and "Unknown file extension" (recorded theme) on 22.13.0, and the head the named refusal on both paths, with no output written.
- The supported Node range is
>=22.13.0and does not change. Verified: the CLI'sengines.nodeis unchanged. - Before, theme build, the theme editor and the recorded-theme cases could not load without module hooks and showed only Node's error. Verified on 22.13.0 at the base.
- Through the CLI's own Core the load settled in the same checkpoint as the throw, so the theme built with the exception dropped. Verified on 24.20.0 at the base; the head refuses it.
- Both problems already exist in the published 0.7.16. Consistent: the base has neither the microtask guard nor the named refusal.
- Cause and fix: the async context is lost before Node 24, a queued microtask now keeps its load, and a refusal recorded during the load wins. Verified:
module-loader.mjs:617-642,:741-749and:782-784. - Module hooks exist from 22.15 and 23.5; without them the load runs unchanged, a stylesheet or asset failure becomes the named refusal, and any other error is unchanged. Verified:
module-loader.mjs:300-329and:360-366, and the 22.15.0 and 23.4.0 runs. - The
ERR_THEME_LOADdoc row now names the Node limit. Verified:themeBuild.doc.mjs:103. - A shared test helper for module hooks: the gather-cache fixture re-exports it,
build.test.mjsandmodule-loader.test.mjsimport it, and five named test files keep their own copy. Verified as worded;test/packed-help-imports.test.mjs:117also keeps a copy (non-blocking). - Stylesheet and asset build tests skip without module hooks, and refusal tests check on every Node that the load is refused and nothing is written. Verified: the
it.skipIfgates and forked expectations; 190 passed and 15 skipped on 22.13.0. - A
[fix]patch changeset for the CLI package. Verified: its front matter, and the changeset check passes. build.test.mjsreads its temp folder by its real path, in a separate test-only commit. Verified: that commit touches only that file.- 15 theme build and theme editor tests fail on Node 22.13.0 at the base and pass or skip here, and the same files pass on current Node. Verified: the base's versions of the 11 changed test files fail 15 tests on 22.13.0; the head's pass on 22.13.0 and 24.20.0.
- The new no-Core microtask test and the no-hooks
.cssand.svgtest fail on the base and pass here. Verified: base and head CLI runs on 22.13.0 and 24.20.0 show the behaviour the tests check, and the tests pass at the head. - By hand on 22.13.0 and current Node, the microtask throw and a
./brand.cssimport behave as described. Verified. - Lint, declaration sync and strict typecheck. Verified: eslint reports no errors in the changed files, declaration sync passes, and the strict typecheck reports only two errors in unchanged templates that need a built theme package.
- The earlier community pull request is credited and superseded. Verified: a co-author trailer.
- The other overlapping pull requests change other parts of the theme build, doctor and ejection; this fixes part of the minimum-Node issue, not its smoke failure; the land path is a process statement. Consistent with the diff, which changes only the theme module load.
Files:
.changeset/cli-minimum-node-theme-loads.md: clearpackages/cli/test-utils/module-hooks.mjs: clearpackages/cli/foundation/fs/module-loader.mjs: non-blocking note (own unbuilt stylesheet)packages/cli/api/theme/themeBuild.doc.mjs: clearpackages/cli/test-utils/packed-gather-cache-fixture.mjs: clearpackages/cli/foundation/fs/module-loader.test.mjs: clearpackages/cli/api/theme/build/build.test.mjs: clearpackages/cli/api/theme/build/build-stable-module-values-throw-refusal.test.mjs: clearpackages/cli/api/theme/build/build-stable-module-callback-runs-load.test.mjs: clearpackages/cli/api/theme/build/build-stable-family-key-replaces-header.test.mjs: clearpackages/cli/api/theme/build/build-stable-value-refuses-up-file.test.mjs: clearpackages/cli/api/theme/build/build-stable-module-changes-global-file.test.mjs: clearpackages/cli/api/theme/build/build-stable-plain-extends-definetheme-misspelled.test.mjs: clearpackages/cli/api/theme-edit/theme-frames-draws-box-width.test.mjs: clearpackages/cli/api/theme-edit/theme-starter-styles.test.mjs: clearpackages/cli/api/theme-edit/theme-starter-types.test.mjs: clear
User impact
Someone on an older Node the CLI supports (
engines.nodeis>=22.13.0) meets two problems when a theme loads:queueMicrotask(() => { throw … })) ends the command withERR_UNKNOWNand the bare error, where Node 24 gives a refused theme load (ERR_THEME_LOAD, "Failed to load theme from p/p.ts: micro-throw") and a theme template to compare with.astryx theme buildand the theme editor cannot load a theme that imports a stylesheet or an asset (a.css, Sass or other stylesheet, an.svg, a picture, a font), and neither can a recorded theme that imports an asset, or a stylesheet that a module in another folder imports by a relative path (a recorded theme's other stylesheets still load there), and the person sees only Node'sUnknown file extension ".css" for /…/brand.css, orUnexpected token '.'when the theme loads through the CLI's own Core, with no file named and no next step.A related gap on every Node: a theme loaded through the CLI's own Core (no Core in its folder, and each member of a
--familybuild) settles in the same microtask checkpoint as such a throw, so the load won and the theme built with the exception dropped.Both problems are pre-existing: the published v0.7.16 behaves the same on Node 22.13.0.
Now a microtask throw while a theme loads is the same refused load on every supported Node and every load path. Those loads still need Node 22.15 or later, or 23.5 or later, and the refusal says so on every load path: "Failed to load theme from p/p.ts: it imports p/brand.css, and loading a theme that imports a stylesheet or asset needs Node 22.15 or later, or 23.5 or later (this is Node 22.13.0). Nothing was written."
Problem and solution fit
uncaughtExceptionoutside the async context that queued it, so the guard sees no load and the exception becomes the command's own crash.Expected behavior and authority
packages/cli/api/theme/themeBuild.doc.mjsdocumentsERR_THEME_LOADfor a file that cannot be loaded into a theme;architecture:cli-surfaceINV3 makescodethe contract a consumer branches on, so the same failure carries the same code on every supported Node.spec:AST-017: the supported Node range does not change here.Smallest restoration
packages/cli/foundation/fs/module-loader.mjs: a microtask queued during a guarded theme load carries its load to the guard; a refusal recorded during the load wins over a load that settled first; the no-hooks refusal for a stylesheet or asset names the file and the Node version it needs.packages/cli/api/theme/themeBuild.doc.mjs: theERR_THEME_LOADcase says a theme that imports a stylesheet or asset needs Node 22.15 or later.packages/cli/test-utils/module-hooks.mjs: a sharedhasModuleHooksfor tests. This change moves three files onto it:packed-gather-cache-fixture.mjsre-exports it, andbuild.test.mjsandmodule-loader.test.mjsimport it instead of their own copies. Other test files that still compute their own copy (build.family.test.mjs,build.core-on-demand.test.mjs,gather-cache.test.mjs,gather-cache.deps.test.mjs,packed-docs-routes.test.mjs) are unchanged here.[fix]changeset for@astryxdesign/cli.packages/cli/api/theme/build/build.test.mjsreads its temp folder by its real path, so the case that lists a theme's local imports passes on macOS, where the temp folder sits behind a link (a separate, test-only commit).Evidence
build-stable-module-values-throw-refusal"a theme module that throws from a microtask while it loads" fails at the base (ERR_UNKNOWN) and passes here.build-stable-module-values-throw-refusal"a theme module with no Core of its own that throws from a microtask while it loads": fails at the base on current Node (the theme builds) and passes here on current Node and Node 22.13.0.build-stable-module-values-throw-refusal"a theme with no Core of its own that imports a stylesheet or an asset, on a Node without module hooks":.cssand.svgimports give the new refusal on Node 22.13.0 (at the base: "Unexpected token").ERR_THEME_LOADand the same message on both, with and without a Core in the theme's folder; a theme importing./brand.cssgives the new refusal on 22.13.0, with and without a Core in its folder, and builds on current Node.Scope
Testing
--project node.pnpm check:knowledge;pnpm -F @astryxdesign/cli sync:api-types;pnpm -F @astryxdesign/cli typecheck:strictreports nothing in the changed files (two template errors need a built@astryxdesign/theme-neutral, absent locally).Overlap checked: #12032, #12092, #12090, #12057 (#12032 is the same microtask fix without the synchronous-load case and is superseded here with credit; the others change the theme build's Core facts, doctor's font check and theme ejection; this change is how a theme module load fails)
Fixes part of #11183: the failures in its theme build and theme editor tests. Its global-mode smoke failure is a different cause and is not changed here.
Owner: fix-loop lane 4. Land path: CodeBunny, CI, a minimum-Node workflow run, then the drain merges.