Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (createOptions.staticMarkup) {
// render the component to static markup
html += ReactDOMServer.renderToStaticMarkup(component);
} else {
// render the redux wrapped component
if (createOptions.reduxStoreInitiator) {
// add redux provider
var Provider = require('react-redux').Provider;
var initStore;
try {
initStore = require(createOptions.reduxStoreInitiator);
if (initStore.default) {
initStore = initStore.default;
}
var store = initStore(data);
var wrappedComponent = React.createElement(Provider, { store: store }, component);
// render the component
html += ReactDOMServer.renderToString(wrappedComponent);
} catch (err) {
return done(err);
}
} else {
// render the component
html += ReactDOMServer.renderToString(component);
}
// the `script` tag that gets injected into the server rendered pages.
// https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet#RULE_.233_-_JavaScript_Escape_Before_Inserting_Untrusted_Data_into_JavaScript_Data_Values
var script = '
} else {
ssrApi = withIds ? ReactDomServer.renderToString : ReactDomServer.renderToStaticMarkup;
}
const target = util.getTargetByQuery(req.query, this._envTargets);
this._extractor = util.createdStatExtractor(target);
return ssrApi(
this._extractor.collectChunks(
React.createElement(
// server side context to provide request
ServerContext,
{ request: req },
// redux provider
React.createElement(
Provider,
{ store },
// user route component
React.createElement(
StaticRouter,
{ location, context: routeContext, basename: this.options.basename },
this._routesComponent
)
)
)
)
);
}
}
return function XDebugControlProvider(props) {
var container = function container() {
var docker = new Docker(props.siteModel.container, store);
return new Container(docker, Object.assign({ status: props.siteStatus }, props.site), maps);
};
if (props.siteStatus && props.siteStatus === 'halted') {
store.dispatch({ type: actions.docker.HALTED });
}
return React.createElement(
Provider,
{ store: store },
React.createElement(XDebugControlContainer, { container: container })
);
};
};