systemjs-plugin-babel
Advanced tools
Comparing version 0.0.2 to 0.0.3
(function (global) { | ||
var babelHelpers = global.babelHelpers = {}; | ||
babelHelpers.typeof = function (obj) { | ||
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}; | ||
babelHelpers.jsx = (function () { | ||
babelHelpers.jsx = function () { | ||
var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7; | ||
@@ -49,3 +50,3 @@ return function createRawReactElement(type, props, key, children) { | ||
}; | ||
})(); | ||
}(); | ||
@@ -68,6 +69,6 @@ babelHelpers.asyncToGenerator = function (fn) { | ||
} else { | ||
Promise.resolve(value).then(function (value) { | ||
step("next", value); | ||
return Promise.resolve(value).then(function (value) { | ||
return step("next", value); | ||
}, function (err) { | ||
step("throw", err); | ||
return step("throw", err); | ||
}); | ||
@@ -77,3 +78,3 @@ } | ||
step("next"); | ||
return step("next"); | ||
}); | ||
@@ -89,3 +90,3 @@ }; | ||
babelHelpers.createClass = (function () { | ||
babelHelpers.createClass = function () { | ||
function defineProperties(target, props) { | ||
@@ -106,3 +107,3 @@ for (var i = 0; i < props.length; i++) { | ||
}; | ||
})(); | ||
}(); | ||
@@ -290,3 +291,3 @@ babelHelpers.defineEnumerableProperties = function (obj, descs) { | ||
babelHelpers.slicedToArray = (function () { | ||
babelHelpers.slicedToArray = function () { | ||
function sliceIterator(arr, i) { | ||
@@ -327,3 +328,3 @@ var _arr = []; | ||
}; | ||
})(); | ||
}(); | ||
@@ -330,0 +331,0 @@ babelHelpers.slicedToArrayLoose = function (arr, i) { |
@@ -17,6 +17,6 @@ export default (function (fn) { | ||
} else { | ||
Promise.resolve(value).then(function (value) { | ||
step("next", value); | ||
return Promise.resolve(value).then(function (value) { | ||
return step("next", value); | ||
}, function (err) { | ||
step("throw", err); | ||
return step("throw", err); | ||
}); | ||
@@ -26,5 +26,5 @@ } | ||
step("next"); | ||
return step("next"); | ||
}); | ||
}; | ||
}) |
@@ -1,2 +0,2 @@ | ||
export default (function () { | ||
export default function () { | ||
function defineProperties(target, props) { | ||
@@ -17,2 +17,2 @@ for (var i = 0; i < props.length; i++) { | ||
}; | ||
})(); | ||
}(); |
@@ -1,2 +0,2 @@ | ||
export default (function () { | ||
export default function () { | ||
var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7; | ||
@@ -42,2 +42,2 @@ return function createRawReactElement(type, props, key, children) { | ||
}; | ||
})(); | ||
}(); |
@@ -1,2 +0,2 @@ | ||
export default (function () { | ||
export default function () { | ||
function sliceIterator(arr, i) { | ||
@@ -37,2 +37,2 @@ var _arr = []; | ||
}; | ||
})(); | ||
}(); |
@@ -1,3 +0,5 @@ | ||
export default (function (obj) { | ||
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}) | ||
export default typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}; |
{ | ||
"name": "systemjs-plugin-babel", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"registry": "npm", | ||
@@ -5,0 +5,0 @@ "jspmPackage": true, |
@@ -8,2 +8,3 @@ var babel = require('systemjs-babel-build').babel; | ||
var stage3 = require('systemjs-babel-build').presetStage3; | ||
var stage2 = require('systemjs-babel-build').presetStage2; | ||
@@ -18,2 +19,7 @@ var externalHelpers = require('systemjs-babel-build').externalHelpers; | ||
if (babelRuntimePath.substr(babelRuntimePath.length - 3, 3) == '.js') | ||
babelRuntimePath = babelRuntimePath.substr(0, babelRuntimePath.length - 3); | ||
if (modularHelpersPath.substr(modularHelpersPath.length - 3, 3) == '.js') | ||
modularHelpersPath = modularHelpersPath.substr(0, modularHelpersPath.length - 3); | ||
// in builds we want to embed canonical names to helpers | ||
@@ -40,8 +46,8 @@ if (System.getCanonicalName) { | ||
* modularRuntime: true / false (whether to use babel-runtime or babel/external-helpers respectively) | ||
* sourceMaps: true / false (defaults to true) Not working pending https://phabricator.babeljs.io/T6903 | ||
* sourceMaps: true / false (defaults to true) | ||
* es2015: true / false (defaults to true) | ||
* stage3: true / false (defaults to true) | ||
* stage2: true / false (defaults to true) | ||
* plugins: array of custom plugins (objects or module name strings) | ||
* presets: array of custom presets (objects or module name strings) | ||
* moduleName: true / false (whether to set __moduleName, defaults to false) needed pending https://phabricator.babeljs.io/T6899 | ||
* | ||
@@ -55,3 +61,3 @@ * babelOptions can be set at SystemJS.babelOptions OR on the metadata object for a given module | ||
stage3: true, | ||
moduleName: false | ||
stage2: true | ||
}; | ||
@@ -90,2 +96,4 @@ | ||
pluginAndPresetModuleLoads.push(pluginLoader['import'](plugin, module.id)); | ||
else if (plugin instanceof Array && typeof plugin[0] == 'string') | ||
pluginAndPresetModuleLoads.push(pluginLoader['import'](plugin[0], module.id)); | ||
}); | ||
@@ -103,2 +111,5 @@ | ||
if (babelOptions.stage2) | ||
presets.push(stage2); | ||
if (babelOptions.modularRuntime) { | ||
@@ -119,3 +130,3 @@ if (load.metadata.format == 'cjs') | ||
presets.push((loader.builder || load.metadata.format == 'cjs') ? es2015 : es2015Register); | ||
else | ||
else if (!(loader.builder || load.metadata.format == 'cjs')) | ||
presets.push(modulesRegister); | ||
@@ -135,2 +146,4 @@ | ||
plugins.push(pluginAndPresetModules[curPluginOrPresetModule++]); | ||
else if (plugin instanceof Array && typeof plugin[0] == 'string') | ||
plugins.push([pluginAndPresetModules[curPluginOrPresetModule++], plugin[1]]); | ||
else | ||
@@ -141,9 +154,10 @@ plugins.push(plugin); | ||
var output = babel.transform(load.source, { | ||
babelrc: false, | ||
plugins: plugins, | ||
presets: presets, | ||
filename: load.address, | ||
sourceMap: babelOptions.sourceMap, | ||
sourceMaps: babelOptions.sourceMaps, | ||
inputSourceMap: load.metadata.sourceMap, | ||
code: true, | ||
ast: false, | ||
ast: true, | ||
resolveModuleSource: function(m) { | ||
@@ -176,8 +190,5 @@ if (m.substr(0, 22) == 'babel-runtime/helpers/') { | ||
if (loader.builder || !babelOptions.moduleName) | ||
return output.code; | ||
else | ||
return '(function(__moduleName){' + output.code + '\n})("' + load.name + '");'; | ||
return output.code; | ||
}); | ||
}; | ||
@@ -28,2 +28,4 @@ SystemJS Babel Plugin | ||
**This plugin is compatible with jspm 0.17 beta, but is not supported in jspm 0.16.** | ||
``` | ||
@@ -82,5 +84,19 @@ jspm install plugin-babel | ||
You can pass options to Babel plugins the same way as in Node, without creating custom presets. | ||
```javascript | ||
SystemJS.config({ | ||
babelOptions: { | ||
plugins: [ | ||
[ "react-transform", { | ||
"transforms": [{"transform": "react-transform-jspm-hmr"}] | ||
}] | ||
] | ||
} | ||
}); | ||
``` | ||
LICENSE | ||
--- | ||
MIT | ||
MIT |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2207309
44050
101
11
2