Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(variant-group)!: remove quotes matching, add option to config seperator #1231

Merged
merged 7 commits into from Jul 9, 2022

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Jul 8, 2022

fix: #1215

revert #831 (Matching the content of quotes can get very complicated)

And Fix the problem that repeated use of MagicString.replace does not work. refer Rich-Harris/magic-string#208

@Dunqing Dunqing requested a review from antfu as a code owner July 8, 2022 05:31
@netlify
Copy link

netlify bot commented Jul 8, 2022

Deploy Preview for unocss canceled.

Name Link
🔨 Latest commit 9ade65b
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/62c918d0356389000859af1c

const file = await readFile('./test/assets/variant-group.vue', 'utf-8')
const result = await transform(file)
expect(result).toMatchInlineSnapshot(`
"<script setup lang=\\"ts\\">
const a = 1
const b = 2
// eslint-disable-next-line @typescript-eslint/space-infix-ops
const c = a-(b -a -b)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this one is a JS that should not be transformed.

Copy link
Member Author

@Dunqing Dunqing Jul 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but there is no good way to solve this problem.

I think this is a very rare case where no one would write arithmetic this way, and we can either wait for this problem to appear and then solve it, or provide an option to disable the -transform.

@antfu
Copy link
Member

antfu commented Jul 8, 2022

I do like the improvement of magic string tho

@antfu antfu changed the title fix(variant-group): when the content contains extra quotation marks, the replacement will not succeed fix(variant-group)!: remove quotes matching, add option to config seperator Jul 9, 2022
@antfu antfu merged commit b5feafd into unocss:main Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variant groups broken by uneven amount of quotes
2 participants