@lvce-editor/shared-process 0.122.7 → 0.122.9

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.122.7",
3
+ "version": "0.122.9",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -3,6 +3,6 @@ import { fileURLToPath } from 'url'
3
3
 
4
4
  export const getBuiltinExtensionsPath = () => {
5
5
  const staticServerPath = fileURLToPath(import.meta.resolve('@lvce-editor/static-server'))
6
- const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', 'f15462f', 'extensions')
6
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '4c89f27', 'extensions')
7
7
  return builtinExtensionsPath
8
8
  }
@@ -1,3 +1,4 @@
1
+ import * as Assert from '@lvce-editor/assert'
1
2
  import { existsSync } from 'node:fs'
2
3
  import { mkdir, readFile, writeFile } from 'node:fs/promises'
3
4
  import { dirname } from 'node:path'
@@ -116,7 +117,13 @@ export const getInstalledExtensions = () => {
116
117
  )
117
118
  }
118
119
 
119
- export const getExtensions = () => {
120
+ export const getExtensions = (fields) => {
121
+ if (fields !== undefined) {
122
+ Assert.array(fields)
123
+ for (const field of fields) {
124
+ Assert.string(field)
125
+ }
126
+ }
120
127
  const transientLinkedExtensions = TransientLinkedExtensions.getLinkedExtensions().map((link) => {
121
128
  return {
122
129
  path: link.resolvedPath,
@@ -140,6 +147,7 @@ export const getExtensions = () => {
140
147
  },
141
148
  ],
142
149
  BuiltinExtensionsPath.getBuiltinExtensionsPath(),
150
+ fields,
143
151
  )
144
152
  }
145
153
 
@@ -4,6 +4,7 @@ import * as ExtensionManifestInputType from '../ExtensionManifestInputType/Exten
4
4
  import * as ExtensionManifestsGetFromFolder from './ExtensionManifestsFromFolder.js'
5
5
  import * as ExtensionManifestsGetFromLinkedExtension from './ExtensionManifestsFromLinkedExtension.js'
6
6
  import * as ExtensionManifestsGetFromOnlyExtension from './ExtensionManifestsFromOnlyExtension.js'
7
+ import { selectExtensionManifestFields } from './SelectExtensionManifestFields.js'
7
8
 
8
9
  const getModule = (type) => {
9
10
  switch (type) {
@@ -18,9 +19,9 @@ const getModule = (type) => {
18
19
  }
19
20
  }
20
21
 
21
- const get = (input) => {
22
+ const get = (input, fields) => {
22
23
  const module = getModule(input.type)
23
- return module.getExtensionManifests(input.path)
24
+ return fields === undefined ? module.getExtensionManifests(input.path) : module.getExtensionManifests(input.path, fields)
24
25
  }
25
26
 
26
27
  const isBuiltin = (extension) => {
@@ -37,11 +38,13 @@ const addExtensionDisabledStatus = (uniqueExtensions, disabledExtensionIds, enab
37
38
  })
38
39
  }
39
40
 
40
- export const getAll = async (inputs, builtinExtensionsPath = undefined) => {
41
- const manifests = await Promise.all(inputs.map(get))
41
+ export const getAll = async (inputs, builtinExtensionsPath = undefined, fields) => {
42
+ // Keep identity and enablement fields until deduplication and live enablement have been applied.
43
+ const inputFields = fields === undefined ? undefined : [...new Set([...fields, 'id', 'path', 'disabled'])]
44
+ const manifests = await Promise.all(inputs.map((input) => get(input, inputFields)))
42
45
  const { disabledExtensionIds, enabledExtensionIds } = await getExtensionEnablement()
43
46
  const flatManifests = manifests.flat(1)
44
47
  const uniqueExtensions = DeduplicateExtensions.deduplicateExtensions(flatManifests, builtinExtensionsPath)
45
48
  const filteredExtensions = addExtensionDisabledStatus(uniqueExtensions, disabledExtensionIds, enabledExtensionIds)
46
- return filteredExtensions
49
+ return selectExtensionManifestFields(filteredExtensions, fields)
47
50
  }
@@ -7,6 +7,7 @@ import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js'
7
7
  import * as Platform from '../Platform/Platform.js'
8
8
  import * as ToAbsolutePaths from '../ToAbsolutePaths/ToAbsolutePaths.js'
9
9
  import { VError } from '../VError/VError.js'
10
+ import { selectExtensionManifestFields } from './SelectExtensionManifestFields.js'
10
11
 
11
12
  let builtinManifests
12
13
 
@@ -17,7 +18,7 @@ const readExtensionManifests = async (path) => {
17
18
  return Promise.all(absolutePaths.map(ExtensionManifest.get))
18
19
  }
19
20
 
20
- export const getExtensionManifests = async (path) => {
21
+ export const getExtensionManifests = async (path, fields) => {
21
22
  let cached
22
23
  try {
23
24
  if (!path) {
@@ -25,7 +26,7 @@ export const getExtensionManifests = async (path) => {
25
26
  }
26
27
  // Packaged builtins are fixed for this process. User and development extensions stay live.
27
28
  if (!Platform.isProduction || path !== BuiltinExtensionsPath.getBuiltinExtensionsPath()) {
28
- return await readExtensionManifests(path)
29
+ return selectExtensionManifestFields(await readExtensionManifests(path), fields)
29
30
  }
30
31
  if (!builtinManifests || builtinManifests.path !== path) {
31
32
  builtinManifests = { path, promise: readExtensionManifests(path) }
@@ -36,10 +37,10 @@ export const getExtensionManifests = async (path) => {
36
37
  if (builtinManifests === cached) {
37
38
  builtinManifests = undefined
38
39
  }
39
- return manifests
40
+ return selectExtensionManifestFields(manifests, fields)
40
41
  }
41
42
  // Keep request-local metadata and nested contributions independent of the cached values.
42
- return structuredClone(manifests)
43
+ return structuredClone(selectExtensionManifestFields(manifests, fields))
43
44
  } catch (error) {
44
45
  if (cached && builtinManifests === cached) {
45
46
  builtinManifests = undefined
@@ -0,0 +1,8 @@
1
+ export const selectExtensionManifestFields = (manifests, fields) => {
2
+ if (fields === undefined) {
3
+ return manifests
4
+ }
5
+ return manifests.map((manifest) =>
6
+ Object.fromEntries(fields.filter((field) => Object.hasOwn(manifest, field)).map((field) => [field, manifest[field]])),
7
+ )
8
+ }
@@ -56,11 +56,11 @@ export const getSetupName = () => {
56
56
  return 'Lvce-Setup'
57
57
  }
58
58
 
59
- export const version = '0.122.7'
59
+ export const version = '0.122.9'
60
60
 
61
- export const commit = 'f15462f'
61
+ export const commit = '4c89f27'
62
62
 
63
- export const date = '2026-10-12T14:04:27.000Z'
63
+ export const date = '2026-10-12T17:07:30.000Z'
64
64
 
65
65
  export const getVersion = () => {
66
66
  return version
@@ -2,5 +2,5 @@ import { join } from 'node:path'
2
2
  import * as Root from '../Root/Root.js'
3
3
 
4
4
  export const getPreloadUrl = () => {
5
- return join(Root.root, 'static', 'f15462f', 'packages', 'preload', 'dist', 'index.js')
5
+ return join(Root.root, 'static', '4c89f27', 'packages', 'preload', 'dist', 'index.js')
6
6
  }