@lvce-editor/find-widget-worker 1.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Lvce Editor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # find-widget-worker
2
+
3
+ Find Widget Worker
@@ -0,0 +1,1334 @@
1
+ const normalizeLine = line => {
2
+ if (line.startsWith('Error: ')) {
3
+ return line.slice('Error: '.length);
4
+ }
5
+ if (line.startsWith('VError: ')) {
6
+ return line.slice('VError: '.length);
7
+ }
8
+ return line;
9
+ };
10
+ const getCombinedMessage = (error, message) => {
11
+ const stringifiedError = normalizeLine(`${error}`);
12
+ if (message) {
13
+ return `${message}: ${stringifiedError}`;
14
+ }
15
+ return stringifiedError;
16
+ };
17
+ const NewLine$2 = '\n';
18
+ const getNewLineIndex$1 = (string, startIndex = undefined) => {
19
+ return string.indexOf(NewLine$2, startIndex);
20
+ };
21
+ const mergeStacks = (parent, child) => {
22
+ if (!child) {
23
+ return parent;
24
+ }
25
+ const parentNewLineIndex = getNewLineIndex$1(parent);
26
+ const childNewLineIndex = getNewLineIndex$1(child);
27
+ if (childNewLineIndex === -1) {
28
+ return parent;
29
+ }
30
+ const parentFirstLine = parent.slice(0, parentNewLineIndex);
31
+ const childRest = child.slice(childNewLineIndex);
32
+ const childFirstLine = normalizeLine(child.slice(0, childNewLineIndex));
33
+ if (parentFirstLine.includes(childFirstLine)) {
34
+ return parentFirstLine + childRest;
35
+ }
36
+ return child;
37
+ };
38
+ class VError extends Error {
39
+ constructor(error, message) {
40
+ const combinedMessage = getCombinedMessage(error, message);
41
+ super(combinedMessage);
42
+ this.name = 'VError';
43
+ if (error instanceof Error) {
44
+ this.stack = mergeStacks(this.stack, error.stack);
45
+ }
46
+ if (error.codeFrame) {
47
+ // @ts-ignore
48
+ this.codeFrame = error.codeFrame;
49
+ }
50
+ if (error.code) {
51
+ // @ts-ignore
52
+ this.code = error.code;
53
+ }
54
+ }
55
+ }
56
+
57
+ const isMessagePort = value => {
58
+ return value && value instanceof MessagePort;
59
+ };
60
+ const isMessagePortMain = value => {
61
+ return value && value.constructor && value.constructor.name === 'MessagePortMain';
62
+ };
63
+ const isOffscreenCanvas = value => {
64
+ return typeof OffscreenCanvas !== 'undefined' && value instanceof OffscreenCanvas;
65
+ };
66
+ const isInstanceOf = (value, constructorName) => {
67
+ return value?.constructor?.name === constructorName;
68
+ };
69
+ const isSocket = value => {
70
+ return isInstanceOf(value, 'Socket');
71
+ };
72
+ const transferrables = [isMessagePort, isMessagePortMain, isOffscreenCanvas, isSocket];
73
+ const isTransferrable = value => {
74
+ for (const fn of transferrables) {
75
+ if (fn(value)) {
76
+ return true;
77
+ }
78
+ }
79
+ return false;
80
+ };
81
+ const walkValue = (value, transferrables, isTransferrable) => {
82
+ if (!value) {
83
+ return;
84
+ }
85
+ if (isTransferrable(value)) {
86
+ transferrables.push(value);
87
+ return;
88
+ }
89
+ if (Array.isArray(value)) {
90
+ for (const item of value) {
91
+ walkValue(item, transferrables, isTransferrable);
92
+ }
93
+ return;
94
+ }
95
+ if (typeof value === 'object') {
96
+ for (const property of Object.values(value)) {
97
+ walkValue(property, transferrables, isTransferrable);
98
+ }
99
+ return;
100
+ }
101
+ };
102
+ const getTransferrables = value => {
103
+ const transferrables = [];
104
+ walkValue(value, transferrables, isTransferrable);
105
+ return transferrables;
106
+ };
107
+ const attachEvents = that => {
108
+ const handleMessage = (...args) => {
109
+ const data = that.getData(...args);
110
+ that.dispatchEvent(new MessageEvent('message', {
111
+ data
112
+ }));
113
+ };
114
+ that.onMessage(handleMessage);
115
+ const handleClose = event => {
116
+ that.dispatchEvent(new Event('close'));
117
+ };
118
+ that.onClose(handleClose);
119
+ };
120
+ class Ipc extends EventTarget {
121
+ constructor(rawIpc) {
122
+ super();
123
+ this._rawIpc = rawIpc;
124
+ attachEvents(this);
125
+ }
126
+ }
127
+ const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
128
+ const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
129
+ const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
130
+ const NewLine$1 = '\n';
131
+ const joinLines$1 = lines => {
132
+ return lines.join(NewLine$1);
133
+ };
134
+ const RE_AT = /^\s+at/;
135
+ const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
136
+ const isNormalStackLine = line => {
137
+ return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
138
+ };
139
+ const getDetails = lines => {
140
+ const index = lines.findIndex(isNormalStackLine);
141
+ if (index === -1) {
142
+ return {
143
+ actualMessage: joinLines$1(lines),
144
+ rest: []
145
+ };
146
+ }
147
+ let lastIndex = index - 1;
148
+ while (++lastIndex < lines.length) {
149
+ if (!isNormalStackLine(lines[lastIndex])) {
150
+ break;
151
+ }
152
+ }
153
+ return {
154
+ actualMessage: lines[index - 1],
155
+ rest: lines.slice(index, lastIndex)
156
+ };
157
+ };
158
+ const splitLines$1 = lines => {
159
+ return lines.split(NewLine$1);
160
+ };
161
+ const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
162
+ const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
163
+ const isMessageCodeBlockStartIndex = line => {
164
+ return RE_MESSAGE_CODE_BLOCK_START.test(line);
165
+ };
166
+ const isMessageCodeBlockEndIndex = line => {
167
+ return RE_MESSAGE_CODE_BLOCK_END.test(line);
168
+ };
169
+ const getMessageCodeBlock = stderr => {
170
+ const lines = splitLines$1(stderr);
171
+ const startIndex = lines.findIndex(isMessageCodeBlockStartIndex);
172
+ const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex);
173
+ const relevantLines = lines.slice(startIndex, endIndex);
174
+ const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
175
+ return relevantMessage;
176
+ };
177
+ const isModuleNotFoundMessage = line => {
178
+ return line.includes('[ERR_MODULE_NOT_FOUND]');
179
+ };
180
+ const getModuleNotFoundError = stderr => {
181
+ const lines = splitLines$1(stderr);
182
+ const messageIndex = lines.findIndex(isModuleNotFoundMessage);
183
+ const message = lines[messageIndex];
184
+ return {
185
+ message,
186
+ code: ERR_MODULE_NOT_FOUND
187
+ };
188
+ };
189
+ const isModuleNotFoundError = stderr => {
190
+ if (!stderr) {
191
+ return false;
192
+ }
193
+ return stderr.includes('ERR_MODULE_NOT_FOUND');
194
+ };
195
+ const isModulesSyntaxError = stderr => {
196
+ if (!stderr) {
197
+ return false;
198
+ }
199
+ return stderr.includes('SyntaxError: Cannot use import statement outside a module');
200
+ };
201
+ const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
202
+ const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
203
+ const isUnhelpfulNativeModuleError = stderr => {
204
+ return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
205
+ };
206
+ const getNativeModuleErrorMessage = stderr => {
207
+ const message = getMessageCodeBlock(stderr);
208
+ return {
209
+ message: `Incompatible native node module: ${message}`,
210
+ code: E_INCOMPATIBLE_NATIVE_MODULE
211
+ };
212
+ };
213
+ const getModuleSyntaxError = () => {
214
+ return {
215
+ message: `ES Modules are not supported in electron`,
216
+ code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
217
+ };
218
+ };
219
+ const getHelpfulChildProcessError = (stdout, stderr) => {
220
+ if (isUnhelpfulNativeModuleError(stderr)) {
221
+ return getNativeModuleErrorMessage(stderr);
222
+ }
223
+ if (isModulesSyntaxError(stderr)) {
224
+ return getModuleSyntaxError();
225
+ }
226
+ if (isModuleNotFoundError(stderr)) {
227
+ return getModuleNotFoundError(stderr);
228
+ }
229
+ const lines = splitLines$1(stderr);
230
+ const {
231
+ actualMessage,
232
+ rest
233
+ } = getDetails(lines);
234
+ return {
235
+ message: actualMessage,
236
+ code: '',
237
+ stack: rest
238
+ };
239
+ };
240
+ class IpcError extends VError {
241
+ // @ts-ignore
242
+ constructor(betterMessage, stdout = '', stderr = '') {
243
+ if (stdout || stderr) {
244
+ // @ts-ignore
245
+ const {
246
+ message,
247
+ code,
248
+ stack
249
+ } = getHelpfulChildProcessError(stdout, stderr);
250
+ const cause = new Error(message);
251
+ // @ts-ignore
252
+ cause.code = code;
253
+ cause.stack = stack;
254
+ super(cause, betterMessage);
255
+ } else {
256
+ super(betterMessage);
257
+ }
258
+ // @ts-ignore
259
+ this.name = 'IpcError';
260
+ // @ts-ignore
261
+ this.stdout = stdout;
262
+ // @ts-ignore
263
+ this.stderr = stderr;
264
+ }
265
+ }
266
+ const readyMessage = 'ready';
267
+ const getData$2 = event => {
268
+ return event.data;
269
+ };
270
+ const listen$7 = () => {
271
+ // @ts-ignore
272
+ if (typeof WorkerGlobalScope === 'undefined') {
273
+ throw new TypeError('module is not in web worker scope');
274
+ }
275
+ return globalThis;
276
+ };
277
+ const signal$8 = global => {
278
+ global.postMessage(readyMessage);
279
+ };
280
+ class IpcChildWithModuleWorker extends Ipc {
281
+ getData(event) {
282
+ return getData$2(event);
283
+ }
284
+ send(message) {
285
+ // @ts-ignore
286
+ this._rawIpc.postMessage(message);
287
+ }
288
+ sendAndTransfer(message) {
289
+ const transfer = getTransferrables(message);
290
+ // @ts-ignore
291
+ this._rawIpc.postMessage(message, transfer);
292
+ }
293
+ dispose() {
294
+ // ignore
295
+ }
296
+ onClose(callback) {
297
+ // ignore
298
+ }
299
+ onMessage(callback) {
300
+ this._rawIpc.addEventListener('message', callback);
301
+ }
302
+ }
303
+ const wrap$f = global => {
304
+ return new IpcChildWithModuleWorker(global);
305
+ };
306
+ const waitForFirstMessage = async port => {
307
+ const {
308
+ resolve,
309
+ promise
310
+ } = Promise.withResolvers();
311
+ port.addEventListener('message', resolve, {
312
+ once: true
313
+ });
314
+ const event = await promise;
315
+ // @ts-ignore
316
+ return event.data;
317
+ };
318
+ const listen$6 = async () => {
319
+ const parentIpcRaw = listen$7();
320
+ signal$8(parentIpcRaw);
321
+ const parentIpc = wrap$f(parentIpcRaw);
322
+ const firstMessage = await waitForFirstMessage(parentIpc);
323
+ if (firstMessage.method !== 'initialize') {
324
+ throw new IpcError('unexpected first message');
325
+ }
326
+ const type = firstMessage.params[0];
327
+ if (type === 'message-port') {
328
+ parentIpc.send({
329
+ jsonrpc: '2.0',
330
+ id: firstMessage.id,
331
+ result: null
332
+ });
333
+ parentIpc.dispose();
334
+ const port = firstMessage.params[1];
335
+ return port;
336
+ }
337
+ return globalThis;
338
+ };
339
+ class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
340
+ getData(event) {
341
+ return getData$2(event);
342
+ }
343
+ send(message) {
344
+ this._rawIpc.postMessage(message);
345
+ }
346
+ sendAndTransfer(message) {
347
+ const transfer = getTransferrables(message);
348
+ this._rawIpc.postMessage(message, transfer);
349
+ }
350
+ dispose() {
351
+ if (this._rawIpc.close) {
352
+ this._rawIpc.close();
353
+ }
354
+ }
355
+ onClose(callback) {
356
+ // ignore
357
+ }
358
+ onMessage(callback) {
359
+ this._rawIpc.addEventListener('message', callback);
360
+ this._rawIpc.start();
361
+ }
362
+ }
363
+ const wrap$e = port => {
364
+ return new IpcChildWithModuleWorkerAndMessagePort(port);
365
+ };
366
+ const IpcChildWithModuleWorkerAndMessagePort$1 = {
367
+ __proto__: null,
368
+ listen: listen$6,
369
+ wrap: wrap$e
370
+ };
371
+
372
+ const Two = '2.0';
373
+ const create$4 = (method, params) => {
374
+ return {
375
+ jsonrpc: Two,
376
+ method,
377
+ params
378
+ };
379
+ };
380
+ const callbacks = Object.create(null);
381
+ const set$1 = (id, fn) => {
382
+ callbacks[id] = fn;
383
+ };
384
+ const get$1 = id => {
385
+ return callbacks[id];
386
+ };
387
+ const remove = id => {
388
+ delete callbacks[id];
389
+ };
390
+ let id = 0;
391
+ const create$3 = () => {
392
+ return ++id;
393
+ };
394
+ const registerPromise = () => {
395
+ const id = create$3();
396
+ const {
397
+ resolve,
398
+ promise
399
+ } = Promise.withResolvers();
400
+ set$1(id, resolve);
401
+ return {
402
+ id,
403
+ promise
404
+ };
405
+ };
406
+ const create$2$1 = (method, params) => {
407
+ const {
408
+ id,
409
+ promise
410
+ } = registerPromise();
411
+ const message = {
412
+ jsonrpc: Two,
413
+ method,
414
+ params,
415
+ id
416
+ };
417
+ return {
418
+ message,
419
+ promise
420
+ };
421
+ };
422
+ class JsonRpcError extends Error {
423
+ constructor(message) {
424
+ super(message);
425
+ this.name = 'JsonRpcError';
426
+ }
427
+ }
428
+ const NewLine = '\n';
429
+ const DomException = 'DOMException';
430
+ const ReferenceError$1 = 'ReferenceError';
431
+ const SyntaxError$1 = 'SyntaxError';
432
+ const TypeError$1 = 'TypeError';
433
+ const getErrorConstructor = (message, type) => {
434
+ if (type) {
435
+ switch (type) {
436
+ case DomException:
437
+ return DOMException;
438
+ case TypeError$1:
439
+ return TypeError;
440
+ case SyntaxError$1:
441
+ return SyntaxError;
442
+ case ReferenceError$1:
443
+ return ReferenceError;
444
+ default:
445
+ return Error;
446
+ }
447
+ }
448
+ if (message.startsWith('TypeError: ')) {
449
+ return TypeError;
450
+ }
451
+ if (message.startsWith('SyntaxError: ')) {
452
+ return SyntaxError;
453
+ }
454
+ if (message.startsWith('ReferenceError: ')) {
455
+ return ReferenceError;
456
+ }
457
+ return Error;
458
+ };
459
+ const constructError = (message, type, name) => {
460
+ const ErrorConstructor = getErrorConstructor(message, type);
461
+ if (ErrorConstructor === DOMException && name) {
462
+ return new ErrorConstructor(message, name);
463
+ }
464
+ if (ErrorConstructor === Error) {
465
+ const error = new Error(message);
466
+ if (name && name !== 'VError') {
467
+ error.name = name;
468
+ }
469
+ return error;
470
+ }
471
+ return new ErrorConstructor(message);
472
+ };
473
+ const getNewLineIndex = (string, startIndex = undefined) => {
474
+ return string.indexOf(NewLine, startIndex);
475
+ };
476
+ const getParentStack = error => {
477
+ let parentStack = error.stack || error.data || error.message || '';
478
+ if (parentStack.startsWith(' at')) {
479
+ parentStack = error.message + NewLine + parentStack;
480
+ }
481
+ return parentStack;
482
+ };
483
+ const joinLines = lines => {
484
+ return lines.join(NewLine);
485
+ };
486
+ const MethodNotFound = -32601;
487
+ const Custom = -32001;
488
+ const splitLines = lines => {
489
+ return lines.split(NewLine);
490
+ };
491
+ const restoreJsonRpcError = error => {
492
+ if (error && error instanceof Error) {
493
+ return error;
494
+ }
495
+ const currentStack = joinLines(splitLines(new Error().stack || '').slice(1));
496
+ if (error && error.code && error.code === MethodNotFound) {
497
+ const restoredError = new JsonRpcError(error.message);
498
+ const parentStack = getParentStack(error);
499
+ restoredError.stack = parentStack + NewLine + currentStack;
500
+ return restoredError;
501
+ }
502
+ if (error && error.message) {
503
+ const restoredError = constructError(error.message, error.type, error.name);
504
+ if (error.data) {
505
+ if (error.data.stack && error.data.type && error.message) {
506
+ restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
507
+ } else if (error.data.stack) {
508
+ restoredError.stack = error.data.stack;
509
+ }
510
+ if (error.data.codeFrame) {
511
+ // @ts-ignore
512
+ restoredError.codeFrame = error.data.codeFrame;
513
+ }
514
+ if (error.data.code) {
515
+ // @ts-ignore
516
+ restoredError.code = error.data.code;
517
+ }
518
+ if (error.data.type) {
519
+ // @ts-ignore
520
+ restoredError.name = error.data.type;
521
+ }
522
+ } else {
523
+ if (error.stack) {
524
+ const lowerStack = restoredError.stack || '';
525
+ // @ts-ignore
526
+ const indexNewLine = getNewLineIndex(lowerStack);
527
+ const parentStack = getParentStack(error);
528
+ // @ts-ignore
529
+ restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
530
+ }
531
+ if (error.codeFrame) {
532
+ // @ts-ignore
533
+ restoredError.codeFrame = error.codeFrame;
534
+ }
535
+ }
536
+ return restoredError;
537
+ }
538
+ if (typeof error === 'string') {
539
+ return new Error(`JsonRpc Error: ${error}`);
540
+ }
541
+ return new Error(`JsonRpc Error: ${error}`);
542
+ };
543
+ const unwrapJsonRpcResult = responseMessage => {
544
+ if ('error' in responseMessage) {
545
+ const restoredError = restoreJsonRpcError(responseMessage.error);
546
+ throw restoredError;
547
+ }
548
+ if ('result' in responseMessage) {
549
+ return responseMessage.result;
550
+ }
551
+ throw new JsonRpcError('unexpected response message');
552
+ };
553
+ const warn = (...args) => {
554
+ console.warn(...args);
555
+ };
556
+ const resolve = (id, response) => {
557
+ const fn = get$1(id);
558
+ if (!fn) {
559
+ console.log(response);
560
+ warn(`callback ${id} may already be disposed`);
561
+ return;
562
+ }
563
+ fn(response);
564
+ remove(id);
565
+ };
566
+ const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
567
+ const getErrorType = prettyError => {
568
+ if (prettyError && prettyError.type) {
569
+ return prettyError.type;
570
+ }
571
+ if (prettyError && prettyError.constructor && prettyError.constructor.name) {
572
+ return prettyError.constructor.name;
573
+ }
574
+ return undefined;
575
+ };
576
+ const getErrorProperty = (error, prettyError) => {
577
+ if (error && error.code === E_COMMAND_NOT_FOUND) {
578
+ return {
579
+ code: MethodNotFound,
580
+ message: error.message,
581
+ data: error.stack
582
+ };
583
+ }
584
+ return {
585
+ code: Custom,
586
+ message: prettyError.message,
587
+ data: {
588
+ stack: prettyError.stack,
589
+ codeFrame: prettyError.codeFrame,
590
+ type: getErrorType(prettyError),
591
+ code: prettyError.code,
592
+ name: prettyError.name
593
+ }
594
+ };
595
+ };
596
+ const create$1$1 = (message, error) => {
597
+ return {
598
+ jsonrpc: Two,
599
+ id: message.id,
600
+ error
601
+ };
602
+ };
603
+ const getErrorResponse = (message, error, preparePrettyError, logError) => {
604
+ const prettyError = preparePrettyError(error);
605
+ logError(error, prettyError);
606
+ const errorProperty = getErrorProperty(error, prettyError);
607
+ return create$1$1(message, errorProperty);
608
+ };
609
+ const create$5 = (message, result) => {
610
+ return {
611
+ jsonrpc: Two,
612
+ id: message.id,
613
+ result: result ?? null
614
+ };
615
+ };
616
+ const getSuccessResponse = (message, result) => {
617
+ const resultProperty = result ?? null;
618
+ return create$5(message, resultProperty);
619
+ };
620
+ const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
621
+ try {
622
+ const result = requiresSocket(message.method) ? await execute(message.method, ipc, ...message.params) : await execute(message.method, ...message.params);
623
+ return getSuccessResponse(message, result);
624
+ } catch (error) {
625
+ return getErrorResponse(message, error, preparePrettyError, logError);
626
+ }
627
+ };
628
+ const defaultPreparePrettyError = error => {
629
+ return error;
630
+ };
631
+ const defaultLogError = () => {
632
+ // ignore
633
+ };
634
+ const defaultRequiresSocket = () => {
635
+ return false;
636
+ };
637
+ const defaultResolve = resolve;
638
+
639
+ // TODO maybe remove this in v6 or v7, only accept options object to simplify the code
640
+ const normalizeParams = args => {
641
+ if (args.length === 1) {
642
+ const options = args[0];
643
+ return {
644
+ ipc: options.ipc,
645
+ message: options.message,
646
+ execute: options.execute,
647
+ resolve: options.resolve || defaultResolve,
648
+ preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
649
+ logError: options.logError || defaultLogError,
650
+ requiresSocket: options.requiresSocket || defaultRequiresSocket
651
+ };
652
+ }
653
+ return {
654
+ ipc: args[0],
655
+ message: args[1],
656
+ execute: args[2],
657
+ resolve: args[3],
658
+ preparePrettyError: args[4],
659
+ logError: args[5],
660
+ requiresSocket: args[6]
661
+ };
662
+ };
663
+ const handleJsonRpcMessage = async (...args) => {
664
+ const options = normalizeParams(args);
665
+ const {
666
+ message,
667
+ ipc,
668
+ execute,
669
+ resolve,
670
+ preparePrettyError,
671
+ logError,
672
+ requiresSocket
673
+ } = options;
674
+ if ('id' in message) {
675
+ if ('method' in message) {
676
+ const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
677
+ try {
678
+ ipc.send(response);
679
+ } catch (error) {
680
+ const errorResponse = getErrorResponse(message, error, preparePrettyError, logError);
681
+ ipc.send(errorResponse);
682
+ }
683
+ return;
684
+ }
685
+ resolve(message.id, message);
686
+ return;
687
+ }
688
+ if ('method' in message) {
689
+ await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
690
+ return;
691
+ }
692
+ throw new JsonRpcError('unexpected message');
693
+ };
694
+ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
695
+ const {
696
+ message,
697
+ promise
698
+ } = create$2$1(method, params);
699
+ if (useSendAndTransfer && ipc.sendAndTransfer) {
700
+ ipc.sendAndTransfer(message);
701
+ } else {
702
+ ipc.send(message);
703
+ }
704
+ const responseMessage = await promise;
705
+ return unwrapJsonRpcResult(responseMessage);
706
+ };
707
+ const send = (transport, method, ...params) => {
708
+ const message = create$4(method, params);
709
+ transport.send(message);
710
+ };
711
+ const invoke = (ipc, method, ...params) => {
712
+ return invokeHelper(ipc, method, params, false);
713
+ };
714
+ const invokeAndTransfer = (ipc, method, ...params) => {
715
+ return invokeHelper(ipc, method, params, true);
716
+ };
717
+
718
+ const commands = Object.create(null);
719
+ const register = commandMap => {
720
+ Object.assign(commands, commandMap);
721
+ };
722
+ const getCommand = key => {
723
+ return commands[key];
724
+ };
725
+ const execute = (command, ...args) => {
726
+ const fn = getCommand(command);
727
+ if (!fn) {
728
+ throw new Error(`command not found ${command}`);
729
+ }
730
+ return fn(...args);
731
+ };
732
+
733
+ const createRpc = ipc => {
734
+ const rpc = {
735
+ // @ts-ignore
736
+ ipc,
737
+ /**
738
+ * @deprecated
739
+ */
740
+ send(method, ...params) {
741
+ send(ipc, method, ...params);
742
+ },
743
+ invoke(method, ...params) {
744
+ return invoke(ipc, method, ...params);
745
+ },
746
+ invokeAndTransfer(method, ...params) {
747
+ return invokeAndTransfer(ipc, method, ...params);
748
+ },
749
+ async dispose() {
750
+ await ipc?.dispose();
751
+ }
752
+ };
753
+ return rpc;
754
+ };
755
+ const requiresSocket = () => {
756
+ return false;
757
+ };
758
+ const preparePrettyError = error => {
759
+ return error;
760
+ };
761
+ const logError = () => {
762
+ // handled by renderer worker
763
+ };
764
+ const handleMessage = event => {
765
+ const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
766
+ const actualExecute = event?.target?.execute || execute;
767
+ return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError, logError, actualRequiresSocket);
768
+ };
769
+ const handleIpc = ipc => {
770
+ if ('addEventListener' in ipc) {
771
+ ipc.addEventListener('message', handleMessage);
772
+ } else if ('on' in ipc) {
773
+ // deprecated
774
+ ipc.on('message', handleMessage);
775
+ }
776
+ };
777
+ const listen$1 = async (module, options) => {
778
+ const rawIpc = await module.listen(options);
779
+ if (module.signal) {
780
+ module.signal(rawIpc);
781
+ }
782
+ const ipc = module.wrap(rawIpc);
783
+ return ipc;
784
+ };
785
+ const create$2 = async ({
786
+ commandMap
787
+ }) => {
788
+ // TODO create a commandMap per rpc instance
789
+ register(commandMap);
790
+ const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
791
+ handleIpc(ipc);
792
+ const rpc = createRpc(ipc);
793
+ return rpc;
794
+ };
795
+ const WebWorkerRpcClient = {
796
+ __proto__: null,
797
+ create: create$2
798
+ };
799
+
800
+ const create$1 = () => {
801
+ const states = Object.create(null);
802
+ return {
803
+ get(uid) {
804
+ return states[uid];
805
+ },
806
+ set(uid, oldState, newState) {
807
+ states[uid] = {
808
+ oldState,
809
+ newState
810
+ };
811
+ },
812
+ dispose(uid) {
813
+ delete states[uid];
814
+ },
815
+ getKeys() {
816
+ return Object.keys(states).map(key => {
817
+ return Number.parseInt(key);
818
+ });
819
+ },
820
+ clear() {
821
+ for (const key of Object.keys(states)) {
822
+ delete states[key];
823
+ }
824
+ },
825
+ wrapCommand(fn) {
826
+ const wrapped = async (uid, ...args) => {
827
+ const {
828
+ newState
829
+ } = states[uid];
830
+ const newerState = await fn(newState, ...args);
831
+ if (newState === newerState) {
832
+ return;
833
+ }
834
+ const latest = states[uid];
835
+ states[uid] = {
836
+ oldState: latest.oldState,
837
+ newState: newerState
838
+ };
839
+ };
840
+ return wrapped;
841
+ },
842
+ diff(uid, modules, numbers) {
843
+ const {
844
+ oldState,
845
+ newState
846
+ } = states[uid];
847
+ const diffResult = [];
848
+ for (let i = 0; i < modules.length; i++) {
849
+ const fn = modules[i];
850
+ if (!fn(oldState, newState)) {
851
+ diffResult.push(numbers[i]);
852
+ }
853
+ }
854
+ return diffResult;
855
+ }
856
+ };
857
+ };
858
+
859
+ const {
860
+ get,
861
+ set,
862
+ wrapCommand
863
+ } = create$1();
864
+
865
+ const Unknown = 0;
866
+
867
+ const create = (uid, x, y, width, height, parentUid) => {
868
+ const state = {
869
+ uid,
870
+ value: '',
871
+ ariaAnnouncement: '',
872
+ matches: new Uint32Array(),
873
+ matchIndex: -1,
874
+ matchCount: 0,
875
+ replaceExpanded: false,
876
+ useRegularExpression: false,
877
+ matchCase: false,
878
+ matchWholeWord: false,
879
+ replacement: '',
880
+ editorUid: 0,
881
+ x: 0,
882
+ y: 0,
883
+ width: 0,
884
+ height: 0,
885
+ focused: false,
886
+ focusSource: Unknown,
887
+ focus: 0,
888
+ version: 0
889
+ };
890
+ set(uid, state, state);
891
+ return state;
892
+ };
893
+
894
+ const modules = [];
895
+ const numbers = [];
896
+
897
+ const diff = (oldState, newState) => {
898
+ const diffResult = [];
899
+ for (let i = 0; i < modules.length; i++) {
900
+ const fn = modules[i];
901
+ if (!fn(oldState, newState)) {
902
+ diffResult.push(numbers[i]);
903
+ }
904
+ }
905
+ return diffResult;
906
+ };
907
+
908
+ const diff2 = uid => {
909
+ const {
910
+ oldState,
911
+ newState
912
+ } = get(uid);
913
+ const diffResult = diff(oldState, newState);
914
+ return diffResult;
915
+ };
916
+
917
+ const commandIds = ['handleSliderPointerDown', 'handleSliderPointerMove'];
918
+
919
+ const getCommandIds = () => {
920
+ return commandIds;
921
+ };
922
+
923
+ const loadContent = state => {
924
+ return {
925
+ ...state,
926
+ version: 1
927
+ };
928
+ };
929
+
930
+ const RenderContent = 13;
931
+
932
+ const HandleClickClose = 'handleClickClose';
933
+ const HandleClickNextMatch = 'handleClickNextMatch';
934
+ const HandleClickPreviousMatch = 'handleClickPreviousMatch';
935
+ const HandleClickReplace = 'handleClickReplace';
936
+ const HandleClickReplaceAll = 'handleClickReplaceAll';
937
+ const HandleFocus = 'handleFocus';
938
+ const HandleInput = 'handleInput';
939
+ const HandleReplaceFocus = 'handleReplaceFocus';
940
+ const HandleReplaceInput = 'handleReplaceInput';
941
+
942
+ const emptyObject = {};
943
+ const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
944
+ const i18nString = (key, placeholders = emptyObject) => {
945
+ if (placeholders === emptyObject) {
946
+ return key;
947
+ }
948
+ const replacer = (match, rest) => {
949
+ return placeholders[rest];
950
+ };
951
+ return key.replaceAll(RE_PLACEHOLDER, replacer);
952
+ };
953
+
954
+ /**
955
+ * @enum {string}
956
+ */
957
+ const UiStrings = {
958
+ MatchOf: '{PH1} of {PH2}',
959
+ NoResults: 'No Results',
960
+ Close: 'Close',
961
+ PreviousMatch: 'Previous Match',
962
+ NextMatch: 'Next Match',
963
+ Find: 'Find',
964
+ Replace: 'Replace',
965
+ ReplaceAll: 'Replace All'
966
+ };
967
+ const noResults = () => {
968
+ return i18nString(UiStrings.NoResults);
969
+ };
970
+ const matchOf = (matchIndex, matchCount) => {
971
+ return i18nString(UiStrings.MatchOf, {
972
+ PH1: matchIndex,
973
+ PH2: matchCount
974
+ });
975
+ };
976
+ const previousMatch = () => {
977
+ return i18nString(UiStrings.PreviousMatch);
978
+ };
979
+ const nextMatch = () => {
980
+ return i18nString(UiStrings.NextMatch);
981
+ };
982
+ const close = () => {
983
+ return i18nString(UiStrings.Close);
984
+ };
985
+ const find = () => {
986
+ return i18nString(UiStrings.Find);
987
+ };
988
+ const replace = () => {
989
+ return i18nString(UiStrings.Replace);
990
+ };
991
+ const replaceAll = () => {
992
+ return i18nString(UiStrings.ReplaceAll);
993
+ };
994
+
995
+ const ArrowDown = 'ArrowDown';
996
+ const ArrowUp = 'ArrowUp';
997
+ const Close$1 = 'Close';
998
+ const Replace$1 = 'Replace';
999
+ const ReplaceAll$1 = 'ReplaceAll';
1000
+
1001
+ const ReplaceAll = 'ReplaceAll';
1002
+ const Close = 'Close';
1003
+ const FocusNext = 'FocusNext';
1004
+ const FocusPrevious = 'FocusPrevious';
1005
+ const Replace = 'Replace';
1006
+
1007
+ const getFindWidgetButtons = (findButtonsEnabled, replaceButtonsEnabled) => {
1008
+ const findButtons = [{
1009
+ label: previousMatch(),
1010
+ icon: ArrowUp,
1011
+ disabled: !findButtonsEnabled,
1012
+ onClick: HandleClickPreviousMatch,
1013
+ name: FocusPrevious
1014
+ }, {
1015
+ label: nextMatch(),
1016
+ icon: ArrowDown,
1017
+ disabled: !findButtonsEnabled,
1018
+ onClick: HandleClickNextMatch,
1019
+ name: FocusNext
1020
+ }, {
1021
+ label: close(),
1022
+ icon: Close$1,
1023
+ disabled: false,
1024
+ onClick: HandleClickClose,
1025
+ name: Close
1026
+ }];
1027
+ const replaceButtons = [{
1028
+ label: replace(),
1029
+ icon: Replace$1,
1030
+ disabled: !replaceButtonsEnabled,
1031
+ onClick: HandleClickReplace,
1032
+ name: Replace
1033
+ }, {
1034
+ label: replaceAll(),
1035
+ icon: ReplaceAll$1,
1036
+ disabled: !replaceButtonsEnabled,
1037
+ onClick: HandleClickReplaceAll,
1038
+ name: ReplaceAll
1039
+ }];
1040
+ return {
1041
+ findButtons,
1042
+ replaceButtons
1043
+ };
1044
+ };
1045
+
1046
+ const getFindWidgetButtonsEnabled = (matchCount, value) => {
1047
+ const findButtonsEnabled = matchCount > 0;
1048
+ const replaceButtonsEnabled = value.length > 0;
1049
+ return {
1050
+ findButtonsEnabled,
1051
+ replaceButtonsEnabled
1052
+ };
1053
+ };
1054
+
1055
+ const CheckBox = 'checkbox';
1056
+ const Group = 'group';
1057
+ const None = 'none';
1058
+
1059
+ const FindWidgetFind = 'FindWidgetFind';
1060
+ const FindWidgetMatchCount = 'FindWidgetMatchCount';
1061
+ const FindWidgetMatchCountEmpty = 'FindWidgetMatchCountEmpty';
1062
+ const FindWidgetReplace = 'FindWidgetReplace';
1063
+ const FindWidgetRight = 'FindWidgetRight';
1064
+ const IconButton = 'IconButton';
1065
+ const IconButtonDisabled = 'IconButtonDisabled';
1066
+ const MaskIcon = 'MaskIcon';
1067
+ const MultilineInputBox = 'MultilineInputBox';
1068
+ const SearchField = 'SearchField';
1069
+ const SearchFieldButton = 'SearchFieldButton';
1070
+ const SearchFieldButtonChecked = 'SearchFieldButtonChecked';
1071
+ const SearchFieldButtons = 'SearchFieldButtons';
1072
+
1073
+ const mergeClassNames = (...classNames) => {
1074
+ return classNames.filter(Boolean).join(' ');
1075
+ };
1076
+ const Text = 12;
1077
+ const text = data => {
1078
+ return {
1079
+ type: Text,
1080
+ text: data,
1081
+ childCount: 0
1082
+ };
1083
+ };
1084
+
1085
+ const getFindMatchCountClassName = (matchCount, value) => {
1086
+ if (value && matchCount === 0) {
1087
+ return mergeClassNames(FindWidgetMatchCount, FindWidgetMatchCountEmpty);
1088
+ }
1089
+ return FindWidgetMatchCount;
1090
+ };
1091
+
1092
+ const Button = 1;
1093
+ const Div = 4;
1094
+ const TextArea = 62;
1095
+
1096
+ const getIconVirtualDom = (icon, type = Div) => {
1097
+ return {
1098
+ type,
1099
+ className: `MaskIcon MaskIcon${icon}`,
1100
+ role: None,
1101
+ childCount: 0
1102
+ };
1103
+ };
1104
+
1105
+ const getIconButtonVirtualDom = iconButton => {
1106
+ const {
1107
+ label,
1108
+ icon,
1109
+ disabled,
1110
+ name,
1111
+ onClick
1112
+ } = iconButton;
1113
+ let className = IconButton;
1114
+ if (disabled) {
1115
+ className += ' ' + IconButtonDisabled;
1116
+ }
1117
+ return [{
1118
+ type: Button,
1119
+ className,
1120
+ title: label,
1121
+ ariaLabel: label,
1122
+ childCount: 1,
1123
+ disabled: disabled ? true : undefined,
1124
+ onClick: onClick,
1125
+ name: name
1126
+ }, getIconVirtualDom(icon)];
1127
+ };
1128
+
1129
+ const getSearchFieldButtonVirtualDom = button => {
1130
+ const {
1131
+ icon,
1132
+ checked,
1133
+ title
1134
+ } = button;
1135
+ return [{
1136
+ type: Div,
1137
+ className: mergeClassNames(SearchFieldButton, checked ? SearchFieldButtonChecked : ''),
1138
+ title,
1139
+ role: CheckBox,
1140
+ ariaChecked: checked,
1141
+ tabIndex: 0,
1142
+ childCount: 1
1143
+ }, {
1144
+ type: Div,
1145
+ className: mergeClassNames(MaskIcon, icon),
1146
+ childCount: 0
1147
+ }];
1148
+ };
1149
+
1150
+ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus = '') => {
1151
+ const dom = [{
1152
+ type: Div,
1153
+ className: SearchField,
1154
+ role: None,
1155
+ childCount: 2
1156
+ }, {
1157
+ type: TextArea,
1158
+ className: MultilineInputBox,
1159
+ spellcheck: false,
1160
+ autocapitalize: 'off',
1161
+ autocorrect: 'off',
1162
+ placeholder,
1163
+ name,
1164
+ onInput,
1165
+ onFocus,
1166
+ childCount: 0
1167
+ }, {
1168
+ type: Div,
1169
+ className: SearchFieldButtons,
1170
+ childCount: insideButtons.length
1171
+ }, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom)];
1172
+ if (outsideButtons.length > 0) {
1173
+ throw new Error('outsideButtons are deprecated');
1174
+ }
1175
+ return dom;
1176
+ };
1177
+
1178
+ const getFindWidgetFindVirtualDom = (matchCountText, buttons, matchCount, value) => {
1179
+ const dom = [];
1180
+ dom.push({
1181
+ type: Div,
1182
+ className: FindWidgetFind,
1183
+ childCount: 5
1184
+ });
1185
+ dom.push(...getSearchFieldVirtualDom('search-value', find(), HandleInput, [], [], HandleFocus));
1186
+ const findClassName = getFindMatchCountClassName(matchCount, value);
1187
+ dom.push({
1188
+ type: Div,
1189
+ className: findClassName,
1190
+ childCount: 1
1191
+ }, text(matchCountText), ...buttons.flatMap(getIconButtonVirtualDom));
1192
+ return dom;
1193
+ };
1194
+
1195
+ const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons) => {
1196
+ const dom = [];
1197
+ if (replaceExpanded) {
1198
+ dom.push({
1199
+ type: Div,
1200
+ className: FindWidgetReplace,
1201
+ childCount: 1 + replaceButtons.length
1202
+ }, ...getSearchFieldVirtualDom('replace-value', replace(), HandleReplaceInput, [], [], HandleReplaceFocus), ...replaceButtons.flatMap(getIconButtonVirtualDom));
1203
+ }
1204
+ return dom;
1205
+ };
1206
+
1207
+ const ToggleReplace = 'ToggleReplace';
1208
+
1209
+ const getSearchToggleButtonVirtualDom = (replaceExpanded, onClick = '') => {
1210
+ return [{
1211
+ type: Button,
1212
+ className: `IconButton SearchToggleButton ${replaceExpanded ? 'SearchToggleButtonExpanded' : ''}`,
1213
+ title: 'Toggle Replace',
1214
+ ariaLabel: 'Toggle Replace',
1215
+ ariaExpanded: replaceExpanded,
1216
+ name: ToggleReplace,
1217
+ childCount: 1,
1218
+ 'data-command': 'toggleReplace',
1219
+ onClick,
1220
+ onFocus: 'handleToggleReplaceFocus'
1221
+ }, {
1222
+ type: Div,
1223
+ className: `MaskIcon ${replaceExpanded ? 'MaskIconChevronDown' : 'MaskIconChevronRight'}`,
1224
+ childCount: 0
1225
+ }];
1226
+ };
1227
+
1228
+ const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, findButtons, replaceButtons, matchCase, matchWholeWord, useRegularExpression, matchCount, value) => {
1229
+ const dom = [];
1230
+ dom.push({
1231
+ type: Div,
1232
+ className: 'Viewlet ViewletFind ViewletFindWidget FindWidget',
1233
+ childCount: 2,
1234
+ role: Group
1235
+ });
1236
+ dom.push(...getSearchToggleButtonVirtualDom(replaceExpanded, 'handleClickToggleReplace'));
1237
+ dom.push({
1238
+ type: Div,
1239
+ className: FindWidgetRight,
1240
+ childCount: replaceExpanded ? 2 : 1
1241
+ });
1242
+ dom.push(...getFindWidgetFindVirtualDom(matchCountText, findButtons, matchCount, value));
1243
+ if (replaceExpanded) {
1244
+ dom.push(...getFindWidgetReplaceVirtualDom(replaceExpanded, replaceButtons));
1245
+ }
1246
+ return dom;
1247
+ };
1248
+
1249
+ const getMatchCountText = (matchIndex, matchCount) => {
1250
+ if (matchCount === 0) {
1251
+ return noResults();
1252
+ }
1253
+ return matchOf(matchIndex + 1, matchCount);
1254
+ };
1255
+
1256
+ const SetDom2 = 'Viewlet.setDom2';
1257
+
1258
+ const renderContent = (oldState, newState) => {
1259
+ const {
1260
+ uid
1261
+ } = newState;
1262
+ const matchCountText = getMatchCountText(newState.matchIndex, newState.matchCount);
1263
+ const {
1264
+ findButtonsEnabled,
1265
+ replaceButtonsEnabled
1266
+ } = getFindWidgetButtonsEnabled(newState.matchCount, newState.value);
1267
+ const {
1268
+ findButtons,
1269
+ replaceButtons
1270
+ } = getFindWidgetButtons(findButtonsEnabled, replaceButtonsEnabled);
1271
+ const dom = getFindWidgetVirtualDom(matchCountText, newState.replaceExpanded, findButtons, replaceButtons, newState.matchCase, newState.matchWholeWord, newState.useRegularExpression, newState.matchCount, newState.value);
1272
+ return [SetDom2, uid, dom];
1273
+ };
1274
+
1275
+ const getRenderer = diffType => {
1276
+ switch (diffType) {
1277
+ case RenderContent:
1278
+ return renderContent;
1279
+ default:
1280
+ throw new Error('unknown renderer');
1281
+ }
1282
+ };
1283
+
1284
+ const applyRender = (oldState, newState, diffResult) => {
1285
+ const commands = [];
1286
+ for (const item of diffResult) {
1287
+ const fn = getRenderer(item);
1288
+ commands.push(fn(oldState, newState));
1289
+ }
1290
+ return commands;
1291
+ };
1292
+
1293
+ const render2 = (uid, diffResult) => {
1294
+ const {
1295
+ oldState,
1296
+ newState
1297
+ } = get(uid);
1298
+ set(uid, newState, newState);
1299
+ const commands = applyRender(oldState, newState, diffResult);
1300
+ return commands;
1301
+ };
1302
+
1303
+ const terminate = () => {
1304
+ globalThis.close();
1305
+ };
1306
+
1307
+ const commandMap = {
1308
+ 'ColorPicker.create': create,
1309
+ 'ColorPicker.diff2': diff2,
1310
+ 'ColorPicker.getCommandIds': getCommandIds,
1311
+ 'ColorPicker.loadContent': wrapCommand(loadContent),
1312
+ 'ColorPicker.render2': render2,
1313
+ 'ColorPicker.terminate': terminate
1314
+ };
1315
+
1316
+ const RendererWorker = 1;
1317
+
1318
+ const rpcs = Object.create(null);
1319
+ const set$6 = (id, rpc) => {
1320
+ rpcs[id] = rpc;
1321
+ };
1322
+
1323
+ const listen = async () => {
1324
+ const rpc = await WebWorkerRpcClient.create({
1325
+ commandMap: commandMap
1326
+ });
1327
+ set$6(RendererWorker, rpc);
1328
+ };
1329
+
1330
+ const main = async () => {
1331
+ await listen();
1332
+ };
1333
+
1334
+ main();
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@lvce-editor/find-widget-worker",
3
+ "version": "1.0.0",
4
+ "description": "Web Worker for the find widget in Lvce Editor",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git@github.com:lvce-editor/find-widget-worker.git"
8
+ },
9
+ "license": "MIT",
10
+ "author": "Lvce Editor",
11
+ "type": "module",
12
+ "main": "dist/findWidgetWorkerMain.js"
13
+ }