
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
vue template to es6 string

npm i vue2ts-cli -g
# single file
vue2ts ./src/demo.vue
# directory
vue2ts ./src
<template>
<ul>
<li v-for="item in houseList" class="houseItem" :class="{'xixi':item.id==123}">
<h1 :houseId="item.id">{{ item.title }}</h1>
<img v-if="item.img" :src="item.img">
</li>
</ul>
</template>
<script lang="ts">
export class House {
img: string
title: string
id: number
}
export default {
setup(ctx, houseList: House[]) {
return {houseList};
},
};
</script>
vue2ts ./demo.vue
let fun = new Function("str", "data", `return (function (str, data) {var tmpData=data||{}; var tmp=""; with (tmpData) { try { tmp = eval(str); } catch (e) { console.warn(str +"not exits in data","\\n",new Error(e)); } } return tmp; } )(str, data);`)
export class House {
img: string
title: string
id: number
}
const _tmp = {
setup(ctx, houseList: House[]) {
return {houseList};
},
};
export default {
expData: fun,
setup(ctx, houseList: House[]) {
let data = {}
if (typeof _tmp["data"] == "function") {
data = _tmp["data"]();
}
let methods = {}
if (typeof _tmp["methods"] == "object") {
methods = _tmp["methods"]
}
// @ts-ignore
let setupData = _tmp.setup(...arguments);
Object.assign(this, data, setupData, methods);
},
toString() {
let str = `<ul>${(() => {
var str = "";
let _tmpItem;
if (this['item']) {
_tmpItem = this['item']
}
this.expData('houseList', this).forEach(item => {
this['item'] = item;
str += `<li class="${(this.expData('true', this) ? 'houseItem' : '') + ' ' + (this.expData('item.id==123', this) ? '"xixi"' : '')}"><h1 houseId="${this.expData('item.id', this)}">${this.expData('item.title', this)}</h1>
${(() => {
if (this.expData('item.img', this)) {
return `<img src="${this.expData('item.img', this)}"/>`
}
return ''
})()}
</li>` });
this['item'] = _tmpItem;
return str
})()}
</ul>
`
return str
}
};
// test.ts
import {House} from "./Demo";
import Demo2 from "./Demo";
const data: House[] = [
{
img: "http://xxx.com/a.png",
title: "hello word",
id: 123
},
{
img: "http://xxx.com/b.png",
title: "nice vue2ts",
id: 456
}
]
Demo2.setup(null, data);
let str = Demo2.toString();
console.log(str)
output
<ul>
<li class="houseItem xixi"><h1 houseId="123">hello word</h1>
<img src="http://xxx.com/a.png"/>
</li>
<li class="houseItem"><h1 houseId="456">nice vue2ts</h1>
<img src="http://xxx.com/b.png"/>
</li>
</ul>
FAQs
vue template to es6 string
The npm package vue2ts-cli receives a total of 5 weekly downloads. As such, vue2ts-cli popularity was classified as not popular.
We found that vue2ts-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.