@lvce-editor/shared-process 0.68.2 → 0.68.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.68.2",
3
+ "version": "0.68.4",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,12 +18,12 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "1.4.0",
21
- "@lvce-editor/extension-host-helper-process": "0.68.2",
21
+ "@lvce-editor/extension-host-helper-process": "0.68.4",
22
22
  "@lvce-editor/ipc": "14.6.0",
23
23
  "@lvce-editor/json-rpc": "7.0.0",
24
24
  "@lvce-editor/jsonc-parser": "1.5.0",
25
25
  "@lvce-editor/pretty-error": "2.0.0",
26
- "@lvce-editor/rpc-registry": "5.1.0",
26
+ "@lvce-editor/rpc-registry": "5.2.0",
27
27
  "@lvce-editor/verror": "1.7.0",
28
28
  "is-object": "^1.0.2",
29
29
  "xdg-basedir": "^5.1.0"
@@ -35,7 +35,7 @@
35
35
  "@lvce-editor/network-process": "5.2.0",
36
36
  "@lvce-editor/preload": "1.5.0",
37
37
  "@lvce-editor/preview-process": "11.0.0",
38
- "@lvce-editor/pty-host": "5.5.0",
38
+ "@lvce-editor/pty-host": "6.1.0",
39
39
  "@lvce-editor/search-process": "12.0.0",
40
40
  "@lvce-editor/typescript-compile-process": "4.1.0",
41
41
  "open": "^11.0.0",
@@ -2,6 +2,6 @@ import { join } from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
  export const getBuiltinExtensionsPath = () => {
4
4
  const staticServerPath = fileURLToPath(import.meta.resolve('@lvce-editor/static-server'));
5
- const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '931b401', 'extensions');
5
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '4a1121b', 'extensions');
6
6
  return builtinExtensionsPath;
7
7
  };
@@ -411,7 +411,7 @@ export const createFilemap = async (fixturesPath) => {
411
411
  };
412
412
  export const createFilemapsPerFixture = async (fixturesPath) => {
413
413
  const dirents = await readdir(fixturesPath, { withFileTypes: true });
414
- const fixtureDirectories = dirents.filter(dirent => dirent.isDirectory());
414
+ const fixtureDirectories = dirents.filter((dirent) => dirent.isDirectory());
415
415
  // Create filemaps in parallel
416
416
  await Promise.all(fixtureDirectories.map(async (dirent) => {
417
417
  const fixturePath = join(fixturesPath, dirent.name);
@@ -17,16 +17,28 @@ export const getElectronFileResponse = async (url, request) => {
17
17
  const pathName = GetElectronFileResponseRelativePath.getElectronFileResponseRelativePath(url);
18
18
  let absolutePath = GetElectronFileResponseAbsolutePath.getElectronFileResponseAbsolutePath(pathName);
19
19
  let etag;
20
+ let stats;
20
21
  // TODO when is there no request?
21
22
  if (request) {
22
- etag = await GetPathEtag.getPathEtag(absolutePath);
23
+ const info = await GetPathEtag.getPathEtag(absolutePath);
24
+ etag = info.etag;
25
+ stats = info.stats;
26
+ let size = stats.size;
27
+ if (absolutePath.endsWith('.html')) {
28
+ // TODO since dynamic data is injected to the stat size is not accurate
29
+ // which is why this workaround is needed
30
+ // but it's a bit inefficient
31
+ const content = await GetElectronFileResponseContent.getElectronFileResponseContent(request, absolutePath, url);
32
+ size = content.byteLength;
33
+ }
23
34
  if (request.headers[HttpHeader.IfNotMatch] === etag) {
24
- const headers = await GetHeaders.getHeaders(absolutePath, pathName, etag, url);
35
+ const headers = await GetHeaders.getHeaders(absolutePath, pathName, etag, url, size);
25
36
  return GetNotModifiedResponse.getNotModifiedResponse(headers);
26
37
  }
27
38
  }
28
39
  const content = await GetElectronFileResponseContent.getElectronFileResponseContent(request, absolutePath, url);
29
- const headers = await GetHeaders.getHeaders(absolutePath, pathName, etag, url);
40
+ const size = content.byteLength;
41
+ const headers = await GetHeaders.getHeaders(absolutePath, pathName, etag, url, size);
30
42
  headers[HttpHeader.CacheControl] = 'public, max-age=0, must-revalidate';
31
43
  return GetContentResponse.getContentResponse(content, headers);
32
44
  }
@@ -5,11 +5,12 @@ import * as GetExtraHeaders from '../GetExtraHeaders/GetExtraHeaders.js';
5
5
  import * as ContentSecurityPolicyState from '../ContentSecurityPolicyState/ContentSecurityPolicyState.js';
6
6
  import * as GetMimeType from '../GetMimeType/GetMimeType.js';
7
7
  import * as HttpHeader from '../HttpHeader/HttpHeader.js';
8
- export const getHeaders = async (absolutePath, pathName, etag, url) => {
8
+ export const getHeaders = async (absolutePath, pathName, etag, url, size) => {
9
9
  const extension = extname(absolutePath);
10
10
  const mime = GetMimeType.getMimeType(extension);
11
11
  const headers = {
12
12
  [HttpHeader.ContentType]: mime,
13
+ [HttpHeader.ContentLength]: `${size}`,
13
14
  [HttpHeader.CrossOriginResourcePolicy]: CrossOriginResourcePolicy.value,
14
15
  [HttpHeader.CrossOriginEmbedderPolicy]: CrossOriginEmbedderPolicy.value,
15
16
  };
@@ -7,5 +7,5 @@ export const getPathEtag = async (absolutePath) => {
7
7
  stats = await stat(absolutePath);
8
8
  }
9
9
  const etag = GetEtag.getEtag(stats);
10
- return etag;
10
+ return { etag, stats };
11
11
  };
@@ -1,5 +1,6 @@
1
1
  export const CacheControl = 'Cache-Control';
2
2
  export const ContentType = 'Content-Type';
3
+ export const ContentLength = 'Content-Length';
3
4
  export const ContentSecurityPolicy = 'Content-Security-Policy';
4
5
  export const CrossOriginEmbedderPolicy = 'Cross-Origin-Embedder-Policy';
5
6
  export const CrossOriginOpenerPolicy = 'Cross-Origin-Opener-Policy';
@@ -1,3 +1,4 @@
1
+ import { existsSync } from 'node:fs';
1
2
  import * as HandleIpc from '../HandleIpc/HandleIpc.js';
2
3
  import * as IpcId from '../IpcId/IpcId.js';
3
4
  import * as IpcParent from '../IpcParent/IpcParent.js';
@@ -10,7 +11,10 @@ const getConfiguredUrl = async (settingName, defaultPath) => {
10
11
  }
11
12
  const allPreferences = await Preferences.getAll();
12
13
  const processPath = allPreferences[settingName] || defaultPath;
13
- return processPath;
14
+ if (existsSync(processPath)) {
15
+ return processPath;
16
+ }
17
+ return defaultPath;
14
18
  };
15
19
  export const launchProcess = async ({ settingName, defaultPath, targetRpcId, name, isElectron }) => {
16
20
  const path = await getConfiguredUrl(settingName, defaultPath);
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
41
41
  export const getSetupName = () => {
42
42
  return 'Lvce-Setup';
43
43
  };
44
- export const version = '0.68.2';
45
- export const commit = '931b401';
46
- export const date = '2025-11-27T12:05:38.000Z';
44
+ export const version = '0.68.4';
45
+ export const commit = '4a1121b';
46
+ export const date = '2025-12-03T15:07:45.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };