@lvce-editor/shared-process 0.21.5 → 0.21.6
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 +5 -5
- package/src/parts/ExportStatic/ExportStatic.js +0 -1
- package/src/parts/GetElectronFileResponse/GetElectronFileResponse.js +29 -15
- package/src/parts/GetMimeType/GetMimeType.js +2 -0
- package/src/parts/HttpStatusCode/HttpStatusCode.js +2 -0
- package/src/parts/Platform/Platform.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.6",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/code-frame": "^7.23.5",
|
|
21
21
|
"@lvce-editor/assert": "^1.0.1",
|
|
22
|
-
"@lvce-editor/extension-host": "0.21.
|
|
23
|
-
"@lvce-editor/extension-host-helper-process": "0.21.
|
|
22
|
+
"@lvce-editor/extension-host": "0.21.6",
|
|
23
|
+
"@lvce-editor/extension-host-helper-process": "0.21.6",
|
|
24
24
|
"@lvce-editor/json-rpc": "^0.4.0",
|
|
25
25
|
"@lvce-editor/jsonc-parser": "^1.1.0",
|
|
26
26
|
"@lvce-editor/pretty-error": "^1.3.0",
|
|
27
|
-
"@lvce-editor/pty-host": "0.21.
|
|
27
|
+
"@lvce-editor/pty-host": "0.21.6",
|
|
28
28
|
"@lvce-editor/verror": "^1.1.2",
|
|
29
29
|
"debug": "^4.3.4",
|
|
30
30
|
"execa": "^8.0.1",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"optionalDependencies": {
|
|
42
42
|
"@lvce-editor/ripgrep": "^1.0.1",
|
|
43
43
|
"extract-zip": "^2.0.1",
|
|
44
|
-
"open": "^10.0.
|
|
44
|
+
"open": "^10.0.1",
|
|
45
45
|
"symlink-dir": "^5.2.0",
|
|
46
46
|
"tail": "^2.2.6",
|
|
47
47
|
"tmp-promise": "^3.0.3",
|
|
@@ -185,7 +185,6 @@ const applyOverrides = async ({ root, commitHash, pathPrefix }) => {
|
|
|
185
185
|
)
|
|
186
186
|
}
|
|
187
187
|
await replace(Path.join(root, 'dist', 'index.html'), `/${commitHash}`, `${pathPrefix}/${commitHash}`)
|
|
188
|
-
await replace(Path.join(root, 'dist', 'index.html'), `/${commitHash}/manifest.json`, `${pathPrefix}/${commitHash}/manifest.json`)
|
|
189
188
|
|
|
190
189
|
if (pathPrefix) {
|
|
191
190
|
await replace(
|
|
@@ -1,23 +1,37 @@
|
|
|
1
|
-
import { readFile } from 'fs/promises'
|
|
1
|
+
import { readFile } from 'node:fs/promises'
|
|
2
2
|
import * as GetElectronFileResponseAbsolutePath from '../GetElectronFileResponseAbsolutePath/GetElectronFileResponseAbsolutePath.js'
|
|
3
3
|
import * as GetElectronFileResponseRelativePath from '../GetElectronFileResponseRelativePath/GetElectronFileResponseRelativePath.js'
|
|
4
4
|
import * as GetHeaders from '../GetHeaders/GetHeaders.js'
|
|
5
|
+
import * as HttpStatusCode from '../HttpStatusCode/HttpStatusCode.js'
|
|
6
|
+
import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js'
|
|
5
7
|
import * as Platform from '../Platform/Platform.js'
|
|
6
8
|
|
|
7
9
|
export const getElectronFileResponse = async (url) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
try {
|
|
11
|
+
const pathName = GetElectronFileResponseRelativePath.getElectronFileResponseRelativePath(url)
|
|
12
|
+
const absolutePath = GetElectronFileResponseAbsolutePath.getElectronFileResponseAbsolutePath(pathName)
|
|
13
|
+
let content = await readFile(absolutePath)
|
|
14
|
+
if (!Platform.isProduction && url === `${Platform.scheme}://-/`) {
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
content = content.toString().replace(' <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />\n', '')
|
|
17
|
+
}
|
|
18
|
+
const headers = GetHeaders.getHeaders(absolutePath)
|
|
19
|
+
return {
|
|
20
|
+
body: content,
|
|
21
|
+
init: {
|
|
22
|
+
status: HttpStatusCode.Ok,
|
|
23
|
+
headers,
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if (IsEnoentError.isEnoentError(error)) {
|
|
28
|
+
return {
|
|
29
|
+
body: 'not-found',
|
|
30
|
+
init: {
|
|
31
|
+
status: HttpStatusCode.NotFound,
|
|
32
|
+
statusText: 'not-found',
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
}
|
|
22
36
|
}
|
|
23
37
|
}
|
|
@@ -16,6 +16,8 @@ export const getMimeType = (fileExtension) => {
|
|
|
16
16
|
return MimeType.ImagePng
|
|
17
17
|
case '.json':
|
|
18
18
|
return MimeType.ApplicationJson
|
|
19
|
+
case '.mp3':
|
|
20
|
+
return MimeType.AudioMpeg
|
|
19
21
|
default:
|
|
20
22
|
console.warn(`unsupported file extension: ${fileExtension}`)
|
|
21
23
|
return ''
|
|
@@ -61,11 +61,11 @@ export const getSetupName = () => {
|
|
|
61
61
|
return 'Lvce-Setup'
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export const version = '0.21.
|
|
64
|
+
export const version = '0.21.6'
|
|
65
65
|
|
|
66
|
-
export const commit = '
|
|
66
|
+
export const commit = 'f4cb33e'
|
|
67
67
|
|
|
68
|
-
export const date = '2023-12-
|
|
68
|
+
export const date = '2023-12-23T22:04:56.000Z'
|
|
69
69
|
|
|
70
70
|
export const getVersion = () => {
|
|
71
71
|
return version
|