@galacean/effects-plugin-alipay-downgrade 2.8.0 → 2.8.1
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(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(s=function(){return!!e})()}function u(e,n,r){return u=s()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&a(o,r.prototype),o},u.apply(null,arguments)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function d(e){var n="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return u(e,arguments,c(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),a(t,e)},d(e)}function p(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 f(){return f=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},f.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 v=["12,8","13,1","13,2","13,3","13,4"],g=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=w(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:h(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=w(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&&v.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 h(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 w(e){return"high"===e?exports.DeviceLevel.High:"medium"===e||"middle"===e?exports.DeviceLevel.Medium:"low"===e?exports.DeviceLevel.Low:exports.DeviceLevel.Unknown}var y=Symbol("@@_inter_pause"),m="mock-pass",b="mock-fail",L=!1;function O(){return O=l((function(r,t){var o,i,l,a,s;return p(this,(function(u){return void 0===t&&(t={}),e.canUseBOM?(L||(L=!0,function(r){var t=r.autoPause;n.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",R),document.addEventListener("resume",I))}(t)),r===b||r===m?[2,Promise.resolve({bizId:r,downgrade:r===b,level:null!=(i=t.level)?i:e.spec.RenderLevel.S,reason:"mock"})]:(l=e.isAlipayMiniApp()?my:n.window.AlipayJSBridge)||t.systemInfo&&t.downgradeResult?(s=performance.now(),[2,x(t,l).then((function(n){var o=performance.now();return function(e,n,r){return P.apply(this,arguments)}(r,t,l).then((function(i){var l=performance.now();e.logger.info("Downgrade time: "+(l-s)+"ms.");var a=new g;a.setSystemInfo(n);var u=a.getDowngradeDecision(i);return t.level&&(u.level=t.level),f({},u,{bizId:r,systemInfo:n,systemTime:o-s,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"})]}))})),O.apply(this,arguments)}function x(e,n){return D.apply(this,arguments)}function D(){return D=l((function(e,n){return p(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)}))}))]}))})),D.apply(this,arguments)}function P(){return P=l((function(e,n,r){return p(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)}))}))]}))})),P.apply(this,arguments)}function S(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function R(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[y]=!0)})))}function I(n){n.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[y]&&(e.resume(),e[y]=!1)})))}var A=function(n){function r(){var e;return(e=n.call(this)||this).order=1,e}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.prototype.onAssetsLoadStart=function(n,r){return l((function(){var n,t,o;return p(this,(function(i){if(t=null==(n=(r=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:S()),[2]}))}))()},r}(d(e.Plugin));if(e.canUseBOM){var E=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==E||E.call("localLog",l)}catch(e){console.error(e)}}))}var j="2.8.
|
|
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(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(s=function(){return!!e})()}function u(e,n,r){return u=s()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&a(o,r.prototype),o},u.apply(null,arguments)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function d(e){var n="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return u(e,arguments,c(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),a(t,e)},d(e)}function p(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 f(){return f=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},f.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 v=["12,8","13,1","13,2","13,3","13,4"],g=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=w(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:h(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=w(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&&v.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 h(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 w(e){return"high"===e?exports.DeviceLevel.High:"medium"===e||"middle"===e?exports.DeviceLevel.Medium:"low"===e?exports.DeviceLevel.Low:exports.DeviceLevel.Unknown}var y=Symbol("@@_inter_pause"),m="mock-pass",b="mock-fail",L=!1;function O(){return O=l((function(r,t){var o,i,l,a,s;return p(this,(function(u){return void 0===t&&(t={}),e.canUseBOM?(L||(L=!0,function(r){var t=r.autoPause;n.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",R),document.addEventListener("resume",I))}(t)),r===b||r===m?[2,Promise.resolve({bizId:r,downgrade:r===b,level:null!=(i=t.level)?i:e.spec.RenderLevel.S,reason:"mock"})]:(l=e.isAlipayMiniApp()?my:n.window.AlipayJSBridge)||t.systemInfo&&t.downgradeResult?(s=performance.now(),[2,x(t,l).then((function(n){var o=performance.now();return function(e,n,r){return P.apply(this,arguments)}(r,t,l).then((function(i){var l=performance.now();e.logger.info("Downgrade time: "+(l-s)+"ms.");var a=new g;a.setSystemInfo(n);var u=a.getDowngradeDecision(i);return t.level&&(u.level=t.level),f({},u,{bizId:r,systemInfo:n,systemTime:o-s,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"})]}))})),O.apply(this,arguments)}function x(e,n){return D.apply(this,arguments)}function D(){return D=l((function(e,n){return p(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)}))}))]}))})),D.apply(this,arguments)}function P(){return P=l((function(e,n,r){return p(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)}))}))]}))})),P.apply(this,arguments)}function S(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function R(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[y]=!0)})))}function I(n){n.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[y]&&(e.resume(),e[y]=!1)})))}var A=function(n){function r(){var e;return(e=n.call(this)||this).order=1,e}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.prototype.onAssetsLoadStart=function(n,r){return l((function(){var n,t,o;return p(this,(function(i){if(t=null==(n=(r=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:S()),[2]}))}))()},r}(d(e.Plugin));if(e.canUseBOM){var E=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==E||E.call("localLog",l)}catch(e){console.error(e)}}))}var j="2.8.1";e.registerPlugin("alipay-downgrade",A),e.logger.info("Plugin downgrade version: 2.8.1."),j!==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=S,exports.getDowngradeResult=function(e){return O.apply(this,arguments)},exports.version=j;
|
|
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,Plugin as u,isAndroid as s,registerPlugin as c}from"@galacean/effects/alipay";import{window as d}from"@galacean/appx-adapter/alipay";function f(e,n,r,t,o,i,a){try{var l=e[i](a),u=l.value}catch(e){return void r(e)}l.done?n(u):Promise.resolve(u).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){f(i,t,o,a,l,"next",e)}function l(e){f(i,t,o,a,l,"throw",e)}a(void 0)}))}}function v(e,n){return v=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},v(e,n)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}function g(e,n,r){return g=h()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&v(o,r.prototype),o},g.apply(null,arguments)}function w(e){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},w(e)}function y(e){var n="function"==typeof Map?new Map:void 0;return y=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return g(e,arguments,w(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),v(t,e)},y(e)}function m(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(u){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,u])}}}function b(){return b=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},b.apply(this,arguments)}var L;"function"==typeof SuppressedError&&SuppressedError,function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(L||(L={}));var S=["12,8","13,1","13,2","13,3","13,4"],R=function(){function e(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=L.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 u=P(l.deviceLevel);u!==L.Unknown&&(this.level=u)}}}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:O(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===L.High?o.RenderLevel.S:this.level===L.Medium?o.RenderLevel.A:this.level===L.Low?o.RenderLevel.B:this.isIOS?o.RenderLevel.S:o.RenderLevel.B},i.setLevel=function(e){if(this.level=P(e),this.level===L.Unknown&&/iPhone(\d+),/.test(this.model)){var n=+RegExp.$1;this.level=n<=9?L.Low:n<10?L.Medium:L.High}},i.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&S.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 O(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?L.High:"medium"===e||"middle"===e?L.Medium:"low"===e?L.Low:L.Unknown}var I=Symbol("@@_inter_pause"),E="mock-pass",k="mock-fail",x=!1;function D(e){return _.apply(this,arguments)}function _(){return _=p((function(e,n){var i,u,s,c,f;return m(this,(function(p){return void 0===n&&(n={}),a?(x||(x=!0,function(e){var n=e.autoPause;d.addEventListener("unload",(function(){l().forEach((function(e){return e.dispose()}))})),n&&(document.addEventListener("pause",B),document.addEventListener("resume",M))}(n)),e===k||e===E?[2,Promise.resolve({bizId:e,downgrade:e===k,level:null!=(u=n.level)?u:o.RenderLevel.S,reason:"mock"})]:(s=t()?my:d.AlipayJSBridge)||n.systemInfo&&n.downgradeResult?(f=performance.now(),[2,j(n,s).then((function(t){var o=performance.now();return function(e,n,r){return U.apply(this,arguments)}(e,n,s).then((function(i){var a=performance.now();r.info("Downgrade time: "+(a-f)+"ms.");var l=new R;l.setSystemInfo(t);var u=l.getDowngradeDecision(i);return n.level&&(u.level=n.level),b({},u,{bizId:e,systemInfo:t,systemTime:o-f,downgradeResult:i,downgradeTime:a-o})}))}))]):[2,{bizId:e,downgrade:!1,level:null!=(c=n.level)?c: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"})]}))})),_.apply(this,arguments)}function j(e,n){return T.apply(this,arguments)}function T(){return T=p((function(e,n){return m(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)}))}))]}))})),T.apply(this,arguments)}function U(){return U=p((function(e,n,r){return m(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 u,s={bizId:e,scene:0,ext:{techPoint:a}};(null!=(u=n.callBridge)?u:r.call)("getDowngradeResult",s,(function(e){t(e)}))}))]}))})),U.apply(this,arguments)}function A(){return i()?o.RenderLevel.S:o.RenderLevel.B}function B(e){e.target===document&&(r.info("Auto pause all players with data offloaded."),l().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[I]=!0)})))}function M(e){e.target===document&&(r.info("Auto resume all players."),l().forEach((function(e){e[I]&&(e.resume(),e[I]=!1)})))}var z=function(e){function n(){var n;return(n=e.call(this)||this).order=1,n}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&&v(e,n)}(n,e),n.prototype.onAssetsLoadStart=function(e,n){return p((function(){var e,t,o;return m(this,(function(i){if(t=null==(e=(n=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:A()),[2]}))}))()},n}(y(u));if(a){var N=t()?my:d.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};s()&&(i.anr_info="mars");try{null==N||N.call("localLog",i)}catch(e){console.error(e)}}))}var F="2.8.
|
|
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,Plugin as u,isAndroid as s,registerPlugin as c}from"@galacean/effects/alipay";import{window as d}from"@galacean/appx-adapter/alipay";function f(e,n,r,t,o,i,a){try{var l=e[i](a),u=l.value}catch(e){return void r(e)}l.done?n(u):Promise.resolve(u).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){f(i,t,o,a,l,"next",e)}function l(e){f(i,t,o,a,l,"throw",e)}a(void 0)}))}}function v(e,n){return v=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},v(e,n)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}function g(e,n,r){return g=h()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&v(o,r.prototype),o},g.apply(null,arguments)}function w(e){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},w(e)}function y(e){var n="function"==typeof Map?new Map:void 0;return y=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return g(e,arguments,w(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),v(t,e)},y(e)}function m(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(u){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,u])}}}function b(){return b=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},b.apply(this,arguments)}var L;"function"==typeof SuppressedError&&SuppressedError,function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(L||(L={}));var S=["12,8","13,1","13,2","13,3","13,4"],R=function(){function e(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=L.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 u=P(l.deviceLevel);u!==L.Unknown&&(this.level=u)}}}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:O(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===L.High?o.RenderLevel.S:this.level===L.Medium?o.RenderLevel.A:this.level===L.Low?o.RenderLevel.B:this.isIOS?o.RenderLevel.S:o.RenderLevel.B},i.setLevel=function(e){if(this.level=P(e),this.level===L.Unknown&&/iPhone(\d+),/.test(this.model)){var n=+RegExp.$1;this.level=n<=9?L.Low:n<10?L.Medium:L.High}},i.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&S.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 O(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?L.High:"medium"===e||"middle"===e?L.Medium:"low"===e?L.Low:L.Unknown}var I=Symbol("@@_inter_pause"),E="mock-pass",k="mock-fail",x=!1;function D(e){return _.apply(this,arguments)}function _(){return _=p((function(e,n){var i,u,s,c,f;return m(this,(function(p){return void 0===n&&(n={}),a?(x||(x=!0,function(e){var n=e.autoPause;d.addEventListener("unload",(function(){l().forEach((function(e){return e.dispose()}))})),n&&(document.addEventListener("pause",B),document.addEventListener("resume",M))}(n)),e===k||e===E?[2,Promise.resolve({bizId:e,downgrade:e===k,level:null!=(u=n.level)?u:o.RenderLevel.S,reason:"mock"})]:(s=t()?my:d.AlipayJSBridge)||n.systemInfo&&n.downgradeResult?(f=performance.now(),[2,j(n,s).then((function(t){var o=performance.now();return function(e,n,r){return U.apply(this,arguments)}(e,n,s).then((function(i){var a=performance.now();r.info("Downgrade time: "+(a-f)+"ms.");var l=new R;l.setSystemInfo(t);var u=l.getDowngradeDecision(i);return n.level&&(u.level=n.level),b({},u,{bizId:e,systemInfo:t,systemTime:o-f,downgradeResult:i,downgradeTime:a-o})}))}))]):[2,{bizId:e,downgrade:!1,level:null!=(c=n.level)?c: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"})]}))})),_.apply(this,arguments)}function j(e,n){return T.apply(this,arguments)}function T(){return T=p((function(e,n){return m(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)}))}))]}))})),T.apply(this,arguments)}function U(){return U=p((function(e,n,r){return m(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 u,s={bizId:e,scene:0,ext:{techPoint:a}};(null!=(u=n.callBridge)?u:r.call)("getDowngradeResult",s,(function(e){t(e)}))}))]}))})),U.apply(this,arguments)}function A(){return i()?o.RenderLevel.S:o.RenderLevel.B}function B(e){e.target===document&&(r.info("Auto pause all players with data offloaded."),l().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[I]=!0)})))}function M(e){e.target===document&&(r.info("Auto resume all players."),l().forEach((function(e){e[I]&&(e.resume(),e[I]=!1)})))}var z=function(e){function n(){var n;return(n=e.call(this)||this).order=1,n}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&&v(e,n)}(n,e),n.prototype.onAssetsLoadStart=function(e,n){return p((function(){var e,t,o;return m(this,(function(i){if(t=null==(e=(n=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:A()),[2]}))}))()},n}(y(u));if(a){var N=t()?my:d.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};s()&&(i.anr_info="mars");try{null==N||N.call("localLog",i)}catch(e){console.error(e)}}))}var F="2.8.1";c("alipay-downgrade",z),r.info("Plugin downgrade version: 2.8.1."),F!==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{L as DeviceLevel,A as getDefaultRenderLevel,D as getDowngradeResult,F 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.8.
|
|
6
|
+
* Version: v2.8.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -723,7 +723,7 @@ if (EFFECTS.canUseBOM) {
|
|
|
723
723
|
|
|
724
724
|
/**
|
|
725
725
|
* 插件版本号
|
|
726
|
-
*/ var version = "2.8.
|
|
726
|
+
*/ var version = "2.8.1";
|
|
727
727
|
EFFECTS.registerPlugin("alipay-downgrade", AlipayDowngradePlugin);
|
|
728
728
|
EFFECTS.logger.info("Plugin downgrade version: " + version + ".");
|
|
729
729
|
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.8.
|
|
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),u=a.value}catch(e){r(e);return}a.done?n(u):Promise.resolve(u).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,u,"next",e)}function u(e){o(l,t,i,a,u,"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(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e,n,r){return(u=a()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&l(o,r.prototype),o}).apply(null,arguments)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e){var n="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,r)}function r(){return u(e,arguments,s(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)})(e)}function f(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(u){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,u])}}}function d(){return(d=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 v=["12,8","13,1","13,2","13,3","13,4"],p=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,u=g(a);u!==e.DeviceLevel.Unknown&&(this.level=u)}}}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=g(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&&v.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 g(n){return"high"===n?e.DeviceLevel.High:"medium"===n||"middle"===n?e.DeviceLevel.Medium:"low"===n?e.DeviceLevel.Low:e.DeviceLevel.Unknown}var h=Symbol("@@_inter_pause"),y="mock-fail",w=!1;function m(){return(m=i(function(e,r){var t,o,i,l,a;return f(this,function(u){var s;return(void 0===r&&(r={}),n.canUseBOM)?(w||(w=!0,s=r.autoPause,window.addEventListener("unload",function(){n.getActivePlayers().forEach(function(e){return e.dispose()})}),s&&(document.addEventListener("pause",D),document.addEventListener("resume",P))),e===y||"mock-pass"===e)?[2,Promise.resolve({bizId:e,downgrade:e===y,level:null!=(o=r.level)?o:n.spec.RenderLevel.S,reason:"mock"})]:(i=n.isAlipayMiniApp()?my:window.AlipayJSBridge)||r.systemInfo&&r.downgradeResult?(a=performance.now(),[2,(function(e,n){return b.apply(this,arguments)})(r,i).then(function(t){var o=performance.now();return(function(e,n,r){return L.apply(this,arguments)})(e,r,i).then(function(i){var l=performance.now();n.logger.info("Downgrade time: "+(l-a)+"ms.");var u=new p;u.setSystemInfo(t);var s=u.getDowngradeDecision(i);return r.level&&(s.level=r.level),d({},s,{bizId:e,systemInfo:t,systemTime:o-a,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 b(){return(b=i(function(e,n){return f(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 L(){return(L=i(function(e,n,r){return f(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 O(){return n.isIOS()?n.spec.RenderLevel.S:n.spec.RenderLevel.B}function D(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[h]=!0)}))}function P(e){e.target===document&&(n.logger.info("Auto resume all players."),n.getActivePlayers().forEach(function(e){e[h]&&(e.resume(),e[h]=!1)}))}var S=function(e){function r(){var n;return(n=e.call(this)||this).order=1,n}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.prototype.onAssetsLoadStart=function(e,r){return i(function(){var e,t,o;return f(this,function(i){if(t=null==(e=(r=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:O()),[2]})})()},r}(c(n.Plugin));if(n.canUseBOM){var R=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==R||R.call("localLog",l)}catch(e){console.error(e)}})}var I="2.8.
|
|
6
|
+
* Version: v2.8.1
|
|
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),u=a.value}catch(e){r(e);return}a.done?n(u):Promise.resolve(u).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,u,"next",e)}function u(e){o(l,t,i,a,u,"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(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e,n,r){return(u=a()?Reflect.construct:function(e,n,r){var t=[null];t.push.apply(t,n);var o=new(Function.bind.apply(e,t));return r&&l(o,r.prototype),o}).apply(null,arguments)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e){var n="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,r)}function r(){return u(e,arguments,s(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)})(e)}function f(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(u){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,u])}}}function d(){return(d=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 v=["12,8","13,1","13,2","13,3","13,4"],p=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,u=g(a);u!==e.DeviceLevel.Unknown&&(this.level=u)}}}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=g(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&&v.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 g(n){return"high"===n?e.DeviceLevel.High:"medium"===n||"middle"===n?e.DeviceLevel.Medium:"low"===n?e.DeviceLevel.Low:e.DeviceLevel.Unknown}var h=Symbol("@@_inter_pause"),y="mock-fail",w=!1;function m(){return(m=i(function(e,r){var t,o,i,l,a;return f(this,function(u){var s;return(void 0===r&&(r={}),n.canUseBOM)?(w||(w=!0,s=r.autoPause,window.addEventListener("unload",function(){n.getActivePlayers().forEach(function(e){return e.dispose()})}),s&&(document.addEventListener("pause",D),document.addEventListener("resume",P))),e===y||"mock-pass"===e)?[2,Promise.resolve({bizId:e,downgrade:e===y,level:null!=(o=r.level)?o:n.spec.RenderLevel.S,reason:"mock"})]:(i=n.isAlipayMiniApp()?my:window.AlipayJSBridge)||r.systemInfo&&r.downgradeResult?(a=performance.now(),[2,(function(e,n){return b.apply(this,arguments)})(r,i).then(function(t){var o=performance.now();return(function(e,n,r){return L.apply(this,arguments)})(e,r,i).then(function(i){var l=performance.now();n.logger.info("Downgrade time: "+(l-a)+"ms.");var u=new p;u.setSystemInfo(t);var s=u.getDowngradeDecision(i);return r.level&&(s.level=r.level),d({},s,{bizId:e,systemInfo:t,systemTime:o-a,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 b(){return(b=i(function(e,n){return f(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 L(){return(L=i(function(e,n,r){return f(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 O(){return n.isIOS()?n.spec.RenderLevel.S:n.spec.RenderLevel.B}function D(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[h]=!0)}))}function P(e){e.target===document&&(n.logger.info("Auto resume all players."),n.getActivePlayers().forEach(function(e){e[h]&&(e.resume(),e[h]=!1)}))}var S=function(e){function r(){var n;return(n=e.call(this)||this).order=1,n}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.prototype.onAssetsLoadStart=function(e,r){return i(function(){var e,t,o;return f(this,function(i){if(t=null==(e=(r=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:O()),[2]})})()},r}(c(n.Plugin));if(n.canUseBOM){var R=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==R||R.call("localLog",l)}catch(e){console.error(e)}})}var I="2.8.1";n.registerPlugin("alipay-downgrade",S),n.logger.info("Plugin downgrade version: "+I+"."),I!==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=O,e.getDowngradeResult=function(e){return m.apply(this,arguments)},e.version=I,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.8.
|
|
6
|
+
* Version: v2.8.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -700,7 +700,7 @@ if (canUseBOM) {
|
|
|
700
700
|
|
|
701
701
|
/**
|
|
702
702
|
* 插件版本号
|
|
703
|
-
*/ var version = "2.8.
|
|
703
|
+
*/ var version = "2.8.1";
|
|
704
704
|
registerPlugin("alipay-downgrade", AlipayDowngradePlugin);
|
|
705
705
|
logger.info("Plugin downgrade version: " + version + ".");
|
|
706
706
|
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.8.
|
|
3
|
+
"version": "2.8.1",
|
|
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.8.
|
|
42
|
+
"@galacean/effects": "2.8.1"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"dev": "vite",
|