Socket
Socket
Sign inDemoInstall

css-tree

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-tree - npm Package Versions

1
6

1.0.0-alpha.35

Diff

Changelog

Source

1.0.0-alpha.35 (October 7, 2019)

  • Walker
    • Changed implementation to avoid runtime compilation due to CSP issues (see #91, #109)
    • Added find(), findLast() and findAll() methods (e.g. csstree.find(ast, node => node.type === 'ClassSelector'))
lahmatiy
published 1.0.0-alpha.34 •

Changelog

Source

1.0.0-alpha.34 (July 27, 2019)

  • Tokenizer
    • Added isBOM() function
    • Added charCodeCategory() function
    • Removed firstCharOffset() function (use isBOM() instead)
    • Removed CHARCODE dictionary
    • Removed INPUT_STREAM_CODE* dictionaries
  • Lexer
    • Allowed comments in matching value (just ignore them like whitespaces)
    • Increased iteration count in value matching from 10k up to 15k
    • Fixed missed debugger (#104)
lahmatiy
published 1.0.0-alpha.33 •

Changelog

Source

1.0.0-alpha.33 (July 11, 2019)

  • Lexer
    • Fixed low priority productions matching by changing an approach for robust one (#103)
lahmatiy
published 1.0.0-alpha.32 •

Changelog

Source

1.0.0-alpha.32 (July 11, 2019)

  • Lexer
    • Fixed low priority productions matching in long ||- and &&- groups (#103)
lahmatiy
published 1.0.0-alpha.31 •

Changelog

Source

1.0.0-alpha.31 (July 11, 2019)

  • Bumped mdn/data to 2.0.4 (#99)
  • Lexer
    • Added bracketed range notation support and related refactoring
    • Removed <number-zero-one>, <number-one-or-greater> and <positive-integer> from generic types. In fact, types moved to patch, because those types can be expressed in a regular grammar due to bracketed range notation implemented
    • Added support for multiple token string matching
    • Improved <custom-ident> production matching to claim the keyword only if no other unfulfilled production can claim it (#101)
    • Improved <length> production matching to claim "unitless zero" only if no other unfulfilled production can claim it
    • Changed lexer's constructor to prevent generic types override when used
    • Fixed large ||- and &&-group matching, matching continues from the beginning on term match (#85)
    • Fixed checking that value has var() occurrences when value is a string (such values can't be matched on syntax currently and fail with specific error that can be used for ignorance in validation tools)
    • Fixed <declaration-value> and <any-value> matching when a value contains a function, parentheses or braces
lahmatiy
published 1.0.0-alpha.30 •

Changelog

Source

1.0.0-alpha.30 (July 3, 2019)

  • Bumped mdn/data to ~2.0.3
    • Removed type removals from mdn/data due to lack of some generic types and specific lexer restictions (since lexer was reworked, see below)
    • Reduced and updated patches
  • Tokenizer
    • Reworked tokenizer itself to compliment CSS Syntax Module Level 3
    • Tokenizer class splitted into several abstractions:
      • Added TokenStream class
      • Added OffsetToLocation class
      • Added tokenize() function that creates TokenStream instance for given string or updates a TokenStream instance passed as second parameter
      • Removed Tokenizer class
    • Removed Raw token type
    • Renamed Identifier token type to Ident
    • Added token types: Hash, BadString, BadUrl, Delim, Percentage, Dimension, Colon, Semicolon, Comma, LeftSquareBracket, RightSquareBracket, LeftParenthesis, RightParenthesis, LeftCurlyBracket, RightCurlyBracket
    • Replaced Punctuator with Delim token type, that excludes specific characters with its own token type like Colon, Semicolon etc
    • Removed findCommentEnd, findStringEnd, findDecimalNumberEnd, findNumberEnd, findEscapeEnd, findIdentifierEnd and findUrlRawEnd helper function
    • Removed SYMBOL_TYPE, PUNCTUATION and STOP_URL_RAW dictionaries
    • Added isDigit, isHexDigit, isUppercaseLetter, isLowercaseLetter, isLetter, isNonAscii, isNameStart, isName, isNonPrintable, isNewline, isWhiteSpace, isValidEscape, isIdentifierStart, isNumberStart, consumeEscaped, consumeName, consumeNumber and consumeBadUrlRemnants helper functions
  • Parser
    • Changed parsing algorithms to work with new token type set
    • Changed HexColor consumption in way to relax checking a value, i.e. now value is a sequence of one or more name chars
    • Added & as a property hack
    • Relaxed var() parsing to only check that a first arguments is an identifier (not a custom property name as before)
  • Lexer
    • Reworked syntax matching to relay on token set only (having AST is optional now)
    • Extended Lexer#match(), Lexer#matchType() and Lexer#matchProperty() methods to take a string as value, beside AST as a value
    • Extended Lexer#match() method to take a string as a syntax, beside of syntax descriptor
    • Reworked generic types:
      • Removed <attr()>, <url> (moved to patch) and <progid> types
      • Added types:
        • Related to token types: <ident-token>, <function-token>, <at-keyword-token>, <hash-token>, <string-token>, <bad-string-token>, <url-token>, <bad-url-token>, <delim-token>, <number-token>, <percentage-token>, <dimension-token>, <whitespace-token>, <CDO-token>, <CDC-token>, <colon-token>, <semicolon-token>, <comma-token>, <[-token>, <]-token>, <(-token>, <)-token>, <{-token> and <}-token>
        • Complex types: <an-plus-b>, <urange>, <custom-property-name>, <declaration-value>, <any-value> and <zero>
      • Renamed <unicode-range> to <urange> as per spec
      • Renamed <expression> (IE legacy extension) to <-ms-legacy-expression> and may to be removed in next releases
lahmatiy
published 1.0.0-alpha.29 •

Changelog

Source

1.0.0-alpha.29 (May 30, 2018)

  • Lexer
    • Syntax matching was completely reworked. Now it's token-based and uses state machine. Public API has not changed. However, some internal data structures have changed. Most significal change in syntax match result tree structure, it's became token-based instead of node-based.
    • Grammar
      • Changed grammar tree format:
        • Added Token node type to represent a single code point (<delim-token>)
        • Added Multiplier that wraps a single node (term property)
        • Added AtKeyword to represent <at-keyword-token>
        • Removed Slash and Percent node types, they are replaced for a node with Token type
        • Changed Function to represent <function-token> with no children
        • Removed multiplier property from Group
      • Changed generate() method:
        • Method takes an options as second argument now (generate(node, forceBraces, decorator) -> generate(node, options)). Two options are supported: forceBraces and decorator
        • When a second parameter is a function it treats as decorate option value, i.e. generate(node, fn) -> generate(node, { decorate: fn })
        • Decorate function invokes with additional parameter – a reference to a node
  • Tokenizer
    • Renamed Atrule const to AtKeyword
lahmatiy
published 1.0.0-alpha.28 •

Changelog

Source

1.0.0-alpha.28 (February 19, 2018)

  • Renamed lexer.grammar.translate() method into generate()
  • Fixed <'-webkit-font-smoothing'> and <'-moz-osx-font-smoothing'> syntaxes (#75)
  • Added vendor keywords for <'overflow'> property syntax (#76)
  • Pinned mdn-data to ~1.1.0 and fixed issues with some updated property syntaxes
lahmatiy
published 1.0.0-alpha.27 •

Changelog

Source

1.0.0-alpha.27 (January 14, 2018)

  • Generator
    • Changed node's generate() methods invocation, methods now take a node as a single argument and context (i.e. this) that have methods: chunk(), node() and children()
    • Renamed translate() to generate() and changed to take options argument
    • Removed translateMarkup(ast, enter, leave) method, use generate(ast, { decorator: (handlers) => { ... }}) instead
    • Removed translateWithSourceMap(ast), use generate(ast, { sourceMap: true }) instead
    • Changed to support for children as an array
  • Walker
    • Changed walk() to take an options argument instead of handler, with enter, leave, visit and reverse options (walk(ast, fn) is still works and equivalent to walk(ast, { enter: fn }))
    • Removed walkUp(ast, fn), use walk(ast, { leave: fn })
    • Removed walkRules(ast, fn), use walk(ast, { visit: 'Rule', enter: fn }) instead
    • Removed walkRulesRight(ast, fn), use walk(ast, { visit: 'Rule', reverse: true, enter: fn }) instead
    • Removed walkDeclarations(ast, fn), use walk(ast, { visit: 'Declaration', enter: fn }) instead
    • Changed to support for children as array in most cases (reverse: true will fail on arrays since they have no forEachRight() method)
  • Misc
    • List
      • Added List#forEach() method
      • Added List#forEachRight() method
      • Added List#filter() method
      • Changed List#map() method to return a List instance instead of Array
      • Added List#push() method, similar to List#appendData() but returns nothing
      • Added List#pop() method
      • Added List#unshift() method, similar to List#prependData() but returns nothing
      • Added List#shift() method
      • Added List#prependList() method
      • Changed List#insert(), List#insertData(), List#appendList() and List#insertList() methods to return a list that performed an operation
    • Changed keyword() method
      • Changed name field to include a vendor prefix
      • Added basename field to contain a name without a vendor prefix
      • Added custom field that contain a true when keyword is a custom property reference
    • Changed property() method
      • Changed name field to include a vendor prefix
      • Added basename field to contain a name without any prefixes, i.e. a hack and a vendor prefix
    • Added vendorPrefix() method
    • Added isCustomProperty() method
lahmatiy
published 1.0.0-alpha.26 •

Changelog

Source

1.0.0-alpha.26 (November 9, 2017)

  • Tokenizer
    • Added Tokenizer#isBalanceEdge() method
    • Removed Tokenizer.endsWith() method
  • Parser
    • Made the parser tolerant to errors by default
    • Removed tolerant parser option (no parsing modes anymore)
    • Removed property parser option (a value parsing does not depend on property name anymore)
    • Canceled error for a handing semicolon in a block
    • Canceled error for unclosed Brackets, Function and Parentheses when EOF is reached
    • Fixed error when prelude ends with a comment for at-rules with custom prelude consumer
    • Relaxed at-rule parsing:
      • Canceled error when EOF is reached after a prelude
      • Canceled error for an at-rule with custom block consumer when at-rule has no block (just don't apply consumer in that case)
      • Canceled error on at-rule parsing when it occurs outside prelude or block (at-rule is converting to Raw node)
      • Allowed for any at-rule to have a prelude and a block, even if it's invalid per at-rule syntax (the responsibility for this check is moved to lexer, since it's possible to construct a AST with such errors)
    • Made a declaration value a safe parsing point (i.e. error on value parsing lead to a value is turning into Raw node, not a declaration as before)
    • Excluded surrounding white spaces and comments from a Raw node that represents a declaration value
    • Changed Value parse handler to return a node only with type Value (previously it returned a Raw node in some cases)
    • Fixed issue with onParseError() is not invoked for errors occured on selector or declaration value parsing in some cases
    • Changed using of onParseError() to stop parsing if handler throws an exception
  • Lexer
    • Changed grammar.walk() to invoke passed handler on entering to node rather than on leaving the node
    • Improved grammar.walk() to take a walk handler pair as an object, i.e. walk(node, { enter: fn, leave: fn })
    • Changed Lexer#match*() methods to take a node of any type, but with a children field
    • Added Lexer#match(syntax, node) method
    • Fixed Lexer#matchType() method to stop return a positive result for the CSS wide keywords
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc