@lvce-editor/shared-process 0.120.13 → 0.120.15
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/config/defaultSettings.json +1 -0
- package/package.json +4 -4
- package/src/parts/AddCustomPathsToIndexHtml/AddCustomPathsToIndexHtml.js +6 -2
- package/src/parts/BuiltinExtensionsPath/BuiltinExtensionsPath.js +1 -1
- package/src/parts/ExportStatic/ExportStatic.js +80 -16
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/PreloadUrl/PreloadUrl.js +1 -1
- package/src/parts/Workers/Workers.json +1 -1
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
"workbench.editor.showTabsWhileLoading": false,
|
|
91
91
|
"workbench.sideBar.visible": true,
|
|
92
92
|
"workbench.sideBarLocation": "right",
|
|
93
|
+
"workbench.panel.alignment": "justify",
|
|
93
94
|
"workbench.saveStateOnVisibilityChange": true,
|
|
94
95
|
|
|
95
96
|
"workspace.defaultWorkspace": "fetch:///playground",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.120.
|
|
3
|
+
"version": "0.120.15",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lvce-editor/assert": "1.9.0",
|
|
21
21
|
"@lvce-editor/file-watcher-explorer": "0.1.1",
|
|
22
|
-
"@lvce-editor/ipc": "16.
|
|
22
|
+
"@lvce-editor/ipc": "16.13.0",
|
|
23
23
|
"@lvce-editor/json-rpc": "8.9.0",
|
|
24
24
|
"@lvce-editor/jsonc-parser": "1.5.2",
|
|
25
25
|
"@lvce-editor/pretty-error": "2.0.2",
|
|
26
|
-
"@lvce-editor/process-explorer": "3.
|
|
26
|
+
"@lvce-editor/process-explorer": "3.33.0",
|
|
27
27
|
"@lvce-editor/rpc-registry": "9.66.0",
|
|
28
28
|
"@lvce-editor/verror": "1.7.0",
|
|
29
29
|
"is-object": "^1.0.2",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"optionalDependencies": {
|
|
33
33
|
"@lvce-editor/auth-process": "1.18.0",
|
|
34
34
|
"@lvce-editor/cookie-import-view": "0.3.2",
|
|
35
|
-
"@lvce-editor/embeds-process": "4.
|
|
35
|
+
"@lvce-editor/embeds-process": "4.25.0",
|
|
36
36
|
"@lvce-editor/file-system-process": "5.17.1",
|
|
37
37
|
"@lvce-editor/file-watcher-process": "4.14.0",
|
|
38
38
|
"@lvce-editor/network-process": "5.2.0",
|
|
@@ -6,6 +6,10 @@ import * as Preferences from '../Preferences/Preferences.js'
|
|
|
6
6
|
|
|
7
7
|
const configElementPattern = /(<script\b[^>]*\bid=["']Config["'][^>]*>)([\s\S]*?)(<\/script>)/i
|
|
8
8
|
|
|
9
|
+
const serializeConfig = (config) => {
|
|
10
|
+
return JSON.stringify(config, null, 2).replaceAll('<', '\\u003c').replaceAll('>', '\\u003e').replaceAll('&', '\\u0026')
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
export const addCustomPathsToIndexHtml = async (content, runtimeConfig = {}) => {
|
|
10
14
|
let preferences = {}
|
|
11
15
|
if (!Platform.isProduction) {
|
|
@@ -38,10 +42,10 @@ export const addCustomPathsToIndexHtml = async (content, runtimeConfig
|
|
|
38
42
|
: {}),
|
|
39
43
|
}
|
|
40
44
|
newContent = newContent.toString().replace(configElementPattern, (_match, openingTag, _config, closingTag) => {
|
|
41
|
-
return `${openingTag}${
|
|
45
|
+
return `${openingTag}${serializeConfig(mergedConfig)}${closingTag}`
|
|
42
46
|
})
|
|
43
47
|
} else {
|
|
44
|
-
const stringifiedConfig =
|
|
48
|
+
const stringifiedConfig = serializeConfig(config)
|
|
45
49
|
newContent = newContent.toString().replace(
|
|
46
50
|
'</title>',
|
|
47
51
|
`</title>
|
|
@@ -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', 'ac72879', 'extensions')
|
|
7
7
|
return builtinExtensionsPath
|
|
8
8
|
}
|
|
@@ -46,6 +46,13 @@ const replace = async (path, occurrence, replacement) => {
|
|
|
46
46
|
await FileSystem.writeFile(path, newContent)
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
const replaceIfPresent = async (path, occurrence, replacement) => {
|
|
50
|
+
const content = await FileSystem.readFile(path)
|
|
51
|
+
if (content.includes(occurrence)) {
|
|
52
|
+
await FileSystem.writeFile(path, content.replaceAll(occurrence, replacement))
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
49
56
|
const getWorkerById = (id) => {
|
|
50
57
|
const worker = workers.find((item) => {
|
|
51
58
|
return item.id === id
|
|
@@ -262,11 +269,11 @@ const applyOverrides = async ({ commitHash, pathPrefix, root, serverStaticPath }
|
|
|
262
269
|
}
|
|
263
270
|
|
|
264
271
|
const addExtensionSeo = async ({ commitHash, description, name, root } ) => {
|
|
265
|
-
await
|
|
266
|
-
await
|
|
267
|
-
await
|
|
268
|
-
await
|
|
269
|
-
await
|
|
272
|
+
await replaceIfPresent(Path.join(root, 'dist', 'index.html'), '<title>Lvce Editor</title>', `<title>${name}</title>`)
|
|
273
|
+
await replaceIfPresent(Path.join(root, 'dist', commitHash, 'manifest.json'), `"name": "Code Editor Web - OSS"`, `"name": "${name}"`)
|
|
274
|
+
await replaceIfPresent(Path.join(root, 'dist', commitHash, 'manifest.json'), `"short_name": "Web - OSS"`, `"short_name": "${name}"`)
|
|
275
|
+
await replaceIfPresent(Path.join(root, 'dist', commitHash, 'manifest.json'), `"description": "Web Code Editor."`, `"description": "${description}"`)
|
|
276
|
+
await replaceIfPresent(
|
|
270
277
|
Path.join(root, 'dist', 'index.html'),
|
|
271
278
|
'<meta name="description" content="VS Code inspired text editor that mostly runs in a webworker." />',
|
|
272
279
|
`<meta name="description" content="${description}" />`,
|
|
@@ -393,6 +400,60 @@ export const mergeExtensionManifests = (manifests, extraExtensions) => {
|
|
|
393
400
|
return merged
|
|
394
401
|
}
|
|
395
402
|
|
|
403
|
+
const getWebExtensionId = (webExtension) => {
|
|
404
|
+
if (typeof webExtension === 'string') {
|
|
405
|
+
return webExtension.split('/').filter(Boolean).at(-1) || ''
|
|
406
|
+
}
|
|
407
|
+
return webExtension.id
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export const mergeWebExtensionManifests = (webExtensions, extraExtensions) => {
|
|
411
|
+
const merged = []
|
|
412
|
+
const indexes = new Map ()
|
|
413
|
+
for (const webExtension of [...webExtensions, ...extraExtensions]) {
|
|
414
|
+
const id = getWebExtensionId(webExtension)
|
|
415
|
+
const existingIndex = indexes.get(id)
|
|
416
|
+
if (existingIndex === undefined) {
|
|
417
|
+
indexes.set(id, merged.length)
|
|
418
|
+
merged.push(webExtension)
|
|
419
|
+
} else {
|
|
420
|
+
merged[existingIndex] = webExtension
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return merged
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
const copyBuiltinWebExtensions = async ({ commitHash, pathPrefix, root } ) => {
|
|
427
|
+
const extensionsPath = join(process.cwd(), 'extensions')
|
|
428
|
+
if (!existsSync(extensionsPath)) {
|
|
429
|
+
return
|
|
430
|
+
}
|
|
431
|
+
const extensionDirents = await FileSystem.readDir(extensionsPath)
|
|
432
|
+
const builtinWebExtensions = []
|
|
433
|
+
for (const extensionDirent of extensionDirents) {
|
|
434
|
+
const extensionPath = Path.join(extensionsPath, extensionDirent)
|
|
435
|
+
const manifestPath = Path.join(extensionPath, 'extension.json')
|
|
436
|
+
if (!existsSync(manifestPath)) {
|
|
437
|
+
continue
|
|
438
|
+
}
|
|
439
|
+
const extensionJson = await readExtensionManifest(manifestPath)
|
|
440
|
+
const isLanguageBasicsExtension = isLanguageBasics(extensionDirent)
|
|
441
|
+
if (extensionJson.compatibility?.web === false || (!extensionJson.browser && !isLanguageBasicsExtension)) {
|
|
442
|
+
continue
|
|
443
|
+
}
|
|
444
|
+
await FileSystem.copy(extensionPath, Path.join(root, 'dist', commitHash, 'extensions', extensionDirent))
|
|
445
|
+
builtinWebExtensions.push({
|
|
446
|
+
...extensionJson,
|
|
447
|
+
isWeb: true,
|
|
448
|
+
path: `${pathPrefix}/${commitHash}/extensions/${extensionDirent}`,
|
|
449
|
+
})
|
|
450
|
+
}
|
|
451
|
+
const webExtensionsPath = Path.join(root, 'dist', commitHash, 'config', 'webExtensions.json')
|
|
452
|
+
const existingWebExtensions = await JsonFile.readJson(webExtensionsPath)
|
|
453
|
+
const webExtensions = mergeWebExtensionManifests(existingWebExtensions, builtinWebExtensions)
|
|
454
|
+
await JsonFile.writeJson(webExtensionsPath, webExtensions)
|
|
455
|
+
}
|
|
456
|
+
|
|
396
457
|
const updateExtensionsJson = async ({ commitHash, extraExtensions, pathPrefix, root } ) => {
|
|
397
458
|
const dirents = await FileSystem.readDir(Path.join(root, 'dist', commitHash, 'extensions'))
|
|
398
459
|
const manifests = await Promise.all(
|
|
@@ -429,23 +490,25 @@ const addExtensionWebExtension = async ({
|
|
|
429
490
|
return
|
|
430
491
|
}
|
|
431
492
|
const webExtensionPath = `${pathPrefix}/${commitHash}/extensions/${extensionJson.id}`
|
|
493
|
+
const webExtensionsPath = Path.join(root, 'dist', commitHash, 'config', 'webExtensions.json')
|
|
494
|
+
const existingWebExtensions = await JsonFile.readJson(webExtensionsPath)
|
|
432
495
|
if (useSimpleWebExtensionFile) {
|
|
433
|
-
const webExtensions =
|
|
496
|
+
const webExtensions = mergeWebExtensionManifests(
|
|
497
|
+
existingWebExtensions.map((webExtension) => (typeof webExtension === 'string' ? webExtension : webExtension.path)),
|
|
498
|
+
[webExtensionPath],
|
|
499
|
+
)
|
|
434
500
|
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'webExtensions.json'), webExtensions)
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
const webExtensions = [
|
|
438
|
-
{
|
|
501
|
+
} else {
|
|
502
|
+
const webExtension = {
|
|
439
503
|
...extensionJson,
|
|
440
504
|
isWeb: true,
|
|
441
505
|
path: webExtensionPath,
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
await FileSystem.forceRemove(Path.join(root, 'dist', commitHash, 'extensions', extensionJson.id))
|
|
446
|
-
for (const dirent of ['src', 'extension.json']) {
|
|
447
|
-
await FileSystem.copy(Path.join(extensionPath, dirent), Path.join(root, 'dist', commitHash, 'extensions', extensionJson.id, dirent))
|
|
506
|
+
}
|
|
507
|
+
const webExtensions = mergeWebExtensionManifests(existingWebExtensions, [webExtension])
|
|
508
|
+
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'webExtensions.json'), webExtensions)
|
|
448
509
|
}
|
|
510
|
+
await FileSystem.forceRemove(Path.join(root, 'dist', commitHash, 'extensions', extensionJson.id))
|
|
511
|
+
await FileSystem.copy(extensionPath, Path.join(root, 'dist', commitHash, 'extensions', extensionJson.id))
|
|
449
512
|
}
|
|
450
513
|
|
|
451
514
|
const addExtension = async ({ commitHash, extensionPath, pathPrefix, root, useSimpleWebExtensionFile } ) => {
|
|
@@ -731,6 +794,7 @@ export const exportStatic = async ({
|
|
|
731
794
|
})
|
|
732
795
|
console.timeEnd('applyOverrides')
|
|
733
796
|
|
|
797
|
+
await copyBuiltinWebExtensions({ commitHash, pathPrefix, root })
|
|
734
798
|
await updateExtensionsJson({ commitHash, extraExtensions: [], pathPrefix, root })
|
|
735
799
|
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'onLoadCommands.json'), onLoadCommands)
|
|
736
800
|
|
|
@@ -56,11 +56,11 @@ export const getSetupName = () => {
|
|
|
56
56
|
return 'Lvce-Setup'
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export const version = '0.120.
|
|
59
|
+
export const version = '0.120.15'
|
|
60
60
|
|
|
61
|
-
export const commit = '
|
|
61
|
+
export const commit = 'ac72879'
|
|
62
62
|
|
|
63
|
-
export const date = '2026-10-
|
|
63
|
+
export const date = '2026-10-06T19:56:19.000Z'
|
|
64
64
|
|
|
65
65
|
export const getVersion = () => {
|
|
66
66
|
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', 'ac72879', 'packages', 'preload', 'dist', 'index.js')
|
|
6
6
|
}
|
|
@@ -1128,7 +1128,7 @@
|
|
|
1128
1128
|
]
|
|
1129
1129
|
},
|
|
1130
1130
|
"loadContent": {
|
|
1131
|
-
"name": "MainArea.
|
|
1131
|
+
"name": "MainArea.loadContentShell",
|
|
1132
1132
|
"parameters": [{ "source": "state", "name": "uid" }, { "source": "argument", "name": "savedState" }]
|
|
1133
1133
|
},
|
|
1134
1134
|
"diff": { "name": "MainArea.diff2", "parameters": [{ "source": "state", "name": "uid" }] },
|