every-plugin 0.8.2 → 0.8.3
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/build/rspack/dev-server-middleware.cjs +3 -40
- package/dist/build/rspack/dev-server-middleware.cjs.map +1 -1
- package/dist/build/rspack/dev-server-middleware.mjs +3 -40
- package/dist/build/rspack/dev-server-middleware.mjs.map +1 -1
- package/dist/errors.cjs +8 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.mts +2 -2
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +2 -1
- package/dist/errors.mjs.map +1 -1
- package/dist/index.cjs +12 -4
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +2 -1
- package/dist/orpc.d.mts +1 -1
- package/dist/orpc.mjs +2 -2
- package/dist/package.cjs +7 -7
- package/dist/package.cjs.map +1 -1
- package/dist/package.mjs +7 -7
- package/dist/package.mjs.map +1 -1
- package/dist/plugin.cjs +6 -2
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +6 -2
- package/dist/plugin.mjs.map +1 -1
- package/dist/runtime/errors.cjs +100 -5
- package/dist/runtime/errors.cjs.map +1 -1
- package/dist/runtime/errors.d.cts +15 -3
- package/dist/runtime/errors.d.cts.map +1 -1
- package/dist/runtime/errors.d.mts +13 -1
- package/dist/runtime/errors.d.mts.map +1 -1
- package/dist/runtime/errors.mjs +98 -6
- package/dist/runtime/errors.mjs.map +1 -1
- package/dist/runtime/index.cjs +1 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/services/module-federation.service.cjs +5 -0
- package/dist/runtime/services/module-federation.service.cjs.map +1 -1
- package/dist/runtime/services/module-federation.service.d.cts.map +1 -1
- package/dist/runtime/services/module-federation.service.d.mts.map +1 -1
- package/dist/runtime/services/module-federation.service.mjs +5 -0
- package/dist/runtime/services/module-federation.service.mjs.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.mts +1 -1
- package/dist/runtime/services/plugin-loader.service.d.cts +1 -1
- package/dist/runtime/services/plugin-loader.service.d.mts +2 -2
- package/dist/runtime/services/plugin.service.d.cts +1 -1
- package/dist/runtime/services/plugin.service.d.mts +2 -2
- package/dist/runtime/services/secrets.service.d.cts +1 -1
- package/dist/runtime/services/secrets.service.d.mts +1 -1
- package/dist/types.d.mts +2 -2
- package/package.json +20 -16
package/dist/runtime/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PluginRuntimeError } from "./errors.mjs";
|
|
2
2
|
import { PluginService } from "./services/plugin.service.mjs";
|
|
3
|
-
import { createRouterClient } from "@orpc/server";
|
|
4
3
|
import { Cause, Effect, Exit, Hash, ManagedRuntime, Option } from "effect";
|
|
4
|
+
import { createRouterClient } from "@orpc/server";
|
|
5
5
|
|
|
6
6
|
//#region src/runtime/index.ts
|
|
7
7
|
var PluginRuntime = class {
|
|
@@ -21,6 +21,7 @@ const createModuleFederationInstance = effect.Effect.cached(effect.Effect.sync((
|
|
|
21
21
|
shared: {
|
|
22
22
|
"every-plugin": {
|
|
23
23
|
version: require_package.version,
|
|
24
|
+
get: () => Promise.resolve().then(() => require("../../index.cjs")).then((mod) => () => mod),
|
|
24
25
|
shareConfig: {
|
|
25
26
|
singleton: true,
|
|
26
27
|
requiredVersion: getMajorVersionRange(require_package.version),
|
|
@@ -30,6 +31,7 @@ const createModuleFederationInstance = effect.Effect.cached(effect.Effect.sync((
|
|
|
30
31
|
},
|
|
31
32
|
effect: {
|
|
32
33
|
version: require_package.dependencies.effect,
|
|
34
|
+
get: () => import("effect").then((mod) => () => mod),
|
|
33
35
|
shareConfig: {
|
|
34
36
|
singleton: true,
|
|
35
37
|
requiredVersion: getMajorVersionRange(require_package.dependencies.effect),
|
|
@@ -39,6 +41,7 @@ const createModuleFederationInstance = effect.Effect.cached(effect.Effect.sync((
|
|
|
39
41
|
},
|
|
40
42
|
zod: {
|
|
41
43
|
version: require_package.dependencies.zod,
|
|
44
|
+
get: () => import("zod").then((mod) => () => mod),
|
|
42
45
|
shareConfig: {
|
|
43
46
|
singleton: true,
|
|
44
47
|
requiredVersion: getMajorVersionRange(require_package.dependencies.zod),
|
|
@@ -48,6 +51,7 @@ const createModuleFederationInstance = effect.Effect.cached(effect.Effect.sync((
|
|
|
48
51
|
},
|
|
49
52
|
"@orpc/contract": {
|
|
50
53
|
version: require_package.dependencies["@orpc/contract"],
|
|
54
|
+
get: () => import("@orpc/contract").then((mod) => () => mod),
|
|
51
55
|
shareConfig: {
|
|
52
56
|
singleton: true,
|
|
53
57
|
requiredVersion: getMajorVersionRange(require_package.dependencies["@orpc/contract"]),
|
|
@@ -57,6 +61,7 @@ const createModuleFederationInstance = effect.Effect.cached(effect.Effect.sync((
|
|
|
57
61
|
},
|
|
58
62
|
"@orpc/server": {
|
|
59
63
|
version: require_package.dependencies["@orpc/server"],
|
|
64
|
+
get: () => import("@orpc/server").then((mod) => () => mod),
|
|
60
65
|
shareConfig: {
|
|
61
66
|
singleton: true,
|
|
62
67
|
requiredVersion: getMajorVersionRange(require_package.dependencies["@orpc/server"]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-federation.service.cjs","names":["version","Effect","getNormalizedRemoteName","ModuleFederationError","Constructor: any"],"sources":["../../../src/runtime/services/module-federation.service.ts"],"sourcesContent":["import {\n\tcreateInstance,\n\tgetInstance,\n} from \"@module-federation/enhanced/runtime\";\nimport { setGlobalFederationInstance } from \"@module-federation/runtime-core\";\nimport { Effect } from \"effect\";\nimport type { AnyPlugin } from \"../../types\";\nimport { ModuleFederationError } from \"../errors\";\nimport { getNormalizedRemoteName } from \"./normalize\";\n\ntype RemoteModule = \n | (new () => AnyPlugin)\n | { default: new () => AnyPlugin };\n\nimport pkg from \"../../../package.json\";\n\nfunction getMajorVersionRange(version: string): string {\n\tconst match = version.match(/^[\\^~]?(\\d+)/);\n\tconst major = match ? match[1] : '0';\n\treturn `^${major}.0.0`;\n}\n\nconst createModuleFederationInstance = Effect.cached(\n\tEffect.sync(() => {\n\t\ttry {\n\t\t\tlet instance = getInstance();\n\n\t\t\tif (!instance) {\n\t\t\t\tinstance = createInstance({\n\t\t\t\t\tname: \"host\",\n\t\t\t\t\tremotes: [],\n\t\t\t\t\tshared: {\n\t\t\t\t\t\t\"every-plugin\": {\n\t\t\t\t\t\t\tversion: pkg.version,\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.version),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\teffect: {\n\t\t\t\t\t\t\tversion: pkg.dependencies.effect,\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies.effect),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tzod: {\n\t\t\t\t\t\t\tversion: pkg.dependencies.zod,\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies.zod),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"@orpc/contract\": {\n\t\t\t\t\t\t\tversion: pkg.dependencies[\"@orpc/contract\"],\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies[\"@orpc/contract\"]),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"@orpc/server\": {\n\t\t\t\t\t\t\tversion: pkg.dependencies[\"@orpc/server\"],\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies[\"@orpc/server\"]),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\tsetGlobalFederationInstance(instance);\n\t\t\t}\n\n\t\t\treturn instance;\n\t\t} catch (error) {\n\t\t\tthrow new Error(`Failed to initialize Module Federation: ${error}`);\n\t\t}\n\t}),\n);\n\nexport class ModuleFederationService extends Effect.Service<ModuleFederationService>()(\"ModuleFederationService\", {\n\teffect: Effect.gen(function* () {\n\t\tconst mf = yield* Effect.flatten(createModuleFederationInstance);\n\n\t\treturn {\n\t\t\tregisterRemote: (pluginId: string, url: string) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconsole.log(`[MF] Registering ${pluginId}`);\n\n\t\t\t\t\tconst remoteName = getNormalizedRemoteName(pluginId);\n\n\t\t\t\t\tyield* Effect.try({\n\t\t\t\t\t\ttry: () => mf.registerRemotes([{\n\t\t\t\t\t\t\tname: remoteName,\n\t\t\t\t\t\t\tentry: url,\n\t\t\t\t\t\t}]),\n\t\t\t\t\t\tcatch: (error): ModuleFederationError =>\n\t\t\t\t\t\t\tnew ModuleFederationError({\n\t\t\t\t\t\t\t\tpluginId,\n\t\t\t\t\t\t\t\tremoteUrl: url,\n\t\t\t\t\t\t\t\tcause:\n\t\t\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\n\t\t\t\t\tconsole.log(`[MF] ✅ Registered ${pluginId}`);\n\t\t\t\t}),\n\n\t\t\tloadRemoteConstructor: (pluginId: string, url: string) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst remoteName = getNormalizedRemoteName(pluginId);\n\t\t\t\t\tconsole.log(`[MF] Loading remote ${remoteName}`);\n\t\t\t\t\tconst modulePath = `${remoteName}/plugin`;\n\n\t\t\t\t\treturn yield* Effect.tryPromise({\n\t\t\t\t\t\ttry: async () => {\n\n\t\t\t\t\t\t\tconst container = await mf.loadRemote<RemoteModule>(modulePath);\n\t\t\t\t\t\t\tif (!container) {\n\t\t\t\t\t\t\t\tthrow new Error(`No container returned for ${modulePath}`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Support multiple export patterns: direct function, default export, named exports\n\t\t\t\t\t\t\tlet Constructor: any;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (typeof container === \"function\") {\n\t\t\t\t\t\t\t\t// Direct function export\n\t\t\t\t\t\t\t\tConstructor = container;\n\t\t\t\t\t\t\t} else if (container.default) {\n\t\t\t\t\t\t\t\t// Default export\n\t\t\t\t\t\t\t\tConstructor = container.default;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Named export fallback - prioritize exports with 'binding' property (plugin classes)\n\t\t\t\t\t\t\t\tConstructor = Object.values(container).find(\n\t\t\t\t\t\t\t\t\t(exp) => typeof exp === \"function\" && (exp as any).binding !== undefined\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// Fallback to any function export if no binding found\n\t\t\t\t\t\t\t\tif (!Constructor) {\n\t\t\t\t\t\t\t\t\tConstructor = Object.values(container).find(\n\t\t\t\t\t\t\t\t\t\t(exp) => typeof exp === \"function\" && exp.prototype?.constructor === exp\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (!Constructor || typeof Constructor !== \"function\") {\n\t\t\t\t\t\t\t\tconst containerInfo = typeof container === \"object\"\n\t\t\t\t\t\t\t\t\t? `Available exports: ${Object.keys(container).join(', ')}`\n\t\t\t\t\t\t\t\t\t: `Container type: ${typeof container}`;\n\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t`No valid plugin constructor found for '${pluginId}'.\\n` +\n\t\t\t\t\t\t\t\t\t`Supported patterns:\\n` +\n\t\t\t\t\t\t\t\t\t` - export const YourPlugin = createPlugin({...})\\n` +\n\t\t\t\t\t\t\t\t\t` - export default createPlugin({...})\\n` +\n\t\t\t\t\t\t\t\t\t`${containerInfo}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Validate it looks like a plugin constructor (has binding property)\n\t\t\t\t\t\t\tif (!(Constructor as any).binding) {\n\t\t\t\t\t\t\t\tconst containerInfo = typeof container === \"object\"\n\t\t\t\t\t\t\t\t\t? `Found exports: ${Object.keys(container).join(', ')}`\n\t\t\t\t\t\t\t\t\t: `Container type: ${typeof container}`;\n\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t`Invalid plugin constructor for '${pluginId}'. ` +\n\t\t\t\t\t\t\t\t\t`The exported value must be created with createPlugin(). ` +\n\t\t\t\t\t\t\t\t\t`Found a function but it's missing the required 'binding' property.\\n` +\n\t\t\t\t\t\t\t\t\t`${containerInfo}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconsole.log(`[MF] ✅ Loaded constructor for ${pluginId}`);\n\t\t\t\t\t\t\treturn Constructor;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcatch: (error): ModuleFederationError =>\n\t\t\t\t\t\t\tnew ModuleFederationError({\n\t\t\t\t\t\t\t\tpluginId,\n\t\t\t\t\t\t\t\tremoteUrl: url,\n\t\t\t\t\t\t\t\tcause:\n\t\t\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t};\n\t}),\n}) {}\n"],"mappings":";;;;;;;;;AAgBA,SAAS,qBAAqB,WAAyB;CACtD,MAAM,QAAQA,UAAQ,MAAM,eAAe;AAE3C,QAAO,IADO,QAAQ,MAAM,KAAK,IAChB;;AAGlB,MAAM,iCAAiCC,cAAO,OAC7CA,cAAO,WAAW;AACjB,KAAI;EACH,IAAI,kEAAwB;AAE5B,MAAI,CAAC,UAAU;AACd,uEAA0B;IACzB,MAAM;IACN,SAAS,EAAE;IACX,QAAQ;KACP,gBAAgB;MACf;MACA,aAAa;OACZ,WAAW;OACX,iBAAiB,6CAAiC;OAClD,OAAO;OACP,eAAe;OACf;MACD;KACD,QAAQ;MACP,sCAA0B;MAC1B,aAAa;OACZ,WAAW;OACX,iBAAiB,kDAAsC,OAAO;OAC9D,OAAO;OACP,eAAe;OACf;MACD;KACD,KAAK;MACJ,sCAA0B;MAC1B,aAAa;OACZ,WAAW;OACX,iBAAiB,kDAAsC,IAAI;OAC3D,OAAO;OACP,eAAe;OACf;MACD;KACD,kBAAkB;MACjB,sCAA0B;MAC1B,aAAa;OACZ,WAAW;OACX,iBAAiB,kDAAsC,kBAAkB;OACzE,OAAO;OACP,eAAe;OACf;MACD;KACD,gBAAgB;MACf,sCAA0B;MAC1B,aAAa;OACZ,WAAW;OACX,iBAAiB,kDAAsC,gBAAgB;OACvE,OAAO;OACP,eAAe;OACf;MACD;KACD;IACD,CAAC;AAEF,qEAA4B,SAAS;;AAGtC,SAAO;UACC,OAAO;AACf,QAAM,IAAI,MAAM,2CAA2C,QAAQ;;EAEnE,CACF;AAED,IAAa,0BAAb,cAA6CA,cAAO,SAAkC,CAAC,2BA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B,YAAM,IAAI,MACT,0CAA0C,SAAS,sHAIhD,gBACH;;AAIF,SAAI,CAAE,YAAoB,SAAS;MAClC,MAAM,gBAAgB,OAAO,cAAc,WACxC,kBAAkB,OAAO,KAAK,UAAU,CAAC,KAAK,KAAK,KACnD,mBAAmB,OAAO;AAE7B,YAAM,IAAI,MACT,mCAAmC,SAAS,iIAGzC,gBACH;;AAGF,aAAQ,IAAI,iCAAiC,WAAW;AACxD,YAAO;;IAER,QAAQ,UACP,IAAID,qCAAsB;KACzB;KACA,WAAW;KACX,OACC,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;KAC1D,CAAC;IACH,CAAC;IACD;EACH;EACA,EACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"module-federation.service.cjs","names":["version","Effect","getNormalizedRemoteName","ModuleFederationError","Constructor: any"],"sources":["../../../src/runtime/services/module-federation.service.ts"],"sourcesContent":["import {\n\tcreateInstance,\n\tgetInstance,\n} from \"@module-federation/enhanced/runtime\";\nimport { setGlobalFederationInstance } from \"@module-federation/runtime-core\";\nimport { Effect } from \"effect\";\nimport type { AnyPlugin } from \"../../types\";\nimport { ModuleFederationError } from \"../errors\";\nimport { getNormalizedRemoteName } from \"./normalize\";\n\ntype RemoteModule = \n | (new () => AnyPlugin)\n | { default: new () => AnyPlugin };\n\nimport pkg from \"../../../package.json\";\n\nfunction getMajorVersionRange(version: string): string {\n\tconst match = version.match(/^[\\^~]?(\\d+)/);\n\tconst major = match ? match[1] : '0';\n\treturn `^${major}.0.0`;\n}\n\nconst createModuleFederationInstance = Effect.cached(\n\tEffect.sync(() => {\n\t\ttry {\n\t\t\tlet instance = getInstance();\n\n\t\t\tif (!instance) {\n\t\t\t\tinstance = createInstance({\n\t\t\t\t\tname: \"host\",\n\t\t\t\t\tremotes: [],\n\t\t\t\t\tshared: {\n\t\t\t\t\t\t\"every-plugin\": {\n\t\t\t\t\t\t\tversion: pkg.version,\n\t\t\t\t\t\t\tget: () => import(\"every-plugin\").then(mod => () => mod),\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.version),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\teffect: {\n\t\t\t\t\t\t\tversion: pkg.dependencies.effect,\n\t\t\t\t\t\t\tget: () => import(\"effect\").then(mod => () => mod),\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies.effect),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tzod: {\n\t\t\t\t\t\t\tversion: pkg.dependencies.zod,\n\t\t\t\t\t\t\tget: () => import(\"zod\").then(mod => () => mod),\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies.zod),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"@orpc/contract\": {\n\t\t\t\t\t\t\tversion: pkg.dependencies[\"@orpc/contract\"],\n\t\t\t\t\t\t\tget: () => import(\"@orpc/contract\").then(mod => () => mod),\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies[\"@orpc/contract\"]),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"@orpc/server\": {\n\t\t\t\t\t\t\tversion: pkg.dependencies[\"@orpc/server\"],\n\t\t\t\t\t\t\tget: () => import(\"@orpc/server\").then(mod => () => mod),\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies[\"@orpc/server\"]),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\tsetGlobalFederationInstance(instance);\n\t\t\t}\n\n\t\t\treturn instance;\n\t\t} catch (error) {\n\t\t\tthrow new Error(`Failed to initialize Module Federation: ${error}`);\n\t\t}\n\t}),\n);\n\nexport class ModuleFederationService extends Effect.Service<ModuleFederationService>()(\"ModuleFederationService\", {\n\teffect: Effect.gen(function* () {\n\t\tconst mf = yield* Effect.flatten(createModuleFederationInstance);\n\n\t\treturn {\n\t\t\tregisterRemote: (pluginId: string, url: string) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconsole.log(`[MF] Registering ${pluginId}`);\n\n\t\t\t\t\tconst remoteName = getNormalizedRemoteName(pluginId);\n\n\t\t\t\t\tyield* Effect.try({\n\t\t\t\t\t\ttry: () => mf.registerRemotes([{\n\t\t\t\t\t\t\tname: remoteName,\n\t\t\t\t\t\t\tentry: url,\n\t\t\t\t\t\t}]),\n\t\t\t\t\t\tcatch: (error): ModuleFederationError =>\n\t\t\t\t\t\t\tnew ModuleFederationError({\n\t\t\t\t\t\t\t\tpluginId,\n\t\t\t\t\t\t\t\tremoteUrl: url,\n\t\t\t\t\t\t\t\tcause:\n\t\t\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\n\t\t\t\t\tconsole.log(`[MF] ✅ Registered ${pluginId}`);\n\t\t\t\t}),\n\n\t\t\tloadRemoteConstructor: (pluginId: string, url: string) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst remoteName = getNormalizedRemoteName(pluginId);\n\t\t\t\t\tconsole.log(`[MF] Loading remote ${remoteName}`);\n\t\t\t\t\tconst modulePath = `${remoteName}/plugin`;\n\n\t\t\t\t\treturn yield* Effect.tryPromise({\n\t\t\t\t\t\ttry: async () => {\n\n\t\t\t\t\t\t\tconst container = await mf.loadRemote<RemoteModule>(modulePath);\n\t\t\t\t\t\t\tif (!container) {\n\t\t\t\t\t\t\t\tthrow new Error(`No container returned for ${modulePath}`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Support multiple export patterns: direct function, default export, named exports\n\t\t\t\t\t\t\tlet Constructor: any;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (typeof container === \"function\") {\n\t\t\t\t\t\t\t\t// Direct function export\n\t\t\t\t\t\t\t\tConstructor = container;\n\t\t\t\t\t\t\t} else if (container.default) {\n\t\t\t\t\t\t\t\t// Default export\n\t\t\t\t\t\t\t\tConstructor = container.default;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Named export fallback - prioritize exports with 'binding' property (plugin classes)\n\t\t\t\t\t\t\t\tConstructor = Object.values(container).find(\n\t\t\t\t\t\t\t\t\t(exp) => typeof exp === \"function\" && (exp as any).binding !== undefined\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// Fallback to any function export if no binding found\n\t\t\t\t\t\t\t\tif (!Constructor) {\n\t\t\t\t\t\t\t\t\tConstructor = Object.values(container).find(\n\t\t\t\t\t\t\t\t\t\t(exp) => typeof exp === \"function\" && exp.prototype?.constructor === exp\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (!Constructor || typeof Constructor !== \"function\") {\n\t\t\t\t\t\t\t\tconst containerInfo = typeof container === \"object\"\n\t\t\t\t\t\t\t\t\t? `Available exports: ${Object.keys(container).join(', ')}`\n\t\t\t\t\t\t\t\t\t: `Container type: ${typeof container}`;\n\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t`No valid plugin constructor found for '${pluginId}'.\\n` +\n\t\t\t\t\t\t\t\t\t`Supported patterns:\\n` +\n\t\t\t\t\t\t\t\t\t` - export const YourPlugin = createPlugin({...})\\n` +\n\t\t\t\t\t\t\t\t\t` - export default createPlugin({...})\\n` +\n\t\t\t\t\t\t\t\t\t`${containerInfo}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Validate it looks like a plugin constructor (has binding property)\n\t\t\t\t\t\t\tif (!(Constructor as any).binding) {\n\t\t\t\t\t\t\t\tconst containerInfo = typeof container === \"object\"\n\t\t\t\t\t\t\t\t\t? `Found exports: ${Object.keys(container).join(', ')}`\n\t\t\t\t\t\t\t\t\t: `Container type: ${typeof container}`;\n\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t`Invalid plugin constructor for '${pluginId}'. ` +\n\t\t\t\t\t\t\t\t\t`The exported value must be created with createPlugin(). ` +\n\t\t\t\t\t\t\t\t\t`Found a function but it's missing the required 'binding' property.\\n` +\n\t\t\t\t\t\t\t\t\t`${containerInfo}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconsole.log(`[MF] ✅ Loaded constructor for ${pluginId}`);\n\t\t\t\t\t\t\treturn Constructor;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcatch: (error): ModuleFederationError =>\n\t\t\t\t\t\t\tnew ModuleFederationError({\n\t\t\t\t\t\t\t\tpluginId,\n\t\t\t\t\t\t\t\tremoteUrl: url,\n\t\t\t\t\t\t\t\tcause:\n\t\t\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t\t\t\t}),\n\t\t\t\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AAK,KACvD,mBAAmB,OAAO;AAE7B,YAAM,IAAI,MACT,0CAA0C,SAAS,sHAIhD,gBACH;;AAIF,SAAI,CAAE,YAAoB,SAAS;MAClC,MAAM,gBAAgB,OAAO,cAAc,WACxC,kBAAkB,OAAO,KAAK,UAAU,CAAC,KAAK,KAAK,KACnD,mBAAmB,OAAO;AAE7B,YAAM,IAAI,MACT,mCAAmC,SAAS,iIAGzC,gBACH;;AAGF,aAAQ,IAAI,iCAAiC,WAAW;AACxD,YAAO;;IAER,QAAQ,UACP,IAAID,qCAAsB;KACzB;KACA,WAAW;KACX,OACC,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;KAC1D,CAAC;IACH,CAAC;IACD;EACH;EACA,EACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-federation.service.d.cts","names":[],"sources":["../../../src/runtime/services/module-federation.service.ts"],"sourcesContent":[],"mappings":";;;;cAOkD;;IAAA,cAAA,EAAA,CAAA,QAAA,EAAA,MAAA,EAAA,GAAA,EAAA,MAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"module-federation.service.d.cts","names":[],"sources":["../../../src/runtime/services/module-federation.service.ts"],"sourcesContent":[],"mappings":";;;;cAOkD;;IAAA,cAAA,EAAA,CAAA,QAAA,EAAA,MAAA,EAAA,GAAA,EAAA,MAAA,EAAA,GA6FD,MAAA,CAAA,MA7FC,CAAA,IAAA,EA6FD,qBA7FC,EAAA,KAAA,CAAA;8DAoHM,MAAA,CAAA,YAAA;EAvBP,CAAA,EAAA,KAAA,EAAA,KAAA,CAAA;CAAA,CAAA;AAuBO,cA5B3C,uBAAA,SAAgC,4BAAA,CA4BW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-federation.service.d.mts","names":[],"sources":["../../../src/runtime/services/module-federation.service.ts"],"sourcesContent":[],"mappings":";;;;cAOkD;;IAAA,cAAA,EAAA,CAAA,QAAA,EAAA,MAAA,EAAA,GAAA,EAAA,MAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"module-federation.service.d.mts","names":[],"sources":["../../../src/runtime/services/module-federation.service.ts"],"sourcesContent":[],"mappings":";;;;cAOkD;;IAAA,cAAA,EAAA,CAAA,QAAA,EAAA,MAAA,EAAA,GAAA,EAAA,MAAA,EAAA,GA6FD,MAAA,CAAA,MA7FC,CAAA,IAAA,EA6FD,qBA7FC,EAAA,KAAA,CAAA;8DAoHM,MAAA,CAAA,YAAA;EAvBP,CAAA,EAAA,KAAA,EAAA,KAAA,CAAA;CAAA,CAAA;AAuBO,cA5B3C,uBAAA,SAAgC,4BAAA,CA4BW"}
|
|
@@ -20,6 +20,7 @@ const createModuleFederationInstance = Effect.cached(Effect.sync(() => {
|
|
|
20
20
|
shared: {
|
|
21
21
|
"every-plugin": {
|
|
22
22
|
version,
|
|
23
|
+
get: () => import("../../index.mjs").then((mod) => () => mod),
|
|
23
24
|
shareConfig: {
|
|
24
25
|
singleton: true,
|
|
25
26
|
requiredVersion: getMajorVersionRange(version),
|
|
@@ -29,6 +30,7 @@ const createModuleFederationInstance = Effect.cached(Effect.sync(() => {
|
|
|
29
30
|
},
|
|
30
31
|
effect: {
|
|
31
32
|
version: dependencies.effect,
|
|
33
|
+
get: () => import("effect").then((mod) => () => mod),
|
|
32
34
|
shareConfig: {
|
|
33
35
|
singleton: true,
|
|
34
36
|
requiredVersion: getMajorVersionRange(dependencies.effect),
|
|
@@ -38,6 +40,7 @@ const createModuleFederationInstance = Effect.cached(Effect.sync(() => {
|
|
|
38
40
|
},
|
|
39
41
|
zod: {
|
|
40
42
|
version: dependencies.zod,
|
|
43
|
+
get: () => import("zod").then((mod) => () => mod),
|
|
41
44
|
shareConfig: {
|
|
42
45
|
singleton: true,
|
|
43
46
|
requiredVersion: getMajorVersionRange(dependencies.zod),
|
|
@@ -47,6 +50,7 @@ const createModuleFederationInstance = Effect.cached(Effect.sync(() => {
|
|
|
47
50
|
},
|
|
48
51
|
"@orpc/contract": {
|
|
49
52
|
version: dependencies["@orpc/contract"],
|
|
53
|
+
get: () => import("@orpc/contract").then((mod) => () => mod),
|
|
50
54
|
shareConfig: {
|
|
51
55
|
singleton: true,
|
|
52
56
|
requiredVersion: getMajorVersionRange(dependencies["@orpc/contract"]),
|
|
@@ -56,6 +60,7 @@ const createModuleFederationInstance = Effect.cached(Effect.sync(() => {
|
|
|
56
60
|
},
|
|
57
61
|
"@orpc/server": {
|
|
58
62
|
version: dependencies["@orpc/server"],
|
|
63
|
+
get: () => import("@orpc/server").then((mod) => () => mod),
|
|
59
64
|
shareConfig: {
|
|
60
65
|
singleton: true,
|
|
61
66
|
requiredVersion: getMajorVersionRange(dependencies["@orpc/server"]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-federation.service.mjs","names":["version","pkg.version","Constructor: any"],"sources":["../../../src/runtime/services/module-federation.service.ts"],"sourcesContent":["import {\n\tcreateInstance,\n\tgetInstance,\n} from \"@module-federation/enhanced/runtime\";\nimport { setGlobalFederationInstance } from \"@module-federation/runtime-core\";\nimport { Effect } from \"effect\";\nimport type { AnyPlugin } from \"../../types\";\nimport { ModuleFederationError } from \"../errors\";\nimport { getNormalizedRemoteName } from \"./normalize\";\n\ntype RemoteModule = \n | (new () => AnyPlugin)\n | { default: new () => AnyPlugin };\n\nimport pkg from \"../../../package.json\";\n\nfunction getMajorVersionRange(version: string): string {\n\tconst match = version.match(/^[\\^~]?(\\d+)/);\n\tconst major = match ? match[1] : '0';\n\treturn `^${major}.0.0`;\n}\n\nconst createModuleFederationInstance = Effect.cached(\n\tEffect.sync(() => {\n\t\ttry {\n\t\t\tlet instance = getInstance();\n\n\t\t\tif (!instance) {\n\t\t\t\tinstance = createInstance({\n\t\t\t\t\tname: \"host\",\n\t\t\t\t\tremotes: [],\n\t\t\t\t\tshared: {\n\t\t\t\t\t\t\"every-plugin\": {\n\t\t\t\t\t\t\tversion: pkg.version,\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.version),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\teffect: {\n\t\t\t\t\t\t\tversion: pkg.dependencies.effect,\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies.effect),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tzod: {\n\t\t\t\t\t\t\tversion: pkg.dependencies.zod,\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies.zod),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"@orpc/contract\": {\n\t\t\t\t\t\t\tversion: pkg.dependencies[\"@orpc/contract\"],\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies[\"@orpc/contract\"]),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"@orpc/server\": {\n\t\t\t\t\t\t\tversion: pkg.dependencies[\"@orpc/server\"],\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies[\"@orpc/server\"]),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\tsetGlobalFederationInstance(instance);\n\t\t\t}\n\n\t\t\treturn instance;\n\t\t} catch (error) {\n\t\t\tthrow new Error(`Failed to initialize Module Federation: ${error}`);\n\t\t}\n\t}),\n);\n\nexport class ModuleFederationService extends Effect.Service<ModuleFederationService>()(\"ModuleFederationService\", {\n\teffect: Effect.gen(function* () {\n\t\tconst mf = yield* Effect.flatten(createModuleFederationInstance);\n\n\t\treturn {\n\t\t\tregisterRemote: (pluginId: string, url: string) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconsole.log(`[MF] Registering ${pluginId}`);\n\n\t\t\t\t\tconst remoteName = getNormalizedRemoteName(pluginId);\n\n\t\t\t\t\tyield* Effect.try({\n\t\t\t\t\t\ttry: () => mf.registerRemotes([{\n\t\t\t\t\t\t\tname: remoteName,\n\t\t\t\t\t\t\tentry: url,\n\t\t\t\t\t\t}]),\n\t\t\t\t\t\tcatch: (error): ModuleFederationError =>\n\t\t\t\t\t\t\tnew ModuleFederationError({\n\t\t\t\t\t\t\t\tpluginId,\n\t\t\t\t\t\t\t\tremoteUrl: url,\n\t\t\t\t\t\t\t\tcause:\n\t\t\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\n\t\t\t\t\tconsole.log(`[MF] ✅ Registered ${pluginId}`);\n\t\t\t\t}),\n\n\t\t\tloadRemoteConstructor: (pluginId: string, url: string) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst remoteName = getNormalizedRemoteName(pluginId);\n\t\t\t\t\tconsole.log(`[MF] Loading remote ${remoteName}`);\n\t\t\t\t\tconst modulePath = `${remoteName}/plugin`;\n\n\t\t\t\t\treturn yield* Effect.tryPromise({\n\t\t\t\t\t\ttry: async () => {\n\n\t\t\t\t\t\t\tconst container = await mf.loadRemote<RemoteModule>(modulePath);\n\t\t\t\t\t\t\tif (!container) {\n\t\t\t\t\t\t\t\tthrow new Error(`No container returned for ${modulePath}`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Support multiple export patterns: direct function, default export, named exports\n\t\t\t\t\t\t\tlet Constructor: any;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (typeof container === \"function\") {\n\t\t\t\t\t\t\t\t// Direct function export\n\t\t\t\t\t\t\t\tConstructor = container;\n\t\t\t\t\t\t\t} else if (container.default) {\n\t\t\t\t\t\t\t\t// Default export\n\t\t\t\t\t\t\t\tConstructor = container.default;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Named export fallback - prioritize exports with 'binding' property (plugin classes)\n\t\t\t\t\t\t\t\tConstructor = Object.values(container).find(\n\t\t\t\t\t\t\t\t\t(exp) => typeof exp === \"function\" && (exp as any).binding !== undefined\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// Fallback to any function export if no binding found\n\t\t\t\t\t\t\t\tif (!Constructor) {\n\t\t\t\t\t\t\t\t\tConstructor = Object.values(container).find(\n\t\t\t\t\t\t\t\t\t\t(exp) => typeof exp === \"function\" && exp.prototype?.constructor === exp\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (!Constructor || typeof Constructor !== \"function\") {\n\t\t\t\t\t\t\t\tconst containerInfo = typeof container === \"object\"\n\t\t\t\t\t\t\t\t\t? `Available exports: ${Object.keys(container).join(', ')}`\n\t\t\t\t\t\t\t\t\t: `Container type: ${typeof container}`;\n\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t`No valid plugin constructor found for '${pluginId}'.\\n` +\n\t\t\t\t\t\t\t\t\t`Supported patterns:\\n` +\n\t\t\t\t\t\t\t\t\t` - export const YourPlugin = createPlugin({...})\\n` +\n\t\t\t\t\t\t\t\t\t` - export default createPlugin({...})\\n` +\n\t\t\t\t\t\t\t\t\t`${containerInfo}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Validate it looks like a plugin constructor (has binding property)\n\t\t\t\t\t\t\tif (!(Constructor as any).binding) {\n\t\t\t\t\t\t\t\tconst containerInfo = typeof container === \"object\"\n\t\t\t\t\t\t\t\t\t? `Found exports: ${Object.keys(container).join(', ')}`\n\t\t\t\t\t\t\t\t\t: `Container type: ${typeof container}`;\n\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t`Invalid plugin constructor for '${pluginId}'. ` +\n\t\t\t\t\t\t\t\t\t`The exported value must be created with createPlugin(). ` +\n\t\t\t\t\t\t\t\t\t`Found a function but it's missing the required 'binding' property.\\n` +\n\t\t\t\t\t\t\t\t\t`${containerInfo}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconsole.log(`[MF] ✅ Loaded constructor for ${pluginId}`);\n\t\t\t\t\t\t\treturn Constructor;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcatch: (error): ModuleFederationError =>\n\t\t\t\t\t\t\tnew ModuleFederationError({\n\t\t\t\t\t\t\t\tpluginId,\n\t\t\t\t\t\t\t\tremoteUrl: url,\n\t\t\t\t\t\t\t\tcause:\n\t\t\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t};\n\t}),\n}) {}\n"],"mappings":";;;;;;;;AAgBA,SAAS,qBAAqB,WAAyB;CACtD,MAAM,QAAQA,UAAQ,MAAM,eAAe;AAE3C,QAAO,IADO,QAAQ,MAAM,KAAK,IAChB;;AAGlB,MAAM,iCAAiC,OAAO,OAC7C,OAAO,WAAW;AACjB,KAAI;EACH,IAAI,WAA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A,EACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"module-federation.service.mjs","names":["version","pkg.version","Constructor: any"],"sources":["../../../src/runtime/services/module-federation.service.ts"],"sourcesContent":["import {\n\tcreateInstance,\n\tgetInstance,\n} from \"@module-federation/enhanced/runtime\";\nimport { setGlobalFederationInstance } from \"@module-federation/runtime-core\";\nimport { Effect } from \"effect\";\nimport type { AnyPlugin } from \"../../types\";\nimport { ModuleFederationError } from \"../errors\";\nimport { getNormalizedRemoteName } from \"./normalize\";\n\ntype RemoteModule = \n | (new () => AnyPlugin)\n | { default: new () => AnyPlugin };\n\nimport pkg from \"../../../package.json\";\n\nfunction getMajorVersionRange(version: string): string {\n\tconst match = version.match(/^[\\^~]?(\\d+)/);\n\tconst major = match ? match[1] : '0';\n\treturn `^${major}.0.0`;\n}\n\nconst createModuleFederationInstance = Effect.cached(\n\tEffect.sync(() => {\n\t\ttry {\n\t\t\tlet instance = getInstance();\n\n\t\t\tif (!instance) {\n\t\t\t\tinstance = createInstance({\n\t\t\t\t\tname: \"host\",\n\t\t\t\t\tremotes: [],\n\t\t\t\t\tshared: {\n\t\t\t\t\t\t\"every-plugin\": {\n\t\t\t\t\t\t\tversion: pkg.version,\n\t\t\t\t\t\t\tget: () => import(\"every-plugin\").then(mod => () => mod),\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.version),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\teffect: {\n\t\t\t\t\t\t\tversion: pkg.dependencies.effect,\n\t\t\t\t\t\t\tget: () => import(\"effect\").then(mod => () => mod),\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies.effect),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tzod: {\n\t\t\t\t\t\t\tversion: pkg.dependencies.zod,\n\t\t\t\t\t\t\tget: () => import(\"zod\").then(mod => () => mod),\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies.zod),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"@orpc/contract\": {\n\t\t\t\t\t\t\tversion: pkg.dependencies[\"@orpc/contract\"],\n\t\t\t\t\t\t\tget: () => import(\"@orpc/contract\").then(mod => () => mod),\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies[\"@orpc/contract\"]),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"@orpc/server\": {\n\t\t\t\t\t\t\tversion: pkg.dependencies[\"@orpc/server\"],\n\t\t\t\t\t\t\tget: () => import(\"@orpc/server\").then(mod => () => mod),\n\t\t\t\t\t\t\tshareConfig: {\n\t\t\t\t\t\t\t\tsingleton: true,\n\t\t\t\t\t\t\t\trequiredVersion: getMajorVersionRange(pkg.dependencies[\"@orpc/server\"]),\n\t\t\t\t\t\t\t\teager: false,\n\t\t\t\t\t\t\t\tstrictVersion: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\tsetGlobalFederationInstance(instance);\n\t\t\t}\n\n\t\t\treturn instance;\n\t\t} catch (error) {\n\t\t\tthrow new Error(`Failed to initialize Module Federation: ${error}`);\n\t\t}\n\t}),\n);\n\nexport class ModuleFederationService extends Effect.Service<ModuleFederationService>()(\"ModuleFederationService\", {\n\teffect: Effect.gen(function* () {\n\t\tconst mf = yield* Effect.flatten(createModuleFederationInstance);\n\n\t\treturn {\n\t\t\tregisterRemote: (pluginId: string, url: string) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconsole.log(`[MF] Registering ${pluginId}`);\n\n\t\t\t\t\tconst remoteName = getNormalizedRemoteName(pluginId);\n\n\t\t\t\t\tyield* Effect.try({\n\t\t\t\t\t\ttry: () => mf.registerRemotes([{\n\t\t\t\t\t\t\tname: remoteName,\n\t\t\t\t\t\t\tentry: url,\n\t\t\t\t\t\t}]),\n\t\t\t\t\t\tcatch: (error): ModuleFederationError =>\n\t\t\t\t\t\t\tnew ModuleFederationError({\n\t\t\t\t\t\t\t\tpluginId,\n\t\t\t\t\t\t\t\tremoteUrl: url,\n\t\t\t\t\t\t\t\tcause:\n\t\t\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\n\t\t\t\t\tconsole.log(`[MF] ✅ Registered ${pluginId}`);\n\t\t\t\t}),\n\n\t\t\tloadRemoteConstructor: (pluginId: string, url: string) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst remoteName = getNormalizedRemoteName(pluginId);\n\t\t\t\t\tconsole.log(`[MF] Loading remote ${remoteName}`);\n\t\t\t\t\tconst modulePath = `${remoteName}/plugin`;\n\n\t\t\t\t\treturn yield* Effect.tryPromise({\n\t\t\t\t\t\ttry: async () => {\n\n\t\t\t\t\t\t\tconst container = await mf.loadRemote<RemoteModule>(modulePath);\n\t\t\t\t\t\t\tif (!container) {\n\t\t\t\t\t\t\t\tthrow new Error(`No container returned for ${modulePath}`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Support multiple export patterns: direct function, default export, named exports\n\t\t\t\t\t\t\tlet Constructor: any;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (typeof container === \"function\") {\n\t\t\t\t\t\t\t\t// Direct function export\n\t\t\t\t\t\t\t\tConstructor = container;\n\t\t\t\t\t\t\t} else if (container.default) {\n\t\t\t\t\t\t\t\t// Default export\n\t\t\t\t\t\t\t\tConstructor = container.default;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Named export fallback - prioritize exports with 'binding' property (plugin classes)\n\t\t\t\t\t\t\t\tConstructor = Object.values(container).find(\n\t\t\t\t\t\t\t\t\t(exp) => typeof exp === \"function\" && (exp as any).binding !== undefined\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// Fallback to any function export if no binding found\n\t\t\t\t\t\t\t\tif (!Constructor) {\n\t\t\t\t\t\t\t\t\tConstructor = Object.values(container).find(\n\t\t\t\t\t\t\t\t\t\t(exp) => typeof exp === \"function\" && exp.prototype?.constructor === exp\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (!Constructor || typeof Constructor !== \"function\") {\n\t\t\t\t\t\t\t\tconst containerInfo = typeof container === \"object\"\n\t\t\t\t\t\t\t\t\t? `Available exports: ${Object.keys(container).join(', ')}`\n\t\t\t\t\t\t\t\t\t: `Container type: ${typeof container}`;\n\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t`No valid plugin constructor found for '${pluginId}'.\\n` +\n\t\t\t\t\t\t\t\t\t`Supported patterns:\\n` +\n\t\t\t\t\t\t\t\t\t` - export const YourPlugin = createPlugin({...})\\n` +\n\t\t\t\t\t\t\t\t\t` - export default createPlugin({...})\\n` +\n\t\t\t\t\t\t\t\t\t`${containerInfo}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Validate it looks like a plugin constructor (has binding property)\n\t\t\t\t\t\t\tif (!(Constructor as any).binding) {\n\t\t\t\t\t\t\t\tconst containerInfo = typeof container === \"object\"\n\t\t\t\t\t\t\t\t\t? `Found exports: ${Object.keys(container).join(', ')}`\n\t\t\t\t\t\t\t\t\t: `Container type: ${typeof container}`;\n\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t`Invalid plugin constructor for '${pluginId}'. ` +\n\t\t\t\t\t\t\t\t\t`The exported value must be created with createPlugin(). ` +\n\t\t\t\t\t\t\t\t\t`Found a function but it's missing the required 'binding' property.\\n` +\n\t\t\t\t\t\t\t\t\t`${containerInfo}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconsole.log(`[MF] ✅ Loaded constructor for ${pluginId}`);\n\t\t\t\t\t\t\treturn Constructor;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcatch: (error): ModuleFederationError =>\n\t\t\t\t\t\t\tnew ModuleFederationError({\n\t\t\t\t\t\t\t\tpluginId,\n\t\t\t\t\t\t\t\tremoteUrl: url,\n\t\t\t\t\t\t\t\tcause:\n\t\t\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t};\n\t}),\n}) {}\n"],"mappings":";;;;;;;;AAgBA,SAAS,qBAAqB,WAAyB;CACtD,MAAM,QAAQA,UAAQ,MAAM,eAAe;AAE3C,QAAO,IADO,QAAQ,MAAM,KAAK,IAChB;;AAGlB,MAAM,iCAAiC,OAAO,OAC7C,OAAO,WAAW;AACjB,KAAI;EACH,IAAI,WAAW,aAAa;AAE5B,MAAI,CAAC,UAAU;AACd,cAAW,eAAe;IACzB,MAAM;IACN,SAAS,EAAE;IACX,QAAQ;KACP,gBAAgB;MACNC;MACT,WAAW,OAAO,mBAAgB,MAAK,cAAa,IAAI;MACxD,aAAa;OACZ,WAAW;OACX,iBAAiB,qBAAqBA,QAAY;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;IACD;EACH;EACA,EACF,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AnyPlugin, InitializedPlugin } from "../../types.cjs";
|
|
2
1
|
import { PluginRuntimeError } from "../errors.cjs";
|
|
2
|
+
import { AnyPlugin, InitializedPlugin } from "../../types.cjs";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
|
|
5
5
|
//#region src/runtime/services/plugin-lifecycle.service.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AnyPlugin, InitializedPlugin } from "../../types.mjs";
|
|
2
1
|
import { PluginRuntimeError } from "../errors.mjs";
|
|
2
|
+
import { AnyPlugin, InitializedPlugin } from "../../types.mjs";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
|
|
5
5
|
//#region src/runtime/services/plugin-lifecycle.service.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AnyPlugin, AnyPluginConstructor, LoadedPlugin, PluginInstance, PluginMetadata, PluginRegistry } from "../../types.cjs";
|
|
2
1
|
import { PluginRuntimeError } from "../errors.cjs";
|
|
2
|
+
import { AnyPlugin, AnyPluginConstructor, LoadedPlugin, PluginInstance, PluginMetadata, PluginRegistry } from "../../types.cjs";
|
|
3
3
|
import { ModuleFederationService } from "./module-federation.service.cjs";
|
|
4
4
|
import { SecretsService } from "./secrets.service.cjs";
|
|
5
5
|
import { Context, Effect, Scope } from "effect";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AnyPlugin, AnyPluginConstructor, LoadedPlugin, PluginInstance, PluginMetadata, PluginRegistry } from "../../types.mjs";
|
|
2
1
|
import { PluginRuntimeError } from "../errors.mjs";
|
|
2
|
+
import { AnyPlugin, AnyPluginConstructor, LoadedPlugin, PluginInstance, PluginMetadata, PluginRegistry } from "../../types.mjs";
|
|
3
3
|
import { ModuleFederationService } from "./module-federation.service.mjs";
|
|
4
4
|
import { SecretsService } from "./secrets.service.mjs";
|
|
5
|
-
import { Context, Effect, Scope } from "effect";
|
|
6
5
|
import { InferSchemaInput, InferSchemaOutput } from "@orpc/contract";
|
|
6
|
+
import { Context, Effect, Scope } from "effect";
|
|
7
7
|
|
|
8
8
|
//#region src/runtime/services/plugin-loader.service.d.ts
|
|
9
9
|
declare const PluginRegistryTag_base: Context.TagClass<PluginRegistryTag, "PluginRegistry", PluginRegistry>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AnyPlugin, AnyPluginConstructor, InitializedPlugin, LoadedPlugin, PluginInstance, PluginMetadata, PluginRegistry, SecretsConfig } from "../../types.cjs";
|
|
2
1
|
import { PluginRuntimeError } from "../errors.cjs";
|
|
2
|
+
import { AnyPlugin, AnyPluginConstructor, InitializedPlugin, LoadedPlugin, PluginInstance, PluginMetadata, PluginRegistry, SecretsConfig } from "../../types.cjs";
|
|
3
3
|
import { PluginLifecycleService } from "./plugin-lifecycle.service.cjs";
|
|
4
4
|
import { PluginLoaderService } from "./plugin-loader.service.cjs";
|
|
5
5
|
import "../../index.cjs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AnyPlugin, AnyPluginConstructor, InitializedPlugin, LoadedPlugin, PluginInstance, PluginMetadata, PluginRegistry, SecretsConfig } from "../../types.mjs";
|
|
2
1
|
import { PluginRuntimeError } from "../errors.mjs";
|
|
2
|
+
import { AnyPlugin, AnyPluginConstructor, InitializedPlugin, LoadedPlugin, PluginInstance, PluginMetadata, PluginRegistry, SecretsConfig } from "../../types.mjs";
|
|
3
3
|
import { PluginLifecycleService } from "./plugin-lifecycle.service.mjs";
|
|
4
4
|
import { PluginLoaderService } from "./plugin-loader.service.mjs";
|
|
5
5
|
import "../../index.mjs";
|
|
6
|
-
import { Effect, Layer, Scope } from "effect";
|
|
7
6
|
import * as _orpc_contract0 from "@orpc/contract";
|
|
7
|
+
import { Effect, Layer, Scope } from "effect";
|
|
8
8
|
|
|
9
9
|
//#region src/runtime/services/plugin.service.d.ts
|
|
10
10
|
declare const PluginService_base: Effect.Service.Class<PluginService, "PluginService", {
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Plugin } from "./plugin.mjs";
|
|
2
|
-
import { Router, RouterClient } from "@orpc/server";
|
|
3
|
-
import { Scope } from "effect";
|
|
4
2
|
import { AnyContractRouter, AnySchema, InferSchemaInput, InferSchemaOutput } from "@orpc/contract";
|
|
3
|
+
import { Scope } from "effect";
|
|
4
|
+
import { Router, RouterClient } from "@orpc/server";
|
|
5
5
|
|
|
6
6
|
//#region src/types.d.ts
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "every-plugin",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -111,33 +111,37 @@
|
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
113
|
"@rspack/core": "1.6.7",
|
|
114
|
-
"typescript": "^5.
|
|
114
|
+
"typescript": "^5.9.3",
|
|
115
|
+
"effect": "^3.19.0",
|
|
116
|
+
"zod": "^4.0.0",
|
|
117
|
+
"@orpc/contract": "^1.12.0",
|
|
118
|
+
"@orpc/server": "^1.12.0"
|
|
115
119
|
},
|
|
116
120
|
"devDependencies": {
|
|
117
|
-
"@effect/language-service": "^0.62.
|
|
121
|
+
"@effect/language-service": "^0.62.3",
|
|
118
122
|
"@effect/vitest": "^0.27.0",
|
|
119
|
-
"@orpc/client": "^1.12.
|
|
120
|
-
"@orpc/openapi": "^1.12.
|
|
123
|
+
"@orpc/client": "^1.12.3",
|
|
124
|
+
"@orpc/openapi": "^1.12.3",
|
|
121
125
|
"@rspack/cli": "^1.6.7",
|
|
122
126
|
"@types/bun": "^1.3.4",
|
|
123
|
-
"@types/node": "^25.0.
|
|
124
|
-
"@vitest/ui": "4.0.
|
|
127
|
+
"@types/node": "^25.0.2",
|
|
128
|
+
"@vitest/ui": "4.0.16",
|
|
125
129
|
"bun-types": "^1.3.4",
|
|
126
130
|
"sirv": "^3.0.2",
|
|
127
|
-
"tsdown": "^0.
|
|
128
|
-
"vite-tsconfig-paths": "^
|
|
129
|
-
"vitest": "^4.0.
|
|
131
|
+
"tsdown": "^0.18.0",
|
|
132
|
+
"vite-tsconfig-paths": "^6.0.1",
|
|
133
|
+
"vitest": "^4.0.16"
|
|
130
134
|
},
|
|
131
135
|
"dependencies": {
|
|
132
136
|
"@module-federation/enhanced": "^0.21.6",
|
|
133
137
|
"@module-federation/node": "^2.7.25",
|
|
134
138
|
"@module-federation/runtime-core": "^0.21.6",
|
|
135
|
-
"@orpc/contract": "^1.12.
|
|
136
|
-
"@orpc/experimental-publisher": "^1.12.
|
|
137
|
-
"@orpc/server": "^1.12.
|
|
138
|
-
"@orpc/zod": "^1.12.
|
|
139
|
-
"effect": "3.19.
|
|
140
|
-
"zod": "4.1
|
|
139
|
+
"@orpc/contract": "^1.12.3",
|
|
140
|
+
"@orpc/experimental-publisher": "^1.12.3",
|
|
141
|
+
"@orpc/server": "^1.12.3",
|
|
142
|
+
"@orpc/zod": "^1.12.3",
|
|
143
|
+
"effect": "3.19.12",
|
|
144
|
+
"zod": "4.2.1"
|
|
141
145
|
},
|
|
142
146
|
"keywords": [
|
|
143
147
|
"plugin",
|