Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
}
const getService = token => {
// $FlowFixMe
const provides = this.getService(token);
const isRequiredToken = Boolean(token.optional);
if (typeof provides === 'undefined' && isRequiredToken) {
throw new Error(
`Token ${token.name} not registered or registered plugin does not provide a service. To use an optional plugin, use \`Token.optional\`.`
);
}
return provides;
};
const renderer = createPlugin({
deps: {
criticalChunkIds: CriticalChunkIdsToken.optional,
skipPrepare: SkipPrepareToken.optional,
},
provides({skipPrepare}) {
return (el: React.Element<*>, ctx) => {
return (skipPrepare ? Promise.resolve() : prepare(el)).then(() => {
if (render) {
return render(el, ctx);
}
if (__NODE__) {
return serverRender(el);
} else {
return clientRender(el);
}
});
};
},
runtimeChunkIds,
initialChunkIds, // $FlowFixMe
} from '../build/loaders/chunk-manifest-loader.js!'; // eslint-disable-line
import modernBrowserVersions from '../build/modern-browser-versions.js';
/*::
import type {SSRBodyTemplateDepsType, SSRBodyTemplateType} from './types.js';
declare var __webpack_public_path__: string;
*/
/* eslint-disable-next-line */
const SSRBodyTemplate = createPlugin/*:: */(
{
deps: {
criticalChunkIds: CriticalChunkIdsToken.optional,
routePrefix: RoutePrefixToken.optional,
},
provides: ({criticalChunkIds, routePrefix}) => {
return ctx => {
const {htmlAttrs, bodyAttrs, title, head, body} = ctx.template;
const safeAttrs = Object.keys(htmlAttrs)
.map(attrKey => {
return ` ${escape(attrKey)}="${escape(htmlAttrs[attrKey])}"`;
})
.join('');
const safeBodyAttrs = Object.keys(bodyAttrs)
.map(attrKey => {
return ` ${escape(attrKey)}="${escape(bodyAttrs[attrKey])}"`;
})
.join('');
import {
chunks,
runtimeChunkIds,
initialChunkIds, // $FlowFixMe
} from '../build/loaders/chunk-manifest-loader.js!'; // eslint-disable-line
/*::
import type {SSRBodyTemplateDepsType, SSRBodyTemplateType} from './types.js';
declare var __webpack_public_path__: string;
*/
/* eslint-disable-next-line */
const SSRBodyTemplate = createPlugin/*:: */(
{
deps: {
criticalChunkIds: CriticalChunkIdsToken.optional,
routePrefix: RoutePrefixToken.optional,
},
provides: ({criticalChunkIds, routePrefix}) => {
return ctx => {
const {htmlAttrs, bodyAttrs, title, head, body} = ctx.template;
const safeAttrs = Object.keys(htmlAttrs)
.map(attrKey => {
return ` ${escape(attrKey)}="${escape(htmlAttrs[attrKey])}"`;
})
.join('');
const safeBodyAttrs = Object.keys(bodyAttrs)
.map(attrKey => {
return ` ${escape(attrKey)}="${escape(bodyAttrs[attrKey])}"`;
})
.join('');