@lvce-editor/shared-process 0.0.25 → 0.0.28

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.
Files changed (56) hide show
  1. package/config/builtinCommands.json +101 -85
  2. package/config/defaultKeyBindings.json +6 -1
  3. package/index.js +2 -2
  4. package/package.json +12 -8
  5. package/src/parts/Assert/Assert.js +12 -5
  6. package/src/parts/ChildProcess/ChildProcessWithFork.js +19 -0
  7. package/src/parts/Command/Command.js +14 -16
  8. package/src/parts/Developer/Developer.ipc.js +2 -8
  9. package/src/parts/ExtensionHost/ExtensionHost.ipc.js +10 -68
  10. package/src/parts/ExtensionHost/ExtensionHost.js +59 -138
  11. package/src/parts/ExtensionHostIpc/ExtensionHostIpc.js +5 -0
  12. package/src/parts/ExtensionHostIpc/ExtensionHostIpcWithChildProcess.js +57 -0
  13. package/src/parts/ExtensionHostIpc/ExtensionHostIpcWithWorker.js +38 -0
  14. package/src/parts/ExtensionHostRpc/ExtensionHostRpc.js +82 -0
  15. package/src/parts/ExtensionManagement/ExtensionManagement.ipc.js +11 -0
  16. package/src/parts/ExtensionManagement/ExtensionManagement.js +5 -2
  17. package/src/parts/{ExtensionHost/ExtensionHostColorTheme.js → ExtensionManagement/ExtensionManagementColorTheme.js} +1 -1
  18. package/src/parts/{ExtensionHost/ExtensionHostIconTheme.js → ExtensionManagement/ExtensionManagementIconTheme.js} +1 -1
  19. package/src/parts/{ExtensionHost/ExtensionHostLanguages.js → ExtensionManagement/ExtensionManagementLanguages.js} +1 -1
  20. package/src/parts/FileSystem/FileSystem.js +13 -1
  21. package/src/parts/JsonRpc/JsonRpc.js +2 -2
  22. package/src/parts/OutputChannel/OutputChannel.ipc.js +1 -1
  23. package/src/parts/ParentIpc/ParentIpc.js +93 -47
  24. package/src/parts/Platform/Platform.js +1 -1
  25. package/src/parts/Preferences/Preferences.js +0 -2
  26. package/src/parts/PrettyError/PrettyError.js +5 -2
  27. package/src/parts/RequiresSocket/RequiresSocket.js +6 -5
  28. package/src/parts/Stats/Stats.js +8 -7
  29. package/src/parts/Terminal/Terminal.ipc.js +2 -2
  30. package/src/parts/Terminal/Terminal.js +1 -1
  31. package/src/parts/Timeout/Timeout.js +7 -0
  32. package/src/sharedProcessMain.js +13 -4
  33. package/src/parts/Extension/Extension.js +0 -7
  34. package/src/parts/ExtensionHost/ExtensionHostBraceCompletion.js +0 -14
  35. package/src/parts/ExtensionHost/ExtensionHostClosingTag.js +0 -14
  36. package/src/parts/ExtensionHost/ExtensionHostCommand.js +0 -19
  37. package/src/parts/ExtensionHost/ExtensionHostCompletion.js +0 -12
  38. package/src/parts/ExtensionHost/ExtensionHostDefinition.js +0 -12
  39. package/src/parts/ExtensionHost/ExtensionHostDiagnostic.js +0 -7
  40. package/src/parts/ExtensionHost/ExtensionHostFileSystem.js +0 -23
  41. package/src/parts/ExtensionHost/ExtensionHostFormatting.js +0 -4
  42. package/src/parts/ExtensionHost/ExtensionHostHover.js +0 -12
  43. package/src/parts/ExtensionHost/ExtensionHostImplementation.js +0 -12
  44. package/src/parts/ExtensionHost/ExtensionHostManagement.js +0 -26
  45. package/src/parts/ExtensionHost/ExtensionHostOutput.js +0 -3
  46. package/src/parts/ExtensionHost/ExtensionHostQuickPick.js +0 -6
  47. package/src/parts/ExtensionHost/ExtensionHostReference.js +0 -12
  48. package/src/parts/ExtensionHost/ExtensionHostRename.js +0 -27
  49. package/src/parts/ExtensionHost/ExtensionHostSemanticTokens.js +0 -10
  50. package/src/parts/ExtensionHost/ExtensionHostSourceControl.js +0 -15
  51. package/src/parts/ExtensionHost/ExtensionHostStats.js +0 -3
  52. package/src/parts/ExtensionHost/ExtensionHostStatusBar.js +0 -7
  53. package/src/parts/ExtensionHost/ExtensionHostTabCompletion.js +0 -12
  54. package/src/parts/ExtensionHost/ExtensionHostTextDocument.js +0 -35
  55. package/src/parts/ExtensionHost/ExtensionHostTypeDefinition.js +0 -12
  56. package/src/parts/ExtensionHost/ExtensionHostWorkspace.js +0 -3
@@ -1,303 +1,307 @@
1
1
  [
2
2
  {
3
- "id": "layout.toggleSideBar",
3
+ "id": "Layout.toggleSideBar",
4
4
  "label": "Layout: Toggle Side Bar"
5
5
  },
6
6
  {
7
- "id": "layout.togglePanel",
7
+ "id": "Layout.togglePanel",
8
8
  "label": "Layout: Toggle Panel"
9
9
  },
10
10
  {
11
- "id": "layout.toggleActivityBar",
11
+ "id": "Layout.toggleActivityBar",
12
12
  "label": "Layout: Toggle Activity Bar"
13
13
  },
14
14
  {
15
- "id": "layout.toggleSideBarPosition",
15
+ "id": "Layout.toggleSideBarPosition",
16
16
  "label": "Layout: Toggle Side Bar Position",
17
17
  "aliases": ["Position Side Bar", "Move Side Bar", "Side Bar Location"]
18
18
  },
19
19
  {
20
- "id": "focus.output",
20
+ "id": "Focus.output",
21
21
  "label": "Focus: Output"
22
22
  },
23
23
  {
24
- "id": "focus.nextPart",
24
+ "id": "Focus.nextPart",
25
25
  "label": "Focus: Next Part"
26
26
  },
27
27
  {
28
- "id": "focus.previousPart",
28
+ "id": "Focus.previousPart",
29
29
  "label": "Focus: Previous Part"
30
30
  },
31
31
  {
32
- "id": "focus.statusBar",
32
+ "id": "Focus.statusBar",
33
33
  "label": "Focus: Status Bar"
34
34
  },
35
35
  {
36
- "id": "focus.problems",
36
+ "id": "Focus.problems",
37
37
  "label": "Focus: Problems"
38
38
  },
39
39
  {
40
- "id": "focus.debugConsole",
40
+ "id": "Focus.debugConsole",
41
41
  "label": "Focus: Debug Console"
42
42
  },
43
43
  {
44
- "id": "focus.terminal",
44
+ "id": "Focus.terminal",
45
45
  "label": "Focus: Terminal"
46
46
  },
47
47
  {
48
- "id": "terminal.clear",
48
+ "id": "Terminal.clear",
49
49
  "label": "Terminal: Clear"
50
50
  },
51
51
  {
52
- "id": "terminal.paste",
52
+ "id": "Terminal.paste",
53
53
  "label": "Terminal: Paste"
54
54
  },
55
55
  {
56
- "id": "terminal.kill",
56
+ "id": "Terminal.kill",
57
57
  "label": "Terminal: Kill active Instance"
58
58
  },
59
59
  {
60
- "id": "terminal.scrollUpLine",
60
+ "id": "Terminal.scrollUpLine",
61
61
  "label": "Terminal: Scroll Up Line"
62
62
  },
63
63
  {
64
- "id": "terminal.scrollDownLine",
64
+ "id": "Terminal.scrollDownLine",
65
65
  "label": "Terminal: Scroll Down Line"
66
66
  },
67
67
  {
68
- "id": "terminal.scrollUpPage",
68
+ "id": "Terminal.scrollUpPage",
69
69
  "label": "Terminal: Scroll Up Page"
70
70
  },
71
71
  {
72
- "id": "terminal.scrollDownPage",
72
+ "id": "Terminal.scrollDownPage",
73
73
  "label": "Terminal: Scroll Down Page"
74
74
  },
75
75
  {
76
- "id": "focus.previousTerminal",
76
+ "id": "Focus.previousTerminal",
77
77
  "label": "Focus: Previous Terminal"
78
78
  },
79
79
  {
80
- "id": "focus.nextTerminal",
80
+ "id": "Focus.nextTerminal",
81
81
  "label": "Focus: Next Terminal"
82
82
  },
83
83
  {
84
- "id": "terminal.split",
84
+ "id": "Terminal.split",
85
85
  "label": "Terminal: Split"
86
86
  },
87
87
  {
88
- "id": "terminal.toggleSelection",
88
+ "id": "Terminal.toggleSelection",
89
89
  "label": "Toggle Selection"
90
90
  },
91
91
  {
92
- "id": "focus.explorer",
92
+ "id": "Focus.explorer",
93
93
  "label": "Focus: Explorer"
94
94
  },
95
95
  {
96
- "id": "focus.search",
96
+ "id": "Focus.search",
97
97
  "label": "Focus: Search"
98
98
  },
99
99
  {
100
- "id": "focus.sourceControl",
100
+ "id": "Focus.sourceControl",
101
101
  "label": "Focus: Source Control"
102
102
  },
103
103
  {
104
- "id": "focus.debugAndRun",
104
+ "id": "Focus.debugAndRun",
105
105
  "label": "Focus: Debug and Run"
106
106
  },
107
107
  {
108
- "id": "focus.extensions",
108
+ "id": "Focus.Extensions",
109
109
  "label": "Focus: Extensions"
110
110
  },
111
111
  {
112
- "id": "preferences.openUserKeyBindings",
112
+ "id": "Preferences.openUserKeyBindings",
113
113
  "label": "Preferences: Open User Key Bindings"
114
114
  },
115
115
  {
116
- "id": "preferences.openDefaultKeyBindings",
116
+ "id": "Preferences.openDefaultKeyBindings",
117
117
  "label": "Preferences: Open Default Key Bindings",
118
118
  "aliases": ["Set Key Bindings", "Key Map", "Key Mapping"]
119
119
  },
120
120
  {
121
- "id": "preferences.openSettingsJson",
121
+ "id": "Preferences.openSettingsJson",
122
122
  "label": "Preferences: Open Settings",
123
123
  "aliases": ["Change Settings", "Configure Settings", "Preferences"]
124
124
  },
125
125
  {
126
- "id": "extensions.openExtensionsFolder",
126
+ "id": "Extensions.openExtensionsFolder",
127
127
  "label": "Extensions: Open Extensions Folder",
128
128
  "deprecated": true,
129
129
  "TODO": "add support for deprecated commands"
130
130
  },
131
131
  {
132
- "id": "extensions.openCachedExtensionsFolder",
132
+ "id": "Extensions.openCachedExtensionsFolder",
133
133
  "label": "Extensions: Open Cached Extensions Folder"
134
134
  },
135
135
  {
136
- "id": "focus.activityBar",
136
+ "id": "Focus.ActivityBar",
137
137
  "label": "Focus: ActivityBar"
138
138
  },
139
139
  {
140
- "id": "focus.titleBar",
140
+ "id": "Focus.titleBar",
141
141
  "label": "Focus: Title Bar"
142
142
  },
143
143
  {
144
- "id": "activityBar.focusNext",
144
+ "id": "ActivityBar.focusNext",
145
145
  "label": "ActivityBar: Focus Next"
146
146
  },
147
147
  {
148
- "id": "activityBar.focusPrevious",
149
- "label": "activityBar: Focus Previous"
148
+ "id": "ActivityBar.focusPrevious",
149
+ "label": "ActivityBar: Focus Previous"
150
150
  },
151
151
  {
152
- "id": "activityBar.focusFirst",
152
+ "id": "ActivityBar.focusFirst",
153
153
  "label": "ActivityBar: Focus First"
154
154
  },
155
155
  {
156
- "id": "activityBar.focusLast",
156
+ "id": "ActivityBar.focusLast",
157
157
  "label": "ActivityBar: Focus Last"
158
158
  },
159
159
  {
160
- "id": "developer.showMemoryUsage",
160
+ "id": "Developer.showMemoryUsage",
161
161
  "label": "Developer: Show Memory Usage"
162
162
  },
163
163
  {
164
- "id": "developer.allocateMemoryInSharedProcess",
164
+ "id": "Developer.downloadViewletState",
165
+ "label": "Developer: Download Viewlets"
166
+ },
167
+ {
168
+ "id": "Developer.allocateMemoryInSharedProcess",
165
169
  "label": "Developer: Allocate Memory in Shared Process"
166
170
  },
167
171
  {
168
- "id": "developer.crashSharedProcess",
172
+ "id": "Developer.crashSharedProcess",
169
173
  "label": "Developer: Crash Shared Process"
170
174
  },
171
175
  {
172
- "id": "developer.crashMainProcess",
176
+ "id": "Developer.crashMainProcess",
173
177
  "label": "Developer: Crash Main Process"
174
178
  },
175
179
  {
176
- "id": "developer.createSharedProcessHeapSnapshot",
180
+ "id": "Developer.createSharedProcessHeapSnapshot",
177
181
  "label": "Developer: Create Shared Process Heap Snapshot"
178
182
  },
179
183
  {
180
- "id": "developer.createSharedProcessProfile",
184
+ "id": "Developer.createSharedProcessProfile",
181
185
  "label": "Developer: Create Shared Process Profile"
182
186
  },
183
187
  {
184
- "id": "developer.clearCache",
188
+ "id": "Developer.clearCache",
185
189
  "label": "Developer: Clear Cache"
186
190
  },
187
191
  {
188
- "id": "developer.openConfigFolder",
192
+ "id": "Developer.openConfigFolder",
189
193
  "label": "Developer: Open Config Folder"
190
194
  },
191
195
  {
192
- "id": "developer.openCacheFolder",
196
+ "id": "Developer.openCacheFolder",
193
197
  "label": "Developer: Open Cache Folder"
194
198
  },
195
199
  {
196
- "id": "developer.openDataFolder",
200
+ "id": "Developer.openDataFolder",
197
201
  "label": "Developer: Open Data Folder"
198
202
  },
199
203
  {
200
- "id": "preferences.selectColorTheme",
204
+ "id": "Preferences.selectColorTheme",
201
205
  "label": "Preferences: Color Theme",
202
206
  "aliases": ["Select Color Theme", "Switch Color Theme", "Theme Color"]
203
207
  },
204
208
  {
205
- "id": "developer.measureLatencyBetweenExtensionHostAndSharedProcess",
209
+ "id": "Developer.measureLatencyBetweenExtensionHostAndSharedProcess",
206
210
  "label": "Developer: Measure Latency Between Extension Host and Shared Process"
207
211
  },
208
212
  {
209
- "id": "developer.measureLatencyBetweenSharedProcessAndRendererProcess",
213
+ "id": "Developer.measureLatencyBetweenSharedProcessAndRendererProcess",
210
214
  "label": "Developer: Measure Latency Between Shared Process and Renderer Process"
211
215
  },
212
216
  {
213
- "id": "developer.showState",
217
+ "id": "Developer.showState",
214
218
  "label": "Developer: Show state"
215
219
  },
216
220
  {
217
- "id": "developer.startupPerformance",
221
+ "id": "Developer.startupPerformance",
218
222
  "label": "Developer: Startup Performance"
219
223
  },
220
224
  {
221
- "id": "developer.toggleDeveloperTools",
225
+ "id": "Developer.toggleDeveloperTools",
222
226
  "label": "Developer: Toggle Developer Tools"
223
227
  },
224
228
  {
225
- "id": "window.reload",
229
+ "id": "Window.reload",
226
230
  "label": "Window: Reload",
227
231
  "aliases": ["Reload Window"]
228
232
  },
229
233
  {
230
- "id": "window.close",
234
+ "id": "Window.close",
231
235
  "label": "Window: Close",
232
236
  "aliases": ["Close Window"]
233
237
  },
234
238
  {
235
- "id": "window.minimize",
239
+ "id": "Window.minimize",
236
240
  "label": "Window: Minimize",
237
241
  "aliases": ["Minimize Window"]
238
242
  },
239
243
  {
240
- "id": "window.maximize",
244
+ "id": "Window.maximize",
241
245
  "label": "Window: Maximize",
242
246
  "aliases": ["Maximize Window"]
243
247
  },
244
248
  {
245
- "id": "window.unmaximize",
249
+ "id": "Window.unmaximize",
246
250
  "label": "Window: Unmaximize",
247
251
  "aliases": ["Unmaximize Window"]
248
252
  },
249
253
  {
250
- "id": "window.makeScreenshot",
254
+ "id": "Window.makeScreenshot",
251
255
  "label": "Window: Make Screenshot"
252
256
  },
253
257
  {
254
- "id": "main.closeEditor",
258
+ "id": "main.EloseEditor",
255
259
  "label": "Main: Close Editor"
256
260
  },
257
261
  {
258
- "id": "main.closeAllEditors",
259
- "label": "Main: Close all editors"
262
+ "id": "main.EloseAllEditors",
263
+ "label": "Main: Close all Editors"
260
264
  },
261
265
  {
262
- "id": "editor.indent",
266
+ "id": "Editor.indent",
263
267
  "label": "Editor: Indent",
264
268
  "aliases": ["Indent More", "DeIndent"]
265
269
  },
266
270
  {
267
- "id": "editor.unindent",
271
+ "id": "Editor.unindent",
268
272
  "label": "Editor: Unindent",
269
273
  "aliases": ["Indent Less", "DeIndent"]
270
274
  },
271
275
  {
272
- "id": "editor.toggleComment",
276
+ "id": "Editor.toggleComment",
273
277
  "label": "Editor: Toggle Comment"
274
278
  },
275
279
  {
276
- "id": "editor.toggleBlockComment",
280
+ "id": "Editor.toggleBlockComment",
277
281
  "label": "Editor: Toggle Block Comment"
278
282
  },
279
283
  {
280
- "id": "editor.openColorPicker",
284
+ "id": "Editor.openColorPicker",
281
285
  "label": "Editor: Open Color Picker"
282
286
  },
283
287
  {
284
- "id": "editor.closeColorPicker",
288
+ "id": "Editor.closeColorPicker",
285
289
  "label": "Editor: Close Color Picker"
286
290
  },
287
291
  {
288
- "id": "editor.copyLineDown",
292
+ "id": "Editor.copyLineDown",
289
293
  "label": "Editor: Copy Line Down"
290
294
  },
291
295
  {
292
- "id": "editor.copyLineUp",
296
+ "id": "Editor.copyLineUp",
293
297
  "label": "Editor: Copy Line Up"
294
298
  },
295
299
  {
296
- "id": "editor.moveLineDown",
300
+ "id": "Editor.moveLineDown",
297
301
  "label": "Editor: Move Line Down"
298
302
  },
299
303
  {
300
- "id": "editor.moveLineUp",
304
+ "id": "Editor.moveLineUp",
301
305
  "label": "Editor: Move Line Up"
302
306
  },
303
307
  {
@@ -313,31 +317,31 @@
313
317
  "label": "Help: About"
314
318
  },
315
319
  {
316
- "id": "editor.format",
320
+ "id": "Editor.format",
317
321
  "label": "Editor: Format Document"
318
322
  },
319
323
  {
320
- "id": "editor.formatForced",
324
+ "id": "Editor.formatForced",
321
325
  "label": "Editor: Format Document (forced)"
322
326
  },
323
327
  {
324
- "id": "editor.selectNextOccurrence",
328
+ "id": "Editor.selectNextOccurrence",
325
329
  "label": "Editor: Select Next Occurrence"
326
330
  },
327
331
  {
328
- "id": "editor.selectAllOccurrences",
332
+ "id": "Editor.selectAllOccurrences",
329
333
  "label": "Editor: Select All Occurrences"
330
334
  },
331
335
  {
332
- "id": "editor.goToDefinition",
336
+ "id": "Editor.goToDefinition",
333
337
  "label": "Editor: Go To Definition"
334
338
  },
335
339
  {
336
- "id": "editor.goToTypeDefinition",
340
+ "id": "Editor.goToTypeDefinition",
337
341
  "label": "Editor: Go To Type Definition"
338
342
  },
339
343
  {
340
- "id": "editor.selectInsideString",
344
+ "id": "Editor.selectInsideString",
341
345
  "label": "Editor: Select Inside String"
342
346
  },
343
347
  {
@@ -349,19 +353,31 @@
349
353
  "label": "Service Worker: Uninstall"
350
354
  },
351
355
  {
352
- "id": "developer.openLogsFolder",
356
+ "id": "Developer.openLogsFolder",
353
357
  "label": "Developer: Open Logs Folder"
354
358
  },
355
359
  {
356
- "id": "developer.openProcessExplorer",
360
+ "id": "Developer.openProcessExplorer",
357
361
  "label": "Developer: Open Process Explorer"
358
362
  },
359
363
  {
360
- "id": "viewletExplorer.collapseAll",
364
+ "id": "Explorer.collapseAll",
361
365
  "label": "Explorer: Collapse All"
362
366
  },
363
367
  {
364
- "id": "viewletExplorer.expandAll",
368
+ "id": "Explorer.expandAll",
365
369
  "label": "Explorer: Expand All"
370
+ },
371
+ {
372
+ "id": "SessionReplay.replayCurrentSession",
373
+ "label": "SessionReplay: Replay Current Session"
374
+ },
375
+ {
376
+ "id": "SessionReplay.downloadSession",
377
+ "label": "SessionReplay: Download Session"
378
+ },
379
+ {
380
+ "id": "SessionReplay.openSession",
381
+ "label": "SessionReplay: Open Session"
366
382
  }
367
383
  ]
@@ -339,6 +339,11 @@
339
339
  "command": "Explorer.removeDirent",
340
340
  "when": "focus.Explorer"
341
341
  },
342
+ {
343
+ "key": "Escape",
344
+ "command": "Explorer.focusNone",
345
+ "when": "focus.Explorer"
346
+ },
342
347
  {
343
348
  "key": "Space",
344
349
  "command": "Explorer.handleClickCurrent",
@@ -361,7 +366,7 @@
361
366
  },
362
367
  {
363
368
  "key": "ctrl+,",
364
- "command": "preferences.openSettingsJson"
369
+ "command": "Preferences.openSettingsJson"
365
370
  },
366
371
  {
367
372
  "key": "ArrowLeft",
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { dirname, join } from 'path'
2
- import { fileURLToPath } from 'url'
1
+ import { dirname, join } from 'node:path'
2
+ import { fileURLToPath } from 'node:url'
3
3
 
4
4
  const __dirname = dirname(fileURLToPath(import.meta.url))
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.0.25",
3
+ "version": "0.0.28",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,10 +17,10 @@
17
17
  "debug": "^4.3.4",
18
18
  "execa": "^6.1.0",
19
19
  "exit-hook": "^3.0.0",
20
- "got": "^12.1.0",
20
+ "got": "^12.3.0",
21
21
  "is-object": "^1.0.2",
22
22
  "json-parse-even-better-errors": "^2.3.1",
23
- "jsonc-parser": "^3.0.0",
23
+ "jsonc-parser": "^3.1.0",
24
24
  "lines-and-columns": "^2.0.3",
25
25
  "open": "^8.4.0",
26
26
  "p-queue": "^7.2.0",
@@ -29,10 +29,10 @@
29
29
  "tar-fs": "^2.1.1",
30
30
  "trash": "^8.1.0",
31
31
  "verror": "^1.10.1",
32
- "ws": "^8.8.0",
32
+ "ws": "^8.8.1",
33
33
  "xdg-basedir": "^5.1.0",
34
- "@lvce-editor/pty-host": "0.0.25",
35
- "@lvce-editor/extension-host": "0.0.25"
34
+ "@lvce-editor/pty-host": "0.0.28",
35
+ "@lvce-editor/extension-host": "0.0.28"
36
36
  },
37
37
  "optionalDependencies": {
38
38
  "electron-clipboard-ex": "^1.3.3",
@@ -44,7 +44,7 @@
44
44
  "@types/is-object": "^1.0.2",
45
45
  "@types/tail": "^2.2.1",
46
46
  "@types/tar-fs": "^2.0.1",
47
- "@types/verror": "^1.10.5",
47
+ "@types/verror": "^1.10.6",
48
48
  "@types/ws": "^8.5.3",
49
49
  "get-port": "^6.1.2"
50
50
  },
@@ -83,7 +83,11 @@
83
83
  "node/prefer-global/process": "off",
84
84
  "unicorn/prevent-abbreviations": "off",
85
85
  "unicorn/no-process-exit": "off",
86
- "quotes": "off"
86
+ "quotes": "off",
87
+ "n/prefer-global/process": [
88
+ "error",
89
+ "always"
90
+ ]
87
91
  },
88
92
  "ignores": [
89
93
  "distmin"
@@ -1,3 +1,10 @@
1
+ class AssertionError extends Error {
2
+ constructor(message) {
3
+ super(message)
4
+ this.name = 'AssertionError'
5
+ }
6
+ }
7
+
1
8
  const getType = (value) => {
2
9
  switch (typeof value) {
3
10
  case 'number':
@@ -24,34 +31,34 @@ const getType = (value) => {
24
31
  export const object = (value) => {
25
32
  const type = getType(value)
26
33
  if (type !== 'object') {
27
- throw new Error('expected value to be of type object')
34
+ throw new AssertionError('expected value to be of type object')
28
35
  }
29
36
  }
30
37
 
31
38
  export const number = (value) => {
32
39
  const type = getType(value)
33
40
  if (type !== 'number') {
34
- throw new Error('expected value to be of type number')
41
+ throw new AssertionError('expected value to be of type number')
35
42
  }
36
43
  }
37
44
 
38
45
  export const array = (value) => {
39
46
  const type = getType(value)
40
47
  if (type !== 'array') {
41
- throw new Error('expected value to be of type array')
48
+ throw new AssertionError('expected value to be of type array')
42
49
  }
43
50
  }
44
51
 
45
52
  export const string = (value) => {
46
53
  const type = getType(value)
47
54
  if (type !== 'string') {
48
- throw new Error('expected value to be of type string')
55
+ throw new AssertionError('expected value to be of type string')
49
56
  }
50
57
  }
51
58
 
52
59
  export const boolean = (value) => {
53
60
  const type = getType(value)
54
61
  if (type !== 'boolean') {
55
- throw new Error('expected value to be of type boolean')
62
+ throw new AssertionError('expected value to be of type boolean')
56
63
  }
57
64
  }
@@ -0,0 +1,19 @@
1
+ import { fork } from 'node:child_process'
2
+
3
+ export const create = (path) => {
4
+ const childProcess = fork(path)
5
+ let _listener
6
+ return {
7
+ get onmessage() {
8
+ return _listener
9
+ },
10
+ set onmessage(listener) {
11
+ if (listener) {
12
+ childProcess.on('message', listener)
13
+ } else {
14
+ childProcess.off('message', listener)
15
+ }
16
+ _listener = listener
17
+ },
18
+ }
19
+ }