New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ui5/server

Package Overview
Dependencies
Maintainers
4
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ui5/server - npm Package Compare versions

Comparing version 2.2.5 to 2.2.6

10

CHANGELOG.md

@@ -5,4 +5,11 @@ # Changelog

A list of unreleased changes can be found [here](https://github.com/SAP/ui5-server/compare/v2.2.5...HEAD).
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-server/compare/v2.2.6...HEAD).
<a name="v2.2.6"></a>
## [v2.2.6] - 2020-10-22
### Bug Fixes
- Improve parallel theme request handling [`88bc0d6`](https://github.com/SAP/ui5-server/commit/88bc0d6d4e5ca8bb191029335451713579360e1c)
- **nonReadRequests middleware:** Use native response API [`2d2325f`](https://github.com/SAP/ui5-server/commit/2d2325f638820d25738ddbd56afe0d104e37f2e0)
<a name="v2.2.5"></a>

@@ -213,2 +220,3 @@ ## [v2.2.5] - 2020-10-06

[v2.2.6]: https://github.com/SAP/ui5-server/compare/v2.2.5...v2.2.6
[v2.2.5]: https://github.com/SAP/ui5-server/compare/v2.2.4...v2.2.5

@@ -215,0 +223,0 @@ [v2.2.4]: https://github.com/SAP/ui5-server/compare/v2.2.3...v2.2.4

3

lib/middleware/nonReadRequests.js

@@ -15,3 +15,4 @@ /**

if (req.method !== "GET" && req.method !== "HEAD" && req.method !== "OPTIONS") {
res.status(404).end(`Cannot ${req.method} ${req.url}`);
res.statusCode = 404;
res.end(`Cannot ${req.method} ${req.url}`);
} else {

@@ -18,0 +19,0 @@ next();

@@ -48,2 +48,50 @@ const themeBuilder = require("@ui5/builder").processors.themeBuilder;

const currentRequests = {};
async function buildTheme(pathname) {
const filename = basename(pathname);
if (cssVariablesThemeResources.includes(filename) && !buildOptions.cssVariables) {
// Activate CSS Variables build the first time a relevant resource is requested
buildOptions.cssVariables = true;
// Clear the cache to ensure that the build is executed again with "cssVariables: true"
builder.clearCache();
}
const sourceLessPath = dirname(pathname) + "/library.source.less";
const sourceLessResource = await resources.all.byPath(sourceLessPath);
if (!sourceLessResource) { // Not found
return;
}
const createdResources = await builder.build([sourceLessResource], buildOptions);
// Pick requested file resource
const resource = createdResources.find((res) => basename(res.getPath()) === filename);
if (!resource) {
throw new Error(`Theme Build did not return requested file "${pathname}"`);
}
return resource;
}
async function sendResponse(req, res, resource) {
const resourcePath = resource.getPath();
const {contentType} = middlewareUtil.getMimeInfo(resourcePath);
res.setHeader("Content-Type", contentType);
const content = await resource.getBuffer();
res.setHeader("ETag", etag(content));
if (isFresh(req, res)) {
// client has a fresh copy of the resource
res.statusCode = 304;
res.end();
return;
}
res.end(content);
}
return async function theme(req, res, next) {

@@ -58,39 +106,14 @@ try {

if (cssVariablesThemeResources.includes(filename) && !buildOptions.cssVariables) {
// Activate CSS Variables build the first time a relevant resource is requested
buildOptions.cssVariables = true;
// Clear the cache to ensure that the build is executed again with "cssVariables: true"
builder.clearCache();
if (!currentRequests[pathname]) {
currentRequests[pathname] = buildTheme(pathname);
}
const sourceLessPath = dirname(pathname) + "/library.source.less";
const sourceLessResource = await resources.all.byPath(sourceLessPath);
if (!sourceLessResource) { // Not found
const resource = await currentRequests[pathname];
if (!resource) {
next();
return;
} else {
await sendResponse(req, res, resource);
}
const createdResources = await builder.build([sourceLessResource], buildOptions);
// Pick requested file resource
const resource = createdResources.find((res) => res.getPath().endsWith(filename));
if (!resource) {
next(new Error(`Theme Build did not return requested file "${pathname}"`));
return;
}
const resourcePath = resource.getPath();
const {contentType} = middlewareUtil.getMimeInfo(resourcePath);
res.setHeader("Content-Type", contentType);
const content = await resource.getBuffer();
res.setHeader("ETag", etag(content));
if (isFresh(req, res)) {
// client has a fresh copy of the resource
res.statusCode = 304;
res.end();
return;
}
res.end(content.toString());
delete currentRequests[pathname];
} catch (err) {

@@ -97,0 +120,0 @@ next(err);

{
"name": "@ui5/server",
"version": "2.2.5",
"version": "2.2.6",
"description": "UI5 Tooling - Server",

@@ -107,5 +107,5 @@ "author": {

"dependencies": {
"@ui5/builder": "^2.2.1",
"@ui5/fs": "^2.0.3",
"@ui5/logger": "^2.0.0",
"@ui5/builder": "^2.3.0",
"@ui5/fs": "^2.0.4",
"@ui5/logger": "^2.0.1",
"body-parser": "^1.19.0",

@@ -133,3 +133,3 @@ "compression": "^1.7.4",

"@ui5/project": "^2.2.2",
"ava": "3.11.1",
"ava": "^3.13.0",
"chokidar-cli": "^2.1.0",

@@ -139,5 +139,5 @@ "coveralls": "^3.1.0",

"docdash": "^1.2.0",
"eslint": "^7.10.0",
"eslint": "^7.11.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-jsdoc": "^30.6.3",
"eslint-plugin-jsdoc": "^30.6.5",
"jsdoc": "^3.6.6",

@@ -148,3 +148,3 @@ "mock-require": "^3.0.3",

"rimraf": "^3.0.2",
"sinon": "^9.1.0",
"sinon": "^9.2.0",
"supertest": "^5.0.0",

@@ -151,0 +151,0 @@ "tap-nyan": "^1.1.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc