express-tsx
Advanced tools
Comparing version 2.2.8 to 2.2.9
@@ -16,2 +16,4 @@ "use strict"; | ||
this.renderToJSX = React.createElement; | ||
this.renderToStaticMarkup = ReactDOM.renderToStaticMarkup; | ||
this.renderToString = ReactDOM.renderToString; | ||
this.ssr = false; | ||
@@ -27,3 +29,2 @@ this.path = Compile_1.defaultOutDir; | ||
configExtend(this, options); | ||
this.renderToString = this.ssr ? ReactDOM.renderToString : ReactDOM.renderToStaticMarkup; | ||
} | ||
@@ -40,3 +41,3 @@ } | ||
function render(options) { | ||
let { renderToJSX, renderToString, ssrWrap, compile, path, requirejs, ssr } = new Options(options); | ||
let { renderToJSX, renderToString, renderToStaticMarkup, ssrWrap, compile, path, requirejs, ssr } = new Options(options); | ||
if (path) { | ||
@@ -49,3 +50,3 @@ exports.middleware.use(path_2.join('/', path).replace(/\\/g, '/'), Compile_1.compile.middleware); | ||
let Render = exports && exports.default || exports; | ||
let body = renderToString(renderToJSX(Render, data)); | ||
let body = (ssr ? renderToString : renderToStaticMarkup)(renderToJSX(Render, data)); | ||
if (ssr) { | ||
@@ -52,0 +53,0 @@ let scriptUrl = path_2.join(data.baseUrl, path, compile(file)).replace(/\\/g, '/'); |
{ | ||
"name": "express-tsx", | ||
"version": "2.2.8", | ||
"version": "2.2.9", | ||
"description": "express view tsx render", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -14,7 +14,7 @@ | ||
configExtend(this,options) | ||
this.renderToString = this.ssr?ReactDOM.renderToString:ReactDOM.renderToStaticMarkup | ||
} | ||
compile?:(file:string)=>any = c.compile | ||
renderToJSX?:(Render,data:Object)=>JSX.Element = React.createElement | ||
renderToString?:(jsx)=>string | ||
renderToStaticMarkup?:(jsx)=>string = ReactDOM.renderToStaticMarkup | ||
renderToString?:(jsx)=>string = ReactDOM.renderToString | ||
ssr?:boolean = false | ||
@@ -40,3 +40,3 @@ path?:string = defaultOutDir | ||
export function render(options?:Options){ | ||
let { renderToJSX,renderToString,ssrWrap,compile,path,requirejs,ssr } = new Options(options) | ||
let { renderToJSX,renderToString,renderToStaticMarkup,ssrWrap,compile,path,requirejs,ssr } = new Options(options) | ||
if(path){ | ||
@@ -49,3 +49,3 @@ middleware.use(join('/',path).replace(/\\/g,'/'),c.middleware) | ||
let Render = exports && exports.default || exports | ||
let body = renderToString( renderToJSX(Render,data) ) | ||
let body = (ssr?renderToString:renderToStaticMarkup)( renderToJSX(Render,data) ) | ||
if(ssr){ | ||
@@ -52,0 +52,0 @@ let scriptUrl = join(data.baseUrl,path,compile(file)).replace(/\\/g,'/') |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22912
340