every-plugin 2.5.10 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +0 -16
  2. package/dist/_virtual/_rolldown/runtime.mjs +1 -33
  3. package/dist/build/rspack/dev-server-middleware.cjs.map +1 -1
  4. package/dist/build/rspack/dev-server-middleware.mjs.map +1 -1
  5. package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -1
  6. package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -1
  7. package/dist/build/rspack/plugin.cjs.map +1 -1
  8. package/dist/build/rspack/plugin.mjs.map +1 -1
  9. package/dist/build/shared-deps.cjs +14 -3
  10. package/dist/build/shared-deps.cjs.map +1 -1
  11. package/dist/build/shared-deps.d.cts +14 -0
  12. package/dist/build/shared-deps.d.cts.map +1 -1
  13. package/dist/build/shared-deps.d.mts +14 -0
  14. package/dist/build/shared-deps.d.mts.map +1 -1
  15. package/dist/build/shared-deps.mjs +14 -3
  16. package/dist/build/shared-deps.mjs.map +1 -1
  17. package/dist/errors.cjs +37 -35
  18. package/dist/errors.cjs.map +1 -1
  19. package/dist/errors.d.cts +130 -130
  20. package/dist/errors.d.mts +130 -130
  21. package/dist/errors.mjs +35 -35
  22. package/dist/errors.mjs.map +1 -1
  23. package/dist/package.cjs +23 -0
  24. package/dist/package.cjs.map +1 -0
  25. package/dist/package.mjs +17 -0
  26. package/dist/package.mjs.map +1 -0
  27. package/dist/plugin.cjs.map +1 -1
  28. package/dist/plugin.mjs.map +1 -1
  29. package/dist/runtime/errors.cjs.map +1 -1
  30. package/dist/runtime/errors.mjs.map +1 -1
  31. package/dist/runtime/index.cjs.map +1 -1
  32. package/dist/runtime/index.mjs.map +1 -1
  33. package/dist/runtime/mf-config.cjs +28 -7
  34. package/dist/runtime/mf-config.cjs.map +1 -1
  35. package/dist/runtime/mf-config.d.cts +25 -38
  36. package/dist/runtime/mf-config.d.cts.map +1 -1
  37. package/dist/runtime/mf-config.d.mts +25 -38
  38. package/dist/runtime/mf-config.d.mts.map +1 -1
  39. package/dist/runtime/mf-config.mjs +28 -7
  40. package/dist/runtime/mf-config.mjs.map +1 -1
  41. package/dist/runtime/services/module-federation.service.cjs +2 -0
  42. package/dist/runtime/services/module-federation.service.cjs.map +1 -1
  43. package/dist/runtime/services/module-federation.service.d.cts.map +1 -1
  44. package/dist/runtime/services/module-federation.service.d.mts.map +1 -1
  45. package/dist/runtime/services/module-federation.service.mjs +2 -0
  46. package/dist/runtime/services/module-federation.service.mjs.map +1 -1
  47. package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
  48. package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
  49. package/dist/runtime/services/secrets.service.cjs +2 -1
  50. package/dist/runtime/services/secrets.service.cjs.map +1 -1
  51. package/dist/runtime/services/secrets.service.mjs +2 -2
  52. package/dist/runtime/services/secrets.service.mjs.map +1 -1
  53. package/dist/testing/index.cjs.map +1 -1
  54. package/dist/testing/index.mjs.map +1 -1
  55. package/dist/zod.cjs +5 -17
  56. package/dist/zod.d.cts +2 -8
  57. package/dist/zod.d.mts +2 -8
  58. package/dist/zod.mjs +2 -11
  59. package/package.json +16 -21
  60. package/skills/plugin-development/SKILL.md +16 -8
  61. package/skills/plugin-testing/SKILL.md +19 -9
  62. package/src/build/shared-deps.ts +17 -2
  63. package/src/runtime/mf-config.ts +49 -14
  64. package/src/runtime/services/module-federation.service.ts +3 -0
  65. package/src/runtime/services/secrets.service.ts +1 -1
  66. package/src/zod-core.ts +0 -3
  67. package/src/zod.ts +3 -1
  68. package/dist/orpc-client.cjs +0 -17
  69. package/dist/orpc-client.d.cts +0 -2
  70. package/dist/orpc-client.d.mts +0 -2
  71. package/dist/orpc-client.mjs +0 -5
  72. package/dist/zod.cjs.map +0 -1
  73. package/dist/zod.d.cts.map +0 -1
  74. package/dist/zod.d.mts.map +0 -1
  75. package/dist/zod.mjs.map +0 -1
  76. package/src/orpc-client.ts +0 -2
@@ -5,19 +5,6 @@ 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
- };
21
8
  var __copyProps = (to, from, except, desc) => {
22
9
  if (from && typeof from === "object" || typeof from === "function") {
23
10
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -32,7 +19,6 @@ var __copyProps = (to, from, except, desc) => {
32
19
  }
33
20
  return to;
34
21
  };
35
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
36
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
37
23
  value: mod,
38
24
  enumerable: true
@@ -40,6 +26,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
40
26
 
41
27
  //#endregion
42
28
 
43
- exports.__exportAll = __exportAll;
44
- exports.__reExport = __reExport;
45
29
  exports.__toESM = __toESM;
@@ -1,39 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
 
3
3
  //#region \0rolldown/runtime.js
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
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
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
24
- key = keys[i];
25
- if (!__hasOwnProp.call(to, key) && key !== except) {
26
- __defProp(to, key, {
27
- get: ((k) => from[k]).bind(null, key),
28
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
- });
30
- }
31
- }
32
- }
33
- return to;
34
- };
35
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
36
4
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
37
5
 
38
6
  //#endregion
39
- export { __exportAll, __reExport, __require };
7
+ export { __require };
@@ -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(\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 (runtime) await runtime.shutdown();\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 })().catch((err) => {\n console.error(\"❌ Plugin dev server fatal error:\", err);\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 buildDevContext = (_req: any, webRequest: Request) => {\n const rawClone =\n webRequest.method === \"GET\" || webRequest.method === \"HEAD\" ? null : webRequest.clone();\n let cachedRawBody: string | null = null;\n return {\n reqHeaders: webRequest.headers,\n getRawBody: async (): Promise<string> => {\n if (cachedRawBody !== null) return cachedRawBody;\n if (!rawClone) {\n cachedRawBody = \"\";\n return cachedRawBody;\n }\n cachedRawBody = await rawClone.text();\n return cachedRawBody;\n },\n };\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: buildDevContext(req, webRequest),\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: buildDevContext(req, webRequest),\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,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Q,MAAgB,SAAS,CAAC;;;AAI7D,WAAU,IAAI,IAAI,WAAW,UAAU,KAAK,OAAO,KAAU,QAAa;AACxE,mBAAiB,IAAI;EACrB,MAAM,aAAa,UAAU,IAAI,OAAO,UAAU;AAClD,MAAI,CAAC,WACH,QAAO,IAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,2BAA2B,CAAC;AAGnE,MAAI;GACF,MAAM,MAAM,UAAU,IAAI,QAAQ,OAAO,IAAI;GAC7C,MAAM,aAAa,IAAI,QAAQ,KAAK;IAClC,QAAQ,IAAI;IACZ,SAAS,IAAI;IACb,MAAM,IAAI,WAAW,SAAS,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,gBAAgB,KAAK,WAAW;IAC1C,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 (runtime) await runtime.shutdown();\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 })().catch((err) => {\n console.error(\"❌ Plugin dev server fatal error:\", err);\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 buildDevContext = (_req: any, webRequest: Request) => {\n const rawClone =\n webRequest.method === \"GET\" || webRequest.method === \"HEAD\" ? null : webRequest.clone();\n let cachedRawBody: string | null = null;\n return {\n reqHeaders: webRequest.headers,\n getRawBody: async (): Promise<string> => {\n if (cachedRawBody !== null) return cachedRawBody;\n if (!rawClone) {\n cachedRawBody = \"\";\n return cachedRawBody;\n }\n cachedRawBody = await rawClone.text();\n return cachedRawBody;\n },\n };\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: buildDevContext(req, webRequest),\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: buildDevContext(req, webRequest),\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,iBAAiB,YAAY;AACjC,MAAI,SAAS;AACX,SAAM,SAAS;AACf,aAAU;;;AAId,EAAC,YAAY;AACX,QAAM,gBAAgB;AAEtB,MAAI;GACF,MAAM,EAAE,wBAAwB,2CAAM;GACtC,MAAM,EAAE,eAAe,MAAM,OAAO;GACpC,MAAM,EAAE,mBAAmB,MAAM,OAAO;GACxC,MAAM,EAAE,2BAA2B,MAAM,OAAO;GAChD,MAAM,EAAE,6BAA6B,MAAM,OAAO;GAClD,MAAM,EAAE,YAAY,2CAAM;GAC1B,MAAM,EAAE,oBAAoB,2CAAM;GAElC,MAAM,WAAW,WAAW,YAAY,WAAW;GAEnD,MAAM,UAAU,oBAAoB,EAClC,UAAU,GACP,WAAW,EACV,QAAQ,oBAAoB,KAAK,kBAClC,EACF,EACF,CAAC;GAKF,MAAM,SAAS,MAAM,QAAQ,UAAU,UAAW,WAAW,U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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 +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(\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 (runtime) await runtime.shutdown();\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 })().catch((err) => {\n console.error(\"❌ Plugin dev server fatal error:\", err);\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 buildDevContext = (_req: any, webRequest: Request) => {\n const rawClone =\n webRequest.method === \"GET\" || webRequest.method === \"HEAD\" ? null : webRequest.clone();\n let cachedRawBody: string | null = null;\n return {\n reqHeaders: webRequest.headers,\n getRawBody: async (): Promise<string> => {\n if (cachedRawBody !== null) return cachedRawBody;\n if (!rawClone) {\n cachedRawBody = \"\";\n return cachedRawBody;\n }\n cachedRawBody = await rawClone.text();\n return cachedRawBody;\n },\n };\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: buildDevContext(req, webRequest),\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: buildDevContext(req, webRequest),\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,iBAAiB,YAAY;AACjC,MAAI,SAAS;AACX,SAAM,SAAS;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AAC;AAGnE,MAAI;GACF,MAAM,MAAM,UAAU,IAAI,QAAQ,OAAO,IAAI;GAC7C,MAAM,aAAa,IAAI,QAAQ,KAAK;IAClC,QAAQ,IAAI;IACZ,SAAS,IAAI;IACb,MAAM,IAAI,WAAW,SAAS,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,gBAAgB,KAAK,WAAW;IAC1C,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.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 (runtime) await runtime.shutdown();\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 })().catch((err) => {\n console.error(\"❌ Plugin dev server fatal error:\", err);\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 buildDevContext = (_req: any, webRequest: Request) => {\n const rawClone =\n webRequest.method === \"GET\" || webRequest.method === \"HEAD\" ? null : webRequest.clone();\n let cachedRawBody: string | null = null;\n return {\n reqHeaders: webRequest.headers,\n getRawBody: async (): Promise<string> => {\n if (cachedRawBody !== null) return cachedRawBody;\n if (!rawClone) {\n cachedRawBody = \"\";\n return cachedRawBody;\n }\n cachedRawBody = await rawClone.text();\n return cachedRawBody;\n },\n };\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: buildDevContext(req, webRequest),\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: buildDevContext(req, webRequest),\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,+BA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AC;;GAE3D;AAEF,WAAU,IAAI,IAAI,QAAQ,iBAAiB;AAC3C,WAAU,IAAI,IAAI,UAAU,iBAAiB"}
@@ -1 +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"}
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,QACrB,KAAK;SACb;AACN,SAAO;;;AAIX,SAAS,WAAW,SAAyB;AAC3C,KAAI;AACF,SAAO,mBAAmB,QAAQ;SAC5B;AACN,SAAO,QAAQ,QAAQ,wBAAwB,MAAM"}
@@ -1 +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
+ {"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,QACrB,KAAK;SACb;AACN,SAAO;;;AAIX,SAAS,WAAW,SAAyB;AAC3C,KAAI;AACF,SAAO,mBAAmB,QAAQ;SAC5B;AACN,SAAO,QAAQ,QAAQ,wBAAwB,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs","names":["getPluginInfo","path","fs","crypto","loadDevConfig","ModuleFederationPlugin","buildSharedDependencies"],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { setupPluginMiddleware } from \"./dev-server-middleware\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo, loadDevConfig } from \"./utils\";\n\nexport interface EveryPluginOptions {\n devConfigPath?: string;\n port?: number;\n pluginId?: string;\n dts?: boolean;\n}\n\nexport interface AdditionalExport {\n srcPath: string;\n exportNames: string[];\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n additionalExports?: AdditionalExport[];\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n const sourceContractPath = path.join(context, \"types\", contractFileName);\n\n let contractTypes: string;\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n const packageDir = context.split(\"/\").pop();\n const nestedPath = path.join(context, \"types\", packageDir ?? \"\", \"src\", contractFileName);\n\n contractTypes = (await tryReadFile(nestedPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. ` +\n `Skipping manifest generation.`,\n );\n return;\n }\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: \"./remoteEntry.js\",\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n const additionalExportsEntries: Array<{ path: string; exports: string[]; sha256: string }> =\n [];\n\n if (this.options.additionalExports?.length) {\n for (const additional of this.options.additionalExports) {\n const sourcePath = path.join(context, \"types\", additional.srcPath);\n const content = await tryReadFile(sourcePath);\n if (!content) {\n console.warn(\n `[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`,\n );\n continue;\n }\n const sha256 = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n const distPath = `./types/${additional.srcPath}`;\n additionalExportsEntries.push({\n path: distPath,\n exports: additional.exportNames,\n sha256,\n });\n\n if (rawSource) {\n compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));\n }\n }\n\n if (additionalExportsEntries.length > 0) {\n manifest.additionalExports = additionalExportsEntries;\n }\n }\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = \"EveryPluginDevServer\";\n\n constructor(private options: EveryPluginOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || \"./plugin.dev.ts\");\n const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;\n\n this.configureDefaults(compiler, pluginInfo);\n\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: \"remoteEntry.js\",\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n compiler.options.output.clean = true;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (compiler.options.devtool === undefined) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n compiler.options.resolve.conditionNames = [\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n\n private configureDevServer(compiler: Compiler, pluginInfo: any, devConfig: any, port: number) {\n if (!compiler.options.devServer) {\n return;\n }\n\n const context = compiler.options.context || process.cwd();\n const originalSetup = compiler.options.devServer.setupMiddlewares;\n\n compiler.options.devServer.port = port;\n compiler.options.devServer.static = path.join(context, \"dist\");\n compiler.options.devServer.hot = true;\n compiler.options.devServer.devMiddleware = { writeToDisk: true };\n compiler.options.devServer.headers = {\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\n compiler.options.devServer.client = {\n logging: \"warn\",\n overlay: {\n warnings: false,\n errors: true,\n },\n };\n\n compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {\n setupPluginMiddleware(devServer, pluginInfo, devConfig, port);\n return originalSetup ? originalSetup(middlewares, devServer) : middlewares;\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA2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ASA,kBAAK,KAAK,SAAS,OAAO;AAC9D,WAAS,QAAQ,UAAU,MAAM;AACjC,WAAS,QAAQ,UAAU,gBAAgB,EAAE,aAAa,MAAM;AAChE,WAAS,QAAQ,UAAU,UAAU;GACnC,+BAA+B;GAC/B,gCAAgC;GAChC,gCAAgC;GACjC;AAED,WAAS,QAAQ,UAAU,SAAS;GAClC,SAAS;GACT,SAAS;IACP,UAAU;IACV,QAAQ;IACT;GACF;AAED,WAAS,QAAQ,UAAU,oBAAoB,aAAa,cAAc;AACxE,uDAAsB,WAAW,YAAY,WAAW,KAAK;AAC7D,UAAO,gBAAgB,cAAc,aAAa,UAAU,GAAG"}
1
+ {"version":3,"file":"plugin.cjs","names":["getPluginInfo","path","fs","crypto","loadDevConfig","ModuleFederationPlugin","buildSharedDependencies"],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { setupPluginMiddleware } from \"./dev-server-middleware\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo, loadDevConfig } from \"./utils\";\n\nexport interface EveryPluginOptions {\n devConfigPath?: string;\n port?: number;\n pluginId?: string;\n dts?: boolean;\n}\n\nexport interface AdditionalExport {\n srcPath: string;\n exportNames: string[];\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n additionalExports?: AdditionalExport[];\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n const sourceContractPath = path.join(context, \"types\", contractFileName);\n\n let contractTypes: string;\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n const packageDir = context.split(\"/\").pop();\n const nestedPath = path.join(context, \"types\", packageDir ?? \"\", \"src\", contractFileName);\n\n contractTypes = (await tryReadFile(nestedPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. ` +\n `Skipping manifest generation.`,\n );\n return;\n }\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: \"./remoteEntry.js\",\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n const additionalExportsEntries: Array<{ path: string; exports: string[]; sha256: string }> =\n [];\n\n if (this.options.additionalExports?.length) {\n for (const additional of this.options.additionalExports) {\n const sourcePath = path.join(context, \"types\", additional.srcPath);\n const content = await tryReadFile(sourcePath);\n if (!content) {\n console.warn(\n `[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`,\n );\n continue;\n }\n const sha256 = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n const distPath = `./types/${additional.srcPath}`;\n additionalExportsEntries.push({\n path: distPath,\n exports: additional.exportNames,\n sha256,\n });\n\n if (rawSource) {\n compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));\n }\n }\n\n if (additionalExportsEntries.length > 0) {\n manifest.additionalExports = additionalExportsEntries;\n }\n }\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = \"EveryPluginDevServer\";\n\n constructor(private options: EveryPluginOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || \"./plugin.dev.ts\");\n const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;\n\n this.configureDefaults(compiler, pluginInfo);\n\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: \"remoteEntry.js\",\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n compiler.options.output.clean = true;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (compiler.options.devtool === undefined) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n compiler.options.resolve.conditionNames = [\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n\n private configureDevServer(compiler: Compiler, pluginInfo: any, devConfig: any, port: number) {\n if (!compiler.options.devServer) {\n return;\n }\n\n const context = compiler.options.context || process.cwd();\n const originalSetup = compiler.options.devServer.setupMiddlewares;\n\n compiler.options.devServer.port = port;\n compiler.options.devServer.static = path.join(context, \"dist\");\n compiler.options.devServer.hot = true;\n compiler.options.devServer.devMiddleware = { writeToDisk: true };\n compiler.options.devServer.headers = {\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\n compiler.options.devServer.client = {\n logging: \"warn\",\n overlay: {\n warnings: false,\n errors: true,\n },\n };\n\n compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {\n setupPluginMiddleware(devServer, pluginInfo, devConfig, port);\n return originalSetup ? originalSetup(middlewares, devServer) : middlewares;\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA2BA,IAAa,qBAAb,MAAgE;CAC9D,OAAO;CAEP,YAAY,AAAQ,UAAwC,EAAE,EAAE;EAA5C;;CAEpB,MAAM,UAAoB;AACxB,WAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;AAEtE,eAAY,MAAM,cAAc,WAAW;IAAE,MAAM,KAAK;IAAM;IAAO,EAAE,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,KAAK;IACzD,MAAM,aAAaA,4BAAc,QAAQ;IACzC,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAC1D,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAE1D,MAAM,qBAAqBC,kBAAK,KAAK,SAAS,SAAS,iBAAiB;IAExE,IAAI;IAEJ,MAAM,cAAc,OAAO,aAA6C;AACtE,SAAI,CAACC,gBAAG,WA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S,QAAQ,OACpB,UAAS,QAAQ,SAAS,EAAE,OAAO,EAAE,EAAE;AAGzC,MAAI,CAAC,SAAS,QAAQ,OAAO,MAC3B,UAAS,QAAQ,OAAO,QAAQ,EAAE;AAYpC,MAAI,CATgB,SAAS,QAAQ,OAAO,MAAM,MAC/C,SACC,OAAO,SAAS,YAChB,SAAS,QACT,UAAU,QACV,KAAK,gBAAgB,UACrB,KAAK,KAAK,KAAK,MAAM,CAGT,CACd,UAAS,QAAQ,OAAO,MAAM,KAAK;GACjC,MAAM;GACN,KAAK;GACL,SAAS;GACV,CAAC;;CAIN,AAAQ,mBAAmB,UAAoB,YAAiB,WAAgB,MAAc;AAC5F,MAAI,CAAC,SAAS,QAAQ,UACpB;EAGF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,KAAK;EACzD,MAAM,gBAAgB,SAAS,QAAQ,UAAU;AAEjD,WAAS,QAAQ,UAAU,OAAO;AAClC,WAAS,QAAQ,UAAU,SAASA,kBAAK,KAAK,SAAS,OAAO;AAC9D,WAAS,QAAQ,UAAU,MAAM;AACjC,WAAS,QAAQ,UAAU,gBAAgB,EAAE,aAAa,MAAM;AAChE,WAAS,QAAQ,UAAU,UAAU;GACnC,+BAA+B;GAC/B,gCAAgC;GAChC,gCAAgC;GACjC;AAED,WAAS,QAAQ,UAAU,SAAS;GAClC,SAAS;GACT,SAAS;IACP,UAAU;IACV,QAAQ;IACT;GACF;AAED,WAAS,QAAQ,UAAU,oBAAoB,aAAa,cAAc;AACxE,uDAAsB,WAAW,YAAY,WAAW,KAAK;AAC7D,UAAO,gBAAgB,cAAc,aAAa,UAAU,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { setupPluginMiddleware } from \"./dev-server-middleware\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo, loadDevConfig } from \"./utils\";\n\nexport interface EveryPluginOptions {\n devConfigPath?: string;\n port?: number;\n pluginId?: string;\n dts?: boolean;\n}\n\nexport interface AdditionalExport {\n srcPath: string;\n exportNames: string[];\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n additionalExports?: AdditionalExport[];\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n const sourceContractPath = path.join(context, \"types\", contractFileName);\n\n let contractTypes: string;\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n const packageDir = context.split(\"/\").pop();\n const nestedPath = path.join(context, \"types\", packageDir ?? \"\", \"src\", contractFileName);\n\n contractTypes = (await tryReadFile(nestedPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. ` +\n `Skipping manifest generation.`,\n );\n return;\n }\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: \"./remoteEntry.js\",\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n const additionalExportsEntries: Array<{ path: string; exports: string[]; sha256: string }> =\n [];\n\n if (this.options.additionalExports?.length) {\n for (const additional of this.options.additionalExports) {\n const sourcePath = path.join(context, \"types\", additional.srcPath);\n const content = await tryReadFile(sourcePath);\n if (!content) {\n console.warn(\n `[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`,\n );\n continue;\n }\n const sha256 = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n const distPath = `./types/${additional.srcPath}`;\n additionalExportsEntries.push({\n path: distPath,\n exports: additional.exportNames,\n sha256,\n });\n\n if (rawSource) {\n compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));\n }\n }\n\n if (additionalExportsEntries.length > 0) {\n manifest.additionalExports = additionalExportsEntries;\n }\n }\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = \"EveryPluginDevServer\";\n\n constructor(private options: EveryPluginOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || \"./plugin.dev.ts\");\n const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;\n\n this.configureDefaults(compiler, pluginInfo);\n\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: \"remoteEntry.js\",\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n compiler.options.output.clean = true;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (compiler.options.devtool === undefined) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n compiler.options.resolve.conditionNames = [\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n\n private configureDevServer(compiler: Compiler, pluginInfo: any, devConfig: any, port: number) {\n if (!compiler.options.devServer) {\n return;\n }\n\n const context = compiler.options.context || process.cwd();\n const originalSetup = compiler.options.devServer.setupMiddlewares;\n\n compiler.options.devServer.port = port;\n compiler.options.devServer.static = path.join(context, \"dist\");\n compiler.options.devServer.hot = true;\n compiler.options.devServer.devMiddleware = { writeToDisk: true };\n compiler.options.devServer.headers = {\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\n compiler.options.devServer.client = {\n logging: \"warn\",\n overlay: {\n warnings: false,\n errors: true,\n },\n };\n\n compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {\n setupPluginMiddleware(devServer, pluginInfo, devConfig, port);\n return originalSetup ? originalSetup(middlewares, devServer) : middlewares;\n };\n }\n}\n"],"mappings":";;;;;;;;;;AA2BA,IAAa,qBAAb,MAAgE;CAC9D,OAAO;CAEP,YAAY,AAAQ,UAAwC,EAAE,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,MAAM;AAChE,WAAS,QAAQ,UAAU,UAAU;GACnC,+BAA+B;GAC/B,gCAAgC;GAChC,gCAAgC;GACjC;AAED,WAAS,QAAQ,UAAU,SAAS;GAClC,SAAS;GACT,SAAS;IACP,UAAU;IACV,QAAQ;IACT;GACF;AAED,WAAS,QAAQ,UAAU,oBAAoB,aAAa,cAAc;AACxE,yBAAsB,WAAW,YAAY,WAAW,KAAK;AAC7D,UAAO,gBAAgB,cAAc,aAAa,UAAU,GAAG"}
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { setupPluginMiddleware } from \"./dev-server-middleware\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo, loadDevConfig } from \"./utils\";\n\nexport interface EveryPluginOptions {\n devConfigPath?: string;\n port?: number;\n pluginId?: string;\n dts?: boolean;\n}\n\nexport interface AdditionalExport {\n srcPath: string;\n exportNames: string[];\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n additionalExports?: AdditionalExport[];\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n const sourceContractPath = path.join(context, \"types\", contractFileName);\n\n let contractTypes: string;\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n const packageDir = context.split(\"/\").pop();\n const nestedPath = path.join(context, \"types\", packageDir ?? \"\", \"src\", contractFileName);\n\n contractTypes = (await tryReadFile(nestedPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. ` +\n `Skipping manifest generation.`,\n );\n return;\n }\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: \"./remoteEntry.js\",\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n const additionalExportsEntries: Array<{ path: string; exports: string[]; sha256: string }> =\n [];\n\n if (this.options.additionalExports?.length) {\n for (const additional of this.options.additionalExports) {\n const sourcePath = path.join(context, \"types\", additional.srcPath);\n const content = await tryReadFile(sourcePath);\n if (!content) {\n console.warn(\n `[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`,\n );\n continue;\n }\n const sha256 = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n const distPath = `./types/${additional.srcPath}`;\n additionalExportsEntries.push({\n path: distPath,\n exports: additional.exportNames,\n sha256,\n });\n\n if (rawSource) {\n compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));\n }\n }\n\n if (additionalExportsEntries.length > 0) {\n manifest.additionalExports = additionalExportsEntries;\n }\n }\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = \"EveryPluginDevServer\";\n\n constructor(private options: EveryPluginOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || \"./plugin.dev.ts\");\n const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;\n\n this.configureDefaults(compiler, pluginInfo);\n\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: \"remoteEntry.js\",\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n compiler.options.output.clean = true;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (compiler.options.devtool === undefined) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n compiler.options.resolve.conditionNames = [\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n\n private configureDevServer(compiler: Compiler, pluginInfo: any, devConfig: any, port: number) {\n if (!compiler.options.devServer) {\n return;\n }\n\n const context = compiler.options.context || process.cwd();\n const originalSetup = compiler.options.devServer.setupMiddlewares;\n\n compiler.options.devServer.port = port;\n compiler.options.devServer.static = path.join(context, \"dist\");\n compiler.options.devServer.hot = true;\n compiler.options.devServer.devMiddleware = { writeToDisk: true };\n compiler.options.devServer.headers = {\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\n compiler.options.devServer.client = {\n logging: \"warn\",\n overlay: {\n warnings: false,\n errors: true,\n },\n };\n\n compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {\n setupPluginMiddleware(devServer, pluginInfo, devConfig, port);\n return originalSetup ? originalSetup(middlewares, devServer) : middlewares;\n };\n }\n}\n"],"mappings":";;;;;;;;;;AA2BA,IAAa,qBAAb,MAAgE;CAC9D,OAAO;CAEP,YAAY,AAAQ,UAAwC,EAAE,EAAE;EAA5C;;CAEpB,MAAM,UAAoB;AACxB,WAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;AAEtE,eAAY,MAAM,cAAc,WAAW;IAAE,MAAM,KAAK;IAAM;IAAO,EAAE,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,KAAK;IACzD,MAAM,aAAa,cAAc,QAAQ;IACzC,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAC1D,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAE1D,MAAM,qBAAqB,KAAK,KAAK,SAAS,SAAS,iBAAiB;IAExE,IAAI;IAEJ,MAAM,cAAc,OAAO,aAA6C;AACtE,SAAI,CAAC,GAAG,WAAW,SAAS,CAC1B,QAAO;AAGT,SAAI,CADU,GAAG,SAAS,SAChB,CAAC,QAAQ,CACjB,QAAO;AAET,SAAI;AACF,aAAO,MAAM,GAAG,SAAS,SAAS,UAAU,OAAO;aAC7C;AACN,aAAO;;;AAIX,oBAA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AAS,YAChB,SAAS,QACT,UAAU,QACV,KAAK,gBAAgB,UACrB,KAAK,KAAK,KAAK,MAAM,CAGT,CACd,UAAS,QAAQ,OAAO,MAAM,KAAK;GACjC,MAAM;GACN,KAAK;GACL,SAAS;GACV,CAAC;;CAIN,AAAQ,mBAAmB,UAAoB,YAAiB,WAAgB,MAAc;AAC5F,MAAI,CAAC,SAAS,QAAQ,UACpB;EAGF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,KAAK;EACzD,MAAM,gBAAgB,SAAS,QAAQ,UAAU;AAEjD,WAAS,QAAQ,UAAU,OAAO;AAClC,WAAS,QAAQ,UAAU,SAAS,KAAK,KAAK,SAAS,OAAO;AAC9D,WAAS,QAAQ,UAAU,MAAM;AACjC,WAAS,QAAQ,UAAU,gBAAgB,EAAE,aAAa,MAAM;AAChE,WAAS,QAAQ,UAAU,UAAU;GACnC,+BAA+B;GAC/B,gCAAgC;GAChC,gCAAgC;GACjC;AAED,WAAS,QAAQ,UAAU,SAAS;GAClC,SAAS;GACT,SAAS;IACP,UAAU;IACV,QAAQ;IACT;GACF;AAED,WAAS,QAAQ,UAAU,oBAAoB,aAAa,cAAc;AACxE,yBAAsB,WAAW,YAAY,WAAW,KAAK;AAC7D,UAAO,gBAAgB,cAAc,aAAa,UAAU,GAAG"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let node_module = require("node:module");
4
3
  let node_fs = require("node:fs");
4
+ let node_module = require("node:module");
5
5
  let node_path = require("node:path");
6
6
  let node_url = require("node:url");
7
7
 
@@ -18,7 +18,8 @@ const DEFAULT_SHARE_CONFIG = {
18
18
  requiredVersion: false,
19
19
  singleton: true,
20
20
  strictVersion: false,
21
- eager: false
21
+ eager: false,
22
+ shareScope: "default"
22
23
  };
23
24
  function extractExactVersion(input) {
24
25
  const match = input.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?/);
@@ -26,7 +27,13 @@ function extractExactVersion(input) {
26
27
  }
27
28
  function getInstalledPackageVersion(packageName, fallbackVersion) {
28
29
  try {
29
- return require$1(`${packageName}/package.json`).version;
30
+ let currentDir = (0, node_path.dirname)(require$1.resolve(packageName));
31
+ for (let i = 0; i < 5; i += 1) {
32
+ const packageJsonPath = (0, node_path.join)(currentDir, "package.json");
33
+ if ((0, node_fs.existsSync)(packageJsonPath)) return JSON.parse((0, node_fs.readFileSync)(packageJsonPath, "utf-8")).version;
34
+ currentDir = (0, node_path.dirname)(currentDir);
35
+ }
36
+ throw new Error(`Could not resolve installed version for ${packageName}`);
30
37
  } catch {
31
38
  return extractExactVersion(fallbackVersion);
32
39
  }
@@ -48,6 +55,10 @@ const pluginSharedDependencies = {
48
55
  version: getInstalledPackageVersion("@orpc/contract", pkg.peerDependencies["@orpc/contract"]),
49
56
  ...DEFAULT_SHARE_CONFIG
50
57
  },
58
+ "@orpc/client": {
59
+ version: getInstalledPackageVersion("@orpc/client", pkg.peerDependencies["@orpc/client"]),
60
+ ...DEFAULT_SHARE_CONFIG
61
+ },
51
62
  "@orpc/server": {
52
63
  version: getInstalledPackageVersion("@orpc/server", pkg.peerDependencies["@orpc/server"]),
53
64
  ...DEFAULT_SHARE_CONFIG
@@ -1 +1 @@
1
- {"version":3,"file":"shared-deps.cjs","names":["__dirname","require"],"sources":["../../src/build/shared-deps.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst require = createRequire(import.meta.url);\n\nlet pkg: typeof import(\"../../package.json\");\n\ntry {\n pkg = JSON.parse(readFileSync(join(__dirname, \"../../package.json\"), \"utf-8\"));\n} catch {\n pkg = require(\"every-plugin/package.json\");\n}\n\nexport interface SharedDependencyConfig {\n version: string;\n requiredVersion: string | false;\n singleton: boolean;\n strictVersion: boolean;\n eager: boolean;\n}\n\nexport type SharedDependencies = Record<string, SharedDependencyConfig>;\n\nconst DEFAULT_SHARE_CONFIG: Omit<SharedDependencyConfig, \"version\"> = {\n requiredVersion: false,\n singleton: true,\n strictVersion: false,\n eager: false,\n};\n\nfunction extractExactVersion(input: string): string {\n const match = input.match(/\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?/);\n return match ? match[0] : input.replace(/^[\\^~>=<\\s]+/, \"\");\n}\n\nfunction getInstalledPackageVersion(packageName: string, fallbackVersion: string): string {\n try {\n return require(`${packageName}/package.json`).version as string;\n } catch {\n return extractExactVersion(fallbackVersion);\n }\n}\n\nexport const pluginSharedDependencies = {\n \"every-plugin\": { version: pkg.version, ...DEFAULT_SHARE_CONFIG },\n effect: {\n version: getInstalledPackageVersion(\"effect\", pkg.peerDependencies.effect),\n ...DEFAULT_SHARE_CONFIG,\n },\n zod: {\n version: getInstalledPackageVersion(\"zod\", pkg.peerDependencies.zod),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"@orpc/contract\": {\n version: getInstalledPackageVersion(\"@orpc/contract\", pkg.peerDependencies[\"@orpc/contract\"]),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"@orpc/server\": {\n version: getInstalledPackageVersion(\"@orpc/server\", pkg.peerDependencies[\"@orpc/server\"]),\n ...DEFAULT_SHARE_CONFIG,\n },\n} satisfies SharedDependencies;\n\nexport type PluginSharedDependencyName = keyof typeof pluginSharedDependencies;\n\nexport function getPluginSharedDependencies(): SharedDependencies {\n return pluginSharedDependencies;\n}\n\nexport function getPluginSharedDependenciesVersionRange(): Record<string, string> {\n return Object.fromEntries(\n Object.entries(getPluginSharedDependencies()).map(([name, config]) => [\n name,\n getMajorMinorVersion(config.version),\n ]),\n );\n}\n\nexport function getMajorMinorVersion(version: string): string {\n const clean = version.replace(/^[\\^~>=<]+/, \"\");\n const match = clean.match(/^(\\d+)\\.(\\d+)/);\n if (!match) return \"^0.0.0\";\n return `^${match[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AAI,CAAC,MAAO,QAAO;AACnB,QAAO,IAAI,MAAM,GAAG,GAAG,MAAM,GAAG"}
1
+ {"version":3,"file":"shared-deps.cjs","names":["__dirname","require"],"sources":["../../src/build/shared-deps.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst require = createRequire(import.meta.url);\n\nlet pkg: typeof import(\"../../package.json\");\n\ntry {\n pkg = JSON.parse(readFileSync(join(__dirname, \"../../package.json\"), \"utf-8\"));\n} catch {\n pkg = require(\"every-plugin/package.json\");\n}\n\nexport interface SharedDependencyConfig {\n version: string;\n requiredVersion: string | false;\n singleton: boolean;\n strictVersion: boolean;\n eager: boolean;\n shareScope: string;\n}\n\nexport type SharedDependencies = Record<string, SharedDependencyConfig>;\n\nconst DEFAULT_SHARE_CONFIG: Omit<SharedDependencyConfig, \"version\"> = {\n requiredVersion: false,\n singleton: true,\n strictVersion: false,\n eager: false,\n shareScope: \"default\",\n};\n\nfunction extractExactVersion(input: string): string {\n const match = input.match(/\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?/);\n return match ? match[0] : input.replace(/^[\\^~>=<\\s]+/, \"\");\n}\n\nfunction getInstalledPackageVersion(packageName: string, fallbackVersion: string): string {\n try {\n let currentDir = dirname(require.resolve(packageName));\n for (let i = 0; i < 5; i += 1) {\n const packageJsonPath = join(currentDir, \"package.json\");\n if (existsSync(packageJsonPath)) {\n return (JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as { version: string }).version;\n }\n currentDir = dirname(currentDir);\n }\n\n throw new Error(`Could not resolve installed version for ${packageName}`);\n } catch {\n return extractExactVersion(fallbackVersion);\n }\n}\n\nexport const pluginSharedDependencies = {\n \"every-plugin\": { version: pkg.version, ...DEFAULT_SHARE_CONFIG },\n effect: {\n version: getInstalledPackageVersion(\"effect\", pkg.peerDependencies.effect),\n ...DEFAULT_SHARE_CONFIG,\n },\n zod: {\n version: getInstalledPackageVersion(\"zod\", pkg.peerDependencies.zod),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"@orpc/contract\": {\n version: getInstalledPackageVersion(\"@orpc/contract\", pkg.peerDependencies[\"@orpc/contract\"]),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"@orpc/client\": {\n version: getInstalledPackageVersion(\"@orpc/client\", pkg.peerDependencies[\"@orpc/client\"]),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"@orpc/server\": {\n version: getInstalledPackageVersion(\"@orpc/server\", pkg.peerDependencies[\"@orpc/server\"]),\n ...DEFAULT_SHARE_CONFIG,\n },\n} satisfies SharedDependencies;\n\nexport type PluginSharedDependencyName = keyof typeof pluginSharedDependencies;\n\nexport function getPluginSharedDependencies(): SharedDependencies {\n return pluginSharedDependencies;\n}\n\nexport function getPluginSharedDependenciesVersionRange(): Record<string, string> {\n return Object.fromEntries(\n Object.entries(getPluginSharedDependencies()).map(([name, config]) => [\n name,\n getMajorMinorVersion(config.version),\n ]),\n );\n}\n\nexport function getMajorMinorVersion(version: string): string {\n const clean = version.replace(/^[\\^~>=<]+/, \"\");\n const match = clean.match(/^(\\d+)\\.(\\d+)/);\n if (!match) return \"^0.0.0\";\n return `^${match[1]}.${match[2]}.0`;\n}\n"],"mappings":";;;;;;;;AAKA,MAAMA,+GAAkD,CAAC;AACzD,MAAMC,yFAAwC;AAE9C,IAAI;AAEJ,IAAI;AACF,OAAM,KAAK,oDAAwBD,aAAW,qBAAqB,EAAE,QAAQ,CAAC;QACxE;AACN,OAAMC,UAAQ,4BAA4B;;AAc5C,MAAM,uBAAgE;CACpE,iBAAiB;CACjB,WAAW;CACX,eAAe;CACf,OAAO;CACP,YAAY;CACb;AAED,SAAS,oBAAoB,OAAuB;CAClD,MAAM,QAAQ,MAAM,MAAM,oCAAoC;AAC9D,QAAO,QAAQ,MAAM,KAAK,MAAM,QAAQ,gBA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@@ interface SharedDependencyConfig {
5
5
  singleton: boolean;
6
6
  strictVersion: boolean;
7
7
  eager: boolean;
8
+ shareScope: string;
8
9
  }
9
10
  type SharedDependencies = Record<string, SharedDependencyConfig>;
10
11
  declare const pluginSharedDependencies: {
@@ -13,6 +14,7 @@ declare const pluginSharedDependencies: {
13
14
  singleton: boolean;
14
15
  strictVersion: boolean;
15
16
  eager: boolean;
17
+ shareScope: string;
16
18
  version: string;
17
19
  };
18
20
  effect: {
@@ -20,6 +22,7 @@ declare const pluginSharedDependencies: {
20
22
  singleton: boolean;
21
23
  strictVersion: boolean;
22
24
  eager: boolean;
25
+ shareScope: string;
23
26
  version: string;
24
27
  };
25
28
  zod: {
@@ -27,6 +30,7 @@ declare const pluginSharedDependencies: {
27
30
  singleton: boolean;
28
31
  strictVersion: boolean;
29
32
  eager: boolean;
33
+ shareScope: string;
30
34
  version: string;
31
35
  };
32
36
  "@orpc/contract": {
@@ -34,6 +38,15 @@ declare const pluginSharedDependencies: {
34
38
  singleton: boolean;
35
39
  strictVersion: boolean;
36
40
  eager: boolean;
41
+ shareScope: string;
42
+ version: string;
43
+ };
44
+ "@orpc/client": {
45
+ requiredVersion: string | false;
46
+ singleton: boolean;
47
+ strictVersion: boolean;
48
+ eager: boolean;
49
+ shareScope: string;
37
50
  version: string;
38
51
  };
39
52
  "@orpc/server": {
@@ -41,6 +54,7 @@ declare const pluginSharedDependencies: {
41
54
  singleton: boolean;
42
55
  strictVersion: boolean;
43
56
  eager: boolean;
57
+ shareScope: string;
44
58
  version: string;
45
59
  };
46
60
  };
@@ -1 +1 @@
1
- {"version":3,"file":"shared-deps.d.cts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB,sBAAA;EACf,OAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,KAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,MAAA,SAAe,sBAAA;AAAA,cAsBnC,wBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoBD,0BAAA,gBAA0C,wBAAA;AAAA,iBAEtC,2BAAA,CAAA,GAA+B,kBAAA;AAAA,iBAI/B,uCAAA,CAAA,GAA2C,MAAA;AAAA,iBAS3C,oBAAA,CAAqB,OAAA"}
1
+ {"version":3,"file":"shared-deps.d.cts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB,sBAAA;EACf,OAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,KAAA;EACA,UAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,MAAA,SAAe,sBAAA;AAAA,cAgCnC,wBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwBD,0BAAA,gBAA0C,wBAAA;AAAA,iBAEtC,2BAAA,CAAA,GAA+B,kBAAA;AAAA,iBAI/B,uCAAA,CAAA,GAA2C,MAAA;AAAA,iBAS3C,oBAAA,CAAqB,OAAA"}
@@ -5,6 +5,7 @@ interface SharedDependencyConfig {
5
5
  singleton: boolean;
6
6
  strictVersion: boolean;
7
7
  eager: boolean;
8
+ shareScope: string;
8
9
  }
9
10
  type SharedDependencies = Record<string, SharedDependencyConfig>;
10
11
  declare const pluginSharedDependencies: {
@@ -13,6 +14,7 @@ declare const pluginSharedDependencies: {
13
14
  singleton: boolean;
14
15
  strictVersion: boolean;
15
16
  eager: boolean;
17
+ shareScope: string;
16
18
  version: string;
17
19
  };
18
20
  effect: {
@@ -20,6 +22,7 @@ declare const pluginSharedDependencies: {
20
22
  singleton: boolean;
21
23
  strictVersion: boolean;
22
24
  eager: boolean;
25
+ shareScope: string;
23
26
  version: string;
24
27
  };
25
28
  zod: {
@@ -27,6 +30,7 @@ declare const pluginSharedDependencies: {
27
30
  singleton: boolean;
28
31
  strictVersion: boolean;
29
32
  eager: boolean;
33
+ shareScope: string;
30
34
  version: string;
31
35
  };
32
36
  "@orpc/contract": {
@@ -34,6 +38,15 @@ declare const pluginSharedDependencies: {
34
38
  singleton: boolean;
35
39
  strictVersion: boolean;
36
40
  eager: boolean;
41
+ shareScope: string;
42
+ version: string;
43
+ };
44
+ "@orpc/client": {
45
+ requiredVersion: string | false;
46
+ singleton: boolean;
47
+ strictVersion: boolean;
48
+ eager: boolean;
49
+ shareScope: string;
37
50
  version: string;
38
51
  };
39
52
  "@orpc/server": {
@@ -41,6 +54,7 @@ declare const pluginSharedDependencies: {
41
54
  singleton: boolean;
42
55
  strictVersion: boolean;
43
56
  eager: boolean;
57
+ shareScope: string;
44
58
  version: string;
45
59
  };
46
60
  };
@@ -1 +1 @@
1
- {"version":3,"file":"shared-deps.d.mts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB,sBAAA;EACf,OAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,KAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,MAAA,SAAe,sBAAA;AAAA,cAsBnC,wBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoBD,0BAAA,gBAA0C,wBAAA;AAAA,iBAEtC,2BAAA,CAAA,GAA+B,kBAAA;AAAA,iBAI/B,uCAAA,CAAA,GAA2C,MAAA;AAAA,iBAS3C,oBAAA,CAAqB,OAAA"}
1
+ {"version":3,"file":"shared-deps.d.mts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB,sBAAA;EACf,OAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,KAAA;EACA,UAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,MAAA,SAAe,sBAAA;AAAA,cAgCnC,wBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwBD,0BAAA,gBAA0C,wBAAA;AAAA,iBAEtC,2BAAA,CAAA,GAA+B,kBAAA;AAAA,iBAI/B,uCAAA,CAAA,GAA2C,MAAA;AAAA,iBAS3C,oBAAA,CAAqB,OAAA"}