systemjs-plugin-babel
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -6,3 +6,3 @@ (function (global) { | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
@@ -53,2 +53,182 @@ | ||
babelHelpers.asyncIterator = function (iterable) { | ||
if (typeof Symbol === "function") { | ||
if (Symbol.asyncIterator) { | ||
var method = iterable[Symbol.asyncIterator]; | ||
if (method != null) return method.call(iterable); | ||
} | ||
if (Symbol.iterator) { | ||
return iterable[Symbol.iterator](); | ||
} | ||
} | ||
throw new TypeError("Object is not async iterable"); | ||
}; | ||
babelHelpers.asyncGenerator = function () { | ||
function AwaitValue(value) { | ||
this.value = value; | ||
} | ||
function AsyncGenerator(gen) { | ||
var front, back; | ||
function send(key, arg) { | ||
return new Promise(function (resolve, reject) { | ||
var request = { | ||
key: key, | ||
arg: arg, | ||
resolve: resolve, | ||
reject: reject, | ||
next: null | ||
}; | ||
if (back) { | ||
back = back.next = request; | ||
} else { | ||
front = back = request; | ||
resume(key, arg); | ||
} | ||
}); | ||
} | ||
function resume(key, arg) { | ||
try { | ||
var result = gen[key](arg); | ||
var value = result.value; | ||
if (value instanceof AwaitValue) { | ||
Promise.resolve(value.value).then(function (arg) { | ||
resume("next", arg); | ||
}, function (arg) { | ||
resume("throw", arg); | ||
}); | ||
} else { | ||
settle(result.done ? "return" : "normal", result.value); | ||
} | ||
} catch (err) { | ||
settle("throw", err); | ||
} | ||
} | ||
function settle(type, value) { | ||
switch (type) { | ||
case "return": | ||
front.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
break; | ||
case "throw": | ||
front.reject(value); | ||
break; | ||
default: | ||
front.resolve({ | ||
value: value, | ||
done: false | ||
}); | ||
break; | ||
} | ||
front = front.next; | ||
if (front) { | ||
resume(front.key, front.arg); | ||
} else { | ||
back = null; | ||
} | ||
} | ||
this._invoke = send; | ||
if (typeof gen.return !== "function") { | ||
this.return = undefined; | ||
} | ||
} | ||
if (typeof Symbol === "function" && Symbol.asyncIterator) { | ||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () { | ||
return this; | ||
}; | ||
} | ||
AsyncGenerator.prototype.next = function (arg) { | ||
return this._invoke("next", arg); | ||
}; | ||
AsyncGenerator.prototype.throw = function (arg) { | ||
return this._invoke("throw", arg); | ||
}; | ||
AsyncGenerator.prototype.return = function (arg) { | ||
return this._invoke("return", arg); | ||
}; | ||
return { | ||
wrap: function (fn) { | ||
return function () { | ||
return new AsyncGenerator(fn.apply(this, arguments)); | ||
}; | ||
}, | ||
await: function (value) { | ||
return new AwaitValue(value); | ||
} | ||
}; | ||
}(); | ||
babelHelpers.asyncGeneratorDelegate = function (inner, awaitWrap) { | ||
var iter = {}, | ||
waiting = false; | ||
function pump(key, value) { | ||
waiting = true; | ||
value = new Promise(function (resolve) { | ||
resolve(inner[key](value)); | ||
}); | ||
return { | ||
done: false, | ||
value: awaitWrap(value) | ||
}; | ||
} | ||
; | ||
if (typeof Symbol === "function" && Symbol.iterator) { | ||
iter[Symbol.iterator] = function () { | ||
return this; | ||
}; | ||
} | ||
iter.next = function (value) { | ||
if (waiting) { | ||
waiting = false; | ||
return value; | ||
} | ||
return pump("next", value); | ||
}; | ||
if (typeof inner.throw === "function") { | ||
iter.throw = function (value) { | ||
if (waiting) { | ||
waiting = false; | ||
throw value; | ||
} | ||
return pump("throw", value); | ||
}; | ||
} | ||
if (typeof inner.return === "function") { | ||
iter.return = function (value) { | ||
return pump("return", value); | ||
}; | ||
} | ||
return iter; | ||
}; | ||
babelHelpers.asyncToGenerator = function (fn) { | ||
@@ -71,5 +251,5 @@ return function () { | ||
return Promise.resolve(value).then(function (value) { | ||
return step("next", value); | ||
step("next", value); | ||
}, function (err) { | ||
return step("throw", err); | ||
step("throw", err); | ||
}); | ||
@@ -76,0 +256,0 @@ } |
@@ -18,5 +18,5 @@ export default (function (fn) { | ||
return Promise.resolve(value).then(function (value) { | ||
return step("next", value); | ||
step("next", value); | ||
}, function (err) { | ||
return step("throw", err); | ||
step("throw", err); | ||
}); | ||
@@ -23,0 +23,0 @@ } |
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; | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; |
{ | ||
"name": "systemjs-plugin-babel", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"registry": "npm", | ||
"jspmPackage": true, | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/systemjs/plugin-babel.git" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/systemjs/plugin-babel/issues" | ||
}, | ||
"homepage": "https://github.com/systemjs/plugin-babel", | ||
"scripts": { | ||
@@ -7,0 +16,0 @@ "build": "./build.sh", |
@@ -130,3 +130,3 @@ var babel = require('systemjs-babel-build').babel; | ||
} | ||
if (babelOptions.es2015) | ||
@@ -176,3 +176,3 @@ presets.push((outputESM || load.metadata.format == 'cjs') ? es2015 : es2015Register); | ||
moduleIds: false, | ||
sourceMaps: babelOptions.sourceMaps, | ||
sourceMaps: traceOpts && traceOpts.sourceMaps || babelOptions.sourceMaps, | ||
inputSourceMap: load.metadata.sourceMap, | ||
@@ -220,2 +220,1 @@ compact: babelOptions.compact, | ||
}; | ||
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
2496873
39
50547
2
2