@lvce-editor/shared-process 0.56.4 → 0.56.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.56.4",
3
+ "version": "0.56.6",
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.56.4",
21
+ "@lvce-editor/extension-host-helper-process": "0.56.6",
22
22
  "@lvce-editor/ipc": "14.3.0",
23
23
  "@lvce-editor/json-rpc": "6.2.0",
24
24
  "@lvce-editor/jsonc-parser": "1.5.0",
25
25
  "@lvce-editor/pretty-error": "2.0.0",
26
- "@lvce-editor/rpc-registry": "2.57.0",
26
+ "@lvce-editor/rpc-registry": "2.63.0",
27
27
  "@lvce-editor/verror": "1.7.0",
28
28
  "debug": "^4.4.1",
29
29
  "is-object": "^1.0.2",
@@ -32,7 +32,7 @@
32
32
  "optionalDependencies": {
33
33
  "@lvce-editor/embeds-process": "4.1.0",
34
34
  "@lvce-editor/file-system-process": "3.3.0",
35
- "@lvce-editor/file-watcher-process": "3.1.0",
35
+ "@lvce-editor/file-watcher-process": "3.2.0",
36
36
  "@lvce-editor/network-process": "5.2.0",
37
37
  "@lvce-editor/preload": "1.5.0",
38
38
  "@lvce-editor/preview-process": "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', 'e6ddf2e', 'extensions');
5
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '0f5bf1d', 'extensions');
6
6
  return builtinExtensionsPath;
7
7
  };
@@ -1,12 +1,14 @@
1
- import { mkdir, rename } from 'node:fs/promises';
1
+ import { existsSync } from 'node:fs';
2
+ import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
3
+ import { dirname } from 'node:path';
4
+ import * as BuiltinExtensionsPath from '../BuiltinExtensionsPath/BuiltinExtensionsPath.js';
2
5
  import * as Debug from '../Debug/Debug.js';
3
6
  import * as ExtensionManifestInputType from '../ExtensionManifestInputType/ExtensionManifestInputType.js';
4
7
  import * as ExtensionManifests from '../ExtensionManifests/ExtensionManifests.js';
8
+ import * as GetEtagFromStats from '../GetEtagFromStats/GetEtagFromStats.js';
9
+ import * as GetExtensionEtags from '../GetExtensionEtags/GetExtensionEtags.js';
5
10
  import * as Path from '../Path/Path.js';
6
- import * as BuiltinExtensionsPath from '../BuiltinExtensionsPath/BuiltinExtensionsPath.js';
7
11
  import * as PlatformPaths from '../PlatformPaths/PlatformPaths.js';
8
- import * as GetExtensionEtags from '../GetExtensionEtags/GetExtensionEtags.js';
9
- import * as GetEtagFromStats from '../GetEtagFromStats/GetEtagFromStats.js';
10
12
  import { VError } from '../VError/VError.js';
11
13
  export const enable = async (id) => {
12
14
  try {
@@ -20,18 +22,46 @@ export const enable = async (id) => {
20
22
  throw new VError(error, `Failed to enable extension "${id}"`);
21
23
  }
22
24
  };
25
+ const getNewDisabledExtensionContent = (disabledExtensions) => {
26
+ const content = JSON.stringify({
27
+ disabledExtensions,
28
+ }, null, 2) + '\n';
29
+ return content;
30
+ };
23
31
  export const disable = async (id) => {
24
32
  try {
25
33
  Debug.debug(`ExtensionManagement#disable ${id}`);
26
- const disabledExtensionsPath = PlatformPaths.getDisabledExtensionsPath();
27
- const extensionsPath = PlatformPaths.getExtensionsPath();
28
- await mkdir(disabledExtensionsPath, { recursive: true });
29
- await rename(Path.join(extensionsPath, id), Path.join(disabledExtensionsPath, id));
34
+ const disabledExtensionsJsonPath = PlatformPaths.getDisabledExtensionsJsonPath();
35
+ const oldDisabledExtensionIds = await getDisabledExtensionIds();
36
+ if (oldDisabledExtensionIds.includes(id)) {
37
+ return;
38
+ }
39
+ const newDisabledExtensionIds = [...oldDisabledExtensionIds, id];
40
+ const content = getNewDisabledExtensionContent(newDisabledExtensionIds);
41
+ await mkdir(dirname(disabledExtensionsJsonPath), { recursive: true });
42
+ await writeFile(disabledExtensionsJsonPath, content);
30
43
  }
31
44
  catch (error) {
32
45
  throw new VError(error, `Failed to disable extension ${id}`);
33
46
  }
34
47
  };
48
+ export const getDisabledExtensionIds = async () => {
49
+ try {
50
+ const disabledExtensionsJsonPath = PlatformPaths.getDisabledExtensionsJsonPath();
51
+ if (!existsSync(disabledExtensionsJsonPath)) {
52
+ return [];
53
+ }
54
+ const content = await readFile(disabledExtensionsJsonPath, 'utf8');
55
+ const parsed = JSON.parse(content);
56
+ if (!parsed || !parsed.disabledExtensions || !Array.isArray(parsed.disabledExtensions)) {
57
+ return [];
58
+ }
59
+ return parsed.disabledExtensions.filter((extensionId) => typeof extensionId === 'string');
60
+ }
61
+ catch {
62
+ return [];
63
+ }
64
+ };
35
65
  export const getBuiltinExtensions = () => {
36
66
  return ExtensionManifests.getAll([
37
67
  {
@@ -1,4 +1,5 @@
1
1
  import * as DeduplicateExtensions from '../DeduplicateExtensions/DeduplicateExtensions.js';
2
+ import { getDisabledExtensionIds } from '../ExtensionManagement/ExtensionManagement.js';
2
3
  import * as ExtensionManifestInputType from '../ExtensionManifestInputType/ExtensionManifestInputType.js';
3
4
  import * as ExtensionManifestsGetFromFolder from './ExtensionManifestsFromFolder.js';
4
5
  import * as ExtensionManifestsGetFromLinkedExtensionsFolder from './ExtensionManifestsFromLinkedExtensionsFolder.js';
@@ -19,9 +20,19 @@ const get = (input) => {
19
20
  const module = getModule(input.type);
20
21
  return module.getExtensionManifests(input.path);
21
22
  };
23
+ const addExtensionDisabledStatus = (uniqueExtensions, disabledExtensionIds) => {
24
+ return uniqueExtensions.map((extension) => {
25
+ return {
26
+ ...extension,
27
+ disabled: disabledExtensionIds.includes(extension.id),
28
+ };
29
+ });
30
+ };
22
31
  export const getAll = async (inputs, builtinExtensionsPath) => {
23
32
  const manifests = await Promise.all(inputs.map(get));
33
+ const disabledIds = await getDisabledExtensionIds();
24
34
  const flatManifests = manifests.flat(1);
25
35
  const uniqueExtensions = DeduplicateExtensions.deduplicateExtensions(flatManifests, builtinExtensionsPath);
26
- return uniqueExtensions;
36
+ const filteredExtensions = addExtensionDisabledStatus(uniqueExtensions, disabledIds);
37
+ return filteredExtensions;
27
38
  };
@@ -231,19 +231,6 @@ export const rename = async (oldPath, newPath) => {
231
231
  throw new VError(error, `Failed to rename "${oldPath}" to "${newPath}"`);
232
232
  }
233
233
  };
234
- // TODO have a separate process for file watching
235
- // export const watch = async (path, options) => {
236
- // // let state = 'loading'
237
- // const chokidar = await import('chokidar')
238
- // const watcher = chokidar.watch(`${path}`, {
239
- // ignoreInitial: true,
240
- // })
241
- // if (options.onAll) {
242
- // watcher.on('all', options.onAll)
243
- // }
244
- // return watcher
245
- // // const { default: chokidar } = await import('chokidar')
246
- // }
247
234
  export const getPathSeparator = () => {
248
235
  return Platform.getPathSeparator();
249
236
  };
@@ -5,7 +5,7 @@ import * as LaunchProcess from '../LaunchProcess/LaunchProcess.js';
5
5
  export const launchFileWatcherProcess = async () => {
6
6
  const ipc = await LaunchProcess.launchProcess({
7
7
  name: 'File Watcher Process',
8
- settingName: '',
8
+ settingName: 'develop.fileWatcherProcessPath',
9
9
  defaultPath: FileWatcherProcessPath.fileWatcherProcessPath,
10
10
  isElectron: IsElectron.isElectron,
11
11
  targetRpcId: IpcId.FileWatcherProcess,
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
41
41
  export const getSetupName = () => {
42
42
  return 'Lvce-Setup';
43
43
  };
44
- export const version = '0.56.4';
45
- export const commit = 'e6ddf2e';
46
- export const date = '2025-07-18T21:13:12.000Z';
44
+ export const version = '0.56.6';
45
+ export const commit = '0f5bf1d';
46
+ export const date = '2025-07-24T21:42:39.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };
@@ -18,6 +18,12 @@ export const getExtensionsPath = () => {
18
18
  export const getBuiltinExtensionsPath = () => {
19
19
  return process.env.BUILTIN_EXTENSIONS_PATH || Path.join(Root.root, 'extensions');
20
20
  };
21
+ export const getDisabledExtensionsJsonPath = () => {
22
+ return Path.join(dataDir, 'extensions', 'disabled-extensions.json');
23
+ };
24
+ /**
25
+ * @deprecated disabled extensions are now stored in a file disabled-extensions.json
26
+ */
21
27
  export const getDisabledExtensionsPath = () => {
22
28
  return Path.join(dataDir, 'disabled-extensions');
23
29
  };