@lvce-editor/renderer-process 30.63.2 → 30.64.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rendererProcessMain.js +76 -7
- package/package.json +1 -1
|
@@ -804,7 +804,7 @@ const applyDirectProperties = (restoredError, error) => {
|
|
|
804
804
|
}
|
|
805
805
|
};
|
|
806
806
|
const restoreMessageError = (error, _currentStack) => {
|
|
807
|
-
const restoredError = constructError(error.message, error.type, error.name);
|
|
807
|
+
const restoredError = constructError(error.message, error.type || error.data?.type, error.name);
|
|
808
808
|
if (typeof error.code === 'string' || typeof error.code === 'number') {
|
|
809
809
|
Object.defineProperty(restoredError, 'code', {
|
|
810
810
|
configurable: true,
|
|
@@ -819,6 +819,23 @@ const restoreMessageError = (error, _currentStack) => {
|
|
|
819
819
|
}
|
|
820
820
|
return restoredError;
|
|
821
821
|
};
|
|
822
|
+
const getFallbackMessage = error => {
|
|
823
|
+
if (error && typeof error.message === 'string' && error.message) {
|
|
824
|
+
return error.message;
|
|
825
|
+
}
|
|
826
|
+
if (error && error.data) {
|
|
827
|
+
return getFallbackMessage(error.data);
|
|
828
|
+
}
|
|
829
|
+
const stringified = String(error);
|
|
830
|
+
if (stringified !== '[object Object]') {
|
|
831
|
+
return stringified;
|
|
832
|
+
}
|
|
833
|
+
try {
|
|
834
|
+
return JSON.stringify(error);
|
|
835
|
+
} catch {
|
|
836
|
+
return stringified;
|
|
837
|
+
}
|
|
838
|
+
};
|
|
822
839
|
const restoreJsonRpcError = error => {
|
|
823
840
|
const currentStack = getCurrentStack();
|
|
824
841
|
if (error && error instanceof Error) {
|
|
@@ -827,13 +844,13 @@ const restoreJsonRpcError = error => {
|
|
|
827
844
|
if (error && error.code && error.code === MethodNotFound) {
|
|
828
845
|
return restoreMethodNotFoundError(error, currentStack);
|
|
829
846
|
}
|
|
847
|
+
if (error && error.error) {
|
|
848
|
+
return restoreJsonRpcError(error.error);
|
|
849
|
+
}
|
|
830
850
|
if (error && error.message) {
|
|
831
851
|
return restoreMessageError(error);
|
|
832
852
|
}
|
|
833
|
-
|
|
834
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
835
|
-
}
|
|
836
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
853
|
+
return new Error(`JsonRpc Error: ${getFallbackMessage(error)}`);
|
|
837
854
|
};
|
|
838
855
|
const unwrapJsonRpcResult = responseMessage => {
|
|
839
856
|
if ('error' in responseMessage) {
|
|
@@ -892,7 +909,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
892
909
|
data: {
|
|
893
910
|
code: prettyError.code ?? error?.code,
|
|
894
911
|
codeFrame: prettyError.codeFrame,
|
|
895
|
-
name: prettyError.name,
|
|
912
|
+
name: prettyError.name ?? error?.name,
|
|
896
913
|
stack: getStack(prettyError),
|
|
897
914
|
type: getErrorType(prettyError)
|
|
898
915
|
},
|
|
@@ -1114,6 +1131,9 @@ const logError$1 = () => {
|
|
|
1114
1131
|
// handled by renderer worker
|
|
1115
1132
|
};
|
|
1116
1133
|
const handleMessage = event => {
|
|
1134
|
+
if (event.data === 'ready') {
|
|
1135
|
+
return Promise.resolve();
|
|
1136
|
+
}
|
|
1117
1137
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
1118
1138
|
const actualExecute = event?.target?.execute || execute;
|
|
1119
1139
|
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError$1, actualRequiresSocket);
|
|
@@ -7089,10 +7109,26 @@ const isTerminalTextInput = event => {
|
|
|
7089
7109
|
}
|
|
7090
7110
|
return target instanceof Element && Boolean(target.closest('.XtermTerminal'));
|
|
7091
7111
|
};
|
|
7112
|
+
const isEditableTarget = target => {
|
|
7113
|
+
if (!(target instanceof Element)) {
|
|
7114
|
+
return false;
|
|
7115
|
+
}
|
|
7116
|
+
return Boolean(target.closest('input, textarea, [contenteditable]:not([contenteditable="false"])'));
|
|
7117
|
+
};
|
|
7092
7118
|
const handleKeyDown$2 = event => {
|
|
7093
7119
|
if (isNativeButtonActivation(event) || isTerminalTextInput(event)) {
|
|
7094
7120
|
return;
|
|
7095
7121
|
}
|
|
7122
|
+
const {
|
|
7123
|
+
altKey,
|
|
7124
|
+
ctrlKey,
|
|
7125
|
+
key,
|
|
7126
|
+
metaKey,
|
|
7127
|
+
shiftKey
|
|
7128
|
+
} = event;
|
|
7129
|
+
if (key === '.' && !altKey && !ctrlKey && !metaKey && !shiftKey && isEditableTarget(event.target)) {
|
|
7130
|
+
return;
|
|
7131
|
+
}
|
|
7096
7132
|
const identifier = getKeyBindingIdentifier(event);
|
|
7097
7133
|
const identifiers = getIdentifiers();
|
|
7098
7134
|
const matchingKeyBinding = isMatchingKeyBinding(identifiers, identifier);
|
|
@@ -12254,7 +12290,7 @@ const flushPendingData = state => {
|
|
|
12254
12290
|
terminal
|
|
12255
12291
|
} = state;
|
|
12256
12292
|
for (const data of pendingData) {
|
|
12257
|
-
terminal.write(data);
|
|
12293
|
+
if (data?.restore) restore(state, data.restore);else terminal.write(data);
|
|
12258
12294
|
}
|
|
12259
12295
|
pendingData.length = 0;
|
|
12260
12296
|
};
|
|
@@ -12286,6 +12322,7 @@ const mountTerminal = async (state, uid) => {
|
|
|
12286
12322
|
cols,
|
|
12287
12323
|
rows
|
|
12288
12324
|
}) => {
|
|
12325
|
+
if (state.restoring) return;
|
|
12289
12326
|
resize(uid, {
|
|
12290
12327
|
columns: cols,
|
|
12291
12328
|
rows
|
|
@@ -12293,6 +12330,7 @@ const mountTerminal = async (state, uid) => {
|
|
|
12293
12330
|
});
|
|
12294
12331
|
terminal.open(state.$Viewlet);
|
|
12295
12332
|
const resizeObserver = new ResizeObserver(() => {
|
|
12333
|
+
if (state.restoring) return;
|
|
12296
12334
|
fitAddon.fit();
|
|
12297
12335
|
focusIfConnected(state);
|
|
12298
12336
|
});
|
|
@@ -12318,6 +12356,7 @@ const create = () => {
|
|
|
12318
12356
|
pendingData: [],
|
|
12319
12357
|
pendingFocus: false,
|
|
12320
12358
|
resizeObserver: undefined,
|
|
12359
|
+
restoring: false,
|
|
12321
12360
|
terminal: undefined
|
|
12322
12361
|
};
|
|
12323
12362
|
};
|
|
@@ -12342,6 +12381,35 @@ const write = (state, data) => {
|
|
|
12342
12381
|
}
|
|
12343
12382
|
terminal.write(data);
|
|
12344
12383
|
};
|
|
12384
|
+
const restore = (state, snapshot) => {
|
|
12385
|
+
if (state.disposed) return;
|
|
12386
|
+
const {
|
|
12387
|
+
columns,
|
|
12388
|
+
data,
|
|
12389
|
+
rows
|
|
12390
|
+
} = snapshot;
|
|
12391
|
+
if (!Number.isSafeInteger(columns) || !Number.isSafeInteger(rows) || columns < 2 || columns > 500 || rows < 1 || rows > 200 || typeof data !== 'string') {
|
|
12392
|
+
throw new Error('Invalid terminal snapshot');
|
|
12393
|
+
}
|
|
12394
|
+
const {
|
|
12395
|
+
terminal
|
|
12396
|
+
} = state;
|
|
12397
|
+
if (!terminal) {
|
|
12398
|
+
state.pendingData.push({
|
|
12399
|
+
restore: snapshot
|
|
12400
|
+
});
|
|
12401
|
+
return;
|
|
12402
|
+
}
|
|
12403
|
+
state.restoring = true;
|
|
12404
|
+
terminal.reset();
|
|
12405
|
+
terminal.resize(columns, rows);
|
|
12406
|
+
terminal.write(data, () => {
|
|
12407
|
+
if (state.disposed) return;
|
|
12408
|
+
state.restoring = false;
|
|
12409
|
+
state.fitAddon.fit();
|
|
12410
|
+
focusIfConnected(state);
|
|
12411
|
+
});
|
|
12412
|
+
};
|
|
12345
12413
|
const focus = state => {
|
|
12346
12414
|
object(state);
|
|
12347
12415
|
const {
|
|
@@ -12391,6 +12459,7 @@ const ViewletTerminal2 = {
|
|
|
12391
12459
|
dispose,
|
|
12392
12460
|
focus,
|
|
12393
12461
|
handleMouseDown,
|
|
12462
|
+
restore,
|
|
12394
12463
|
setTerminal,
|
|
12395
12464
|
write
|
|
12396
12465
|
};
|