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

wechat-mini-program-extend

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wechat-mini-program-extend - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

dist/core/ComputedInstaller.js

@@ -1,1 +0,1 @@

"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_common=require("../utils/common"),_Stream=require("../libs/Stream"),_Singleton2=require("../libs/Singleton"),_index=_interopRequireDefault(require("../libs/fast-deep-equal/index"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],a=!0,u=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _get(e,t,r){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){e=_superPropBase(e,t);if(e){t=Object.getOwnPropertyDescriptor(e,t);return t.get?t.get.call(r):t.value}})(e,t,r||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var n=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var RTCSign=Symbol("__wxRTC__"),CMPCSign=Symbol("__wxCMPC__"),CMPCSetterSign=Symbol("__wxCMPC_SETTER__"),CMPCGetterSign=Symbol("__wxCMPC_GETTER__"),ComputedSourceSingleton=function(){_inherits(r,_Singleton2.Singleton);var e=_createSuper(r);function r(){var t;return _classCallCheck(this,r),t=e.call(this,function(e){var n=_assertThisInitialized(t);return new Proxy(e,{get:function(e,t,r){return(0,_common.isPlainObject)(n.source)&&Reflect.has(n.source,t)?Reflect.get(n.source,t):Reflect.get(e,t)},set:function(e,t,r,n){return Reflect.set(e,t,r)}})}),_defineProperty(_assertThisInitialized(t),"_source",void 0),t}return _createClass(r,[{key:"source",get:function(){return this._source},set:function(e){this._source=e}},{key:"get",value:function(e,t){return this.source=t,_get(_getPrototypeOf(r.prototype),"get",this).call(this,e)}}]),r}(),ComputedInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"getRuntimeContext",value:function(e,t,r){return Reflect.has(e,RTCSign)?Reflect.get(e,RTCSign).get(e,t.get("properties"),t.get("computed"),r):e}},{key:"releaseRuntimeContext",value:function(e){Reflect.has(e,RTCSign)&&(Reflect.get(e,RTCSign).release(),Reflect.deleteProperty(this,RTCSign))}},{key:"getComputedContext",value:function(e,t,r,n){return Reflect.get(e,CMPCSign).get(this.getRuntimeContext(e,t,r),n)}},{key:"releaseComputedContext",value:function(e){Reflect.has(e,CMPCSign)&&(Reflect.get(e,CMPCSign).release(),Reflect.deleteProperty(this,CMPCSign))}},{key:"attemptToInstantiateCalculated",value:function(e,t,r,n,o){var i=t.get("computed"),a=t.get("methods"),u=Object.assign({},t.get("state")),l=new Proxy({data:u},{get:function(e,t,r){if("data"===t)return Reflect.get(e,t);if(Reflect.has(u,t))return Reflect.get(u,t);if(Reflect.has(i,t)){e=Reflect.get(i,t);if((0,_common.isFunction)(e))return e.call(r);if((0,_common.isPlainObject)(e)&&(0,_common.isFunction)(e.get))return e.get.call(r)}else if(Reflect.has(a,t)){t=Reflect.get(a,t);if((0,_common.isFunction)(t))return t.bind(r)}}});return _Stream.Stream.of(Object.entries(i)).map(function(e){var t=_slicedToArray(e,2),e=t[0],t=t[1],t=(0,_common.isPlainObject)(t)&&(0,_common.isFunction)(t.get)?t.get:(0,_common.isFunction)(t)?t:null;if((0,_common.isFunction)(t))return[e,t.call(l)]}).filter(function(e){return!!e}).collect(_Stream.Collectors.toMap())}},{key:"beforeUpdate",value:function(e,n,t,o,i){var a=this,u=n.get("computed"),r=Reflect.get(o,CMPCSetterSign),l=Reflect.get(o,CMPCGetterSign),c=Object.keys(i).filter(function(e){return r.includes(e)}),s=o.setData;c.length&&c.forEach(function(e){u[e].set.call(a.getRuntimeContext(o,n,s.bind(o)),i[e])});var f={};l.forEach(function(e){var t=(0,_common.isFunction)(u[e].get)?u[e].get:u[e],r=Reflect.get(a.getRuntimeContext(o,n,s.bind(o)),e),t=t.call(a.getComputedContext(o,n,s.bind(o),i));(0,_index.default)(r,t)||(f[e]=t)}),Object.assign(i,f)}},{key:"definitionFilter",value:function(t,e,r,n,o){var i=this,a=e.get("state"),u=e.get("computed"),l=Object.keys(u).filter(function(e){return(0,_common.isPlainObject)(u[e])&&(0,_common.isFunction)(u[e].set)}),c=(0,_common.isPlainObject)(u)?Object.keys(u).filter(function(e){return(0,_common.isPlainObject)(u[e])&&(0,_common.isFunction)(u[e].get)||(0,_common.isFunction)(u[e])}):[];(0,_common.isPlainObject)(a)&&(o=this.attemptToInstantiateCalculated(t,e,r,n,o),n.behaviors=[Behavior({data:o,lifetimes:{created:function(){var e;Object.defineProperty(this,RTCSign,{configurable:!1,enumerable:!1,value:t.createRuntimeContextSingleton(),writable:!1}),Object.defineProperty(this,CMPCSign,{configurable:!1,enumerable:!1,value:(e=this,Object.defineProperty(e,CMPCGetterSign,{value:c,enumerable:!1,configurable:!1}),Object.defineProperty(e,CMPCSetterSign,{value:l,enumerable:!1,configurable:!1}),new ComputedSourceSingleton),writable:!1})}}})].concat(n.behaviors||[],Behavior({lifetimes:{detached:function(){var e;e=this,i.releaseRuntimeContext(e),e=this,i.releaseComputedContext(e),Reflect.deleteProperty(e,CMPCGetterSign),Reflect.deleteProperty(e,CMPCSetterSign)}}})))}},{key:"install",value:function(e,t,r){r=r.computed,r=void 0===r?null:r;t.set("computed",Object.assign.apply(void 0,[{}].concat(_toConsumableArray(e.installers.map(function(e){return e.computed()})),[r])))}}]),t}();exports.default=ComputedInstaller;
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_common=require("../utils/common"),_Stream=require("../libs/Stream"),_Singleton2=require("../libs/Singleton"),_index=_interopRequireDefault(require("../libs/fast-deep-equal/index"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],a=!0,u=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _get(e,t,r){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){e=_superPropBase(e,t);if(e){t=Object.getOwnPropertyDescriptor(e,t);return t.get?t.get.call(r):t.value}})(e,t,r||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var n=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var RTCSign=Symbol("__wxRTC__"),CMPCSign=Symbol("__wxCMPC__"),CMPCSetterSign=Symbol("__wxCMPC_SETTER__"),CMPCGetterSign=Symbol("__wxCMPC_GETTER__"),ComputedSourceSingleton=function(){_inherits(r,_Singleton2.Singleton);var e=_createSuper(r);function r(){var t;return _classCallCheck(this,r),t=e.call(this,function(e){var n=_assertThisInitialized(t);return new Proxy(e,{get:function(e,t,r){return(0,_common.isPlainObject)(n.source)&&Reflect.has(n.source,t)?Reflect.get(n.source,t):Reflect.get(e,t)},set:function(e,t,r,n){return Reflect.set(e,t,r)}})}),_defineProperty(_assertThisInitialized(t),"_source",void 0),t}return _createClass(r,[{key:"source",get:function(){return this._source},set:function(e){this._source=e}},{key:"get",value:function(e,t){return this.source=t,_get(_getPrototypeOf(r.prototype),"get",this).call(this,e)}}]),r}(),ComputedInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"getRuntimeContext",value:function(e,t,r){return Reflect.has(e,RTCSign)?Reflect.get(e,RTCSign).get(e,t.get("properties"),t.get("computed"),r):e}},{key:"releaseRuntimeContext",value:function(e){Reflect.has(e,RTCSign)&&(Reflect.get(e,RTCSign).release(),Reflect.deleteProperty(this,RTCSign))}},{key:"getComputedContext",value:function(e,t,r,n){return Reflect.get(e,CMPCSign).get(this.getRuntimeContext(e,t,r),n)}},{key:"releaseComputedContext",value:function(e){Reflect.has(e,CMPCSign)&&(Reflect.get(e,CMPCSign).release(),Reflect.deleteProperty(this,CMPCSign))}},{key:"attemptToInstantiateCalculated",value:function(e,t,r,n,o){var i=t.get("computed"),a=t.get("methods"),u=Object.assign({},t.get("state")),l=new Proxy({data:u},{get:function(e,t,r){if("data"===t)return Reflect.get(e,t);if(Reflect.has(u,t))return Reflect.get(u,t);if(Reflect.has(i,t)){e=Reflect.get(i,t);if((0,_common.isFunction)(e))return e.call(r);if((0,_common.isPlainObject)(e)&&(0,_common.isFunction)(e.get))return e.get.call(r)}else if(Reflect.has(a,t)){t=Reflect.get(a,t);if((0,_common.isFunction)(t))return t.bind(r)}}});return _Stream.Stream.of(Object.entries(i)).map(function(e){var t=_slicedToArray(e,2),e=t[0],t=t[1],t=(0,_common.isPlainObject)(t)&&(0,_common.isFunction)(t.get)?t.get:(0,_common.isFunction)(t)?t:null;if((0,_common.isFunction)(t))return[e,t.call(l)]}).filter(function(e){return!!e}).collect(_Stream.Collectors.toMap())}},{key:"beforeUpdate",value:function(e,n,t,o,i){var a=this,u=n.get("computed"),r=Reflect.get(o,CMPCSetterSign),l=Reflect.get(o,CMPCGetterSign),c=Object.keys(i).filter(function(e){return r.includes(e)}),s=o.setData;c.length&&c.forEach(function(e){u[e].set.call(a.getRuntimeContext(o,n,s.bind(o)),i[e])});var f={};l.forEach(function(e){var t=(0,_common.isFunction)(u[e].get)?u[e].get:u[e],r=Reflect.get(a.getRuntimeContext(o,n,s.bind(o)),e),t=t.call(a.getComputedContext(o,n,s.bind(o),i));(0,_index.default)(r,t)||(f[e]=t)}),Object.assign(i,f)}},{key:"definitionFilter",value:function(t,e,r,n,o){var i=this,a=e.get("state"),u=e.get("computed"),l=Object.keys(u).filter(function(e){return(0,_common.isPlainObject)(u[e])&&(0,_common.isFunction)(u[e].set)}),c=(0,_common.isPlainObject)(u)?Object.keys(u).filter(function(e){return(0,_common.isPlainObject)(u[e])&&(0,_common.isFunction)(u[e].get)||(0,_common.isFunction)(u[e])}):[];(0,_common.isPlainObject)(a)&&(o=this.attemptToInstantiateCalculated(t,e,r,n,o),n.behaviors=[Behavior({data:o,lifetimes:{created:function(){var e;Object.defineProperty(this,RTCSign,{configurable:!1,enumerable:!1,value:t.createRuntimeContextSingleton(),writable:!1}),Object.defineProperty(this,CMPCSign,{configurable:!1,enumerable:!1,value:(e=this,Object.defineProperty(e,CMPCGetterSign,{value:c,enumerable:!1,configurable:!1}),Object.defineProperty(e,CMPCSetterSign,{value:l,enumerable:!1,configurable:!1}),new ComputedSourceSingleton),writable:!1})},attached:function(){!function(e,t,r,n){var o={};i.beforeUpdate(e,t,r,n,o);r=_Stream.Stream.of(Object.keys(o)).map(function(e){return[e,Reflect.get(n,"data")[e]]}).collect(_Stream.Collectors.toMap());(0,_index.default)(o,r)||n.setData.call(n,o)}(t,e,r,this)}}})].concat(n.behaviors||[],Behavior({lifetimes:{detached:function(){var e;e=this,i.releaseRuntimeContext(e),e=this,i.releaseComputedContext(e),Reflect.deleteProperty(e,CMPCGetterSign),Reflect.deleteProperty(e,CMPCSetterSign)}}})))}},{key:"install",value:function(e,t,r){r=r.computed,r=void 0===r?null:r;t.set("computed",Object.assign.apply(void 0,[{}].concat(_toConsumableArray(e.installers.map(function(e){return e.computed()})),[r])))}}]),t}();exports.default=ComputedInstaller;
{
"name": "wechat-mini-program-extend",
"version": "1.0.3",
"version": "1.0.4",
"repository": "git@github.com:sitorhy/wechat-mini-program-extend.git",

@@ -5,0 +5,0 @@ "author": "sitorhy <sitorhy>",

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