every-plugin 2.9.6 → 2.10.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.
- package/dist/_virtual/_rolldown/runtime.mjs +1 -1
- package/dist/build/rspack/dev-server-middleware.cjs.map +1 -1
- package/dist/build/rspack/dev-server-middleware.mjs.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts +0 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts +0 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -1
- package/dist/build/rspack/module-federation.cjs.map +1 -1
- package/dist/build/rspack/module-federation.mjs.map +1 -1
- package/dist/build/rspack/plugin.cjs +2 -0
- package/dist/build/rspack/plugin.cjs.map +1 -1
- package/dist/build/rspack/plugin.d.cts +1 -2
- package/dist/build/rspack/plugin.d.cts.map +1 -1
- package/dist/build/rspack/plugin.d.mts +1 -2
- package/dist/build/rspack/plugin.d.mts.map +1 -1
- package/dist/build/rspack/plugin.mjs +2 -0
- package/dist/build/rspack/plugin.mjs.map +1 -1
- package/dist/build/rspack/utils.cjs.map +1 -1
- package/dist/build/rspack/utils.mjs.map +1 -1
- package/dist/build/shared-deps.cjs +0 -1
- package/dist/build/shared-deps.cjs.map +1 -1
- package/dist/build/shared-deps.d.cts.map +1 -1
- package/dist/build/shared-deps.d.mts.map +1 -1
- package/dist/build/shared-deps.mjs.map +1 -1
- package/dist/errors.cjs +0 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +0 -1
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.mts +0 -1
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/orpc.cjs +0 -1
- package/dist/plugin.cjs +2 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +3 -2
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +3 -2
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +3 -2
- package/dist/plugin.mjs.map +1 -1
- package/dist/runtime/errors.cjs +0 -1
- package/dist/runtime/errors.cjs.map +1 -1
- package/dist/runtime/errors.d.cts +3 -5
- package/dist/runtime/errors.d.cts.map +1 -1
- package/dist/runtime/errors.d.mts +3 -5
- package/dist/runtime/errors.d.mts.map +1 -1
- package/dist/runtime/errors.mjs.map +1 -1
- package/dist/runtime/index.cjs +4 -2
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts +0 -1
- package/dist/runtime/index.d.cts.map +1 -1
- package/dist/runtime/index.d.mts +0 -1
- package/dist/runtime/index.d.mts.map +1 -1
- package/dist/runtime/index.mjs +4 -1
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/mf-config.cjs +1 -2
- package/dist/runtime/mf-config.cjs.map +1 -1
- package/dist/runtime/mf-config.d.cts.map +1 -1
- package/dist/runtime/mf-config.d.mts.map +1 -1
- package/dist/runtime/mf-config.mjs +1 -1
- package/dist/runtime/mf-config.mjs.map +1 -1
- package/dist/runtime/services/module-federation.service.cjs +0 -1
- package/dist/runtime/services/module-federation.service.cjs.map +1 -1
- package/dist/runtime/services/module-federation.service.d.cts +0 -1
- package/dist/runtime/services/module-federation.service.d.cts.map +1 -1
- package/dist/runtime/services/module-federation.service.d.mts +0 -1
- package/dist/runtime/services/module-federation.service.d.mts.map +1 -1
- package/dist/runtime/services/module-federation.service.mjs.map +1 -1
- package/dist/runtime/services/normalize.cjs.map +1 -1
- package/dist/runtime/services/normalize.d.cts.map +1 -1
- package/dist/runtime/services/normalize.d.mts.map +1 -1
- package/dist/runtime/services/normalize.mjs.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.cjs +0 -1
- package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts +0 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.mts +0 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.cjs +2 -2
- package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.d.cts +1 -2
- package/dist/runtime/services/plugin-loader.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin-loader.service.d.mts +1 -2
- package/dist/runtime/services/plugin-loader.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin-loader.service.mjs +2 -1
- package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
- package/dist/runtime/services/plugin.service.cjs +0 -1
- package/dist/runtime/services/plugin.service.cjs.map +1 -1
- package/dist/runtime/services/plugin.service.d.cts +5 -6
- package/dist/runtime/services/plugin.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin.service.d.mts +5 -6
- package/dist/runtime/services/plugin.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin.service.mjs.map +1 -1
- package/dist/runtime/services/secrets.service.cjs.map +1 -1
- package/dist/runtime/services/secrets.service.d.cts +1 -2
- package/dist/runtime/services/secrets.service.d.cts.map +1 -1
- package/dist/runtime/services/secrets.service.d.mts +1 -2
- package/dist/runtime/services/secrets.service.d.mts.map +1 -1
- package/dist/runtime/services/secrets.service.mjs.map +1 -1
- package/dist/runtime/validation.cjs +0 -1
- package/dist/runtime/validation.cjs.map +1 -1
- package/dist/runtime/validation.mjs.map +1 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +2 -1
- package/dist/testing/index.d.cts.map +1 -1
- package/dist/testing/index.d.mts +2 -1
- package/dist/testing/index.d.mts.map +1 -1
- package/dist/testing/index.mjs.map +1 -1
- package/dist/types.d.cts +1 -2
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +1 -2
- package/dist/types.d.mts.map +1 -1
- package/package.json +5 -5
- package/src/plugin.ts +3 -1
- package/src/runtime/services/plugin-loader.service.ts +2 -1
|
@@ -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 handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n if (runtime) await runtime.shutdown();\n };\n\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n const formatted = formatORPCError(error);\n if (formatted) console.error(formatted);\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 const formatted = formatORPCError(error);\n if (formatted) console.error(formatted);\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,a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D,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 handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n if (runtime) await runtime.shutdown();\n };\n\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n const formatted = formatORPCError(error);\n if (formatted) console.error(formatted);\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 const formatted = formatORPCError(error);\n if (formatted) console.error(formatted);\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;AAClC;AAEA,MAAM,oBAAoB,QAAa;CACrC,OAAO,QAAQ,WAAW,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EACpD,IAAI,UAAU,KAAK,KAAK;CAC1B,CAAC;AACH;AAEA,MAAM,mBAAmB,WAA4B;CACnD,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,UAAU,OAAO,QAAQ,cAAc,EAAE;CAC/C,OAAO,UAAU,IAAI,YAAY;AACnC;AAEA,SAAgB,sBACd,WACA,YACA,WACA,MACA;CACA,MAAM,YAAY,gBAAgB,WAAW,MAAM;CACnD,MAAM,WAAmC;EAAE,KAAK;EAAM,KAAK;CAAK;CAChE,IAAI,UAAwC;CAE5C,MAAM,iBAAiB,YAAY;EACjC,IAAI,SAAS;GACX,MAAM,QAAQ;GACd,UAAU;EACZ;CACF;CAEA,CAAC,YAAY;EACX,MAAM,eAAe;EAErB,IAAI;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,iBACnC,EACF,EACF,CAAC;GAKD,MAAM,SAAS,MAAM,QAAQ,UAAU,UAAW,WAAW,UAAU;IAH/C,WAAW,CAAC;IAAG,SAAS,CAAC;GAGkC,CAAS;GAE5F,UAA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,KAAK,UAAU;GAC1C,CAAC;GAED,IAAI,OAAO,UAAU;IACnB,IAAI,OAAO,OAAO,SAAS,MAAM;IACjC,OAAO,SAAS,QAAQ,SAAS,OAAe,QAAgB;KAC9D,IAAI,UAAU,KAAK,KAAK;IAC1B,CAAC;IACD,MAAM,OAAO,MAAM,OAAO,SAAS,KAAK;IACxC,IAAI,KAAK,IAAI;GACf,OACE,IAAI,OAAO,GAAG,CAAC,CAAC,KAAK,WAAW;EAEpC,SAAS,OAAO;GACd,QAAQ,MAAM,cAAc,KAAK;GACjC,IAAI,OAAO,GAAG,CAAC,CAAC,KAAK,EAAE,OAAQ,MAAgB,QAAQ,CAAC;EAC1D;CACF,CAAC;CAED,UAAU,IAAI,IAAI,QAAQ,gBAAgB;CAC1C,UAAU,IAAI,IAAI,UAAU,gBAAgB;AAC9C"}
|
|
@@ -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 handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n if (runtime) await runtime.shutdown();\n };\n\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n const formatted = formatORPCError(error);\n if (formatted) console.error(formatted);\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 const formatted = formatORPCError(error);\n if (formatted) console.error(formatted);\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;CACp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middleware.mjs","names":[],"sources":["../../../src/build/rspack/dev-server-middleware.ts"],"sourcesContent":["import type { PluginInfo } from \"./utils\";\n\nconst corsHeaders = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, POST, PUT, DELETE, PATCH, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"X-Requested-With, content-type, Authorization\",\n};\n\nconst applyCorsHeaders = (res: any) => {\n Object.entries(corsHeaders).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n};\n\nconst normalizePrefix = (prefix?: string): string => {\n if (!prefix) return \"\";\n const cleaned = prefix.replace(/^\\/+|\\/+$/g, \"\");\n return cleaned ? `/${cleaned}` : \"\";\n};\n\nexport function setupPluginMiddleware(\n devServer: any,\n pluginInfo: PluginInfo,\n devConfig: any,\n port: number,\n) {\n const rpcPrefix = normalizePrefix(devConfig?.prefix);\n const handlers: { rpc: any; api: any } = { rpc: null, api: null };\n let cleanup: (() => Promise<void>) | null = null;\n\n const performCleanup = async () => {\n if (cleanup) {\n await cleanup();\n cleanup = null;\n }\n };\n\n (async () => {\n await performCleanup();\n\n try {\n const { createPluginRuntime } = await import(\"every-plugin\");\n const { RPCHandler } = await import(\"@orpc/server/fetch\");\n const { OpenAPIHandler } = await import(\"@orpc/openapi/fetch\");\n const { OpenAPIReferencePlugin } = await import(\"@orpc/openapi/plugins\");\n const { ZodToJsonSchemaConverter } = await import(\"@orpc/zod/zod4\");\n const { onError } = await import(\"every-plugin/orpc\");\n const { formatORPCError } = await import(\"every-plugin/errors\");\n\n const pluginId = devConfig?.pluginId || pluginInfo.normalizedName;\n\n const runtime = createPluginRuntime({\n registry: {\n [pluginId]: {\n remote: `http://localhost:${port}/remoteEntry.js`,\n },\n },\n });\n\n const defaultConfig = { variables: {}, secrets: {} };\n\n // @ts-expect-error we don't know the plugin id\n const loaded = await runtime.usePlugin(pluginId, (devConfig?.config ?? defaultConfig) as any);\n\n cleanup = async () => {\n handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n if (runtime) await runtime.shutdown();\n };\n\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n const formatted = formatORPCError(error);\n if (formatted) console.error(formatted);\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 const formatted = formatORPCError(error);\n if (formatted) console.error(formatted);\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;AAClC;AAEA,MAAM,oBAAoB,QAAa;CACrC,OAAO,QAAQ,WAAW,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EACpD,IAAI,UAAU,KAAK,KAAK;CAC1B,CAAC;AACH;AAEA,MAAM,mBAAmB,WAA4B;CACnD,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,UAAU,OAAO,QAAQ,cAAc,EAAE;CAC/C,OAAO,UAAU,IAAI,YAAY;AACnC;AAEA,SAAgB,sBACd,WACA,YACA,WACA,MACA;CACA,MAAM,YAAY,gBAAgB,WAAW,MAAM;CACnD,MAAM,WAAmC;EAAE,KAAK;EAAM,KAAK;CAAK;CAChE,IAAI,UAAwC;CAE5C,MAAM,iBAAiB,YAAY;EACjC,IAAI,SAAS;GACX,MAAM,QAAQ;GACd,UAAU;EACZ;CACF;CAEA,CAAC,YAAY;EACX,MAAM,eAAe;EAErB,IAAI;GACF,MAAM,EAAE,wBAAwB,MAAM,OAAO;GAC7C,MAAM,EAAE,eAAe,MAAM,OAAO;GACpC,MAAM,EAAE,mBAAmB,MAAM,OAAO;GACxC,MAAM,EAAE,2BAA2B,MAAM,OAAO;GAChD,MAAM,EAAE,6BAA6B,MAAM,OAAO;GAClD,MAAM,E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AM,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;GACnE,CAAgB;GAEhB,MAAM,SAAS,MAAM,WAAW,OAAO,YAAY;IACjD,QAAQ,WAAW;IACnB,SAAS,gBAAgB,KAAK,UAAU;GAC1C,CAAC;GAED,IAAI,OAAO,UAAU;IACnB,IAAI,OAAO,OAAO,SAAS,MAAM;IACjC,OAAO,SAAS,QAAQ,SAAS,OAAe,QAAgB;KAC9D,IAAI,UAAU,KAAK,KAAK;IAC1B,CAAC;IACD,MAAM,OAAO,MAAM,OAAO,SAAS,KAAK;IACxC,IAAI,KAAK,IAAI;GACf,OACE,IAAI,OAAO,GAAG,CAAC,CAAC,KAAK,WAAW;EAEpC,SAAS,OAAO;GACd,QAAQ,MAAM,cAAc,KAAK;GACjC,IAAI,OAAO,GAAG,CAAC,CAAC,KAAK,EAAE,OAAQ,MAAgB,QAAQ,CAAC;EAC1D;CACF,CAAC;CAED,UAAU,IAAI,IAAI,QAAQ,gBAAgB;CAC1C,UAAU,IAAI,IAAI,UAAU,gBAAgB;AAC9C"}
|
|
@@ -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;
|
|
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;EACxB,SAAS,MAAM,YAAY,IAAI,KAAK,OAAO,cAAc,EAAE,0BAA0B;GACnF,oBAAoB,MAAM,cAAc,IAAI,KAAK,OAAO,gBAAgB;IACtE,IAAI,CAAC,aAAa,SAAS;IAC3B,IAAI,CAAC,YAAY,QAAQ,SAAS,kBAAkB,GAAG;IACvD,KAAK,gBAAgB,WAAW;GAClC,CAAC;EACH,CAAC;CACH;CAEA,AAAQ,gBAAgB,aAAkC;EACxD,MAAM,EAAE,YAAY;EACpB,MAAM,MAAM,QAAQ,QAAQ,kBAAkB;EAC9C,IAAI,QAAQ,IAAI;EAEhB,MAAM,eAAe,MAAM;EAC3B,MAAM,SAAS,QAAQ,UAAU,GAAG,YAAY;EAChD,MAAM,aAAa,QAAQ,UAAU,YAAY;EAEjD,IAAI,iBAAiB,UAAU,GAAG;EAElC,MAAM,UAAU,WAAW,UAAU;EACrC,YAAY,UAAU,SAAS,mBAAmB,OAAO;CAC3D;AACF;AAEA,SAAS,iBAAiB,SAA0B;CAClD,IAAI;EAEF,OADgB,mBAAmB,OACtB,MAAM;CACrB,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,WAAW,SAAyB;CAC3C,IAAI;EACF,OAAO,mBAAmB,OAAO;CACnC,QAAQ;EACN,OAAO,QAAQ,QAAQ,wBAAwB,KAAK;CACtD;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix-mf-data-uri-plugin.d.cts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"fix-mf-data-uri-plugin.d.cts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;cAIa,8BAA8B;EACzC;EAEA,MAAM,UAAU;UAUR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix-mf-data-uri-plugin.d.mts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"fix-mf-data-uri-plugin.d.mts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;cAIa,8BAA8B;EACzC;EAEA,MAAM,UAAU;UAUR"}
|
|
@@ -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;
|
|
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;EACxB,SAAS,MAAM,YAAY,IAAI,KAAK,OAAO,cAAc,EAAE,0BAA0B;GACnF,oBAAoB,MAAM,cAAc,IAAI,KAAK,OAAO,gBAAgB;IACtE,IAAI,CAAC,aAAa,SAAS;IAC3B,IAAI,CAAC,YAAY,QAAQ,SAAS,kBAAkB,GAAG;IACvD,KAAK,gBAAgB,WAAW;GAClC,CAAC;EACH,CAAC;CACH;CAEA,AAAQ,gBAAgB,aAAkC;EACxD,MAAM,EAAE,YAAY;EACpB,MAAM,MAAM,QAAQ,QAAQ,kBAAkB;EAC9C,IAAI,QAAQ,IAAI;EAEhB,MAAM,eAAe,MAAM;EAC3B,MAAM,SAAS,QAAQ,UAAU,GAAG,YAAY;EAChD,MAAM,aAAa,QAAQ,UAAU,YAAY;EAEjD,IAAI,iBAAiB,UAAU,GAAG;EAElC,MAAM,UAAU,WAAW,UAAU;EACrC,YAAY,UAAU,SAAS,mBAAmB,OAAO;CAC3D;AACF;AAEA,SAAS,iBAAiB,SAA0B;CAClD,IAAI;EAEF,OADgB,mBAAmB,OACtB,MAAM;CACrB,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,WAAW,SAAyB;CAC3C,IAAI;EACF,OAAO,mBAAmB,OAAO;CACnC,QAAQ;EACN,OAAO,QAAQ,QAAQ,wBAAwB,KAAK;CACtD;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-federation.cjs","names":["getPluginSharedDependencies"],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../shared-deps\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;
|
|
1
|
+
{"version":3,"file":"module-federation.cjs","names":["getPluginSharedDependencies"],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../shared-deps\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;CAC/D,OAAOA,sDAA4B;AACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-federation.mjs","names":[],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../shared-deps\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;
|
|
1
|
+
{"version":3,"file":"module-federation.mjs","names":[],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../shared-deps\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;CAC/D,OAAO,4BAA4B;AACrC"}
|
|
@@ -12,6 +12,7 @@ let _module_federation_enhanced_rspack = require("@module-federation/enhanced/rs
|
|
|
12
12
|
|
|
13
13
|
//#region src/build/rspack/plugin.ts
|
|
14
14
|
var EmitPluginManifest = class {
|
|
15
|
+
options;
|
|
15
16
|
name = "EmitPluginManifest";
|
|
16
17
|
constructor(options = {}) {
|
|
17
18
|
this.options = options;
|
|
@@ -98,6 +99,7 @@ var EmitPluginManifest = class {
|
|
|
98
99
|
}
|
|
99
100
|
};
|
|
100
101
|
var EveryPluginDevServer = class {
|
|
102
|
+
options;
|
|
101
103
|
name = "EveryPluginDevServer";
|
|
102
104
|
constructor(options = {}) {
|
|
103
105
|
this.options = options;
|
|
@@ -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":";;;;;;;;;;;;;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,WAAW,SAAS,CAC1B,QAAO;AAGT,SAAI,CADUA,gBAAG,SAAS,SAChB,CAAC,QAAQ,CACjB,QAAO;AAET,SAAI;AACF,aAAO,MAAMA,gBAAG,SAAS,SAAS,UAAU,OAAO;aAC7C;AACN,aAAO;;;AAIX,oBAAiB,MAAM,YAAY,mBAAmB,IAAK;AAE3D,QAAI,CAAC,eAAe;KAClB,MAAM,aAAa,QAAQ,MAAM,IAAI,CAAC,KAAK;KAC3C,MAAM,aAAaD,kBAAK,KAAK,SAAS,SAAS,cAAc,IAAI,OAAO,iBAAiB;AAEzF,qBAAiB,MAAM,YAAY,WAAW,IAAK;AAEnD,SA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AAgB,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
|
+
{"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;CAG1C;CAFpB,OAAO;CAEP,YAAY,AAAQ,UAAwC,CAAC,GAAG;EAA5C;CAA6C;CAEjE,MAAM,UAAoB;EACxB,SAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;GAEtE,YAAY,MAAM,cAAc,WAAW;IAAE,MAAM,KAAK;IAAM;GAAM,GAAG,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,IAAI;IACxD,MAAM,aAAaA,4BAAc,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;EACF;EAEA,SAAS,QAAQ,UAAU,oBAAoB,aAAa,cAAc;GACxE,oDAAsB,WAAW,YAAY,WAAW,IAAI;GAC5D,OAAO,gBAAgB,cAAc,aAAa,SAAS,IAAI;EACjE;CACF;AACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Compiler, RspackPluginInstance } from "@rspack/core";
|
|
2
|
-
|
|
3
2
|
//#region src/build/rspack/plugin.d.ts
|
|
4
3
|
interface EveryPluginOptions {
|
|
5
4
|
devConfigPath?: string;
|
|
@@ -32,5 +31,5 @@ declare class EveryPluginDevServer implements RspackPluginInstance {
|
|
|
32
31
|
private configureDevServer;
|
|
33
32
|
}
|
|
34
33
|
//#endregion
|
|
35
|
-
export { EmitPluginManifest, EveryPluginDevServer, EveryPluginOptions, PluginManifestEmitterOptions };
|
|
34
|
+
export { AdditionalExport, EmitPluginManifest, EveryPluginDevServer, EveryPluginOptions, PluginManifestEmitterOptions };
|
|
36
35
|
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":";;UASiB;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA,oBAAoB;;cAGT,8BAA8B;UAGrB;EAFpB;EAEoB,YAAA,UAAS;EAE7B,MAAM,UAAU;;cAiHL,gCAAgC;UAGvB;EAFpB;EAEoB,YAAA,UAAS;EAE7B,MAAM,UAAU;UAqCR;UA6DA;UA2BA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Compiler, RspackPluginInstance } from "@rspack/core";
|
|
2
|
-
|
|
3
2
|
//#region src/build/rspack/plugin.d.ts
|
|
4
3
|
interface EveryPluginOptions {
|
|
5
4
|
devConfigPath?: string;
|
|
@@ -32,5 +31,5 @@ declare class EveryPluginDevServer implements RspackPluginInstance {
|
|
|
32
31
|
private configureDevServer;
|
|
33
32
|
}
|
|
34
33
|
//#endregion
|
|
35
|
-
export { EmitPluginManifest, EveryPluginDevServer, EveryPluginOptions, PluginManifestEmitterOptions };
|
|
34
|
+
export { AdditionalExport, EmitPluginManifest, EveryPluginDevServer, EveryPluginOptions, PluginManifestEmitterOptions };
|
|
36
35
|
//# sourceMappingURL=plugin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":";;UASiB;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA,oBAAoB;;cAGT,8BAA8B;UAGrB;EAFpB;EAEoB,YAAA,UAAS;EAE7B,MAAM,UAAU;;cAiHL,gCAAgC;UAGvB;EAFpB;EAEoB,YAAA,UAAS;EAE7B,MAAM,UAAU;UAqCR;UA6DA;UA2BA"}
|
|
@@ -9,6 +9,7 @@ import { ModuleFederationPlugin } from "@module-federation/enhanced/rspack";
|
|
|
9
9
|
|
|
10
10
|
//#region src/build/rspack/plugin.ts
|
|
11
11
|
var EmitPluginManifest = class {
|
|
12
|
+
options;
|
|
12
13
|
name = "EmitPluginManifest";
|
|
13
14
|
constructor(options = {}) {
|
|
14
15
|
this.options = options;
|
|
@@ -95,6 +96,7 @@ var EmitPluginManifest = class {
|
|
|
95
96
|
}
|
|
96
97
|
};
|
|
97
98
|
var EveryPluginDevServer = class {
|
|
99
|
+
options;
|
|
98
100
|
name = "EveryPluginDevServer";
|
|
99
101
|
constructor(options = {}) {
|
|
100
102
|
this.options = options;
|
|
@@ -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)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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
|
+
{"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;CAG1C;CAFpB,OAAO;CAEP,YAAY,AAAQ,UAAwC,CAAC,GAAG;EAA5C;CAA6C;CAEjE,MAAM,UAAoB;EACxB,SAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;GAEtE,YAAY,MAAM,cAAc,WAAW;IAAE,MAAM,KAAK;IAAM;GAAM,GAAG,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,IAAI;IACxD,MAAM,aAAa,cAAc,OAAO;IACxC,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAC1D,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAE1D,MAAM,qBAAqB,KAAK,KAAK,SAAS,SAAS,gBAAgB;IAEvE,IAAI;IAEJ,MAAM,cAAc,OAAO,aAA6C;KACtE,IAAI,CAAC,GAAG,WAAW,QAAQ,GACzB,OAAO;KAGT,IAAI,CADU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B;CACF;CAEA,AAAQ,uBAAuB,UAAoB;EACjD,IAAI,CAAC,SAAS,QAAQ,QACpB,SAAS,QAAQ,SAAS,EAAE,OAAO,CAAC,EAAE;EAGxC,IAAI,CAAC,SAAS,QAAQ,OAAO,OAC3B,SAAS,QAAQ,OAAO,QAAQ,CAAC;EAYnC,IAAI,CATgB,SAAS,QAAQ,OAAO,MAAM,MAC/C,SACC,OAAO,SAAS,YAChB,SAAS,QACT,UAAU,QACV,KAAK,gBAAgB,UACrB,KAAK,KAAK,KAAK,KAAK,CAGT,GACb,SAAS,QAAQ,OAAO,MAAM,KAAK;GACjC,MAAM;GACN,KAAK;GACL,SAAS;EACX,CAAC;CAEL;CAEA,AAAQ,mBAAmB,UAAoB,YAAiB,WAAgB,MAAc;EAC5F,IAAI,CAAC,SAAS,QAAQ,WACpB;EAGF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,IAAI;EACxD,MAAM,gBAAgB,SAAS,QAAQ,UAAU;EAEjD,SAAS,QAAQ,UAAU,OAAO;EAClC,SAAS,QAAQ,UAAU,SAAS,KAAK,KAAK,SAAS,MAAM;EAC7D,SAAS,QAAQ,UAAU,MAAM;EACjC,SAAS,QAAQ,UAAU,gBAAgB,EAAE,aAAa,KAAK;EAC/D,SAAS,QAAQ,UAAU,UAAU;GACnC,+BAA+B;GAC/B,gCAAgC;GAChC,gCAAgC;EAClC;EAEA,SAAS,QAAQ,UAAU,SAAS;GAClC,SAAS;GACT,SAAS;IACP,UAAU;IACV,QAAQ;GACV;EACF;EAEA,SAAS,QAAQ,UAAU,oBAAoB,aAAa,cAAc;GACxE,sBAAsB,WAAW,YAAY,WAAW,IAAI;GAC5D,OAAO,gBAAgB,cAAc,aAAa,SAAS,IAAI;EACjE;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["path","fs","getNormalizedRemoteName"],"sources":["../../../src/build/rspack/utils.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { getNormalizedRemoteName } from \"every-plugin/normalize\";\n\nexport interface PluginInfo {\n name: string;\n version: string;\n normalizedName: string;\n dependencies: Record<string, string>;\n peerDependencies: Record<string, string>;\n}\n\nexport function getPluginInfo(context: string): PluginInfo {\n const pkgPath = path.join(context, \"package.json\");\n const pkg = JSON.parse(fs.readFileSync(pkgPath, \"utf-8\"));\n\n return {\n name: pkg.name,\n version: pkg.version,\n normalizedName: getNormalizedRemoteName(pkg.name),\n dependencies: pkg.dependencies || {},\n peerDependencies: pkg.peerDependencies || {},\n };\n}\n\nconst loadedModules = new Set<string>();\n\nexport function loadDevConfig(devConfigPath: string) {\n if (process.env.DEPLOY === \"true\") {\n return null;\n }\n\n try {\n const fullPath = path.resolve(devConfigPath);\n\n if (loadedModules.has(fullPath)) {\n delete require.cache[fullPath];\n const dirPath = path.dirname(fullPath);\n for (const key of Object.keys(require.cache)) {\n if (key.startsWith(dirPath) && key !== fullPath) {\n delete require.cache[key];\n }\n }\n }\n\n const module = require(fullPath).default;\n loadedModules.add(fullPath);\n return module;\n } catch (error) {\n console.warn(`Could not load dev config from ${devConfigPath}:`, (error as Error).message);\n return null;\n }\n}\n\nexport function cleanupDevConfig() {\n for (const modulePath of loadedModules) {\n delete require.cache[modulePath];\n }\n loadedModules.clear();\n}\n"],"mappings":";;;;;;;;AAYA,SAAgB,cAAc,SAA6B;CACzD,MAAM,UAAUA,kBAAK,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["path","fs","getNormalizedRemoteName"],"sources":["../../../src/build/rspack/utils.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { getNormalizedRemoteName } from \"every-plugin/normalize\";\n\nexport interface PluginInfo {\n name: string;\n version: string;\n normalizedName: string;\n dependencies: Record<string, string>;\n peerDependencies: Record<string, string>;\n}\n\nexport function getPluginInfo(context: string): PluginInfo {\n const pkgPath = path.join(context, \"package.json\");\n const pkg = JSON.parse(fs.readFileSync(pkgPath, \"utf-8\"));\n\n return {\n name: pkg.name,\n version: pkg.version,\n normalizedName: getNormalizedRemoteName(pkg.name),\n dependencies: pkg.dependencies || {},\n peerDependencies: pkg.peerDependencies || {},\n };\n}\n\nconst loadedModules = new Set<string>();\n\nexport function loadDevConfig(devConfigPath: string) {\n if (process.env.DEPLOY === \"true\") {\n return null;\n }\n\n try {\n const fullPath = path.resolve(devConfigPath);\n\n if (loadedModules.has(fullPath)) {\n delete require.cache[fullPath];\n const dirPath = path.dirname(fullPath);\n for (const key of Object.keys(require.cache)) {\n if (key.startsWith(dirPath) && key !== fullPath) {\n delete require.cache[key];\n }\n }\n }\n\n const module = require(fullPath).default;\n loadedModules.add(fullPath);\n return module;\n } catch (error) {\n console.warn(`Could not load dev config from ${devConfigPath}:`, (error as Error).message);\n return null;\n }\n}\n\nexport function cleanupDevConfig() {\n for (const modulePath of loadedModules) {\n delete require.cache[modulePath];\n }\n loadedModules.clear();\n}\n"],"mappings":";;;;;;;;AAYA,SAAgB,cAAc,SAA6B;CACzD,MAAM,UAAUA,kBAAK,KAAK,SAAS,cAAc;CACjD,MAAM,MAAM,KAAK,MAAMC,gBAAG,aAAa,SAAS,OAAO,CAAC;CAExD,OAAO;EACL,MAAM,IAAI;EACV,SAAS,IAAI;EACb,gBAAgBC,2DAAwB,IAAI,IAAI;EAChD,cAAc,IAAI,gBAAgB,CAAC;EACnC,kBAAkB,IAAI,oBAAoB,CAAC;CAC7C;AACF;AAEA,MAAM,gCAAgB,IAAI,IAAY;AAEtC,SAAgB,cAAc,eAAuB;CACnD,IAAI,QAAQ,IAAI,WAAW,QACzB,OAAO;CAGT,IAAI;EACF,MAAM,WAAWF,kBAAK,QAAQ,aAAa;EAE3C,IAAI,cAAc,IAAI,QAAQ,GAAG;GAC/B,OAAO,QAAQ,MAAM;GACrB,MAAM,UAAUA,kBAAK,QAAQ,QAAQ;GACrC,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,KAAK,GACzC,IAAI,IAAI,WAAW,OAAO,KAAK,QAAQ,UACrC,OAAO,QAAQ,MAAM;EAG3B;EAEA,MAAM,SAAS,QAAQ,QAAQ,CAAC,CAAC;EACjC,cAAc,IAAI,QAAQ;EAC1B,OAAO;CACT,SAAS,OAAO;EACd,QAAQ,KAAK,kCAAkC,cAAc,IAAK,MAAgB,OAAO;EACzF,OAAO;CACT;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/build/rspack/utils.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { getNormalizedRemoteName } from \"every-plugin/normalize\";\n\nexport interface PluginInfo {\n name: string;\n version: string;\n normalizedName: string;\n dependencies: Record<string, string>;\n peerDependencies: Record<string, string>;\n}\n\nexport function getPluginInfo(context: string): PluginInfo {\n const pkgPath = path.join(context, \"package.json\");\n const pkg = JSON.parse(fs.readFileSync(pkgPath, \"utf-8\"));\n\n return {\n name: pkg.name,\n version: pkg.version,\n normalizedName: getNormalizedRemoteName(pkg.name),\n dependencies: pkg.dependencies || {},\n peerDependencies: pkg.peerDependencies || {},\n };\n}\n\nconst loadedModules = new Set<string>();\n\nexport function loadDevConfig(devConfigPath: string) {\n if (process.env.DEPLOY === \"true\") {\n return null;\n }\n\n try {\n const fullPath = path.resolve(devConfigPath);\n\n if (loadedModules.has(fullPath)) {\n delete require.cache[fullPath];\n const dirPath = path.dirname(fullPath);\n for (const key of Object.keys(require.cache)) {\n if (key.startsWith(dirPath) && key !== fullPath) {\n delete require.cache[key];\n }\n }\n }\n\n const module = require(fullPath).default;\n loadedModules.add(fullPath);\n return module;\n } catch (error) {\n console.warn(`Could not load dev config from ${devConfigPath}:`, (error as Error).message);\n return null;\n }\n}\n\nexport function cleanupDevConfig() {\n for (const modulePath of loadedModules) {\n delete require.cache[modulePath];\n }\n loadedModules.clear();\n}\n"],"mappings":";;;;;;AAYA,SAAgB,cAAc,SAA6B;CACzD,MAAM,UAAU,KAAK,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/build/rspack/utils.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { getNormalizedRemoteName } from \"every-plugin/normalize\";\n\nexport interface PluginInfo {\n name: string;\n version: string;\n normalizedName: string;\n dependencies: Record<string, string>;\n peerDependencies: Record<string, string>;\n}\n\nexport function getPluginInfo(context: string): PluginInfo {\n const pkgPath = path.join(context, \"package.json\");\n const pkg = JSON.parse(fs.readFileSync(pkgPath, \"utf-8\"));\n\n return {\n name: pkg.name,\n version: pkg.version,\n normalizedName: getNormalizedRemoteName(pkg.name),\n dependencies: pkg.dependencies || {},\n peerDependencies: pkg.peerDependencies || {},\n };\n}\n\nconst loadedModules = new Set<string>();\n\nexport function loadDevConfig(devConfigPath: string) {\n if (process.env.DEPLOY === \"true\") {\n return null;\n }\n\n try {\n const fullPath = path.resolve(devConfigPath);\n\n if (loadedModules.has(fullPath)) {\n delete require.cache[fullPath];\n const dirPath = path.dirname(fullPath);\n for (const key of Object.keys(require.cache)) {\n if (key.startsWith(dirPath) && key !== fullPath) {\n delete require.cache[key];\n }\n }\n }\n\n const module = require(fullPath).default;\n loadedModules.add(fullPath);\n return module;\n } catch (error) {\n console.warn(`Could not load dev config from ${devConfigPath}:`, (error as Error).message);\n return null;\n }\n}\n\nexport function cleanupDevConfig() {\n for (const modulePath of loadedModules) {\n delete require.cache[modulePath];\n }\n loadedModules.clear();\n}\n"],"mappings":";;;;;;AAYA,SAAgB,cAAc,SAA6B;CACzD,MAAM,UAAU,KAAK,KAAK,SAAS,cAAc;CACjD,MAAM,MAAM,KAAK,MAAM,GAAG,aAAa,SAAS,OAAO,CAAC;CAExD,OAAO;EACL,MAAM,IAAI;EACV,SAAS,IAAI;EACb,gBAAgB,wBAAwB,IAAI,IAAI;EAChD,cAAc,IAAI,gBAAgB,CAAC;EACnC,kBAAkB,IAAI,oBAAoB,CAAC;CAC7C;AACF;AAEA,MAAM,gCAAgB,IAAI,IAAY;AAEtC,SAAgB,cAAc,eAAuB;CACnD,IAAI,QAAQ,IAAI,WAAW,QACzB,OAAO;CAGT,IAAI;EACF,MAAM,WAAW,KAAK,QAAQ,aAAa;EAE3C,IAAI,cAAc,IAAI,QAAQ,GAAG;GAC/B,iBAAe,MAAM;GACrB,MAAM,UAAU,KAAK,QAAQ,QAAQ;GACrC,KAAK,MAAM,OAAO,OAAO,eAAa,KAAK,GACzC,IAAI,IAAI,WAAW,OAAO,KAAK,QAAQ,UACrC,iBAAe,MAAM;EAG3B;EAEA,MAAM,mBAAiB,QAAQ,CAAC,CAAC;EACjC,cAAc,IAAI,QAAQ;EAC1B,OAAO;CACT,SAAS,OAAO;EACd,QAAQ,KAAK,kCAAkC,cAAc,IAAK,MAAgB,OAAO;EACzF,OAAO;CACT;AACF"}
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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,8GAAiD,CAAC;AACxD,MAAMC,wFAAuC;AAE7C,IAAI;AAEJ,IAAI;CACF,MAAM,KAAK,oDAAwBD,aAAW,oBAAoB,GAAG,OAAO,CAAC;AAC/E,QAAQ;CACN,MAAMC,UAAQ,2BAA2B;AAC3C;AAaA,MAAM,uBAAgE;CACpE,iBAAiB;CACjB,WAAW;CACX,eAAe;CACf,OAAO;CACP,YAAY;AACd;AAEA,SAAS,oBAAoB,OAAuB;CAClD,MAAM,QAAQ,MAAM,MAAM,mCAAmC;CA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AAO,OAAO;CACnB,OAAO,IAAI,MAAM,GAAG,GAAG,MAAM,GAAG;AAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-deps.d.cts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB
|
|
1
|
+
{"version":3,"file":"shared-deps.d.cts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB;EACf;EACA;EACA;EACA;EACA;EACA;;KAGU,qBAAqB,eAAe;cAgCnC;;IAvCM;IACN;IACI;IACR;IACK;;;;IAJK;IACN;IACI;IACR;IACK;;;;IAJK;IACN;IACI;IACR;IACK;;;;IAJK;IACN;IACI;IACR;IACK;;;;IAJK;IACN;IACI;IACR;IACK;;;;IAJK;IACN;IACI;IACR;IACK;;;;KA2DF,0CAA0C;iBAEtC,+BAA+B;iBAI/B,2CAA2C;iBAS3C,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-deps.d.mts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB
|
|
1
|
+
{"version":3,"file":"shared-deps.d.mts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB;EACf;EACA;EACA;EACA;EACA;EACA;;KAGU,qBAAqB,eAAe;cAgCnC;;IAvCM;IACN;IACI;IACR;IACK;;;;IAJK;IACN;IACI;IACR;IACK;;;;IAJK;IACN;IACI;IACR;IACK;;;;IAJK;IACN;IACI;IACR;IACK;;;;IAJK;IACN;IACI;IACR;IACK;;;;IAJK;IACN;IACI;IACR;IACK;;;;KA2DF,0CAA0C;iBAEtC,+BAA+B;iBAI/B,2CAA2C;iBAS3C,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-deps.mjs","names":[],"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,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"shared-deps.mjs","names":[],"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,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,GAAG,CAAC;AACxD,MAAM,UAAU,cAAc,OAAO,KAAK,GAAG;AAE7C,IAAI;AAEJ,IAAI;CACF,MAAM,KAAK,MAAM,aAAa,KAAK,WAAW,oBAAoB,GAAG,OAAO,CAAC;AAC/E,QAAQ;CACN,MAAM,QAAQ,2BAA2B;AAC3C;AAaA,MAAM,uBAAgE;CACpE,iBAAiB;CACjB,WAAW;CACX,eAAe;CACf,OAAO;CACP,YAAY;AACd;AAEA,SAAS,oBAAoB,OAAuB;CAClD,MAAM,QAAQ,MAAM,MAAM,mCAAmC;CAC7D,OAAO,QAAQ,MAAM,KAAK,MAAM,QAAQ,gBAAgB,EAAE;AAC5D;AAEA,SAAS,2BAA2B,aAAqB,iBAAiC;CACxF,IAAI;EACF,IAAI,aAAa,QAAQ,QAAQ,QAAQ,WAAW,CAAC;EACrD,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG;GAC7B,MAAM,kBAAkB,KAAK,YAAY,cAAc;GACvD,IAAI,WAAW,eAAe,GAC5B,OAAQ,KAAK,MAAM,aAAa,iBAAiB,OAAO,CAAC,CAAC,CAAyB;GAErF,aAAa,QAAQ,UAAU;EACjC;EAEA,MAAM,IAAI,MAAM,2CAA2C,aAAa;CAC1E,QAAQ;EACN,OAAO,oBAAoB,eAAe;CAC5C;AACF;AAEA,MAAa,2BAA2B;CACtC,gBAAgB;EAAE,SAAS,IAAI;EAAS,GAAG;CAAqB;CAChE,QAAQ;EACN,SAAS,2BAA2B,UAAU,IAAI,iBAAiB,MAAM;EACzE,GAAG;CACL;CACA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