Socket
Socket
Sign inDemoInstall

css-tree

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-tree - npm Package Versions

13
6

2.0.0

Diff

Changelog

Source

2.0.0 (December 3, 2021)

  • Package
    • Dropped support for Node.js prior 14.16 (following patch versions changed it to ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0)
    • Converted to ES modules. However, CommonJS is supported as well (dual module)
    • Added exports for standalone parts instead of internal paths usage (use as import * as parser from "css-tree/parser" or require("css-tree/parser")):
      • css-tree/tokenizer
      • css-tree/parser
      • css-tree/walker
      • css-tree/generator
      • css-tree/lexer
      • css-tree/definition-syntax
      • css-tree/utils
    • Changed bundle set to provide dist/csstree.js (an IIFE version with csstree as a global name) and dist/csstree.esm.js (as ES module). Both are minified
    • Bumped mdn-data to 2.0.23
  • Tokenizer
    • Changed tokenize() to take a function as second argument, which will be called for every token. No stream instance is creating when second argument is ommited.
    • Changed TokenStream#getRawLength() to take second parameter as a function (rule) that check a char code to stop a scanning
    • Added TokenStream#forEachToken(fn) method
    • Removed TokenStream#skipWS() method
    • Removed TokenStream#getTokenLength() method
  • Parser
    • Moved SyntaxError (custom parser's error class) from root of public API to parser via parse.SyntaxError
    • Removed parseError field in parser's SyntaxError
    • Changed selector parsing to produce { type: 'Combinator', name: ' ' } node instead of WhiteSpace node
    • Removed producing of WhiteSpace nodes with the single exception for a custom property declaration with a single white space token as a value
    • Parser adds a whitespace to + and - operators, when a whitespace is before and/or after an operator
    • Exposed parser's inner configuration as parse.config
    • Added consumeUntilBalanceEnd(), consumeUntilLeftCurlyBracket(), consumeUntilLeftCurlyBracketOrSemicolon(), consumeUntilExclamationMarkOrSemicolon() and consumeUntilSemicolonIncluded() methods to parser's inner API to use with Raw instead of Raw.mode
    • Changed Nth to always consume of clause when presented, so it became more general and moves validation to lexer
    • Changed String node type to store decoded string value, i.e. with no quotes and escape sequences
    • Changed Url node type to store decoded url value as a string instead of String or Raw node, i.e. with no quotes, escape sequences and url() wrapper
  • Generator
    • Generator is now determines itself when a white space required between emitting tokens
    • Changed chunk() handler to token() (output a single token) and tokenize() (split a string into tokens and output each of them)
    • Added mode option for generate() to specify a mode of token separation: spec or safe (by default)
    • Added emit(token, type, auto) handler as implementation specific token processor
    • Changed Nth to serialize +n as n
    • Added auto-encoding for a string and url tokens on serialization
  • Lexer
    • Removed Lexer#matchDeclaration() method
  • Utils
    • Added ident, string and url helpers to decode/encode corresponding values, e.g. url.decode('url("image.jpg")') === 'image.jpg'
    • List
      • Changed List to be iterable (iterates data)
      • Changed List#first, List#last and List#isEmpty to getters
      • Changed List#getSize() method to List#size getter
      • Removed List#each() and List#eachRight() methods, List#forEach() and List#forEachRight() should be used instead
lahmatiy
published 1.1.3 •

Changelog

Source

1.1.3 (March 31, 2021)

  • Fixed matching on CSS wide keywords for at-rule's prelude and descriptors
  • Added fit-content to width property patch as browsers are supported it as a keyword (nonstandard), but spec defines it as a function
  • Fixed parsing a value contains parentheses or brackets and parseValue option is set to false, in that case !important was included into a value but must not (#155)
lahmatiy
published 1.1.2 •

Changelog

Source

1.1.2 (November 26, 2020)

  • Rolled back to use spread syntax in object literals since it not supported by nodejs < 8.3 (#145)
lahmatiy
published 1.1.1 •

Changelog

Source

1.1.1 (November 18, 2020)

  • Fixed edge cases in mismatch location computation for SyntaxMatchError
lahmatiy
published 1.1.0 •

Changelog

Source

1.1.0 (November 17, 2020)

  • Bumped mdn-data to 2.0.14
  • Extended fork() method to allow append syntax instead of overriding for types, properties and atrules, e.g. csstree.fork({ types: { color: '| foo | bar' } })
  • Extended lexer API for validation
    • Added Lexer#checkAtruleName(atruleName), Lexer#checkAtrulePrelude(atruleName, prelude), Lexer#checkAtruleDescriptorName(atruleName, descriptorName) and Lexer#checkPropertyName(propertyName)
    • Added Lexer#getAtrule(atruleName, fallbackBasename) method
    • Extended Lexer#getAtrulePrelude() and Lexer#getProperty() methods to take fallbackBasename parameter
    • Improved SyntaxMatchError location details
    • Changed error messages
lahmatiy
published 1.0.1 •

Changelog

Source

1.0.1 (November 11, 2020)

  • Fixed edge cases for parsing of custom property value with a single whitespace when parseCustomProperty:true
lahmatiy
published 1.0.0 •

Changelog

Source

1.0.0 (October 27, 2020)

  • Added onComment option to parser config
  • Added support for break and skip values in walk() to control traversal
  • Added List#reduce() and List#reduceRight() methods
  • Bumped mdn-data to 2.0.12
  • Exposed version of the lib (i.e. import { version } from 'css-tree')
  • Fixed Lexer#dump() to dump atrules syntaxes as well
  • Fixed matching comma separated <urange> list (#135)
  • Renamed HexColor node type into Hash
  • Removed element() specific parsing rules
  • Removed dist/default-syntax.json from package
lahmatiy
published 1.0.0-alpha.39 •

Changelog

Source

1.0.0-alpha.39 (December 5, 2019)

  • Fixed walker with visit: "Declaration" to iterate DeclarationList (#114)
lahmatiy
published 1.0.0-alpha.38 •

Changelog

Source

1.0.0-alpha.38 (November 25, 2019)

  • Bumped mdn-data to 2.0.6
  • Added initial implmentation for at-rule matching via Lexer#matchAtrulePrelude() and Lexer#matchAtruleDescriptor() methods
  • Added -moz-control-character-visibility, -ms-grid-columns, -ms-grid-rows and -ms-hyphenate-limit-last properties to patch (#111)
  • Added flow, flow-root and table-caption values to patched display (#112)
lahmatiy
published 1.0.0-alpha.37 •

Changelog

Source

1.0.0-alpha.37 (October 22, 2019)

  • Bumped source-map version to ^0.6.1 to fix source map generation inconsistency across node.js versions due to mappings sorting bug and v8 moving to a stable Array#sort (fix commit in source-map)
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