every-plugin 0.5.1 → 0.6.1
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 -4
- package/dist/_virtual/rolldown_runtime.mjs +1 -10
- package/dist/build/rspack/dev-server-middleware.cjs +1 -1
- package/dist/build/rspack/dev-server-middleware.cjs.map +1 -1
- package/dist/build/rspack/dev-server-middleware.mjs +1 -1
- package/dist/build/rspack/dev-server-middleware.mjs.map +1 -1
- package/dist/build/rspack/module-federation.cjs +11 -12
- package/dist/build/rspack/module-federation.cjs.map +1 -1
- package/dist/build/rspack/module-federation.mjs +11 -12
- package/dist/build/rspack/module-federation.mjs.map +1 -1
- package/dist/errors.cjs +41 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +29 -1
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.mts +29 -1
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +41 -1
- package/dist/errors.mjs.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/package.cjs +20 -161
- package/dist/package.cjs.map +1 -1
- package/dist/package.mjs +13 -163
- package/dist/package.mjs.map +1 -1
- package/dist/runtime/errors.cjs +54 -2
- package/dist/runtime/errors.cjs.map +1 -1
- package/dist/runtime/errors.mjs +54 -2
- package/dist/runtime/errors.mjs.map +1 -1
- package/dist/runtime/services/module-federation.service.cjs +7 -8
- package/dist/runtime/services/module-federation.service.cjs.map +1 -1
- package/dist/runtime/services/module-federation.service.mjs +7 -9
- package/dist/runtime/services/module-federation.service.mjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.cjs +11 -4
- package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin-loader.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin-loader.service.mjs +11 -4
- package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CommonPluginErrors } from "./errors.cjs";
|
|
1
|
+
import { CommonPluginErrors, ERROR_PATTERNS } from "./errors.cjs";
|
|
2
2
|
import { LoadedPluginWithBinding, Plugin, PluginConfigFor, createPlugin } from "./plugin.cjs";
|
|
3
3
|
import { AnyPlugin, EveryPlugin, InitializedPlugin, LoadedPlugin, PluginClientType, PluginConfigInput, PluginContext, PluginContract, PluginInstance, PluginMetadata, PluginRegistry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginVariables, RegisteredPlugins, SecretsConfig } from "./types.cjs";
|
|
4
4
|
import { PluginRuntime, createPluginRuntime } from "./runtime/index.cjs";
|
|
5
5
|
import { getNormalizedRemoteName } from "./runtime/services/normalize.cjs";
|
|
6
|
-
export { type AnyPlugin, CommonPluginErrors, type EveryPlugin, type InitializedPlugin, type LoadedPlugin, LoadedPluginWithBinding, Plugin, type PluginClientType, PluginConfigFor, type PluginConfigInput, type PluginContext, type PluginContract, type PluginInstance, type PluginMetadata, type PluginRegistry, type PluginRouterType, PluginRuntime, type PluginRuntimeConfig, type PluginSecrets, type PluginVariables, type RegisteredPlugins, type SecretsConfig, createPlugin, createPluginRuntime, getNormalizedRemoteName };
|
|
6
|
+
export { type AnyPlugin, CommonPluginErrors, ERROR_PATTERNS, type EveryPlugin, type InitializedPlugin, type LoadedPlugin, LoadedPluginWithBinding, Plugin, type PluginClientType, PluginConfigFor, type PluginConfigInput, type PluginContext, type PluginContract, type PluginInstance, type PluginMetadata, type PluginRegistry, type PluginRouterType, PluginRuntime, type PluginRuntimeConfig, type PluginSecrets, type PluginVariables, type RegisteredPlugins, type SecretsConfig, createPlugin, createPluginRuntime, getNormalizedRemoteName };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CommonPluginErrors } from "./errors.mjs";
|
|
1
|
+
import { CommonPluginErrors, ERROR_PATTERNS } from "./errors.mjs";
|
|
2
2
|
import { LoadedPluginWithBinding, Plugin, PluginConfigFor, createPlugin } from "./plugin.mjs";
|
|
3
3
|
import { AnyPlugin, EveryPlugin, InitializedPlugin, LoadedPlugin, PluginClientType, PluginConfigInput, PluginContext, PluginContract, PluginInstance, PluginMetadata, PluginRegistry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginVariables, RegisteredPlugins, SecretsConfig } from "./types.mjs";
|
|
4
4
|
import { PluginRuntime, createPluginRuntime } from "./runtime/index.mjs";
|
|
5
5
|
import { getNormalizedRemoteName } from "./runtime/services/normalize.mjs";
|
|
6
|
-
export { type AnyPlugin, CommonPluginErrors, type EveryPlugin, type InitializedPlugin, type LoadedPlugin, LoadedPluginWithBinding, Plugin, type PluginClientType, PluginConfigFor, type PluginConfigInput, type PluginContext, type PluginContract, type PluginInstance, type PluginMetadata, type PluginRegistry, type PluginRouterType, PluginRuntime, type PluginRuntimeConfig, type PluginSecrets, type PluginVariables, type RegisteredPlugins, type SecretsConfig, createPlugin, createPluginRuntime, getNormalizedRemoteName };
|
|
6
|
+
export { type AnyPlugin, CommonPluginErrors, ERROR_PATTERNS, type EveryPlugin, type InitializedPlugin, type LoadedPlugin, LoadedPluginWithBinding, Plugin, type PluginClientType, PluginConfigFor, type PluginConfigInput, type PluginContext, type PluginContract, type PluginInstance, type PluginMetadata, type PluginRegistry, type PluginRouterType, PluginRuntime, type PluginRuntimeConfig, type PluginSecrets, type PluginVariables, type RegisteredPlugins, type SecretsConfig, createPlugin, createPluginRuntime, getNormalizedRemoteName };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CommonPluginErrors } from "./errors.mjs";
|
|
1
|
+
import { CommonPluginErrors, ERROR_PATTERNS } from "./errors.mjs";
|
|
2
2
|
import { createPlugin } from "./plugin.mjs";
|
|
3
3
|
import { getNormalizedRemoteName } from "./runtime/services/normalize.mjs";
|
|
4
4
|
import { PluginRuntime, createPluginRuntime } from "./runtime/index.mjs";
|
|
5
5
|
|
|
6
|
-
export { CommonPluginErrors, PluginRuntime, createPlugin, createPluginRuntime, getNormalizedRemoteName };
|
|
6
|
+
export { CommonPluginErrors, ERROR_PATTERNS, PluginRuntime, createPlugin, createPluginRuntime, getNormalizedRemoteName };
|
package/dist/package.cjs
CHANGED
|
@@ -1,170 +1,29 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
1
|
|
|
3
2
|
//#region package.json
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"require": "./dist/index.d.cts"
|
|
17
|
-
},
|
|
18
|
-
"import": "./dist/index.mjs",
|
|
19
|
-
"require": "./dist/index.cjs"
|
|
20
|
-
},
|
|
21
|
-
"./runtime": {
|
|
22
|
-
"types": {
|
|
23
|
-
"import": "./dist/runtime/index.d.mts",
|
|
24
|
-
"require": "./dist/runtime/index.d.cts"
|
|
25
|
-
},
|
|
26
|
-
"import": "./dist/runtime/index.mjs",
|
|
27
|
-
"require": "./dist/runtime/index.cjs"
|
|
28
|
-
},
|
|
29
|
-
"./testing": {
|
|
30
|
-
"types": {
|
|
31
|
-
"import": "./dist/testing/index.d.mts",
|
|
32
|
-
"require": "./dist/testing/index.d.cts"
|
|
33
|
-
},
|
|
34
|
-
"import": "./dist/testing/index.mjs",
|
|
35
|
-
"require": "./dist/testing/index.cjs"
|
|
36
|
-
},
|
|
37
|
-
"./normalize": {
|
|
38
|
-
"types": {
|
|
39
|
-
"import": "./dist/runtime/services/normalize.d.mts",
|
|
40
|
-
"require": "./dist/runtime/services/normalize.d.cts"
|
|
41
|
-
},
|
|
42
|
-
"import": "./dist/runtime/services/normalize.mjs",
|
|
43
|
-
"require": "./dist/runtime/services/normalize.cjs"
|
|
44
|
-
},
|
|
45
|
-
"./effect": {
|
|
46
|
-
"types": {
|
|
47
|
-
"import": "./dist/effect.d.mts",
|
|
48
|
-
"require": "./dist/effect.d.cts"
|
|
49
|
-
},
|
|
50
|
-
"import": "./dist/effect.mjs",
|
|
51
|
-
"require": "./dist/effect.cjs"
|
|
52
|
-
},
|
|
53
|
-
"./zod": {
|
|
54
|
-
"types": {
|
|
55
|
-
"import": "./dist/zod.d.mts",
|
|
56
|
-
"require": "./dist/zod.d.cts"
|
|
57
|
-
},
|
|
58
|
-
"import": "./dist/zod.mjs",
|
|
59
|
-
"require": "./dist/zod.cjs"
|
|
60
|
-
},
|
|
61
|
-
"./zod/v4/core": {
|
|
62
|
-
"types": {
|
|
63
|
-
"import": "./dist/zod-core.d.mts",
|
|
64
|
-
"require": "./dist/zod-core.d.cts"
|
|
65
|
-
},
|
|
66
|
-
"import": "./dist/zod-core.mjs",
|
|
67
|
-
"require": "./dist/zod-core.cjs"
|
|
68
|
-
},
|
|
69
|
-
"./orpc": {
|
|
70
|
-
"types": {
|
|
71
|
-
"import": "./dist/orpc.d.mts",
|
|
72
|
-
"require": "./dist/orpc.d.cts"
|
|
73
|
-
},
|
|
74
|
-
"import": "./dist/orpc.mjs",
|
|
75
|
-
"require": "./dist/orpc.cjs"
|
|
76
|
-
},
|
|
77
|
-
"./errors": {
|
|
78
|
-
"types": {
|
|
79
|
-
"import": "./dist/errors.d.mts",
|
|
80
|
-
"require": "./dist/errors.d.cts"
|
|
81
|
-
},
|
|
82
|
-
"import": "./dist/errors.mjs",
|
|
83
|
-
"require": "./dist/errors.cjs"
|
|
84
|
-
},
|
|
85
|
-
"./types": {
|
|
86
|
-
"types": {
|
|
87
|
-
"import": "./dist/types.d.mts",
|
|
88
|
-
"require": "./dist/types.d.cts"
|
|
89
|
-
},
|
|
90
|
-
"import": "./dist/types.mjs",
|
|
91
|
-
"require": "./dist/types.cjs"
|
|
92
|
-
},
|
|
93
|
-
"./build/rspack": {
|
|
94
|
-
"types": {
|
|
95
|
-
"import": "./dist/build/rspack/index.d.mts",
|
|
96
|
-
"require": "./dist/build/rspack/index.d.cts"
|
|
97
|
-
},
|
|
98
|
-
"import": "./dist/build/rspack/index.mjs",
|
|
99
|
-
"require": "./dist/build/rspack/index.cjs"
|
|
100
|
-
},
|
|
101
|
-
"./package.json": "./package.json"
|
|
102
|
-
},
|
|
103
|
-
"files": ["dist"],
|
|
104
|
-
"scripts": {
|
|
105
|
-
"build": "tsdown",
|
|
106
|
-
"build:test": "cd tests/fixtures/test-plugin && bun run build",
|
|
107
|
-
"test": "vitest run --config vitest.config.ts",
|
|
108
|
-
"test:unit": "vitest run --config vitest.config.ts",
|
|
109
|
-
"test:integration": "bun run build:test && vitest run --config vitest.integration.config.ts",
|
|
110
|
-
"test:all": "bun run test:unit && bun run test:integration",
|
|
111
|
-
"test:watch": "vitest --config vitest.config.ts --watch",
|
|
112
|
-
"typecheck": "tsc --noEmit"
|
|
113
|
-
},
|
|
114
|
-
"peerDependencies": {
|
|
115
|
-
"@rspack/core": "*",
|
|
116
|
-
"typescript": "^5.6.0"
|
|
117
|
-
},
|
|
118
|
-
"devDependencies": {
|
|
119
|
-
"@effect/language-service": "^0.38.4",
|
|
120
|
-
"@effect/vitest": "^0.25.1",
|
|
121
|
-
"@orpc/client": "^1.10.0",
|
|
122
|
-
"@orpc/openapi": "^1.10.4",
|
|
123
|
-
"@rspack/cli": "^1.5.8",
|
|
124
|
-
"@types/bun": "^1.3.0",
|
|
125
|
-
"@types/node": "^24.9.0",
|
|
126
|
-
"@vitest/ui": "3.2.4",
|
|
127
|
-
"bun-types": "^1.3.0",
|
|
128
|
-
"sirv": "^3.0.2",
|
|
129
|
-
"tsdown": "^0.16.1",
|
|
130
|
-
"vite-tsconfig-paths": "^5.1.4",
|
|
131
|
-
"vitest": "^3.2.4"
|
|
132
|
-
},
|
|
133
|
-
"dependencies": {
|
|
134
|
-
"@module-federation/enhanced": "^0.19.1",
|
|
135
|
-
"@module-federation/node": "^2.7.15",
|
|
136
|
-
"@module-federation/runtime-core": "^0.19.1",
|
|
137
|
-
"@orpc/contract": "^1.10.0",
|
|
138
|
-
"@orpc/experimental-publisher": "^1.10.0",
|
|
139
|
-
"@orpc/server": "^1.10.0",
|
|
140
|
-
"@orpc/zod": "^1.10.0",
|
|
141
|
-
"effect": "3.18.1",
|
|
142
|
-
"zod": "4.1.5"
|
|
143
|
-
},
|
|
144
|
-
"keywords": [
|
|
145
|
-
"plugin",
|
|
146
|
-
"module-federation",
|
|
147
|
-
"orpc",
|
|
148
|
-
"zod",
|
|
149
|
-
"typescript"
|
|
150
|
-
],
|
|
151
|
-
"author": "plugin.every.near",
|
|
152
|
-
"license": "MIT",
|
|
153
|
-
"repository": {
|
|
154
|
-
"type": "git",
|
|
155
|
-
"url": "https://github.com/near-everything/every-plugin.git"
|
|
156
|
-
},
|
|
157
|
-
"bugs": { "url": "https://github.com/near-everything/every-plugin/issues" },
|
|
158
|
-
"homepage": "https://plugin.everything.dev",
|
|
159
|
-
"workspaces": ["tests/fixtures/*"]
|
|
160
|
-
};
|
|
161
|
-
}) });
|
|
3
|
+
var version = "0.6.1";
|
|
4
|
+
var dependencies = {
|
|
5
|
+
"@module-federation/enhanced": "^0.19.1",
|
|
6
|
+
"@module-federation/node": "^2.7.15",
|
|
7
|
+
"@module-federation/runtime-core": "^0.19.1",
|
|
8
|
+
"@orpc/contract": "^1.10.0",
|
|
9
|
+
"@orpc/experimental-publisher": "^1.10.0",
|
|
10
|
+
"@orpc/server": "^1.10.0",
|
|
11
|
+
"@orpc/zod": "^1.10.0",
|
|
12
|
+
"effect": "3.18.1",
|
|
13
|
+
"zod": "4.1.5"
|
|
14
|
+
};
|
|
162
15
|
|
|
163
16
|
//#endregion
|
|
164
|
-
Object.defineProperty(exports, '
|
|
17
|
+
Object.defineProperty(exports, 'dependencies', {
|
|
165
18
|
enumerable: true,
|
|
166
19
|
get: function () {
|
|
167
|
-
return
|
|
20
|
+
return dependencies;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, 'version', {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () {
|
|
26
|
+
return version;
|
|
168
27
|
}
|
|
169
28
|
});
|
|
170
29
|
//# sourceMappingURL=package.cjs.map
|
package/dist/package.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.cjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"every-plugin\",\n\t\"version\": \"0.
|
|
1
|
+
{"version":3,"file":"package.cjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"every-plugin\",\n\t\"version\": \"0.6.1\",\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,167 +1,17 @@
|
|
|
1
|
-
import { __commonJS } from "./_virtual/rolldown_runtime.mjs";
|
|
2
|
-
|
|
3
1
|
//#region package.json
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"require": "./dist/index.d.cts"
|
|
17
|
-
},
|
|
18
|
-
"import": "./dist/index.mjs",
|
|
19
|
-
"require": "./dist/index.cjs"
|
|
20
|
-
},
|
|
21
|
-
"./runtime": {
|
|
22
|
-
"types": {
|
|
23
|
-
"import": "./dist/runtime/index.d.mts",
|
|
24
|
-
"require": "./dist/runtime/index.d.cts"
|
|
25
|
-
},
|
|
26
|
-
"import": "./dist/runtime/index.mjs",
|
|
27
|
-
"require": "./dist/runtime/index.cjs"
|
|
28
|
-
},
|
|
29
|
-
"./testing": {
|
|
30
|
-
"types": {
|
|
31
|
-
"import": "./dist/testing/index.d.mts",
|
|
32
|
-
"require": "./dist/testing/index.d.cts"
|
|
33
|
-
},
|
|
34
|
-
"import": "./dist/testing/index.mjs",
|
|
35
|
-
"require": "./dist/testing/index.cjs"
|
|
36
|
-
},
|
|
37
|
-
"./normalize": {
|
|
38
|
-
"types": {
|
|
39
|
-
"import": "./dist/runtime/services/normalize.d.mts",
|
|
40
|
-
"require": "./dist/runtime/services/normalize.d.cts"
|
|
41
|
-
},
|
|
42
|
-
"import": "./dist/runtime/services/normalize.mjs",
|
|
43
|
-
"require": "./dist/runtime/services/normalize.cjs"
|
|
44
|
-
},
|
|
45
|
-
"./effect": {
|
|
46
|
-
"types": {
|
|
47
|
-
"import": "./dist/effect.d.mts",
|
|
48
|
-
"require": "./dist/effect.d.cts"
|
|
49
|
-
},
|
|
50
|
-
"import": "./dist/effect.mjs",
|
|
51
|
-
"require": "./dist/effect.cjs"
|
|
52
|
-
},
|
|
53
|
-
"./zod": {
|
|
54
|
-
"types": {
|
|
55
|
-
"import": "./dist/zod.d.mts",
|
|
56
|
-
"require": "./dist/zod.d.cts"
|
|
57
|
-
},
|
|
58
|
-
"import": "./dist/zod.mjs",
|
|
59
|
-
"require": "./dist/zod.cjs"
|
|
60
|
-
},
|
|
61
|
-
"./zod/v4/core": {
|
|
62
|
-
"types": {
|
|
63
|
-
"import": "./dist/zod-core.d.mts",
|
|
64
|
-
"require": "./dist/zod-core.d.cts"
|
|
65
|
-
},
|
|
66
|
-
"import": "./dist/zod-core.mjs",
|
|
67
|
-
"require": "./dist/zod-core.cjs"
|
|
68
|
-
},
|
|
69
|
-
"./orpc": {
|
|
70
|
-
"types": {
|
|
71
|
-
"import": "./dist/orpc.d.mts",
|
|
72
|
-
"require": "./dist/orpc.d.cts"
|
|
73
|
-
},
|
|
74
|
-
"import": "./dist/orpc.mjs",
|
|
75
|
-
"require": "./dist/orpc.cjs"
|
|
76
|
-
},
|
|
77
|
-
"./errors": {
|
|
78
|
-
"types": {
|
|
79
|
-
"import": "./dist/errors.d.mts",
|
|
80
|
-
"require": "./dist/errors.d.cts"
|
|
81
|
-
},
|
|
82
|
-
"import": "./dist/errors.mjs",
|
|
83
|
-
"require": "./dist/errors.cjs"
|
|
84
|
-
},
|
|
85
|
-
"./types": {
|
|
86
|
-
"types": {
|
|
87
|
-
"import": "./dist/types.d.mts",
|
|
88
|
-
"require": "./dist/types.d.cts"
|
|
89
|
-
},
|
|
90
|
-
"import": "./dist/types.mjs",
|
|
91
|
-
"require": "./dist/types.cjs"
|
|
92
|
-
},
|
|
93
|
-
"./build/rspack": {
|
|
94
|
-
"types": {
|
|
95
|
-
"import": "./dist/build/rspack/index.d.mts",
|
|
96
|
-
"require": "./dist/build/rspack/index.d.cts"
|
|
97
|
-
},
|
|
98
|
-
"import": "./dist/build/rspack/index.mjs",
|
|
99
|
-
"require": "./dist/build/rspack/index.cjs"
|
|
100
|
-
},
|
|
101
|
-
"./package.json": "./package.json"
|
|
102
|
-
},
|
|
103
|
-
"files": ["dist"],
|
|
104
|
-
"scripts": {
|
|
105
|
-
"build": "tsdown",
|
|
106
|
-
"build:test": "cd tests/fixtures/test-plugin && bun run build",
|
|
107
|
-
"test": "vitest run --config vitest.config.ts",
|
|
108
|
-
"test:unit": "vitest run --config vitest.config.ts",
|
|
109
|
-
"test:integration": "bun run build:test && vitest run --config vitest.integration.config.ts",
|
|
110
|
-
"test:all": "bun run test:unit && bun run test:integration",
|
|
111
|
-
"test:watch": "vitest --config vitest.config.ts --watch",
|
|
112
|
-
"typecheck": "tsc --noEmit"
|
|
113
|
-
},
|
|
114
|
-
"peerDependencies": {
|
|
115
|
-
"@rspack/core": "*",
|
|
116
|
-
"typescript": "^5.6.0"
|
|
117
|
-
},
|
|
118
|
-
"devDependencies": {
|
|
119
|
-
"@effect/language-service": "^0.38.4",
|
|
120
|
-
"@effect/vitest": "^0.25.1",
|
|
121
|
-
"@orpc/client": "^1.10.0",
|
|
122
|
-
"@orpc/openapi": "^1.10.4",
|
|
123
|
-
"@rspack/cli": "^1.5.8",
|
|
124
|
-
"@types/bun": "^1.3.0",
|
|
125
|
-
"@types/node": "^24.9.0",
|
|
126
|
-
"@vitest/ui": "3.2.4",
|
|
127
|
-
"bun-types": "^1.3.0",
|
|
128
|
-
"sirv": "^3.0.2",
|
|
129
|
-
"tsdown": "^0.16.1",
|
|
130
|
-
"vite-tsconfig-paths": "^5.1.4",
|
|
131
|
-
"vitest": "^3.2.4"
|
|
132
|
-
},
|
|
133
|
-
"dependencies": {
|
|
134
|
-
"@module-federation/enhanced": "^0.19.1",
|
|
135
|
-
"@module-federation/node": "^2.7.15",
|
|
136
|
-
"@module-federation/runtime-core": "^0.19.1",
|
|
137
|
-
"@orpc/contract": "^1.10.0",
|
|
138
|
-
"@orpc/experimental-publisher": "^1.10.0",
|
|
139
|
-
"@orpc/server": "^1.10.0",
|
|
140
|
-
"@orpc/zod": "^1.10.0",
|
|
141
|
-
"effect": "3.18.1",
|
|
142
|
-
"zod": "4.1.5"
|
|
143
|
-
},
|
|
144
|
-
"keywords": [
|
|
145
|
-
"plugin",
|
|
146
|
-
"module-federation",
|
|
147
|
-
"orpc",
|
|
148
|
-
"zod",
|
|
149
|
-
"typescript"
|
|
150
|
-
],
|
|
151
|
-
"author": "plugin.every.near",
|
|
152
|
-
"license": "MIT",
|
|
153
|
-
"repository": {
|
|
154
|
-
"type": "git",
|
|
155
|
-
"url": "https://github.com/near-everything/every-plugin.git"
|
|
156
|
-
},
|
|
157
|
-
"bugs": { "url": "https://github.com/near-everything/every-plugin/issues" },
|
|
158
|
-
"homepage": "https://plugin.everything.dev",
|
|
159
|
-
"workspaces": ["tests/fixtures/*"]
|
|
160
|
-
};
|
|
161
|
-
}) });
|
|
2
|
+
var version = "0.6.1";
|
|
3
|
+
var dependencies = {
|
|
4
|
+
"@module-federation/enhanced": "^0.19.1",
|
|
5
|
+
"@module-federation/node": "^2.7.15",
|
|
6
|
+
"@module-federation/runtime-core": "^0.19.1",
|
|
7
|
+
"@orpc/contract": "^1.10.0",
|
|
8
|
+
"@orpc/experimental-publisher": "^1.10.0",
|
|
9
|
+
"@orpc/server": "^1.10.0",
|
|
10
|
+
"@orpc/zod": "^1.10.0",
|
|
11
|
+
"effect": "3.18.1",
|
|
12
|
+
"zod": "4.1.5"
|
|
13
|
+
};
|
|
162
14
|
|
|
163
15
|
//#endregion
|
|
164
|
-
export
|
|
165
|
-
|
|
166
|
-
export { require_package };
|
|
16
|
+
export { dependencies, version };
|
|
167
17
|
//# sourceMappingURL=package.mjs.map
|
package/dist/package.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.mjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"every-plugin\",\n\t\"version\": \"0.
|
|
1
|
+
{"version":3,"file":"package.mjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"every-plugin\",\n\t\"version\": \"0.6.1\",\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/runtime/errors.cjs
CHANGED
|
@@ -6,6 +6,56 @@ let __orpc_contract = require("@orpc/contract");
|
|
|
6
6
|
var PluginRuntimeError = class extends effect.Data.TaggedError("PluginRuntimeError") {};
|
|
7
7
|
var ModuleFederationError = class extends effect.Data.TaggedError("ModuleFederationError") {};
|
|
8
8
|
var ValidationError = class extends effect.Data.TaggedError("ValidationError") {};
|
|
9
|
+
const extractErrorMessage = (error) => {
|
|
10
|
+
if (!error) return "Unknown error";
|
|
11
|
+
if (error instanceof Error) {
|
|
12
|
+
if (error.message) return error.message;
|
|
13
|
+
if (error.cause instanceof Error) return extractErrorMessage(error.cause);
|
|
14
|
+
}
|
|
15
|
+
if (error instanceof AggregateError && error.errors?.length) return error.errors.map((e) => extractErrorMessage(e)).join("; ");
|
|
16
|
+
if (typeof error === "object" && "message" in error) return String(error.message);
|
|
17
|
+
return String(error);
|
|
18
|
+
};
|
|
19
|
+
const formatPluginError = (pluginId, operation, message) => {
|
|
20
|
+
const lines = [];
|
|
21
|
+
lines.push(`\n╭─ Plugin Error ${"─".repeat(40)}`);
|
|
22
|
+
if (pluginId) lines.push(`│ Plugin: ${pluginId}`);
|
|
23
|
+
if (operation) lines.push(`│ During: ${operation}`);
|
|
24
|
+
lines.push(`│`);
|
|
25
|
+
if (message.includes("ECONNREFUSED")) {
|
|
26
|
+
lines.push(`│ ❌ Connection refused`);
|
|
27
|
+
lines.push(`│ `);
|
|
28
|
+
lines.push(`│ A required service is not running.`);
|
|
29
|
+
lines.push(`│ → Run: docker compose up -d`);
|
|
30
|
+
} else if (message.includes("ENOTFOUND")) {
|
|
31
|
+
lines.push(`│ ❌ Host not found`);
|
|
32
|
+
lines.push(`│ `);
|
|
33
|
+
lines.push(`│ Check your connection URL or network settings.`);
|
|
34
|
+
} else if (message.includes("ETIMEDOUT") || message.includes("timeout")) {
|
|
35
|
+
lines.push(`│ ❌ Connection timeout`);
|
|
36
|
+
lines.push(`│ `);
|
|
37
|
+
lines.push(`│ The service took too long to respond.`);
|
|
38
|
+
} else if (message.includes("EACCES") || message.includes("permission")) {
|
|
39
|
+
lines.push(`│ ❌ Permission denied`);
|
|
40
|
+
lines.push(`│ `);
|
|
41
|
+
lines.push(`│ Check credentials or access permissions.`);
|
|
42
|
+
} else if (message.includes("401") || message.includes("unauthorized")) {
|
|
43
|
+
lines.push(`│ ❌ Authentication failed`);
|
|
44
|
+
lines.push(`│ `);
|
|
45
|
+
lines.push(`│ Check your API key or credentials.`);
|
|
46
|
+
} else lines.push(`│ ❌ ${message}`);
|
|
47
|
+
lines.push(`╰${"─".repeat(50)}\n`);
|
|
48
|
+
console.error(lines.join("\n"));
|
|
49
|
+
};
|
|
50
|
+
const isRetryableError = (message) => {
|
|
51
|
+
return [
|
|
52
|
+
"ETIMEDOUT",
|
|
53
|
+
"ECONNRESET",
|
|
54
|
+
"timeout",
|
|
55
|
+
"503",
|
|
56
|
+
"429"
|
|
57
|
+
].some((p) => message.toLowerCase().includes(p.toLowerCase()));
|
|
58
|
+
};
|
|
9
59
|
const isRetryableORPCCode = (code) => {
|
|
10
60
|
switch (code) {
|
|
11
61
|
case "TOO_MANY_REQUESTS":
|
|
@@ -28,12 +78,14 @@ const wrapORPCError = (orpcError, pluginId, procedureName, operation) => {
|
|
|
28
78
|
const toPluginRuntimeError = (error, pluginId, procedureName, operation, defaultRetryable = false) => {
|
|
29
79
|
if (error instanceof __orpc_contract.ORPCError) return wrapORPCError(error, pluginId, procedureName, operation);
|
|
30
80
|
if (error instanceof PluginRuntimeError) return error;
|
|
81
|
+
const message = extractErrorMessage(error);
|
|
82
|
+
formatPluginError(pluginId, operation, message);
|
|
31
83
|
return new PluginRuntimeError({
|
|
32
84
|
pluginId,
|
|
33
85
|
operation,
|
|
34
86
|
procedureName,
|
|
35
|
-
retryable: defaultRetryable,
|
|
36
|
-
cause: error instanceof Error ? error : new Error(
|
|
87
|
+
retryable: defaultRetryable || isRetryableError(message),
|
|
88
|
+
cause: error instanceof Error ? error : new Error(message)
|
|
37
89
|
});
|
|
38
90
|
};
|
|
39
91
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","names":["Data","ORPCError"],"sources":["../../src/runtime/errors.ts"],"sourcesContent":["import { ORPCError } from \"@orpc/contract\";\nimport { Data } from \"effect\";\nimport type { z } from \"zod\";\n\nexport class PluginRuntimeError extends Data.TaggedError(\"PluginRuntimeError\")<{\n\treadonly pluginId?: string;\n\treadonly operation?: string;\n\treadonly procedureName?: string;\n\treadonly cause?: Error;\n\treadonly retryable: boolean;\n}> { }\n\nexport class ModuleFederationError extends Data.TaggedError(\n\t\"ModuleFederationError\",\n)<{\n\treadonly pluginId: string;\n\treadonly remoteUrl: string;\n\treadonly cause?: Error;\n}> { }\n\nexport class ValidationError extends Data.TaggedError(\"ValidationError\")<{\n\treadonly pluginId: string;\n\treadonly stage: \"config\" | \"input\" | \"output\" | \"state\";\n\treadonly zodError: z.ZodError;\n}> { }\n\n// Helper to determine if an oRPC error code is retryable\nexport const isRetryableORPCCode = (code: string): boolean => {\n\tswitch (code) {\n\t\tcase 'TOO_MANY_REQUESTS':\n\t\tcase 'SERVICE_UNAVAILABLE':\n\t\tcase 'BAD_GATEWAY':\n\t\tcase 'GATEWAY_TIMEOUT':\n\t\tcase 'TIMEOUT':\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n};\n\n// Convert ORPC errors from plugin procedures to PluginRuntimeError\nexport const wrapORPCError = (\n\torpcError: ORPCError<string, unknown>,\n\tpluginId?: string,\n\tprocedureName?: string,\n\toperation?: string\n): PluginRuntimeError => {\n\treturn new PluginRuntimeError({\n\t\tpluginId,\n\t\toperation,\n\t\tprocedureName,\n\t\tretryable: isRetryableORPCCode(orpcError.code),\n\t\tcause: orpcError as Error\n\t});\n};\n\n// Universal error converter for the runtime\nexport const toPluginRuntimeError = (\n\terror: unknown,\n\tpluginId?: string,\n\tprocedureName?: string,\n\toperation?: string,\n\tdefaultRetryable = false\n): PluginRuntimeError => {\n\tif (error instanceof ORPCError) {\n\t\treturn wrapORPCError(error, pluginId, procedureName, operation);\n\t}\n\n\tif (error instanceof PluginRuntimeError) {\n\t\treturn error
|
|
1
|
+
{"version":3,"file":"errors.cjs","names":["Data","lines: string[]","ORPCError"],"sources":["../../src/runtime/errors.ts"],"sourcesContent":["import { ORPCError } from \"@orpc/contract\";\nimport { Data } from \"effect\";\nimport type { z } from \"zod\";\n\nexport class PluginRuntimeError extends Data.TaggedError(\"PluginRuntimeError\")<{\n\treadonly pluginId?: string;\n\treadonly operation?: string;\n\treadonly procedureName?: string;\n\treadonly cause?: Error;\n\treadonly retryable: boolean;\n}> { }\n\nexport class ModuleFederationError extends Data.TaggedError(\n\t\"ModuleFederationError\",\n)<{\n\treadonly pluginId: string;\n\treadonly remoteUrl: string;\n\treadonly cause?: Error;\n}> { }\n\nexport class ValidationError extends Data.TaggedError(\"ValidationError\")<{\n\treadonly pluginId: string;\n\treadonly stage: \"config\" | \"input\" | \"output\" | \"state\";\n\treadonly zodError: z.ZodError;\n}> { }\n\nconst extractErrorMessage = (error: unknown): string => {\n\tif (!error) return 'Unknown error';\n\n\tif (error instanceof Error) {\n\t\tif (error.message) return error.message;\n\t\tif ((error as any).cause instanceof Error) {\n\t\t\treturn extractErrorMessage((error as any).cause);\n\t\t}\n\t}\n\n\tif (error instanceof AggregateError && error.errors?.length) {\n\t\treturn error.errors.map(e => extractErrorMessage(e)).join('; ');\n\t}\n\n\tif (typeof error === 'object' && 'message' in error) {\n\t\treturn String((error as any).message);\n\t}\n\n\treturn String(error);\n};\n\nconst formatPluginError = (\n\tpluginId: string | undefined,\n\toperation: string | undefined,\n\tmessage: string\n): void => {\n\tconst lines: string[] = [];\n\n\tlines.push(`\\n╭─ Plugin Error ${'─'.repeat(40)}`);\n\tif (pluginId) lines.push(`│ Plugin: ${pluginId}`);\n\tif (operation) lines.push(`│ During: ${operation}`);\n\tlines.push(`│`);\n\n\tif (message.includes('ECONNREFUSED')) {\n\t\tlines.push(`│ ❌ Connection refused`);\n\t\tlines.push(`│ `);\n\t\tlines.push(`│ A required service is not running.`);\n\t\tlines.push(`│ → Run: docker compose up -d`);\n\t} else if (message.includes('ENOTFOUND')) {\n\t\tlines.push(`│ ❌ Host not found`);\n\t\tlines.push(`│ `);\n\t\tlines.push(`│ Check your connection URL or network settings.`);\n\t} else if (message.includes('ETIMEDOUT') || message.includes('timeout')) {\n\t\tlines.push(`│ ❌ Connection timeout`);\n\t\tlines.push(`│ `);\n\t\tlines.push(`│ The service took too long to respond.`);\n\t} else if (message.includes('EACCES') || message.includes('permission')) {\n\t\tlines.push(`│ ❌ Permission denied`);\n\t\tlines.push(`│ `);\n\t\tlines.push(`│ Check credentials or access permissions.`);\n\t} else if (message.includes('401') || message.includes('unauthorized')) {\n\t\tlines.push(`│ ❌ Authentication failed`);\n\t\tlines.push(`│ `);\n\t\tlines.push(`│ Check your API key or credentials.`);\n\t} else {\n\t\tlines.push(`│ ❌ ${message}`);\n\t}\n\n\tlines.push(`╰${'─'.repeat(50)}\\n`);\n\n\tconsole.error(lines.join('\\n'));\n};\n\nconst isRetryableError = (message: string): boolean => {\n\tconst retryablePatterns = ['ETIMEDOUT', 'ECONNRESET', 'timeout', '503', '429'];\n\treturn retryablePatterns.some(p => message.toLowerCase().includes(p.toLowerCase()));\n};\n\n// Helper to determine if an oRPC error code is retryable\nexport const isRetryableORPCCode = (code: string): boolean => {\n\tswitch (code) {\n\t\tcase 'TOO_MANY_REQUESTS':\n\t\tcase 'SERVICE_UNAVAILABLE':\n\t\tcase 'BAD_GATEWAY':\n\t\tcase 'GATEWAY_TIMEOUT':\n\t\tcase 'TIMEOUT':\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n};\n\n// Convert ORPC errors from plugin procedures to PluginRuntimeError\nexport const wrapORPCError = (\n\torpcError: ORPCError<string, unknown>,\n\tpluginId?: string,\n\tprocedureName?: string,\n\toperation?: string\n): PluginRuntimeError => {\n\treturn new PluginRuntimeError({\n\t\tpluginId,\n\t\toperation,\n\t\tprocedureName,\n\t\tretryable: isRetryableORPCCode(orpcError.code),\n\t\tcause: orpcError as Error\n\t});\n};\n\n// Universal error converter for the runtime\nexport const toPluginRuntimeError = (\n\terror: unknown,\n\tpluginId?: string,\n\tprocedureName?: string,\n\toperation?: string,\n\tdefaultRetryable = false\n): PluginRuntimeError => {\n\tif (error instanceof ORPCError) {\n\t\treturn wrapORPCError(error, pluginId, procedureName, operation);\n\t}\n\n\tif (error instanceof PluginRuntimeError) {\n\t\treturn error;\n\t}\n\n\tconst message = extractErrorMessage(error);\n\n\tformatPluginError(pluginId, operation, message);\n\n\treturn new PluginRuntimeError({\n\t\tpluginId,\n\t\toperation,\n\t\tprocedureName,\n\t\tretryable: defaultRetryable || isRetryableError(message),\n\t\tcause: error instanceof Error ? error : new Error(message)\n\t});\n};\n"],"mappings":"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"}
|