Skip to content

Move the <style> attribute helpers into style-tag.js - #426

Merged
NullVoxPopuli merged 1 commit into
auditboard:mainfrom
tylerturdenpants:style-tag-helpers
Sep 4, 2026
Merged

NullVoxPopuli merged 1 commit into
auditboard:mainfrom
tylerturdenpants:style-tag-helpers

Conversation

@tylerturdenpants

@tylerturdenpants tylerturdenpants commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Split out of #422 so that PR is only the stylelint support. No behaviour change here.

What moves

hasScopedAttribute, hasInlineAttributeWithoutLang and getLangAttribute were private to template-plugin.js, and unplugin-colocated.js kept its own copy of the extensions Vite preprocesses. They answer the same question, how a <style> block is read, so they now live together in src/build/style-tag.js and their callers import them from there.

All four are byte-identical to what they replace. I compared the parsed function bodies rather than reading the diff, so that is a check rather than a claim.

The export

ember-scoped-css/__private_do_not_use_are_you_serious__/style-tag.

It is a seam for stylelint-ember-scoped-css, which needs the same answers and today has its own drifted copies of the first two helpers. Not public API, and the path says so. The module imports nothing, so a consumer does not pull the build pipeline in behind it.

Verified

  • 205 tests pass, the same as on main.
  • pnpm build clean.
  • The export resolves from a consumer and gives exactly hasScopedAttribute, hasInlineAttributeWithoutLang, getLangAttribute and PREPROCESSED_EXTENSIONS.

Relationship to #422

#422 is stacked on this branch. It adds isPreprocessed and the dialect list behind it, which only the linter calls, so those stay there rather than landing here with no caller. Its diff will still show this commit until this merges, at which point I will rebase it.

hasScopedAttribute, getLangAttribute and hasInlineAttributeWithoutLang
were private to template-plugin.js, and unplugin-colocated.js kept its own
copy of the extensions Vite preprocesses. They answer the same question --
how a <style> block is read -- so they now live in one module.

The module is exported as
ember-scoped-css/__private_do_not_use_are_you_serious__/style-tag, a seam
for stylelint-ember-scoped-css (auditboard#422), which needs the same answers and
today has its own drifted copies of the first two. Not public API, and the
path says so. It imports nothing, so a consumer does not pull the build
pipeline in behind it.

A move, nothing else: the four things are byte-identical to what they
replace, and the same 203 tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@NullVoxPopuli
NullVoxPopuli merged commit 7438189 into auditboard:main Sep 4, 2026
20 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 4, 2026
@tylerturdenpants

Copy link
Copy Markdown
Contributor Author

#422 is stacked on this one and is in draft until it lands, so this wants to go first.

tylerturdenpants added a commit to tylerturdenpants/ember-scoped-css that referenced this pull request Sep 4, 2026
Per review, ember-scoped-css should not take a semver bump on this PR's
account. It no longer needs to: the only thing left in its diff was
PREPROCESSED_LANGS, added so the syntax could ask "is this a preprocessor
dialect", and nothing asks that any more.

The suggestion was to chop the leading `.` off PREPROCESSED_EXTENSIONS in the
plugin instead. That is not needed either, because the plugin does not want a
list of dialects, it wants a lang-to-parser mapping, and which postcss parser
reads scss is a stylelint concern rather than something the build can answer.
That table lives in the plugin and is keyed by lang already.

So style-tag.js goes back to main's version, literal extension Set and all,
and PREPROCESSED_EXTENSIONS keeps its single consumer in
unplugin-colocated.js. The private style-tag export this PR relies on is
already on main from auditboard#426, so nothing in ember-scoped-css changes here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants