You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Core extensions are extensions built into moonlight. They are usually libraries or important features.
8
+
9
+
Core extensions cannot be uninstalled, but they can be disabled. Some core extensions are enabled by default when moonlight is installed for the first time.
10
+
11
+
The biggest core extension is [Moonbase](https://github.com/moonlight-mod/moonlight/tree/main/packages/core-extensions/src/moonbase), which is responsible for installing and updating extensions, updating moonlight itself, and providing a UI to manage everything. moonlight's core does not contain any functionality for installing/updating extensions or updating moonlight, and it is instead implemented inside of Moonbase.
12
+
13
+
## Developing core extensions
14
+
15
+
Core extensions live in the `packages/core-extensions` folder in the moonlight repository. As such, adding new core extensions must be done in a [pull request](/dev/setup).
16
+
17
+
Keep in mind that moonlight currently [uses a separate build system](/dev/project-structure#build-system) from other external extensions, so there may be more bugs, and some changes may not apply until you [restart the development server](/ext-dev/getting-started#edit-and-reload-your-extension).
18
+
19
+
## Creating a new core extension
20
+
21
+
Before you create a core extension, consider if your extension idea is a good fit for a core extension. An extension is a good fit for a core extension if it's a library or development tool, but actual features or tweaks should usually be distributed on a extension repository instead. This isn't a hard rule, though, so feel free to ask if you're considering making a core extension!
22
+
23
+
After cloning moonlight, simply create a new folder with a `manifest.json` inside of it, and structure it like a normal moonlight extension. The extension manifest should not contain a `version` or `meta.source`.
24
+
25
+
## Adding types
26
+
27
+
The types for core extensions should be placed in the `types` package so other extensions can use them.
28
+
29
+
- Create a new file in the `coreExtensions` folder, and export the types from there.
30
+
- Re-export the types in `coreExtensions.ts`.
31
+
- Register the type in the Webpack require function in `discord/require.ts`.
32
+
- Register the type for module imports in `import.d.ts`.
Copy file name to clipboardExpand all lines: src/content/docs/dev/project-structure.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,9 +50,7 @@ The types package is published alongside moonlight releases, but some moonlight
50
50
51
51
## Core extensions
52
52
53
-
Core extensions are extensions built into moonlight. They cannot be uninstalled, but they can be disabled. A few core extensions are enabled by default when the config is created for the first time. An extension is a good fit for a core extension if it's a library or development tool, but actual features or tweaks should usually be distributed on a extension repository instead. This isn't a hard rule, though, so feel free to ask if you're considering making a core extension!
54
-
55
-
The biggest core extension is [Moonbase](https://github.com/moonlight-mod/moonlight/tree/main/packages/core-extensions/src/moonbase), which is responsible for installing and updating extensions, updating moonlight itself, and providing a UI to manage everything. Unlike other client mods, Moonbase is just implemented as another extension, and can be disabled if the user wants. The core does not contain any functionality for installing/updating extensions or updating moonlight, and it is instead implemented inside of Moonbase.
53
+
Core extensions are extensions built into moonlight. This section has moved into its own dedicated page, which you can see [here](/dev/core-extensions).
Copy file name to clipboardExpand all lines: src/content/docs/dev/setup.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,20 +5,19 @@ sidebar:
5
5
order: 1
6
6
---
7
7
8
+
moonlight requires [Node.js](https://nodejs.org) 22 and [pnpm](https://pnpm.io) 10.
8
9
9
-
You will need [pnpm](https://pnpm.io) 10, as moonlight uses it for dependency and workspace management.
10
-
11
-
- Clone the repository.
12
-
- Install dependencies with `pnpm i`.
13
-
- Build the project with `pnpm run build`.
10
+
- Clone the repository: `git clone https://github.com/moonlight-mod/moonlight.git`
11
+
- Install dependencies: `pnpm install`.
12
+
- Build the project: `pnpm run build`.
14
13
- For working on moonlight, a watch mode is available with `pnpm run dev`.
15
14
16
15
For more information on project structure, [see the dedicated page](/dev/project-structure).
17
16
18
17
## Contribution guidelines
19
18
20
19
- Ensure your commits pass Prettier/ESLint. This is a requirement for merge.
21
-
- moonlight uses [husky](https://typicode.github.io/husky/) to check lints on commit.
20
+
- moonlight uses [husky](https://typicode.github.io/husky) to check lints on commit. This should have automatically been setup for you when running `pnpm install`.
22
21
- Please make PRs to the `develop` branch instead of `main`.
23
22
-`develop` is merged into `main` when moonlight updates happen. Our in-progress work resides on `develop`.
Copy file name to clipboardExpand all lines: src/content/docs/ext-dev/api.md
+40-2Lines changed: 40 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,36 +14,74 @@ The global types are available [here](https://github.com/moonlight-mod/moonlight
14
14
-`moonlightNode`: available in the web *and* Node.js environments
15
15
- Contains configuration details, browser checks
16
16
- Polyfilled in the browser extension
17
-
-`moonlightNodeSandboxed`: available in the Node.js environments (`node.ts`)
17
+
-`moonlightNodeSandboxed`: available in the host and Node.js environments (`host.ts`, `node.ts`)
18
18
- Contains filesystem APIs
19
19
-`moonlightHost`: available in the host environment (`host.ts`)
20
20
- Contains configuration details, `.asar` path
21
21
22
22
## Extension libraries
23
23
24
-
Remember to [add the module as a dependency](/ext-dev/webpack#webpack-module-dependencies).
24
+
These libraries are built into moonlight as [core extensions](/dev/core-extensions). Remember to [add the extension dependency](/ext-dev/cookbook#using-another-extension-as-a-library) and [add the module dependency](/ext-dev/webpack#webpack-module-dependencies) before using these libraries.
25
+
26
+
### App Panels
27
+
28
+
Add custom "app panels" next to the user area and mute buttons.
Copy file name to clipboardExpand all lines: src/content/docs/ext-dev/devtools.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,19 +7,19 @@ sidebar:
7
7
8
8
The Chrome DevTools is a panel/window that offers several utilities for web development. Normally, it is intended for the creators of the target application, but it also serves as an excellent tool for client modders.
9
9
10
+
To open DevTools, press `Ctrl + Shift + I`. If this keybind doesn't do anything, you may need to [enable DevTools](#enabling-devtools) first.
11
+
10
12
## Enabling DevTools
11
13
12
-
In some branches of Discord, the following is required in the `settings.json` file (*not* the moonlight config file):
14
+
In some branches of Discord, you must enable DevTools in Discord's config file. This is *not* the moonlight config file, and it is present in [Discord's config folder](/using/crash-recovery#finding-discords-logs). Add this entry to `settings.json`, then restart your client:
Also see [this page](/ext-dev/webpack#common-patterns) for common patterns to look out for.
38
+
Some patterns may stick out when reading minified Discord source code:
39
+
40
+
- The pattern `n(/* some number */)` (or some other minified variable) represents a Webpack module require, and the function argument is the module ID. You can pass that module ID to `spacepack.inspect` to read the required module's source.
41
+
-`Z` and `ZP` usually correspond to `default` exports. Despite being minified, these export names are stable.
42
+
- Mentions of `jsx` and `createElement` imply construction of React components.
39
43
40
44
## Using the Sources tab
41
45
@@ -53,7 +57,7 @@ You can set breakpoints on Webpack modules to inspect the variables at runtime.
53
57
54
58
React DevTools allows you to inspect the React component tree easier, instead of its representation with the DOM. You can view the sources of components and their props this way.
55
59
56
-
Either [use the rehosted version](https://moon.light.pm/files/reactdevtools.zip) or [download the extension and extract it yourself](https://react.dev/learn/react-developer-tools). Use the "DevTools Extensions" extension to load it - remember to restart Discord fully after configuring it. A new Components tab will appear in DevTools.
60
+
Either [use the rehosted version](https://moon.light.pm/files/reactdevtools.zip) or [download the extension and extract it yourself](https://react.dev/learn/react-developer-tools). Use the "DevTools Extensions" extension to load it, and remember to restart Discord fully after configuring it. Once loaded, a new Components tab will appear in DevTools.
57
61
58
62
You can use the element picker to select components. Props are available on the right side. Click the bug icon to view data about the component. Click the bracket icon to view the source of the component.
0 commit comments