@lvce-editor/shared-process 0.44.8 → 0.45.1

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.44.8",
3
+ "version": "0.45.1",
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.44.8",
21
+ "@lvce-editor/extension-host-helper-process": "0.45.1",
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",
@@ -32,10 +32,10 @@
32
32
  "@lvce-editor/embeds-process": "1.6.0",
33
33
  "@lvce-editor/network-process": "2.2.0",
34
34
  "@lvce-editor/preload": "1.4.0",
35
- "@lvce-editor/preview-process": "7.21.0",
35
+ "@lvce-editor/preview-process": "7.22.0",
36
36
  "@lvce-editor/pty-host": "3.1.0",
37
37
  "@lvce-editor/search-process": "4.1.0",
38
- "@lvce-editor/typescript-compile-process": "2.2.0",
38
+ "@lvce-editor/typescript-compile-process": "2.3.0",
39
39
  "open": "^10.1.0",
40
40
  "tail": "^2.2.6",
41
41
  "tmp-promise": "^3.0.3",
@@ -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', '0645499', 'extensions');
5
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '6f7ccc8', 'extensions');
6
6
  return builtinExtensionsPath;
7
7
  };
@@ -4,6 +4,7 @@ import * as FileSystem from '../FileSystem/FileSystem.js';
4
4
  import * as GetContentSecurityPolicy from '../GetContentSecurityPolicy/GetContentSecurityPolicy.js';
5
5
  import * as JsonFile from '../JsonFile/JsonFile.js';
6
6
  import * as Path from '../Path/Path.js';
7
+ import { readdir, readFile, rm, writeFile } from 'node:fs/promises';
7
8
  const staticContentSecurityPolicy = GetContentSecurityPolicy.getContentSecurityPolicy([
8
9
  `default-src 'none'`,
9
10
  `font-src 'self'`,
@@ -362,9 +363,35 @@ const isTestFile = (file) => {
362
363
  const getTestFiles = (testFilesRaw) => {
363
364
  return testFilesRaw.map(getName).filter(isTestFile);
364
365
  };
366
+ const transpileFile = (typescript, content) => {
367
+ const result = typescript.transpileModule(content, {
368
+ compilerOptions: {
369
+ target: 'esnext',
370
+ },
371
+ });
372
+ return result.outputText;
373
+ };
374
+ const transpileFiles = async (folder) => {
375
+ const typescript = await import('typescript');
376
+ const dirents = await readdir(folder);
377
+ for (const dirent of dirents) {
378
+ if (dirent.endsWith('.ts')) {
379
+ const content = await readFile(join(folder, dirent), 'utf-8');
380
+ const js = transpileFile(typescript, content);
381
+ await writeFile(join(folder, dirent.slice(0, -2) + 'js'), js);
382
+ }
383
+ }
384
+ for (const dirent of dirents) {
385
+ if (dirent.endsWith('.ts')) {
386
+ await rm(join(folder, dirent));
387
+ }
388
+ }
389
+ };
365
390
  const addTestFiles = async ({ testPath, commitHash, root, pathPrefix }) => {
366
391
  const testRoot = isAbsolute(testPath) ? testPath : join(root, testPath);
367
392
  await FileSystem.copy(`${testRoot}/src`, `${root}/dist/${commitHash}/packages/extension-host-worker-tests/src`);
393
+ const distDirentsPath = `${root}/dist/${commitHash}/packages/extension-host-worker-tests/src`;
394
+ await transpileFiles(distDirentsPath);
368
395
  const testFilesRaw = await FileSystem.readDir(`${testRoot}/src`);
369
396
  const testFiles = getTestFiles(testFilesRaw);
370
397
  await FileSystem.mkdir(`${root}/dist/${commitHash}/tests`);
@@ -31,4 +31,5 @@ export const Commands = {
31
31
  stat: FileSystem.stat,
32
32
  writeFile: FileSystem.writeFile,
33
33
  getRealUri: FileSystem.getRealUri,
34
+ getFolderSize: FileSystem.getFolderSize,
34
35
  };
@@ -12,6 +12,7 @@ import * as Platform from '../Platform/Platform.js';
12
12
  import * as Trash from '../Trash/Trash.js';
13
13
  import { VError } from '../VError/VError.js';
14
14
  import { fileURLToPath } from 'node:url';
15
+ import { join } from 'node:path';
15
16
  export const state = {
16
17
  watcherMap: Object.create(null),
17
18
  };
@@ -314,3 +315,15 @@ export const getRealUri = (pathOrUri) => {
314
315
  return pathOrUri;
315
316
  }
316
317
  };
318
+ export const getFolderSize = async (uri) => {
319
+ let total = 0;
320
+ const stats = await fs.stat(uri);
321
+ total += stats.size;
322
+ if (stats.isDirectory()) {
323
+ const dirents = await fs.readdir(uri);
324
+ for (const dirent of dirents) {
325
+ total += await getFolderSize(join(uri, dirent));
326
+ }
327
+ }
328
+ return total;
329
+ };
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
41
41
  export const getSetupName = () => {
42
42
  return 'Lvce-Setup';
43
43
  };
44
- export const version = '0.44.8';
45
- export const commit = '0645499';
46
- export const date = '2025-01-16T19:58:21.000Z';
44
+ export const version = '0.45.1';
45
+ export const commit = '6f7ccc8';
46
+ export const date = '2025-01-19T12:42:37.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };