@ui5/server
Advanced tools
Comparing version 0.2.2 to 1.0.0
@@ -5,12 +5,16 @@ # Changelog | ||
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-server/compare/v0.2.2...HEAD). | ||
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-server/compare/v1.0.0...HEAD). | ||
<a name="v1.0.0"></a> | ||
## [v1.0.0] - 2019-01-10 | ||
### Dependency Updates | ||
- Bump [@ui5](https://github.com/ui5)/project from 0.2.5 to 1.0.0 ([#109](https://github.com/SAP/ui5-server/issues/109)) [`84d31a5`](https://github.com/SAP/ui5-server/commit/84d31a5340f77fc6ec54e9c5829c8ad656b2adb1) | ||
- Bump [@ui5](https://github.com/ui5)/builder from 0.2.9 to 1.0.0 ([#108](https://github.com/SAP/ui5-server/issues/108)) [`8e39375`](https://github.com/SAP/ui5-server/commit/8e393754f71efe14e9cd5daf345012f2b1d7926d) | ||
- Bump [@ui5](https://github.com/ui5)/fs from 0.2.0 to 1.0.0 ([#107](https://github.com/SAP/ui5-server/issues/107)) [`93e39af`](https://github.com/SAP/ui5-server/commit/93e39afc3e728ff2e829865d7de3c635a43241f0) | ||
- Bump [@ui5](https://github.com/ui5)/logger from 0.2.2 to 1.0.0 ([#106](https://github.com/SAP/ui5-server/issues/106)) [`3687ad6`](https://github.com/SAP/ui5-server/commit/3687ad6b224cf9c37359de30917bc711fe7b239a) | ||
<a name="v0.2.2"></a> | ||
## [v0.2.2] - 2018-10-29 | ||
### Internal Changes | ||
- **Coveralls:** Use parallel setting to reduce number of PR comments [`9e9855d`](https://github.com/SAP/ui5-server/commit/9e9855d34f5b62111ca56204c17e1183ea28beae) | ||
- **serveThemes:** Fix tests after upgrade to [@ui5](https://github.com/ui5)/builder v0.2.3 [`1dfba02`](https://github.com/SAP/ui5-server/commit/1dfba027b3eb0e78907d7cc67a2ef418dd025f53) | ||
- **versionInfo:** sap-ui-version.json no longer contains gav information [`c66af16`](https://github.com/SAP/ui5-server/commit/c66af1656b1235504ef00c4362178da7f70141c1) | ||
<a name="v0.2.1"></a> | ||
@@ -21,11 +25,3 @@ ## [v0.2.1] - 2018-07-17 | ||
## [v0.2.0] - 2018-07-12 | ||
### Internal Changes | ||
- Add .npmrc to enforce public registry [`3eb2825`](https://github.com/SAP/ui5-server/commit/3eb2825af9d20c61beaadd811b3a1ed911159314) | ||
- Fix theme middleware tests [`dde2a65`](https://github.com/SAP/ui5-server/commit/dde2a65a260c51c0811245bdc92bb3409b91de9e) | ||
- Fix package-lock.json URLs [`173dfa1`](https://github.com/SAP/ui5-server/commit/173dfa1acf9e9a679250cd11412ae143e37d4e75) | ||
- Update min Node.js version to >=8.5 [`89b7f21`](https://github.com/SAP/ui5-server/commit/89b7f219279e9b92f200e7822c0f13134044c12c) | ||
- **CHANGELOG:** Fix scope detection in commit messages [`cd7dbd1`](https://github.com/SAP/ui5-server/commit/cd7dbd1011830e273d4e001fca1ba3cd719ee598) | ||
- **package.json:** Define files to publish [`5443bec`](https://github.com/SAP/ui5-server/commit/5443bec4363bf38d3935d5b13deb75438e62275a) | ||
<a name="v0.1.2"></a> | ||
@@ -46,25 +42,7 @@ ## [v0.1.2] - 2018-07-10 | ||
## [v0.1.0] - 2018-06-26 | ||
### Internal Changes | ||
- Update ui5 tooling dependencies [`ba34c41`](https://github.com/SAP/ui5-server/commit/ba34c41f4d291b109e2dc770672f8e945778e665) | ||
- Add coveralls and dm-badges [`1c22823`](https://github.com/SAP/ui5-server/commit/1c22823870acb1c761c4f52ce5b676219d411541) | ||
- **CHANGELOG:** Fix GitHub release template [`a4f736b`](https://github.com/SAP/ui5-server/commit/a4f736b189e74ad4b65f195509da198196d623b9) | ||
- **README:** Pre-Alpha -> Alpha [`8b32857`](https://github.com/SAP/ui5-server/commit/8b32857e88699ef62292a3b69b30e724d960441e) | ||
<a name="v0.0.1"></a> | ||
## v0.0.1 - 2018-06-06 | ||
### Internal Changes | ||
- Prepare npm release [`80271f1`](https://github.com/SAP/ui5-server/commit/80271f1c80dd6fb65ced85d949f28dd75f9bc74f) | ||
- Update .editorconfig [`21ed234`](https://github.com/SAP/ui5-server/commit/21ed234f7e492ea1c6000e26855cd1e2c2c1a6a5) | ||
- Add chglog config + npm release scripts [`9e1a122`](https://github.com/SAP/ui5-server/commit/9e1a1226b64a595ec72f1c886343c56b625f56d0) | ||
- Update dependencies [`0518658`](https://github.com/SAP/ui5-server/commit/0518658cb9bab9e551a4406bfa905ffeb9218dad) | ||
- Add missing test module dependencies [`9ee06c4`](https://github.com/SAP/ui5-server/commit/9ee06c4ed5e8ae9e1de1fc497768909313e769d6) | ||
- Update and add more jsdoc for server, sslUtil and middleware [`d0e747d`](https://github.com/SAP/ui5-server/commit/d0e747d598b8f6696755581582f53e276260c72c) | ||
- Add travis CI badge + package.json cleanup [`3ff2fb9`](https://github.com/SAP/ui5-server/commit/3ff2fb91f1c350cae284c9e1398e9efd4b82b2f2) | ||
- Fix links to CONTRIBUTING.md file [`63b9f0d`](https://github.com/SAP/ui5-server/commit/63b9f0d20fb4c76f182ff9dea8692c85e4a1897d) | ||
- **ESLint:** Activate no-var rule [`7f3e234`](https://github.com/SAP/ui5-server/commit/7f3e2348e977232676c4829e8079dad6e4f1d8ea) | ||
- **ESLint:** Activate no-console [`dc6b76a`](https://github.com/SAP/ui5-server/commit/dc6b76a3f19b49a18396631fcfa13f97f3e42e47) | ||
- **Travis:** Add node.js 10 to test matrix [`2881261`](https://github.com/SAP/ui5-server/commit/2881261a05afd737af7c8874b91819a52b8f88df) | ||
[v1.0.0]: https://github.com/SAP/ui5-server/compare/v0.2.2...v1.0.0 | ||
[v0.2.2]: https://github.com/SAP/ui5-server/compare/v0.2.1...v0.2.2 | ||
@@ -71,0 +49,0 @@ [v0.2.1]: https://github.com/SAP/ui5-server/compare/v0.2.0...v0.2.1 |
@@ -1,2 +0,6 @@ | ||
const ui5Server = { | ||
/** | ||
* @module @ui5/server | ||
* @public | ||
*/ | ||
module.exports = { | ||
server: require("./lib/server"), | ||
@@ -14,3 +18,1 @@ sslUtil: require("./lib/sslUtil"), | ||
}; | ||
module.exports = ui5Server; |
{ | ||
"tags": { | ||
"allowUnknownTags": true | ||
"allowUnknownTags": false | ||
}, | ||
"source": { | ||
"include": ["README.md"], | ||
"include": ["README.md", "index.js"], | ||
"includePattern": ".+\\.js$", | ||
@@ -16,8 +16,46 @@ "excludePattern": "(node_modules(\\\\|/))" | ||
"recurse": true, | ||
"verbose": true | ||
"verbose": true, | ||
"access": "public" | ||
}, | ||
"templates": { | ||
"cleverLinks": false, | ||
"monospaceLinks": false | ||
"monospaceLinks": false, | ||
"default": { | ||
"useLongnameInNav": true | ||
} | ||
}, | ||
"openGraph": { | ||
"title": "UI5 Build and Development Tooling - API Reference", | ||
"type": "website", | ||
"image": "https://sap.github.io/ui5-tooling/docs/images/UI5_logo_wide.png", | ||
"site_name": "UI5 Build and Development Tooling - API Reference", | ||
"url": "https://sap.github.io/ui5-tooling/" | ||
}, | ||
"docdash": { | ||
"sectionOrder": [ | ||
"Modules", | ||
"Namespaces", | ||
"Classes", | ||
"Externals", | ||
"Events", | ||
"Mixins", | ||
"Tutorials", | ||
"Interfaces" | ||
], | ||
"meta": { | ||
"title": "UI5 Build and Development Tooling - API Reference - UI5 Server", | ||
"description": "UI5 Build and Development Tooling - API Reference - UI5 Server", | ||
"keyword": "openui5 sapui5 ui5 build development tool api reference" | ||
}, | ||
"search": true, | ||
"wrap": true, | ||
"menu": { | ||
"GitHub": { | ||
"href": "https://github.com/SAP/ui5-server", | ||
"target": "_blank", | ||
"class": "menu-item", | ||
"id": "github_link" | ||
} | ||
} | ||
} | ||
} |
@@ -36,8 +36,8 @@ const url = require("url"); | ||
let oParsedUrl = url.parse(req.url); | ||
let oQuery = querystring.parse(oParsedUrl.query); | ||
const oParsedUrl = url.parse(req.url); | ||
const oQuery = querystring.parse(oParsedUrl.query); | ||
let sCspUrlParameterValue = oQuery[sCspUrlParameterName]; | ||
if (sCspUrlParameterValue) { | ||
let mPolicyMatch = rPolicy.exec(sCspUrlParameterValue); | ||
const mPolicyMatch = rPolicy.exec(sCspUrlParameterValue); | ||
@@ -65,3 +65,3 @@ if (mPolicyMatch && mPolicyMatch[1] | ||
if (oPolicy) { | ||
let sHeader = bReportOnly ? HEADER_CONTENT_SECURITY_POLICY_REPORT_ONLY : HEADER_CONTENT_SECURITY_POLICY; | ||
const sHeader = bReportOnly ? HEADER_CONTENT_SECURITY_POLICY_REPORT_ONLY : HEADER_CONTENT_SECURITY_POLICY; | ||
let sHeaderValue; | ||
@@ -68,0 +68,0 @@ |
@@ -15,7 +15,7 @@ const librariesPattern = /([A-Z0-9._%+-/]+)\/[A-Z0-9._]*\.library$/i; | ||
* | ||
* @module server/middleware/discovery | ||
* @module @ui5/server/middleware/discovery | ||
* @param {Object} resourceCollections Contains the resource reader or collection to access project related files | ||
* @param {AbstractReader} resourceCollections.source Resource reader or collection for the source project | ||
* @param {AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies | ||
* @returns {function} Returns a server middleware closure. | ||
* @param {module:@ui5/fs.AbstractReader} resourceCollections.source Resource reader or collection for the source project | ||
* @param {module:@ui5/fs.AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies | ||
* @returns {Function} Returns a server middleware closure. | ||
*/ | ||
@@ -52,3 +52,3 @@ function createMiddleware({resourceCollections}) { | ||
resources.forEach(function(resource) { | ||
let relPath = resource.getPath().substr(1); // cut off leading "/" | ||
const relPath = resource.getPath().substr(1); // cut off leading "/" | ||
response.push({ | ||
@@ -65,3 +65,3 @@ entry: relPath | ||
resources.forEach(function(resource) { | ||
let relPath = resource.getPath().substr(11); // cut off leading "/resources/" | ||
const relPath = resource.getPath().substr(11); // cut off leading "/resources/" | ||
const match = librariesPattern.exec(relPath); | ||
@@ -81,8 +81,8 @@ if (match) { | ||
]).then(function(results) { | ||
let libraryResources = results[0]; | ||
let testPageResources = results[1]; | ||
const libraryResources = results[0]; | ||
const testPageResources = results[1]; | ||
const libs = {}; | ||
libraryResources.forEach(function(resource) { | ||
let relPath = resource.getPath().substr(11); // cut off leading "/resources/" | ||
const relPath = resource.getPath().substr(11); // cut off leading "/resources/" | ||
const match = librariesPattern.exec(relPath); | ||
@@ -96,3 +96,3 @@ if (match) { | ||
testPageResources.forEach(function(resource) { | ||
let relPath = resource.getPath().substr(16); // cut off leading "/test-resources/" | ||
const relPath = resource.getPath().substr(16); // cut off leading "/test-resources/" | ||
if (testPagesPattern.test(relPath)) { | ||
@@ -99,0 +99,0 @@ Object.keys(libs).forEach(function(lib) { |
@@ -7,4 +7,4 @@ /** | ||
* | ||
* @module server/middleware/nonReadRequests | ||
* @returns {function} Returns a server middleware closure. | ||
* @module @ui5/server/middleware/nonReadRequests | ||
* @returns {Function} Returns a server middleware closure. | ||
*/ | ||
@@ -11,0 +11,0 @@ function createMiddleware() { |
@@ -13,4 +13,4 @@ const log = require("@ui5/logger").getLogger("server:middleware:serveIndex"); | ||
* | ||
* @param {Resource} resource the resource | ||
* @returns {String} mime type | ||
* @param {module:@ui5/fs.Resource} resource the resource | ||
* @returns {string} mime type | ||
*/ | ||
@@ -28,4 +28,4 @@ function getMimeType(resource) { | ||
* | ||
* @param {Number} bytes bytes | ||
* @returns {String} human readable size | ||
* @param {number} bytes bytes | ||
* @returns {string} human readable size | ||
*/ | ||
@@ -50,9 +50,9 @@ function formatSize(bytes) { | ||
* | ||
* @param {Resource} resource the resource to convert | ||
* @param {module:@ui5/fs.Resource} resource the resource to convert | ||
* @returns {Object} resource info object | ||
*/ | ||
function createResourceInfo(resource) { | ||
let stat = resource.getStatInfo(); | ||
let isDir = stat.isDirectory(); | ||
let resInfo = { | ||
const stat = resource.getStatInfo(); | ||
const isDir = stat.isDirectory(); | ||
const resInfo = { | ||
path: resource.getPath() + (isDir ? "/" : ""), | ||
@@ -75,3 +75,3 @@ name: resource._name + (isDir ? "/" : ""), | ||
* | ||
* @param {Resource[]} resources an array of resources | ||
* @param {module:@ui5/fs.Resource[]} resources an array of resources | ||
* @returns {Object[]} sorted array of resource infos | ||
@@ -97,5 +97,5 @@ */ | ||
* | ||
* @param {String} path the path | ||
* @param {string} path the path | ||
* @param {Object[]} resourceInfos an array of resource infos | ||
* @returns {String} HTML content for the resource listing | ||
* @returns {string} HTML content for the resource listing | ||
*/ | ||
@@ -139,6 +139,6 @@ function createContent(path, resourceInfos) { | ||
* | ||
* @module server/middleware/serveIndex | ||
* @module @ui5/server/middleware/serveIndex | ||
* @param {Object} resourceCollections Contains the resource reader or collection to access project related files | ||
* @param {AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies | ||
* @returns {function} Returns a server middleware closure. | ||
* @param {module:@ui5/fs.AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies | ||
* @returns {Function} Returns a server middleware closure. | ||
*/ | ||
@@ -148,3 +148,3 @@ function createMiddleware({resourceCollections}) { | ||
log.verbose("\n Listing index of " +req.path); | ||
let glob = req.path + (req.path.endsWith("/") ? "*" : "/*"); | ||
const glob = req.path + (req.path.endsWith("/") ? "*" : "/*"); | ||
resourceCollections.combo.byGlob(glob, {nodir: false}).then((resources) => { | ||
@@ -160,3 +160,3 @@ if (!resources || resources.length == 0) { // Not found | ||
let resourceInfos = createResourceInfos(resources); | ||
const resourceInfos = createResourceInfos(resources); | ||
res.end(createContent(req.path, resourceInfos)); | ||
@@ -163,0 +163,0 @@ }).catch((err) => { |
@@ -20,6 +20,6 @@ const log = require("@ui5/logger").getLogger("server:middleware:serveResources"); | ||
* | ||
* @module server/middleware/serveResources | ||
* @module @ui5/server/middleware/serveResources | ||
* @param {Object} resourceCollections Contains the resource reader or collection to access project related files | ||
* @param {AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies | ||
* @returns {function} Returns a server middleware closure. | ||
* @param {module:@ui5/fs.AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies | ||
* @returns {Function} Returns a server middleware closure. | ||
*/ | ||
@@ -26,0 +26,0 @@ function createMiddleware({resourceCollections}) { |
@@ -19,6 +19,6 @@ const themeBuilder = require("@ui5/builder").processors.themeBuilder; | ||
* | ||
* @module server/middleware/serveThemes | ||
* @module @ui5/server/middleware/serveThemes | ||
* @param {Object} resourceCollections Contains the resource reader or collection to access project related files | ||
* @param {AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies | ||
* @returns {function} Returns a server middleware closure. | ||
* @param {module:@ui5/fs.AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies | ||
* @returns {Function} Returns a server middleware closure. | ||
*/ | ||
@@ -25,0 +25,0 @@ function createMiddleware({resourceCollections}) { |
@@ -6,6 +6,6 @@ const createVersionInfoProcessor = require("@ui5/builder").processors.versionInfoGenerator; | ||
* | ||
* @module server/middleware/versionInfo | ||
* @module @ui5/server/middleware/versionInfo | ||
* @param {Object} resourceCollections Contains the resource reader or collection to access project related files | ||
* @param {AbstractReader} resourceCollections.dependencies Resource collection which contains the project dependencies | ||
* @returns {function} Returns a server middleware closure. | ||
* @param {module:@ui5/fs.AbstractReader} resourceCollections.dependencies Resource collection which contains the project dependencies | ||
* @returns {Function} Returns a server middleware closure. | ||
*/ | ||
@@ -12,0 +12,0 @@ function createMiddleware({resourceCollections, tree: project}) { |
@@ -19,100 +19,2 @@ const express = require("express"); | ||
/** | ||
* Start a server for the given project (sub-)tree | ||
* | ||
* @module server/server | ||
* @param {Object} tree A (sub-)tree | ||
* @param {Object} options Options | ||
* @param {number} options.port Port to listen to | ||
* @param {boolean} [options.changePortIfInUse=false] If true, change the port if it is already in use | ||
* @param {boolean} [options.h2=false] Whether HTTP/2 should be used - defaults to <code>http</code> | ||
* @param {string} [options.key] Path to private key to be used for https | ||
* @param {string} [options.cert] Path to certificate to be used for for https | ||
* @param {boolean} [options.acceptRemoteConnections=false] If true, listens to remote connections and not only to localhost connections | ||
* @returns {Promise<Object>} Promise resolving once the server is listening. It resolves with an object containing the <code>port</code>, | ||
* <code>h2</code>-flag and a <code>close</code> function, which can be used to stop the server. | ||
*/ | ||
function serve(tree, {port, changePortIfInUse = false, h2 = false, key, cert, acceptRemoteConnections = false}) { | ||
return Promise.resolve().then(() => { | ||
const projectResourceCollections = resourceFactory.createCollectionsForTree(tree); | ||
const workspace = resourceFactory.createWorkspace({ | ||
reader: projectResourceCollections.source, | ||
name: tree.metadata.name | ||
}); | ||
const combo = new ReaderCollectionPrioritized({ | ||
name: "server - prioritize workspace over dependencies", | ||
readers: [workspace, projectResourceCollections.dependencies] | ||
}); | ||
const resourceCollections = { | ||
source: projectResourceCollections.source, | ||
dependencies: projectResourceCollections.dependencies, | ||
combo | ||
}; | ||
const app = express(); | ||
const oCspConfig = { | ||
allowDynamicPolicySelection: true, | ||
allowDynamicPolicyDefinition: true, | ||
defaultPolicyIsReportOnly: true, | ||
definedPolicies: { | ||
"sap-target-level-1": | ||
"default-src 'self'; " + | ||
"script-src 'self' 'unsafe-eval'; " + | ||
"style-src 'self' 'unsafe-inline'; " + | ||
"font-src 'self' data:; " + | ||
"img-src 'self' * data: blob:; " + | ||
"frame-src 'self' https: data: blob:; " + | ||
"child-src 'self' https: data: blob:; " + | ||
"connect-src 'self' https: wss:;", | ||
"sap-target-level-2": | ||
"default-src 'self'; " + | ||
"script-src 'self'; " + | ||
"style-src 'self' 'unsafe-inline'; " + | ||
"font-src 'self' data:; " + | ||
"img-src 'self' * data: blob:; " + | ||
"frame-src 'self' https: data: blob:; " + | ||
"child-src 'self' https: data: blob:; " + | ||
"connect-src 'self' https: wss:;" | ||
} | ||
}; | ||
app.use(csp("sap-ui-xx-csp-policy", oCspConfig)); | ||
app.use(compression()); | ||
app.use(cors()); | ||
app.use("/discovery", discovery({resourceCollections})); | ||
app.use(serveResources({resourceCollections})); | ||
app.use(serveThemes({resourceCollections})); | ||
app.use("/resources/sap-ui-version.json", versionInfo({resourceCollections, tree})); | ||
app.use("/proxy", ui5connect.proxy({ | ||
secure: false | ||
})); | ||
// Handle anything but read operations *before* the serveIndex middleware | ||
// as it will reject them with a 405 (Method not allowed) instead of 404 like our old tooling | ||
app.use(nonReadRequests({resourceCollections})); | ||
app.use(serveIndex({resourceCollections})); | ||
if (h2) { | ||
return _addSsl({app, h2, key, cert}); | ||
} | ||
return app; | ||
}).then((app) => { | ||
return _listen(app, port, changePortIfInUse, acceptRemoteConnections).then(function({port, server}) { | ||
return { | ||
h2, | ||
port, | ||
close: function(callback) { | ||
server.close(callback); | ||
} | ||
}; | ||
}); | ||
}); | ||
} | ||
/** | ||
* Returns a promise resolving by starting the server. | ||
@@ -135,3 +37,3 @@ * | ||
let host = options.host || "127.0.0.1"; | ||
const host = options.host || "127.0.0.1"; | ||
let portMax; | ||
@@ -175,5 +77,6 @@ if (changePortIfInUse) { | ||
* | ||
* @param {Object} app The original express application | ||
* @param {string} key Path to private key to be used for https | ||
* @param {string} cert Path to certificate to be used for for https | ||
* @param {Object} parameters | ||
* @param {Object} parameters.app The original express application | ||
* @param {string} parameters.key Path to private key to be used for https | ||
* @param {string} parameters.cert Path to certificate to be used for for https | ||
* @returns {Object} The express application with SSL support | ||
@@ -188,4 +91,108 @@ * @private | ||
/** | ||
* @public | ||
* @namespace | ||
* @alias module:@ui5/server.server | ||
*/ | ||
module.exports = { | ||
serve: serve | ||
/** | ||
* Start a server for the given project (sub-)tree | ||
* | ||
* @public | ||
* @param {Object} tree A (sub-)tree | ||
* @param {Object} options Options | ||
* @param {number} options.port Port to listen to | ||
* @param {boolean} [options.changePortIfInUse=false] If true, change the port if it is already in use | ||
* @param {boolean} [options.h2=false] Whether HTTP/2 should be used - defaults to <code>http</code> | ||
* @param {string} [options.key] Path to private key to be used for https | ||
* @param {string} [options.cert] Path to certificate to be used for for https | ||
* @param {boolean} [options.acceptRemoteConnections=false] If true, listens to remote connections and | ||
* not only to localhost connections | ||
* @returns {Promise<Object>} Promise resolving once the server is listening. | ||
* It resolves with an object containing the <code>port</code>, | ||
* <code>h2</code>-flag and a <code>close</code> function, | ||
* which can be used to stop the server. | ||
*/ | ||
serve(tree, {port, changePortIfInUse = false, h2 = false, key, cert, acceptRemoteConnections = false}) { | ||
return Promise.resolve().then(() => { | ||
const projectResourceCollections = resourceFactory.createCollectionsForTree(tree); | ||
const workspace = resourceFactory.createWorkspace({ | ||
reader: projectResourceCollections.source, | ||
name: tree.metadata.name | ||
}); | ||
const combo = new ReaderCollectionPrioritized({ | ||
name: "server - prioritize workspace over dependencies", | ||
readers: [workspace, projectResourceCollections.dependencies] | ||
}); | ||
const resourceCollections = { | ||
source: projectResourceCollections.source, | ||
dependencies: projectResourceCollections.dependencies, | ||
combo | ||
}; | ||
const app = express(); | ||
const oCspConfig = { | ||
allowDynamicPolicySelection: true, | ||
allowDynamicPolicyDefinition: true, | ||
defaultPolicyIsReportOnly: true, | ||
definedPolicies: { | ||
"sap-target-level-1": | ||
"default-src 'self'; " + | ||
"script-src 'self' 'unsafe-eval'; " + | ||
"style-src 'self' 'unsafe-inline'; " + | ||
"font-src 'self' data:; " + | ||
"img-src 'self' * data: blob:; " + | ||
"frame-src 'self' https: data: blob:; " + | ||
"child-src 'self' https: data: blob:; " + | ||
"connect-src 'self' https: wss:;", | ||
"sap-target-level-2": | ||
"default-src 'self'; " + | ||
"script-src 'self'; " + | ||
"style-src 'self' 'unsafe-inline'; " + | ||
"font-src 'self' data:; " + | ||
"img-src 'self' * data: blob:; " + | ||
"frame-src 'self' https: data: blob:; " + | ||
"child-src 'self' https: data: blob:; " + | ||
"connect-src 'self' https: wss:;" | ||
} | ||
}; | ||
app.use(csp("sap-ui-xx-csp-policy", oCspConfig)); | ||
app.use(compression()); | ||
app.use(cors()); | ||
app.use("/discovery", discovery({resourceCollections})); | ||
app.use(serveResources({resourceCollections})); | ||
app.use(serveThemes({resourceCollections})); | ||
app.use("/resources/sap-ui-version.json", versionInfo({resourceCollections, tree})); | ||
app.use("/proxy", ui5connect.proxy({ | ||
secure: false | ||
})); | ||
// Handle anything but read operations *before* the serveIndex middleware | ||
// as it will reject them with a 405 (Method not allowed) instead of 404 like our old tooling | ||
app.use(nonReadRequests({resourceCollections})); | ||
app.use(serveIndex({resourceCollections})); | ||
if (h2) { | ||
return _addSsl({app, h2, key, cert}); | ||
} | ||
return app; | ||
}).then((app) => { | ||
return _listen(app, port, changePortIfInUse, acceptRemoteConnections).then(function({port, server}) { | ||
return { | ||
h2, | ||
port, | ||
close: function(callback) { | ||
server.close(callback); | ||
} | ||
}; | ||
}); | ||
}); | ||
} | ||
}; |
@@ -19,3 +19,3 @@ const os = require("os"); | ||
* | ||
* @module server/sslUtil | ||
* @module @ui5/server/sslUtil | ||
* @param {string} [keyPath=$HOME/.ui5/server/server.key] Path to private key to be used for https. | ||
@@ -25,3 +25,3 @@ * Defaults to <code>$HOME/.ui5/server/server.key</code> | ||
* Defaults to <code>$HOME/.ui5/server/server.crt</codee> | ||
* @returns {Promise<object>} Resolves with an sslObject containing <code>cert</code> and <code>key</code> | ||
* @returns {Promise<Object>} Resolves with an sslObject containing <code>cert</code> and <code>key</code> | ||
*/ | ||
@@ -28,0 +28,0 @@ getSslCertificate: function( |
@@ -1,1 +0,1 @@ | ||
Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. | ||
Copyright (c) 2018-2019 SAP SE or an SAP affiliate company. All rights reserved. |
{ | ||
"name": "@ui5/server", | ||
"version": "0.2.2", | ||
"version": "1.0.0", | ||
"description": "UI5 Build and Development Tooling - Server", | ||
@@ -24,6 +24,6 @@ "author": "SAP SE (https://www.sap.com)", | ||
"unit": "rimraf test/tmp && ava", | ||
"unit-verbose": "rimraf test/tmp && cross-env UI5_LOG_LVL=verbose ava --verbose --serial", | ||
"unit-watch": "rimraf test/tmp && ava --watch", | ||
"unit-nyan": "npm run unit -- --tap | tnyan", | ||
"unit-debug": "rimraf test/tmp && cross-env DEBUG=*,-babel,-ava ava", | ||
"unit-inspect": "cross-env DEBUG=*,-babel,-ava node --inspect-brk node_modules/ava/profile.js", | ||
"unit-nyan": "rimraf test/tmp && ava --tap | tnyan", | ||
"unit-inspect": "cross-env UI5_LOG_LVL=verbose node --inspect-brk node_modules/ava/profile.js", | ||
"coverage": "nyc npm run unit", | ||
@@ -96,12 +96,12 @@ "jsdoc": "npm run jsdoc-generate && opn jsdocs/index.html", | ||
"dependencies": { | ||
"@ui5/builder": "^0.2.0", | ||
"@ui5/fs": "^0.2.0", | ||
"@ui5/logger": "^0.2.0", | ||
"@ui5/project": "^0.2.0", | ||
"@ui5/builder": "^1.0.0", | ||
"@ui5/fs": "^1.0.0", | ||
"@ui5/logger": "^1.0.0", | ||
"@ui5/project": "^1.0.0", | ||
"compression": "^1.7.1", | ||
"connect-openui5": "^0.7.2", | ||
"cors": "^2.8.3", | ||
"cors": "^2.8.5", | ||
"devcert-sanscache": "^0.4.5", | ||
"etag": "^1.8.1", | ||
"express": "^4.16.2", | ||
"express": "^4.16.4", | ||
"fresh": "^0.5.2", | ||
@@ -120,9 +120,12 @@ "make-dir": "^1.1.0", | ||
"cross-env": "^5.1.1", | ||
"docdash": "^1.0.0", | ||
"eslint": "^5.0.1", | ||
"eslint-config-google": "^0.10.0", | ||
"docdash": "^1.0.2", | ||
"eslint": "^5.12.0", | ||
"eslint-config-google": "^0.11.0", | ||
"eslint-plugin-jsdoc": "^3.15.1", | ||
"jsdoc": "^3.5.5", | ||
"nyc": "^13.0.1", | ||
"opn-cli": "^3.1.0", | ||
"rimraf": "^2.6.2", | ||
"mock-require": "^3.0.2", | ||
"nyc": "^13.1.0", | ||
"opn-cli": "^4.0.0", | ||
"rimraf": "^2.6.3", | ||
"sinon": "^7.2.2", | ||
"supertest": "^3.0.0", | ||
@@ -129,0 +132,0 @@ "tap-nyan": "^1.1.0" |
@@ -13,5 +13,2 @@  | ||
**This is an alpha release!** | ||
**The UI5 Build and Development Tooling described here is not intended for productive use yet. Breaking changes are to be expected.** | ||
## Server | ||
@@ -24,5 +21,5 @@ The UI5 Build and Development Tooling comes along with a web server component to serve a project. | ||
* Translation files with `.properties` extension are properly encoded with **ISO-8859-1** | ||
* Changes on files with `.less` extension triggers a theme build and delivers the compiled CSS files | ||
* Version Info is created automatically (`/resources/sap-ui-version.json`) | ||
* Translation files with `.properties` extension are properly encoded with **ISO-8859-1**. | ||
* Changes on files with `.less` extension triggers a theme build and delivers the compiled CSS files. | ||
* Version info is created automatically (`/resources/sap-ui-version.json`). | ||
* List project files with URL (needed exclusively by the OpenUI5 testsuite): `/discovery/app_pages`, `/discovery/all_libs`, `/discovery/all_tests` | ||
@@ -34,3 +31,3 @@ | ||
Upon startup it checks if a certificate exists within the path provided. | ||
Upon startup, it checks if a certificate exists within the path provided. | ||
If there is none, a new certificate is created and used. | ||
@@ -37,0 +34,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
892
1
53538
15
46
+ Added@babel/helper-string-parser@7.25.9(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/parser@7.26.9(transitive)
+ Added@babel/types@7.26.9(transitive)
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Added@types/glob@7.2.0(transitive)
+ Added@types/linkify-it@5.0.0(transitive)
+ Added@types/markdown-it@12.2.3(transitive)
+ Added@types/mdurl@2.0.0(transitive)
+ Added@types/minimatch@5.1.2(transitive)
+ Added@types/node@22.13.9(transitive)
+ Added@ui5/builder@1.10.1(transitive)
+ Added@ui5/fs@1.1.2(transitive)
+ Added@ui5/logger@1.0.2(transitive)
+ Added@ui5/project@1.2.0(transitive)
+ Added@ui5/server@1.6.0(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedarray-union@2.1.0(transitive)
+ Addedasync@3.2.6(transitive)
+ Addedbluebird@3.7.2(transitive)
+ Addedboolbase@1.0.0(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcatharsis@0.9.0(transitive)
+ Addedcheerio@0.22.0(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedconnect-openui5@0.9.1(transitive)
+ Addedcookie@0.4.2(transitive)
+ Addedcss-select@1.2.0(transitive)
+ Addedcss-what@2.1.3(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addeddevcert-sanscache@0.4.6(transitive)
+ Addeddir-glob@3.0.1(transitive)
+ Addeddom-serializer@0.1.1(transitive)
+ Addeddomelementtype@1.3.1(transitive)
+ Addeddomhandler@2.4.2(transitive)
+ Addeddomutils@1.5.1(transitive)
+ Addedentities@1.1.22.1.0(transitive)
+ Addedescape-string-regexp@2.0.0(transitive)
+ Addedescape-unicode@0.2.0(transitive)
+ Addedfast-glob@3.3.3(transitive)
+ Addedfastq@1.19.1(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedget-caller-file@1.0.3(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedglobby@10.0.2(transitive)
+ Addedhandle-thing@2.0.1(transitive)
+ Addedhtmlparser2@3.10.1(transitive)
+ Addedignore@5.3.2(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedjs2xmlparser@4.0.2(transitive)
+ Addedjsdoc@3.6.11(transitive)
+ Addedklaw@3.0.0(transitive)
+ Addedless-openui5@0.8.7(transitive)
+ Addedlinkify-it@3.0.3(transitive)
+ Addedlodash.assignin@4.2.0(transitive)
+ Addedlodash.bind@4.2.1(transitive)
+ Addedlodash.defaults@4.2.0(transitive)
+ Addedlodash.filter@4.6.0(transitive)
+ Addedlodash.flatten@4.4.0(transitive)
+ Addedlodash.foreach@4.5.0(transitive)
+ Addedlodash.map@4.6.0(transitive)
+ Addedlodash.merge@4.6.2(transitive)
+ Addedlodash.pick@4.4.0(transitive)
+ Addedlodash.reduce@4.6.0(transitive)
+ Addedlodash.reject@4.6.0(transitive)
+ Addedlodash.some@4.6.0(transitive)
+ Addedmake-dir@3.1.0(transitive)
+ Addedmarkdown-it@12.3.2(transitive)
+ Addedmarkdown-it-anchor@8.6.7(transitive)
+ Addedmarked@4.3.0(transitive)
+ Addedmdurl@1.0.1(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addedmock-require@3.0.3(transitive)
+ Addednormalize-path@2.1.1(transitive)
+ Addednth-check@1.0.2(transitive)
+ Addedpath-type@4.0.0(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedrandom-int@2.0.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedremove-trailing-separator@1.1.0(transitive)
+ Addedrequizzle@0.2.4(transitive)
+ Addedreusify@1.1.0(transitive)
+ Addedrimraf@3.0.2(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedset-cookie-parser@2.7.1(transitive)
+ Addedslash@3.0.0(transitive)
+ Addedsource-map-support@0.5.21(transitive)
+ Addedspdy@4.0.2(transitive)
+ Addedspdy-transport@3.0.0(transitive)
+ Addedstrip-json-comments@3.1.1(transitive)
+ Addedtaffydb@2.6.2(transitive)
+ Addedterser@4.8.1(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addeduc.micro@1.0.6(transitive)
+ Addedunderscore@1.13.7(transitive)
+ Addedundici-types@6.20.0(transitive)
+ Addedxmlcreate@2.0.4(transitive)
+ Addedyesno@0.3.1(transitive)
- Removed@ui5/builder@0.2.9(transitive)
- Removed@ui5/fs@0.2.0(transitive)
- Removed@ui5/logger@0.2.2(transitive)
- Removed@ui5/project@0.2.5(transitive)
- Removedarr-diff@4.0.0(transitive)
- Removedarr-flatten@1.1.0(transitive)
- Removedarr-union@3.1.0(transitive)
- Removedarray-union@1.0.2(transitive)
- Removedarray-uniq@1.0.3(transitive)
- Removedarray-unique@0.3.2(transitive)
- Removedassign-symbols@1.0.0(transitive)
- Removedbase@0.11.2(transitive)
- Removedbraces@2.3.2(transitive)
- Removedcache-base@1.0.1(transitive)
- Removedclass-utils@0.3.6(transitive)
- Removedclone@1.0.4(transitive)
- Removedcollection-visit@1.0.0(transitive)
- Removedcommander@2.14.1(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedcopy-descriptor@0.1.1(transitive)
- Removeddefaults@1.0.4(transitive)
- Removeddefine-property@0.2.51.0.02.0.2(transitive)
- Removeddir-glob@2.2.2(transitive)
- Removedesprima@2.7.3(transitive)
- Removedexpand-brackets@2.1.4(transitive)
- Removedextend-shallow@2.0.13.0.2(transitive)
- Removedextglob@2.0.4(transitive)
- Removedfill-range@4.0.0(transitive)
- Removedfor-in@1.0.2(transitive)
- Removedfragment-cache@0.2.1(transitive)
- Removedget-value@2.0.6(transitive)
- Removedglobby@7.1.1(transitive)
- Removedhas-value@0.3.11.0.0(transitive)
- Removedhas-values@0.1.41.0.0(transitive)
- Removedignore@3.3.10(transitive)
- Removedis-accessor-descriptor@1.0.1(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-data-descriptor@1.0.1(transitive)
- Removedis-descriptor@0.1.71.0.3(transitive)
- Removedis-extendable@0.1.11.0.1(transitive)
- Removedis-number@3.0.0(transitive)
- Removedis-plain-object@2.0.4(transitive)
- Removedis-windows@1.0.2(transitive)
- Removedisobject@2.1.03.0.1(transitive)
- Removedkind-of@3.2.24.0.06.0.3(transitive)
- Removedmap-cache@0.2.2(transitive)
- Removedmap-visit@1.0.0(transitive)
- Removedmicromatch@3.1.10(transitive)
- Removedmixin-deep@1.3.2(transitive)
- Removednanomatch@1.2.13(transitive)
- Removedobject-copy@0.1.0(transitive)
- Removedobject-visit@1.0.1(transitive)
- Removedobject.pick@1.3.0(transitive)
- Removedpascalcase@0.1.1(transitive)
- Removedposix-character-classes@0.1.1(transitive)
- Removedrandom-int@1.0.0(transitive)
- Removedregex-not@1.0.2(transitive)
- Removedrepeat-element@1.1.4(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedret@0.1.15(transitive)
- Removedsafe-regex@1.1.0(transitive)
- Removedset-value@2.0.1(transitive)
- Removedslash@1.0.0(transitive)
- Removedsnapdragon@0.8.2(transitive)
- Removedsnapdragon-node@2.1.1(transitive)
- Removedsnapdragon-util@3.0.1(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedsplit-string@3.1.0(transitive)
- Removedstatic-extend@0.1.2(transitive)
- Removedto-object-path@0.3.0(transitive)
- Removedto-regex@3.0.2(transitive)
- Removedto-regex-range@2.1.1(transitive)
- Removeduglify-es@3.3.10(transitive)
- Removedunion-value@1.0.1(transitive)
- Removedunset-value@1.0.0(transitive)
- Removeduse@3.1.1(transitive)
Updated@ui5/builder@^1.0.0
Updated@ui5/fs@^1.0.0
Updated@ui5/logger@^1.0.0
Updated@ui5/project@^1.0.0
Updatedcors@^2.8.5
Updatedexpress@^4.16.4