Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-tsx

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-tsx - npm Package Compare versions

Comparing version 5.0.8 to 5.0.9

7

dist/require.config.js

@@ -40,4 +40,9 @@ "use strict";

//set url
app.get("/require.config.js" /* requirejsConfigJsPath */, (req, res) => res.type('js').header({ maxAge: 15 * 24 * 60 * 60 }).send(res.app.settings["requirejsConfigStr" /* requirejsConfigStr */]));
app.get("/require.config.js" /* requirejsConfigJsPath */, (req, res) => {
res
.type('js')
.header('Cache-Control', `max-age=${res.app.settings["compiler" /* compiler */].jsExpiredTime}`)
.send(res.app.settings["requirejsConfigStr" /* requirejsConfigStr */]);
});
};
//# sourceMappingURL=require.config.js.map

2

package.json
{
"name": "express-tsx",
"version": "5.0.8",
"version": "5.0.9",
"description": "express view engine to render tsx file",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -6,3 +6,4 @@ # 文档

```js
var render = expressTsx(requirejsConfig,compiler=new Compiler())
/**@type {Express}*/
var app = expressTsx(viewsDir="/views",compiler=new Compiler())

@@ -9,0 +10,0 @@ ```

@@ -52,16 +52,19 @@ import { Express } from "express";

app.settings[key.requirejsId] = `store${cursor++}`
Object.defineProperty(app.settings,key.requirejsConfig,{
get(){ return Requirejs.s.contexts[this.requirejsId].config },
set(config){
Requirejs.config({ context:this.requirejsId, ...config })
config = this[key.requirejsConfig]
//remake config str
let configStr =
this[key.requirejsConfigStr] =
`requirejs.config(${JSON.stringify({ ...config, context:'_', })})`
//update hash path
let hash = crypto.createHash('md5').update(configStr).digest('hex')
this[key.requirejsConfigJsPathWithHash] = `${key.requirejsConfigJsPath}?${hash}`
Object.defineProperty(
app.settings, key.requirejsConfig,
{
get(){ return Requirejs.s.contexts[this.requirejsId].config },
set(config){
Requirejs.config({ context:this.requirejsId, ...config })
config = this[key.requirejsConfig]
//remake config str
let configStr =
this[key.requirejsConfigStr] =
`requirejs.config(${JSON.stringify({ ...config, context:'_', })})`
//update hash path
let hash = crypto.createHash('md5').update(configStr).digest('hex')
this[key.requirejsConfigJsPathWithHash] = `${key.requirejsConfigJsPath}?${hash}`
}
}
})
)
//set default config

@@ -72,5 +75,10 @@ app.settings[key.requirejsConfig] = defaultRequirejsConfig

key.requirejsConfigJsPath,
(req,res)=>
res.type('js').header({maxAge:15*24*60*60}).send(res.app.settings[key.requirejsConfigStr])
(req,res)=>{
res
.type('js')
//过期时间和 compiler 的过期时间保持一致
.header('Cache-Control',`max-age=${(res.app.settings[key.compiler] as Compile).jsExpiredTime}`)
.send(res.app.settings[key.requirejsConfigStr])
}
)
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc