You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In dev mode the WASM @astrojs/compiler annotates every rendered element with data-astro-source-file and data-astro-source-loc attributes when annotateSourceFile is enabled. @astrojs/compiler-rs accepts the annotateSourceFile / annotate_source_file option but does not emit those
HTML attributes, so on Astro 7 (which defaults to the Rust compiler) the
source annotations are simply absent from the served HTML.
This is a dev-tooling parity regression versus @astrojs/compiler.
Environment
@astrojs/compiler-rs: 0.3.1
astro: 7.1.1 (Rust compiler is the default)
Repro also implied on any Astro 7.x dev server
Expected
With the dev toolbar enabled, a dev-mode render annotates elements, e.g.:
(This is what Astro 5.x / 6.x produce via @astrojs/compiler.)
Actual
On Astro 7 dev, the served HTML contains zerodata-astro-source-*
attributes on any element, across all pages.
Evidence
Astro still requests annotation: packages/astro/src/core/compile/compile.ts
on main sets annotateSourceFile: viteConfig.command === 'serve' && astroConfig.devToolbar?.enabled && toolbarEnabled.
compiler-rs accepts the option — it is present in crates/astro_codegen/src/options.rs (annotate_source_file), crates/astro_napi (annotateSourceFile), and packages/compiler/src/shared.ts — so the flag is plumbed through to codegen.
But the attribute strings are never produced: a repo code search for data-astro-source returns no matches in the Rust sources, and the published
native binary (@astrojs/compiler-binding-*/*.node) contains 0
occurrences of data-astro-source. By contrast the WASM @astrojs/compiler
emits data-astro-source-file and data-astro-source-loc.
Empirically: a fresh Astro 6.4.8 dev server emits these attributes
(100+ per page); an Astro 7.1.1 dev server emits none, with the dev toolbar
enabled in both.
Impact
These attributes are the source-location channel for dev tooling:
Third-party dev tools built on the same channel break on Astro 7, e.g. astro-text-edit (in-browser visual content editing) and astro-click-to-source (Alt-click to open the source file in $EDITOR).
Both locate elements via data-astro-source-file / -loc.
Repro
npm create astro@latest on Astro 7, keep the dev toolbar enabled.
astro dev.
curl any page (or View Source) and grep for data-astro-source — no matches.
Ask
Implement dev-mode emission of data-astro-source-file and data-astro-source-loc when annotateSourceFile is true, restoring parity with @astrojs/compiler. If the intent is instead to move source-location exposure
to a different API (per the note on withastro/astro#13602 about a public API for
element annotations), it would help to document that migration path for
third-party dev tools.
Summary
In dev mode the WASM
@astrojs/compilerannotates every rendered element withdata-astro-source-fileanddata-astro-source-locattributes whenannotateSourceFileis enabled.@astrojs/compiler-rsaccepts theannotateSourceFile/annotate_source_fileoption but does not emit thoseHTML attributes, so on Astro 7 (which defaults to the Rust compiler) the
source annotations are simply absent from the served HTML.
This is a dev-tooling parity regression versus
@astrojs/compiler.Environment
@astrojs/compiler-rs: 0.3.1astro: 7.1.1 (Rust compiler is the default)Expected
With the dev toolbar enabled, a dev-mode render annotates elements, e.g.:
(This is what Astro 5.x / 6.x produce via
@astrojs/compiler.)Actual
On Astro 7 dev, the served HTML contains zero
data-astro-source-*attributes on any element, across all pages.
Evidence
packages/astro/src/core/compile/compile.tson
mainsetsannotateSourceFile: viteConfig.command === 'serve' && astroConfig.devToolbar?.enabled && toolbarEnabled.compiler-rsaccepts the option — it is present incrates/astro_codegen/src/options.rs(annotate_source_file),crates/astro_napi(annotateSourceFile), andpackages/compiler/src/shared.ts— so the flag is plumbed through to codegen.data-astro-sourcereturns no matches in the Rust sources, and the publishednative binary (
@astrojs/compiler-binding-*/*.node) contains 0occurrences of
data-astro-source. By contrast the WASM@astrojs/compileremits
data-astro-source-fileanddata-astro-source-loc.(100+ per page); an Astro 7.1.1 dev server emits none, with the dev toolbar
enabled in both.
Impact
These attributes are the source-location channel for dev tooling:
[data-astro-source-file],copies the values into a
WeakMap, then strips the attributes (seeRemove
data-astro-source-fileanddata-astro-source-locattributes in dev mode astro#13602). Without emission, its source-backed features(e.g. "open in editor" from an audit) have nothing to read.
astro-text-edit(in-browser visual content editing) andastro-click-to-source(Alt-click to open the source file in$EDITOR).Both locate elements via
data-astro-source-file/-loc.Repro
npm create astro@lateston Astro 7, keep the dev toolbar enabled.astro dev.curlany page (or View Source) and grep fordata-astro-source— no matches.Ask
Implement dev-mode emission of
data-astro-source-fileanddata-astro-source-locwhenannotateSourceFileis true, restoring parity with@astrojs/compiler. If the intent is instead to move source-location exposureto a different API (per the note on withastro/astro#13602 about a public API for
element annotations), it would help to document that migration path for
third-party dev tools.