@myop/cli 0.1.23 β 0.1.24
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/dist/myop-cli.js +758 -692
- package/package.json +1 -1
package/dist/myop-cli.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
import
|
|
6
|
-
import { select as
|
|
7
|
-
import { Command as
|
|
8
|
-
import { execSync as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { URL as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
const
|
|
2
|
+
var at = Object.defineProperty;
|
|
3
|
+
var lt = (o, e, t) => e in o ? at(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
4
|
+
var fe = (o, e, t) => lt(o, typeof e != "symbol" ? e + "" : e, t);
|
|
5
|
+
import V from "ora";
|
|
6
|
+
import { select as We, Separator as Ee } from "@inquirer/prompts";
|
|
7
|
+
import { Command as ct, Option as ce } from "commander";
|
|
8
|
+
import { execSync as he, spawn as dt } from "child_process";
|
|
9
|
+
import te from "path";
|
|
10
|
+
import D from "fs";
|
|
11
|
+
import je from "crypto";
|
|
12
|
+
import pt from "http";
|
|
13
|
+
import { URL as Ve, URLSearchParams as Ge } from "url";
|
|
14
|
+
import mt from "open";
|
|
15
|
+
import ut from "os";
|
|
16
|
+
const ft = `
|
|
17
17
|
Usage: myop [OPTIONS] COMMAND [ARGS]...
|
|
18
18
|
|
|
19
19
|
A powerful command-line interface for managing your Myop projects.
|
|
@@ -47,7 +47,7 @@ Examples:
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
`,
|
|
50
|
+
`, y = {
|
|
51
51
|
program: null,
|
|
52
52
|
executionPath: "",
|
|
53
53
|
options: {
|
|
@@ -55,81 +55,81 @@ Examples:
|
|
|
55
55
|
verbose: !1
|
|
56
56
|
},
|
|
57
57
|
myopConfig: null
|
|
58
|
-
},
|
|
58
|
+
}, Ye = {
|
|
59
59
|
name: "π₯ Install Myop generated dependencies",
|
|
60
60
|
value: "myopInstall",
|
|
61
61
|
description: "Fetch and generates Myop dependencies. flows including components, refs and props.",
|
|
62
62
|
action: async () => {
|
|
63
63
|
console.info("installing... ");
|
|
64
|
-
for (const o of
|
|
65
|
-
const e =
|
|
64
|
+
for (const o of y.myopConfig.flows) {
|
|
65
|
+
const e = te.join(y.executionPath, "/node_modules/@myop/flow-types/");
|
|
66
66
|
console.info(`Generate flow at ${e}`), console.info(`Generated flow at ${e}`);
|
|
67
67
|
}
|
|
68
68
|
process.exit();
|
|
69
69
|
}
|
|
70
70
|
}, gt = (o) => {
|
|
71
|
-
const e =
|
|
71
|
+
const e = te.join(y.executionPath, o);
|
|
72
72
|
console.info(`reading config file from: ${e}`);
|
|
73
|
-
const t =
|
|
73
|
+
const t = D.readFileSync(e, "utf8"), n = JSON.parse(t);
|
|
74
74
|
return console.info("config file loaded, ", n), n;
|
|
75
|
-
},
|
|
76
|
-
const t =
|
|
75
|
+
}, Ne = (o, e) => {
|
|
76
|
+
const t = te.join(y.executionPath, o);
|
|
77
77
|
console.info(`writing config file to: ${t}`);
|
|
78
78
|
try {
|
|
79
79
|
const n = JSON.stringify(e, null, 2);
|
|
80
|
-
|
|
80
|
+
D.writeFileSync(t, n), console.info(`config file updated ${n}`);
|
|
81
81
|
} catch (n) {
|
|
82
82
|
throw console.info(`error ${n} while writing to ${t}, JSON: ${e}`), console.log(`
|
|
83
83
|
β οΈ Failed write config file to ${t}, for more info use verbose flag`), n;
|
|
84
84
|
}
|
|
85
|
-
},
|
|
85
|
+
}, Ke = {
|
|
86
86
|
name: "π Add flow definition to your project",
|
|
87
87
|
value: "addFlow",
|
|
88
88
|
description: "Adds flow to yours myop.config.json",
|
|
89
89
|
_action: (o) => {
|
|
90
|
-
|
|
90
|
+
y.myopConfig.flows.includes(o) || y.myopConfig.flows.push(o), Ne(y.options.configPath, y.myopConfig);
|
|
91
91
|
},
|
|
92
92
|
action: async () => {
|
|
93
93
|
}
|
|
94
|
-
},
|
|
94
|
+
}, Qe = {
|
|
95
95
|
name: "π« Remove flow definition from your project",
|
|
96
96
|
value: "removeFlow",
|
|
97
97
|
description: "Removes flow to yours myop.config.json",
|
|
98
98
|
_action: (o) => {
|
|
99
|
-
|
|
99
|
+
y.myopConfig.flows = y.myopConfig.flows.filter((e) => e !== o), Ne(y.options.configPath, y.myopConfig);
|
|
100
100
|
},
|
|
101
101
|
action: () => {
|
|
102
102
|
}
|
|
103
|
-
},
|
|
103
|
+
}, ht = {
|
|
104
104
|
name: "π Quit",
|
|
105
105
|
value: "quit",
|
|
106
106
|
description: "Quit and continue coding.",
|
|
107
107
|
action: () => {
|
|
108
108
|
process.exit();
|
|
109
109
|
}
|
|
110
|
-
},
|
|
110
|
+
}, yt = {
|
|
111
111
|
name: "π’ Create new component",
|
|
112
112
|
value: "-",
|
|
113
113
|
disabled: "(not available yet)"
|
|
114
|
-
},
|
|
114
|
+
}, wt = {
|
|
115
115
|
name: "π΅ Create new experience",
|
|
116
116
|
value: "-",
|
|
117
117
|
disabled: "(not available yet)"
|
|
118
|
-
},
|
|
118
|
+
}, vt = {
|
|
119
119
|
name: "π‘ Create new skin",
|
|
120
120
|
value: "-",
|
|
121
121
|
disabled: "(not available yet)"
|
|
122
|
-
},
|
|
122
|
+
}, bt = {
|
|
123
123
|
name: "π΄ Create new flow",
|
|
124
124
|
value: "-",
|
|
125
125
|
disabled: "(not available yet)"
|
|
126
|
-
},
|
|
126
|
+
}, St = {
|
|
127
127
|
name: "π Define new custom Myop message",
|
|
128
128
|
value: "generateMyopMessage",
|
|
129
129
|
description: "οΈHelp you creates the right structure for a new Myop message, including types and handlers.",
|
|
130
130
|
disabled: "(not available yet)"
|
|
131
|
-
},
|
|
132
|
-
function
|
|
131
|
+
}, xt = [St, yt, wt, vt, bt];
|
|
132
|
+
function $t(o, e, t, n) {
|
|
133
133
|
return `<!DOCTYPE html>
|
|
134
134
|
<html lang="en">
|
|
135
135
|
<head>
|
|
@@ -219,34 +219,34 @@ ${n}
|
|
|
219
219
|
</body>
|
|
220
220
|
</html>`;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Ct(o) {
|
|
223
223
|
return o.includes("esbuild") && o.includes("another platform");
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function Mt(o) {
|
|
226
226
|
return o.includes("ERR_MODULE_NOT_FOUND") && o.includes("esbuild");
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Pt() {
|
|
229
229
|
console.error(`
|
|
230
230
|
β esbuild platform mismatch detected!`), console.error(" Your node_modules contains esbuild binaries for a different OS."), console.error(`
|
|
231
231
|
This usually happens when node_modules is copied between different`), console.error(` operating systems (e.g., Windows β Mac, or Mac β Linux).
|
|
232
232
|
`);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function Rt(o) {
|
|
235
235
|
return new Promise((e) => {
|
|
236
236
|
console.log(`π§ Attempting to fix: removing node_modules and reinstalling...
|
|
237
237
|
`);
|
|
238
238
|
const n = process.platform === "win32" ? "rmdir /s /q node_modules" : "rm -rf node_modules";
|
|
239
|
-
o(n, (
|
|
240
|
-
if (
|
|
241
|
-
console.error("β Failed to remove node_modules:",
|
|
239
|
+
o(n, (r) => {
|
|
240
|
+
if (r) {
|
|
241
|
+
console.error("β Failed to remove node_modules:", r.message), console.error(`
|
|
242
242
|
Please run manually:`), console.error(` \x1B[36m${n} && npm install\x1B[0m
|
|
243
243
|
`), e(!1);
|
|
244
244
|
return;
|
|
245
245
|
}
|
|
246
246
|
console.log(" β Removed node_modules"), console.log(` β³ Running npm install...
|
|
247
|
-
`), o("npm install", { maxBuffer: 10 * 1024 * 1024 }, (s, d,
|
|
247
|
+
`), o("npm install", { maxBuffer: 10 * 1024 * 1024 }, (s, d, v) => {
|
|
248
248
|
if (s) {
|
|
249
|
-
console.error("β npm install failed:", s.message),
|
|
249
|
+
console.error("β npm install failed:", s.message), v && console.error(v), e(!1);
|
|
250
250
|
return;
|
|
251
251
|
}
|
|
252
252
|
console.log(` β Dependencies reinstalled successfully!
|
|
@@ -255,101 +255,101 @@ function Pt(o) {
|
|
|
255
255
|
});
|
|
256
256
|
});
|
|
257
257
|
}
|
|
258
|
-
async function
|
|
258
|
+
async function Ze(o, e, t, n, r = {}) {
|
|
259
259
|
const {
|
|
260
260
|
hasTriedPlatformFix: s = !1,
|
|
261
261
|
hasTriedInstall: d = !1,
|
|
262
|
-
onRetry:
|
|
263
|
-
} =
|
|
264
|
-
return !s &&
|
|
265
|
-
`),
|
|
266
|
-
n("npm install", (p,
|
|
262
|
+
onRetry: v
|
|
263
|
+
} = r, M = ((o == null ? void 0 : o.message) || "") + (e || "") + (t || "");
|
|
264
|
+
return !s && Ct(M) ? (Pt(), await Rt(n) && v ? (console.log(`π Retrying build...
|
|
265
|
+
`), v(), { handled: !0, hasTriedPlatformFix: !0, hasTriedInstall: d }) : { handled: !0, hasTriedPlatformFix: !0, hasTriedInstall: d }) : !d && Mt(M) ? (console.log("π¦ Missing dependencies detected, running npm install..."), new Promise((u) => {
|
|
266
|
+
n("npm install", (p, S, f) => {
|
|
267
267
|
if (p) {
|
|
268
|
-
console.error("β Failed to install dependencies:", p.message),
|
|
268
|
+
console.error("β Failed to install dependencies:", p.message), f && console.error(f), u({ handled: !0, hasTriedPlatformFix: s, hasTriedInstall: !0 });
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
|
-
console.log("β
Dependencies installed"),
|
|
271
|
+
console.log("β
Dependencies installed"), v && v(), u({ handled: !0, hasTriedPlatformFix: s, hasTriedInstall: !0 });
|
|
272
272
|
});
|
|
273
273
|
})) : { handled: !1, hasTriedPlatformFix: s, hasTriedInstall: d };
|
|
274
274
|
}
|
|
275
|
-
async function
|
|
276
|
-
const o = await import("fs"), e = await import("path"), { exec: t } = await import("child_process"), n = await import("http"), { createHash:
|
|
275
|
+
async function _e() {
|
|
276
|
+
const o = await import("fs"), e = await import("path"), { exec: t } = await import("child_process"), n = await import("http"), { createHash: r } = await import("node:crypto");
|
|
277
277
|
let s;
|
|
278
278
|
if (import.meta.url.startsWith("file://")) {
|
|
279
|
-
const
|
|
279
|
+
const i = new URL(import.meta.url).pathname, l = process.platform === "win32" && i.startsWith("/") ? i.slice(1) : i;
|
|
280
280
|
s = e.default.dirname(l);
|
|
281
281
|
} else
|
|
282
282
|
s = e.default.dirname(import.meta.url);
|
|
283
|
-
const d = e.default.join(s, "commands", "dev", "management-website"),
|
|
284
|
-
let
|
|
285
|
-
const
|
|
283
|
+
const d = e.default.join(s, "commands", "dev", "management-website"), v = o.default.readFileSync(e.default.join(d, "styles.css"), "utf-8"), M = o.default.readFileSync(e.default.join(d, "app.js"), "utf-8"), u = 9292, p = 9293;
|
|
284
|
+
let S = "./dist", f = !1, b = !1, x = !1, $ = null;
|
|
285
|
+
const L = () => {
|
|
286
286
|
try {
|
|
287
|
-
const
|
|
288
|
-
if (
|
|
289
|
-
return
|
|
287
|
+
const a = o.default.readdirSync(".").filter((i) => !i.endsWith(".html") || i.startsWith(".") ? !1 : o.default.statSync(i).isFile());
|
|
288
|
+
if (a.length === 1)
|
|
289
|
+
return a[0];
|
|
290
290
|
} catch {
|
|
291
291
|
}
|
|
292
292
|
return null;
|
|
293
|
-
},
|
|
293
|
+
}, H = () => {
|
|
294
294
|
try {
|
|
295
|
-
const
|
|
296
|
-
return !!(
|
|
295
|
+
const a = JSON.parse(o.default.readFileSync("package.json", "utf-8"));
|
|
296
|
+
return !!(a.scripts && a.scripts.build);
|
|
297
297
|
} catch {
|
|
298
298
|
return !1;
|
|
299
299
|
}
|
|
300
|
-
}, g = (
|
|
301
|
-
const
|
|
300
|
+
}, g = (a) => {
|
|
301
|
+
const i = process.platform;
|
|
302
302
|
let l;
|
|
303
|
-
|
|
303
|
+
i === "darwin" ? l = `open "${a}"` : i === "win32" ? l = `start "" "${a}"` : l = `xdg-open "${a}"`, t(l, (c) => {
|
|
304
304
|
});
|
|
305
|
-
}, P = /* @__PURE__ */ new Map(), E =
|
|
306
|
-
let C, I,
|
|
307
|
-
$ =
|
|
308
|
-
const
|
|
305
|
+
}, P = /* @__PURE__ */ new Map(), E = y.program.getOptionValue("config") || "./myop.config.json";
|
|
306
|
+
let C, I, k = !1;
|
|
307
|
+
$ = L();
|
|
308
|
+
const q = H();
|
|
309
309
|
try {
|
|
310
|
-
const
|
|
311
|
-
C =
|
|
312
|
-
} catch (
|
|
313
|
-
$ && !
|
|
310
|
+
const a = o.default.readFileSync(E, "utf-8"), i = JSON.parse(a);
|
|
311
|
+
C = i.componentId || "DEV", I = i.componentName || i.name || null, k = i.HMR === !0, $ && !q && (x = !0, k = !0, console.log(`π Single HTML file mode: ${$}`)), k && console.log("π₯ HMR enabled");
|
|
312
|
+
} catch (a) {
|
|
313
|
+
$ && !q ? (x = !0, C = "DEV", I = e.default.basename($, ".html"), k = !0, console.log(`π Single HTML file mode: ${$}`), console.log("π₯ HMR enabled")) : (console.error("β Error reading myop.config.json:", a.message), process.exit(1));
|
|
314
314
|
}
|
|
315
315
|
const U = async () => {
|
|
316
316
|
if (C !== "DEV" && C !== "NEW")
|
|
317
317
|
return C;
|
|
318
318
|
try {
|
|
319
|
-
const
|
|
320
|
-
const
|
|
319
|
+
const i = ((await new Promise((m, h) => {
|
|
320
|
+
const w = {
|
|
321
321
|
hostname: "localhost",
|
|
322
322
|
port: p,
|
|
323
323
|
path: "/_list",
|
|
324
324
|
method: "GET",
|
|
325
325
|
timeout: 1e3
|
|
326
|
-
},
|
|
326
|
+
}, R = n.default.request(w, (N) => {
|
|
327
327
|
let J = "";
|
|
328
|
-
N.on("data", (
|
|
328
|
+
N.on("data", (Z) => J += Z), N.on("end", () => {
|
|
329
329
|
try {
|
|
330
|
-
|
|
330
|
+
m(JSON.parse(J));
|
|
331
331
|
} catch {
|
|
332
|
-
|
|
332
|
+
m({ components: [] });
|
|
333
333
|
}
|
|
334
334
|
});
|
|
335
335
|
});
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}),
|
|
339
|
-
})).components || []).map(([
|
|
340
|
-
if (
|
|
336
|
+
R.on("error", () => m({ components: [] })), R.on("timeout", () => {
|
|
337
|
+
R.destroy(), m({ components: [] });
|
|
338
|
+
}), R.end();
|
|
339
|
+
})).components || []).map(([m]) => m).filter((m) => m === "DEV" || m === "NEW" || /^DEV\d+$/.test(m) || /^NEW\d+$/.test(m));
|
|
340
|
+
if (i.length === 0)
|
|
341
341
|
return "DEV1";
|
|
342
|
-
const l =
|
|
343
|
-
if (
|
|
344
|
-
const
|
|
345
|
-
return
|
|
346
|
-
}).filter((
|
|
342
|
+
const l = i.map((m) => {
|
|
343
|
+
if (m === "DEV" || m === "NEW") return 1;
|
|
344
|
+
const h = m.match(/^DEV(\d+)$/), w = m.match(/^NEW(\d+)$/);
|
|
345
|
+
return h ? parseInt(h[1], 10) : w ? parseInt(w[1], 10) : 0;
|
|
346
|
+
}).filter((m) => m > 0);
|
|
347
347
|
return `DEV${Math.max(...l, 0) + 1}`;
|
|
348
348
|
} catch {
|
|
349
349
|
return "DEV1";
|
|
350
350
|
}
|
|
351
|
-
},
|
|
352
|
-
const
|
|
351
|
+
}, F = process.cwd(), G = (a) => {
|
|
352
|
+
const i = e.default.extname(a).toLowerCase();
|
|
353
353
|
return {
|
|
354
354
|
".html": "text/html",
|
|
355
355
|
".js": "text/javascript",
|
|
@@ -360,38 +360,38 @@ async function Fe() {
|
|
|
360
360
|
".gif": "image/gif",
|
|
361
361
|
".svg": "image/svg+xml",
|
|
362
362
|
".ico": "image/x-icon"
|
|
363
|
-
}[
|
|
364
|
-
},
|
|
365
|
-
if (
|
|
366
|
-
const c =
|
|
367
|
-
|
|
363
|
+
}[i] || "application/octet-stream";
|
|
364
|
+
}, T = /* @__PURE__ */ new Map(), Y = [], xe = 50, K = [], oe = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map(), ot = (a, i, l) => {
|
|
365
|
+
if (a.url.startsWith("/_hmr/")) {
|
|
366
|
+
const c = a.url.split("/_hmr/")[1], m = a.headers["sec-websocket-key"], h = r("sha1").update(m + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11").digest("base64");
|
|
367
|
+
i.write(
|
|
368
368
|
`HTTP/1.1 101 Switching Protocols\r
|
|
369
369
|
Upgrade: websocket\r
|
|
370
370
|
Connection: Upgrade\r
|
|
371
|
-
Sec-WebSocket-Accept: ${
|
|
371
|
+
Sec-WebSocket-Accept: ${h}\r
|
|
372
372
|
\r
|
|
373
373
|
`
|
|
374
|
-
),
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
}),
|
|
378
|
-
const
|
|
379
|
-
|
|
374
|
+
), Q.has(c) || Q.set(c, /* @__PURE__ */ new Set()), Q.get(c).add(i), console.log(`π HMR client connected: ${c}`), i.on("close", () => {
|
|
375
|
+
const w = Q.get(c);
|
|
376
|
+
w && (w.delete(i), w.size === 0 && Q.delete(c)), console.log(`π HMR client disconnected: ${c}`);
|
|
377
|
+
}), i.on("error", () => {
|
|
378
|
+
const w = Q.get(c);
|
|
379
|
+
w && w.delete(i);
|
|
380
380
|
});
|
|
381
381
|
}
|
|
382
|
-
},
|
|
383
|
-
if (
|
|
382
|
+
}, $e = n.default.createServer((a, i) => {
|
|
383
|
+
if (i.setHeader("Content-Type", "application/json"), a.method === "POST" && a.url === "/_register") {
|
|
384
384
|
let l = "";
|
|
385
|
-
|
|
385
|
+
a.on("data", (c) => l += c), a.on("end", () => {
|
|
386
386
|
try {
|
|
387
|
-
const { componentId: c, distPath:
|
|
388
|
-
|
|
389
|
-
const
|
|
390
|
-
console.log(`β
Registered: ${c}${
|
|
391
|
-
const N = Array.from(
|
|
387
|
+
const { componentId: c, distPath: m, componentName: h, htmlFile: w } = JSON.parse(l);
|
|
388
|
+
T.set(c, { path: m, name: h || null, htmlFile: w || null });
|
|
389
|
+
const R = h ? ` (${h})` : "";
|
|
390
|
+
console.log(`β
Registered: ${c}${R} -> ${m}${w ? "/" + w : ""}`), i.writeHead(200), i.end(JSON.stringify({ success: !0, registered: Array.from(T.keys()) }));
|
|
391
|
+
const N = Array.from(T.entries()).map(([J, Z]) => ({
|
|
392
392
|
id: J,
|
|
393
|
-
path:
|
|
394
|
-
name:
|
|
393
|
+
path: Z.path,
|
|
394
|
+
name: Z.name
|
|
395
395
|
}));
|
|
396
396
|
K.forEach((J) => {
|
|
397
397
|
try {
|
|
@@ -405,25 +405,25 @@ Sec-WebSocket-Accept: ${y}\r
|
|
|
405
405
|
}
|
|
406
406
|
});
|
|
407
407
|
} catch (c) {
|
|
408
|
-
|
|
408
|
+
i.writeHead(400), i.end(JSON.stringify({ error: c.message }));
|
|
409
409
|
}
|
|
410
410
|
});
|
|
411
|
-
} else if (
|
|
411
|
+
} else if (a.method === "POST" && a.url === "/_unregister") {
|
|
412
412
|
let l = "";
|
|
413
|
-
|
|
413
|
+
a.on("data", (c) => l += c), a.on("end", () => {
|
|
414
414
|
try {
|
|
415
415
|
const { componentId: c } = JSON.parse(l);
|
|
416
|
-
|
|
417
|
-
const
|
|
418
|
-
id:
|
|
419
|
-
path:
|
|
420
|
-
name:
|
|
416
|
+
T.delete(c), console.log(`β Unregistered: ${c}`), i.writeHead(200), i.end(JSON.stringify({ success: !0 }));
|
|
417
|
+
const m = Array.from(T.entries()).map(([h, w]) => ({
|
|
418
|
+
id: h,
|
|
419
|
+
path: w.path,
|
|
420
|
+
name: w.name
|
|
421
421
|
}));
|
|
422
|
-
K.forEach((
|
|
422
|
+
K.forEach((h) => {
|
|
423
423
|
try {
|
|
424
|
-
|
|
424
|
+
h.write(`data: ${JSON.stringify({
|
|
425
425
|
type: "components",
|
|
426
|
-
components:
|
|
426
|
+
components: m
|
|
427
427
|
})}
|
|
428
428
|
|
|
429
429
|
`);
|
|
@@ -431,200 +431,230 @@ Sec-WebSocket-Accept: ${y}\r
|
|
|
431
431
|
}
|
|
432
432
|
});
|
|
433
433
|
} catch (c) {
|
|
434
|
-
|
|
434
|
+
i.writeHead(400), i.end(JSON.stringify({ error: c.message }));
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
} else if (a.method === "GET" && a.url === "/_list")
|
|
438
|
+
i.writeHead(200), i.end(JSON.stringify({ components: Array.from(T.entries()) }));
|
|
439
|
+
else if (a.method === "POST" && a.url === "/_hmr_notify") {
|
|
440
|
+
let l = "";
|
|
441
|
+
a.on("data", (c) => l += c), a.on("end", () => {
|
|
442
|
+
try {
|
|
443
|
+
const { componentId: c, html: m } = JSON.parse(l), h = Q.get(c);
|
|
444
|
+
if (h && h.size > 0) {
|
|
445
|
+
console.log(`π₯ Notifying ${h.size} HMR client(s) for: ${c}`);
|
|
446
|
+
const w = JSON.stringify({ type: "update", html: m }), R = He(w);
|
|
447
|
+
h.forEach((N) => {
|
|
448
|
+
try {
|
|
449
|
+
N.write(R);
|
|
450
|
+
} catch {
|
|
451
|
+
h.delete(N);
|
|
452
|
+
}
|
|
453
|
+
}), i.writeHead(200), i.end(JSON.stringify({ success: !0, notified: h.size }));
|
|
454
|
+
} else
|
|
455
|
+
i.writeHead(200), i.end(JSON.stringify({ success: !0, notified: 0 }));
|
|
456
|
+
} catch (c) {
|
|
457
|
+
i.writeHead(400), i.end(JSON.stringify({ error: c.message }));
|
|
435
458
|
}
|
|
436
459
|
});
|
|
437
|
-
} else
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
460
|
+
} else
|
|
461
|
+
i.writeHead(404), i.end(JSON.stringify({ error: "Not found" }));
|
|
462
|
+
}), de = n.default.createServer((a, i) => {
|
|
463
|
+
if (a.url.includes("..")) {
|
|
464
|
+
i.writeHead(403, { "Content-Type": "text/plain" }), i.end("Forbidden");
|
|
441
465
|
return;
|
|
442
466
|
}
|
|
443
|
-
const l = new URL(
|
|
467
|
+
const l = new URL(a.url, `http://localhost:${u}`), c = l.pathname, m = c.split("/").filter((A) => A);
|
|
444
468
|
if (c.startsWith("/consume")) {
|
|
445
469
|
const A = l.searchParams.get("id");
|
|
446
470
|
if (!A) {
|
|
447
|
-
|
|
471
|
+
i.writeHead(400, { "Content-Type": "application/json" }), i.end(JSON.stringify({ error: "Component ID required. Use /consume?id=<componentId>" }));
|
|
448
472
|
return;
|
|
449
473
|
}
|
|
450
|
-
const B =
|
|
451
|
-
let j = "Unknown",
|
|
452
|
-
if (
|
|
453
|
-
const
|
|
474
|
+
const B = T.get(A), z = B ? B.path : null, re = (X) => {
|
|
475
|
+
let j = "Unknown", W = "Unknown";
|
|
476
|
+
if (a.headers.referer || a.headers.referrer) {
|
|
477
|
+
const _ = a.headers.referer || a.headers.referrer;
|
|
454
478
|
try {
|
|
455
|
-
const ne = new URL(
|
|
456
|
-
j = ne.origin,
|
|
479
|
+
const ne = new URL(_);
|
|
480
|
+
j = ne.origin, W = ne.hostname || ne.origin;
|
|
457
481
|
} catch {
|
|
458
|
-
j =
|
|
482
|
+
j = _, W = _;
|
|
459
483
|
}
|
|
460
|
-
} else if (
|
|
484
|
+
} else if (a.headers.origin)
|
|
461
485
|
try {
|
|
462
|
-
const
|
|
463
|
-
j =
|
|
486
|
+
const _ = new URL(a.headers.origin);
|
|
487
|
+
j = _.origin, W = _.hostname || _.origin;
|
|
464
488
|
} catch {
|
|
465
|
-
j =
|
|
489
|
+
j = a.headers.origin, W = a.headers.origin;
|
|
466
490
|
}
|
|
467
|
-
else if (
|
|
468
|
-
const
|
|
469
|
-
|
|
491
|
+
else if (a.socket.remoteAddress) {
|
|
492
|
+
const _ = a.socket.remoteAddress;
|
|
493
|
+
_ === "::1" || _ === "::ffff:127.0.0.1" ? (j = "localhost", W = "localhost (direct)") : (j = _, W = _.replace("::ffff:", ""));
|
|
470
494
|
}
|
|
471
|
-
const
|
|
495
|
+
const Te = a.headers.referer || a.headers.referrer || j, ue = {
|
|
472
496
|
type: "request",
|
|
473
497
|
componentId: A,
|
|
474
498
|
timestamp: Date.now(),
|
|
475
|
-
servedLocally:
|
|
476
|
-
referrer:
|
|
499
|
+
servedLocally: X,
|
|
500
|
+
referrer: Te,
|
|
477
501
|
origin: j,
|
|
478
|
-
originLabel:
|
|
502
|
+
originLabel: W
|
|
479
503
|
};
|
|
480
|
-
|
|
504
|
+
oe.has(j) || (oe.set(j, {
|
|
481
505
|
url: j,
|
|
482
|
-
label:
|
|
506
|
+
label: W,
|
|
483
507
|
firstSeen: Date.now(),
|
|
484
508
|
requestCount: 0
|
|
485
|
-
}), K.forEach((
|
|
509
|
+
}), K.forEach((_) => {
|
|
486
510
|
try {
|
|
487
|
-
|
|
511
|
+
_.write(`data: ${JSON.stringify({
|
|
488
512
|
type: "origins",
|
|
489
|
-
origins: Array.from(
|
|
513
|
+
origins: Array.from(oe.values())
|
|
490
514
|
})}
|
|
491
515
|
|
|
492
516
|
`);
|
|
493
517
|
} catch {
|
|
494
518
|
}
|
|
495
519
|
}));
|
|
496
|
-
const
|
|
497
|
-
|
|
520
|
+
const Oe = oe.get(j);
|
|
521
|
+
Oe.requestCount++, K.forEach((_) => {
|
|
498
522
|
try {
|
|
499
|
-
|
|
523
|
+
_.write(`data: ${JSON.stringify({
|
|
500
524
|
type: "origins",
|
|
501
|
-
origins: Array.from(
|
|
525
|
+
origins: Array.from(oe.values())
|
|
502
526
|
})}
|
|
503
527
|
|
|
504
528
|
`);
|
|
505
529
|
} catch {
|
|
506
530
|
}
|
|
507
|
-
}),
|
|
531
|
+
}), Y.push(ue), Y.length > xe && Y.shift(), K.forEach((_) => {
|
|
508
532
|
try {
|
|
509
|
-
|
|
533
|
+
_.write(`data: ${JSON.stringify(ue)}
|
|
510
534
|
|
|
511
535
|
`);
|
|
512
536
|
} catch {
|
|
513
537
|
}
|
|
514
538
|
});
|
|
515
539
|
};
|
|
516
|
-
if (
|
|
517
|
-
const
|
|
518
|
-
o.default.readFile(
|
|
540
|
+
if (z) {
|
|
541
|
+
const X = B.htmlFile ? e.default.join(z, B.htmlFile) : e.default.join(z, "index.html");
|
|
542
|
+
o.default.readFile(X, "utf-8", (j, W) => {
|
|
519
543
|
if (j) {
|
|
520
|
-
console.log(`β File not found: ${
|
|
544
|
+
console.log(`β File not found: ${X}`), i.writeHead(404, { "Content-Type": "application/json" }), i.end(JSON.stringify({ error: "index.html not found" }));
|
|
521
545
|
return;
|
|
522
546
|
}
|
|
523
|
-
const
|
|
547
|
+
const Te = Ce(W, A), ue = `dev-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, Oe = {
|
|
524
548
|
item: {
|
|
525
549
|
name: A,
|
|
526
550
|
id: A,
|
|
527
551
|
consume_variant: [
|
|
528
552
|
{
|
|
529
|
-
id:
|
|
553
|
+
id: ue,
|
|
530
554
|
name: "dev version",
|
|
531
555
|
loader: {
|
|
532
556
|
type: "HTMLLoader",
|
|
533
557
|
shadowRootMode: "localFrame",
|
|
534
|
-
HTML:
|
|
558
|
+
HTML: Te
|
|
535
559
|
}
|
|
536
560
|
}
|
|
537
561
|
]
|
|
538
562
|
}
|
|
539
563
|
};
|
|
540
|
-
console.log(`β
Serving consume JSON for: ${A}`),
|
|
564
|
+
console.log(`β
Serving consume JSON for: ${A}`), re(!0), i.writeHead(200, {
|
|
541
565
|
"Content-Type": "application/json",
|
|
542
566
|
"Access-Control-Allow-Origin": "*"
|
|
543
|
-
}),
|
|
567
|
+
}), i.end(JSON.stringify(Oe, null, 2));
|
|
544
568
|
});
|
|
545
569
|
} else {
|
|
546
570
|
console.log(`π‘ Proxying consume request to cloud.myop.dev for: ${A}`);
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
|
|
571
|
+
const X = `https://cloud.myop.dev/consume${l.search}`;
|
|
572
|
+
re(!1), fetch(X).then((j) => j.text()).then((j) => {
|
|
573
|
+
i.writeHead(200, {
|
|
550
574
|
"Content-Type": "application/json",
|
|
551
575
|
"Access-Control-Allow-Origin": "*"
|
|
552
|
-
}),
|
|
576
|
+
}), i.end(j);
|
|
553
577
|
}).catch((j) => {
|
|
554
|
-
console.error(`β Proxy error: ${j.message}`),
|
|
578
|
+
console.error(`β Proxy error: ${j.message}`), i.writeHead(502, { "Content-Type": "application/json" }), i.end(JSON.stringify({ error: "Failed to fetch from cloud.myop.dev" }));
|
|
555
579
|
});
|
|
556
580
|
}
|
|
557
581
|
return;
|
|
558
582
|
}
|
|
559
583
|
if (c === "/events") {
|
|
560
|
-
|
|
584
|
+
i.writeHead(200, {
|
|
561
585
|
"Content-Type": "text/event-stream",
|
|
562
586
|
"Cache-Control": "no-cache",
|
|
563
587
|
Connection: "keep-alive",
|
|
564
588
|
"Access-Control-Allow-Origin": "*"
|
|
565
|
-
}), K.push(
|
|
566
|
-
const A = Array.from(
|
|
589
|
+
}), K.push(i);
|
|
590
|
+
const A = Array.from(T.entries()).map(([B, z]) => ({
|
|
567
591
|
id: B,
|
|
568
|
-
path:
|
|
569
|
-
name:
|
|
592
|
+
path: z.path,
|
|
593
|
+
name: z.name
|
|
570
594
|
}));
|
|
571
|
-
|
|
595
|
+
i.write(`data: ${JSON.stringify({
|
|
572
596
|
type: "components",
|
|
573
597
|
components: A
|
|
574
598
|
})}
|
|
575
599
|
|
|
576
|
-
`),
|
|
600
|
+
`), i.write(`data: ${JSON.stringify({
|
|
577
601
|
type: "origins",
|
|
578
|
-
origins: Array.from(
|
|
602
|
+
origins: Array.from(oe.values())
|
|
579
603
|
})}
|
|
580
604
|
|
|
581
|
-
`),
|
|
605
|
+
`), i.write(`data: ${JSON.stringify({
|
|
582
606
|
type: "requestLog",
|
|
583
|
-
log:
|
|
607
|
+
log: Y
|
|
584
608
|
})}
|
|
585
609
|
|
|
586
|
-
`),
|
|
587
|
-
const B = K.indexOf(
|
|
610
|
+
`), a.on("close", () => {
|
|
611
|
+
const B = K.indexOf(i);
|
|
588
612
|
B !== -1 && K.splice(B, 1);
|
|
589
613
|
});
|
|
590
614
|
return;
|
|
591
615
|
}
|
|
592
|
-
if (
|
|
593
|
-
|
|
616
|
+
if (m.length === 0) {
|
|
617
|
+
i.writeHead(200, { "Content-Type": "text/html" }), i.end($t(u, p, v, M));
|
|
594
618
|
return;
|
|
595
619
|
}
|
|
596
|
-
if (
|
|
597
|
-
|
|
620
|
+
if (m[0] !== "view") {
|
|
621
|
+
i.writeHead(404, { "Content-Type": "text/plain" }), i.end("Not found. Use /view/<componentId>/ to access components.");
|
|
598
622
|
return;
|
|
599
623
|
}
|
|
600
|
-
if (
|
|
601
|
-
|
|
624
|
+
if (m.length < 2) {
|
|
625
|
+
i.writeHead(400, { "Content-Type": "text/plain" }), i.end("Component ID required. Use /view/<componentId>/");
|
|
602
626
|
return;
|
|
603
627
|
}
|
|
604
|
-
const
|
|
605
|
-
if (!
|
|
606
|
-
|
|
628
|
+
const h = m[1], w = T.get(h);
|
|
629
|
+
if (!w) {
|
|
630
|
+
i.writeHead(404, { "Content-Type": "text/plain" }), i.end(`Component not found: ${h}`);
|
|
607
631
|
return;
|
|
608
632
|
}
|
|
609
|
-
const
|
|
610
|
-
console.log(`π₯ Request: ${
|
|
633
|
+
const R = w.path, N = m.slice(2), J = w.htmlFile || "index.html", Z = N.length === 0 ? J : N.join("/"), ie = e.default.join(R, Z);
|
|
634
|
+
console.log(`π₯ Request: ${a.url} -> ${ie}`), o.default.readFile(ie, (A, B) => {
|
|
611
635
|
if (A) {
|
|
612
|
-
console.log(`β File not found: ${ie}`),
|
|
636
|
+
console.log(`β File not found: ${ie}`), i.writeHead(404, { "Content-Type": "text/plain" }), i.end("Not Found");
|
|
613
637
|
return;
|
|
614
638
|
}
|
|
615
|
-
const
|
|
616
|
-
console.log(`β
Serving: ${ie} (${
|
|
617
|
-
|
|
639
|
+
const z = G(ie);
|
|
640
|
+
console.log(`β
Serving: ${ie} (${z})`);
|
|
641
|
+
let re = B;
|
|
642
|
+
if (z === "text/html" && k) {
|
|
643
|
+
const X = B.toString("utf-8");
|
|
644
|
+
re = Ce(X, h);
|
|
645
|
+
}
|
|
646
|
+
i.writeHead(200, {
|
|
647
|
+
"Content-Type": z,
|
|
618
648
|
"Access-Control-Allow-Origin": "*"
|
|
619
|
-
}),
|
|
649
|
+
}), i.end(re);
|
|
620
650
|
});
|
|
621
|
-
}),
|
|
622
|
-
const l = x ? e.default.resolve(
|
|
651
|
+
}), Ae = () => new Promise((a, i) => {
|
|
652
|
+
const l = x ? e.default.resolve(F) : e.default.resolve(F, S), c = JSON.stringify({
|
|
623
653
|
componentId: C,
|
|
624
654
|
distPath: l,
|
|
625
655
|
componentName: I,
|
|
626
656
|
htmlFile: x ? $ : null
|
|
627
|
-
}),
|
|
657
|
+
}), m = {
|
|
628
658
|
hostname: "localhost",
|
|
629
659
|
port: p,
|
|
630
660
|
path: "/_register",
|
|
@@ -633,14 +663,14 @@ Sec-WebSocket-Accept: ${y}\r
|
|
|
633
663
|
"Content-Type": "application/json",
|
|
634
664
|
"Content-Length": Buffer.byteLength(c)
|
|
635
665
|
}
|
|
636
|
-
},
|
|
637
|
-
let
|
|
638
|
-
|
|
639
|
-
|
|
666
|
+
}, h = n.default.request(m, (w) => {
|
|
667
|
+
let R = "";
|
|
668
|
+
w.on("data", (N) => R += N), w.on("end", () => {
|
|
669
|
+
w.statusCode === 200 ? a(JSON.parse(R)) : i(new Error(`Registration failed: ${w.statusCode}`));
|
|
640
670
|
});
|
|
641
671
|
});
|
|
642
|
-
|
|
643
|
-
}),
|
|
672
|
+
h.on("error", i), h.write(c), h.end();
|
|
673
|
+
}), nt = () => new Promise((a, i) => {
|
|
644
674
|
const l = JSON.stringify({ componentId: C }), c = {
|
|
645
675
|
hostname: "localhost",
|
|
646
676
|
port: p,
|
|
@@ -650,15 +680,15 @@ Sec-WebSocket-Accept: ${y}\r
|
|
|
650
680
|
"Content-Type": "application/json",
|
|
651
681
|
"Content-Length": Buffer.byteLength(l)
|
|
652
682
|
}
|
|
653
|
-
},
|
|
654
|
-
|
|
683
|
+
}, m = n.default.request(c, (h) => {
|
|
684
|
+
a();
|
|
655
685
|
});
|
|
656
|
-
|
|
657
|
-
}),
|
|
686
|
+
m.on("error", () => a()), m.write(l), m.end();
|
|
687
|
+
}), st = (a) => `
|
|
658
688
|
<!-- MYOP HMR -->
|
|
659
689
|
<script>
|
|
660
690
|
(function() {
|
|
661
|
-
const componentId = '${
|
|
691
|
+
const componentId = '${a}';
|
|
662
692
|
const wsUrl = 'ws://localhost:${p}/_hmr/' + componentId;
|
|
663
693
|
let ws;
|
|
664
694
|
let reconnectAttempts = 0;
|
|
@@ -759,215 +789,251 @@ Sec-WebSocket-Accept: ${y}\r
|
|
|
759
789
|
connect();
|
|
760
790
|
})();
|
|
761
791
|
<\/script>
|
|
762
|
-
`,
|
|
763
|
-
if (!
|
|
764
|
-
const l =
|
|
765
|
-
return
|
|
766
|
-
},
|
|
767
|
-
const
|
|
792
|
+
`, Ce = (a, i) => {
|
|
793
|
+
if (!k) return a;
|
|
794
|
+
const l = st(i);
|
|
795
|
+
return a.includes("</body>") ? a.replace("</body>", `${l}</body>`) : a.includes("</html>") ? a.replace("</html>", `${l}</html>`) : a + l;
|
|
796
|
+
}, He = (a) => {
|
|
797
|
+
const i = Buffer.from(a), l = i.length;
|
|
768
798
|
let c;
|
|
769
799
|
return l < 126 ? c = Buffer.concat([
|
|
770
800
|
Buffer.from([129, l]),
|
|
771
801
|
// FIN + text frame, length
|
|
772
|
-
|
|
802
|
+
i
|
|
773
803
|
]) : l < 65536 ? c = Buffer.concat([
|
|
774
804
|
Buffer.from([129, 126]),
|
|
775
805
|
// FIN + text frame, extended length
|
|
776
806
|
Buffer.from([l >> 8, l & 255]),
|
|
777
807
|
// 16-bit length
|
|
778
|
-
|
|
808
|
+
i
|
|
779
809
|
]) : c = Buffer.concat([
|
|
780
810
|
Buffer.from([129, 127]),
|
|
781
811
|
// FIN + text frame, extended length
|
|
782
812
|
Buffer.from([0, 0, 0, 0, l >> 24, l >> 16 & 255, l >> 8 & 255, l & 255]),
|
|
783
813
|
// 64-bit length
|
|
784
|
-
|
|
814
|
+
i
|
|
785
815
|
]), c;
|
|
786
|
-
},
|
|
787
|
-
if (!
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
return;
|
|
791
|
-
console.log(`π₯ Notifying ${r.size} HMR client(s)`);
|
|
792
|
-
const a = x ? $ : e.default.join(b, "index.html");
|
|
816
|
+
}, De = () => {
|
|
817
|
+
if (!k) return;
|
|
818
|
+
const a = x ? $ : e.default.join(S, "index.html");
|
|
819
|
+
let i;
|
|
793
820
|
try {
|
|
794
|
-
const l = o.default.readFileSync(a, "utf-8")
|
|
821
|
+
const l = o.default.readFileSync(a, "utf-8");
|
|
822
|
+
i = Ce(l, C);
|
|
823
|
+
} catch (l) {
|
|
824
|
+
console.error("β Failed to read HTML for HMR:", l.message);
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
if (Re) {
|
|
828
|
+
const l = Q.get(C);
|
|
829
|
+
if (!l || l.size === 0)
|
|
830
|
+
return;
|
|
831
|
+
console.log(`π₯ Notifying ${l.size} HMR client(s)`);
|
|
832
|
+
const c = JSON.stringify({
|
|
795
833
|
type: "update",
|
|
796
|
-
html:
|
|
797
|
-
}),
|
|
798
|
-
|
|
834
|
+
html: i
|
|
835
|
+
}), m = He(c);
|
|
836
|
+
l.forEach((h) => {
|
|
799
837
|
try {
|
|
800
|
-
|
|
838
|
+
h.write(m);
|
|
801
839
|
} catch {
|
|
802
|
-
|
|
840
|
+
l.delete(h);
|
|
803
841
|
}
|
|
804
842
|
});
|
|
805
|
-
}
|
|
806
|
-
|
|
843
|
+
} else {
|
|
844
|
+
const l = JSON.stringify({
|
|
845
|
+
componentId: C,
|
|
846
|
+
html: i
|
|
847
|
+
}), c = {
|
|
848
|
+
hostname: "localhost",
|
|
849
|
+
port: p,
|
|
850
|
+
path: "/_hmr_notify",
|
|
851
|
+
method: "POST",
|
|
852
|
+
headers: {
|
|
853
|
+
"Content-Type": "application/json",
|
|
854
|
+
"Content-Length": Buffer.byteLength(l)
|
|
855
|
+
},
|
|
856
|
+
timeout: 5e3
|
|
857
|
+
}, m = n.default.request(c, (h) => {
|
|
858
|
+
let w = "";
|
|
859
|
+
h.on("data", (R) => w += R), h.on("end", () => {
|
|
860
|
+
try {
|
|
861
|
+
const R = JSON.parse(w);
|
|
862
|
+
R.notified > 0 && console.log(`π₯ Notified ${R.notified} HMR client(s) via server`);
|
|
863
|
+
} catch {
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
});
|
|
867
|
+
m.on("error", () => {
|
|
868
|
+
}), m.on("timeout", () => {
|
|
869
|
+
m.destroy();
|
|
870
|
+
}), m.write(l), m.end();
|
|
807
871
|
}
|
|
808
872
|
};
|
|
809
|
-
let
|
|
810
|
-
const
|
|
811
|
-
if (
|
|
812
|
-
|
|
873
|
+
let Me = { hasTriedPlatformFix: !1, hasTriedInstall: !1 };
|
|
874
|
+
const pe = (a) => {
|
|
875
|
+
if (f) {
|
|
876
|
+
b = !0;
|
|
813
877
|
return;
|
|
814
878
|
}
|
|
815
|
-
|
|
816
|
-
π¨ Building...`), t("npm run build", { maxBuffer: 10 * 1024 * 1024 }, async (
|
|
817
|
-
if (
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
onRetry: () =>
|
|
879
|
+
f = !0, console.log(`
|
|
880
|
+
π¨ Building...`), t("npm run build", { maxBuffer: 10 * 1024 * 1024 }, async (i, l, c) => {
|
|
881
|
+
if (f = !1, i) {
|
|
882
|
+
const m = await Ze(i, l, c, t, {
|
|
883
|
+
...Me,
|
|
884
|
+
onRetry: () => pe(a)
|
|
821
885
|
});
|
|
822
|
-
|
|
886
|
+
Me = { ...Me, ...m }, m.handled || (console.error("β Build failed:", i.message), c && console.error(c));
|
|
823
887
|
} else
|
|
824
|
-
console.log("β
Build completed"), l && console.log(l),
|
|
825
|
-
|
|
888
|
+
console.log("β
Build completed"), l && console.log(l), De(), a && a();
|
|
889
|
+
b && (b = !1, pe());
|
|
826
890
|
});
|
|
827
|
-
},
|
|
828
|
-
o.default.readdir(
|
|
829
|
-
|
|
830
|
-
const
|
|
891
|
+
}, Ue = /* @__PURE__ */ new Set(), Pe = (a) => {
|
|
892
|
+
o.default.readdir(a, { withFileTypes: !0 }, (i, l) => {
|
|
893
|
+
i || (l.forEach((c) => {
|
|
894
|
+
const m = e.default.join(a, c.name);
|
|
831
895
|
if (c.isDirectory())
|
|
832
|
-
c.name !== "node_modules" && c.name !== "dist" && !c.name.startsWith(".") &&
|
|
896
|
+
c.name !== "node_modules" && c.name !== "dist" && !c.name.startsWith(".") && Pe(m);
|
|
833
897
|
else if (c.isFile()) {
|
|
834
|
-
const
|
|
835
|
-
if (
|
|
898
|
+
const h = e.default.extname(c.name);
|
|
899
|
+
if (h === ".js" || h === ".css" || h === ".html")
|
|
836
900
|
try {
|
|
837
|
-
const
|
|
838
|
-
P.set(
|
|
901
|
+
const w = o.default.readFileSync(m, "utf-8");
|
|
902
|
+
P.set(m, w);
|
|
839
903
|
} catch {
|
|
840
904
|
}
|
|
841
905
|
}
|
|
842
|
-
}),
|
|
843
|
-
if (!
|
|
844
|
-
const
|
|
845
|
-
if (
|
|
846
|
-
const
|
|
906
|
+
}), Ue.has(a) || (Ue.add(a), o.default.watch(a, (c, m) => {
|
|
907
|
+
if (!m) return;
|
|
908
|
+
const h = e.default.extname(m);
|
|
909
|
+
if (h !== ".js" && h !== ".css" && h !== ".html") return;
|
|
910
|
+
const w = e.default.join(a, m);
|
|
847
911
|
setTimeout(() => {
|
|
848
912
|
try {
|
|
849
|
-
const
|
|
850
|
-
|
|
913
|
+
const R = o.default.readFileSync(w, "utf-8"), N = P.get(w);
|
|
914
|
+
R !== N && (P.set(w, R), console.log(`π File changed: ${w}`), x ? De() : pe());
|
|
851
915
|
} catch {
|
|
852
916
|
}
|
|
853
917
|
}, 50);
|
|
854
918
|
})));
|
|
855
919
|
});
|
|
856
|
-
},
|
|
920
|
+
}, Be = (a) => {
|
|
857
921
|
console.log(`
|
|
858
|
-
π¨ Component: ${C}`), x ? (console.log("π No build needed (single HTML file mode)"),
|
|
859
|
-
`),
|
|
922
|
+
π¨ Component: ${C}`), x ? (console.log("π No build needed (single HTML file mode)"), Pe(F), console.log(`π Watching ${$} for changes...`), console.log(`Press Ctrl+C to stop
|
|
923
|
+
`), a && a()) : (pe(a), Pe(F), console.log("π Watching .js, .css, and .html files for changes..."), console.log(`Press Ctrl+C to stop
|
|
860
924
|
`));
|
|
861
|
-
},
|
|
862
|
-
const
|
|
925
|
+
}, it = () => new Promise((a) => {
|
|
926
|
+
const i = {
|
|
863
927
|
hostname: "localhost",
|
|
864
928
|
port: p,
|
|
865
929
|
path: "/_list",
|
|
866
930
|
method: "GET",
|
|
867
931
|
timeout: 1e3
|
|
868
|
-
}, l = n.default.request(
|
|
869
|
-
|
|
932
|
+
}, l = n.default.request(i, (c) => {
|
|
933
|
+
a(!0);
|
|
870
934
|
});
|
|
871
|
-
l.on("error", () =>
|
|
872
|
-
l.destroy(),
|
|
935
|
+
l.on("error", () => a(!1)), l.on("timeout", () => {
|
|
936
|
+
l.destroy(), a(!1);
|
|
873
937
|
}), l.end();
|
|
874
|
-
}),
|
|
875
|
-
const
|
|
938
|
+
}), rt = () => new Promise((a) => {
|
|
939
|
+
const i = n.default.createServer((l, c) => {
|
|
876
940
|
if (c.setHeader("Content-Type", "application/json"), l.method === "POST" && l.url === "/_register") {
|
|
877
|
-
let
|
|
878
|
-
l.on("data", (
|
|
941
|
+
let m = "";
|
|
942
|
+
l.on("data", (h) => m += h), l.on("end", () => {
|
|
879
943
|
try {
|
|
880
|
-
const { componentId:
|
|
881
|
-
|
|
882
|
-
const J =
|
|
883
|
-
console.log(`β
Registered: ${
|
|
884
|
-
} catch (
|
|
885
|
-
c.writeHead(400), c.end(JSON.stringify({ error:
|
|
944
|
+
const { componentId: h, distPath: w, componentName: R, htmlFile: N } = JSON.parse(m);
|
|
945
|
+
T.set(h, { path: w, name: R || null, htmlFile: N || null });
|
|
946
|
+
const J = R ? ` (${R})` : "";
|
|
947
|
+
console.log(`β
Registered: ${h}${J} -> ${w}${N ? "/" + N : ""}`), c.writeHead(200), c.end(JSON.stringify({ success: !0, registered: Array.from(T.keys()) }));
|
|
948
|
+
} catch (h) {
|
|
949
|
+
c.writeHead(400), c.end(JSON.stringify({ error: h.message }));
|
|
886
950
|
}
|
|
887
951
|
});
|
|
888
952
|
} else if (l.method === "POST" && l.url === "/_unregister") {
|
|
889
|
-
let
|
|
890
|
-
l.on("data", (
|
|
953
|
+
let m = "";
|
|
954
|
+
l.on("data", (h) => m += h), l.on("end", () => {
|
|
891
955
|
try {
|
|
892
|
-
const { componentId:
|
|
893
|
-
|
|
894
|
-
} catch (
|
|
895
|
-
c.writeHead(400), c.end(JSON.stringify({ error:
|
|
956
|
+
const { componentId: h } = JSON.parse(m);
|
|
957
|
+
T.delete(h), console.log(`β Unregistered: ${h}`), c.writeHead(200), c.end(JSON.stringify({ success: !0 }));
|
|
958
|
+
} catch (h) {
|
|
959
|
+
c.writeHead(400), c.end(JSON.stringify({ error: h.message }));
|
|
896
960
|
}
|
|
897
961
|
});
|
|
898
|
-
} else l.method === "GET" && l.url === "/_list" ? (c.writeHead(200), c.end(JSON.stringify({ components: Array.from(
|
|
962
|
+
} else l.method === "GET" && l.url === "/_list" ? (c.writeHead(200), c.end(JSON.stringify({ components: Array.from(T.entries()) }))) : (c.writeHead(404), c.end(JSON.stringify({ error: "Not found" })));
|
|
899
963
|
});
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
}),
|
|
964
|
+
i.on("error", () => {
|
|
965
|
+
a(!1);
|
|
966
|
+
}), i.listen(p, () => {
|
|
903
967
|
console.log(`
|
|
904
|
-
π Taking over as server...`), console.log(`π‘ Management server on port ${p}`),
|
|
905
|
-
|
|
906
|
-
}),
|
|
907
|
-
console.log(`π‘ Main server running at http://localhost:${
|
|
908
|
-
const l = x ? e.default.resolve(
|
|
909
|
-
|
|
968
|
+
π Taking over as server...`), console.log(`π‘ Management server on port ${p}`), de.on("error", () => {
|
|
969
|
+
i.close(), a(!1);
|
|
970
|
+
}), de.listen(u, () => {
|
|
971
|
+
console.log(`π‘ Main server running at http://localhost:${u}`);
|
|
972
|
+
const l = x ? e.default.resolve(F) : e.default.resolve(F, S);
|
|
973
|
+
T.set(C, {
|
|
910
974
|
path: l,
|
|
911
975
|
name: I,
|
|
912
976
|
htmlFile: x ? $ : null
|
|
913
977
|
});
|
|
914
978
|
const c = I ? ` (${I})` : "";
|
|
915
|
-
console.log(`β
Registered component: ${C}${c}`), console.log(`π‘ Access at: http://localhost:${
|
|
979
|
+
console.log(`β
Registered component: ${C}${c}`), console.log(`π‘ Access at: http://localhost:${u}/view/${C}/`), a(!0);
|
|
916
980
|
});
|
|
917
981
|
});
|
|
918
982
|
});
|
|
919
|
-
let
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
await
|
|
923
|
-
β οΈ Server appears to be down, attempting to take over...`), await
|
|
983
|
+
let me;
|
|
984
|
+
const Je = () => {
|
|
985
|
+
me = setInterval(async () => {
|
|
986
|
+
await it() || (clearInterval(me), console.log(`
|
|
987
|
+
β οΈ Server appears to be down, attempting to take over...`), await rt() ? (console.log("β
Successfully took over as server"), Re = !0) : (console.log("βΉοΈ Another instance took over, re-registering..."), setTimeout(async () => {
|
|
924
988
|
try {
|
|
925
|
-
await
|
|
989
|
+
await Ae(), console.log(`β
Re-registered component: ${C}`), Je();
|
|
926
990
|
} catch (l) {
|
|
927
991
|
console.error("β Failed to re-register:", l.message);
|
|
928
992
|
}
|
|
929
993
|
}, 2e3)));
|
|
930
994
|
}, 3e3);
|
|
931
|
-
},
|
|
995
|
+
}, ze = async () => {
|
|
932
996
|
console.log(`
|
|
933
997
|
|
|
934
|
-
π Shutting down...`),
|
|
998
|
+
π Shutting down...`), me && clearInterval(me), await nt(), process.exit(0);
|
|
935
999
|
};
|
|
936
|
-
process.on("SIGINT",
|
|
937
|
-
|
|
1000
|
+
process.on("SIGINT", ze), process.on("SIGTERM", ze);
|
|
1001
|
+
let Re = !1;
|
|
1002
|
+
$e.on("error", async (a) => {
|
|
1003
|
+
if (a.code === "EADDRINUSE") {
|
|
938
1004
|
console.log(`
|
|
939
1005
|
π Connecting to existing dev server...`);
|
|
940
1006
|
try {
|
|
941
1007
|
C = await U();
|
|
942
|
-
const
|
|
943
|
-
console.log(`β
Registered component: ${C}`), console.log(`π‘ Access at: http://localhost:${
|
|
944
|
-
process.env.MYOP_NO_BROWSER || g(`http://localhost:${
|
|
945
|
-
}),
|
|
946
|
-
} catch (
|
|
947
|
-
console.error("β Failed to register component:",
|
|
1008
|
+
const i = await Ae();
|
|
1009
|
+
console.log(`β
Registered component: ${C}`), console.log(`π‘ Access at: http://localhost:${u}/view/${C}/`), console.log(`π All registered components: ${i.registered.join(", ")}`), Be(() => {
|
|
1010
|
+
process.env.MYOP_NO_BROWSER || g(`http://localhost:${u}/view/${C}/`);
|
|
1011
|
+
}), Je();
|
|
1012
|
+
} catch (i) {
|
|
1013
|
+
console.error("β Failed to register component:", i.message), process.exit(1);
|
|
948
1014
|
}
|
|
949
1015
|
} else
|
|
950
|
-
console.error("β Management server error:",
|
|
951
|
-
}),
|
|
952
|
-
console.log(`
|
|
953
|
-
π Starting shared dev server...`), console.log(`π‘ Management server on port ${p}`),
|
|
954
|
-
console.error("β Main server error:",
|
|
955
|
-
}),
|
|
956
|
-
console.log(`π‘ Main server running at http://localhost:${
|
|
957
|
-
const
|
|
958
|
-
|
|
959
|
-
path:
|
|
1016
|
+
console.error("β Management server error:", a.message), process.exit(1);
|
|
1017
|
+
}), $e.on("upgrade", ot), $e.listen(p, async () => {
|
|
1018
|
+
Re = !0, console.log(`
|
|
1019
|
+
π Starting shared dev server...`), console.log(`π‘ Management server on port ${p}`), de.on("error", (a) => {
|
|
1020
|
+
console.error("β Main server error:", a.message), process.exit(1);
|
|
1021
|
+
}), de.listen(u, async () => {
|
|
1022
|
+
console.log(`π‘ Main server running at http://localhost:${u}`), (C === "DEV" || C === "NEW") && (C = "DEV1");
|
|
1023
|
+
const a = x ? e.default.resolve(F) : e.default.resolve(F, S);
|
|
1024
|
+
T.set(C, {
|
|
1025
|
+
path: a,
|
|
960
1026
|
name: I,
|
|
961
1027
|
htmlFile: x ? $ : null
|
|
962
1028
|
});
|
|
963
|
-
const
|
|
964
|
-
console.log(`β
Registered component: ${C}${
|
|
965
|
-
process.env.MYOP_NO_BROWSER || g(`http://localhost:${
|
|
1029
|
+
const i = I ? ` (${I})` : "";
|
|
1030
|
+
console.log(`β
Registered component: ${C}${i}`), console.log(`π‘ Access at: http://localhost:${u}/view/${C}/`), Be(() => {
|
|
1031
|
+
process.env.MYOP_NO_BROWSER || g(`http://localhost:${u}/view/${C}/`);
|
|
966
1032
|
});
|
|
967
1033
|
});
|
|
968
1034
|
});
|
|
969
1035
|
}
|
|
970
|
-
const
|
|
1036
|
+
const O = class O {
|
|
971
1037
|
constructor(e) {
|
|
972
1038
|
this.components = e.map(
|
|
973
1039
|
(t) => typeof t == "string" ? { name: t, path: "", id: "" } : t
|
|
@@ -976,7 +1042,7 @@ const T = class T {
|
|
|
976
1042
|
this.logs.set(t.name, []), this.scrollPos.set(t.name, 0), this.statuses.set(t.name, "Initializing..."), this.statusKeys.set(t.name, "initializing");
|
|
977
1043
|
this.cols = process.stdout.columns || 120, this.rows = process.stdout.rows || 30, process.stdout.on("resize", () => {
|
|
978
1044
|
this.cols = process.stdout.columns || 120, this.rows = process.stdout.rows || 30, this.needsFullRedraw = !0, this.calculateLayout(), this.render();
|
|
979
|
-
}), this.setupKeyboardInput(), process.stdout.write(
|
|
1045
|
+
}), this.setupKeyboardInput(), process.stdout.write(O.ESC.hideCursor), this.calculateLayout(), this.render(), this.uptimeInterval = setInterval(() => this.updateHeader(), 1e3);
|
|
980
1046
|
}
|
|
981
1047
|
setupKeyboardInput() {
|
|
982
1048
|
process.stdin.isTTY && (process.stdin.setRawMode(!0), process.stdin.resume(), process.stdin.setEncoding("utf8"), process.stdin.on("data", (e) => {
|
|
@@ -1007,8 +1073,8 @@ const T = class T {
|
|
|
1007
1073
|
this.scrollPos.set(t, 0), this.queueUpdate(t);
|
|
1008
1074
|
break;
|
|
1009
1075
|
case "G":
|
|
1010
|
-
const
|
|
1011
|
-
this.scrollPos.set(t, Math.max(0,
|
|
1076
|
+
const r = this.logs.get(t) || [];
|
|
1077
|
+
this.scrollPos.set(t, Math.max(0, r.length - this.visibleLogLines)), this.queueUpdate(t);
|
|
1012
1078
|
break;
|
|
1013
1079
|
}
|
|
1014
1080
|
}));
|
|
@@ -1017,35 +1083,35 @@ const T = class T {
|
|
|
1017
1083
|
const e = this.components.length, t = 38;
|
|
1018
1084
|
let n;
|
|
1019
1085
|
this.cols >= t * 3 + 4 ? n = Math.min(e, 3) : this.cols >= t * 2 + 2 ? n = Math.min(e, 2) : n = 1;
|
|
1020
|
-
const
|
|
1021
|
-
this.visibleLogLines = Math.max(2,
|
|
1086
|
+
const r = Math.ceil(e / n), s = Math.floor(this.cols / n), d = 2, M = this.rows - d - 2, u = Math.floor(M / r);
|
|
1087
|
+
this.visibleLogLines = Math.max(2, u - 4), this.layout = { panelsPerRow: n, panelWidth: s, numRows: r, panelHeight: u }, this.panelPositions.clear();
|
|
1022
1088
|
for (let p = 0; p < e; p++) {
|
|
1023
|
-
const
|
|
1024
|
-
this.panelPositions.set(
|
|
1025
|
-
row: d + 1 +
|
|
1026
|
-
col:
|
|
1089
|
+
const S = this.components[p], f = Math.floor(p / n), b = p % n;
|
|
1090
|
+
this.panelPositions.set(S.name, {
|
|
1091
|
+
row: d + 1 + f * u,
|
|
1092
|
+
col: b * s + 1,
|
|
1027
1093
|
width: s,
|
|
1028
|
-
height:
|
|
1094
|
+
height: u
|
|
1029
1095
|
});
|
|
1030
1096
|
}
|
|
1031
1097
|
}
|
|
1032
1098
|
log(e, t, n = "info") {
|
|
1033
|
-
const
|
|
1099
|
+
const r = this.logs.get(e) || [], s = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
|
|
1034
1100
|
hour12: !1,
|
|
1035
1101
|
hour: "2-digit",
|
|
1036
1102
|
minute: "2-digit",
|
|
1037
1103
|
second: "2-digit"
|
|
1038
1104
|
});
|
|
1039
|
-
t.includes("β
") || t.includes("completed") ? n = "success" : t.includes("β") || t.includes("failed") ? n = "error" : t.includes("β ") ? n = "warning" : t.includes("π₯") || t.includes("HMR") ? n = "hmr" : (t.includes("π") || t.includes("changed")) && (n = "change"),
|
|
1105
|
+
t.includes("β
") || t.includes("completed") ? n = "success" : t.includes("β") || t.includes("failed") ? n = "error" : t.includes("β ") ? n = "warning" : t.includes("π₯") || t.includes("HMR") ? n = "hmr" : (t.includes("π") || t.includes("changed")) && (n = "change"), r.push({ timestamp: s, message: t.replace(/[β
ββ π₯ππ¨]/g, "").trim(), type: n }), this.logs.set(e, r), r.length > this.visibleLogLines && this.scrollPos.set(e, r.length - this.visibleLogLines), this.queueUpdate(e);
|
|
1040
1106
|
}
|
|
1041
1107
|
setStatus(e, t) {
|
|
1042
1108
|
let n = "ready";
|
|
1043
|
-
const
|
|
1044
|
-
|
|
1109
|
+
const r = t.toLowerCase();
|
|
1110
|
+
r.includes("initializing") || r.includes("β³") ? n = "initializing" : r.includes("starting") ? n = "starting" : r.includes("building") || r.includes("π¨") ? n = "building" : r.includes("ready") || r.includes("β
") ? n = "ready" : r.includes("changed") || r.includes("π") ? n = "changed" : r.includes("hmr") ? n = "hmr_update" : r.includes("π₯") ? n = "hmr" : r.includes("error") || r.includes("β") ? n = "error" : r.includes("warning") || r.includes("β ") ? n = "warning" : (r.includes("stopped") || r.includes("exited")) && (n = "stopped"), this.statuses.set(e, t), this.statusKeys.set(e, n), this.queueUpdate(e);
|
|
1045
1111
|
}
|
|
1046
1112
|
scroll(e, t) {
|
|
1047
|
-
const n = this.logs.get(e) || [],
|
|
1048
|
-
d !==
|
|
1113
|
+
const n = this.logs.get(e) || [], r = this.scrollPos.get(e) || 0, s = Math.max(0, n.length - this.visibleLogLines), d = Math.max(0, Math.min(s, r + t));
|
|
1114
|
+
d !== r && (this.scrollPos.set(e, d), this.queueUpdate(e));
|
|
1049
1115
|
}
|
|
1050
1116
|
queueUpdate(e) {
|
|
1051
1117
|
this.pendingUpdates.add(e), this.renderQueued || (this.renderQueued = !0, setImmediate(() => {
|
|
@@ -1066,71 +1132,71 @@ const T = class T {
|
|
|
1066
1132
|
return `${t}:${n.toString().padStart(2, "0")}`;
|
|
1067
1133
|
}
|
|
1068
1134
|
updateHeader() {
|
|
1069
|
-
const e =
|
|
1070
|
-
let
|
|
1071
|
-
|
|
1135
|
+
const e = O.C, t = Array.from(this.statusKeys.values()).filter((s) => s === "ready").length, n = this.components.length;
|
|
1136
|
+
let r = `${e.dim}π‘${e.reset} http://localhost:9292 ${e.gray}|${e.reset} `;
|
|
1137
|
+
r += `${e.green}${t}${e.reset}/${n} ready ${e.gray}|${e.reset} `, r += `β± ${this.getUptime()} ${e.gray}|${e.reset} `, r += `Press ${e.yellow}Ctrl+C${e.reset} to stop`, r += O.ESC.clearLine.slice(0, -1), process.stdout.write(O.ESC.moveTo(2, 1) + r);
|
|
1072
1138
|
}
|
|
1073
1139
|
renderPanel(e) {
|
|
1074
|
-
const t =
|
|
1075
|
-
if (!
|
|
1076
|
-
const s = this.components.findIndex((U) => U.name === e), d = this.components[s],
|
|
1077
|
-
let
|
|
1078
|
-
|
|
1079
|
-
const g = 5 +
|
|
1080
|
-
|
|
1081
|
-
const P = (d.path || "").substring(0,
|
|
1140
|
+
const t = O.C, n = O.STATUS, r = this.panelPositions.get(e);
|
|
1141
|
+
if (!r) return;
|
|
1142
|
+
const s = this.components.findIndex((U) => U.name === e), d = this.components[s], v = s === this.selectedPanel, M = this.statusKeys.get(e) || "initializing", u = n[M], p = t[u.color], S = this.logs.get(e) || [], f = this.scrollPos.get(e) || 0, b = r.width - 1, x = v ? t.cyan : t.gray, $ = [], L = d.name.substring(0, b - 20);
|
|
1143
|
+
let H = `${x}ββ${t.reset} ${p}${u.icon}${t.reset} `;
|
|
1144
|
+
H += `${t.bold}${L}${t.reset} ${t.gray}β${t.reset} ${p}${u.label}${t.reset} `;
|
|
1145
|
+
const g = 5 + L.length + u.label.length + 3;
|
|
1146
|
+
H += `${x}${"β".repeat(Math.max(0, b - g))}β${t.reset}`, $.push(O.ESC.moveTo(r.row, r.col) + H);
|
|
1147
|
+
const P = (d.path || "").substring(0, b - 6);
|
|
1082
1148
|
let E = `${x}β${t.reset} ${t.dim}${P}${t.reset}`;
|
|
1083
|
-
E += " ".repeat(Math.max(0,
|
|
1084
|
-
const C =
|
|
1085
|
-
let
|
|
1086
|
-
I && (
|
|
1087
|
-
const
|
|
1149
|
+
E += " ".repeat(Math.max(0, b - P.length - 3)), E += `${x}β${t.reset}`, $.push(O.ESC.moveTo(r.row + 1, r.col) + E);
|
|
1150
|
+
const C = S.length, I = C > this.visibleLogLines ? `${f + 1}-${Math.min(f + this.visibleLogLines, C)}/${C}` : "";
|
|
1151
|
+
let k = `${x}β${"β".repeat(b - I.length - 4)}${t.reset}`;
|
|
1152
|
+
I && (k += `${t.dim}${I}${t.reset}`), k += `${x}${"β".repeat(2)}β€${t.reset}`, $.push(O.ESC.moveTo(r.row + 2, r.col) + k);
|
|
1153
|
+
const q = S.slice(f, f + this.visibleLogLines);
|
|
1088
1154
|
for (let U = 0; U < this.visibleLogLines; U++) {
|
|
1089
|
-
const
|
|
1090
|
-
let
|
|
1091
|
-
if (
|
|
1092
|
-
let
|
|
1093
|
-
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1155
|
+
const F = q[U];
|
|
1156
|
+
let G = `${x}β${t.reset}`;
|
|
1157
|
+
if (F) {
|
|
1158
|
+
let T = t.white;
|
|
1159
|
+
F.type === "success" ? T = t.green : F.type === "error" ? T = t.red : F.type === "warning" ? T = t.yellow : F.type === "hmr" ? T = t.magenta : F.type === "change" && (T = t.blue);
|
|
1160
|
+
const Y = F.message.substring(0, b - 12);
|
|
1161
|
+
G += `${t.dim}${F.timestamp}${t.reset} ${T}${Y}${t.reset}`;
|
|
1162
|
+
const xe = b - F.timestamp.length - Y.length - 2;
|
|
1163
|
+
G += " ".repeat(Math.max(0, xe));
|
|
1098
1164
|
} else
|
|
1099
|
-
|
|
1100
|
-
|
|
1165
|
+
G += " ".repeat(b - 2);
|
|
1166
|
+
G += `${x}β${t.reset}`, $.push(O.ESC.moveTo(r.row + 3 + U, r.col) + G);
|
|
1101
1167
|
}
|
|
1102
|
-
$.push(
|
|
1168
|
+
$.push(O.ESC.moveTo(r.row + 3 + this.visibleLogLines, r.col) + `${x}β${"β".repeat(b - 2)}β${t.reset}`), process.stdout.write($.join(""));
|
|
1103
1169
|
}
|
|
1104
1170
|
fullRender() {
|
|
1105
|
-
const e =
|
|
1106
|
-
process.stdout.write(
|
|
1171
|
+
const e = O.C;
|
|
1172
|
+
process.stdout.write(O.ESC.clearScreen + O.ESC.moveTo(1, 1));
|
|
1107
1173
|
const t = " MYOP MONOREPO DEV ", n = Math.floor((this.cols - t.length) / 2);
|
|
1108
1174
|
process.stdout.write(`${e.cyan}${"β".repeat(n)}${e.bold}${e.bgCyan}${e.black}${t}${e.reset}${e.cyan}${"β".repeat(this.cols - n - t.length)}${e.reset}`), this.updateHeader();
|
|
1109
|
-
for (const
|
|
1110
|
-
this.renderPanel(
|
|
1175
|
+
for (const r of this.components)
|
|
1176
|
+
this.renderPanel(r.name);
|
|
1111
1177
|
this.renderFooter();
|
|
1112
1178
|
}
|
|
1113
1179
|
renderFooter() {
|
|
1114
|
-
const e =
|
|
1180
|
+
const e = O.C, t = this.rows - 1;
|
|
1115
1181
|
let n = `${e.gray}`;
|
|
1116
|
-
n += `${e.green}β${e.gray} Ready `, n += `${e.yellow}β³${e.gray} Building `, n += `${e.magenta}β‘${e.gray} HMR `, n += `${e.red}β${e.gray} Error `, n += `${e.dim}| ββ: select panel ββ: scroll PgUp/PgDn: page g/G: top/bottom${e.reset}`, process.stdout.write(
|
|
1182
|
+
n += `${e.green}β${e.gray} Ready `, n += `${e.yellow}β³${e.gray} Building `, n += `${e.magenta}β‘${e.gray} HMR `, n += `${e.red}β${e.gray} Error `, n += `${e.dim}| ββ: select panel ββ: scroll PgUp/PgDn: page g/G: top/bottom${e.reset}`, process.stdout.write(O.ESC.moveTo(t, 1) + n);
|
|
1117
1183
|
}
|
|
1118
1184
|
render() {
|
|
1119
1185
|
this.needsFullRedraw = !0, this.queueUpdate("__full__");
|
|
1120
1186
|
}
|
|
1121
1187
|
clear() {
|
|
1122
|
-
this.uptimeInterval && clearInterval(this.uptimeInterval), process.stdin.isTTY && process.stdin.setRawMode(!1), process.stdout.write(
|
|
1188
|
+
this.uptimeInterval && clearInterval(this.uptimeInterval), process.stdin.isTTY && process.stdin.setRawMode(!1), process.stdout.write(O.ESC.clearScreen + O.ESC.moveTo(1, 1) + O.ESC.showCursor);
|
|
1123
1189
|
}
|
|
1124
1190
|
};
|
|
1125
1191
|
// ANSI escape codes
|
|
1126
|
-
|
|
1192
|
+
fe(O, "ESC", {
|
|
1127
1193
|
moveTo: (e, t) => `\x1B[${e};${t}H`,
|
|
1128
1194
|
hideCursor: "\x1B[?25l",
|
|
1129
1195
|
showCursor: "\x1B[?25h",
|
|
1130
1196
|
clearScreen: "\x1B[2J",
|
|
1131
1197
|
clearLine: "\x1B[2K"
|
|
1132
1198
|
}), // Colors
|
|
1133
|
-
|
|
1199
|
+
fe(O, "C", {
|
|
1134
1200
|
reset: "\x1B[0m",
|
|
1135
1201
|
bold: "\x1B[1m",
|
|
1136
1202
|
dim: "\x1B[2m",
|
|
@@ -1145,7 +1211,7 @@ ue(T, "C", {
|
|
|
1145
1211
|
bgCyan: "\x1B[46m",
|
|
1146
1212
|
black: "\x1B[30m"
|
|
1147
1213
|
}), // Status configs
|
|
1148
|
-
|
|
1214
|
+
fe(O, "STATUS", {
|
|
1149
1215
|
initializing: { icon: "β", color: "yellow", label: "Initializing" },
|
|
1150
1216
|
starting: { icon: "β", color: "yellow", label: "Starting" },
|
|
1151
1217
|
building: { icon: "β³", color: "yellow", label: "Building" },
|
|
@@ -1158,16 +1224,16 @@ ue(T, "STATUS", {
|
|
|
1158
1224
|
warning: { icon: "β ", color: "yellow", label: "Warning" },
|
|
1159
1225
|
stopped: { icon: "β ", color: "gray", label: "Stopped" }
|
|
1160
1226
|
});
|
|
1161
|
-
let
|
|
1162
|
-
async function
|
|
1163
|
-
const { spawn: e, exec: t } = await import("child_process"), n = await import("path"),
|
|
1227
|
+
let Ie = O;
|
|
1228
|
+
async function Tt(o) {
|
|
1229
|
+
const { spawn: e, exec: t } = await import("child_process"), n = await import("path"), r = o.map((p) => ({
|
|
1164
1230
|
name: p.name,
|
|
1165
1231
|
path: p.path,
|
|
1166
1232
|
id: p.componentId || ""
|
|
1167
|
-
})), s = new
|
|
1168
|
-
const
|
|
1169
|
-
let
|
|
1170
|
-
|
|
1233
|
+
})), s = new Ie(r), d = [], v = (p) => {
|
|
1234
|
+
const S = process.platform;
|
|
1235
|
+
let f;
|
|
1236
|
+
S === "darwin" ? f = `open "${p}"` : S === "win32" ? f = `start "" "${p}"` : f = `xdg-open "${p}"`, t(f, () => {
|
|
1171
1237
|
});
|
|
1172
1238
|
}, M = () => {
|
|
1173
1239
|
s.clear(), console.log(`
|
|
@@ -1179,73 +1245,73 @@ async function Rt(o) {
|
|
|
1179
1245
|
}), setTimeout(() => process.exit(0), 500);
|
|
1180
1246
|
};
|
|
1181
1247
|
process.on("SIGINT", M), process.on("SIGTERM", M);
|
|
1182
|
-
const
|
|
1248
|
+
const u = process.argv[1];
|
|
1183
1249
|
for (let p = 0; p < o.length; p++) {
|
|
1184
|
-
const
|
|
1185
|
-
s.setStatus(
|
|
1186
|
-
const
|
|
1187
|
-
cwd: n.default.resolve(
|
|
1250
|
+
const S = o[p], f = S.name;
|
|
1251
|
+
s.setStatus(f, "β³ Starting..."), s.log(f, `Starting in ${S.path}`);
|
|
1252
|
+
const b = e("node", [u, "dev"], {
|
|
1253
|
+
cwd: n.default.resolve(S.path),
|
|
1188
1254
|
env: { ...process.env, FORCE_COLOR: "1", MYOP_NO_BROWSER: "1" },
|
|
1189
1255
|
stdio: ["ignore", "pipe", "pipe"]
|
|
1190
1256
|
});
|
|
1191
|
-
d.push(
|
|
1257
|
+
d.push(b);
|
|
1192
1258
|
let x = "";
|
|
1193
|
-
|
|
1259
|
+
b.stdout.on("data", ($) => {
|
|
1194
1260
|
x += $.toString();
|
|
1195
|
-
const
|
|
1261
|
+
const L = x.split(`
|
|
1196
1262
|
`);
|
|
1197
|
-
x =
|
|
1198
|
-
for (const
|
|
1199
|
-
const g =
|
|
1200
|
-
g && (g.includes("Registered component") || g.includes("Registered:") ? s.setStatus(
|
|
1263
|
+
x = L.pop() || "";
|
|
1264
|
+
for (const H of L) {
|
|
1265
|
+
const g = H.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "").trim();
|
|
1266
|
+
g && (g.includes("Registered component") || g.includes("Registered:") ? s.setStatus(f, "β
Ready") : g.includes("Building...") || g.includes("Running initial build") ? s.setStatus(f, "π¨ Building...") : g.includes("Build completed") || g.includes("Build succeeded") ? s.setStatus(f, "β
Ready") : g.includes("Build failed") ? s.setStatus(f, "β Build Error") : g.includes("File changed") ? (s.setStatus(f, "π Changed"), setTimeout(() => s.setStatus(f, "β
Ready"), 1500)) : g.includes("Notifying") && g.includes("HMR") ? (s.setStatus(f, "π₯ HMR Update"), setTimeout(() => s.setStatus(f, "β
Ready"), 1e3)) : g.includes("HMR client connected") && (s.setStatus(f, "π₯ HMR Connected"), setTimeout(() => s.setStatus(f, "β
Ready"), 1e3)), !g.includes("Watching") && !g.includes("Press Ctrl+C") && !g.includes("Starting shared") && !g.includes("Management server") && !g.includes("Main server") && !g.includes("Access at:") && !g.includes("No build needed") && s.log(f, g));
|
|
1201
1267
|
}
|
|
1202
|
-
}),
|
|
1203
|
-
const
|
|
1268
|
+
}), b.stderr.on("data", ($) => {
|
|
1269
|
+
const L = $.toString().split(`
|
|
1204
1270
|
`);
|
|
1205
|
-
for (const
|
|
1206
|
-
const g =
|
|
1207
|
-
g && (s.log(
|
|
1271
|
+
for (const H of L) {
|
|
1272
|
+
const g = H.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "").trim();
|
|
1273
|
+
g && (s.log(f, `β οΈ ${g}`), s.setStatus(f, "β οΈ Warning"));
|
|
1208
1274
|
}
|
|
1209
|
-
}),
|
|
1210
|
-
$ !== 0 && $ !== null && (s.setStatus(
|
|
1275
|
+
}), b.on("exit", ($) => {
|
|
1276
|
+
$ !== 0 && $ !== null && (s.setStatus(f, `β Exited (${$})`), s.log(f, `Process exited with code ${$}`));
|
|
1211
1277
|
}), p < o.length - 1 && await new Promise(($) => setTimeout($, 500));
|
|
1212
1278
|
}
|
|
1213
1279
|
s.render(), setTimeout(() => {
|
|
1214
|
-
|
|
1280
|
+
v("http://localhost:9292");
|
|
1215
1281
|
}, 2e3);
|
|
1216
1282
|
}
|
|
1217
|
-
const
|
|
1283
|
+
const Ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1218
1284
|
__proto__: null,
|
|
1219
|
-
devCommand:
|
|
1220
|
-
monorepoDevCommand:
|
|
1221
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1285
|
+
devCommand: _e,
|
|
1286
|
+
monorepoDevCommand: Tt
|
|
1287
|
+
}, Symbol.toStringTag, { value: "Module" })), Fe = te.join(ut.homedir(), ".myop"), le = te.join(Fe, "credentials.json");
|
|
1222
1288
|
function Et() {
|
|
1223
|
-
|
|
1289
|
+
D.existsSync(Fe) || D.mkdirSync(Fe, { recursive: !0, mode: 448 });
|
|
1224
1290
|
}
|
|
1225
|
-
function
|
|
1291
|
+
function ke() {
|
|
1226
1292
|
try {
|
|
1227
|
-
if (!
|
|
1293
|
+
if (!D.existsSync(le))
|
|
1228
1294
|
return null;
|
|
1229
|
-
const o =
|
|
1295
|
+
const o = D.readFileSync(le, "utf8");
|
|
1230
1296
|
return JSON.parse(o);
|
|
1231
1297
|
} catch (o) {
|
|
1232
1298
|
return console.info("Failed to read credentials:", o.message), null;
|
|
1233
1299
|
}
|
|
1234
1300
|
}
|
|
1235
|
-
function
|
|
1301
|
+
function Xe(o) {
|
|
1236
1302
|
Et();
|
|
1237
1303
|
const e = {
|
|
1238
1304
|
...o,
|
|
1239
1305
|
savedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1240
1306
|
};
|
|
1241
|
-
|
|
1307
|
+
D.writeFileSync(le, JSON.stringify(e, null, 2), {
|
|
1242
1308
|
mode: 384
|
|
1243
1309
|
// Read/write for owner only
|
|
1244
1310
|
});
|
|
1245
1311
|
}
|
|
1246
|
-
function
|
|
1312
|
+
function qe() {
|
|
1247
1313
|
try {
|
|
1248
|
-
return
|
|
1314
|
+
return D.existsSync(le) && D.unlinkSync(le), !0;
|
|
1249
1315
|
} catch (o) {
|
|
1250
1316
|
return console.error("Failed to clear credentials:", o.message), !1;
|
|
1251
1317
|
}
|
|
@@ -1256,27 +1322,27 @@ function It(o) {
|
|
|
1256
1322
|
const e = 5 * 60 * 1e3, t = new Date(o.expiresAt).getTime();
|
|
1257
1323
|
return Date.now() > t - e;
|
|
1258
1324
|
}
|
|
1259
|
-
function
|
|
1260
|
-
const o =
|
|
1325
|
+
function be() {
|
|
1326
|
+
const o = ke();
|
|
1261
1327
|
return o ? {
|
|
1262
1328
|
email: o.userEmail,
|
|
1263
1329
|
userId: o.userId
|
|
1264
1330
|
} : null;
|
|
1265
1331
|
}
|
|
1266
|
-
const se = process.env.MYOP_MCP_URL || "https://mcp.myop.dev",
|
|
1267
|
-
function
|
|
1268
|
-
return
|
|
1332
|
+
const se = process.env.MYOP_MCP_URL || "https://mcp.myop.dev", ye = 19284, Le = `http://localhost:${ye}/callback`, Ft = "myop-cli";
|
|
1333
|
+
function jt() {
|
|
1334
|
+
return je.randomBytes(32).toString("base64url");
|
|
1269
1335
|
}
|
|
1270
|
-
function
|
|
1271
|
-
return
|
|
1336
|
+
function Nt(o) {
|
|
1337
|
+
return je.createHash("sha256").update(o).digest("base64url");
|
|
1272
1338
|
}
|
|
1273
|
-
async function
|
|
1339
|
+
async function _t() {
|
|
1274
1340
|
const o = await fetch(`${se}/oauth/register`, {
|
|
1275
1341
|
method: "POST",
|
|
1276
1342
|
headers: { "Content-Type": "application/json" },
|
|
1277
1343
|
body: JSON.stringify({
|
|
1278
|
-
client_name:
|
|
1279
|
-
redirect_uris: [
|
|
1344
|
+
client_name: Ft,
|
|
1345
|
+
redirect_uris: [Le],
|
|
1280
1346
|
grant_types: ["authorization_code", "refresh_token"],
|
|
1281
1347
|
response_types: ["code"]
|
|
1282
1348
|
})
|
|
@@ -1288,7 +1354,7 @@ async function kt() {
|
|
|
1288
1354
|
return o.json();
|
|
1289
1355
|
}
|
|
1290
1356
|
function ge(o, e, t, n = null) {
|
|
1291
|
-
const
|
|
1357
|
+
const r = {
|
|
1292
1358
|
success: `<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="#4ade80" stroke-width="2">
|
|
1293
1359
|
<circle cx="12" cy="12" r="10"/>
|
|
1294
1360
|
<path d="M8 12l2.5 2.5L16 9"/>
|
|
@@ -1305,7 +1371,7 @@ function ge(o, e, t, n = null) {
|
|
|
1305
1371
|
success: { accent: "#4ade80", glow: "rgba(74, 222, 128, 0.1)" },
|
|
1306
1372
|
error: { accent: "#f87171", glow: "rgba(248, 113, 113, 0.1)" },
|
|
1307
1373
|
warning: { accent: "#fbbf24", glow: "rgba(251, 191, 36, 0.1)" }
|
|
1308
|
-
}, { accent: d, glow:
|
|
1374
|
+
}, { accent: d, glow: v } = s[o] || s.error;
|
|
1309
1375
|
return `<!DOCTYPE html>
|
|
1310
1376
|
<html lang="en">
|
|
1311
1377
|
<head>
|
|
@@ -1398,7 +1464,7 @@ function ge(o, e, t, n = null) {
|
|
|
1398
1464
|
display: inline-flex;
|
|
1399
1465
|
align-items: center;
|
|
1400
1466
|
gap: 8px;
|
|
1401
|
-
background: ${
|
|
1467
|
+
background: ${v};
|
|
1402
1468
|
border: 1px solid ${d}33;
|
|
1403
1469
|
border-radius: 4px;
|
|
1404
1470
|
padding: 10px 16px;
|
|
@@ -1436,7 +1502,7 @@ function ge(o, e, t, n = null) {
|
|
|
1436
1502
|
<body>
|
|
1437
1503
|
<div class="container">
|
|
1438
1504
|
<div class="icon">
|
|
1439
|
-
${
|
|
1505
|
+
${r[o] || r.error}
|
|
1440
1506
|
</div>
|
|
1441
1507
|
<h1>${e}</h1>
|
|
1442
1508
|
<p class="message">${t}</p>
|
|
@@ -1453,19 +1519,19 @@ function ge(o, e, t, n = null) {
|
|
|
1453
1519
|
</body>
|
|
1454
1520
|
</html>`;
|
|
1455
1521
|
}
|
|
1456
|
-
function
|
|
1522
|
+
function kt(o) {
|
|
1457
1523
|
return new Promise((e, t) => {
|
|
1458
|
-
const n =
|
|
1459
|
-
const d = new
|
|
1524
|
+
const n = pt.createServer((r, s) => {
|
|
1525
|
+
const d = new Ve(r.url, `http://localhost:${ye}`);
|
|
1460
1526
|
if (d.pathname === "/callback") {
|
|
1461
|
-
const
|
|
1462
|
-
if (
|
|
1527
|
+
const v = d.searchParams.get("code"), M = d.searchParams.get("state"), u = d.searchParams.get("error");
|
|
1528
|
+
if (u) {
|
|
1463
1529
|
s.writeHead(200, { "Content-Type": "text/html" }), s.end(ge(
|
|
1464
1530
|
"error",
|
|
1465
1531
|
"Authentication Failed",
|
|
1466
1532
|
"Unable to complete the authentication process.",
|
|
1467
|
-
|
|
1468
|
-
)), n.close(), t(new Error(`OAuth error: ${
|
|
1533
|
+
u
|
|
1534
|
+
)), n.close(), t(new Error(`OAuth error: ${u}`));
|
|
1469
1535
|
return;
|
|
1470
1536
|
}
|
|
1471
1537
|
if (M !== o) {
|
|
@@ -1477,7 +1543,7 @@ function Nt(o) {
|
|
|
1477
1543
|
)), n.close(), t(new Error("State mismatch"));
|
|
1478
1544
|
return;
|
|
1479
1545
|
}
|
|
1480
|
-
if (!
|
|
1546
|
+
if (!v) {
|
|
1481
1547
|
s.writeHead(400, { "Content-Type": "text/html" }), s.end(ge(
|
|
1482
1548
|
"error",
|
|
1483
1549
|
"Missing Authorization Code",
|
|
@@ -1490,40 +1556,40 @@ function Nt(o) {
|
|
|
1490
1556
|
"success",
|
|
1491
1557
|
"Authentication Successful",
|
|
1492
1558
|
"You have been authenticated successfully. Return to the terminal to continue."
|
|
1493
|
-
)), n.close(), e(
|
|
1559
|
+
)), n.close(), e(v);
|
|
1494
1560
|
} else
|
|
1495
1561
|
s.writeHead(404), s.end("Not found");
|
|
1496
1562
|
});
|
|
1497
|
-
n.listen(
|
|
1498
|
-
console.info(`OAuth callback server listening on port ${
|
|
1563
|
+
n.listen(ye, () => {
|
|
1564
|
+
console.info(`OAuth callback server listening on port ${ye}`);
|
|
1499
1565
|
}), setTimeout(() => {
|
|
1500
1566
|
n.close(), t(new Error("Authentication timed out"));
|
|
1501
1567
|
}, 5 * 60 * 1e3);
|
|
1502
1568
|
});
|
|
1503
1569
|
}
|
|
1504
|
-
async function
|
|
1570
|
+
async function Lt(o, e, t) {
|
|
1505
1571
|
const n = await fetch(`${se}/oauth/token`, {
|
|
1506
1572
|
method: "POST",
|
|
1507
1573
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
1508
|
-
body: new
|
|
1574
|
+
body: new Ge({
|
|
1509
1575
|
grant_type: "authorization_code",
|
|
1510
1576
|
code: o,
|
|
1511
1577
|
client_id: e,
|
|
1512
|
-
redirect_uri:
|
|
1578
|
+
redirect_uri: Le,
|
|
1513
1579
|
code_verifier: t
|
|
1514
1580
|
})
|
|
1515
1581
|
});
|
|
1516
1582
|
if (!n.ok) {
|
|
1517
|
-
const
|
|
1518
|
-
throw new Error(
|
|
1583
|
+
const r = await n.json();
|
|
1584
|
+
throw new Error(r.error_description || r.error || "Token exchange failed");
|
|
1519
1585
|
}
|
|
1520
1586
|
return n.json();
|
|
1521
1587
|
}
|
|
1522
|
-
async function
|
|
1588
|
+
async function At(o, e) {
|
|
1523
1589
|
const t = await fetch(`${se}/oauth/token`, {
|
|
1524
1590
|
method: "POST",
|
|
1525
1591
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
1526
|
-
body: new
|
|
1592
|
+
body: new Ge({
|
|
1527
1593
|
grant_type: "refresh_token",
|
|
1528
1594
|
refresh_token: o,
|
|
1529
1595
|
client_id: e
|
|
@@ -1535,8 +1601,8 @@ async function Lt(o, e) {
|
|
|
1535
1601
|
}
|
|
1536
1602
|
return t.json();
|
|
1537
1603
|
}
|
|
1538
|
-
async function
|
|
1539
|
-
var
|
|
1604
|
+
async function Ht(o) {
|
|
1605
|
+
var r, s, d;
|
|
1540
1606
|
const e = await fetch(`${se}/mcp`, {
|
|
1541
1607
|
method: "POST",
|
|
1542
1608
|
headers: {
|
|
@@ -1558,57 +1624,57 @@ async function At(o) {
|
|
|
1558
1624
|
const t = await e.json();
|
|
1559
1625
|
if (t.error)
|
|
1560
1626
|
throw new Error(t.error.message);
|
|
1561
|
-
const n = (d = (s = (
|
|
1627
|
+
const n = (d = (s = (r = t.result) == null ? void 0 : r.content) == null ? void 0 : s[0]) == null ? void 0 : d.text;
|
|
1562
1628
|
if (n)
|
|
1563
1629
|
return JSON.parse(n);
|
|
1564
1630
|
throw new Error("Invalid response from whoami");
|
|
1565
1631
|
}
|
|
1566
|
-
async function
|
|
1567
|
-
const o =
|
|
1632
|
+
async function ae() {
|
|
1633
|
+
const o = V("Starting authentication...").start();
|
|
1568
1634
|
try {
|
|
1569
1635
|
o.text = "Registering OAuth client...";
|
|
1570
|
-
const t = (await
|
|
1636
|
+
const t = (await _t()).client_id, n = jt(), r = Nt(n), s = je.randomBytes(16).toString("hex");
|
|
1571
1637
|
o.text = "Waiting for authorization...";
|
|
1572
|
-
const d =
|
|
1573
|
-
|
|
1574
|
-
π Opening browser for authentication...`), console.log("If the browser does not open, visit:"), console.log(` ${
|
|
1575
|
-
`), await
|
|
1638
|
+
const d = kt(s), v = new Ve(`${se}/oauth/authorize`);
|
|
1639
|
+
v.searchParams.set("response_type", "code"), v.searchParams.set("client_id", t), v.searchParams.set("redirect_uri", Le), v.searchParams.set("code_challenge", r), v.searchParams.set("code_challenge_method", "S256"), v.searchParams.set("state", s), o.stop(), console.log(`
|
|
1640
|
+
π Opening browser for authentication...`), console.log("If the browser does not open, visit:"), console.log(` ${v.toString()}
|
|
1641
|
+
`), await mt(v.toString());
|
|
1576
1642
|
const M = await d;
|
|
1577
1643
|
o.start("Exchanging authorization code...");
|
|
1578
|
-
const
|
|
1644
|
+
const u = await Lt(M, t, n);
|
|
1579
1645
|
o.text = "Getting user info...";
|
|
1580
|
-
const p = await
|
|
1581
|
-
accessToken:
|
|
1582
|
-
refreshToken:
|
|
1583
|
-
expiresAt: new Date(Date.now() +
|
|
1646
|
+
const p = await Ht(u.access_token), S = {
|
|
1647
|
+
accessToken: u.access_token,
|
|
1648
|
+
refreshToken: u.refresh_token,
|
|
1649
|
+
expiresAt: new Date(Date.now() + u.expires_in * 1e3).toISOString(),
|
|
1584
1650
|
clientId: t,
|
|
1585
1651
|
userId: p.userId,
|
|
1586
1652
|
userEmail: p.email
|
|
1587
1653
|
};
|
|
1588
|
-
return
|
|
1654
|
+
return Xe(S), o.succeed(`Authenticated as ${p.email}`), S;
|
|
1589
1655
|
} catch (e) {
|
|
1590
1656
|
throw o.fail(`Authentication failed: ${e.message}`), e;
|
|
1591
1657
|
}
|
|
1592
1658
|
}
|
|
1593
|
-
async function
|
|
1594
|
-
const o =
|
|
1659
|
+
async function et() {
|
|
1660
|
+
const o = ke();
|
|
1595
1661
|
if (!o) {
|
|
1596
1662
|
console.log("Not currently logged in.");
|
|
1597
1663
|
return;
|
|
1598
1664
|
}
|
|
1599
|
-
|
|
1665
|
+
qe(), console.log(`β
Logged out (was: ${o.userEmail})`);
|
|
1600
1666
|
}
|
|
1601
1667
|
async function Dt() {
|
|
1602
|
-
let o =
|
|
1668
|
+
let o = ke();
|
|
1603
1669
|
if (!o)
|
|
1604
1670
|
return console.log(`Not logged in. Starting authentication...
|
|
1605
|
-
`), await
|
|
1671
|
+
`), await ae();
|
|
1606
1672
|
if (!It(o))
|
|
1607
1673
|
return o;
|
|
1608
1674
|
if (o.refreshToken) {
|
|
1609
|
-
const e =
|
|
1675
|
+
const e = V("Refreshing access token...").start();
|
|
1610
1676
|
try {
|
|
1611
|
-
const t = await
|
|
1677
|
+
const t = await At(
|
|
1612
1678
|
o.refreshToken,
|
|
1613
1679
|
o.clientId
|
|
1614
1680
|
);
|
|
@@ -1617,100 +1683,100 @@ async function Dt() {
|
|
|
1617
1683
|
accessToken: t.access_token,
|
|
1618
1684
|
refreshToken: t.refresh_token,
|
|
1619
1685
|
expiresAt: new Date(Date.now() + t.expires_in * 1e3).toISOString()
|
|
1620
|
-
},
|
|
1686
|
+
}, Xe(o), e.succeed("Token refreshed"), o;
|
|
1621
1687
|
} catch {
|
|
1622
|
-
return e.warn("Token refresh failed, please log in again"),
|
|
1688
|
+
return e.warn("Token refresh failed, please log in again"), qe(), await ae();
|
|
1623
1689
|
}
|
|
1624
1690
|
}
|
|
1625
1691
|
return console.log(`Session expired. Please log in again.
|
|
1626
|
-
`), await
|
|
1692
|
+
`), await ae();
|
|
1627
1693
|
}
|
|
1628
|
-
function
|
|
1694
|
+
function Ut() {
|
|
1629
1695
|
return se;
|
|
1630
1696
|
}
|
|
1631
|
-
const
|
|
1632
|
-
async function
|
|
1697
|
+
const we = "@myop/cli";
|
|
1698
|
+
async function Bt() {
|
|
1633
1699
|
try {
|
|
1634
|
-
const o = await fetch(`https://registry.npmjs.org/${
|
|
1700
|
+
const o = await fetch(`https://registry.npmjs.org/${we}/latest`);
|
|
1635
1701
|
return o.ok ? (await o.json()).version : null;
|
|
1636
1702
|
} catch {
|
|
1637
1703
|
return null;
|
|
1638
1704
|
}
|
|
1639
1705
|
}
|
|
1640
|
-
function
|
|
1706
|
+
function Jt(o, e) {
|
|
1641
1707
|
const t = o.split(".").map(Number), n = e.split(".").map(Number);
|
|
1642
|
-
for (let
|
|
1643
|
-
const s = t[
|
|
1708
|
+
for (let r = 0; r < Math.max(t.length, n.length); r++) {
|
|
1709
|
+
const s = t[r] || 0, d = n[r] || 0;
|
|
1644
1710
|
if (s > d) return 1;
|
|
1645
1711
|
if (s < d) return -1;
|
|
1646
1712
|
}
|
|
1647
1713
|
return 0;
|
|
1648
1714
|
}
|
|
1649
|
-
async function
|
|
1650
|
-
const e =
|
|
1715
|
+
async function zt(o) {
|
|
1716
|
+
const e = V({
|
|
1651
1717
|
text: "Checking for updates...",
|
|
1652
1718
|
color: "cyan"
|
|
1653
|
-
}).start(), t = await
|
|
1654
|
-
if (e.stop(), !t ||
|
|
1719
|
+
}).start(), t = await Bt();
|
|
1720
|
+
if (e.stop(), !t || Jt(t, o) <= 0)
|
|
1655
1721
|
return !1;
|
|
1656
1722
|
console.log(`
|
|
1657
1723
|
π¦ New version available: ${o} β ${t}
|
|
1658
1724
|
`);
|
|
1659
1725
|
let n;
|
|
1660
1726
|
try {
|
|
1661
|
-
n = await
|
|
1727
|
+
n = await We({
|
|
1662
1728
|
message: "Would you like to update now?",
|
|
1663
1729
|
choices: [
|
|
1664
1730
|
{ name: "Yes, update now", value: !0 },
|
|
1665
1731
|
{ name: "No, continue with current version", value: !1 }
|
|
1666
1732
|
]
|
|
1667
1733
|
});
|
|
1668
|
-
} catch (
|
|
1669
|
-
throw
|
|
1734
|
+
} catch (r) {
|
|
1735
|
+
throw r.name === "ExitPromptError" && (console.log(`
|
|
1670
1736
|
|
|
1671
1737
|
π Goodbye!
|
|
1672
|
-
`), process.exit(0)),
|
|
1738
|
+
`), process.exit(0)), r;
|
|
1673
1739
|
}
|
|
1674
1740
|
if (n) {
|
|
1675
|
-
const
|
|
1676
|
-
text: `Updating ${
|
|
1741
|
+
const r = V({
|
|
1742
|
+
text: `Updating ${we} to v${t}...`,
|
|
1677
1743
|
color: "green"
|
|
1678
1744
|
}).start();
|
|
1679
1745
|
try {
|
|
1680
|
-
return
|
|
1746
|
+
return he(`npm install -g ${we}@latest`, { stdio: "pipe" }), r.succeed(`Updated to v${t}`), console.log(`
|
|
1681
1747
|
π Restarting with new version...
|
|
1682
|
-
`),
|
|
1748
|
+
`), dt("myop", process.argv.slice(2), {
|
|
1683
1749
|
stdio: "inherit",
|
|
1684
1750
|
shell: !0
|
|
1685
1751
|
}).on("close", (d) => {
|
|
1686
1752
|
process.exit(d || 0);
|
|
1687
1753
|
}), !0;
|
|
1688
1754
|
} catch {
|
|
1689
|
-
return
|
|
1690
|
-
You can manually update by running: npm install -g ${
|
|
1755
|
+
return r.fail("Update failed"), console.log(`
|
|
1756
|
+
You can manually update by running: npm install -g ${we}@latest
|
|
1691
1757
|
`), !1;
|
|
1692
1758
|
}
|
|
1693
1759
|
}
|
|
1694
1760
|
return !1;
|
|
1695
1761
|
}
|
|
1696
|
-
const
|
|
1762
|
+
const Wt = (o) => new Promise((e) => setTimeout(e, o)), tt = (o = ".", e = 3, t = 0) => {
|
|
1697
1763
|
const n = [];
|
|
1698
1764
|
if (t > e) return n;
|
|
1699
1765
|
try {
|
|
1700
|
-
const
|
|
1701
|
-
for (const s of
|
|
1702
|
-
const d =
|
|
1766
|
+
const r = D.readdirSync(o, { withFileTypes: !0 });
|
|
1767
|
+
for (const s of r) {
|
|
1768
|
+
const d = te.join(o, s.name);
|
|
1703
1769
|
if (s.isDirectory()) {
|
|
1704
1770
|
if (s.name === "node_modules" || s.name === ".git" || s.name === "dist" || s.name.startsWith("."))
|
|
1705
1771
|
continue;
|
|
1706
|
-
n.push(...
|
|
1772
|
+
n.push(...tt(d, e, t + 1));
|
|
1707
1773
|
} else if (s.name === "myop.config.json")
|
|
1708
1774
|
try {
|
|
1709
|
-
const
|
|
1775
|
+
const v = D.readFileSync(d, "utf-8"), M = JSON.parse(v);
|
|
1710
1776
|
n.push({
|
|
1711
1777
|
path: o,
|
|
1712
1778
|
configPath: d,
|
|
1713
|
-
name: M.name || M.componentName ||
|
|
1779
|
+
name: M.name || M.componentName || te.basename(o),
|
|
1714
1780
|
componentId: M.componentId || null,
|
|
1715
1781
|
config: M
|
|
1716
1782
|
});
|
|
@@ -1721,26 +1787,26 @@ const zt = (o) => new Promise((e) => setTimeout(e, o)), qe = (o = ".", e = 3, t
|
|
|
1721
1787
|
}
|
|
1722
1788
|
return n;
|
|
1723
1789
|
};
|
|
1724
|
-
|
|
1725
|
-
const
|
|
1726
|
-
const e =
|
|
1790
|
+
y.executionPath = process.cwd();
|
|
1791
|
+
const Se = (o = !1) => {
|
|
1792
|
+
const e = y.program.getOptionValue("verbose");
|
|
1727
1793
|
e || (console.info = () => {
|
|
1728
|
-
}), console.info("π verbose mode on"),
|
|
1729
|
-
configPath:
|
|
1794
|
+
}), console.info("π verbose mode on"), y.options = {
|
|
1795
|
+
configPath: y.program.getOptionValue("config"),
|
|
1730
1796
|
verbose: e
|
|
1731
1797
|
};
|
|
1732
1798
|
try {
|
|
1733
|
-
return
|
|
1799
|
+
return y.myopConfig = gt(y.options.configPath), { configFound: !0 };
|
|
1734
1800
|
} catch (t) {
|
|
1735
1801
|
if (o) {
|
|
1736
1802
|
console.info(`
|
|
1737
|
-
β οΈ failed read config file from ${
|
|
1803
|
+
β οΈ failed read config file from ${y.options.configPath}, trying to create new one`);
|
|
1738
1804
|
try {
|
|
1739
1805
|
const n = {
|
|
1740
1806
|
author: "@myop-cli",
|
|
1741
1807
|
flows: []
|
|
1742
1808
|
};
|
|
1743
|
-
return
|
|
1809
|
+
return Ne(y.options.configPath, n), y.myopConfig = n, { configFound: !0 };
|
|
1744
1810
|
} catch {
|
|
1745
1811
|
return console.info("Error details :", t), { configFound: !1, error: t };
|
|
1746
1812
|
}
|
|
@@ -1749,44 +1815,44 @@ const be = (o = !1) => {
|
|
|
1749
1815
|
}
|
|
1750
1816
|
};
|
|
1751
1817
|
[
|
|
1752
|
-
new
|
|
1753
|
-
...
|
|
1818
|
+
new Ee(),
|
|
1819
|
+
...xt
|
|
1754
1820
|
];
|
|
1755
|
-
const
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1821
|
+
const Vt = "0.1.24";
|
|
1822
|
+
y.program = new ct();
|
|
1823
|
+
y.program.name("@myop/cli").description("Myop CLI - Remote UI Made Easy").version(Vt);
|
|
1824
|
+
y.program.addOption(new ce("-c, --config <value>", "myop.config.json file location").default("./myop.config.json", "./myop.config.json"));
|
|
1825
|
+
y.program.addOption(new ce("-h, --help", "Show helpful information"));
|
|
1826
|
+
y.program.addOption(new ce("-v, --verbose", "Enables verbose output mode for the command-line interface (CLI)."));
|
|
1827
|
+
y.program.addOption(new ce("--ci", "CI mode: print status info (version, config, auth) as JSON and exit without prompts"));
|
|
1828
|
+
y.program.addOption(new ce("-m, --monorepo", "Monorepo mode: scan for all myop.config.json files in nested directories"));
|
|
1829
|
+
y.program.command("add").description("Install Myop assets").addArgument("type").addArgument("id").action((o, e) => {
|
|
1830
|
+
Se(!0), console.info("adding ", o, e, y.options.configPath), o === "flow" && Ke._action(e), process.exit();
|
|
1765
1831
|
});
|
|
1766
|
-
|
|
1767
|
-
|
|
1832
|
+
y.program.command("remove").description("Remove Myop asset").argument("<type>", "Myop asset type").argument("<id>", "Asset id").action((o, e) => {
|
|
1833
|
+
Se(), console.info("removing ", o, e, y.options.configPath), o === "flow" && Qe._action(e), process.exit();
|
|
1768
1834
|
});
|
|
1769
|
-
|
|
1770
|
-
|
|
1835
|
+
y.program.command("install").description("Install Myop assets").action(async () => {
|
|
1836
|
+
Se(), await Ye.action();
|
|
1771
1837
|
});
|
|
1772
|
-
|
|
1838
|
+
y.program.command("login").description("Authenticate with Myop platform").action(async () => {
|
|
1773
1839
|
try {
|
|
1774
|
-
await
|
|
1840
|
+
await ae();
|
|
1775
1841
|
} catch (o) {
|
|
1776
1842
|
console.error("Login failed:", o.message), process.exit(1);
|
|
1777
1843
|
}
|
|
1778
1844
|
process.exit(0);
|
|
1779
1845
|
});
|
|
1780
|
-
|
|
1781
|
-
await
|
|
1846
|
+
y.program.command("logout").description("Clear stored credentials").action(async () => {
|
|
1847
|
+
await et(), process.exit(0);
|
|
1782
1848
|
});
|
|
1783
|
-
|
|
1784
|
-
const o =
|
|
1849
|
+
y.program.command("whoami").description("Show current authenticated user").action(async () => {
|
|
1850
|
+
const o = be();
|
|
1785
1851
|
o && o.email ? console.log(`Logged in as: ${o.email}`) : console.log("Not logged in. Run `myop login` to authenticate."), process.exit(0);
|
|
1786
1852
|
});
|
|
1787
|
-
|
|
1788
|
-
var
|
|
1789
|
-
const e =
|
|
1853
|
+
y.program.command("sync").description("Build and upload component to Myop platform").option("--skip-build", "Skip the build step").action(async (o) => {
|
|
1854
|
+
var f, b, x, $, L, H;
|
|
1855
|
+
const e = y.program.getOptionValue("config") || "./myop.config.json", t = await import("fs"), { execSync: n } = await import("child_process"), r = await import("path");
|
|
1790
1856
|
let s = {};
|
|
1791
1857
|
if (t.existsSync(e))
|
|
1792
1858
|
try {
|
|
@@ -1802,42 +1868,42 @@ h.program.command("sync").description("Build and upload component to Myop platfo
|
|
|
1802
1868
|
if (!o.skipBuild) {
|
|
1803
1869
|
const { exec: g } = await import("child_process");
|
|
1804
1870
|
let P = { hasTriedPlatformFix: !1, hasTriedInstall: !1 };
|
|
1805
|
-
const E = (I = !1) => new Promise((
|
|
1806
|
-
const
|
|
1807
|
-
g("npm run build", { maxBuffer: 10 * 1024 * 1024 }, async (U,
|
|
1871
|
+
const E = (I = !1) => new Promise((k) => {
|
|
1872
|
+
const q = V(I ? "Retrying build..." : "Building project...").start();
|
|
1873
|
+
g("npm run build", { maxBuffer: 10 * 1024 * 1024 }, async (U, F, G) => {
|
|
1808
1874
|
if (!U) {
|
|
1809
|
-
|
|
1875
|
+
q.succeed("Build completed"), k(!0);
|
|
1810
1876
|
return;
|
|
1811
1877
|
}
|
|
1812
|
-
if (
|
|
1813
|
-
const
|
|
1814
|
-
if (P = { ...P, ...
|
|
1815
|
-
const
|
|
1816
|
-
|
|
1878
|
+
if (q.fail("Build failed"), !P.hasTriedPlatformFix && !P.hasTriedInstall) {
|
|
1879
|
+
const T = await Ze(U, F, G, g, P);
|
|
1880
|
+
if (P = { ...P, ...T }, T.handled) {
|
|
1881
|
+
const Y = await E(!0);
|
|
1882
|
+
k(Y);
|
|
1817
1883
|
return;
|
|
1818
1884
|
}
|
|
1819
1885
|
}
|
|
1820
|
-
console.error(U.message),
|
|
1886
|
+
console.error(U.message), k(!1);
|
|
1821
1887
|
});
|
|
1822
1888
|
});
|
|
1823
1889
|
await E() || process.exit(1);
|
|
1824
1890
|
}
|
|
1825
1891
|
const d = "./dist/index.html";
|
|
1826
1892
|
t.existsSync(d) || (console.error("β Error: ./dist/index.html not found"), console.log(" Make sure your build outputs to ./dist/index.html"), process.exit(1));
|
|
1827
|
-
let
|
|
1893
|
+
let v;
|
|
1828
1894
|
try {
|
|
1829
|
-
|
|
1895
|
+
v = await Dt();
|
|
1830
1896
|
} catch (g) {
|
|
1831
1897
|
console.error("β Authentication failed:", g.message), process.exit(1);
|
|
1832
1898
|
}
|
|
1833
|
-
const M =
|
|
1834
|
-
let
|
|
1899
|
+
const M = Ut();
|
|
1900
|
+
let u = V("Requesting upload URL...").start(), p;
|
|
1835
1901
|
try {
|
|
1836
1902
|
const g = await fetch(`${M}/mcp`, {
|
|
1837
1903
|
method: "POST",
|
|
1838
1904
|
headers: {
|
|
1839
1905
|
"Content-Type": "application/json",
|
|
1840
|
-
Authorization: `Bearer ${
|
|
1906
|
+
Authorization: `Bearer ${v.accessToken}`
|
|
1841
1907
|
},
|
|
1842
1908
|
body: JSON.stringify({
|
|
1843
1909
|
jsonrpc: "2.0",
|
|
@@ -1846,7 +1912,7 @@ h.program.command("sync").description("Build and upload component to Myop platfo
|
|
|
1846
1912
|
params: {
|
|
1847
1913
|
name: "upload_component",
|
|
1848
1914
|
arguments: {
|
|
1849
|
-
name: s.name || s.componentName ||
|
|
1915
|
+
name: s.name || s.componentName || r.default.basename(process.cwd()),
|
|
1850
1916
|
componentId: s.componentId || void 0,
|
|
1851
1917
|
organization: s.organization || void 0
|
|
1852
1918
|
}
|
|
@@ -1858,14 +1924,14 @@ h.program.command("sync").description("Build and upload component to Myop platfo
|
|
|
1858
1924
|
const P = await g.json();
|
|
1859
1925
|
if (P.error)
|
|
1860
1926
|
throw new Error(P.error.message);
|
|
1861
|
-
const E = (x = (
|
|
1927
|
+
const E = (x = (b = (f = P.result) == null ? void 0 : f.content) == null ? void 0 : b[0]) == null ? void 0 : x.text;
|
|
1862
1928
|
if (p = JSON.parse(E), !p.success)
|
|
1863
1929
|
throw new Error(p.error);
|
|
1864
|
-
|
|
1930
|
+
u.succeed("Upload URL obtained");
|
|
1865
1931
|
} catch (g) {
|
|
1866
|
-
|
|
1932
|
+
u.fail("Failed to get upload URL"), console.error(" ", g.message), process.exit(1);
|
|
1867
1933
|
}
|
|
1868
|
-
|
|
1934
|
+
u = V("Uploading component...").start();
|
|
1869
1935
|
try {
|
|
1870
1936
|
const g = t.readFileSync(d, "utf-8");
|
|
1871
1937
|
let P;
|
|
@@ -1891,18 +1957,18 @@ h.program.command("sync").description("Build and upload component to Myop platfo
|
|
|
1891
1957
|
const I = await C.text();
|
|
1892
1958
|
throw new Error(`Upload failed with status ${C.status}: ${I}`);
|
|
1893
1959
|
}
|
|
1894
|
-
|
|
1960
|
+
u.succeed("Component uploaded");
|
|
1895
1961
|
} catch (g) {
|
|
1896
|
-
|
|
1962
|
+
u.fail("Upload failed"), console.error(" ", g.message), g.cause && console.error(" Cause:", g.cause), process.exit(1);
|
|
1897
1963
|
}
|
|
1898
|
-
|
|
1899
|
-
let
|
|
1964
|
+
u = V("Confirming upload...").start();
|
|
1965
|
+
let S;
|
|
1900
1966
|
try {
|
|
1901
1967
|
const g = await fetch(`${M}/mcp`, {
|
|
1902
1968
|
method: "POST",
|
|
1903
1969
|
headers: {
|
|
1904
1970
|
"Content-Type": "application/json",
|
|
1905
|
-
Authorization: `Bearer ${
|
|
1971
|
+
Authorization: `Bearer ${v.accessToken}`
|
|
1906
1972
|
},
|
|
1907
1973
|
body: JSON.stringify({
|
|
1908
1974
|
jsonrpc: "2.0",
|
|
@@ -1921,40 +1987,40 @@ h.program.command("sync").description("Build and upload component to Myop platfo
|
|
|
1921
1987
|
const P = await g.json();
|
|
1922
1988
|
if (P.error)
|
|
1923
1989
|
throw new Error(P.error.message);
|
|
1924
|
-
const E = (
|
|
1925
|
-
if (
|
|
1926
|
-
throw new Error(
|
|
1927
|
-
|
|
1990
|
+
const E = (H = (L = ($ = P.result) == null ? void 0 : $.content) == null ? void 0 : L[0]) == null ? void 0 : H.text;
|
|
1991
|
+
if (S = JSON.parse(E), !S.success)
|
|
1992
|
+
throw new Error(S.error);
|
|
1993
|
+
u.succeed("Upload confirmed");
|
|
1928
1994
|
} catch (g) {
|
|
1929
|
-
|
|
1995
|
+
u.fail("Confirmation failed"), console.error(" ", g.message), process.exit(1);
|
|
1930
1996
|
}
|
|
1931
|
-
if (
|
|
1932
|
-
s.componentId =
|
|
1997
|
+
if (S.isNewComponent || !s.componentId) {
|
|
1998
|
+
s.componentId = S.componentId, s.organization = S.orgId, s.name || (s.name = S.componentName);
|
|
1933
1999
|
try {
|
|
1934
2000
|
t.writeFileSync(e, JSON.stringify(s, null, 2)), console.log(`
|
|
1935
2001
|
π Updated ${e} with componentId`);
|
|
1936
2002
|
} catch (g) {
|
|
1937
2003
|
console.log(`
|
|
1938
|
-
β οΈ Could not update ${e}: ${g.message}`), console.log(` Please add componentId: "${
|
|
2004
|
+
β οΈ Could not update ${e}: ${g.message}`), console.log(` Please add componentId: "${S.componentId}" manually`);
|
|
1939
2005
|
}
|
|
1940
2006
|
}
|
|
1941
2007
|
console.log(`
|
|
1942
|
-
β
Sync completed successfully!`), console.log(` Component: ${
|
|
2008
|
+
β
Sync completed successfully!`), console.log(` Component: ${S.componentName}`), console.log(` Dashboard: ${S.dashboardUrl}`), process.exit(0);
|
|
1943
2009
|
});
|
|
1944
|
-
|
|
1945
|
-
const
|
|
2010
|
+
y.program.command("dev").description("Start development server with file watching").action(_e);
|
|
2011
|
+
const Gt = () => {
|
|
1946
2012
|
try {
|
|
1947
|
-
|
|
2013
|
+
he("git --version", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
1948
2014
|
} catch {
|
|
1949
2015
|
return { gitNotInstalled: !0 };
|
|
1950
2016
|
}
|
|
1951
2017
|
try {
|
|
1952
|
-
|
|
2018
|
+
he("git rev-parse --git-dir", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
1953
2019
|
} catch {
|
|
1954
2020
|
return { notARepo: !0 };
|
|
1955
2021
|
}
|
|
1956
2022
|
try {
|
|
1957
|
-
const o =
|
|
2023
|
+
const o = he("git diff --stat HEAD -- . 2>/dev/null || git diff --stat -- . 2>/dev/null", {
|
|
1958
2024
|
encoding: "utf-8",
|
|
1959
2025
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1960
2026
|
}).trim();
|
|
@@ -1965,21 +2031,21 @@ const Vt = () => {
|
|
|
1965
2031
|
deletions: 0
|
|
1966
2032
|
};
|
|
1967
2033
|
const e = o.split(`
|
|
1968
|
-
`), t = e[e.length - 1], n = t.match(/(\d+) insertion/),
|
|
2034
|
+
`), t = e[e.length - 1], n = t.match(/(\d+) insertion/), r = t.match(/(\d+) deletion/), s = t.match(/(\d+) file/);
|
|
1969
2035
|
return {
|
|
1970
2036
|
files: s ? parseInt(s[1]) : 0,
|
|
1971
2037
|
insertions: n ? parseInt(n[1]) : 0,
|
|
1972
|
-
deletions:
|
|
2038
|
+
deletions: r ? parseInt(r[1]) : 0
|
|
1973
2039
|
};
|
|
1974
2040
|
} catch {
|
|
1975
2041
|
return null;
|
|
1976
2042
|
}
|
|
1977
|
-
},
|
|
1978
|
-
var p,
|
|
1979
|
-
const t =
|
|
2043
|
+
}, ee = async (o = !1, e = !1) => {
|
|
2044
|
+
var p, S, f;
|
|
2045
|
+
const t = be(), n = !!(t != null && t.email), r = ((p = y.myopConfig) == null ? void 0 : p.name) || ((S = y.myopConfig) == null ? void 0 : S.componentName), s = (f = y.myopConfig) == null ? void 0 : f.componentId, d = Gt();
|
|
1980
2046
|
console.log(`
|
|
1981
2047
|
βββββββββββββββββββββββββββββββββββββββββββββββββββ`), console.log("β β"), console.log("β Welcome to Myop CLI - Remote UI Made Easy β"), console.log("β β"), console.log(`βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
1982
|
-
`), o &&
|
|
2048
|
+
`), o && r ? (console.log(` Component: ${r}`), s ? (console.log(` ID: ${s}`), console.log(` Dashboard: https://dashboard.myop.dev/dashboard/2.0/component/${s}`)) : console.log(" ID: (not yet pushed)")) : console.log(" Component: No myop.config.json found"), console.log(` User: ${n ? t.email : "Not logged in"}`), d != null && d.gitNotInstalled ? (console.log(" Changes: Git not installed"), console.log(" Install: https://git-scm.com/downloads"), console.log(" Mac: brew install git | Windows: https://gitforwindows.org")) : d != null && d.notARepo ? console.log(" Changes: Not a git repository") : d && (d.insertions > 0 || d.deletions > 0) ? console.log(` Changes: ${d.files} file${d.files !== 1 ? "s" : ""} | \x1B[32m+${d.insertions}\x1B[0m \x1B[31m-${d.deletions}\x1B[0m`) : d && console.log(" Changes: No uncommitted changes"), console.log("");
|
|
1983
2049
|
const M = [
|
|
1984
2050
|
{
|
|
1985
2051
|
emoji: "π",
|
|
@@ -1990,26 +2056,26 @@ const Vt = () => {
|
|
|
1990
2056
|
},
|
|
1991
2057
|
{
|
|
1992
2058
|
emoji: "π οΈ ",
|
|
1993
|
-
label:
|
|
2059
|
+
label: r ? `Start dev mode for "${r}"` : "Start dev mode",
|
|
1994
2060
|
value: "dev",
|
|
1995
2061
|
help: "Starts dev server with HMR for instant preview of changes",
|
|
1996
2062
|
disabled: o ? !1 : "(no config file)"
|
|
1997
2063
|
},
|
|
1998
2064
|
{
|
|
1999
2065
|
emoji: "π¦",
|
|
2000
|
-
label:
|
|
2066
|
+
label: r ? `Push "${r}"` : "Push component",
|
|
2001
2067
|
value: "sync",
|
|
2002
2068
|
help: "Builds project & uploads dist/index.html to Myop",
|
|
2003
2069
|
disabled: o ? n ? !1 : "(login required)" : "(no config file)"
|
|
2004
2070
|
}
|
|
2005
|
-
].map((
|
|
2006
|
-
name: e && !
|
|
2007
|
-
${
|
|
2008
|
-
value:
|
|
2009
|
-
disabled:
|
|
2071
|
+
].map((b) => ({
|
|
2072
|
+
name: e && !b.disabled ? `${b.emoji} ${b.label}
|
|
2073
|
+
${b.help}` : `${b.emoji} ${b.label}`,
|
|
2074
|
+
value: b.value,
|
|
2075
|
+
disabled: b.disabled
|
|
2010
2076
|
}));
|
|
2011
2077
|
M.push(
|
|
2012
|
-
new
|
|
2078
|
+
new Ee(),
|
|
2013
2079
|
{
|
|
2014
2080
|
name: e && n ? `π Logout (${t.email})
|
|
2015
2081
|
Clears stored credentials from this machine` : e && !n ? `π Login to Myop
|
|
@@ -2020,123 +2086,123 @@ const Vt = () => {
|
|
|
2020
2086
|
name: e ? "π Hide help" : "π Show help",
|
|
2021
2087
|
value: "help"
|
|
2022
2088
|
},
|
|
2023
|
-
new
|
|
2089
|
+
new Ee(),
|
|
2024
2090
|
{
|
|
2025
2091
|
name: "π Exit",
|
|
2026
2092
|
value: "exit"
|
|
2027
2093
|
}
|
|
2028
2094
|
);
|
|
2029
|
-
let
|
|
2095
|
+
let u;
|
|
2030
2096
|
try {
|
|
2031
|
-
|
|
2097
|
+
u = await We({
|
|
2032
2098
|
message: "What would you like to do?",
|
|
2033
2099
|
choices: M
|
|
2034
2100
|
});
|
|
2035
|
-
} catch (
|
|
2036
|
-
throw
|
|
2101
|
+
} catch (b) {
|
|
2102
|
+
throw b.name === "ExitPromptError" && (console.log(`
|
|
2037
2103
|
|
|
2038
2104
|
π Goodbye!
|
|
2039
|
-
`), process.exit(0)),
|
|
2105
|
+
`), process.exit(0)), b;
|
|
2040
2106
|
}
|
|
2041
|
-
switch (
|
|
2107
|
+
switch (u) {
|
|
2042
2108
|
case "init":
|
|
2043
|
-
await
|
|
2109
|
+
await Zt();
|
|
2044
2110
|
break;
|
|
2045
2111
|
case "sync":
|
|
2046
2112
|
console.log(`
|
|
2047
2113
|
Running sync...
|
|
2048
2114
|
`);
|
|
2049
|
-
const { execSync:
|
|
2115
|
+
const { execSync: b } = await import("child_process");
|
|
2050
2116
|
try {
|
|
2051
|
-
|
|
2117
|
+
b("node " + process.argv[1] + " sync", { stdio: "inherit" });
|
|
2052
2118
|
} catch {
|
|
2053
2119
|
}
|
|
2054
|
-
await
|
|
2120
|
+
await ee(!0, e);
|
|
2055
2121
|
break;
|
|
2056
2122
|
case "dev":
|
|
2057
|
-
await
|
|
2123
|
+
await _e();
|
|
2058
2124
|
break;
|
|
2059
2125
|
case "login":
|
|
2060
2126
|
try {
|
|
2061
|
-
await
|
|
2062
|
-
`), await
|
|
2127
|
+
await ae(), console.log(`
|
|
2128
|
+
`), await ee(o, e);
|
|
2063
2129
|
} catch (x) {
|
|
2064
|
-
console.error("Login failed:", x.message), await
|
|
2130
|
+
console.error("Login failed:", x.message), await ee(o, e);
|
|
2065
2131
|
}
|
|
2066
2132
|
break;
|
|
2067
2133
|
case "logout":
|
|
2068
|
-
await
|
|
2069
|
-
`), await
|
|
2134
|
+
await et(), console.log(`
|
|
2135
|
+
`), await ee(o, e);
|
|
2070
2136
|
break;
|
|
2071
2137
|
case "help":
|
|
2072
|
-
await
|
|
2138
|
+
await ee(o, !e);
|
|
2073
2139
|
break;
|
|
2074
2140
|
case "exit":
|
|
2075
2141
|
process.exit(0);
|
|
2076
2142
|
}
|
|
2077
|
-
},
|
|
2143
|
+
}, ve = ".myop-monorepo.json", Yt = () => {
|
|
2078
2144
|
try {
|
|
2079
|
-
const o =
|
|
2145
|
+
const o = D.readFileSync(ve, "utf-8");
|
|
2080
2146
|
return JSON.parse(o);
|
|
2081
2147
|
} catch {
|
|
2082
2148
|
return null;
|
|
2083
2149
|
}
|
|
2084
|
-
},
|
|
2150
|
+
}, Kt = (o) => {
|
|
2085
2151
|
try {
|
|
2086
2152
|
const e = {
|
|
2087
2153
|
selectedComponents: o,
|
|
2088
2154
|
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
2089
2155
|
};
|
|
2090
|
-
|
|
2156
|
+
D.writeFileSync(ve, JSON.stringify(e, null, 2));
|
|
2091
2157
|
} catch {
|
|
2092
2158
|
}
|
|
2093
|
-
},
|
|
2094
|
-
const o =
|
|
2159
|
+
}, Qt = async () => {
|
|
2160
|
+
const o = be(), e = !!(o != null && o.email);
|
|
2095
2161
|
console.log(`
|
|
2096
2162
|
βββββββββββββββββββββββββββββββββββββββββββββββββββ`), console.log("β β"), console.log("β Myop CLI - Monorepo Mode β"), console.log("β β"), console.log(`βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
2097
2163
|
`);
|
|
2098
|
-
const t =
|
|
2164
|
+
const t = V("Scanning for components...").start(), n = tt(".");
|
|
2099
2165
|
t.stop(), n.length === 0 && (console.log(` β οΈ No myop.config.json files found in this directory or subdirectories.
|
|
2100
2166
|
`), console.log(" Run `myop` without -m flag to initialize a single component.\n"), process.exit(0));
|
|
2101
|
-
const
|
|
2167
|
+
const r = Yt(), s = (r == null ? void 0 : r.selectedComponents) || [], d = s.length > 0;
|
|
2102
2168
|
console.log(` Found ${n.length} component${n.length > 1 ? "s" : ""}:
|
|
2103
|
-
`), n.forEach((
|
|
2104
|
-
const x =
|
|
2105
|
-
console.log(` ${x} ${
|
|
2106
|
-
}), console.log(` User: ${e ? o.email : "Not logged in"}`), d && console.log(` π Using saved selection from ${
|
|
2107
|
-
const { checkbox:
|
|
2108
|
-
name: `${
|
|
2109
|
-
value:
|
|
2110
|
-
checked: d ? s.includes(
|
|
2169
|
+
`), n.forEach((f, b) => {
|
|
2170
|
+
const x = f.componentId ? "β
" : "βͺ", $ = f.componentId ? f.componentId.substring(0, 8) + "..." : "(not pushed)";
|
|
2171
|
+
console.log(` ${x} ${f.name}`), console.log(` Path: ${f.path}`), console.log(` ID: ${$}`), console.log("");
|
|
2172
|
+
}), console.log(` User: ${e ? o.email : "Not logged in"}`), d && console.log(` π Using saved selection from ${ve}`), console.log("");
|
|
2173
|
+
const { checkbox: v } = await import("@inquirer/prompts"), M = n.map((f) => ({
|
|
2174
|
+
name: `${f.name} (${f.path})`,
|
|
2175
|
+
value: f.path,
|
|
2176
|
+
checked: d ? s.includes(f.path) : !0
|
|
2111
2177
|
}));
|
|
2112
|
-
let
|
|
2178
|
+
let u;
|
|
2113
2179
|
try {
|
|
2114
|
-
|
|
2180
|
+
u = await v({
|
|
2115
2181
|
message: "Select components to start in dev mode:",
|
|
2116
2182
|
choices: M
|
|
2117
2183
|
});
|
|
2118
|
-
} catch (
|
|
2119
|
-
throw
|
|
2184
|
+
} catch (f) {
|
|
2185
|
+
throw f.name === "ExitPromptError" && (console.log(`
|
|
2120
2186
|
|
|
2121
2187
|
π Goodbye!
|
|
2122
|
-
`), process.exit(0)),
|
|
2188
|
+
`), process.exit(0)), f;
|
|
2123
2189
|
}
|
|
2124
|
-
|
|
2190
|
+
u.length === 0 && (console.log(`
|
|
2125
2191
|
β οΈ No components selected.
|
|
2126
|
-
`), process.exit(0)),
|
|
2127
|
-
πΎ Selection saved to ${
|
|
2128
|
-
const p = n.filter((
|
|
2192
|
+
`), process.exit(0)), Kt(u), console.log(`
|
|
2193
|
+
πΎ Selection saved to ${ve}`);
|
|
2194
|
+
const p = n.filter((f) => u.includes(f.path));
|
|
2129
2195
|
console.log(`π Starting dev mode for ${p.length} component${p.length > 1 ? "s" : ""}...
|
|
2130
2196
|
`);
|
|
2131
|
-
const { monorepoDevCommand:
|
|
2132
|
-
await
|
|
2133
|
-
},
|
|
2134
|
-
const { input: o, select: e } = await import("@inquirer/prompts"), t = await import("fs"),
|
|
2197
|
+
const { monorepoDevCommand: S } = await Promise.resolve().then(() => Ot);
|
|
2198
|
+
await S(p);
|
|
2199
|
+
}, Zt = async () => {
|
|
2200
|
+
const { input: o, select: e } = await import("@inquirer/prompts"), t = await import("fs"), r = (await import("path")).default.basename(process.cwd());
|
|
2135
2201
|
let s, d;
|
|
2136
2202
|
try {
|
|
2137
2203
|
s = await o({
|
|
2138
2204
|
message: "Component name:",
|
|
2139
|
-
default:
|
|
2205
|
+
default: r
|
|
2140
2206
|
}), d = await e({
|
|
2141
2207
|
message: "Component type:",
|
|
2142
2208
|
choices: [
|
|
@@ -2146,22 +2212,22 @@ Running sync...
|
|
|
2146
2212
|
{ name: "π
°οΈ Angular", value: "angular", disabled: "(coming soon)" }
|
|
2147
2213
|
]
|
|
2148
2214
|
});
|
|
2149
|
-
} catch (
|
|
2150
|
-
throw
|
|
2215
|
+
} catch (u) {
|
|
2216
|
+
throw u.name === "ExitPromptError" && (console.log(`
|
|
2151
2217
|
|
|
2152
2218
|
π Goodbye!
|
|
2153
|
-
`), process.exit(0)),
|
|
2219
|
+
`), process.exit(0)), u;
|
|
2154
2220
|
}
|
|
2155
|
-
const
|
|
2221
|
+
const v = {
|
|
2156
2222
|
name: s,
|
|
2157
2223
|
type: d,
|
|
2158
2224
|
author: "@myop-cli",
|
|
2159
2225
|
HMR: !0
|
|
2160
|
-
}, M =
|
|
2226
|
+
}, M = y.program.getOptionValue("config") || "./myop.config.json";
|
|
2161
2227
|
try {
|
|
2162
|
-
t.writeFileSync(M, JSON.stringify(
|
|
2228
|
+
t.writeFileSync(M, JSON.stringify(v, null, 2)), console.log(`
|
|
2163
2229
|
β
Created ${M}`);
|
|
2164
|
-
const
|
|
2230
|
+
const u = {
|
|
2165
2231
|
name: s.toLowerCase().replace(/\s+/g, "-"),
|
|
2166
2232
|
version: "1.0.0",
|
|
2167
2233
|
type: "module",
|
|
@@ -2173,7 +2239,7 @@ Running sync...
|
|
|
2173
2239
|
esbuild: "^0.24.0"
|
|
2174
2240
|
}
|
|
2175
2241
|
};
|
|
2176
|
-
t.writeFileSync("package.json", JSON.stringify(
|
|
2242
|
+
t.writeFileSync("package.json", JSON.stringify(u, null, 2)), console.log("β
Created package.json"), t.mkdirSync("src/modules", { recursive: !0 }), t.mkdirSync("src/styles", { recursive: !0 }), t.writeFileSync("build.js", `import * as esbuild from 'esbuild';
|
|
2177
2243
|
import fs from 'fs';
|
|
2178
2244
|
import path from 'path';
|
|
2179
2245
|
|
|
@@ -2253,7 +2319,7 @@ fs.writeFileSync('dist/index.html', html);
|
|
|
2253
2319
|
console.log('β
Built dist/index.html');
|
|
2254
2320
|
console.log(\` Bundled \${jsFiles.length} JS modules, \${cssFiles.length} CSS files\`);
|
|
2255
2321
|
`), console.log("β
Created build.js");
|
|
2256
|
-
const
|
|
2322
|
+
const S = `<!DOCTYPE html>
|
|
2257
2323
|
<html lang="en">
|
|
2258
2324
|
<head>
|
|
2259
2325
|
<meta charset="UTF-8">
|
|
@@ -2270,8 +2336,8 @@ console.log(\` Bundled \${jsFiles.length} JS modules, \${cssFiles.length} CSS
|
|
|
2270
2336
|
</body>
|
|
2271
2337
|
</html>
|
|
2272
2338
|
`;
|
|
2273
|
-
t.writeFileSync("index.html",
|
|
2274
|
-
const
|
|
2339
|
+
t.writeFileSync("index.html", S), console.log("β
Created index.html");
|
|
2340
|
+
const f = `// ${s} - Entry Point
|
|
2275
2341
|
import { init } from './modules/app.js';
|
|
2276
2342
|
import { setupMyopInterface } from './modules/myop.js';
|
|
2277
2343
|
|
|
@@ -2280,8 +2346,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
2280
2346
|
setupMyopInterface();
|
|
2281
2347
|
});
|
|
2282
2348
|
`;
|
|
2283
|
-
t.writeFileSync("src/index.js",
|
|
2284
|
-
const
|
|
2349
|
+
t.writeFileSync("src/index.js", f), console.log("β
Created src/index.js");
|
|
2350
|
+
const b = `// ${s} - Main Application Logic
|
|
2285
2351
|
|
|
2286
2352
|
export function init() {
|
|
2287
2353
|
console.log('${s} loaded');
|
|
@@ -2289,7 +2355,7 @@ export function init() {
|
|
|
2289
2355
|
// Your component logic here
|
|
2290
2356
|
}
|
|
2291
2357
|
`;
|
|
2292
|
-
t.writeFileSync("src/modules/app.js",
|
|
2358
|
+
t.writeFileSync("src/modules/app.js", b), console.log("β
Created src/modules/app.js"), t.writeFileSync("src/modules/myop.js", `// Myop Interface - Communication with host app
|
|
2293
2359
|
|
|
2294
2360
|
export function setupMyopInterface() {
|
|
2295
2361
|
// Called when host app sends data to this component
|
|
@@ -2310,7 +2376,7 @@ export function setupMyopInterface() {
|
|
|
2310
2376
|
@import './main.css';
|
|
2311
2377
|
`;
|
|
2312
2378
|
t.writeFileSync("src/styles/index.css", $), console.log("β
Created src/styles/index.css");
|
|
2313
|
-
const
|
|
2379
|
+
const L = `/* ${s} - Main Styles */
|
|
2314
2380
|
|
|
2315
2381
|
* {
|
|
2316
2382
|
box-sizing: border-box;
|
|
@@ -2339,7 +2405,7 @@ p {
|
|
|
2339
2405
|
line-height: 1.5;
|
|
2340
2406
|
}
|
|
2341
2407
|
`;
|
|
2342
|
-
t.writeFileSync("src/styles/main.css",
|
|
2408
|
+
t.writeFileSync("src/styles/main.css", L), console.log("β
Created src/styles/main.css"), t.writeFileSync(".gitignore", `node_modules/
|
|
2343
2409
|
dist/
|
|
2344
2410
|
.temp-entry.js
|
|
2345
2411
|
.temp-styles.css
|
|
@@ -2373,23 +2439,23 @@ dist/
|
|
|
2373
2439
|
}
|
|
2374
2440
|
console.log(`
|
|
2375
2441
|
π¦ Next steps:`), console.log(" 1. npm install"), console.log(" 2. npm run build"), console.log(` 3. myop sync
|
|
2376
|
-
`),
|
|
2377
|
-
} catch (
|
|
2378
|
-
console.error(`Failed to initialize component: ${
|
|
2442
|
+
`), y.myopConfig = v, await ee(!0);
|
|
2443
|
+
} catch (u) {
|
|
2444
|
+
console.error(`Failed to initialize component: ${u.message}`), process.exit(1);
|
|
2379
2445
|
}
|
|
2380
2446
|
};
|
|
2381
|
-
|
|
2382
|
-
if (
|
|
2383
|
-
await
|
|
2447
|
+
y.program.command("default", { isDefault: !0 }).action(async () => {
|
|
2448
|
+
if (y.program.getOptionValue("help") && (console.log(ft), process.exit()), y.program.getOptionValue("monorepo")) {
|
|
2449
|
+
await Qt();
|
|
2384
2450
|
return;
|
|
2385
2451
|
}
|
|
2386
|
-
if (
|
|
2387
|
-
const
|
|
2388
|
-
let
|
|
2452
|
+
if (y.program.getOptionValue("ci")) {
|
|
2453
|
+
const v = await import("fs"), M = y.program.getOptionValue("config") || "./myop.config.json", u = y.program.version(), p = be();
|
|
2454
|
+
let S = { found: !1 };
|
|
2389
2455
|
try {
|
|
2390
|
-
if (
|
|
2391
|
-
const
|
|
2392
|
-
|
|
2456
|
+
if (v.existsSync(M)) {
|
|
2457
|
+
const b = v.readFileSync(M, "utf-8"), x = JSON.parse(b);
|
|
2458
|
+
S = {
|
|
2393
2459
|
found: !0,
|
|
2394
2460
|
path: M,
|
|
2395
2461
|
name: x.name || x.componentName || null,
|
|
@@ -2397,27 +2463,27 @@ h.program.command("default", { isDefault: !0 }).action(async () => {
|
|
|
2397
2463
|
organization: x.organization || null
|
|
2398
2464
|
};
|
|
2399
2465
|
}
|
|
2400
|
-
} catch (
|
|
2401
|
-
|
|
2466
|
+
} catch (b) {
|
|
2467
|
+
S = { found: !1, error: b.message };
|
|
2402
2468
|
}
|
|
2403
|
-
const
|
|
2404
|
-
version:
|
|
2405
|
-
config:
|
|
2469
|
+
const f = {
|
|
2470
|
+
version: u,
|
|
2471
|
+
config: S,
|
|
2406
2472
|
auth: {
|
|
2407
2473
|
loggedIn: !!(p != null && p.email),
|
|
2408
2474
|
email: (p == null ? void 0 : p.email) || null
|
|
2409
2475
|
}
|
|
2410
2476
|
};
|
|
2411
|
-
console.log(JSON.stringify(
|
|
2477
|
+
console.log(JSON.stringify(f, null, 2)), process.exit(0);
|
|
2412
2478
|
}
|
|
2413
|
-
let n =
|
|
2479
|
+
let n = V({
|
|
2414
2480
|
text: "Loading Myop CLI...",
|
|
2415
2481
|
color: "green"
|
|
2416
2482
|
}).start();
|
|
2417
|
-
const
|
|
2418
|
-
await
|
|
2419
|
-
const s =
|
|
2420
|
-
await
|
|
2483
|
+
const r = Se();
|
|
2484
|
+
await Wt(500), n.stop();
|
|
2485
|
+
const s = y.program.version();
|
|
2486
|
+
await zt(s) || await ee(r.configFound);
|
|
2421
2487
|
});
|
|
2422
|
-
|
|
2423
|
-
|
|
2488
|
+
y.program.parse(process.argv);
|
|
2489
|
+
y.program.opts();
|