sugar-high 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.mjs +7 -0
  2. package/package.json +1 -1
package/lib/index.mjs CHANGED
@@ -218,12 +218,19 @@ function tokenize(code) {
218
218
  */
219
219
  function classify(token) {
220
220
  const isLineBreak = token === '\n'
221
+ // First checking if they're attributes values
221
222
  if (inJsxTag() && inStringQuotes()) {
222
223
  return T_STRING
223
224
  }
225
+ // Then determine if they're jsx literals
224
226
  const isJsxLiterals = inJsxLiterals()
225
227
  if (isJsxLiterals) {
226
228
  return T_JSX_LITERALS
229
+
230
+ }
231
+ // Determine strings first before other types
232
+ if (inStringQuotes()) {
233
+ return T_STRING
227
234
  } else if (keywords.has(token)) {
228
235
  return last[1] === '.' ? T_IDENTIFIER : T_KEYWORD
229
236
  } else if (isLineBreak) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sugar-high",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "exports": "./lib/index.mjs",
6
6
  "description": "Super lightweight JSX syntax highlighter",