@xwiki/cristal-electron-settings-main 0.20.0 → 0.21.0
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/CHANGELOG.md +12 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +1 -1
- package/src/storage.ts +1 -1
- package/vite.config.ts +1 -1
- package/vitest.config.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @xwiki/cristal-electron-settings-main
|
|
2
2
|
|
|
3
|
+
## 0.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Cristal 0.21 Release
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @xwiki/cristal-configuration-api@0.21.0
|
|
13
|
+
- @xwiki/cristal-settings-api@0.21.0
|
|
14
|
+
|
|
3
15
|
## 0.20.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/storage.ts","../__vite-browser-external","../../../../node_modules/.pnpm/electron@37.
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/storage.ts","../__vite-browser-external","../../../../node_modules/.pnpm/electron@37.2.5/node_modules/electron/index.js","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport defaultSettings from \"./defaultSettings.json\";\nimport { Configurations } from \"@xwiki/cristal-configuration-api\";\nimport Store from \"electron-store\";\n\nconst configurationKey = \"configuration\";\nconst settingsKey = \"_raw\";\n\nconst schema = {\n _raw: {\n type: \"string\",\n },\n configuration: {\n type: \"object\",\n },\n};\n\nconst storeInstance: Store = new Store({\n name: \"settings\",\n // Here, we want to keep in the store the raw string representation of the\n // file, since it should be parsed and serialized by the SettingsManager\n // service. We still include the deserialized object in case we want to check\n // some settings values on Electron's main process.\n serialize: (value: Record<string, unknown>) => value._raw as string,\n deserialize: (value: string) => ({ _raw: value, ...JSON.parse(value) }),\n schema,\n});\n\nfunction set<T>(key: string, value: T) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.set(key, value);\n}\n\nfunction get<T>(key: string): T {\n // @ts-expect-error type resolution failing because of electron-store library bug\n return storeInstance.get(key) as T;\n}\n\nfunction rm(key: string) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.delete(key);\n}\n\nfunction setSettings(value: string): void {\n set(settingsKey, value);\n}\n\nfunction getSettings(): string {\n // @ts-expect-error type resolution failing because of electron-store library bug\n if (storeInstance.size < 2) {\n setSettings(JSON.stringify(defaultSettings, null, 2));\n }\n return get(settingsKey);\n}\n\nfunction deleteSettings(): void {\n rm(settingsKey);\n}\n\nfunction getConfigurations(): Configurations {\n return get(configurationKey);\n}\n\nexport { deleteSettings, getConfigurations, getSettings, setSettings };\n","export default {}","const fs = require('fs');\nconst path = require('path');\n\nconst pathFile = path.join(__dirname, 'path.txt');\n\nfunction getElectronPath () {\n let executablePath;\n if (fs.existsSync(pathFile)) {\n executablePath = fs.readFileSync(pathFile, 'utf-8');\n }\n if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {\n return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || 'electron');\n }\n if (executablePath) {\n return path.join(__dirname, 'dist', executablePath);\n } else {\n throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');\n }\n}\n\nmodule.exports = getElectronPath();\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { getConfigurations, getSettings, setSettings } from \"./storage\";\nimport { ipcMain } from \"electron\";\n\nfunction saveSettings(settings: string): void {\n setSettings(settings);\n}\n\nfunction loadSettings(): string {\n return getSettings();\n}\n\nfunction load(): void {\n ipcMain.handle(\n \"settings:save\",\n async (\n _event,\n {\n settings,\n }: {\n settings: string;\n },\n ): Promise<void> => {\n saveSettings(settings);\n },\n );\n\n ipcMain.handle(\"settings:load\", async (): Promise<string> => {\n return loadSettings();\n });\n}\n\nexport { getConfigurations, load };\n"],"names":["configurationKey","settingsKey","schema","storeInstance","Store","value","set","key","get","setSettings","getSettings","defaultSettings","getConfigurations","__viteBrowserExternal","fs","require$$0","path","require$$1","pathFile","getElectronPath","executablePath","electron","saveSettings","settings","loadSettings","load","ipcMain","_event"],"mappings":";;;GAwBMA,IAAmB,iBACnBC,IAAc,QAEdC,IAAS;AAAA,EACb,MAAM;AAAA,IACJ,MAAM;AAAA,EAAA;AAAA,EAER,eAAe;AAAA,IACb,MAAM;AAAA,EAAA;AAEV,GAEMC,IAAuB,IAAIC,EAAM;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AAJ;AAAA,IAAA,MAIgB;AAClB,MAAAD,EAAaC,CAAQ;AAAA,IACvB;AAAA,EAAA,GAGFG,UAAQ,OAAO,iBAAiB,YACvBF,EAAA,CACR;AACH;","x_google_ignoreList":[2]}
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/storage.ts","../__vite-browser-external","../../../../node_modules/.pnpm/electron@37.
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/storage.ts","../__vite-browser-external","../../../../node_modules/.pnpm/electron@37.2.5/node_modules/electron/index.js","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport defaultSettings from \"./defaultSettings.json\";\nimport { Configurations } from \"@xwiki/cristal-configuration-api\";\nimport Store from \"electron-store\";\n\nconst configurationKey = \"configuration\";\nconst settingsKey = \"_raw\";\n\nconst schema = {\n _raw: {\n type: \"string\",\n },\n configuration: {\n type: \"object\",\n },\n};\n\nconst storeInstance: Store = new Store({\n name: \"settings\",\n // Here, we want to keep in the store the raw string representation of the\n // file, since it should be parsed and serialized by the SettingsManager\n // service. We still include the deserialized object in case we want to check\n // some settings values on Electron's main process.\n serialize: (value: Record<string, unknown>) => value._raw as string,\n deserialize: (value: string) => ({ _raw: value, ...JSON.parse(value) }),\n schema,\n});\n\nfunction set<T>(key: string, value: T) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.set(key, value);\n}\n\nfunction get<T>(key: string): T {\n // @ts-expect-error type resolution failing because of electron-store library bug\n return storeInstance.get(key) as T;\n}\n\nfunction rm(key: string) {\n // @ts-expect-error type resolution failing because of electron-store library bug\n storeInstance.delete(key);\n}\n\nfunction setSettings(value: string): void {\n set(settingsKey, value);\n}\n\nfunction getSettings(): string {\n // @ts-expect-error type resolution failing because of electron-store library bug\n if (storeInstance.size < 2) {\n setSettings(JSON.stringify(defaultSettings, null, 2));\n }\n return get(settingsKey);\n}\n\nfunction deleteSettings(): void {\n rm(settingsKey);\n}\n\nfunction getConfigurations(): Configurations {\n return get(configurationKey);\n}\n\nexport { deleteSettings, getConfigurations, getSettings, setSettings };\n","export default {}","const fs = require('fs');\nconst path = require('path');\n\nconst pathFile = path.join(__dirname, 'path.txt');\n\nfunction getElectronPath () {\n let executablePath;\n if (fs.existsSync(pathFile)) {\n executablePath = fs.readFileSync(pathFile, 'utf-8');\n }\n if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {\n return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || 'electron');\n }\n if (executablePath) {\n return path.join(__dirname, 'dist', executablePath);\n } else {\n throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');\n }\n}\n\nmodule.exports = getElectronPath();\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { getConfigurations, getSettings, setSettings } from \"./storage\";\nimport { ipcMain } from \"electron\";\n\nfunction saveSettings(settings: string): void {\n setSettings(settings);\n}\n\nfunction loadSettings(): string {\n return getSettings();\n}\n\nfunction load(): void {\n ipcMain.handle(\n \"settings:save\",\n async (\n _event,\n {\n settings,\n }: {\n settings: string;\n },\n ): Promise<void> => {\n saveSettings(settings);\n },\n );\n\n ipcMain.handle(\"settings:load\", async (): Promise<string> => {\n return loadSettings();\n });\n}\n\nexport { getConfigurations, load };\n"],"names":["configurationKey","settingsKey","schema","storeInstance","Store","value","set","key","get","setSettings","getSettings","defaultSettings","getConfigurations","fs","require$$0","path","require$$1","pathFile","getElectronPath","executablePath","electron","saveSettings","settings","loadSettings","load","ipcMain","_event"],"mappings":"ipCAwBMA,EAAmB,gBACnBC,EAAc,OAEdC,EAAS,CACb,KAAM,CACJ,KAAM,QAAA,EAER,cAAe,CACb,KAAM,QAAA,CAEV,EAEMC,EAAuB,IAAIC,EAAM,CACrC,KAAM,WAKN,UAAYC,GAAmCA,EAAM,KACrD,YAAcA,IAAmB,CAAE,KAAMA,EAAO,GAAG,KAAK,MAAMA,CAAK,IACnE,OAAAH,CACF,CAAC,EAED,SAASI,EAAOC,EAAaF,EAAU,CAErCF,EAAc,IAAII,EAAKF,CAAK,CAC9B,CAEA,SAASG,EAAOD,EAAgB,CAE9B,OAAOJ,EAAc,IAAII,CAAG,CAC9B,CAOA,SAASE,EAAYJ,EAAqB,CACxCC,EAAIL,EAAaI,CAAK,CACxB,CAEA,SAASK,GAAsB,CAE7B,OAAIP,EAAc,KAAO,GACvBM,EAAY,KAAK,UAAUE,EAAiB,KAAM,CAAC,CAAC,EAE/CH,EAAIP,CAAW,CACxB,CAMA,SAASW,GAAoC,CAC3C,OAAOJ,EAAIR,CAAgB,CAC7B,ukBChFe,CAAA,iFCAf,MAAMa,EAAKC,EACLC,EAAOC,EAEPC,EAAWF,EAAK,KAAK,UAAW,UAAU,EAEhD,SAASG,GAAmB,CAC1B,IAAIC,EAIJ,GAHIN,EAAG,WAAWI,CAAQ,IACxBE,EAAiBN,EAAG,aAAaI,EAAU,OAAO,GAEhD,QAAQ,IAAI,4BACd,OAAOF,EAAK,KAAK,QAAQ,IAAI,4BAA6BI,GAAkB,UAAU,EAExF,GAAIA,EACF,OAAOJ,EAAK,KAAK,UAAW,OAAQI,CAAc,EAElD,MAAM,IAAI,MAAM,oGAAoG,CAExH,CAEA,OAAAC,EAAiBF,EAAe,cCGhC,SAASG,EAAaC,EAAwB,CAC5Cb,EAAYa,CAAQ,CACtB,CAEA,SAASC,GAAuB,CAC9B,OAAOb,EAAA,CACT,CAEA,SAASc,GAAa,CACpBC,EAAAA,QAAQ,OACN,gBACA,MACEC,EACA,CACE,SAAAJ,CAAA,IAIgB,CAClBD,EAAaC,CAAQ,CACvB,CAAA,EAGFG,UAAQ,OAAO,gBAAiB,SACvBF,EAAA,CACR,CACH","x_google_ignoreList":[2]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xwiki/cristal-electron-settings-main",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"license": "LGPL 2.1",
|
|
5
5
|
"author": "XWiki Org Community <contact@xwiki.org>",
|
|
6
6
|
"homepage": "https://cristal.xwiki.org/",
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"main": "./dist/index.es.js",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"electron-store": "10.1.0",
|
|
31
|
-
"@xwiki/cristal-settings-api": "0.
|
|
32
|
-
"@xwiki/cristal-configuration-api": "0.
|
|
31
|
+
"@xwiki/cristal-settings-api": "0.21.0",
|
|
32
|
+
"@xwiki/cristal-configuration-api": "0.21.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"electron": "37.
|
|
35
|
+
"electron": "37.2.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"typescript": "5.
|
|
39
|
-
"vite": "7.0.
|
|
40
|
-
"@xwiki/cristal-dev-config": "0.
|
|
38
|
+
"typescript": "5.9.2",
|
|
39
|
+
"vite": "7.0.6",
|
|
40
|
+
"@xwiki/cristal-dev-config": "0.21.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "tsc --project tsconfig.json && vite build",
|
package/src/index.ts
CHANGED
package/src/storage.ts
CHANGED
package/vite.config.ts
CHANGED
package/vitest.config.ts
CHANGED