Skip to content

Replace is-url with is-url-superb#307

Merged
XhmikosR merged 6 commits into
mainfrom
xmr/is-url-superb
Apr 23, 2026
Merged

Replace is-url with is-url-superb#307
XhmikosR merged 6 commits into
mainfrom
xmr/is-url-superb

Conversation

@XhmikosR
Copy link
Copy Markdown
Member

@XhmikosR XhmikosR commented Mar 2, 2026

@joscha: not 100% sure this is the same, since is-url-superb seems to not work with // (it's just using the Node.js URL constructor).

But this is what postcss-values-parser is using: https://github.com/shellscape/postcss-values-parser/blob/d95ae33212a5b46e093db03cb4e841b830daceb7/lib/nodes/Word.js#L40

You probably have a better idea if this patch is OK or not. :)

PS. makes me wonder if postcss-values-parser can be used directly instead of using is-url-superb?

@joscha
Copy link
Copy Markdown
Collaborator

joscha commented Mar 3, 2026

Gwen I created it we had // everywhere, so it would be better to make sure it's compatible. Regarding the values parser, I remember trying it out and then rolling my own, but I don't remember why, unfortunately. If we can call out to it, that would definitely be good, less customization.

@XhmikosR XhmikosR force-pushed the xmr/is-url-superb branch from a21f262 to 6287000 Compare March 3, 2026 14:17
@joscha
Copy link
Copy Markdown
Collaborator

joscha commented Mar 5, 2026

Something is lurking in the back of my brain that the logic might not work for all cases, but clearly past @joscha cheated on the test coverage, so I think we go with it. Maybe the next release should be a minor or even major, just so we don't break users?

@XhmikosR XhmikosR force-pushed the xmr/is-url-superb branch from a8a2b6f to 81f8a77 Compare March 5, 2026 16:17
@XhmikosR
Copy link
Copy Markdown
Member Author

XhmikosR commented Mar 5, 2026

I'm still not sure about this, I want to think about it a bit more :)

In theory it should work the same, and we are now doing what postcss-values-parser is also doing. So, assuming the new tests are correct (I used AI's help to detect uncovered test cases), we should be OK.

The next version needs to be a major bump due to #292, anyway.

@joscha
Copy link
Copy Markdown
Collaborator

joscha commented Mar 5, 2026

The next version needs to be a major bump due to #292, anyway.

I think that's fine then. If we break functionality in the url space we should treat it as a regression though, I think, so if someone comes in 3 months and says they just upgraded to the new major version and the URL handling changed, it feels like we should revert to what was done before this change. I am not sure how feasible that is IRL as others would have adopted the new major with the change in behavior. What then? Cut a new major with the fixed regression?

@XhmikosR
Copy link
Copy Markdown
Member Author

XhmikosR commented Mar 6, 2026

If that's the case, we try to fix the regression, otherwise we revert the package change. In both cases we cut a new patch version.

@joscha
Copy link
Copy Markdown
Collaborator

joscha commented Mar 6, 2026

Okay, I am happy with that, 🛥️

@XhmikosR XhmikosR force-pushed the xmr/is-url-superb branch 2 times, most recently from 96a1039 to 4b75c6f Compare April 19, 2026 14:12
@XhmikosR XhmikosR marked this pull request as ready for review April 22, 2026 16:03
@XhmikosR XhmikosR requested a review from joscha April 22, 2026 16:04
- Improve getValueOrUrl() to correctly filter protocol-relative URLs by normalizing them before validation.
- Filter out falsey URL values when collecting references from declarations.
- Update debug messages for clearer context ("url() in @value" -> "url() in declaration").
- Type `src` parameter as `string` and `references` as `string[]`
- Guard against undefined `firstNode` and `lastNode` from postcss-values-parser
@XhmikosR XhmikosR force-pushed the xmr/is-url-superb branch from 4b75c6f to 72379a0 Compare April 23, 2026 05:00
@XhmikosR XhmikosR merged commit 32a7d4b into main Apr 23, 2026
6 checks passed
@XhmikosR XhmikosR deleted the xmr/is-url-superb branch April 23, 2026 05:02
@XhmikosR
Copy link
Copy Markdown
Member Author

@joscha I didn't squash all patches for better history.

The publish action is broken, I assume due to the old token. We shouldn't use tokens anymore and just use OIDC. I manually published v8.0.0 for now.

@joscha
Copy link
Copy Markdown
Collaborator

joscha commented Apr 23, 2026

Nice!

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