CSS parser with support of preprocessors

Overview

Gonzales PE @dev

NPM version Build Status AppVeyor Build Status

Gonzales PE is a CSS parser which plays nicely with preprocessors.
Currently those are supported: SCSS, Sass, LESS.
Try out Gonzales PE online: Gonzales PE Playground.

Install

(1) To install command-line tool globally:

npm install -g git://github.com/tonyganch/gonzales-pe.git#dev

(2) To install parser as a project dependency:

npm install --save git://github.com/tonyganch/gonzales-pe.git#dev

(3) If for some reason you want to build files yourself:

# Clone the repo.
git clone [email protected]:tonyganch/gonzales-pe.git
# Go to dev branch.
git checkout dev
# Install project dependencies.
npm install
# Install git hooks and build files.
npm run init

API

Basically there are a few things you can do:

  1. parse css string and get a parse tree in return;
  2. modify tree nodes;
  3. remove tree nodes;
  4. add new nodes to the tree;
  5. convert modified tree back to a string.

The different type of tree nodes can be found in docs/node-types.md.

In examples below I assume that gonzales is a parser module and parseTree is some parsed css:

let gonzales = require('gonzales-pe');
let parseTree = gonzales.parse(css);

gonzales.createNode(options)

Description

Creates a new node. Useful when you need to add something to a tree.

Parameters
{Object} options Options to pass to a `Node` constructor.
Returns
{Object} A new node.
Examples
let css = 'a {color: tomato}';
let parseTree = gonzales.parse(css);
let node = gonzales.createNode({ type: 'animal', content: 'panda' });
parseTree.content.push(node);

gonzales.parse(css[, options])

Description

Parses a css string.

Parameters
{string} css A string to parse.
{Object=} options Optional. Additional options:
  • {string} syntax — any of the following: css, less, sass, scss. Default one is css.
  • {string} context — root node's type. For a list of available values see "Node types". Default one is stylesheet.
  • {number} tabSize — size of a tab character in spaces. Default one is 1.
Returns
{Object} Parse tree.
Examples
let css = 'a {color: tomato}';
let parseTree = gonzales.parse(css);
let less = 'a {$color: tomato}';
let parseTree = gonzales.parse(less, {syntax: 'less'});
let less = '$color: tomato';
let parseTree = gonzales.parse(less, {syntax: 'less', rule: 'declaration'});

parseTree.contains(type)

Description

Checks whether there is a child node of given type.

Parameters
{string} type Node type we're looking for. For a list of available values see "Node types".
Returns
{boolean} true if a tree contains a child node of a given type, false otherwise.
Examples
if (parseTree.contains('space')) {
  doSomething();
}

parseTree.content

Returns
{string|Array} Node's content (child nodes or a string).

parseTree.eachFor([type, ]callback)

Description

Calls a function for every child node in tree. If type parameter is passed, calls a function only for child nodes of a given type. The main difference from parseTree.forEach() is that this method loops through node list from the end to beginning.

Parameters
{string=} type Optional. A node type by which to filter child nodes before applying a callback function. For a list of available values see "Node types".
{Function} callback Function to call for every child node. Accepts following parameters:
  • {Object} — a child node;
  • {number} — index of the child node in node list;
  • {Object} — parent node (equals to parseTree).
Examples
parseTree.eachFor(function(childNode) {
  doSomething(childNode);
});
// Remove all child spaces.
parseTree.eachFor('space', function(spaceNode, i) {
  parseTree.removeChild(i);
});

parseTree.end

Returns
{Object} End position of the node. Contains following info:
  • {number} line — last symbol's line number (1-based index);
  • {number} column — last symbol's column number (1-based index).

parseTree.first([type])

Description

Gets the first child node. If type parameter is passed, gets the first child node of a given type. If no node has been found, returns null.

Parameters
{string=} type Optional. Node type to look for. For a list of available values see "Node types".
Returns
{?Object} A node.
Examples
let node = parseTree.first();
node.content = 'panda';
let node = parseTree.first('multilineComment');
node.content = 'panda';

parseTree.forEach([type, ]callback)

Description

Calls a function for every child node in tree. If type parameter is passed, calls a function only for child nodes of a given type. The main difference from parseTree.eachFor() is that this method loops through node list from the beginnig to end.

Parameters
{string=} type Optional. A node type by which to filter child nodes before applying a callback function. For a list of available values see "Node types".
{Function} callback Function to call for every child node. Accepts following parameters:
  • {Object} — a child node;
  • {number} — index of the child node in node list;
  • {Object} — parent node (equals to parseTree).
Examples
parseTree.forEach(function(childNode) {
  doSomething();
});
parseTree.forEach('space', function(spaceNode) {
  doSomething();
});

parseTree.get(index)

Description

Gets nth child of the parseTree. If no node has been found, returns null.

Parameters
{number} index Index number of node which we're looking for.
Returns
{?Object} A node.
Examples
var node = parseTree.get(2);
doSomething(node);

parseTree.insert(index, node)

Description

Inserts a node to a given position in parseTree.

Parameters
{number} index Index of position where to insert the node.
{Object} node A node to insert.
Examples
let node = gonzales.createNode({type: 'animal', content: 'panda'});
parseTree.insert(2, node);

parseTree.is(type)

Description

Checks whether the node is of given type.

Parameters
{string} type A node type against which to check type of parseTree. For a list of available values see "Node types".
Returns
{boolean} true if types are equal, false otherwise.
Examples
if (node.is('space')) {
  node.content = '';
}

parseTree.last(type)

Gets the last child node. If type parameter is passed, gets the last child node of a given type. If no node has been found, returns null.

Parameters
{string=} type Optional. Node type to look for. For a list of available values see "Node types".
Returns
{?Object} A node.
Examples
let node = parseTree.last();
node.content = 'panda';
let node = parseTree.last('multilineComment');
node.content = 'panda';

parseTree.length

Returns
{number} Number of child nodes.

parseTree.removeChild(index)

Description

Removes a child node at a given position.

Parameters
{number} index Index of a child node we need to remove.
Returns
{Object} Removed node.
##### Examples
// Swap nodes.
var node = parseTree.removeChild(1);
parseTree.insert(0, node);

parseTree.start

Returns
{Object} Start position of the node. Contains following info:
  • {number} line — first symbol's line number (1-based index);
  • {number} column — first symbol's column number (1-based index).

parseTree.syntax

Returns
{string} Syntax of original parsed string.

parseTree.toJson()

Description

Converts parse tree to JSON. Useful for printing.

Returns
{Object} Parse tree in JSON

parseTree.toString()

Description

Converts parse tree back to string according to original syntax.

Returns
{string} A compiled string.
Examples
let css = parseTree.toString();

parseTree.traverse(callback)

Description

Calls the function for every node in a tree including parseTree itself.

Parameters
{Function} callback Function to apply to every node. Accepts following parameters:
  • {Object} — a node to which we apply callback;
  • {number} — node's index number inside its parent;
  • {Object} — a node's parent;
  • {number} — node's nesting level relative to its parent.
Examples
parseTree.traverse(function(node, index, parent) {
  if (node.is('multilineComment')) {
    parent.removeChild(index);
  } else if (node.is('space')) {
    node.content = ' ';
  }
});

parseTree.traverseByType(type, callback)

Description

This method should be called for a root node, because calling it for a child will be more time consuming.
Calls the function for every node of a given type. This means not just child nodes, but grandchilds and so on.

Parameters
{string} type Node type. For a list of available values please see "Node types".
{Function} callback Function to apply to every node of a given type. Accepts following parameters:
  • {Object} — a node to which we apply callback;
  • {number} — node's index number inside its parent;
  • {Object} — a node's parent.
Examples
// Remove all comments.
parseTree.traverseByType('multilineComment', function(node, index, parent) {
  parent.removeChild(index);
});

parseTree.traverseByTypes(types, callback)

Description

This method should be called for a root node, because calling it for a child will be more time consuming.
Calls the function for every node of given types. This means not just child nodes, but grandchilds and so on.

Parameters
{Array.string} types List of node types. For a list of available values please see "Node types".
{Function} callback Function to apply to every node of given types. Accepts following parameters:
  • {Object} — a node to which we apply callback;
  • {number} — node's index number inside its parent;
  • {Object} — a node's parent.
Examples
// Remove all comments and spaces.
let types = ['multilineComment', 'space'];
parseTree.traverseByTypes(types, function(node, index, parent) {
  parent.removeChild(index);
});

parseTree.type

Returns
{string} Node type. For a list of available values see "Node types".

Test

To run tests:

npm test

This command will build library files from sources and run tests on all files in syntax directories.

Every test has 3 files: source stylesheet, expected parse tree and expected string compiled back from parse tree to css.

If some tests fail, you can find information in test logs:

  • log/test.log contains all information from stdout;
  • log/expected.txt contains only expected text;
  • log/result.txt contains only result text.

The last two are made for your convenience: you can use any diff app to see the defference between them.

If you want to test one specific string or get a general idea of how Gonzales works, you can use test/ast.js file.
Simply change the first two strings (css and syntax vars) and run:

node test/single-test.js

Report

If you find a bug or want to add a feature, welcome to Issues.

If you are shy but have a question, feel free to drop me a line.

Comments
  • [SCSS] 3.0.0-beta issues

    [SCSS] 3.0.0-beta issues

    Hi,

    I have the following code that is throwing the parser with "Warning: Parsing error at FILENAME: Please check validity of the block starting from line …"

    Here's the beginning of the file, and the line that is mentioned in the error message is marked with ***:

    .layout-1 {
      @include breakpoint($breakpoint-large) {
        .section-header {
    ***      &.img { ***
            .content {
              @include span(first 15 of 24);
              // ensure text doesn't come too close to the image
              @if supports-browser('ie7') {
                .ie7 & {
                  @include span(first 14 of 24); // Less the post 1
                }
              }
              @include post(1);
              // leave a 3 column gap
            }
    
          }
        }
      }
    }
    

    If I remove the ampersand before .img, it gets further but dies on the next line with an ampersand ( .ie7 &). Any idea what's going on here? The files all compile fine via ruby-based sass.

    type: bug 
    opened by cgtm 22
  • Install on mac broken since 3.2.3

    Install on mac broken since 3.2.3

    npm ERR! Darwin 15.2.0
    npm ERR! argv "/Users/user/.nvm/versions/node/v4.2.6/bin/node" "/Users/user/.nvm/versions/node/v4.2.6/bin/npm" "install"
    npm ERR! node v4.2.6
    npm ERR! npm  v3.7.1
    npm ERR! file sh
    npm ERR! code ELIFECYCLE
    npm ERR! errno ENOENT
    npm ERR! syscall spawn
    
    npm ERR! [email protected] postinstall: `./scripts/postinstall.sh`
    npm ERR! spawn ENOENT
    npm ERR! 
    npm ERR! Failed at the [email protected] postinstall script './scripts/postinstall.sh'.
    
    opened by danez 14
  • Add column numbers to tokens

    Add column numbers to tokens

    Added column numbers to tokens and fixed line number counting for multiline comments in some syntaxes. Partially fixes https://github.com/tonyganch/gonzales-pe/issues/19, need to pass column numbers from rules to srcToAST. Also need to cover this with unit-tests. Need your comments, @tonyganch.

    opened by vecmezoni 14
  • parse error with interpolation

    parse error with interpolation

    Hi @tonyganch

    Ive been running through all the reported issues on sass-lint with regards to parse errors, here's one that is still throwing a parse error in gonzales-pe 3.2.1

    left: calc(50% - #{$eb-hint-width / 2});
    

    This parses fine however

    left: calc(50% - #{$eb-hint-width});
    

    First reported here

    opened by DanPurdy 13
  • [SCSS] Fixes issues with URIs when handling interp and unary

    [SCSS] Fixes issues with URIs when handling interp and unary

    This PR rewrites the way we handle URI nodes by allowing either a raw uri or non-raw uri that can be made up of multiple nodes (interps, numbers, idents, unary etc)

    It solves issues highlighted in #85

    Only implement in SCSS but if approved I'll add it into Sass too.

    opened by bgriffith 11
  • False error on placeholder function

    False error on placeholder function

    This one is a major blocker for us: gozales-pe throws an error when it encounters LESS placeholder functions. These are perfectly valid and pass linting with lessc --lint.

    Test Script:

    var gonzales = require('gonzales-pe');
    var less = '.transition(...){}';
    var result = gonzales.parse(less, {
        syntax: 'less'
    });
    console.log(result);
    

    Output:

    → node lesstest.js                  
    
    /.../node_modules/gonzales-pe/lib/parse.js:5
    = parse(tokens,rule,needInfo);}catch(e) {if(!e.syntax)throw e;throw new Parsin
                                                                        ^
    Parsing error: Please check validity of the block starting from line #1
    

    When var less = '.transition(...){}'; is changed to var less = '.transition(){}'; gonzales-pe allows it to pass. That should not be required, as the former value is completely valid.

    type: bug syntax: less 
    opened by shellscape 11
  • Spaces before and after variable throws validity error

    Spaces before and after variable throws validity error

    Error message given -> Please check validity of the block starting from line #31

    Example: This doesn' work src: url($themepath_base + 'fonts/Interstate-ExtraLightItalic.eot'); This works (notice the deleted spaces between the variable) src: url($themepath_base+'fonts/Interstate-ExtraLightItalic.eot');

    syntax: scss status: has pr open 
    opened by sarabarrerariano 10
  • Ampersand SCSS parse error

    Ampersand SCSS parse error

    In SCSS/Sass the & be used as a prefix to quickly form BEM style selectors.

    Using the ampersand like this was ok in 3.0.0-31 but in 3.0.3 it's causing a parse issue.

    .block {
      content: 'this is a block';
    
      &__element {
        content: 'foo';
    
        &--modifier {
          content: 'bar';
        }
      }
    }
    

    Results in 3 selectors; .block, .block__element and .block__element--modifier.

    type: bug syntax: sass syntax: scss syntax: less 
    opened by bgriffith 10
  • Brace Node Type

    Brace Node Type

    I may have missed it but I'm looking for a brace node type for my Sass Lint project in order to provide linting around it. Is there one that I've missed? If not, may I request one be added?

    Thank you!

    opened by Snugug 10
  • Gonzales PE 4.2.3 Fails Parsing SCSS Custom CSS Variable With #{} Interpolation

    Gonzales PE 4.2.3 Fails Parsing SCSS Custom CSS Variable With #{} Interpolation

    I am using Sass Extract which uses Gonzales PE ^4.2.2. I am on Gonzales PE 4.2.3.

    I'm trying to parse the Bootstrap scss to grab variables using Sass Extract. However it fails on one file, _root.scss.

    Here is the command I'm running in the Node repl

    > sassExtract.renderSync({file: './node_modules/bootstrap/scss/bootstrap.scss'})
    Thrown: Parsing error: Please check validity of the block starting from line #4
    
    2 |   // Custom variable values only support SassScript inside `#{}`.
    3 |   @each $color, $value in $colors {
    4*|     --#{$color}: #{$value};
    5 |   }
    
    Syntax: scss
    Gonzales PE version: 4.2.3
    

    It fails on line 4:

        --#{$color}: #{$value};
    

    _root.scss is the only file it fails on. If I remove the import on this line, it works.

    If I move the string inside the interpolation, it also works:

        #{--$color}: #{$value};
    

    I know custom css properties are supported. But I don't know about custom css properties with interpolation. A workaround for now is to just skip this file since I'm only trying to grab the variables.

    type: bug 
    opened by dosentmatter 9
  • [SCSS | Sass] Fix hyphens in interpolated indents

    [SCSS | Sass] Fix hyphens in interpolated indents

    Fixes parse issue when parser comes across hyphens in interpolated indents i.e.

    .-#{$i}
    .-#{$s1}.-#{$s2}
    .-#{$s1}-#{$s2}
    

    Also removes some unused variables (interpolation array, isInt bool)

    re https://github.com/sasstools/sass-lint/issues/644

    pr status: waiting for tonyganch 
    opened by bgriffith 9
  • Bump decode-uri-component from 0.2.0 to 0.2.2

    Bump decode-uri-component from 0.2.0 to 0.2.2

    Bumps decode-uri-component from 0.2.0 to 0.2.2.

    Release notes

    Sourced from decode-uri-component's releases.

    v0.2.2

    • Prevent overwriting previously decoded tokens 980e0bf

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.1...v0.2.2

    v0.2.1

    • Switch to GitHub workflows 76abc93
    • Fix issue where decode throws - fixes #6 746ca5d
    • Update license (#1) 486d7e2
    • Tidelift tasks a650457
    • Meta tweaks 66e1c28

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.1

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump minimatch, jscs and mocha

    Bump minimatch, jscs and mocha

    Bumps minimatch to 3.0.4 and updates ancestor dependencies minimatch, jscs and mocha. These dependencies need to be updated together.

    Updates minimatch from 0.2.14 to 3.0.4

    Commits
    Maintainer changes

    This version was pushed to npm by isaacs, a new releaser for minimatch since your current version.


    Updates jscs from 2.1.0 to 2.11.0

    Release notes

    Sourced from jscs's releases.

    2.11.0

    Version 2.11.0 (2016-03-01):

    Spring release! Yeah, yeah, technically spring only comes in middle of the March (you nerds, you), but we're coming to you a bit earlier!

    Anyways, there are three new rules, a couple of changes for the airbnb preset and important fixes for disallowSpacesInsideTemplateStringPlaceholders and validateQuoteMarks (for all you ES7 lovers).

    New Rules

    requireSpaceBeforeDestructuredValues by Maks Sadowsky

    Enforces colon spacing after destructuring assignment i.e. requireSpaceBeforeObjectValues but for destructuring.

    // good
    const { String: EmberString } = Ember;
    

    // bad const { String:EmberString } = Ember;

    disallowArrayDestructuringReturn by Maks Sadowsky

    Enforces the 5:3 verse of airbnb code style, which prohibits use of array destructuring for thy CallExpressions.

    // God is on your side
    const { left, right } = processInput(input);
    

    // Devil is on your shoulder! const [left, __, top] = processInput(input);

    requireNewlineBeforeSingleStatementsInIf by Brian Schemp

    Enforces using newlines in your parenthesesless code.

    
    // Cool stairs brah
    if (x)
       doX();
    else
       doY();
    

    // Just how could you have "X" and "Y"'s on the same line?! if (x) doX(); else doY();

    ... (truncated)

    Changelog

    Sourced from jscs's changelog.

    Version 2.11.0 (2016-03-01):

    Spring release! Yeah, yeah, technically spring only comes in middle of the March (you nerds, you), but we're coming to you a bit earlier!

    Anyways, there are three new rules, a couple of changes for the airbnb preset and important fixes for disallowSpacesInsideTemplateStringPlaceholders and validateQuoteMarks (for all you ES7 lovers).

    New Rules

    requireSpaceBeforeDestructuredValues by Maks Sadowsky

    Enforces colon spacing after destructuring assignment i.e. requireSpaceBeforeObjectValues but for destructuring.

    // good
    const { String: EmberString } = Ember;
    

    // bad const { String:EmberString } = Ember;

    disallowArrayDestructuringReturn by Maks Sadowsky

    Enforces the 5:3 verse of airbnb code style, which prohibits use of array destructuring for thy CallExpressions.

    // God is on your side
    const { left, right } = processInput(input);
    

    // Devil is on your shoulder! const [left, __, top] = processInput(input);

    requireNewlineBeforeSingleStatementsInIf by Brian Schemp

    Enforces using newlines in your parenthesesless code.

    
    // Cool stairs brah
    if (x)
       doX();
    else
       doY();
    

    // Just how could you have "X" and "Y"'s on the same line?! if (x) doX(); else doY();

    Presets

    ... (truncated)

    Commits
    • 8d25f6d 2.11.0
    • d85701c Misc: add 2.11.0 changelog
    • d750790 Docs: correct docs requireCapitalizedConstructorsNew rule
    • f0b859b Preset: add requireshorthandarrowfunctions rule to airbnb preset
    • 4b97b03 disallowArrayDestructuringReturn: adjust to 2.x
    • 3b1fc42 Preset: add disallowArrayDestructuringReturn in airbnb preset
    • 8500623 New rule: disallowArrayDestructuringReturn
    • d760044 Misc: fix dynamic test requires
    • 60caf4f Preset: ease up on requireCamelCaseOrUpperCaseIdentifiers in airbnb
    • ce34c05 requireNewlineBeforeSingleStatementsInIf: make lint happy
    • Additional commits viewable in compare view

    Updates mocha from 2.2.5 to 10.1.0

    Release notes

    Sourced from mocha's releases.

    v10.1.0

    10.1.0 / 2022-10-16

    :tada: Enhancements

    :nut_and_bolt: Other

    v10.0.0

    10.0.0 / 2022-05-01

    :boom: Breaking Changes

    :nut_and_bolt: Other

    Also thanks to @​ea2305 and @​SukkaW for improvements to our documentation.

    v9.2.2

    9.2.2 / 2022-03-11

    Please also note our announcements.

    :bug: Fixes

    ... (truncated)

    Changelog

    Sourced from mocha's changelog.

    10.1.0 / 2022-10-16

    :tada: Enhancements

    :nut_and_bolt: Other

    10.0.0 / 2022-05-01

    :boom: Breaking Changes

    :nut_and_bolt: Other

    Also thanks to @​ea2305 and @​SukkaW for improvements to our documentation.

    9.2.2 / 2022-03-11

    :bug: Fixes

    :nut_and_bolt: Other

    ... (truncated)

    Commits
    • 5f96d51 build(v10.1.0): release
    • ed74f16 build(v10.1.0): update CHANGELOG
    • 51d4746 chore(devDeps): update 'ESLint' to v8 (#4926)
    • 4e06a6f fix(browser): increase contrast for replay buttons (#4912)
    • 41567df Support prefers-color-scheme: dark (#4896)
    • 61b4b92 fix the regular expression for function clean in utils.js (#4770)
    • 77c18d2 chore: use standard 'Promise.allSettled' instead of polyfill (#4905)
    • 84b2f84 chore(ci): upgrade GH actions to latest versions (#4899)
    • 023f548 build(v10.0.0): release
    • 62b1566 build(v10.0.0): update CHANGELOG
    • Additional commits viewable in compare view
    Maintainer changes

    This version was pushed to npm by juergba, a new releaser for mocha since your current version.


    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Prototype pollution in minimist

    Prototype pollution in minimist

    We are getting dependabot alert on version (4.2.3, but does not seemed to be patched in 4.2.4) about minimist.

    Could you patch to include Dependabot recommendation please?

    Affected versions of minimist are vulnerable to prototype pollution. Arguments are not properly sanitized, allowing an attacker to modify the prototype of Object, causing the addition or modification of an existing property that will exist on all objects. Parsing the argument --__proto__.y=Polluted adds a y property with value Polluted to all objects. The argument --__proto__=Polluted raises and uncaught error and crashes the application. This is exploitable if attackers have control over the arguments being passed to minimist.

    Recommendation

    Upgrade to versions 0.2.1, 1.2.3 or later.

    opened by andreaskoscinski 0
  • Bump minimist from 1.2.5 to 1.2.6

    Bump minimist from 1.2.5 to 1.2.6

    Bumps minimist from 1.2.5 to 1.2.6.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Error The unauthenticated git protocol on port 9418 is no longer supported.

    Error The unauthenticated git protocol on port 9418 is no longer supported.

    npm ERR! Error while executing: npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t git://github.com/tonyganch/gonzales-pe.git npm ERR! npm ERR! fatal: remote error: npm ERR! The unauthenticated git protocol on port 9418 is no longer supported. npm ERR! Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information. npm ERR! npm ERR! exited with error code: 128

    opened by agenka 0
Releases(v4.2.4)
  • v4.2.4(Mar 22, 2019)

  • v4.2.0(Aug 29, 2017)

    • Add support for custom property syntax in CSS, Sass and SCSS.
    • Add support for deep combinator syntax in CSS, LESS, Sass and SCSS.
    • Add support for alternative descendant >> syntax in CSS, LESS, Sass and SCSS.
    • Add support for ::slotted() syntax in CSS, LESS, Sass and SCSS.
    • Fixed parsing of non-lowercase keyframes at-rule in CSS, LESS, Sass and SCSS.
    • Fixed parsing of multiline selectors within keyframes in Sass.
    • Fixed parsing of !important within maps in Sass and SCSS.
    • Fixed parsing of ... following a function in Sass and SCSS.
    Source code(tar.gz)
    Source code(zip)
  • v3.4.6(Oct 22, 2016)

  • v3.4.0(Jul 27, 2016)

    • Added unicode-range and urange node types in CSS, Less, Sass and SCSS.
    • Fixed parsing of trailing interpolation in compound selector in Sass and SCSS.
    • Fixed parsing of hyphens after interpolation with parentSelectors in Sass and SCSS.
    • Added ESLint and moved linters to a separate script.
    • Fixed incorrect dimension wrap of unicode-ranges in CSS, Sass and SCSS.
    • Fixed parsing of hyphens in interpolated idents in Sass and SCSS.
    • Added compilation of JS using Google Closure.
    Source code(tar.gz)
    Source code(zip)
    gonzales.js(160.92 KB)
  • v3.3.4(May 18, 2016)

  • v3.3.3(May 18, 2016)

  • v3.3.2(May 18, 2016)

    • Added AppVeyor badge.
    • Fixed build file to glue multiple syntaxes into one file.
    • Fixed parsing of functions inside urls in Sass.
    • Fixed parsing of mulitple keyframe selectors in CSS, Sass and SCSS.
    • Fixed parsing of parent selector as property in Sass and SCSS.
    • Fixed parsing of parent selector inside interpolations in Sass and SCSS.
    Source code(tar.gz)
    Source code(zip)
  • v3.3.1(Apr 28, 2016)

  • v3.2.7(Apr 28, 2016)

    • Fixed typos and example in documentation.
    • Fixed parsing of functions inside urls in SCSS.
    • Fixed parsing of selectors starting with combinators in Sass, SCSS and Less.
    • Fixed incorrect CRLF line numbers.
    • Fixed parsing of extends that sometimes were incorrectly parsed as atrules.
    Source code(tar.gz)
    Source code(zip)
  • v3.2.6(Apr 28, 2016)

  • v3.2.5(Apr 28, 2016)

  • v3.2.4(Apr 28, 2016)

  • v3.2.3(Apr 28, 2016)

    • Modified npm test to remove .DS_Store files before running tests.
    • Updated Travis config to use [email protected].
    • Updated Travis config to include compiler info.
    • Made it possible to build files if module is installed from github.
    • Fixed parsing of interpolation content in Sass and SCSS.
    • Fixed parsing of interpolation as part of parent selector extension in Sass and SCSS.
    • Fixed issue with keyframeSelector in includes in SCSS.
    Source code(tar.gz)
    Source code(zip)
  • v3.2.2(Apr 28, 2016)

  • v3.2.1(Oct 19, 2015)

    Parsing rules

    • Fixed the issue when selectors inside extends were not wrapped in selector nodes in Sass and SCSS.
    • Fixed parsing of multiple selectors in extends in Sass and SCSS.
    Source code(tar.gz)
    Source code(zip)
  • v3.2.0(Oct 19, 2015)

    Node types

    • Added new node type: parentSelectorExtension.

    Parsing rules

    • Fixed parsing of parent selectors with extensions, like &__element or &--modifier.
    Source code(tar.gz)
    Source code(zip)
  • v3.1.1(Oct 19, 2015)

  • v3.1.0(Oct 18, 2015)

    CLI

    • Fixed passing a --context argument.
    • Fixed printing of a simplified tree.

    Parsing rules

    • Added new node type: keyframesSelector.
    • Fixed parsing of keyframes in all syntaxes.
    Source code(tar.gz)
    Source code(zip)
  • v3.0.3(Oct 18, 2015)

  • v3.0.2(Oct 18, 2015)

  • v3.0.1(Oct 18, 2015)

  • v3.0.0(Oct 18, 2015)

    CLI

    • Made cli process stdin only if - argument is passed.
    • Added help message.

    API

    • Renamed parseTree.remove to parseTree.removeChild().
    • Unwraped callback parameters for traverse... methods.
    • Made first(), last() and get() methods return null if no child nodes were found.
    • Made node.length return a number of child nodes.
    • Renamed rule to context.
    • Made parseTree.removeChild() return a removed node.
    • Added traverseBy... methods to all nodes, not only root ones.
    • Added support for specifying a tab size in spaces.

    Parsing rules

    • Fixed parsing of single-line comments after url token.
    • Fixed parsing of interpolations inside id selectors in Less.
    • Fixed parsing of selectors according to spec.
    • Fixed parsing of placeholders as selectors in SCSS.

    Misc

    • Added Travis badge to Readme page.
    • Added init script to build sources.
    • Added commit message template.
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0-beta(Oct 18, 2015)

    CLI

    • Added --simple flag for printing a simplified tree structure.
    • CLI now prints parse tree to stdout.

    API

    • Parse tree is now represented as objects, not arrays.
    • Renamed gonzales.srcToAST() to gonzales.parse(). See Readme.
    • Renamed gonzales.astToSrc() to parseTree.toString(). See Readme.
    • Renamed gonzales.astToString() to parseTree.toJson(). See Readme.
    • Added information about column number to nodes.
    • Added information about end position to nodes.
    • Made empty strings to be parsed as empty nodes.

    Node types

    • In Sass renamed interpolatedVariable to interpolation.
    • Separated include and extend nodes.
    • Replaced filter with declaration.
    • Replaced braces with brackets and parentheses.
    • Replaced atrulers with block.
    • Renamed nthSelector to pseudoClass.
    • Renamed atrules, atruler and atruleb to atrule.
    • Renamed functionBody to arguments.
    • Renamed functionExpression to expression.
    • Renamed attrib to attributeSelector.
    • Renamed attrselector to attributeMatch.
    • Renamed commentSL to singlelineComment.
    • Renamed commentML to multilineComment.
    • Renamed declDelim to declarationDelimiter.
    • Renamed delim to delimiter.
    • Renamed propertyDelim to propertyDelimiter.
    • Renamed pseudoc to pseudoClass.
    • Renamed pseudoe to pseudoElement.
    • Renamed s to space.
    • Renamed shash to color.
    • Renamed vhash to id.
    • Removed atrulerq, unary and unknown.
    • Added attributeFlags.
    • Added attributeName.
    • Added attributeValue.
    • Added conditionalStatement.
    • Added namePrefix.
    • Added namespacePrefix.
    • Added namespaceSeparator.
    • Added typeSelector.

    Parsing rules

    • Spaces that separate two nodes are now put between those nodes in parse tree.
    • Added support for extend nodes in Less.
    • Added support for equality and inequality signs in Sass and SCSS.
    • Added support for /deep/ combinator.
    • Added support for !optional and !global in Sass and SCSS.
    • Fixed parsing of interpolations in Sass and SCSS.
    • Fixed parsing of arguments in Sass, SCSS and Less.
    • Fixed parsing of declaration delimiters in Sass.
    • Fixed the issue when pseudo-classes were parsed like declarations.
    • Fixed parsing of selectors on multiple lines in Sass.
    • Fixed parsing of percent sign as operator in SCSS.
    • Fixed parsing of pseudo-elements as selectors in Sass.

    Misc

    • Added Babel to build source files.
    • Used mocha for tests.
    • Added helper scripts.
    • Added Travis config.
    • Improved tests structure.
    • Separated log and test scripts.
    • Improved error messages.
    • Removed benchmark tests.
    • Moved source files from lib to src directory.
    • Made package availbale for install from GitHub.
    Source code(tar.gz)
    Source code(zip)
  • v2.0.2(Dec 28, 2013)

  • v2.0.0(Nov 10, 2013)

    • [x] Sass support (scss and indented syntax)
    • [x] Less support
    • [x] Pass all arguments as one object
    • [x] Pass syntax name as an argument
    • [x] Update tests
    • [x] Update documentation
    Source code(tar.gz)
    Source code(zip)
Owner
Tony Ganch
Tony Ganch
A tool set for CSS including fast detailed parser, walker, generator and lexer based on W3C specs and browser implementations

CSSTree CSSTree is a tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and match

CSSTree 1.6k Dec 28, 2022
A decent CSS parser.

mensch A decent CSS parser. usage npm install mensch var mensch = require('mensch'); var ast = mensch.parse('p { color: black; }'); var css = mensch.

Brett Stimmerman 112 Sep 24, 2022
Plugin framework for CSS preprocessing in Node.js

rework CSS manipulations built on css, allowing you to automate vendor prefixing, create your own properties, inline images, anything you can imagine!

rework 2.8k Dec 6, 2022
Modern CSS to all browsers

stylecow: modern CSS for all browser Node library to fix your css code and make it compatible with all browsers. Created by Óscar Otero. License: MIT

stylecow 155 Dec 21, 2022
Json-parser - A parser for json-objects without dependencies

Json Parser This is a experimental tool that I create for educational purposes, it's based in the jq works With this tool you can parse json-like stri

Gabriel Guerra 1 Jan 3, 2022
Query for CSS brower support data, combined from caniuse and MDN, including version support started and global support percentages.

css-browser-support Query for CSS browser support data, combined from caniuse and MDN, including version support started and global support percentage

Stephanie Eckles 65 Nov 2, 2022
A WASM shell parser and formatter with bash support, based on mvdan/sh

sh-syntax A WASM shell parser and formatter with bash support, based on mvdan/sh TOC Usage Install API Changelog License Usage Install # yarn yarn add

RxTS 7 Jan 1, 2023
A querystring parser with nesting support

qs A querystring parsing and stringifying library with some added security. Lead Maintainer: Jordan Harband The qs module was originally created and m

Jordan Harband 7.6k Jan 4, 2023
Add GeoIP && UA-Parser support for Grafana Loki

loki-enhance-middleware loki-enhance-middleware hijacks log push requests sent to loki and modifies it. Deploy docker-compose.yaml services: loki:

WangLei 5 Dec 10, 2022
CSS Object Model implemented in pure JavaScript. It's also a parser!

CSSOM CSSOM.js is a CSS parser written in pure JavaScript. It is also a partial implementation of CSS Object Model. CSSOM.parse("body {color: black}")

Nikita Vasilyev 723 Dec 30, 2022
A tool set for CSS including fast detailed parser, walker, generator and lexer based on W3C specs and browser implementations

CSSTree CSSTree is a tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and match

CSSTree 1.6k Dec 28, 2022
A decent CSS parser.

mensch A decent CSS parser. usage npm install mensch var mensch = require('mensch'); var ast = mensch.parse('p { color: black; }'); var css = mensch.

Brett Stimmerman 112 Sep 24, 2022
Framework-agnostic CSS-in-JS with support for server-side rendering, browser prefixing, and minimum CSS generation

Aphrodite Framework-agnostic CSS-in-JS with support for server-side rendering, browser prefixing, and minimum CSS generation. Support for colocating y

Khan Academy 5.3k Jan 1, 2023
Multiple file upload plugin with image previews, drag and drop, progress bars. S3 and Azure support, image scaling, form support, chunking, resume, pause, and tons of other features.

Fine Uploader is no longer maintained and the project has been effectively shut down. For more info, see https://github.com/FineUploader/fine-uploader

Fine Uploader 8.2k Jan 2, 2023
The official proxy of Titanium Network with enhanced support for a large majority of sites with hCAPTCHA support. Successor to Alloy Proxy.

Corrosion Titanium Networks main web proxy. Successor to Alloy Installation: npm i corrosion Example: const Corrosion = require('corrosion'); const p

Titanium Network 79 Dec 21, 2022
🟢 OneForAll Support Bot - Is a support bot for the discord server of OFA!

?? OneForAll Support Bot - Is a support bot for the discord server of OFA! Setup You can setup OneForAll Support Bot by simply opening your terminal/c

baby 3 Oct 15, 2022
A website for tracking community support for BIP21 QR codes that support on-chain and lightning bitcoin payments.

BIP21 Microsite This is a WIP microsite to promote the usage of a BIP21 payment URI QR code that can include lightning invoices or offers. Wallet supp

Stephen DeLorme 16 Nov 27, 2022
Persistent key/value data storage for your Browser and/or PWA, promisified, including file support and service worker support, all with IndexedDB. Perfectly suitable for your next (PWA) app.

BrowstorJS ?? ?? ?? Persistent key/value data storage for your Browser and/or PWA, promisified, including file support and service worker support, all

Nullix 8 Aug 5, 2022
Javascript Canvas Library, SVG-to-Canvas (& canvas-to-SVG) Parser

Fabric.js Fabric.js is a framework that makes it easy to work with HTML5 canvas element. It is an interactive object model on top of canvas element. I

Fabric.js 23.6k Jan 3, 2023