@lvce-editor/shared-process 0.106.2 → 0.106.4
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 +3 -4
- package/src/parts/BuiltinExtensionsPath/BuiltinExtensionsPath.js +1 -1
- package/src/parts/IsAllowedWebSocketOrigin/IsAllowedWebSocketOrigin.js +8 -9
- package/src/parts/LanguageServerConnection/LanguageServerConnection.js +2 -61
- package/src/parts/Module/Module.js +0 -2
- package/src/parts/ModuleId/ModuleId.js +0 -1
- package/src/parts/ModuleMap/ModuleMap.js +0 -3
- package/src/parts/NormalizeLanguageServerDocumentUri/NormalizeLanguageServerDocumentUri.js +5 -6
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/PreloadUrl/PreloadUrl.js +1 -1
- package/src/parts/ChromeCookieImport/ChromeCookieImport.ipc.js +0 -8
- package/src/parts/ChromeCookieImport/ChromeCookieImport.js +0 -9
- package/src/parts/MarkdownLanguageServerRequest/MarkdownLanguageServerRequest.js +0 -121
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.106.
|
|
3
|
+
"version": "0.106.4",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -18,16 +18,15 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lvce-editor/assert": "1.9.0",
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.106.
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.106.4",
|
|
22
22
|
"@lvce-editor/ipc": "16.12.0",
|
|
23
23
|
"@lvce-editor/json-rpc": "8.7.0",
|
|
24
24
|
"@lvce-editor/jsonc-parser": "1.5.0",
|
|
25
25
|
"@lvce-editor/pretty-error": "2.0.0",
|
|
26
26
|
"@lvce-editor/process-explorer": "3.19.0",
|
|
27
|
-
"@lvce-editor/rpc-registry": "9.
|
|
27
|
+
"@lvce-editor/rpc-registry": "9.54.0",
|
|
28
28
|
"@lvce-editor/verror": "1.7.0",
|
|
29
29
|
"is-object": "^1.0.2",
|
|
30
|
-
"markdown-it": "^15.0.0",
|
|
31
30
|
"xdg-basedir": "^5.1.0"
|
|
32
31
|
},
|
|
33
32
|
"optionalDependencies": {
|
|
@@ -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', '71bebb6', 'extensions')
|
|
7
7
|
return builtinExtensionsPath
|
|
8
8
|
}
|
|
@@ -34,15 +34,14 @@ export const isAllowedWebSocketOrigin = (request) => {
|
|
|
34
34
|
if (!origin) {
|
|
35
35
|
return false
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const originHost = url.host.toLowerCase()
|
|
43
|
-
const allowedHosts = getAllowedHosts(headers)
|
|
44
|
-
return allowedHosts.includes(originHost)
|
|
45
|
-
} catch {
|
|
37
|
+
if (!URL.canParse(origin)) {
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
const url = new URL(origin)
|
|
41
|
+
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
|
46
42
|
return false
|
|
47
43
|
}
|
|
44
|
+
const originHost = url.host.toLowerCase()
|
|
45
|
+
const allowedHosts = getAllowedHosts(headers)
|
|
46
|
+
return allowedHosts.includes(originHost)
|
|
48
47
|
}
|
|
@@ -2,10 +2,6 @@ import { spawn, } from 'node:child_process'
|
|
|
2
2
|
import { basename, extname } from 'node:path'
|
|
3
3
|
import { fileURLToPath } from 'node:url'
|
|
4
4
|
import { LanguageServerMessageParser } from '../LanguageServerMessageParser/LanguageServerMessageParser.js'
|
|
5
|
-
import {
|
|
6
|
-
executeMarkdownLanguageServerRequest,
|
|
7
|
-
isMarkdownLanguageServerRequest,
|
|
8
|
-
} from '../MarkdownLanguageServerRequest/MarkdownLanguageServerRequest.js'
|
|
9
5
|
import { normalizeLanguageServerDocumentUri } from '../NormalizeLanguageServerDocumentUri/NormalizeLanguageServerDocumentUri.js'
|
|
10
6
|
|
|
11
7
|
|
|
@@ -165,7 +161,6 @@ export class LanguageServerConnection {
|
|
|
165
161
|
ready
|
|
166
162
|
rootUri
|
|
167
163
|
initializationProgressWasStarted = false
|
|
168
|
-
markdownConfigured = false
|
|
169
164
|
nextRequestId = 1
|
|
170
165
|
running = true
|
|
171
166
|
stderr = ''
|
|
@@ -236,7 +231,6 @@ export class LanguageServerConnection {
|
|
|
236
231
|
|
|
237
232
|
async complete(textDocument, offset) {
|
|
238
233
|
await this.ready
|
|
239
|
-
this.configureMarkdown(textDocument.languageId)
|
|
240
234
|
this.syncDocument(textDocument)
|
|
241
235
|
const result = await this.sendRequest('textDocument/completion', {
|
|
242
236
|
context: {
|
|
@@ -258,7 +252,6 @@ export class LanguageServerConnection {
|
|
|
258
252
|
|
|
259
253
|
async diagnostic(textDocument) {
|
|
260
254
|
await this.ready
|
|
261
|
-
this.configureMarkdown(textDocument.languageId)
|
|
262
255
|
if (this.supportsPullDiagnostics) {
|
|
263
256
|
this.syncDocument(textDocument)
|
|
264
257
|
const result = await this.sendRequest('textDocument/diagnostic', {
|
|
@@ -286,7 +279,6 @@ export class LanguageServerConnection {
|
|
|
286
279
|
|
|
287
280
|
async definition(textDocument, offset) {
|
|
288
281
|
await this.ready
|
|
289
|
-
this.configureMarkdown(textDocument.languageId)
|
|
290
282
|
this.syncDocument(textDocument)
|
|
291
283
|
return this.sendRequest('textDocument/definition', {
|
|
292
284
|
position: getPosition(textDocument.text, offset),
|
|
@@ -346,52 +338,6 @@ export class LanguageServerConnection {
|
|
|
346
338
|
return Array.isArray(result) ? result : []
|
|
347
339
|
}
|
|
348
340
|
|
|
349
|
-
configureMarkdown(languageId) {
|
|
350
|
-
if (languageId !== 'markdown' || this.markdownConfigured) {
|
|
351
|
-
return
|
|
352
|
-
}
|
|
353
|
-
this.markdownConfigured = true
|
|
354
|
-
this.sendNotification('workspace/didChangeConfiguration', {
|
|
355
|
-
settings: {
|
|
356
|
-
markdown: {
|
|
357
|
-
occurrencesHighlight: {
|
|
358
|
-
enabled: true,
|
|
359
|
-
},
|
|
360
|
-
preferredMdPathExtensionStyle: 'auto',
|
|
361
|
-
server: {
|
|
362
|
-
log: 'off',
|
|
363
|
-
},
|
|
364
|
-
suggest: {
|
|
365
|
-
paths: {
|
|
366
|
-
enabled: true,
|
|
367
|
-
includeWorkspaceHeaderCompletions: 'never',
|
|
368
|
-
},
|
|
369
|
-
},
|
|
370
|
-
validate: {
|
|
371
|
-
duplicateLinkDefinitions: {
|
|
372
|
-
enabled: 'warning',
|
|
373
|
-
},
|
|
374
|
-
enabled: true,
|
|
375
|
-
fileLinks: {
|
|
376
|
-
enabled: 'warning',
|
|
377
|
-
markdownFragmentLinks: 'inherit',
|
|
378
|
-
},
|
|
379
|
-
fragmentLinks: {
|
|
380
|
-
enabled: 'warning',
|
|
381
|
-
},
|
|
382
|
-
ignoredLinks: [],
|
|
383
|
-
referenceLinks: {
|
|
384
|
-
enabled: 'warning',
|
|
385
|
-
},
|
|
386
|
-
unusedLinkDefinitions: {
|
|
387
|
-
enabled: 'warning',
|
|
388
|
-
},
|
|
389
|
-
},
|
|
390
|
-
},
|
|
391
|
-
},
|
|
392
|
-
})
|
|
393
|
-
}
|
|
394
|
-
|
|
395
341
|
async initialize() {
|
|
396
342
|
const result = (await this.sendRequest('initialize', {
|
|
397
343
|
capabilities: {
|
|
@@ -530,7 +476,7 @@ export class LanguageServerConnection {
|
|
|
530
476
|
return
|
|
531
477
|
}
|
|
532
478
|
if (message.method && message.id !== undefined && message.id !== null) {
|
|
533
|
-
|
|
479
|
+
this.handleServerRequest(message)
|
|
534
480
|
return
|
|
535
481
|
}
|
|
536
482
|
if (message.id === undefined || message.id === null) {
|
|
@@ -579,7 +525,7 @@ export class LanguageServerConnection {
|
|
|
579
525
|
this.initializationProgressEnded.resolve()
|
|
580
526
|
}
|
|
581
527
|
|
|
582
|
-
|
|
528
|
+
handleServerRequest(message) {
|
|
583
529
|
try {
|
|
584
530
|
let result = null
|
|
585
531
|
if (message.method === 'workspace/configuration') {
|
|
@@ -595,11 +541,6 @@ export class LanguageServerConnection {
|
|
|
595
541
|
uri: this.rootUri,
|
|
596
542
|
},
|
|
597
543
|
]
|
|
598
|
-
} else if (isMarkdownLanguageServerRequest(message.method || '')) {
|
|
599
|
-
result = await executeMarkdownLanguageServerRequest(message.method || '', message.params || {}, {
|
|
600
|
-
documents: this.documents,
|
|
601
|
-
rootUri: this.rootUri,
|
|
602
|
-
})
|
|
603
544
|
}
|
|
604
545
|
this.sendMessage({
|
|
605
546
|
id: message.id,
|
|
@@ -12,8 +12,6 @@ export const load = (moduleId) => {
|
|
|
12
12
|
return import('../AutoUpdaterWindowsNsis/AutoUpdaterWindowsNsis.ipc.js')
|
|
13
13
|
case ModuleId.BulkReplacement:
|
|
14
14
|
return import('../BulkReplacement/BulkReplacement.ipc.js')
|
|
15
|
-
case ModuleId.ChromeCookieImport:
|
|
16
|
-
return import('../ChromeCookieImport/ChromeCookieImport.ipc.js')
|
|
17
15
|
case ModuleId.ClipBoard:
|
|
18
16
|
return import('../ClipBoard/ClipBoard.ipc.js')
|
|
19
17
|
case ModuleId.ContentSecurityPolicy:
|
|
@@ -80,6 +80,5 @@ export const HandleMessagePortForAuthProcess = 86
|
|
|
80
80
|
export const LanguageServer = 87
|
|
81
81
|
export const SendMessagePortToMainProcess = 88
|
|
82
82
|
export const SecretStorage = 89
|
|
83
|
-
export const ChromeCookieImport = 90
|
|
84
83
|
export const FirefoxCookieImport = 91
|
|
85
84
|
export const IpcTrace = 92
|
|
@@ -18,9 +18,6 @@ export const getModuleId = (commandId) => {
|
|
|
18
18
|
return ModuleId.AutoUpdaterWindowsNsis
|
|
19
19
|
case 'BulkReplacement.applyBulkReplacement':
|
|
20
20
|
return ModuleId.BulkReplacement
|
|
21
|
-
case 'ChromeCookieImport.getInfo':
|
|
22
|
-
case 'ChromeCookieImport.importCookies':
|
|
23
|
-
return ModuleId.ChromeCookieImport
|
|
24
21
|
case 'ChromeExtension.install':
|
|
25
22
|
case 'ChromeExtension.uninstall':
|
|
26
23
|
return ModuleId.ChromeExtension
|
|
@@ -3,14 +3,13 @@ import { pathToFileURL } from 'node:url'
|
|
|
3
3
|
const windowsFileUriRegex = /^file:\/\/\/([a-z])(?::|%3a)(?=\/|$)/i
|
|
4
4
|
|
|
5
5
|
const normalizeRemoteFileUrl = (uri) => {
|
|
6
|
-
|
|
7
|
-
const url = new URL(uri)
|
|
8
|
-
if ((url.protocol === 'http:' || url.protocol === 'https:') && url.pathname.startsWith('/remote/')) {
|
|
9
|
-
return `file://${url.pathname.slice('/remote'.length)}`
|
|
10
|
-
}
|
|
11
|
-
} catch {
|
|
6
|
+
if (!URL.canParse(uri)) {
|
|
12
7
|
return undefined
|
|
13
8
|
}
|
|
9
|
+
const url = new URL(uri)
|
|
10
|
+
if ((url.protocol === 'http:' || url.protocol === 'https:') && url.pathname.startsWith('/remote/')) {
|
|
11
|
+
return `file://${url.pathname.slice('/remote'.length)}`
|
|
12
|
+
}
|
|
14
13
|
return undefined
|
|
15
14
|
}
|
|
16
15
|
|
|
@@ -61,11 +61,11 @@ export const getSetupName = () => {
|
|
|
61
61
|
return 'Lvce-Setup'
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export const version = '0.106.
|
|
64
|
+
export const version = '0.106.4'
|
|
65
65
|
|
|
66
|
-
export const commit = '
|
|
66
|
+
export const commit = '71bebb6'
|
|
67
67
|
|
|
68
|
-
export const date = '2026-08-
|
|
68
|
+
export const date = '2026-08-22T16:15:27.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', '71bebb6', 'packages', 'preload', 'dist', 'index.js')
|
|
6
6
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as MainProcess from '../MainProcess/MainProcess.js'
|
|
2
|
-
|
|
3
|
-
export const getInfo = () => {
|
|
4
|
-
return MainProcess.invoke('ChromeCookieImport.getInfo')
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const importCookies = () => {
|
|
8
|
-
return MainProcess.invoke('ChromeCookieImport.importCookies')
|
|
9
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import MarkdownIt from 'markdown-it'
|
|
2
|
-
import { readFile, readdir, stat } from 'node:fs/promises'
|
|
3
|
-
import { isAbsolute, relative, resolve, sep } from 'node:path'
|
|
4
|
-
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const markdownFileExtensions = new Set(['.markdown', '.md', '.mdown', '.mdtext', '.mdtxt', '.mdwn', '.mkd', '.mkdn'])
|
|
21
|
-
const ignoredDirectories = new Set(['.git', 'node_modules'])
|
|
22
|
-
const markdownIt = new MarkdownIt({ html: true })
|
|
23
|
-
|
|
24
|
-
export const isMarkdownLanguageServerRequest = (method) => {
|
|
25
|
-
return (
|
|
26
|
-
method === 'markdown/parse' ||
|
|
27
|
-
method === 'markdown/fs/readFile' ||
|
|
28
|
-
method === 'markdown/fs/readDirectory' ||
|
|
29
|
-
method === 'markdown/fs/stat' ||
|
|
30
|
-
method === 'markdown/fs/watcher/create' ||
|
|
31
|
-
method === 'markdown/fs/watcher/delete' ||
|
|
32
|
-
method === 'markdown/findMarkdownFilesInWorkspace'
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const getWorkspacePath = (uri, rootUri) => {
|
|
37
|
-
const rootPath = resolve(fileURLToPath(rootUri))
|
|
38
|
-
const targetPath = resolve(fileURLToPath(uri))
|
|
39
|
-
const relativePath = relative(rootPath, targetPath)
|
|
40
|
-
if (relativePath === '..' || relativePath.startsWith(`..${sep}`) || isAbsolute(relativePath)) {
|
|
41
|
-
throw new Error(`Language server file request is outside the workspace`)
|
|
42
|
-
}
|
|
43
|
-
return targetPath
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const getMarkdownText = async (params, context) => {
|
|
47
|
-
if (typeof params.text === 'string') {
|
|
48
|
-
return params.text
|
|
49
|
-
}
|
|
50
|
-
if (!params.uri) {
|
|
51
|
-
throw new Error(`Markdown parse request is missing a uri`)
|
|
52
|
-
}
|
|
53
|
-
const document = context.documents.get(params.uri)
|
|
54
|
-
if (document) {
|
|
55
|
-
return document.text
|
|
56
|
-
}
|
|
57
|
-
const path = getWorkspacePath(params.uri, context.rootUri)
|
|
58
|
-
return readFile(path, 'utf8')
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const findMarkdownFiles = async (rootPath) => {
|
|
62
|
-
const result = []
|
|
63
|
-
const visit = async (directory) => {
|
|
64
|
-
const entries = await readdir(directory, { withFileTypes: true })
|
|
65
|
-
await Promise.all(
|
|
66
|
-
entries.map(async (entry) => {
|
|
67
|
-
const path = resolve(directory, entry.name)
|
|
68
|
-
if (entry.isDirectory()) {
|
|
69
|
-
if (ignoredDirectories.has(entry.name)) {
|
|
70
|
-
return
|
|
71
|
-
}
|
|
72
|
-
await visit(path)
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
|
-
const extensionIndex = entry.name.lastIndexOf('.')
|
|
76
|
-
const extension = extensionIndex === -1 ? '' : entry.name.slice(extensionIndex).toLowerCase()
|
|
77
|
-
if (markdownFileExtensions.has(extension)) {
|
|
78
|
-
result.push(pathToFileURL(path).href)
|
|
79
|
-
}
|
|
80
|
-
}),
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
await visit(rootPath)
|
|
84
|
-
return result.sort()
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export const executeMarkdownLanguageServerRequest = async (
|
|
88
|
-
method,
|
|
89
|
-
params,
|
|
90
|
-
context,
|
|
91
|
-
) => {
|
|
92
|
-
if (method === 'markdown/parse') {
|
|
93
|
-
return markdownIt.parse(await getMarkdownText(params, context), {})
|
|
94
|
-
}
|
|
95
|
-
if (method === 'markdown/findMarkdownFilesInWorkspace') {
|
|
96
|
-
return findMarkdownFiles(getWorkspacePath(context.rootUri, context.rootUri))
|
|
97
|
-
}
|
|
98
|
-
if (method === 'markdown/fs/watcher/create' || method === 'markdown/fs/watcher/delete') {
|
|
99
|
-
return null
|
|
100
|
-
}
|
|
101
|
-
if (!params.uri) {
|
|
102
|
-
throw new Error(`Markdown file request is missing a uri`)
|
|
103
|
-
}
|
|
104
|
-
const path = getWorkspacePath(params.uri, context.rootUri)
|
|
105
|
-
if (method === 'markdown/fs/readFile') {
|
|
106
|
-
return [...(await readFile(path))]
|
|
107
|
-
}
|
|
108
|
-
if (method === 'markdown/fs/readDirectory') {
|
|
109
|
-
const entries = await readdir(path, { withFileTypes: true })
|
|
110
|
-
return entries.map((entry) => [entry.name, { isDirectory: entry.isDirectory() }])
|
|
111
|
-
}
|
|
112
|
-
if (method === 'markdown/fs/stat') {
|
|
113
|
-
try {
|
|
114
|
-
const fileStat = await stat(path)
|
|
115
|
-
return { isDirectory: fileStat.isDirectory() }
|
|
116
|
-
} catch {
|
|
117
|
-
return undefined
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
throw new Error(`Unsupported Markdown language server request: ${method}`)
|
|
121
|
-
}
|