@univerjs/rpc-node 1.3.1 → 1.5.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/README.md CHANGED
@@ -8,9 +8,9 @@
8
8
 
9
9
  ## Package Overview
10
10
 
11
- | Package | UMD global | CSS | Locales | Facade entry |
12
- | --- | --- | :---: | :---: | :---: |
13
- | `@univerjs/rpc-node` | `UniverRpcNode` | No | No | No |
11
+ | Package | UMD global | CSS | Locales | Facade entry | Worker entry |
12
+ | --- | --- | :---: | :---: | :---: | :---: |
13
+ | `@univerjs/rpc-node` | `UniverRpcNode` | No | No | No | Yes |
14
14
 
15
15
  ## Installation
16
16
 
@@ -20,10 +20,10 @@ pnpm add @univerjs/rpc-node
20
20
  npm install @univerjs/rpc-node
21
21
  ```
22
22
 
23
- Keep all `@univerjs/*` packages on the same version.
24
-
25
23
  ## Usage
26
24
 
25
+ Start with the [integration setup](https://docs.univer.ai/) for your document type, including its required plugins, styles, and locale resources. The snippet below assumes that setup is complete.
26
+
27
27
  ```ts
28
28
  import { fileURLToPath } from 'node:url';
29
29
  import { UniverRPCNodeMainPlugin } from '@univerjs/rpc-node';
@@ -32,12 +32,21 @@ const workerSrc = fileURLToPath(new URL('./worker.js', import.meta.url));
32
32
  univer.registerPlugin(UniverRPCNodeMainPlugin, { workerSrc });
33
33
  ```
34
34
 
35
- The referenced worker module must create its own Univer instance and register `UniverRPCNodeWorkerPlugin`; see the [Node.js worker example](../../examples/src/node/sdk/worker.ts).
36
-
37
- Exported plugin classes:
35
+ Main-thread plugin classes:
38
36
 
39
37
  - `UniverRPCNodeMainPlugin`
40
- - `UniverRPCNodeWorkerPlugin`
38
+
39
+ ### Worker usage
40
+
41
+ On the main thread, import `UniverRPCNodeMainPlugin` from `@univerjs/rpc-node`. Set `workerSrc` to the worker module path.
42
+
43
+ In the worker entry, import `UniverRPCNodeWorkerPlugin` from `@univerjs/rpc-node/worker`:
44
+
45
+ ```ts
46
+ import { UniverRPCNodeWorkerPlugin } from '@univerjs/rpc-node/worker';
47
+
48
+ univer.registerPlugin(UniverRPCNodeWorkerPlugin);
49
+ ```
41
50
 
42
51
  ## Resources
43
52
 
@@ -0,0 +1,134 @@
1
+ // package.json
2
+ var name = "@univerjs/rpc-node";
3
+ var version = "1.5.0";
4
+
5
+ // src/config/config.ts
6
+ /**
7
+ * Copyright 2023-present DreamNum Co., Ltd.
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+ const PLUGIN_CONFIG_KEY_MAIN_THREAD = "rpc-node.main-thread.config";
22
+ const configSymbolMainThread = Symbol(PLUGIN_CONFIG_KEY_MAIN_THREAD);
23
+ const defaultPluginMainThreadConfig = {};
24
+ const PLUGIN_CONFIG_KEY_WORKER_THREAD = "rpc-node.worker-thread.config";
25
+ const configSymbolWorkerThread = Symbol(PLUGIN_CONFIG_KEY_WORKER_THREAD);
26
+ const defaultPluginWorkerThreadConfig = {};
27
+
28
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
29
+ function _typeof(o) {
30
+ "@babel/helpers - typeof";
31
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
32
+ return typeof o;
33
+ } : function(o) {
34
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
35
+ }, _typeof(o);
36
+ }
37
+
38
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
39
+ function toPrimitive(t, e) {
40
+ if ("object" != _typeof(t) || !t) return t;
41
+ var r;
42
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
43
+ var i = r.call(t, e || "default");
44
+ if ("object" != _typeof(i)) return i;
45
+ throw new TypeError("@@toPrimitive must return a primitive value.");
46
+ }
47
+ return ("string" === e ? String : Number)(t);
48
+ }
49
+
50
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
51
+ function toPropertyKey(t) {
52
+ var i = toPrimitive(t, "string");
53
+ return "symbol" == _typeof(i) ? i : i + "";
54
+ }
55
+
56
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
57
+ function _defineProperty(e, r, t) {
58
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
59
+ value: t,
60
+ enumerable: !0,
61
+ configurable: !0,
62
+ writable: !0
63
+ }) : e[r] = t, e;
64
+ }
65
+
66
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
67
+ function __decorateParam(paramIndex, decorator) {
68
+ return function(target, key) {
69
+ decorator(target, key, paramIndex);
70
+ };
71
+ }
72
+
73
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
74
+ function __decorate(decorators, target, key, desc) {
75
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
76
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
77
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
78
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
79
+ }
80
+
81
+ Object.defineProperty(exports, "PLUGIN_CONFIG_KEY_MAIN_THREAD", {
82
+ enumerable: true,
83
+ get: function () {
84
+ return PLUGIN_CONFIG_KEY_MAIN_THREAD;
85
+ }
86
+ });
87
+ Object.defineProperty(exports, "PLUGIN_CONFIG_KEY_WORKER_THREAD", {
88
+ enumerable: true,
89
+ get: function () {
90
+ return PLUGIN_CONFIG_KEY_WORKER_THREAD;
91
+ }
92
+ });
93
+ Object.defineProperty(exports, "__decorate", {
94
+ enumerable: true,
95
+ get: function () {
96
+ return __decorate;
97
+ }
98
+ });
99
+ Object.defineProperty(exports, "__decorateParam", {
100
+ enumerable: true,
101
+ get: function () {
102
+ return __decorateParam;
103
+ }
104
+ });
105
+ Object.defineProperty(exports, "_defineProperty", {
106
+ enumerable: true,
107
+ get: function () {
108
+ return _defineProperty;
109
+ }
110
+ });
111
+ Object.defineProperty(exports, "defaultPluginMainThreadConfig", {
112
+ enumerable: true,
113
+ get: function () {
114
+ return defaultPluginMainThreadConfig;
115
+ }
116
+ });
117
+ Object.defineProperty(exports, "defaultPluginWorkerThreadConfig", {
118
+ enumerable: true,
119
+ get: function () {
120
+ return defaultPluginWorkerThreadConfig;
121
+ }
122
+ });
123
+ Object.defineProperty(exports, "name", {
124
+ enumerable: true,
125
+ get: function () {
126
+ return name;
127
+ }
128
+ });
129
+ Object.defineProperty(exports, "version", {
130
+ enumerable: true,
131
+ get: function () {
132
+ return version;
133
+ }
134
+ });
package/lib/cjs/index.js CHANGED
@@ -1,143 +1,29 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- //#region \0rolldown/runtime.js
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
24
- value: mod,
25
- enumerable: true
26
- }) : target, mod));
27
-
28
- //#endregion
29
- let node_child_process = require("node:child_process");
30
- let node_process = require("node:process");
31
- node_process = __toESM(node_process);
2
+ const require_decorate = require("./decorate-ysRSRVYP.js");
32
3
  let _univerjs_core = require("@univerjs/core");
33
4
  let _univerjs_rpc = require("@univerjs/rpc");
5
+ let node_child_process = require("node:child_process");
34
6
  let rxjs = require("rxjs");
35
7
 
36
- //#region package.json
37
- var name = "@univerjs/rpc-node";
38
- var version = "1.3.1";
39
-
40
- //#endregion
41
- //#region src/config/config.ts
42
- /**
43
- * Copyright 2023-present DreamNum Co., Ltd.
44
- *
45
- * Licensed under the Apache License, Version 2.0 (the "License");
46
- * you may not use this file except in compliance with the License.
47
- * You may obtain a copy of the License at
48
- *
49
- * http://www.apache.org/licenses/LICENSE-2.0
50
- *
51
- * Unless required by applicable law or agreed to in writing, software
52
- * distributed under the License is distributed on an "AS IS" BASIS,
53
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54
- * See the License for the specific language governing permissions and
55
- * limitations under the License.
56
- */
57
- const PLUGIN_CONFIG_KEY_MAIN_THREAD = "rpc-node.main-thread.config";
58
- const configSymbolMainThread = Symbol(PLUGIN_CONFIG_KEY_MAIN_THREAD);
59
- const defaultPluginMainThreadConfig = {};
60
- const PLUGIN_CONFIG_KEY_WORKER_THREAD = "rpc-node.worker-thread.config";
61
- const configSymbolWorkerThread = Symbol(PLUGIN_CONFIG_KEY_WORKER_THREAD);
62
- const defaultPluginWorkerThreadConfig = {};
63
-
64
- //#endregion
65
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
66
- function _typeof(o) {
67
- "@babel/helpers - typeof";
68
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
69
- return typeof o;
70
- } : function(o) {
71
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
72
- }, _typeof(o);
73
- }
74
-
75
- //#endregion
76
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
77
- function toPrimitive(t, r) {
78
- if ("object" != _typeof(t) || !t) return t;
79
- var e = t[Symbol.toPrimitive];
80
- if (void 0 !== e) {
81
- var i = e.call(t, r || "default");
82
- if ("object" != _typeof(i)) return i;
83
- throw new TypeError("@@toPrimitive must return a primitive value.");
84
- }
85
- return ("string" === r ? String : Number)(t);
86
- }
87
-
88
- //#endregion
89
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
90
- function toPropertyKey(t) {
91
- var i = toPrimitive(t, "string");
92
- return "symbol" == _typeof(i) ? i : i + "";
93
- }
94
-
95
- //#endregion
96
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
97
- function _defineProperty(e, r, t) {
98
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
99
- value: t,
100
- enumerable: !0,
101
- configurable: !0,
102
- writable: !0
103
- }) : e[r] = t, e;
104
- }
105
-
106
- //#endregion
107
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
108
- function __decorateParam(paramIndex, decorator) {
109
- return function(target, key) {
110
- decorator(target, key, paramIndex);
111
- };
112
- }
113
-
114
- //#endregion
115
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
116
- function __decorate(decorators, target, key, desc) {
117
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
118
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
119
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
120
- return c > 3 && r && Object.defineProperty(target, key, r), r;
121
- }
122
-
123
- //#endregion
124
- //#region src/plugin.ts
8
+ // src/plugin.ts
125
9
  let UniverRPCNodeMainPlugin = class UniverRPCNodeMainPlugin extends _univerjs_core.Plugin {
126
- constructor(_config = defaultPluginMainThreadConfig, _injector, _configService) {
10
+ constructor(_config = require_decorate.defaultPluginMainThreadConfig, _injector, _configService) {
127
11
  super();
128
12
  this._config = _config;
129
13
  this._injector = _injector;
130
14
  this._configService = _configService;
131
- _defineProperty(this, "_child", null);
132
- const { ...rest } = (0, _univerjs_core.merge)({}, defaultPluginMainThreadConfig, this._config);
133
- this._configService.setConfig(PLUGIN_CONFIG_KEY_MAIN_THREAD, rest);
15
+ require_decorate._defineProperty(this, "_child", null);
16
+ const { ...rest } = (0, _univerjs_core.merge)({}, require_decorate.defaultPluginMainThreadConfig, this._config);
17
+ this._configService.setConfig(require_decorate.PLUGIN_CONFIG_KEY_MAIN_THREAD, rest);
134
18
  }
135
19
  onStarting() {
136
20
  const { workerSrc } = this._config;
137
21
  if (!workerSrc) throw new Error("[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin");
138
22
  const [messageProtocol, child] = createNodeMessagePortOnMain(this._injector, workerSrc);
139
23
  [
140
- [_univerjs_rpc.IRPCChannelService, { useFactory: () => new _univerjs_rpc.ChannelService(messageProtocol) }],
24
+ [_univerjs_rpc.IRPCChannelService, { useFactory: function createChannelService() {
25
+ return new _univerjs_rpc.ChannelService(messageProtocol);
26
+ } }],
141
27
  [_univerjs_rpc.DataSyncPrimaryController],
142
28
  [_univerjs_rpc.IRemoteSyncService, { useClass: _univerjs_rpc.RemoteSyncPrimaryService }]
143
29
  ].forEach((dependency) => this._injector.add(dependency));
@@ -156,32 +42,10 @@ let UniverRPCNodeMainPlugin = class UniverRPCNodeMainPlugin extends _univerjs_co
156
42
  }
157
43
  }
158
44
  };
159
- _defineProperty(UniverRPCNodeMainPlugin, "pluginName", "UNIVER_RPC_NODE_MAIN_PLUGIN");
160
- _defineProperty(UniverRPCNodeMainPlugin, "packageName", name);
161
- _defineProperty(UniverRPCNodeMainPlugin, "version", version);
162
- UniverRPCNodeMainPlugin = __decorate([__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(2, _univerjs_core.IConfigService)], UniverRPCNodeMainPlugin);
163
- let UniverRPCNodeWorkerPlugin = class UniverRPCNodeWorkerPlugin extends _univerjs_core.Plugin {
164
- constructor(_config = defaultPluginWorkerThreadConfig, _injector, _configService) {
165
- super();
166
- this._config = _config;
167
- this._injector = _injector;
168
- this._configService = _configService;
169
- const { ...rest } = (0, _univerjs_core.merge)({}, defaultPluginWorkerThreadConfig, this._config);
170
- this._configService.setConfig(PLUGIN_CONFIG_KEY_WORKER_THREAD, rest);
171
- }
172
- onStarting() {
173
- [
174
- [_univerjs_rpc.DataSyncReplicaController],
175
- [_univerjs_rpc.IRPCChannelService, { useFactory: () => new _univerjs_rpc.ChannelService(createNodeWorkerMessageProtocol()) }],
176
- [_univerjs_rpc.IRemoteInstanceService, { useClass: _univerjs_rpc.WebWorkerRemoteInstanceService }]
177
- ].forEach((d) => this._injector.add(d));
178
- this._injector.get(_univerjs_rpc.DataSyncReplicaController);
179
- }
180
- };
181
- _defineProperty(UniverRPCNodeWorkerPlugin, "pluginName", "UNIVER_RPC_NODE_WORKER_PLUGIN");
182
- _defineProperty(UniverRPCNodeWorkerPlugin, "packageName", name);
183
- _defineProperty(UniverRPCNodeWorkerPlugin, "version", version);
184
- UniverRPCNodeWorkerPlugin = __decorate([__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(2, _univerjs_core.IConfigService)], UniverRPCNodeWorkerPlugin);
45
+ require_decorate._defineProperty(UniverRPCNodeMainPlugin, "pluginName", "UNIVER_RPC_NODE_MAIN_PLUGIN");
46
+ require_decorate._defineProperty(UniverRPCNodeMainPlugin, "packageName", require_decorate.name);
47
+ require_decorate._defineProperty(UniverRPCNodeMainPlugin, "version", require_decorate.version);
48
+ UniverRPCNodeMainPlugin = require_decorate.__decorate([require_decorate.__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), require_decorate.__decorateParam(2, _univerjs_core.IConfigService)], UniverRPCNodeMainPlugin);
185
49
  function createNodeMessagePortOnMain(injector, path) {
186
50
  const logService = injector.get(_univerjs_core.ILogService);
187
51
  const child = (0, node_child_process.fork)(path);
@@ -203,34 +67,10 @@ function createNodeMessagePortOnMain(injector, path) {
203
67
  }))
204
68
  }, child];
205
69
  }
206
- function createNodeWorkerMessageProtocol() {
207
- return {
208
- send(message) {
209
- node_process.default.send(message);
210
- },
211
- onMessage: new rxjs.Observable((subscriber) => {
212
- const handler = (event) => {
213
- subscriber.next(event);
214
- };
215
- node_process.default.on("message", handler);
216
- return () => node_process.default.off("message", handler);
217
- }).pipe((0, rxjs.shareReplay)({
218
- bufferSize: 1,
219
- refCount: true
220
- }))
221
- };
222
- }
223
70
 
224
- //#endregion
225
71
  Object.defineProperty(exports, "UniverRPCNodeMainPlugin", {
226
72
  enumerable: true,
227
73
  get: function () {
228
74
  return UniverRPCNodeMainPlugin;
229
75
  }
230
- });
231
- Object.defineProperty(exports, "UniverRPCNodeWorkerPlugin", {
232
- enumerable: true,
233
- get: function () {
234
- return UniverRPCNodeWorkerPlugin;
235
- }
236
76
  });
@@ -0,0 +1,83 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ // \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+
28
+ const require_decorate = require("./decorate-ysRSRVYP.js");
29
+ let _univerjs_core = require("@univerjs/core");
30
+ let _univerjs_rpc = require("@univerjs/rpc");
31
+ let rxjs = require("rxjs");
32
+ let node_process = require("node:process");
33
+ node_process = __toESM(node_process);
34
+
35
+ // src/worker.ts
36
+ let UniverRPCNodeWorkerPlugin = class UniverRPCNodeWorkerPlugin extends _univerjs_core.Plugin {
37
+ constructor(_config = require_decorate.defaultPluginWorkerThreadConfig, _injector, _configService) {
38
+ super();
39
+ this._config = _config;
40
+ this._injector = _injector;
41
+ this._configService = _configService;
42
+ const { ...rest } = (0, _univerjs_core.merge)({}, require_decorate.defaultPluginWorkerThreadConfig, this._config);
43
+ this._configService.setConfig(require_decorate.PLUGIN_CONFIG_KEY_WORKER_THREAD, rest);
44
+ }
45
+ onStarting() {
46
+ [
47
+ [_univerjs_rpc.DataSyncReplicaController],
48
+ [_univerjs_rpc.IRPCChannelService, { useFactory: function createChannelService() {
49
+ return new _univerjs_rpc.ChannelService(createNodeWorkerMessageProtocol());
50
+ } }],
51
+ [_univerjs_rpc.IRemoteInstanceService, { useClass: _univerjs_rpc.WebWorkerRemoteInstanceService }]
52
+ ].forEach((d) => this._injector.add(d));
53
+ this._injector.get(_univerjs_rpc.DataSyncReplicaController);
54
+ }
55
+ };
56
+ require_decorate._defineProperty(UniverRPCNodeWorkerPlugin, "pluginName", "UNIVER_RPC_NODE_WORKER_PLUGIN");
57
+ require_decorate._defineProperty(UniverRPCNodeWorkerPlugin, "packageName", require_decorate.name);
58
+ require_decorate._defineProperty(UniverRPCNodeWorkerPlugin, "version", require_decorate.version);
59
+ UniverRPCNodeWorkerPlugin = require_decorate.__decorate([require_decorate.__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), require_decorate.__decorateParam(2, _univerjs_core.IConfigService)], UniverRPCNodeWorkerPlugin);
60
+ function createNodeWorkerMessageProtocol() {
61
+ return {
62
+ send(message) {
63
+ node_process.default.send(message);
64
+ },
65
+ onMessage: new rxjs.Observable((subscriber) => {
66
+ const handler = (event) => {
67
+ subscriber.next(event);
68
+ };
69
+ node_process.default.on("message", handler);
70
+ return () => node_process.default.off("message", handler);
71
+ }).pipe((0, rxjs.shareReplay)({
72
+ bufferSize: 1,
73
+ refCount: true
74
+ }))
75
+ };
76
+ }
77
+
78
+ Object.defineProperty(exports, "UniverRPCNodeWorkerPlugin", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return UniverRPCNodeWorkerPlugin;
82
+ }
83
+ });
@@ -0,0 +1,81 @@
1
+ // package.json
2
+ var name = "@univerjs/rpc-node";
3
+ var version = "1.5.0";
4
+
5
+ // src/config/config.ts
6
+ /**
7
+ * Copyright 2023-present DreamNum Co., Ltd.
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+ const PLUGIN_CONFIG_KEY_MAIN_THREAD = "rpc-node.main-thread.config";
22
+ const configSymbolMainThread = Symbol(PLUGIN_CONFIG_KEY_MAIN_THREAD);
23
+ const defaultPluginMainThreadConfig = {};
24
+ const PLUGIN_CONFIG_KEY_WORKER_THREAD = "rpc-node.worker-thread.config";
25
+ const configSymbolWorkerThread = Symbol(PLUGIN_CONFIG_KEY_WORKER_THREAD);
26
+ const defaultPluginWorkerThreadConfig = {};
27
+
28
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
29
+ function _typeof(o) {
30
+ "@babel/helpers - typeof";
31
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
32
+ return typeof o;
33
+ } : function(o) {
34
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
35
+ }, _typeof(o);
36
+ }
37
+
38
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
39
+ function toPrimitive(t, e) {
40
+ if ("object" != _typeof(t) || !t) return t;
41
+ var r;
42
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
43
+ var i = r.call(t, e || "default");
44
+ if ("object" != _typeof(i)) return i;
45
+ throw new TypeError("@@toPrimitive must return a primitive value.");
46
+ }
47
+ return ("string" === e ? String : Number)(t);
48
+ }
49
+
50
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
51
+ function toPropertyKey(t) {
52
+ var i = toPrimitive(t, "string");
53
+ return "symbol" == _typeof(i) ? i : i + "";
54
+ }
55
+
56
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
57
+ function _defineProperty(e, r, t) {
58
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
59
+ value: t,
60
+ enumerable: !0,
61
+ configurable: !0,
62
+ writable: !0
63
+ }) : e[r] = t, e;
64
+ }
65
+
66
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
67
+ function __decorateParam(paramIndex, decorator) {
68
+ return function(target, key) {
69
+ decorator(target, key, paramIndex);
70
+ };
71
+ }
72
+
73
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
74
+ function __decorate(decorators, target, key, desc) {
75
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
76
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
77
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
78
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
79
+ }
80
+
81
+ export { PLUGIN_CONFIG_KEY_WORKER_THREAD as a, name as c, PLUGIN_CONFIG_KEY_MAIN_THREAD as i, version as l, __decorateParam as n, defaultPluginMainThreadConfig as o, _defineProperty as r, defaultPluginWorkerThreadConfig as s, __decorate as t };
@@ -0,0 +1,81 @@
1
+ // package.json
2
+ var name = "@univerjs/rpc-node";
3
+ var version = "1.5.0";
4
+
5
+ // src/config/config.ts
6
+ /**
7
+ * Copyright 2023-present DreamNum Co., Ltd.
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+ const PLUGIN_CONFIG_KEY_MAIN_THREAD = "rpc-node.main-thread.config";
22
+ const configSymbolMainThread = Symbol(PLUGIN_CONFIG_KEY_MAIN_THREAD);
23
+ const defaultPluginMainThreadConfig = {};
24
+ const PLUGIN_CONFIG_KEY_WORKER_THREAD = "rpc-node.worker-thread.config";
25
+ const configSymbolWorkerThread = Symbol(PLUGIN_CONFIG_KEY_WORKER_THREAD);
26
+ const defaultPluginWorkerThreadConfig = {};
27
+
28
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
29
+ function _typeof(o) {
30
+ "@babel/helpers - typeof";
31
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
32
+ return typeof o;
33
+ } : function(o) {
34
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
35
+ }, _typeof(o);
36
+ }
37
+
38
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
39
+ function toPrimitive(t, e) {
40
+ if ("object" != _typeof(t) || !t) return t;
41
+ var r;
42
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
43
+ var i = r.call(t, e || "default");
44
+ if ("object" != _typeof(i)) return i;
45
+ throw new TypeError("@@toPrimitive must return a primitive value.");
46
+ }
47
+ return ("string" === e ? String : Number)(t);
48
+ }
49
+
50
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
51
+ function toPropertyKey(t) {
52
+ var i = toPrimitive(t, "string");
53
+ return "symbol" == _typeof(i) ? i : i + "";
54
+ }
55
+
56
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
57
+ function _defineProperty(e, r, t) {
58
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
59
+ value: t,
60
+ enumerable: !0,
61
+ configurable: !0,
62
+ writable: !0
63
+ }) : e[r] = t, e;
64
+ }
65
+
66
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
67
+ function __decorateParam(paramIndex, decorator) {
68
+ return function(target, key) {
69
+ decorator(target, key, paramIndex);
70
+ };
71
+ }
72
+
73
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
74
+ function __decorate(decorators, target, key, desc) {
75
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
76
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
77
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
78
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
79
+ }
80
+
81
+ export { PLUGIN_CONFIG_KEY_WORKER_THREAD as a, name as c, PLUGIN_CONFIG_KEY_MAIN_THREAD as i, version as l, __decorateParam as n, defaultPluginMainThreadConfig as o, _defineProperty as r, defaultPluginWorkerThreadConfig as s, __decorate as t };
package/lib/es/index.js CHANGED
@@ -1,98 +1,10 @@
1
- import { fork } from "node:child_process";
2
- import process from "node:process";
1
+ import { c as name, i as PLUGIN_CONFIG_KEY_MAIN_THREAD, l as version, n as __decorateParam, o as defaultPluginMainThreadConfig, r as _defineProperty, t as __decorate } from "./decorate-B9OmIMUb.js";
3
2
  import { IConfigService, ILogService, Inject, Injector, Plugin, merge } from "@univerjs/core";
4
- import { ChannelService, DataSyncPrimaryController, DataSyncReplicaController, IRPCChannelService, IRemoteInstanceService, IRemoteSyncService, RemoteSyncPrimaryService, WebWorkerRemoteInstanceService } from "@univerjs/rpc";
3
+ import { ChannelService, DataSyncPrimaryController, IRPCChannelService, IRemoteSyncService, RemoteSyncPrimaryService } from "@univerjs/rpc";
4
+ import { fork } from "node:child_process";
5
5
  import { Observable, shareReplay } from "rxjs";
6
6
 
7
- //#region package.json
8
- var name = "@univerjs/rpc-node";
9
- var version = "1.3.1";
10
-
11
- //#endregion
12
- //#region src/config/config.ts
13
- /**
14
- * Copyright 2023-present DreamNum Co., Ltd.
15
- *
16
- * Licensed under the Apache License, Version 2.0 (the "License");
17
- * you may not use this file except in compliance with the License.
18
- * You may obtain a copy of the License at
19
- *
20
- * http://www.apache.org/licenses/LICENSE-2.0
21
- *
22
- * Unless required by applicable law or agreed to in writing, software
23
- * distributed under the License is distributed on an "AS IS" BASIS,
24
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
- * See the License for the specific language governing permissions and
26
- * limitations under the License.
27
- */
28
- const PLUGIN_CONFIG_KEY_MAIN_THREAD = "rpc-node.main-thread.config";
29
- const configSymbolMainThread = Symbol(PLUGIN_CONFIG_KEY_MAIN_THREAD);
30
- const defaultPluginMainThreadConfig = {};
31
- const PLUGIN_CONFIG_KEY_WORKER_THREAD = "rpc-node.worker-thread.config";
32
- const configSymbolWorkerThread = Symbol(PLUGIN_CONFIG_KEY_WORKER_THREAD);
33
- const defaultPluginWorkerThreadConfig = {};
34
-
35
- //#endregion
36
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
37
- function _typeof(o) {
38
- "@babel/helpers - typeof";
39
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
40
- return typeof o;
41
- } : function(o) {
42
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
43
- }, _typeof(o);
44
- }
45
-
46
- //#endregion
47
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
48
- function toPrimitive(t, r) {
49
- if ("object" != _typeof(t) || !t) return t;
50
- var e = t[Symbol.toPrimitive];
51
- if (void 0 !== e) {
52
- var i = e.call(t, r || "default");
53
- if ("object" != _typeof(i)) return i;
54
- throw new TypeError("@@toPrimitive must return a primitive value.");
55
- }
56
- return ("string" === r ? String : Number)(t);
57
- }
58
-
59
- //#endregion
60
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
61
- function toPropertyKey(t) {
62
- var i = toPrimitive(t, "string");
63
- return "symbol" == _typeof(i) ? i : i + "";
64
- }
65
-
66
- //#endregion
67
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
68
- function _defineProperty(e, r, t) {
69
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
70
- value: t,
71
- enumerable: !0,
72
- configurable: !0,
73
- writable: !0
74
- }) : e[r] = t, e;
75
- }
76
-
77
- //#endregion
78
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
79
- function __decorateParam(paramIndex, decorator) {
80
- return function(target, key) {
81
- decorator(target, key, paramIndex);
82
- };
83
- }
84
-
85
- //#endregion
86
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
87
- function __decorate(decorators, target, key, desc) {
88
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
89
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
90
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91
- return c > 3 && r && Object.defineProperty(target, key, r), r;
92
- }
93
-
94
- //#endregion
95
- //#region src/plugin.ts
7
+ // src/plugin.ts
96
8
  let UniverRPCNodeMainPlugin = class UniverRPCNodeMainPlugin extends Plugin {
97
9
  constructor(_config = defaultPluginMainThreadConfig, _injector, _configService) {
98
10
  super();
@@ -108,7 +20,9 @@ let UniverRPCNodeMainPlugin = class UniverRPCNodeMainPlugin extends Plugin {
108
20
  if (!workerSrc) throw new Error("[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin");
109
21
  const [messageProtocol, child] = createNodeMessagePortOnMain(this._injector, workerSrc);
110
22
  [
111
- [IRPCChannelService, { useFactory: () => new ChannelService(messageProtocol) }],
23
+ [IRPCChannelService, { useFactory: function createChannelService() {
24
+ return new ChannelService(messageProtocol);
25
+ } }],
112
26
  [DataSyncPrimaryController],
113
27
  [IRemoteSyncService, { useClass: RemoteSyncPrimaryService }]
114
28
  ].forEach((dependency) => this._injector.add(dependency));
@@ -131,28 +45,6 @@ _defineProperty(UniverRPCNodeMainPlugin, "pluginName", "UNIVER_RPC_NODE_MAIN_PLU
131
45
  _defineProperty(UniverRPCNodeMainPlugin, "packageName", name);
132
46
  _defineProperty(UniverRPCNodeMainPlugin, "version", version);
133
47
  UniverRPCNodeMainPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverRPCNodeMainPlugin);
134
- let UniverRPCNodeWorkerPlugin = class UniverRPCNodeWorkerPlugin extends Plugin {
135
- constructor(_config = defaultPluginWorkerThreadConfig, _injector, _configService) {
136
- super();
137
- this._config = _config;
138
- this._injector = _injector;
139
- this._configService = _configService;
140
- const { ...rest } = merge({}, defaultPluginWorkerThreadConfig, this._config);
141
- this._configService.setConfig(PLUGIN_CONFIG_KEY_WORKER_THREAD, rest);
142
- }
143
- onStarting() {
144
- [
145
- [DataSyncReplicaController],
146
- [IRPCChannelService, { useFactory: () => new ChannelService(createNodeWorkerMessageProtocol()) }],
147
- [IRemoteInstanceService, { useClass: WebWorkerRemoteInstanceService }]
148
- ].forEach((d) => this._injector.add(d));
149
- this._injector.get(DataSyncReplicaController);
150
- }
151
- };
152
- _defineProperty(UniverRPCNodeWorkerPlugin, "pluginName", "UNIVER_RPC_NODE_WORKER_PLUGIN");
153
- _defineProperty(UniverRPCNodeWorkerPlugin, "packageName", name);
154
- _defineProperty(UniverRPCNodeWorkerPlugin, "version", version);
155
- UniverRPCNodeWorkerPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverRPCNodeWorkerPlugin);
156
48
  function createNodeMessagePortOnMain(injector, path) {
157
49
  const logService = injector.get(ILogService);
158
50
  const child = fork(path);
@@ -174,23 +66,5 @@ function createNodeMessagePortOnMain(injector, path) {
174
66
  }))
175
67
  }, child];
176
68
  }
177
- function createNodeWorkerMessageProtocol() {
178
- return {
179
- send(message) {
180
- process.send(message);
181
- },
182
- onMessage: new Observable((subscriber) => {
183
- const handler = (event) => {
184
- subscriber.next(event);
185
- };
186
- process.on("message", handler);
187
- return () => process.off("message", handler);
188
- }).pipe(shareReplay({
189
- bufferSize: 1,
190
- refCount: true
191
- }))
192
- };
193
- }
194
69
 
195
- //#endregion
196
- export { UniverRPCNodeMainPlugin, UniverRPCNodeWorkerPlugin };
70
+ export { UniverRPCNodeMainPlugin };
@@ -0,0 +1,50 @@
1
+ import { a as PLUGIN_CONFIG_KEY_WORKER_THREAD, c as name, l as version, n as __decorateParam, r as _defineProperty, s as defaultPluginWorkerThreadConfig, t as __decorate } from "./decorate-B9OmIMUb.js";
2
+ import { IConfigService, Inject, Injector, Plugin, merge } from "@univerjs/core";
3
+ import { ChannelService, DataSyncReplicaController, IRPCChannelService, IRemoteInstanceService, WebWorkerRemoteInstanceService } from "@univerjs/rpc";
4
+ import { Observable, shareReplay } from "rxjs";
5
+ import process from "node:process";
6
+
7
+ // src/worker.ts
8
+ let UniverRPCNodeWorkerPlugin = class UniverRPCNodeWorkerPlugin extends Plugin {
9
+ constructor(_config = defaultPluginWorkerThreadConfig, _injector, _configService) {
10
+ super();
11
+ this._config = _config;
12
+ this._injector = _injector;
13
+ this._configService = _configService;
14
+ const { ...rest } = merge({}, defaultPluginWorkerThreadConfig, this._config);
15
+ this._configService.setConfig(PLUGIN_CONFIG_KEY_WORKER_THREAD, rest);
16
+ }
17
+ onStarting() {
18
+ [
19
+ [DataSyncReplicaController],
20
+ [IRPCChannelService, { useFactory: function createChannelService() {
21
+ return new ChannelService(createNodeWorkerMessageProtocol());
22
+ } }],
23
+ [IRemoteInstanceService, { useClass: WebWorkerRemoteInstanceService }]
24
+ ].forEach((d) => this._injector.add(d));
25
+ this._injector.get(DataSyncReplicaController);
26
+ }
27
+ };
28
+ _defineProperty(UniverRPCNodeWorkerPlugin, "pluginName", "UNIVER_RPC_NODE_WORKER_PLUGIN");
29
+ _defineProperty(UniverRPCNodeWorkerPlugin, "packageName", name);
30
+ _defineProperty(UniverRPCNodeWorkerPlugin, "version", version);
31
+ UniverRPCNodeWorkerPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverRPCNodeWorkerPlugin);
32
+ function createNodeWorkerMessageProtocol() {
33
+ return {
34
+ send(message) {
35
+ process.send(message);
36
+ },
37
+ onMessage: new Observable((subscriber) => {
38
+ const handler = (event) => {
39
+ subscriber.next(event);
40
+ };
41
+ process.on("message", handler);
42
+ return () => process.off("message", handler);
43
+ }).pipe(shareReplay({
44
+ bufferSize: 1,
45
+ refCount: true
46
+ }))
47
+ };
48
+ }
49
+
50
+ export { UniverRPCNodeWorkerPlugin };
package/lib/index.js CHANGED
@@ -1,98 +1,10 @@
1
- import { fork } from "node:child_process";
2
- import process from "node:process";
1
+ import { c as name, i as PLUGIN_CONFIG_KEY_MAIN_THREAD, l as version, n as __decorateParam, o as defaultPluginMainThreadConfig, r as _defineProperty, t as __decorate } from "./decorate-B9OmIMUb.js";
3
2
  import { IConfigService, ILogService, Inject, Injector, Plugin, merge } from "@univerjs/core";
4
- import { ChannelService, DataSyncPrimaryController, DataSyncReplicaController, IRPCChannelService, IRemoteInstanceService, IRemoteSyncService, RemoteSyncPrimaryService, WebWorkerRemoteInstanceService } from "@univerjs/rpc";
3
+ import { ChannelService, DataSyncPrimaryController, IRPCChannelService, IRemoteSyncService, RemoteSyncPrimaryService } from "@univerjs/rpc";
4
+ import { fork } from "node:child_process";
5
5
  import { Observable, shareReplay } from "rxjs";
6
6
 
7
- //#region package.json
8
- var name = "@univerjs/rpc-node";
9
- var version = "1.3.1";
10
-
11
- //#endregion
12
- //#region src/config/config.ts
13
- /**
14
- * Copyright 2023-present DreamNum Co., Ltd.
15
- *
16
- * Licensed under the Apache License, Version 2.0 (the "License");
17
- * you may not use this file except in compliance with the License.
18
- * You may obtain a copy of the License at
19
- *
20
- * http://www.apache.org/licenses/LICENSE-2.0
21
- *
22
- * Unless required by applicable law or agreed to in writing, software
23
- * distributed under the License is distributed on an "AS IS" BASIS,
24
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
- * See the License for the specific language governing permissions and
26
- * limitations under the License.
27
- */
28
- const PLUGIN_CONFIG_KEY_MAIN_THREAD = "rpc-node.main-thread.config";
29
- const configSymbolMainThread = Symbol(PLUGIN_CONFIG_KEY_MAIN_THREAD);
30
- const defaultPluginMainThreadConfig = {};
31
- const PLUGIN_CONFIG_KEY_WORKER_THREAD = "rpc-node.worker-thread.config";
32
- const configSymbolWorkerThread = Symbol(PLUGIN_CONFIG_KEY_WORKER_THREAD);
33
- const defaultPluginWorkerThreadConfig = {};
34
-
35
- //#endregion
36
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
37
- function _typeof(o) {
38
- "@babel/helpers - typeof";
39
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
40
- return typeof o;
41
- } : function(o) {
42
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
43
- }, _typeof(o);
44
- }
45
-
46
- //#endregion
47
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
48
- function toPrimitive(t, r) {
49
- if ("object" != _typeof(t) || !t) return t;
50
- var e = t[Symbol.toPrimitive];
51
- if (void 0 !== e) {
52
- var i = e.call(t, r || "default");
53
- if ("object" != _typeof(i)) return i;
54
- throw new TypeError("@@toPrimitive must return a primitive value.");
55
- }
56
- return ("string" === r ? String : Number)(t);
57
- }
58
-
59
- //#endregion
60
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
61
- function toPropertyKey(t) {
62
- var i = toPrimitive(t, "string");
63
- return "symbol" == _typeof(i) ? i : i + "";
64
- }
65
-
66
- //#endregion
67
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
68
- function _defineProperty(e, r, t) {
69
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
70
- value: t,
71
- enumerable: !0,
72
- configurable: !0,
73
- writable: !0
74
- }) : e[r] = t, e;
75
- }
76
-
77
- //#endregion
78
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
79
- function __decorateParam(paramIndex, decorator) {
80
- return function(target, key) {
81
- decorator(target, key, paramIndex);
82
- };
83
- }
84
-
85
- //#endregion
86
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
87
- function __decorate(decorators, target, key, desc) {
88
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
89
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
90
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91
- return c > 3 && r && Object.defineProperty(target, key, r), r;
92
- }
93
-
94
- //#endregion
95
- //#region src/plugin.ts
7
+ // src/plugin.ts
96
8
  let UniverRPCNodeMainPlugin = class UniverRPCNodeMainPlugin extends Plugin {
97
9
  constructor(_config = defaultPluginMainThreadConfig, _injector, _configService) {
98
10
  super();
@@ -108,7 +20,9 @@ let UniverRPCNodeMainPlugin = class UniverRPCNodeMainPlugin extends Plugin {
108
20
  if (!workerSrc) throw new Error("[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin");
109
21
  const [messageProtocol, child] = createNodeMessagePortOnMain(this._injector, workerSrc);
110
22
  [
111
- [IRPCChannelService, { useFactory: () => new ChannelService(messageProtocol) }],
23
+ [IRPCChannelService, { useFactory: function createChannelService() {
24
+ return new ChannelService(messageProtocol);
25
+ } }],
112
26
  [DataSyncPrimaryController],
113
27
  [IRemoteSyncService, { useClass: RemoteSyncPrimaryService }]
114
28
  ].forEach((dependency) => this._injector.add(dependency));
@@ -131,28 +45,6 @@ _defineProperty(UniverRPCNodeMainPlugin, "pluginName", "UNIVER_RPC_NODE_MAIN_PLU
131
45
  _defineProperty(UniverRPCNodeMainPlugin, "packageName", name);
132
46
  _defineProperty(UniverRPCNodeMainPlugin, "version", version);
133
47
  UniverRPCNodeMainPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverRPCNodeMainPlugin);
134
- let UniverRPCNodeWorkerPlugin = class UniverRPCNodeWorkerPlugin extends Plugin {
135
- constructor(_config = defaultPluginWorkerThreadConfig, _injector, _configService) {
136
- super();
137
- this._config = _config;
138
- this._injector = _injector;
139
- this._configService = _configService;
140
- const { ...rest } = merge({}, defaultPluginWorkerThreadConfig, this._config);
141
- this._configService.setConfig(PLUGIN_CONFIG_KEY_WORKER_THREAD, rest);
142
- }
143
- onStarting() {
144
- [
145
- [DataSyncReplicaController],
146
- [IRPCChannelService, { useFactory: () => new ChannelService(createNodeWorkerMessageProtocol()) }],
147
- [IRemoteInstanceService, { useClass: WebWorkerRemoteInstanceService }]
148
- ].forEach((d) => this._injector.add(d));
149
- this._injector.get(DataSyncReplicaController);
150
- }
151
- };
152
- _defineProperty(UniverRPCNodeWorkerPlugin, "pluginName", "UNIVER_RPC_NODE_WORKER_PLUGIN");
153
- _defineProperty(UniverRPCNodeWorkerPlugin, "packageName", name);
154
- _defineProperty(UniverRPCNodeWorkerPlugin, "version", version);
155
- UniverRPCNodeWorkerPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverRPCNodeWorkerPlugin);
156
48
  function createNodeMessagePortOnMain(injector, path) {
157
49
  const logService = injector.get(ILogService);
158
50
  const child = fork(path);
@@ -174,23 +66,5 @@ function createNodeMessagePortOnMain(injector, path) {
174
66
  }))
175
67
  }, child];
176
68
  }
177
- function createNodeWorkerMessageProtocol() {
178
- return {
179
- send(message) {
180
- process.send(message);
181
- },
182
- onMessage: new Observable((subscriber) => {
183
- const handler = (event) => {
184
- subscriber.next(event);
185
- };
186
- process.on("message", handler);
187
- return () => process.off("message", handler);
188
- }).pipe(shareReplay({
189
- bufferSize: 1,
190
- refCount: true
191
- }))
192
- };
193
- }
194
69
 
195
- //#endregion
196
- export { UniverRPCNodeMainPlugin, UniverRPCNodeWorkerPlugin };
70
+ export { UniverRPCNodeMainPlugin };
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { UniverRPCNodeMainPlugin, UniverRPCNodeWorkerPlugin } from './plugin';
16
+ export { UniverRPCNodeMainPlugin } from './plugin';
@@ -13,8 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IUniverRPCNodeMainConfig, IUniverRPCNodeWorkerThreadConfig } from './config/config';
17
16
  import { IConfigService, Injector, Plugin } from '@univerjs/core';
17
+ import type { IUniverRPCNodeMainConfig } from './config/config';
18
18
  export declare class UniverRPCNodeMainPlugin extends Plugin {
19
19
  private readonly _config;
20
20
  protected readonly _injector: Injector;
@@ -27,13 +27,3 @@ export declare class UniverRPCNodeMainPlugin extends Plugin {
27
27
  onStarting(): void;
28
28
  dispose(): void;
29
29
  }
30
- export declare class UniverRPCNodeWorkerPlugin extends Plugin {
31
- private readonly _config;
32
- protected readonly _injector: Injector;
33
- private readonly _configService;
34
- static pluginName: string;
35
- static packageName: string;
36
- static version: string;
37
- constructor(_config: Partial<IUniverRPCNodeWorkerThreadConfig> | undefined, _injector: Injector, _configService: IConfigService);
38
- onStarting(): void;
39
- }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { IConfigService, Injector, Plugin } from '@univerjs/core';
17
+ import type { IUniverRPCNodeWorkerThreadConfig } from './config/config';
18
+ export declare class UniverRPCNodeWorkerPlugin extends Plugin {
19
+ private readonly _config;
20
+ protected readonly _injector: Injector;
21
+ private readonly _configService;
22
+ static pluginName: string;
23
+ static packageName: string;
24
+ static version: string;
25
+ constructor(_config: Partial<IUniverRPCNodeWorkerThreadConfig> | undefined, _injector: Injector, _configService: IConfigService);
26
+ onStarting(): void;
27
+ }
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("node:child_process"),require("node:process"),require("@univerjs/core"),require("@univerjs/rpc"),require("rxjs")):typeof define==`function`&&define.amd?define([`exports`,`node:child_process`,`node:process`,`@univerjs/core`,`@univerjs/rpc`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverRpcNode={},e[`Node:child_process`],e[`Node:process`],e.UniverCore,e.UniverRpc,e.rxjs))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:o(u(e)),f(t||!e||!e.__esModule||!d.call(e,`default`)?s(n,`default`,{value:e,enumerable:!0}):n,e)))(n);var p=`@univerjs/rpc-node`,m=`1.3.1`;let h={},g={};function _(e){"@babel/helpers - typeof";return _=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},_(e)}function v(e,t){if(_(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function y(e){var t=v(e,`string`);return _(t)==`symbol`?t:t+``}function b(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(e,t){return function(n,r){t(n,r,e)}}function S(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let C=class extends r.Plugin{constructor(e=h,t,n){super(),this._config=e,this._injector=t,this._configService=n,b(this,`_child`,null);let{...i}=(0,r.merge)({},h,this._config);this._configService.setConfig(`rpc-node.main-thread.config`,i)}onStarting(){let{workerSrc:e}=this._config;if(!e)throw Error(`[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin`);let[t,n]=T(this._injector,e);[[i.IRPCChannelService,{useFactory:()=>new i.ChannelService(t)}],[i.DataSyncPrimaryController],[i.IRemoteSyncService,{useClass:i.RemoteSyncPrimaryService}]].forEach(e=>this._injector.add(e)),this._injector.get(i.DataSyncPrimaryController),this._child=n}dispose(){if(super.dispose(),this._child){try{this._child.kill()}catch(e){console.error(`Failed to kill child process:`,e)}this._child=null}}};b(C,`pluginName`,`UNIVER_RPC_NODE_MAIN_PLUGIN`),b(C,`packageName`,p),b(C,`version`,m),C=S([x(1,(0,r.Inject)(r.Injector)),x(2,r.IConfigService)],C);let w=class extends r.Plugin{constructor(e=g,t,n){super(),this._config=e,this._injector=t,this._configService=n;let{...i}=(0,r.merge)({},g,this._config);this._configService.setConfig(`rpc-node.worker-thread.config`,i)}onStarting(){[[i.DataSyncReplicaController],[i.IRPCChannelService,{useFactory:()=>new i.ChannelService(E())}],[i.IRemoteInstanceService,{useClass:i.WebWorkerRemoteInstanceService}]].forEach(e=>this._injector.add(e)),this._injector.get(i.DataSyncReplicaController)}};b(w,`pluginName`,`UNIVER_RPC_NODE_WORKER_PLUGIN`),b(w,`packageName`,p),b(w,`version`,m),w=S([x(1,(0,r.Inject)(r.Injector)),x(2,r.IConfigService)],w);function T(e,n){let i=e.get(r.ILogService),o=(0,t.fork)(n);return o.on(`spawn`,()=>i.log(`Child computing process spawned!`)),o.on(`error`,e=>i.error(e)),[{send(e){o.send(e)},onMessage:new a.Observable(e=>{let t=t=>{e.next(t)};return o.on(`message`,t),()=>o.off(`message`,t)}).pipe((0,a.shareReplay)({bufferSize:1,refCount:!0}))},o]}function E(){return{send(e){n.default.send(e)},onMessage:new a.Observable(e=>{let t=t=>{e.next(t)};return n.default.on(`message`,t),()=>n.default.off(`message`,t)}).pipe((0,a.shareReplay)({bufferSize:1,refCount:!0}))}}Object.defineProperty(e,"UniverRPCNodeMainPlugin",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"UniverRPCNodeWorkerPlugin",{enumerable:!0,get:function(){return w}})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/rpc"),require("node:child_process"),require("rxjs")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/rpc`,`node:child_process`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverRpcNode={},e.UniverCore,e.UniverRpc,e[`Node:child_process`],e.rxjs))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=`@univerjs/rpc-node`,o=`1.5.0`;let s={};function c(e){"@babel/helpers - typeof";return c=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},c(e)}function l(e,t){if(c(e)!=`object`||!e)return e;var n;if(typeof Symbol<`u`&&(n=e[Symbol.toPrimitive])!==void 0){var r=n.call(e,t||`default`);if(c(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function u(e){var t=l(e,`string`);return c(t)==`symbol`?t:t+``}function d(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){return function(n,r){t(n,r,e)}}function p(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let m=class extends t.Plugin{constructor(e=s,n,r){super(),this._config=e,this._injector=n,this._configService=r,d(this,`_child`,null);let{...i}=(0,t.merge)({},s,this._config);this._configService.setConfig(`rpc-node.main-thread.config`,i)}onStarting(){let{workerSrc:e}=this._config;if(!e)throw Error(`[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin`);let[t,r]=h(this._injector,e);[[n.IRPCChannelService,{useFactory:function(){return new n.ChannelService(t)}}],[n.DataSyncPrimaryController],[n.IRemoteSyncService,{useClass:n.RemoteSyncPrimaryService}]].forEach(e=>this._injector.add(e)),this._injector.get(n.DataSyncPrimaryController),this._child=r}dispose(){if(super.dispose(),this._child){try{this._child.kill()}catch(e){console.error(`Failed to kill child process:`,e)}this._child=null}}};d(m,`pluginName`,`UNIVER_RPC_NODE_MAIN_PLUGIN`),d(m,`packageName`,a),d(m,`version`,o),m=p([f(1,(0,t.Inject)(t.Injector)),f(2,t.IConfigService)],m);function h(e,n){let a=e.get(t.ILogService),o=(0,r.fork)(n);return o.on(`spawn`,()=>a.log(`Child computing process spawned!`)),o.on(`error`,e=>a.error(e)),[{send(e){o.send(e)},onMessage:new i.Observable(e=>{let t=t=>{e.next(t)};return o.on(`message`,t),()=>o.off(`message`,t)}).pipe((0,i.shareReplay)({bufferSize:1,refCount:!0}))},o]}Object.defineProperty(e,"UniverRPCNodeMainPlugin",{enumerable:!0,get:function(){return m}})});
package/lib/worker.js ADDED
@@ -0,0 +1,50 @@
1
+ import { a as PLUGIN_CONFIG_KEY_WORKER_THREAD, c as name, l as version, n as __decorateParam, r as _defineProperty, s as defaultPluginWorkerThreadConfig, t as __decorate } from "./decorate-B9OmIMUb.js";
2
+ import { IConfigService, Inject, Injector, Plugin, merge } from "@univerjs/core";
3
+ import { ChannelService, DataSyncReplicaController, IRPCChannelService, IRemoteInstanceService, WebWorkerRemoteInstanceService } from "@univerjs/rpc";
4
+ import { Observable, shareReplay } from "rxjs";
5
+ import process from "node:process";
6
+
7
+ // src/worker.ts
8
+ let UniverRPCNodeWorkerPlugin = class UniverRPCNodeWorkerPlugin extends Plugin {
9
+ constructor(_config = defaultPluginWorkerThreadConfig, _injector, _configService) {
10
+ super();
11
+ this._config = _config;
12
+ this._injector = _injector;
13
+ this._configService = _configService;
14
+ const { ...rest } = merge({}, defaultPluginWorkerThreadConfig, this._config);
15
+ this._configService.setConfig(PLUGIN_CONFIG_KEY_WORKER_THREAD, rest);
16
+ }
17
+ onStarting() {
18
+ [
19
+ [DataSyncReplicaController],
20
+ [IRPCChannelService, { useFactory: function createChannelService() {
21
+ return new ChannelService(createNodeWorkerMessageProtocol());
22
+ } }],
23
+ [IRemoteInstanceService, { useClass: WebWorkerRemoteInstanceService }]
24
+ ].forEach((d) => this._injector.add(d));
25
+ this._injector.get(DataSyncReplicaController);
26
+ }
27
+ };
28
+ _defineProperty(UniverRPCNodeWorkerPlugin, "pluginName", "UNIVER_RPC_NODE_WORKER_PLUGIN");
29
+ _defineProperty(UniverRPCNodeWorkerPlugin, "packageName", name);
30
+ _defineProperty(UniverRPCNodeWorkerPlugin, "version", version);
31
+ UniverRPCNodeWorkerPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverRPCNodeWorkerPlugin);
32
+ function createNodeWorkerMessageProtocol() {
33
+ return {
34
+ send(message) {
35
+ process.send(message);
36
+ },
37
+ onMessage: new Observable((subscriber) => {
38
+ const handler = (event) => {
39
+ subscriber.next(event);
40
+ };
41
+ process.on("message", handler);
42
+ return () => process.off("message", handler);
43
+ }).pipe(shareReplay({
44
+ bufferSize: 1,
45
+ refCount: true
46
+ }))
47
+ };
48
+ }
49
+
50
+ export { UniverRPCNodeWorkerPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/rpc-node",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "private": false,
5
5
  "description": "Node.js RPC plugins for Univer main-thread and worker communication.",
6
6
  "author": "DreamNum Co., Ltd. <developer@univer.ai>",
@@ -35,6 +35,11 @@
35
35
  "require": "./lib/cjs/*",
36
36
  "types": "./lib/types/index.d.ts"
37
37
  },
38
+ "./worker": {
39
+ "import": "./lib/es/worker.js",
40
+ "require": "./lib/cjs/worker.js",
41
+ "types": "./lib/types/worker.d.ts"
42
+ },
38
43
  "./lib/*": "./lib/*"
39
44
  },
40
45
  "main": "./lib/es/index.js",
@@ -52,22 +57,22 @@
52
57
  "rxjs": ">=7.0.0"
53
58
  },
54
59
  "dependencies": {
55
- "@univerjs/core": "1.3.1",
56
- "@univerjs/rpc": "1.3.1"
60
+ "@univerjs/core": "1.5.0",
61
+ "@univerjs/rpc": "1.5.0"
57
62
  },
58
63
  "devDependencies": {
59
- "@univerjs-infra/shared": "1.3.1",
64
+ "@univerjs-infra/shared": "1.5.0",
60
65
  "rxjs": "7.8.2",
61
- "typescript": "^6.0.3",
62
- "vitest": "^5.0.4"
66
+ "tsrs": "0.23.0-ts7.1.0-beta",
67
+ "vitest": "^5.1.0"
63
68
  },
64
69
  "scripts": {
65
70
  "test": "vitest run",
66
71
  "test:watch": "vitest",
67
72
  "coverage": "vitest run --coverage",
68
- "typecheck": "tsc --noEmit",
73
+ "typecheck": "tsrs --noEmit",
69
74
  "build:bundle": "univer-cli build",
70
- "build:types": "tsc -p tsconfig.node.json",
75
+ "build:types": "tsrs -p tsconfig.node.json",
71
76
  "build": "pnpm run build:bundle && pnpm run build:types"
72
77
  },
73
78
  "module": "./lib/es/index.js"