@module-federation/runtime 0.0.0-next-20231229025030 → 0.0.0-next-20231229091919

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/share.cjs.js CHANGED
@@ -91,41 +91,39 @@ function _object_without_properties_loose(source, excluded) {
91
91
  // export const nativeGlobal: typeof global = new Function('return this')();
92
92
  const nativeGlobal = new Function('return this')();
93
93
  const Global = nativeGlobal;
94
+ function definePropertyGlobalVal(target, key, val) {
95
+ Object.defineProperty(target, key, {
96
+ value: val,
97
+ configurable: false,
98
+ writable: true
99
+ });
100
+ }
101
+ function includeOwnProperty(target, key) {
102
+ return Object.hasOwnProperty.call(target, key);
103
+ }
94
104
  // This section is to prevent encapsulation by certain microfrontend frameworks. Due to reuse policies, sandbox escapes.
95
105
  // The sandbox in the microfrontend does not replicate the value of 'configurable'.
96
106
  // If there is no loading content on the global object, this section defines the loading object.
97
- if (!Object.hasOwnProperty.call(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__')) {
98
- Object.defineProperty(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__', {
99
- value: {},
100
- configurable: false
101
- });
107
+ if (!includeOwnProperty(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__')) {
108
+ definePropertyGlobalVal(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__', {});
102
109
  }
103
110
  const globalLoading = globalThis.__GLOBAL_LOADING_REMOTE_ENTRY__;
104
111
  function setGlobalDefaultVal(target) {
105
112
  var _target___FEDERATION__, _target___FEDERATION__1, _target___FEDERATION__2, _target___FEDERATION__3, _target___FEDERATION__4, _target___FEDERATION__5, _target___FEDERATION__6;
106
- if (Object.hasOwnProperty.call(target, '__VMOK__')) {
107
- Object.defineProperty(target, '__FEDERATION__', {
108
- value: target.__VMOK__,
109
- configurable: false
110
- });
113
+ if (includeOwnProperty(target, '__VMOK__') && !includeOwnProperty(target, '__FEDERATION__')) {
114
+ definePropertyGlobalVal(target, '__FEDERATION__', target.__VMOK__);
111
115
  }
112
- if (!Object.hasOwnProperty.call(target, '__FEDERATION__')) {
113
- Object.defineProperty(target, '__FEDERATION__', {
114
- value: {
115
- __GLOBAL_PLUGIN__: [],
116
- __INSTANCES__: [],
117
- moduleInfo: {},
118
- __SHARE__: {},
119
- __MANIFEST_LOADING__: {},
120
- __SHARE_SCOPE_LOADING__: {},
121
- __PRELOADED_MAP__: new Map()
122
- },
123
- configurable: false
124
- });
125
- Object.defineProperty(target, '__VMOK__', {
126
- value: target.__FEDERATION__,
127
- configurable: false
116
+ if (!includeOwnProperty(target, '__FEDERATION__')) {
117
+ definePropertyGlobalVal(target, '__FEDERATION__', {
118
+ __GLOBAL_PLUGIN__: [],
119
+ __INSTANCES__: [],
120
+ moduleInfo: {},
121
+ __SHARE__: {},
122
+ __MANIFEST_LOADING__: {},
123
+ __SHARE_SCOPE_LOADING__: {},
124
+ __PRELOADED_MAP__: new Map()
128
125
  });
126
+ definePropertyGlobalVal(target, '__VMOK__', target.__FEDERATION__);
129
127
  }
130
128
  var ___GLOBAL_PLUGIN__;
131
129
  (___GLOBAL_PLUGIN__ = (_target___FEDERATION__ = target.__FEDERATION__).__GLOBAL_PLUGIN__) != null ? ___GLOBAL_PLUGIN__ : _target___FEDERATION__.__GLOBAL_PLUGIN__ = [];
package/dist/share.esm.js CHANGED
@@ -89,41 +89,39 @@ function _object_without_properties_loose(source, excluded) {
89
89
  // export const nativeGlobal: typeof global = new Function('return this')();
90
90
  const nativeGlobal = new Function('return this')();
91
91
  const Global = nativeGlobal;
92
+ function definePropertyGlobalVal(target, key, val) {
93
+ Object.defineProperty(target, key, {
94
+ value: val,
95
+ configurable: false,
96
+ writable: true
97
+ });
98
+ }
99
+ function includeOwnProperty(target, key) {
100
+ return Object.hasOwnProperty.call(target, key);
101
+ }
92
102
  // This section is to prevent encapsulation by certain microfrontend frameworks. Due to reuse policies, sandbox escapes.
93
103
  // The sandbox in the microfrontend does not replicate the value of 'configurable'.
94
104
  // If there is no loading content on the global object, this section defines the loading object.
95
- if (!Object.hasOwnProperty.call(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__')) {
96
- Object.defineProperty(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__', {
97
- value: {},
98
- configurable: false
99
- });
105
+ if (!includeOwnProperty(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__')) {
106
+ definePropertyGlobalVal(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__', {});
100
107
  }
101
108
  const globalLoading = globalThis.__GLOBAL_LOADING_REMOTE_ENTRY__;
102
109
  function setGlobalDefaultVal(target) {
103
110
  var _target___FEDERATION__, _target___FEDERATION__1, _target___FEDERATION__2, _target___FEDERATION__3, _target___FEDERATION__4, _target___FEDERATION__5, _target___FEDERATION__6;
104
- if (Object.hasOwnProperty.call(target, '__VMOK__')) {
105
- Object.defineProperty(target, '__FEDERATION__', {
106
- value: target.__VMOK__,
107
- configurable: false
108
- });
111
+ if (includeOwnProperty(target, '__VMOK__') && !includeOwnProperty(target, '__FEDERATION__')) {
112
+ definePropertyGlobalVal(target, '__FEDERATION__', target.__VMOK__);
109
113
  }
110
- if (!Object.hasOwnProperty.call(target, '__FEDERATION__')) {
111
- Object.defineProperty(target, '__FEDERATION__', {
112
- value: {
113
- __GLOBAL_PLUGIN__: [],
114
- __INSTANCES__: [],
115
- moduleInfo: {},
116
- __SHARE__: {},
117
- __MANIFEST_LOADING__: {},
118
- __SHARE_SCOPE_LOADING__: {},
119
- __PRELOADED_MAP__: new Map()
120
- },
121
- configurable: false
122
- });
123
- Object.defineProperty(target, '__VMOK__', {
124
- value: target.__FEDERATION__,
125
- configurable: false
114
+ if (!includeOwnProperty(target, '__FEDERATION__')) {
115
+ definePropertyGlobalVal(target, '__FEDERATION__', {
116
+ __GLOBAL_PLUGIN__: [],
117
+ __INSTANCES__: [],
118
+ moduleInfo: {},
119
+ __SHARE__: {},
120
+ __MANIFEST_LOADING__: {},
121
+ __SHARE_SCOPE_LOADING__: {},
122
+ __PRELOADED_MAP__: new Map()
126
123
  });
124
+ definePropertyGlobalVal(target, '__VMOK__', target.__FEDERATION__);
127
125
  }
128
126
  var ___GLOBAL_PLUGIN__;
129
127
  (___GLOBAL_PLUGIN__ = (_target___FEDERATION__ = target.__FEDERATION__).__GLOBAL_PLUGIN__) != null ? ___GLOBAL_PLUGIN__ : _target___FEDERATION__.__GLOBAL_PLUGIN__ = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.0-next-20231229025030",
3
+ "version": "0.0.0-next-20231229091919",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.esm.js",
@@ -45,6 +45,6 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@module-federation/sdk": "0.0.0-next-20231229025030"
48
+ "@module-federation/sdk": "0.0.0-next-20231229091919"
49
49
  }
50
50
  }