fix(text): inline title case mapping to avoid JSON import attribute#7129
fix(text): inline title case mapping to avoid JSON import attribute#7129tomas-zijdemans wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Isn't that more a vite or jsr bug than a std problem? Shouldn't this be resolved by a request |
Fair point. This is a practical change in std, but the better fix would likely be in the vite json plugin (if possible) |
lunadogbot
left a comment
There was a problem hiding this comment.
Rename to _title_case_mapping.ts keeps the underscore-private convention (matches _title_case_util.ts); Record<string, string> + Object.entries(...) preserves the existing Map<string,string> shape; generator emits the same header + entry format used in the hand-checked-in file (new Date().getFullYear() keeps the year auto-rolling). text/deno.json never exported the JSON, so no JSR-surface change.
- nit: no test asserts the inlined data itself —
toTitleCasecoverage exercises the mapping indirectly. Probably overkill given the generator is the source of truth.
|
@bartlomieju this is ready to merge |
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