stylus-source 0.32.1 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/vendor/bin/stylus +14 -14
- data/vendor/lib/browserify.js +2 -0
- data/vendor/lib/convert/css.js +3 -3
- data/vendor/lib/functions/index.js +22 -3
- data/vendor/lib/functions/index.styl +1 -1
- data/vendor/lib/lexer.js +1 -1
- data/vendor/lib/middleware.js +3 -3
- data/vendor/lib/parser.js +8 -3
- data/vendor/lib/visitor/compiler.js +10 -4
- data/vendor/lib/visitor/evaluator.js +1 -1
- data/vendor/lib/visitor/normalizer.js +3 -1
- data/vendor/package.json +3 -2
- metadata +2 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e43f1d0afc6bc5ef7a1e8b10f4db14c85882f229
         | 
| 4 | 
            +
              data.tar.gz: f5aab3d545f9f2d8f3c818e18a67860518e3ea2d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b4d427303372c6b71b85f0858cf370f93179b325c3b9a816696abfbe3cbab7a5054102f54bfe11cf775a12a4497216c99a423e39580cd090d56aa1646de567cc
         | 
| 7 | 
            +
              data.tar.gz: 9303eaf8bd3b90779ad350a31f507cef1997e07b38856e686ad0139fae05fda4bc4c21519d38438b725bfeb61e53eb589abf6b9323caae49673ece09add56b4a
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0. | 
| 1 | 
            +
            0.33.0
         | 
    
        data/vendor/bin/stylus
    CHANGED
    
    | @@ -91,7 +91,7 @@ var plugins = []; | |
| 91 91 | 
             
            var urlFunction = false;
         | 
| 92 92 |  | 
| 93 93 | 
             
            /**
         | 
| 94 | 
            -
             * Include  | 
| 94 | 
            +
             * Include CSS on import.
         | 
| 95 95 | 
             
             */
         | 
| 96 96 |  | 
| 97 97 | 
             
            var includeCSS = false;
         | 
| @@ -121,21 +121,21 @@ var usage = [ | |
| 121 121 | 
             
              , '  Options:'
         | 
| 122 122 | 
             
              , ''
         | 
| 123 123 | 
             
              , '    -i, --interactive       Start interactive REPL'
         | 
| 124 | 
            -
              , '    -u, --use <path>        Utilize the  | 
| 125 | 
            -
              , '    -U, --inline            Utilize image inlining via data  | 
| 124 | 
            +
              , '    -u, --use <path>        Utilize the Stylus plugin at <path>'
         | 
| 125 | 
            +
              , '    -U, --inline            Utilize image inlining via data URI support'
         | 
| 126 126 | 
             
              , '    -w, --watch             Watch file(s) for changes and re-compile'
         | 
| 127 127 | 
             
              , '    -o, --out <dir>         Output to <dir> when passing files'
         | 
| 128 | 
            -
              , '    -C, --css <src> [dest]  Convert  | 
| 128 | 
            +
              , '    -C, --css <src> [dest]  Convert CSS input to Stylus'
         | 
| 129 129 | 
             
              , '    -I, --include <path>    Add <path> to lookup paths'
         | 
| 130 | 
            -
              , '    -c, --compress          Compress  | 
| 130 | 
            +
              , '    -c, --compress          Compress CSS output'
         | 
| 131 131 | 
             
              , '    -d, --compare           Display input along with output'
         | 
| 132 | 
            -
              , '    -f, --firebug           Emits debug infos in the generated  | 
| 132 | 
            +
              , '    -f, --firebug           Emits debug infos in the generated CSS that'
         | 
| 133 133 | 
             
              , '                            can be used by the FireStylus Firebug plugin'
         | 
| 134 | 
            -
              , '    -l, --line-numbers      Emits comments in the generated  | 
| 135 | 
            -
              , '                            indicating the corresponding  | 
| 134 | 
            +
              , '    -l, --line-numbers      Emits comments in the generated CSS'
         | 
| 135 | 
            +
              , '                            indicating the corresponding Stylus line'
         | 
| 136 136 | 
             
              , '    --import <file>         Import stylus <file>'
         | 
| 137 | 
            -
              , '    --include-css           Include regular  | 
| 138 | 
            -
              , '    -V, --version           Display the version of  | 
| 137 | 
            +
              , '    --include-css           Include regular CSS on @import'
         | 
| 138 | 
            +
              , '    -V, --version           Display the version of Stylus'
         | 
| 139 139 | 
             
              , '    -h, --help              Display help information'
         | 
| 140 140 | 
             
              , ''
         | 
| 141 141 | 
             
            ].join('\n');
         | 
| @@ -320,7 +320,7 @@ var options = { | |
| 320 320 |  | 
| 321 321 | 
             
            var str = '';
         | 
| 322 322 |  | 
| 323 | 
            -
            // Convert  | 
| 323 | 
            +
            // Convert CSS to Stylus
         | 
| 324 324 |  | 
| 325 325 | 
             
            if (convertCSS) {
         | 
| 326 326 | 
             
                switch (files.length) {
         | 
| @@ -350,7 +350,7 @@ if (convertCSS) { | |
| 350 350 | 
             
            }
         | 
| 351 351 |  | 
| 352 352 | 
             
            /**
         | 
| 353 | 
            -
             * Start  | 
| 353 | 
            +
             * Start Stylus REPL.
         | 
| 354 354 | 
             
             */
         | 
| 355 355 |  | 
| 356 356 | 
             
            function repl() {
         | 
| @@ -424,7 +424,7 @@ function repl() { | |
| 424 424 | 
             
            }
         | 
| 425 425 |  | 
| 426 426 | 
             
            /**
         | 
| 427 | 
            -
             * Highlight the given string of  | 
| 427 | 
            +
             * Highlight the given string of Stylus.
         | 
| 428 428 | 
             
             */
         | 
| 429 429 |  | 
| 430 430 | 
             
            function highlight(str) {
         | 
| @@ -535,7 +535,7 @@ function compileFile(file) { | |
| 535 535 | 
             
            }
         | 
| 536 536 |  | 
| 537 537 | 
             
            /**
         | 
| 538 | 
            -
             * Write the given  | 
| 538 | 
            +
             * Write the given CSS output.
         | 
| 539 539 | 
             
             */
         | 
| 540 540 |  | 
| 541 541 | 
             
            function writeFile(file, css) {
         | 
    
        data/vendor/lib/convert/css.js
    CHANGED
    
    | @@ -1,11 +1,11 @@ | |
| 1 1 | 
             
            /*!
         | 
| 2 | 
            -
             * Stylus -  | 
| 2 | 
            +
             * Stylus - CSS to Stylus conversion
         | 
| 3 3 | 
             
             * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
         | 
| 4 4 | 
             
             * MIT Licensed
         | 
| 5 5 | 
             
             */
         | 
| 6 6 |  | 
| 7 7 | 
             
            /**
         | 
| 8 | 
            -
             * Convert the given `css` to  | 
| 8 | 
            +
             * Convert the given `css` to Stylus source.
         | 
| 9 9 | 
             
             *
         | 
| 10 10 | 
             
             * @param {String} css
         | 
| 11 11 | 
             
             * @return {String}
         | 
| @@ -32,7 +32,7 @@ function Converter(css) { | |
| 32 32 | 
             
            }
         | 
| 33 33 |  | 
| 34 34 | 
             
            /**
         | 
| 35 | 
            -
             * Convert to  | 
| 35 | 
            +
             * Convert to Stylus.
         | 
| 36 36 | 
             
             *
         | 
| 37 37 | 
             
             * @return {String}
         | 
| 38 38 | 
             
             * @api private
         | 
| @@ -742,14 +742,33 @@ exports.trace = function trace(){ | |
| 742 742 | 
             
             *    image-size('foo.png')[1]
         | 
| 743 743 | 
             
             *    // => 100px
         | 
| 744 744 | 
             
             *
         | 
| 745 | 
            +
             * Can be used to test if the image exists,
         | 
| 746 | 
            +
             * using an optional argument set to `true`
         | 
| 747 | 
            +
             * (without this argument this function throws error
         | 
| 748 | 
            +
             * if there is no such image).
         | 
| 749 | 
            +
             *
         | 
| 750 | 
            +
             * Example:
         | 
| 751 | 
            +
             *
         | 
| 752 | 
            +
             *    image-size('nosuchimage.png', true)[0]
         | 
| 753 | 
            +
             *    // => 0
         | 
| 754 | 
            +
             *
         | 
| 745 755 | 
             
             * @param {String} img
         | 
| 756 | 
            +
             * @param {Boolean} ignoreErr
         | 
| 746 757 | 
             
             * @return {Expression}
         | 
| 747 758 | 
             
             * @api public
         | 
| 748 759 | 
             
             */
         | 
| 749 760 |  | 
| 750 | 
            -
            exports['image-size'] = function imageSize(img) {
         | 
| 761 | 
            +
            exports['image-size'] = function imageSize(img, ignoreErr) {
         | 
| 751 762 | 
             
              utils.assertType(img, 'string', 'img');
         | 
| 752 | 
            -
               | 
| 763 | 
            +
              try {
         | 
| 764 | 
            +
                var img = new Image(this, img.string);
         | 
| 765 | 
            +
              } catch (err) {
         | 
| 766 | 
            +
                if (ignoreErr) {
         | 
| 767 | 
            +
                  return [new nodes.Unit(0), new nodes.Unit(0)];
         | 
| 768 | 
            +
                } else {
         | 
| 769 | 
            +
                  throw err;
         | 
| 770 | 
            +
                }
         | 
| 771 | 
            +
              }
         | 
| 753 772 |  | 
| 754 773 | 
             
              // Read size
         | 
| 755 774 | 
             
              img.open();
         | 
| @@ -880,4 +899,4 @@ function parseUnit(str){ | |
| 880 899 | 
             
              var n = parseInt(m[1], 10);
         | 
| 881 900 | 
             
              var type = m[2];
         | 
| 882 901 | 
             
              return new nodes.Unit(n, type);
         | 
| 883 | 
            -
            }
         | 
| 902 | 
            +
            }
         | 
| @@ -224,7 +224,7 @@ join(delim, vals...) | |
| 224 224 | 
             
              for val, i in vals
         | 
| 225 225 | 
             
                buf += i ? delim + val : val
         | 
| 226 226 |  | 
| 227 | 
            -
            // add a  | 
| 227 | 
            +
            // add a CSS rule to the containing block
         | 
| 228 228 |  | 
| 229 229 | 
             
            // - This definition allows add-property to be used as a mixin
         | 
| 230 230 | 
             
            // - It has the same effect as interpolation but allows users
         | 
    
        data/vendor/lib/lexer.js
    CHANGED
    
    | @@ -797,7 +797,7 @@ Lexer.prototype = { | |
| 797 797 |  | 
| 798 798 | 
             
              selector: function() {
         | 
| 799 799 | 
             
                var captures;
         | 
| 800 | 
            -
                if (captures =  | 
| 800 | 
            +
                if (captures = /^.*?(?=\/\/(?![^\[]*\])|[,\n{])/.exec(this.str)) {
         | 
| 801 801 | 
             
                  var selector = captures[0];
         | 
| 802 802 | 
             
                  this.skip(captures);
         | 
| 803 803 | 
             
                  return new Token('selector', selector);
         | 
    
        data/vendor/lib/middleware.js
    CHANGED
    
    | @@ -35,10 +35,10 @@ var imports = {}; | |
| 35 35 | 
             
             *    `compile`   Custom compile function, accepting the arguments
         | 
| 36 36 | 
             
             *                `(str, path)`.
         | 
| 37 37 | 
             
             *    `compress`  Whether the output .css files should be compressed
         | 
| 38 | 
            -
             *    `firebug`   Emits debug infos in the generated  | 
| 38 | 
            +
             *    `firebug`   Emits debug infos in the generated CSS that can
         | 
| 39 39 | 
             
             *                be used by the FireStylus Firebug plugin
         | 
| 40 | 
            -
             *    `linenos`   Emits comments in the generated  | 
| 41 | 
            -
             *                the corresponding  | 
| 40 | 
            +
             *    `linenos`   Emits comments in the generated CSS indicating 
         | 
| 41 | 
            +
             *                the corresponding Stylus line
         | 
| 42 42 | 
             
             *
         | 
| 43 43 | 
             
             * Examples:
         | 
| 44 44 | 
             
             * 
         | 
    
        data/vendor/lib/parser.js
    CHANGED
    
    | @@ -299,14 +299,19 @@ Parser.prototype = { | |
| 299 299 | 
             
                    // unclosed, must be a block
         | 
| 300 300 | 
             
                    if (!this.lineContains('}')) return;
         | 
| 301 301 | 
             
                    // check if ':' is within the braces.
         | 
| 302 | 
            -
                    // though not required by  | 
| 302 | 
            +
                    // though not required by Stylus, chances
         | 
| 303 303 | 
             
                    // are if someone is using {} they will
         | 
| 304 | 
            -
                    // use  | 
| 304 | 
            +
                    // use CSS-style props, helping us with
         | 
| 305 305 | 
             
                    // the ambiguity in this case
         | 
| 306 306 | 
             
                    var i = 0
         | 
| 307 307 | 
             
                      , la;
         | 
| 308 308 | 
             
                    while (la = this.lookahead(++i)) {
         | 
| 309 | 
            -
                      if ('}' == la.type)  | 
| 309 | 
            +
                      if ('}' == la.type) {
         | 
| 310 | 
            +
                        // Check empty block.
         | 
| 311 | 
            +
                        if (i == 2 || (i == 3 && this.lookahead(i - 1).type == 'space'))
         | 
| 312 | 
            +
                          return;
         | 
| 313 | 
            +
                        break;
         | 
| 314 | 
            +
                      }
         | 
| 310 315 | 
             
                      if (':' == la.type) return;
         | 
| 311 316 | 
             
                    }
         | 
| 312 317 | 
             
                  }
         | 
| @@ -19,7 +19,7 @@ var Visitor = require('./') | |
| 19 19 | 
             
             *
         | 
| 20 20 | 
             
             * Options:
         | 
| 21 21 | 
             
             *
         | 
| 22 | 
            -
             *   - `compress`  Compress the  | 
| 22 | 
            +
             *   - `compress`  Compress the CSS output (default: false)
         | 
| 23 23 | 
             
             *
         | 
| 24 24 | 
             
             * @param {Node} root
         | 
| 25 25 | 
             
             * @api public
         | 
| @@ -89,7 +89,7 @@ Compiler.prototype.visitRoot = function(block){ | |
| 89 89 | 
             
            Compiler.prototype.visitBlock = function(block){
         | 
| 90 90 | 
             
              var node;
         | 
| 91 91 |  | 
| 92 | 
            -
              if (block.hasProperties) {
         | 
| 92 | 
            +
              if (block.hasProperties && !block.lacksRenderedSelectors) {
         | 
| 93 93 | 
             
                var arr = [this.compress ? '{' : ' {'];
         | 
| 94 94 | 
             
                ++this.indents;
         | 
| 95 95 | 
             
                for (var i = 0, len = block.nodes.length; i < len; ++i) {
         | 
| @@ -343,7 +343,10 @@ Compiler.prototype.visitGroup = function(group){ | |
| 343 343 | 
             
              // selectors
         | 
| 344 344 | 
             
              if (group.block.hasProperties) {
         | 
| 345 345 | 
             
                var selectors = this.compileSelectors(stack);
         | 
| 346 | 
            -
                 | 
| 346 | 
            +
                if(selectors.length)
         | 
| 347 | 
            +
                  this.buf += (this.selector = selectors.join(this.compress ? ',' : ',\n'));
         | 
| 348 | 
            +
                else
         | 
| 349 | 
            +
                  group.block.lacksRenderedSelectors = true;
         | 
| 347 350 | 
             
              }
         | 
| 348 351 |  | 
| 349 352 | 
             
              // output block
         | 
| @@ -458,7 +461,8 @@ Compiler.prototype.compileSelectors = function(arr){ | |
| 458 461 | 
             
              var stack = this.stack
         | 
| 459 462 | 
             
                , self = this
         | 
| 460 463 | 
             
                , selectors = []
         | 
| 461 | 
            -
                , buf = [] | 
| 464 | 
            +
                , buf = []
         | 
| 465 | 
            +
                , hiddenSelectorRegexp = /^\s*\$/;
         | 
| 462 466 |  | 
| 463 467 | 
             
              function interpolateParent(selector, buf) {
         | 
| 464 468 | 
             
                var str = selector.val.trim();
         | 
| @@ -477,6 +481,7 @@ Compiler.prototype.compileSelectors = function(arr){ | |
| 477 481 | 
             
              function compile(arr, i) {
         | 
| 478 482 | 
             
                if (i) {
         | 
| 479 483 | 
             
                  arr[i].forEach(function(selector){
         | 
| 484 | 
            +
                    if(selector.val.match(hiddenSelectorRegexp)) return;
         | 
| 480 485 | 
             
                    if (selector.inherits) {
         | 
| 481 486 | 
             
                      buf.unshift(selector.val);
         | 
| 482 487 | 
             
                      compile(arr, i - 1);
         | 
| @@ -487,6 +492,7 @@ Compiler.prototype.compileSelectors = function(arr){ | |
| 487 492 | 
             
                  });
         | 
| 488 493 | 
             
                } else {
         | 
| 489 494 | 
             
                  arr[0].forEach(function(selector){
         | 
| 495 | 
            +
                    if(selector.val.match(hiddenSelectorRegexp)) return;
         | 
| 490 496 | 
             
                    var str = interpolateParent(selector, buf);
         | 
| 491 497 | 
             
                    selectors.push(self.indent + str.trimRight());
         | 
| 492 498 | 
             
                  });
         | 
| @@ -336,7 +336,7 @@ Evaluator.prototype.visitCall = function(call){ | |
| 336 336 | 
             
                fn = this.lookupFunction(call.name);
         | 
| 337 337 | 
             
              }
         | 
| 338 338 |  | 
| 339 | 
            -
              // Undefined function | 
| 339 | 
            +
              // Undefined function? render literal CSS
         | 
| 340 340 | 
             
              if (!fn || fn.nodeName != 'function') {
         | 
| 341 341 | 
             
                debug('%s is undefined', call);
         | 
| 342 342 | 
             
                var ret = this.literalCall(call);
         | 
| @@ -150,12 +150,14 @@ Normalizer.prototype.visitMedia = function(media){ | |
| 150 150 | 
             
                , other = [];
         | 
| 151 151 |  | 
| 152 152 | 
             
              media.block.nodes.forEach(function(node, i) {
         | 
| 153 | 
            +
                node = this.visit(node);
         | 
| 154 | 
            +
             | 
| 153 155 | 
             
                if ('property' == node.nodeName) {
         | 
| 154 156 | 
             
                  props.push(node);
         | 
| 155 157 | 
             
                } else {
         | 
| 156 158 | 
             
                  other.push(node);
         | 
| 157 159 | 
             
                }
         | 
| 158 | 
            -
              });
         | 
| 160 | 
            +
              }, this);
         | 
| 159 161 |  | 
| 160 162 | 
             
              // Fake self-referencing group to contain
         | 
| 161 163 | 
             
              // any props that are floating
         | 
    
        data/vendor/package.json
    CHANGED
    
    | @@ -1,10 +1,11 @@ | |
| 1 1 | 
             
            {   "name": "stylus"
         | 
| 2 2 | 
             
              , "description": "Robust, expressive, and feature-rich CSS superset"
         | 
| 3 | 
            -
              , "version": "0. | 
| 3 | 
            +
              , "version": "0.33.0"
         | 
| 4 4 | 
             
              , "author": "TJ Holowaychuk <tj@vision-media.ca>"
         | 
| 5 5 | 
             
              , "keywords": ["css", "parser", "style", "stylesheets", "jade", "language"]
         | 
| 6 | 
            -
              , "repository": "git://github.com/ | 
| 6 | 
            +
              , "repository": "git://github.com/LearnBoost/stylus"
         | 
| 7 7 | 
             
              , "main": "./index.js"
         | 
| 8 | 
            +
              , "browserify": "./lib/browserify.js"
         | 
| 8 9 | 
             
              , "engines": { "node": "*" }
         | 
| 9 10 | 
             
              , "bin": { "stylus": "./bin/stylus" }
         | 
| 10 11 | 
             
              , "scripts" : { "prepublish" : "npm prune", "test": "make test" }
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: stylus-source
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.33.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - TJ Holowaychuk
         | 
| @@ -27,6 +27,7 @@ files: | |
| 27 27 | 
             
            - vendor/bin/stylus
         | 
| 28 28 | 
             
            - vendor/bm.js
         | 
| 29 29 | 
             
            - vendor/index.js
         | 
| 30 | 
            +
            - vendor/lib/browserify.js
         | 
| 30 31 | 
             
            - vendor/lib/colors.js
         | 
| 31 32 | 
             
            - vendor/lib/convert/css.js
         | 
| 32 33 | 
             
            - vendor/lib/errors.js
         |