@module-federation/dts-plugin 0.0.0-chore-bump-node-22-20260710161714

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.
@@ -0,0 +1,74 @@
1
+ const require_Action = require('./Action-CzhPMw2i.js');
2
+ const require_utils = require('./utils-7KqCZHbb.js');
3
+ let isomorphic_ws = require("isomorphic-ws");
4
+ isomorphic_ws = require_Action.__toESM(isomorphic_ws);
5
+
6
+ //#region src/server/message/Action/FetchTypes.ts
7
+ var FetchTypesAction = class extends require_Action.Action {
8
+ constructor(payload) {
9
+ super({ payload }, require_Action.ActionKind.FETCH_TYPES);
10
+ }
11
+ };
12
+
13
+ //#endregion
14
+ //#region src/server/message/Action/AddDynamicRemote.ts
15
+ var AddDynamicRemoteAction = class extends require_Action.Action {
16
+ constructor(payload) {
17
+ super({ payload }, require_Action.ActionKind.ADD_DYNAMIC_REMOTE);
18
+ }
19
+ };
20
+
21
+ //#endregion
22
+ //#region src/server/createWebsocket.ts
23
+ function createWebsocket() {
24
+ return new isomorphic_ws.default(`ws://127.0.0.1:${require_Action.DEFAULT_WEB_SOCKET_PORT}?WEB_SOCKET_CONNECT_MAGIC_ID=${require_Action.WEB_SOCKET_CONNECT_MAGIC_ID}`);
25
+ }
26
+
27
+ //#endregion
28
+ //#region src/runtime-plugins/dynamic-remote-type-hints-plugin.ts
29
+ const PLUGIN_NAME = "dynamic-remote-type-hints-plugin";
30
+ function dynamicRemoteTypeHintsPlugin() {
31
+ let ws = createWebsocket();
32
+ let isConnected = false;
33
+ ws.onopen = () => {
34
+ isConnected = true;
35
+ };
36
+ ws.onerror = (err) => {
37
+ console.error(`[ ${PLUGIN_NAME} ] err: ${err}`);
38
+ };
39
+ return {
40
+ name: "dynamic-remote-type-hints-plugin",
41
+ registerRemote(args) {
42
+ const { remote, origin } = args;
43
+ try {
44
+ if (!isConnected) return args;
45
+ if (!("entry" in remote)) return args;
46
+ const defaultIpV4 = typeof FEDERATION_IPV4 === "string" ? FEDERATION_IPV4 : "127.0.0.1";
47
+ const remoteIp = require_utils.getIpFromEntry(remote.entry, defaultIpV4);
48
+ const remoteInfo = {
49
+ name: remote.name,
50
+ url: remote.entry,
51
+ alias: remote.alias || remote.name
52
+ };
53
+ if (remoteIp) ws.send(JSON.stringify(new AddDynamicRemoteAction({
54
+ remoteIp,
55
+ remoteInfo,
56
+ name: origin.name,
57
+ ip: defaultIpV4
58
+ })));
59
+ ws.send(JSON.stringify(new FetchTypesAction({
60
+ name: origin.name,
61
+ ip: defaultIpV4,
62
+ remoteInfo
63
+ })));
64
+ return args;
65
+ } catch (err) {
66
+ console.error(new Error(err));
67
+ return args;
68
+ }
69
+ }
70
+ };
71
+ }
72
+
73
+ //#endregion
74
+ module.exports = dynamicRemoteTypeHintsPlugin;
@@ -0,0 +1,47 @@
1
+ //#region src/server/message/Message.ts
2
+ var Message = class {
3
+ constructor(type, kind) {
4
+ this.type = type;
5
+ this.kind = kind;
6
+ this.time = Date.now();
7
+ }
8
+ };
9
+
10
+ //#endregion
11
+ //#region src/server/constant.ts
12
+ const DEFAULT_WEB_SOCKET_PORT = 16322;
13
+ const WEB_SOCKET_CONNECT_MAGIC_ID = "1hpzW-zo2z-o8io-gfmV1-2cb1d82";
14
+ const MF_SERVER_IDENTIFIER = "Module Federation DTS";
15
+ const WEB_CLIENT_OPTIONS_IDENTIFIER = "__WEB_CLIENT_OPTIONS__";
16
+ const DEFAULT_TAR_NAME = "@mf-types.zip";
17
+ let UpdateMode = /* @__PURE__ */ function(UpdateMode) {
18
+ UpdateMode["POSITIVE"] = "POSITIVE";
19
+ UpdateMode["PASSIVE"] = "PASSIVE";
20
+ return UpdateMode;
21
+ }({});
22
+
23
+ //#endregion
24
+ //#region src/server/message/Action/Action.ts
25
+ let ActionKind = /* @__PURE__ */ function(ActionKind) {
26
+ ActionKind["ADD_SUBSCRIBER"] = "ADD_SUBSCRIBER";
27
+ ActionKind["EXIT_SUBSCRIBER"] = "EXIT_SUBSCRIBER";
28
+ ActionKind["ADD_PUBLISHER"] = "ADD_PUBLISHER";
29
+ ActionKind["UPDATE_PUBLISHER"] = "UPDATE_PUBLISHER";
30
+ ActionKind["NOTIFY_SUBSCRIBER"] = "NOTIFY_SUBSCRIBER";
31
+ ActionKind["EXIT_PUBLISHER"] = "EXIT_PUBLISHER";
32
+ ActionKind["ADD_WEB_CLIENT"] = "ADD_WEB_CLIENT";
33
+ ActionKind["NOTIFY_WEB_CLIENT"] = "NOTIFY_WEB_CLIENT";
34
+ ActionKind["FETCH_TYPES"] = "FETCH_TYPES";
35
+ ActionKind["ADD_DYNAMIC_REMOTE"] = "ADD_DYNAMIC_REMOTE";
36
+ return ActionKind;
37
+ }({});
38
+ var Action = class extends Message {
39
+ constructor(content, kind) {
40
+ super("Action", kind);
41
+ const { payload } = content;
42
+ this.payload = payload;
43
+ }
44
+ };
45
+
46
+ //#endregion
47
+ export { MF_SERVER_IDENTIFIER as a, WEB_SOCKET_CONNECT_MAGIC_ID as c, DEFAULT_WEB_SOCKET_PORT as i, Message as l, ActionKind as n, UpdateMode as o, DEFAULT_TAR_NAME as r, WEB_CLIENT_OPTIONS_IDENTIFIER as s, Action as t };