@lvce-editor/shared-process 0.45.0 → 0.45.2

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.45.0",
3
+ "version": "0.45.2",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "1.3.0",
21
- "@lvce-editor/extension-host-helper-process": "0.45.0",
21
+ "@lvce-editor/extension-host-helper-process": "0.45.2",
22
22
  "@lvce-editor/ipc": "13.7.0",
23
23
  "@lvce-editor/json-rpc": "5.4.0",
24
24
  "@lvce-editor/jsonc-parser": "1.5.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', '4e323a6', 'extensions');
5
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '4ff4cba', 'extensions');
6
6
  return builtinExtensionsPath;
7
7
  };
@@ -12,4 +12,5 @@ export const Commands = {
12
12
  rename: FileSystemDisk.rename,
13
13
  stat: FileSystemDisk.stat,
14
14
  writeFile: FileSystemDisk.writeFile,
15
+ getFolderSize: FileSystemDisk.getFolderSize,
15
16
  };
@@ -10,6 +10,7 @@ import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js';
10
10
  import * as Trash from '../Trash/Trash.js';
11
11
  import { VError } from '../VError/VError.js';
12
12
  import { fileURLToPath } from 'node:url';
13
+ import { join } from 'node:path';
13
14
  const assertUri = (uri) => {
14
15
  if (!uri.startsWith('file://')) {
15
16
  throw new Error(`path must be a valid file uri`);
@@ -245,3 +246,20 @@ export const readJson = async (uri) => {
245
246
  throw new VError(error, `Failed to read file as json "${uri}"`);
246
247
  }
247
248
  };
249
+ const getFolderSizeInternal = async (path) => {
250
+ let total = 0;
251
+ const stats = await fs.stat(path);
252
+ total += stats.size;
253
+ if (stats.isDirectory()) {
254
+ const dirents = await fs.readdir(path);
255
+ for (const dirent of dirents) {
256
+ total += await getFolderSizeInternal(join(path, dirent));
257
+ }
258
+ }
259
+ return total;
260
+ };
261
+ export const getFolderSize = async (uri) => {
262
+ const path = fileURLToPath(uri);
263
+ const total = await getFolderSizeInternal(path);
264
+ return total;
265
+ };
@@ -302,6 +302,7 @@ export const getModuleId = (commandId) => {
302
302
  case 'FileSystemDisk.remove':
303
303
  case 'FileSystemDisk.rename':
304
304
  case 'FileSystemDisk.stat':
305
+ case 'FileSystemDisk.getFolderSize':
305
306
  case 'FileSystemDisk.readJson':
306
307
  case 'FileSystemDisk.writeFile':
307
308
  return ModuleId.FileSystemDisk;
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
41
41
  export const getSetupName = () => {
42
42
  return 'Lvce-Setup';
43
43
  };
44
- export const version = '0.45.0';
45
- export const commit = '4e323a6';
46
- export const date = '2025-01-18T10:06:29.000Z';
44
+ export const version = '0.45.2';
45
+ export const commit = '4ff4cba';
46
+ export const date = '2025-01-19T18:21:34.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };