esnext / es6-module-transpiler

Tomorrow’s JavaScript module syntax today
http://esnext.github.io/es6-module-transpiler/
Other
1.21k stars 85 forks source link

separate runtime #116

Closed jonathanong closed 10 years ago

jonathanong commented 10 years ago

regenerator allows you to include the runtime, instead of this module that automatically includes it. silly to add it to every file when it could be just prepended to a built JS file and made global.

i'm particularly talking about this piece of code:

"use strict";
function __es6_transpiler_warn__(warning) {
  if (typeof console === 'undefined') {
  } else if (typeof console.warn === "function") {
    console.warn(warning);
  } else if (typeof console.log === "function") {
    console.log(warning);
  }
}
function __es6_transpiler_build_module_object__(name, imported) {
  var moduleInstanceObject = Object.create ? Object.create(null) : {};
  if (typeof imported === "function") {
    __es6_transpiler_warn__("imported module '"+name+"' exported a function - this may not work as expected");
  }
  for (var key in imported) {
    if (Object.prototype.hasOwnProperty.call(imported, key)) {
      moduleInstanceObject[key] = imported[key];
    }
  }
  if (Object.freeze) {
    Object.freeze(moduleInstanceObject);
  }
  return moduleInstanceObject;
}
eventualbuddha commented 10 years ago

Point taken. It's something that I've been thinking about with esnext as a whole. Now, however, this problem does not really exist with the release of v0.5.1.