@xuda.io/xuda-worker-bundle-min 1.3.251 → 1.3.253

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.
Files changed (2) hide show
  1. package/index.js +22 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -742,8 +742,16 @@ glb.worker_queue_num = 0;
742
742
  func.common.get_module = async function (SESSION_ID, module) {
743
743
  let ret;
744
744
 
745
- const invoke_init_module = function () {
746
- if (!ret.init_module) return;
745
+ const get_ret = async function (src) {
746
+ const module_ret = await import(src);
747
+ var params = get_params();
748
+
749
+ return module_ret.XudaModule
750
+ ? new module_ret.XudaModule(params)
751
+ : invoke_init_module(module_ret, params);
752
+ };
753
+
754
+ const get_params = function () {
747
755
  let params = {
748
756
  glb,
749
757
  func,
@@ -761,12 +769,17 @@ func.common.get_module = async function (SESSION_ID, module) {
761
769
 
762
770
  if (typeof IS_DOCKER !== "undefined") params.IS_DOCKER = IS_DOCKER;
763
771
 
764
- ret.init_module(params);
772
+ return params;
773
+ };
774
+ const invoke_init_module = function (module_ret, params) {
775
+ if (!module_ret.init_module) return;
776
+
777
+ return module_ret.init_module(params);
765
778
  };
766
779
  const _session = SESSION_OBJ[SESSION_ID];
767
780
  if (_session.worker_type === "Dev") {
768
- ret = await import("./modules/" + module);
769
- invoke_init_module();
781
+ ret = await get_ret("./modules/" + module);
782
+ // invoke_init_module();
770
783
  return ret;
771
784
  }
772
785
  if (_session.worker_type === "Debug") {
@@ -796,7 +809,7 @@ func.common.get_module = async function (SESSION_ID, module) {
796
809
  )
797
810
  );
798
811
  }
799
- invoke_init_module();
812
+ // invoke_init_module();
800
813
  return ret;
801
814
  }
802
815
 
@@ -810,10 +823,7 @@ func.common.get_module = async function (SESSION_ID, module) {
810
823
  typeof IS_DOCKER !== "undefined" ||
811
824
  typeof IS_PROCESS_SERVER !== "undefined"
812
825
  ) {
813
- // ret = await import(
814
- // `${_conf.xuda_home}root/dist/runtime/js/modules/` + rep()
815
- // );
816
- ret = await import(
826
+ ret = await get_ret(
817
827
  func.utils.get_resource_filename(
818
828
  SESSION_OBJ[SESSION_ID].engine_mode === "live_preview"
819
829
  ? ""
@@ -822,7 +832,7 @@ func.common.get_module = async function (SESSION_ID, module) {
822
832
  )
823
833
  );
824
834
  } else {
825
- ret = await import(
835
+ ret = await get_ret(
826
836
  func.common.get_url(
827
837
  SESSION_ID,
828
838
  "dist",
@@ -835,7 +845,7 @@ func.common.get_module = async function (SESSION_ID, module) {
835
845
  )
836
846
  );
837
847
  }
838
- invoke_init_module();
848
+ // invoke_init_module();
839
849
  return ret;
840
850
  };
841
851
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.251",
3
+ "version": "1.3.253",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {