Skip to content

Commit

Permalink
fix: hack
Browse files Browse the repository at this point in the history
  • Loading branch information
lvjiaxuan committed Apr 25, 2023
1 parent a552704 commit eac70ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions index.mjs
@@ -1,3 +1,5 @@
import MagicString from 'magic-string'

export default {
name: 'unocss-transformer-attribute-values-group',
enforce: 'pre',
Expand Down Expand Up @@ -30,8 +32,10 @@ export default {
.join(' ')
)

if (typeof code !== 'string' && code.length())
code.overwrite(0, code.toString().length, str)
if (typeof code !== 'string' && code.length()) {
code = new MagicString(code.toString()) // hack? rewrite original magic string
code.overwrite(0, code.length(), str)
}

return str
},
Expand Down
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -24,5 +24,8 @@
"@unocss/core": "^0.51.8",
"jest": "^29.5.0",
"vitest": "^0.30.1"
},
"dependencies": {
"magic-string": "^0.30.0"
}
}
7 changes: 5 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eac70ef

Please sign in to comment.