@lvce-editor/shared-process 0.101.15 → 0.102.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.101.15",
3
+ "version": "0.102.0",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "1.9.0",
21
- "@lvce-editor/extension-host-helper-process": "0.101.15",
21
+ "@lvce-editor/extension-host-helper-process": "0.102.0",
22
22
  "@lvce-editor/ipc": "16.11.0",
23
23
  "@lvce-editor/json-rpc": "8.6.0",
24
24
  "@lvce-editor/jsonc-parser": "1.5.0",
@@ -3,6 +3,6 @@ import { fileURLToPath } from 'url'
3
3
 
4
4
  export const getBuiltinExtensionsPath = () => {
5
5
  const staticServerPath = fileURLToPath(import.meta.resolve('@lvce-editor/static-server'))
6
- const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '0ae7736', 'extensions')
6
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', 'dbe3eca', 'extensions')
7
7
  return builtinExtensionsPath
8
8
  }
@@ -5,5 +5,9 @@ export const getHelpString = () => {
5
5
 
6
6
  Usage:
7
7
  ${Platform.applicationName} [path]
8
+
9
+ Diagnostics:
10
+ --trace-ipc=<worker-ids> Trace comma-separated worker IDs (or *) to JSONL.
11
+ Traces can be large and contain source code.
8
12
  `
9
13
  }
@@ -0,0 +1,7 @@
1
+ import * as IpcTrace from './IpcTrace.js'
2
+
3
+ export const name = 'IpcTrace'
4
+
5
+ export const Commands = {
6
+ append: IpcTrace.append,
7
+ }
@@ -0,0 +1,59 @@
1
+ import { appendFile, mkdir } from 'node:fs/promises'
2
+ import { join } from 'node:path'
3
+ import * as PlatformPaths from '../PlatformPaths/PlatformPaths.js'
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+ export const state = {
17
+ appendFile,
18
+ cacheDirectory: PlatformPaths.cacheDir,
19
+ mkdir,
20
+ timeOrigin: performance.timeOrigin,
21
+ }
22
+
23
+ let writeChain = Promise.resolve()
24
+ const initializedDirectories = new Set ()
25
+ const unsafeWorkerIdCharacterRegex = /[^a-z\d._-]/gi
26
+
27
+ export const sanitizeWorkerId = (workerId) => {
28
+ return workerId.replaceAll(unsafeWorkerIdCharacterRegex, '_') || 'unknown-worker'
29
+ }
30
+
31
+ export const getSessionName = (timeOrigin) => {
32
+ return new Date(timeOrigin).toISOString().replaceAll(':', '-')
33
+ }
34
+
35
+ export const appendWithDependencies = async (workerId, records, dependencies) => {
36
+ if (records.length === 0) {
37
+ return
38
+ }
39
+ const sessionName = getSessionName(dependencies.timeOrigin)
40
+ const traceDirectory = join(dependencies.cacheDirectory, 'ipcTraces', sessionName)
41
+ if (!initializedDirectories.has(traceDirectory)) {
42
+ await dependencies.mkdir(traceDirectory, { recursive: true })
43
+ initializedDirectories.add(traceDirectory)
44
+ }
45
+ const fileName = `${sanitizeWorkerId(workerId)}.jsonl`
46
+ const content = `${records.map((record) => JSON.stringify(record)).join('\n')}\n`
47
+ await dependencies.appendFile(join(traceDirectory, fileName), content)
48
+ }
49
+
50
+ export const append = (workerId, records) => {
51
+ const operation = writeChain.then(() => appendWithDependencies(workerId, records, state))
52
+ writeChain = operation.catch(() => {})
53
+ return operation
54
+ }
55
+
56
+ export const reset = () => {
57
+ initializedDirectories.clear()
58
+ writeChain = Promise.resolve()
59
+ }
@@ -112,6 +112,8 @@ export const load = (moduleId) => {
112
112
  return import('../HandleWindowAllClosed/HandleWindowAllClosed.ipc.js')
113
113
  case ModuleId.InstallExtension:
114
114
  return import('../InstallExtension/InstallExtension.ipc.js')
115
+ case ModuleId.IpcTrace:
116
+ return import('../IpcTrace/IpcTrace.ipc.js')
115
117
  case ModuleId.IsAutoUpdateSupported:
116
118
  return import('../IsAutoUpdateSupported/IsAutoUpdateSupported.ipc.js')
117
119
  case ModuleId.LanguageServer:
@@ -82,3 +82,4 @@ export const SendMessagePortToMainProcess = 88
82
82
  export const SecretStorage = 89
83
83
  export const ChromeCookieImport = 90
84
84
  export const FirefoxCookieImport = 91
85
+ export const IpcTrace = 92
@@ -209,6 +209,8 @@ export const getModuleId = (commandId) => {
209
209
  return ModuleId.HandleWindowAllClosed
210
210
  case 'InstallExtension.installExtension':
211
211
  return ModuleId.InstallExtension
212
+ case 'IpcTrace.append':
213
+ return ModuleId.IpcTrace
212
214
  case 'IsAutoUpdateSupported.isAutoUpdateSupported':
213
215
  return ModuleId.IsAutoUpdateSupported
214
216
  case 'LanguageServer.codeAction':
@@ -61,11 +61,11 @@ export const getSetupName = () => {
61
61
  return 'Lvce-Setup'
62
62
  }
63
63
 
64
- export const version = '0.101.15'
64
+ export const version = '0.102.0'
65
65
 
66
- export const commit = '0ae7736'
66
+ export const commit = 'dbe3eca'
67
67
 
68
- export const date = '2026-08-15T20:50:44.000Z'
68
+ export const date = '2026-08-15T22:06:56.000Z'
69
69
 
70
70
  export const getVersion = () => {
71
71
  return version
@@ -2,5 +2,5 @@ import { join } from 'node:path'
2
2
  import * as Root from '../Root/Root.js'
3
3
 
4
4
  export const getPreloadUrl = () => {
5
- return join(Root.root, 'static', '0ae7736', 'packages', 'preload', 'dist', 'index.js')
5
+ return join(Root.root, 'static', 'dbe3eca', 'packages', 'preload', 'dist', 'index.js')
6
6
  }