@cordy/electro-generator 1.2.18 → 1.2.19
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/index.mjs +4 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -113,7 +113,10 @@ function generateBridgeTypes(view, features, policy) {
|
|
|
113
113
|
if (allowedFeatures.length > 0) if (eventTypeEntries.length > 0) featureTypes.push(` events: {\n on<K extends keyof ElectroEventMap>(channel: K, handler: (payload: ElectroEventMap[K]) => void): () => void;\n on(channel: string & {}, handler: (payload: unknown) => void): () => void;\n };`);
|
|
114
114
|
else featureTypes.push(` events: {\n on(channel: string & {}, handler: (payload: unknown) => void): () => void;\n };`);
|
|
115
115
|
const content = `${HEADER}
|
|
116
|
-
type
|
|
116
|
+
type _InvokeApi<T> = {
|
|
117
|
+
[K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => Promise<Awaited<R>> : never;
|
|
118
|
+
};
|
|
119
|
+
type _SvcApi<T> = T extends { api(): infer R } ? _InvokeApi<NonNullable<R>> : never;
|
|
117
120
|
type _EventPayload<T> = T extends { payload(): infer P } ? P : unknown;${eventMapTypes}
|
|
118
121
|
|
|
119
122
|
export interface ElectroBridge ${featureTypes.length > 0 ? `{\n${featureTypes.join("\n")}\n }` : "{}"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cordy/electro-generator",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
4
4
|
"description": "Code generator for @cordy/electro — scans features and emits preload scripts and bridge types",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"prepublishOnly": "bun run build"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@cordy/electro": "1.2.
|
|
47
|
+
"@cordy/electro": "1.2.19"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"oxc-parser": "^0.114.0",
|
|
51
51
|
"tinyglobby": "^0.2.15"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@cordy/electro": "1.2.
|
|
54
|
+
"@cordy/electro": "1.2.19",
|
|
55
55
|
"tsdown": "^0.20.3",
|
|
56
56
|
"vitest": "v4.1.0-beta.3"
|
|
57
57
|
}
|