Skip to content

Commit 3b46933

Browse files
committed
make modfs core external
1 parent 3251227 commit 3b46933

File tree

4 files changed

+54
-11
lines changed

4 files changed

+54
-11
lines changed

Website/package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Website/package.json

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,38 @@
88
"version_name": "2.19.18",
99
"version_code": 21918,
1010
"verified_hosts": [
11-
["mmrl", "i"],
12-
["localhost", "i"],
13-
["mmrl.dergoogler.com", "i"],
14-
["dergoogler.com", "i"],
15-
["dergoogler.github.io", "i"],
16-
["gr.dergoogler.com", "i"],
17-
["googlers-repo.github.io", "i"],
18-
["(localhost|\\b(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)(?::\\d{0,4})?\\b)", "g"]
11+
[
12+
"mmrl",
13+
"i"
14+
],
15+
[
16+
"localhost",
17+
"i"
18+
],
19+
[
20+
"mmrl.dergoogler.com",
21+
"i"
22+
],
23+
[
24+
"dergoogler.com",
25+
"i"
26+
],
27+
[
28+
"dergoogler.github.io",
29+
"i"
30+
],
31+
[
32+
"gr.dergoogler.com",
33+
"i"
34+
],
35+
[
36+
"googlers-repo.github.io",
37+
"i"
38+
],
39+
[
40+
"(localhost|\\b(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)(?::\\d{0,4})?\\b)",
41+
"g"
42+
]
1943
]
2044
},
2145
"main": "index.tsx",
@@ -68,6 +92,7 @@
6892
"markdown-to-jsx": "^7.4.0",
6993
"material-icons": "^1.10.8",
7094
"material-ui-confirm": "^3.0.11",
95+
"modfs": "^1.0.0",
7196
"monaco-editor": "^0.48.0",
7297
"monaco-editor-core": "^0.46.0",
7398
"monaco-languageclient": "^6.5.0",

Website/src/hooks/useModFS.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { SetStateAction } from "./useStateCallback";
55
import { formatObjectEntries, formatString } from "@Util/stringFormat";
66
import { useNativeFileStorage } from "./useNativeFileStorage";
77

8+
import { default as PModFS } from "modfs";
9+
810
export interface ModFS {
911
//cli
1012
MSUCLI: string;
@@ -128,12 +130,14 @@ export const useModFS = () => {
128130
export const ModFSProvider = (props: React.PropsWithChildren) => {
129131
const [modFS, setModFS] = useNativeFileStorage("/data/adb/mmrl/modfs.json", INITIAL_MOD_CONF, { loader: "json" });
130132

133+
const pmodFS = React.useMemo(() => new PModFS(defaultComposer(INITIAL_MOD_CONF, modFS)), [modFS]);
134+
131135
const contextValue = React.useMemo(
132136
() => ({
133137
_modFS: defaultComposer(INITIAL_MOD_CONF, modFS),
134-
__modFS: formatObjectEntries<ModFS>(defaultComposer(INITIAL_MOD_CONF, modFS)),
135-
modFS: (key, adds) => {
136-
return formatString(defaultComposer(INITIAL_MOD_CONF, modFS)[key], { ...modFS, ...adds });
138+
__modFS: pmodFS.formatEntries(),
139+
modFS<K extends keyof ModFS>(key: K, adds: ModFS | object): ModFS[K] {
140+
return PModFS.format(pmodFS.getEntrie(key)!, { ...modFS, ...adds });
137141
},
138142
setModFS: (name, state) => {
139143
setModFS((prev) => {

Website/src/util/licenses.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,14 @@
212212
"version": "3.0.11",
213213
"source": "https://www.npmjs.com/package/material-ui-confirm"
214214
},
215+
{
216+
"name": "modfs",
217+
"author": null,
218+
"license": "MIT",
219+
"description": "ModFS is a json format processor and also used in MMRL as the ModFS system",
220+
"version": "1.0.0",
221+
"source": "https://www.npmjs.com/package/modfs"
222+
},
215223
{
216224
"name": "monaco-editor",
217225
"author": null,

0 commit comments

Comments
 (0)