every-plugin 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/dist/{chunk-QQAxy9l9.mjs → _virtual/rolldown_runtime.cjs} +3 -7
  2. package/dist/{chunk-zltIcp7o.cjs → _virtual/rolldown_runtime.mjs} +4 -28
  3. package/dist/build/rspack/dev-server-middleware.cjs +201 -0
  4. package/dist/build/rspack/dev-server-middleware.cjs.map +1 -0
  5. package/dist/build/rspack/dev-server-middleware.mjs +200 -0
  6. package/dist/build/rspack/dev-server-middleware.mjs.map +1 -0
  7. package/dist/build/rspack/index.cjs +2 -362
  8. package/dist/build/rspack/index.d.cts +2 -20
  9. package/dist/build/rspack/index.d.mts +2 -20
  10. package/dist/build/rspack/index.mjs +2 -360
  11. package/dist/build/rspack/module-federation.cjs +46 -0
  12. package/dist/build/rspack/module-federation.cjs.map +1 -0
  13. package/dist/build/rspack/module-federation.mjs +46 -0
  14. package/dist/build/rspack/module-federation.mjs.map +1 -0
  15. package/dist/build/rspack/plugin.cjs +90 -0
  16. package/dist/build/rspack/plugin.cjs.map +1 -0
  17. package/dist/build/rspack/plugin.d.cts +20 -0
  18. package/dist/build/rspack/plugin.d.cts.map +1 -0
  19. package/dist/build/rspack/plugin.d.mts +20 -0
  20. package/dist/build/rspack/plugin.d.mts.map +1 -0
  21. package/dist/build/rspack/plugin.mjs +89 -0
  22. package/dist/build/rspack/plugin.mjs.map +1 -0
  23. package/dist/build/rspack/utils.cjs +41 -0
  24. package/dist/build/rspack/utils.cjs.map +1 -0
  25. package/dist/build/rspack/utils.mjs +38 -0
  26. package/dist/build/rspack/utils.mjs.map +1 -0
  27. package/dist/errors.cjs +103 -3
  28. package/dist/errors.cjs.map +1 -0
  29. package/dist/errors.d.cts +103 -3
  30. package/dist/errors.d.cts.map +1 -0
  31. package/dist/errors.d.mts +103 -3
  32. package/dist/errors.d.mts.map +1 -0
  33. package/dist/errors.mjs +102 -3
  34. package/dist/errors.mjs.map +1 -0
  35. package/dist/index.cjs +9 -55
  36. package/dist/index.d.cts +6 -5
  37. package/dist/index.d.mts +6 -5
  38. package/dist/index.mjs +5 -51
  39. package/dist/orpc.cjs +1 -1
  40. package/dist/package.cjs +29 -0
  41. package/dist/package.cjs.map +1 -0
  42. package/dist/package.mjs +17 -0
  43. package/dist/package.mjs.map +1 -0
  44. package/dist/plugin.cjs +48 -0
  45. package/dist/plugin.cjs.map +1 -0
  46. package/dist/plugin.d.cts +62 -0
  47. package/dist/plugin.d.cts.map +1 -0
  48. package/dist/plugin.d.mts +62 -0
  49. package/dist/plugin.d.mts.map +1 -0
  50. package/dist/plugin.mjs +47 -0
  51. package/dist/plugin.mjs.map +1 -0
  52. package/dist/runtime/errors.cjs +97 -0
  53. package/dist/runtime/errors.cjs.map +1 -0
  54. package/dist/runtime/errors.d.cts +27 -0
  55. package/dist/runtime/errors.d.cts.map +1 -0
  56. package/dist/runtime/errors.d.mts +27 -0
  57. package/dist/runtime/errors.d.mts.map +1 -0
  58. package/dist/runtime/errors.mjs +93 -0
  59. package/dist/runtime/errors.mjs.map +1 -0
  60. package/dist/runtime/index.cjs +157 -5
  61. package/dist/runtime/index.cjs.map +1 -0
  62. package/dist/runtime/index.d.cts +43 -5
  63. package/dist/runtime/index.d.cts.map +1 -0
  64. package/dist/runtime/index.d.mts +43 -5
  65. package/dist/runtime/index.d.mts.map +1 -0
  66. package/dist/runtime/index.mjs +155 -4
  67. package/dist/runtime/index.mjs.map +1 -0
  68. package/dist/runtime/services/module-federation.service.cjs +142 -0
  69. package/dist/runtime/services/module-federation.service.cjs.map +1 -0
  70. package/dist/runtime/services/module-federation.service.d.cts +15 -0
  71. package/dist/runtime/services/module-federation.service.d.cts.map +1 -0
  72. package/dist/runtime/services/module-federation.service.d.mts +15 -0
  73. package/dist/runtime/services/module-federation.service.d.mts.map +1 -0
  74. package/dist/runtime/services/module-federation.service.mjs +141 -0
  75. package/dist/runtime/services/module-federation.service.mjs.map +1 -0
  76. package/dist/runtime/services/normalize.cjs +22 -2
  77. package/dist/runtime/services/normalize.cjs.map +1 -0
  78. package/dist/runtime/services/normalize.d.cts +21 -2
  79. package/dist/runtime/services/normalize.d.cts.map +1 -0
  80. package/dist/runtime/services/normalize.d.mts +21 -2
  81. package/dist/runtime/services/normalize.d.mts.map +1 -0
  82. package/dist/runtime/services/normalize.mjs +21 -2
  83. package/dist/runtime/services/normalize.mjs.map +1 -0
  84. package/dist/runtime/services/plugin-lifecycle.service.cjs +33 -0
  85. package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -0
  86. package/dist/runtime/services/plugin-lifecycle.service.d.cts +17 -0
  87. package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +1 -0
  88. package/dist/runtime/services/plugin-lifecycle.service.d.mts +17 -0
  89. package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +1 -0
  90. package/dist/runtime/services/plugin-lifecycle.service.mjs +32 -0
  91. package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -0
  92. package/dist/runtime/services/plugin-loader.service.cjs +132 -0
  93. package/dist/runtime/services/plugin-loader.service.cjs.map +1 -0
  94. package/dist/runtime/services/plugin-loader.service.d.cts +54 -0
  95. package/dist/runtime/services/plugin-loader.service.d.cts.map +1 -0
  96. package/dist/runtime/services/plugin-loader.service.d.mts +54 -0
  97. package/dist/runtime/services/plugin-loader.service.d.mts.map +1 -0
  98. package/dist/runtime/services/plugin-loader.service.mjs +128 -0
  99. package/dist/runtime/services/plugin-loader.service.mjs.map +1 -0
  100. package/dist/runtime/services/plugin.service.cjs +33 -0
  101. package/dist/runtime/services/plugin.service.cjs.map +1 -0
  102. package/dist/runtime/services/plugin.service.d.cts +42 -0
  103. package/dist/runtime/services/plugin.service.d.cts.map +1 -0
  104. package/dist/runtime/services/plugin.service.d.mts +42 -0
  105. package/dist/runtime/services/plugin.service.d.mts.map +1 -0
  106. package/dist/runtime/services/plugin.service.mjs +32 -0
  107. package/dist/runtime/services/plugin.service.mjs.map +1 -0
  108. package/dist/runtime/services/secrets.service.cjs +50 -0
  109. package/dist/runtime/services/secrets.service.cjs.map +1 -0
  110. package/dist/runtime/services/secrets.service.d.cts +16 -0
  111. package/dist/runtime/services/secrets.service.d.cts.map +1 -0
  112. package/dist/runtime/services/secrets.service.d.mts +16 -0
  113. package/dist/runtime/services/secrets.service.d.mts.map +1 -0
  114. package/dist/runtime/services/secrets.service.mjs +48 -0
  115. package/dist/runtime/services/secrets.service.mjs.map +1 -0
  116. package/dist/runtime/validation.cjs +18 -0
  117. package/dist/runtime/validation.cjs.map +1 -0
  118. package/dist/runtime/validation.mjs +17 -0
  119. package/dist/runtime/validation.mjs.map +1 -0
  120. package/dist/testing/index.cjs +2 -4
  121. package/dist/testing/index.cjs.map +1 -1
  122. package/dist/testing/index.d.cts +4 -4
  123. package/dist/testing/index.d.mts +4 -4
  124. package/dist/testing/index.mjs +1 -3
  125. package/dist/testing/index.mjs.map +1 -1
  126. package/dist/types.cjs +0 -0
  127. package/dist/types.d.cts +261 -0
  128. package/dist/types.d.cts.map +1 -0
  129. package/dist/types.d.mts +261 -0
  130. package/dist/types.d.mts.map +1 -0
  131. package/dist/types.mjs +1 -0
  132. package/dist/zod-core.cjs +9 -0
  133. package/dist/zod-core.d.cts +1 -0
  134. package/dist/zod-core.d.mts +1 -0
  135. package/dist/zod-core.mjs +3 -0
  136. package/dist/zod.cjs +13 -1
  137. package/dist/zod.cjs.map +1 -0
  138. package/dist/zod.d.cts +8 -2
  139. package/dist/zod.d.cts.map +1 -0
  140. package/dist/zod.d.mts +8 -2
  141. package/dist/zod.d.mts.map +1 -0
  142. package/dist/zod.mjs +9 -2
  143. package/dist/zod.mjs.map +1 -0
  144. package/package.json +17 -2
  145. package/dist/build/rspack/index.cjs.map +0 -1
  146. package/dist/build/rspack/index.d.cts.map +0 -1
  147. package/dist/build/rspack/index.d.mts.map +0 -1
  148. package/dist/build/rspack/index.mjs.map +0 -1
  149. package/dist/errors-9sNpYLv5.d.mts +0 -75
  150. package/dist/errors-9sNpYLv5.d.mts.map +0 -1
  151. package/dist/errors-CVnoPl9v.cjs +0 -68
  152. package/dist/errors-CVnoPl9v.cjs.map +0 -1
  153. package/dist/errors-D7keKf7a.mjs +0 -63
  154. package/dist/errors-D7keKf7a.mjs.map +0 -1
  155. package/dist/errors-DKPPPYYT.d.cts +0 -75
  156. package/dist/errors-DKPPPYYT.d.cts.map +0 -1
  157. package/dist/fetch-8DauUFDh.mjs +0 -335
  158. package/dist/fetch-8DauUFDh.mjs.map +0 -1
  159. package/dist/fetch-CrBvwsZ4.cjs +0 -336
  160. package/dist/fetch-CrBvwsZ4.cjs.map +0 -1
  161. package/dist/index-Bu2wtZrA.d.mts +0 -463
  162. package/dist/index-Bu2wtZrA.d.mts.map +0 -1
  163. package/dist/index-DtTqwV4f.d.cts +0 -462
  164. package/dist/index-DtTqwV4f.d.cts.map +0 -1
  165. package/dist/index.cjs.map +0 -1
  166. package/dist/index.mjs.map +0 -1
  167. package/dist/normalize-BW7kk8Lk.d.cts +0 -21
  168. package/dist/normalize-BW7kk8Lk.d.cts.map +0 -1
  169. package/dist/normalize-D4Qh0wVk.cjs +0 -28
  170. package/dist/normalize-D4Qh0wVk.cjs.map +0 -1
  171. package/dist/normalize-D7nae0Hn.mjs +0 -22
  172. package/dist/normalize-D7nae0Hn.mjs.map +0 -1
  173. package/dist/normalize-eB_j86fm.d.mts +0 -21
  174. package/dist/normalize-eB_j86fm.d.mts.map +0 -1
  175. package/dist/package-CaRYwbRi.mjs +0 -150
  176. package/dist/package-CaRYwbRi.mjs.map +0 -1
  177. package/dist/package-DyTuSutr.cjs +0 -155
  178. package/dist/package-DyTuSutr.cjs.map +0 -1
  179. package/dist/plugins-C6MGKdD-.mjs +0 -790
  180. package/dist/plugins-C6MGKdD-.mjs.map +0 -1
  181. package/dist/plugins-DNaNtkG7.cjs +0 -791
  182. package/dist/plugins-DNaNtkG7.cjs.map +0 -1
  183. package/dist/runtime-BNcFgWDG.cjs +0 -558
  184. package/dist/runtime-BNcFgWDG.cjs.map +0 -1
  185. package/dist/runtime-CAWcnrAk.mjs +0 -547
  186. package/dist/runtime-CAWcnrAk.mjs.map +0 -1
  187. package/dist/standard-CkH8zNkx.mjs +0 -584
  188. package/dist/standard-CkH8zNkx.mjs.map +0 -1
  189. package/dist/standard-v75BC6Z5.cjs +0 -685
  190. package/dist/standard-v75BC6Z5.cjs.map +0 -1
  191. package/dist/zod-A7Pti5IV.d.cts +0 -4
  192. package/dist/zod-A7Pti5IV.d.cts.map +0 -1
  193. package/dist/zod-BVo51kgJ.mjs +0 -10
  194. package/dist/zod-BVo51kgJ.mjs.map +0 -1
  195. package/dist/zod-DYghWCz1.cjs +0 -14
  196. package/dist/zod-DYghWCz1.cjs.map +0 -1
  197. package/dist/zod-Zw8dlP3j.d.mts +0 -4
  198. package/dist/zod-Zw8dlP3j.d.mts.map +0 -1
@@ -0,0 +1,261 @@
1
+ import { Plugin } from "./plugin.mjs";
2
+ import { Scope } from "effect";
3
+ import { Context as Context$1, Router, RouterClient } from "@orpc/server";
4
+ import { AnyContractRouter, AnySchema, InferSchemaInput, InferSchemaOutput } from "@orpc/contract";
5
+
6
+ //#region src/types.d.ts
7
+
8
+ /**
9
+ * Registry bindings interface - populated via module augmentation
10
+ * Only needed for remote-only plugin entries.
11
+ * @example
12
+ * ```typescript
13
+ * declare module "every-plugin" {
14
+ * interface RegisteredPlugins {
15
+ * "my-plugin": typeof MyPlugin;
16
+ * }
17
+ * }
18
+ * ```
19
+ */
20
+ interface RegisteredPlugins {}
21
+ /**
22
+ * Base type for any plugin instance.
23
+ */
24
+ type AnyPlugin = Plugin<AnyContractRouter, AnySchema, AnySchema, any>;
25
+ /**
26
+ * Loaded plugin constructor with binding information
27
+ */
28
+ type AnyPluginConstructor = {
29
+ new (): AnyPlugin;
30
+ binding: {
31
+ contract: AnyContractRouter;
32
+ variables: AnySchema;
33
+ secrets: AnySchema;
34
+ context: Context$1;
35
+ };
36
+ };
37
+ /**
38
+ * Registry entry that supports both direct module imports and remote URLs
39
+ */
40
+ type PluginRegistryEntry = {
41
+ module: AnyPluginConstructor;
42
+ remote?: string;
43
+ version?: string;
44
+ description?: string;
45
+ } | {
46
+ remote: string;
47
+ version?: string;
48
+ description?: string;
49
+ };
50
+ /**
51
+ * Extract plugin constructor type from registry entry
52
+ */
53
+ type ExtractPluginType<E> = E extends {
54
+ module: infer M;
55
+ } ? M : never;
56
+ /**
57
+ * Infer registry types from plugin entries with module constructors
58
+ */
59
+ type InferRegistryFromEntries<R$1 extends Record<string, PluginRegistryEntry>> = { [K in keyof R$1]: R$1[K] extends {
60
+ module: infer M;
61
+ } ? M : K extends keyof RegisteredPlugins ? RegisteredPlugins[K] : never };
62
+ /**
63
+ * Extract contract type from plugin binding
64
+ */
65
+ type PluginContract<T> = T extends {
66
+ binding: {
67
+ contract: infer C extends AnyContractRouter;
68
+ };
69
+ } ? C : never;
70
+ /**
71
+ * Extract variables type from plugin binding
72
+ */
73
+ type PluginVariables<T> = T extends {
74
+ binding: {
75
+ variables: infer V extends AnySchema;
76
+ };
77
+ } ? V : never;
78
+ /**
79
+ * Extract secrets type from plugin binding
80
+ */
81
+ type PluginSecrets<T> = T extends {
82
+ binding: {
83
+ secrets: infer S extends AnySchema;
84
+ };
85
+ } ? S : never;
86
+ /**
87
+ * Extract context type from plugin binding
88
+ */
89
+ type PluginContext<T> = T extends {
90
+ binding: {
91
+ context: infer C extends Context$1;
92
+ };
93
+ } ? C : never;
94
+ /**
95
+ * Extract router type from plugin binding
96
+ * Uses 'any' for context to support nested router compositions
97
+ */
98
+ type PluginRouterType<T> = Router<PluginContract<T>, any>;
99
+ /**
100
+ * Extract client type from plugin binding
101
+ */
102
+ type PluginClientType<T> = RouterClient<PluginRouterType<T>>;
103
+ /**
104
+ * Extract plugin type from registered plugins by key
105
+ * @param K - The plugin key
106
+ * @param R - The registry type (defaults to RegisteredPlugins for module augmentation pattern)
107
+ */
108
+ type RegisteredPlugin<K$1 extends keyof R$1, R$1 = RegisteredPlugins> = R$1[K$1] extends {
109
+ binding: infer B;
110
+ } ? B extends {
111
+ contract: infer C extends AnyContractRouter;
112
+ variables: infer V extends AnySchema;
113
+ secrets: infer S extends AnySchema;
114
+ context: infer TContext extends Context$1;
115
+ } ? Plugin<C, V, S, TContext> : never : never;
116
+ /**
117
+ * Extract config input type from plugin binding
118
+ */
119
+ type PluginConfigInput<T> = {
120
+ variables: InferSchemaInput<PluginVariables<T>>;
121
+ secrets: InferSchemaInput<PluginSecrets<T>>;
122
+ };
123
+ /**
124
+ * Extract context type from plugin instance
125
+ */
126
+ type ContextOf<T extends AnyPlugin> = T extends Plugin<AnyContractRouter, AnySchema, AnySchema, infer TContext> ? TContext : never;
127
+ /**
128
+ * Plugin metadata for remote loading
129
+ */
130
+ type PluginMetadata = {
131
+ readonly remoteUrl: string;
132
+ readonly version?: string;
133
+ readonly description?: string;
134
+ };
135
+ /**
136
+ * Runtime registry configuration supporting both module and remote entries
137
+ */
138
+ type PluginRegistry = Record<string, PluginRegistryEntry>;
139
+ /**
140
+ * Legacy metadata-only registry (for backwards compatibility)
141
+ */
142
+ type PluginMetadataRegistry = Record<string, PluginMetadata>;
143
+ /**
144
+ * Configuration for secrets injection.
145
+ * Secrets are hydrated into plugin configs using template replacement.
146
+ */
147
+ interface SecretsConfig {
148
+ [key: string]: string;
149
+ }
150
+ /**
151
+ * Loaded plugin
152
+ */
153
+ interface LoadedPlugin<T extends AnyPlugin = AnyPlugin> {
154
+ readonly ctor: new () => T;
155
+ readonly metadata: PluginMetadata;
156
+ }
157
+ /**
158
+ * Instantiated plugin
159
+ */
160
+ interface PluginInstance<T extends AnyPlugin = AnyPlugin> {
161
+ readonly plugin: T;
162
+ readonly metadata: PluginMetadata;
163
+ }
164
+ /**
165
+ * Fully initialized plugin ready for use
166
+ */
167
+ interface InitializedPlugin<T extends AnyPlugin = AnyPlugin> {
168
+ readonly plugin: T;
169
+ readonly metadata: PluginMetadata;
170
+ readonly config: {
171
+ variables: InferSchemaOutput<T["configSchema"]["variables"]>;
172
+ secrets: InferSchemaOutput<T["configSchema"]["secrets"]>;
173
+ };
174
+ readonly context: ContextOf<T>;
175
+ readonly scope: Scope.CloseableScope;
176
+ }
177
+ /**
178
+ * Helper type to detect type errors when looking up RegisteredPlugins
179
+ */
180
+ type VerifyPluginBinding<K$1 extends keyof R$1, R$1 = RegisteredPlugins> = R$1[K$1] extends {
181
+ binding: infer B;
182
+ } ? B extends {
183
+ contract: AnyContractRouter;
184
+ variables: AnySchema;
185
+ secrets: AnySchema;
186
+ context: Context$1;
187
+ } ? true : `❌ Plugin "${K$1 & string}" is not properly registered. Ensure it extends plugin binding layout { contract, variables, secrets, context }.` : `❌ Plugin "${K$1 & string}" is not properly registered. Missing binding property.`;
188
+ /**
189
+ * Result of runtime.usePlugin() call
190
+ * @param K - The plugin key
191
+ * @param R - The registry type (defaults to RegisteredPlugins for module augmentation pattern)
192
+ */
193
+ type UsePluginResult<K$1 extends keyof R$1, R$1 = RegisteredPlugins> = VerifyPluginBinding<K$1, R$1> extends true ? {
194
+ readonly client: PluginClientType<R$1[K$1]>;
195
+ readonly router: PluginRouterType<R$1[K$1]>;
196
+ readonly metadata: PluginMetadata;
197
+ readonly initialized: InitializedPlugin<RegisteredPlugin<K$1, R$1>>;
198
+ } : VerifyPluginBinding<K$1, R$1>;
199
+ /**
200
+ * Runtime options
201
+ */
202
+ interface RuntimeOptions {
203
+ isolation?: "strict" | "shared" | "none";
204
+ memoryLimit?: string;
205
+ concurrency?: number;
206
+ resourceTimeout?: string;
207
+ debug?: boolean;
208
+ metrics?: boolean;
209
+ }
210
+ /**
211
+ * Extract registry type from runtime instance or use type directly
212
+ * This allows EveryPlugin.Infer to work with both:
213
+ * - typeof runtime (extracts registry from PluginRuntime<R> via __registryType)
214
+ * - Registry types directly
215
+ */
216
+ type RegistryOf<T> = T extends {
217
+ __registryType?: infer R;
218
+ } ? R : T;
219
+ /**
220
+ * Namespace containing type utilities for working with plugin results.
221
+ */
222
+ declare namespace EveryPlugin {
223
+ /**
224
+ * Extract plugin runtime instance type from registered plugins or runtime.
225
+ * Provides full type safety for plugin clients, routers, and metadata.
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * // From RegisteredPlugins (module augmentation)
230
+ * type Plugin = EveryPlugin.Infer<"my-plugin">;
231
+ *
232
+ * // From runtime instance (when using module entries)
233
+ * const runtime = createPluginRuntime({ registry: { "my-plugin": { module: MyPlugin } } });
234
+ * type Plugin = EveryPlugin.Infer<"my-plugin", typeof runtime>;
235
+ *
236
+ * // From explicit registry type
237
+ * type Plugin = EveryPlugin.Infer<"my-plugin", MyRegistryType>;
238
+ * ```
239
+ */
240
+ type Infer<K$1 extends string, Source = RegisteredPlugins> = K$1 extends keyof RegistryOf<Source> ? UsePluginResult<K$1, RegistryOf<Source>> : never;
241
+ }
242
+ /**
243
+ * Plugin runtime configuration with support for both module and remote entries
244
+ */
245
+ interface PluginRuntimeConfig<R$1 extends Record<string, PluginRegistryEntry> = Record<string, PluginRegistryEntry>> {
246
+ registry: R$1;
247
+ secrets?: SecretsConfig;
248
+ options?: RuntimeOptions;
249
+ }
250
+ /**
251
+ * Legacy plugin runtime configuration (metadata-only registry)
252
+ * @deprecated Use PluginRuntimeConfig with module/remote entries instead
253
+ */
254
+ interface LegacyPluginRuntimeConfig {
255
+ registry: PluginMetadataRegistry;
256
+ secrets?: SecretsConfig;
257
+ options?: RuntimeOptions;
258
+ }
259
+ //#endregion
260
+ export { AnyPlugin, AnyPluginConstructor, ContextOf, EveryPlugin, ExtractPluginType, InferRegistryFromEntries, InitializedPlugin, LegacyPluginRuntimeConfig, LoadedPlugin, PluginClientType, PluginConfigInput, PluginContext, PluginContract, PluginInstance, PluginMetadata, PluginMetadataRegistry, PluginRegistry, PluginRegistryEntry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginVariables, RegisteredPlugin, RegisteredPlugins, RuntimeOptions, SecretsConfig, UsePluginResult };
261
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;YACN;YACA;YACA"}
package/dist/types.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,9 @@
1
+
2
+
3
+ var zod_v4_core = require("zod/v4/core");
4
+ Object.keys(zod_v4_core).forEach(function (k) {
5
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
6
+ enumerable: true,
7
+ get: function () { return zod_v4_core[k]; }
8
+ });
9
+ });
@@ -0,0 +1 @@
1
+ export * from "zod/v4/core";
@@ -0,0 +1 @@
1
+ export * from "zod/v4/core";
@@ -0,0 +1,3 @@
1
+ export * from "zod/v4/core"
2
+
3
+ export { };
package/dist/zod.cjs CHANGED
@@ -1,6 +1,16 @@
1
- const require_zod = require('./zod-DYghWCz1.cjs');
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
2
 
3
+ //#region src/zod.ts
4
+ var zod_exports = {};
5
+ require_rolldown_runtime.__reExport(zod_exports, require("zod"));
3
6
 
7
+ //#endregion
8
+ Object.defineProperty(exports, 'zod_exports', {
9
+ enumerable: true,
10
+ get: function () {
11
+ return zod_exports;
12
+ }
13
+ });
4
14
  var zod = require("zod");
5
15
  Object.keys(zod).forEach(function (k) {
6
16
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
@@ -8,3 +18,5 @@ Object.keys(zod).forEach(function (k) {
8
18
  get: function () { return zod[k]; }
9
19
  });
10
20
  });
21
+
22
+ //# sourceMappingURL=zod.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod.cjs","names":[],"sources":["../src/zod.ts"],"sourcesContent":["export * from \"zod\";\n"],"mappings":""}
package/dist/zod.d.cts CHANGED
@@ -1,2 +1,8 @@
1
- import "./zod-A7Pti5IV.cjs";
2
- export * from "zod";
1
+ export * from "zod";
2
+
3
+ //#region src/zod.d.ts
4
+
5
+ import * as import_zod from "zod";
6
+ //#endregion
7
+ export { import_zod as zod_d_exports };
8
+ //# sourceMappingURL=zod.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod.d.cts","names":[],"sources":["../src/zod.ts"],"sourcesContent":[],"mappings":""}
package/dist/zod.d.mts CHANGED
@@ -1,2 +1,8 @@
1
- import "./zod-Zw8dlP3j.mjs";
2
- export * from "zod";
1
+ export * from "zod";
2
+
3
+ //#region src/zod.d.ts
4
+
5
+ import * as import_zod from "zod";
6
+ //#endregion
7
+ export { import_zod as zod_d_exports };
8
+ //# sourceMappingURL=zod.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod.d.mts","names":[],"sources":["../src/zod.ts"],"sourcesContent":[],"mappings":""}
package/dist/zod.mjs CHANGED
@@ -1,5 +1,12 @@
1
- import "./zod-BVo51kgJ.mjs";
1
+ import { __reExport } from "./_virtual/rolldown_runtime.mjs";
2
2
 
3
3
  export * from "zod"
4
4
 
5
- export { };
5
+ //#region src/zod.ts
6
+ var zod_exports = {};
7
+ import * as import_zod from "zod";
8
+ __reExport(zod_exports, import_zod);
9
+
10
+ //#endregion
11
+ export { zod_exports };
12
+ //# sourceMappingURL=zod.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod.mjs","names":[],"sources":["../src/zod.ts"],"sourcesContent":["export * from \"zod\";\n"],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "every-plugin",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -54,6 +54,14 @@
54
54
  "import": "./dist/zod.mjs",
55
55
  "require": "./dist/zod.cjs"
56
56
  },
57
+ "./zod/v4/core": {
58
+ "types": {
59
+ "import": "./dist/zod-core.d.mts",
60
+ "require": "./dist/zod-core.d.cts"
61
+ },
62
+ "import": "./dist/zod-core.mjs",
63
+ "require": "./dist/zod-core.cjs"
64
+ },
57
65
  "./orpc": {
58
66
  "types": {
59
67
  "import": "./dist/orpc.d.mts",
@@ -70,6 +78,14 @@
70
78
  "import": "./dist/errors.mjs",
71
79
  "require": "./dist/errors.cjs"
72
80
  },
81
+ "./types": {
82
+ "types": {
83
+ "import": "./dist/types.d.mts",
84
+ "require": "./dist/types.d.cts"
85
+ },
86
+ "import": "./dist/types.mjs",
87
+ "require": "./dist/types.cjs"
88
+ },
73
89
  "./build/rspack": {
74
90
  "types": {
75
91
  "import": "./dist/build/rspack/index.d.mts",
@@ -113,7 +129,6 @@
113
129
  "vitest": "^3.2.4"
114
130
  },
115
131
  "dependencies": {
116
- "@better-fetch/fetch": "^1.1.18",
117
132
  "@module-federation/enhanced": "^0.19.1",
118
133
  "@module-federation/node": "^2.7.15",
119
134
  "@module-federation/runtime-core": "^0.19.1",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["handlers: { rpc: any, api: any }","cleanup: (() => Promise<void>) | null","lines: string[]","path","fs","getNormalizedRemoteName","module","options: EveryPluginOptions","ModuleFederationPlugin","path"],"sources":["../../../src/build/rspack/dev-server-middleware.ts","../../../src/build/rspack/module-federation.ts","../../../src/build/rspack/utils.ts","../../../src/build/rspack/plugin.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","import type { PluginInfo } from './utils';\n\nexport function buildSharedDependencies(pluginInfo: PluginInfo) {\n // Get every-plugin package info for version constraints\n const everyPluginPkg = require('every-plugin/package.json');\n\n return {\n 'every-plugin': {\n version: everyPluginPkg.version,\n singleton: true,\n requiredVersion: `${everyPluginPkg.version}`,\n strictVersion: false,\n eager: false,\n },\n effect: {\n version: everyPluginPkg.dependencies.effect,\n singleton: true,\n requiredVersion: `${everyPluginPkg.dependencies.effect}`,\n strictVersion: false,\n eager: false,\n },\n zod: {\n version: everyPluginPkg.dependencies.zod,\n singleton: true,\n requiredVersion: `${everyPluginPkg.dependencies.zod}`,\n strictVersion: false,\n eager: false,\n },\n '@orpc/contract': {\n version: everyPluginPkg.dependencies['@orpc/contract'],\n singleton: true,\n requiredVersion: `${everyPluginPkg.dependencies['@orpc/contract']}`,\n strictVersion: false,\n eager: false,\n },\n '@orpc/server': {\n version: everyPluginPkg.dependencies['@orpc/server'],\n singleton: true,\n requiredVersion: `${everyPluginPkg.dependencies['@orpc/server']}`,\n strictVersion: false,\n eager: false,\n },\n };\n}\n","import path from 'node:path';\nimport fs from 'node:fs';\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 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","import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';\nimport type { Compiler, RspackPluginInstance } from '@rspack/core';\nimport path from 'node:path';\nimport { setupPluginMiddleware } from './dev-server-middleware';\nimport { buildSharedDependencies } from './module-federation';\nimport { getPluginInfo, loadDevConfig } from './utils';\n\n\nexport interface EveryPluginOptions {\n devConfigPath?: string; // defaults to './plugin.dev.ts'\n port?: number; // override plugin.dev.ts port\n pluginId?: string; // override auto-detected\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = 'EveryPluginDevServer';\n\n constructor(private options: EveryPluginOptions = {}) { }\n\n apply(compiler: Compiler) {\n // Load configuration\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || './plugin.dev.ts');\n const port = this.options.port || devConfig?.port || 3999;\n\n // Configure defaults immediately (no hooks needed)\n this.configureDefaults(compiler, pluginInfo);\n\n // Initialize devServer if it doesn't exist\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n // Configure dev server\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n // Apply Module Federation plugin\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: 'remoteEntry.js',\n // manifest: true, // Enable MF 2.0 manifest generation\n dts: false,\n runtimePlugins: [\n require.resolve('@module-federation/node/runtimePlugin'),\n ],\n library: { type: 'commonjs-module' },\n exposes: {\n './plugin': './src/index.ts',\n },\n shared: buildSharedDependencies(pluginInfo),\n }).apply(compiler);\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n // Configure output defaults\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 // Configure target and mode defaults\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 // Configure devtool\n if (!compiler.options.devtool) {\n compiler.options.devtool = 'source-map';\n }\n\n // Suppress verbose infrastructure logging\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: 'warn', // Only show warnings and errors\n };\n }\n\n // Configure module rules - ensure TypeScript loader is present\n this.ensureTypeScriptLoader(compiler);\n\n // Configure resolve extensions\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = ['...', '.tsx', '.ts'];\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 // Check if TypeScript loader is already configured\n const hasTsLoader = compiler.options.module.rules.some((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 // Add TypeScript loader if not present\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; // Should never happen due to check in apply()\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 // Suppress verbose logging\n compiler.options.devServer.client = {\n logging: 'warn', // Only show warnings and errors\n overlay: {\n warnings: false, // Don't show warning overlay\n errors: true, // Still show errors\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":";;;;;;;;;;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,MA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,WAAS,QAAQ,UAAU,gBAAgB,EAAE,aAAa,MAAM;AAChE,WAAS,QAAQ,UAAU,UAAU;GACnC,+BAA+B;GAC/B,gCAAgC;GAChC,gCAAgC;GACjC;AAGD,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 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":[],"mappings":";;;UAQiB,kBAAA;;EAAA,IAAA,CAAA,EAAA,MAAA;EAMJ,QAAA,CAAA,EAAA,MAAA;;AAKK,cALL,oBAAA,YAAgC,oBAK3B,CAAA;EAL2B,QAAA,OAAA;EAAoB,IAAA,EAAA,MAAA;wBAGlC;kBAEb"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":[],"mappings":";;;UAQiB,kBAAA;;EAAA,IAAA,CAAA,EAAA,MAAA;EAMJ,QAAA,CAAA,EAAA,MAAA;;AAKK,cALL,oBAAA,YAAgC,oBAK3B,CAAA;EAL2B,QAAA,OAAA;EAAoB,IAAA,EAAA,MAAA;wBAGlC;kBAEb"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":["handlers: { rpc: any, api: any }","cleanup: (() => Promise<void>) | null","lines: string[]","options: EveryPluginOptions"],"sources":["../../../src/build/rspack/dev-server-middleware.ts","../../../src/build/rspack/module-federation.ts","../../../src/build/rspack/utils.ts","../../../src/build/rspack/plugin.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","import type { PluginInfo } from './utils';\n\nexport function buildSharedDependencies(pluginInfo: PluginInfo) {\n // Get every-plugin package info for version constraints\n const everyPluginPkg = require('every-plugin/package.json');\n\n return {\n 'every-plugin': {\n version: everyPluginPkg.version,\n singleton: true,\n requiredVersion: `${everyPluginPkg.version}`,\n strictVersion: false,\n eager: false,\n },\n effect: {\n version: everyPluginPkg.dependencies.effect,\n singleton: true,\n requiredVersion: `${everyPluginPkg.dependencies.effect}`,\n strictVersion: false,\n eager: false,\n },\n zod: {\n version: everyPluginPkg.dependencies.zod,\n singleton: true,\n requiredVersion: `${everyPluginPkg.dependencies.zod}`,\n strictVersion: false,\n eager: false,\n },\n '@orpc/contract': {\n version: everyPluginPkg.dependencies['@orpc/contract'],\n singleton: true,\n requiredVersion: `${everyPluginPkg.dependencies['@orpc/contract']}`,\n strictVersion: false,\n eager: false,\n },\n '@orpc/server': {\n version: everyPluginPkg.dependencies['@orpc/server'],\n singleton: true,\n requiredVersion: `${everyPluginPkg.dependencies['@orpc/server']}`,\n strictVersion: false,\n eager: false,\n },\n };\n}\n","import path from 'node:path';\nimport fs from 'node:fs';\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 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","import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';\nimport type { Compiler, RspackPluginInstance } from '@rspack/core';\nimport path from 'node:path';\nimport { setupPluginMiddleware } from './dev-server-middleware';\nimport { buildSharedDependencies } from './module-federation';\nimport { getPluginInfo, loadDevConfig } from './utils';\n\n\nexport interface EveryPluginOptions {\n devConfigPath?: string; // defaults to './plugin.dev.ts'\n port?: number; // override plugin.dev.ts port\n pluginId?: string; // override auto-detected\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = 'EveryPluginDevServer';\n\n constructor(private options: EveryPluginOptions = {}) { }\n\n apply(compiler: Compiler) {\n // Load configuration\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || './plugin.dev.ts');\n const port = this.options.port || devConfig?.port || 3999;\n\n // Configure defaults immediately (no hooks needed)\n this.configureDefaults(compiler, pluginInfo);\n\n // Initialize devServer if it doesn't exist\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n // Configure dev server\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n // Apply Module Federation plugin\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: 'remoteEntry.js',\n // manifest: true, // Enable MF 2.0 manifest generation\n dts: false,\n runtimePlugins: [\n require.resolve('@module-federation/node/runtimePlugin'),\n ],\n library: { type: 'commonjs-module' },\n exposes: {\n './plugin': './src/index.ts',\n },\n shared: buildSharedDependencies(pluginInfo),\n }).apply(compiler);\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n // Configure output defaults\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 // Configure target and mode defaults\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 // Configure devtool\n if (!compiler.options.devtool) {\n compiler.options.devtool = 'source-map';\n }\n\n // Suppress verbose infrastructure logging\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: 'warn', // Only show warnings and errors\n };\n }\n\n // Configure module rules - ensure TypeScript loader is present\n this.ensureTypeScriptLoader(compiler);\n\n // Configure resolve extensions\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = ['...', '.tsx', '.ts'];\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 // Check if TypeScript loader is already configured\n const hasTsLoader = compiler.options.module.rules.some((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 // Add TypeScript loader if not present\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; // Should never happen due to check in apply()\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 // Suppress verbose logging\n compiler.options.devServer.client = {\n logging: 'warn', // Only show warnings and errors\n overlay: {\n warnings: false, // Don't show warning overlay\n errors: true, // Still show errors\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":";;;;;;;;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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K;GACjC,MAAM;GACN,KAAK;GACL,SAAS;GACV,CAAC;;CAIN,AAAQ,mBAAmB,UAAoB,YAAiB,WAAgB,MAAc;AAC5F,MAAI,CAAC,SAAS,QAAQ,UACpB;EAGF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,KAAK;EACzD,MAAM,gBAAgB,SAAS,QAAQ,UAAU;AAEjD,WAAS,QAAQ,UAAU,OAAO;AAClC,WAAS,QAAQ,UAAU,SAAS,KAAK,KAAK,SAAS,OAAO;AAC9D,WAAS,QAAQ,UAAU,MAAM;AACjC,WAAS,QAAQ,UAAU,gBAAgB,EAAE,aAAa,MAAM;AAChE,WAAS,QAAQ,UAAU,UAAU;GACnC,+BAA+B;GAC/B,gCAAgC;GAChC,gCAAgC;GACjC;AAGD,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,75 +0,0 @@
1
- import { t as zod_d_exports } from "./zod-Zw8dlP3j.mjs";
2
-
3
- //#region src/errors.d.ts
4
-
5
- /**
6
- * Common error schemas for plugin contracts.
7
- * Import these to ensure consistent error handling across plugins.
8
- *
9
- * @example
10
- * ```typescript
11
- * import { CommonPluginErrors } from "every-plugin/errors";
12
- *
13
- * export const contract = oc.router({
14
- * getData: oc.route(...)
15
- * .errors(CommonPluginErrors)
16
- * });
17
- * ```
18
- */
19
- declare const CommonPluginErrors: {
20
- readonly UNAUTHORIZED: {
21
- readonly data: zod_d_exports.z.ZodObject<{
22
- apiKeyProvided: zod_d_exports.z.ZodBoolean;
23
- provider: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodString>;
24
- authType: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodEnum<{
25
- apiKey: "apiKey";
26
- oauth: "oauth";
27
- token: "token";
28
- }>>;
29
- }, zod_d_exports.z.core.$strip>;
30
- };
31
- readonly RATE_LIMITED: {
32
- readonly data: zod_d_exports.z.ZodObject<{
33
- retryAfter: zod_d_exports.z.ZodNumber;
34
- remainingRequests: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodNumber>;
35
- resetTime: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodString>;
36
- limitType: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodEnum<{
37
- requests: "requests";
38
- tokens: "tokens";
39
- bandwidth: "bandwidth";
40
- }>>;
41
- }, zod_d_exports.z.core.$strip>;
42
- };
43
- readonly SERVICE_UNAVAILABLE: {
44
- readonly data: zod_d_exports.z.ZodObject<{
45
- retryAfter: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodNumber>;
46
- maintenanceWindow: zod_d_exports.z.ZodDefault<zod_d_exports.z.ZodBoolean>;
47
- estimatedUptime: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodString>;
48
- }, zod_d_exports.z.core.$strip>;
49
- };
50
- readonly BAD_REQUEST: {
51
- readonly data: zod_d_exports.z.ZodObject<{
52
- invalidFields: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodArray<zod_d_exports.z.ZodString>>;
53
- validationErrors: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodArray<zod_d_exports.z.ZodObject<{
54
- field: zod_d_exports.z.ZodString;
55
- message: zod_d_exports.z.ZodString;
56
- code: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodString>;
57
- }, zod_d_exports.z.core.$strip>>>;
58
- }, zod_d_exports.z.core.$strip>;
59
- };
60
- readonly NOT_FOUND: {
61
- readonly data: zod_d_exports.z.ZodObject<{
62
- resource: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodString>;
63
- resourceId: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodString>;
64
- }, zod_d_exports.z.core.$strip>;
65
- };
66
- readonly FORBIDDEN: {
67
- readonly data: zod_d_exports.z.ZodObject<{
68
- requiredPermissions: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodArray<zod_d_exports.z.ZodString>>;
69
- action: zod_d_exports.z.ZodOptional<zod_d_exports.z.ZodString>;
70
- }, zod_d_exports.z.core.$strip>;
71
- };
72
- };
73
- //#endregion
74
- export { CommonPluginErrors as t };
75
- //# sourceMappingURL=errors-9sNpYLv5.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-9sNpYLv5.d.mts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;;;;;AAgBA;;;;;;;;;;;;cAAa"}