Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cssserve

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cssserve - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

6

CHANGELOG.md

@@ -7,2 +7,8 @@ # Change Log

## 1.3.0
_2021-06-15_
- feat: Add `config.loudBadTokenErrors` (default: `false` in "production")
## 1.2.0 – 1.2.1

@@ -9,0 +15,0 @@

2

package.json
{
"name": "cssserve",
"version": "1.2.1",
"version": "1.3.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -241,2 +241,3 @@ #!/usr/bin/env node

cache: true,
loudBadTokenErrors: undefined !== 'production',
};

@@ -253,2 +254,5 @@ var config = rc__default['default'](appName, defaults);

config.sslKeyPath = config.sslKeyPath && config.sslKeyPath.trim();
// config.sslCert =
// config.sslPrivkey =
config.loudBadTokenErrors = Boolean(config.loudBadTokenErrors);

@@ -346,6 +350,10 @@ var _validVersions = {};

}; };
var findFirstError = function (modules, isInvalidModule) {
var findFirstError = function (modules, isInvalidModule, loudErrors) {
var moduleError;
modules.forEach(function (moduleName) {
moduleError = moduleError || isInvalidModule(moduleName);
modules.find(function (moduleName) {
var error = isInvalidModule(moduleName);
if (error && (loudErrors || error instanceof UnsafeModuleTokenError)) {
moduleError = error;
return true; // exit loop early
}
});

@@ -359,4 +367,5 @@ return moduleError;

});
var getDepsFor = function (file) {
var deps = config.cache && _depsCache[file];
var getDepsFor = function (file, cache) {
if (cache === void 0) { cache = true; }
var deps = cache && _depsCache[file];
if (!deps) {

@@ -369,7 +378,7 @@ var css = fs.readFileSync(file, 'utf8');

};
var parseModules = function (sourceFolder, modules) {
var parseModules = function (modules, sourceFolder, opts) {
return new Promise(function (resolve, reject) {
var isInvalidModule = makeModuleValidator(sourceFolder);
// Check if the top-level modules coming from the URL are safe and sane
var moduleError = findFirstError(modules, isInvalidModule);
var moduleError = findFirstError(modules, isInvalidModule, opts.loudBadTokenErrors);
if (moduleError) {

@@ -390,3 +399,3 @@ reject(moduleError);

contextFile = sourceFolder + moduleName + '.css';
var deps = getDepsFor(contextFile);
var deps = getDepsFor(contextFile, opts.cache);
return deps.reduce(parseDepsTree, list).concat(deps.hasCSS ? [moduleName] : []);

@@ -409,10 +418,7 @@ };

var getModuleListFromQuery = function (query) {
var allTokensValid = true;
var modules = getParamArr(query, 'm')
.split(',')
.filter(function (token) {
allTokensValid = allTokensValid && isSafeToken(token);
return token;
});
return allTokensValid ? modules.sort(lowercaseFirstCompare) : [];
return getParamArr(query, 'm')
.trim()
.split(/\s*,\s*/)
.filter(function (token) { return token; })
.sort(lowercaseFirstCompare);
};

@@ -437,3 +443,3 @@

var ttl_bundle = config.ttl_bundle, staticFolder = config.staticFolder, cacheRefreshToken = config.cacheRefreshToken;
var ttl_bundle = config.ttl_bundle, staticFolder = config.staticFolder, cacheRefreshToken = config.cacheRefreshToken, cache = config.cache, loudBadTokenErrors = config.loudBadTokenErrors;
var CACHE_CONTROL_VALUE = 'public, max-age=' + ttl_bundle + (ttl_bundle ? ', immutable' : '');

@@ -495,3 +501,6 @@ var bundleCache;

}
return parseModules(staticFolder + versionFolder, modules).then(function (parsedModules) {
return parseModules(modules, staticFolder + versionFolder, {
cache: cache,
loudBadTokenErrors: loudBadTokenErrors,
}).then(function (parsedModules) {
var linkHeader = makeLinkHeaderValue(versionFolder, parsedModules);

@@ -498,0 +507,0 @@ var css = makeCssFromModuleNames(versionFolder, parsedModules);

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