Skip to content

fix(text): inline title case mapping to avoid JSON import attribute#7129

Open
tomas-zijdemans wants to merge 1 commit intodenoland:mainfrom
tomas-zijdemans:title-case-inline
Open

fix(text): inline title case mapping to avoid JSON import attribute#7129
tomas-zijdemans wants to merge 1 commit intodenoland:mainfrom
tomas-zijdemans:title-case-inline

Conversation

@tomas-zijdemans
Copy link
Copy Markdown
Contributor

@tomas-zijdemans tomas-zijdemans commented May 6, 2026

Fixes: #7128

When Vite resolves @std/text/unstable-to-title-case, it follows that import to JSR and ends up requesting https://jsr.io/@std/text/1.0.18/title_case_mapping.json?import. The catch: hitting that URL in an HTTP client returns the JSR registry's HTML browse page for the file, not the raw JSON

Vite no longer needs to fetch a .json file from JSR when bundling @std/text/unstable-to-title-case, so the builtin:vite-json "expected value at line 1 column 1" crash from #7128 goes away. No public API change.

PS: There are other cases like this in the code as well, but not many

@github-actions github-actions Bot added the text label May 6, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.62%. Comparing base (a496da2) to head (42c51c1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7129      +/-   ##
==========================================
+ Coverage   94.61%   94.62%   +0.01%     
==========================================
  Files         634      635       +1     
  Lines       51801    51938     +137     
  Branches     9329     9329              
==========================================
+ Hits        49011    49148     +137     
  Misses       2216     2216              
  Partials      574      574              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@timreichen
Copy link
Copy Markdown
Contributor

Isn't that more a vite or jsr bug than a std problem? Shouldn't this be resolved by a request content-type: application/json for example so the correct data gets returned?
I think std should be able to import json files as intended by the import api.

@tomas-zijdemans
Copy link
Copy Markdown
Contributor Author

Isn't that more a vite or jsr bug than a std problem? Shouldn't this be resolved by a request content-type: application/json for example so the correct data gets returned? I think std should be able to import json files as intended by the import api.

Fair point. This is a practical change in std, but the better fix would likely be in the vite json plugin (if possible)

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.

Vite crash when using @std/text unstable features

2 participants