How to use the traceur.RUNTIME_PATH function in traceur

To help you get started, we’ve selected a few traceur examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ggoodman / plunker-run-plugin / adapters / transformers / es6.js View on Github external
var Fs = require("fs");
var Traceur = require("traceur");

var compileOptions = {
    annotations: true,
    memberVariables: true,
    modules: "instantiate",
    typeAssertions: false,
    // typeAssertionModule: 'rtts_assert/rtts_assert',
    types: true
};

var compiler = new Traceur.NodeCompiler(compileOptions);
var runtime = Fs.readFileSync(Traceur.RUNTIME_PATH, "utf8");

module.exports = {
  matches: /\.js$/,
  provides: ".es6.js",
  transform: function (request, reply) {
    try {
      var result = compiler.compile(request.content, request.path.replace(/\.es6\.js$/, ""));
      var response = {
        content: /*runtime + "\n\n" + */result,
        encoding: "utf8",
      };
    } catch (err) {
      
      return process.nextTick(function () {
        reply(err);
      });
github angular / angular / tools / transpiler / index.js View on Github external
// Entry point for Node.

var fs = require('fs');
var glob = require('glob');
var path = require('path');
var traceur = require('traceur');
var assert = require('assert');

exports.RUNTIME_PATH = traceur.RUNTIME_PATH;
var TRACEUR_PATH = traceur.RUNTIME_PATH.replace('traceur-runtime.js', 'traceur.js');
var SELF_SOURCE_REGEX = /transpiler\/src/;
var SELF_COMPILE_OPTIONS = {
  modules: 'register',
  memberVariables: false,
  moduleName: true,
  script: false // parse as a module
};

var needsReload = true;
var oldSystemGet = System.get;
var currentOptions;

exports.reloadSources = function() {
  needsReload = true;
};
github angular / angular / tools / transpiler / index.js View on Github external
// Entry point for Node.

var fs = require('fs');
var glob = require('glob');
var path = require('path');
var traceur = require('traceur');
var assert = require('assert');

exports.RUNTIME_PATH = traceur.RUNTIME_PATH;
var TRACEUR_PATH = traceur.RUNTIME_PATH.replace('traceur-runtime.js', 'traceur.js');
var SELF_SOURCE_REGEX = /transpiler\/src/;
var SELF_COMPILE_OPTIONS = {
  modules: 'register',
  memberVariables: false,
  moduleName: true,
  script: false // parse as a module
};

var needsReload = true;
var oldSystemGet = System.get;
var currentOptions;

exports.reloadSources = function() {
  needsReload = true;
};
github ggoodman / plunker-run-plugin / adapters / transformers / traceur.js View on Github external
var Fs = require('fs');
var Traceur = require('traceur');
var _ = require('lodash');

var defaultCompileOptions = {
    annotations: true,
    memberVariables: true,
    modules: 'instantiate',
    typeAssertions: false,
    // typeAssertionModule: 'rtts_assert/rtts_assert',
    types: true
};

var runtime = Fs.readFileSync(Traceur.RUNTIME_PATH, 'utf8');

module.exports = {
  matches: /\.(es6|traceur)\.js$/,
  provides: '.js',
  transform: function (context) {
    var options = _.defaults({}, context.compileOptions, defaultCompileOptions);
    var traceurrc = context.preview.files['.traceurrc'];
    
    if (typeof traceurrc !== 'undefined') {
      try {
        traceurrc = JSON.parse(traceurrc);
        
        _.extend(options, traceurrc);
      } catch (__) {}
    }
github sindresorhus / gulp-traceur / index.js View on Github external
}

			this.push(file);
		} catch (err) {
			const msg = Array.isArray(err) ? err.join('\n') : err;
			this.emit('error', new PluginError('gulp-traceur', msg, {
				fileName: file.path,
				showStack: false
			}));
		}

		cb();
	});
};

module.exports.RUNTIME_PATH = traceur.RUNTIME_PATH;
github domenic / count-to-6 / lib / traceur-processor.js View on Github external
"use strict";
var traceur = require("traceur");
var fs = require("fs");
var q = require("q");
var path = require("path");
var os = require("os");
var rimraf = require("rimraf");

var tmpDir = path.resolve(os.tmpdir(), "_count-to-6_" + process.pid);
var runtimeContents = fs.readFileSync(traceur.RUNTIME_PATH, { encoding: "utf-8" });

module.exports = function (exercise) {
    exercise.addProcessor(processor);
    exercise.addCleanup(cleanup);

    return exercise;
};

function processor(mode, callback) {
    var exercise = this;

    q.nfcall(fs.mkdir, tmpDir).then(function () {
        return q.all([
            writeTranspiled(exercise.submission),
            writeTranspiled(exercise.solution)
        ]);
github handsontable / hot-builder / lib / transformers / es6ify.js View on Github external
'use strict';

var through     =  require('through')
  , crypto      =  require('crypto')
  , path        =  require('path')
  , runtime     =  require.resolve(require('traceur').RUNTIME_PATH)
  , cache       =  {};


var Compiler = require('traceur').NodeCompiler
  , xtend = require('xtend')
  ;

function getHash(data) {
  return crypto
    .createHash('md5')
    .update(data)
    .digest('hex');
}

/**
 * Compile function, exposed to be used from other libraries, not needed when using es6ify as a transform.
github karma-runner / karma-traceur-preprocessor / index.js View on Github external
var initTraceurFramework = function(files) {
  files.unshift({pattern: traceur.RUNTIME_PATH, included: true, served: true, watched: false});
};
github thlorenz / es6ify / index.js View on Github external
'use strict';

var through     =  require('through')
  , compile     =  require('./compile')
  , crypto      =  require('crypto')
  , path        =  require('path')
  , runtime     =  require.resolve(require('traceur').RUNTIME_PATH)
  , cache       =  {};

function getHash(data) {
  return crypto
    .createHash('md5')
    .update(data)
    .digest('hex');
}

/**
 * Compile function, exposed to be used from other libraries, not needed when using es6ify as a transform.
 *
 * @name es6ify::compileFile
 * @function
 * @param {string} file name of the file that is being compiled to ES5
 * @param {string} src source of the file being compiled to ES5
github aaronfrost / grunt-traceur / tasks / traceur.js View on Github external
var RUNTIME_PATH = (function () {
  return require('traceur').RUNTIME_PATH;
})();