chayns-api 2.6.0-beta.0 → 2.6.0-beta.2
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/cjs/host/module/ModuleHost.js +1 -1
- package/dist/cjs/host/module/utils/loadComponent.js +1 -1
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/plugins/SSRManifestPlugin.js +28 -0
- package/dist/cjs/plugins/index.js +12 -0
- package/dist/cjs/util/collectCssChunks.js +3 -0
- package/dist/cjs/util/initModuleFederationSharing.js +3 -2
- package/dist/esm/host/module/ModuleHost.js +1 -1
- package/dist/esm/host/module/utils/loadComponent.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/plugins/SSRManifestPlugin.js +21 -0
- package/dist/esm/plugins/index.js +1 -0
- package/dist/esm/util/collectCssChunks.js +3 -0
- package/dist/esm/util/initModuleFederationSharing.js +3 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/plugins/SSRManifestPlugin.d.ts +5 -0
- package/dist/types/plugins/index.d.ts +1 -0
- package/dist/types/util/initModuleFederationSharing.d.ts +2 -1
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ const System = ({
|
|
|
21
21
|
var _system$scope, _moduleContext$_syste;
|
|
22
22
|
const moduleContext = (0, _react.useContext)(_moduleContext.ModuleContext);
|
|
23
23
|
(_moduleContext$_syste = moduleContext[_system$scope = system.scope]) !== null && _moduleContext$_syste !== void 0 ? _moduleContext$_syste : moduleContext[_system$scope] = {
|
|
24
|
-
url:
|
|
24
|
+
url: system.url,
|
|
25
25
|
modules: new Set()
|
|
26
26
|
};
|
|
27
27
|
moduleContext[system.scope].modules.add(system.module);
|
|
@@ -27,7 +27,7 @@ const loadModule = (scope, module, url, preventSingleton = false) => {
|
|
|
27
27
|
console.error(`[chayns-api] call registerRemote with force for scope ${scope}. url: ${url}`);
|
|
28
28
|
}
|
|
29
29
|
registerRemotes([{
|
|
30
|
-
shareScope: url.endsWith('v2.remoteEntry.js') ? 'chayns-api' : 'default',
|
|
30
|
+
shareScope: url.endsWith('v2.remoteEntry.js') || url.endsWith('mf-manifest.json') ? 'chayns-api' : 'default',
|
|
31
31
|
name: scope,
|
|
32
32
|
entry: url,
|
|
33
33
|
alias: scope
|
package/dist/cjs/index.js
CHANGED
|
@@ -167,6 +167,18 @@ var _loadComponent = _interopRequireWildcard(require("./host/module/utils/loadCo
|
|
|
167
167
|
var _DialogHandler = _interopRequireDefault(require("./handler/DialogHandler"));
|
|
168
168
|
var _dialog = _interopRequireWildcard(require("./calls/dialogs/index"));
|
|
169
169
|
exports.dialog = _dialog;
|
|
170
|
+
var _plugins = require("./plugins");
|
|
171
|
+
Object.keys(_plugins).forEach(function (key) {
|
|
172
|
+
if (key === "default" || key === "__esModule") return;
|
|
173
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
174
|
+
if (key in exports && exports[key] === _plugins[key]) return;
|
|
175
|
+
Object.defineProperty(exports, key, {
|
|
176
|
+
enumerable: true,
|
|
177
|
+
get: function () {
|
|
178
|
+
return _plugins[key];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
});
|
|
170
182
|
var _initModuleFederationSharing = require("./util/initModuleFederationSharing");
|
|
171
183
|
Object.keys(_initModuleFederationSharing).forEach(function (key) {
|
|
172
184
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SSRManifestPlugin = void 0;
|
|
7
|
+
const SSRManifestPlugin = () => {
|
|
8
|
+
return {
|
|
9
|
+
name: 'ssr-manifest',
|
|
10
|
+
loadRemoteSnapshot(args) {
|
|
11
|
+
var _ref, _ref$ssrPublicPath;
|
|
12
|
+
if (args.from !== 'manifest') {
|
|
13
|
+
return args;
|
|
14
|
+
}
|
|
15
|
+
(_ref$ssrPublicPath = (_ref = args.remoteSnapshot).ssrPublicPath) !== null && _ref$ssrPublicPath !== void 0 ? _ref$ssrPublicPath : _ref.ssrPublicPath = new URL('.', args.manifestUrl).href;
|
|
16
|
+
if ('remoteEntry' in args.remoteSnapshot) {
|
|
17
|
+
var _args$remoteSnapshot, _args$remoteSnapshot$;
|
|
18
|
+
(_args$remoteSnapshot$ = (_args$remoteSnapshot = args.remoteSnapshot).ssrRemoteEntry) !== null && _args$remoteSnapshot$ !== void 0 ? _args$remoteSnapshot$ : _args$remoteSnapshot.ssrRemoteEntry = args.remoteSnapshot.remoteEntry;
|
|
19
|
+
}
|
|
20
|
+
if ('remoteEntryType' in args.remoteSnapshot) {
|
|
21
|
+
var _args$remoteSnapshot2, _args$remoteSnapshot3;
|
|
22
|
+
(_args$remoteSnapshot3 = (_args$remoteSnapshot2 = args.remoteSnapshot).ssrRemoteEntryType) !== null && _args$remoteSnapshot3 !== void 0 ? _args$remoteSnapshot3 : _args$remoteSnapshot2.ssrRemoteEntryType = args.remoteSnapshot.remoteEntryType;
|
|
23
|
+
}
|
|
24
|
+
return args;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
exports.SSRManifestPlugin = SSRManifestPlugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "SSRManifestPlugin", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _SSRManifestPlugin.SSRManifestPlugin;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _SSRManifestPlugin = require("./SSRManifestPlugin");
|
|
@@ -6,6 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.collectCssChunks = void 0;
|
|
7
7
|
const remoteInfoCache = {};
|
|
8
8
|
const loadRemoteInfo = async url => {
|
|
9
|
+
if (!url.endsWith('/mf-manifest.json')) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
9
12
|
if (remoteInfoCache[url]) {
|
|
10
13
|
return remoteInfoCache[url];
|
|
11
14
|
}
|
|
@@ -13,7 +13,8 @@ try {
|
|
|
13
13
|
ReactDOMClient = require('react-dom/client');
|
|
14
14
|
} catch (e) {}
|
|
15
15
|
const initModuleFederationSharing = ({
|
|
16
|
-
name
|
|
16
|
+
name,
|
|
17
|
+
plugins = []
|
|
17
18
|
}) => {
|
|
18
19
|
if (globalThis.moduleFederationRuntime) {
|
|
19
20
|
return;
|
|
@@ -50,7 +51,7 @@ const initModuleFederationSharing = ({
|
|
|
50
51
|
name: name !== null && name !== void 0 ? name : '',
|
|
51
52
|
remotes: [],
|
|
52
53
|
shared,
|
|
53
|
-
plugins: [(0, _SequentialLoadPlugin.SequentialLoadPlugin)()]
|
|
54
|
+
plugins: [(0, _SequentialLoadPlugin.SequentialLoadPlugin)(), ...plugins]
|
|
54
55
|
});
|
|
55
56
|
};
|
|
56
57
|
exports.initModuleFederationSharing = initModuleFederationSharing;
|
|
@@ -13,7 +13,7 @@ const System = _ref => {
|
|
|
13
13
|
var _system$scope, _moduleContext$_syste;
|
|
14
14
|
const moduleContext = useContext(ModuleContext);
|
|
15
15
|
(_moduleContext$_syste = moduleContext[_system$scope = system.scope]) !== null && _moduleContext$_syste !== void 0 ? _moduleContext$_syste : moduleContext[_system$scope] = {
|
|
16
|
-
url:
|
|
16
|
+
url: system.url,
|
|
17
17
|
modules: new Set()
|
|
18
18
|
};
|
|
19
19
|
moduleContext[system.scope].modules.add(system.module);
|
|
@@ -21,7 +21,7 @@ export const loadModule = function (scope, module, url) {
|
|
|
21
21
|
console.error(`[chayns-api] call registerRemote with force for scope ${scope}. url: ${url}`);
|
|
22
22
|
}
|
|
23
23
|
registerRemotes([{
|
|
24
|
-
shareScope: url.endsWith('v2.remoteEntry.js') ? 'chayns-api' : 'default',
|
|
24
|
+
shareScope: url.endsWith('v2.remoteEntry.js') || url.endsWith('mf-manifest.json') ? 'chayns-api' : 'default',
|
|
25
25
|
name: scope,
|
|
26
26
|
entry: url,
|
|
27
27
|
alias: scope
|
package/dist/esm/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { default as loadComponent, loadModule } from './host/module/utils/loadCo
|
|
|
15
15
|
export { default as DialogHandler } from './handler/DialogHandler';
|
|
16
16
|
import * as _dialog from './calls/dialogs/index';
|
|
17
17
|
export { _dialog as dialog };
|
|
18
|
+
export * from './plugins';
|
|
18
19
|
export * from './util/initModuleFederationSharing';
|
|
19
20
|
export * from './util/bindChaynsApi';
|
|
20
21
|
export * from './util/appStorage';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const SSRManifestPlugin = () => {
|
|
2
|
+
return {
|
|
3
|
+
name: 'ssr-manifest',
|
|
4
|
+
loadRemoteSnapshot(args) {
|
|
5
|
+
var _ref, _ref$ssrPublicPath;
|
|
6
|
+
if (args.from !== 'manifest') {
|
|
7
|
+
return args;
|
|
8
|
+
}
|
|
9
|
+
(_ref$ssrPublicPath = (_ref = args.remoteSnapshot).ssrPublicPath) !== null && _ref$ssrPublicPath !== void 0 ? _ref$ssrPublicPath : _ref.ssrPublicPath = new URL('.', args.manifestUrl).href;
|
|
10
|
+
if ('remoteEntry' in args.remoteSnapshot) {
|
|
11
|
+
var _args$remoteSnapshot, _args$remoteSnapshot$;
|
|
12
|
+
(_args$remoteSnapshot$ = (_args$remoteSnapshot = args.remoteSnapshot).ssrRemoteEntry) !== null && _args$remoteSnapshot$ !== void 0 ? _args$remoteSnapshot$ : _args$remoteSnapshot.ssrRemoteEntry = args.remoteSnapshot.remoteEntry;
|
|
13
|
+
}
|
|
14
|
+
if ('remoteEntryType' in args.remoteSnapshot) {
|
|
15
|
+
var _args$remoteSnapshot2, _args$remoteSnapshot3;
|
|
16
|
+
(_args$remoteSnapshot3 = (_args$remoteSnapshot2 = args.remoteSnapshot).ssrRemoteEntryType) !== null && _args$remoteSnapshot3 !== void 0 ? _args$remoteSnapshot3 : _args$remoteSnapshot2.ssrRemoteEntryType = args.remoteSnapshot.remoteEntryType;
|
|
17
|
+
}
|
|
18
|
+
return args;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SSRManifestPlugin } from './SSRManifestPlugin';
|
|
@@ -7,7 +7,8 @@ try {
|
|
|
7
7
|
} catch (e) {}
|
|
8
8
|
export const initModuleFederationSharing = _ref => {
|
|
9
9
|
let {
|
|
10
|
-
name
|
|
10
|
+
name,
|
|
11
|
+
plugins = []
|
|
11
12
|
} = _ref;
|
|
12
13
|
if (globalThis.moduleFederationRuntime) {
|
|
13
14
|
return;
|
|
@@ -44,6 +45,6 @@ export const initModuleFederationSharing = _ref => {
|
|
|
44
45
|
name: name !== null && name !== void 0 ? name : '',
|
|
45
46
|
remotes: [],
|
|
46
47
|
shared,
|
|
47
|
-
plugins: [SequentialLoadPlugin()]
|
|
48
|
+
plugins: [SequentialLoadPlugin(), ...plugins]
|
|
48
49
|
});
|
|
49
50
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { default as StaticChaynsApi } from './wrapper/StaticChaynsApi';
|
|
|
14
14
|
export { default as loadComponent, loadModule } from './host/module/utils/loadComponent';
|
|
15
15
|
export { default as DialogHandler } from './handler/DialogHandler';
|
|
16
16
|
export * as dialog from './calls/dialogs/index';
|
|
17
|
+
export * from './plugins';
|
|
17
18
|
export * from './util/initModuleFederationSharing';
|
|
18
19
|
export * from './util/bindChaynsApi';
|
|
19
20
|
export * from './util/appStorage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SSRManifestPlugin } from './SSRManifestPlugin';
|