t3mode 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hezaerd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,13 @@
1
- # Temporary Holding Version
1
+ # t3mode
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The `t3mode` command. It installs [t3mode](https://github.com/Hezaerd/t3mode), the plugin loader for the [T3 Code](https://github.com/pingdotgg/t3code) desktop app on Windows, and manages its plugins.
4
+
5
+ ```sh
6
+ npx t3mode install --wait --launch
7
+ ```
8
+
9
+ `--wait` waits until you close T3 Code. `--launch` starts it again when the install is done.
10
+
11
+ To keep the command, install it globally with `npm install --global t3mode`. Other commands: `t3mode status`, `t3mode plugin add <owner/repo>`, `t3mode safe`, `t3mode uninstall`. Run `t3mode --help` for the full list.
12
+
13
+ t3mode is a community project. The T3 Code team doesn't make or support it.
@@ -0,0 +1,94 @@
1
+ // \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ let node_fs = require("node:fs");
23
+ node_fs = __toESM(node_fs, 1);
24
+ let node_module = require("node:module");
25
+ node_module = __toESM(node_module, 1);
26
+ let node_path = require("node:path");
27
+ node_path = __toESM(node_path, 1);
28
+ let electron = require("electron");
29
+ /** File names inside T3 Code's `resources` folder. */
30
+ const Resources = {
31
+ shimAsar: "app.asar",
32
+ originalAsar: "_app.asar",
33
+ unpacked: "app.asar.unpacked",
34
+ originalUnpacked: "_app.asar.unpacked"
35
+ };
36
+ /** T3 Code's data folder: `T3CODE_HOME`, or `~/.t3`. */
37
+ const t3HomePath = (env, homeDirectory) => env["T3CODE_HOME"]?.trim() || node_path.join(homeDirectory, ".t3");
38
+ const resolveHomeRoot = (env, homeDirectory) => env["T3MODE_HOME"]?.trim() || node_path.join(t3HomePath(env, homeDirectory), "t3mode");
39
+ const homeLayout = (root) => {
40
+ const dist = node_path.join(root, "dist");
41
+ const logs = node_path.join(root, "logs");
42
+ return {
43
+ root,
44
+ dist,
45
+ mainJs: node_path.join(dist, "main.cjs"),
46
+ preloadJs: node_path.join(dist, "preload.cjs"),
47
+ rendererJs: node_path.join(dist, "renderer.js"),
48
+ settings: node_path.join(root, "settings.json"),
49
+ state: node_path.join(root, "state.json"),
50
+ logs,
51
+ mainLog: node_path.join(logs, "main.log"),
52
+ shimLog: node_path.join(logs, "shim.log"),
53
+ safeMode: node_path.join(root, "SAFE_MODE"),
54
+ shortcutSeeded: node_path.join(root, "shortcut-seeded"),
55
+ repairJs: node_path.join(dist, "repair.cjs"),
56
+ shimJs: node_path.join(dist, "shim.cjs"),
57
+ updateHelper: node_path.join(dist, "update-helper.ps1"),
58
+ updates: node_path.join(root, "updates"),
59
+ updateReady: node_path.join(root, "updates", "ready.json"),
60
+ updateLog: node_path.join(logs, "update.log"),
61
+ plugins: node_path.join(root, "plugins"),
62
+ pluginsLock: node_path.join(root, "plugins.json"),
63
+ pluginData: node_path.join(root, "plugin-data")
64
+ };
65
+ };
66
+ // src/index.ts
67
+ const originalAsar = node_path.join(process.resourcesPath, Resources.originalAsar);
68
+ const logShimError = (layout, error) => {
69
+ try {
70
+ node_fs.mkdirSync(layout.logs, { recursive: true });
71
+ const detail = error instanceof Error ? error.stack ?? error.message : String(error);
72
+ node_fs.appendFileSync(layout.shimLog, `${(/* @__PURE__ */ new Date()).toISOString()} loader failed: ${detail}\n`);
73
+ } catch {}
74
+ };
75
+ const loadMod = () => {
76
+ if (process.env["T3MODE_DISABLE"] === "1") return;
77
+ const layout = homeLayout(resolveHomeRoot(process.env, electron.app.getPath("home")));
78
+ if (!node_fs.existsSync(layout.mainJs)) return;
79
+ try {
80
+ node_module.createRequire(layout.mainJs)(layout.mainJs);
81
+ } catch (error) {
82
+ logShimError(layout, error);
83
+ }
84
+ };
85
+ const bootOriginal = () => {
86
+ const pkg = JSON.parse(node_fs.readFileSync(node_path.join(originalAsar, "package.json"), "utf8"));
87
+ const mainPath = node_path.join(originalAsar, pkg.main ?? "index.js");
88
+ electron.app.setAppPath(originalAsar);
89
+ const load = node_module.createRequire(mainPath);
90
+ if (load.main) load.main.filename = mainPath;
91
+ load(mainPath);
92
+ };
93
+ loadMod();
94
+ bootOriginal();