@lvce-editor/shared-process 0.64.5 → 0.66.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.
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.64.5",
3
+ "version": "0.66.6",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,27 +18,26 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "1.4.0",
21
- "@lvce-editor/extension-host-helper-process": "0.64.5",
22
- "@lvce-editor/ipc": "14.5.0",
21
+ "@lvce-editor/extension-host-helper-process": "0.66.6",
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
26
  "@lvce-editor/rpc-registry": "3.12.0",
27
27
  "@lvce-editor/verror": "1.7.0",
28
- "debug": "^4.4.3",
29
28
  "is-object": "^1.0.2",
30
29
  "xdg-basedir": "^5.1.0"
31
30
  },
32
31
  "optionalDependencies": {
33
32
  "@lvce-editor/embeds-process": "4.1.0",
34
- "@lvce-editor/file-system-process": "3.7.0",
35
- "@lvce-editor/file-watcher-process": "3.3.0",
33
+ "@lvce-editor/file-system-process": "3.8.0",
34
+ "@lvce-editor/file-watcher-process": "3.6.0",
36
35
  "@lvce-editor/network-process": "5.2.0",
37
36
  "@lvce-editor/preload": "1.5.0",
38
37
  "@lvce-editor/preview-process": "11.0.0",
39
38
  "@lvce-editor/pty-host": "5.5.0",
40
39
  "@lvce-editor/search-process": "12.0.0",
41
- "@lvce-editor/typescript-compile-process": "4.0.0",
40
+ "@lvce-editor/typescript-compile-process": "4.1.0",
42
41
  "open": "^10.2.0",
43
42
  "tail": "^2.2.6",
44
43
  "tmp-promise": "^3.0.3",
@@ -11,13 +11,23 @@ import * as Platform from '../Platform/Platform.js';
11
11
  import * as UpdateState from '../UpdateState/UpdateState.js';
12
12
  import * as UpdateStateType from '../UpdateStateType/UpdateStateType.js';
13
13
  import { VError } from '../VError/VError.js';
14
+ const getArchPostFix = (arch) => {
15
+ switch (arch) {
16
+ case 'arm':
17
+ case 'arm64':
18
+ return '-arm64';
19
+ default:
20
+ return '-x64';
21
+ }
22
+ };
14
23
  // TODO make it possible to cancel downloading updates
15
24
  export const downloadUpdate = async (version) => {
16
25
  try {
17
26
  Assert.string(version);
18
27
  const repository = Platform.getRepository();
19
28
  const setupName = Platform.getSetupName();
20
- const fileName = `${setupName}-v${version}.exe`;
29
+ const archPostFix = getArchPostFix(process.arch);
30
+ const fileName = `${setupName}-v${version}${archPostFix}.exe`;
21
31
  const downLoadUrl = GetWindowsNsisDownloadUrl.getDownloadUrl(repository, version, fileName);
22
32
  const outFile = GetNsisDownloadPath.getNsisUpdateDownloadPath(version);
23
33
  Logger.info(`[shared-process] downloading nsis update: ${downLoadUrl} -> ${outFile}`);
@@ -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', '488a9bc', 'extensions');
5
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '26ac40c', 'extensions');
6
6
  return builtinExtensionsPath;
7
7
  };
@@ -2,7 +2,6 @@ import { existsSync } from 'node:fs';
2
2
  import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
3
3
  import { dirname } from 'node:path';
4
4
  import * as BuiltinExtensionsPath from '../BuiltinExtensionsPath/BuiltinExtensionsPath.js';
5
- import * as Debug from '../Debug/Debug.js';
6
5
  import * as ExtensionManifestInputType from '../ExtensionManifestInputType/ExtensionManifestInputType.js';
7
6
  import * as ExtensionManifests from '../ExtensionManifests/ExtensionManifests.js';
8
7
  import * as GetEtagFromStats from '../GetEtagFromStats/GetEtagFromStats.js';
@@ -12,7 +11,6 @@ import * as PlatformPaths from '../PlatformPaths/PlatformPaths.js';
12
11
  import { VError } from '../VError/VError.js';
13
12
  export const enable = async (id) => {
14
13
  try {
15
- Debug.debug(`ExtensionManagement#enable ${id}`);
16
14
  const extensionsPath = PlatformPaths.getExtensionsPath();
17
15
  const disabledExtensionsPath = PlatformPaths.getDisabledExtensionsPath();
18
16
  await mkdir(extensionsPath, { recursive: true });
@@ -30,7 +28,6 @@ const getNewDisabledExtensionContent = (disabledExtensions) => {
30
28
  };
31
29
  export const disable = async (id) => {
32
30
  try {
33
- Debug.debug(`ExtensionManagement#disable ${id}`);
34
31
  const disabledExtensionsJsonPath = PlatformPaths.getDisabledExtensionsJsonPath();
35
32
  const oldDisabledExtensionIds = await getDisabledExtensionIds();
36
33
  if (oldDisabledExtensionIds.includes(id)) {
@@ -1,11 +1,9 @@
1
1
  import { rm } from 'node:fs/promises';
2
- import * as Debug from '../Debug/Debug.js';
3
2
  import * as Path from '../Path/Path.js';
4
3
  import * as PlatformPaths from '../PlatformPaths/PlatformPaths.js';
5
4
  import { VError } from '../VError/VError.js';
6
5
  export const uninstall = async (id) => {
7
6
  try {
8
- Debug.debug(`ExtensionManagement#uninstall ${id}`);
9
7
  const extensionsPath = PlatformPaths.getExtensionsPath();
10
8
  await rm(Path.join(extensionsPath, id), { recursive: true });
11
9
  }
@@ -2,5 +2,6 @@ import * as FileWatcher from '../FileWatcher/FileWatcher.js';
2
2
  export const name = 'FileWatcher';
3
3
  export const Commands = {
4
4
  watch: FileWatcher.watch,
5
+ watchFile2: FileWatcher.watchFile2,
5
6
  handleChange: FileWatcher.handleChange,
6
7
  };
@@ -16,6 +16,25 @@ export const watch = async (ipc, id, { roots, exclude }) => {
16
16
  exclude,
17
17
  });
18
18
  };
19
+ const disposeFileWatcher = async (internalId) => {
20
+ try {
21
+ await FileWatcherProcess.invoke('FileWatcher.dispose', internalId);
22
+ }
23
+ catch {
24
+ // ignore
25
+ }
26
+ };
27
+ export const watchFile2 = async (ipc, id, uri) => {
28
+ const internalId = Id.create();
29
+ const handleClose = async () => {
30
+ ipc.off('close', handleClose);
31
+ await disposeFileWatcher(internalId);
32
+ };
33
+ ipc.on('close', handleClose);
34
+ internalIdMap[internalId] = { id, ipc };
35
+ // TODO promise never resolves, should resolve as soon as watcher has been set up
36
+ await FileWatcherProcess.invoke('FileWatcher.watchFile2', internalId, uri);
37
+ };
19
38
  export const handleChange = (event) => {
20
39
  const ref = internalIdMap[event.id];
21
40
  handleEvents(ref.id, ref.ipc, event);
@@ -1,4 +1,5 @@
1
1
  import * as Platform from '../Platform/Platform.js';
2
+ import { removeQueryParameters } from '../RemoveQueryParameters/RemoveQueryParameters.js';
2
3
  import * as Scheme from '../Scheme/Scheme.js';
3
4
  const { scheme } = Platform;
4
5
  const prefix = `${scheme}://-`;
@@ -23,7 +24,7 @@ export const getElectronFileResponseRelativePath = (requestUrl) => {
23
24
  }
24
25
  if (requestUrl.startsWith('/')) {
25
26
  // TODO this should not be supported anymore and could probably be removed
26
- return requestUrl;
27
+ return removeQueryParameters(requestUrl);
27
28
  }
28
29
  console.log({ requestUrl });
29
30
  return '';
@@ -1,10 +1,7 @@
1
- import * as Debug from '../Debug/Debug.js';
2
1
  import * as ParentIpc from '../MainProcess/MainProcess.js';
3
2
  import * as Platform from '../Platform/Platform.js';
4
3
  export const handleWindowAllClosed = async () => {
5
- Debug.debug('[info] all windows closed');
6
4
  if (!Platform.isMacOs) {
7
- Debug.debug('[info] quitting');
8
5
  await ParentIpc.invoke('Exit.exit');
9
6
  }
10
7
  };
@@ -1,4 +1,3 @@
1
- import * as Debug from '../Debug/Debug.js';
2
1
  import * as Download from '../Download/Download.js';
3
2
  import * as Extract from '../Extract/Extract.js';
4
3
  import * as Path from '../Path/Path.js';
@@ -10,15 +9,12 @@ export const installExtension = async (id) => {
10
9
  // TODO use command.execute
11
10
  try {
12
11
  const marketplaceUrl = PlatformPaths.getMarketplaceUrl();
13
- Debug.debug(`ExtensionManagement#install ${id}`);
14
12
  const cachedExtensionsPath = PlatformPaths.getCachedExtensionsPath();
15
13
  const extensionsPath = PlatformPaths.getExtensionsPath();
16
14
  // TODO maybe a queue is over engineering here
17
15
  await Queue.add('download', async () => {
18
- Debug.debug(`ExtensionManagement#download ${id}`);
19
16
  // TODO use command.execute
20
17
  await Download.download(`${marketplaceUrl}/download/${id}`, Path.join(cachedExtensionsPath, `${id}.tar.br`));
21
- Debug.debug(`ExtensionManagement#extract ${id}`);
22
18
  await Extract.extractTarBr(Path.join(cachedExtensionsPath, `${id}.tar.br`), Path.join(extensionsPath, id));
23
19
  });
24
20
  // TODO should this be here? (probably not)
@@ -1,3 +1,5 @@
1
+ import { removeQueryParameters } from '../RemoveQueryParameters/RemoveQueryParameters.js';
1
2
  export const isTypeScriptPath = (uri) => {
2
- return uri.endsWith('.ts');
3
+ const pathName = removeQueryParameters(uri);
4
+ return pathName.endsWith('.ts');
3
5
  };
@@ -186,6 +186,7 @@ export const getModuleId = (commandId) => {
186
186
  case 'GetWindowId.getWindowId':
187
187
  return ModuleId.GetWindowId;
188
188
  case 'Platform.getAppDir':
189
+ case 'Platform.getArch':
189
190
  case 'Platform.getApplicationName':
190
191
  case 'Platform.getBuiltinExtensionsPath':
191
192
  case 'Platform.getCachedExtensionsPath':
@@ -290,6 +291,7 @@ export const getModuleId = (commandId) => {
290
291
  case 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess':
291
292
  return ModuleId.HandleMessagePortForSearchProcess;
292
293
  case 'FileWatcher.watch':
294
+ case 'FileWatcher.watchFile2':
293
295
  case 'FileWatcher.handleChange':
294
296
  return ModuleId.FileWatcher;
295
297
  case 'Transferrable.transfer':
@@ -4,6 +4,7 @@ export const name = 'Platform';
4
4
  export const Commands = {
5
5
  getAppDir: PlatformPaths.getAppDir,
6
6
  getApplicationName: Platform.getApplicationName,
7
+ getArch: Platform.getArch,
7
8
  getBuiltinExtensionsPath: PlatformPaths.getBuiltinExtensionsPath,
8
9
  getCachedExtensionsPath: PlatformPaths.getCachedExtensionsPath,
9
10
  getCacheDir: PlatformPaths.getCacheDir,
@@ -11,8 +12,6 @@ export const Commands = {
11
12
  getConfigDir: PlatformPaths.getConfigDir,
12
13
  getDataDir: PlatformPaths.getDataDir,
13
14
  getDate: Platform.getDate,
14
- getRoot: PlatformPaths.getRoot,
15
- getRootUri: PlatformPaths.getRootUri,
16
15
  getDisabledExtensionsPath: PlatformPaths.getDisabledExtensionsPath,
17
16
  getDownloadDir: PlatformPaths.getDownloadDir,
18
17
  getExtensionsPath: PlatformPaths.getExtensionsPath,
@@ -22,6 +21,8 @@ export const Commands = {
22
21
  getNodePath: Platform.getNodePath,
23
22
  getProductNameLong: Platform.getProductNameLong,
24
23
  getRecentlyOpenedPath: PlatformPaths.getRecentlyOpenedPath,
24
+ getRoot: PlatformPaths.getRoot,
25
+ getRootUri: PlatformPaths.getRootUri,
25
26
  getTestPath: PlatformPaths.getTestPath,
26
27
  getTmpDir: Platform.getTmpDir,
27
28
  getUserKeyBindingsPath: PlatformPaths.getUserKeyBindingsPath,
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
41
41
  export const getSetupName = () => {
42
42
  return 'Lvce-Setup';
43
43
  };
44
- export const version = '0.64.5';
45
- export const commit = '488a9bc';
46
- export const date = '2025-11-03T13:16:12.000Z';
44
+ export const version = '0.66.6';
45
+ export const commit = '26ac40c';
46
+ export const date = '2025-11-11T16:37:15.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };
@@ -57,3 +57,6 @@ export const productNameLong = 'Lvce Editor - OSS';
57
57
  export const getProductNameLong = () => {
58
58
  return productNameLong;
59
59
  };
60
+ export const getArch = () => {
61
+ return process.arch;
62
+ };
@@ -76,7 +76,9 @@ export const getTestPath = () => {
76
76
  const testPath = '/remote' + pathToFileURL(absolutePath).toString().slice(7);
77
77
  return testPath;
78
78
  }
79
- return '/packages/extension-host-worker-tests';
79
+ const absolutePath = join(Root.root, 'packages/extension-host-worker-tests');
80
+ const testPath = '/remote' + pathToFileURL(absolutePath).toString().slice(7);
81
+ return testPath;
80
82
  };
81
83
  export const getNodePath = () => {
82
84
  return Process.argv[0];
@@ -1,10 +1,8 @@
1
- import * as Debug from '../Debug/Debug.js';
2
1
  import * as IpcParentType from '../IpcParentType/IpcParentType.js';
3
2
  import * as JsonRpc from '../JsonRpc/JsonRpc.js';
4
3
  import * as LaunchPtyHost from '../LaunchPtyHost/LaunchPtyHost.js';
5
4
  import * as PtyHostState from '../PtyHostState/PtyHostState.js';
6
5
  export const getOrCreate = (method = IpcParentType.NodeForkedProcess) => {
7
- Debug.debug('creating pty host');
8
6
  if (!PtyHostState.state.ptyHostPromise) {
9
7
  PtyHostState.state.ptyHostPromise = LaunchPtyHost.launchPtyHost(method);
10
8
  }
@@ -0,0 +1,7 @@
1
+ export const removeQueryParameters = (url) => {
2
+ const questionIndex = url.indexOf('?');
3
+ if (questionIndex === -1) {
4
+ return url;
5
+ }
6
+ return url.slice(0, questionIndex);
7
+ };
@@ -15,6 +15,7 @@ const METHODS_THAT_REQUIRE_SOCKET = new Set([
15
15
  'ElectronBrowserView.createBrowserView',
16
16
  'ElectronWebContentsView.createWebContentsView',
17
17
  'FileWatcher.watch',
18
+ 'FileWatcher.watchFile2',
18
19
  ]);
19
20
  export const requiresSocket = (method) => {
20
21
  return METHODS_THAT_REQUIRE_SOCKET.has(method);
@@ -1,2 +0,0 @@
1
- import debugModule from 'debug';
2
- export const debug = debugModule('shared-process');