@lvce-editor/shared-process 0.69.4 → 0.70.0

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.69.4",
3
+ "version": "0.70.0",
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.5.1",
21
- "@lvce-editor/extension-host-helper-process": "0.69.4",
21
+ "@lvce-editor/extension-host-helper-process": "0.70.0",
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.3.0",
26
+ "@lvce-editor/rpc-registry": "5.10.0",
27
27
  "@lvce-editor/verror": "1.7.0",
28
28
  "is-object": "^1.0.2",
29
29
  "xdg-basedir": "^5.1.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', '7250be5', 'extensions');
5
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '377d2ba', 'extensions');
6
6
  return builtinExtensionsPath;
7
7
  };
@@ -1,20 +1,24 @@
1
1
  import { existsSync } from 'node:fs';
2
- import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
2
+ import { mkdir, readFile, writeFile } from 'node:fs/promises';
3
3
  import { dirname } from 'node:path';
4
4
  import * as BuiltinExtensionsPath from '../BuiltinExtensionsPath/BuiltinExtensionsPath.js';
5
5
  import * as ExtensionManifestInputType from '../ExtensionManifestInputType/ExtensionManifestInputType.js';
6
6
  import * as ExtensionManifests from '../ExtensionManifests/ExtensionManifests.js';
7
7
  import * as GetEtagFromStats from '../GetEtagFromStats/GetEtagFromStats.js';
8
8
  import * as GetExtensionEtags from '../GetExtensionEtags/GetExtensionEtags.js';
9
- import * as Path from '../Path/Path.js';
10
9
  import * as PlatformPaths from '../PlatformPaths/PlatformPaths.js';
11
10
  import { VError } from '../VError/VError.js';
12
11
  export const enable = async (id) => {
13
12
  try {
14
- const extensionsPath = PlatformPaths.getExtensionsPath();
15
- const disabledExtensionsPath = PlatformPaths.getDisabledExtensionsPath();
16
- await mkdir(extensionsPath, { recursive: true });
17
- await rename(Path.join(disabledExtensionsPath, id), Path.join(extensionsPath, id));
13
+ const disabledExtensionsJsonPath = PlatformPaths.getDisabledExtensionsJsonPath();
14
+ const oldDisabledExtensionIds = await getDisabledExtensionIds();
15
+ if (!oldDisabledExtensionIds.includes(id)) {
16
+ return;
17
+ }
18
+ const newDisabledExtensionIds = oldDisabledExtensionIds.filter((extensionId) => extensionId !== id);
19
+ const content = getNewDisabledExtensionContent(newDisabledExtensionIds);
20
+ await mkdir(dirname(disabledExtensionsJsonPath), { recursive: true });
21
+ await writeFile(disabledExtensionsJsonPath, content);
18
22
  }
19
23
  catch (error) {
20
24
  throw new VError(error, `Failed to enable extension "${id}"`);
@@ -52,18 +52,25 @@ export const readFile = async (path, encoding = EncodingType.Utf8) => {
52
52
  throw new VError(error, `Failed to read file "${path}"`);
53
53
  }
54
54
  };
55
- export const readJson = async (path) => {
55
+ const toPath = (uri) => {
56
+ if (uri.startsWith('file://')) {
57
+ return fileURLToPath(uri);
58
+ }
59
+ return uri;
60
+ };
61
+ export const readJson = async (uri) => {
56
62
  try {
57
- Assert.string(path);
63
+ Assert.string(uri);
64
+ const path = toPath(uri);
58
65
  const content = await fs.readFile(path, 'utf8');
59
66
  const parsed = JSON.parse(content);
60
67
  return parsed;
61
68
  }
62
69
  catch (error) {
63
70
  if (IsEnoentError.isEnoentError(error)) {
64
- throw new FileNotFoundError(path);
71
+ throw new FileNotFoundError(uri);
65
72
  }
66
- throw new VError(error, `Failed to read file as json "${path}"`);
73
+ throw new VError(error, `Failed to read file as json "${uri}"`);
67
74
  }
68
75
  };
69
76
  export const readFileAsBuffer = async (path) => {
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
41
41
  export const getSetupName = () => {
42
42
  return 'Lvce-Setup';
43
43
  };
44
- export const version = '0.69.4';
45
- export const commit = '7250be5';
46
- export const date = '2025-12-13T19:47:23.000Z';
44
+ export const version = '0.70.0';
45
+ export const commit = '377d2ba';
46
+ export const date = '2025-12-15T22:18:58.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };
@@ -9,6 +9,7 @@ export const Commands = {
9
9
  getConfigDir: PlatformPaths.getConfigDir,
10
10
  getDataDir: PlatformPaths.getDataDir,
11
11
  getDisabledExtensionsPath: PlatformPaths.getDisabledExtensionsPath,
12
+ getDisabledExtensionsJsonPath: PlatformPaths.getDisabledExtensionsJsonPath,
12
13
  getDownloadDir: PlatformPaths.getDownloadDir,
13
14
  getExtensionsPath: PlatformPaths.getExtensionsPath,
14
15
  getHomeDir: PlatformPaths.getHomeDir,