Socket
Socket
Sign inDemoInstall

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.1.4 to 1.2.0

7

CHANGELOG.md

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

## 1.2.0
_2021-05-05_
- feat: Allow `//` comments inside `@deps` blocks
- docs: Improved README and AppConfig docs.
## 1.1.3 – 1.1.4

@@ -9,0 +16,0 @@

7

package.json
{
"name": "cssserve",
"version": "1.1.4",
"version": "1.2.0",
"license": "MIT",

@@ -26,3 +26,6 @@ "dependencies": {

},
"scripts": {}
"scripts": {},
"engines": {
"node": ">=12"
}
}

@@ -13,5 +13,7 @@ # cssserve – CSS Server

- [Log-levels](#log-levels)
- [What it serves](#what-it-serves)
- [CSS dependency bundling and version resolution](#css-dependency-bundling-and-version-resolution)
- [Example request:](#example-request)
- [Static assets](#static-assets)
[Example request:](#example-request)
- [Static assets](#static-assets) [Example request:](#example-request)

@@ -39,3 +41,4 @@ ---

CLI arguments and a `--config file` option as well.
([See more details](https://www.npmjs.com/package/rc#standards))
([See the `rc` docs](https://www.npmjs.com/package/rc#standards) for more
details.)

@@ -55,9 +58,10 @@ Additionally the `port` option can be overridden via the environment variables

## What it serves
## CSS dependency bundling and version resolution
The server's only purpose is to accept a list of CSS module names build a
The server's primary purpose is to accept a list of CSS module names build a
correctly ordered, deduplicated list of `@include` links to the corresponding
CSS files and their dependencies recursively.
CSS files and **their dependencies** (see below), recursively.
For this, it exposes the endpoint `/bundle/:version?m={module1,module2,...}`
For this, the server exposes the endpoint
`/bundle/:version?m={module1,module2,...}`

@@ -81,6 +85,6 @@ The `:version` path token can be any value ascii alpha-numerical value with

...then the `:version` token `v1` will match the folder `css/v1.10/`. (See
[getAllValidCssVersions.tests](src/getAllValidCssVersions.tests.ts) and
...then the `:version` token `v1` will resolve to the folder `css/v1.10/`.
(See [getAllValidCssVersions.tests](src/getAllValidCssVersions.tests.ts) and
[resolveCssVersionFolder.tests](src/resolveCssVersionFolder.tests.ts) for more
details.)
nerdy details.)

@@ -108,3 +112,3 @@ ### Example request:

@import '/css/v1.10/ModuleA.css';
/* Unique dependencies of ModuleB.css */
/* Dependencies of ModuleB.css not already met by ModuleA */
@import '/css/v1.10/FormInput.css';

@@ -122,3 +126,3 @@ @import '/css/v1.10/Selectbox.css';

Button
Carousel
Carousel // NOTE: comments are allowed
Herobanner

@@ -136,1 +140,7 @@ Tabs

[parseModules.tests](src/parseModules.tests.ts) for details.)
## Static assets
Any files/folders you place inside `options.staticFolder` will automatically
exposed and served with a HTTP caching lifetime set to `options.ttl_static`
(same as the `@import`ed CSS files and their linked assets).
#!/usr/bin/env node
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var fastify = _interopDefault(require('fastify'));
var fastifyCompress = _interopDefault(require('fastify-compress'));
var fastifyStatic = _interopDefault(require('fastify-static'));
var fastifyCors = _interopDefault(require('fastify-cors'));
var fastify = require('fastify');
var fastifyCompress = require('fastify-compress');
var fastifyStatic = require('fastify-static');
var fastifyCors = require('fastify-cors');
var fs = require('fs');
var glob = require('glob');
var rc = _interopDefault(require('rc'));
var LRUCache = _interopDefault(require('lru-cache'));
var rc = require('rc');
var LRUCache = require('lru-cache');
var path = require('path');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var fastify__default = /*#__PURE__*/_interopDefaultLegacy(fastify);
var fastifyCompress__default = /*#__PURE__*/_interopDefaultLegacy(fastifyCompress);
var fastifyStatic__default = /*#__PURE__*/_interopDefaultLegacy(fastifyStatic);
var fastifyCors__default = /*#__PURE__*/_interopDefaultLegacy(fastifyCors);
var rc__default = /*#__PURE__*/_interopDefaultLegacy(rc);
var LRUCache__default = /*#__PURE__*/_interopDefaultLegacy(LRUCache);
/*! *****************************************************************************

@@ -235,3 +242,3 @@ Copyright (c) Microsoft Corporation. All rights reserved.

};
var config = rc(appName, defaults);
var config = rc__default['default'](appName, defaults);
// enforce correct types

@@ -277,2 +284,3 @@ config.port = parseInt(process.env.NODE_PORT || process.env.PORT || '') || config.port;

var deps = match[1]
.replace(/\/\/.*(?:\n|$)/g, '')
.replace(/\n|,|;/g, ' ')

@@ -429,3 +437,3 @@ .trim()

var makeBundleCache = function () {
bundleCache = new LRUCache({
bundleCache = new LRUCache__default['default']({
// With maxAge `undefined` means infinite cache-lifetime,

@@ -538,3 +546,3 @@ // but `-1` makes everything immediately stale - effectively

var sslKeyPath = config.sslKeyPath || __dirname + '/default-keys/';
var app = fastify(proxied
var app = fastify__default['default'](proxied
? {}

@@ -550,9 +558,9 @@ : {

if (!proxied) {
app.register(fastifyCompress, { global: true });
app.register(fastifyCompress__default['default'], { global: true });
}
app.register(fastifyCors, {
app.register(fastifyCors__default['default'], {
origin: true,
methods: ['GET'],
});
app.register(fastifyStatic, {
app.register(fastifyStatic__default['default'], {
root: path.resolve(staticFolder$1),

@@ -559,0 +567,0 @@ redirect: true,

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