@lvce-editor/shared-process 0.101.14 → 0.101.16
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 +2 -2
- package/src/parts/BuiltinExtensionsPath/BuiltinExtensionsPath.js +1 -1
- package/src/parts/GetHelpString/GetHelpString.js +4 -0
- package/src/parts/IpcTrace/IpcTrace.ipc.js +7 -0
- package/src/parts/IpcTrace/IpcTrace.js +59 -0
- package/src/parts/Module/Module.js +2 -0
- package/src/parts/ModuleId/ModuleId.js +1 -0
- package/src/parts/ModuleMap/ModuleMap.js +2 -0
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/PreloadUrl/PreloadUrl.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.101.
|
|
3
|
+
"version": "0.101.16",
|
|
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.
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.101.16",
|
|
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', '
|
|
6
|
+
const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '3c1cf72', 'extensions')
|
|
7
7
|
return builtinExtensionsPath
|
|
8
8
|
}
|
|
@@ -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:
|
|
@@ -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.
|
|
64
|
+
export const version = '0.101.16'
|
|
65
65
|
|
|
66
|
-
export const commit = '
|
|
66
|
+
export const commit = '3c1cf72'
|
|
67
67
|
|
|
68
|
-
export const date = '2026-08-
|
|
68
|
+
export const date = '2026-08-15T21:37:08.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', '
|
|
5
|
+
return join(Root.root, 'static', '3c1cf72', 'packages', 'preload', 'dist', 'index.js')
|
|
6
6
|
}
|