@galacean/effects-core 2.6.2 → 2.6.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/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.6.2
6
+ * Version: v2.6.3
7
7
  */
8
8
 
9
9
  'use strict';
@@ -795,6 +795,28 @@ function noop() {}
795
795
  */ function isObject(obj) {
796
796
  return Object.prototype.toString.call(obj) === "[object Object]";
797
797
  }
798
+ /**
799
+ * 判断对象是否是`Plain Object`类型
800
+ *
801
+ * @param obj - 要判断的对象
802
+ * @returns
803
+ */ function isPlainObject(obj) {
804
+ if (obj === null || typeof obj !== "object") {
805
+ return false;
806
+ }
807
+ // 先排除 Array/Date/Map/Set/RegExp 等
808
+ if (Object.prototype.toString.call(obj) !== "[object Object]") {
809
+ return false;
810
+ }
811
+ var proto = Object.getPrototypeOf(obj);
812
+ if (proto === null) {
813
+ return true;
814
+ } // Object.create(null)
815
+ var hasOwn = Object.prototype.hasOwnProperty;
816
+ var Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
817
+ // 构造器需要是 Object(跨 realm 用函数源码比对)
818
+ return typeof Ctor === "function" && Function.prototype.toString.call(Ctor) === Function.prototype.toString.call(Object);
819
+ }
798
820
  function isCanvas(canvas) {
799
821
  var _canvas_tagName;
800
822
  // 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
@@ -29428,7 +29450,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
29428
29450
  } else if (SerializationHelper.checkDataPath(property)) {
29429
29451
  var referenceObject = engine.findObject(property);
29430
29452
  return overrideDataPath ? referenceObject : property;
29431
- } else if (isObject(property) && property.constructor === Object) {
29453
+ } else if (isPlainObject(property)) {
29432
29454
  var res1;
29433
29455
  if (type) {
29434
29456
  res1 = new type();
@@ -31099,7 +31121,7 @@ function getStandardSpriteContent(sprite, transform) {
31099
31121
  return ret;
31100
31122
  }
31101
31123
 
31102
- var version$1 = "2.6.2";
31124
+ var version$1 = "2.6.3";
31103
31125
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
31104
31126
  var standardVersion = /^(\d+)\.(\d+)$/;
31105
31127
  var reverseParticle = false;
@@ -31687,6 +31709,10 @@ var seed = 1;
31687
31709
  ];
31688
31710
  case 1:
31689
31711
  rawJSON = _state.sent();
31712
+ // 小程序环境下,如果产物是相对路径,adapter 返回的是字符串,需要兼容
31713
+ if (isString(rawJSON)) {
31714
+ rawJSON = JSON.parse(rawJSON);
31715
+ }
31690
31716
  return [
31691
31717
  3,
31692
31718
  3
@@ -34009,7 +34035,7 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
34009
34035
  * @ignore
34010
34036
  */ _proto.findObject = function findObject(guid) {
34011
34037
  // 编辑器可能传 Class 对象,这边判断处理一下直接返回原对象。
34012
- if (!(isObject(guid) && guid.constructor === Object)) {
34038
+ if (!isPlainObject(guid)) {
34013
34039
  return guid;
34014
34040
  }
34015
34041
  if (this.objectInstance[guid.id]) {
@@ -34349,7 +34375,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
34349
34375
  registerPlugin("particle", ParticleLoader, exports.VFXItem);
34350
34376
  registerPlugin("cal", CalculateLoader, exports.VFXItem);
34351
34377
  registerPlugin("interact", InteractLoader, exports.VFXItem);
34352
- var version = "2.6.2";
34378
+ var version = "2.6.3";
34353
34379
  logger.info("Core version: " + version + ".");
34354
34380
 
34355
34381
  exports.AbstractPlugin = AbstractPlugin;
@@ -34577,6 +34603,7 @@ exports.isIOSByUA = isIOSByUA;
34577
34603
  exports.isMiniProgram = isMiniProgram;
34578
34604
  exports.isObject = isObject;
34579
34605
  exports.isOpenHarmony = isOpenHarmony;
34606
+ exports.isPlainObject = isPlainObject;
34580
34607
  exports.isSimulatorCellPhone = isSimulatorCellPhone;
34581
34608
  exports.isString = isString;
34582
34609
  exports.isUniformStruct = isUniformStruct;