Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var fs = require('fs');
var url = require('url');
var cspMiddleware = require('@ui5/server').middleware.csp;
module.exports = function(grunt, config) {
// determine the testsuite name and lookup the sap.ui.core library
// to be a bit more dynamic for the livereload middleware
var testsuiteName = config.testsuite && config.testsuite.name || testsuiteName;
var sapUiCoreBasePath = 'src/sap.ui.core';
config.allLibraries.forEach(function(oLib, i) {
if (oLib.name === 'sap.ui.core') {
sapUiCoreBasePath = oLib.path;
}
});
var sapUiTestsuiteBasePath = config.testsuite.path;
var sapUiBuildtime = config.buildtime;
return projectPreprocessor.processTree(tree).then((parsedTree) => {
t.deepEqual(parsedTree.dependencies.length, 0, "Application project has no dependencies");
const {middlewareRepository} = require("@ui5/server");
t.truthy(middlewareRepository.getMiddleware("middleware.a"),
"middleware.a has been added to the middleware repository");
});
});
handleServerMiddleware(extension) {
if (!extension.metadata && !extension.metadata.name) {
throw new Error(`Middleware extension ${extension.id} is missing 'metadata.name' configuration`);
}
if (!extension.middleware) {
throw new Error(`Middleware extension ${extension.id} is missing 'middleware' configuration`);
}
const {middlewareRepository} = require("@ui5/server");
const middlewarePath = path.join(extension.path, extension.middleware.path);
middlewareRepository.addMiddleware(extension.metadata.name, middlewarePath);
}
}