@module-federation/dts-plugin 2.0.1 → 2.1.0

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.
Files changed (56) hide show
  1. package/dist/Action-CzhPMw2i.js +153 -0
  2. package/dist/Broker-DRlzScTT.js +800 -0
  3. package/dist/CHANGELOG.md +15 -0
  4. package/dist/DtsWorker-Dtem3-FM.d.ts +166 -0
  5. package/dist/constant-BwEkyidO.d.ts +42 -0
  6. package/dist/consumeTypes-AD2ig87l.js +237 -0
  7. package/dist/core.d.ts +3 -68
  8. package/dist/core.js +26 -2443
  9. package/dist/dynamic-remote-type-hints-plugin.d.ts +622 -3
  10. package/dist/dynamic-remote-type-hints-plugin.js +65 -187
  11. package/dist/esm/Action-DNNg2YDh.mjs +47 -0
  12. package/dist/esm/Broker-BU4gToNr.mjs +736 -0
  13. package/dist/esm/consumeTypes-D51rVbSt.mjs +204 -0
  14. package/dist/esm/core.mjs +5 -0
  15. package/dist/esm/dynamic-remote-type-hints-plugin.mjs +73 -0
  16. package/dist/esm/expose-rpc-DMhY1i8A.mjs +1301 -0
  17. package/dist/esm/fork-dev-worker.mjs +103 -0
  18. package/dist/esm/fork-generate-dts.mjs +14 -0
  19. package/dist/esm/index.mjs +465 -0
  20. package/dist/esm/start-broker.mjs +22 -0
  21. package/dist/esm/utils-CkPvDGOy.mjs +13 -0
  22. package/dist/expose-rpc-BLAH20uj.js +1415 -0
  23. package/dist/fork-dev-worker.d.ts +10 -9
  24. package/dist/fork-dev-worker.js +100 -2932
  25. package/dist/fork-generate-dts.d.ts +4 -8
  26. package/dist/fork-generate-dts.js +11 -2103
  27. package/dist/iife/launch-web-client.iife.js +117 -0
  28. package/dist/index.d.ts +57 -46
  29. package/dist/index.js +449 -3043
  30. package/dist/package.json +26 -11
  31. package/dist/start-broker.d.ts +41 -39
  32. package/dist/start-broker.js +17 -952
  33. package/dist/utils-7KqCZHbb.js +19 -0
  34. package/package.json +31 -16
  35. package/dist/DTSManager-b15Gfat3.d.ts +0 -53
  36. package/dist/DTSManagerOptions-QVchWb0x.d.ts +0 -32
  37. package/dist/DtsWorker-BrHsGz8C.d.ts +0 -56
  38. package/dist/core.d.mts +0 -68
  39. package/dist/dynamic-remote-type-hints-plugin.d.mts +0 -5
  40. package/dist/esm/chunk-647HGGGS.js +0 -241
  41. package/dist/esm/chunk-G65LOFTY.js +0 -24
  42. package/dist/esm/chunk-LJTUMI5K.js +0 -282
  43. package/dist/esm/chunk-MV6M4VFH.js +0 -1642
  44. package/dist/esm/chunk-WWV5RWOP.js +0 -902
  45. package/dist/esm/core.js +0 -44
  46. package/dist/esm/dynamic-remote-type-hints-plugin.js +0 -73
  47. package/dist/esm/fork-dev-worker.js +0 -145
  48. package/dist/esm/fork-generate-dts.js +0 -27
  49. package/dist/esm/index.js +0 -646
  50. package/dist/esm/start-broker.js +0 -36
  51. package/dist/fork-dev-worker.d.mts +0 -15
  52. package/dist/fork-generate-dts.d.mts +0 -10
  53. package/dist/iife/launch-web-client.js +0 -152
  54. package/dist/index.d.mts +0 -56
  55. package/dist/start-broker.d.mts +0 -42
  56. package/dist/utils-C4sQemLR.d.ts +0 -15
@@ -0,0 +1,19 @@
1
+
2
+ //#region src/dev-worker/utils.ts
3
+ const DEFAULT_LOCAL_IPS = ["localhost", "127.0.0.1"];
4
+ function getIpFromEntry(entry, ipv4) {
5
+ let ip;
6
+ entry.replace(/https?:\/\/([0-9|.]+|localhost):/, (str, matched) => {
7
+ ip = matched;
8
+ return str;
9
+ });
10
+ if (ip) return DEFAULT_LOCAL_IPS.includes(ip) ? ipv4 : ip;
11
+ }
12
+
13
+ //#endregion
14
+ Object.defineProperty(exports, 'getIpFromEntry', {
15
+ enumerable: true,
16
+ get: function () {
17
+ return getIpFromEntry;
18
+ }
19
+ });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@module-federation/dts-plugin",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "author": "hanric <hanric.zhang@gmail.com>",
5
5
  "main": "./dist/index.js",
6
- "module": "./dist/index.js",
6
+ "module": "./dist/esm/index.mjs",
7
7
  "types": "./dist/index.d.ts",
8
8
  "license": "MIT",
9
9
  "repository": {
@@ -20,17 +20,34 @@
20
20
  ],
21
21
  "exports": {
22
22
  ".": {
23
- "import": "./dist/index.js",
24
- "require": "./dist/index.js"
23
+ "import": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/esm/index.mjs"
26
+ },
27
+ "require": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ }
25
31
  },
26
32
  "./core": {
27
- "import": "./dist/core.js",
28
- "require": "./dist/core.js"
33
+ "import": {
34
+ "types": "./dist/core.d.ts",
35
+ "default": "./dist/esm/core.mjs"
36
+ },
37
+ "require": {
38
+ "types": "./dist/core.d.ts",
39
+ "default": "./dist/core.js"
40
+ }
29
41
  },
30
42
  "./dynamic-remote-type-hints-plugin": {
31
- "types": "./dist/dynamic-remote-type-hints-plugin.d.ts",
32
- "import": "./dist/esm/dynamic-remote-type-hints-plugin.js",
33
- "require": "./dist/dynamic-remote-type-hints-plugin.js"
43
+ "import": {
44
+ "types": "./dist/dynamic-remote-type-hints-plugin.d.ts",
45
+ "default": "./dist/esm/dynamic-remote-type-hints-plugin.mjs"
46
+ },
47
+ "require": {
48
+ "types": "./dist/dynamic-remote-type-hints-plugin.d.ts",
49
+ "default": "./dist/dynamic-remote-type-hints-plugin.js"
50
+ }
34
51
  },
35
52
  "./*": "./*"
36
53
  },
@@ -54,19 +71,17 @@
54
71
  "chalk": "3.0.0",
55
72
  "fs-extra": "9.1.0",
56
73
  "isomorphic-ws": "5.0.0",
57
- "koa": "3.0.3",
58
74
  "lodash.clonedeepwith": "4.5.0",
59
75
  "log4js": "6.9.1",
60
76
  "node-schedule": "2.1.1",
61
77
  "rambda": "^9.1.0",
62
78
  "ws": "8.18.0",
63
- "@module-federation/error-codes": "2.0.1",
64
- "@module-federation/managers": "2.0.1",
65
- "@module-federation/sdk": "2.0.1",
66
- "@module-federation/third-party-dts-extractor": "2.0.1"
79
+ "@module-federation/error-codes": "2.1.0",
80
+ "@module-federation/managers": "2.1.0",
81
+ "@module-federation/sdk": "2.1.0",
82
+ "@module-federation/third-party-dts-extractor": "2.1.0"
67
83
  },
68
84
  "devDependencies": {
69
- "@types/koa": "2.15.0",
70
85
  "@types/node-schedule": "2.1.7",
71
86
  "@types/ws": "8.5.12",
72
87
  "@vue/tsconfig": "^0.7.0",
@@ -74,7 +89,7 @@
74
89
  "vue": "^3.5.13",
75
90
  "vue-tsc": "^2.2.10",
76
91
  "webpack": "^5.104.1",
77
- "@module-federation/runtime": "2.0.1"
92
+ "@module-federation/runtime": "2.1.0"
78
93
  },
79
94
  "peerDependencies": {
80
95
  "typescript": "^4.9.0 || ^5.0.0",
@@ -1,53 +0,0 @@
1
- import { a as RemoteOptions, D as DTSManagerOptions, R as RemoteInfo, H as HostOptions } from './DTSManagerOptions-QVchWb0x.js';
2
- import ts from 'typescript';
3
-
4
- interface TsConfigJson {
5
- extends?: string;
6
- compilerOptions?: ts.CompilerOptions;
7
- exclude?: string[];
8
- include?: string[];
9
- files?: string[];
10
- }
11
-
12
- declare const retrieveRemoteConfig: (options: RemoteOptions) => {
13
- tsConfig: TsConfigJson;
14
- mapComponentsToExpose: Record<string, string>;
15
- remoteOptions: Required<RemoteOptions>;
16
- };
17
-
18
- declare const enum UpdateMode {
19
- POSITIVE = "POSITIVE",
20
- PASSIVE = "PASSIVE"
21
- }
22
-
23
- interface UpdateTypesOptions {
24
- updateMode: UpdateMode;
25
- remoteName?: string;
26
- remoteTarPath?: string;
27
- remoteInfo?: RemoteInfo;
28
- once?: boolean;
29
- }
30
- declare class DTSManager {
31
- options: DTSManagerOptions;
32
- runtimePkgs: string[];
33
- remoteAliasMap: Record<string, Required<RemoteInfo>>;
34
- loadedRemoteAPIAlias: Set<string>;
35
- extraOptions: Record<string, any>;
36
- updatedRemoteInfos: Record<string, Required<RemoteInfo>>;
37
- constructor(options: DTSManagerOptions);
38
- generateAPITypes(mapComponentsToExpose: Record<string, string>): string;
39
- extractRemoteTypes(options: ReturnType<typeof retrieveRemoteConfig>): Promise<void>;
40
- generateTypes(): Promise<void>;
41
- requestRemoteManifest(remoteInfo: RemoteInfo, hostOptions: Required<HostOptions>): Promise<Required<RemoteInfo>>;
42
- consumeTargetRemotes(hostOptions: Required<HostOptions>, remoteInfo: Required<RemoteInfo>): Promise<[string, string]>;
43
- downloadAPITypes(remoteInfo: Required<RemoteInfo>, destinationPath: string, hostOptions: Required<HostOptions>): Promise<boolean>;
44
- consumeAPITypes(hostOptions: Required<HostOptions>): void;
45
- consumeArchiveTypes(options: HostOptions): Promise<{
46
- hostOptions: Required<HostOptions>;
47
- downloadPromisesResult: PromiseSettledResult<[string, string]>[];
48
- }>;
49
- consumeTypes(): Promise<void>;
50
- updateTypes(options: UpdateTypesOptions): Promise<void>;
51
- }
52
-
53
- export { DTSManager as D, type TsConfigJson as T, retrieveRemoteConfig as r };
@@ -1,32 +0,0 @@
1
- import { moduleFederationPlugin } from '@module-federation/sdk';
2
-
3
- interface RemoteOptions extends moduleFederationPlugin.DtsRemoteOptions {
4
- moduleFederationConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
5
- context?: string;
6
- implementation?: string;
7
- hostRemoteTypesFolder?: string;
8
- outputDir?: string;
9
- }
10
-
11
- interface HostOptions extends moduleFederationPlugin.DtsHostOptions {
12
- moduleFederationConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
13
- context?: string;
14
- implementation?: string;
15
- runtimePkgs?: string[];
16
- }
17
- interface RemoteInfo {
18
- name: string;
19
- url: string;
20
- alias: string;
21
- zipUrl?: string;
22
- apiTypeUrl?: string;
23
- }
24
-
25
- interface DTSManagerOptions {
26
- remote?: RemoteOptions;
27
- host?: HostOptions;
28
- extraOptions?: Record<string, any>;
29
- displayErrorInTerminal?: moduleFederationPlugin.PluginDtsOptions['displayErrorInTerminal'];
30
- }
31
-
32
- export type { DTSManagerOptions as D, HostOptions as H, RemoteInfo as R, RemoteOptions as a };
@@ -1,56 +0,0 @@
1
- import { ChildProcess } from 'child_process';
2
- import { D as DTSManagerOptions } from './DTSManagerOptions-QVchWb0x.js';
3
- import { D as DTSManager } from './DTSManager-b15Gfat3.js';
4
-
5
- declare enum RpcGMCallTypes {
6
- CALL = "mf_call",
7
- RESOLVE = "mf_resolve",
8
- REJECT = "mf_reject",
9
- EXIT = "mf_exit"
10
- }
11
- interface RpcCallMessage {
12
- type: RpcGMCallTypes.CALL;
13
- id: string;
14
- args: unknown[];
15
- }
16
- interface RpcResolveMessage {
17
- type: RpcGMCallTypes.RESOLVE;
18
- id: string;
19
- value: unknown;
20
- }
21
- interface RpcRejectMessage {
22
- type: RpcGMCallTypes.REJECT;
23
- id: string;
24
- error: unknown;
25
- }
26
- interface RpcExitMessage {
27
- type: RpcGMCallTypes.EXIT;
28
- id: string;
29
- }
30
- type RpcMessage = RpcCallMessage | RpcResolveMessage | RpcRejectMessage | RpcExitMessage;
31
- type RpcMethod = (...args: any[]) => any;
32
- type RpcRemoteMethod<T extends RpcMethod> = T extends (...args: infer A) => infer R ? R extends Promise<any> ? (...args: A) => R : (...args: A) => Promise<R> : (...args: unknown[]) => Promise<unknown>;
33
-
34
- interface RpcWorkerBase {
35
- connect(...args: unknown[]): any;
36
- terminate(): void;
37
- readonly connected: boolean;
38
- readonly id: string;
39
- readonly process: ChildProcess | undefined;
40
- }
41
- type RpcWorker<T extends RpcMethod = RpcMethod> = RpcWorkerBase & RpcRemoteMethod<T>;
42
- declare function createRpcWorker<T extends RpcMethod>(modulePath: string, data: unknown, memoryLimit?: number, once?: boolean): RpcWorker<T>;
43
- declare function getRpcWorkerData(): unknown;
44
-
45
- type DtsWorkerOptions = DTSManagerOptions;
46
- declare class DtsWorker {
47
- rpcWorker: RpcWorker<RpcMethod>;
48
- private _options;
49
- private _res;
50
- constructor(options: DtsWorkerOptions);
51
- removeUnSerializationOptions(): void;
52
- get controlledPromise(): ReturnType<DTSManager['generateTypes']>;
53
- exit(): void;
54
- }
55
-
56
- export { DtsWorker as D, type RpcRemoteMethod as R, type RpcCallMessage as a, RpcGMCallTypes as b, type RpcMessage as c, type RpcMethod as d, type RpcRejectMessage as e, type RpcResolveMessage as f, type RpcWorker as g, createRpcWorker as h, getRpcWorkerData as i, type DtsWorkerOptions as j };
package/dist/core.d.mts DELETED
@@ -1,68 +0,0 @@
1
- import { T as TsConfigJson } from './DTSManager-b15Gfat3.js';
2
- export { D as DTSManager, r as retrieveRemoteConfig } from './DTSManager-b15Gfat3.js';
3
- import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-QVchWb0x.js';
4
- export { g as getDTSManagerConstructor, i as isTSProject, r as retrieveTypesAssetsInfo, v as validateOptions } from './utils-C4sQemLR.js';
5
- import { R as RpcRemoteMethod, a as RpcCallMessage, b as RpcGMCallTypes, c as RpcMessage, d as RpcMethod, e as RpcRejectMessage, f as RpcResolveMessage, g as RpcWorker, h as createRpcWorker, i as getRpcWorkerData } from './DtsWorker-BrHsGz8C.js';
6
- export { D as DtsWorker } from './DtsWorker-BrHsGz8C.js';
7
- import { ChildProcess } from 'child_process';
8
- import 'typescript';
9
- import '@module-federation/sdk';
10
-
11
- declare const retrieveHostConfig: (options: HostOptions) => {
12
- hostOptions: Required<HostOptions>;
13
- mapRemotesToDownload: Record<string, RemoteInfo>;
14
- };
15
-
16
- declare const retrieveMfTypesPath: (tsConfig: TsConfigJson, remoteOptions: Required<RemoteOptions>) => string;
17
- declare const retrieveOriginalOutDir: (tsConfig: TsConfigJson, remoteOptions: Required<RemoteOptions>) => string;
18
-
19
- declare const retrieveTypesZipPath: (mfTypesPath: string, remoteOptions: Required<RemoteOptions>) => string;
20
-
21
- declare function generateTypes(options: DTSManagerOptions): Promise<void>;
22
-
23
- declare function generateTypesInChildProcess(options: DTSManagerOptions): Promise<void>;
24
-
25
- declare function exposeRpc(fn: (...args: any[]) => any): void;
26
-
27
- interface WrapRpcOptions {
28
- id: string;
29
- once?: boolean;
30
- }
31
- declare function wrapRpc<T extends (...args: any[]) => any>(childProcess: ChildProcess, options: WrapRpcOptions): RpcRemoteMethod<T>;
32
-
33
- declare class RpcExitError extends Error {
34
- readonly code?: string | number | null;
35
- readonly signal?: string | null;
36
- constructor(message: string, code?: string | number | null, signal?: string | null);
37
- }
38
-
39
- /**
40
- * forked from https://github.com/TypeStrong/fork-ts-checker-webpack-plugin
41
- * license at https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/main/LICENSE
42
- */
43
-
44
- declare const index_RpcCallMessage: typeof RpcCallMessage;
45
- type index_RpcExitError = RpcExitError;
46
- declare const index_RpcExitError: typeof RpcExitError;
47
- declare const index_RpcGMCallTypes: typeof RpcGMCallTypes;
48
- declare const index_RpcMessage: typeof RpcMessage;
49
- declare const index_RpcMethod: typeof RpcMethod;
50
- declare const index_RpcRejectMessage: typeof RpcRejectMessage;
51
- declare const index_RpcRemoteMethod: typeof RpcRemoteMethod;
52
- declare const index_RpcResolveMessage: typeof RpcResolveMessage;
53
- declare const index_RpcWorker: typeof RpcWorker;
54
- declare const index_createRpcWorker: typeof createRpcWorker;
55
- declare const index_exposeRpc: typeof exposeRpc;
56
- declare const index_getRpcWorkerData: typeof getRpcWorkerData;
57
- declare const index_wrapRpc: typeof wrapRpc;
58
- declare namespace index {
59
- export { index_RpcCallMessage as RpcCallMessage, index_RpcExitError as RpcExitError, index_RpcGMCallTypes as RpcGMCallTypes, index_RpcMessage as RpcMessage, index_RpcMethod as RpcMethod, index_RpcRejectMessage as RpcRejectMessage, index_RpcRemoteMethod as RpcRemoteMethod, index_RpcResolveMessage as RpcResolveMessage, index_RpcWorker as RpcWorker, index_createRpcWorker as createRpcWorker, index_exposeRpc as exposeRpc, index_getRpcWorkerData as getRpcWorkerData, index_wrapRpc as wrapRpc };
60
- }
61
-
62
- declare function consumeTypes(options: DTSManagerOptions): Promise<void>;
63
-
64
- declare const REMOTE_ALIAS_IDENTIFIER = "REMOTE_ALIAS_IDENTIFIER";
65
- declare const REMOTE_API_TYPES_FILE_NAME = "apis.d.ts";
66
- declare const HOST_API_TYPES_FILE_NAME = "index.d.ts";
67
-
68
- export { DTSManagerOptions, HOST_API_TYPES_FILE_NAME, HostOptions, REMOTE_ALIAS_IDENTIFIER, REMOTE_API_TYPES_FILE_NAME, RemoteOptions, consumeTypes, generateTypes, generateTypesInChildProcess, retrieveHostConfig, retrieveMfTypesPath, retrieveOriginalOutDir, retrieveTypesZipPath, index as rpc };
@@ -1,5 +0,0 @@
1
- import { ModuleFederationRuntimePlugin } from '@module-federation/runtime';
2
-
3
- declare function dynamicRemoteTypeHintsPlugin(): ModuleFederationRuntimePlugin;
4
-
5
- export { dynamicRemoteTypeHintsPlugin as default };
@@ -1,241 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
21
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
22
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
23
- }) : x)(function(x) {
24
- if (typeof require !== "undefined")
25
- return require.apply(this, arguments);
26
- throw Error('Dynamic require of "' + x + '" is not supported');
27
- });
28
- var __objRest = (source, exclude) => {
29
- var target = {};
30
- for (var prop in source)
31
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
32
- target[prop] = source[prop];
33
- if (source != null && __getOwnPropSymbols)
34
- for (var prop of __getOwnPropSymbols(source)) {
35
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
36
- target[prop] = source[prop];
37
- }
38
- return target;
39
- };
40
- var __export = (target, all) => {
41
- for (var name in all)
42
- __defProp(target, name, { get: all[name], enumerable: true });
43
- };
44
- var __publicField = (obj, key, value) => {
45
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
46
- return value;
47
- };
48
- var __async = (__this, __arguments, generator) => {
49
- return new Promise((resolve, reject) => {
50
- var fulfilled = (value) => {
51
- try {
52
- step(generator.next(value));
53
- } catch (e) {
54
- reject(e);
55
- }
56
- };
57
- var rejected = (value) => {
58
- try {
59
- step(generator.throw(value));
60
- } catch (e) {
61
- reject(e);
62
- }
63
- };
64
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
65
- step((generator = generator.apply(__this, __arguments)).next());
66
- });
67
- };
68
-
69
- // src/server/constant.ts
70
- var DEFAULT_WEB_SOCKET_PORT = 16322;
71
- var WEB_SOCKET_CONNECT_MAGIC_ID = "1hpzW-zo2z-o8io-gfmV1-2cb1d82";
72
- var MF_SERVER_IDENTIFIER = "Module Federation DTS";
73
- var WEB_CLIENT_OPTIONS_IDENTIFIER = "__WEB_CLIENT_OPTIONS__";
74
- var DEFAULT_TAR_NAME = "@mf-types.zip";
75
- var UpdateMode;
76
- (function(UpdateMode2) {
77
- UpdateMode2["POSITIVE"] = "POSITIVE";
78
- UpdateMode2["PASSIVE"] = "PASSIVE";
79
- })(UpdateMode || (UpdateMode = {}));
80
-
81
- // src/server/message/Action/Update.ts
82
- var UpdateKind;
83
- (function(UpdateKind2) {
84
- UpdateKind2["UPDATE_TYPE"] = "UPDATE_TYPE";
85
- UpdateKind2["RELOAD_PAGE"] = "RELOAD_PAGE";
86
- })(UpdateKind || (UpdateKind = {}));
87
-
88
- // src/server/message/Message.ts
89
- var _Message = class _Message {
90
- constructor(type, kind) {
91
- __publicField(this, "type");
92
- __publicField(this, "kind");
93
- __publicField(this, "time");
94
- this.type = type;
95
- this.kind = kind;
96
- this.time = Date.now();
97
- }
98
- };
99
- __name(_Message, "Message");
100
- var Message = _Message;
101
-
102
- // src/server/message/Action/Action.ts
103
- var ActionKind;
104
- (function(ActionKind2) {
105
- ActionKind2["ADD_SUBSCRIBER"] = "ADD_SUBSCRIBER";
106
- ActionKind2["EXIT_SUBSCRIBER"] = "EXIT_SUBSCRIBER";
107
- ActionKind2["ADD_PUBLISHER"] = "ADD_PUBLISHER";
108
- ActionKind2["UPDATE_PUBLISHER"] = "UPDATE_PUBLISHER";
109
- ActionKind2["NOTIFY_SUBSCRIBER"] = "NOTIFY_SUBSCRIBER";
110
- ActionKind2["EXIT_PUBLISHER"] = "EXIT_PUBLISHER";
111
- ActionKind2["ADD_WEB_CLIENT"] = "ADD_WEB_CLIENT";
112
- ActionKind2["NOTIFY_WEB_CLIENT"] = "NOTIFY_WEB_CLIENT";
113
- ActionKind2["FETCH_TYPES"] = "FETCH_TYPES";
114
- ActionKind2["ADD_DYNAMIC_REMOTE"] = "ADD_DYNAMIC_REMOTE";
115
- })(ActionKind || (ActionKind = {}));
116
- var _Action = class _Action extends Message {
117
- constructor(content, kind) {
118
- super("Action", kind);
119
- __publicField(this, "payload");
120
- const { payload } = content;
121
- this.payload = payload;
122
- }
123
- };
124
- __name(_Action, "Action");
125
- var Action = _Action;
126
-
127
- // src/server/message/Action/FetchTypes.ts
128
- var _FetchTypesAction = class _FetchTypesAction extends Action {
129
- constructor(payload) {
130
- super({
131
- payload
132
- }, ActionKind.FETCH_TYPES);
133
- }
134
- };
135
- __name(_FetchTypesAction, "FetchTypesAction");
136
- var FetchTypesAction = _FetchTypesAction;
137
-
138
- // src/server/message/Action/AddDynamicRemote.ts
139
- var _AddDynamicRemoteAction = class _AddDynamicRemoteAction extends Action {
140
- constructor(payload) {
141
- super({
142
- payload
143
- }, ActionKind.ADD_DYNAMIC_REMOTE);
144
- }
145
- };
146
- __name(_AddDynamicRemoteAction, "AddDynamicRemoteAction");
147
- var AddDynamicRemoteAction = _AddDynamicRemoteAction;
148
-
149
- // src/server/message/Action/AddPublisher.ts
150
- var _AddPublisherAction = class _AddPublisherAction extends Action {
151
- constructor(payload) {
152
- super({
153
- payload
154
- }, ActionKind.ADD_PUBLISHER);
155
- }
156
- };
157
- __name(_AddPublisherAction, "AddPublisherAction");
158
- var AddPublisherAction = _AddPublisherAction;
159
-
160
- // src/server/message/Action/AddSubscriber.ts
161
- var _AddSubscriberAction = class _AddSubscriberAction extends Action {
162
- constructor(payload) {
163
- super({
164
- payload
165
- }, ActionKind.ADD_SUBSCRIBER);
166
- }
167
- };
168
- __name(_AddSubscriberAction, "AddSubscriberAction");
169
- var AddSubscriberAction = _AddSubscriberAction;
170
-
171
- // src/server/message/Action/ExitSubscriber.ts
172
- var _ExitSubscriberAction = class _ExitSubscriberAction extends Action {
173
- constructor(payload) {
174
- super({
175
- payload
176
- }, ActionKind.EXIT_SUBSCRIBER);
177
- }
178
- };
179
- __name(_ExitSubscriberAction, "ExitSubscriberAction");
180
- var ExitSubscriberAction = _ExitSubscriberAction;
181
-
182
- // src/server/message/Action/ExitPublisher.ts
183
- var _ExitPublisherAction = class _ExitPublisherAction extends Action {
184
- constructor(payload) {
185
- super({
186
- payload
187
- }, ActionKind.EXIT_PUBLISHER);
188
- }
189
- };
190
- __name(_ExitPublisherAction, "ExitPublisherAction");
191
- var ExitPublisherAction = _ExitPublisherAction;
192
-
193
- // src/server/message/Action/NotifyWebClient.ts
194
- var _NotifyWebClientAction = class _NotifyWebClientAction extends Action {
195
- constructor(payload) {
196
- super({
197
- payload
198
- }, ActionKind.NOTIFY_WEB_CLIENT);
199
- }
200
- };
201
- __name(_NotifyWebClientAction, "NotifyWebClientAction");
202
- var NotifyWebClientAction = _NotifyWebClientAction;
203
-
204
- // src/server/message/Action/UpdatePublisher.ts
205
- var _UpdatePublisherAction = class _UpdatePublisherAction extends Action {
206
- constructor(payload) {
207
- super({
208
- payload
209
- }, ActionKind.UPDATE_PUBLISHER);
210
- }
211
- };
212
- __name(_UpdatePublisherAction, "UpdatePublisherAction");
213
- var UpdatePublisherAction = _UpdatePublisherAction;
214
-
215
- export {
216
- __spreadValues,
217
- __spreadProps,
218
- __name,
219
- __require,
220
- __objRest,
221
- __export,
222
- __publicField,
223
- __async,
224
- Message,
225
- DEFAULT_WEB_SOCKET_PORT,
226
- WEB_SOCKET_CONNECT_MAGIC_ID,
227
- MF_SERVER_IDENTIFIER,
228
- WEB_CLIENT_OPTIONS_IDENTIFIER,
229
- DEFAULT_TAR_NAME,
230
- UpdateMode,
231
- ActionKind,
232
- UpdateKind,
233
- AddPublisherAction,
234
- AddSubscriberAction,
235
- ExitSubscriberAction,
236
- ExitPublisherAction,
237
- NotifyWebClientAction,
238
- UpdatePublisherAction,
239
- FetchTypesAction,
240
- AddDynamicRemoteAction
241
- };
@@ -1,24 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-647HGGGS.js";
4
-
5
- // src/dev-worker/utils.ts
6
- var DEFAULT_LOCAL_IPS = [
7
- "localhost",
8
- "127.0.0.1"
9
- ];
10
- function getIpFromEntry(entry, ipv4) {
11
- let ip;
12
- entry.replace(/https?:\/\/([0-9|.]+|localhost):/, (str, matched) => {
13
- ip = matched;
14
- return str;
15
- });
16
- if (ip) {
17
- return DEFAULT_LOCAL_IPS.includes(ip) ? ipv4 : ip;
18
- }
19
- }
20
- __name(getIpFromEntry, "getIpFromEntry");
21
-
22
- export {
23
- getIpFromEntry
24
- };