@lvce-editor/test-worker 16.1.0 → 16.3.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/dist/api.d.ts +10 -0
- package/dist/testWorkerMain.js +162 -87
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -268,6 +268,7 @@ export type SelectItemWaitUntil = "done" | "quickPick" | "none";
|
|
|
268
268
|
export type SearchInputType = "SearchValue" | "ReplaceValue" | "IncludeValue" | "ExcludeValue";
|
|
269
269
|
|
|
270
270
|
interface Workspace {
|
|
271
|
+
readonly close: () => Promise<void>;
|
|
271
272
|
readonly openTmpDir: () => Promise<string>;
|
|
272
273
|
readonly setPath: (path: string) => Promise<void>;
|
|
273
274
|
}
|
|
@@ -505,9 +506,13 @@ interface Editor {
|
|
|
505
506
|
readonly goToDefinition: () => Promise<void>;
|
|
506
507
|
readonly goToTypeDefinition: () => Promise<void>;
|
|
507
508
|
readonly growSelection: () => Promise<void>;
|
|
509
|
+
readonly handleTab: () => Promise<void>;
|
|
510
|
+
readonly indentLess: () => Promise<void>;
|
|
511
|
+
readonly indentMore: () => Promise<void>;
|
|
508
512
|
readonly insertLineBreak: () => Promise<void>;
|
|
509
513
|
readonly invokeBraceCompletion: (text: string) => Promise<void>;
|
|
510
514
|
readonly invokeTabCompletion: () => Promise<void>;
|
|
515
|
+
readonly moveLineDown: () => Promise<void>;
|
|
511
516
|
readonly openColorPicker: () => Promise<void>;
|
|
512
517
|
readonly openCompletion: () => Promise<void>;
|
|
513
518
|
readonly openCompletionDetails: () => Promise<void>;
|
|
@@ -519,6 +524,7 @@ interface Editor {
|
|
|
519
524
|
readonly openRename: () => Promise<void>;
|
|
520
525
|
readonly openSourceActions: () => Promise<void>;
|
|
521
526
|
readonly organizeImports: () => Promise<void>;
|
|
527
|
+
readonly pasteText: (text: string) => Promise<void>;
|
|
522
528
|
readonly redo: () => Promise<void>;
|
|
523
529
|
readonly rename: () => Promise<void>;
|
|
524
530
|
readonly rename2: (newName: string) => Promise<void>;
|
|
@@ -533,6 +539,8 @@ interface Editor {
|
|
|
533
539
|
readonly selectNextOccurrence: () => Promise<void>;
|
|
534
540
|
readonly selectPreviousOccurrence: () => Promise<void>;
|
|
535
541
|
readonly selectUp: () => Promise<void>;
|
|
542
|
+
readonly selectWordLeft: () => Promise<void>;
|
|
543
|
+
readonly selectWordRight: () => Promise<void>;
|
|
536
544
|
readonly selectionGrow: () => Promise<void>;
|
|
537
545
|
readonly setCursor: (rowIndex: number, columnIndex: number) => Promise<void>;
|
|
538
546
|
readonly setDeltaY: (deltaY: number) => Promise<void>;
|
|
@@ -545,11 +553,13 @@ interface Editor {
|
|
|
545
553
|
readonly shouldHaveTokens: (expectedTokens: readonly TokenRow[]) => Promise<void>;
|
|
546
554
|
readonly showHover: () => Promise<void>;
|
|
547
555
|
readonly sortImports: () => Promise<void>;
|
|
556
|
+
readonly sortLinesAscending: () => Promise<void>;
|
|
548
557
|
readonly sourceActionsSelectCurrent: () => Promise<void>;
|
|
549
558
|
readonly toggleBlockComment: () => Promise<void>;
|
|
550
559
|
readonly toggleCompletionDetails: () => Promise<void>;
|
|
551
560
|
readonly toggleLineComment: () => Promise<void>;
|
|
552
561
|
readonly type: (text: string) => Promise<void>;
|
|
562
|
+
readonly typeWithAutoClosing: (text: string) => Promise<void>;
|
|
553
563
|
readonly unIndent: () => Promise<void>;
|
|
554
564
|
readonly undo: () => Promise<void>;
|
|
555
565
|
}
|
package/dist/testWorkerMain.js
CHANGED
|
@@ -1265,15 +1265,17 @@ const initializeOpenerWorker = async () => {
|
|
|
1265
1265
|
set$3(rpc);
|
|
1266
1266
|
};
|
|
1267
1267
|
|
|
1268
|
-
|
|
1268
|
+
const state$3 = {
|
|
1269
|
+
autoFixError: undefined
|
|
1270
|
+
};
|
|
1269
1271
|
const get$1 = () => {
|
|
1270
|
-
return autoFixError;
|
|
1272
|
+
return state$3.autoFixError;
|
|
1271
1273
|
};
|
|
1272
1274
|
const set$1 = value => {
|
|
1273
|
-
autoFixError = value;
|
|
1275
|
+
state$3.autoFixError = value;
|
|
1274
1276
|
};
|
|
1275
1277
|
const clear$3 = () => {
|
|
1276
|
-
autoFixError = undefined;
|
|
1278
|
+
state$3.autoFixError = undefined;
|
|
1277
1279
|
};
|
|
1278
1280
|
|
|
1279
1281
|
class AssertionError extends Error {
|
|
@@ -1316,7 +1318,7 @@ const printLocator = locator => {
|
|
|
1316
1318
|
result = part.selector;
|
|
1317
1319
|
continue;
|
|
1318
1320
|
}
|
|
1319
|
-
result
|
|
1321
|
+
result += ` >> ${part.selector}`;
|
|
1320
1322
|
continue;
|
|
1321
1323
|
}
|
|
1322
1324
|
if (part.type === 'text') {
|
|
@@ -1324,14 +1326,14 @@ const printLocator = locator => {
|
|
|
1324
1326
|
result = `text=${part.text}`;
|
|
1325
1327
|
continue;
|
|
1326
1328
|
}
|
|
1327
|
-
result
|
|
1329
|
+
result += ` text=${part.text}`;
|
|
1328
1330
|
continue;
|
|
1329
1331
|
}
|
|
1330
1332
|
if (part.type === 'has-text') {
|
|
1331
|
-
result
|
|
1333
|
+
result += ` "${part.text}"`;
|
|
1332
1334
|
continue;
|
|
1333
1335
|
}
|
|
1334
|
-
result
|
|
1336
|
+
result += `:nth(${part.index})`;
|
|
1335
1337
|
}
|
|
1336
1338
|
return result;
|
|
1337
1339
|
};
|
|
@@ -1618,7 +1620,7 @@ const nameAnonymousFunction = (fn, name) => {
|
|
|
1618
1620
|
|
|
1619
1621
|
// @ts-nocheck
|
|
1620
1622
|
|
|
1621
|
-
const state = {
|
|
1623
|
+
const state$2 = {
|
|
1622
1624
|
mockRpcs: Object.create(null),
|
|
1623
1625
|
/**
|
|
1624
1626
|
* @type {any[]}
|
|
@@ -1626,7 +1628,7 @@ const state = {
|
|
|
1626
1628
|
pendingTests: []
|
|
1627
1629
|
};
|
|
1628
1630
|
const addTest = (name, fn) => {
|
|
1629
|
-
state.pendingTests.push({
|
|
1631
|
+
state$2.pendingTests.push({
|
|
1630
1632
|
fn,
|
|
1631
1633
|
name
|
|
1632
1634
|
});
|
|
@@ -1634,7 +1636,7 @@ const addTest = (name, fn) => {
|
|
|
1634
1636
|
const setMockRpc = mockRpc => {
|
|
1635
1637
|
object(mockRpc);
|
|
1636
1638
|
string$1(mockRpc.name);
|
|
1637
|
-
state.mockRpcs[mockRpc.name] = mockRpc;
|
|
1639
|
+
state$2.mockRpcs[mockRpc.name] = mockRpc;
|
|
1638
1640
|
};
|
|
1639
1641
|
|
|
1640
1642
|
class CssParsingError extends Error {
|
|
@@ -1922,6 +1924,7 @@ const execute$1 = async (id, ...args) => {
|
|
|
1922
1924
|
return invoke(id, ...args);
|
|
1923
1925
|
};
|
|
1924
1926
|
const executeExtensionCommand = async (commandId, ...args) => {
|
|
1927
|
+
// TODO maybe ask extension-management-worker instead
|
|
1925
1928
|
return invoke('ExtensionHost.executeCommand', commandId, ...args);
|
|
1926
1929
|
};
|
|
1927
1930
|
|
|
@@ -2235,11 +2238,11 @@ const assertObjectMatches = (actual, expected, path) => {
|
|
|
2235
2238
|
if (!isObject$3(actual)) {
|
|
2236
2239
|
throw new TypeError(`Expected ${path} to be an object but got ${formatValue(actual)}`);
|
|
2237
2240
|
}
|
|
2238
|
-
for (const key of Object.
|
|
2241
|
+
for (const [key, expectedValue] of Object.entries(expected)) {
|
|
2239
2242
|
if (!Object.hasOwn(actual, key)) {
|
|
2240
2243
|
throw new Error(`Expected ${path}.${key} to exist`);
|
|
2241
2244
|
}
|
|
2242
|
-
assertPayloadMatches(actual[key],
|
|
2245
|
+
assertPayloadMatches(actual[key], expectedValue, `${path}.${key}`);
|
|
2243
2246
|
}
|
|
2244
2247
|
};
|
|
2245
2248
|
const assertPrimitiveMatches = (actual, expected, path) => {
|
|
@@ -2608,6 +2611,9 @@ const directionMap = {
|
|
|
2608
2611
|
horizontal: 1,
|
|
2609
2612
|
vertical: 2
|
|
2610
2613
|
};
|
|
2614
|
+
const isLayoutDirectionName = value => {
|
|
2615
|
+
return value === 'horizontal' || value === 'vertical';
|
|
2616
|
+
};
|
|
2611
2617
|
const isObject$2 = value => {
|
|
2612
2618
|
return typeof value === 'object' && value !== null && !Array.isArray(value) && !(value instanceof RegExp);
|
|
2613
2619
|
};
|
|
@@ -2637,8 +2643,11 @@ const matchesExpectedObject = (actual, expected) => {
|
|
|
2637
2643
|
return true;
|
|
2638
2644
|
};
|
|
2639
2645
|
const matchesExpected = (actual, expected, key = '') => {
|
|
2640
|
-
if (key === 'direction' && typeof expected === 'string' && expected
|
|
2641
|
-
|
|
2646
|
+
if (key === 'direction' && typeof expected === 'string' && isLayoutDirectionName(expected)) {
|
|
2647
|
+
if (expected === 'horizontal') {
|
|
2648
|
+
return Object.is(actual, directionMap.horizontal);
|
|
2649
|
+
}
|
|
2650
|
+
return Object.is(actual, directionMap.vertical);
|
|
2642
2651
|
}
|
|
2643
2652
|
if (expected instanceof RegExp) {
|
|
2644
2653
|
return typeof actual === 'string' && expected.test(actual);
|
|
@@ -2830,13 +2839,32 @@ const areSelectionsEqual = (a, b) => {
|
|
|
2830
2839
|
return true;
|
|
2831
2840
|
};
|
|
2832
2841
|
|
|
2842
|
+
const areTokensEqual = (actual, expected) => {
|
|
2843
|
+
if (actual.length !== expected.length) {
|
|
2844
|
+
return false;
|
|
2845
|
+
}
|
|
2846
|
+
for (let i = 0; i < actual.length; i++) {
|
|
2847
|
+
const actualRow = actual[i];
|
|
2848
|
+
const expectedRow = expected[i];
|
|
2849
|
+
if (actualRow.length !== expectedRow.length) {
|
|
2850
|
+
return false;
|
|
2851
|
+
}
|
|
2852
|
+
for (let j = 0; j < actualRow.length; j++) {
|
|
2853
|
+
if (actualRow[j] !== expectedRow[j]) {
|
|
2854
|
+
return false;
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
return true;
|
|
2859
|
+
};
|
|
2860
|
+
|
|
2833
2861
|
const getEditorKey = async () => {
|
|
2834
2862
|
const keys = await invoke$4('Editor.getKeys');
|
|
2835
2863
|
if (keys.length === 0) {
|
|
2836
2864
|
throw new Error(`no editor found`);
|
|
2837
2865
|
}
|
|
2838
2866
|
const key = keys.at(-1);
|
|
2839
|
-
const numeric = Number
|
|
2867
|
+
const numeric = Number(key);
|
|
2840
2868
|
return numeric;
|
|
2841
2869
|
};
|
|
2842
2870
|
|
|
@@ -2925,6 +2953,12 @@ const cursorUp = async () => {
|
|
|
2925
2953
|
const cursorWordLeft = async () => {
|
|
2926
2954
|
await invoke('Editor.cursorWordLeft');
|
|
2927
2955
|
};
|
|
2956
|
+
const selectWordLeft = async () => {
|
|
2957
|
+
await invoke('Editor.selectWordLeft');
|
|
2958
|
+
};
|
|
2959
|
+
const selectWordRight = async () => {
|
|
2960
|
+
await invoke('Editor.selectWordRight');
|
|
2961
|
+
};
|
|
2928
2962
|
const setText = async text => {
|
|
2929
2963
|
await invoke('Editor.setText', text);
|
|
2930
2964
|
};
|
|
@@ -2997,6 +3031,27 @@ const setDeltaY$1 = async deltaY => {
|
|
|
2997
3031
|
const format = async () => {
|
|
2998
3032
|
await invoke('Editor.format');
|
|
2999
3033
|
};
|
|
3034
|
+
const indentMore = async () => {
|
|
3035
|
+
await invoke('Editor.indentMore');
|
|
3036
|
+
};
|
|
3037
|
+
const indentLess = async () => {
|
|
3038
|
+
await invoke('Editor.indentLess');
|
|
3039
|
+
};
|
|
3040
|
+
const moveLineDown = async () => {
|
|
3041
|
+
await invoke('Editor.moveLineDown');
|
|
3042
|
+
};
|
|
3043
|
+
const pasteText = async text => {
|
|
3044
|
+
await invoke('Editor.pasteText', text);
|
|
3045
|
+
};
|
|
3046
|
+
const sortLinesAscending = async () => {
|
|
3047
|
+
await invoke('Editor.sortLinesAscending');
|
|
3048
|
+
};
|
|
3049
|
+
const typeWithAutoClosing = async text => {
|
|
3050
|
+
await invoke('Editor.typeWithAutoClosing', text);
|
|
3051
|
+
};
|
|
3052
|
+
const handleTab = async () => {
|
|
3053
|
+
await invoke('Editor.handleTab');
|
|
3054
|
+
};
|
|
3000
3055
|
const unIndent = async () => {
|
|
3001
3056
|
await invoke('Editor.unIndent');
|
|
3002
3057
|
};
|
|
@@ -3106,24 +3161,6 @@ const shouldHaveText = async expectedText => {
|
|
|
3106
3161
|
throw new Error(`Expected editor to have text ${expectedText} but was ${text}`);
|
|
3107
3162
|
}
|
|
3108
3163
|
};
|
|
3109
|
-
const areTokensEqual = (actual, expected) => {
|
|
3110
|
-
if (actual.length !== expected.length) {
|
|
3111
|
-
return false;
|
|
3112
|
-
}
|
|
3113
|
-
for (let i = 0; i < actual.length; i++) {
|
|
3114
|
-
const actualRow = actual[i];
|
|
3115
|
-
const expectedRow = expected[i];
|
|
3116
|
-
if (actualRow.length !== expectedRow.length) {
|
|
3117
|
-
return false;
|
|
3118
|
-
}
|
|
3119
|
-
for (let j = 0; j < actualRow.length; j++) {
|
|
3120
|
-
if (actualRow[j] !== expectedRow[j]) {
|
|
3121
|
-
return false;
|
|
3122
|
-
}
|
|
3123
|
-
}
|
|
3124
|
-
}
|
|
3125
|
-
return true;
|
|
3126
|
-
};
|
|
3127
3164
|
const shouldHaveTokens = async expectedTokens => {
|
|
3128
3165
|
const key = await getEditorKey();
|
|
3129
3166
|
const text = await invoke$4('Editor.getTokens', key);
|
|
@@ -3226,9 +3263,13 @@ const Editor = {
|
|
|
3226
3263
|
goToDefinition,
|
|
3227
3264
|
goToTypeDefinition,
|
|
3228
3265
|
growSelection,
|
|
3266
|
+
handleTab,
|
|
3267
|
+
indentLess,
|
|
3268
|
+
indentMore,
|
|
3229
3269
|
insertLineBreak,
|
|
3230
3270
|
invokeBraceCompletion,
|
|
3231
3271
|
invokeTabCompletion,
|
|
3272
|
+
moveLineDown,
|
|
3232
3273
|
openColorPicker,
|
|
3233
3274
|
openCompletion,
|
|
3234
3275
|
openCompletionDetails,
|
|
@@ -3240,6 +3281,7 @@ const Editor = {
|
|
|
3240
3281
|
openRename,
|
|
3241
3282
|
openSourceActions,
|
|
3242
3283
|
organizeImports,
|
|
3284
|
+
pasteText,
|
|
3243
3285
|
redo,
|
|
3244
3286
|
rename: rename$1,
|
|
3245
3287
|
rename2,
|
|
@@ -3254,6 +3296,8 @@ const Editor = {
|
|
|
3254
3296
|
selectNextOccurrence,
|
|
3255
3297
|
selectPreviousOccurrence,
|
|
3256
3298
|
selectUp: selectUp$1,
|
|
3299
|
+
selectWordLeft,
|
|
3300
|
+
selectWordRight,
|
|
3257
3301
|
selectionGrow,
|
|
3258
3302
|
setCursor,
|
|
3259
3303
|
setDeltaY: setDeltaY$1,
|
|
@@ -3266,11 +3310,13 @@ const Editor = {
|
|
|
3266
3310
|
shouldHaveTokens,
|
|
3267
3311
|
showHover,
|
|
3268
3312
|
sortImports,
|
|
3313
|
+
sortLinesAscending,
|
|
3269
3314
|
sourceActionsSelectCurrent,
|
|
3270
3315
|
toggleBlockComment,
|
|
3271
3316
|
toggleCompletionDetails,
|
|
3272
3317
|
toggleLineComment,
|
|
3273
3318
|
type,
|
|
3319
|
+
typeWithAutoClosing,
|
|
3274
3320
|
unIndent,
|
|
3275
3321
|
undo
|
|
3276
3322
|
};
|
|
@@ -3281,7 +3327,7 @@ const selectIndex$6 = async index => {
|
|
|
3281
3327
|
const selectCurrentIndex$2 = async () => {
|
|
3282
3328
|
await invoke('EditorCompletion.selectCurrentIndex');
|
|
3283
3329
|
};
|
|
3284
|
-
const close$
|
|
3330
|
+
const close$3 = async () => {
|
|
3285
3331
|
await invoke('EditorCompletion.close');
|
|
3286
3332
|
};
|
|
3287
3333
|
const handleWheel$2 = async (deltaMode, deltaY) => {
|
|
@@ -3292,7 +3338,7 @@ const handlePointerdown = async (clientX, clientY) => {
|
|
|
3292
3338
|
};
|
|
3293
3339
|
|
|
3294
3340
|
const EditorCompletion = {
|
|
3295
|
-
close: close$
|
|
3341
|
+
close: close$3,
|
|
3296
3342
|
handlePointerdown,
|
|
3297
3343
|
handleWheel: handleWheel$2,
|
|
3298
3344
|
selectCurrentIndex: selectCurrentIndex$2,
|
|
@@ -3302,12 +3348,12 @@ const EditorCompletion = {
|
|
|
3302
3348
|
const show$6 = async () => {
|
|
3303
3349
|
await invoke('Editor.showHover2');
|
|
3304
3350
|
};
|
|
3305
|
-
const close$
|
|
3351
|
+
const close$2 = async () => {
|
|
3306
3352
|
await invoke('EditorHover.close');
|
|
3307
3353
|
};
|
|
3308
3354
|
|
|
3309
3355
|
const EditorHover = {
|
|
3310
|
-
close: close$
|
|
3356
|
+
close: close$2,
|
|
3311
3357
|
show: show$6
|
|
3312
3358
|
};
|
|
3313
3359
|
|
|
@@ -3721,11 +3767,11 @@ const getFileMapNode = async url => {
|
|
|
3721
3767
|
const contents = await Promise.all(allFiles.map(filePath => {
|
|
3722
3768
|
return readFile$1(filePath);
|
|
3723
3769
|
}));
|
|
3724
|
-
allFiles.
|
|
3770
|
+
for (const [index, filePath] of allFiles.entries()) {
|
|
3725
3771
|
const content = contents[index];
|
|
3726
3772
|
const relativePaths = filePath.slice(fileUrl.length + 1);
|
|
3727
3773
|
fileMap[relativePaths] = content;
|
|
3728
|
-
}
|
|
3774
|
+
}
|
|
3729
3775
|
return fileMap;
|
|
3730
3776
|
};
|
|
3731
3777
|
|
|
@@ -3819,7 +3865,7 @@ const getParentUri = uri => {
|
|
|
3819
3865
|
const pathSegments = url.pathname.split('/').filter(Boolean);
|
|
3820
3866
|
pathSegments.pop();
|
|
3821
3867
|
url.pathname = pathSegments.length === 0 ? '/' : `/${pathSegments.join('/')}`;
|
|
3822
|
-
return url.
|
|
3868
|
+
return url.href;
|
|
3823
3869
|
};
|
|
3824
3870
|
const getBaseName = uri => {
|
|
3825
3871
|
const url = new URL(uri);
|
|
@@ -3947,7 +3993,7 @@ const focusNext$5 = async () => {
|
|
|
3947
3993
|
const focusPrevious$5 = async () => {
|
|
3948
3994
|
await invoke('FindWidget.focusPrevious');
|
|
3949
3995
|
};
|
|
3950
|
-
const close = async () => {
|
|
3996
|
+
const close$1 = async () => {
|
|
3951
3997
|
await invoke('FindWidget.close');
|
|
3952
3998
|
};
|
|
3953
3999
|
const setReplaceValue$1 = async value => {
|
|
@@ -3988,7 +4034,7 @@ const focusPreviousElement = async () => {
|
|
|
3988
4034
|
};
|
|
3989
4035
|
|
|
3990
4036
|
const FindWidget = {
|
|
3991
|
-
close,
|
|
4037
|
+
close: close$1,
|
|
3992
4038
|
focusElement,
|
|
3993
4039
|
focusNext: focusNext$5,
|
|
3994
4040
|
focusNextElement,
|
|
@@ -4323,33 +4369,41 @@ const Control = 'Control';
|
|
|
4323
4369
|
const Space = 'Space';
|
|
4324
4370
|
const Alt = 'Alt';
|
|
4325
4371
|
|
|
4372
|
+
const applyKeyPart = (part, options) => {
|
|
4373
|
+
switch (part) {
|
|
4374
|
+
case Alt:
|
|
4375
|
+
{
|
|
4376
|
+
options.altKey = true;
|
|
4377
|
+
return;
|
|
4378
|
+
}
|
|
4379
|
+
case Control:
|
|
4380
|
+
{
|
|
4381
|
+
options.ctrlKey = true;
|
|
4382
|
+
return;
|
|
4383
|
+
}
|
|
4384
|
+
case Space:
|
|
4385
|
+
{
|
|
4386
|
+
options.key = ' ';
|
|
4387
|
+
return;
|
|
4388
|
+
}
|
|
4389
|
+
default:
|
|
4390
|
+
{
|
|
4391
|
+
options.key = part;
|
|
4392
|
+
}
|
|
4393
|
+
}
|
|
4394
|
+
};
|
|
4326
4395
|
const getKeyOptions = rawKey => {
|
|
4327
4396
|
if (rawKey.includes('+')) {
|
|
4328
4397
|
const parts = rawKey.split('+');
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4398
|
+
const options = {
|
|
4399
|
+
altKey: false,
|
|
4400
|
+
ctrlKey: false,
|
|
4401
|
+
key: ''
|
|
4402
|
+
};
|
|
4332
4403
|
for (const part of parts) {
|
|
4333
|
-
|
|
4334
|
-
case Alt:
|
|
4335
|
-
altKey = true;
|
|
4336
|
-
break;
|
|
4337
|
-
case Control:
|
|
4338
|
-
ctrlKey = true;
|
|
4339
|
-
break;
|
|
4340
|
-
case Space:
|
|
4341
|
-
key = ' ';
|
|
4342
|
-
break;
|
|
4343
|
-
default:
|
|
4344
|
-
key = part;
|
|
4345
|
-
break;
|
|
4346
|
-
}
|
|
4404
|
+
applyKeyPart(part, options);
|
|
4347
4405
|
}
|
|
4348
|
-
return
|
|
4349
|
-
altKey,
|
|
4350
|
-
ctrlKey,
|
|
4351
|
-
key
|
|
4352
|
-
};
|
|
4406
|
+
return options;
|
|
4353
4407
|
}
|
|
4354
4408
|
return {
|
|
4355
4409
|
altKey: false,
|
|
@@ -4487,11 +4541,12 @@ const getIsFirefox = () => {
|
|
|
4487
4541
|
if (typeof navigator === 'undefined') {
|
|
4488
4542
|
return false;
|
|
4489
4543
|
}
|
|
4490
|
-
if (
|
|
4491
4544
|
// @ts-expect-error
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4545
|
+
const {
|
|
4546
|
+
userAgentData
|
|
4547
|
+
} = navigator;
|
|
4548
|
+
if (userAgentData?.brands) {
|
|
4549
|
+
return userAgentData.brands.includes('Firefox');
|
|
4495
4550
|
}
|
|
4496
4551
|
return navigator.userAgent.toLowerCase().includes('firefox');
|
|
4497
4552
|
};
|
|
@@ -4647,6 +4702,13 @@ const focusIndex$2 = async index => {
|
|
|
4647
4702
|
const focusPrevious$2 = async () => {
|
|
4648
4703
|
await invoke('QuickPick.focusPrevious');
|
|
4649
4704
|
};
|
|
4705
|
+
const ignoreSelectionFailure = async promise => {
|
|
4706
|
+
try {
|
|
4707
|
+
await promise;
|
|
4708
|
+
} catch {
|
|
4709
|
+
// ignore selection failures for fire-and-forget selection flows
|
|
4710
|
+
}
|
|
4711
|
+
};
|
|
4650
4712
|
const selectItem = async (label, {
|
|
4651
4713
|
waitUntil = 'done'
|
|
4652
4714
|
} = {}) => {
|
|
@@ -4657,10 +4719,10 @@ const selectItem = async (label, {
|
|
|
4657
4719
|
const visiblePromise = waitUntil === 'quickPick' ? invoke('QuickPick.waitUntilVisible') : undefined;
|
|
4658
4720
|
const promise = Promise.resolve(invoke('QuickPick.selectItem', label));
|
|
4659
4721
|
if (waitUntil === 'none') {
|
|
4660
|
-
void promise
|
|
4722
|
+
void ignoreSelectionFailure(promise);
|
|
4661
4723
|
return;
|
|
4662
4724
|
}
|
|
4663
|
-
void promise
|
|
4725
|
+
void ignoreSelectionFailure(promise);
|
|
4664
4726
|
await visiblePromise;
|
|
4665
4727
|
};
|
|
4666
4728
|
const selectIndex$3 = async index => {
|
|
@@ -5089,12 +5151,15 @@ const TitleBarMenuBar = {
|
|
|
5089
5151
|
toggleMenu
|
|
5090
5152
|
};
|
|
5091
5153
|
|
|
5092
|
-
|
|
5154
|
+
const state$1 = {
|
|
5155
|
+
url: ''
|
|
5156
|
+
};
|
|
5093
5157
|
const setUrl = newUrl => {
|
|
5094
|
-
url = newUrl;
|
|
5158
|
+
state$1.url = newUrl;
|
|
5095
5159
|
};
|
|
5096
5160
|
const resolve = relativePath => {
|
|
5097
|
-
|
|
5161
|
+
const resolvedUrl = new URL(relativePath, state$1.url);
|
|
5162
|
+
return resolvedUrl.href;
|
|
5098
5163
|
};
|
|
5099
5164
|
|
|
5100
5165
|
const Url = {
|
|
@@ -5186,8 +5251,12 @@ const openTmpDir = async () => {
|
|
|
5186
5251
|
await setPath(tmpDir);
|
|
5187
5252
|
return tmpDir;
|
|
5188
5253
|
};
|
|
5254
|
+
const close = async () => {
|
|
5255
|
+
await invoke('Workspace.close');
|
|
5256
|
+
};
|
|
5189
5257
|
|
|
5190
5258
|
const Workspace = {
|
|
5259
|
+
close,
|
|
5191
5260
|
openTmpDir,
|
|
5192
5261
|
setPath
|
|
5193
5262
|
};
|
|
@@ -5354,14 +5423,18 @@ const printError = error => {
|
|
|
5354
5423
|
};
|
|
5355
5424
|
|
|
5356
5425
|
const prepareError = 'Errors.prepare';
|
|
5426
|
+
const ignoredCodeFrameStackLines = ['testWorkerMain.js', 'testWorkerMain.ts'];
|
|
5357
5427
|
const formatPreparedError = preparedError => {
|
|
5358
5428
|
const codeFrame = preparedError.codeframe || preparedError.codeFrame;
|
|
5359
5429
|
return [preparedError.message, codeFrame, preparedError.stack].filter(Boolean).join('\n');
|
|
5360
5430
|
};
|
|
5361
5431
|
const printTestError = async error => {
|
|
5362
5432
|
try {
|
|
5363
|
-
const preparedError = await invoke$3(prepareError, error
|
|
5364
|
-
|
|
5433
|
+
const preparedError = await invoke$3(prepareError, error, {
|
|
5434
|
+
ignoredCodeFrameStackLines
|
|
5435
|
+
});
|
|
5436
|
+
const formatted = formatPreparedError(preparedError);
|
|
5437
|
+
console.error(formatted);
|
|
5365
5438
|
} catch {
|
|
5366
5439
|
printError(error);
|
|
5367
5440
|
}
|
|
@@ -5406,7 +5479,7 @@ const importScript = async url => {
|
|
|
5406
5479
|
} catch (error) {
|
|
5407
5480
|
throw error;
|
|
5408
5481
|
// TODO
|
|
5409
|
-
// const actualErrorMessage = await TryToGetactualImportErrorMessage.tryToGetActualImportErrorMessage(
|
|
5482
|
+
// const actualErrorMessage = await TryToGetactualImportErrorMessage.tryToGetActualImportErrorMessage(URL, error)
|
|
5410
5483
|
// throw new Error(actualErrorMessage)
|
|
5411
5484
|
}
|
|
5412
5485
|
};
|
|
@@ -5419,12 +5492,14 @@ const importTest = async url => {
|
|
|
5419
5492
|
}
|
|
5420
5493
|
};
|
|
5421
5494
|
|
|
5422
|
-
|
|
5495
|
+
const state = {
|
|
5496
|
+
items: []
|
|
5497
|
+
};
|
|
5423
5498
|
const push = item => {
|
|
5424
|
-
items = [...items, item];
|
|
5499
|
+
state.items = [...state.items, item];
|
|
5425
5500
|
};
|
|
5426
5501
|
const maybeLast = () => {
|
|
5427
|
-
return items.at(-1);
|
|
5502
|
+
return state.items.at(-1);
|
|
5428
5503
|
};
|
|
5429
5504
|
|
|
5430
5505
|
const getFileUri = href => {
|
|
@@ -5459,7 +5534,7 @@ const execute = async (href, platform, assetDir) => {
|
|
|
5459
5534
|
const globals = createApi(platform, assetDir);
|
|
5460
5535
|
// TODO
|
|
5461
5536
|
// 0. wait for page to be ready
|
|
5462
|
-
// 1. get script to import from renderer process (
|
|
5537
|
+
// 1. get script to import from renderer process (URL or from HTML)
|
|
5463
5538
|
const scriptUrl = href;
|
|
5464
5539
|
setUrl(scriptUrl); // TODO avoid side effect
|
|
5465
5540
|
try {
|
|
@@ -5514,8 +5589,8 @@ const doHotReload = async (url, platform, assetDir) => {
|
|
|
5514
5589
|
|
|
5515
5590
|
const createUrlWithQueryParameter = (url, locationHref, time) => {
|
|
5516
5591
|
const parsedUrl = new URL(url, locationHref);
|
|
5517
|
-
parsedUrl.searchParams.set('time',
|
|
5518
|
-
const string = parsedUrl.
|
|
5592
|
+
parsedUrl.searchParams.set('time', String(time));
|
|
5593
|
+
const string = parsedUrl.href;
|
|
5519
5594
|
return string;
|
|
5520
5595
|
};
|
|
5521
5596
|
|
|
@@ -5626,7 +5701,7 @@ const consumeComment = (inBlockComment, inLineComment, character, nextCharacter)
|
|
|
5626
5701
|
};
|
|
5627
5702
|
|
|
5628
5703
|
const isStringDelimiter = character => {
|
|
5629
|
-
return
|
|
5704
|
+
return [`'`, '"', '`'].includes(character);
|
|
5630
5705
|
};
|
|
5631
5706
|
|
|
5632
5707
|
const consumeString = (stringDelimiter, character) => {
|
|
@@ -5753,11 +5828,11 @@ const projectActualOntoExpected = (actualValue, expectedValue) => {
|
|
|
5753
5828
|
return actualValue;
|
|
5754
5829
|
}
|
|
5755
5830
|
const result = {};
|
|
5756
|
-
for (const key of Object.
|
|
5831
|
+
for (const [key, nestedExpectedValue] of Object.entries(expectedValue)) {
|
|
5757
5832
|
if (!Object.hasOwn(actualValue, key)) {
|
|
5758
5833
|
continue;
|
|
5759
5834
|
}
|
|
5760
|
-
result[key] = projectActualOntoExpected(actualValue[key],
|
|
5835
|
+
result[key] = projectActualOntoExpected(actualValue[key], nestedExpectedValue);
|
|
5761
5836
|
}
|
|
5762
5837
|
return result;
|
|
5763
5838
|
}
|
|
@@ -5869,7 +5944,7 @@ const toFileUrl = (url, locationHref) => {
|
|
|
5869
5944
|
if (parsedUrl.protocol === 'file:') {
|
|
5870
5945
|
parsedUrl.hash = '';
|
|
5871
5946
|
parsedUrl.search = '';
|
|
5872
|
-
return parsedUrl.
|
|
5947
|
+
return parsedUrl.href;
|
|
5873
5948
|
}
|
|
5874
5949
|
return getFileUrlFromRemotePath(parsedUrl.pathname);
|
|
5875
5950
|
};
|