Comparing version 2.0.0 to 2.1.0
@@ -64,3 +64,4 @@ // http://www.w3.org/TR/CSS21/grammar.html | ||
var err = new Error(msg + ' near line ' + lineno + ':' + column); | ||
var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg); | ||
err.reason = msg; | ||
err.filename = options.source; | ||
@@ -67,0 +68,0 @@ err.line = lineno; |
@@ -7,2 +7,3 @@ | ||
var Base = require('./compiler'); | ||
var inherits = require('inherits'); | ||
@@ -27,3 +28,3 @@ /** | ||
Compiler.prototype.__proto__ = Base.prototype; | ||
inherits(Compiler, Base); | ||
@@ -30,0 +31,0 @@ /** |
@@ -7,2 +7,3 @@ | ||
var Base = require('./compiler'); | ||
var inherits = require('inherits'); | ||
@@ -29,3 +30,3 @@ /** | ||
Compiler.prototype.__proto__ = Base.prototype; | ||
inherits(Compiler, Base); | ||
@@ -32,0 +33,0 @@ /** |
@@ -37,3 +37,8 @@ | ||
compiler.applySourceMaps(); | ||
return { code: code, map: compiler.map.toJSON() }; | ||
var map = options.sourcemap === 'generator' | ||
? compiler.map | ||
: compiler.map.toJSON(); | ||
return { code: code, map: map }; | ||
} | ||
@@ -40,0 +45,0 @@ |
@@ -104,8 +104,10 @@ | ||
var originalMap = sourceMapResolve.resolveSync( | ||
content, file, fs.readFileSync); | ||
if (originalMap) { | ||
var map = new SourceMapConsumer(originalMap.map); | ||
var relativeTo = originalMap.sourcesRelativeTo; | ||
this.map.applySourceMap(map, file, urix(path.dirname(relativeTo))); | ||
if (this.options.inputSourcemaps !== false) { | ||
var originalMap = sourceMapResolve.resolveSync( | ||
content, file, fs.readFileSync); | ||
if (originalMap) { | ||
var map = new SourceMapConsumer(originalMap.map); | ||
var relativeTo = originalMap.sourcesRelativeTo; | ||
this.map.applySourceMap(map, file, urix(path.dirname(relativeTo))); | ||
} | ||
} | ||
@@ -112,0 +114,0 @@ }, this); |
{ | ||
"name": "css", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "CSS parser / stringifier", | ||
@@ -11,15 +11,16 @@ "main": "index", | ||
"dependencies": { | ||
"source-map": "~0.1.31", | ||
"source-map-resolve": "~0.1.3", | ||
"urix": "~0.1.0" | ||
"source-map": "^0.1.38", | ||
"source-map-resolve": "^0.3.0", | ||
"urix": "^0.1.0", | ||
"inherits": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*", | ||
"should": "*", | ||
"matcha": "~0.4.0", | ||
"bytes": "~0.2.1" | ||
"mocha": "^1.21.3", | ||
"should": "^4.0.4", | ||
"matcha": "^0.5.0", | ||
"bytes": "^1.0.0" | ||
}, | ||
"scripts": { | ||
"benchmark": "matcha", | ||
"test": "mocha --require should --reporter spec --bail test/**/*.js" | ||
"test": "mocha --require should --reporter spec --bail test/*.js" | ||
}, | ||
@@ -26,0 +27,0 @@ "author": "TJ Holowaychuk <tj@vision-media.ca>", |
@@ -12,4 +12,4 @@ # css [![Build Status](https://travis-ci.org/reworkcss/css.svg?branch=master)](https://travis-ci.org/reworkcss/css) | ||
```js | ||
var css = require('css') | ||
var obj = css.parse('body { font-size: 12px; }', options) | ||
var css = require('css'); | ||
var obj = css.parse('body { font-size: 12px; }', options); | ||
css.stringify(obj, options); | ||
@@ -39,2 +39,8 @@ ``` | ||
option of `css.parse` is strongly recommended when creating a source map. | ||
Specify `sourcemap: 'generator'` to return the SourceMapGenerator object | ||
instead of serializing the source map. | ||
- inputSourcemaps: (enabled by default, specify `false` to disable) reads any | ||
source maps referenced by the input files when generating the output source | ||
map. When enabled, file system access may be required for reading the | ||
referenced source maps. | ||
@@ -44,3 +50,3 @@ ### Example | ||
```js | ||
var ast = css.parse('body { font-size: 12px; }', { position: true, source: 'source.css' }); | ||
var ast = css.parse('body { font-size: 12px; }', { source: 'source.css' }); | ||
@@ -56,3 +62,5 @@ var css = css.stringify(ast); | ||
Errors will have `error.position`, just like [`node.position`](#position). | ||
Errors will have `error.position`, just like [`node.position`](#position). The | ||
error contains the source position in the message. To get the error message | ||
without the position use `error.reason`. | ||
@@ -85,3 +93,2 @@ If you create any errors in plugins such as in | ||
- content: `String`. The full source string passed to `css.parse`. | ||
- parent: `Object`. Reference to the parent node that contains this node. | ||
@@ -99,2 +106,6 @@ The line and column numbers are 1-based: The first line is 1 and the first | ||
#### parent | ||
A reference to the parent node, or `null` if the node has no parent. | ||
### Types | ||
@@ -101,0 +112,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
31776
1004
300
1
4
+ Addedinherits@^2.0.1
+ Addedinherits@2.0.4(transitive)
+ Addedsource-map-resolve@0.3.1(transitive)
+ Addedsource-map-url@0.3.0(transitive)
- Removedsource-map-resolve@0.1.4(transitive)
- Removedsource-map-url@0.2.0(transitive)
Updatedsource-map@^0.1.38
Updatedsource-map-resolve@^0.3.0
Updatedurix@^0.1.0