Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function(webpackConfig) {
var render = createRenderer(webpackConfig);
return Promise.all(
(hopsConfig.locations || []).map(function(location) {
return render(location).then(function(html) {
if (html) {
return writeFile(location, html);
}
});
})
).then(function() {
console.log(/* empty line */);
});
};
exports.rewritePath = function rewritePath(req, res, next) {
if (
process.env.HOPS_MODE === 'static' &&
Array.isArray(hopsConfig.locations)
) {
var location = hopsConfig.locations.find(function(location) {
return (
location !== hopsConfig.basePath + '/' &&
req.url.indexOf(location) === 0
);
});
if (location) {
req.url = location.replace(/([^\\/])$/, '$1/');
}
}
next();
};
exports.registerMiddleware = function registerMiddleware(app, middleware) {
if (
process.env.HOPS_MODE === 'static' &&
Array.isArray(hopsConfig.locations)
) {
hopsConfig.locations.forEach(function(location) {
app.get(location === '/' ? location : location + '*', middleware);
});
} else {
app.all('*', middleware);
}
};
exports.registerMiddleware = function registerMiddleware(app, middleware) {
if (
process.env.HOPS_MODE === 'static' &&
Array.isArray(hopsConfig.locations)
) {
hopsConfig.locations.forEach(function(location) {
app.get(location === '/' ? location : location + '*', middleware);
});
} else {
app.all('*', middleware);
}
};
exports.rewritePath = function rewritePath(req, res, next) {
if (
process.env.HOPS_MODE === 'static' &&
Array.isArray(hopsConfig.locations)
) {
var location = hopsConfig.locations.find(function(location) {
return (
location !== hopsConfig.basePath + '/' &&
req.url.indexOf(location) === 0
);
});
if (location) {
req.url = location.replace(/([^\\/])$/, '$1/');
}
}
next();
};
exports.registerMiddleware = function registerMiddleware(app, middleware) {
app.use(exports.assetsMiddleware);
if (
process.env.HOPS_MODE === 'static' &&
Array.isArray(hopsConfig.locations)
) {
hopsConfig.locations.forEach(function(location) {
app.get(location === '/' ? location : location + '*', middleware);
});
} else {
app.all('*', middleware);
}
};
exports.rewritePath = function rewritePath(req, res, next) {
if (
process.env.HOPS_MODE === 'static' &&
Array.isArray(hopsConfig.locations)
) {
var location = hopsConfig.locations.find(function(location) {
return (
location !== hopsConfig.basePath + '/' &&
req.url.indexOf(location) === 0
);
});
if (location) {
req.url = location.replace(/([^\\/])$/, '$1/');
}
}
next();
};