@steambrew/ttc 2.5.3 → 2.6.3

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/package.json CHANGED
@@ -1,53 +1,53 @@
1
- {
2
- "name": "@steambrew/ttc",
3
- "version": "2.5.3",
4
- "type": "module",
5
- "main": "dist/index.js",
6
- "module": "dist/index.js",
7
- "bin": {
8
- "millennium-ttc": "dist/index.js"
9
- },
10
- "scripts": {
11
- "build": "rollup -c",
12
- "prepare": "npm run build"
13
- },
14
- "publishConfig": {
15
- "access": "public"
16
- },
17
- "keywords": [],
18
- "author": "",
19
- "license": "ISC",
20
- "description": "A tiny typescript compiler for Millennium plugins.",
21
- "dependencies": {
22
- "@babel/parser": "^7.27.0",
23
- "@babel/preset-env": "^7.26.0",
24
- "@babel/preset-react": "^7.25.9",
25
- "@babel/preset-typescript": "^7.27.0",
26
- "@babel/traverse": "^7.27.0",
27
- "@rollup/plugin-babel": "^6.0.4",
28
- "@rollup/plugin-commonjs": "^28.0.1",
29
- "@rollup/plugin-json": "^6.1.0",
30
- "@rollup/plugin-node-resolve": "^15.3.0",
31
- "@rollup/plugin-replace": "^6.0.1",
32
- "@rollup/plugin-terser": "^0.4.4",
33
- "@rollup/plugin-typescript": "^12.1.1",
34
- "@rollup/plugin-url": "^8.0.2",
35
- "@rollup/pluginutils": "^5.1.4",
36
- "chalk": "^5.3.0",
37
- "dotenv": "^16.4.7",
38
- "fs": "^0.0.1-security",
39
- "glob": "^11.0.2",
40
- "magic-string": "^0.30.17",
41
- "rollup": "^4.40.0",
42
- "rollup-plugin-inject-process-env": "^1.3.1",
43
- "rollup-plugin-polyfill-node": "^0.13.0",
44
- "rollup-plugin-scss": "^4.0.1",
45
- "sass": "^1.87.0",
46
- "tslib": "^2.8.1"
47
- },
48
- "devDependencies": {
49
- "@types/babel__traverse": "^7.20.7",
50
- "@types/glob": "^8.1.0",
51
- "@types/node": "^22.15.2"
52
- }
53
- }
1
+ {
2
+ "name": "@steambrew/ttc",
3
+ "version": "2.6.3",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "bin": {
8
+ "millennium-ttc": "dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "rollup -c",
12
+ "prepare": "npm run build"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "keywords": [],
18
+ "author": "SteamClientHomebrew",
19
+ "license": "MIT",
20
+ "description": "A tiny typescript compiler for Millennium plugins.",
21
+ "dependencies": {
22
+ "@babel/parser": "^7.27.5",
23
+ "@babel/preset-env": "^7.27.2",
24
+ "@babel/preset-react": "^7.27.1",
25
+ "@babel/preset-typescript": "^7.27.1",
26
+ "@babel/traverse": "^7.27.4",
27
+ "@rollup/plugin-babel": "^6.0.4",
28
+ "@rollup/plugin-commonjs": "^28.0.3",
29
+ "@rollup/plugin-json": "^6.1.0",
30
+ "@rollup/plugin-node-resolve": "^15.3.1",
31
+ "@rollup/plugin-replace": "^6.0.2",
32
+ "@rollup/plugin-terser": "^0.4.4",
33
+ "@rollup/plugin-typescript": "^12.1.2",
34
+ "@rollup/plugin-url": "^8.0.2",
35
+ "@rollup/pluginutils": "^5.1.4",
36
+ "chalk": "^5.4.1",
37
+ "dotenv": "^16.5.0",
38
+ "fs": "0.0.1-security",
39
+ "glob": "^11.0.2",
40
+ "magic-string": "^0.30.17",
41
+ "rollup": "^4.42.0",
42
+ "rollup-plugin-inject-process-env": "^1.3.1",
43
+ "rollup-plugin-polyfill-node": "^0.13.0",
44
+ "rollup-plugin-scss": "^4.0.1",
45
+ "sass": "^1.89.1",
46
+ "tslib": "^2.8.1"
47
+ },
48
+ "devDependencies": {
49
+ "@types/babel__traverse": "^7.20.7",
50
+ "@types/glob": "^8.1.0",
51
+ "@types/node": "^22.15.30"
52
+ }
53
+ }
package/rollup.config.js CHANGED
@@ -2,6 +2,9 @@ import commonjs from '@rollup/plugin-commonjs';
2
2
  import typescript from '@rollup/plugin-typescript';
3
3
  import json from '@rollup/plugin-json';
4
4
  import nodeResolve from '@rollup/plugin-node-resolve';
5
+ import { readFileSync } from 'fs';
6
+
7
+ const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
5
8
 
6
9
  export default {
7
10
  input: 'src/index.ts',
@@ -11,26 +14,9 @@ export default {
11
14
  },
12
15
  plugins: [commonjs(), typescript(), json(), nodeResolve()],
13
16
  external: [
14
- 'chalk',
15
- 'path',
16
- 'url',
17
- 'fs/promises',
18
- 'fs',
19
- 'rollup',
20
- '@rollup/plugin-json',
21
- '@rollup/plugin-commonjs',
22
- '@rollup/plugin-replace',
23
- '@rollup/plugin-typescript',
24
- '@rollup/plugin-node-resolve',
25
- 'rollup-plugin-import-css',
26
- '@rollup/plugin-terser',
27
- '@rollup/plugin-babel',
28
- 'rollup-plugin-inject-process-env',
29
- 'dotenv',
30
- 'perf_hooks',
31
- '@rollup/pluginutils',
32
- 'magic-string',
33
- 'rollup-plugin-scss',
34
- 'sass',
17
+ ...Object.keys(pkg.dependencies || {}),
18
+ ...Object.keys(pkg.peerDependencies || {}),
19
+ ...Object.keys(pkg.optionalDependencies || {}),
20
+ ...Object.keys(pkg.devDependencies || {}),
35
21
  ],
36
22
  };
package/src/plugin-api.ts CHANGED
@@ -10,6 +10,11 @@ declare global {
10
10
  * It is used to store the plugin settings and the plugin settings parser.
11
11
  */
12
12
  MILLENNIUM_PLUGIN_SETTINGS_STORE: any;
13
+ /**
14
+ * @description Used to store the settings for the plugin.
15
+ * Millennium then renders these in the settings panel.
16
+ */
17
+ MILLENNIUM_SIDEBAR_NAVIGATION_PANELS: any;
13
18
  }
14
19
  }
15
20
 
@@ -96,7 +101,20 @@ function ExecutePluginModule() {
96
101
  });
97
102
 
98
103
  /** Run the rolled up plugins default exported function */
99
- PluginModule.default();
104
+ let pluginProps = PluginModule.default();
105
+
106
+ function isValidSidebarNavComponent(obj: any) {
107
+ return obj && obj.title !== undefined && obj.icon !== undefined && obj.content !== undefined;
108
+ }
109
+
110
+ if (pluginProps && isValidSidebarNavComponent(pluginProps)) {
111
+ window.MILLENNIUM_SIDEBAR_NAVIGATION_PANELS[pluginName] = pluginProps;
112
+ } else {
113
+ console.warn(
114
+ `Plugin ${pluginName} does not contain proper SidebarNavigation props and therefor can't be mounted by Millennium. Please ensure it has a title, icon, and content.`,
115
+ );
116
+ return;
117
+ }
100
118
 
101
119
  /** If the current module is a client module, post message id=1 which calls the front_end_loaded method on the backend. */
102
120
  if (MILLENNIUM_IS_CLIENT_MODULE) {
@@ -116,6 +134,7 @@ function InitializePlugins() {
116
134
  */
117
135
  (window.PLUGIN_LIST ||= {})[pluginName] ||= {};
118
136
  (window.MILLENNIUM_PLUGIN_SETTINGS_STORE ||= {})[pluginName] ||= {};
137
+ window.MILLENNIUM_SIDEBAR_NAVIGATION_PANELS ||= {};
119
138
 
120
139
  /**
121
140
  * Accepted IPC message types from Millennium backend.
@@ -154,7 +173,7 @@ function InitializePlugins() {
154
173
  await new Promise((resolve) => setTimeout(resolve, 0));
155
174
  }
156
175
 
157
- MainWindowBrowserManager.m_browser.on('message', (messageId: string, data: string) => {
176
+ MainWindowBrowserManager?.m_browser?.on('message', (messageId: string, data: string) => {
158
177
  if (messageId !== IPCMessageId) {
159
178
  return;
160
179
  }
@@ -170,7 +189,7 @@ function InitializePlugins() {
170
189
  }
171
190
 
172
191
  function WebkitInitializeIPC() {
173
- SteamClient.BrowserView.RegisterForMessageFromParent((messageId: string, data: string) => {
192
+ SteamClient?.BrowserView?.RegisterForMessageFromParent((messageId: string, data: string) => {
174
193
  if (messageId !== IPCMessageId) {
175
194
  return;
176
195
  }