every-plugin 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,7 +38,7 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
38
38
  const { OpenAPIReferencePlugin } = await import("@orpc/openapi/plugins");
39
39
  const { ZodToJsonSchemaConverter } = await import("@orpc/zod/zod4");
40
40
  const pluginId = devConfig?.pluginId || pluginInfo.normalizedName;
41
- const runtime = createPluginRuntime({ registry: { [pluginId]: { remoteUrl: `http://localhost:${port}/remoteEntry.js` } } });
41
+ const runtime = createPluginRuntime({ registry: { [pluginId]: { remote: `http://localhost:${port}/remoteEntry.js` } } });
42
42
  const loaded = await runtime.usePlugin(pluginId, devConfig?.config);
43
43
  cleanup = async () => {
44
44
  if (loaded && typeof loaded.dispose === "function") await loaded.dispose();
@@ -163,8 +163,6 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
163
163
  res.status(500).json({ error: error.message });
164
164
  }
165
165
  };
166
- devServer.app.all("/api", handleApiRequest);
167
- devServer.app.all("/api/*", handleApiRequest);
168
166
  devServer.app.all(`/api/rpc${rpcPrefix}/*`, async (req, res) => {
169
167
  applyCorsHeaders(res);
170
168
  const rpcHandler = devServer.app.locals.handlers?.rpc;
@@ -194,6 +192,8 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
194
192
  res.status(500).json({ error: error.message });
195
193
  }
196
194
  });
195
+ devServer.app.all("/api", handleApiRequest);
196
+ devServer.app.all("/api/*", handleApiRequest);
197
197
  }
198
198
 
199
199
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server-middleware.cjs","names":["handlers: { rpc: any, api: any }","cleanup: (() => Promise<void>) | null","lines: string[]"],"sources":["../../../src/build/rspack/dev-server-middleware.ts"],"sourcesContent":["import type { PluginInfo } from './utils';\n\nconst corsHeaders = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',\n 'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'\n};\n\nconst applyCorsHeaders = (res: any) => {\n Object.entries(corsHeaders).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n};\n\nconst normalizePrefix = (prefix?: string): string => {\n if (!prefix) return '';\n const cleaned = prefix.replace(/^\\/+|\\/+$/g, '');\n return cleaned ? `/${cleaned}` : '';\n};\n\nexport function setupPluginMiddleware(devServer: any, pluginInfo: PluginInfo, devConfig: any, port: number) {\n const rpcPrefix = normalizePrefix(devConfig?.prefix);\n let handlers: { rpc: any, api: any } = { rpc: null, api: null };\n let cleanup: (() => Promise<void>) | null = null;\n\n const performCleanup = async () => {\n if (cleanup) {\n await cleanup();\n cleanup = null;\n }\n };\n\n (async () => {\n await performCleanup();\n\n try {\n const { createPluginRuntime } = await import('every-plugin');\n const { RPCHandler } = await import('@orpc/server/fetch');\n const { onError } = await import('@orpc/server');\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\n const pluginId = devConfig?.pluginId || pluginInfo.normalizedName;\n\n const runtime = createPluginRuntime({\n registry: {\n [pluginId]: {\n remoteUrl: `http://localhost:${port}/remoteEntry.js`\n }\n }\n });\n\n const loaded = await runtime.usePlugin(pluginId, devConfig?.config);\n\n cleanup = async () => {\n if (loaded && typeof (loaded as any).dispose === 'function') {\n await (loaded as any).dispose();\n }\n if (runtime && typeof (runtime as any).cleanup === 'function') {\n await (runtime as any).cleanup();\n }\n handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n };\n\n const formatError = (error: any, context: string) => {\n const lines: string[] = [`\\nšŸ”“ ${context} Error: ${error.message || 'Unknown error'}`];\n \n if (error.cause?.issues && Array.isArray(error.cause.issues)) {\n lines.push('\\nšŸ“‹ Validation Issues:');\n error.cause.issues.forEach((issue: any, index: number) => {\n lines.push(` ${index + 1}. ${issue.path?.join('.') || 'root'}`);\n lines.push(` ā”œā”€ Code: ${issue.code || 'unknown'}`);\n lines.push(` ā”œā”€ Message: ${issue.message || 'No message'}`);\n if (issue.expected !== undefined) {\n lines.push(` ā”œā”€ Expected: ${JSON.stringify(issue.expected)}`);\n }\n if (issue.received !== undefined) {\n lines.push(` └─ Received: ${JSON.stringify(issue.received)}`);\n } else {\n lines.push(` └─ (end)`);\n }\n });\n }\n \n if (error.data && typeof error.data === 'object' && Object.keys(error.data).length > 0) {\n lines.push('\\nšŸ“Š Error Data:');\n try {\n const dataStr = JSON.stringify(error.data, null, 2);\n dataStr.split('\\n').forEach(line => {\n lines.push(` ${line}`);\n });\n } catch {\n lines.push(` ${String(error.data)}`);\n }\n }\n \n if (error.cause?.data) {\n lines.push('\\nšŸ“¦ Request Data:');\n try {\n const dataStr = JSON.stringify(error.cause.data, null, 2);\n dataStr.split('\\n').forEach(line => {\n lines.push(` ${line}`);\n });\n } catch {\n lines.push(` ${String(error.cause.data)}`);\n }\n }\n \n if (error.code) {\n lines.push(`\\nāš ļø Error Code: ${error.code}`);\n }\n \n if (error.status) {\n lines.push(`šŸ“ Status: ${error.status}`);\n }\n \n lines.push('');\n console.error(lines.join('\\n'));\n };\n\n // @ts-expect-error no type\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n formatError(error, 'RPC');\n }),\n ]\n });\n\n // @ts-expect-error no type\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 formatError(error, 'OpenAPI');\n }),\n ]\n });\n\n console.log(`╭─────────────────────────────────────────────`);\n console.log(`│ āœ… Plugin dev server ready: `);\n console.log(`ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€`);\n console.log(`│ šŸ“” RPC: http://localhost:${port}/api/rpc${rpcPrefix}`);\n console.log(`│ šŸ“– Docs: http://localhost:${port}/api`);\n console.log(`│ šŸ’š Health: http://localhost:${port}/`);\n console.log(`╰─────────────────────────────────────────────`);\n\n devServer.app.locals.handlers = handlers;\n\n if (devServer.server) {\n devServer.server.once('close', async () => {\n await performCleanup();\n });\n }\n } catch (error) {\n console.error('āŒ Failed to load plugin:', error);\n await performCleanup();\n }\n })();\n\n process.once('SIGINT', async () => {\n await performCleanup();\n });\n process.once('SIGTERM', async () => {\n await performCleanup();\n });\n\n devServer.app.options('*', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.status(200).end();\n });\n\n devServer.app.get('/', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.json({\n ok: true,\n plugin: pluginInfo.normalizedName,\n version: pluginInfo.version,\n status: devServer.app.locals.handlers?.rpc ? 'ready' : 'loading',\n endpoints: {\n health: '/',\n docs: '/api',\n rpc: `/api/rpc${rpcPrefix}`\n }\n });\n });\n\n // OpenAPI documentation and REST endpoints at /api and /api/*\n const handleApiRequest = async (req: any, res: any) => {\n applyCorsHeaders(res);\n const apiHandler = devServer.app.locals.handlers?.api;\n if (!apiHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await apiHandler.handle(webRequest, {\n prefix: '/api',\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('OpenAPI error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n };\n\n devServer.app.all('/api', handleApiRequest);\n devServer.app.all('/api/*', handleApiRequest);\n\n devServer.app.all(`/api/rpc${rpcPrefix}/*`, async (req: any, res: any) => {\n applyCorsHeaders(res);\n const rpcHandler = devServer.app.locals.handlers?.rpc;\n if (!rpcHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await rpcHandler.handle(webRequest, {\n prefix: `/api/rpc${rpcPrefix}`,\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('RPC error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n });\n}\n"],"mappings":";;AAEA,MAAM,cAAc;CAClB,+BAA+B;CAC/B,gCAAgC;CAChC,gCAAgC;CACjC;AAED,MAAM,oBAAoB,QAAa;AACrC,QAAO,QAAQ,YAAY,CAAC,SAAS,CAAC,KAAK,WAAW;AACpD,MAAI,UAAU,KAAK,MAAM;GACzB;;AAGJ,MAAM,mBAAmB,WAA4B;AACnD,KAAI,CAAC,OAAQ,QAAO;CACpB,MAAM,UAAU,OAAO,QAAQ,cAAc,GAAG;AAChD,QAAO,UAAU,IAAI,YAAY;;AAGnC,SAAgB,sBAAsB,WAAgB,YAAwB,WAAgB,MAAc;CAC1G,MAAM,YAAY,gBAAgB,WAAW,OAAO;CACpD,IAAIA,WAAmC;EAAE,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,SAAS,EAAE;IACZ,CAAC;AAEF,OAAI,OAAO,UAAU;AACnB,QAAI,OAAO,OAAO,SAAS,OAAO;AAClC,WAAO,SAAS,QAAQ,SAAS,OAAe,QAAgB;AAC9D,SAAI,UAAU,KAAK,MAAM;MACzB;IACF,MAAM,OAAO,MAAM,OAAO,SAAS,MAAM;AACzC,QAAI,KAAK,KAAK;SAEd,KAAI,OAAO,IAAI,CAAC,KAAK,YAAY;WAE5B,OAAO;AACd,WAAQ,MAAM,cAAc,MAAM;AAClC,OAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAQ,MAAgB,SAAS,CAAC;;GAE3D"}
1
+ {"version":3,"file":"dev-server-middleware.cjs","names":["handlers: { rpc: any, api: any }","cleanup: (() => Promise<void>) | null","lines: string[]"],"sources":["../../../src/build/rspack/dev-server-middleware.ts"],"sourcesContent":["import type { PluginInfo } from './utils';\n\nconst corsHeaders = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',\n 'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'\n};\n\nconst applyCorsHeaders = (res: any) => {\n Object.entries(corsHeaders).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n};\n\nconst normalizePrefix = (prefix?: string): string => {\n if (!prefix) return '';\n const cleaned = prefix.replace(/^\\/+|\\/+$/g, '');\n return cleaned ? `/${cleaned}` : '';\n};\n\nexport function setupPluginMiddleware(devServer: any, pluginInfo: PluginInfo, devConfig: any, port: number) {\n const rpcPrefix = normalizePrefix(devConfig?.prefix);\n let handlers: { rpc: any, api: any } = { rpc: null, api: null };\n let cleanup: (() => Promise<void>) | null = null;\n\n const performCleanup = async () => {\n if (cleanup) {\n await cleanup();\n cleanup = null;\n }\n };\n\n (async () => {\n await performCleanup();\n\n try {\n const { createPluginRuntime } = await import('every-plugin');\n const { RPCHandler } = await import('@orpc/server/fetch');\n const { onError } = await import('@orpc/server');\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\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 loaded = await runtime.usePlugin(pluginId, devConfig?.config);\n\n cleanup = async () => {\n if (loaded && typeof (loaded as any).dispose === 'function') {\n await (loaded as any).dispose();\n }\n if (runtime && typeof (runtime as any).cleanup === 'function') {\n await (runtime as any).cleanup();\n }\n handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n };\n\n const formatError = (error: any, context: string) => {\n const lines: string[] = [`\\nšŸ”“ ${context} Error: ${error.message || 'Unknown error'}`];\n \n if (error.cause?.issues && Array.isArray(error.cause.issues)) {\n lines.push('\\nšŸ“‹ Validation Issues:');\n error.cause.issues.forEach((issue: any, index: number) => {\n lines.push(` ${index + 1}. ${issue.path?.join('.') || 'root'}`);\n lines.push(` ā”œā”€ Code: ${issue.code || 'unknown'}`);\n lines.push(` ā”œā”€ Message: ${issue.message || 'No message'}`);\n if (issue.expected !== undefined) {\n lines.push(` ā”œā”€ Expected: ${JSON.stringify(issue.expected)}`);\n }\n if (issue.received !== undefined) {\n lines.push(` └─ Received: ${JSON.stringify(issue.received)}`);\n } else {\n lines.push(` └─ (end)`);\n }\n });\n }\n \n if (error.data && typeof error.data === 'object' && Object.keys(error.data).length > 0) {\n lines.push('\\nšŸ“Š Error Data:');\n try {\n const dataStr = JSON.stringify(error.data, null, 2);\n dataStr.split('\\n').forEach(line => {\n lines.push(` ${line}`);\n });\n } catch {\n lines.push(` ${String(error.data)}`);\n }\n }\n \n if (error.cause?.data) {\n lines.push('\\nšŸ“¦ Request Data:');\n try {\n const dataStr = JSON.stringify(error.cause.data, null, 2);\n dataStr.split('\\n').forEach(line => {\n lines.push(` ${line}`);\n });\n } catch {\n lines.push(` ${String(error.cause.data)}`);\n }\n }\n \n if (error.code) {\n lines.push(`\\nāš ļø Error Code: ${error.code}`);\n }\n \n if (error.status) {\n lines.push(`šŸ“ Status: ${error.status}`);\n }\n \n lines.push('');\n console.error(lines.join('\\n'));\n };\n\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n formatError(error, 'RPC');\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 formatError(error, 'OpenAPI');\n }),\n ]\n });\n\n console.log(`╭─────────────────────────────────────────────`);\n console.log(`│ āœ… Plugin dev server ready: `);\n console.log(`ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€`);\n console.log(`│ šŸ“” RPC: http://localhost:${port}/api/rpc${rpcPrefix}`);\n console.log(`│ šŸ“– Docs: http://localhost:${port}/api`);\n console.log(`│ šŸ’š Health: http://localhost:${port}/`);\n console.log(`╰─────────────────────────────────────────────`);\n\n devServer.app.locals.handlers = handlers;\n\n if (devServer.server) {\n devServer.server.once('close', async () => {\n await performCleanup();\n });\n }\n } catch (error) {\n console.error('āŒ Failed to load plugin:', error);\n await performCleanup();\n }\n })();\n\n process.once('SIGINT', async () => {\n await performCleanup();\n });\n process.once('SIGTERM', async () => {\n await performCleanup();\n });\n\n devServer.app.options('*', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.status(200).end();\n });\n\n devServer.app.get('/', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.json({\n ok: true,\n plugin: pluginInfo.normalizedName,\n version: pluginInfo.version,\n status: devServer.app.locals.handlers?.rpc ? 'ready' : 'loading',\n endpoints: {\n health: '/',\n docs: '/api',\n rpc: `/api/rpc${rpcPrefix}`\n }\n });\n });\n\n // OpenAPI documentation and REST endpoints at /api and /api/*\n const handleApiRequest = async (req: any, res: any) => {\n applyCorsHeaders(res);\n const apiHandler = devServer.app.locals.handlers?.api;\n if (!apiHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await apiHandler.handle(webRequest, {\n prefix: '/api',\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('OpenAPI error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n };\n\n devServer.app.all(`/api/rpc${rpcPrefix}/*`, async (req: any, res: any) => {\n applyCorsHeaders(res);\n const rpcHandler = devServer.app.locals.handlers?.rpc;\n if (!rpcHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await rpcHandler.handle(webRequest, {\n prefix: `/api/rpc${rpcPrefix}`,\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('RPC error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n });\n\n devServer.app.all('/api', handleApiRequest);\n devServer.app.all('/api/*', handleApiRequest);\n}\n"],"mappings":";;AAEA,MAAM,cAAc;CAClB,+BAA+B;CAC/B,gCAAgC;CAChC,gCAAgC;CACjC;AAED,MAAM,oBAAoB,QAAa;AACrC,QAAO,QAAQ,YAAY,CAAC,SAAS,CAAC,KAAK,WAAW;AACpD,MAAI,UAAU,KAAK,MAAM;GACzB;;AAGJ,MAAM,mBAAmB,WAA4B;AACnD,KAAI,CAAC,OAAQ,QAAO;CACpB,MAAM,UAAU,OAAO,QAAQ,cAAc,GAAG;AAChD,QAAO,UAAU,IAAI,YAAY;;AAGnC,SAAgB,sBAAsB,WAAgB,YAAwB,WAAgB,MAAc;CAC1G,MAAM,YAAY,gBAAgB,WAAW,OAAO;CACpD,IAAIA,WAAmC;EAAE,KAAK;EAAM,KAAK;EAAM;CAC/D,IAAIC,UAAwC;CAE5C,MAAM,iBAAiB,YAAY;AACjC,MAAI,SAAS;AACX,SAAM,SAAS;AACf,aAAU;;;AAId,EAAC,YAAY;AACX,QAAM,gBAAgB;AAEtB,MAAI;GACF,MAAM,EAAE,wBAAwB,2CAAM;GACtC,MAAM,EAAE,eAAe,MAAM,OAAO;GACpC,MAAM,EAAE,YAAY,MAAM,OAAO;GACjC,MAAM,EAAE,mBAAmB,MAAM,OAAO;GACxC,MAAM,EAAE,2BAA2B,MAAM,OAAO;GAChD,MAAM,EAAE,6BAA6B,MAAM,OAAO;GAElD,MAAM,WAAW,WAAW,YAAY,WAAW;GAEnD,MAAM,UAAU,oBAAoB,EAClC,UAAU,GACP,WAAW,EACV,QAAQ,oBAAoB,KAAK,kBAClC,EACF,EACF,CAAC;GAEF,MAAM,SAAS,MAAM,QAAQ,UAAU,UAAU,WAAW,OAAO;AAEnE,aAAU,YAAY;AACpB,QAAI,UAAU,OAAQ,OAAe,YAAY,WAC/C,OAAO,OAAe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K,OAAO,KAAU,QAAa;AACxE,mBAAiB,IAAI;EACrB,MAAM,aAAa,UAAU,IAAI,OAAO,UAAU;AAClD,MAAI,CAAC,WACH,QAAO,IAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,2BAA2B,CAAC;AAGnE,MAAI;GACF,MAAM,MAAM,UAAU,IAAI,QAAQ,OAAO,IAAI;GAC7C,MAAM,aAAa,IAAI,QAAQ,KAAK;IAClC,QAAQ,IAAI;IACZ,SAAS,IAAI;IACb,MAAM,IAAI,WAAW,SAAS,IAAI,WAAW,SAAS,MAAM;IAC5D,QAAQ,IAAI,WAAW,SAAS,IAAI,WAAW,SAAS,SAAS;IAClE,CAAgB;GAEjB,MAAM,SAAS,MAAM,WAAW,OAAO,YAAY;IACjD,QAAQ,WAAW;IACnB,SAAS,EAAE;IACZ,CAAC;AAEF,OAAI,OAAO,UAAU;AACnB,QAAI,OAAO,OAAO,SAAS,OAAO;AAClC,WAAO,SAAS,QAAQ,SAAS,OAAe,QAAgB;AAC9D,SAAI,UAAU,KAAK,MAAM;MACzB;IACF,MAAM,OAAO,MAAM,OAAO,SAAS,MAAM;AACzC,QAAI,KAAK,KAAK;SAEd,KAAI,OAAO,IAAI,CAAC,KAAK,YAAY;WAE5B,OAAO;AACd,WAAQ,MAAM,cAAc,MAAM;AAClC,OAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAQ,MAAgB,SAAS,CAAC;;GAE3D;AAEF,WAAU,IAAI,IAAI,QAAQ,iBAAiB;AAC3C,WAAU,IAAI,IAAI,UAAU,iBAAiB"}
@@ -37,7 +37,7 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
37
37
  const { OpenAPIReferencePlugin } = await import("@orpc/openapi/plugins");
38
38
  const { ZodToJsonSchemaConverter } = await import("@orpc/zod/zod4");
39
39
  const pluginId = devConfig?.pluginId || pluginInfo.normalizedName;
40
- const runtime = createPluginRuntime({ registry: { [pluginId]: { remoteUrl: `http://localhost:${port}/remoteEntry.js` } } });
40
+ const runtime = createPluginRuntime({ registry: { [pluginId]: { remote: `http://localhost:${port}/remoteEntry.js` } } });
41
41
  const loaded = await runtime.usePlugin(pluginId, devConfig?.config);
42
42
  cleanup = async () => {
43
43
  if (loaded && typeof loaded.dispose === "function") await loaded.dispose();
@@ -162,8 +162,6 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
162
162
  res.status(500).json({ error: error.message });
163
163
  }
164
164
  };
165
- devServer.app.all("/api", handleApiRequest);
166
- devServer.app.all("/api/*", handleApiRequest);
167
165
  devServer.app.all(`/api/rpc${rpcPrefix}/*`, async (req, res) => {
168
166
  applyCorsHeaders(res);
169
167
  const rpcHandler = devServer.app.locals.handlers?.rpc;
@@ -193,6 +191,8 @@ function setupPluginMiddleware(devServer, pluginInfo, devConfig, port) {
193
191
  res.status(500).json({ error: error.message });
194
192
  }
195
193
  });
194
+ devServer.app.all("/api", handleApiRequest);
195
+ devServer.app.all("/api/*", handleApiRequest);
196
196
  }
197
197
 
198
198
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server-middleware.mjs","names":["handlers: { rpc: any, api: any }","cleanup: (() => Promise<void>) | null","lines: string[]"],"sources":["../../../src/build/rspack/dev-server-middleware.ts"],"sourcesContent":["import type { PluginInfo } from './utils';\n\nconst corsHeaders = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',\n 'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'\n};\n\nconst applyCorsHeaders = (res: any) => {\n Object.entries(corsHeaders).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n};\n\nconst normalizePrefix = (prefix?: string): string => {\n if (!prefix) return '';\n const cleaned = prefix.replace(/^\\/+|\\/+$/g, '');\n return cleaned ? `/${cleaned}` : '';\n};\n\nexport function setupPluginMiddleware(devServer: any, pluginInfo: PluginInfo, devConfig: any, port: number) {\n const rpcPrefix = normalizePrefix(devConfig?.prefix);\n let handlers: { rpc: any, api: any } = { rpc: null, api: null };\n let cleanup: (() => Promise<void>) | null = null;\n\n const performCleanup = async () => {\n if (cleanup) {\n await cleanup();\n cleanup = null;\n }\n };\n\n (async () => {\n await performCleanup();\n\n try {\n const { createPluginRuntime } = await import('every-plugin');\n const { RPCHandler } = await import('@orpc/server/fetch');\n const { onError } = await import('@orpc/server');\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\n const pluginId = devConfig?.pluginId || pluginInfo.normalizedName;\n\n const runtime = createPluginRuntime({\n registry: {\n [pluginId]: {\n remoteUrl: `http://localhost:${port}/remoteEntry.js`\n }\n }\n });\n\n const loaded = await runtime.usePlugin(pluginId, devConfig?.config);\n\n cleanup = async () => {\n if (loaded && typeof (loaded as any).dispose === 'function') {\n await (loaded as any).dispose();\n }\n if (runtime && typeof (runtime as any).cleanup === 'function') {\n await (runtime as any).cleanup();\n }\n handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n };\n\n const formatError = (error: any, context: string) => {\n const lines: string[] = [`\\nšŸ”“ ${context} Error: ${error.message || 'Unknown error'}`];\n \n if (error.cause?.issues && Array.isArray(error.cause.issues)) {\n lines.push('\\nšŸ“‹ Validation Issues:');\n error.cause.issues.forEach((issue: any, index: number) => {\n lines.push(` ${index + 1}. ${issue.path?.join('.') || 'root'}`);\n lines.push(` ā”œā”€ Code: ${issue.code || 'unknown'}`);\n lines.push(` ā”œā”€ Message: ${issue.message || 'No message'}`);\n if (issue.expected !== undefined) {\n lines.push(` ā”œā”€ Expected: ${JSON.stringify(issue.expected)}`);\n }\n if (issue.received !== undefined) {\n lines.push(` └─ Received: ${JSON.stringify(issue.received)}`);\n } else {\n lines.push(` └─ (end)`);\n }\n });\n }\n \n if (error.data && typeof error.data === 'object' && Object.keys(error.data).length > 0) {\n lines.push('\\nšŸ“Š Error Data:');\n try {\n const dataStr = JSON.stringify(error.data, null, 2);\n dataStr.split('\\n').forEach(line => {\n lines.push(` ${line}`);\n });\n } catch {\n lines.push(` ${String(error.data)}`);\n }\n }\n \n if (error.cause?.data) {\n lines.push('\\nšŸ“¦ Request Data:');\n try {\n const dataStr = JSON.stringify(error.cause.data, null, 2);\n dataStr.split('\\n').forEach(line => {\n lines.push(` ${line}`);\n });\n } catch {\n lines.push(` ${String(error.cause.data)}`);\n }\n }\n \n if (error.code) {\n lines.push(`\\nāš ļø Error Code: ${error.code}`);\n }\n \n if (error.status) {\n lines.push(`šŸ“ Status: ${error.status}`);\n }\n \n lines.push('');\n console.error(lines.join('\\n'));\n };\n\n // @ts-expect-error no type\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n formatError(error, 'RPC');\n }),\n ]\n });\n\n // @ts-expect-error no type\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 formatError(error, 'OpenAPI');\n }),\n ]\n });\n\n console.log(`╭─────────────────────────────────────────────`);\n console.log(`│ āœ… Plugin dev server ready: `);\n console.log(`ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€`);\n console.log(`│ šŸ“” RPC: http://localhost:${port}/api/rpc${rpcPrefix}`);\n console.log(`│ šŸ“– Docs: http://localhost:${port}/api`);\n console.log(`│ šŸ’š Health: http://localhost:${port}/`);\n console.log(`╰─────────────────────────────────────────────`);\n\n devServer.app.locals.handlers = handlers;\n\n if (devServer.server) {\n devServer.server.once('close', async () => {\n await performCleanup();\n });\n }\n } catch (error) {\n console.error('āŒ Failed to load plugin:', error);\n await performCleanup();\n }\n })();\n\n process.once('SIGINT', async () => {\n await performCleanup();\n });\n process.once('SIGTERM', async () => {\n await performCleanup();\n });\n\n devServer.app.options('*', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.status(200).end();\n });\n\n devServer.app.get('/', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.json({\n ok: true,\n plugin: pluginInfo.normalizedName,\n version: pluginInfo.version,\n status: devServer.app.locals.handlers?.rpc ? 'ready' : 'loading',\n endpoints: {\n health: '/',\n docs: '/api',\n rpc: `/api/rpc${rpcPrefix}`\n }\n });\n });\n\n // OpenAPI documentation and REST endpoints at /api and /api/*\n const handleApiRequest = async (req: any, res: any) => {\n applyCorsHeaders(res);\n const apiHandler = devServer.app.locals.handlers?.api;\n if (!apiHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await apiHandler.handle(webRequest, {\n prefix: '/api',\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('OpenAPI error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n };\n\n devServer.app.all('/api', handleApiRequest);\n devServer.app.all('/api/*', handleApiRequest);\n\n devServer.app.all(`/api/rpc${rpcPrefix}/*`, async (req: any, res: any) => {\n applyCorsHeaders(res);\n const rpcHandler = devServer.app.locals.handlers?.rpc;\n if (!rpcHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await rpcHandler.handle(webRequest, {\n prefix: `/api/rpc${rpcPrefix}`,\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('RPC error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n });\n}\n"],"mappings":";AAEA,MAAM,cAAc;CAClB,+BAA+B;CAC/B,gCAAgC;CAChC,gCAAgC;CACjC;AAED,MAAM,oBAAoB,QAAa;AACrC,QAAO,QAAQ,YAAY,CAAC,SAAS,CAAC,KAAK,WAAW;AACpD,MAAI,UAAU,KAAK,MAAM;GACzB;;AAGJ,MAAM,mBAAmB,WAA4B;AACnD,KAAI,CAAC,OAAQ,QAAO;CACpB,MAAM,UAAU,OAAO,QAAQ,cAAc,GAAG;AAChD,QAAO,UAAU,IAAI,YAAY;;AAGnC,SAAgB,sBAAsB,WAAgB,YAAwB,WAAgB,MAAc;CAC1G,MAAM,YAAY,gBAAgB,WAAW,OAAO;CACpD,IAAIA,WAAmC;EAAE,KAAK;EAAM,KAAK;EAAM;CAC/D,IAAIC,UAAwC;CAE5C,MAAM,iBAAiB,YAAY;AACjC,MAAI,SAAS;AACX,SAAM,SAAS;AACf,aAAU;;;AAId,EAAC,YAAY;AACX,QAAM,gBAAgB;AAEtB,MAAI;GACF,MAAM,EAAE,wBAAwB,MAAM,OAAO;GAC7C,MAAM,EAAE,eAAe,MAAM,OAAO;GACpC,MAAM,EAAE,YAAY,MAAM,OAAO;GACjC,MAAM,EAAE,mBAAmB,MAAM,OAAO;GACxC,MAAM,EAAE,2BAA2B,MAAM,OAAO;GAChD,MAA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AQ,MAAgB,SAAS,CAAC;;GAE3D"}
1
+ {"version":3,"file":"dev-server-middleware.mjs","names":["handlers: { rpc: any, api: any }","cleanup: (() => Promise<void>) | null","lines: string[]"],"sources":["../../../src/build/rspack/dev-server-middleware.ts"],"sourcesContent":["import type { PluginInfo } from './utils';\n\nconst corsHeaders = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',\n 'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'\n};\n\nconst applyCorsHeaders = (res: any) => {\n Object.entries(corsHeaders).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n};\n\nconst normalizePrefix = (prefix?: string): string => {\n if (!prefix) return '';\n const cleaned = prefix.replace(/^\\/+|\\/+$/g, '');\n return cleaned ? `/${cleaned}` : '';\n};\n\nexport function setupPluginMiddleware(devServer: any, pluginInfo: PluginInfo, devConfig: any, port: number) {\n const rpcPrefix = normalizePrefix(devConfig?.prefix);\n let handlers: { rpc: any, api: any } = { rpc: null, api: null };\n let cleanup: (() => Promise<void>) | null = null;\n\n const performCleanup = async () => {\n if (cleanup) {\n await cleanup();\n cleanup = null;\n }\n };\n\n (async () => {\n await performCleanup();\n\n try {\n const { createPluginRuntime } = await import('every-plugin');\n const { RPCHandler } = await import('@orpc/server/fetch');\n const { onError } = await import('@orpc/server');\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\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 loaded = await runtime.usePlugin(pluginId, devConfig?.config);\n\n cleanup = async () => {\n if (loaded && typeof (loaded as any).dispose === 'function') {\n await (loaded as any).dispose();\n }\n if (runtime && typeof (runtime as any).cleanup === 'function') {\n await (runtime as any).cleanup();\n }\n handlers.rpc = null;\n handlers.api = null;\n if (devServer.app.locals.handlers) {\n devServer.app.locals.handlers = null;\n }\n };\n\n const formatError = (error: any, context: string) => {\n const lines: string[] = [`\\nšŸ”“ ${context} Error: ${error.message || 'Unknown error'}`];\n \n if (error.cause?.issues && Array.isArray(error.cause.issues)) {\n lines.push('\\nšŸ“‹ Validation Issues:');\n error.cause.issues.forEach((issue: any, index: number) => {\n lines.push(` ${index + 1}. ${issue.path?.join('.') || 'root'}`);\n lines.push(` ā”œā”€ Code: ${issue.code || 'unknown'}`);\n lines.push(` ā”œā”€ Message: ${issue.message || 'No message'}`);\n if (issue.expected !== undefined) {\n lines.push(` ā”œā”€ Expected: ${JSON.stringify(issue.expected)}`);\n }\n if (issue.received !== undefined) {\n lines.push(` └─ Received: ${JSON.stringify(issue.received)}`);\n } else {\n lines.push(` └─ (end)`);\n }\n });\n }\n \n if (error.data && typeof error.data === 'object' && Object.keys(error.data).length > 0) {\n lines.push('\\nšŸ“Š Error Data:');\n try {\n const dataStr = JSON.stringify(error.data, null, 2);\n dataStr.split('\\n').forEach(line => {\n lines.push(` ${line}`);\n });\n } catch {\n lines.push(` ${String(error.data)}`);\n }\n }\n \n if (error.cause?.data) {\n lines.push('\\nšŸ“¦ Request Data:');\n try {\n const dataStr = JSON.stringify(error.cause.data, null, 2);\n dataStr.split('\\n').forEach(line => {\n lines.push(` ${line}`);\n });\n } catch {\n lines.push(` ${String(error.cause.data)}`);\n }\n }\n \n if (error.code) {\n lines.push(`\\nāš ļø Error Code: ${error.code}`);\n }\n \n if (error.status) {\n lines.push(`šŸ“ Status: ${error.status}`);\n }\n \n lines.push('');\n console.error(lines.join('\\n'));\n };\n\n handlers.rpc = new RPCHandler(loaded.router, {\n interceptors: [\n onError((error: any) => {\n formatError(error, 'RPC');\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 formatError(error, 'OpenAPI');\n }),\n ]\n });\n\n console.log(`╭─────────────────────────────────────────────`);\n console.log(`│ āœ… Plugin dev server ready: `);\n console.log(`ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€`);\n console.log(`│ šŸ“” RPC: http://localhost:${port}/api/rpc${rpcPrefix}`);\n console.log(`│ šŸ“– Docs: http://localhost:${port}/api`);\n console.log(`│ šŸ’š Health: http://localhost:${port}/`);\n console.log(`╰─────────────────────────────────────────────`);\n\n devServer.app.locals.handlers = handlers;\n\n if (devServer.server) {\n devServer.server.once('close', async () => {\n await performCleanup();\n });\n }\n } catch (error) {\n console.error('āŒ Failed to load plugin:', error);\n await performCleanup();\n }\n })();\n\n process.once('SIGINT', async () => {\n await performCleanup();\n });\n process.once('SIGTERM', async () => {\n await performCleanup();\n });\n\n devServer.app.options('*', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.status(200).end();\n });\n\n devServer.app.get('/', (req: any, res: any) => {\n applyCorsHeaders(res);\n res.json({\n ok: true,\n plugin: pluginInfo.normalizedName,\n version: pluginInfo.version,\n status: devServer.app.locals.handlers?.rpc ? 'ready' : 'loading',\n endpoints: {\n health: '/',\n docs: '/api',\n rpc: `/api/rpc${rpcPrefix}`\n }\n });\n });\n\n // OpenAPI documentation and REST endpoints at /api and /api/*\n const handleApiRequest = async (req: any, res: any) => {\n applyCorsHeaders(res);\n const apiHandler = devServer.app.locals.handlers?.api;\n if (!apiHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await apiHandler.handle(webRequest, {\n prefix: '/api',\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('OpenAPI error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n };\n\n devServer.app.all(`/api/rpc${rpcPrefix}/*`, async (req: any, res: any) => {\n applyCorsHeaders(res);\n const rpcHandler = devServer.app.locals.handlers?.rpc;\n if (!rpcHandler) {\n return res.status(503).json({ error: 'Plugin still loading...' });\n }\n\n try {\n const url = `http://${req.headers.host}${req.url}`;\n const webRequest = new Request(url, {\n method: req.method,\n headers: req.headers,\n body: req.method !== 'GET' && req.method !== 'HEAD' ? req : undefined,\n duplex: req.method !== 'GET' && req.method !== 'HEAD' ? 'half' : undefined\n } as RequestInit);\n\n const result = await rpcHandler.handle(webRequest, {\n prefix: `/api/rpc${rpcPrefix}`,\n context: {}\n });\n\n if (result.response) {\n res.status(result.response.status);\n result.response.headers.forEach((value: string, key: string) => {\n res.setHeader(key, value);\n });\n const text = await result.response.text();\n res.send(text);\n } else {\n res.status(404).send('Not Found');\n }\n } catch (error) {\n console.error('RPC error:', error);\n res.status(500).json({ error: (error as Error).message });\n }\n });\n\n devServer.app.all('/api', handleApiRequest);\n devServer.app.all('/api/*', handleApiRequest);\n}\n"],"mappings":";AAEA,MAAM,cAAc;CAClB,+BAA+B;CAC/B,gCAAgC;CAChC,gCAAgC;CACjC;AAED,MAAM,oBAAoB,QAAa;AACrC,QAAO,QAAQ,YAAY,CAAC,SAAS,CAAC,KAAK,WAAW;AACpD,MAAI,UAAU,KAAK,MAAM;GACzB;;AAGJ,MAAM,mBAAmB,WAA4B;AACnD,KAAI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;IAC5D,QAAQ,IAAI,WAAW,SAAS,IAAI,WAAW,SAAS,SAAS;IAClE,CAAgB;GAEjB,MAAM,SAAS,MAAM,WAAW,OAAO,YAAY;IACjD,QAAQ,WAAW;IACnB,SAAS,EAAE;IACZ,CAAC;AAEF,OAAI,OAAO,UAAU;AACnB,QAAI,OAAO,OAAO,SAAS,OAAO;AAClC,WAAO,SAAS,QAAQ,SAAS,OAAe,QAAgB;AAC9D,SAAI,UAAU,KAAK,MAAM;MACzB;IACF,MAAM,OAAO,MAAM,OAAO,SAAS,MAAM;AACzC,QAAI,KAAK,KAAK;SAEd,KAAI,OAAO,IAAI,CAAC,KAAK,YAAY;WAE5B,OAAO;AACd,WAAQ,MAAM,cAAc,MAAM;AAClC,OAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAQ,MAAgB,SAAS,CAAC;;GAE3D;AAEF,WAAU,IAAI,IAAI,QAAQ,iBAAiB;AAC3C,WAAU,IAAI,IAAI,UAAU,iBAAiB"}
package/dist/package.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  //#region package.json
3
- var version = "0.6.0";
3
+ var version = "0.6.2";
4
4
  var dependencies = {
5
5
  "@module-federation/enhanced": "^0.19.1",
6
6
  "@module-federation/node": "^2.7.15",
@@ -1 +1 @@
1
- {"version":3,"file":"package.cjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"every-plugin\",\n\t\"version\": \"0.6.0\",\n\t\"type\": \"module\",\n\t\"main\": \"./dist/index.cjs\",\n\t\"module\": \"./dist/index.mjs\",\n\t\"types\": \"./dist/index.d.mts\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/index.mjs\",\n\t\t\t\"require\": \"./dist/index.cjs\"\n\t\t},\n\t\t\"./runtime\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/runtime/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/runtime/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/runtime/index.mjs\",\n\t\t\t\"require\": \"./dist/runtime/index.cjs\"\n\t\t},\n\t\t\"./testing\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/testing/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/testing/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/testing/index.mjs\",\n\t\t\t\"require\": \"./dist/testing/index.cjs\"\n\t\t},\n\t\t\"./normalize\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/runtime/services/normalize.d.mts\",\n\t\t\t\t\"require\": \"./dist/runtime/services/normalize.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/runtime/services/normalize.mjs\",\n\t\t\t\"require\": \"./dist/runtime/services/normalize.cjs\"\n\t\t},\n\t\t\"./effect\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/effect.d.mts\",\n\t\t\t\t\"require\": \"./dist/effect.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/effect.mjs\",\n\t\t\t\"require\": \"./dist/effect.cjs\"\n\t\t},\n\t\t\"./zod\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/zod.d.mts\",\n\t\t\t\t\"require\": \"./dist/zod.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/zod.mjs\",\n\t\t\t\"require\": \"./dist/zod.cjs\"\n\t\t},\n\t\t\"./zod/v4/core\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/zod-core.d.mts\",\n\t\t\t\t\"require\": \"./dist/zod-core.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/zod-core.mjs\",\n\t\t\t\"require\": \"./dist/zod-core.cjs\"\n\t\t},\n\t\t\"./orpc\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/orpc.d.mts\",\n\t\t\t\t\"require\": \"./dist/orpc.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/orpc.mjs\",\n\t\t\t\"require\": \"./dist/orpc.cjs\"\n\t\t},\n\t\t\"./errors\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/errors.d.mts\",\n\t\t\t\t\"require\": \"./dist/errors.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/errors.mjs\",\n\t\t\t\"require\": \"./dist/errors.cjs\"\n\t\t},\n\t\t\"./types\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/types.d.mts\",\n\t\t\t\t\"require\": \"./dist/types.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/types.mjs\",\n\t\t\t\"require\": \"./dist/types.cjs\"\n\t\t},\n\t\t\"./build/rspack\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/build/rspack/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/build/rspack/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/build/rspack/index.mjs\",\n\t\t\t\"require\": \"./dist/build/rspack/index.cjs\"\n\t\t},\n\t\t\"./package.json\": \"./package.json\"\n\t},\n\t\"files\": [\n\t\t\"dist\"\n\t],\n\t\"scripts\": {\n\t\t\"build\": \"tsdown\",\n\t\t\"build:test\": \"cd tests/fixtures/test-plugin && bun run build\",\n\t\t\"test\": \"vitest run --config vitest.config.ts\",\n\t\t\"test:unit\": \"vitest run --config vitest.config.ts\",\n\t\t\"test:integration\": \"bun run build:test && vitest run --config vitest.integration.config.ts\",\n\t\t\"test:all\": \"bun run test:unit && bun run test:integration\",\n\t\t\"test:watch\": \"vitest --config vitest.config.ts --watch\",\n\t\t\"typecheck\": \"tsc --noEmit\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"@rspack/core\": \"*\",\n\t\t\"typescript\": \"^5.6.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@effect/language-service\": \"^0.38.4\",\n\t\t\"@effect/vitest\": \"^0.25.1\",\n\t\t\"@orpc/client\": \"^1.10.0\",\n\t\t\"@orpc/openapi\": \"^1.10.4\",\n\t\t\"@rspack/cli\": \"^1.5.8\",\n\t\t\"@types/bun\": \"^1.3.0\",\n\t\t\"@types/node\": \"^24.9.0\",\n\t\t\"@vitest/ui\": \"3.2.4\",\n\t\t\"bun-types\": \"^1.3.0\",\n\t\t\"sirv\": \"^3.0.2\",\n\t\t\"tsdown\": \"^0.16.1\",\n\t\t\"vite-tsconfig-paths\": \"^5.1.4\",\n\t\t\"vitest\": \"^3.2.4\"\n\t},\n\t\"dependencies\": {\n\t\t\"@module-federation/enhanced\": \"^0.19.1\",\n\t\t\"@module-federation/node\": \"^2.7.15\",\n\t\t\"@module-federation/runtime-core\": \"^0.19.1\",\n\t\t\"@orpc/contract\": \"^1.10.0\",\n\t\t\"@orpc/experimental-publisher\": \"^1.10.0\",\n\t\t\"@orpc/server\": \"^1.10.0\",\n\t\t\"@orpc/zod\": \"^1.10.0\",\n\t\t\"effect\": \"3.18.1\",\n\t\t\"zod\": \"4.1.5\"\n\t},\n\t\"keywords\": [\n\t\t\"plugin\",\n\t\t\"module-federation\",\n\t\t\"orpc\",\n\t\t\"zod\",\n\t\t\"typescript\"\n\t],\n\t\"author\": \"plugin.every.near\",\n\t\"license\": \"MIT\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/near-everything/every-plugin.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/near-everything/every-plugin/issues\"\n\t},\n\t\"homepage\": \"https://plugin.everything.dev\",\n\t\"workspaces\": [\n\t\t\"tests/fixtures/*\"\n\t]\n}\n"],"mappings":";;cAEY;mBAgIK;CACf,+BAA+B;CAC/B,2BAA2B;CAC3B,mCAAmC;CACnC,kBAAkB;CAClB,gCAAgC;CAChC,gBAAgB;CAChB,aAAa;CACb,UAAU;CACV,OAAO;CACP"}
1
+ {"version":3,"file":"package.cjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"every-plugin\",\n\t\"version\": \"0.6.2\",\n\t\"type\": \"module\",\n\t\"main\": \"./dist/index.cjs\",\n\t\"module\": \"./dist/index.mjs\",\n\t\"types\": \"./dist/index.d.mts\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/index.mjs\",\n\t\t\t\"require\": \"./dist/index.cjs\"\n\t\t},\n\t\t\"./runtime\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/runtime/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/runtime/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/runtime/index.mjs\",\n\t\t\t\"require\": \"./dist/runtime/index.cjs\"\n\t\t},\n\t\t\"./testing\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/testing/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/testing/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/testing/index.mjs\",\n\t\t\t\"require\": \"./dist/testing/index.cjs\"\n\t\t},\n\t\t\"./normalize\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/runtime/services/normalize.d.mts\",\n\t\t\t\t\"require\": \"./dist/runtime/services/normalize.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/runtime/services/normalize.mjs\",\n\t\t\t\"require\": \"./dist/runtime/services/normalize.cjs\"\n\t\t},\n\t\t\"./effect\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/effect.d.mts\",\n\t\t\t\t\"require\": \"./dist/effect.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/effect.mjs\",\n\t\t\t\"require\": \"./dist/effect.cjs\"\n\t\t},\n\t\t\"./zod\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/zod.d.mts\",\n\t\t\t\t\"require\": \"./dist/zod.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/zod.mjs\",\n\t\t\t\"require\": \"./dist/zod.cjs\"\n\t\t},\n\t\t\"./zod/v4/core\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/zod-core.d.mts\",\n\t\t\t\t\"require\": \"./dist/zod-core.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/zod-core.mjs\",\n\t\t\t\"require\": \"./dist/zod-core.cjs\"\n\t\t},\n\t\t\"./orpc\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/orpc.d.mts\",\n\t\t\t\t\"require\": \"./dist/orpc.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/orpc.mjs\",\n\t\t\t\"require\": \"./dist/orpc.cjs\"\n\t\t},\n\t\t\"./errors\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/errors.d.mts\",\n\t\t\t\t\"require\": \"./dist/errors.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/errors.mjs\",\n\t\t\t\"require\": \"./dist/errors.cjs\"\n\t\t},\n\t\t\"./types\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/types.d.mts\",\n\t\t\t\t\"require\": \"./dist/types.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/types.mjs\",\n\t\t\t\"require\": \"./dist/types.cjs\"\n\t\t},\n\t\t\"./build/rspack\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/build/rspack/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/build/rspack/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/build/rspack/index.mjs\",\n\t\t\t\"require\": \"./dist/build/rspack/index.cjs\"\n\t\t},\n\t\t\"./package.json\": \"./package.json\"\n\t},\n\t\"files\": [\n\t\t\"dist\"\n\t],\n\t\"scripts\": {\n\t\t\"build\": \"tsdown\",\n\t\t\"build:test\": \"cd tests/fixtures/test-plugin && bun run build\",\n\t\t\"test\": \"vitest run --config vitest.config.ts\",\n\t\t\"test:unit\": \"vitest run --config vitest.config.ts\",\n\t\t\"test:integration\": \"bun run build:test && vitest run --config vitest.integration.config.ts\",\n\t\t\"test:all\": \"bun run test:unit && bun run test:integration\",\n\t\t\"test:watch\": \"vitest --config vitest.config.ts --watch\",\n\t\t\"typecheck\": \"tsc --noEmit\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"@rspack/core\": \"*\",\n\t\t\"typescript\": \"^5.6.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@effect/language-service\": \"^0.38.4\",\n\t\t\"@effect/vitest\": \"^0.25.1\",\n\t\t\"@orpc/client\": \"^1.10.0\",\n\t\t\"@orpc/openapi\": \"^1.10.4\",\n\t\t\"@rspack/cli\": \"^1.5.8\",\n\t\t\"@types/bun\": \"^1.3.0\",\n\t\t\"@types/node\": \"^24.9.0\",\n\t\t\"@vitest/ui\": \"3.2.4\",\n\t\t\"bun-types\": \"^1.3.0\",\n\t\t\"sirv\": \"^3.0.2\",\n\t\t\"tsdown\": \"^0.16.1\",\n\t\t\"vite-tsconfig-paths\": \"^5.1.4\",\n\t\t\"vitest\": \"^3.2.4\"\n\t},\n\t\"dependencies\": {\n\t\t\"@module-federation/enhanced\": \"^0.19.1\",\n\t\t\"@module-federation/node\": \"^2.7.15\",\n\t\t\"@module-federation/runtime-core\": \"^0.19.1\",\n\t\t\"@orpc/contract\": \"^1.10.0\",\n\t\t\"@orpc/experimental-publisher\": \"^1.10.0\",\n\t\t\"@orpc/server\": \"^1.10.0\",\n\t\t\"@orpc/zod\": \"^1.10.0\",\n\t\t\"effect\": \"3.18.1\",\n\t\t\"zod\": \"4.1.5\"\n\t},\n\t\"keywords\": [\n\t\t\"plugin\",\n\t\t\"module-federation\",\n\t\t\"orpc\",\n\t\t\"zod\",\n\t\t\"typescript\"\n\t],\n\t\"author\": \"plugin.every.near\",\n\t\"license\": \"MIT\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/near-everything/every-plugin.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/near-everything/every-plugin/issues\"\n\t},\n\t\"homepage\": \"https://plugin.everything.dev\",\n\t\"workspaces\": [\n\t\t\"tests/fixtures/*\"\n\t]\n}\n"],"mappings":";;cAEY;mBAgIK;CACf,+BAA+B;CAC/B,2BAA2B;CAC3B,mCAAmC;CACnC,kBAAkB;CAClB,gCAAgC;CAChC,gBAAgB;CAChB,aAAa;CACb,UAAU;CACV,OAAO;CACP"}
package/dist/package.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.6.0";
2
+ var version = "0.6.2";
3
3
  var dependencies = {
4
4
  "@module-federation/enhanced": "^0.19.1",
5
5
  "@module-federation/node": "^2.7.15",
@@ -1 +1 @@
1
- {"version":3,"file":"package.mjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"every-plugin\",\n\t\"version\": \"0.6.0\",\n\t\"type\": \"module\",\n\t\"main\": \"./dist/index.cjs\",\n\t\"module\": \"./dist/index.mjs\",\n\t\"types\": \"./dist/index.d.mts\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/index.mjs\",\n\t\t\t\"require\": \"./dist/index.cjs\"\n\t\t},\n\t\t\"./runtime\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/runtime/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/runtime/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/runtime/index.mjs\",\n\t\t\t\"require\": \"./dist/runtime/index.cjs\"\n\t\t},\n\t\t\"./testing\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/testing/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/testing/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/testing/index.mjs\",\n\t\t\t\"require\": \"./dist/testing/index.cjs\"\n\t\t},\n\t\t\"./normalize\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/runtime/services/normalize.d.mts\",\n\t\t\t\t\"require\": \"./dist/runtime/services/normalize.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/runtime/services/normalize.mjs\",\n\t\t\t\"require\": \"./dist/runtime/services/normalize.cjs\"\n\t\t},\n\t\t\"./effect\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/effect.d.mts\",\n\t\t\t\t\"require\": \"./dist/effect.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/effect.mjs\",\n\t\t\t\"require\": \"./dist/effect.cjs\"\n\t\t},\n\t\t\"./zod\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/zod.d.mts\",\n\t\t\t\t\"require\": \"./dist/zod.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/zod.mjs\",\n\t\t\t\"require\": \"./dist/zod.cjs\"\n\t\t},\n\t\t\"./zod/v4/core\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/zod-core.d.mts\",\n\t\t\t\t\"require\": \"./dist/zod-core.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/zod-core.mjs\",\n\t\t\t\"require\": \"./dist/zod-core.cjs\"\n\t\t},\n\t\t\"./orpc\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/orpc.d.mts\",\n\t\t\t\t\"require\": \"./dist/orpc.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/orpc.mjs\",\n\t\t\t\"require\": \"./dist/orpc.cjs\"\n\t\t},\n\t\t\"./errors\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/errors.d.mts\",\n\t\t\t\t\"require\": \"./dist/errors.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/errors.mjs\",\n\t\t\t\"require\": \"./dist/errors.cjs\"\n\t\t},\n\t\t\"./types\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/types.d.mts\",\n\t\t\t\t\"require\": \"./dist/types.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/types.mjs\",\n\t\t\t\"require\": \"./dist/types.cjs\"\n\t\t},\n\t\t\"./build/rspack\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/build/rspack/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/build/rspack/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/build/rspack/index.mjs\",\n\t\t\t\"require\": \"./dist/build/rspack/index.cjs\"\n\t\t},\n\t\t\"./package.json\": \"./package.json\"\n\t},\n\t\"files\": [\n\t\t\"dist\"\n\t],\n\t\"scripts\": {\n\t\t\"build\": \"tsdown\",\n\t\t\"build:test\": \"cd tests/fixtures/test-plugin && bun run build\",\n\t\t\"test\": \"vitest run --config vitest.config.ts\",\n\t\t\"test:unit\": \"vitest run --config vitest.config.ts\",\n\t\t\"test:integration\": \"bun run build:test && vitest run --config vitest.integration.config.ts\",\n\t\t\"test:all\": \"bun run test:unit && bun run test:integration\",\n\t\t\"test:watch\": \"vitest --config vitest.config.ts --watch\",\n\t\t\"typecheck\": \"tsc --noEmit\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"@rspack/core\": \"*\",\n\t\t\"typescript\": \"^5.6.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@effect/language-service\": \"^0.38.4\",\n\t\t\"@effect/vitest\": \"^0.25.1\",\n\t\t\"@orpc/client\": \"^1.10.0\",\n\t\t\"@orpc/openapi\": \"^1.10.4\",\n\t\t\"@rspack/cli\": \"^1.5.8\",\n\t\t\"@types/bun\": \"^1.3.0\",\n\t\t\"@types/node\": \"^24.9.0\",\n\t\t\"@vitest/ui\": \"3.2.4\",\n\t\t\"bun-types\": \"^1.3.0\",\n\t\t\"sirv\": \"^3.0.2\",\n\t\t\"tsdown\": \"^0.16.1\",\n\t\t\"vite-tsconfig-paths\": \"^5.1.4\",\n\t\t\"vitest\": \"^3.2.4\"\n\t},\n\t\"dependencies\": {\n\t\t\"@module-federation/enhanced\": \"^0.19.1\",\n\t\t\"@module-federation/node\": \"^2.7.15\",\n\t\t\"@module-federation/runtime-core\": \"^0.19.1\",\n\t\t\"@orpc/contract\": \"^1.10.0\",\n\t\t\"@orpc/experimental-publisher\": \"^1.10.0\",\n\t\t\"@orpc/server\": \"^1.10.0\",\n\t\t\"@orpc/zod\": \"^1.10.0\",\n\t\t\"effect\": \"3.18.1\",\n\t\t\"zod\": \"4.1.5\"\n\t},\n\t\"keywords\": [\n\t\t\"plugin\",\n\t\t\"module-federation\",\n\t\t\"orpc\",\n\t\t\"zod\",\n\t\t\"typescript\"\n\t],\n\t\"author\": \"plugin.every.near\",\n\t\"license\": \"MIT\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/near-everything/every-plugin.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/near-everything/every-plugin/issues\"\n\t},\n\t\"homepage\": \"https://plugin.everything.dev\",\n\t\"workspaces\": [\n\t\t\"tests/fixtures/*\"\n\t]\n}\n"],"mappings":";cAEY;mBAgIK;CACf,+BAA+B;CAC/B,2BAA2B;CAC3B,mCAAmC;CACnC,kBAAkB;CAClB,gCAAgC;CAChC,gBAAgB;CAChB,aAAa;CACb,UAAU;CACV,OAAO;CACP"}
1
+ {"version":3,"file":"package.mjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"every-plugin\",\n\t\"version\": \"0.6.2\",\n\t\"type\": \"module\",\n\t\"main\": \"./dist/index.cjs\",\n\t\"module\": \"./dist/index.mjs\",\n\t\"types\": \"./dist/index.d.mts\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/index.mjs\",\n\t\t\t\"require\": \"./dist/index.cjs\"\n\t\t},\n\t\t\"./runtime\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/runtime/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/runtime/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/runtime/index.mjs\",\n\t\t\t\"require\": \"./dist/runtime/index.cjs\"\n\t\t},\n\t\t\"./testing\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/testing/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/testing/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/testing/index.mjs\",\n\t\t\t\"require\": \"./dist/testing/index.cjs\"\n\t\t},\n\t\t\"./normalize\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/runtime/services/normalize.d.mts\",\n\t\t\t\t\"require\": \"./dist/runtime/services/normalize.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/runtime/services/normalize.mjs\",\n\t\t\t\"require\": \"./dist/runtime/services/normalize.cjs\"\n\t\t},\n\t\t\"./effect\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/effect.d.mts\",\n\t\t\t\t\"require\": \"./dist/effect.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/effect.mjs\",\n\t\t\t\"require\": \"./dist/effect.cjs\"\n\t\t},\n\t\t\"./zod\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/zod.d.mts\",\n\t\t\t\t\"require\": \"./dist/zod.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/zod.mjs\",\n\t\t\t\"require\": \"./dist/zod.cjs\"\n\t\t},\n\t\t\"./zod/v4/core\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/zod-core.d.mts\",\n\t\t\t\t\"require\": \"./dist/zod-core.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/zod-core.mjs\",\n\t\t\t\"require\": \"./dist/zod-core.cjs\"\n\t\t},\n\t\t\"./orpc\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/orpc.d.mts\",\n\t\t\t\t\"require\": \"./dist/orpc.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/orpc.mjs\",\n\t\t\t\"require\": \"./dist/orpc.cjs\"\n\t\t},\n\t\t\"./errors\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/errors.d.mts\",\n\t\t\t\t\"require\": \"./dist/errors.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/errors.mjs\",\n\t\t\t\"require\": \"./dist/errors.cjs\"\n\t\t},\n\t\t\"./types\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/types.d.mts\",\n\t\t\t\t\"require\": \"./dist/types.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/types.mjs\",\n\t\t\t\"require\": \"./dist/types.cjs\"\n\t\t},\n\t\t\"./build/rspack\": {\n\t\t\t\"types\": {\n\t\t\t\t\"import\": \"./dist/build/rspack/index.d.mts\",\n\t\t\t\t\"require\": \"./dist/build/rspack/index.d.cts\"\n\t\t\t},\n\t\t\t\"import\": \"./dist/build/rspack/index.mjs\",\n\t\t\t\"require\": \"./dist/build/rspack/index.cjs\"\n\t\t},\n\t\t\"./package.json\": \"./package.json\"\n\t},\n\t\"files\": [\n\t\t\"dist\"\n\t],\n\t\"scripts\": {\n\t\t\"build\": \"tsdown\",\n\t\t\"build:test\": \"cd tests/fixtures/test-plugin && bun run build\",\n\t\t\"test\": \"vitest run --config vitest.config.ts\",\n\t\t\"test:unit\": \"vitest run --config vitest.config.ts\",\n\t\t\"test:integration\": \"bun run build:test && vitest run --config vitest.integration.config.ts\",\n\t\t\"test:all\": \"bun run test:unit && bun run test:integration\",\n\t\t\"test:watch\": \"vitest --config vitest.config.ts --watch\",\n\t\t\"typecheck\": \"tsc --noEmit\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"@rspack/core\": \"*\",\n\t\t\"typescript\": \"^5.6.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@effect/language-service\": \"^0.38.4\",\n\t\t\"@effect/vitest\": \"^0.25.1\",\n\t\t\"@orpc/client\": \"^1.10.0\",\n\t\t\"@orpc/openapi\": \"^1.10.4\",\n\t\t\"@rspack/cli\": \"^1.5.8\",\n\t\t\"@types/bun\": \"^1.3.0\",\n\t\t\"@types/node\": \"^24.9.0\",\n\t\t\"@vitest/ui\": \"3.2.4\",\n\t\t\"bun-types\": \"^1.3.0\",\n\t\t\"sirv\": \"^3.0.2\",\n\t\t\"tsdown\": \"^0.16.1\",\n\t\t\"vite-tsconfig-paths\": \"^5.1.4\",\n\t\t\"vitest\": \"^3.2.4\"\n\t},\n\t\"dependencies\": {\n\t\t\"@module-federation/enhanced\": \"^0.19.1\",\n\t\t\"@module-federation/node\": \"^2.7.15\",\n\t\t\"@module-federation/runtime-core\": \"^0.19.1\",\n\t\t\"@orpc/contract\": \"^1.10.0\",\n\t\t\"@orpc/experimental-publisher\": \"^1.10.0\",\n\t\t\"@orpc/server\": \"^1.10.0\",\n\t\t\"@orpc/zod\": \"^1.10.0\",\n\t\t\"effect\": \"3.18.1\",\n\t\t\"zod\": \"4.1.5\"\n\t},\n\t\"keywords\": [\n\t\t\"plugin\",\n\t\t\"module-federation\",\n\t\t\"orpc\",\n\t\t\"zod\",\n\t\t\"typescript\"\n\t],\n\t\"author\": \"plugin.every.near\",\n\t\"license\": \"MIT\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/near-everything/every-plugin.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/near-everything/every-plugin/issues\"\n\t},\n\t\"homepage\": \"https://plugin.everything.dev\",\n\t\"workspaces\": [\n\t\t\"tests/fixtures/*\"\n\t]\n}\n"],"mappings":";cAEY;mBAgIK;CACf,+BAA+B;CAC/B,2BAA2B;CAC3B,mCAAmC;CACnC,kBAAkB;CAClB,gCAAgC;CAChC,gBAAgB;CAChB,aAAa;CACb,UAAU;CACV,OAAO;CACP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "every-plugin",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",