Skip to content

ignore lightningcss global pseudo-class warning#13773

Merged
ascorbic merged 2 commits intowithastro:mainfrom
sijad:fix-lightningcss-warn
May 21, 2025
Merged

ignore lightningcss global pseudo-class warning#13773
ascorbic merged 2 commits intowithastro:mainfrom
sijad:fix-lightningcss-warn

Conversation

@sijad
Copy link
Copy Markdown
Contributor

@sijad sijad commented May 9, 2025

Changes

ignore lightningcss unsupported pseudo-class warning. fixes #13658

Testing

there's no testing for logger

Docs

no need to updated docs, no affect on user’s behavior

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 9, 2025

🦋 Changeset detected

Latest commit: 608eb2a

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the pkg: astro Related to the core `astro` package (scope) label May 9, 2025
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 9, 2025

CodSpeed Performance Report

Merging #13773 will not alter performance

Comparing sijad:fix-lightningcss-warn (608eb2a) with main (3aa5337)

Summary

✅ 6 untouched benchmarks

@ematipico
Copy link
Copy Markdown
Member

Thank you @sijad , can you add a changeset? The contribution guide should tell you how

@sijad sijad force-pushed the fix-lightningcss-warn branch from 549ca75 to ccc50b1 Compare May 10, 2025 12:55
@sijad
Copy link
Copy Markdown
Contributor Author

sijad commented May 10, 2025

@ematipico added

@sijad sijad force-pushed the fix-lightningcss-warn branch from ccc50b1 to 8f348f5 Compare May 10, 2025 12:57
@ascorbic ascorbic merged commit 3aa5337 into withastro:main May 21, 2025
5 checks passed
@astrobot-houston astrobot-houston mentioned this pull request May 21, 2025
openscript pushed a commit to openscript/astro that referenced this pull request Sep 12, 2025
* ignore lightningcss global pseudo-class warning

* Update changeset

---------

Co-authored-by: Matt Kane <m@mk.gg>
yurishkuro added a commit to jaegertracing/jaeger-ui that referenced this pull request Mar 22, 2026
## Motivation

The Vite 8 upgrade introduced new build warnings:

1. **`[EVAL] Warning` from `store/plugins/lib/json2.js`** — The `store`
npm package (v2.0.12, latest and unmaintained) bundles a `json2`
polyfill that uses `eval()`. Vite 8's rolldown bundler flags this. Since
`store` is just a localStorage wrapper and the json2 polyfill is
unnecessary in modern browsers, the entire dependency can be replaced.

2. **`::global` pseudo-element warning from LightningCSS** — Vite's CSS
modules pipeline emits `::global()` syntax into the compiled CSS, which
LightningCSS's minifier then flags as unrecognized. This is not in our
source code — it's a Vite build tooling issue (related to
[vitejs/vite#8480](vitejs/vite#8480)). The
same workaround is used by Astro
([withastro/astro#13773](withastro/astro#13773)).

## Changes

**Replaced `store` with `src/utils/storage.ts`** — A ~60-line utility
wrapping `localStorage` with JSON serialization and type-safe getters:
- `getString(key, defaultValue?)` — returns value only if it's a string
- `getNumber(key, defaultValue?)` — returns value only if it's a number
- `getBool(key, defaultValue?)` — returns value only if it's a boolean
- `getJSON<T>(key)` — returns parsed JSON for complex objects
- `set(key, value)` — stores JSON-serialized value

Unlike the previous `as` type casts on the old `store.get()` (which
returned `any`), the typed getters validate at runtime and return the
default value if the stored data has an unexpected type.

On JSON parse failure, `getRaw()` falls back to returning the raw string
(matching the old `store` package behavior), so previously persisted
plain-string values are not silently dropped.

**Suppressed LightningCSS `::global` warning** — Added a small Vite
plugin that filters this specific warning from the build logger. This is
purely cosmetic; it does not change CSS processing.

## Side effects

- The main JS bundle shrank by ~418 KB (from 2,797 KB to 2,379 KB) since
the `store` package and its json2 polyfill are no longer included.
- The `store` package is removed from `package.json` and
`package-lock.json`.
- Test files updated to mock the new `storage` utility instead of the
`store` package.

## AI Usage in this PR (choose one)
See [AI Usage
Policy](https://github.com/jaegertracing/jaeger/blob/main/CONTRIBUTING_GUIDELINES.md#ai-usage-policy).
- [ ] **None**: No AI tools were used in creating this PR
- [ ] **Light**: AI provided minor assistance (formatting, simple
suggestions)
- [ ] **Moderate**: AI helped with code generation or debugging specific
parts
- [x] **Heavy**: AI generated most or all of the code changes

---------

Signed-off-by: Yuri Shkuro <github@ysh.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lightningcss warns (a lot) when using :global()

3 participants