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

If I have AST parsed by 'vue-eslint-parser'.parsed(), is there any api to recover source vue code ? #224

Closed
LLwyct opened this issue Mar 3, 2024 · 3 comments

Comments

@LLwyct
Copy link

LLwyct commented Mar 3, 2024

If I have AST parsed by 'vue-eslint-parser'.parsed(), is there any api to recover source vue code ?

import { parse } from 'vue-eslint-parser';

const ast = parse('code');

// travel ast and do some my modify

const code = // ???? //(ast);

fs.write('file', code);

for example

<temp v-if="isMobileDevice"></temp>
<temp v-if="isPCDevice"></temp >

when I publish code to PC env, I want to delete code running in moblie device.

and similer code in <script lang='ts' setup>.

I dont know how to achive this

<temp v-if="isPCDevice"></temp>
@neostfox
Copy link

me too

@UnrefinedBrain
Copy link

My library vue-metamorph was built for this purpose

@LLwyct
Copy link
Author

LLwyct commented Jul 16, 2024

My library vue-metamorph was built for this purpose

thanks.
for some reason, I don't need do this work, but maybe I will try you lib in future.

@LLwyct LLwyct closed this as completed Jul 16, 2024
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

No branches or pull requests

3 participants