[Pkg-javascript-commits] [less.js] 26/285: move sourcemap generator to environment

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:23:34 UTC 2015


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

js pushed a commit to annotated tag v2.0.0
in repository less.js.

commit e30cccc508d0dde7479d55a9f660a647c60b3cf8
Author: Luke Page <luke.a.page at gmail.com>
Date:   Wed Feb 26 19:30:37 2014 +0000

    move sourcemap generator to environment
---
 lib/less/environments/node.js | 3 +++
 lib/less/non-node-index.js    | 2 +-
 lib/less/source-map-output.js | 4 ++--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/less/environments/node.js b/lib/less/environments/node.js
index ea4f240..d4ef9c3 100644
--- a/lib/less/environments/node.js
+++ b/lib/less/environments/node.js
@@ -42,6 +42,9 @@ module.exports = {
     getAbsolutePath: function getAbsolutePath(env, filename) {
         return require('path').resolve(filename);
     },
+    getSourceMapGenerator: function getSourceMapGenerator() {
+        return require("source-map").SourceMapGenerator;
+    },
     alwaysMakePathsAbsolute: function alwaysMakePathsAbsolute() {
         return false;
     },
diff --git a/lib/less/non-node-index.js b/lib/less/non-node-index.js
index 5c3f8c7..5cd0ad1 100644
--- a/lib/less/non-node-index.js
+++ b/lib/less/non-node-index.js
@@ -13,6 +13,6 @@ require('./import-visitor.js')(less.tree);
 require('./extend-visitor.js')(less.tree);
 require('./join-selector-visitor.js')(less.tree);
 require('./to-css-visitor.js')(less.tree);
-require('./source-map-output.js')(less.tree);
+require('./source-map-output.js')(less, less.tree);
 
 module.exports = less;
diff --git a/lib/less/source-map-output.js b/lib/less/source-map-output.js
index 2fd10ec..9cdc818 100644
--- a/lib/less/source-map-output.js
+++ b/lib/less/source-map-output.js
@@ -1,4 +1,4 @@
-module.exports = function (tree) {
+module.exports = function (less, tree) {
 
     tree.sourceMapOutput = function (options) {
         this._css = [];
@@ -14,7 +14,7 @@ module.exports = function (tree) {
         }
         this._sourceMapRootpath = options.sourceMapRootpath;
         this._outputSourceFiles = options.outputSourceFiles;
-        this._sourceMapGeneratorConstructor = options.sourceMapGenerator || require("source-map").SourceMapGenerator;
+        this._sourceMapGeneratorConstructor = less.environment.getSourceMapGenerator();
 
         if (this._sourceMapRootpath && this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1) !== '/') {
             this._sourceMapRootpath += '/';

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



More information about the Pkg-javascript-commits mailing list