Comparing version 0.4.1 to 0.4.2
@@ -8,4 +8,2 @@ "use strict"; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _utils = require("./utils"); | ||
@@ -15,6 +13,4 @@ | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
var initConfig = { | ||
lifeCycle: ["awake", "start"] | ||
lifeCycle: ["_awake", "awake"] | ||
}; | ||
@@ -29,114 +25,5 @@ | ||
_.config = initConfig; | ||
_.hooks._hooks = [function (_ref2) { | ||
var _key = _ref2._key, | ||
_val = _ref2._val, | ||
cp = _ref2.cp; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
_.hooks._hooks = [_plugins._hooks]; | ||
_.hooks._mount = [_plugins._mount]; | ||
try { | ||
for (var _iterator = Object.entries(_val())[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var _ref3 = _step.value; | ||
var _ref4 = _slicedToArray(_ref3, 2); | ||
var key = _ref4[0]; | ||
var val = _ref4[1]; | ||
if (val) { | ||
if (!_.hooks[key]) { | ||
_.hooks[key] = []; | ||
} | ||
_.hooks[key].push(val.bind(cp)); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
}]; | ||
_.hooks._mount = [function (_ref5) { | ||
var _key = _ref5._key, | ||
_val = _ref5._val, | ||
cp = _ref5.cp; | ||
var _$config$lifeCycle = _.config.lifeCycle, | ||
lifeCycle = _$config$lifeCycle === undefined ? [] : _$config$lifeCycle; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator2 = Object.entries(_val)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var _ref6 = _step2.value; | ||
var _ref7 = _slicedToArray(_ref6, 2); | ||
var key = _ref7[0]; | ||
var components = _ref7[1]; | ||
components.forEach(function () { | ||
var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(component) { | ||
var cp, name; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
cp = typeof component === "function" ? component({ _: _ }) : component; | ||
name = cp.name; | ||
_.components[name] = cp; | ||
lifeCycle.forEach(function (key) { | ||
if (key.startsWith("_")) { | ||
cp[key] && cp[key](); | ||
} | ||
}); | ||
_context.next = 6; | ||
return Object.keys(cp).forEach(function (_key) { | ||
if (_key.startsWith("_")) { | ||
(0, _utils.bindHook)({ _: _, _key: _key, cp: cp }); | ||
} | ||
}); | ||
case 6: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, undefined); | ||
})); | ||
return function (_x) { | ||
return _ref8.apply(this, arguments); | ||
}; | ||
}()); | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
}]; | ||
_.$use = function (parms) { | ||
@@ -149,4 +36,7 @@ Object.keys(parms).forEach(function (_key) { | ||
_.$use({ | ||
_mount: { | ||
0: [_plugins.v000] | ||
_hooks: function _hooks() { | ||
return { | ||
_config: _plugins._config, | ||
_command: _plugins._command | ||
}; | ||
} | ||
@@ -153,0 +43,0 @@ }); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.Optional = exports.v001 = exports.v000 = undefined; | ||
exports._data = exports._methods = exports._command = exports._config = exports._mount = exports._hooks = undefined; | ||
@@ -15,155 +15,252 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var v000 = exports.v000 = function v000(_ref) { | ||
var _ = _ref._; | ||
return { | ||
name: "v000", | ||
_hooks: function _hooks() { | ||
var _this = this; | ||
var _hooks = exports._hooks = function _hooks(_ref) { | ||
var _ = _ref._, | ||
_key = _ref._key, | ||
_val = _ref._val, | ||
cp = _ref.cp; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
return { | ||
_config: function _config(_ref2) { | ||
var _key = _ref2._key, | ||
_val = _ref2._val, | ||
cp = _ref2.cp; | ||
try { | ||
for (var _iterator = Object.entries(_val())[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var _ref2 = _step.value; | ||
_.config = (0, _utils.ConfigMerger)(_.config, _val); | ||
}, | ||
_command: function _command(_ref3) { | ||
var _key = _ref3._key, | ||
_val = _ref3._val, | ||
cp = _ref3.cp; | ||
var run = _val.run; | ||
var _ref3 = _slicedToArray(_ref2, 2); | ||
if (run) { | ||
var _$config$lifeCycle = _.config.lifeCycle, | ||
lifeCycle = _$config$lifeCycle === undefined ? [] : _$config$lifeCycle; | ||
var key = _ref3[0]; | ||
var val = _ref3[1]; | ||
Object.values(_.components).forEach(function () { | ||
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(cp) { | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return Object.keys(cp).forEach(function (_key) { | ||
if (!_key.startsWith("_")) { | ||
(0, _utils.bindHook)({ _: _, _key: _key, cp: cp }); | ||
} | ||
}); | ||
if (val) { | ||
if (!_.hooks[key]) { | ||
_.hooks[key] = []; | ||
} | ||
_.hooks[key].push(val.bind(cp)); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
}; | ||
case 2: | ||
var _mount = exports._mount = function _mount(_ref4) { | ||
var _ = _ref4._, | ||
_key = _ref4._key, | ||
_val = _ref4._val, | ||
cp = _ref4.cp; | ||
var _$config$lifeCycle = _.config.lifeCycle, | ||
lifeCycle = _$config$lifeCycle === undefined ? [] : _$config$lifeCycle; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
lifeCycle.forEach(function (key) { | ||
if (!key.startsWith("_")) { | ||
cp[key] && cp[key](); | ||
} | ||
}); | ||
try { | ||
for (var _iterator2 = Object.entries(_val)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var _ref5 = _step2.value; | ||
case 3: | ||
case "end": | ||
return _context.stop(); | ||
var _ref6 = _slicedToArray(_ref5, 2); | ||
var key = _ref6[0]; | ||
var components = _ref6[1]; | ||
components.forEach(function () { | ||
var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(component) { | ||
var cp, name; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
cp = typeof component === "function" ? component({ _: _ }) : component; | ||
name = cp.name; | ||
_.components[name] = cp; | ||
lifeCycle.forEach(function (key) { | ||
if (key.startsWith("_")) { | ||
cp[key] && cp[key](); | ||
} | ||
} | ||
}, _callee, _this); | ||
})); | ||
}); | ||
return function (_x) { | ||
return _ref4.apply(this, arguments); | ||
}; | ||
}()); | ||
} | ||
} | ||
}; | ||
_context.next = 6; | ||
return Object.keys(cp).forEach(function (_key) { | ||
if (_key.startsWith("_")) { | ||
(0, _utils.bindHook)({ _: _, _key: _key, cp: cp }); | ||
} | ||
}); | ||
case 6: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, undefined); | ||
})); | ||
return function (_x) { | ||
return _ref7.apply(this, arguments); | ||
}; | ||
}()); | ||
} | ||
}; | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
}; | ||
var v001 = exports.v001 = function v001(_ref5) { | ||
var _ = _ref5._; | ||
return { | ||
name: "v001", | ||
_hooks: function _hooks() { | ||
return { | ||
_methods: function _methods(_ref6) { | ||
var _key = _ref6._key, | ||
_val = _ref6._val, | ||
cp = _ref6.cp; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var _config = exports._config = function _config(_ref8) { | ||
var _ = _ref8._, | ||
_key = _ref8._key, | ||
_val = _ref8._val, | ||
cp = _ref8.cp; | ||
try { | ||
for (var _iterator = Object.entries(_val)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var _ref7 = _step.value; | ||
_.config = (0, _utils.ConfigMerger)(_.config, _val); | ||
}; | ||
var _command = exports._command = function _command(_ref9) { | ||
var _ = _ref9._, | ||
_key = _ref9._key, | ||
_val = _ref9._val, | ||
cp = _ref9.cp; | ||
var run = _val.run; | ||
var _ref8 = _slicedToArray(_ref7, 2); | ||
if (run) { | ||
var _$config$lifeCycle2 = _.config.lifeCycle, | ||
lifeCycle = _$config$lifeCycle2 === undefined ? [] : _$config$lifeCycle2; | ||
var key = _ref8[0]; | ||
var val = _ref8[1]; | ||
Object.values(_.components).forEach(function () { | ||
var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(cp) { | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.next = 2; | ||
return Object.keys(cp).forEach(function (_key) { | ||
if (!_key.startsWith("_")) { | ||
(0, _utils.bindHook)({ _: _, _key: _key, cp: cp }); | ||
} | ||
}); | ||
if (!cp[key]) { | ||
cp[key] = val.bind(cp); | ||
} else { | ||
console.warn(cp.name + " : \"" + key + "\" in methods is valid, Please use another one"); | ||
} | ||
case 2: | ||
lifeCycle.forEach(function (key) { | ||
if (!key.startsWith("_")) { | ||
cp[key] && cp[key](); | ||
} | ||
}); | ||
case 3: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
}, | ||
_data: function _data(_ref9) { | ||
var _val = _ref9._val, | ||
cp = _ref9.cp; | ||
}, _callee2, undefined); | ||
})); | ||
var props = _val.bind(cp)(); | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
return function (_x2) { | ||
return _ref10.apply(this, arguments); | ||
}; | ||
}()); | ||
} | ||
}; | ||
try { | ||
for (var _iterator2 = Object.entries(props)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var _ref10 = _step2.value; | ||
var _methods = exports._methods = function _methods(_ref11) { | ||
var _ = _ref11._, | ||
_key = _ref11._key, | ||
_val = _ref11._val, | ||
cp = _ref11.cp; | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
var _ref11 = _slicedToArray(_ref10, 2); | ||
try { | ||
for (var _iterator3 = Object.entries(_val)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var _ref12 = _step3.value; | ||
var key = _ref11[0]; | ||
var val = _ref11[1]; | ||
var _ref13 = _slicedToArray(_ref12, 2); | ||
if (!cp[key]) { | ||
cp[key] = val; | ||
} else { | ||
console.warn(cp.name + " : \"" + key + " \" is data is valid, Please use another one"); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
var key = _ref13[0]; | ||
var val = _ref13[1]; | ||
if (!cp[key]) { | ||
cp[key] = val.bind(cp); | ||
} else { | ||
console.warn(cp.name + " : \"" + key + "\" in methods is valid, Please use another one"); | ||
} | ||
} | ||
}; | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
} | ||
}; | ||
var Optional = exports.Optional = [v001]; | ||
var _data = exports._data = function _data(_ref14) { | ||
var _ = _ref14._, | ||
_key = _ref14._key, | ||
_val = _ref14._val, | ||
cp = _ref14.cp; | ||
var props = _val.bind(cp)(); | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
try { | ||
for (var _iterator4 = Object.entries(props)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var _ref15 = _step4.value; | ||
var _ref16 = _slicedToArray(_ref15, 2); | ||
var key = _ref16[0]; | ||
var val = _ref16[1]; | ||
if (!cp[key]) { | ||
cp[key] = val; | ||
} else { | ||
console.warn(cp.name + " : \"" + key + " \" is data is valid, Please use another one"); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
} | ||
} | ||
} | ||
}; |
{ | ||
"name": "menhera", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"main": "dist", | ||
@@ -5,0 +5,0 @@ "files": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12990
312
1