Socket
Socket
Sign inDemoInstall

css-tree

Package Overview
Dependencies
2
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install
Previous12356Next

1.0.0-alpha25

Diff

Changelog

Source

1.0.0-alpha25 (October 9, 2017)

  • Parser
    • Added fallback node as argument to onParseError() handler
    • Fixed raw consuming in tolerant mode when selector is invalid (greedy consuming and redundant warnings)
    • Fixed exception in tolerant mode caused by unknown at-rule with unclosed block
    • Changed handling of semicolons:
      • Hanging semicolon inside declaration blocks raise an error or turns into a Raw node in tolerant mode instead of being ignored
      • Semicolon outside of declaration blocks opens a Rule node as part of selector instead of being ignored
    • Aligned parseAtrulePrelude behaviour to parseRulePrelude
      • Removed Raw node wraping into AtrulePrelude when parseAtrulePrelude is disabled
      • Removed error emitting when at-rule has a custom prelude customer but no prelude is found (it should be validated by a lexer later)
  • Generator
    • Fixed performance issue with translateWithSourceMap(), flattening the string (because of mixing building string and indexing into it) turned it into a quadratic algorithm (approximate numbers can be found in the quiz created by this case)
  • Added support for a single solidus hack for property()
  • Minor fixes for custom errors
lahmatiy
published 1.0.0-alpha24 •

Changelog

Source

1.0.0-alpha24 (September 14, 2017)

  • Improved CSSTree to be stable for standart build-in objects extension (#58)
  • Parser
    • Renamed rule's selector to prelude. The reasons: spec names this part so, and this branch can contain not only a selector (SelectorList) but also a raw payload (Raw). What's changed:
      • Renamed Rule.selector to Rule.prelude
      • Renamed parseSelector parser option to parseRulePrelude
      • Removed option for selector parse in SelectorList
  • Lexer
    • Fixed undefined positions in a error when match a syntax to empty or white space only value
    • Improved Lexer#checkStructure()
      • Return a warning as an object with node reference and message
      • No exception on unknown node type, return a warning instead
lahmatiy
published 1.0.0-alpha23 •

Changelog

Source

1.0.0-alpha23 (September 10, 2017)

  • Fixed Tokenizer#getRawLength()'s false positive balance match to the end of input in some cases (#56)
  • Rename walker's entry point methods to be the same as CSSTree exposed methods (i.e. walk(), walkUp() etc)
  • Rename at-rule's expression to prelude (since spec names it so)
    • AtruleExpression node type → AtrulePrelude
    • Atrule.expression field → Atrule.prelude
    • parseAtruleExpression parser's option → parseAtrulePrelude
    • atruleExpression parse context → atrulePrelude
    • atruleExpression walk context reference → atrulePrelude
lahmatiy
published 1.0.0-alpha22 •

Changelog

Source

1.0.0-alpha22 (September 8, 2017)

  • Parser
    • Fixed exception on parsing of unclosed {}-block in tolerant mode
    • Added tolerant mode support for DeclarationList
    • Added standalone entry point, i.e. default parser can be used via require('css-tree/lib/parser') (#47)
  • Generator
    • Changed generator to produce +n when AnPlusB.a is +1 to be "round-trip" with parser
    • Added standalone entry point, i.e. default generators can be used via require('css-tree/lib/generator')
  • Walker
    • Added standalone entry point, i.e. default walkers can be used via require('css-tree/lib/walker') (#47)
  • Lexer
    • Added default keyword to the list of invalid values for <custom-ident> (since it reversed per spec)
  • Convertors (toPlainObject() and fromPlainObject()) moved to lib/convertor (entry point is require('css-tree/lib/convertor'))
lahmatiy
published 1.0.0-alpha21 •

Changelog

Source

1.0.0-alpha21 (September 5, 2017)

  • Tokenizer
    • Added Raw token type
    • Improved tokenization of url() with raw as url to be more spec complient
    • Added Tokenizer#balance array computation on token layout
    • Added Tokenizer#getRawLength() to compute a raw length with respect of block balance
    • Added Tokenizer#getTokenStart(offset) method to get token start offset by token index
    • Added idx and balance fields to each token of Tokenizer#dump() method result
  • Parser
    • Added onParseError option
    • Reworked node parsers that consume a Raw node to use a new approach. Since now a Raw node builds in parser#Raw() function only
    • Changed semantic of parser#Raw(), it takes 5 parameters now (it might to be changed in future)
    • Changed parser#tolerantParse() to pass a start token index to fallback function instead of source offset
    • Fixed AtruleExpression consuming in tolerant mode
    • Atrule handler to convert an empty AtruleExpression node into null
    • Changed AtruleExpression handler to always return a node (before it could return a null in some cases)
  • Lexer
    • Fixed comma match node for # multiplier
    • Added reference name to SyntaxReferenceError
  • Additional fixes on custom errors
  • Reduced possible corruption of base config by syntax.fork()
lahmatiy
published 1.0.0-alpha20 •

Changelog

Source

1.0.0-alpha20 (August 28, 2017)

  • Tokenizer
    • Added Atrule token type (<at-rule-token> per spec)
    • Added Function token type (<function-token> per spec)
    • Added Url token type
    • Replaced Tokenizer#getTypes() method with Tokenizer#dump() to get all tokens as an array
    • Renamed Tokenizer.TYPE.Whitespace to Tokenizer.TYPE.WhiteSpace
    • Renamed Tokenizer.findWhitespaceEnd() to Tokenizer.findWhiteSpaceEnd()
  • Parser
    • Added initial implementation of tollerant mode (turn on by passing tolerant: true option). In this mode parse errors are never occour and any invalid part of CSS turns into a Raw node. Current safe points: Atrule, AtruleExpression, Rule, Selector and Declaration. Feature is experimental and further improvements are planned.
    • Changed Atrule.expression to contain a AtruleExpression node or null only (other node types is wrapping into a AtruleExpression node)
    • Renamed AttributeSelector.operator to AttributeSelector.matcher
  • Generator
    • translate() method is now can take a function as second argument, that recieves every generated chunk. When no function is passed, default handler is used, it concats all the chunks and method returns a string.
  • Lexer
    • Used mdn/data package as source of lexer's grammar instead of local dictionaries
    • Added x unit to <resolution> generic type
    • Improved match tree:
      • Omited Group (sequences) match nodes
      • Omited empty match nodes (for terms with zero or more multipliers)
      • Added ASTNode node type to contain a reference to AST node
      • Fixed node duplication (uncompleted match were added to tree)
      • Added AST node reference in match nodes
      • Added comma match node by # multiplier
    • Grammar
      • Changed translate() function to get a handler as third argument (optional). That handler recieves result of node traslation and can be used for decoration purposes. See example
      • Added SyntaxParseError to grammar export
      • Reworked group and multipliers representation in syntax tree:
        • Replaced Sequence for Group node type (Sequence node type removed)
        • Added explicit boolean property for Group
        • Only groups can have a multiplier now (other node types is wrapping into a single term implicit group when multiplier is applied)
        • Renamed nonEmpty Group's property to disallowEmpty
        • Added optimisation for syntax tree by dropping redundant root Group when it contains a single Group term (return this Group as a result)
    • Changed lexer's match functionality
      • Changed Lexer#matchProperty() and Lexer#matchType() to return an object instead of match tree. A match tree stores in matched field when AST is matched to grammar successfully, otherwise an error in error field. The result object also has some methods to test AST node against a match tree: getTrace(), isType(), isProperty() and isKeyword()
      • Added Lexer#matchDeclaration() method
      • Removed Lexer#lastMatchError (error stores in match result object in error field)
    • Added initial implementation of search for AST segments (new lexer methods: Lexer#findValueSegments(), Lexer#findDeclarationValueSegments() and Lexer#findAllSegments)
    • Implemented SyntaxReferenceError for unknown property and type references
  • Renamed field in resulting object of property() function: variablecustom
  • Fixed issue with readonly properties (e.g. line and column) of Error and exception on attempt to write in iOS Safari
lahmatiy
published 1.0.0-alpha19 •

Changelog

Source

1.0.0-alpha19 (April 24, 2017)

  • Extended List class with new methods:
    • List#prepend(item)
    • List#prependData(data)
    • List#insertData(data)
    • List#insertList(list)
    • List#replace(item, itemOrList)
lahmatiy
published 1.0.0-alpha18 •

Changelog

Source

1.0.0-alpha18 (April 3, 2017)

  • Added atrule walk context (#39)
  • Changed a result of generate method for AnPlusB, AttributeSelector, Function, MediaFeature and Ratio (1e95877)
  • Fixed typo in List exception messages (@strarsis, #42)
  • Improved tokenizer to convert an input to a string
lahmatiy
published 1.0.0-alpha17 •

Changelog

Source

1.0.0-alpha17 (March 13, 2017)

  • Implemented new concept of syntax
    • Changed main exports to expose a default syntax
    • Defined initial CSS syntax
    • Implemented createSyntax() method to create a new syntax from scratch
    • Implemented fork() method to create a new syntax based on given via extension
  • Parser
    • Implemented mediaQueryList and mediaQuery parsing contexts
    • Implemented CDO and CDC node types
    • Implemented additional declaration property prefix hacks (# and +)
    • Added support for UTF-16LE BOM
    • Added support for @font-face at-rule
    • Added chroma() to legacy IE filter functions
    • Improved HexColor to consume hex only
    • Improved support for \0 and \9 hacks (#2)
    • Relaxed number check for Ratio terms
      • Allowed fractal values as a Ratio term
      • Disallowed zero number as a Ratio term
    • Changed important clause parsing
      • Allowed any identifier for important (to support hacks like !ie)
      • Store true for important field in case identifier equals to important and string otherwise
    • Fixed parse error formatted message rendering to take into account tabs
    • Removed exposing of Parser class
    • Removed readSelectorSequence(), readSequenceFallback() and readSelectorSequenceFallback methods
    • Used single universal sequence consumer for AtruleExpression, Selector and Value
  • Generator
    • Reworked generator to use auto-generated functions based on syntax definition (additional work to be done in next releases)
    • Implemented translateMarkup(ast, before, after) method for complex cases
    • Reworked translateWithSourceMap to be more flexible (based on translateMarkup, additional work to be done in next releases)
  • Walker
    • Reworked walker to use auto-generated function based on syntax definition (additional work to be done in next releases)
  • Lexer
    • Prepared for better extensibility (additional work to be done in next releases)
    • Implemented checkStructure(ast) method to check AST structure based on syntax definition
    • Update syntax dictionaries to latest mdn/data
      • Add missing <'offset-position'> syntax
      • Extended <position> property with -webkit-sticky (@sergejmueller, #37)
    • Improved mismatch error position
  • Implemented script (gen:syntax) to generate AST format reference page (docs/ast.md) using syntax definition
lahmatiy
published 1.0.0-alpha16 •

Changelog

Source

1.0.0-alpha16 (February 12, 2017)

  • Exposed Parser class
  • Added startOffset option to Tokenizer (constructor and setSource() method)
  • Added fallback functions for default (readSequenceFallback) and selector (readSelectorSequenceFallback) sequence readers
  • Fixed edge cases for AnPlusB
  • Fixed wrong whitespace ignoring in Selector consumer
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