@skathi-native/cli 0.0.0 → 0.1.0-beta.2
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/aot-inputs.ts +294 -0
- package/ascii.ts +397 -0
- package/build.ts +1236 -0
- package/check/builtins.json +1219 -0
- package/check/builtins.ts +112 -0
- package/check/codes.ts +178 -0
- package/check/command.ts +105 -0
- package/check/config.ts +76 -0
- package/check/finding.ts +30 -0
- package/check/graph.ts +69 -0
- package/check/highlight.ts +40 -0
- package/check/index.ts +308 -0
- package/check/packages.ts +54 -0
- package/check/program.ts +209 -0
- package/check/report.ts +219 -0
- package/check/rules.ts +307 -0
- package/check/schema.ts +69 -0
- package/check/typing.ts +703 -0
- package/cli/assets.ts +114 -0
- package/cli/build-app.ts +587 -0
- package/cli/config.ts +646 -0
- package/cli/create.ts +327 -0
- package/cli/dev.ts +92 -0
- package/cli/elf.ts +142 -0
- package/cli/help.ts +160 -0
- package/cli/host-fetch.ts +178 -0
- package/cli/host.ts +378 -0
- package/cli/icon.ts +303 -0
- package/cli/macos-bundle.ts +451 -0
- package/cli/pe.ts +429 -0
- package/cli/platform.ts +74 -0
- package/cli/sk.ts +290 -0
- package/cli/skpk.ts +268 -0
- package/cli/stamp.ts +254 -0
- package/cli/term.ts +176 -0
- package/cli/versioninfo.ts +123 -0
- package/css-prefixes.ts +118 -0
- package/devtools/apps.ts +68 -0
- package/devtools/commands.ts +860 -0
- package/devtools/ctl.ts +166 -0
- package/package.json +52 -3
- package/prod.ts +701 -0
- package/runtime-path.ts +24 -0
- package/tailwind.ts +76 -0
- package/templates/minimal/assets/hello.txt +1 -0
- package/templates/minimal/src/App.vue +142 -0
- package/templates/minimal/src/main.ts +4 -0
- package/templates/showcase/assets/hello.txt +1 -0
- package/templates/showcase/assets/media/aurora.png +0 -0
- package/templates/showcase/assets/media/clip.mp4 +0 -0
- package/templates/showcase/assets/media/sticker.tgs +0 -0
- package/templates/showcase/src/App.vue +128 -0
- package/templates/showcase/src/components/Card.vue +41 -0
- package/templates/showcase/src/components/Icon.vue +29 -0
- package/templates/showcase/src/components/Missing.vue +26 -0
- package/templates/showcase/src/components/Page.vue +41 -0
- package/templates/showcase/src/components/Titlebar.vue +128 -0
- package/templates/showcase/src/engine.ts +33 -0
- package/templates/showcase/src/icons.ts +22 -0
- package/templates/showcase/src/main.ts +7 -0
- package/templates/showcase/src/pages/AudioPage.vue +124 -0
- package/templates/showcase/src/pages/FilesPage.vue +91 -0
- package/templates/showcase/src/pages/FormsPage.vue +139 -0
- package/templates/showcase/src/pages/GraphicsPage.vue +156 -0
- package/templates/showcase/src/pages/HomePage.vue +141 -0
- package/templates/showcase/src/pages/LocalePage.vue +71 -0
- package/templates/showcase/src/pages/MediaPage.vue +85 -0
- package/templates/showcase/src/pages/MotionPage.vue +199 -0
- package/templates/showcase/src/pages/NetworkPage.vue +103 -0
- package/templates/showcase/src/pages/PermissionsPage.vue +80 -0
- package/templates/showcase/src/pages/StoragePage.vue +117 -0
- package/templates/showcase/src/pages/StylesPage.vue +199 -0
- package/templates/showcase/src/pages/SystemPage.vue +89 -0
- package/templates/showcase/src/pages/TrayPage.vue +66 -0
- package/templates/showcase/src/pages/WindowPage.vue +128 -0
- package/templates/showcase/src/product.ts +2 -0
- package/templates/showcase/src/router.ts +149 -0
- package/templates/showcase/src/stores/counter.ts +9 -0
- package/templates/showcase/src/stores/desktop.ts +115 -0
- package/templates/showcase/src/styles.css +140 -0
- package/vitecompat.ts +1151 -0
package/devtools/apps.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finding a PACKAGED app's devtools handshake (`--app <name>`): a packaged exe publishes
|
|
3
|
+
* `%TEMP%\skathi\apps\<sk.config name>\<pid>\devtools.json`; `--app hello` picks the newest
|
|
4
|
+
* one whose process is still alive. Zero dependencies, like `ctl.ts`.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
8
|
+
import { tmpdir } from "node:os";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
|
|
11
|
+
export const appsRoot = () => join(tmpdir(), "skathi", "apps");
|
|
12
|
+
|
|
13
|
+
export function slotName(name: string): string {
|
|
14
|
+
const cleaned = [...name]
|
|
15
|
+
.map((c) => (/[A-Za-z0-9._-]/.test(c) ? c : "-"))
|
|
16
|
+
.slice(0, 64)
|
|
17
|
+
.join("")
|
|
18
|
+
.replace(/^[-.]+|[-.]+$/g, "");
|
|
19
|
+
return cleaned || "sk-host";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function alive(pid: number): boolean {
|
|
23
|
+
try {
|
|
24
|
+
process.kill(pid, 0);
|
|
25
|
+
return true;
|
|
26
|
+
} catch (e) {
|
|
27
|
+
// EPERM: it exists, it just is not ours to signal.
|
|
28
|
+
return (e as NodeJS.ErrnoException).code === "EPERM";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface AppSlot {
|
|
33
|
+
dir: string;
|
|
34
|
+
pid: number;
|
|
35
|
+
port: number;
|
|
36
|
+
at: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function appSlots(name: string): AppSlot[] {
|
|
40
|
+
const root = join(appsRoot(), slotName(name));
|
|
41
|
+
if (!existsSync(root)) return [];
|
|
42
|
+
const out: AppSlot[] = [];
|
|
43
|
+
for (const leaf of readdirSync(root)) {
|
|
44
|
+
const dir = join(root, leaf);
|
|
45
|
+
const file = join(dir, "devtools.json");
|
|
46
|
+
try {
|
|
47
|
+
const h = JSON.parse(readFileSync(file, "utf8")) as { port?: number; pid?: number };
|
|
48
|
+
const pid = Number(h.pid ?? leaf);
|
|
49
|
+
if (!h.port || !alive(pid)) continue;
|
|
50
|
+
out.push({ dir, pid, port: h.port, at: statSync(file).mtimeMs });
|
|
51
|
+
} catch {
|
|
52
|
+
// no handshake (devtools off, or still booting) — not attachable
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return out.sort((a, b) => b.at - a.at);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function appSlot(name: string): { dir: string } | { error: string } {
|
|
59
|
+
const slots = appSlots(name);
|
|
60
|
+
if (slots.length) return { dir: slots[0]!.dir };
|
|
61
|
+
const root = join(appsRoot(), slotName(name));
|
|
62
|
+
return {
|
|
63
|
+
error:
|
|
64
|
+
`no running packaged app "${name}" with its devtools on (looked in ${root}). ` +
|
|
65
|
+
`Start the exe; an app built on the no-devtools host, or one that called appDevtools.disable(), ` +
|
|
66
|
+
`publishes no handshake.`,
|
|
67
|
+
};
|
|
68
|
+
}
|