vuejs/vue-eslint-parser

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

l-outsider opened this issue · 3 comments

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>

me too

My library vue-metamorph was built for this purpose

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.