@galacean/effects-plugin-alipay-downgrade 2.7.1 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alipay.js +1 -1
- package/dist/alipay.mjs +1 -1
- package/dist/index.js +2 -2
- package/dist/index.min.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
package/dist/alipay.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@galacean/effects/alipay"),n=require("@galacean/appx-adapter/alipay");function r(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}})),n.default=e,Object.freeze(n)}var t,o=r(e);function i(e,n,r,t,o,i,l){try{var a=e[i](l),s=a.value}catch(e){return void r(e)}a.done?n(s):Promise.resolve(s).then(t,o)}function l(e){return function(){var n=this,r=arguments;return new Promise((function(t,o){var l=e.apply(n,r);function a(e){i(l,t,o,a,s,"next",e)}function s(e){i(l,t,o,a,s,"throw",e)}a(void 0)}))}}function a(e,n){return a=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},a(e,n)}function s(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e],t=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function u(){return u=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},u.apply(this,arguments)}"function"==typeof SuppressedError&&SuppressedError,exports.DeviceLevel=void 0,(t=exports.DeviceLevel||(exports.DeviceLevel={})).High="high",t.Medium="medium",t.Low="low",t.Unknown="unknown";var c=["12,8","13,1","13,2","13,3","13,4"],d=function(){function n(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=exports.DeviceLevel.Unknown,this.isDowngrade=!1}var r=n.prototype;return r.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=void 0===t?"UNKNOWN_DEVICE":t,i=e.system,l=void 0===i?"Unknown":i;this.isIOS="iOS"===r,this.model=o,this.system=l,this.setLevel(n)},r.getDowngradeDecision=function(n){var r=void 0,t=void 0;if(n.error)return{downgrade:4!==n.error,level:this.getRenderLevel(),reason:"api error: "+n.error};try{var o=e.isString(n)?JSON.parse(n):n;if("downgradeResultType"in o?r=o.downgradeResultType:"resultType"in o&&(r=o.resultType,t=o.resultReason),n.context){var i=n.context.deviceInfo;if(i){var l=p(i.deviceLevel);l!==exports.DeviceLevel.Unknown&&(this.level=l)}}}catch(n){e.logger.error(n)}return void 0===r?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===r?{downgrade:!0,level:this.getRenderLevel(),reason:v(t)}:e.isAlipayMiniApp()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+r}},r.getRenderLevel=function(){return this.level===exports.DeviceLevel.High?e.spec.RenderLevel.S:this.level===exports.DeviceLevel.Medium?e.spec.RenderLevel.A:this.level===exports.DeviceLevel.Low?e.spec.RenderLevel.B:this.isIOS?e.spec.RenderLevel.S:e.spec.RenderLevel.B},r.setLevel=function(e){if(this.level=p(e),this.level===exports.DeviceLevel.Unknown&&/iPhone(\d+),/.test(this.model)){var n=+RegExp.$1;this.level=n<=9?exports.DeviceLevel.Low:n<10?exports.DeviceLevel.Medium:exports.DeviceLevel.High}},r.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&c.find((function(n){return n===e.model}))){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},n}();function v(e){return-1===e?e+", unable to pull configuration":0===e?e+", no downgrade":1===e?e+", memory downgrade":2===e?e+", crash downgrade":3===e?e+", basic dimension downgrade":4===e?e+", technical point downgrade":5===e?e+", GPU downgrade":6===e?e+", self-healing downgrade":7===e?e+", 32-bit CPU downgrade":""+e}function p(e){return"high"===e?exports.DeviceLevel.High:"medium"===e||"middle"===e?exports.DeviceLevel.Medium:"low"===e?exports.DeviceLevel.Low:exports.DeviceLevel.Unknown}var f=Symbol("@@_inter_pause"),g="mock-pass",w="mock-fail",h=!1;function y(){return y=l((function(r,t){var o,i,l,a,c;return s(this,(function(s){return void 0===t&&(t={}),e.canUseBOM?(h||(h=!0,function(r){var t=r.autoPause;n.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",x),document.addEventListener("resume",P))}(t)),r===w||r===g?[2,Promise.resolve({bizId:r,downgrade:r===w,level:null!=(i=t.level)?i:e.spec.RenderLevel.S,reason:"mock"})]:(l=e.isAlipayMiniApp()?my:n.window.AlipayJSBridge)||t.systemInfo&&t.downgradeResult?(c=performance.now(),[2,m(t,l).then((function(n){var o=performance.now();return function(e,n,r){return b.apply(this,arguments)}(r,t,l).then((function(i){var l=performance.now();e.logger.info("Downgrade time: "+(l-c)+"ms.");var a=new d;a.setSystemInfo(n);var s=a.getDowngradeDecision(i);return t.level&&(s.level=t.level),u({},s,{bizId:r,systemInfo:n,systemTime:o-c,downgradeResult:i,downgradeTime:l-o})}))}))]):[2,{bizId:r,downgrade:!1,level:null!=(a=t.level)?a:e.spec.RenderLevel.S,reason:"Non-Alipay environment"}]):[2,Promise.resolve({bizId:r,downgrade:!0,level:null!=(o=t.level)?o:e.spec.RenderLevel.S,reason:"当前环境无法访问 window"})]}))})),y.apply(this,arguments)}function m(e,n){return L.apply(this,arguments)}function L(){return L=l((function(e,n){return s(this,(function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise((function(e,r){n.call("getSystemInfo",(function(n){n.error?r(n):e(n)}))}))]}))})),L.apply(this,arguments)}function b(){return b=l((function(e,n,r){return s(this,(function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise((function(t,o){var i,l=["mars"],a=n.techPoint;a&&(i=l).push.apply(i,[].concat(a));var s,u={bizId:e,scene:0,ext:{techPoint:l}};(null!=(s=n.callBridge)?s:r.call)("getDowngradeResult",u,(function(e){t(e)}))}))]}))})),b.apply(this,arguments)}function D(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function x(n){n.target===document&&(e.logger.info("Auto pause all players with data offloaded."),e.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[f]=!0)})))}function P(n){n.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[f]&&(e.resume(),e[f]=!1)})))}var O=function(n){function r(){return n.apply(this,arguments)}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&a(e,n)}(r,n),r.processRawJSON=function(n,r){return void 0===r&&(r={}),l((function(){var n,t,o;return s(this,(function(i){if(t=null==(n=r.pluginData)?void 0:n.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else e.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return r.renderLevel||(r.renderLevel=null!=(o=null==t?void 0:t.level)?o:D()),[2]}))}))()},r}(e.AbstractPlugin);if(e.canUseBOM){var R=e.isAlipayMiniApp()?my:n.window.AlipayJSBridge;e.logger.register((function(n,r){for(var t=arguments.length,o=new Array(t>2?t-2:0),i=2;i<t;i++)o[i-2]=arguments[i];var l={message:"[Galacean Effects] "+r+" "+o.join(""),level:n};e.isAndroid()&&(l.anr_info="mars");try{null==R||R.call("localLog",l)}catch(e){console.error(e)}}))}var S="2.7.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@galacean/effects/alipay"),n=require("@galacean/appx-adapter/alipay");function r(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}})),n.default=e,Object.freeze(n)}var t,o=r(e);function i(e,n,r,t,o,i,l){try{var a=e[i](l),s=a.value}catch(e){return void r(e)}a.done?n(s):Promise.resolve(s).then(t,o)}function l(e){return function(){var n=this,r=arguments;return new Promise((function(t,o){var l=e.apply(n,r);function a(e){i(l,t,o,a,s,"next",e)}function s(e){i(l,t,o,a,s,"throw",e)}a(void 0)}))}}function a(e,n){return a=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},a(e,n)}function s(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e],t=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function u(){return u=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},u.apply(this,arguments)}"function"==typeof SuppressedError&&SuppressedError,exports.DeviceLevel=void 0,(t=exports.DeviceLevel||(exports.DeviceLevel={})).High="high",t.Medium="medium",t.Low="low",t.Unknown="unknown";var c=["12,8","13,1","13,2","13,3","13,4"],d=function(){function n(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=exports.DeviceLevel.Unknown,this.isDowngrade=!1}var r=n.prototype;return r.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=void 0===t?"UNKNOWN_DEVICE":t,i=e.system,l=void 0===i?"Unknown":i;this.isIOS="iOS"===r,this.model=o,this.system=l,this.setLevel(n)},r.getDowngradeDecision=function(n){var r=void 0,t=void 0;if(n.error)return{downgrade:4!==n.error,level:this.getRenderLevel(),reason:"api error: "+n.error};try{var o=e.isString(n)?JSON.parse(n):n;if("downgradeResultType"in o?r=o.downgradeResultType:"resultType"in o&&(r=o.resultType,t=o.resultReason),n.context){var i=n.context.deviceInfo;if(i){var l=p(i.deviceLevel);l!==exports.DeviceLevel.Unknown&&(this.level=l)}}}catch(n){e.logger.error(n)}return void 0===r?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===r?{downgrade:!0,level:this.getRenderLevel(),reason:v(t)}:e.isAlipayMiniApp()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+r}},r.getRenderLevel=function(){return this.level===exports.DeviceLevel.High?e.spec.RenderLevel.S:this.level===exports.DeviceLevel.Medium?e.spec.RenderLevel.A:this.level===exports.DeviceLevel.Low?e.spec.RenderLevel.B:this.isIOS?e.spec.RenderLevel.S:e.spec.RenderLevel.B},r.setLevel=function(e){if(this.level=p(e),this.level===exports.DeviceLevel.Unknown&&/iPhone(\d+),/.test(this.model)){var n=+RegExp.$1;this.level=n<=9?exports.DeviceLevel.Low:n<10?exports.DeviceLevel.Medium:exports.DeviceLevel.High}},r.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&c.find((function(n){return n===e.model}))){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},n}();function v(e){return-1===e?e+", unable to pull configuration":0===e?e+", no downgrade":1===e?e+", memory downgrade":2===e?e+", crash downgrade":3===e?e+", basic dimension downgrade":4===e?e+", technical point downgrade":5===e?e+", GPU downgrade":6===e?e+", self-healing downgrade":7===e?e+", 32-bit CPU downgrade":""+e}function p(e){return"high"===e?exports.DeviceLevel.High:"medium"===e||"middle"===e?exports.DeviceLevel.Medium:"low"===e?exports.DeviceLevel.Low:exports.DeviceLevel.Unknown}var f=Symbol("@@_inter_pause"),g="mock-pass",w="mock-fail",h=!1;function y(){return y=l((function(r,t){var o,i,l,a,c;return s(this,(function(s){return void 0===t&&(t={}),e.canUseBOM?(h||(h=!0,function(r){var t=r.autoPause;n.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",x),document.addEventListener("resume",P))}(t)),r===w||r===g?[2,Promise.resolve({bizId:r,downgrade:r===w,level:null!=(i=t.level)?i:e.spec.RenderLevel.S,reason:"mock"})]:(l=e.isAlipayMiniApp()?my:n.window.AlipayJSBridge)||t.systemInfo&&t.downgradeResult?(c=performance.now(),[2,m(t,l).then((function(n){var o=performance.now();return function(e,n,r){return b.apply(this,arguments)}(r,t,l).then((function(i){var l=performance.now();e.logger.info("Downgrade time: "+(l-c)+"ms.");var a=new d;a.setSystemInfo(n);var s=a.getDowngradeDecision(i);return t.level&&(s.level=t.level),u({},s,{bizId:r,systemInfo:n,systemTime:o-c,downgradeResult:i,downgradeTime:l-o})}))}))]):[2,{bizId:r,downgrade:!1,level:null!=(a=t.level)?a:e.spec.RenderLevel.S,reason:"Non-Alipay environment"}]):[2,Promise.resolve({bizId:r,downgrade:!0,level:null!=(o=t.level)?o:e.spec.RenderLevel.S,reason:"当前环境无法访问 window"})]}))})),y.apply(this,arguments)}function m(e,n){return L.apply(this,arguments)}function L(){return L=l((function(e,n){return s(this,(function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise((function(e,r){n.call("getSystemInfo",(function(n){n.error?r(n):e(n)}))}))]}))})),L.apply(this,arguments)}function b(){return b=l((function(e,n,r){return s(this,(function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise((function(t,o){var i,l=["mars"],a=n.techPoint;a&&(i=l).push.apply(i,[].concat(a));var s,u={bizId:e,scene:0,ext:{techPoint:l}};(null!=(s=n.callBridge)?s:r.call)("getDowngradeResult",u,(function(e){t(e)}))}))]}))})),b.apply(this,arguments)}function D(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function x(n){n.target===document&&(e.logger.info("Auto pause all players with data offloaded."),e.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[f]=!0)})))}function P(n){n.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[f]&&(e.resume(),e[f]=!1)})))}var O=function(n){function r(){return n.apply(this,arguments)}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&a(e,n)}(r,n),r.processRawJSON=function(n,r){return void 0===r&&(r={}),l((function(){var n,t,o;return s(this,(function(i){if(t=null==(n=r.pluginData)?void 0:n.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else e.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return r.renderLevel||(r.renderLevel=null!=(o=null==t?void 0:t.level)?o:D()),[2]}))}))()},r}(e.AbstractPlugin);if(e.canUseBOM){var R=e.isAlipayMiniApp()?my:n.window.AlipayJSBridge;e.logger.register((function(n,r){for(var t=arguments.length,o=new Array(t>2?t-2:0),i=2;i<t;i++)o[i-2]=arguments[i];var l={message:"[Galacean Effects] "+r+" "+o.join(""),level:n};e.isAndroid()&&(l.anr_info="mars");try{null==R||R.call("localLog",l)}catch(e){console.error(e)}}))}var S="2.7.3";e.registerPlugin("alipay-downgrade",O,e.VFXItem),e.logger.info("Plugin downgrade version: 2.7.3."),S!==o.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),exports.getDefaultRenderLevel=D,exports.getDowngradeResult=function(e){return y.apply(this,arguments)},exports.version=S;
|
|
2
2
|
//# sourceMappingURL=alipay.js.map
|
package/dist/alipay.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"@galacean/effects/alipay";import{isString as n,logger as r,isAlipayMiniApp as t,spec as o,isIOS as i,canUseBOM as a,getActivePlayers as l,AbstractPlugin as s,isAndroid as u,registerPlugin as d,VFXItem as c}from"@galacean/effects/alipay";import{window as f}from"@galacean/appx-adapter/alipay";function v(e,n,r,t,o,i,a){try{var l=e[i](a),s=l.value}catch(e){return void r(e)}l.done?n(s):Promise.resolve(s).then(t,o)}function p(e){return function(){var n=this,r=arguments;return new Promise((function(t,o){var i=e.apply(n,r);function a(e){v(i,t,o,a,l,"next",e)}function l(e){v(i,t,o,a,l,"throw",e)}a(void 0)}))}}function h(e,n){return h=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},h(e,n)}function g(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&l[0]?t.return:l[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,l[1])).done)return o;switch(t=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,t=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=n.call(e,i)}catch(e){l=[6,e],t=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}}function w(){return w=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},w.apply(this,arguments)}var m;"function"==typeof SuppressedError&&SuppressedError,function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(m||(m={}));var y=["12,8","13,1","13,2","13,3","13,4"],b=function(){function e(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=m.Unknown,this.isDowngrade=!1}var i=e.prototype;return i.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=void 0===t?"UNKNOWN_DEVICE":t,i=e.system,a=void 0===i?"Unknown":i;this.isIOS="iOS"===r,this.model=o,this.system=a,this.setLevel(n)},i.getDowngradeDecision=function(e){var o=void 0,i=void 0;if(e.error)return{downgrade:4!==e.error,level:this.getRenderLevel(),reason:"api error: "+e.error};try{var a=n(e)?JSON.parse(e):e;if("downgradeResultType"in a?o=a.downgradeResultType:"resultType"in a&&(o=a.resultType,i=a.resultReason),e.context){var l=e.context.deviceInfo;if(l){var s=R(l.deviceLevel);s!==m.Unknown&&(this.level=s)}}}catch(e){r.error(e)}return void 0===o?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===o?{downgrade:!0,level:this.getRenderLevel(),reason:L(i)}:t()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+o}},i.getRenderLevel=function(){return this.level===m.High?o.RenderLevel.S:this.level===m.Medium?o.RenderLevel.A:this.level===m.Low?o.RenderLevel.B:this.isIOS?o.RenderLevel.S:o.RenderLevel.B},i.setLevel=function(e){if(this.level=R(e),this.level===m.Unknown&&/iPhone(\d+),/.test(this.model)){var n=+RegExp.$1;this.level=n<=9?m.Low:n<10?m.Medium:m.High}},i.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&y.find((function(n){return n===e.model}))){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},e}();function L(e){return-1===e?e+", unable to pull configuration":0===e?e+", no downgrade":1===e?e+", memory downgrade":2===e?e+", crash downgrade":3===e?e+", basic dimension downgrade":4===e?e+", technical point downgrade":5===e?e+", GPU downgrade":6===e?e+", self-healing downgrade":7===e?e+", 32-bit CPU downgrade":""+e}function R(e){return"high"===e?m.High:"medium"===e||"middle"===e?m.Medium:"low"===e?m.Low:m.Unknown}var S=Symbol("@@_inter_pause"),P="mock-pass",I="mock-fail",O=!1;function E(e){return k.apply(this,arguments)}function k(){return k=p((function(e,n){var i,s,u,d,c;return g(this,(function(v){return void 0===n&&(n={}),a?(O||(O=!0,function(e){var n=e.autoPause;f.addEventListener("unload",(function(){l().forEach((function(e){return e.dispose()}))})),n&&(document.addEventListener("pause",_),document.addEventListener("resume",A))}(n)),e===I||e===P?[2,Promise.resolve({bizId:e,downgrade:e===I,level:null!=(s=n.level)?s:o.RenderLevel.S,reason:"mock"})]:(u=t()?my:f.AlipayJSBridge)||n.systemInfo&&n.downgradeResult?(c=performance.now(),[2,D(n,u).then((function(t){var o=performance.now();return function(e,n,r){return U.apply(this,arguments)}(e,n,u).then((function(i){var a=performance.now();r.info("Downgrade time: "+(a-c)+"ms.");var l=new b;l.setSystemInfo(t);var s=l.getDowngradeDecision(i);return n.level&&(s.level=n.level),w({},s,{bizId:e,systemInfo:t,systemTime:o-c,downgradeResult:i,downgradeTime:a-o})}))}))]):[2,{bizId:e,downgrade:!1,level:null!=(d=n.level)?d:o.RenderLevel.S,reason:"Non-Alipay environment"}]):[2,Promise.resolve({bizId:e,downgrade:!0,level:null!=(i=n.level)?i:o.RenderLevel.S,reason:"当前环境无法访问 window"})]}))})),k.apply(this,arguments)}function D(e,n){return x.apply(this,arguments)}function x(){return x=p((function(e,n){return g(this,(function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise((function(e,r){n.call("getSystemInfo",(function(n){n.error?r(n):e(n)}))}))]}))})),x.apply(this,arguments)}function U(){return U=p((function(e,n,r){return g(this,(function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise((function(t,o){var i,a=["mars"],l=n.techPoint;l&&(i=a).push.apply(i,[].concat(l));var s,u={bizId:e,scene:0,ext:{techPoint:a}};(null!=(s=n.callBridge)?s:r.call)("getDowngradeResult",u,(function(e){t(e)}))}))]}))})),U.apply(this,arguments)}function T(){return i()?o.RenderLevel.S:o.RenderLevel.B}function _(e){e.target===document&&(r.info("Auto pause all players with data offloaded."),l().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[S]=!0)})))}function A(e){e.target===document&&(r.info("Auto resume all players."),l().forEach((function(e){e[S]&&(e.resume(),e[S]=!1)})))}var j=function(e){function n(){return e.apply(this,arguments)}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&h(e,n)}(n,e),n.processRawJSON=function(e,n){return void 0===n&&(n={}),p((function(){var e,t,o;return g(this,(function(i){if(t=null==(e=n.pluginData)?void 0:e.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else r.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:T()),[2]}))}))()},n}(s);if(a){var B=t()?my:f.AlipayJSBridge;r.register((function(e,n){for(var r=arguments.length,t=new Array(r>2?r-2:0),o=2;o<r;o++)t[o-2]=arguments[o];var i={message:"[Galacean Effects] "+n+" "+t.join(""),level:e};u()&&(i.anr_info="mars");try{null==B||B.call("localLog",i)}catch(e){console.error(e)}}))}var M="2.7.
|
|
1
|
+
import*as e from"@galacean/effects/alipay";import{isString as n,logger as r,isAlipayMiniApp as t,spec as o,isIOS as i,canUseBOM as a,getActivePlayers as l,AbstractPlugin as s,isAndroid as u,registerPlugin as d,VFXItem as c}from"@galacean/effects/alipay";import{window as f}from"@galacean/appx-adapter/alipay";function v(e,n,r,t,o,i,a){try{var l=e[i](a),s=l.value}catch(e){return void r(e)}l.done?n(s):Promise.resolve(s).then(t,o)}function p(e){return function(){var n=this,r=arguments;return new Promise((function(t,o){var i=e.apply(n,r);function a(e){v(i,t,o,a,l,"next",e)}function l(e){v(i,t,o,a,l,"throw",e)}a(void 0)}))}}function h(e,n){return h=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},h(e,n)}function g(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&l[0]?t.return:l[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,l[1])).done)return o;switch(t=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,t=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=n.call(e,i)}catch(e){l=[6,e],t=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}}function w(){return w=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},w.apply(this,arguments)}var m;"function"==typeof SuppressedError&&SuppressedError,function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(m||(m={}));var y=["12,8","13,1","13,2","13,3","13,4"],b=function(){function e(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=m.Unknown,this.isDowngrade=!1}var i=e.prototype;return i.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=void 0===t?"UNKNOWN_DEVICE":t,i=e.system,a=void 0===i?"Unknown":i;this.isIOS="iOS"===r,this.model=o,this.system=a,this.setLevel(n)},i.getDowngradeDecision=function(e){var o=void 0,i=void 0;if(e.error)return{downgrade:4!==e.error,level:this.getRenderLevel(),reason:"api error: "+e.error};try{var a=n(e)?JSON.parse(e):e;if("downgradeResultType"in a?o=a.downgradeResultType:"resultType"in a&&(o=a.resultType,i=a.resultReason),e.context){var l=e.context.deviceInfo;if(l){var s=R(l.deviceLevel);s!==m.Unknown&&(this.level=s)}}}catch(e){r.error(e)}return void 0===o?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===o?{downgrade:!0,level:this.getRenderLevel(),reason:L(i)}:t()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+o}},i.getRenderLevel=function(){return this.level===m.High?o.RenderLevel.S:this.level===m.Medium?o.RenderLevel.A:this.level===m.Low?o.RenderLevel.B:this.isIOS?o.RenderLevel.S:o.RenderLevel.B},i.setLevel=function(e){if(this.level=R(e),this.level===m.Unknown&&/iPhone(\d+),/.test(this.model)){var n=+RegExp.$1;this.level=n<=9?m.Low:n<10?m.Medium:m.High}},i.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&y.find((function(n){return n===e.model}))){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},e}();function L(e){return-1===e?e+", unable to pull configuration":0===e?e+", no downgrade":1===e?e+", memory downgrade":2===e?e+", crash downgrade":3===e?e+", basic dimension downgrade":4===e?e+", technical point downgrade":5===e?e+", GPU downgrade":6===e?e+", self-healing downgrade":7===e?e+", 32-bit CPU downgrade":""+e}function R(e){return"high"===e?m.High:"medium"===e||"middle"===e?m.Medium:"low"===e?m.Low:m.Unknown}var S=Symbol("@@_inter_pause"),P="mock-pass",I="mock-fail",O=!1;function E(e){return k.apply(this,arguments)}function k(){return k=p((function(e,n){var i,s,u,d,c;return g(this,(function(v){return void 0===n&&(n={}),a?(O||(O=!0,function(e){var n=e.autoPause;f.addEventListener("unload",(function(){l().forEach((function(e){return e.dispose()}))})),n&&(document.addEventListener("pause",_),document.addEventListener("resume",A))}(n)),e===I||e===P?[2,Promise.resolve({bizId:e,downgrade:e===I,level:null!=(s=n.level)?s:o.RenderLevel.S,reason:"mock"})]:(u=t()?my:f.AlipayJSBridge)||n.systemInfo&&n.downgradeResult?(c=performance.now(),[2,D(n,u).then((function(t){var o=performance.now();return function(e,n,r){return U.apply(this,arguments)}(e,n,u).then((function(i){var a=performance.now();r.info("Downgrade time: "+(a-c)+"ms.");var l=new b;l.setSystemInfo(t);var s=l.getDowngradeDecision(i);return n.level&&(s.level=n.level),w({},s,{bizId:e,systemInfo:t,systemTime:o-c,downgradeResult:i,downgradeTime:a-o})}))}))]):[2,{bizId:e,downgrade:!1,level:null!=(d=n.level)?d:o.RenderLevel.S,reason:"Non-Alipay environment"}]):[2,Promise.resolve({bizId:e,downgrade:!0,level:null!=(i=n.level)?i:o.RenderLevel.S,reason:"当前环境无法访问 window"})]}))})),k.apply(this,arguments)}function D(e,n){return x.apply(this,arguments)}function x(){return x=p((function(e,n){return g(this,(function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise((function(e,r){n.call("getSystemInfo",(function(n){n.error?r(n):e(n)}))}))]}))})),x.apply(this,arguments)}function U(){return U=p((function(e,n,r){return g(this,(function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise((function(t,o){var i,a=["mars"],l=n.techPoint;l&&(i=a).push.apply(i,[].concat(l));var s,u={bizId:e,scene:0,ext:{techPoint:a}};(null!=(s=n.callBridge)?s:r.call)("getDowngradeResult",u,(function(e){t(e)}))}))]}))})),U.apply(this,arguments)}function T(){return i()?o.RenderLevel.S:o.RenderLevel.B}function _(e){e.target===document&&(r.info("Auto pause all players with data offloaded."),l().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[S]=!0)})))}function A(e){e.target===document&&(r.info("Auto resume all players."),l().forEach((function(e){e[S]&&(e.resume(),e[S]=!1)})))}var j=function(e){function n(){return e.apply(this,arguments)}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&h(e,n)}(n,e),n.processRawJSON=function(e,n){return void 0===n&&(n={}),p((function(){var e,t,o;return g(this,(function(i){if(t=null==(e=n.pluginData)?void 0:e.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else r.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:T()),[2]}))}))()},n}(s);if(a){var B=t()?my:f.AlipayJSBridge;r.register((function(e,n){for(var r=arguments.length,t=new Array(r>2?r-2:0),o=2;o<r;o++)t[o-2]=arguments[o];var i={message:"[Galacean Effects] "+n+" "+t.join(""),level:e};u()&&(i.anr_info="mars");try{null==B||B.call("localLog",i)}catch(e){console.error(e)}}))}var M="2.7.3";d("alipay-downgrade",j,c),r.info("Plugin downgrade version: 2.7.3."),M!==e.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");export{m as DeviceLevel,T as getDefaultRenderLevel,E as getDowngradeResult,M as version};
|
|
2
2
|
//# sourceMappingURL=alipay.mjs.map
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects player downgrade plugin for Alipay
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,意绮,飂兮
|
|
6
|
-
* Version: v2.7.
|
|
6
|
+
* Version: v2.7.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -651,7 +651,7 @@ if (EFFECTS.canUseBOM) {
|
|
|
651
651
|
|
|
652
652
|
/**
|
|
653
653
|
* 插件版本号
|
|
654
|
-
*/ var version = "2.7.
|
|
654
|
+
*/ var version = "2.7.3";
|
|
655
655
|
EFFECTS.registerPlugin("alipay-downgrade", AlipayDowngradePlugin, EFFECTS.VFXItem);
|
|
656
656
|
EFFECTS.logger.info("Plugin downgrade version: " + version + ".");
|
|
657
657
|
if (version !== EFFECTS__namespace.version) {
|
package/dist/index.min.js
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Description: Galacean Effects player downgrade plugin for Alipay
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,意绮,飂兮
|
|
6
|
-
* Version: v2.7.
|
|
7
|
-
*/function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).ge=e.ge||{},e.ge.alipayDowngradePlugin={}),e.ge)}(this,function(e,n){"use strict";var r,t=function(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}}),n.default=e,Object.freeze(n)}(n);function o(e,n,r,t,o,i,l){try{var a=e[i](l),s=a.value}catch(e){r(e);return}a.done?n(s):Promise.resolve(s).then(t,o)}function i(e){return function(){var n=this,r=arguments;return new Promise(function(t,i){var l=e.apply(n,r);function a(e){o(l,t,i,a,s,"next",e)}function s(e){o(l,t,i,a,s,"throw",e)}a(void 0)})}}function l(e,n){return(l=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function a(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(s){return function(a){if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e],t=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function s(){return(s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}"function"==typeof SuppressedError&&SuppressedError,e.DeviceLevel=void 0,(r=e.DeviceLevel||(e.DeviceLevel={})).High="high",r.Medium="medium",r.Low="low",r.Unknown="unknown";var u=["12,8","13,1","13,2","13,3","13,4"],c=function(){function r(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=e.DeviceLevel.Unknown,this.isDowngrade=!1}var t=r.prototype;return t.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=e.system;this.isIOS="iOS"===r,this.model=void 0===t?"UNKNOWN_DEVICE":t,this.system=void 0===o?"Unknown":o,this.setLevel(n)},t.getDowngradeDecision=function(r){var t=void 0,o=void 0;if(r.error)return{downgrade:4!==r.error,level:this.getRenderLevel(),reason:"api error: "+r.error};try{var i=n.isString(r)?JSON.parse(r):r;if("downgradeResultType"in i?t=i.downgradeResultType:"resultType"in i&&(t=i.resultType,o=i.resultReason),r.context){var l=r.context.deviceInfo;if(l){var a=l.deviceLevel,s=d(a);s!==e.DeviceLevel.Unknown&&(this.level=s)}}}catch(e){n.logger.error(e)}return void 0===t?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===t?{downgrade:!0,level:this.getRenderLevel(),reason:function(e){if(-1===e)return""+e+", unable to pull configuration";if(0===e)return""+e+", no downgrade";if(1===e)return""+e+", memory downgrade";if(2===e)return""+e+", crash downgrade";if(3===e)return""+e+", basic dimension downgrade";if(4===e)return""+e+", technical point downgrade";if(5===e)return""+e+", GPU downgrade";else if(6===e)return""+e+", self-healing downgrade";else if(7===e)return""+e+", 32-bit CPU downgrade";else return""+e}(o)}:n.isAlipayMiniApp()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+t}},t.getRenderLevel=function(){return this.level===e.DeviceLevel.High?n.spec.RenderLevel.S:this.level===e.DeviceLevel.Medium?n.spec.RenderLevel.A:this.level===e.DeviceLevel.Low?n.spec.RenderLevel.B:this.isIOS?n.spec.RenderLevel.S:n.spec.RenderLevel.B},t.setLevel=function(n){if(this.level=d(n),this.level===e.DeviceLevel.Unknown&&/iPhone(\d+),/.test(this.model)){var r=+RegExp.$1;r<=9?this.level=e.DeviceLevel.Low:r<10?this.level=e.DeviceLevel.Medium:this.level=e.DeviceLevel.High}},t.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&u.find(function(n){return n===e.model})){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},r}();function d(n){return"high"===n?e.DeviceLevel.High:"medium"===n||"middle"===n?e.DeviceLevel.Medium:"low"===n?e.DeviceLevel.Low:e.DeviceLevel.Unknown}var f=Symbol("@@_inter_pause"),v="mock-fail",p=!1;function g(){return(g=i(function(e,r){var t,o,i,l,u;return a(this,function(a){var d;return(void 0===r&&(r={}),n.canUseBOM)?(p||(p=!0,d=r.autoPause,window.addEventListener("unload",function(){n.getActivePlayers().forEach(function(e){return e.dispose()})}),d&&(document.addEventListener("pause",m),document.addEventListener("resume",L))),e===v||"mock-pass"===e)?[2,Promise.resolve({bizId:e,downgrade:e===v,level:null!=(o=r.level)?o:n.spec.RenderLevel.S,reason:"mock"})]:(i=n.isAlipayMiniApp()?my:window.AlipayJSBridge)||r.systemInfo&&r.downgradeResult?(u=performance.now(),[2,(function(e,n){return h.apply(this,arguments)})(r,i).then(function(t){var o=performance.now();return(function(e,n,r){return w.apply(this,arguments)})(e,r,i).then(function(i){var l=performance.now();n.logger.info("Downgrade time: "+(l-u)+"ms.");var a=new c;a.setSystemInfo(t);var d=a.getDowngradeDecision(i);return r.level&&(d.level=r.level),s({},d,{bizId:e,systemInfo:t,systemTime:o-u,downgradeResult:i,downgradeTime:l-o})})})]):[2,{bizId:e,downgrade:!1,level:null!=(l=r.level)?l:n.spec.RenderLevel.S,reason:"Non-Alipay environment"}]:[2,Promise.resolve({bizId:e,downgrade:!0,level:null!=(t=r.level)?t:n.spec.RenderLevel.S,reason:"当前环境无法访问 window"})]})})).apply(this,arguments)}function h(){return(h=i(function(e,n){return a(this,function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise(function(e,r){n.call("getSystemInfo",function(n){n.error?r(n):e(n)})})]})})).apply(this,arguments)}function w(){return(w=i(function(e,n,r){return a(this,function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise(function(t,o){var i,l=["mars"],a=n.techPoint;a&&l.push.apply(l,[].concat(a)),(null!=(i=n.callBridge)?i:r.call)("getDowngradeResult",{bizId:e,scene:0,ext:{techPoint:l}},function(e){t(e)})})]})})).apply(this,arguments)}function y(){return n.isIOS()?n.spec.RenderLevel.S:n.spec.RenderLevel.B}function m(e){e.target===document&&(n.logger.info("Auto pause all players with data offloaded."),n.getActivePlayers().forEach(function(e){e.paused||(e.pause({offloadTexture:!0}),e[f]=!0)}))}function L(e){e.target===document&&(n.logger.info("Auto resume all players."),n.getActivePlayers().forEach(function(e){e[f]&&(e.resume(),e[f]=!1)}))}var b=function(e){function r(){return e.apply(this,arguments)}return!function(e,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&l(e,n)}(r,e),r.processRawJSON=function(e,r){return void 0===r&&(r={}),i(function(){var e,t,o;return a(this,function(i){if(t=null==(e=r.pluginData)?void 0:e.downgrade){if(t.downgrade)throw Error("Downgraded, reason: "+t.reason)}else n.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return r.renderLevel||(r.renderLevel=null!=(o=null==t?void 0:t.level)?o:y()),[2]})})()},r}(n.AbstractPlugin);if(n.canUseBOM){var D=n.isAlipayMiniApp()?my:window.AlipayJSBridge;n.logger.register(function(e,r){for(var t=arguments.length,o=Array(t>2?t-2:0),i=2;i<t;i++)o[i-2]=arguments[i];var l={message:"[Galacean Effects] "+r+" "+o.join(""),level:e};n.isAndroid()&&(l.anr_info="mars");try{null==D||D.call("localLog",l)}catch(e){console.error(e)}})}var P="2.7.
|
|
6
|
+
* Version: v2.7.3
|
|
7
|
+
*/function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).ge=e.ge||{},e.ge.alipayDowngradePlugin={}),e.ge)}(this,function(e,n){"use strict";var r,t=function(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}}),n.default=e,Object.freeze(n)}(n);function o(e,n,r,t,o,i,l){try{var a=e[i](l),s=a.value}catch(e){r(e);return}a.done?n(s):Promise.resolve(s).then(t,o)}function i(e){return function(){var n=this,r=arguments;return new Promise(function(t,i){var l=e.apply(n,r);function a(e){o(l,t,i,a,s,"next",e)}function s(e){o(l,t,i,a,s,"throw",e)}a(void 0)})}}function l(e,n){return(l=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function a(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(s){return function(a){if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e],t=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function s(){return(s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}"function"==typeof SuppressedError&&SuppressedError,e.DeviceLevel=void 0,(r=e.DeviceLevel||(e.DeviceLevel={})).High="high",r.Medium="medium",r.Low="low",r.Unknown="unknown";var u=["12,8","13,1","13,2","13,3","13,4"],c=function(){function r(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=e.DeviceLevel.Unknown,this.isDowngrade=!1}var t=r.prototype;return t.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=e.system;this.isIOS="iOS"===r,this.model=void 0===t?"UNKNOWN_DEVICE":t,this.system=void 0===o?"Unknown":o,this.setLevel(n)},t.getDowngradeDecision=function(r){var t=void 0,o=void 0;if(r.error)return{downgrade:4!==r.error,level:this.getRenderLevel(),reason:"api error: "+r.error};try{var i=n.isString(r)?JSON.parse(r):r;if("downgradeResultType"in i?t=i.downgradeResultType:"resultType"in i&&(t=i.resultType,o=i.resultReason),r.context){var l=r.context.deviceInfo;if(l){var a=l.deviceLevel,s=d(a);s!==e.DeviceLevel.Unknown&&(this.level=s)}}}catch(e){n.logger.error(e)}return void 0===t?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===t?{downgrade:!0,level:this.getRenderLevel(),reason:function(e){if(-1===e)return""+e+", unable to pull configuration";if(0===e)return""+e+", no downgrade";if(1===e)return""+e+", memory downgrade";if(2===e)return""+e+", crash downgrade";if(3===e)return""+e+", basic dimension downgrade";if(4===e)return""+e+", technical point downgrade";if(5===e)return""+e+", GPU downgrade";else if(6===e)return""+e+", self-healing downgrade";else if(7===e)return""+e+", 32-bit CPU downgrade";else return""+e}(o)}:n.isAlipayMiniApp()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+t}},t.getRenderLevel=function(){return this.level===e.DeviceLevel.High?n.spec.RenderLevel.S:this.level===e.DeviceLevel.Medium?n.spec.RenderLevel.A:this.level===e.DeviceLevel.Low?n.spec.RenderLevel.B:this.isIOS?n.spec.RenderLevel.S:n.spec.RenderLevel.B},t.setLevel=function(n){if(this.level=d(n),this.level===e.DeviceLevel.Unknown&&/iPhone(\d+),/.test(this.model)){var r=+RegExp.$1;r<=9?this.level=e.DeviceLevel.Low:r<10?this.level=e.DeviceLevel.Medium:this.level=e.DeviceLevel.High}},t.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&u.find(function(n){return n===e.model})){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},r}();function d(n){return"high"===n?e.DeviceLevel.High:"medium"===n||"middle"===n?e.DeviceLevel.Medium:"low"===n?e.DeviceLevel.Low:e.DeviceLevel.Unknown}var f=Symbol("@@_inter_pause"),v="mock-fail",p=!1;function g(){return(g=i(function(e,r){var t,o,i,l,u;return a(this,function(a){var d;return(void 0===r&&(r={}),n.canUseBOM)?(p||(p=!0,d=r.autoPause,window.addEventListener("unload",function(){n.getActivePlayers().forEach(function(e){return e.dispose()})}),d&&(document.addEventListener("pause",m),document.addEventListener("resume",L))),e===v||"mock-pass"===e)?[2,Promise.resolve({bizId:e,downgrade:e===v,level:null!=(o=r.level)?o:n.spec.RenderLevel.S,reason:"mock"})]:(i=n.isAlipayMiniApp()?my:window.AlipayJSBridge)||r.systemInfo&&r.downgradeResult?(u=performance.now(),[2,(function(e,n){return h.apply(this,arguments)})(r,i).then(function(t){var o=performance.now();return(function(e,n,r){return w.apply(this,arguments)})(e,r,i).then(function(i){var l=performance.now();n.logger.info("Downgrade time: "+(l-u)+"ms.");var a=new c;a.setSystemInfo(t);var d=a.getDowngradeDecision(i);return r.level&&(d.level=r.level),s({},d,{bizId:e,systemInfo:t,systemTime:o-u,downgradeResult:i,downgradeTime:l-o})})})]):[2,{bizId:e,downgrade:!1,level:null!=(l=r.level)?l:n.spec.RenderLevel.S,reason:"Non-Alipay environment"}]:[2,Promise.resolve({bizId:e,downgrade:!0,level:null!=(t=r.level)?t:n.spec.RenderLevel.S,reason:"当前环境无法访问 window"})]})})).apply(this,arguments)}function h(){return(h=i(function(e,n){return a(this,function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise(function(e,r){n.call("getSystemInfo",function(n){n.error?r(n):e(n)})})]})})).apply(this,arguments)}function w(){return(w=i(function(e,n,r){return a(this,function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise(function(t,o){var i,l=["mars"],a=n.techPoint;a&&l.push.apply(l,[].concat(a)),(null!=(i=n.callBridge)?i:r.call)("getDowngradeResult",{bizId:e,scene:0,ext:{techPoint:l}},function(e){t(e)})})]})})).apply(this,arguments)}function y(){return n.isIOS()?n.spec.RenderLevel.S:n.spec.RenderLevel.B}function m(e){e.target===document&&(n.logger.info("Auto pause all players with data offloaded."),n.getActivePlayers().forEach(function(e){e.paused||(e.pause({offloadTexture:!0}),e[f]=!0)}))}function L(e){e.target===document&&(n.logger.info("Auto resume all players."),n.getActivePlayers().forEach(function(e){e[f]&&(e.resume(),e[f]=!1)}))}var b=function(e){function r(){return e.apply(this,arguments)}return!function(e,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&l(e,n)}(r,e),r.processRawJSON=function(e,r){return void 0===r&&(r={}),i(function(){var e,t,o;return a(this,function(i){if(t=null==(e=r.pluginData)?void 0:e.downgrade){if(t.downgrade)throw Error("Downgraded, reason: "+t.reason)}else n.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return r.renderLevel||(r.renderLevel=null!=(o=null==t?void 0:t.level)?o:y()),[2]})})()},r}(n.AbstractPlugin);if(n.canUseBOM){var D=n.isAlipayMiniApp()?my:window.AlipayJSBridge;n.logger.register(function(e,r){for(var t=arguments.length,o=Array(t>2?t-2:0),i=2;i<t;i++)o[i-2]=arguments[i];var l={message:"[Galacean Effects] "+r+" "+o.join(""),level:e};n.isAndroid()&&(l.anr_info="mars");try{null==D||D.call("localLog",l)}catch(e){console.error(e)}})}var P="2.7.3";n.registerPlugin("alipay-downgrade",b,n.VFXItem),n.logger.info("Plugin downgrade version: "+P+"."),P!==t.version&&console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),e.getDefaultRenderLevel=y,e.getDowngradeResult=function(e){return g.apply(this,arguments)},e.version=P,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
8
8
|
//# sourceMappingURL=index.min.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects player downgrade plugin for Alipay
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,意绮,飂兮
|
|
6
|
-
* Version: v2.7.
|
|
6
|
+
* Version: v2.7.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -628,7 +628,7 @@ if (canUseBOM) {
|
|
|
628
628
|
|
|
629
629
|
/**
|
|
630
630
|
* 插件版本号
|
|
631
|
-
*/ var version = "2.7.
|
|
631
|
+
*/ var version = "2.7.3";
|
|
632
632
|
registerPlugin("alipay-downgrade", AlipayDowngradePlugin, VFXItem);
|
|
633
633
|
logger.info("Plugin downgrade version: " + version + ".");
|
|
634
634
|
if (version !== EFFECTS.version) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/effects-plugin-alipay-downgrade",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.3",
|
|
4
4
|
"description": "Galacean Effects player downgrade plugin for Alipay",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"registry": "https://registry.npmjs.org"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@galacean/effects": "2.7.
|
|
42
|
+
"@galacean/effects": "2.7.3"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"dev": "vite",
|