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

@vivliostyle/cli

Package Overview
Dependencies
Maintainers
5
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vivliostyle/cli - npm Package Compare versions

Comparing version 2.0.0-pre.3 to 2.0.0

63

dist/lib/server.js

@@ -138,2 +138,3 @@ "use strict";

var port, beforeHook, server;
var _this = this;
return __generator(this, function (_a) {

@@ -145,24 +146,44 @@ switch (_a.label) {

util_1.debug("Launching broker server... http://localhost:" + port);
beforeHook = function (req, res, next) {
// Provide node_modules
var resolvedPath;
if (req.url && req.url.startsWith('/node_modules')) {
var pathName = url_1.default.parse(req.url).pathname;
var moduleName = pathName.substr(14).replace('..', '');
try {
resolvedPath = require.resolve(moduleName);
beforeHook = function (req, res, next) { return __awaiter(_this, void 0, void 0, function () {
var pathName, moduleName, basePathCandidates, _i, basePathCandidates_1, basePath, resolvedPath, stream, e_2;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!(req.url && req.url.startsWith('/node_modules'))) return [3 /*break*/, 6];
pathName = url_1.default.parse(req.url).pathname;
moduleName = pathName.substr(14).replace('..', '');
basePathCandidates = require.resolve.paths(moduleName) || [];
_i = 0, basePathCandidates_1 = basePathCandidates;
_a.label = 1;
case 1:
if (!(_i < basePathCandidates_1.length)) return [3 /*break*/, 6];
basePath = basePathCandidates_1[_i];
_a.label = 2;
case 2:
_a.trys.push([2, 4, , 5]);
resolvedPath = path_1.default.resolve(basePath, moduleName);
return [4 /*yield*/, fs_1.default.promises.access(resolvedPath)];
case 3:
_a.sent();
stream = fs_1.default.createReadStream(resolvedPath);
stream.pipe(res); // send module to client
return [2 /*return*/];
case 4:
e_2 = _a.sent();
if (e_2.code === 'ENOENT') {
return [3 /*break*/, 5];
}
else {
throw e_2;
}
return [3 /*break*/, 5];
case 5:
_i++;
return [3 /*break*/, 1];
case 6:
next(); // module not found
return [2 /*return*/];
}
catch (e) {
if (e.code !== 'MODULE_NOT_FOUND') {
next();
throw e;
}
}
}
if (!resolvedPath) {
return next(); // module not found
}
var stream = fs_1.default.createReadStream(resolvedPath);
stream.pipe(res); // send module to client
};
});
}); };
server = startEndpoint({

@@ -169,0 +190,0 @@ root: path_1.default.resolve(__dirname, '../..'),

{
"name": "@vivliostyle/cli",
"description": "Save the pdf file via Headless Chrome and Vivliostyle.",
"version": "2.0.0-pre.3",
"version": "2.0.0",
"engines": {

@@ -15,3 +15,3 @@ "node": ">= 10"

"dependencies": {
"@vivliostyle/core": "2.0.0-pre.4",
"@vivliostyle/core": "2.0.0",
"commander": "^4.0.1",

@@ -18,0 +18,0 @@ "debug": "^4.1.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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