@_davideast/stitch-mcp 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-22bymmh9.js +137 -0
- package/dist/chunk-22bymmh9.js.map +10 -0
- package/dist/chunk-387yyye2.js +248 -0
- package/dist/chunk-387yyye2.js.map +14 -0
- package/dist/chunk-3ff2k44g.js +19 -0
- package/dist/chunk-3ff2k44g.js.map +9 -0
- package/dist/chunk-46cay1zp.js +273 -0
- package/dist/chunk-46cay1zp.js.map +10 -0
- package/dist/chunk-48e1jpm8.js +167 -0
- package/dist/chunk-48e1jpm8.js.map +10 -0
- package/dist/chunk-4arzkk1s.js +69 -0
- package/dist/chunk-4arzkk1s.js.map +10 -0
- package/dist/chunk-4js7vw6h.js +415 -0
- package/dist/chunk-4js7vw6h.js.map +20 -0
- package/dist/chunk-4p1wfk3t.js +736 -0
- package/dist/chunk-4p1wfk3t.js.map +16 -0
- package/dist/chunk-4zg969tc.js +370 -0
- package/dist/chunk-4zg969tc.js.map +16 -0
- package/dist/chunk-5jjt7tgw.js +247 -0
- package/dist/chunk-5jjt7tgw.js.map +14 -0
- package/dist/chunk-5t2h8z2n.js +273 -0
- package/dist/chunk-5t2h8z2n.js.map +10 -0
- package/dist/chunk-5zy3et1m.js +759 -0
- package/dist/chunk-5zy3et1m.js.map +19 -0
- package/dist/chunk-6wvst7z8.js +125 -0
- package/dist/chunk-6wvst7z8.js.map +12 -0
- package/dist/chunk-8mm08arm.js +256 -0
- package/dist/chunk-8mm08arm.js.map +11 -0
- package/dist/chunk-8nv4wwv0.js +19 -0
- package/dist/chunk-8nv4wwv0.js.map +9 -0
- package/dist/chunk-9cjny9z2.js +19 -0
- package/dist/chunk-9cjny9z2.js.map +9 -0
- package/dist/chunk-9ggfw78s.js +19 -0
- package/dist/chunk-9ggfw78s.js.map +9 -0
- package/dist/chunk-9nyyn1hn.js +125 -0
- package/dist/chunk-9nyyn1hn.js.map +12 -0
- package/dist/chunk-9nzbvp6r.js +19 -0
- package/dist/chunk-9nzbvp6r.js.map +9 -0
- package/dist/chunk-a0gmbh8e.js +415 -0
- package/dist/chunk-a0gmbh8e.js.map +20 -0
- package/dist/chunk-acv998mp.js +941 -0
- package/dist/chunk-acv998mp.js.map +27 -0
- package/dist/chunk-cpjsvven.js +10 -0
- package/dist/chunk-cpjsvven.js.map +9 -0
- package/dist/chunk-dmrahbs1.js +31467 -0
- package/dist/chunk-dmrahbs1.js.map +245 -0
- package/dist/chunk-dts6851a.js +137 -0
- package/dist/chunk-dts6851a.js.map +10 -0
- package/dist/chunk-efd0rm6g.js +69 -0
- package/dist/chunk-efd0rm6g.js.map +10 -0
- package/dist/chunk-f1kjn6cd.js +16554 -0
- package/dist/chunk-f1kjn6cd.js.map +98 -0
- package/dist/chunk-f5f6ekgp.js +109 -0
- package/dist/chunk-f5f6ekgp.js.map +10 -0
- package/dist/chunk-fmewhfh3.js +137 -0
- package/dist/chunk-fmewhfh3.js.map +10 -0
- package/dist/chunk-fmhrn6cg.js +6382 -0
- package/dist/chunk-fmhrn6cg.js.map +109 -0
- package/dist/chunk-gh7dzfhb.js +256 -0
- package/dist/chunk-gh7dzfhb.js.map +11 -0
- package/dist/chunk-gwhtc0fe.js +370 -0
- package/dist/chunk-gwhtc0fe.js.map +16 -0
- package/dist/chunk-hc7sdwmn.js +449 -0
- package/dist/chunk-hc7sdwmn.js.map +17 -0
- package/dist/chunk-k4xwb3wp.js +44184 -0
- package/dist/chunk-k4xwb3wp.js.map +237 -0
- package/dist/chunk-k751yfm6.js +736 -0
- package/dist/chunk-k751yfm6.js.map +16 -0
- package/dist/chunk-kkc2tvar.js +19 -0
- package/dist/chunk-kkc2tvar.js.map +9 -0
- package/dist/chunk-kva47mgc.js +10 -0
- package/dist/chunk-kva47mgc.js.map +9 -0
- package/dist/chunk-nv2j020p.js +45210 -0
- package/dist/chunk-nv2j020p.js.map +258 -0
- package/dist/chunk-pdj9s41r.js +683 -0
- package/dist/chunk-pdj9s41r.js.map +17 -0
- package/dist/chunk-ppphsy4t.js +273 -0
- package/dist/chunk-ppphsy4t.js.map +10 -0
- package/dist/chunk-psmw9zpa.js +941 -0
- package/dist/chunk-psmw9zpa.js.map +27 -0
- package/dist/chunk-pz31v3ma.js +24 -0
- package/dist/chunk-pz31v3ma.js.map +9 -0
- package/dist/chunk-qbt0906e.js +1495 -0
- package/dist/chunk-qbt0906e.js.map +23 -0
- package/dist/chunk-rh3k09h7.js +19 -0
- package/dist/chunk-rh3k09h7.js.map +9 -0
- package/dist/chunk-saznae7w.js +10 -0
- package/dist/chunk-saznae7w.js.map +9 -0
- package/dist/chunk-sscqdg1j.js +69 -0
- package/dist/chunk-sscqdg1j.js.map +10 -0
- package/dist/chunk-stgj6y85.js +835 -0
- package/dist/chunk-stgj6y85.js.map +19 -0
- package/dist/chunk-t3tqmxyj.js +42 -0
- package/dist/chunk-t3tqmxyj.js.map +9 -0
- package/dist/chunk-v8ak35zd.js +94 -0
- package/dist/chunk-v8ak35zd.js.map +10 -0
- package/dist/chunk-w9acw256.js +167 -0
- package/dist/chunk-w9acw256.js.map +10 -0
- package/dist/chunk-wq60thjn.js +167 -0
- package/dist/chunk-wq60thjn.js.map +10 -0
- package/dist/chunk-wzkdeb8a.js +736 -0
- package/dist/chunk-wzkdeb8a.js.map +16 -0
- package/dist/chunk-xxv6j815.js +256 -0
- package/dist/chunk-xxv6j815.js.map +11 -0
- package/dist/chunk-yjnj35q8.js +1495 -0
- package/dist/chunk-yjnj35q8.js.map +23 -0
- package/dist/chunk-yvzzrczy.js +45206 -0
- package/dist/chunk-yvzzrczy.js.map +258 -0
- package/dist/chunk-ywax1akt.js +370 -0
- package/dist/chunk-ywax1akt.js.map +16 -0
- package/dist/chunk-zakq9pc0.js +4989 -0
- package/dist/chunk-zakq9pc0.js.map +65 -0
- package/dist/commands/doctor/command.js +1 -1
- package/dist/commands/doctor/steps/AdcProjectCheckStep.d.ts +8 -0
- package/dist/commands/init/command.js +1 -1
- package/dist/commands/logout/command.js +1 -1
- package/dist/commands/proxy/command.js +1 -1
- package/dist/commands/screens/command.js +2 -2
- package/dist/commands/serve/command.js +3 -3
- package/dist/commands/site/command.js +1 -1
- package/dist/commands/snapshot/command.js +1 -1
- package/dist/commands/tool/command.js +1 -1
- package/dist/commands/view/command.js +1 -1
- package/dist/index.js +4 -4
- package/dist/lib/server/AssetGateway.d.ts +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {
|
|
2
|
+
icons,
|
|
3
|
+
theme
|
|
4
|
+
} from "./chunk-kbtqrkwh.js";
|
|
5
|
+
import"./chunk-3sfn889r.js";
|
|
6
|
+
import {
|
|
7
|
+
__require
|
|
8
|
+
} from "./chunk-9wyra8hs.js";
|
|
9
|
+
|
|
10
|
+
// src/commands/view/handler.ts
|
|
11
|
+
class ViewCommandHandler {
|
|
12
|
+
async execute(options) {
|
|
13
|
+
if (options.serve) {
|
|
14
|
+
await this.executeServeMode(options);
|
|
15
|
+
} else {
|
|
16
|
+
await this.executeInteractiveMode(options);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async executeServeMode(options) {
|
|
20
|
+
if (!options.screen && !options.sourceScreen && !options.name) {
|
|
21
|
+
console.error(theme.red("Error: --serve requires a screen to be specified via --screen, --sourceScreen, or --name"));
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
const { ViewHandler } = await import("./chunk-st7q66e5.js");
|
|
25
|
+
const handler = new ViewHandler;
|
|
26
|
+
const execOptions = { projects: false };
|
|
27
|
+
if (options.project)
|
|
28
|
+
execOptions.project = options.project;
|
|
29
|
+
if (options.screen)
|
|
30
|
+
execOptions.screen = options.screen;
|
|
31
|
+
if (options.sourceScreen)
|
|
32
|
+
execOptions.sourceScreen = options.sourceScreen;
|
|
33
|
+
if (options.name)
|
|
34
|
+
execOptions.name = options.name;
|
|
35
|
+
const res = await handler.execute(execOptions);
|
|
36
|
+
if (!res.success)
|
|
37
|
+
throw new Error(res.error.message);
|
|
38
|
+
const resource = res.data;
|
|
39
|
+
if (!resource) {
|
|
40
|
+
throw new Error("Could not find resource");
|
|
41
|
+
}
|
|
42
|
+
if (!resource.htmlCode || !resource.htmlCode.downloadUrl) {
|
|
43
|
+
console.error(theme.red("Error: The specified resource is not a screen or has no HTML code."));
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
const { StitchViteServer } = await import("./chunk-saznae7w.js");
|
|
47
|
+
const { downloadText } = await import("./chunk-3at4pjgn.js");
|
|
48
|
+
const server = new StitchViteServer;
|
|
49
|
+
const url = await server.start(0);
|
|
50
|
+
console.log(theme.green(`Starting server at ${url}`));
|
|
51
|
+
console.log("Downloading content...");
|
|
52
|
+
const html = await downloadText(resource.htmlCode.downloadUrl);
|
|
53
|
+
server.mount("/", html);
|
|
54
|
+
console.log(theme.green(`Serving screen "${resource.title || "Screen"}" at ${url}/`));
|
|
55
|
+
console.log("Press Ctrl+C to stop.");
|
|
56
|
+
await new Promise(() => {});
|
|
57
|
+
}
|
|
58
|
+
async executeInteractiveMode(options) {
|
|
59
|
+
const { render } = await import("./chunk-t3tqmxyj.js");
|
|
60
|
+
const React = await import("./chunk-edp6faw2.js");
|
|
61
|
+
const { InteractiveViewer } = await import("./chunk-pdj9s41r.js");
|
|
62
|
+
const { ViewHandler } = await import("./chunk-st7q66e5.js");
|
|
63
|
+
const handler = new ViewHandler;
|
|
64
|
+
const result = await handler.execute({
|
|
65
|
+
projects: options.projects,
|
|
66
|
+
name: options.name,
|
|
67
|
+
sourceScreen: options.sourceScreen,
|
|
68
|
+
project: options.project,
|
|
69
|
+
screen: options.screen
|
|
70
|
+
});
|
|
71
|
+
if (!result.success) {
|
|
72
|
+
console.error(theme.red(`
|
|
73
|
+
${icons.error} View failed: ${result.error.message}`));
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
const createElement = React.createElement || React.default.createElement;
|
|
77
|
+
let rootLabel;
|
|
78
|
+
if (options.sourceScreen) {
|
|
79
|
+
rootLabel = "screen";
|
|
80
|
+
} else if (options.name) {
|
|
81
|
+
rootLabel = "resource";
|
|
82
|
+
}
|
|
83
|
+
const fetchResource = async (resourceName) => {
|
|
84
|
+
if (resourceName.includes("/screens/")) {
|
|
85
|
+
const navResult = await handler.execute({ projects: false, sourceScreen: resourceName });
|
|
86
|
+
if (!navResult.success)
|
|
87
|
+
throw new Error(navResult.error.message);
|
|
88
|
+
return navResult.data;
|
|
89
|
+
} else {
|
|
90
|
+
const navResult = await handler.execute({ projects: false, name: resourceName });
|
|
91
|
+
if (!navResult.success)
|
|
92
|
+
throw new Error(navResult.error.message);
|
|
93
|
+
return navResult.data;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const initialHistory = [];
|
|
97
|
+
if (options.sourceScreen) {
|
|
98
|
+
const projectMatch = options.sourceScreen.match(/^(projects\/\d+)/);
|
|
99
|
+
if (projectMatch) {
|
|
100
|
+
const projectName = projectMatch[1];
|
|
101
|
+
try {
|
|
102
|
+
const projectsResult = await handler.execute({ projects: true });
|
|
103
|
+
if (projectsResult.success) {
|
|
104
|
+
initialHistory.push({ data: projectsResult.data, rootLabel: undefined });
|
|
105
|
+
}
|
|
106
|
+
} catch (e) {}
|
|
107
|
+
try {
|
|
108
|
+
const projectResult = await handler.execute({ projects: false, name: projectName });
|
|
109
|
+
if (projectResult.success) {
|
|
110
|
+
initialHistory.push({ data: projectResult.data, rootLabel: "resource", resourcePath: projectName });
|
|
111
|
+
}
|
|
112
|
+
} catch (e) {}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (options.name && !options.sourceScreen) {
|
|
116
|
+
try {
|
|
117
|
+
const projectsResult = await handler.execute({ projects: true });
|
|
118
|
+
if (projectsResult.success) {
|
|
119
|
+
initialHistory.push({ data: projectsResult.data, rootLabel: undefined });
|
|
120
|
+
}
|
|
121
|
+
} catch (e) {}
|
|
122
|
+
}
|
|
123
|
+
const instance = render(createElement(InteractiveViewer, {
|
|
124
|
+
initialData: result.data,
|
|
125
|
+
initialRootLabel: rootLabel,
|
|
126
|
+
initialHistory: initialHistory.length > 0 ? initialHistory : undefined,
|
|
127
|
+
onFetch: fetchResource
|
|
128
|
+
}));
|
|
129
|
+
await instance.waitUntilExit();
|
|
130
|
+
process.exit(0);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
ViewCommandHandler
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
//# debugId=FACA0134243A0F2764756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/commands/view/handler.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { theme, icons } from '../../ui/theme.js';\n\ninterface ViewOptions {\n projects: boolean;\n name?: string;\n sourceScreen?: string;\n project?: string;\n screen?: string;\n serve: boolean;\n}\n\nexport class ViewCommandHandler {\n async execute(options: ViewOptions): Promise<void> {\n if (options.serve) {\n await this.executeServeMode(options);\n } else {\n await this.executeInteractiveMode(options);\n }\n }\n\n private async executeServeMode(options: ViewOptions): Promise<void> {\n if (!options.screen && !options.sourceScreen && !options.name) {\n console.error(theme.red('Error: --serve requires a screen to be specified via --screen, --sourceScreen, or --name'));\n process.exit(1);\n }\n\n const { ViewHandler } = await import('../../services/view/handler.js');\n const handler = new ViewHandler();\n\n const execOptions: any = { projects: false };\n if (options.project) execOptions.project = options.project;\n if (options.screen) execOptions.screen = options.screen;\n if (options.sourceScreen) execOptions.sourceScreen = options.sourceScreen;\n if (options.name) execOptions.name = options.name;\n\n const res = await handler.execute(execOptions);\n if (!res.success) throw new Error(res.error.message);\n\n const resource = res.data;\n if (!resource) {\n throw new Error('Could not find resource');\n }\n\n if (!resource.htmlCode || !resource.htmlCode.downloadUrl) {\n console.error(theme.red('Error: The specified resource is not a screen or has no HTML code.'));\n process.exit(1);\n }\n\n const { StitchViteServer } = await import('../../lib/server/vite/StitchViteServer.js');\n const { downloadText } = await import('../../ui/copy-behaviors/clipboard.js');\n\n const server = new StitchViteServer();\n const url = await server.start(0);\n console.log(theme.green(`Starting server at ${url}`));\n\n console.log('Downloading content...');\n const html = await downloadText(resource.htmlCode.downloadUrl);\n server.mount('/', html);\n\n console.log(theme.green(`Serving screen \"${resource.title || 'Screen'}\" at ${url}/`));\n console.log('Press Ctrl+C to stop.');\n\n await new Promise(() => {});\n }\n\n private async executeInteractiveMode(options: ViewOptions): Promise<void> {\n const { render } = await import('ink');\n const React = await import('react');\n const { InteractiveViewer } = await import('../../ui/InteractiveViewer.js');\n const { ViewHandler } = await import('../../services/view/handler.js');\n\n const handler = new ViewHandler();\n const result = await handler.execute({\n projects: options.projects,\n name: options.name,\n sourceScreen: options.sourceScreen,\n project: options.project,\n screen: options.screen,\n });\n\n if (!result.success) {\n console.error(theme.red(`\\n${icons.error} View failed: ${result.error.message}`));\n process.exit(1);\n }\n\n const createElement = React.createElement || (React.default as any).createElement;\n\n let rootLabel: string | undefined;\n if (options.sourceScreen) {\n rootLabel = 'screen';\n } else if (options.name) {\n rootLabel = 'resource';\n }\n\n const fetchResource = async (resourceName: string): Promise<any> => {\n if (resourceName.includes('/screens/')) {\n const navResult = await handler.execute({ projects: false, sourceScreen: resourceName });\n if (!navResult.success) throw new Error(navResult.error.message);\n return navResult.data;\n } else {\n const navResult = await handler.execute({ projects: false, name: resourceName });\n if (!navResult.success) throw new Error(navResult.error.message);\n return navResult.data;\n }\n };\n\n const initialHistory: Array<{ data: any; rootLabel?: string; resourcePath?: string }> = [];\n\n if (options.sourceScreen) {\n const projectMatch = options.sourceScreen.match(/^(projects\\/\\d+)/);\n if (projectMatch) {\n const projectName = projectMatch[1];\n try {\n const projectsResult = await handler.execute({ projects: true });\n if (projectsResult.success) {\n initialHistory.push({ data: projectsResult.data, rootLabel: undefined });\n }\n } catch (e) {}\n\n try {\n const projectResult = await handler.execute({ projects: false, name: projectName });\n if (projectResult.success) {\n initialHistory.push({ data: projectResult.data, rootLabel: 'resource', resourcePath: projectName });\n }\n } catch (e) {}\n }\n }\n\n if (options.name && !options.sourceScreen) {\n try {\n const projectsResult = await handler.execute({ projects: true });\n if (projectsResult.success) {\n initialHistory.push({ data: projectsResult.data, rootLabel: undefined });\n }\n } catch (e) {}\n }\n\n const instance = render(createElement(InteractiveViewer, {\n initialData: result.data,\n initialRootLabel: rootLabel,\n initialHistory: initialHistory.length > 0 ? initialHistory : undefined,\n onFetch: fetchResource,\n }));\n await instance.waitUntilExit();\n process.exit(0);\n }\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;AAWO,MAAM,mBAAmB;AAAA,OACxB,QAAO,CAAC,SAAqC;AAAA,IACjD,IAAI,QAAQ,OAAO;AAAA,MACjB,MAAM,KAAK,iBAAiB,OAAO;AAAA,IACrC,EAAO;AAAA,MACL,MAAM,KAAK,uBAAuB,OAAO;AAAA;AAAA;AAAA,OAI/B,iBAAgB,CAAC,SAAqC;AAAA,IAClE,IAAI,CAAC,QAAQ,UAAU,CAAC,QAAQ,gBAAgB,CAAC,QAAQ,MAAM;AAAA,MAC7D,QAAQ,MAAM,MAAM,IAAI,0FAA0F,CAAC;AAAA,MACnH,QAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,IAEA,QAAQ,gBAAgB,MAAa;AAAA,IACrC,MAAM,UAAU,IAAI;AAAA,IAEpB,MAAM,cAAmB,EAAE,UAAU,MAAM;AAAA,IAC3C,IAAI,QAAQ;AAAA,MAAS,YAAY,UAAU,QAAQ;AAAA,IACnD,IAAI,QAAQ;AAAA,MAAQ,YAAY,SAAS,QAAQ;AAAA,IACjD,IAAI,QAAQ;AAAA,MAAc,YAAY,eAAe,QAAQ;AAAA,IAC7D,IAAI,QAAQ;AAAA,MAAM,YAAY,OAAO,QAAQ;AAAA,IAE7C,MAAM,MAAM,MAAM,QAAQ,QAAQ,WAAW;AAAA,IAC7C,IAAI,CAAC,IAAI;A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AgB,MAAM,QAAQ,QAAQ,EAAE,UAAU,OAAO,MAAM,YAAY,CAAC;AAAA,UAClF,IAAI,cAAc,SAAS;AAAA,YACzB,eAAe,KAAK,EAAE,MAAM,cAAc,MAAM,WAAW,YAAY,cAAc,YAAY,CAAC;AAAA,UACpG;AAAA,UACA,OAAO,GAAG;AAAA,MACd;AAAA,IACF;AAAA,IAEA,IAAI,QAAQ,QAAQ,CAAC,QAAQ,cAAc;AAAA,MACzC,IAAI;AAAA,QACF,MAAM,iBAAiB,MAAM,QAAQ,QAAQ,EAAE,UAAU,KAAK,CAAC;AAAA,QAC/D,IAAI,eAAe,SAAS;AAAA,UAC1B,eAAe,KAAK,EAAE,MAAM,eAAe,MAAM,WAAW,UAAU,CAAC;AAAA,QACzE;AAAA,QACA,OAAO,GAAG;AAAA,IACd;AAAA,IAEA,MAAM,WAAW,OAAO,cAAc,mBAAmB;AAAA,MACvD,aAAa,OAAO;AAAA,MACpB,kBAAkB;AAAA,MAClB,gBAAgB,eAAe,SAAS,IAAI,iBAAiB;AAAA,MAC7D,SAAS;AAAA,IACX,CAAC,CAAC;AAAA,IACF,MAAM,SAAS,cAAc;AAAA,IAC7B,QAAQ,KAAK,CAAC;AAAA;AAElB;",
|
|
8
|
+
"debugId": "FACA0134243A0F2764756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConsoleUI,
|
|
3
|
+
GcloudHandler,
|
|
4
|
+
execCommand,
|
|
5
|
+
getGcloudConfigPath
|
|
6
|
+
} from "./chunk-fmhrn6cg.js";
|
|
7
|
+
import"./chunk-hc7sdwmn.js";
|
|
8
|
+
import {
|
|
9
|
+
runSteps
|
|
10
|
+
} from "./chunk-f2hq6bfv.js";
|
|
11
|
+
import"./chunk-tz7wnw4s.js";
|
|
12
|
+
import {
|
|
13
|
+
icons,
|
|
14
|
+
theme
|
|
15
|
+
} from "./chunk-kbtqrkwh.js";
|
|
16
|
+
import"./chunk-3sfn889r.js";
|
|
17
|
+
import"./chunk-c6ge431q.js";
|
|
18
|
+
import"./chunk-9wyra8hs.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/logout/steps/PrepareStep.ts
|
|
21
|
+
class PrepareStep {
|
|
22
|
+
id = "prepare";
|
|
23
|
+
name = "Preparation";
|
|
24
|
+
async shouldRun(context) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
async run(context) {
|
|
28
|
+
const result = await context.gcloudService.ensureInstalled({
|
|
29
|
+
minVersion: "400.0.0",
|
|
30
|
+
forceLocal: false
|
|
31
|
+
});
|
|
32
|
+
if (!result.success) {
|
|
33
|
+
return {
|
|
34
|
+
success: false,
|
|
35
|
+
error: new Error("Google Cloud CLI not found"),
|
|
36
|
+
errorCode: "GCLOUD_NOT_FOUND",
|
|
37
|
+
shouldExit: true
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
context.gcloudPath = result.data.path;
|
|
41
|
+
if (!context.input.force) {
|
|
42
|
+
const shouldLogout = await context.ui.promptConfirm("Are you sure you want to log out? This will revoke all credentials.", false);
|
|
43
|
+
if (!shouldLogout) {
|
|
44
|
+
context.ui.log(`
|
|
45
|
+
Logout cancelled.
|
|
46
|
+
`);
|
|
47
|
+
return { success: true, shouldExit: true, detail: "Cancelled" };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return { success: true };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/commands/logout/steps/RevokeUserStep.ts
|
|
55
|
+
class RevokeUserStep {
|
|
56
|
+
id = "revoke-user";
|
|
57
|
+
name = "Revoke user authentication";
|
|
58
|
+
async shouldRun(context) {
|
|
59
|
+
if (!context.gcloudPath) {
|
|
60
|
+
const result = await context.gcloudService.ensureInstalled({ minVersion: "400.0.0", forceLocal: false });
|
|
61
|
+
if (result.success)
|
|
62
|
+
context.gcloudPath = result.data.path;
|
|
63
|
+
else
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
async run(context) {
|
|
69
|
+
const activeAccount = await context.gcloudService.getActiveAccount();
|
|
70
|
+
if (activeAccount) {
|
|
71
|
+
context.ui.log(theme.gray("Revoking user authentication..."));
|
|
72
|
+
const userResult = await execCommand([context.gcloudPath, "auth", "revoke", "--all"], { env: this.getEnvironment() });
|
|
73
|
+
if (userResult.success || userResult.stderr?.includes("No credentialed accounts")) {
|
|
74
|
+
context.ui.log(theme.green(`${icons.success} User authentication revoked`));
|
|
75
|
+
context.userRevoked = true;
|
|
76
|
+
} else {
|
|
77
|
+
context.ui.log(theme.yellow(`${icons.warning} Failed to revoke user authentication`));
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
context.ui.log(theme.gray("No active user authentication found"));
|
|
81
|
+
context.userRevoked = true;
|
|
82
|
+
}
|
|
83
|
+
return { success: true };
|
|
84
|
+
}
|
|
85
|
+
getEnvironment() {
|
|
86
|
+
const configPath = getGcloudConfigPath();
|
|
87
|
+
const env = { ...process.env };
|
|
88
|
+
env.CLOUDSDK_CONFIG = configPath;
|
|
89
|
+
env.CLOUDSDK_CORE_DISABLE_PROMPTS = "1";
|
|
90
|
+
return env;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/commands/logout/steps/RevokeAdcStep.ts
|
|
95
|
+
class RevokeAdcStep {
|
|
96
|
+
id = "revoke-adc";
|
|
97
|
+
name = "Revoke Application Default Credentials";
|
|
98
|
+
async shouldRun(context) {
|
|
99
|
+
if (!context.gcloudPath) {
|
|
100
|
+
const result = await context.gcloudService.ensureInstalled({ minVersion: "400.0.0", forceLocal: false });
|
|
101
|
+
if (result.success)
|
|
102
|
+
context.gcloudPath = result.data.path;
|
|
103
|
+
else
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
async run(context) {
|
|
109
|
+
const hasADC = await context.gcloudService.hasADC();
|
|
110
|
+
if (hasADC) {
|
|
111
|
+
context.ui.log(theme.gray("Revoking Application Default Credentials..."));
|
|
112
|
+
const adcResult = await execCommand([context.gcloudPath, "auth", "application-default", "revoke"], { env: this.getEnvironment() });
|
|
113
|
+
if (adcResult.success || adcResult.stderr?.includes("No credentials")) {
|
|
114
|
+
context.ui.log(theme.green(`${icons.success} Application Default Credentials revoked`));
|
|
115
|
+
context.adcRevoked = true;
|
|
116
|
+
} else {
|
|
117
|
+
context.ui.log(theme.yellow(`${icons.warning} Failed to revoke Application Default Credentials`));
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
context.ui.log(theme.gray("No Application Default Credentials found"));
|
|
121
|
+
context.adcRevoked = true;
|
|
122
|
+
}
|
|
123
|
+
return { success: true };
|
|
124
|
+
}
|
|
125
|
+
getEnvironment() {
|
|
126
|
+
const configPath = getGcloudConfigPath();
|
|
127
|
+
const env = { ...process.env };
|
|
128
|
+
env.CLOUDSDK_CONFIG = configPath;
|
|
129
|
+
env.CLOUDSDK_CORE_DISABLE_PROMPTS = "1";
|
|
130
|
+
return env;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/commands/logout/steps/ClearConfigStep.ts
|
|
135
|
+
import fs from "node:fs";
|
|
136
|
+
|
|
137
|
+
class ClearConfigStep {
|
|
138
|
+
id = "clear-config";
|
|
139
|
+
name = "Clear configuration directory";
|
|
140
|
+
async shouldRun(context) {
|
|
141
|
+
return context.input.clearConfig;
|
|
142
|
+
}
|
|
143
|
+
async run(context) {
|
|
144
|
+
context.ui.log(theme.gray("Clearing gcloud configuration directory..."));
|
|
145
|
+
const configPath = getGcloudConfigPath();
|
|
146
|
+
try {
|
|
147
|
+
if (fs.existsSync(configPath)) {
|
|
148
|
+
fs.rmSync(configPath, { recursive: true, force: true });
|
|
149
|
+
context.ui.log(theme.green(`${icons.success} Configuration directory cleared`));
|
|
150
|
+
context.configCleared = true;
|
|
151
|
+
} else {
|
|
152
|
+
context.ui.log(theme.gray("Configuration directory does not exist"));
|
|
153
|
+
context.configCleared = true;
|
|
154
|
+
}
|
|
155
|
+
} catch (error) {
|
|
156
|
+
context.ui.log(theme.yellow(`${icons.warning} Failed to clear configuration directory`));
|
|
157
|
+
context.ui.log(theme.gray(` ${error instanceof Error ? error.message : String(error)}`));
|
|
158
|
+
}
|
|
159
|
+
return { success: true };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// src/commands/logout/handler.ts
|
|
164
|
+
class LogoutHandler {
|
|
165
|
+
gcloudService;
|
|
166
|
+
steps;
|
|
167
|
+
constructor(gcloudService = new GcloudHandler) {
|
|
168
|
+
this.gcloudService = gcloudService;
|
|
169
|
+
this.steps = [
|
|
170
|
+
new PrepareStep,
|
|
171
|
+
new RevokeUserStep,
|
|
172
|
+
new RevokeAdcStep,
|
|
173
|
+
new ClearConfigStep
|
|
174
|
+
];
|
|
175
|
+
}
|
|
176
|
+
async execute(input) {
|
|
177
|
+
const context = {
|
|
178
|
+
input,
|
|
179
|
+
ui: new ConsoleUI,
|
|
180
|
+
gcloudService: this.gcloudService,
|
|
181
|
+
userRevoked: false,
|
|
182
|
+
adcRevoked: false,
|
|
183
|
+
configCleared: false
|
|
184
|
+
};
|
|
185
|
+
console.log(`
|
|
186
|
+
${theme.blue("Logout from Google Cloud")}
|
|
187
|
+
`);
|
|
188
|
+
try {
|
|
189
|
+
const { stoppedAt } = await runSteps(this.steps, context, {
|
|
190
|
+
onAfterStep: (_step, result) => {
|
|
191
|
+
if (!result.success && result.errorCode === "GCLOUD_NOT_FOUND")
|
|
192
|
+
return true;
|
|
193
|
+
if (result.shouldExit)
|
|
194
|
+
return true;
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
if (stoppedAt) {
|
|
199
|
+
if (stoppedAt.result.errorCode === "GCLOUD_NOT_FOUND") {
|
|
200
|
+
return {
|
|
201
|
+
success: false,
|
|
202
|
+
error: {
|
|
203
|
+
code: "GCLOUD_NOT_FOUND",
|
|
204
|
+
message: stoppedAt.result.error?.message || "Gcloud not found",
|
|
205
|
+
recoverable: true
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
success: true,
|
|
211
|
+
data: {
|
|
212
|
+
userRevoked: context.userRevoked,
|
|
213
|
+
adcRevoked: context.adcRevoked,
|
|
214
|
+
configCleared: context.configCleared
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
console.log(`
|
|
219
|
+
${theme.green("Successfully logged out!")}
|
|
220
|
+
`);
|
|
221
|
+
console.log(theme.gray("To log back in, run:"));
|
|
222
|
+
console.log(theme.cyan(` stitch-mcp init
|
|
223
|
+
`));
|
|
224
|
+
return {
|
|
225
|
+
success: true,
|
|
226
|
+
data: {
|
|
227
|
+
userRevoked: context.userRevoked,
|
|
228
|
+
adcRevoked: context.adcRevoked,
|
|
229
|
+
configCleared: context.configCleared
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
} catch (error) {
|
|
233
|
+
return {
|
|
234
|
+
success: false,
|
|
235
|
+
error: {
|
|
236
|
+
code: "UNKNOWN_ERROR",
|
|
237
|
+
message: error instanceof Error ? error.message : String(error),
|
|
238
|
+
recoverable: false
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
export {
|
|
245
|
+
LogoutHandler
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
//# debugId=90DBA33599959FD564756E2164756E21
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/commands/logout/steps/PrepareStep.ts", "../src/commands/logout/steps/RevokeUserStep.ts", "../src/commands/logout/steps/RevokeAdcStep.ts", "../src/commands/logout/steps/ClearConfigStep.ts", "../src/commands/logout/handler.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { type CommandStep, type StepResult } from '../../../framework/CommandStep.js';\nimport { type LogoutContext } from '../context.js';\n\nexport class PrepareStep implements CommandStep<LogoutContext> {\n id = 'prepare';\n name = 'Preparation';\n\n async shouldRun(context: LogoutContext): Promise<boolean> {\n return true;\n }\n\n async run(context: LogoutContext): Promise<StepResult> {\n // Check for gcloud availability\n const result = await context.gcloudService.ensureInstalled({\n minVersion: '400.0.0',\n forceLocal: false,\n });\n\n if (!result.success) {\n return {\n success: false,\n error: new Error('Google Cloud CLI not found'),\n errorCode: 'GCLOUD_NOT_FOUND',\n shouldExit: true\n };\n }\n context.gcloudPath = result.data.path;\n\n if (!context.input.force) {\n const shouldLogout = await context.ui.promptConfirm(\n 'Are you sure you want to log out? This will revoke all credentials.',\n false\n );\n\n if (!shouldLogout) {\n context.ui.log('\\nLogout cancelled.\\n');\n return { success: true, shouldExit: true, detail: 'Cancelled' };\n }\n }\n\n return { success: true };\n }\n}\n",
|
|
6
|
+
"import { type CommandStep, type StepResult } from '../../../framework/CommandStep.js';\nimport { type LogoutContext } from '../context.js';\nimport { execCommand } from '../../../platform/shell.js';\nimport { theme, icons } from '../../../ui/theme.js';\nimport { getGcloudConfigPath } from '../../../platform/detector.js';\n\nexport class RevokeUserStep implements CommandStep<LogoutContext> {\n id = 'revoke-user';\n name = 'Revoke user authentication';\n\n async shouldRun(context: LogoutContext): Promise<boolean> {\n // If force is true, we might not have set gcloudPath yet in ConfirmStep\n if (!context.gcloudPath) {\n const result = await context.gcloudService.ensureInstalled({ minVersion: '400.0.0', forceLocal: false });\n if (result.success) context.gcloudPath = result.data.path;\n else return false;\n }\n return true;\n }\n\n async run(context: LogoutContext): Promise<StepResult> {\n const activeAccount = await context.gcloudService.getActiveAccount();\n\n if (activeAccount) {\n context.ui.log(theme.gray('Revoking user authentication...'));\n const userResult = await execCommand(\n [context.gcloudPath!, 'auth', 'revoke', '--all'],\n { env: this.getEnvironment() }\n );\n\n if (userResult.success || userResult.stderr?.includes('No credentialed accounts')) {\n context.ui.log(theme.green(`${icons.success} User authentication revoked`));\n context.userRevoked = true;\n } else {\n context.ui.log(theme.yellow(`${icons.warning} Failed to revoke user authentication`));\n }\n } else {\n context.ui.log(theme.gray('No active user authentication found'));\n context.userRevoked = true;\n }\n\n return { success: true };\n }\n\n private getEnvironment(): Record<string, string> {\n const configPath = getGcloudConfigPath();\n const env: Record<string, string> = { ...process.env as Record<string, string> };\n env.CLOUDSDK_CONFIG = configPath;\n env.CLOUDSDK_CORE_DISABLE_PROMPTS = '1';\n return env;\n }\n}\n",
|
|
7
|
+
"import { type CommandStep, type StepResult } from '../../../framework/CommandStep.js';\nimport { type LogoutContext } from '../context.js';\nimport { execCommand } from '../../../platform/shell.js';\nimport { theme, icons } from '../../../ui/theme.js';\nimport { getGcloudConfigPath } from '../../../platform/detector.js';\n\nexport class RevokeAdcStep implements CommandStep<LogoutContext> {\n id = 'revoke-adc';\n name = 'Revoke Application Default Credentials';\n\n async shouldRun(context: LogoutContext): Promise<boolean> {\n if (!context.gcloudPath) {\n const result = await context.gcloudService.ensureInstalled({ minVersion: '400.0.0', forceLocal: false });\n if (result.success) context.gcloudPath = result.data.path;\n else return false;\n }\n return true;\n }\n\n async run(context: LogoutContext): Promise<StepResult> {\n const hasADC = await context.gcloudService.hasADC();\n if (hasADC) {\n context.ui.log(theme.gray('Revoking Application Default Credentials...'));\n const adcResult = await execCommand(\n [context.gcloudPath!, 'auth', 'application-default', 'revoke'],\n { env: this.getEnvironment() }\n );\n\n if (adcResult.success || adcResult.stderr?.includes('No credentials')) {\n context.ui.log(theme.green(`${icons.success} Application Default Credentials revoked`));\n context.adcRevoked = true;\n } else {\n context.ui.log(theme.yellow(`${icons.warning} Failed to revoke Application Default Credentials`));\n }\n } else {\n context.ui.log(theme.gray('No Application Default Credentials found'));\n context.adcRevoked = true;\n }\n return { success: true };\n }\n\n private getEnvironment(): Record<string, string> {\n const configPath = getGcloudConfigPath();\n const env: Record<string, string> = { ...process.env as Record<string, string> };\n env.CLOUDSDK_CONFIG = configPath;\n env.CLOUDSDK_CORE_DISABLE_PROMPTS = '1';\n return env;\n }\n}\n",
|
|
8
|
+
"import { type CommandStep, type StepResult } from '../../../framework/CommandStep.js';\nimport { type LogoutContext } from '../context.js';\nimport { theme, icons } from '../../../ui/theme.js';\nimport { getGcloudConfigPath } from '../../../platform/detector.js';\nimport fs from 'node:fs';\n\nexport class ClearConfigStep implements CommandStep<LogoutContext> {\n id = 'clear-config';\n name = 'Clear configuration directory';\n\n async shouldRun(context: LogoutContext): Promise<boolean> {\n return context.input.clearConfig;\n }\n\n async run(context: LogoutContext): Promise<StepResult> {\n context.ui.log(theme.gray('Clearing gcloud configuration directory...'));\n const configPath = getGcloudConfigPath();\n\n try {\n if (fs.existsSync(configPath)) {\n fs.rmSync(configPath, { recursive: true, force: true });\n context.ui.log(theme.green(`${icons.success} Configuration directory cleared`));\n context.configCleared = true;\n } else {\n context.ui.log(theme.gray('Configuration directory does not exist'));\n context.configCleared = true;\n }\n } catch (error) {\n context.ui.log(theme.yellow(`${icons.warning} Failed to clear configuration directory`));\n context.ui.log(theme.gray(` ${error instanceof Error ? error.message : String(error)}`));\n }\n return { success: true };\n }\n}\n",
|
|
9
|
+
"import { type LogoutCommand, type LogoutInput, type LogoutResult } from './spec.js';\nimport { GcloudHandler } from '../../services/gcloud/handler.js';\nimport { type GcloudService } from '../../services/gcloud/spec.js';\nimport { theme } from '../../ui/theme.js';\nimport { ConsoleUI } from '../../framework/ConsoleUI.js';\nimport { type LogoutContext } from './context.js';\nimport { type CommandStep } from '../../framework/CommandStep.js';\nimport { runSteps } from '../../framework/StepRunner.js';\n\nimport { PrepareStep } from './steps/PrepareStep.js';\nimport { RevokeUserStep } from './steps/RevokeUserStep.js';\nimport { RevokeAdcStep } from './steps/RevokeAdcStep.js';\nimport { ClearConfigStep } from './steps/ClearConfigStep.js';\n\nexport class LogoutHandler implements LogoutCommand {\n private steps: CommandStep<LogoutContext>[];\n\n constructor(private readonly gcloudService: GcloudService = new GcloudHandler()) {\n this.steps = [\n new PrepareStep(),\n new RevokeUserStep(),\n new RevokeAdcStep(),\n new ClearConfigStep(),\n ];\n }\n\n async execute(input: LogoutInput): Promise<LogoutResult> {\n const context: LogoutContext = {\n input,\n ui: new ConsoleUI(),\n gcloudService: this.gcloudService,\n userRevoked: false,\n adcRevoked: false,\n configCleared: false,\n };\n\n console.log(`\\n${theme.blue('Logout from Google Cloud')}\\n`);\n\n try {\n const { stoppedAt } = await runSteps(this.steps, context, {\n onAfterStep: (_step, result) => {\n if (!result.success && result.errorCode === 'GCLOUD_NOT_FOUND') return true;\n if (result.shouldExit) return true;\n return false;\n },\n });\n\n if (stoppedAt) {\n if (stoppedAt.result.errorCode === 'GCLOUD_NOT_FOUND') {\n return {\n success: false,\n error: {\n code: 'GCLOUD_NOT_FOUND',\n message: stoppedAt.result.error?.message || 'Gcloud not found',\n recoverable: true,\n },\n };\n }\n // shouldExit case — successful early exit\n return {\n success: true,\n data: {\n userRevoked: context.userRevoked,\n adcRevoked: context.adcRevoked,\n configCleared: context.configCleared,\n },\n };\n }\n\n console.log(`\\n${theme.green('Successfully logged out!')}\\n`);\n console.log(theme.gray('To log back in, run:'));\n console.log(theme.cyan(' stitch-mcp init\\n'));\n\n return {\n success: true,\n data: {\n userRevoked: context.userRevoked,\n adcRevoked: context.adcRevoked,\n configCleared: context.configCleared,\n },\n };\n\n } catch (error) {\n return {\n success: false,\n error: {\n code: 'UNKNOWN_ERROR',\n message: error instanceof Error ? error.message : String(error),\n recoverable: false,\n },\n };\n }\n }\n}\n"
|
|
10
|
+
],
|
|
11
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAGO,MAAM,YAAkD;AAAA,EAC7D,KAAK;AAAA,EACL,OAAO;AAAA,OAED,UAAS,CAAC,SAA0C;AAAA,IACxD,OAAO;AAAA;AAAA,OAGH,IAAG,CAAC,SAA6C;AAAA,IAErD,MAAM,SAAS,MAAM,QAAQ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;AAAA,YACpB,eAAe,QAAQ;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AAAA,MAEA,QAAQ,IAAI;AAAA,EAAK,MAAM,MAAM,0BAA0B;AAAA,CAAK;AAAA,MAC5D,QAAQ,IAAI,MAAM,KAAK,sBAAsB,CAAC;AAAA,MAC9C,QAAQ,IAAI,MAAM,KAAK;AAAA,CAAqB,CAAC;AAAA,MAE7C,OAAO;AAAA,QACL,SAAS;AAAA,QACT,MAAM;AAAA,UACJ,aAAa,QAAQ;AAAA,UACrB,YAAY,QAAQ;AAAA,UACpB,eAAe,QAAQ;AAAA,QACzB;AAAA,MACF;AAAA,MAEA,OAAO,OAAO;AAAA,MACd,OAAO;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL,MAAM;AAAA,UACN,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,UAC9D,aAAa;AAAA,QACf;AAAA,MACF;AAAA;AAAA;AAGN;",
|
|
12
|
+
"debugId": "90DBA33599959FD564756E2164756E21",
|
|
13
|
+
"names": []
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SiteBuilder
|
|
3
|
+
} from "./chunk-wzkdeb8a.js";
|
|
4
|
+
import"./chunk-krfqppg2.js";
|
|
5
|
+
import"./chunk-nv2j020p.js";
|
|
6
|
+
import"./chunk-w8q7nsm7.js";
|
|
7
|
+
import"./chunk-f1kjn6cd.js";
|
|
8
|
+
import"./chunk-4jwmvjb4.js";
|
|
9
|
+
import"./chunk-6gw9apqb.js";
|
|
10
|
+
import"./chunk-a5xra9jn.js";
|
|
11
|
+
import"./chunk-nq68kghz.js";
|
|
12
|
+
import"./chunk-hc7sdwmn.js";
|
|
13
|
+
import"./chunk-3sfn889r.js";
|
|
14
|
+
import"./chunk-9wyra8hs.js";
|
|
15
|
+
export {
|
|
16
|
+
SiteBuilder
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//# debugId=1C4BD3D870A3482964756E2164756E21
|