Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

systemjs-plugin-babel

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

systemjs-plugin-babel - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

babel-helpers/asyncGenerator.js

186

babel-helpers.js

@@ -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 @@ }

4

babel-helpers/asyncToGenerator.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc