@module-federation/dts-plugin 0.1.19 → 0.1.21
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/CHANGELOG.md +27 -0
- package/dist/{DtsWorker-d731dc2b.d.ts → DtsWorker-7113d2b0.d.ts} +6 -3
- package/dist/core.d.mts +85 -0
- package/dist/core.d.ts +5 -5
- package/dist/core.js +1105 -1008
- package/dist/dynamic-remote-type-hints-plugin.d.mts +5 -0
- package/dist/dynamic-remote-type-hints-plugin.d.ts +5 -0
- package/dist/dynamic-remote-type-hints-plugin.js +198 -0
- package/dist/esm/chunk-55BKSNZ4.js +2372 -0
- package/dist/esm/chunk-G7ONFBMA.js +24 -0
- package/dist/esm/chunk-MQRIERJP.js +236 -0
- package/dist/esm/core.js +44 -0
- package/dist/esm/dynamic-remote-type-hints-plugin.js +73 -0
- package/dist/esm/fork-dev-worker.js +141 -0
- package/dist/esm/fork-generate-dts.js +26 -0
- package/dist/esm/index.js +406 -0
- package/dist/esm/start-broker.js +36 -0
- package/dist/fork-dev-worker.d.ts +15 -0
- package/dist/fork-dev-worker.js +2543 -0
- package/dist/{forkGenerateDts.d.ts → fork-generate-dts.d.mts} +1 -1
- package/dist/fork-generate-dts.d.ts +9 -0
- package/dist/fork-generate-dts.js +1902 -0
- package/dist/iife/launch-web-client.js +91 -42
- package/dist/index.d.mts +10 -0
- package/dist/index.js +1287 -1181
- package/dist/package.json +11 -2
- package/dist/{startBroker.d.ts → start-broker.d.mts} +2 -0
- package/dist/start-broker.d.ts +42 -0
- package/dist/start-broker.js +1273 -0
- package/package.json +14 -5
- package/dist/forkDevWorker.js +0 -2523
- package/dist/forkGenerateDts.js +0 -1618
- package/dist/launch-web-client.d.ts +0 -2
- package/dist/startBroker.js +0 -902
- /package/dist/{forkDevWorker.d.ts → fork-dev-worker.d.mts} +0 -0
|
@@ -1,73 +1,124 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
(() => {
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
ws = global.WebSocket || global.MozWebSocket;
|
|
11
|
-
} else if (typeof window !== "undefined") {
|
|
12
|
-
ws = window.WebSocket || window.MozWebSocket;
|
|
13
|
-
} else if (typeof self !== "undefined") {
|
|
14
|
-
ws = self.WebSocket || self.MozWebSocket;
|
|
15
|
-
}
|
|
16
|
-
var browser_default = ws;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
var __publicField = (obj, key, value) => {
|
|
6
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
+
return value;
|
|
8
|
+
};
|
|
17
9
|
|
|
18
10
|
// packages/dts-plugin/src/server/constant.ts
|
|
19
11
|
var DEFAULT_WEB_SOCKET_PORT = 16322;
|
|
20
12
|
var WEB_SOCKET_CONNECT_MAGIC_ID = "1hpzW-zo2z-o8io-gfmV1-2cb1d82";
|
|
21
13
|
|
|
22
14
|
// packages/dts-plugin/src/server/message/Message.ts
|
|
23
|
-
var
|
|
15
|
+
var _Message = class _Message {
|
|
24
16
|
constructor(type, kind) {
|
|
17
|
+
__publicField(this, "type");
|
|
18
|
+
__publicField(this, "kind");
|
|
19
|
+
__publicField(this, "time");
|
|
25
20
|
this.type = type;
|
|
26
21
|
this.kind = kind;
|
|
27
22
|
this.time = Date.now();
|
|
28
23
|
}
|
|
29
24
|
};
|
|
25
|
+
__name(_Message, "Message");
|
|
26
|
+
var Message = _Message;
|
|
30
27
|
|
|
31
28
|
// packages/dts-plugin/src/server/message/Action/Action.ts
|
|
32
|
-
var
|
|
29
|
+
var ActionKind;
|
|
30
|
+
(function(ActionKind2) {
|
|
31
|
+
ActionKind2["ADD_SUBSCRIBER"] = "ADD_SUBSCRIBER";
|
|
32
|
+
ActionKind2["EXIT_SUBSCRIBER"] = "EXIT_SUBSCRIBER";
|
|
33
|
+
ActionKind2["ADD_PUBLISHER"] = "ADD_PUBLISHER";
|
|
34
|
+
ActionKind2["UPDATE_PUBLISHER"] = "UPDATE_PUBLISHER";
|
|
35
|
+
ActionKind2["NOTIFY_SUBSCRIBER"] = "NOTIFY_SUBSCRIBER";
|
|
36
|
+
ActionKind2["EXIT_PUBLISHER"] = "EXIT_PUBLISHER";
|
|
37
|
+
ActionKind2["ADD_WEB_CLIENT"] = "ADD_WEB_CLIENT";
|
|
38
|
+
ActionKind2["NOTIFY_WEB_CLIENT"] = "NOTIFY_WEB_CLIENT";
|
|
39
|
+
ActionKind2["FETCH_TYPES"] = "FETCH_TYPES";
|
|
40
|
+
ActionKind2["ADD_DYNAMIC_REMOTE"] = "ADD_DYNAMIC_REMOTE";
|
|
41
|
+
})(ActionKind || (ActionKind = {}));
|
|
42
|
+
var _Action = class _Action extends Message {
|
|
33
43
|
constructor(content, kind) {
|
|
34
44
|
super("Action", kind);
|
|
45
|
+
__publicField(this, "payload");
|
|
35
46
|
const { payload } = content;
|
|
36
47
|
this.payload = payload;
|
|
37
48
|
}
|
|
38
49
|
};
|
|
50
|
+
__name(_Action, "Action");
|
|
51
|
+
var Action = _Action;
|
|
52
|
+
|
|
53
|
+
// packages/dts-plugin/src/server/message/Action/Update.ts
|
|
54
|
+
var UpdateKind;
|
|
55
|
+
(function(UpdateKind2) {
|
|
56
|
+
UpdateKind2["UPDATE_TYPE"] = "UPDATE_TYPE";
|
|
57
|
+
UpdateKind2["RELOAD_PAGE"] = "RELOAD_PAGE";
|
|
58
|
+
})(UpdateKind || (UpdateKind = {}));
|
|
39
59
|
|
|
40
60
|
// packages/dts-plugin/src/server/message/Action/AddWebClient.ts
|
|
41
|
-
var
|
|
61
|
+
var _AddWebClientAction = class _AddWebClientAction extends Action {
|
|
42
62
|
constructor(payload) {
|
|
43
|
-
super(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
"ADD_WEB_CLIENT" /* ADD_WEB_CLIENT */
|
|
48
|
-
);
|
|
63
|
+
super({
|
|
64
|
+
payload
|
|
65
|
+
}, ActionKind.ADD_WEB_CLIENT);
|
|
49
66
|
}
|
|
50
67
|
};
|
|
68
|
+
__name(_AddWebClientAction, "AddWebClientAction");
|
|
69
|
+
var AddWebClientAction = _AddWebClientAction;
|
|
70
|
+
|
|
71
|
+
// packages/dts-plugin/src/core/constant.ts
|
|
72
|
+
var UpdateMode;
|
|
73
|
+
(function(UpdateMode2) {
|
|
74
|
+
UpdateMode2["POSITIVE"] = "POSITIVE";
|
|
75
|
+
UpdateMode2["PASSIVE"] = "PASSIVE";
|
|
76
|
+
})(UpdateMode || (UpdateMode = {}));
|
|
77
|
+
|
|
78
|
+
// packages/dts-plugin/src/server/message/API/API.ts
|
|
79
|
+
var APIKind;
|
|
80
|
+
(function(APIKind2) {
|
|
81
|
+
APIKind2["UPDATE_SUBSCRIBER"] = "UPDATE_SUBSCRIBER";
|
|
82
|
+
APIKind2["RELOAD_WEB_CLIENT"] = "RELOAD_WEB_CLIENT";
|
|
83
|
+
APIKind2["FETCH_TYPES"] = "FETCH_TYPES";
|
|
84
|
+
})(APIKind || (APIKind = {}));
|
|
85
|
+
|
|
86
|
+
// node_modules/.pnpm/isomorphic-ws@5.0.0_ws@8.17.0/node_modules/isomorphic-ws/browser.js
|
|
87
|
+
var ws = null;
|
|
88
|
+
if (typeof WebSocket !== "undefined") {
|
|
89
|
+
ws = WebSocket;
|
|
90
|
+
} else if (typeof MozWebSocket !== "undefined") {
|
|
91
|
+
ws = MozWebSocket;
|
|
92
|
+
} else if (typeof global !== "undefined") {
|
|
93
|
+
ws = global.WebSocket || global.MozWebSocket;
|
|
94
|
+
} else if (typeof window !== "undefined") {
|
|
95
|
+
ws = window.WebSocket || window.MozWebSocket;
|
|
96
|
+
} else if (typeof self !== "undefined") {
|
|
97
|
+
ws = self.WebSocket || self.MozWebSocket;
|
|
98
|
+
}
|
|
99
|
+
var browser_default = ws;
|
|
100
|
+
|
|
101
|
+
// packages/dts-plugin/src/server/createWebsocket.ts
|
|
102
|
+
function createWebsocket() {
|
|
103
|
+
return new browser_default(`ws://127.0.0.1:${DEFAULT_WEB_SOCKET_PORT}?WEB_SOCKET_CONNECT_MAGIC_ID=${WEB_SOCKET_CONNECT_MAGIC_ID}`);
|
|
104
|
+
}
|
|
105
|
+
__name(createWebsocket, "createWebsocket");
|
|
51
106
|
|
|
52
107
|
// packages/dts-plugin/src/server/WebClient.ts
|
|
53
|
-
var
|
|
108
|
+
var _WebClient = class _WebClient {
|
|
54
109
|
constructor(options) {
|
|
55
|
-
this
|
|
110
|
+
__publicField(this, "_webSocket", null);
|
|
111
|
+
__publicField(this, "_name");
|
|
112
|
+
__publicField(this, "logPrefix");
|
|
56
113
|
this._name = options.name;
|
|
57
114
|
this.logPrefix = options.logPrefix || "";
|
|
58
115
|
this._connect();
|
|
59
116
|
}
|
|
60
117
|
_connect() {
|
|
61
|
-
console.log(
|
|
62
|
-
|
|
63
|
-
);
|
|
64
|
-
this._webSocket = new browser_default(
|
|
65
|
-
`ws://127.0.0.1:${DEFAULT_WEB_SOCKET_PORT}?WEB_SOCKET_CONNECT_MAGIC_ID=${WEB_SOCKET_CONNECT_MAGIC_ID}`
|
|
66
|
-
);
|
|
118
|
+
console.log(`${this.logPrefix}Trying to connect to {cyan ws://127.0.0.1:${DEFAULT_WEB_SOCKET_PORT}}...}`);
|
|
119
|
+
this._webSocket = createWebsocket();
|
|
67
120
|
this._webSocket.onopen = () => {
|
|
68
|
-
console.log(
|
|
69
|
-
`${this.logPrefix}Connected to {cyan ws://127.0.0.1:${DEFAULT_WEB_SOCKET_PORT}} success!`
|
|
70
|
-
);
|
|
121
|
+
console.log(`${this.logPrefix}Connected to {cyan ws://127.0.0.1:${DEFAULT_WEB_SOCKET_PORT}} success!`);
|
|
71
122
|
const startWebClient = new AddWebClientAction({
|
|
72
123
|
name: this._name
|
|
73
124
|
});
|
|
@@ -75,14 +126,10 @@
|
|
|
75
126
|
};
|
|
76
127
|
this._webSocket.onmessage = (message) => {
|
|
77
128
|
console.log(message);
|
|
78
|
-
const parsedMessage = JSON.parse(
|
|
79
|
-
message.data.toString()
|
|
80
|
-
);
|
|
129
|
+
const parsedMessage = JSON.parse(message.data.toString());
|
|
81
130
|
if (parsedMessage.type === "API") {
|
|
82
|
-
if (parsedMessage.kind ===
|
|
83
|
-
const {
|
|
84
|
-
payload: { name }
|
|
85
|
-
} = parsedMessage;
|
|
131
|
+
if (parsedMessage.kind === APIKind.RELOAD_WEB_CLIENT) {
|
|
132
|
+
const { payload: { name } } = parsedMessage;
|
|
86
133
|
if (name !== this._name) {
|
|
87
134
|
return;
|
|
88
135
|
}
|
|
@@ -99,6 +146,8 @@
|
|
|
99
146
|
location.reload();
|
|
100
147
|
}
|
|
101
148
|
};
|
|
149
|
+
__name(_WebClient, "WebClient");
|
|
150
|
+
var WebClient = _WebClient;
|
|
102
151
|
|
|
103
152
|
// packages/dts-plugin/src/server/launchWebClient.ts
|
|
104
153
|
new WebClient(__WEB_CLIENT_OPTIONS__);
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WebpackPluginInstance, Compiler } from 'webpack';
|
|
2
|
+
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
3
|
+
|
|
4
|
+
declare class DtsPlugin implements WebpackPluginInstance {
|
|
5
|
+
options: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
6
|
+
constructor(options: moduleFederationPlugin.ModuleFederationPluginOptions);
|
|
7
|
+
apply(compiler: Compiler): void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { DtsPlugin };
|