cmda-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xingwei...@apache.org
Subject [16/51] [partial] incubator-cmda git commit: Update ApacheCMDA_1.0
Date Fri, 16 Oct 2015 23:11:50 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/index.js
----------------------------------------------------------------------
diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/index.js
b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/index.js
new file mode 100644
index 0000000..ff42e66
--- /dev/null
+++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/index.js
@@ -0,0 +1,227 @@
+var path = require('path'),
+    url = require('url'),
+    request,
+    fs = require('fs');
+
+var less = {
+    version: [1, 6, 0],
+    Parser: require('./parser').Parser,
+    tree: require('./tree'),
+    render: function (input, options, callback) {
+        options = options || {};
+
+        if (typeof(options) === 'function') {
+            callback = options;
+            options = {};
+        }
+
+        var parser = new(less.Parser)(options),
+            ee;
+
+        if (callback) {
+            parser.parse(input, function (e, root) {
+                try { callback(e, root && root.toCSS && root.toCSS(options));
} 
+                catch (err) { callback(err); }
+            });
+        } else {
+            ee = new (require('events').EventEmitter)();
+
+            process.nextTick(function () {
+                parser.parse(input, function (e, root) {
+                    if (e) { return ee.emit('error', e); }
+                    try { ee.emit('success', root.toCSS(options)); } 
+                    catch (err) { ee.emit('error', err); }
+                });
+            });
+            return ee;
+        }
+    },
+    formatError: function(ctx, options) {
+        options = options || {};
+
+        var message = "";
+        var extract = ctx.extract;
+        var error = [];
+        var stylize = options.color ? require('./lessc_helper').stylize : function (str)
{ return str; };
+
+        // only output a stack if it isn't a less error
+        if (ctx.stack && !ctx.type) { return stylize(ctx.stack, 'red'); }
+
+        if (!ctx.hasOwnProperty('index') || !extract) {
+            return ctx.stack || ctx.message;
+        }
+
+        if (typeof(extract[0]) === 'string') {
+            error.push(stylize((ctx.line - 1) + ' ' + extract[0], 'grey'));
+        }
+
+        if (typeof(extract[1]) === 'string') {
+            var errorTxt = ctx.line + ' ';
+            if (extract[1]) {
+                errorTxt += extract[1].slice(0, ctx.column) +
+                                stylize(stylize(stylize(extract[1][ctx.column], 'bold') +
+                                extract[1].slice(ctx.column + 1), 'red'), 'inverse');
+            }
+            error.push(errorTxt);
+        }
+
+        if (typeof(extract[2]) === 'string') {
+            error.push(stylize((ctx.line + 1) + ' ' + extract[2], 'grey'));
+        }
+        error = error.join('\n') + stylize('', 'reset') + '\n';
+
+        message += stylize(ctx.type + 'Error: ' + ctx.message, 'red');
+        if (ctx.filename) {
+            message += stylize(' in ', 'red') + ctx.filename +
+                stylize(' on line ' + ctx.line + ', column ' + (ctx.column + 1) + ':', 'grey');
+        }
+
+        message += '\n' + error;
+
+        if (ctx.callLine) {
+            message += stylize('from ', 'red') + (ctx.filename || '') + '/n';
+            message += stylize(ctx.callLine, 'grey') + ' ' + ctx.callExtract + '/n';
+        }
+
+        return message;
+    },
+    writeError: function (ctx, options) {
+        options = options || {};
+        if (options.silent) { return; }
+        console.error(less.formatError(ctx, options));
+    }
+};
+
+['color',      'directive',  'operation',          'dimension',
+ 'keyword',    'variable',   'ruleset',            'element',
+ 'selector',   'quoted',     'expression',         'rule',
+ 'call',       'url',        'alpha',              'import',
+ 'mixin',      'comment',    'anonymous',          'value',
+ 'javascript', 'assignment', 'condition',          'paren',
+ 'media',      'unicode-descriptor', 'negative',   'extend'
+].forEach(function (n) {
+    require('./tree/' + n);
+});
+
+
+var isUrlRe = /^(?:https?:)?\/\//i;
+
+less.Parser.fileLoader = function (file, currentFileInfo, callback, env) {
+    var pathname, dirname, data,
+        newFileInfo = {
+            relativeUrls: env.relativeUrls,
+            entryPath: currentFileInfo.entryPath,
+            rootpath: currentFileInfo.rootpath,
+            rootFilename: currentFileInfo.rootFilename
+        };
+
+    function handleDataAndCallCallback(data) {
+        var j = file.lastIndexOf('/');
+
+        // Pass on an updated rootpath if path of imported file is relative and file 
+        // is in a (sub|sup) directory
+        // 
+        // Examples: 
+        // - If path of imported file is 'module/nav/nav.less' and rootpath is 'less/',
+        //   then rootpath should become 'less/module/nav/'
+        // - If path of imported file is '../mixins.less' and rootpath is 'less/', 
+        //   then rootpath should become 'less/../'
+        if(newFileInfo.relativeUrls && !/^(?:[a-z-]+:|\/)/.test(file) &&
j != -1) {
+            var relativeSubDirectory = file.slice(0, j+1);
+            newFileInfo.rootpath = newFileInfo.rootpath + relativeSubDirectory; // append
(sub|sup) directory path of imported file
+        }
+        newFileInfo.currentDirectory = pathname.replace(/[^\\\/]*$/, "");
+        newFileInfo.filename = pathname;
+
+        callback(null, data, pathname, newFileInfo);
+    }
+    
+    var isUrl = isUrlRe.test( file );
+    if (isUrl || isUrlRe.test(currentFileInfo.currentDirectory)) {
+        if (request === undefined) {
+            try { request = require('request'); }
+            catch(e) { request = null; }
+        }
+        if (!request) {
+            callback({ type: 'File', message: "optional dependency 'request' required to
import over http(s)\n" });
+            return;
+        }
+
+        var urlStr = isUrl ? file : url.resolve(currentFileInfo.currentDirectory, file),
+            urlObj = url.parse(urlStr);
+
+        request.get({uri: urlStr, strictSSL: !env.insecure }, function (error, res, body)
{
+            if (res.statusCode === 404) {
+                callback({ type: 'File', message: "resource '" + urlStr + "' was not found\n"
});
+                return;
+            }
+            if (!body) {
+                console.error( 'Warning: Empty body (HTTP '+ res.statusCode + ') returned
by "' + urlStr +'"' );
+            }
+            if (error) {
+                callback({ type: 'File', message: "resource '" + urlStr + "' gave this Error:\n
 "+ error +"\n" });
+            }
+            pathname = urlStr;
+            dirname = urlObj.protocol +'//'+ urlObj.host + urlObj.pathname.replace(/[^\/]*$/,
'');
+            handleDataAndCallCallback(body);
+        });
+    } else {
+
+        var paths = [currentFileInfo.currentDirectory].concat(env.paths);
+        paths.push('.');
+
+        if (env.syncImport) {
+            for (var i = 0; i < paths.length; i++) {
+                try {
+                    pathname = path.join(paths[i], file);
+                    fs.statSync(pathname);
+                    break;
+                } catch (e) {
+                    pathname = null;
+                }
+            }
+
+            if (!pathname) {
+                callback({ type: 'File', message: "'" + file + "' wasn't found" });
+                return;
+            }
+
+            try {
+                data = fs.readFileSync(pathname, 'utf-8');
+                handleDataAndCallCallback(data);
+            } catch (e) {
+                callback(e);
+            }
+        } else {
+            (function tryPathIndex(i) {
+                if (i < paths.length) {
+                    pathname = path.join(paths[i], file);
+                    fs.stat(pathname, function (err) {
+                        if (err) {
+                            tryPathIndex(i + 1);
+                        } else {
+                            fs.readFile(pathname, 'utf-8', function(e, data) {
+                                if (e) { callback(e); }
+                                handleDataAndCallCallback(data);
+                            });
+                        }
+                    });
+                } else {
+                    callback({ type: 'File', message: "'" + file + "' wasn't found" });
+                }
+            }(0));
+        }
+    }
+};
+
+require('./env');
+require('./functions');
+require('./colors');
+require('./visitor.js');
+require('./import-visitor.js');
+require('./extend-visitor.js');
+require('./join-selector-visitor.js');
+require('./to-css-visitor.js');
+require('./source-map-output.js');
+
+for (var k in less) { exports[k] = less[k]; }

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/join-selector-visitor.js
----------------------------------------------------------------------
diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/join-selector-visitor.js
b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/join-selector-visitor.js
new file mode 100644
index 0000000..75a61d6
--- /dev/null
+++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/join-selector-visitor.js
@@ -0,0 +1,44 @@
+(function (tree) {
+    tree.joinSelectorVisitor = function() {
+        this.contexts = [[]];
+        this._visitor = new tree.visitor(this);
+    };
+
+    tree.joinSelectorVisitor.prototype = {
+        run: function (root) {
+            return this._visitor.visit(root);
+        },
+        visitRule: function (ruleNode, visitArgs) {
+            visitArgs.visitDeeper = false;
+        },
+        visitMixinDefinition: function (mixinDefinitionNode, visitArgs) {
+            visitArgs.visitDeeper = false;
+        },
+
+        visitRuleset: function (rulesetNode, visitArgs) {
+            var context = this.contexts[this.contexts.length - 1],
+                paths = [], selectors;
+
+            this.contexts.push(paths);
+
+            if (! rulesetNode.root) {
+                selectors = rulesetNode.selectors;
+                if (selectors) {
+                    selectors = selectors.filter(function(selector) { return selector.getIsOutput();
});
+                    rulesetNode.selectors = selectors.length ? selectors : (selectors = null);
+                    if (selectors) { rulesetNode.joinSelectors(paths, context, selectors);
}
+                }
+                if (!selectors) { rulesetNode.rules = null; }
+                rulesetNode.paths = paths;
+            }
+        },
+        visitRulesetOut: function (rulesetNode) {
+            this.contexts.length = this.contexts.length - 1;
+        },
+        visitMedia: function (mediaNode, visitArgs) {
+            var context = this.contexts[this.contexts.length - 1];
+            mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia);
+        }
+    };
+
+})(require('./tree'));
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/lessc_helper.js
----------------------------------------------------------------------
diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/lessc_helper.js
b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/lessc_helper.js
new file mode 100644
index 0000000..624babb
--- /dev/null
+++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/less/lib/less/lessc_helper.js
@@ -0,0 +1,82 @@
+// lessc_helper.js
+//
+//      helper functions for lessc
+var lessc_helper = {
+
+    //Stylize a string
+    stylize : function(str, style) {
+        var styles = {
+            'reset'     : [0,   0],
+            'bold'      : [1,  22],
+            'inverse'   : [7,  27],
+            'underline' : [4,  24],
+            'yellow'    : [33, 39],
+            'green'     : [32, 39],
+            'red'       : [31, 39],
+            'grey'      : [90, 39]
+        };
+        return '\033[' + styles[style][0] + 'm' + str +
+               '\033[' + styles[style][1] + 'm';
+    },
+
+    //Print command line options
+    printUsage: function() {
+        console.log("usage: lessc [option option=parameter ...] <source> [destination]");
+        console.log("");
+        console.log("If source is set to `-' (dash or hyphen-minus), input is read from stdin.");
+        console.log("");
+        console.log("options:");
+        console.log("  -h, --help               Print help (this message) and exit.");
+        console.log("  --include-path=PATHS     Set include paths. Separated by `:'. Use
`;' on Windows.");
+        console.log("  -M, --depends            Output a makefile import dependency list
to stdout");
+        console.log("  --no-color               Disable colorized output.");
+        console.log("  --no-ie-compat           Disable IE compatibility checks.");
+        console.log("  --no-js                  Disable JavaScript in less files");
+        console.log("  -l, --lint               Syntax check only (lint).");
+        console.log("  -s, --silent             Suppress output of error messages.");
+        console.log("  --strict-imports         Force evaluation of imports.");
+        console.log("  --insecure               Allow imports from insecure https hosts.");
+        console.log("  -v, --version            Print version number and exit.");
+        console.log("  -x, --compress           Compress output by removing some whitespaces.");
+        console.log("  --clean-css              Compress output using clean-css");
+        console.log("  --clean-option=opt:val   Pass an option to clean css, using CLI arguments
from ");
+        console.log("                           https://github.com/GoalSmashers/clean-css
e.g.");
+        console.log("                           --clean-option=--selectors-merge-mode:ie8");
+        console.log("                           and to switch on advanced use --clean-option=--advanced");
+        console.log("  --source-map[=FILENAME]  Outputs a v3 sourcemap to the filename (or
output filename.map)");
+        console.log("  --source-map-rootpath=X  adds this path onto the sourcemap filename
and less file paths");
+        console.log("  --source-map-basepath=X  Sets sourcemap base path, defaults to current
working directory.");
+        console.log("  --source-map-less-inline puts the less files into the map instead
of referencing them");
+        console.log("  --source-map-map-inline  puts the map (and any less files) into the
output css file");
+        console.log("  --source-map-url=URL     the complete url and filename put in the
less file");
+        console.log("  -rp, --rootpath=URL      Set rootpath for url rewriting in relative
imports and urls.");
+        console.log("                           Works with or without the relative-urls option.");
+        console.log("  -ru, --relative-urls     re-write relative urls to the base less file.");
+        console.log("  -sm=on|off               Turn on or off strict math, where in strict
mode, math");
+        console.log("  --strict-math=on|off     requires brackets. This option may default
to on and then");
+        console.log("                           be removed in the future.");
+        console.log("  -su=on|off               Allow mixed units, e.g. 1px+1em or 1px*1px
which have units");
+        console.log("  --strict-units=on|off    that cannot be represented.");
+        console.log("  --global-var='VAR=VALUE' Defines a variable that can be referenced
by the file.");
+        console.log("  --modify-var='VAR=VALUE' Modifies a variable already declared in the
file.");
+        console.log("");
+        console.log("-------------------------- Deprecated ----------------");
+        console.log("  -O0, -O1, -O2            Set the parser's optimization level. The
lower");
+        console.log("                           the number, the less nodes it will create
in the");
+        console.log("                           tree. This could matter for debugging, or
if you");
+        console.log("                           want to access the individual nodes in the
tree.");
+        console.log("  --line-numbers=TYPE      Outputs filename and line numbers.");
+        console.log("                           TYPE can be either 'comments', which will
output");
+        console.log("                           the debug info within comments, 'mediaquery'");
+        console.log("                           that will output the information within a
fake");
+        console.log("                           media query which is compatible with the
SASS");
+        console.log("                           format, and 'all' which will do both.");
+        console.log("  --verbose                Be verbose.");
+        console.log("");
+        console.log("Report bugs to: http://github.com/less/less.js/issues");
+        console.log("Home page: <http://lesscss.org/>");
+    }
+};
+
+// Exports helper functions
+for (var h in lessc_helper) { exports[h] = lessc_helper[h]; }


Mime
View raw message