@lvce-editor/about-view 7.38.0 → 7.40.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.
@@ -632,9 +632,12 @@ const applyDataProperties = (restoredError, error) => {
632
632
  writable: true
633
633
  });
634
634
  }
635
- if (error.data.type) {
636
- // @ts-ignore
637
- restoredError.name = error.data.type;
635
+ const name = error.data.name || error.data.type;
636
+ if (name) {
637
+ Object.defineProperty(restoredError, 'name', {
638
+ configurable: true,
639
+ value: name
640
+ });
638
641
  }
639
642
  };
640
643
  const applyDirectProperties = (restoredError, error) => {
@@ -651,7 +654,7 @@ const applyDirectProperties = (restoredError, error) => {
651
654
  }
652
655
  };
653
656
  const restoreMessageError = (error, _currentStack) => {
654
- const restoredError = constructError(error.message, error.type || error.data?.type, error.name);
657
+ const restoredError = constructError(error.message, error.type || error.data?.type, error.name || error.data?.name);
655
658
  if (typeof error.code === 'string' || typeof error.code === 'number') {
656
659
  Object.defineProperty(restoredError, 'code', {
657
660
  configurable: true,
@@ -861,6 +864,12 @@ const handleJsonRpcMessage = async (...args) => {
861
864
  requiresSocket,
862
865
  resolve
863
866
  } = options;
867
+ if (message === 'ready') {
868
+ return;
869
+ }
870
+ if (!message || typeof message !== 'object') {
871
+ throw new JsonRpcError('unexpected message');
872
+ }
864
873
  if ('id' in message) {
865
874
  if ('method' in message) {
866
875
  const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
@@ -1203,6 +1212,12 @@ const {
1203
1212
  invokeAndTransfer,
1204
1213
  set: set$2
1205
1214
  } = create$2(RendererWorker);
1215
+ const initializeRendererWorkerForWorker = async commandMap => {
1216
+ const rpc = await create$3({
1217
+ commandMap
1218
+ });
1219
+ set$2(rpc);
1220
+ };
1206
1221
  const getElectronVersion$1 = async () => {
1207
1222
  return invoke$1('Process.getElectronVersion');
1208
1223
  };
@@ -1238,6 +1253,23 @@ const openWidget = async name => {
1238
1253
  const getWindowId$1 = async () => {
1239
1254
  return invoke$1('GetWindowId.getWindowId');
1240
1255
  };
1256
+ const sendFs = async port => {
1257
+ await sendMessagePortToFileSystemWorker(port, 0);
1258
+ };
1259
+ const initializeFileSystemWorker = async () => {
1260
+ const rpc = await create$4({
1261
+ commandMap: {},
1262
+ send: sendFs
1263
+ });
1264
+ set$4(rpc);
1265
+ };
1266
+ const initializeDialogWorker = async () => {
1267
+ const rpc = await create$4({
1268
+ commandMap: {},
1269
+ send: sendMessagePortToDialogWorker
1270
+ });
1271
+ set$5(rpc);
1272
+ };
1241
1273
 
1242
1274
  const toCommandId = key => {
1243
1275
  const dotIndex = key.indexOf('.');
@@ -1245,6 +1277,7 @@ const toCommandId = key => {
1245
1277
  };
1246
1278
  const create$1 = () => {
1247
1279
  const commandQueues = new Map();
1280
+ const instanceIds = Object.create(null);
1248
1281
  const generations = Object.create(null);
1249
1282
  const states = Object.create(null);
1250
1283
  const commandMapRef = Object.create(null);
@@ -1359,6 +1392,9 @@ const create$1 = () => {
1359
1392
  },
1360
1393
  set(uid, oldState, newState, scheduledState) {
1361
1394
  const current = states[uid];
1395
+ if (!current) {
1396
+ instanceIds[uid] = (instanceIds[uid] || 0) + 1;
1397
+ }
1362
1398
  if (!current || oldState === newState && newState !== current.newState) {
1363
1399
  generations[uid] = getGeneration(uid) + 1;
1364
1400
  }
@@ -1452,8 +1488,9 @@ const create$1 = () => {
1452
1488
  },
1453
1489
  wrapSerialAsyncCommand(fn) {
1454
1490
  const wrapped = async (uid, ...args) => {
1491
+ const instanceId = instanceIds[uid];
1455
1492
  await enqueueCommand(uid, async () => {
1456
- if (!states[uid]) {
1493
+ if (!states[uid] || instanceIds[uid] !== instanceId) {
1457
1494
  return;
1458
1495
  }
1459
1496
  const generation = getGeneration(uid);
@@ -1465,8 +1502,9 @@ const create$1 = () => {
1465
1502
  },
1466
1503
  wrapSerialCommand(fn) {
1467
1504
  const wrapped = async (uid, ...args) => {
1505
+ const instanceId = instanceIds[uid];
1468
1506
  await enqueueCommand(uid, async () => {
1469
- if (!states[uid]) {
1507
+ if (!states[uid] || instanceIds[uid] !== instanceId) {
1470
1508
  return;
1471
1509
  }
1472
1510
  const generation = getGeneration(uid);
@@ -2079,13 +2117,20 @@ const loadConfig = async () => {
2079
2117
  };
2080
2118
  };
2081
2119
 
2082
- const loadContent2 = async context => {
2120
+ const getContent = async () => {
2083
2121
  const config = await loadConfig();
2122
+ return {
2123
+ lines: getDetailStringWeb(config),
2124
+ productName: config.productName
2125
+ };
2126
+ };
2127
+ const loadContent2 = async (context, content) => {
2128
+ const resolvedContent = content || (await getContent());
2084
2129
  await context.updateState(state => ({
2085
2130
  ...state,
2086
2131
  focusId: Ok$2,
2087
- lines: getDetailStringWeb(config),
2088
- productName: config.productName
2132
+ lines: resolvedContent.lines,
2133
+ productName: resolvedContent.productName
2089
2134
  }));
2090
2135
  };
2091
2136
 
@@ -2465,33 +2510,11 @@ const commandMap = {
2465
2510
  'About.showAboutElectron': showAboutElectron
2466
2511
  };
2467
2512
 
2468
- const send = async port => {
2469
- await sendMessagePortToFileSystemWorker(port, 0);
2470
- };
2471
- const initializeFileSystemWorker = async () => {
2472
- const rpc = await create$4({
2473
- commandMap: {},
2474
- send
2475
- });
2476
- set$4(rpc);
2477
- };
2478
-
2479
- const initializeRendererWorker = async () => {
2480
- const rpc = await create$3({
2481
- commandMap: commandMap
2482
- });
2483
- set$2(rpc);
2484
- };
2485
-
2486
2513
  const listen = async () => {
2487
2514
  registerCommands(commandMap);
2488
- await initializeRendererWorker();
2515
+ await initializeRendererWorkerForWorker(commandMap);
2489
2516
  await initializeFileSystemWorker();
2490
- const dialogRpc = await create$4({
2491
- commandMap: {},
2492
- send: sendMessagePortToDialogWorker
2493
- });
2494
- set$5(dialogRpc);
2517
+ await initializeDialogWorker();
2495
2518
  };
2496
2519
 
2497
2520
  const main = async () => {