@virid/renderer 0.1.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.
- package/LICENSE +190 -0
- package/README.md +1 -0
- package/README.zh.md +1 -0
- package/dist/index.cjs +10 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +54 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Ailrid
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
todo
|
package/README.zh.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
todo
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @virid/renderer v0.0.1
|
|
3
|
+
* Electron renderer process adapter for virid, responsible for forwarding and receiving messages from the main process
|
|
4
|
+
*/
|
|
5
|
+
var s=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var D=(e,r,i)=>r in e?s(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i;var t=(e,r)=>s(e,"name",{value:r,configurable:!0});var T=(e,r)=>{for(var i in r)s(e,i,{get:r[i],enumerable:!0})},V=(e,r,i,_)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of M(r))!y.call(e,o)&&o!==i&&s(e,o,{get:()=>r[o],enumerable:!(_=E(r,o))||_.enumerable});return e};var $=e=>V(s({},"__esModule",{value:!0}),e);var a=(e,r,i)=>D(e,typeof r!="symbol"?r+"":r,i);var P={};T(P,{FromIpc:()=>A,FromMainMessage:()=>c,RenderPlugin:()=>G,ToMainMessage:()=>d,convertFromMainMessage:()=>l,middleWare:()=>g});module.exports=$(P);var v=require("@virid/core");var f=class f extends v.EventMessage{constructor(){super(...arguments);a(this,"__virid_source","unknown");a(this,"__virid_target");a(this,"__virid_messageType")}};t(f,"FromMainMessage");var c=f,w=class w extends v.EventMessage{};t(w,"ToMainMessage"),a(w,"__virid_source");var d=w;var u=require("@virid/core");var g=t((e,r)=>{if(e instanceof d){let{__virid_target:i,__virid_messageType:_,...o}=e;if(i==d.__virid_source){u.MessageWriter.warn(`[Virid Render] Prohibit Sending To Oneself: ${i} is not allowed in ToRenderMessage.`);return}window.__VIRID_BRIDGE__.post({__virid_source:d.__virid_source,__virid_target:i,__virid_messageType:_,payload:o})}else r()},"middleWare");var p=require("@virid/core");var m=new Map;function A(e){return function(r){m.has(e)&&p.MessageWriter.error(new Error(`[Virid Main] Duplicate IpcMessage: Registration for type: ${e}`)),m.set(e,r)}}t(A,"FromIpc");function l(e){let{__virid_source:r,__virid_target:i,__virid_messageType:_,payload:o}=e;if(!_||!r||!i){p.MessageWriter.error(new Error(`[Virid Render] Incomplete Data:
|
|
6
|
+
__virid_source: ${r}
|
|
7
|
+
__virid_target:${i}
|
|
8
|
+
__virid_messageType: ${_}.`));return}if(!m.has(_)){p.MessageWriter.error(new Error(`[Virid Render] Unregistered type: ${_} `));return}let x=m.get(_),n=new x;n.__virid_source=r,n.__virid_target=i,n.__virid_messageType=_,o&&Object.assign(n,o),p.MessageWriter.write(n)}t(l,"convertFromMainMessage");var I=require("@virid/core");function R(e,r){window.__VIRID_BRIDGE__||I.MessageWriter.error(new Error("[Virid Render] Preloading Failed: Please initialize in the preloaded script first.")),r?.windowId||I.MessageWriter.error(new Error(`[Virid Render] Activate Failed:
|
|
9
|
+
Please provide the windowId:${r?.windowId}.`)),d.__virid_source=r.windowId,window.__VIRID_BRIDGE__.post({__virid_source:r.windowId,__virid_target:"main",__virid_messageType:"VIRID_INTERNAL_REGISTER",payload:{windowId:r.windowId}}),window.__VIRID_BRIDGE__.subscribe(l),e.useMiddleware(g)}t(R,"activateApp");var G={name:"@virid/render",install(e,r){R(e,r)}};0&&(module.exports={FromIpc,FromMainMessage,RenderPlugin,ToMainMessage,convertFromMainMessage,middleWare});
|
|
10
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/renderer/message.ts","../src/renderer/middleware.ts","../src/renderer/router.ts","../src/app.ts"],"sourcesContent":["/*\n * Copyright (c) 2026-present Ailrid\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * Description: Electron renderer process adapter for virid, responsible for forwarding and receiving messages from the main process.\n */\nimport { ViridPlugin, type ViridApp } from \"@virid/core\";\nexport { ToMainMessage, FromMainMessage } from \"./renderer\";\nexport * from \"./interfaces\";\nexport * from \"./renderer\";\nimport { activateApp } from \"./app\";\nimport { type PluginOption } from \"./interfaces\";\nexport const RenderPlugin: ViridPlugin<PluginOption> = {\n name: \"@virid/render\",\n install(app: ViridApp, options: PluginOption) {\n activateApp(app, options);\n },\n};\n","/*\n * Copyright (c) 2026-present Ailrid.\n * Licensed under the Apache License, Version 2.0.\n * Project: Virid Renderer\n */\nimport { EventMessage } from \"@virid/core\";\n/**\n * RenderMessage: 由主进程发来的消息\n */\nexport abstract class FromMainMessage extends EventMessage {\n /** 我来自哪?\n */\n public __virid_source: string = \"unknown\";\n /** 我的目的地是哪儿?\n * 'main': 发给主进程处理\n * 'all': 广播给所有窗口(经过主进程中转)\n * string: 指定某个窗口的 ID (windowId)\n */\n public __virid_target: string;\n /**\n * 我应该在目的地转变成什么消息?\n */\n public __virid_messageType: string;\n}\n\n/**\n * RenderMessage: 由渲染进程发起,目标是主进程或其他窗口\n */\nexport abstract class ToMainMessage extends EventMessage {\n /** 我来自哪?\n */\n public static __virid_source: string;\n\n /** 我的目的地是哪儿?\n * 'main': 发给主进程处理\n * 'all': 广播给所有窗口(经过主进程中转)\n * string: 指定某个窗口的 ID (windowId)\n */\n public abstract __virid_target: string;\n\n /**\n * 我应该在目的地转变成什么消息?\n */\n public abstract __virid_messageType: string;\n}\n","/*\n * Copyright (c) 2026-present Ailrid.\n * Licensed under the Apache License, Version 2.0.\n * Project: Virid Renderer\n */\nimport { type Middleware, MessageWriter } from \"@virid/core\";\nimport { ToMainMessage } from \"./message\";\nexport const middleWare: Middleware = (message, next) => {\n //如果消息继承自ToMainMessage,拦截并发往主进程\n if (message instanceof ToMainMessage) {\n const { __virid_target, __virid_messageType, ...payload } = message;\n //禁止发给自己\n if (__virid_target == ToMainMessage.__virid_source) {\n MessageWriter.warn(\n `[Virid Render] Prohibit Sending To Oneself: ${__virid_target} is not allowed in ToRenderMessage.`,\n );\n return;\n }\n window.__VIRID_BRIDGE__.post({\n __virid_source: ToMainMessage.__virid_source,\n __virid_target: __virid_target,\n __virid_messageType: __virid_messageType,\n payload: payload, // 展开实例上的所有属性\n });\n } else {\n next();\n }\n};\n","/*\n * Copyright (c) 2026-present Ailrid.\n * Licensed under the Apache License, Version 2.0.\n * Project: Virid Renderer\n */\nimport { MessageWriter, Newable } from \"@virid/core\";\nimport { type FromMainMessage } from \"./message\";\nlet MESSAGE_MAP = new Map<string, Newable<FromMainMessage>>();\n\nexport function FromIpc(type: string) {\n return function (target: Newable<FromMainMessage>) {\n if (MESSAGE_MAP.has(type)) {\n MessageWriter.error(\n new Error(\n `[Virid Main] Duplicate IpcMessage: Registration for type: ${type}`,\n ),\n );\n }\n MESSAGE_MAP.set(type, target);\n };\n}\nexport function convertFromMainMessage(ipcMessage: any): void {\n // 解构\n const { __virid_source, __virid_target, __virid_messageType, payload } =\n ipcMessage;\n if (!__virid_messageType || !__virid_source || !__virid_target) {\n MessageWriter.error(\n new Error(\n `[Virid Render] Incomplete Data:\\n__virid_source: ${__virid_source}\\n__virid_target:${__virid_target}\\n__virid_messageType: ${__virid_messageType}.`,\n ),\n );\n return;\n }\n if (!MESSAGE_MAP.has(__virid_messageType)) {\n MessageWriter.error(\n new Error(`[Virid Render] Unregistered type: ${__virid_messageType} `),\n );\n return;\n }\n // 找到对应的构造函数\n const MessageClass = MESSAGE_MAP.get(__virid_messageType)!;\n // 实例化并注入参数\n const instance = new MessageClass();\n\n // 显式赋值基类标识,确保实例的身份信息完整\n instance.__virid_source = __virid_source;\n instance.__virid_target = __virid_target;\n instance.__virid_messageType = __virid_messageType;\n\n // 还原数据\n if (payload) {\n Object.assign(instance, payload);\n }\n\n // 重新分发\n MessageWriter.write(instance);\n}\n","/*\n * Copyright (c) 2026-present Ailrid.\n * Licensed under the Apache License, Version 2.0.\n * Project: Virid Renderer\n */\n\nimport { MessageWriter, type ViridApp } from \"@virid/core\";\nimport { middleWare, convertFromMainMessage, ToMainMessage } from \"./renderer\";\nimport { type PluginOption } from \"./interfaces\";\nexport function activateApp(app: ViridApp, options: PluginOption) {\n // 先检查预加载脚本是否已经加载\n if (!window.__VIRID_BRIDGE__) {\n MessageWriter.error(\n new Error(\n `[Virid Render] Preloading Failed: Please initialize in the preloaded script first.`,\n ),\n );\n }\n // 检查参数是否传递\n if (!options?.windowId) {\n MessageWriter.error(\n new Error(\n `[Virid Render] Activate Failed:\\nPlease provide the windowId:${options?.windowId}.`,\n ),\n );\n }\n //注册自己的id,以后所有发往主进程的消息都会携带自己的id\n ToMainMessage.__virid_source = options.windowId;\n //主动向主进程发一个注册消息来注册自己\n window.__VIRID_BRIDGE__.post({\n __virid_source: options.windowId,\n __virid_target: \"main\",\n __virid_messageType: \"VIRID_INTERNAL_REGISTER\",\n payload: {\n windowId: options.windowId,\n },\n });\n // 订阅ipc通道,所有返回的消息,全部转换按照注册表转换成自己的消息类型\n window.__VIRID_BRIDGE__.subscribe(convertFromMainMessage);\n //注册自己的中间件函数,把ToMainMessage类型的消息拦截发往electron主进程\n app.useMiddleware(middleWare);\n}\n"],"mappings":";;;;ulBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,oBAAAC,EAAA,iBAAAC,EAAA,kBAAAC,EAAA,2BAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAR,GCKA,IAAAS,EAA6B,uBAItB,IAAeC,EAAf,MAAeA,UAAwBC,cAAAA,CAAvC,kCAGEC,EAAAA,sBAAyB,WAMzBC,EAAAA,uBAIAC,EAAAA,4BACT,EAd8CH,EAAAA,EAAAA,mBAAvC,IAAeD,EAAfK,EAmBeC,EAAf,MAAeA,UAAsBL,cAAAA,CAgB5C,EAhB4CA,EAAAA,EAAAA,iBAG1CM,EAHoBD,EAGNJ,kBAHT,IAAeI,EAAfE,ECvBP,IAAAC,EAA+C,uBAExC,IAAMC,EAAyBC,EAAA,CAACC,EAASC,IAAAA,CAE9C,GAAID,aAAmBE,EAAe,CACpC,GAAM,CAAEC,eAAAA,EAAgBC,oBAAAA,EAAqB,GAAGC,CAAAA,EAAYL,EAE5D,GAAIG,GAAkBD,EAAcI,eAAgB,CAClDC,gBAAcC,KACZ,+CAA+CL,CAAAA,qCAAmD,EAEpG,MACF,CACAM,OAAOC,iBAAiBC,KAAK,CAC3BL,eAAgBJ,EAAcI,eAC9BH,eAAgBA,EAChBC,oBAAqBA,EACrBC,QAASA,CACX,CAAA,CACF,MACEJ,EAAAA,CAEJ,EApBsC,cCFtC,IAAAW,EAAuC,uBAEvC,IAAIC,EAAc,IAAIC,IAEf,SAASC,EAAQC,EAAY,CAClC,OAAO,SAAUC,EAAgC,CAC3CJ,EAAYK,IAAIF,CAAAA,GAClBG,gBAAcC,MACZ,IAAIC,MACF,6DAA6DL,CAAAA,EAAM,CAAA,EAIzEH,EAAYS,IAAIN,EAAMC,CAAAA,CACxB,CACF,CAXgBF,EAAAA,EAAAA,WAYT,SAASQ,EAAuBC,EAAe,CAEpD,GAAM,CAAEC,eAAAA,EAAgBC,eAAAA,EAAgBC,oBAAAA,EAAqBC,QAAAA,CAAO,EAClEJ,EACF,GAAI,CAACG,GAAuB,CAACF,GAAkB,CAACC,EAAgB,CAC9DP,gBAAcC,MACZ,IAAIC,MACF;kBAAoDI,CAAAA;iBAAkCC,CAAAA;uBAAwCC,CAAAA,GAAsB,CAAA,EAGxJ,MACF,CACA,GAAI,CAACd,EAAYK,IAAIS,CAAAA,EAAsB,CACzCR,gBAAcC,MACZ,IAAIC,MAAM,qCAAqCM,CAAAA,GAAsB,CAAA,EAEvE,MACF,CAEA,IAAME,EAAehB,EAAYiB,IAAIH,CAAAA,EAE/BI,EAAW,IAAIF,EAGrBE,EAASN,eAAiBA,EAC1BM,EAASL,eAAiBA,EAC1BK,EAASJ,oBAAsBA,EAG3BC,GACFI,OAAOC,OAAOF,EAAUH,CAAAA,EAI1BT,gBAAce,MAAMH,CAAAA,CACtB,CAnCgBR,EAAAA,EAAAA,0BCfhB,IAAAY,EAA6C,uBAGtC,SAASC,EAAYC,EAAeC,EAAqB,CAEzDC,OAAOC,kBACVC,gBAAcC,MACZ,IAAIC,MACF,oFAAoF,CAAA,EAKrFL,GAASM,UACZH,gBAAcC,MACZ,IAAIC,MACF;8BAAgEL,GAASM,QAAAA,GAAW,CAAA,EAK1FC,EAAcC,eAAiBR,EAAQM,SAEvCL,OAAOC,iBAAiBO,KAAK,CAC3BD,eAAgBR,EAAQM,SACxBI,eAAgB,OAChBC,oBAAqB,0BACrBC,QAAS,CACPN,SAAUN,EAAQM,QACpB,CACF,CAAA,EAEAL,OAAOC,iBAAiBW,UAAUC,CAAAA,EAElCf,EAAIgB,cAAcC,CAAAA,CACpB,CAhCgBlB,EAAAA,EAAAA,eJcT,IAAMmB,EAA0C,CACrDC,KAAM,gBACNC,QAAQC,EAAeC,EAAqB,CAC1CC,EAAYF,EAAKC,CAAAA,CACnB,CACF","names":["index_exports","__export","FromIpc","FromMainMessage","RenderPlugin","ToMainMessage","convertFromMainMessage","middleWare","__toCommonJS","import_core","FromMainMessage","EventMessage","__virid_source","__virid_target","__virid_messageType","_FromMainMessage","ToMainMessage","__publicField","_ToMainMessage","import_core","middleWare","__name","message","next","ToMainMessage","__virid_target","__virid_messageType","payload","__virid_source","MessageWriter","warn","window","__VIRID_BRIDGE__","post","import_core","MESSAGE_MAP","Map","FromIpc","type","target","has","MessageWriter","error","Error","set","convertFromMainMessage","ipcMessage","__virid_source","__virid_target","__virid_messageType","payload","MessageClass","get","instance","Object","assign","write","import_core","activateApp","app","options","window","__VIRID_BRIDGE__","MessageWriter","error","Error","windowId","ToMainMessage","__virid_source","post","__virid_target","__virid_messageType","payload","subscribe","convertFromMainMessage","useMiddleware","middleWare","RenderPlugin","name","install","app","options","activateApp"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { EventMessage, Middleware, Newable, ViridPlugin } from '@virid/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* RenderMessage: 由主进程发来的消息
|
|
5
|
+
*/
|
|
6
|
+
declare abstract class FromMainMessage extends EventMessage {
|
|
7
|
+
/** 我来自哪?
|
|
8
|
+
*/
|
|
9
|
+
__virid_source: string;
|
|
10
|
+
/** 我的目的地是哪儿?
|
|
11
|
+
* 'main': 发给主进程处理
|
|
12
|
+
* 'all': 广播给所有窗口(经过主进程中转)
|
|
13
|
+
* string: 指定某个窗口的 ID (windowId)
|
|
14
|
+
*/
|
|
15
|
+
__virid_target: string;
|
|
16
|
+
/**
|
|
17
|
+
* 我应该在目的地转变成什么消息?
|
|
18
|
+
*/
|
|
19
|
+
__virid_messageType: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* RenderMessage: 由渲染进程发起,目标是主进程或其他窗口
|
|
23
|
+
*/
|
|
24
|
+
declare abstract class ToMainMessage extends EventMessage {
|
|
25
|
+
/** 我来自哪?
|
|
26
|
+
*/
|
|
27
|
+
static __virid_source: string;
|
|
28
|
+
/** 我的目的地是哪儿?
|
|
29
|
+
* 'main': 发给主进程处理
|
|
30
|
+
* 'all': 广播给所有窗口(经过主进程中转)
|
|
31
|
+
* string: 指定某个窗口的 ID (windowId)
|
|
32
|
+
*/
|
|
33
|
+
abstract __virid_target: string;
|
|
34
|
+
/**
|
|
35
|
+
* 我应该在目的地转变成什么消息?
|
|
36
|
+
*/
|
|
37
|
+
abstract __virid_messageType: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare const middleWare: Middleware;
|
|
41
|
+
|
|
42
|
+
declare function FromIpc(type: string): (target: Newable<FromMainMessage>) => void;
|
|
43
|
+
declare function convertFromMainMessage(ipcMessage: any): void;
|
|
44
|
+
|
|
45
|
+
interface PluginOption {
|
|
46
|
+
/**
|
|
47
|
+
* 窗口的 ID
|
|
48
|
+
*/
|
|
49
|
+
windowId: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare const RenderPlugin: ViridPlugin<PluginOption>;
|
|
53
|
+
|
|
54
|
+
export { FromIpc, FromMainMessage, type PluginOption, RenderPlugin, ToMainMessage, convertFromMainMessage, middleWare };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { EventMessage, Middleware, Newable, ViridPlugin } from '@virid/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* RenderMessage: 由主进程发来的消息
|
|
5
|
+
*/
|
|
6
|
+
declare abstract class FromMainMessage extends EventMessage {
|
|
7
|
+
/** 我来自哪?
|
|
8
|
+
*/
|
|
9
|
+
__virid_source: string;
|
|
10
|
+
/** 我的目的地是哪儿?
|
|
11
|
+
* 'main': 发给主进程处理
|
|
12
|
+
* 'all': 广播给所有窗口(经过主进程中转)
|
|
13
|
+
* string: 指定某个窗口的 ID (windowId)
|
|
14
|
+
*/
|
|
15
|
+
__virid_target: string;
|
|
16
|
+
/**
|
|
17
|
+
* 我应该在目的地转变成什么消息?
|
|
18
|
+
*/
|
|
19
|
+
__virid_messageType: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* RenderMessage: 由渲染进程发起,目标是主进程或其他窗口
|
|
23
|
+
*/
|
|
24
|
+
declare abstract class ToMainMessage extends EventMessage {
|
|
25
|
+
/** 我来自哪?
|
|
26
|
+
*/
|
|
27
|
+
static __virid_source: string;
|
|
28
|
+
/** 我的目的地是哪儿?
|
|
29
|
+
* 'main': 发给主进程处理
|
|
30
|
+
* 'all': 广播给所有窗口(经过主进程中转)
|
|
31
|
+
* string: 指定某个窗口的 ID (windowId)
|
|
32
|
+
*/
|
|
33
|
+
abstract __virid_target: string;
|
|
34
|
+
/**
|
|
35
|
+
* 我应该在目的地转变成什么消息?
|
|
36
|
+
*/
|
|
37
|
+
abstract __virid_messageType: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare const middleWare: Middleware;
|
|
41
|
+
|
|
42
|
+
declare function FromIpc(type: string): (target: Newable<FromMainMessage>) => void;
|
|
43
|
+
declare function convertFromMainMessage(ipcMessage: any): void;
|
|
44
|
+
|
|
45
|
+
interface PluginOption {
|
|
46
|
+
/**
|
|
47
|
+
* 窗口的 ID
|
|
48
|
+
*/
|
|
49
|
+
windowId: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare const RenderPlugin: ViridPlugin<PluginOption>;
|
|
53
|
+
|
|
54
|
+
export { FromIpc, FromMainMessage, type PluginOption, RenderPlugin, ToMainMessage, convertFromMainMessage, middleWare };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @virid/renderer v0.0.1
|
|
3
|
+
* Electron renderer process adapter for virid, responsible for forwarding and receiving messages from the main process
|
|
4
|
+
*/
|
|
5
|
+
var v=Object.defineProperty;var x=(e,r,i)=>r in e?v(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i;var _=(e,r)=>v(e,"name",{value:r,configurable:!0});var n=(e,r,i)=>x(e,typeof r!="symbol"?r+"":r,i);import{EventMessage as f}from"@virid/core";var m=class m extends f{constructor(){super(...arguments);n(this,"__virid_source","unknown");n(this,"__virid_target");n(this,"__virid_messageType")}};_(m,"FromMainMessage");var w=m,a=class a extends f{};_(a,"ToMainMessage"),n(a,"__virid_source");var o=a;import{MessageWriter as E}from"@virid/core";var g=_((e,r)=>{if(e instanceof o){let{__virid_target:i,__virid_messageType:t,...s}=e;if(i==o.__virid_source){E.warn(`[Virid Render] Prohibit Sending To Oneself: ${i} is not allowed in ToRenderMessage.`);return}window.__VIRID_BRIDGE__.post({__virid_source:o.__virid_source,__virid_target:i,__virid_messageType:t,payload:s})}else r()},"middleWare");import{MessageWriter as p}from"@virid/core";var c=new Map;function h(e){return function(r){c.has(e)&&p.error(new Error(`[Virid Main] Duplicate IpcMessage: Registration for type: ${e}`)),c.set(e,r)}}_(h,"FromIpc");function l(e){let{__virid_source:r,__virid_target:i,__virid_messageType:t,payload:s}=e;if(!t||!r||!i){p.error(new Error(`[Virid Render] Incomplete Data:
|
|
6
|
+
__virid_source: ${r}
|
|
7
|
+
__virid_target:${i}
|
|
8
|
+
__virid_messageType: ${t}.`));return}if(!c.has(t)){p.error(new Error(`[Virid Render] Unregistered type: ${t} `));return}let R=c.get(t),d=new R;d.__virid_source=r,d.__virid_target=i,d.__virid_messageType=t,s&&Object.assign(d,s),p.write(d)}_(l,"convertFromMainMessage");import{MessageWriter as I}from"@virid/core";function u(e,r){window.__VIRID_BRIDGE__||I.error(new Error("[Virid Render] Preloading Failed: Please initialize in the preloaded script first.")),r?.windowId||I.error(new Error(`[Virid Render] Activate Failed:
|
|
9
|
+
Please provide the windowId:${r?.windowId}.`)),o.__virid_source=r.windowId,window.__VIRID_BRIDGE__.post({__virid_source:r.windowId,__virid_target:"main",__virid_messageType:"VIRID_INTERNAL_REGISTER",payload:{windowId:r.windowId}}),window.__VIRID_BRIDGE__.subscribe(l),e.useMiddleware(g)}_(u,"activateApp");var L={name:"@virid/render",install(e,r){u(e,r)}};export{h as FromIpc,w as FromMainMessage,L as RenderPlugin,o as ToMainMessage,l as convertFromMainMessage,g as middleWare};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/renderer/message.ts","../src/renderer/middleware.ts","../src/renderer/router.ts","../src/app.ts","../src/index.ts"],"sourcesContent":["/*\n * Copyright (c) 2026-present Ailrid.\n * Licensed under the Apache License, Version 2.0.\n * Project: Virid Renderer\n */\nimport { EventMessage } from \"@virid/core\";\n/**\n * RenderMessage: 由主进程发来的消息\n */\nexport abstract class FromMainMessage extends EventMessage {\n /** 我来自哪?\n */\n public __virid_source: string = \"unknown\";\n /** 我的目的地是哪儿?\n * 'main': 发给主进程处理\n * 'all': 广播给所有窗口(经过主进程中转)\n * string: 指定某个窗口的 ID (windowId)\n */\n public __virid_target: string;\n /**\n * 我应该在目的地转变成什么消息?\n */\n public __virid_messageType: string;\n}\n\n/**\n * RenderMessage: 由渲染进程发起,目标是主进程或其他窗口\n */\nexport abstract class ToMainMessage extends EventMessage {\n /** 我来自哪?\n */\n public static __virid_source: string;\n\n /** 我的目的地是哪儿?\n * 'main': 发给主进程处理\n * 'all': 广播给所有窗口(经过主进程中转)\n * string: 指定某个窗口的 ID (windowId)\n */\n public abstract __virid_target: string;\n\n /**\n * 我应该在目的地转变成什么消息?\n */\n public abstract __virid_messageType: string;\n}\n","/*\n * Copyright (c) 2026-present Ailrid.\n * Licensed under the Apache License, Version 2.0.\n * Project: Virid Renderer\n */\nimport { type Middleware, MessageWriter } from \"@virid/core\";\nimport { ToMainMessage } from \"./message\";\nexport const middleWare: Middleware = (message, next) => {\n //如果消息继承自ToMainMessage,拦截并发往主进程\n if (message instanceof ToMainMessage) {\n const { __virid_target, __virid_messageType, ...payload } = message;\n //禁止发给自己\n if (__virid_target == ToMainMessage.__virid_source) {\n MessageWriter.warn(\n `[Virid Render] Prohibit Sending To Oneself: ${__virid_target} is not allowed in ToRenderMessage.`,\n );\n return;\n }\n window.__VIRID_BRIDGE__.post({\n __virid_source: ToMainMessage.__virid_source,\n __virid_target: __virid_target,\n __virid_messageType: __virid_messageType,\n payload: payload, // 展开实例上的所有属性\n });\n } else {\n next();\n }\n};\n","/*\n * Copyright (c) 2026-present Ailrid.\n * Licensed under the Apache License, Version 2.0.\n * Project: Virid Renderer\n */\nimport { MessageWriter, Newable } from \"@virid/core\";\nimport { type FromMainMessage } from \"./message\";\nlet MESSAGE_MAP = new Map<string, Newable<FromMainMessage>>();\n\nexport function FromIpc(type: string) {\n return function (target: Newable<FromMainMessage>) {\n if (MESSAGE_MAP.has(type)) {\n MessageWriter.error(\n new Error(\n `[Virid Main] Duplicate IpcMessage: Registration for type: ${type}`,\n ),\n );\n }\n MESSAGE_MAP.set(type, target);\n };\n}\nexport function convertFromMainMessage(ipcMessage: any): void {\n // 解构\n const { __virid_source, __virid_target, __virid_messageType, payload } =\n ipcMessage;\n if (!__virid_messageType || !__virid_source || !__virid_target) {\n MessageWriter.error(\n new Error(\n `[Virid Render] Incomplete Data:\\n__virid_source: ${__virid_source}\\n__virid_target:${__virid_target}\\n__virid_messageType: ${__virid_messageType}.`,\n ),\n );\n return;\n }\n if (!MESSAGE_MAP.has(__virid_messageType)) {\n MessageWriter.error(\n new Error(`[Virid Render] Unregistered type: ${__virid_messageType} `),\n );\n return;\n }\n // 找到对应的构造函数\n const MessageClass = MESSAGE_MAP.get(__virid_messageType)!;\n // 实例化并注入参数\n const instance = new MessageClass();\n\n // 显式赋值基类标识,确保实例的身份信息完整\n instance.__virid_source = __virid_source;\n instance.__virid_target = __virid_target;\n instance.__virid_messageType = __virid_messageType;\n\n // 还原数据\n if (payload) {\n Object.assign(instance, payload);\n }\n\n // 重新分发\n MessageWriter.write(instance);\n}\n","/*\n * Copyright (c) 2026-present Ailrid.\n * Licensed under the Apache License, Version 2.0.\n * Project: Virid Renderer\n */\n\nimport { MessageWriter, type ViridApp } from \"@virid/core\";\nimport { middleWare, convertFromMainMessage, ToMainMessage } from \"./renderer\";\nimport { type PluginOption } from \"./interfaces\";\nexport function activateApp(app: ViridApp, options: PluginOption) {\n // 先检查预加载脚本是否已经加载\n if (!window.__VIRID_BRIDGE__) {\n MessageWriter.error(\n new Error(\n `[Virid Render] Preloading Failed: Please initialize in the preloaded script first.`,\n ),\n );\n }\n // 检查参数是否传递\n if (!options?.windowId) {\n MessageWriter.error(\n new Error(\n `[Virid Render] Activate Failed:\\nPlease provide the windowId:${options?.windowId}.`,\n ),\n );\n }\n //注册自己的id,以后所有发往主进程的消息都会携带自己的id\n ToMainMessage.__virid_source = options.windowId;\n //主动向主进程发一个注册消息来注册自己\n window.__VIRID_BRIDGE__.post({\n __virid_source: options.windowId,\n __virid_target: \"main\",\n __virid_messageType: \"VIRID_INTERNAL_REGISTER\",\n payload: {\n windowId: options.windowId,\n },\n });\n // 订阅ipc通道,所有返回的消息,全部转换按照注册表转换成自己的消息类型\n window.__VIRID_BRIDGE__.subscribe(convertFromMainMessage);\n //注册自己的中间件函数,把ToMainMessage类型的消息拦截发往electron主进程\n app.useMiddleware(middleWare);\n}\n","/*\n * Copyright (c) 2026-present Ailrid\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * Description: Electron renderer process adapter for virid, responsible for forwarding and receiving messages from the main process.\n */\nimport { ViridPlugin, type ViridApp } from \"@virid/core\";\nexport { ToMainMessage, FromMainMessage } from \"./renderer\";\nexport * from \"./interfaces\";\nexport * from \"./renderer\";\nimport { activateApp } from \"./app\";\nimport { type PluginOption } from \"./interfaces\";\nexport const RenderPlugin: ViridPlugin<PluginOption> = {\n name: \"@virid/render\",\n install(app: ViridApp, options: PluginOption) {\n activateApp(app, options);\n },\n};\n"],"mappings":";;;;uNAKA,OAASA,gBAAAA,MAAoB,cAItB,IAAeC,EAAf,MAAeA,UAAwBC,CAAAA,CAAvC,kCAGEC,EAAAA,sBAAyB,WAMzBC,EAAAA,uBAIAC,EAAAA,4BACT,EAd8CH,EAAAA,EAAAA,mBAAvC,IAAeD,EAAfK,EAmBeC,EAAf,MAAeA,UAAsBL,CAAAA,CAgB5C,EAhB4CA,EAAAA,EAAAA,iBAG1CM,EAHoBD,EAGNJ,kBAHT,IAAeI,EAAfE,ECvBP,OAA0BC,iBAAAA,MAAqB,cAExC,IAAMC,EAAyBC,EAAA,CAACC,EAASC,IAAAA,CAE9C,GAAID,aAAmBE,EAAe,CACpC,GAAM,CAAEC,eAAAA,EAAgBC,oBAAAA,EAAqB,GAAGC,CAAAA,EAAYL,EAE5D,GAAIG,GAAkBD,EAAcI,eAAgB,CAClDC,EAAcC,KACZ,+CAA+CL,CAAAA,qCAAmD,EAEpG,MACF,CACAM,OAAOC,iBAAiBC,KAAK,CAC3BL,eAAgBJ,EAAcI,eAC9BH,eAAgBA,EAChBC,oBAAqBA,EACrBC,QAASA,CACX,CAAA,CACF,MACEJ,EAAAA,CAEJ,EApBsC,cCFtC,OAASW,iBAAAA,MAA8B,cAEvC,IAAIC,EAAc,IAAIC,IAEf,SAASC,EAAQC,EAAY,CAClC,OAAO,SAAUC,EAAgC,CAC3CJ,EAAYK,IAAIF,CAAAA,GAClBG,EAAcC,MACZ,IAAIC,MACF,6DAA6DL,CAAAA,EAAM,CAAA,EAIzEH,EAAYS,IAAIN,EAAMC,CAAAA,CACxB,CACF,CAXgBF,EAAAA,EAAAA,WAYT,SAASQ,EAAuBC,EAAe,CAEpD,GAAM,CAAEC,eAAAA,EAAgBC,eAAAA,EAAgBC,oBAAAA,EAAqBC,QAAAA,CAAO,EAClEJ,EACF,GAAI,CAACG,GAAuB,CAACF,GAAkB,CAACC,EAAgB,CAC9DP,EAAcC,MACZ,IAAIC,MACF;kBAAoDI,CAAAA;iBAAkCC,CAAAA;uBAAwCC,CAAAA,GAAsB,CAAA,EAGxJ,MACF,CACA,GAAI,CAACd,EAAYK,IAAIS,CAAAA,EAAsB,CACzCR,EAAcC,MACZ,IAAIC,MAAM,qCAAqCM,CAAAA,GAAsB,CAAA,EAEvE,MACF,CAEA,IAAME,EAAehB,EAAYiB,IAAIH,CAAAA,EAE/BI,EAAW,IAAIF,EAGrBE,EAASN,eAAiBA,EAC1BM,EAASL,eAAiBA,EAC1BK,EAASJ,oBAAsBA,EAG3BC,GACFI,OAAOC,OAAOF,EAAUH,CAAAA,EAI1BT,EAAce,MAAMH,CAAAA,CACtB,CAnCgBR,EAAAA,EAAAA,0BCfhB,OAASY,iBAAAA,MAAoC,cAGtC,SAASC,EAAYC,EAAeC,EAAqB,CAEzDC,OAAOC,kBACVC,EAAcC,MACZ,IAAIC,MACF,oFAAoF,CAAA,EAKrFL,GAASM,UACZH,EAAcC,MACZ,IAAIC,MACF;8BAAgEL,GAASM,QAAAA,GAAW,CAAA,EAK1FC,EAAcC,eAAiBR,EAAQM,SAEvCL,OAAOC,iBAAiBO,KAAK,CAC3BD,eAAgBR,EAAQM,SACxBI,eAAgB,OAChBC,oBAAqB,0BACrBC,QAAS,CACPN,SAAUN,EAAQM,QACpB,CACF,CAAA,EAEAL,OAAOC,iBAAiBW,UAAUC,CAAAA,EAElCf,EAAIgB,cAAcC,CAAAA,CACpB,CAhCgBlB,EAAAA,EAAAA,eCcT,IAAMmB,EAA0C,CACrDC,KAAM,gBACNC,QAAQC,EAAeC,EAAqB,CAC1CC,EAAYF,EAAKC,CAAAA,CACnB,CACF","names":["EventMessage","FromMainMessage","EventMessage","__virid_source","__virid_target","__virid_messageType","_FromMainMessage","ToMainMessage","__publicField","_ToMainMessage","MessageWriter","middleWare","__name","message","next","ToMainMessage","__virid_target","__virid_messageType","payload","__virid_source","MessageWriter","warn","window","__VIRID_BRIDGE__","post","MessageWriter","MESSAGE_MAP","Map","FromIpc","type","target","has","MessageWriter","error","Error","set","convertFromMainMessage","ipcMessage","__virid_source","__virid_target","__virid_messageType","payload","MessageClass","get","instance","Object","assign","write","MessageWriter","activateApp","app","options","window","__VIRID_BRIDGE__","MessageWriter","error","Error","windowId","ToMainMessage","__virid_source","post","__virid_target","__virid_messageType","payload","subscribe","convertFromMainMessage","useMiddleware","middleWare","RenderPlugin","name","install","app","options","activateApp"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@virid/renderer",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Electron renderer process adapter for virid, responsible for forwarding and receiving messages from the main process",
|
|
6
|
+
"author": "Ailrid",
|
|
7
|
+
"license": "Apache 2.0",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"electron",
|
|
10
|
+
"renderer",
|
|
11
|
+
"virid",
|
|
12
|
+
"message"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/ArisuYuki/virid.git"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.cjs",
|
|
19
|
+
"module": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"require": "./dist/index.cjs"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public",
|
|
33
|
+
"registry": "https://registry.npmjs.org/"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@virid/core": "0.1.0"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsup --config tsup.config.ts",
|
|
41
|
+
"dev": "tsup --config tsup.config.ts --watch",
|
|
42
|
+
"typecheck": "tsc --noEmit"
|
|
43
|
+
}
|
|
44
|
+
}
|