Repository navigation
fix(cli): doctor says when an app does not import Core's component styles - #12244
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested: the new doctor checks catch a missing Core stylesheet in the default setup, but they misreport apps on the supported @astryxdesign/build source build, and the new stylesheet reader duplicates one doctor already has. Both points still apply at this revision.
core-stylesheetsandbuilt-astryx-stylestreat a source-build app as broken (for exampleapps/example-nextjs-sourcewithwithAstryx()and@stylex;,apps/example-vitewithastryxStylex(), or the Turbopack setup with@astryx;): plaindoctorwarns and says to import@astryxdesign/core/astryx.css, which makes awithAstryx()build fail, anddoctor --built .on those apps goes from exit 0 to exit 1 with "Do not deliver this output", so please detect a source build, pass or leave out both checks for it, and reword the changeset's "Without them, Astryx components render unstyled".doctor.mjsparses stylesheet@imports with its own regex instead of the doctor adapter'sdoctorStylesheetImports, which the theme-wiring scan already uses, and the two already disagree (an@IMPORTrule warns here, while an@importinside acontent:string passes), so please use the shared reader besidemoduleSpecifiersand drop the regex.
No current spec record governs these two doctor checks, so approval also needs an engineering owner to settle whether doctor owns them, at what severity (a warning in doctor, a failure in --built), and whether source builds are left out. An owner records that decision with a spec record (the package-stylesheet spec is the closest) or by commenting /approve-spec <full head SHA>; the author may do so as an engineering owner.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
Claims:
- Changeset:
doctornow reports an app that does not import Core's component styles. Verified:doctor.mjs:414-433,built-checks.mjs:768-801and the new tests. - Changeset: without them, Astryx components render unstyled. False for
@astryxdesign/buildsource builds, which load noastryx.cssby design (first finding). - Changeset: before this change the build,
doctoranddoctor --builtall passed. Verified: at the base,--builtreturns only the usage and purity checks, and plaindoctorhas no check for Core's stylesheet. - Changeset: plain
doctorwarns when no project source or stylesheet imports them. Verified:doctor.mjs:427-432. - Changeset:
doctor --builtfails when the output uses Astryx but no built stylesheet or page carries them. Verified, with the documented pass on a source import and info with no stylesheet or page (built-checks.mjs:778-793); a source-build project folder also fails (first finding). - Description: the before and after messages in the reproduction table. Verified against the message strings (
doctor.mjs:430,built-checks.mjs:798). - Description: each message names the fix of importing
reset.css, thenastryx.css. Verified:doctor.mjs:431,built-checks.mjs:799. - Description: with the imports back, as
@importlines or module imports, both checks pass, built or not. Verified: the new tests, andapps/example-nextjspasses both. - Description: a theme stylesheet and Core's scripts already satisfied the usage check. Verified:
built-checks.mjs:113-114. - Description: agents run
doctor --builtbefore they deliver. Verified: the agent docs' delivery line (foundation/agent-docs/agent-docs.mjs:658). - Description:
doctor's own contract describes--builtas a check before delivery, and the getting-started guide sets both imports. Verified:doctor.doc.mjs,getting-started.doc.mjs. - Description: no knowledge record lists doctor's checks. Verified for these checks; the package-stylesheet spec still governs the setup they check, and it exempts source builds.
- Description:
core-stylesheetsruns aftercore-installed, only with Core installed and the project on Core, and ignores commented-out imports. Verified: the check order, the Core-only check set, thecoreDirguard and the warn test. - Description:
built-astryx-stylesruns only when the output uses Astryx, passes on base-layer rules or a source import, is info with no stylesheet or page, and ignores scripts. Verified for the prebuilt setup (built-checks.mjs:656-659,:768-801,:938-940); false for a source-build project folder (first finding). - Description: the theme checks share their module reader, and the doc and type describe the new check. Verified.
- Description: the regression tests and the golden update. Verified: the three changed test files and the golden test pass at this revision.
- Description: the full test, typecheck, lint and format runs. Partly verified: the changed and golden test files pass here, and CI's lint and CLI smoke-test jobs pass.
- Description: no new public API under the bug-fix label. Verified:
doctor()and its types keep their shape, and CI's API report lists no change.
Files:
.changeset/doctor-core-stylesheets.md: one sentence is false for source builds (first finding).packages/cli/api/doctor/doctor.mjs: first and second findings.packages/cli/api/doctor/built-checks.mjs: first finding. Non-blocking: the base-layer mark also matches the Lab, Rich Text and Charts stylesheets, so the pass message can name Core's styles when only another package's are present.packages/cli/api/doctor/theme-checks.mjs: clear.packages/cli/api/doctor/doctor.doc.mjs: clear.packages/cli/api/doctor/doctor.type.mjs: clear.packages/cli/api/doctor/built-checks.test.mjs: clear; it needs a source-build case once the first finding is fixed.packages/cli/api/doctor/doctor.test.mjs: clear; same.packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json: clear.
|
Owner decision (engineering owner, covering this pull request): |
|
/approve-spec cf89056 |
There was a problem hiding this comment.
Changes requested: the new doctor warnings now leave @astryxdesign/build source builds alone, but the source-build detector also skips apps that compile only their own StyleX, so those apps never get the warning this change adds.
sourceBuildSetup(doctor.mjs) counts any@stylex;rule as a Core source build, yet StyleX's own PostCSS plugin writes that rule in the documented own-StyleX setup, which still loads the prebuilt stylesheet (asapps/example-nextjs-stylexdoes): with itsastryx.cssimport removed, both checks say "Not checked: this app compiles Core's styles from source" instead of warning, so please drop@stylex;from the mark (thewithAstryx()setup is already found throughnext.config) or count it only when the PostCSS config loads@astryxdesign/build, and update INV39, the--builtdoc and the tests to match.
The earlier points are fixed at this revision: source builds are reported as not checked, and plain doctor reads stylesheet imports with the shared reader. Our earlier suggestion to treat @stylex; as a source-build mark was wrong. The golden doctor-installed-set.json also conflicts with main and needs regenerating after a merge.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- Changeset:
doctornow says when an app does not load Core's component styles. Verified:doctor.mjs:520-549,built-checks.mjs:774-815and the new tests. - Changeset: in an app on Core's prebuilt styles, components render unstyled without them. Verified: a build with only a theme stylesheet carries no
astryx-baserules. - Changeset: before, the build,
doctoranddoctor --builtall passed. Verified: the base has neither check. - Changeset: plain
doctorwarns when no project stylesheet or module imports them and no page links them. False for an app with its own@stylex;rule (the finding); verified otherwise on copies of the example apps and in the tests. - Changeset:
doctor --builtwarns when output that uses Astryx carries none of them. Verified:built-checks.mjs:808-814; it also passes on a source import. - Changeset: an app that compiles Core from source with
@astryxdesign/buildis not checked. Verified forwithAstryx(),astryxStylex()and@astryx;; the detector also skips apps that do not use the build package (the finding). - Description: before, no problem reported; after, the two quoted warnings. Verified against the message text (
doctor.mjs:546,built-checks.mjs:812) and the example-app copies. - Description: each warning names the fix of importing
reset.css, thenastryx.css. Verified:doctor.mjs:547,built-checks.mjs:813. - Description: with the imports back, or a page link, both checks pass. Verified on the example apps and in the tests.
- Description: a source build is reported as not checked, naming the setup found, an
@stylex;rule included. Verified as behavior; the@stylex;part misclassifies own-StyleX apps (the finding). - Description: the usage check already counted a theme stylesheet and Core's scripts. Verified:
built-checks.mjs:114-115. - Description: agents run
doctor --builtbefore they deliver. Verified: the agent docs' delivery line. - Description: INV39 states both warnings and the skip, and the failure waits for the next minor because
--builtshipped in a stable release. Verified:cli-surface.md:344-351,built-checks.mjs:761-768. - Description: the check order, the Core-only scope, the readers, the page link, the info and warning cases, and the adapter and module-reader helpers. Verified.
- Description: the repository's source-build examples are info with
doctor --built .exiting 0, andexample-nextjs-stylexandexample-nextjspass. Verified. - Description: the listed regression tests and the golden update. Verified: the tests pass at this revision.
- Description: no new public API under the bug-fix label. Verified: no export, type, command or option changes.
- Description: the writing rubric results. Present, as one line for R1 and R7.
- Description: the test, typecheck and lint runs. Verified: the changed test files pass, the strict typecheck has no error in the changed files, and ESLint passes on them.
Files:
.changeset/doctor-core-stylesheets.md: the plain-doctorsentence is false for own-StyleX apps (the finding).docs/architecture/cli-surface.md: INV39's@stylex;mark (the finding).packages/cli/api/doctor/doctor.mjs: the finding. Non-blocking: the Core stylesheet constant and fix text are duplicated inbuilt-checks.mjs.packages/cli/api/doctor/built-checks.mjs: non-blocking: theastryx-basemark also matches the Lab, Rich Text and Charts stylesheets, and stylesheet imports are read with a regex rather than the shared reader.packages/cli/api/doctor/_adapter.mjs: clear.packages/cli/api/doctor/theme-checks.mjs: clear.packages/cli/api/doctor/doctor.doc.mjs: its source-build wording follows the finding.packages/cli/api/doctor/doctor.type.mjs: clear.packages/cli/api/doctor/built-checks.test.mjs: clear.packages/cli/api/doctor/doctor.test.mjs: the@stylex;case follows the finding; it needs an own-StyleX case without the import.packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json: clear at this revision; it conflicts withmain.
…ilds, and warns in --built Plain doctor's core-stylesheets check also counts a page that links Core's astryx.css and reads stylesheet imports with the shared reader. Both checks report an app that loads no astryx.css but compiles Core's styles from source (withAstryx(), astryxStylex(), or an @AstryX; or @stylex; rule) as not checked. built-astryx-styles warns instead of failing, because --built shipped in a stable release. architecture:cli-surface INV39 records both checks.
cf89056 to
7085d89
Compare
|
/approve-spec 7085d89 |
There was a problem hiding this comment.
Changes requested: two defects remain in the new checks, and both have small fixes.
- Any
@stylex;rule is taken for a Core source build (packages/cli/api/doctor/doctor.mjs:433-439), so an app that compiles its own StyleX and loads the prebuiltastryx.css(a default setup the package-stylesheets spec requires to load it) is told "this app compiles Core's styles from source" and is never warned when the import is missing; count@stylex;only when the PostCSS config loads@astryxdesign/build, and update INV39, the docs, the changeset and the tests to match. - Miss:
doctor --builtignores a page<link rel="stylesheet">to Core'sastryx.css(packages/cli/api/doctor/built-checks.mjs:657-678), so an app whoseindex.htmllinks it from a CDN passesdoctorbut gets "This output's Astryx components render unstyled … Do not deliver this output." fromdoctor --built, which also makes the description's "a page that links Core'sastryx.css, both checks pass" untrue; share the page-link reader withscanBuiltand add a--builttest.
The earlier source-build false warning is fixed, and the tests, lint and knowledge checks pass at this head.
Claims and files checked
Review mode: full; reason: rebase
Claims:
- Changeset:
doctornow says when an app does not load Core's component styles: verified (a copy of the Next.js example without the import warns in both commands). - Changeset and description: before this change the build,
doctoranddoctor --builtall passed: verified (the base has neither check, andbuilt-astryx-usagepasses on a theme stylesheet). - Changeset: plain
doctorwarns when no stylesheet or module imports the styles and no page links them: verified (tests and probes). - Changeset:
doctor --builtwarns when Astryx output carries no Core styles: verified, but it also warns when a page links them (finding 2). - Changeset: only an
@astryxdesign/buildsource build is not checked: false, any@stylex;app is skipped too (finding 1). - Description: the before/after reproduction messages: verified.
- Description: with a page that links Core's
astryx.css, both checks pass: false fordoctor --built(finding 2). - Description: source builds are reported as not checked, naming their setup: verified for
withAstryx(),astryxStylex()and@astryx;; the@stylex;mark is finding 1. - Description: an app that loads
astryx.csspasses in any setup: verified. - Description:
--builtstarts as a warning because it already shipped in a stable release: verified. - Description:
core-stylesheetsruns only when Core is installed and the project is on Core; commented-out imports and links do not count: verified. - Description:
built-astryx-stylesis info with no built stylesheet or page, and scripts do not count: verified. - Description: the example apps report as described: verified on copies of each.
- Description: the listed regression tests and the golden: verified, they pass.
- Description: tests pass and the strict typecheck has no error in the changed files: verified.
- Description: writing rubric results: present as one line; the next-minor sentence in INV39 reads as release sequencing (non-blocking).
Files:
.changeset/doctor-core-stylesheets.md: finding 1 (describes the skip as@astryxdesign/buildonly).docs/architecture/cli-surface.md: finding 1 (INV39 names@stylex;); non-blocking note on the next-minor sentence.packages/cli/api/doctor/_adapter.mjs: clear.packages/cli/api/doctor/built-checks.mjs: finding 2; non-blocking notes on the layer mark and the duplicated constant.packages/cli/api/doctor/built-checks.test.mjs: finding 2 (no page-link case).packages/cli/api/doctor/doctor.doc.mjs: follows finding 1.packages/cli/api/doctor/doctor.mjs: finding 1.packages/cli/api/doctor/doctor.test.mjs: finding 1 (the@stylex;case).packages/cli/api/doctor/doctor.type.mjs: clear.packages/cli/api/doctor/theme-checks.mjs: clear.packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json: clear.
…stryxdesign/build in PostCSS, and --built counts a page link An app's own StyleX writes into an @stylex; rule too, and still needs Core's prebuilt styles, so the rule marks a source build only while the PostCSS config loads @astryxdesign/build. doctor --built now shares plain doctor's page-link reader, so a page that links Core's astryx.css passes both checks.
|
/approve-spec 87380e5 |
There was a problem hiding this comment.
Approved pending CI: the new doctor and doctor --built warnings for an app that loads none of Core's component styles match the cli-surface record's new INV39, which an engineering owner approved for this revision, and both earlier blocking points are fixed. CI's Node test legs, and the test job that joins them, stopped on the suite-wide time budget before running any test. The same plan is over budget on main, so this change does not cause it, but the Node tests still need to pass on a re-run before merge; every other check passed.
Non-blocking suggestions, with details in the inline comments:
- Plain
doctorreads only.cssstylesheets, so an app whoseglobals.scssimports@astryxdesign/core/astryx.cssis told its components render unstyled. - The
astryx-basemark thatbuilt-astryx-styleslooks for is in every package stylesheet, so output with onlyrichtext.cssorlab.csspasses as "Core's component styles". - The
--builtdocs leave out the page-link pass, andastryx doctor --helpmentions neither new warning.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- Changeset:
doctornow says when an app does not load Core's component styles: verified (doctor.mjs:569-598,built-checks.mjs:804-853, fixture runs). - Changeset: in an app on Core's prebuilt styles, components render unstyled without them: verified (the package-stylesheets spec requires the prebuilt stylesheet in every default setup).
- Changeset and description: before, the build,
doctoranddoctor --builtall passed: verified (the base has no such check, and the usage check accepts a theme's stylesheet and Core's scripts). - Changeset: plain
doctorwarns when no project stylesheet or module imports them and no page links them: verified for.css, module and page sources; a.scssstylesheet is not read (non-blocking). - Changeset:
doctor --builtwarns when Astryx output carries none of them: verified (fixture output folders and tests). - Changeset and description: an app that compiles Core from source with
@astryxdesign/buildis reported as not checked, naming its setup: verified forwithAstryx(),astryxStylex(),@astryx;, and@stylex;with the build's PostCSS plugin. - Description: an
@stylex;rule alone is the app's own StyleX and is checked: verified (own-StyleX fixture without the import warns). - Description: the reproduction's before and after messages: verified word for word on fixture apps.
- Description: each warning names the two imports to add: verified (
doctor.mjs:596,built-checks.mjs:851). - Description: with the imports back, or a page linking Core's stylesheet, both checks pass; a link in a comment does not count: verified (fixtures and tests).
- Description: plain
doctorhad no check for Core's stylesheet: verified (the existing theme-wiring scan reads stylesheets only for theme imports). - Description: the new record invariant states both warnings and the skip: verified (
cli-surface.md:355-363). - Description:
--builtshipped in a stable release, so the new check warns and a failure is a later breaking change: verified (no failing status in the code). - Description: the adapter, theme-checks, doc and type changes as listed: verified.
- Description: the source-build and own-StyleX example apps behave as stated, with
doctor --built .exiting 0: verified on copies of those apps. - Description: the listed regression tests and the golden update: verified (
doctor.test.mjs:340-491,built-checks.test.mjs:127-250). - Description: the four test files pass with 285 tests, and the strict typecheck and lint report nothing in the changed files: verified (285 passed; ESLint clean; the only typecheck errors are in page templates).
- Description: no internal context in public text: verified.
Files:
.changeset/doctor-core-stylesheets.md: clear (its "no project stylesheet" is broader than the.csswalk; see the first suggestion).docs/architecture/cli-surface.md: owner-approved; non-blocking: the next-minor sentence is work order.packages/cli/api/doctor/_adapter.mjs: clear.packages/cli/api/doctor/built-checks.mjs: non-blocking: the styles mark matches every package stylesheet, and the stylesheet constant and fix text repeatdoctor.mjs.packages/cli/api/doctor/built-checks.test.mjs: clear.packages/cli/api/doctor/doctor.doc.mjs: non-blocking: the--builttext leaves out the page-link pass.packages/cli/api/doctor/doctor.mjs: non-blocking:.scssstylesheets are not read.packages/cli/api/doctor/doctor.test.mjs: clear.packages/cli/api/doctor/doctor.type.mjs: clear.packages/cli/api/doctor/theme-checks.mjs: clear.packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json: clear.
| function coreStylesheetLoad(root) { | ||
| let unparsed = 0; | ||
| for (const file of listProjectSourceFiles(root, '', { | ||
| stylesheets: true, |
There was a problem hiding this comment.
Non-blocking: this walk lists only .css stylesheets, so an app whose globals.scss imports @astryxdesign/core/astryx.css is told "Found nothing … Without them, Astryx components render unstyled." Consider reading the @import and @use lines of .scss and .sass files too, or saying in the message that only .css stylesheets were read.
| * scripts hold such a rule as text they write at run time, so only | ||
| * stylesheets and pages count. | ||
| */ | ||
| const CORE_STYLES_MARK = /@layer\s+astryx-base\s*\{/; |
There was a problem hiding this comment.
Non-blocking: every package stylesheet puts its rules in astryx-base (lab.css, richtext.css and charts.css too), so output that loads only one of those passes with "Core's component styles are in …". Saying "Astryx component styles", or matching a rule only Core's stylesheet has, would keep the message true.
| type: 'string', | ||
| description: | ||
| 'A finished build to check before you deliver it: a project folder, a build output folder, or one built `.html` file, relative to `cwd`. Adds two checks after the others. `built-astryx-usage` fails when the path holds no value import from an Astryx package (any `@astryxdesign/*` package or an integration the project installs), no component imported from one, and no Astryx styles in built CSS or HTML. `built-astryx-purity` warns with the source check of `astryx docs is-my-code-good`: raw elements Astryx has a component for, raw SVG and icon-library icons, inline styles, classes, `stylex.create` and imported stylesheets, each with its file and line, in `.tsx` and `.jsx` files and JSX in `.js` source, found by parsing it; it is info, not inspected, when the path holds no source with JSX, such as a bundle. It reads at most 20,000 files, each up to 5 MB, skipping installs and version control; when either limit leaves source unread and nothing was found, the purity check is info, not fully inspected, and when the file limit ends the read before any Astryx turns up, `built-astryx-usage` warns that the rest went unread instead of failing. Given one built `.html` file, it also reads the local stylesheets and scripts that page links, finding a root-relative link from the nearest folder above the page that holds it; a linked file that is not there makes `built-astryx-usage` warn instead of fail. An empty folder fails with nothing checked, like a missing path. A source tree counts as using Astryx through an import, a re-export (`export … from`) or a stylesheet `@import` of an Astryx package; a type-only import or re-export (`import type`, `export type`, or a list whose names are all `type`) does not count, since the build erases it. `--built` goes with `doctor` alone; a `doctor integration` check refuses it. A path that does not exist fails `built-astryx-usage` with nothing checked, and the purity check is left out. The integrations that count are the dependencies the nearest package.json above the path declares whose installed copy, found the way the CLI autolinks (a hoisted workspace copy included), has an integration manifest. The files under the path, and that configuration, are only read, never run. Without it, doctor runs exactly as before.', | ||
| "A finished build to check before you deliver it: a project folder, a build output folder, or one built `.html` file, relative to `cwd`. Adds its checks after the others. `built-astryx-usage` fails when the path holds no value import from an Astryx package (any `@astryxdesign/*` package or an integration the project installs), no component imported from one, and no Astryx styles in built CSS or HTML. When the output uses Astryx, `built-astryx-styles` warns when no built stylesheet or page under the path carries Core's component styles (the `astryx-base` layer of `@astryxdesign/core/astryx.css`) and no source file or stylesheet there imports them, since the components then render unstyled; it is info, not checked, when the path holds no built stylesheet or page, or when the project that holds the path compiles Core's styles from source (`withAstryx()` or `astryxStylex()` from `@astryxdesign/build` in its `next.config` or `vite.config`, an `@astryx;` rule in a stylesheet, or an `@stylex;` rule while its PostCSS config loads `@astryxdesign/build`). `built-astryx-purity` warns with the source check of `astryx docs is-my-code-good`: raw elements Astryx has a component for, raw SVG and icon-library icons, inline styles, classes, `stylex.create` and imported stylesheets, each with its file and line, in `.tsx` and `.jsx` files and JSX in `.js` source, found by parsing it; it is info, not inspected, when the path holds no source with JSX, such as a bundle. It reads at most 20,000 files, each up to 5 MB, skipping installs and version control; when either limit leaves source unread and nothing was found, the purity check is info, not fully inspected, and when the file limit ends the read before any Astryx turns up, `built-astryx-usage` warns that the rest went unread instead of failing. Given one built `.html` file, it also reads the local stylesheets and scripts that page links, finding a root-relative link from the nearest folder above the page that holds it; a linked file that is not there makes `built-astryx-usage` warn instead of fail. An empty folder fails with nothing checked, like a missing path. A source tree counts as using Astryx through an import, a re-export (`export … from`) or a stylesheet `@import` of an Astryx package; a type-only import or re-export (`import type`, `export type`, or a list whose names are all `type`) does not count, since the build erases it. `--built` goes with `doctor` alone; a `doctor integration` check refuses it. A path that does not exist fails `built-astryx-usage` with nothing checked, and the purity check is left out. The integrations that count are the dependencies the nearest package.json above the path declares whose installed copy, found the way the CLI autolinks (a hoisted workspace copy included), has an integration manifest. The files under the path, and that configuration, are only read, never run. Without it, doctor runs exactly as before.", |
There was a problem hiding this comment.
Non-blocking: this text says built-astryx-styles warns unless a built file carries the layer or a source imports it, but a page that links Core's astryx.css also passes (built-checks.mjs:814-821). The command doc, clients/cli/commands/doctor.doc.mjs, which astryx doctor --help prints, still mentions neither new warning.
| Core's component styles; that warning becomes a failure in the next minor | ||
| release, as its own `[breaking]` change. An app that compiles Core's styles |
There was a problem hiding this comment.
Non-blocking: "that warning becomes a failure in the next minor release, as its own [breaking] change" is work order that turns false once that release ships (rubric R7 in docs/contributing/spec-writing.md). The pull request or a plan can carry it, while INV39 states what doctor does.
User impact
An app that renders Astryx components with Core's prebuilt styles, but does not load them (
@astryxdesign/core/astryx.css), shows every component unstyled. Nothing caught it: the build passed, andastryx doctorandastryx doctor --built distboth passed. The getting-started setup and the agent docs say to import Core's stylesheets once, and tell agents to check a build withdoctor --builtbefore they deliver it, so the check agents rely on missed the most basic setup failure.Reproduction: a Vite app with
@astryxdesign/coreand@astryxdesign/theme-neutral, the neutral theme added and imported, a page with aButton; then the two imports (reset.css,astryx.css) removed.doctorcore-stylesheetswarns: "Found nothing in project source, stylesheets or pages that imports or links @astryxdesign/core/astryx.css, Core's component styles. Without them, Astryx components render unstyled."doctor --built distbuilt-astryx-usagepasses ("Astryx styles in assets/index-….css", the theme's stylesheet)built-astryx-styleswarns: "None of the 2 built stylesheets and pages that doctor read carries Core's component styles (theastryx-baselayer of @astryxdesign/core/astryx.css). This output's Astryx components render unstyled."Each names the fix: import
@astryxdesign/core/reset.css, then@astryxdesign/core/astryx.css, once, in the app's global stylesheet or its entry module. With the imports back (as@importlines or as module imports), or with a page that links Core'sastryx.css, both checks pass.An app that compiles Core's styles from source with
@astryxdesign/buildloads noastryx.cssby design. When it loads none, both checks report it as not checked (info), naming the setup they found:withAstryx()in itsnext.config,astryxStylex()in itsvite.config, an@astryx;rule in a stylesheet, or an@stylex;rule while its PostCSS config loads@astryxdesign/build. An@stylex;rule alone is the app's own StyleX, which still needs Core's prebuilt styles, so it is checked as usual. An app that loads Core'sastryx.csspasses in any setup.Problem and solution fit
built-astryx-usageasks only whether the output uses Astryx at all. A theme's stylesheet, and Core's scripts, which reference Astryx's custom properties and hold theastryx-baselayer name as text, already count, so output without Core's component styles passes. Plaindoctorhas no check on the app's stylesheets.doctor --builtbefore they deliver, and follow its result.Expected behavior and authority
architecture:cli-surfaceINV39, added in this pull request:doctorwarns (core-stylesheets) anddoctor --builtwarns (built-astryx-styles); an app that compiles Core's styles from source (withAstryx(),astryxStylex(), an@astryx;rule, or an@stylex;rule with@astryxdesign/buildin the PostCSS config) gets neither warning.--builtshipped in a stable release (0.7.16), so its new check starts as a warning. Turning it into a failure is its own[breaking]change in the next minor release, not part of this pull request.Smallest restoration
api/doctor/doctor.mjs:core-stylesheets, aftercore-installed, only when Core is installed and the project is on Core. It passes when a project stylesheet@imports Core's component styles (read with the shared stylesheet reader), a module imports them (read as a syntax tree), or a page links them (<link rel="stylesheet">to the package'sastryx.css, from a package CDN or the installed copy); a commented-out import or link does not count. Otherwise it is info for a source build (sourceBuildSetup) and a warning for any other app.api/doctor/built-checks.mjs:built-astryx-styles, only when the output uses Astryx. It passes when a built stylesheet or page holds theastryx-baselayer's rules, a page links Core'sastryx.css(linksCoreStylesheet, the reader plaindoctorshares), or a source file or stylesheet under the path imports Core's component styles (a project folder before its build). It is info for a source build of the project that holds the path, and info when the path holds no built stylesheet or page. Otherwise it warns. Core's scripts hold such a rule as text they write at run time, so scripts do not count.api/doctor/_adapter.mjs: the walk lists pages on request;doctorStylesheetAtRulesreads a stylesheet's at-rules with postcss;builtProjectRootfinds the project that holds a--builtpath (the walkbuiltIntegrationPackagesalready did).api/doctor/theme-checks.mjsexports the module-specifier reader the new check shares, andstringValues, which reads a PostCSS config's plugin names from its syntax tree;doctor.doc.mjsanddoctor.type.mjsdescribe both checks.Evidence
doctorwarning and adoctor --built distwarning (exit 0). A CDN link to Core'sastryx.cssinindex.htmlpasses both checks, built (dist/index.html links …) and not; the same link in a comment warns.astryxStylex()invite.config.ts, or an@astryx;rule in the global stylesheet, makes both checks info. An@stylex;rule alone warns; with@astryxdesign/build/postcssinpostcss.config.mjsit is info.example-nextjs-source(withAstryx()) andexample-vite(astryxStylex()) are info in both checks, withdoctor --built .exiting 0;example-nextjs-stylex(importsastryx.cssbeside its own@stylex;rule) andexample-nextjspass.doctorpasses an@import url(…), a module import, and a page link from a CDN or the installed package; warns when the only import or link is in a comment; is info for each source-build setup (Next, Vite,@astryx;, and@stylex;with the build's plugin inpostcss.config.mjsor.postcssrc.json); warns an app whose@stylex;rule is its own StyleX; still warns when the setup is only named in a comment; passes an app that loadsastryx.cssbeside its own@stylex;rule; is left out without Core.--builtpasses a page that links Core's stylesheet and warns when that link is in a comment; warns about a build whose CSS holds only a theme's stylesheet and whose script holds Core's run-time base-layer text; passes a built stylesheet or a page<style>with the layer, and a source that imports Core's styles before any build; is info for a source build (given, and read throughdoctor --builtfrom the project'svite.config.ts), while output with the styles still passes; is info for output with no built stylesheet or page; is left out for output that uses no Astryx.doctorgolden for a broken installed set carries the new warning.Scope
Components: CLI (
doctor,doctor --built)Writing rubric results
Testing
vitest run --project nodeoverapi/doctor/built-checks.test.mjs,api/doctor/doctor.test.mjs,api/doctor/theme-checks.test.mjsandtest/experimental-isolation.test.mjs(thedoctorgolden): 4 files, 285 passed.tsc --project tsconfig.strict.json: no error in the changed files. The commit hook's lint-staged andcheck:repopass.