@lvce-editor/shared-process 0.0.38 → 0.0.41

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.
@@ -5,7 +5,7 @@
5
5
  "languages": [
6
6
  {
7
7
  "id": "dockerfile",
8
- "fileExtensions": [".dockerfile", ".containerfile"],
8
+ "extensions": [".dockerfile", ".containerfile"],
9
9
  "fileNames": ["Dockerfile", "Containerfile"],
10
10
  "fileNamePatterns": ["Dockerfile.*", "Containerfile.*"],
11
11
  "tokenize": "src/tokenizeDockerfile.js"
@@ -5,7 +5,8 @@
5
5
  "languages": [
6
6
  {
7
7
  "id": "toml",
8
- "extensions": [".toml"],
8
+ "extensions": [".toml", ".tml", ".replit"],
9
+ "filenames": ["Cargo.lock", "Gopkg.lock"],
9
10
  "tokenize": "src/tokenizeToml.js"
10
11
  }
11
12
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.0.38",
3
+ "version": "0.0.41",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -38,8 +38,8 @@
38
38
  "verror": "^1.10.1",
39
39
  "ws": "^8.8.1",
40
40
  "xdg-basedir": "^5.1.0",
41
- "@lvce-editor/pty-host": "0.0.38",
42
- "@lvce-editor/extension-host": "0.0.38"
41
+ "@lvce-editor/pty-host": "0.0.41",
42
+ "@lvce-editor/extension-host": "0.0.41"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "electron-clipboard-ex": "^1.3.3",
@@ -65,10 +65,11 @@ export const about = async () => {
65
65
  await invoke(/* About.open */ 'About.open')
66
66
  }
67
67
 
68
- export const showOpenDialog = async (title) => {
68
+ export const showOpenDialog = async (title, properties) => {
69
69
  const result = await invoke(
70
70
  /* Dialog.showOpenDialog */ 'Dialog.showOpenDialog',
71
- /* title */ title
71
+ /* title */ title,
72
+ /* properties */ properties
72
73
  )
73
74
  return result
74
75
  }
@@ -32,40 +32,6 @@ const getEnabledExtensionWithOnlyExtension = (
32
32
  return extensions
33
33
  }
34
34
 
35
- export const state = {
36
- async getExtensions() {
37
- // TODO only read from env once
38
- const builtinExtensions = await getBuiltinExtensions()
39
- const onlyExtensionPath = Platform.getOnlyExtensionPath()
40
- if (onlyExtensionPath) {
41
- const absolutePath = path.resolve(onlyExtensionPath)
42
- const [onlyExtension] = await getExtensionManifests([absolutePath])
43
- const enabledExtensions = getEnabledExtensionWithOnlyExtension(
44
- builtinExtensions,
45
- onlyExtension
46
- )
47
- return enabledExtensions
48
- }
49
- const installedExtensions = await getInstalledExtensions()
50
- return [...builtinExtensions, ...installedExtensions]
51
- },
52
- async getThemeExtensions() {
53
- const builtinExtensionsPath = Platform.getBuiltinExtensionsPath()
54
- const dirents = await readdir(builtinExtensionsPath)
55
- const paths = []
56
- for (const dirent of dirents) {
57
- if (isTheme(dirent)) {
58
- paths.push(getAbsoluteBuiltinExtensionPath(dirent))
59
- }
60
- }
61
- if (process.env.ONLY_EXTENSION && isTheme(process.env.ONLY_EXTENSION)) {
62
- paths.push(process.env.ONLY_EXTENSION)
63
- }
64
- const builtinExtensions = await getExtensionManifests(paths)
65
- return builtinExtensions
66
- },
67
- }
68
-
69
35
  export const install = async (id) => {
70
36
  // TODO this should be a stateless function, renderer-worker should have info on marketplace url
71
37
  // TODO use command.execute
@@ -301,7 +267,20 @@ export const getInstalledExtensions = async () => {
301
267
  }
302
268
 
303
269
  export const getExtensions = async () => {
304
- return state.getExtensions()
270
+ // TODO only read from env once
271
+ const builtinExtensions = await getBuiltinExtensions()
272
+ const onlyExtensionPath = Platform.getOnlyExtensionPath()
273
+ if (onlyExtensionPath) {
274
+ const absolutePath = path.resolve(onlyExtensionPath)
275
+ const [onlyExtension] = await getExtensionManifests([absolutePath])
276
+ const enabledExtensions = getEnabledExtensionWithOnlyExtension(
277
+ builtinExtensions,
278
+ onlyExtension
279
+ )
280
+ return enabledExtensions
281
+ }
282
+ const installedExtensions = await getInstalledExtensions()
283
+ return [...builtinExtensions, ...installedExtensions]
305
284
  }
306
285
 
307
286
  const RE_THEME = /[a-z]+\.[a-z\-]*theme-[a-z\d\-]+$/
@@ -317,7 +296,20 @@ const getThemeExtensionsBuiltin = async () => {
317
296
  }
318
297
 
319
298
  export const getThemeExtensions = async () => {
320
- return state.getThemeExtensions()
299
+ const builtinExtensionsPath = Platform.getBuiltinExtensionsPath()
300
+ const dirents = await readdir(builtinExtensionsPath)
301
+ const paths = []
302
+ for (const dirent of dirents) {
303
+ if (isTheme(dirent)) {
304
+ paths.push(getAbsoluteBuiltinExtensionPath(dirent))
305
+ }
306
+ }
307
+ const onlyExtensionPath = Platform.getOnlyExtensionPath()
308
+ if (onlyExtensionPath && isTheme(onlyExtensionPath)) {
309
+ paths.push(onlyExtensionPath)
310
+ }
311
+ const builtinExtensions = await getExtensionManifests(paths)
312
+ return builtinExtensions
321
313
  }
322
314
 
323
315
  export const getDisabledExtensions = async () => {
@@ -327,8 +319,9 @@ export const getDisabledExtensions = async () => {
327
319
  }
328
320
 
329
321
  export const getAllExtensions = async () => {
330
- if (process.env.ONLY_EXTENSION) {
331
- return getExtensionManifests([process.env.ONLY_EXTENSION])
322
+ const onlyExtensionPath = Platform.getOnlyExtensionPath()
323
+ if (onlyExtensionPath) {
324
+ return getExtensionManifests([onlyExtensionPath])
332
325
  }
333
326
  const t1 = performance.now()
334
327
  const [builtinExtensions, installedExtensions, disabledExtensions] =