Skip to content

Commit

Permalink
[webpack] test5
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed Sep 14, 2024
1 parent 23d3360 commit 2cc0a67
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"application_id": "com.dergoogler.mmrl",
"min_sdk": 26,
"target_sdk": 34,
"version_name": "3.24.27",
"version_code": 32427,
"version_name": "3.24.28",
"version_code": 32428,
"verified_hosts": [
[
"mmrl",
Expand Down
30 changes: 20 additions & 10 deletions src/activitys/ModConfActivity/components/ModConfView/libs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,26 @@ import { useConfirm } from "material-ui-confirm";
import { Markup } from "@Components/Markdown";
import { DialogEditTextListItem } from "@Components/DialogEditTextListItem";
import { SearchActivity } from "@Activitys/SearchActivity";
import React from "react";
import { withRequireNewVersion } from "../../../../hoc/withRequireNewVersion";
import { CodeBlock } from "@Components/CodeBlock";
import { VerifiedIcon } from "@Components/icons/VerifiedIcon";
import { IsolatedFunctionBlockError } from "@Native/IsolatedEval/IsolatedFunctionBlockError";
import { Terminal } from "@Native/Terminal";
import { useFetch } from "@Hooks/useFetch";

// Libaries
import * as React from "react";
import * as MUI from "@mui/material";
import * as ICONS_MUI from "@mui/icons-material";
import * as LAB_MUI from "@mui/lab";
import * as FlatListReact from "flatlist-react";
import OnsenUI from "onsenui";
import * as DefaultComposer from "default-composer";
import * as UseHooksTS from "usehooks-ts";
import * as ModFS from "modfs";

export const InternalReact = {
...require("react"),
...React,
createElement(type: any, props: any, ...children: any[]) {
switch (type) {
// prevents webview url change
Expand All @@ -47,17 +57,17 @@ export const InternalReact = {
export const libraries = {
react: InternalReact,

"@mui/material": require("@mui/material"),
"@mui/material": MUI,

"@mui/lab": require("@mui/lab"),
"@mui/lab": LAB_MUI,

"@mui/icons-material": require("@mui/icons-material"),
"@mui/icons-material": ICONS_MUI,

"@mmrl/terminal": os.isAndroid ? Terminal : {},

"flatlist-react": require("flatlist-react").default,
"flatlist-react": FlatListReact,

onsenui: require("onsenui").default,
onsenui: OnsenUI,

"@mmrl/activity": {
SearchActivity: SearchActivity,
Expand Down Expand Up @@ -106,10 +116,10 @@ export const libraries = {
ConfigProvider: ConfigProvider,
StringsProvider: StringsProvider,
},
modfs: require("modfs"),
"default-composer": require("default-composer"),
modfs: ModFS,
"default-composer": DefaultComposer,
"usehooks-ts": {
...require("usehooks-ts"),
...UseHooksTS,
useLocalStorage: undefined,
useScript: undefined,
useSessionStorage: undefined,
Expand Down
8 changes: 6 additions & 2 deletions src/native/IsolatedEval/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import { IsolatedFunctionBlockError } from "./IsolatedFunctionBlockError";
import { InternalReact } from "@Activitys/ModConfActivity/components/ModConfView/libs";
import ModFS from "modfs";

import YAML from "yaml";
import INI from "ini";

type IsoModule = {
exports: {
default?: any;
Expand All @@ -45,8 +48,8 @@ class IsolatedEval<T = any> {
private readonly _globals = {
...Sandbox.SAFE_GLOBALS,
JSON: JSON,
YAML: require("yaml"),
INI: require("ini"),
YAML: YAML,
INI: INI,
console: console,
document: new IsoDocument(),
Toast: Toast,
Expand Down Expand Up @@ -170,6 +173,7 @@ class IsolatedEval<T = any> {

public require(modulePath: string) {
// Check if the module is a core module
console.log(this.libraries[modulePath])
if (this.libraries[modulePath]) {
return this.libraries[modulePath];
}
Expand Down

0 comments on commit 2cc0a67

Please sign in to comment.