Socket
Socket
Sign inDemoInstall

css

Package Overview
Dependencies
8
Maintainers
11
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.2.0

History.md

28

lib/parse/index.js

@@ -59,7 +59,5 @@ // http://www.w3.org/TR/CSS21/grammar.html

var errorsList = [];
function error(msg) {
if (options.silent === true) {
return false;
}
var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg);

@@ -71,3 +69,8 @@ err.reason = msg;

err.source = css;
throw err;
if (options.silent) {
errorsList.push(err);
} else {
throw err;
}
}

@@ -80,6 +83,9 @@

function stylesheet() {
var rulesList = rules();
return {
type: 'stylesheet',
stylesheet: {
rules: rules()
rules: rulesList,
parsingErrors: errorsList
}

@@ -289,3 +295,3 @@ };

var pos = position();
var m = match(/^@([-\w]+)?keyframes */);
var m = match(/^@([-\w]+)?keyframes\s*/);

@@ -349,3 +355,3 @@ if (!m) return;

var pos = position();
var m = match(/^@host */);
var m = match(/^@host\s*/);

@@ -397,3 +403,3 @@ if (!m) return;

var pos = position();
var m = match(/^@custom-media (--[^\s]+) *([^{;]+);/);
var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
if (!m) return;

@@ -470,3 +476,3 @@

var pos = position();
var m = match(/^@font-face */);
var m = match(/^@font-face\s*/);
if (!m) return;

@@ -516,3 +522,3 @@

function _compileAtrule(name) {
var re = new RegExp('^@' + name + ' *([^;\\n]+);');
var re = new RegExp('^@' + name + '\\s*([^;]+);');
return function() {

@@ -519,0 +525,0 @@ var pos = position();

{
"name": "css",
"version": "2.1.0",
"version": "2.2.0",
"description": "CSS parser / stringifier",

@@ -5,0 +5,0 @@ "main": "index",

@@ -35,2 +35,3 @@ # css [![Build Status](https://travis-ci.org/reworkcss/css.svg?branch=master)](https://travis-ci.org/reworkcss/css)

- indent: the string used to indent the output. Defaults to two spaces.
- compress: omit comments and extraneous whitespace.

@@ -60,9 +61,19 @@ - sourcemap: return a sourcemap along with the CSS output. Using the `source`

Errors will have `error.position`, just like [`node.position`](#position). The
error contains the source position in the message. To get the error message
without the position use `error.reason`.
Errors thrown during parsing have the following properties:
- message: `String`. The full error message with the source position.
- reason: `String`. The error message without position.
- filename: `String` or `undefined`. The value of `options.source` if
passed to `css.parse`. Otherwise `undefined`.
- line: `Integer`.
- column: `Integer`.
- source: `String`. The portion of code that couldn't be parsed.
When parsing with the `silent` option, errors are listed in the
`parsingErrors` property of the [`stylesheet`](#stylesheet) node instead
of being thrown.
If you create any errors in plugins such as in
[rework](https://github.com/reworkcss/rework), you __must__ set the `position`
as well for consistency.
[rework](https://github.com/reworkcss/rework), you __must__ set the same
properties for consistency.

@@ -119,2 +130,4 @@ ## AST

at-rule types.
- parsingErrors: `Array` of `Error`s. Errors collected during parsing when
option `silent` is true.

@@ -121,0 +134,0 @@ #### rule

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc