function end() { var body = Buffer.concat(chunks) .toString('utf8') .replace(/^#!/, '//#!'); if (file.match(/\.json$/)) { this.push('module.exports=' + body); this.push(null); return; } var fopts = { locations: true, ecmaVersion: opts.ecmaVersion || 9 }; try { var src = String(falafel(body, fopts, walk)); } catch (err) { return onerror(err, file, body); } var sfile = JSON.stringify(JSON.stringify(file)); var origBody = body; var bodySourceMap = convertSourceMap.fromSource(body); if (bodySourceMap && bodySourceMap.sourcemap.mappings) { bodySourceMap = new sourceMap.SourceMapConsumer(bodySourceMap.sourcemap); origBody = bodySourceMap.sourceContentFor(slash(file)); var originalLoc = function originalLocation(loc) { var pos = bodySourceMap.originalPositionFor(loc); if (pos.line && pos.column) { return { line: pos.line, column: pos.column }; } }; expected = expected.map(function (loc) { var origStart = originalLoc(loc.start); var origEnd = originalLoc(loc.end); if (origStart && origEnd) { return { start: originalLoc(loc.start), end: originalLoc(loc.end) }; } else { return false; } }); } var lines = origBody.split('\n'); var lineOffsets = []; var offset = 0; for (var i = 0; i < lines.length; i++) { lineOffsets[i] = offset; offset += lines[i].length + 1; } expected = expected.map(function (loc) { if (!loc) { return false; } return [ lineOffsets[loc.start.line - 1] + loc.start.column, lineOffsets[loc.end.line - 1] + loc.end.column ]; }); /* eslint-disable no-useless-concat */ this.push(outputFn + '("COVERAGE " + ' + sfile + ' + " " + ' + JSON.stringify(JSON.stringify(expected)) + ');' + 'var __coverage = ' + JSON.stringify(expected.reduce(function (acc, x, ix) { acc[ix] = x; return acc; }, {})) + ';' + 'var __coverageFunction = function () {' + 'var a=[].slice.call(arguments);' + 'a.splice(-1, 0, "__coverageWrap");' + 'var f=Function.apply(this, a);' + 'return function(){' + 'var b=[].slice.call(arguments);' + 'b.push(__coverageWrap);' + 'return f.apply(this, b);' + '}' + '};' + '__coverageFunction.prototype = Function.prototype;' + 'var __coverageWrap = function (index) {' + 'if (__coverage[index]) ' + outputFn + '("COVERED " + ' + sfile + ' + " " + index);' + 'delete __coverage[index];' + 'return function (x) { return x }' + '};' + '(function (Function) {\n'); /* eslint-enable no-useless-concat */ this.push(src); this.push('\n})(__coverageFunction)'); this.push(null); }
module.exports = function (source, options) { var stream = new Readable({objectMode: true}); var cwd = process.cwd(); var command; var args; var base; var destDir; var destFile; var compileMappings; // redundant but necessary stream._read = function () {}; options = assign({}, options); options.container = options.container || 'gulp-ruby-sass'; // sourcemap can only be true or false; warn those trying to pass a Sass string option if (typeof options.sourcemap === 'string') { throw newErr('The sourcemap option must be true or false. See the readme for instructions on using Sass sourcemaps with gulp.'); } options.sourcemap = options.sourcemap ? 'file' : 'none'; // directory source if (path.extname(source) === '') { base = path.join(cwd, source); destDir = slash(path.join(osTempDir, options.container)); // sass options need unix style slashes compileMappings = source + ':' + destDir; options.update = true; } // single file source else { base = path.join(cwd, path.dirname(source)); destDir = path.join(osTempDir, options.container); destFile = slash(path.join(destDir, path.basename(source, path.extname(source)) + '.css')); // sass options need unix style slashes compileMappings = [ source, destFile ]; mkdirp(destDir); } // TODO: implement glob file source args = dargs(options, [ 'bundleExec', 'watch', 'poll', 'container' ]).concat(compileMappings); if (options.bundleExec) { command = 'bundle'; args.unshift('exec', 'sass'); } else { command = 'sass'; } // temporary logging until gulp adds its own if (process.argv.indexOf('--verbose') !== -1) { gutil.log('gulp-ruby-sass:', 'Running command:', chalk.blue(command, args.join(' '))); } // error handling var matchNoSass = /execvp\(\): No such file or directory|spawn ENOENT/; var msgNoSass = 'Missing the Sass executable. Please install and make available on your PATH.'; var matchSassErr = /error\s/; var matchNoBundler = /ERROR: Gem bundler is not installed/; var matchNoGemfile = /Could not locate Gemfile/; var matchNoBundledSass = /bundler: command not found: sass|Could not find gem/; var sass = spawn(command, args); sass.stdout.setEncoding('utf8'); sass.stderr.setEncoding('utf8'); // sass stdout: successful compile messages // bundler stdout: bundler not installed, no gemfile, correct version of sass not installed sass.stdout.on('data', function (data) { var msg = formatMsg(data, destDir); var isError = [ matchSassErr, matchNoBundler, matchNoGemfile, matchNoBundledSass ].some(function (match) { return match.test(msg); }); if (isError) { stream.emit('error', newErr(msg)); } else { gutil.log('gulp-ruby-sass stdout:', msg); } }); // sass stderr: warnings, debug statements // bundler stderr: no version of sass installed // spawn stderr: no sass executable sass.stderr.on('data', function (data) { var msg = formatMsg(data, destDir); if (matchNoBundledSass.test(msg)) { stream.emit('error', newErr(msg)); } else if (!matchNoSass.test(msg)) { gutil.log('gulp-ruby-sass stderr:', msg); } }); // spawn error: no sass executable sass.on('error', function (err) { if (matchNoSass.test(err)) { err.message = msgNoSass; } stream.emit('error', newErr(err)); }); sass.on('close', function (code) { // TODO: Here be dragons. Right now we grab all files in the directory. This // will have to grab x files based on the task source glob. glob(path.join(destDir, '**', '*'), function (err, files) { if (err) { stream.emit('error', new gutil.PluginError('gulp-ruby-sass', err)); } eachAsync(files, function (file, i, next) { if (fs.statSync(file).isDirectory() || path.extname(file) === '.map') { next(); return; } fs.readFile(file, function (err, data) { if (err) { stream.emit('error', new gutil.PluginError('gulp-ruby-sass', err)); next(); return; } // rewrite file paths so gulp thinks the file came from the cwd, not // the temp directory var vinylFile = new File({ cwd: cwd, base: base, path: file.replace(destDir, base) }); var sourcemap; if (options.sourcemap === 'file' && path.extname(file) === '.css' && fs.existsSync(file + '.map')) { // remove Sass sourcemap comment; gulp-sourcemaps will add it back in data = new Buffer( convert.removeMapFileComments(data.toString()) ); sourcemap = JSON.parse(fs.readFileSync(file + '.map', 'utf8')); // create relative paths for sources sourcemap.sources = sourcemap.sources.map(function (sourcemapSource) { var absoluteSourcePath = sourcemapSource.replace('file://', ''); return path.relative(base, absoluteSourcePath); }); vinylFile.sourceMap = sourcemap; } vinylFile.contents = data; stream.push(vinylFile); next(); return; }); }, function () { // cleanup previously generated files for next run // TODO: This kills caching. Keeping will push files through that are not in // the current gulp.src. We need to decide whether to use a Sass style caching // strategy, or a gulp style strategy, and what each would look like. rimraf(destDir, function () { stream.push(null); }); }); }); }); return stream; };
return paths.filter(function(path) { return (!useDotFilter || dotFilter(path)) && (!useJunkFilter || junkFilter(path)) && (!filter || (maximatch(slash(path), filter, options).length > 0)); });
function hostFlags(specFile) { return `-wasm -args ${slash(path.relative(rlRoot, specFile))} -endargs`; }
stream.has = function (relativePath) { return slash(relativePath) in cache; };
sourceMap.sources = sourceMap.sources.map(function (source) { var sourceBase = source.replace(/\.\.\//g, ''); // normalize to browser style paths if we're on windows return slash(path.join(stepUp, relativePath, sourceBase)); });
module.exports = function (source, options) { var stream = new Readable({objectMode: true}); var cwd = process.cwd(); var defaults = { container: 'gulp-ruby-sass', verbose: false, sourcemap: false }; var command; var args; var base; var tempDir; var destFile; var compileMappings; // redundant but necessary stream._read = function () {}; options = assign(defaults, options); // sourcemap can only be true or false; warn those trying to pass a Sass string option if (typeof options.sourcemap !== 'boolean') { throw newErr('The sourcemap option must be true or false. See the readme for instructions on using Sass sourcemaps with gulp.'); } // reassign options.sourcemap boolean to one of our two acceptable Sass arguments options.sourcemap = options.sourcemap === true ? 'file' : 'none'; // sass options need unix style slashes tempDir = slash(path.join(osTempDir, options.container)); // directory source if (path.extname(source) === '') { base = path.join(cwd, source); compileMappings = source + ':' + tempDir; options.update = true; } // single file source else { base = path.join(cwd, path.dirname(source)); destFile = slash(path.join(tempDir, path.basename(source, path.extname(source)) + '.css')); // sass options need unix style slashes compileMappings = [ source, destFile ]; mkdirp(tempDir); } // TODO: implement glob file source args = dargs(options, [ 'bundleExec', 'watch', 'poll', 'container', 'verbose' ]).concat(compileMappings); if (options.bundleExec) { command = 'bundle'; args.unshift('exec', 'sass'); } else { command = 'sass'; } // plugin logging if (options.verbose) { logger.verbose(command, args); } var sass = spawn(command, args); sass.stdout.setEncoding('utf8'); sass.stderr.setEncoding('utf8'); sass.stdout.on('data', function (data) { logger.stdout(data, tempDir, stream); }); sass.stderr.on('data', function (data) { logger.stderr(data, tempDir, stream); }); sass.on('error', function (err) { logger.error(err, stream); }); sass.on('close', function (code) { glob(path.join(tempDir, '**', '*'), function (err, files) { if (err) { stream.emit('error', new gutil.PluginError('gulp-ruby-sass', err)); } eachAsync(files, function (file, i, next) { if (fs.statSync(file).isDirectory() || path.extname(file) === '.map') { next(); return; } fs.readFile(file, function (err, data) { if (err) { stream.emit('error', new gutil.PluginError('gulp-ruby-sass', err)); next(); return; } // rewrite file paths so gulp thinks the files came from cwd, not the // OS temp directory var vinylFile = new File({ cwd: cwd, base: base, path: file.replace(tempDir, base) }); var sourcemap; // if we are managing sourcemaps and the sourcemap exists if (options.sourcemap === 'file' && fs.existsSync(file + '.map')) { // remove Sass sourcemap comment; gulp-sourcemaps will add it back in data = new Buffer( convert.removeMapFileComments(data.toString()) ); sourcemap = JSON.parse(fs.readFileSync(file + '.map', 'utf8')); // create relative paths for sources sourcemap.sources = sourcemap.sources.map(function (sourcemapSource) { var absoluteSourcePath = decodeURI(path.resolve('/', sourcemapSource.replace('file:///', ''))) return path.relative(base, absoluteSourcePath); }); vinylFile.sourceMap = sourcemap; } vinylFile.contents = data; stream.push(vinylFile); next(); return; }); }, function () { // cleanup previously generated files for next run // TODO: This kills caching. Keeping will push files through that are not in // the current gulp.src. We need to decide whether to use a Sass style caching // strategy, or a gulp style strategy, and what each would look like. rimraf(tempDir, function () { stream.push(null); }); }); }); }); return stream; };
assets.styles = assets.styles.concat(boilerplate.styles.map(function (style) { return slash(path.relative(_this.root, path.resolve(dir, style))); }));
const filePaths = files.map(file => slash(path.relative(opts.cwd, path.resolve(opts.cwd, file))));
ComponentHelper.prototype.getClientAssets = function (dir) { var boilerplatePath = path.resolve(dir, 'component.json'), releasePath = path.resolve(dir, this.releaseDirName), _this = this, styles, filePath, boilerplate; var assets = { scripts: [], styles: [] }; // If the component has its own component.json if (fs.existsSync(boilerplatePath)) { boilerplate = utils.safeRequire(boilerplatePath); if (boilerplate) { if (boilerplate.scripts && _.isArray(boilerplate.scripts)) { assets.scripts = assets.scripts.concat(boilerplate.scripts.map(function (script) { return slash(path.relative(_this.root, path.resolve(dir, script))); })); } if (boilerplate.styles && _.isArray(boilerplate.styles)) { assets.styles = assets.styles.concat(boilerplate.styles.map(function (style) { return slash(path.relative(_this.root, path.resolve(dir, style))); })); } } } // If the component has been pre-built else if (fs.existsSync(releasePath)) { // We expect to find a main.css and main.js in the release directory // main.js should already include all templates, precompiled assets.scripts.push(slash(path.relative(_this.root, path.resolve(releasePath, this.rootFileName + '.js')))); assets.styles.push(slash(path.relative(_this.root, path.resolve(releasePath, this.rootFileName + '.css')))); } // Standard component else { // We expect to find a main.js in the scripts directory, and a main.{less,scss} in // the styles directory filePath = path.resolve(dir, this.scriptsDirName, this.rootFileName + '.js'); if (fs.existsSync(filePath)) { assets.scripts.push(slash(path.relative(_this.root, filePath))); } styles = path.resolve(dir, this.stylesDirName); if (fs.existsSync(styles)) { fs.readdirSync(styles).some(function (style) { if (path.basename(style).indexOf('main.') !== -1) { filePath = path.resolve(styles, style); if (fs.statSync(filePath).isFile()) { assets.styles.push(slash(path.relative(_this.root, filePath))); return true; } } return false; }); } } return assets; };
assets.scripts = assets.scripts.concat(boilerplate.scripts.map(function (script) { return slash(path.relative(_this.root, path.resolve(dir, script))); }));
assets.helpers = glob.sync(path.resolve(helpersDir, this.helpersGlobPattern)).map(function (dir) { return slash(path.relative(_this.root, dir)); });
it('returns the root path', () => { const rootByProcess = slash(process.cwd()); expect(BabelRootImportHelper().root).to.equal(rootByProcess); });
it('transforms path as relative root-path with / rootPathSuffix', () => { const rootPath = slash(`${process.cwd()}/some/path`); const result = BabelRootImportHelper().transformRelativeToRootPath('/some/path', null, '/'); expect(result).to.equal(rootPath); });
return function (filepath) { filepath = config_1.ENV === 'prod' ? filepath.replace("/" + config_1.APP_DEST, '') : filepath; arguments[0] = path_1.join(config_1.APP_BASE, filepath) + ("?" + Date.now()); return slash(plugins.inject.transform.apply(plugins.inject.transform, arguments)); };
it('transforms given path relative root-path', () => { const rootPath = slash(`${process.cwd()}/some/path`); const result = transformRelativeToRootPath('~/some/path'); expect(result).to.equal(rootPath); });
fs.writeFileSync = jest.fn((path, data, options) => { expect(options).toBe('utf8'); const normalizedPath = slash(path); mockFs[normalizedPath] = data; });
return p => ignores.ignores(slash(path.relative(cwd, p)));
}, function (tempDir, cb, vinylFiles) { // all paths passed to sass must have unix path separators tempDir = slash(tempDir); var compileDir = slash(path.join(tempDir, relativeCompileDir)); options = options || {}; options.update = true; options.loadPath = typeof options.loadPath === 'undefined' ? [] : [].concat(options.loadPath); // add loadPaths for each temp file vinylFiles.forEach(function (file) { var loadPath = slash(path.dirname(path.relative(procDir, file.path))); if (options.loadPath.indexOf(loadPath) === -1) { options.loadPath.push(loadPath); } }); var command; var args = dargs(options, [ 'bundleExec', 'watch', 'poll', 'sourcemapPath', 'container' ]); args.push(tempDir + ':' + compileDir); if (options.bundleExec) { command = 'bundle'; args.unshift('exec', 'sass'); } else { command = 'sass'; } // temporary logging until gulp adds its own if (process.argv.indexOf('--verbose') !== -1) { gutil.log('gulp-ruby-sass:', 'Running command:', chalk.blue(command, args.join(' '))); } var sass = spawn(command, args); sass.stdout.setEncoding('utf8'); sass.stderr.setEncoding('utf8'); sass.stdout.on('data', function (data) { var msg = removePaths(data, [tempDir, relativeCompileDir]).trim(); if (sassErrMatcher.test(msg) || noBundlerMatcher.test(msg) || noGemfileMatcher.test(msg)) { stream.emit('error', createErr(msg, {showStack: false})); } else if (noBundleSassMatcher.test(msg)) { stream.emit('error', createErr(bundleErrMsg, {showStack: false})); } else { gutil.log('gulp-ruby-sass:', msg); } }); sass.stderr.on('data', function (data) { var msg = removePaths(data, [tempDir, relativeCompileDir]).trim(); if (noBundleSassMatcher.test(msg)) { stream.emit('error', createErr(bundleErrMsg, {showStack: false})); } else if (!noSassMatcher.test(msg)) { gutil.log('gulp-ruby-sass: stderr:', msg); } }); sass.on('error', function (err) { if (noSassMatcher.test(err.message)) { stream.emit('error', createErr(noSassErrMsg, {showStack: false})); } else { stream.emit('error', createErr(err)); } }); sass.on('close', function (code) { if (options.sourcemap && options.sourcemapPath) { rewriteSourcemapPaths(compileDir, options.sourcemapPath, function (err) { if (err) { stream.emit('error', createErr(err)); } cb(); }); } else { cb(); } }); });
function getUnixPath(windowsPath) { var unixPath = slash('/' + windowsPath.replace(':','')); unixPath = unixPath.substring(0,1).toUpperCase() + unixPath.substring(1, unixPath.length); return unixPath; }
}, function (fileNames) { if (fileNames === undefined) { dialog.showErrorBox(i18n.__('title.error'), i18n.__('error.loading.no_file')); return; } var fileName = slash(fileNames[0]); // Get a list of matching files glob("*/*-*/*h*.vwi", { cwd: fileName, nocase: true }, function (err, matches) { if (matches.length == 0) { dialog.showErrorBox(i18n.__('title.error'), i18n.__('error.loading.not_valid')); return; } // Treat each file matches.forEach(function (match) { console.log("Treating: " + match); var year = match.substring(0, 4); var month = match.substring(5, 7); var day = match.substring(8, 10); var hour = match.substring(11, 13); var minutes = match.substring(14, 16); var date = new Date(year, month, day, hour, minutes, 0, 0); var weight, level, calories, duration, cardiac; // Parse each lines var lines = fs.readFileSync(path.join(fileName, match)).toString().split("\n"); lines.forEach(function (line) { var keyValue = line.split(':'); switch (keyValue[0]) { case "Weight": weight = parseInt(keyValue[1]); break; case "Level": level = parseInt(keyValue[1]); break; case "Calories": calories = parseInt(keyValue[1]); break; case "Duration": duration = parseFloat(keyValue[1]); break; case "Cardiac": cardiac = keyValue[1].split(',').map(Number); break; default: console.log("add the track"); // Create & add the track var track = new Track(date, weight, level, calories, duration, cardiac); trackList.push(track); break; } }); console.log(trackList.length + " vs " + matches.length); if (trackList.length === matches.length) { // Finished processing files currentTrack = trackList.length-1; console.log(trackList.length + " items processed."); isDataLoaded = true; $("#no-file-loaded").css("display", "none"); refreshData(true); } }); }); });
function playerjoinfunction( event ){ var slash = require('slash'); slash([ 'broadcast [Your Message Here]' ], server); }
function getBaselinePath(specFile) { return `${slash(path.relative(rlRoot, path.join(baselineDir, path.basename(specFile, path.extname(specFile)))))}.baseline`; }
normalizeOptions(opts: Object) { opts = assign({}, opts); if (opts.filename) { var rcFilename = opts.filename; if (!isAbsolute(rcFilename)) rcFilename = path.join(process.cwd(), rcFilename); opts = resolveRc(rcFilename, opts); } // for (let key in opts) { if (key[0] === "_") continue; let option = File.options[key]; if (!option) this.log.error(`Unknown option: ${key}`, ReferenceError); } var envKey = process.env.BABEL_ENV || process.env.NODE_ENV || "development"; if (opts.env) merge(opts, opts.env[envKey]); for (let key in File.options) { let option = File.options[key]; var val = opts[key]; if (!val && option.optional) continue; if (val && option.deprecated) { throw new Error("Deprecated option " + key + ": " + option.deprecated); } if (val == null) { val = clone(option.default); } var optionParser = optionParsers[option.type]; if (optionParser) val = optionParser(key, val, this.pipeline); if (option.alias) { opts[option.alias] = opts[option.alias] || val; } else { opts[key] = val; } } if (opts.inputSourceMap) { opts.sourceMaps = true; } // normalize windows path separators to unix opts.filename = slash(opts.filename); if (opts.sourceRoot) { opts.sourceRoot = slash(opts.sourceRoot); } if (opts.moduleId) { opts.moduleIds = true; } opts.basename = path.basename(opts.filename, path.extname(opts.filename)); opts.ignore = util.arrayify(opts.ignore, util.regexify); opts.only = util.arrayify(opts.only, util.regexify); defaults(opts, { moduleRoot: opts.sourceRoot }); defaults(opts, { sourceRoot: opts.moduleRoot }); defaults(opts, { filenameRelative: opts.filename }); defaults(opts, { sourceFileName: opts.filenameRelative, sourceMapName: opts.filenameRelative }); // if (opts.externalHelpers) { this.set("helpersNamespace", t.identifier("babelHelpers")); } return opts; };
.then(function (stat) { stat.path = slash(path); return stat; });
var fs = require("fs-extra") , slash = require('slash') var vashStatic = require("./index.js") var MAIN_DIR = slash(__dirname + "/") , TEST_RES = MAIN_DIR + "test-resources/" , TEMP_DIR = MAIN_DIR + "dist/tmp/" , CACHE_PATH = TEMP_DIR + "precompiled-vash.json" , PAGE_TYPE = "page" /* * Creating a template cache */ var step1 = function(cb) { vashStatic.precompileTemplateCache({ file: TEST_RES + PAGE_TYPE + "/about/Index.vash" // path to template you want to precompile , debugMode: true // for development should be true, but production should be false (or omitted) to keep file size down , dirTypes: [PAGE_TYPE] // Module type is 'pg' (page), which is matched against the containing directory name (eg "app/pg/home/Index.vash") , modelsPath: TEST_RES + "models.js" // Optionally prepend a JS file containing models used to render the templates. }, function(success, tmpl) { if(success) { var cache = {}; cache[ tmpl.name ] = tmpl.contents; fs.outputFileSync(CACHE_PATH, JSON.stringify(cache)) cb(); } }) }
const windowsToWSLPath = p => { const noSlashes = slash(p); return noSlashes.slice(2, noSlashes.length); };
.map(function (path) { return path_1.join(target, slash(path).split('/').pop()); }));
/** * Fixup slashes in file paths for windows * @param {string} str * @return {string} */ function normalizePath(str) { return process.platform === 'win32' ? slash(str) : str; }
File.prototype.normalizeOptions = function (opts) { opts = assign({}, opts); for (var key in opts) { if (key[0] !== "_" && File.validOptions.indexOf(key) < 0) { throw new ReferenceError("Unknown option: " + key); } } defaults(opts, { keepModuleIdExtensions: false, resolveModuleSource: null, externalHelpers: false, auxilaryComment: "", experimental: false, reactCompat: false, playground: false, moduleIds: false, blacklist: [], whitelist: [], sourceMap: false, optional: [], comments: true, filename: "unknown", modules: "common", compact: "auto", loose: [], code: true, ast: true }); // normalize windows path separators to unix opts.filename = slash(opts.filename); if (opts.sourceRoot) { opts.sourceRoot = slash(opts.sourceRoot); } if (opts.moduleId) { opts.moduleIds = true; } opts.basename = path.basename(opts.filename, path.extname(opts.filename)); opts.blacklist = util.arrayify(opts.blacklist); opts.whitelist = util.arrayify(opts.whitelist); opts.optional = util.arrayify(opts.optional); opts.compact = util.booleanify(opts.compact); opts.loose = util.arrayify(opts.loose); if (includes(opts.loose, "all") || includes(opts.loose, true)) { opts.loose = Object.keys(transform.transformers); } defaults(opts, { moduleRoot: opts.sourceRoot }); defaults(opts, { sourceRoot: opts.moduleRoot }); defaults(opts, { filenameRelative: opts.filename }); defaults(opts, { sourceFileName: opts.filenameRelative, sourceMapName: opts.filenameRelative }); if (opts.playground) { opts.experimental = true; } if (opts.externalHelpers) { this.set("helpersNamespace", t.identifier("babelHelpers")); } opts.blacklist = transform._ensureTransformerNames("blacklist", opts.blacklist); opts.whitelist = transform._ensureTransformerNames("whitelist", opts.whitelist); opts.optional = transform._ensureTransformerNames("optional", opts.optional); opts.loose = transform._ensureTransformerNames("loose", opts.loose); if (opts.reactCompat) { opts.optional.push("reactCompat"); console.error("The reactCompat option has been moved into the optional transformer `reactCompat`"); } var ensureEnabled = function (key) { var namespace = transform.transformerNamespaces[key]; if (namespace === "es7") opts.experimental = true; if (namespace === "playground") opts.playground = true; }; each(opts.whitelist, ensureEnabled); each(opts.optional, ensureEnabled); return opts; };