[Pkg-javascript-commits] [node-stylus] 07/08: Use node-css instead of node-css-parse

Mattia Rizzolo mattia at debian.org
Mon May 23 06:29:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository node-stylus.

commit 21564ffe2792500cdac43c1041153c6a62462afa
Author: James Clarke <jrtc27 at jrtc27.com>
Date:   Mon May 23 02:01:40 2016 +0100

    Use node-css instead of node-css-parse
    
    Closes: #804509
---
 debian/control                                  |  4 +-
 debian/patches/at-rules.patch                   | 59 +++++++++++++++++++++++++
 debian/patches/replace-css-parse-with-css.patch | 28 ++++++++++++
 debian/patches/series                           |  2 +
 4 files changed, 91 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index 2636444..fb6dc7f 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Build-Depends:
  , node-should
  , node-sax
  , node-glob
- , node-css-parse
+ , node-css
  , node-mkdirp
  , node-source-map
  , nodejs
@@ -27,7 +27,7 @@ Depends:
  , nodejs
  , node-debug
  , node-glob (>= 3.2.0)
- , node-css-parse (>= 1.7.0)
+ , node-css (>= 1.7.0)
  , node-sax (>= 0.5.0)
  , node-mkdirp (>= 0.3.0)
  , node-source-map (>= 0.1.0)
diff --git a/debian/patches/at-rules.patch b/debian/patches/at-rules.patch
new file mode 100644
index 0000000..d500a41
--- /dev/null
+++ b/debian/patches/at-rules.patch
@@ -0,0 +1,59 @@
+Description: Add font-face and custom-media support to css.js
+ Later versions of node-css-parse, as well as the recommended node-css, have
+ added special at rules for font-face and custom-media, so they must be
+ handled. Fixes the 'converter atrules' test case failing with undefined
+ appearing where there should be a font-face.
+Author: James Clarke <jrtc27 at jrtc27.com>
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/lib/convert/css.js
++++ b/lib/convert/css.js
+@@ -73,7 +73,11 @@
+     case 'page':
+     case 'host':
+     case 'supports':
+-      var name = node.type[0].toUpperCase() + node.type.slice(1);
++    case 'font-face':
++    case 'custom-media':
++      var name = node.type.split('-').map(function (s) {
++                              return s[0].toUpperCase() + s.slice(1);
++                          }).join('');
+       return this['visit' + name](node);
+   }
+ };
+@@ -305,3 +309,35 @@
+   --this.indents;
+   return buf;
+ };
++
++/**
++ * Visit FontFace `node`.`
++ *
++ * @param {FontFace} node
++ * @return {String}
++ * @api private
++ */
++
++Converter.prototype.visitFontFace = function(node){
++  var buf = this.indent + '@font-face';
++  buf += '\n';
++  ++this.indents;
++  for (var i = 0, len = node.declarations.length; i < len; ++i) {
++    buf += this.visitDeclaration(node.declarations[i]);
++  }
++  --this.indents;
++  return buf;
++};
++
++/**
++ * Visit CustomMedia `node`.`
++ *
++ * @param {CustomMedia} node
++ * @return {String}
++ * @api private
++ */
++
++Converter.prototype.visitCustomMedia = function(node){
++  var buf = this.indent + '@custom-media ' + node.name + ' ' + node.media;
++  return buf + '\n';
++};
diff --git a/debian/patches/replace-css-parse-with-css.patch b/debian/patches/replace-css-parse-with-css.patch
new file mode 100644
index 0000000..c34c0e5
--- /dev/null
+++ b/debian/patches/replace-css-parse-with-css.patch
@@ -0,0 +1,28 @@
+Description: Use node-css instead of node-css-parse
+ node-css-parse is now just a one-line wrapper around node-css, and should
+ not be used.
+Author: James Clarke <jrtc27 at jrtc27.com>
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/lib/convert/css.js
++++ b/lib/convert/css.js
+@@ -24,7 +24,7 @@
+  */
+ 
+ function Converter(css) {
+-  var parse = require('css-parse');
++  var parse = require('css').parse;
+   this.css = css;
+   this.root = parse(css, { position: false });
+   this.indents = 0;
+--- a/package.json
++++ b/package.json
+@@ -29,7 +29,7 @@
+     "test-cov": "mocha test/ test/middleware/ --require should --bail --reporter html-cov > coverage.html"
+   },
+   "dependencies": {
+-    "css-parse": "1.7.x",
++    "css": "^2.0.0",
+     "mkdirp": "0.5.x",
+     "debug": "*",
+     "sax": "0.5.x",
diff --git a/debian/patches/series b/debian/patches/series
index ce42a26..880322a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 nodejs-shebang.patch
+replace-css-parse-with-css.patch
+at-rules.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stylus.git



More information about the Pkg-javascript-commits mailing list