@lvce-editor/shared-process 0.121.6 → 0.121.9
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 +1 -1
- package/src/parts/AddCustomPathsToIndexHtml/AddCustomPathsToIndexHtml.js +17 -6
- package/src/parts/BuiltinExtensionsPath/BuiltinExtensionsPath.js +1 -1
- package/src/parts/ExportStatic/ExportStatic.js +15 -2
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/PreloadUrl/PreloadUrl.js +1 -1
- package/src/parts/Workers/Workers.json +1 -1
package/package.json
CHANGED
|
@@ -5,9 +5,18 @@ import * as Platform from '../Platform/Platform.js'
|
|
|
5
5
|
import * as Preferences from '../Preferences/Preferences.js'
|
|
6
6
|
|
|
7
7
|
const configElementPattern = /(<script\b[^>]*\bid=["']Config["'][^>]*>)([\s\S]*?)(<\/script>)/i
|
|
8
|
+
const whitespaceOnlyPattern = /^\s*$/
|
|
8
9
|
|
|
9
|
-
const
|
|
10
|
-
|
|
10
|
+
const getHtmlIndentation = (content, index) => {
|
|
11
|
+
const lineStart = content.lastIndexOf('\n', index - 1) + 1
|
|
12
|
+
const indentation = content.slice(lineStart, index)
|
|
13
|
+
return whitespaceOnlyPattern.test(indentation) ? indentation : ''
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const serializeConfig = (config, indentation) => {
|
|
17
|
+
const json = JSON.stringify(config, null, 2).replaceAll('<', '\\u003c').replaceAll('>', '\\u003e').replaceAll('&', '\\u0026')
|
|
18
|
+
const contentIndentation = `${indentation} `
|
|
19
|
+
return `${contentIndentation}${json.replaceAll('\n', `\n${contentIndentation}`)}`
|
|
11
20
|
}
|
|
12
21
|
|
|
13
22
|
export const addCustomPathsToIndexHtml = async (content, runtimeConfig = {}) => {
|
|
@@ -41,15 +50,17 @@ export const addCustomPathsToIndexHtml = async (content, runtimeConfig
|
|
|
41
50
|
}
|
|
42
51
|
: {}),
|
|
43
52
|
}
|
|
44
|
-
newContent = newContent.toString().replace(configElementPattern, (_match, openingTag, _config, closingTag) => {
|
|
45
|
-
|
|
53
|
+
newContent = newContent.toString().replace(configElementPattern, (_match, openingTag, _config, closingTag, index) => {
|
|
54
|
+
const indentation = getHtmlIndentation(newContent.toString(), index)
|
|
55
|
+
return `${openingTag}\n${serializeConfig(mergedConfig, indentation)}\n${indentation}${closingTag}`
|
|
46
56
|
})
|
|
47
57
|
} else {
|
|
48
|
-
const stringifiedConfig = serializeConfig(config)
|
|
49
58
|
newContent = newContent.toString().replace(
|
|
50
59
|
'</title>',
|
|
51
60
|
`</title>
|
|
52
|
-
<script type="application/json" id="Config"
|
|
61
|
+
<script type="application/json" id="Config">
|
|
62
|
+
${serializeConfig(config, ' ')}
|
|
63
|
+
</script>`,
|
|
53
64
|
)
|
|
54
65
|
}
|
|
55
66
|
return newContent
|
|
@@ -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', '1d11c2f', 'extensions')
|
|
7
7
|
return builtinExtensionsPath
|
|
8
8
|
}
|
|
@@ -14,6 +14,7 @@ const importFromTsRegex = /(from\s+['"][^'"]+)\.ts(['"])/g
|
|
|
14
14
|
const sideEffectImportTsRegex = /(import\s+['"][^'"]+)\.ts(['"])/g
|
|
15
15
|
const dynamicImportTsRegex = /(import\(\s*['"][^'"]+)\.ts(['"]\s*\))/g
|
|
16
16
|
const runtimeConfigScriptRegex = /<script id="Config" type="application\/json">([\s\S]*?)<\/script>/
|
|
17
|
+
const whitespaceOnlyRegex = /^\s*$/
|
|
17
18
|
|
|
18
19
|
const staticContentSecurityPolicy = GetContentSecurityPolicy.getContentSecurityPolicy([
|
|
19
20
|
`default-src 'none'`,
|
|
@@ -160,8 +161,17 @@ const applyRuntimeConfigOverrides = async ({ root } ) => {
|
|
|
160
161
|
}
|
|
161
162
|
const config = JSON.parse(configElement[1])
|
|
162
163
|
config.platform = 'web'
|
|
163
|
-
const
|
|
164
|
-
const
|
|
164
|
+
const configIndex = content.indexOf(configElement[0])
|
|
165
|
+
const lineStart = content.lastIndexOf('\n', configIndex - 1) + 1
|
|
166
|
+
const lineIndentation = content.slice(lineStart, configIndex)
|
|
167
|
+
const indentation = whitespaceOnlyRegex.test(lineIndentation) ? lineIndentation : ''
|
|
168
|
+
const contentIndentation = `${indentation} `
|
|
169
|
+
const serializedConfig = `${contentIndentation}${JSON.stringify(config, null, 2)
|
|
170
|
+
.replaceAll('<', '\\u003c')
|
|
171
|
+
.replaceAll('>', '\\u003e')
|
|
172
|
+
.replaceAll('&', '\\u0026')
|
|
173
|
+
.replaceAll('\n', `\n${contentIndentation}`)}`
|
|
174
|
+
const newContent = content.replace(configElement[0], `<script id="Config" type="application/json">\n${serializedConfig}\n${indentation}</script>`)
|
|
165
175
|
await writeFile(indexHtmlPath, newContent)
|
|
166
176
|
}
|
|
167
177
|
|
|
@@ -821,6 +831,9 @@ export const exportStatic = async ({
|
|
|
821
831
|
})
|
|
822
832
|
console.timeEnd('addTestFiles')
|
|
823
833
|
}
|
|
834
|
+
const chatPath = Path.join(root, 'dist', 'chat')
|
|
835
|
+
await FileSystem.mkdir(chatPath)
|
|
836
|
+
await FileSystem.copyFile(Path.join(root, 'dist', 'index.html'), Path.join(chatPath, 'index.html'))
|
|
824
837
|
return {
|
|
825
838
|
commitHash,
|
|
826
839
|
}
|
|
@@ -56,11 +56,11 @@ export const getSetupName = () => {
|
|
|
56
56
|
return 'Lvce-Setup'
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export const version = '0.121.
|
|
59
|
+
export const version = '0.121.9'
|
|
60
60
|
|
|
61
|
-
export const commit = '
|
|
61
|
+
export const commit = '1d11c2f'
|
|
62
62
|
|
|
63
|
-
export const date = '2026-10-
|
|
63
|
+
export const date = '2026-10-09T11:15:03.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', '1d11c2f', 'packages', 'preload', 'dist', 'index.js')
|
|
6
6
|
}
|
|
@@ -1966,7 +1966,7 @@
|
|
|
1966
1966
|
"contentSecurityPolicy": ["default-src 'none'", "script-src 'self'", "sandbox allow-same-origin"],
|
|
1967
1967
|
"defaultPath": "/packages/renderer-worker/node_modules/@lvce-editor/syntax-highlighting-worker/dist/syntaxHighlightingWorkerMain.js",
|
|
1968
1968
|
"productionPath": "/packages/syntax-highlighting-worker/dist/syntaxHighlightingWorkerMain.js",
|
|
1969
|
-
"settingName": "
|
|
1969
|
+
"settingName": "develop.syntaxHighlightingWorkerPath",
|
|
1970
1970
|
"hotReloadCommand": ""
|
|
1971
1971
|
},
|
|
1972
1972
|
{
|