@module-federation/runtime 0.1.8 → 0.1.10

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/README.md CHANGED
@@ -10,4 +10,4 @@ See [https://module-federation.io/guide/basic/runtime.html](https://module-feder
10
10
 
11
11
  ## License
12
12
 
13
- `@module-federation/runtime` is [MIT licensed](https://github.com/module-federation/universe/blob/main/packages/runtime/LICENSE).
13
+ `@module-federation/runtime` is [MIT licensed](https://github.com/module-federation/core/blob/main/packages/runtime/LICENSE).
package/dist/index.cjs.js CHANGED
@@ -1699,7 +1699,7 @@ class FederationHost {
1699
1699
  // not used yet
1700
1700
  afterPreloadRemote: new AsyncHook()
1701
1701
  });
1702
- this.version = "0.1.8";
1702
+ this.version = "0.1.10";
1703
1703
  this.moduleCache = new Map();
1704
1704
  this.loaderHook = new PluginSystem({
1705
1705
  // FIXME: may not be suitable , not open to the public yet
@@ -1756,18 +1756,21 @@ function init(options) {
1756
1756
  }
1757
1757
  function loadRemote(...args) {
1758
1758
  share.assert(FederationInstance, 'Please call init first');
1759
+ const loadRemote1 = FederationInstance.loadRemote;
1759
1760
  // eslint-disable-next-line prefer-spread
1760
- return FederationInstance.loadRemote.apply(FederationInstance, args);
1761
+ return loadRemote1.apply(FederationInstance, args);
1761
1762
  }
1762
1763
  function loadShare(...args) {
1763
1764
  share.assert(FederationInstance, 'Please call init first');
1764
1765
  // eslint-disable-next-line prefer-spread
1765
- return FederationInstance.loadShare.apply(FederationInstance, args);
1766
+ const loadShare1 = FederationInstance.loadShare;
1767
+ return loadShare1.apply(FederationInstance, args);
1766
1768
  }
1767
1769
  function loadShareSync(...args) {
1768
1770
  share.assert(FederationInstance, 'Please call init first');
1771
+ const loadShareSync1 = FederationInstance.loadShareSync;
1769
1772
  // eslint-disable-next-line prefer-spread
1770
- return FederationInstance.loadShareSync.apply(FederationInstance, args);
1773
+ return loadShareSync1.apply(FederationInstance, args);
1771
1774
  }
1772
1775
  function preloadRemote(...args) {
1773
1776
  share.assert(FederationInstance, 'Please call init first');
package/dist/index.esm.js CHANGED
@@ -1697,7 +1697,7 @@ class FederationHost {
1697
1697
  // not used yet
1698
1698
  afterPreloadRemote: new AsyncHook()
1699
1699
  });
1700
- this.version = "0.1.8";
1700
+ this.version = "0.1.10";
1701
1701
  this.moduleCache = new Map();
1702
1702
  this.loaderHook = new PluginSystem({
1703
1703
  // FIXME: may not be suitable , not open to the public yet
@@ -1754,18 +1754,21 @@ function init(options) {
1754
1754
  }
1755
1755
  function loadRemote(...args) {
1756
1756
  assert(FederationInstance, 'Please call init first');
1757
+ const loadRemote1 = FederationInstance.loadRemote;
1757
1758
  // eslint-disable-next-line prefer-spread
1758
- return FederationInstance.loadRemote.apply(FederationInstance, args);
1759
+ return loadRemote1.apply(FederationInstance, args);
1759
1760
  }
1760
1761
  function loadShare(...args) {
1761
1762
  assert(FederationInstance, 'Please call init first');
1762
1763
  // eslint-disable-next-line prefer-spread
1763
- return FederationInstance.loadShare.apply(FederationInstance, args);
1764
+ const loadShare1 = FederationInstance.loadShare;
1765
+ return loadShare1.apply(FederationInstance, args);
1764
1766
  }
1765
1767
  function loadShareSync(...args) {
1766
1768
  assert(FederationInstance, 'Please call init first');
1769
+ const loadShareSync1 = FederationInstance.loadShareSync;
1767
1770
  // eslint-disable-next-line prefer-spread
1768
- return FederationInstance.loadShareSync.apply(FederationInstance, args);
1771
+ return loadShareSync1.apply(FederationInstance, args);
1769
1772
  }
1770
1773
  function preloadRemote(...args) {
1771
1774
  assert(FederationInstance, 'Please call init first');
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
package/dist/share.cjs.js CHANGED
@@ -190,7 +190,7 @@ function getGlobalFederationConstructor() {
190
190
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
191
191
  if (isDebug) {
192
192
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
193
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.8";
193
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.10";
194
194
  }
195
195
  }
196
196
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -293,7 +293,15 @@ const setPreloaded = (id)=>globalThis.__FEDERATION__.__PRELOADED_MAP__.set(id, t
293
293
  const DEFAULT_SCOPE = 'default';
294
294
  const DEFAULT_REMOTE_TYPE = 'global';
295
295
 
296
+ // fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts
296
297
  // those constants are based on https://www.rubydoc.info/gems/semantic_range/3.0.0/SemanticRange#BUILDIDENTIFIER-constant
298
+ // Copyright (c)
299
+ // vite-plugin-federation is licensed under Mulan PSL v2.
300
+ // You can use this software according to the terms and conditions of the Mulan PSL v2.
301
+ // You may obtain a copy of Mulan PSL v2 at:
302
+ // http://license.coscl.org.cn/MulanPSL2
303
+ // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
304
+ // See the Mulan PSL v2 for more details.
297
305
  const buildIdentifier = '[0-9A-Za-z-]+';
298
306
  const build = `(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`;
299
307
  const numericIdentifier = '0|[1-9]\\d*';
@@ -324,6 +332,7 @@ const comparator = `^${gtlt}\\s*(${fullPlain})$|^$`;
324
332
  // copy from semver package
325
333
  const gte0 = '^\\s*>=\\s*0.0.0\\s*$';
326
334
 
335
+ // fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts
327
336
  function parseRegex(source) {
328
337
  return new RegExp(source);
329
338
  }
@@ -344,6 +353,7 @@ function combineVersion(major, minor, patch, preRelease) {
344
353
  return mainVersion;
345
354
  }
346
355
 
356
+ // fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts
347
357
  function parseHyphen(range) {
348
358
  return range.replace(parseRegex(hyphenRange), (_range, from, fromMajor, fromMinor, fromPatch, _fromPreRelease, _fromBuild, to, toMajor, toMinor, toPatch, toPreRelease)=>{
349
359
  if (isXVersion(fromMajor)) {
@@ -490,6 +500,14 @@ function parseGTE0(comparatorString) {
490
500
  return comparatorString.trim().replace(parseRegex(gte0), '');
491
501
  }
492
502
 
503
+ // fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts
504
+ // Copyright (c)
505
+ // vite-plugin-federation is licensed under Mulan PSL v2.
506
+ // You can use this software according to the terms and conditions of the Mulan PSL v2.
507
+ // You may obtain a copy of Mulan PSL v2 at:
508
+ // http://license.coscl.org.cn/MulanPSL2
509
+ // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
510
+ // See the Mulan PSL v2 for more details.
493
511
  function compareAtom(rangeAtom, versionAtom) {
494
512
  rangeAtom = Number(rangeAtom) || rangeAtom;
495
513
  versionAtom = Number(versionAtom) || versionAtom;
package/dist/share.esm.js CHANGED
@@ -188,7 +188,7 @@ function getGlobalFederationConstructor() {
188
188
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
189
189
  if (isDebug) {
190
190
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
191
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.8";
191
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.10";
192
192
  }
193
193
  }
194
194
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -291,7 +291,15 @@ const setPreloaded = (id)=>globalThis.__FEDERATION__.__PRELOADED_MAP__.set(id, t
291
291
  const DEFAULT_SCOPE = 'default';
292
292
  const DEFAULT_REMOTE_TYPE = 'global';
293
293
 
294
+ // fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts
294
295
  // those constants are based on https://www.rubydoc.info/gems/semantic_range/3.0.0/SemanticRange#BUILDIDENTIFIER-constant
296
+ // Copyright (c)
297
+ // vite-plugin-federation is licensed under Mulan PSL v2.
298
+ // You can use this software according to the terms and conditions of the Mulan PSL v2.
299
+ // You may obtain a copy of Mulan PSL v2 at:
300
+ // http://license.coscl.org.cn/MulanPSL2
301
+ // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
302
+ // See the Mulan PSL v2 for more details.
295
303
  const buildIdentifier = '[0-9A-Za-z-]+';
296
304
  const build = `(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`;
297
305
  const numericIdentifier = '0|[1-9]\\d*';
@@ -322,6 +330,7 @@ const comparator = `^${gtlt}\\s*(${fullPlain})$|^$`;
322
330
  // copy from semver package
323
331
  const gte0 = '^\\s*>=\\s*0.0.0\\s*$';
324
332
 
333
+ // fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts
325
334
  function parseRegex(source) {
326
335
  return new RegExp(source);
327
336
  }
@@ -342,6 +351,7 @@ function combineVersion(major, minor, patch, preRelease) {
342
351
  return mainVersion;
343
352
  }
344
353
 
354
+ // fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts
345
355
  function parseHyphen(range) {
346
356
  return range.replace(parseRegex(hyphenRange), (_range, from, fromMajor, fromMinor, fromPatch, _fromPreRelease, _fromBuild, to, toMajor, toMinor, toPatch, toPreRelease)=>{
347
357
  if (isXVersion(fromMajor)) {
@@ -488,6 +498,14 @@ function parseGTE0(comparatorString) {
488
498
  return comparatorString.trim().replace(parseRegex(gte0), '');
489
499
  }
490
500
 
501
+ // fork from https://github.com/originjs/vite-plugin-federation/blob/v1.1.12/packages/lib/src/utils/semver/index.ts
502
+ // Copyright (c)
503
+ // vite-plugin-federation is licensed under Mulan PSL v2.
504
+ // You can use this software according to the terms and conditions of the Mulan PSL v2.
505
+ // You may obtain a copy of Mulan PSL v2 at:
506
+ // http://license.coscl.org.cn/MulanPSL2
507
+ // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
508
+ // See the Mulan PSL v2 for more details.
491
509
  function compareAtom(rangeAtom, versionAtom) {
492
510
  rangeAtom = Number(rangeAtom) || rangeAtom;
493
511
  versionAtom = Number(versionAtom) || versionAtom;
@@ -7,9 +7,9 @@ export { loadScript, loadScriptNode } from '@module-federation/sdk';
7
7
  export type { Federation } from './global';
8
8
  export type { FederationRuntimePlugin };
9
9
  export declare function init(options: UserOptions): FederationHost;
10
- export declare function loadRemote(...args: Parameters<FederationHost['loadRemote']>): ReturnType<FederationHost['loadRemote']>;
11
- export declare function loadShare(...args: Parameters<FederationHost['loadShare']>): ReturnType<FederationHost['loadShare']>;
12
- export declare function loadShareSync(...args: Parameters<FederationHost['loadShareSync']>): ReturnType<FederationHost['loadShareSync']>;
10
+ export declare function loadRemote<T>(...args: Parameters<FederationHost['loadRemote']>): Promise<T | null>;
11
+ export declare function loadShare<T>(...args: Parameters<FederationHost['loadShare']>): Promise<false | (() => T | undefined)>;
12
+ export declare function loadShareSync<T>(...args: Parameters<FederationHost['loadShareSync']>): () => T | never;
13
13
  export declare function preloadRemote(...args: Parameters<FederationHost['preloadRemote']>): ReturnType<FederationHost['preloadRemote']>;
14
14
  export declare function registerRemotes(...args: Parameters<FederationHost['registerRemotes']>): ReturnType<FederationHost['registerRemotes']>;
15
15
  export declare function registerPlugins(...args: Parameters<FederationHost['registerPlugins']>): ReturnType<FederationHost['registerRemotes']>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
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.1.8"
48
+ "@module-federation/sdk": "0.1.10"
49
49
  }
50
50
  }