<commit_before>var CSSPluginBase = require('css/css-plugin-base.js');
var JspmLessPlugin = require('./jspm-less-plugin.js');

var isWin = typeof process !== 'undefined' && process.platform.match(/^win/);

function fromFileURL(url) {
  return url.substr(7 + !!isWin).replace(/\//g, isWin ? '\\' : '/');
}

module.exports = new CSSPluginBase(function compile(style, address, opts) {

  var loader = this;

  // use a file path in Node and a URL in the browser
  var filename = this.builder ? fromFileURL(address) : address,
    lessPromise = this.builder ? System.import('./bundled_less/less.node.js', module.id) : System.import('./bundled_less/less.browser.js', module.id);

  return lessPromise
    .then(function (less) {
      return less.render(style, {
        filename: filename,
        rootpath: !loader.builder && filename.replace(/[^/]+$/, ''),
        paths: opts.fileAsRoot && [filename.replace(/[^/]+$/, '')],
        relativeUrls: opts.relativeUrls || false,
        sourceMap: loader.builder && {
          sourceMapBasepath: filename.replace(/[^/]+$/, '')
        },
        plugins: [new JspmLessPlugin({
          prefix: 'jspm://'
        })]
      });
    })
    .then(function (output) {
      return {
        css: output.css + (loader.builder ? '' : ('/*# sourceURL=' + filename + '*/')),
        map: output.map,

        // style plugins can optionally return a modular module
        // source as well as the stylesheet above
        moduleSource: null,
        moduleFormat: null
      };
    });<commit_msg>import node version of less based on process information rather than existence of builder allows for plugin to be used with testing frameworks without mocking out a full dom environment<commit_after>var CSSPluginBase = require('css/css-plugin-base.js');
var JspmLessPlugin = require('./jspm-less-plugin.js');

var isWin = typeof process !== 'undefined' && process.platform.match(/^win/);

function fromFileURL(url) {
  return url.substr(7 + !!isWin).replace(/\//g, isWin ? '\\' : '/');
}

module.exports = new CSSPluginBase(function compile(style, address, opts) {

  var loader = this;

  // use a file path in Node and a URL in the browser
  var useNode = typeof process === 'object' && typeof process.versions.node === 'string';
  var filename = useNode ? fromFileURL(address) : address,
    lessPromise = useNode ? System.import('./bundled_less/less.node.js', module.id) : System.import('./bundled_less/less.browser.js', module.id);

  return lessPromise
    .then(function (less) {
      return less.render(style, {
        filename: filename,
        rootpath: !loader.builder && filename.replace(/[^/]+$/, ''),
        paths: opts.fileAsRoot && [filename.replace(/[^/]+$/, '')],
        relativeUrls: opts.relativeUrls || false,
        sourceMap: loader.builder && {
          sourceMapBasepath: filename.replace(/[^/]+$/, '')
        },
        plugins: [new JspmLessPlugin({
          prefix: 'jspm://'
        })]
      });
    })
    .then(function (output) {
      return {
        css: output.css + (loader.builder ? '' : ('/*# sourceURL=' + filename + '*/')),
        map: output.map,

        // style plugins can optionally return a modular module
        // source as well as the stylesheet above
        moduleSource: null,
        moduleFormat: null
      };
    });
{'fraction_non_alphanumeric': 0.1602409638554217, 'fraction_numerical': 0.0006024096385542169, 'mean_word_length': 2.7738636363636364, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3979895', 'n_tokens_mistral': 983, 'n_tokens_neox': 962, 'n_words': 247}