Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
express-tsx
Advanced tools
这是 express 中 jsx 模板渲染的一个实现 .
import Express = require('express')
export const app = Express()
import { render,requirejsConfig,defaultOptions } from "../src";
//你可以在这里配置 requirejs , 这下面是一些默认配置
requirejsConfig({
paths:{
'requirejs' :'https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min',
'react' :'https://cdnjs.cloudflare.com/ajax/libs/react/15.5.4/react',
'react-dom' :'https://cdnjs.cloudflare.com/ajax/libs/react/15.5.4/react-dom',
},
shim:{
'react-dom' :['react']
}
})
app.engine('.tsx',render({
ssr:false, //推荐关闭
// ssrRender,
// ssrWrap, //这个是核心 , 不建议替换
// placeholder:'loading', //你可以在这里放个 loading 动画
}))
//此外你还可以在 `defaultOptions` 中设置默认值(对已经使用了 `render` 的不起效 )
defaultOptions.placeholder = 'loading'
app.set('views',__dirname+'/views')
app.set('view engine','tsx')
app.get('/',(req,res)=>res.render('ssrRender',{ who:'express-tsx', title:'express-tsx' }))
export default (props)=>
<div onClick={ ()=>alert(props.who) }>
hello {props.who}
</div>
spdy
的话 , 将会预推送文件到客户端 , 加快加载git clone https://github.com/shynome/express-tsx.git
npm install
npm test
ps: 如果你使用 vscode 的话 , 你可以直接 f5 运行FAQs
express view engine to render tsx file
The npm package express-tsx receives a total of 3 weekly downloads. As such, express-tsx popularity was classified as not popular.
We found that express-tsx 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.