every-plugin 0.9.0 → 2.2.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.
Files changed (179) hide show
  1. package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +15 -1
  2. package/dist/_virtual/{rolldown_runtime.mjs → _rolldown/runtime.mjs} +15 -2
  3. package/dist/build/rspack/dev-server-middleware.cjs +15 -4
  4. package/dist/build/rspack/dev-server-middleware.cjs.map +1 -1
  5. package/dist/build/rspack/dev-server-middleware.mjs +15 -4
  6. package/dist/build/rspack/dev-server-middleware.mjs.map +1 -1
  7. package/dist/build/rspack/fix-mf-data-uri-plugin.cjs +44 -0
  8. package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -0
  9. package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts +11 -0
  10. package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts.map +1 -0
  11. package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts +11 -0
  12. package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts.map +1 -0
  13. package/dist/build/rspack/fix-mf-data-uri-plugin.mjs +43 -0
  14. package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -0
  15. package/dist/build/rspack/index.cjs +8 -4
  16. package/dist/build/rspack/index.d.cts +3 -2
  17. package/dist/build/rspack/index.d.mts +3 -2
  18. package/dist/build/rspack/index.mjs +3 -2
  19. package/dist/build/rspack/module-federation.cjs +3 -3
  20. package/dist/build/rspack/module-federation.cjs.map +1 -1
  21. package/dist/build/rspack/module-federation.mjs +1 -1
  22. package/dist/build/rspack/module-federation.mjs.map +1 -1
  23. package/dist/build/rspack/plugin.cjs +83 -5
  24. package/dist/build/rspack/plugin.cjs.map +1 -1
  25. package/dist/build/rspack/plugin.d.cts +12 -1
  26. package/dist/build/rspack/plugin.d.cts.map +1 -1
  27. package/dist/build/rspack/plugin.d.mts +12 -1
  28. package/dist/build/rspack/plugin.d.mts.map +1 -1
  29. package/dist/build/rspack/plugin.mjs +80 -5
  30. package/dist/build/rspack/plugin.mjs.map +1 -1
  31. package/dist/build/rspack/utils.cjs +5 -4
  32. package/dist/build/rspack/utils.cjs.map +1 -1
  33. package/dist/build/rspack/utils.mjs +3 -2
  34. package/dist/build/rspack/utils.mjs.map +1 -1
  35. package/dist/build/shared-deps.cjs +50 -42
  36. package/dist/build/shared-deps.cjs.map +1 -1
  37. package/dist/build/shared-deps.d.cts +27 -2
  38. package/dist/build/shared-deps.d.cts.map +1 -1
  39. package/dist/build/shared-deps.d.mts +27 -2
  40. package/dist/build/shared-deps.d.mts.map +1 -1
  41. package/dist/build/shared-deps.mjs +48 -43
  42. package/dist/build/shared-deps.mjs.map +1 -1
  43. package/dist/errors.cjs +1 -0
  44. package/dist/errors.cjs.map +1 -1
  45. package/dist/errors.d.cts.map +1 -1
  46. package/dist/errors.d.mts.map +1 -1
  47. package/dist/errors.mjs.map +1 -1
  48. package/dist/index.cjs +2 -0
  49. package/dist/index.d.cts +2 -2
  50. package/dist/index.d.mts +2 -2
  51. package/dist/index.mjs +2 -2
  52. package/dist/orpc-client.cjs +17 -0
  53. package/dist/orpc-client.d.cts +2 -0
  54. package/dist/orpc-client.d.mts +2 -0
  55. package/dist/orpc-client.mjs +5 -0
  56. package/dist/orpc-openapi.cjs +17 -0
  57. package/dist/orpc-openapi.d.cts +2 -0
  58. package/dist/orpc-openapi.d.mts +2 -0
  59. package/dist/orpc-openapi.mjs +5 -0
  60. package/dist/orpc.cjs +8 -7
  61. package/dist/plugin.cjs +9 -7
  62. package/dist/plugin.cjs.map +1 -1
  63. package/dist/plugin.d.cts +23 -24
  64. package/dist/plugin.d.cts.map +1 -1
  65. package/dist/plugin.d.mts +23 -24
  66. package/dist/plugin.d.mts.map +1 -1
  67. package/dist/plugin.mjs +8 -7
  68. package/dist/plugin.mjs.map +1 -1
  69. package/dist/runtime/errors.cjs +2 -2
  70. package/dist/runtime/errors.cjs.map +1 -1
  71. package/dist/runtime/errors.d.cts +4 -4
  72. package/dist/runtime/errors.d.cts.map +1 -1
  73. package/dist/runtime/errors.d.mts +4 -4
  74. package/dist/runtime/errors.d.mts.map +1 -1
  75. package/dist/runtime/errors.mjs +1 -1
  76. package/dist/runtime/errors.mjs.map +1 -1
  77. package/dist/runtime/index.cjs +41 -37
  78. package/dist/runtime/index.cjs.map +1 -1
  79. package/dist/runtime/index.d.cts +3 -3
  80. package/dist/runtime/index.d.cts.map +1 -1
  81. package/dist/runtime/index.d.mts +3 -3
  82. package/dist/runtime/index.d.mts.map +1 -1
  83. package/dist/runtime/index.mjs +12 -9
  84. package/dist/runtime/index.mjs.map +1 -1
  85. package/dist/runtime/mf-config.cjs +33 -0
  86. package/dist/runtime/mf-config.cjs.map +1 -0
  87. package/dist/runtime/mf-config.d.cts +41 -0
  88. package/dist/runtime/mf-config.d.cts.map +1 -0
  89. package/dist/runtime/mf-config.d.mts +41 -0
  90. package/dist/runtime/mf-config.d.mts.map +1 -0
  91. package/dist/runtime/mf-config.mjs +29 -0
  92. package/dist/runtime/mf-config.mjs.map +1 -0
  93. package/dist/runtime/services/module-federation.service.cjs +19 -56
  94. package/dist/runtime/services/module-federation.service.cjs.map +1 -1
  95. package/dist/runtime/services/module-federation.service.d.cts.map +1 -1
  96. package/dist/runtime/services/module-federation.service.d.mts.map +1 -1
  97. package/dist/runtime/services/module-federation.service.mjs +18 -55
  98. package/dist/runtime/services/module-federation.service.mjs.map +1 -1
  99. package/dist/runtime/services/normalize.cjs +3 -2
  100. package/dist/runtime/services/normalize.cjs.map +1 -1
  101. package/dist/runtime/services/normalize.mjs +2 -2
  102. package/dist/runtime/services/normalize.mjs.map +1 -1
  103. package/dist/runtime/services/plugin-lifecycle.service.cjs +1 -1
  104. package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -1
  105. package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +1 -1
  106. package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +1 -1
  107. package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -1
  108. package/dist/runtime/services/plugin-loader.service.cjs +3 -3
  109. package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
  110. package/dist/runtime/services/plugin-loader.service.d.cts +1 -1
  111. package/dist/runtime/services/plugin-loader.service.d.cts.map +1 -1
  112. package/dist/runtime/services/plugin-loader.service.d.mts +1 -1
  113. package/dist/runtime/services/plugin-loader.service.d.mts.map +1 -1
  114. package/dist/runtime/services/plugin-loader.service.mjs +2 -2
  115. package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
  116. package/dist/runtime/services/plugin.service.cjs +1 -1
  117. package/dist/runtime/services/plugin.service.cjs.map +1 -1
  118. package/dist/runtime/services/plugin.service.d.cts +6 -7
  119. package/dist/runtime/services/plugin.service.d.cts.map +1 -1
  120. package/dist/runtime/services/plugin.service.d.mts +6 -7
  121. package/dist/runtime/services/plugin.service.d.mts.map +1 -1
  122. package/dist/runtime/services/plugin.service.mjs.map +1 -1
  123. package/dist/runtime/services/secrets.service.cjs +1 -1
  124. package/dist/runtime/services/secrets.service.cjs.map +1 -1
  125. package/dist/runtime/services/secrets.service.d.cts.map +1 -1
  126. package/dist/runtime/services/secrets.service.d.mts.map +1 -1
  127. package/dist/runtime/services/secrets.service.mjs.map +1 -1
  128. package/dist/runtime/validation.cjs +1 -1
  129. package/dist/runtime/validation.cjs.map +1 -1
  130. package/dist/runtime/validation.mjs.map +1 -1
  131. package/dist/testing/index.cjs +2 -1
  132. package/dist/testing/index.cjs.map +1 -1
  133. package/dist/testing/index.d.cts +0 -2
  134. package/dist/testing/index.d.cts.map +1 -1
  135. package/dist/testing/index.d.mts +0 -2
  136. package/dist/testing/index.d.mts.map +1 -1
  137. package/dist/testing/index.mjs +1 -1
  138. package/dist/testing/index.mjs.map +1 -1
  139. package/dist/types.d.cts +6 -6
  140. package/dist/types.d.cts.map +1 -1
  141. package/dist/types.d.mts +6 -6
  142. package/dist/types.d.mts.map +1 -1
  143. package/dist/zod.cjs +4 -3
  144. package/dist/zod.mjs +2 -2
  145. package/package.json +204 -182
  146. package/src/build/rspack/dev-server-middleware.ts +233 -0
  147. package/src/build/rspack/fix-mf-data-uri-plugin.ts +49 -0
  148. package/src/build/rspack/index.ts +14 -0
  149. package/src/build/rspack/module-federation.ts +6 -0
  150. package/src/build/rspack/plugin.ts +252 -0
  151. package/src/build/rspack/utils.ts +60 -0
  152. package/src/build/shared-deps.ts +79 -0
  153. package/src/effect.ts +1 -0
  154. package/src/errors.ts +140 -0
  155. package/src/index.ts +26 -0
  156. package/src/orpc-client.ts +2 -0
  157. package/src/orpc-openapi.ts +2 -0
  158. package/src/orpc.ts +9 -0
  159. package/src/plugin.ts +220 -0
  160. package/src/runtime/errors.ts +332 -0
  161. package/src/runtime/index.ts +258 -0
  162. package/src/runtime/mf-config.ts +29 -0
  163. package/src/runtime/services/module-federation.service.ts +181 -0
  164. package/src/runtime/services/normalize.ts +18 -0
  165. package/src/runtime/services/plugin-lifecycle.service.ts +86 -0
  166. package/src/runtime/services/plugin-loader.service.ts +254 -0
  167. package/src/runtime/services/plugin.service.ts +66 -0
  168. package/src/runtime/services/secrets.service.ts +74 -0
  169. package/src/runtime/services.ts +5 -0
  170. package/src/runtime/validation.ts +23 -0
  171. package/src/testing/index.ts +87 -0
  172. package/src/testing/mocks/module-federation.service.ts +41 -0
  173. package/src/types.ts +309 -0
  174. package/src/zod-core.ts +4 -0
  175. package/src/zod.ts +1 -0
  176. package/dist/package.cjs +0 -45
  177. package/dist/package.cjs.map +0 -1
  178. package/dist/package.mjs +0 -27
  179. package/dist/package.mjs.map +0 -1
@@ -1,10 +1,23 @@
1
- //#region rolldown:runtime
1
+ //#region \0rolldown/runtime.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __exportAll = (all, no_symbols) => {
9
+ let target = {};
10
+ for (var name in all) {
11
+ __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ }
16
+ if (!no_symbols) {
17
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ }
19
+ return target;
20
+ };
8
21
  var __copyProps = (to, from, except, desc) => {
9
22
  if (from && typeof from === "object" || typeof from === "function") {
10
23
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -27,5 +40,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
40
 
28
41
  //#endregion
29
42
 
43
+ exports.__exportAll = __exportAll;
30
44
  exports.__reExport = __reExport;
31
45
  exports.__toESM = __toESM;
@@ -1,10 +1,23 @@
1
1
  import { createRequire } from "node:module";
2
2
 
3
- //#region rolldown:runtime
3
+ //#region \0rolldown/runtime.js
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __exportAll = (all, no_symbols) => {
9
+ let target = {};
10
+ for (var name in all) {
11
+ __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ }
16
+ if (!no_symbols) {
17
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ }
19
+ return target;
20
+ };
8
21
  var __copyProps = (to, from, except, desc) => {
9
22
  if (from && typeof from === "object" || typeof from === "function") {
10
23
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -23,4 +36,4 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
23
36
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
24
37
 
25
38
  //#endregion
26
- export { __reExport, __require };
39
+ export { __exportAll, __reExport, __require };
@@ -17,7 +17,7 @@ const normalizePrefix = (prefix) => {
17
17
  };
18
18
  function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
19
19
  const rpcPrefix = normalizePrefix(devConfig?.prefix);
20
- let handlers = {
20
+ const handlers = {
21
21
  rpc: null,
22
22
  api: null
23
23
  };
@@ -40,7 +40,10 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
40
40
  const { formatORPCError } = await Promise.resolve().then(() => require("../../errors.cjs"));
41
41
  const pluginId = devConfig?.pluginId || pluginInfo.normalizedName;
42
42
  const runtime = createPluginRuntime({ registry: { [pluginId]: { remote: `http://localhost:${port}/remoteEntry.js` } } });
43
- const loaded = await runtime.usePlugin(pluginId, devConfig?.config);
43
+ const loaded = await runtime.usePlugin(pluginId, devConfig?.config ?? {
44
+ variables: {},
45
+ secrets: {}
46
+ });
44
47
  cleanup = async () => {
45
48
  if (loaded && typeof loaded.dispose === "function") await loaded.dispose();
46
49
  if (runtime && typeof runtime.cleanup === "function") await runtime.cleanup();
@@ -74,16 +77,20 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
74
77
  }
75
78
  })();
76
79
  process.once("SIGINT", async () => {
80
+ const timeout = setTimeout(() => process.exit(0), 3e3);
77
81
  await performCleanup();
82
+ clearTimeout(timeout);
78
83
  });
79
84
  process.once("SIGTERM", async () => {
85
+ const timeout = setTimeout(() => process.exit(0), 3e3);
80
86
  await performCleanup();
87
+ clearTimeout(timeout);
81
88
  });
82
- devServer.app.options("*", (req, res) => {
89
+ devServer.app.options("*", (_req, res) => {
83
90
  applyCorsHeaders(res);
84
91
  res.status(200).end();
85
92
  });
86
- devServer.app.get("/", (req, res) => {
93
+ devServer.app.get("/", (_req, res) => {
87
94
  applyCorsHeaders(res);
88
95
  res.json({
89
96
  ok: true,
@@ -97,6 +104,10 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
97
104
  }
98
105
  });
99
106
  });
107
+ devServer.app.get("/health", (_req, res) => {
108
+ applyCorsHeaders(res);
109
+ res.status(200).send("OK");
110
+ });
100
111
  const handleApiRequest = async (req, res) => {
101
112
  applyCorsHeaders(res);
102
113
  const apiHandler = devServer.app.locals.handlers?.api;
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server-middleware.cjs","names":[],"sources":["../../../src/build/rspack/dev-server-middleware.ts"],"sourcesContent":["import type { PluginInfo } from './utils';\n\nconst corsHeaders = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',\n 'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'\n};\n\nconst applyCorsHeaders = (res: any) => {\n Object.entries(corsHeaders).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n};\n\nconst normalizePrefix = (prefix?: string): string => {\n if (!prefix) return '';\n const cleaned = prefix.replace(/^\\/+|\\/+$/g, '');\n return cleaned ? `/${cleaned}` : '';\n};\n\nexport function setupPluginMiddleware(devServer: any, pluginInfo: PluginInfo, devConfig: any, port: number) {\n const rpcPrefix = normalizePrefix(devConfig?.prefix);\n let handlers: { rpc: any, api: any } = { rpc: null, api: null };\n let cleanup: (() => Promise<void>) | null = null;\n\n const performCleanup = async () => {\n if (cleanup) {\n await cleanup();\n cleanup = null;\n }\n };\n\n (async () => {\n await performCleanup();\n\n try {\n const { createPluginRuntime } = await import('every-plugin');\n const { RPCHandler } = await import('@orpc/server/fetch');\n const { OpenAPIHandler } = await import('@orpc/openapi/fetch');\n const { OpenAPIReferencePlugin } = await import('@orpc/openapi/plugins');\n const { ZodToJsonSchemaConverter } = await import('@orpc/zod/zod4');\n const { onError } = await import('every-plugin/orpc');\n const { formatORPCError } = await import('every-plugin/errors');\n\n\n const pluginId = devConfig?.pluginId || pluginInfo.normalizedName;\n\n const runtime = createPluginRuntime({\n registry: {\n [pluginId]: {\n remote: `http://localhost:${port}/remoteEntry.js`\n }\n }\n });\n\n // @ts-expect-error we don't know the plugin id\n const loaded = await runtime.usePlugin(pluginId, devConfig?.config);\n\n cleanup = async () => {\n if (loaded && typeof (loaded as any).dispose === 'function') {\n await (loaded as any).dispose();\n }\n if (runtime && typeof (runtime as any).cleanup === 'function') {\n await (runtime as any).cleanup();\n }\n handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n };\n\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n formatORPCError(error);\n }),\n ]\n });\n\n handlers.api = new OpenAPIHandler(loaded.router, {\n plugins: [\n new OpenAPIReferencePlugin({\n schemaConverters: [new ZodToJsonSchemaConverter()],\n }),\n ],\n interceptors: [\n onError((error: any) => {\n formatORPCError(error);\n }),\n ]\n });\n\n console.log(`╭─────────────────────────────────────────────`);\n console.log(`│ ✅ Plugin dev server ready: `);\n console.log(`├─────────────────────────────────────────────`);\n console.log(`│ 📡 RPC: http://localhost:${port}/api/rpc${rpcPrefix}`);\n console.log(`│ 📖 Docs: http://localhost:${port}/api`);\n console.log(`│ 💚 Health: http://localhost:${port}/`);\n console.log(`╰─────────────────────────────────────────────`);\n\n devServer.app.locals.handlers = handlers;\n\n if (devServer.server) {\n devServer.server.once('close', async () => {\n await performCleanup();\n });\n }\n } catch (error) {\n console.error('❌ Failed to load plugin:', error);\n await performCleanup();\n }\n })();\n\n process.once('SIGINT', async () => {\n await performCleanup();\n });\n process.once('SIGTERM', async () => {\n await performCleanup();\n });\n\n devServer.app.options('*', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.status(200).end();\n });\n\n devServer.app.get('/', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.json({\n ok: true,\n plugin: pluginInfo.normalizedName,\n version: pluginInfo.version,\n status: devServer.app.locals.handlers?.rpc ? 'ready' : 'loading',\n endpoints: {\n health: '/',\n docs: '/api',\n rpc: `/api/rpc${rpcPrefix}`\n }\n });\n });\n\n // OpenAPI documentation and REST endpoints at /api and /api/*\n const handleApiRequest = async (req: any, res: any) => {\n applyCorsHeaders(res);\n const apiHandler = devServer.app.locals.handlers?.api;\n if (!apiHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await apiHandler.handle(webRequest, {\n prefix: '/api',\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('OpenAPI error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n };\n\n devServer.app.all(`/api/rpc${rpcPrefix}/*`, async (req: any, res: any) => {\n applyCorsHeaders(res);\n const rpcHandler = devServer.app.locals.handlers?.rpc;\n if (!rpcHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await rpcHandler.handle(webRequest, {\n prefix: `/api/rpc${rpcPrefix}`,\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('RPC error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n });\n\n devServer.app.all('/api', handleApiRequest);\n devServer.app.all('/api/*', handleApiRequest);\n}\n"],"mappings":";;AAEA,MAAM,cAAc;CAClB,+BAA+B;CAC/B,gCAAgC;CAChC,gCAAgC;CACjC;AAED,MAAM,oBAAoB,Q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,IAAI,WAAW,SAAS,MAAM;IAC5D,QAAQ,IAAI,WAAW,SAAS,IAAI,WAAW,SAAS,SAAS;IAClE,CAAgB;GAEjB,MAAM,SAAS,MAAM,WAAW,OAAO,YAAY;IACjD,QAAQ,WAAW;IACnB,SAAS,EAAE;IACZ,CAAC;AAEF,OAAI,OAAO,UAAU;AACnB,QAAI,OAAO,OAAO,SAAS,OAAO;AAClC,WAAO,SAAS,QAAQ,SAAS,OAAe,QAAgB;AAC9D,SAAI,UAAU,KAAK,MAAM;MACzB;IACF,MAAM,OAAO,MAAM,OAAO,SAAS,MAAM;AACzC,QAAI,KAAK,KAAK;SAEd,KAAI,OAAO,IAAI,CAAC,KAAK,YAAY;WAE5B,OAAO;AACd,WAAQ,MAAM,cAAc,MAAM;AAClC,OAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAQ,MAAgB,SAAS,CAAC;;GAE3D;AAEF,WAAU,IAAI,IAAI,QAAQ,iBAAiB;AAC3C,WAAU,IAAI,IAAI,UAAU,iBAAiB"}
1
+ {"version":3,"file":"dev-server-middleware.cjs","names":[],"sources":["../../../src/build/rspack/dev-server-middleware.ts"],"sourcesContent":["import type { PluginInfo } from \"./utils\";\n\nconst corsHeaders = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, POST, PUT, DELETE, PATCH, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"X-Requested-With, content-type, Authorization\",\n};\n\nconst applyCorsHeaders = (res: any) => {\n Object.entries(corsHeaders).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n};\n\nconst normalizePrefix = (prefix?: string): string => {\n if (!prefix) return \"\";\n const cleaned = prefix.replace(/^\\/+|\\/+$/g, \"\");\n return cleaned ? `/${cleaned}` : \"\";\n};\n\nexport function setupPluginMiddleware(\n devServer: any,\n pluginInfo: PluginInfo,\n devConfig: any,\n port: number,\n) {\n const rpcPrefix = normalizePrefix(devConfig?.prefix);\n const handlers: { rpc: any; api: any } = { rpc: null, api: null };\n let cleanup: (() => Promise<void>) | null = null;\n\n const performCleanup = async () => {\n if (cleanup) {\n await cleanup();\n cleanup = null;\n }\n };\n\n (async () => {\n await performCleanup();\n\n try {\n const { createPluginRuntime } = await import(\"every-plugin\");\n const { RPCHandler } = await import(\"@orpc/server/fetch\");\n const { OpenAPIHandler } = await import(\"@orpc/openapi/fetch\");\n const { OpenAPIReferencePlugin } = await import(\"@orpc/openapi/plugins\");\n const { ZodToJsonSchemaConverter } = await import(\"@orpc/zod/zod4\");\n const { onError } = await import(\"every-plugin/orpc\");\n const { formatORPCError } = await import(\"every-plugin/errors\");\n\n const pluginId = devConfig?.pluginId || pluginInfo.normalizedName;\n\n const runtime = createPluginRuntime({\n registry: {\n [pluginId]: {\n remote: `http://localhost:${port}/remoteEntry.js`,\n },\n },\n });\n\n const defaultConfig = { variables: {}, secrets: {} };\n\n // @ts-expect-error we don't know the plugin id\n const loaded = await runtime.usePlugin(pluginId, (devConfig?.config ?? defaultConfig) as any);\n\n cleanup = async () => {\n if (loaded && typeof (loaded as any).dispose === \"function\") {\n await (loaded as any).dispose();\n }\n if (runtime && typeof (runtime as any).cleanup === \"function\") {\n await (runtime as any).cleanup();\n }\n handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n };\n\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n formatORPCError(error);\n }),\n ],\n });\n\n handlers.api = new OpenAPIHandler(loaded.router, {\n plugins: [\n new OpenAPIReferencePlugin({\n schemaConverters: [new ZodToJsonSchemaConverter()],\n }),\n ],\n interceptors: [\n onError((error: any) => {\n formatORPCError(error);\n }),\n ],\n });\n\n console.log(`╭─────────────────────────────────────────────`);\n console.log(`│ ✅ Plugin dev server ready: `);\n console.log(`├─────────────────────────────────────────────`);\n console.log(`│ 📡 RPC: http://localhost:${port}/api/rpc${rpcPrefix}`);\n console.log(`│ 📖 Docs: http://localhost:${port}/api`);\n console.log(`│ 💚 Health: http://localhost:${port}/`);\n console.log(`╰─────────────────────────────────────────────`);\n\n devServer.app.locals.handlers = handlers;\n\n if (devServer.server) {\n devServer.server.once(\"close\", async () => {\n await performCleanup();\n });\n }\n } catch (error) {\n console.error(\"❌ Failed to load plugin:\", error);\n await performCleanup();\n }\n })();\n\n process.once(\"SIGINT\", async () => {\n const timeout = setTimeout(() => process.exit(0), 3000);\n await performCleanup();\n clearTimeout(timeout);\n });\n process.once(\"SIGTERM\", async () => {\n const timeout = setTimeout(() => process.exit(0), 3000);\n await performCleanup();\n clearTimeout(timeout);\n });\n\n devServer.app.options(\"*\", (_req: any, res: any) => {\n applyCorsHeaders(res);\n res.status(200).end();\n });\n\n devServer.app.get(\"/\", (_req: any, res: any) => {\n applyCorsHeaders(res);\n res.json({\n ok: true,\n plugin: pluginInfo.normalizedName,\n version: pluginInfo.version,\n status: devServer.app.locals.handlers?.rpc ? \"ready\" : \"loading\",\n endpoints: {\n health: \"/\",\n docs: \"/api\",\n rpc: `/api/rpc${rpcPrefix}`,\n },\n });\n });\n\n devServer.app.get(\"/health\", (_req: any, res: any) => {\n applyCorsHeaders(res);\n res.status(200).send(\"OK\");\n });\n\n const handleApiRequest = async (req: any, res: any) => {\n applyCorsHeaders(res);\n const apiHandler = devServer.app.locals.handlers?.api;\n if (!apiHandler) {\n return res.status(503).json({ error: \"Plugin still loading...\" });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== \"GET\" && req.method !== \"HEAD\" ? req : undefined,\n duplex: req.method !== \"GET\" && req.method !== \"HEAD\" ? \"half\" : undefined,\n } as RequestInit);\n\n const result = await apiHandler.handle(webRequest, {\n prefix: \"/api\",\n context: {},\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send(\"Not Found\");\n }\n } catch (error) {\n console.error(\"OpenAPI error:\", error);\n res.status(500).json({ error: (error as Error).message });\n }\n };\n\n devServer.app.all(`/api/rpc${rpcPrefix}/*`, async (req: any, res: any) => {\n applyCorsHeaders(res);\n const rpcHandler = devServer.app.locals.handlers?.rpc;\n if (!rpcHandler) {\n return res.status(503).json({ error: \"Plugin still loading...\" });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== \"GET\" && req.method !== \"HEAD\" ? req : undefined,\n duplex: req.method !== \"GET\" && req.method !== \"HEAD\" ? \"half\" : undefined,\n } as RequestInit);\n\n const result = await rpcHandler.handle(webRequest, {\n prefix: `/api/rpc${rpcPrefix}`,\n context: {},\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send(\"Not Found\");\n }\n } catch (error) {\n console.error(\"RPC error:\", error);\n res.status(500).json({ error: (error as Error).message });\n }\n });\n\n devServer.app.all(\"/api\", handleApiRequest);\n devServer.app.all(\"/api/*\", handleApiRequest);\n}\n"],"mappings":";;AAEA,MAAM,cAAc;CAClB,+BAA+B;CAC/B,gCAAgC;CAChC,gCAAgC;CACjC;AAED,MAAM,oBAAoB,QAAa;AACrC,QAAO,QAAQ,YAAY,CAAC,SAAS,CAAC,KAAK,WAAW;AACpD,MAAI,UAAU,KAAK,MAAM;GACzB;;AAGJ,MAAM,mBAAmB,WAA4B;AACnD,KAAI,CAAC,OAAQ,QAAO;CACpB,MAAM,UAAU,OAAO,QAAQ,cAAc,GAAG;AAChD,QAAO,UAAU,IAAI,YAAY;;AAGnC,SAAgB,sBACd,WACA,YACA,WACA,MACA;CACA,MAAM,YAAY,gBAAgB,WAAW,OAAO;CACpD,MAAM,WAAmC;EAAE,KAAK;EAAM,KAAK;EAAM;CACjE,IAAI,UAAwC;CAE5C,MAAM,i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gB;GAEjB,MAAM,SAAS,MAAM,WAAW,OAAO,YAAY;IACjD,QAAQ,WAAW;IACnB,SAAS,EAAE;IACZ,CAAC;AAEF,OAAI,OAAO,UAAU;AACnB,QAAI,OAAO,OAAO,SAAS,OAAO;AAClC,WAAO,SAAS,QAAQ,SAAS,OAAe,QAAgB;AAC9D,SAAI,UAAU,KAAK,MAAM;MACzB;IACF,MAAM,OAAO,MAAM,OAAO,SAAS,MAAM;AACzC,QAAI,KAAK,KAAK;SAEd,KAAI,OAAO,IAAI,CAAC,KAAK,YAAY;WAE5B,OAAO;AACd,WAAQ,MAAM,cAAc,MAAM;AAClC,OAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAQ,MAAgB,SAAS,CAAC;;GAE3D;AAEF,WAAU,IAAI,IAAI,QAAQ,iBAAiB;AAC3C,WAAU,IAAI,IAAI,UAAU,iBAAiB"}
@@ -16,7 +16,7 @@ const normalizePrefix = (prefix) => {
16
16
  };
17
17
  function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
18
18
  const rpcPrefix = normalizePrefix(devConfig?.prefix);
19
- let handlers = {
19
+ const handlers = {
20
20
  rpc: null,
21
21
  api: null
22
22
  };
@@ -39,7 +39,10 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
39
39
  const { formatORPCError } = await import("../../errors.mjs");
40
40
  const pluginId = devConfig?.pluginId || pluginInfo.normalizedName;
41
41
  const runtime = createPluginRuntime({ registry: { [pluginId]: { remote: `http://localhost:${port}/remoteEntry.js` } } });
42
- const loaded = await runtime.usePlugin(pluginId, devConfig?.config);
42
+ const loaded = await runtime.usePlugin(pluginId, devConfig?.config ?? {
43
+ variables: {},
44
+ secrets: {}
45
+ });
43
46
  cleanup = async () => {
44
47
  if (loaded && typeof loaded.dispose === "function") await loaded.dispose();
45
48
  if (runtime && typeof runtime.cleanup === "function") await runtime.cleanup();
@@ -73,16 +76,20 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
73
76
  }
74
77
  })();
75
78
  process.once("SIGINT", async () => {
79
+ const timeout = setTimeout(() => process.exit(0), 3e3);
76
80
  await performCleanup();
81
+ clearTimeout(timeout);
77
82
  });
78
83
  process.once("SIGTERM", async () => {
84
+ const timeout = setTimeout(() => process.exit(0), 3e3);
79
85
  await performCleanup();
86
+ clearTimeout(timeout);
80
87
  });
81
- devServer.app.options("*", (req, res) => {
88
+ devServer.app.options("*", (_req, res) => {
82
89
  applyCorsHeaders(res);
83
90
  res.status(200).end();
84
91
  });
85
- devServer.app.get("/", (req, res) => {
92
+ devServer.app.get("/", (_req, res) => {
86
93
  applyCorsHeaders(res);
87
94
  res.json({
88
95
  ok: true,
@@ -96,6 +103,10 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
96
103
  }
97
104
  });
98
105
  });
106
+ devServer.app.get("/health", (_req, res) => {
107
+ applyCorsHeaders(res);
108
+ res.status(200).send("OK");
109
+ });
99
110
  const handleApiRequest = async (req, res) => {
100
111
  applyCorsHeaders(res);
101
112
  const apiHandler = devServer.app.locals.handlers?.api;
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server-middleware.mjs","names":[],"sources":["../../../src/build/rspack/dev-server-middleware.ts"],"sourcesContent":["import type { PluginInfo } from './utils';\n\nconst corsHeaders = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',\n 'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'\n};\n\nconst applyCorsHeaders = (res: any) => {\n Object.entries(corsHeaders).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n};\n\nconst normalizePrefix = (prefix?: string): string => {\n if (!prefix) return '';\n const cleaned = prefix.replace(/^\\/+|\\/+$/g, '');\n return cleaned ? `/${cleaned}` : '';\n};\n\nexport function setupPluginMiddleware(devServer: any, pluginInfo: PluginInfo, devConfig: any, port: number) {\n const rpcPrefix = normalizePrefix(devConfig?.prefix);\n let handlers: { rpc: any, api: any } = { rpc: null, api: null };\n let cleanup: (() => Promise<void>) | null = null;\n\n const performCleanup = async () => {\n if (cleanup) {\n await cleanup();\n cleanup = null;\n }\n };\n\n (async () => {\n await performCleanup();\n\n try {\n const { createPluginRuntime } = await import('every-plugin');\n const { RPCHandler } = await import('@orpc/server/fetch');\n const { OpenAPIHandler } = await import('@orpc/openapi/fetch');\n const { OpenAPIReferencePlugin } = await import('@orpc/openapi/plugins');\n const { ZodToJsonSchemaConverter } = await import('@orpc/zod/zod4');\n const { onError } = await import('every-plugin/orpc');\n const { formatORPCError } = await import('every-plugin/errors');\n\n\n const pluginId = devConfig?.pluginId || pluginInfo.normalizedName;\n\n const runtime = createPluginRuntime({\n registry: {\n [pluginId]: {\n remote: `http://localhost:${port}/remoteEntry.js`\n }\n }\n });\n\n // @ts-expect-error we don't know the plugin id\n const loaded = await runtime.usePlugin(pluginId, devConfig?.config);\n\n cleanup = async () => {\n if (loaded && typeof (loaded as any).dispose === 'function') {\n await (loaded as any).dispose();\n }\n if (runtime && typeof (runtime as any).cleanup === 'function') {\n await (runtime as any).cleanup();\n }\n handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n };\n\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n formatORPCError(error);\n }),\n ]\n });\n\n handlers.api = new OpenAPIHandler(loaded.router, {\n plugins: [\n new OpenAPIReferencePlugin({\n schemaConverters: [new ZodToJsonSchemaConverter()],\n }),\n ],\n interceptors: [\n onError((error: any) => {\n formatORPCError(error);\n }),\n ]\n });\n\n console.log(`╭─────────────────────────────────────────────`);\n console.log(`│ ✅ Plugin dev server ready: `);\n console.log(`├─────────────────────────────────────────────`);\n console.log(`│ 📡 RPC: http://localhost:${port}/api/rpc${rpcPrefix}`);\n console.log(`│ 📖 Docs: http://localhost:${port}/api`);\n console.log(`│ 💚 Health: http://localhost:${port}/`);\n console.log(`╰─────────────────────────────────────────────`);\n\n devServer.app.locals.handlers = handlers;\n\n if (devServer.server) {\n devServer.server.once('close', async () => {\n await performCleanup();\n });\n }\n } catch (error) {\n console.error('❌ Failed to load plugin:', error);\n await performCleanup();\n }\n })();\n\n process.once('SIGINT', async () => {\n await performCleanup();\n });\n process.once('SIGTERM', async () => {\n await performCleanup();\n });\n\n devServer.app.options('*', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.status(200).end();\n });\n\n devServer.app.get('/', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.json({\n ok: true,\n plugin: pluginInfo.normalizedName,\n version: pluginInfo.version,\n status: devServer.app.locals.handlers?.rpc ? 'ready' : 'loading',\n endpoints: {\n health: '/',\n docs: '/api',\n rpc: `/api/rpc${rpcPrefix}`\n }\n });\n });\n\n // OpenAPI documentation and REST endpoints at /api and /api/*\n const handleApiRequest = async (req: any, res: any) => {\n applyCorsHeaders(res);\n const apiHandler = devServer.app.locals.handlers?.api;\n if (!apiHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await apiHandler.handle(webRequest, {\n prefix: '/api',\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('OpenAPI error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n };\n\n devServer.app.all(`/api/rpc${rpcPrefix}/*`, async (req: any, res: any) => {\n applyCorsHeaders(res);\n const rpcHandler = devServer.app.locals.handlers?.rpc;\n if (!rpcHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await rpcHandler.handle(webRequest, {\n prefix: `/api/rpc${rpcPrefix}`,\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('RPC error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n });\n\n devServer.app.all('/api', handleApiRequest);\n devServer.app.all('/api/*', handleApiRequest);\n}\n"],"mappings":";AAEA,MAAM,cAAc;CAClB,+BAA+B;CAC/B,gCAAgC;CAChC,gCAAgC;CACjC;AAED,MAAM,oBAAoB,QAAa;AACrC,QAAO,QAAQ,YAAY,CAAC,SAAS,CAAC,KAAK,WAAW;AACpD,MAAI,UAAU,KAAK,MAAM;GACzB;;AAGJ,MAAM,mBAAmB,WAA4B;AACnD,KAAI,CAAC,OAAQ,QAAO;CACpB,MAAM,UAAU,OAAO,QAAQ,cAAc,GAAG;AAChD,QAAO,UAAU,IAAI,YAAY;;AAGnC,SAAgB,sBAAsB,WAAgB,YAAwB,WAAgB,MAAc;CAC1G,MAAM,YAAY,gBAAgB,WAAW,OAAO;CACpD,IAAI,WAAmC;EAAE,KAAK;EAAM,KAAK;EAAM;CAC/D,IAAI,UAAwC;CAE5C,MAAM,iBAAiB,YAAY;AACjC,MAAI,SAAS;AACX,SAAM,SAAS;AACf,aAAU;;;AAId,EAAC,YAAY;AACX,QAAM,gBAAgB;AAEtB,MAAI;GACF,MAAM,EAAE,wBAAwB,MAAM,OAAO;GAC7C,MAAM,EAAE,eAAe,MAAM,OAAO;GACpC,MAAM,EAAE,mBAAmB,MAAM,OAAO;GACxC,MAAM,EAAE,2BAA2B,MAAM,OAAO;GAChD,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-middleware.mjs","names":[],"sources":["../../../src/build/rspack/dev-server-middleware.ts"],"sourcesContent":["import type { PluginInfo } from \"./utils\";\n\nconst corsHeaders = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, POST, PUT, DELETE, PATCH, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"X-Requested-With, content-type, Authorization\",\n};\n\nconst applyCorsHeaders = (res: any) => {\n Object.entries(corsHeaders).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n};\n\nconst normalizePrefix = (prefix?: string): string => {\n if (!prefix) return \"\";\n const cleaned = prefix.replace(/^\\/+|\\/+$/g, \"\");\n return cleaned ? `/${cleaned}` : \"\";\n};\n\nexport function setupPluginMiddleware(\n devServer: any,\n pluginInfo: PluginInfo,\n devConfig: any,\n port: number,\n) {\n const rpcPrefix = normalizePrefix(devConfig?.prefix);\n const handlers: { rpc: any; api: any } = { rpc: null, api: null };\n let cleanup: (() => Promise<void>) | null = null;\n\n const performCleanup = async () => {\n if (cleanup) {\n await cleanup();\n cleanup = null;\n }\n };\n\n (async () => {\n await performCleanup();\n\n try {\n const { createPluginRuntime } = await import(\"every-plugin\");\n const { RPCHandler } = await import(\"@orpc/server/fetch\");\n const { OpenAPIHandler } = await import(\"@orpc/openapi/fetch\");\n const { OpenAPIReferencePlugin } = await import(\"@orpc/openapi/plugins\");\n const { ZodToJsonSchemaConverter } = await import(\"@orpc/zod/zod4\");\n const { onError } = await import(\"every-plugin/orpc\");\n const { formatORPCError } = await import(\"every-plugin/errors\");\n\n const pluginId = devConfig?.pluginId || pluginInfo.normalizedName;\n\n const runtime = createPluginRuntime({\n registry: {\n [pluginId]: {\n remote: `http://localhost:${port}/remoteEntry.js`,\n },\n },\n });\n\n const defaultConfig = { variables: {}, secrets: {} };\n\n // @ts-expect-error we don't know the plugin id\n const loaded = await runtime.usePlugin(pluginId, (devConfig?.config ?? defaultConfig) as any);\n\n cleanup = async () => {\n if (loaded && typeof (loaded as any).dispose === \"function\") {\n await (loaded as any).dispose();\n }\n if (runtime && typeof (runtime as any).cleanup === \"function\") {\n await (runtime as any).cleanup();\n }\n handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n };\n\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n formatORPCError(error);\n }),\n ],\n });\n\n handlers.api = new OpenAPIHandler(loaded.router, {\n plugins: [\n new OpenAPIReferencePlugin({\n schemaConverters: [new ZodToJsonSchemaConverter()],\n }),\n ],\n interceptors: [\n onError((error: any) => {\n formatORPCError(error);\n }),\n ],\n });\n\n console.log(`╭─────────────────────────────────────────────`);\n console.log(`│ ✅ Plugin dev server ready: `);\n console.log(`├─────────────────────────────────────────────`);\n console.log(`│ 📡 RPC: http://localhost:${port}/api/rpc${rpcPrefix}`);\n console.log(`│ 📖 Docs: http://localhost:${port}/api`);\n console.log(`│ 💚 Health: http://localhost:${port}/`);\n console.log(`╰─────────────────────────────────────────────`);\n\n devServer.app.locals.handlers = handlers;\n\n if (devServer.server) {\n devServer.server.once(\"close\", async () => {\n await performCleanup();\n });\n }\n } catch (error) {\n console.error(\"❌ Failed to load plugin:\", error);\n await performCleanup();\n }\n })();\n\n process.once(\"SIGINT\", async () => {\n const timeout = setTimeout(() => process.exit(0), 3000);\n await performCleanup();\n clearTimeout(timeout);\n });\n process.once(\"SIGTERM\", async () => {\n const timeout = setTimeout(() => process.exit(0), 3000);\n await performCleanup();\n clearTimeout(timeout);\n });\n\n devServer.app.options(\"*\", (_req: any, res: any) => {\n applyCorsHeaders(res);\n res.status(200).end();\n });\n\n devServer.app.get(\"/\", (_req: any, res: any) => {\n applyCorsHeaders(res);\n res.json({\n ok: true,\n plugin: pluginInfo.normalizedName,\n version: pluginInfo.version,\n status: devServer.app.locals.handlers?.rpc ? \"ready\" : \"loading\",\n endpoints: {\n health: \"/\",\n docs: \"/api\",\n rpc: `/api/rpc${rpcPrefix}`,\n },\n });\n });\n\n devServer.app.get(\"/health\", (_req: any, res: any) => {\n applyCorsHeaders(res);\n res.status(200).send(\"OK\");\n });\n\n const handleApiRequest = async (req: any, res: any) => {\n applyCorsHeaders(res);\n const apiHandler = devServer.app.locals.handlers?.api;\n if (!apiHandler) {\n return res.status(503).json({ error: \"Plugin still loading...\" });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== \"GET\" && req.method !== \"HEAD\" ? req : undefined,\n duplex: req.method !== \"GET\" && req.method !== \"HEAD\" ? \"half\" : undefined,\n } as RequestInit);\n\n const result = await apiHandler.handle(webRequest, {\n prefix: \"/api\",\n context: {},\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send(\"Not Found\");\n }\n } catch (error) {\n console.error(\"OpenAPI error:\", error);\n res.status(500).json({ error: (error as Error).message });\n }\n };\n\n devServer.app.all(`/api/rpc${rpcPrefix}/*`, async (req: any, res: any) => {\n applyCorsHeaders(res);\n const rpcHandler = devServer.app.locals.handlers?.rpc;\n if (!rpcHandler) {\n return res.status(503).json({ error: \"Plugin still loading...\" });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== \"GET\" && req.method !== \"HEAD\" ? req : undefined,\n duplex: req.method !== \"GET\" && req.method !== \"HEAD\" ? \"half\" : undefined,\n } as RequestInit);\n\n const result = await rpcHandler.handle(webRequest, {\n prefix: `/api/rpc${rpcPrefix}`,\n context: {},\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send(\"Not Found\");\n }\n } catch (error) {\n console.error(\"RPC error:\", error);\n res.status(500).json({ error: (error as Error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";
4
+ var FixMfDataUriPlugin = class {
5
+ name = "FixMfDataUriPlugin";
6
+ apply(compiler) {
7
+ compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {
8
+ normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {
9
+ if (!resolveData?.request) return;
10
+ if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;
11
+ this.reencodeDataUri(resolveData);
12
+ });
13
+ });
14
+ }
15
+ reencodeDataUri(resolveData) {
16
+ const { request } = resolveData;
17
+ const idx = request.indexOf(MF_DATA_URI_MARKER);
18
+ if (idx === -1) return;
19
+ const contentStart = idx + 21;
20
+ const prefix = request.substring(0, contentStart);
21
+ const rawContent = request.substring(contentStart);
22
+ if (isAlreadyEncoded(rawContent)) return;
23
+ const decoded = safeDecode(rawContent);
24
+ resolveData.request = prefix + encodeURIComponent(decoded);
25
+ }
26
+ };
27
+ function isAlreadyEncoded(content) {
28
+ try {
29
+ return decodeURIComponent(content) !== content;
30
+ } catch {
31
+ return false;
32
+ }
33
+ }
34
+ function safeDecode(content) {
35
+ try {
36
+ return decodeURIComponent(content);
37
+ } catch {
38
+ return content.replace(/%(?![0-9A-Fa-f]{2})/g, "%25");
39
+ }
40
+ }
41
+
42
+ //#endregion
43
+ exports.FixMfDataUriPlugin = FixMfDataUriPlugin;
44
+ //# sourceMappingURL=fix-mf-data-uri-plugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-mf-data-uri-plugin.cjs","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"sourcesContent":["import type { Compiler, RspackPluginInstance } from \"@rspack/core\";\n\nconst MF_DATA_URI_MARKER = \"data:text/javascript,\";\n\nexport class FixMfDataUriPlugin implements RspackPluginInstance {\n name = \"FixMfDataUriPlugin\";\n\n apply(compiler: Compiler) {\n compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {\n normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {\n if (!resolveData?.request) return;\n if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;\n this.reencodeDataUri(resolveData);\n });\n });\n }\n\n private reencodeDataUri(resolveData: { request: string }) {\n const { request } = resolveData;\n const idx = request.indexOf(MF_DATA_URI_MARKER);\n if (idx === -1) return;\n\n const contentStart = idx + MF_DATA_URI_MARKER.length;\n const prefix = request.substring(0, contentStart);\n const rawContent = request.substring(contentStart);\n\n if (isAlreadyEncoded(rawContent)) return;\n\n const decoded = safeDecode(rawContent);\n resolveData.request = prefix + encodeURIComponent(decoded);\n }\n}\n\nfunction isAlreadyEncoded(content: string): boolean {\n try {\n const decoded = decodeURIComponent(content);\n return decoded !== content;\n } catch {\n return false;\n }\n}\n\nfunction safeDecode(content: string): string {\n try {\n return decodeURIComponent(content);\n } catch {\n return content.replace(/%(?![0-9A-Fa-f]{2})/g, \"%25\");\n }\n}\n"],"mappings":";;AAEA,MAAM,qBAAqB;AAE3B,IAAa,qBAAb,MAAgE;CAC9D,OAAO;CAEP,MAAM,UAAoB;AACxB,WAAS,MAAM,YAAY,IAAI,KAAK,OAAO,cAAc,EAAE,0BAA0B;AACnF,uBAAoB,MAAM,cAAc,IAAI,KAAK,OAAO,gBAAgB;AACtE,QAAI,CAAC,aAAa,QAAS;AAC3B,QAAI,CAAC,YAAY,QAAQ,SAAS,mBAAmB,CAAE;AACvD,SAAK,gBAAgB,YAAY;KACjC;IACF;;CAGJ,AAAQ,gBAAgB,aAAkC;EACxD,MAAM,EAAE,YAAY;EACpB,MAAM,MAAM,QAAQ,QAAQ,mBAAmB;AAC/C,MAAI,QAAQ,GAAI;EAEhB,MAAM,eAAe,MAAM;EAC3B,MAAM,SAAS,QAAQ,UAAU,GAAG,aAAa;EACjD,MAAM,aAAa,QAAQ,UAAU,aAAa;AAElD,MAAI,iBAAiB,WAAW,CAAE;EAElC,MAAM,UAAU,WAAW,WAAW;AACtC,cAAY,UAAU,SAAS,mBAAmB,QAAQ;;;AAI9D,SAAS,iBAAiB,SAA0B;AAClD,KAAI;AAEF,SADgB,mBAAmB,QAAQ,KACxB;SACb;AACN,SAAO;;;AAIX,SAAS,WAAW,SAAyB;AAC3C,KAAI;AACF,SAAO,mBAAmB,QAAQ;SAC5B;AACN,SAAO,QAAQ,QAAQ,wBAAwB,MAAM"}
@@ -0,0 +1,11 @@
1
+ import { Compiler, RspackPluginInstance } from "@rspack/core";
2
+
3
+ //#region src/build/rspack/fix-mf-data-uri-plugin.d.ts
4
+ declare class FixMfDataUriPlugin implements RspackPluginInstance {
5
+ name: string;
6
+ apply(compiler: Compiler): void;
7
+ private reencodeDataUri;
8
+ }
9
+ //#endregion
10
+ export { FixMfDataUriPlugin };
11
+ //# sourceMappingURL=fix-mf-data-uri-plugin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-mf-data-uri-plugin.d.cts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;;cAIa,kBAAA,YAA8B,oBAAA;EACzC,IAAA;EAEA,KAAA,CAAM,QAAA,EAAU,QAAA;EAAA,QAUR,eAAA;AAAA"}
@@ -0,0 +1,11 @@
1
+ import { Compiler, RspackPluginInstance } from "@rspack/core";
2
+
3
+ //#region src/build/rspack/fix-mf-data-uri-plugin.d.ts
4
+ declare class FixMfDataUriPlugin implements RspackPluginInstance {
5
+ name: string;
6
+ apply(compiler: Compiler): void;
7
+ private reencodeDataUri;
8
+ }
9
+ //#endregion
10
+ export { FixMfDataUriPlugin };
11
+ //# sourceMappingURL=fix-mf-data-uri-plugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-mf-data-uri-plugin.d.mts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;;cAIa,kBAAA,YAA8B,oBAAA;EACzC,IAAA;EAEA,KAAA,CAAM,QAAA,EAAU,QAAA;EAAA,QAUR,eAAA;AAAA"}
@@ -0,0 +1,43 @@
1
+ //#region src/build/rspack/fix-mf-data-uri-plugin.ts
2
+ const MF_DATA_URI_MARKER = "data:text/javascript,";
3
+ var FixMfDataUriPlugin = class {
4
+ name = "FixMfDataUriPlugin";
5
+ apply(compiler) {
6
+ compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {
7
+ normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {
8
+ if (!resolveData?.request) return;
9
+ if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;
10
+ this.reencodeDataUri(resolveData);
11
+ });
12
+ });
13
+ }
14
+ reencodeDataUri(resolveData) {
15
+ const { request } = resolveData;
16
+ const idx = request.indexOf(MF_DATA_URI_MARKER);
17
+ if (idx === -1) return;
18
+ const contentStart = idx + 21;
19
+ const prefix = request.substring(0, contentStart);
20
+ const rawContent = request.substring(contentStart);
21
+ if (isAlreadyEncoded(rawContent)) return;
22
+ const decoded = safeDecode(rawContent);
23
+ resolveData.request = prefix + encodeURIComponent(decoded);
24
+ }
25
+ };
26
+ function isAlreadyEncoded(content) {
27
+ try {
28
+ return decodeURIComponent(content) !== content;
29
+ } catch {
30
+ return false;
31
+ }
32
+ }
33
+ function safeDecode(content) {
34
+ try {
35
+ return decodeURIComponent(content);
36
+ } catch {
37
+ return content.replace(/%(?![0-9A-Fa-f]{2})/g, "%25");
38
+ }
39
+ }
40
+
41
+ //#endregion
42
+ export { FixMfDataUriPlugin };
43
+ //# sourceMappingURL=fix-mf-data-uri-plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-mf-data-uri-plugin.mjs","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"sourcesContent":["import type { Compiler, RspackPluginInstance } from \"@rspack/core\";\n\nconst MF_DATA_URI_MARKER = \"data:text/javascript,\";\n\nexport class FixMfDataUriPlugin implements RspackPluginInstance {\n name = \"FixMfDataUriPlugin\";\n\n apply(compiler: Compiler) {\n compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {\n normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {\n if (!resolveData?.request) return;\n if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;\n this.reencodeDataUri(resolveData);\n });\n });\n }\n\n private reencodeDataUri(resolveData: { request: string }) {\n const { request } = resolveData;\n const idx = request.indexOf(MF_DATA_URI_MARKER);\n if (idx === -1) return;\n\n const contentStart = idx + MF_DATA_URI_MARKER.length;\n const prefix = request.substring(0, contentStart);\n const rawContent = request.substring(contentStart);\n\n if (isAlreadyEncoded(rawContent)) return;\n\n const decoded = safeDecode(rawContent);\n resolveData.request = prefix + encodeURIComponent(decoded);\n }\n}\n\nfunction isAlreadyEncoded(content: string): boolean {\n try {\n const decoded = decodeURIComponent(content);\n return decoded !== content;\n } catch {\n return false;\n }\n}\n\nfunction safeDecode(content: string): string {\n try {\n return decodeURIComponent(content);\n } catch {\n return content.replace(/%(?![0-9A-Fa-f]{2})/g, \"%25\");\n }\n}\n"],"mappings":";AAEA,MAAM,qBAAqB;AAE3B,IAAa,qBAAb,MAAgE;CAC9D,OAAO;CAEP,MAAM,UAAoB;AACxB,WAAS,MAAM,YAAY,IAAI,KAAK,OAAO,cAAc,EAAE,0BAA0B;AACnF,uBAAoB,MAAM,cAAc,IAAI,KAAK,OAAO,gBAAgB;AACtE,QAAI,CAAC,aAAa,QAAS;AAC3B,QAAI,CAAC,YAAY,QAAQ,SAAS,mBAAmB,CAAE;AACvD,SAAK,gBAAgB,YAAY;KACjC;IACF;;CAGJ,AAAQ,gBAAgB,aAAkC;EACxD,MAAM,EAAE,YAAY;EACpB,MAAM,MAAM,QAAQ,QAAQ,mBAAmB;AAC/C,MAAI,QAAQ,GAAI;EAEhB,MAAM,eAAe,MAAM;EAC3B,MAAM,SAAS,QAAQ,UAAU,GAAG,aAAa;EACjD,MAAM,aAAa,QAAQ,UAAU,aAAa;AAElD,MAAI,iBAAiB,WAAW,CAAE;EAElC,MAAM,UAAU,WAAW,WAAW;AACtC,cAAY,UAAU,SAAS,mBAAmB,QAAQ;;;AAI9D,SAAS,iBAAiB,SAA0B;AAClD,KAAI;AAEF,SADgB,mBAAmB,QAAQ,KACxB;SACb;AACN,SAAO;;;AAIX,SAAS,WAAW,SAAyB;AAC3C,KAAI;AACF,SAAO,mBAAmB,QAAQ;SAC5B;AACN,SAAO,QAAQ,QAAQ,wBAAwB,MAAM"}
@@ -1,7 +1,11 @@
1
- const require_shared_deps = require('../shared-deps.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_build_shared_deps = require('../shared-deps.cjs');
3
+ const require_fix_mf_data_uri_plugin = require('./fix-mf-data-uri-plugin.cjs');
2
4
  const require_plugin = require('./plugin.cjs');
3
5
 
6
+ exports.EmitPluginManifest = require_plugin.EmitPluginManifest;
4
7
  exports.EveryPluginDevServer = require_plugin.EveryPluginDevServer;
5
- exports.getMajorMinorVersion = require_shared_deps.getMajorMinorVersion;
6
- exports.getPluginSharedDependencies = require_shared_deps.getPluginSharedDependencies;
7
- exports.getPluginSharedDependenciesVersionRange = require_shared_deps.getPluginSharedDependenciesVersionRange;
8
+ exports.FixMfDataUriPlugin = require_fix_mf_data_uri_plugin.FixMfDataUriPlugin;
9
+ exports.getMajorMinorVersion = require_build_shared_deps.getMajorMinorVersion;
10
+ exports.getPluginSharedDependencies = require_build_shared_deps.getPluginSharedDependencies;
11
+ exports.getPluginSharedDependenciesVersionRange = require_build_shared_deps.getPluginSharedDependenciesVersionRange;
@@ -1,3 +1,4 @@
1
- import { EveryPluginDevServer, EveryPluginOptions } from "./plugin.cjs";
2
1
  import { SharedDependencies, SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange } from "../shared-deps.cjs";
3
- export { EveryPluginDevServer, type EveryPluginOptions, type SharedDependencies, type SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
2
+ import { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin.cjs";
3
+ import { EmitPluginManifest, EveryPluginDevServer, EveryPluginOptions, PluginManifestEmitterOptions } from "./plugin.cjs";
4
+ export { EmitPluginManifest, EveryPluginDevServer, type EveryPluginOptions, FixMfDataUriPlugin, type PluginManifestEmitterOptions, type SharedDependencies, type SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
@@ -1,3 +1,4 @@
1
- import { EveryPluginDevServer, EveryPluginOptions } from "./plugin.mjs";
2
1
  import { SharedDependencies, SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange } from "../shared-deps.mjs";
3
- export { EveryPluginDevServer, type EveryPluginOptions, type SharedDependencies, type SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
2
+ import { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin.mjs";
3
+ import { EmitPluginManifest, EveryPluginDevServer, EveryPluginOptions, PluginManifestEmitterOptions } from "./plugin.mjs";
4
+ export { EmitPluginManifest, EveryPluginDevServer, type EveryPluginOptions, FixMfDataUriPlugin, type PluginManifestEmitterOptions, type SharedDependencies, type SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
@@ -1,4 +1,5 @@
1
1
  import { getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange } from "../shared-deps.mjs";
2
- import { EveryPluginDevServer } from "./plugin.mjs";
2
+ import { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin.mjs";
3
+ import { EmitPluginManifest, EveryPluginDevServer } from "./plugin.mjs";
3
4
 
4
- export { EveryPluginDevServer, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
5
+ export { EmitPluginManifest, EveryPluginDevServer, FixMfDataUriPlugin, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
@@ -1,8 +1,8 @@
1
- const require_shared_deps = require('../shared-deps.cjs');
1
+ const require_build_shared_deps = require('../shared-deps.cjs');
2
2
 
3
3
  //#region src/build/rspack/module-federation.ts
4
- function buildSharedDependencies(pluginInfo) {
5
- return require_shared_deps.getPluginSharedDependencies();
4
+ function buildSharedDependencies(_pluginInfo) {
5
+ return require_build_shared_deps.getPluginSharedDependencies();
6
6
  }
7
7
 
8
8
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"module-federation.cjs","names":["getPluginSharedDependencies"],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import type { PluginInfo } from './utils';\nimport { getPluginSharedDependencies } from '../shared-deps';\n\nexport function buildSharedDependencies(pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,YAAwB;AAC9D,QAAOA,iDAA6B"}
1
+ {"version":3,"file":"module-federation.cjs","names":["getPluginSharedDependencies"],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../shared-deps\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;AAC/D,QAAOA,uDAA6B"}
@@ -1,7 +1,7 @@
1
1
  import { getPluginSharedDependencies } from "../shared-deps.mjs";
2
2
 
3
3
  //#region src/build/rspack/module-federation.ts
4
- function buildSharedDependencies(pluginInfo) {
4
+ function buildSharedDependencies(_pluginInfo) {
5
5
  return getPluginSharedDependencies();
6
6
  }
7
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"module-federation.mjs","names":[],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import type { PluginInfo } from './utils';\nimport { getPluginSharedDependencies } from '../shared-deps';\n\nexport function buildSharedDependencies(pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,YAAwB;AAC9D,QAAO,6BAA6B"}
1
+ {"version":3,"file":"module-federation.mjs","names":[],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../shared-deps\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;AAC/D,QAAO,6BAA6B"}