every-plugin 2.5.10 → 2.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +0 -16
- package/dist/_virtual/_rolldown/runtime.mjs +1 -33
- package/dist/build/rspack/dev-server-middleware.cjs.map +1 -1
- package/dist/build/rspack/dev-server-middleware.mjs.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -1
- package/dist/build/rspack/plugin.cjs.map +1 -1
- package/dist/build/rspack/plugin.mjs.map +1 -1
- package/dist/build/shared-deps.cjs.map +1 -1
- package/dist/build/shared-deps.mjs.map +1 -1
- package/dist/errors.cjs +37 -35
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +130 -130
- package/dist/errors.d.mts +130 -130
- package/dist/errors.mjs +35 -35
- package/dist/errors.mjs.map +1 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.mjs.map +1 -1
- package/dist/runtime/errors.cjs.map +1 -1
- package/dist/runtime/errors.mjs.map +1 -1
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/mf-config.cjs +1 -1
- package/dist/runtime/mf-config.mjs +1 -1
- package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
- package/dist/runtime/services/secrets.service.cjs +2 -1
- package/dist/runtime/services/secrets.service.cjs.map +1 -1
- package/dist/runtime/services/secrets.service.mjs +2 -2
- package/dist/runtime/services/secrets.service.mjs.map +1 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.mjs.map +1 -1
- package/dist/zod.cjs +5 -17
- package/dist/zod.d.cts +2 -8
- package/dist/zod.d.mts +2 -8
- package/dist/zod.mjs +2 -11
- package/package.json +6 -6
- package/skills/plugin-development/SKILL.md +16 -8
- package/skills/plugin-testing/SKILL.md +19 -9
- package/src/runtime/services/secrets.service.ts +1 -1
- package/src/zod-core.ts +0 -3
- package/src/zod.ts +3 -1
- package/dist/zod.cjs.map +0 -1
- package/dist/zod.d.cts.map +0 -1
- package/dist/zod.d.mts.map +0 -1
- package/dist/zod.mjs.map +0 -1
package/dist/zod.mjs
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod";
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
//#region src/zod.ts
|
|
6
|
-
var zod_exports = /* @__PURE__ */ __exportAll({});
|
|
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
|
|
3
|
+
export { z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "every-plugin",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"typecheck": "tsc --noEmit"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@rspack/core": "
|
|
99
|
+
"@rspack/core": "1.7.11",
|
|
100
100
|
"typescript": "^5.9.3",
|
|
101
101
|
"effect": "^3.21.0",
|
|
102
102
|
"zod": "^4.3.6",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"@effect/vitest": "^0.29.0",
|
|
113
113
|
"@orpc/client": "^1.13.4",
|
|
114
114
|
"@orpc/openapi": "^1.13.4",
|
|
115
|
-
"@rspack/cli": "
|
|
115
|
+
"@rspack/cli": "1.7.11",
|
|
116
116
|
"@tanstack/intent": "^0.0.40",
|
|
117
117
|
"@types/bun": "^1.3.7",
|
|
118
118
|
"@types/node": "^25.1.0",
|
|
@@ -124,9 +124,9 @@
|
|
|
124
124
|
"vitest": "^4.0.18"
|
|
125
125
|
},
|
|
126
126
|
"dependencies": {
|
|
127
|
-
"@module-federation/enhanced": "^2.
|
|
128
|
-
"@module-federation/node": "^2.7.
|
|
129
|
-
"@module-federation/runtime-core": "^2.
|
|
127
|
+
"@module-federation/enhanced": "^2.4.0",
|
|
128
|
+
"@module-federation/node": "^2.7.42",
|
|
129
|
+
"@module-federation/runtime-core": "^2.4.0",
|
|
130
130
|
"@orpc/contract": "^1.13.4",
|
|
131
131
|
"@orpc/experimental-publisher": "^1.13.4",
|
|
132
132
|
"@orpc/server": "^1.13.4",
|
|
@@ -95,6 +95,7 @@ export class MyService {
|
|
|
95
95
|
```typescript
|
|
96
96
|
import { createPlugin } from "every-plugin";
|
|
97
97
|
import { Effect } from "every-plugin/effect";
|
|
98
|
+
import { ORPCError } from "every-plugin/orpc";
|
|
98
99
|
import { z } from "every-plugin/zod";
|
|
99
100
|
import { contract } from "./contract";
|
|
100
101
|
import { MyService } from "./service";
|
|
@@ -186,23 +187,30 @@ Port assignments: host=3000, api=3001, auth=3002, ui=3003, ui-ssr=3004, plugins=
|
|
|
186
187
|
|
|
187
188
|
## Build Config (rspack.config.js)
|
|
188
189
|
|
|
189
|
-
every-plugin provides rspack
|
|
190
|
+
every-plugin provides rspack helpers as plugins:
|
|
190
191
|
|
|
191
192
|
```javascript
|
|
192
|
-
|
|
193
|
+
import {
|
|
194
|
+
EmitPluginManifest,
|
|
195
|
+
EveryPluginDevServer,
|
|
196
|
+
FixMfDataUriPlugin,
|
|
197
|
+
} from "every-plugin/build/rspack";
|
|
193
198
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
})
|
|
199
|
+
export default {
|
|
200
|
+
plugins: [
|
|
201
|
+
new EmitPluginManifest(),
|
|
202
|
+
new EveryPluginDevServer({ dts: false }),
|
|
203
|
+
new FixMfDataUriPlugin(),
|
|
204
|
+
],
|
|
205
|
+
};
|
|
198
206
|
```
|
|
199
207
|
|
|
200
|
-
|
|
208
|
+
`EveryPluginDevServer` configures the Module Federation dev server defaults. Add the manifest/fix plugins the same way the package templates do.
|
|
201
209
|
|
|
202
210
|
## Common Mistakes
|
|
203
211
|
|
|
204
212
|
- Importing `oc` from `@orpc/contract` instead of `every-plugin/orpc` — will cause version mismatches in Module Federation
|
|
205
|
-
- Importing `z` from `zod` instead of `every-plugin/zod` —
|
|
213
|
+
- Importing `z` from `zod` instead of `every-plugin/zod` — may cause Vitest CJS/ESM interop issues; always use `every-plugin/zod`
|
|
206
214
|
- Forgetting `.errors(Errors)` on routes that can throw ORPCError — untyped errors
|
|
207
215
|
- Using `Effect.runPromise` inside `Effect.gen` — use `yield*` instead for proper error channel
|
|
208
216
|
- Putting business logic in `createRouter` — keep it in the service class, router is just glue
|
|
@@ -23,7 +23,7 @@ Test the service class directly without the plugin runtime:
|
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
25
|
import { describe, expect, it } from "vitest";
|
|
26
|
-
import { Effect } from "effect";
|
|
26
|
+
import { Effect } from "every-plugin/effect";
|
|
27
27
|
import { MyService } from "../service";
|
|
28
28
|
|
|
29
29
|
describe("MyService", () => {
|
|
@@ -51,15 +51,19 @@ Test the full plugin lifecycle — initialization, router execution, shutdown:
|
|
|
51
51
|
|
|
52
52
|
```typescript
|
|
53
53
|
import { describe, expect, it, beforeAll, afterAll } from "vitest";
|
|
54
|
-
import { createPluginRuntime } from "every-plugin
|
|
54
|
+
import { createPluginRuntime } from "every-plugin";
|
|
55
55
|
import Plugin from "../index";
|
|
56
56
|
|
|
57
57
|
describe("MyPlugin integration", () => {
|
|
58
|
-
let runtime:
|
|
58
|
+
let runtime: ReturnType<typeof createPluginRuntime>;
|
|
59
59
|
let client: any;
|
|
60
60
|
|
|
61
61
|
beforeAll(async () => {
|
|
62
|
-
runtime = createPluginRuntime(
|
|
62
|
+
runtime = createPluginRuntime({
|
|
63
|
+
registry: {
|
|
64
|
+
"my-plugin": { module: Plugin },
|
|
65
|
+
},
|
|
66
|
+
});
|
|
63
67
|
const result = await runtime.usePlugin("my-plugin", {
|
|
64
68
|
variables: { baseUrl: "https://api.example.com" },
|
|
65
69
|
secrets: { apiKey: "test-key" },
|
|
@@ -68,7 +72,7 @@ describe("MyPlugin integration", () => {
|
|
|
68
72
|
});
|
|
69
73
|
|
|
70
74
|
afterAll(async () => {
|
|
71
|
-
await runtime.
|
|
75
|
+
await runtime.shutdown();
|
|
72
76
|
});
|
|
73
77
|
|
|
74
78
|
it("ping responds", async () => {
|
|
@@ -92,7 +96,8 @@ describe("MyPlugin integration", () => {
|
|
|
92
96
|
When testing an API plugin that uses `withPlugins`, mock the `pluginsClient`:
|
|
93
97
|
|
|
94
98
|
```typescript
|
|
95
|
-
import { createPluginRuntime } from "every-plugin
|
|
99
|
+
import { createPluginRuntime } from "every-plugin";
|
|
100
|
+
import ApiPlugin from "../index";
|
|
96
101
|
|
|
97
102
|
const mockRegistryClient = {
|
|
98
103
|
getRegistryStatus: vi.fn().mockResolvedValue({ status: "ok" }),
|
|
@@ -101,7 +106,11 @@ const mockRegistryClient = {
|
|
|
101
106
|
|
|
102
107
|
describe("API with mock registry", () => {
|
|
103
108
|
it("pluginDemo returns composed data", async () => {
|
|
104
|
-
const runtime = createPluginRuntime(
|
|
109
|
+
const runtime = createPluginRuntime({
|
|
110
|
+
registry: {
|
|
111
|
+
api: { module: ApiPlugin },
|
|
112
|
+
},
|
|
113
|
+
});
|
|
105
114
|
const result = await runtime.usePlugin(
|
|
106
115
|
"api",
|
|
107
116
|
{ variables: {}, secrets: {} },
|
|
@@ -110,7 +119,7 @@ describe("API with mock registry", () => {
|
|
|
110
119
|
const client = result.createClient();
|
|
111
120
|
const data = await client.pluginDemo();
|
|
112
121
|
expect(data.registryStatus.status).toBe("ok");
|
|
113
|
-
await runtime.
|
|
122
|
+
await runtime.shutdown();
|
|
114
123
|
});
|
|
115
124
|
});
|
|
116
125
|
```
|
|
@@ -146,7 +155,8 @@ export default defineConfig({
|
|
|
146
155
|
|
|
147
156
|
## Common Mistakes
|
|
148
157
|
|
|
149
|
-
- Not calling `runtime.
|
|
158
|
+
- Not calling `runtime.shutdown()` in `afterAll` — leaves plugin scopes/resources running
|
|
150
159
|
- Using `vi.fn()` without `.mockResolvedValue()` — unhandled promise rejections
|
|
151
160
|
- Forgetting `vite-tsconfig-paths` plugin — path aliases like `every-plugin/orpc` won't resolve
|
|
161
|
+
- Omitting the `registry` object when calling `createPluginRuntime(...)` — the runtime requires explicit plugin entries
|
|
152
162
|
- Testing only happy paths — always test error channels (Effect failures, ORPCError throws)
|
package/src/zod-core.ts
CHANGED
package/src/zod.ts
CHANGED
package/dist/zod.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zod.cjs","names":[],"sources":["../src/zod.ts"],"sourcesContent":["export * from \"zod\";\n"],"mappings":""}
|
package/dist/zod.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.cts","names":[],"sources":["../src/zod.ts"],"mappings":""}
|
package/dist/zod.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.mts","names":[],"sources":["../src/zod.ts"],"mappings":""}
|
package/dist/zod.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zod.mjs","names":[],"sources":["../src/zod.ts"],"sourcesContent":["export * from \"zod\";\n"],"mappings":""}
|