1 line
957 B
JavaScript
1 line
957 B
JavaScript
const e=require("fs"),t=require("path"),a={version:1.1,globalAttributes:[{name:"data-i18n",description:"The key of the translation for current element."},{name:"data-i18n-prop",description:"Attributes of the element that should be translated, separated by space.",valueSet:"i18nProps"},{name:"data-hint",description:"The tooltip of the element."}],valueSets:[]},l=async()=>{await new Promise((t,l)=>{e.readFile("src/livecodes/i18n/locales/models.ts","utf8",(e,s)=>{if(e)console.error(e),l(e);else{let e=s.match(/I18nAttributes.+?{([\s\S]*?)}/)[1].split("\n").map(e=>e.trim().replace(/['|;?]/g,"").split(":")[0]).filter(e=>""!==e);a.valueSets.push({name:a.globalAttributes[1].valueSet,values:e.map(e=>({name:e}))}),t()}})});let l=t.resolve(__dirname,"../.vscode/html.html-data.json");e.writeFileSync(l,JSON.stringify(a,null,2)),console.log(`HTML Intellisense schema generated at ${l}`)};module.exports={generateHTMLIntellisense:l},require.main===module&&l(); |